feature: Added Invert option to data inspector
This commit is contained in:
parent
b751f98e91
commit
ffb9a8b7ed
@ -29,6 +29,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
std::endian m_endian = std::endian::native;
|
std::endian m_endian = std::endian::native;
|
||||||
ContentRegistry::DataInspector::NumberDisplayStyle m_numberDisplayStyle = ContentRegistry::DataInspector::NumberDisplayStyle::Decimal;
|
ContentRegistry::DataInspector::NumberDisplayStyle m_numberDisplayStyle = ContentRegistry::DataInspector::NumberDisplayStyle::Decimal;
|
||||||
|
bool m_invert = false;
|
||||||
|
|
||||||
u64 m_startAddress = 0;
|
u64 m_startAddress = 0;
|
||||||
size_t m_validBytes = 0;
|
size_t m_validBytes = 0;
|
||||||
|
@ -42,6 +42,11 @@ namespace hex::plugin::builtin {
|
|||||||
std::vector<u8> buffer(entry.requiredSize);
|
std::vector<u8> buffer(entry.requiredSize);
|
||||||
provider->read(this->m_startAddress, buffer.data(), buffer.size());
|
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 });
|
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 {
|
} else {
|
||||||
std::string text = "hex.builtin.view.data_inspector.no_data"_lang;
|
std::string text = "hex.builtin.view.data_inspector.no_data"_lang;
|
||||||
auto textSize = ImGui::CalcTextSize(text.c_str());
|
auto textSize = ImGui::CalcTextSize(text.c_str());
|
||||||
|
@ -137,6 +137,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.view.data_inspector.table.name", "Name" },
|
{ "hex.builtin.view.data_inspector.table.name", "Name" },
|
||||||
{ "hex.builtin.view.data_inspector.table.value", "Wert" },
|
{ "hex.builtin.view.data_inspector.table.value", "Wert" },
|
||||||
{ "hex.builtin.view.data_inspector.no_data", "Keine bytes angewählt"},
|
{ "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.name", "Datenprozessor" },
|
||||||
{ "hex.builtin.view.data_processor.help_text", "Rechtsklicken um neuen Knoten zu erstellen" },
|
{ "hex.builtin.view.data_processor.help_text", "Rechtsklicken um neuen Knoten zu erstellen" },
|
||||||
|
@ -138,7 +138,8 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.view.data_inspector.name", "Data Inspector" },
|
{ "hex.builtin.view.data_inspector.name", "Data Inspector" },
|
||||||
{ "hex.builtin.view.data_inspector.table.name", "Name" },
|
{ "hex.builtin.view.data_inspector.table.name", "Name" },
|
||||||
{ "hex.builtin.view.data_inspector.table.value", "Value" },
|
{ "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.name", "Data Processor" },
|
||||||
{ "hex.builtin.view.data_processor.help_text", "Right click to add a new node" },
|
{ "hex.builtin.view.data_processor.help_text", "Right click to add a new node" },
|
||||||
|
@ -139,7 +139,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.view.data_inspector.table.name", "Nome" },
|
{ "hex.builtin.view.data_inspector.table.name", "Nome" },
|
||||||
{ "hex.builtin.view.data_inspector.table.value", "Valore" },
|
{ "hex.builtin.view.data_inspector.table.value", "Valore" },
|
||||||
{ "hex.builtin.view.data_inspector.no_data", "Nessun byte selezionato"},
|
{ "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.name", "Processa Dati" },
|
||||||
//{ "hex.builtin.view.data_processor.help_text", "Right click to add a new node" },
|
//{ "hex.builtin.view.data_processor.help_text", "Right click to add a new node" },
|
||||||
|
@ -139,6 +139,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.view.data_inspector.table.name", "名前" },
|
{ "hex.builtin.view.data_inspector.table.name", "名前" },
|
||||||
{ "hex.builtin.view.data_inspector.table.value", "値" },
|
{ "hex.builtin.view.data_inspector.table.value", "値" },
|
||||||
{ "hex.builtin.view.data_inspector.no_data", "範囲が選択されていません"},
|
{ "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.name", "データプロセッサ" },
|
||||||
//{ "hex.builtin.view.data_processor.help_text", "Right click to add a new node" },
|
//{ "hex.builtin.view.data_processor.help_text", "Right click to add a new node" },
|
||||||
|
@ -138,6 +138,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.view.data_inspector.table.name", "名称" },
|
{ "hex.builtin.view.data_inspector.table.name", "名称" },
|
||||||
{ "hex.builtin.view.data_inspector.table.value", "值" },
|
{ "hex.builtin.view.data_inspector.table.value", "值" },
|
||||||
{ "hex.builtin.view.data_inspector.no_data", "没有选中字节"},
|
{ "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.name", "数据处理器" },
|
||||||
{ "hex.builtin.view.data_processor.help_text", "右键以添加新的节点" },
|
{ "hex.builtin.view.data_processor.help_text", "右键以添加新的节点" },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user