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
commit caa5b87c95

View file

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