cellGameBootCheck Improvements

* size->sysSizeKB returns 4kb. (hw tested, unknown if in different situations this value changes)
* Return CELL_GAME_ERROR_BROKEN on failure to init. (hw tested)
* Write to dirName only when type is HDD game. (REd)
* Don't write to *size on errors, make it happen after *attributes and *type writes. (REd)
This commit is contained in:
Eladash 2019-12-01 07:14:09 +02:00 committed by Ivan
commit 1a6e8e20dc

View file

@ -304,21 +304,20 @@ error_code cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr
{ {
cellGame.warning("cellGameBootCheck(type=*0x%x, attributes=*0x%x, size=*0x%x, dirName=*0x%x)", type, attributes, size, dirName); cellGame.warning("cellGameBootCheck(type=*0x%x, attributes=*0x%x, size=*0x%x, dirName=*0x%x)", type, attributes, size, dirName);
if (size) if (!type || !attributes)
{
// TODO: Use the free space of the computer's HDD where RPCS3 is being run.
size->hddFreeSizeKB = 40 * 1024 * 1024 - 1; // Read explanation in cellHddGameCheck
// TODO: Calculate data size for HG and DG games, if necessary.
size->sizeKB = CELL_GAME_SIZEKB_NOTCALC;
size->sysSizeKB = 0;
}
if (!type)
{ {
return CELL_GAME_ERROR_PARAM; return CELL_GAME_ERROR_PARAM;
} }
const auto perm = g_fxo->get<content_permission>();
const auto init = perm->init.init();
if (!init)
{
return CELL_GAME_ERROR_BROKEN;
}
std::string dir; std::string dir;
psf::registry sfo; psf::registry sfo;
@ -334,7 +333,6 @@ error_code cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr
{ {
*type = CELL_GAME_GAMETYPE_DISC; *type = CELL_GAME_GAMETYPE_DISC;
*attributes = CELL_GAME_ATTRIBUTE_PATCH; // TODO *attributes = CELL_GAME_ATTRIBUTE_PATCH; // TODO
if (dirName) strcpy_trunc(*dirName, Emu.GetTitleID()); // ???
sfo = psf::load_object(fs::file(vfs::get(Emu.GetDir() + "PARAM.SFO"))); sfo = psf::load_object(fs::file(vfs::get(Emu.GetDir() + "PARAM.SFO")));
} }
@ -342,19 +340,24 @@ error_code cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr
{ {
*type = CELL_GAME_GAMETYPE_HDD; *type = CELL_GAME_GAMETYPE_HDD;
*attributes = 0; // TODO *attributes = 0; // TODO
if (dirName) strcpy_trunc(*dirName, Emu.GetTitleID());
sfo = psf::load_object(fs::file(vfs::get(Emu.GetDir() + "PARAM.SFO"))); sfo = psf::load_object(fs::file(vfs::get(Emu.GetDir() + "PARAM.SFO")));
dir = Emu.GetTitleID(); dir = Emu.GetTitleID();
} }
const auto perm = g_fxo->get<content_permission>(); if (size)
const auto init = perm->init.init();
if (!init)
{ {
return CELL_GAME_ERROR_BUSY; // TODO: Use the free space of the computer's HDD where RPCS3 is being run.
size->hddFreeSizeKB = 40 * 1024 * 1024 - 1; // Read explanation in cellHddGameCheck
// TODO: Calculate data size for HG and DG games, if necessary.
size->sizeKB = CELL_GAME_SIZEKB_NOTCALC;
size->sysSizeKB = 4;
}
if (*type == CELL_GAME_GAMETYPE_HDD && dirName)
{
strcpy_trunc(*dirName, Emu.GetTitleID());
} }
perm->dir = std::move(dir); perm->dir = std::move(dir);
@ -393,7 +396,7 @@ error_code cellGamePatchCheck(vm::ptr<CellGameContentSize> size, vm::ptr<void> r
if (!init) if (!init)
{ {
return CELL_GAME_ERROR_BUSY; return CELL_GAME_ERROR_BROKEN;
} }
perm->dir = Emu.GetTitleID(); perm->dir = Emu.GetTitleID();
@ -441,7 +444,7 @@ error_code cellGameDataCheck(u32 type, vm::cptr<char> dirName, vm::ptr<CellGameC
if (!init) if (!init)
{ {
return CELL_GAME_ERROR_BUSY; return CELL_GAME_ERROR_BROKEN;
} }
perm->dir = std::move(name); perm->dir = std::move(name);