1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2025-02-01 04:51:49 +01:00

Fix cellDiscGameGetBootDiscInfo (#2430)

cellDiscGameGetBootDiscInfo is called by non-disc games for some reason.
That wasn't accounted for and therefore it would try to read PARAM.SFO
from an unmounted path and throw an access violation.

Tested with NBA Live 08 Demo NPUB90029, probably fixes similar games as
well
This commit is contained in:
Ani 2017-02-28 15:42:45 +00:00 committed by Ivan
parent c785b14c18
commit 557e1c3694

View File

@ -760,13 +760,19 @@ s32 cellGameThemeInstallFromBuffer()
s32 cellDiscGameGetBootDiscInfo(vm::ptr<CellDiscGameSystemFileParam> getParam)
{
cellGame.warning("cellDiscGameGetBootDiscInfo(getParam=*0x%x)", getParam);
//this should only appear in disc games
// This is also called by non-disc games, see NPUB90029
const std::string dir = "/dev_bdvd/PS3_GAME"s;
if (!fs::is_dir(vfs::get(dir)))
{
// Not a disc game. TODO: Fetch PARAM.SFO from proper game dir
cellGame.warning("cellDiscGameGetBootDiscInfo(): directory '%s' not found", dir);
getParam->parentalLevel = 0;
strcpy_trunc(getParam->titleId, "0");
return CELL_OK;
}
const auto& psf = psf::load_object(fs::file(vfs::get(dir + "/PARAM.SFO")));
if (psf.count("PARENTAL_LEVEL") != 0) getParam->parentalLevel = psf.at("PARENTAL_LEVEL").as_integer();