2022-04-17 16:57:30 +02:00
|
|
|
#include <hex/api/content_registry.hpp>
|
|
|
|
#include <hex/providers/provider.hpp>
|
2023-01-09 08:38:19 +01:00
|
|
|
#include <hex/helpers/magic.hpp>
|
2022-04-17 16:57:30 +02:00
|
|
|
|
2022-08-06 21:38:09 +02:00
|
|
|
#include <pl/core/evaluator.hpp>
|
2022-04-17 16:57:30 +02:00
|
|
|
|
|
|
|
namespace hex::plugin::builtin {
|
|
|
|
|
|
|
|
void registerPatternLanguagePragmas() {
|
|
|
|
|
|
|
|
ContentRegistry::PatternLanguage::addPragma("base_address", [](pl::PatternLanguage &runtime, const std::string &value) {
|
|
|
|
auto baseAddress = strtoull(value.c_str(), nullptr, 0);
|
|
|
|
|
|
|
|
ImHexApi::Provider::get()->setBaseAddress(baseAddress);
|
2022-08-28 17:53:33 +02:00
|
|
|
runtime.setDataBaseAddress(baseAddress);
|
|
|
|
|
2022-04-17 16:57:30 +02:00
|
|
|
return true;
|
|
|
|
});
|
|
|
|
|
2023-01-09 08:38:19 +01:00
|
|
|
ContentRegistry::PatternLanguage::addPragma("MIME", [](pl::PatternLanguage&, const std::string &value) {
|
|
|
|
return magic::isValidMIMEType(value);
|
|
|
|
});
|
2022-04-17 16:57:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|