feat: Add endian option to Sum hash

This commit is contained in:
WerWolv
2025-12-07 22:18:34 +01:00
parent 994df0a3a4
commit 6427f53b5a
6 changed files with 64 additions and 32 deletions

View File

@@ -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);
}

View File

@@ -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;
}
}