diff --git a/plugins/builtin/romfs/lang/en_US.json b/plugins/builtin/romfs/lang/en_US.json index 51e2730c6..bc5f9d054 100644 --- a/plugins/builtin/romfs/lang/en_US.json +++ b/plugins/builtin/romfs/lang/en_US.json @@ -636,6 +636,7 @@ "hex.builtin.tools.ieee754.mantissa_size": "Mantissa Size", "hex.builtin.tools.ieee754.result.float": "Floating Point Result", "hex.builtin.tools.ieee754.result.hex": "Hexadecimal Result", + "hex.builtin.tools.ieee754.quarter_precision": "Quarter Precision", "hex.builtin.tools.ieee754.result.title": "Result", "hex.builtin.tools.ieee754.settings.display_mode.detailed": "Detailed", "hex.builtin.tools.ieee754.settings.display_mode.simplified": "Simplified", diff --git a/plugins/builtin/source/content/tools/ieee_decoder.cpp b/plugins/builtin/source/content/tools/ieee_decoder.cpp index ee97bca38..ee83a0b46 100644 --- a/plugins/builtin/source/content/tools/ieee_decoder.cpp +++ b/plugins/builtin/source/content/tools/ieee_decoder.cpp @@ -24,12 +24,7 @@ namespace hex::plugin::builtin { class IEEE754STATICS { public: - IEEE754STATICS() { - value = 0; - exponentBitCount = 8; - mantissaBitCount = 23; - resultFloat = 0; - } + IEEE754STATICS() : value(0), exponentBitCount(8), mantissaBitCount(23), resultFloat(0) {} u128 value; i32 exponentBitCount; @@ -567,6 +562,19 @@ namespace hex::plugin::builtin { auto color = ImGui::GetColorU32(ImGuiCol_ButtonActive); bool needsPop = false; + if (ieee754statics.exponentBitCount == 3 && ieee754statics.mantissaBitCount == 4) { + ImGui::PushStyleColor(ImGuiCol_Button, color); + needsPop = true; + } + if (ImGui::Button("hex.builtin.tools.ieee754.quarter_precision"_lang)) { + ieee754statics.exponentBitCount = 3; + ieee754statics.mantissaBitCount = 4; + inputFieldWidth = 0; + } + if (needsPop) ImGui::PopStyleColor(); + + ImGui::SameLine(); + needsPop = false; if (ieee754statics.exponentBitCount == 5 && ieee754statics.mantissaBitCount == 10) { ImGui::PushStyleColor(ImGuiCol_Button, color); needsPop = true;