impr: Modernize the disassembler, hashes and yara view
This commit is contained in:
parent
aad6f6bcbe
commit
512fcd361b
@ -512,7 +512,9 @@ namespace ImGuiExt {
|
|||||||
PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0F);
|
PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0F);
|
||||||
|
|
||||||
PushStyleColor(ImGuiCol_Text, iconColor);
|
PushStyleColor(ImGuiCol_Text, iconColor);
|
||||||
|
ImGui::PushID(text);
|
||||||
Button(icon);
|
Button(icon);
|
||||||
|
ImGui::PopID();
|
||||||
PopStyleColor();
|
PopStyleColor();
|
||||||
|
|
||||||
if (IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
|
if (IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"hex.disassembler.view.disassembler.bpf.classic": "Classic",
|
"hex.disassembler.view.disassembler.bpf.classic": "Classic",
|
||||||
"hex.disassembler.view.disassembler.bpf.extended": "Extended",
|
"hex.disassembler.view.disassembler.bpf.extended": "Extended",
|
||||||
"hex.disassembler.view.disassembler.image_base_address": "Image Base Address",
|
"hex.disassembler.view.disassembler.image_base_address": "Image Base Address",
|
||||||
|
"hex.disassembler.view.disassembler.image_base_address.hint": "This is the start address of the code region in the loaded data. For example the begin of the .text section",
|
||||||
"hex.disassembler.view.disassembler.disassemble": "Disassemble",
|
"hex.disassembler.view.disassembler.disassemble": "Disassemble",
|
||||||
"hex.disassembler.view.disassembler.disassembling": "Disassembling...",
|
"hex.disassembler.view.disassembler.disassembling": "Disassembling...",
|
||||||
"hex.disassembler.view.disassembler.disassembly.address": "Address",
|
"hex.disassembler.view.disassembler.disassembly.address": "Address",
|
||||||
@ -25,6 +26,7 @@
|
|||||||
"hex.disassembler.view.disassembler.export": "Export instructions as...",
|
"hex.disassembler.view.disassembler.export": "Export instructions as...",
|
||||||
"hex.disassembler.view.disassembler.export.popup.error": "Failed to export to ASM file!",
|
"hex.disassembler.view.disassembler.export.popup.error": "Failed to export to ASM file!",
|
||||||
"hex.disassembler.view.disassembler.image_load_address": "Image Load Address",
|
"hex.disassembler.view.disassembler.image_load_address": "Image Load Address",
|
||||||
|
"hex.disassembler.view.disassembler.image_load_address.hint": "This is the address of where the disassembled code is being loaded into memory before it's being executed",
|
||||||
"hex.disassembler.view.disassembler.m680x.6301": "6301",
|
"hex.disassembler.view.disassembler.m680x.6301": "6301",
|
||||||
"hex.disassembler.view.disassembler.m680x.6309": "6309",
|
"hex.disassembler.view.disassembler.m680x.6309": "6309",
|
||||||
"hex.disassembler.view.disassembler.m680x.6800": "6800",
|
"hex.disassembler.view.disassembler.m680x.6800": "6800",
|
||||||
|
@ -145,11 +145,15 @@ namespace hex::plugin::disasm {
|
|||||||
|
|
||||||
// Draw base address input
|
// Draw base address input
|
||||||
ImGuiExt::InputHexadecimal("hex.disassembler.view.disassembler.image_load_address"_lang, &m_imageLoadAddress, ImGuiInputTextFlags_CharsHexadecimal);
|
ImGuiExt::InputHexadecimal("hex.disassembler.view.disassembler.image_load_address"_lang, &m_imageLoadAddress, ImGuiInputTextFlags_CharsHexadecimal);
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGuiExt::HelpHover("hex.disassembler.view.disassembler.image_load_address.hint"_lang, ICON_VS_INFO);
|
||||||
|
|
||||||
// Draw code region start address input
|
// Draw code region start address input
|
||||||
ImGui::BeginDisabled(m_range == ui::RegionType::EntireData);
|
ImGui::BeginDisabled(m_range == ui::RegionType::EntireData);
|
||||||
{
|
{
|
||||||
ImGuiExt::InputHexadecimal("hex.disassembler.view.disassembler.image_base_address"_lang, &m_imageBaseAddress, ImGuiInputTextFlags_CharsHexadecimal);
|
ImGuiExt::InputHexadecimal("hex.disassembler.view.disassembler.image_base_address"_lang, &m_imageBaseAddress, ImGuiInputTextFlags_CharsHexadecimal);
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGuiExt::HelpHover("hex.disassembler.view.disassembler.image_base_address.hint"_lang, ICON_VS_INFO);
|
||||||
}
|
}
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
@ -428,14 +432,14 @@ namespace hex::plugin::disasm {
|
|||||||
m_mode = cs_mode(u32(m_mode) | CS_MODE_BIG_ENDIAN);
|
m_mode = cs_mode(u32(m_mode) | CS_MODE_BIG_ENDIAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiExt::EndBox();
|
|
||||||
}
|
}
|
||||||
|
ImGuiExt::EndBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw disassemble button
|
// Draw disassemble button
|
||||||
ImGui::BeginDisabled(m_disassemblerTask.isRunning() || m_regionToDisassemble.getStartAddress() < m_imageBaseAddress);
|
ImGui::BeginDisabled(m_disassemblerTask.isRunning() || m_regionToDisassemble.getStartAddress() < m_imageBaseAddress);
|
||||||
{
|
{
|
||||||
if (ImGui::Button("hex.disassembler.view.disassembler.disassemble"_lang))
|
if (ImGuiExt::DimmedButton("hex.disassembler.view.disassembler.disassemble"_lang))
|
||||||
this->disassemble();
|
this->disassemble();
|
||||||
}
|
}
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
"hex.hashes.view.hashes.hover_info": "Hover over the Hex Editor selection and hold down SHIFT to view the hashes of that region.",
|
"hex.hashes.view.hashes.hover_info": "Hover over the Hex Editor selection and hold down SHIFT to view the hashes of that region.",
|
||||||
"hex.hashes.view.hashes.name": "Hashes",
|
"hex.hashes.view.hashes.name": "Hashes",
|
||||||
"hex.hashes.view.hashes.no_settings": "No settings available",
|
"hex.hashes.view.hashes.no_settings": "No settings available",
|
||||||
|
"hex.hashes.view.hashes.add": "Add hash",
|
||||||
"hex.hashes.view.hashes.remove": "Remove hash",
|
"hex.hashes.view.hashes.remove": "Remove hash",
|
||||||
|
"hex.hashes.view.hashes.hash_name": "Hash Name",
|
||||||
"hex.hashes.view.hashes.table.name": "Name",
|
"hex.hashes.view.hashes.table.name": "Name",
|
||||||
"hex.hashes.view.hashes.table.result": "Result",
|
"hex.hashes.view.hashes.table.result": "Result",
|
||||||
"hex.hashes.view.hashes.table.type": "Type",
|
"hex.hashes.view.hashes.table.type": "Type",
|
||||||
|
@ -152,8 +152,16 @@ namespace hex::plugin::hashes {
|
|||||||
m_selectedHash = hashes.front().get();
|
m_selectedHash = hashes.front().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginCombo("hex.hashes.view.hashes.function"_lang, m_selectedHash != nullptr ? Lang(m_selectedHash->getUnlocalizedName()) : "")) {
|
if (ImGuiExt::DimmedButton("hex.hashes.view.hashes.add"_lang)) {
|
||||||
|
ImGui::OpenPopup("##CreateHash");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::BeginPopup("##CreateHash")) {
|
||||||
|
ImGuiExt::InputTextIcon("hex.hashes.view.hashes.hash_name"_lang, ICON_VS_SYMBOL_KEY, m_newHashName);
|
||||||
|
|
||||||
|
ImGui::NewLine();
|
||||||
|
|
||||||
|
if (ImGui::BeginCombo("hex.hashes.view.hashes.function"_lang, m_selectedHash != nullptr ? Lang(m_selectedHash->getUnlocalizedName()) : "")) {
|
||||||
for (const auto &hash : hashes) {
|
for (const auto &hash : hashes) {
|
||||||
if (ImGui::Selectable(Lang(hash->getUnlocalizedName()), m_selectedHash == hash.get())) {
|
if (ImGui::Selectable(Lang(hash->getUnlocalizedName()), m_selectedHash == hash.get())) {
|
||||||
m_selectedHash = hash.get();
|
m_selectedHash = hash.get();
|
||||||
@ -167,7 +175,7 @@ namespace hex::plugin::hashes {
|
|||||||
if (m_newHashName.empty() && m_selectedHash != nullptr)
|
if (m_newHashName.empty() && m_selectedHash != nullptr)
|
||||||
m_newHashName = hex::format("{} {}", Lang(m_selectedHash->getUnlocalizedName()), static_cast<const char *>("hex.hashes.view.hashes.hash"_lang));
|
m_newHashName = hex::format("{} {}", Lang(m_selectedHash->getUnlocalizedName()), static_cast<const char *>("hex.hashes.view.hashes.hash"_lang));
|
||||||
|
|
||||||
if (ImGui::BeginChild("##settings", ImVec2(ImGui::GetContentRegionAvail().x, 200_scaled), true)) {
|
if (ImGuiExt::BeginSubWindow("hex.builtin.common.settings"_lang, nullptr, scaled({ 400, 200 }))) {
|
||||||
if (m_selectedHash != nullptr) {
|
if (m_selectedHash != nullptr) {
|
||||||
auto startPos = ImGui::GetCursorPosY();
|
auto startPos = ImGui::GetCursorPosY();
|
||||||
m_selectedHash->draw();
|
m_selectedHash->draw();
|
||||||
@ -178,22 +186,22 @@ namespace hex::plugin::hashes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGuiExt::EndSubWindow();
|
||||||
|
|
||||||
|
|
||||||
ImGuiExt::InputTextIcon("##hash_name", ICON_VS_SYMBOL_KEY, m_newHashName);
|
|
||||||
ImGui::SameLine();
|
|
||||||
|
|
||||||
ImGui::BeginDisabled(m_newHashName.empty() || m_selectedHash == nullptr);
|
ImGui::BeginDisabled(m_newHashName.empty() || m_selectedHash == nullptr);
|
||||||
if (ImGuiExt::IconButton(ICON_VS_ADD, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
if (ImGuiExt::DimmedButton("hex.hashes.view.hashes.add"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0))) {
|
||||||
if (m_selectedHash != nullptr) {
|
if (m_selectedHash != nullptr) {
|
||||||
m_hashFunctions->push_back(m_selectedHash->create(m_newHashName));
|
m_hashFunctions->push_back(m_selectedHash->create(m_newHashName));
|
||||||
AchievementManager::unlockAchievement("hex.builtin.achievement.misc", "hex.hashes.achievement.misc.create_hash.name");
|
AchievementManager::unlockAchievement("hex.builtin.achievement.misc", "hex.hashes.achievement.misc.create_hash.name");
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SameLine(0, 10_scaled);
|
||||||
ImGuiExt::HelpHover("hex.hashes.view.hashes.hover_info"_lang, ICON_VS_INFO);
|
ImGuiExt::HelpHover("hex.hashes.view.hashes.hover_info"_lang, ICON_VS_INFO);
|
||||||
|
|
||||||
if (ImGui::BeginTable("##hashes", 4, ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Borders | ImGuiTableFlags_ScrollY)) {
|
if (ImGui::BeginTable("##hashes", 4, ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Borders | ImGuiTableFlags_ScrollY)) {
|
||||||
@ -247,7 +255,7 @@ namespace hex::plugin::hashes {
|
|||||||
PopupTextHash::open(function);
|
PopupTextHash::open(function);
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGuiExt::IconButton(ICON_VS_X, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) {
|
if (ImGuiExt::IconButton(ICON_VS_X, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||||
indexToRemove = i;
|
indexToRemove = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,15 +163,18 @@ namespace hex::plugin::yara {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
ImGui::BeginDisabled(*m_selectedRule >= m_rulePaths->size());
|
||||||
if (ImGuiExt::IconButton(ICON_VS_REMOVE, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
if (ImGuiExt::IconButton(ICON_VS_REMOVE, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||||
if (*m_selectedRule < m_rulePaths->size()) {
|
|
||||||
m_rulePaths->erase(m_rulePaths->begin() + *m_selectedRule);
|
m_rulePaths->erase(m_rulePaths->begin() + *m_selectedRule);
|
||||||
m_selectedRule = std::min(*m_selectedRule, u32(m_rulePaths->size() - 1));
|
m_selectedRule = std::min(*m_selectedRule, u32(m_rulePaths->size() - 1));
|
||||||
}
|
}
|
||||||
}
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
ImGui::NewLine();
|
ImGui::NewLine();
|
||||||
if (ImGui::Button("hex.yara_rules.view.yara.match"_lang)) this->applyRules();
|
|
||||||
|
ImGui::BeginDisabled(m_rulePaths->empty());
|
||||||
|
if (ImGuiExt::DimmedButton("hex.yara_rules.view.yara.match"_lang)) this->applyRules();
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
if (m_matcherTask.isRunning()) {
|
if (m_matcherTask.isRunning()) {
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user