HLE: Implement ERROR_BROKEN in cellGameDataCheck (#8945)

This commit is contained in:
Eladash 2020-09-22 11:30:31 +03:00 committed by GitHub
parent 5d50602397
commit cf61198fe3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 3 deletions

View File

@ -462,13 +462,33 @@ error_code cellGameDataCheck(u32 type, vm::cptr<char> dirName, vm::ptr<CellGameC
const auto perm = g_fxo->get<content_permission>();
const auto init = perm->init.init();
auto init = perm->init.init();
if (!init)
{
return CELL_GAME_ERROR_BUSY;
}
auto sfo = psf::load_object(fs::file(vfs::get(dir + "/PARAM.SFO")));
if (psf::get_string(sfo, "CATEGORY") != [&]()
{
switch (type)
{
case CELL_GAME_GAMETYPE_HDD: return "HG"sv;
case CELL_GAME_GAMETYPE_GAMEDATA: return "GD"sv;
case CELL_GAME_GAMETYPE_DISC: return "DG"sv;
default: ASSUME(0);
}
}())
{
if (fs::is_file(vfs::get(dir + "/PARAM.SFO")))
{
init.cancel();
return CELL_GAME_ERROR_BROKEN;
}
}
if (size)
{
// TODO: Use the free space of the computer's HDD where RPCS3 is being run.
@ -488,14 +508,14 @@ error_code cellGameDataCheck(u32 type, vm::cptr<char> dirName, vm::ptr<CellGameC
perm->restrict_sfo_params = false;
if (!fs::is_dir(vfs::get(dir)))
if (sfo.empty())
{
cellGame.warning("cellGameDataCheck(): directory '%s' not found", dir);
return not_an_error(CELL_GAME_RET_NONE);
}
perm->exists = true;
perm->sfo = psf::load_object(fs::file(vfs::get(dir + "/PARAM.SFO")));
perm->sfo = std::move(sfo);
return CELL_OK;
}