System: add vsh.self when scanning vsh/module

This commit is contained in:
Megamouse 2021-07-27 04:09:20 +02:00
parent 03a46a499e
commit 22e51e1615

View file

@ -728,29 +728,47 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
g_fxo->init<named_thread>("SPRX Loader"sv, [this] g_fxo->init<named_thread>("SPRX Loader"sv, [this]
{ {
std::string path;
std::vector<std::string> dir_queue; std::vector<std::string> dir_queue;
dir_queue.emplace_back(m_path + '/'); dir_queue.emplace_back(m_path + '/');
// Find game update to use EBOOT.BIN from it, also add its directory to scan if (m_title_id.empty())
if (m_cat == "DG")
{ {
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; // Memorize path to vsh.self
dir_queue.emplace_back(m_path + '/'); path = vsh_path + "/vsh.self";
} }
} }
else
// Try to add all related directories
const std::set<std::string> 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))
{ {
// Compile EBOOT.BIN first // Find game update to use EBOOT.BIN from it, also add its directory to scan
ppu_log.notice("Trying to load EBOOT.BIN: %s", path); 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<std::string> 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}; fs::file src{path};
@ -772,7 +790,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
} }
else 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 else