ngs2 will not load at startup (but will load HLE stubs if no lle module found)

This commit is contained in:
georgemoralis 2024-09-27 10:07:46 +03:00
parent cdc5223f02
commit caa5b87c95

View file

@ -225,32 +225,32 @@ void Emulator::Run(const std::filesystem::path& file) {
}
void Emulator::LoadSystemModules(const std::filesystem::path& file) {
constexpr std::array<SysModules, 12> ModulesToLoad{
{/* {"libSceNgs2.sprx", &Libraries::Ngs2::RegisterlibSceNgs2},*/
{"libSceFiber.sprx", nullptr},
{"libSceUlt.sprx", nullptr},
{"libSceJson.sprx", nullptr},
{"libSceJson2.sprx", nullptr},
{"libSceLibcInternal.sprx", &Libraries::LibcInternal::RegisterlibSceLibcInternal},
{"libSceDiscMap.sprx", &Libraries::DiscMap::RegisterlibSceDiscMap},
{"libSceRtc.sprx", &Libraries::Rtc::RegisterlibSceRtc},
{"libSceJpegEnc.sprx", nullptr},
{"libSceFont.sprx", nullptr},
{"libSceRazorCpu.sprx", nullptr},
{"libSceCesCs.sprx", nullptr},
{"libSceRudp.sprx", nullptr}}};
constexpr std::array<SysModules, 13> ModulesToLoad{
{{"libSceNgs2.sprx", &Libraries::Ngs2::RegisterlibSceNgs2,false},
{"libSceFiber.sprx", nullptr, true},
{"libSceUlt.sprx", nullptr, true},
{"libSceJson.sprx", nullptr, true},
{"libSceJson2.sprx", nullptr, true},
{"libSceLibcInternal.sprx", &Libraries::LibcInternal::RegisterlibSceLibcInternal, true},
{"libSceDiscMap.sprx", &Libraries::DiscMap::RegisterlibSceDiscMap, true},
{"libSceRtc.sprx", &Libraries::Rtc::RegisterlibSceRtc, true},
{"libSceJpegEnc.sprx", nullptr, true},
{"libSceFont.sprx", nullptr, true},
{"libSceRazorCpu.sprx", nullptr, true},
{"libSceCesCs.sprx", nullptr, true},
{"libSceRudp.sprx", nullptr, true}}};
std::vector<std::filesystem::path> found_modules;
const auto& sys_module_path = Common::FS::GetUserPath(Common::FS::PathType::SysModuleDir);
for (const auto& entry : std::filesystem::directory_iterator(sys_module_path)) {
found_modules.push_back(entry.path());
}
for (const auto& [module_name, init_func] : ModulesToLoad) {
for (const auto& [module_name, init_func , load_at_startup] : ModulesToLoad) {
const auto it = std::ranges::find_if(
found_modules, [&](const auto& path) { return path.filename() == module_name; });
if (it != found_modules.end()) {
LOG_INFO(Loader, "Loading {}", it->string());
if (!(it->string() == "libSceNgs2.sprx")) {
if (load_at_startup) {
linker->LoadModule(*it);
}