mirror of https://github.com/RPCS3/rpcs3.git
Rearrange /dev_bdvd mounting logic
Prevent booting patches without /dev_bdvd Prevent booting with foreign /dev_bdvd
This commit is contained in:
parent
d8abe75526
commit
25fcde9507
|
@ -381,6 +381,7 @@ void Emulator::Load()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Booting disc game
|
||||||
if (_cat == "DG" && bdvd_dir.empty())
|
if (_cat == "DG" && bdvd_dir.empty())
|
||||||
{
|
{
|
||||||
// Mount /dev_bdvd/ if necessary
|
// Mount /dev_bdvd/ if necessary
|
||||||
|
@ -390,6 +391,7 @@ void Emulator::Load()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Booting patch data
|
||||||
if (_cat == "GD" && bdvd_dir.empty())
|
if (_cat == "GD" && bdvd_dir.empty())
|
||||||
{
|
{
|
||||||
// Load /dev_bdvd/ from game list if available
|
// Load /dev_bdvd/ from game list if available
|
||||||
|
@ -397,24 +399,19 @@ void Emulator::Load()
|
||||||
{
|
{
|
||||||
bdvd_dir = node.Scalar();
|
bdvd_dir = node.Scalar();
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
if (!bdvd_dir.empty() && fs::is_dir(bdvd_dir))
|
LOG_FATAL(LOADER, "Disc directory not found. Try to run the game from the actual game disc directory.");
|
||||||
{
|
}
|
||||||
vfs::mount("dev_bdvd", bdvd_dir);
|
|
||||||
LOG_NOTICE(LOADER, "Disc: %s", vfs::get("/dev_bdvd"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check /dev_bdvd/
|
// Check /dev_bdvd/
|
||||||
if (_cat == "DG")
|
if (!bdvd_dir.empty() && fs::is_dir(bdvd_dir))
|
||||||
{
|
{
|
||||||
fs::file sfb_file;
|
fs::file sfb_file;
|
||||||
|
|
||||||
if (bdvd_dir.empty())
|
vfs::mount("dev_bdvd", bdvd_dir);
|
||||||
{
|
LOG_NOTICE(LOADER, "Disc: %s", vfs::get("/dev_bdvd"));
|
||||||
LOG_ERROR(LOADER, "Failed to mount disc directory for the disc game %s", m_title_id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sfb_file.open(vfs::get("/dev_bdvd/PS3_DISC.SFB")) || sfb_file.size() < 4 || sfb_file.read<u32>() != ".SFB"_u32)
|
if (!sfb_file.open(vfs::get("/dev_bdvd/PS3_DISC.SFB")) || sfb_file.size() < 4 || sfb_file.read<u32>() != ".SFB"_u32)
|
||||||
{
|
{
|
||||||
|
@ -422,12 +419,25 @@ void Emulator::Load()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string bdvd_title_id = psf::get_string(psf::load_object(fs::file{vfs::get("/dev_bdvd/PS3_GAME/PARAM.SFO")}), "TITLE_ID");
|
||||||
|
|
||||||
|
if (bdvd_title_id != m_title_id)
|
||||||
|
{
|
||||||
|
LOG_ERROR(LOADER, "Unexpected disc directory for the disc game %s (found %s)", m_title_id, bdvd_title_id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Store /dev_bdvd/ location
|
// Store /dev_bdvd/ location
|
||||||
games[m_title_id] = bdvd_dir;
|
games[m_title_id] = bdvd_dir;
|
||||||
YAML::Emitter out;
|
YAML::Emitter out;
|
||||||
out << games;
|
out << games;
|
||||||
fs::file(fs::get_config_dir() + "/games.yml", fs::rewrite).write(out.c_str(), out.size());
|
fs::file(fs::get_config_dir() + "/games.yml", fs::rewrite).write(out.c_str(), out.size());
|
||||||
}
|
}
|
||||||
|
else if (_cat == "DG" || _cat == "GD")
|
||||||
|
{
|
||||||
|
LOG_ERROR(LOADER, "Failed to mount disc directory for the disc game %s", m_title_id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check game updates
|
// Check game updates
|
||||||
const std::string hdd0_boot = hdd0_game + m_title_id + "/USRDIR/EBOOT.BIN";
|
const std::string hdd0_boot = hdd0_game + m_title_id + "/USRDIR/EBOOT.BIN";
|
||||||
|
|
Loading…
Reference in New Issue