1
0
mirror of synced 2024-11-27 09:00:52 +01:00
ImHex/plugins/builtin/source/content/pl_pragmas.cpp

24 lines
733 B
C++
Raw Normal View History

#include <hex/api/content_registry.hpp>
#include <hex/providers/provider.hpp>
#include <pl/core/evaluator.hpp>
namespace hex::plugin::builtin {
void registerPatternLanguagePragmas() {
ContentRegistry::PatternLanguage::addPragma("base_address", [](pl::PatternLanguage &runtime, const std::string &value) {
hex::unused(runtime);
auto baseAddress = strtoull(value.c_str(), nullptr, 0);
ImHexApi::Provider::get()->setBaseAddress(baseAddress);
runtime.setDataBaseAddress(baseAddress);
return true;
});
ContentRegistry::PatternLanguage::addPragma("MIME", [](pl::PatternLanguage&, const std::string &value) { return !value.empty(); });
}
}