impr: Make script loaders be initialized synchronously

This commit is contained in:
WerWolv 2023-07-21 20:25:56 +02:00
parent f6bbfd7283
commit c294619102
2 changed files with 16 additions and 9 deletions

View file

@ -121,7 +121,7 @@ namespace hex::script::loader {
result = hostfxr_get_runtime_delegate(
ctx,
hdt_load_assembly_and_get_function_pointer,
hostfxr_delegate_type::hdt_load_assembly_and_get_function_pointer,
(void**)&loadAssemblyFunction
);

View file

@ -68,14 +68,7 @@ namespace {
return count > 0;
}
}
IMHEX_PLUGIN_SETUP("Script Loader", "WerWolv", "Script Loader plugin") {
hex::log::debug("Using romfs: '{}'", romfs::name());
for (auto &path : romfs::list("lang"))
hex::ContentRegistry::Language::addLocalization(nlohmann::json::parse(romfs::get(path).string()));
if (initializeAllLoaders()) {
void addScriptsMenu() {
static TaskHolder runnerTask, updaterTask;
hex::ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.extras" }, 5000, [] {
static bool menuJustOpened = true;
@ -115,4 +108,18 @@ IMHEX_PLUGIN_SETUP("Script Loader", "WerWolv", "Script Loader plugin") {
return !runnerTask.isRunning();
});
}
}
IMHEX_PLUGIN_SETUP("Script Loader", "WerWolv", "Script Loader plugin") {
hex::log::debug("Using romfs: '{}'", romfs::name());
for (auto &path : romfs::list("lang"))
hex::ContentRegistry::Language::addLocalization(nlohmann::json::parse(romfs::get(path).string()));
TaskManager::doLater([] {
if (initializeAllLoaders()) {
addScriptsMenu();
}
});
}