WerWolv / ImHex

🔍 A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.
https://imhex.werwolv.net
GNU General Public License v2.0
43.94k stars 1.92k forks source link

[Bug] Disassembler always disassembles as little endian #1763

Closed imaandrew closed 3 months ago

imaandrew commented 3 months ago

Operating System

Windows

What's the issue you encountered?

The disassembler plugin will always disassemble bytes in little endian format even if the big endian option is selected.

In view_disassembler.cpp, the endianness choice is stored in the littleEndian variable:

// Draw endian radio buttons. This setting is available for all architectures
static int littleEndian = true;
ImGui::RadioButton("hex.ui.common.little_endian"_lang, &littleEndian, true);
ImGui::SameLine();
ImGui::RadioButton("hex.ui.common.big_endian"_lang, &littleEndian, false);

but the littleEndian variable is never referenced when setting m_mode

How can the issue be reproduced?

These bytes should be disassembled as lui $v1, 0x8000 in big endian format, but they get disassembled to raw bytes regardless of if big endian or little endian is selected

These bytes will now disassemble to lui $v1, 0x8000 regardless of if big endian or little endian is selected

ImHex Version

1.34.0

ImHex Build Type

Installation type

MSI

Additional context?

No response