1
0
mirror of synced 2025-01-11 05:42:15 +01:00

feat: Added Disassemble selection option to the Edit menu

#1994
This commit is contained in:
WerWolv 2024-12-09 21:35:08 +01:00
parent cb6b74b269
commit 1e71d8afc0
2 changed files with 14 additions and 0 deletions

View File

@ -122,6 +122,7 @@
"hex.builtin.menu.file.clear_recent": "Clear", "hex.builtin.menu.file.clear_recent": "Clear",
"hex.builtin.menu.file.close": "Close", "hex.builtin.menu.file.close": "Close",
"hex.builtin.menu.file.create_file": "New File...", "hex.builtin.menu.file.create_file": "New File...",
"hex.builtin.menu.edit.disassemble_range": "Disassemble selection",
"hex.builtin.menu.file.export": "Export...", "hex.builtin.menu.file.export": "Export...",
"hex.builtin.menu.file.export.as_language": "Text Formatted Bytes", "hex.builtin.menu.file.export.as_language": "Text Formatted Bytes",
"hex.builtin.menu.file.export.as_language.popup.export_error": "Failed to export bytes to the file!", "hex.builtin.menu.file.export.as_language.popup.export_error": "Failed to export bytes to the file!",

View File

@ -1,4 +1,5 @@
#include "content/views/view_disassembler.hpp" #include "content/views/view_disassembler.hpp"
#include "hex/api/content_registry.hpp"
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
#include <hex/helpers/fmt.hpp> #include <hex/helpers/fmt.hpp>
@ -16,6 +17,18 @@ namespace hex::plugin::disasm {
EventProviderDeleted::subscribe(this, [this](const auto*) { EventProviderDeleted::subscribe(this, [this](const auto*) {
m_disassembly.clear(); m_disassembly.clear();
}); });
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.menu.edit.disassemble_range" }, ICON_VS_DEBUG_LINE_BY_LINE, 3100, CTRLCMD + SHIFT + Keys::D, [this] {
ImGui::SetWindowFocus(this->getName().c_str());
this->getWindowOpenState() = true;
m_range = ui::RegionType::Region;
m_codeRegion = ImHexApi::HexEditor::getSelection()->getRegion();
this->disassemble();
}, [this]{
return ImHexApi::HexEditor::isSelectionValid() && !this->m_disassemblerTask.isRunning();
});
} }
ViewDisassembler::~ViewDisassembler() { ViewDisassembler::~ViewDisassembler() {