Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix C00 boot from external HG games #13392

Merged
merged 1 commit into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix C00 boot from external HG games
  • Loading branch information
Megamouse committed Feb 12, 2023
commit 6774358e374639b9de3744dd79b9948932598c2c
24 changes: 20 additions & 4 deletions rpcs3/Emu/System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
}
else
{
m_sfo_dir = rpcs3::utils::get_sfo_dir_from_game_path(elf_dir + "/../", m_title_id);
m_sfo_dir = rpcs3::utils::get_sfo_dir_from_game_path(fs::get_parent_dir(elf_dir), m_title_id);
}

_psf = psf::load_object(m_sfo_dir + "/PARAM.SFO");
Expand Down Expand Up @@ -1633,8 +1633,16 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool

if (!m_title_id.empty() && !from_hdd0_game && m_cat == "HG")
{
std::string game_dir = m_sfo_dir;

// Don't use the C00 subdirectory in our game list
if (game_dir.ends_with("/C00") || game_dir.ends_with("\\C00"))
{
game_dir = game_dir.substr(0, game_dir.size() - 4);
}

// Add HG games not in HDD0 to games.yml
games[m_title_id] = m_sfo_dir;
games[m_title_id] = game_dir;
YAML::Emitter out;
out << games;

Expand All @@ -1645,7 +1653,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
sys_log.error("Failed to save HG game location of title '%s' (error=%s)", m_title_id, fs::g_tls_error);
}

vfs::mount("/dev_hdd0/game/" + m_title_id, m_sfo_dir + '/');
vfs::mount("/dev_hdd0/game/" + m_title_id, game_dir + '/');
}
}
else if (m_cat == "DG" && from_hdd0_game && disc.empty())
Expand Down Expand Up @@ -1977,8 +1985,16 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
}
else if (!m_title_id.empty() && m_cat == "HG")
{
std::string game_dir = m_sfo_dir;

// Remove the C00 suffix
if (game_dir.ends_with("/C00") || game_dir.ends_with("\\C00"))
{
game_dir = game_dir.substr(0, game_dir.size() - 4);
}

m_dir = "/dev_hdd0/game/" + m_title_id + '/';
argv[0] = m_dir + unescape(resolved_path.substr(GetCallbacks().resolve_path(m_sfo_dir).size()));
argv[0] = m_dir + unescape(resolved_path.substr(GetCallbacks().resolve_path(game_dir).size()));
sys_log.notice("Boot path: %s", m_dir);
}
else if (g_cfg.vfs.host_root)
Expand Down
6 changes: 6 additions & 0 deletions rpcs3/rpcs3qt/game_list_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,12 @@ void game_list_frame::Refresh(const bool from_drive, const bool scroll_after)
continue;
}

// Don't use the C00 subdirectory in our game list
if (game_dir.ends_with("/C00") || game_dir.ends_with("\\C00"))
{
game_dir = game_dir.substr(0, game_dir.size() - 4);
}

const bool has_sfo = fs::is_file(game_dir + "/PARAM.SFO");

if (!has_sfo && fs::is_file(game_dir + "/PS3_DISC.SFB"))
Expand Down