diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 9594a4d259..300b9f11a7 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -728,29 +728,47 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool g_fxo->init("SPRX Loader"sv, [this] { + std::string path; std::vector dir_queue; dir_queue.emplace_back(m_path + '/'); - // Find game update to use EBOOT.BIN from it, also add its directory to scan - if (m_cat == "DG") + if (m_title_id.empty()) { - const std::string hdd0_path = vfs::get("/dev_hdd0/game/") + m_title_id; + // Check if we are trying to scan vsh/module + const std::string vsh_path = g_cfg.vfs.get_dev_flash() + "vsh/module"; - if (fs::is_file(hdd0_path + "/USRDIR/EBOOT.BIN")) + if (IsPathInsideDir(m_path, vsh_path)) { - m_path = hdd0_path; - dir_queue.emplace_back(m_path + '/'); + // Memorize path to vsh.self + path = vsh_path + "/vsh.self"; } } - - // Try to add all related directories - const std::set dirs = GetGameDirs(); - dir_queue.insert(std::end(dir_queue), std::begin(dirs), std::end(dirs)); - - if (std::string path = m_path + "/USRDIR/EBOOT.BIN"; fs::is_file(path)) + else { - // Compile EBOOT.BIN first - ppu_log.notice("Trying to load EBOOT.BIN: %s", path); + // Find game update to use EBOOT.BIN from it, also add its directory to scan + if (m_cat == "DG") + { + const std::string hdd0_path = vfs::get("/dev_hdd0/game/") + m_title_id; + + if (fs::is_file(hdd0_path + "/USRDIR/EBOOT.BIN")) + { + m_path = hdd0_path; + dir_queue.emplace_back(m_path + '/'); + } + } + + // Memorize path to EBOOT.BIN + path = m_path + "/USRDIR/EBOOT.BIN"; + + // Try to add all related directories + const std::set dirs = GetGameDirs(); + dir_queue.insert(std::end(dir_queue), std::begin(dirs), std::end(dirs)); + } + + if (fs::is_file(path)) + { + // Compile binary first + ppu_log.notice("Trying to load binary: %s", path); fs::file src{path}; @@ -772,7 +790,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool } else { - sys_log.error("Failed to load EBOOT.BIN '%s' (%s)", path, obj.get_error()); + sys_log.error("Failed to load binary '%s' (%s)", path, obj.get_error()); } } else