1
0
mirror of synced 2025-01-31 03:53:44 +01:00

feature: Added Invert option to data inspector

This commit is contained in:
WerWolv 2022-05-27 20:46:16 +02:00
parent b751f98e91
commit ffb9a8b7ed
7 changed files with 23 additions and 2 deletions

View File

@ -29,6 +29,7 @@ namespace hex::plugin::builtin {
std::endian m_endian = std::endian::native;
ContentRegistry::DataInspector::NumberDisplayStyle m_numberDisplayStyle = ContentRegistry::DataInspector::NumberDisplayStyle::Decimal;
bool m_invert = false;
u64 m_startAddress = 0;
size_t m_validBytes = 0;

View File

@ -42,6 +42,11 @@ namespace hex::plugin::builtin {
std::vector<u8> buffer(entry.requiredSize);
provider->read(this->m_startAddress, buffer.data(), buffer.size());
if (this->m_invert) {
for (auto &byte : buffer)
byte ^= 0xFF;
}
this->m_cachedData.push_back({ entry.unlocalizedName, entry.generatorFunction(buffer, this->m_endian, this->m_numberDisplayStyle), entry.editingFunction, false });
}
}
@ -154,6 +159,17 @@ namespace hex::plugin::builtin {
}
}
}
{
int selection = this->m_invert ? 1 : 0;
std::array options = { "hex.builtin.common.no"_lang, "hex.builtin.common.yes"_lang };
if (ImGui::SliderInt("hex.builtin.view.data_inspector.invert"_lang, &selection, 0, options.size() - 1, options[selection], ImGuiSliderFlags_NoInput)) {
this->m_shouldInvalidate = true;
this->m_invert = selection == 1;
}
}
} else {
std::string text = "hex.builtin.view.data_inspector.no_data"_lang;
auto textSize = ImGui::CalcTextSize(text.c_str());

View File

@ -137,6 +137,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.data_inspector.table.name", "Name" },
{ "hex.builtin.view.data_inspector.table.value", "Wert" },
{ "hex.builtin.view.data_inspector.no_data", "Keine bytes angewählt"},
{ "hex.builtin.view.data_inspector.invert", "Invertieren" },
{ "hex.builtin.view.data_processor.name", "Datenprozessor" },
{ "hex.builtin.view.data_processor.help_text", "Rechtsklicken um neuen Knoten zu erstellen" },

View File

@ -138,7 +138,8 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.data_inspector.name", "Data Inspector" },
{ "hex.builtin.view.data_inspector.table.name", "Name" },
{ "hex.builtin.view.data_inspector.table.value", "Value" },
{ "hex.builtin.view.data_inspector.no_data", "No bytes selected"},
{ "hex.builtin.view.data_inspector.no_data", "No bytes selected" },
{ "hex.builtin.view.data_inspector.invert", "Invert" },
{ "hex.builtin.view.data_processor.name", "Data Processor" },
{ "hex.builtin.view.data_processor.help_text", "Right click to add a new node" },

View File

@ -139,7 +139,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.data_inspector.table.name", "Nome" },
{ "hex.builtin.view.data_inspector.table.value", "Valore" },
{ "hex.builtin.view.data_inspector.no_data", "Nessun byte selezionato"},
//{ "hex.builtin.view.data_inspector.invert", "Invert" },
{ "hex.builtin.view.data_processor.name", "Processa Dati" },
//{ "hex.builtin.view.data_processor.help_text", "Right click to add a new node" },

View File

@ -139,6 +139,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.data_inspector.table.name", "名前" },
{ "hex.builtin.view.data_inspector.table.value", "" },
{ "hex.builtin.view.data_inspector.no_data", "範囲が選択されていません"},
//{ "hex.builtin.view.data_inspector.invert", "Invert" },
{ "hex.builtin.view.data_processor.name", "データプロセッサ" },
//{ "hex.builtin.view.data_processor.help_text", "Right click to add a new node" },

View File

@ -138,6 +138,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.data_inspector.table.name", "名称" },
{ "hex.builtin.view.data_inspector.table.value", "" },
{ "hex.builtin.view.data_inspector.no_data", "没有选中字节"},
//{ "hex.builtin.view.data_inspector.invert", "Invert" },
{ "hex.builtin.view.data_processor.name", "数据处理器" },
{ "hex.builtin.view.data_processor.help_text", "右键以添加新的节点" },