mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-01 21:17:44 -05:00
feat: Add endian option to Sum hash
This commit is contained in:
@@ -15,5 +15,6 @@ namespace hex::ui {
|
||||
};
|
||||
|
||||
void regionSelectionPicker(Region *region, prv::Provider *provider, RegionType *type, bool showHeader = true, bool firstEntry = false);
|
||||
bool endiannessSlider(std::endian &endian);
|
||||
|
||||
}
|
||||
@@ -69,4 +69,37 @@ namespace hex::ui {
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
|
||||
bool endiannessSlider(std::endian &endian) {
|
||||
int selection = [&] {
|
||||
switch (endian) {
|
||||
default:
|
||||
case std::endian::little:
|
||||
return 0;
|
||||
case std::endian::big:
|
||||
return 1;
|
||||
}
|
||||
}();
|
||||
|
||||
std::array options = {
|
||||
fmt::format("{}: {}", "hex.ui.common.endian"_lang, "hex.ui.common.little"_lang),
|
||||
fmt::format("{}: {}", "hex.ui.common.endian"_lang, "hex.ui.common.big"_lang)
|
||||
};
|
||||
|
||||
if (ImGui::SliderInt("##endian", &selection, 0, options.size() - 1, options[selection].c_str(), ImGuiSliderFlags_NoInput)) {
|
||||
switch (selection) {
|
||||
default:
|
||||
case 0:
|
||||
endian = std::endian::little;
|
||||
break;
|
||||
case 1:
|
||||
endian = std::endian::big;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user