[Kernel] Added support for loading modules before main

This commit is contained in:
Gliniak
2025-07-28 21:23:51 +02:00
committed by Radosław Gliński
parent 70364e73ae
commit 2969a04145
4 changed files with 58 additions and 5 deletions

View File

@@ -24,6 +24,7 @@
#include "xenia/cpu/processor.h"
#include "xenia/emulator.h"
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/user_module.h"
#include "xenia/kernel/xmodule.h"
#include "third_party/crypto/TinySHA1.hpp"
@@ -1062,6 +1063,15 @@ bool XexModule::LoadContinue() {
opt_import_libraries->string_table.count);
assert_not_null(string_table[library_name_index]);
auto library_name = std::string(string_table[library_name_index]);
if (!kernel_state_->IsModuleLoaded(library_name)) {
if (auto module = kernel_state_->LoadUserModule(library_name)) {
if (kernel_state_->FinishLoadingUserModule(module, false)) {
library_name = module->path();
}
}
}
SetupLibraryImports(library_name, library);
library_offset += library->size;
}