mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 15:57:03 -05:00
refactor: Rework features that use external libraries into optional plugins (#1470)
This commit is contained in:
43
plugins/disassembler/source/plugin_disassembler.cpp
Normal file
43
plugins/disassembler/source/plugin_disassembler.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include <hex/plugin.hpp>
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/helpers/logger.hpp>
|
||||
|
||||
#include <pl/api.hpp>
|
||||
|
||||
#include <romfs/romfs.hpp>
|
||||
|
||||
#include "content/views/view_disassembler.hpp"
|
||||
|
||||
using namespace hex;
|
||||
using namespace hex::plugin::disasm;
|
||||
|
||||
namespace hex::plugin::disasm {
|
||||
|
||||
void drawDisassemblyVisualizer(pl::ptrn::Pattern &, pl::ptrn::IIterable &, bool, std::span<const pl::core::Token::Literal> arguments);
|
||||
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
void registerViews() {
|
||||
ContentRegistry::Views::add<ViewDisassembler>();
|
||||
}
|
||||
|
||||
void registerPlVisualizers() {
|
||||
using ParamCount = pl::api::FunctionParameterCount;
|
||||
|
||||
ContentRegistry::PatternLanguage::addVisualizer("disassembler", drawDisassemblyVisualizer, ParamCount::exactly(4));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
IMHEX_PLUGIN_SETUP("Disassembler", "WerWolv", "Disassembler support") {
|
||||
hex::log::debug("Using romfs: '{}'", romfs::name());
|
||||
for (auto &path : romfs::list("lang"))
|
||||
hex::ContentRegistry::Language::addLocalization(nlohmann::json::parse(romfs::get(path).string()));
|
||||
|
||||
registerViews();
|
||||
registerPlVisualizers();
|
||||
}
|
||||
Reference in New Issue
Block a user