1
0
mirror of synced 2024-12-21 03:55:56 +01:00
ImHex/plugins/disassembler/source/plugin_disassembler.cpp

44 lines
1.1 KiB
C++

#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 &, 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();
}