From 1a6e8e20dca9fd259e03c607d4c9d93ae5375298 Mon Sep 17 00:00:00 2001 From: Eladash Date: Sun, 1 Dec 2019 07:14:09 +0200 Subject: [PATCH] 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) --- rpcs3/Emu/Cell/Modules/cellGame.cpp | 45 +++++++++++++++-------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellGame.cpp b/rpcs3/Emu/Cell/Modules/cellGame.cpp index 0b7741435f..9b76f5a33d 100644 --- a/rpcs3/Emu/Cell/Modules/cellGame.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGame.cpp @@ -304,21 +304,20 @@ error_code cellGameBootCheck(vm::ptr type, vm::ptr attributes, vm::ptr { cellGame.warning("cellGameBootCheck(type=*0x%x, attributes=*0x%x, size=*0x%x, dirName=*0x%x)", type, attributes, size, dirName); - if (size) - { - // 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) + if (!type || !attributes) { return CELL_GAME_ERROR_PARAM; } + const auto perm = g_fxo->get(); + + const auto init = perm->init.init(); + + if (!init) + { + return CELL_GAME_ERROR_BROKEN; + } + std::string dir; psf::registry sfo; @@ -334,7 +333,6 @@ error_code cellGameBootCheck(vm::ptr type, vm::ptr attributes, vm::ptr { *type = CELL_GAME_GAMETYPE_DISC; *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"))); } @@ -342,19 +340,24 @@ error_code cellGameBootCheck(vm::ptr type, vm::ptr attributes, vm::ptr { *type = CELL_GAME_GAMETYPE_HDD; *attributes = 0; // TODO - if (dirName) strcpy_trunc(*dirName, Emu.GetTitleID()); sfo = psf::load_object(fs::file(vfs::get(Emu.GetDir() + "PARAM.SFO"))); dir = Emu.GetTitleID(); } - const auto perm = g_fxo->get(); - - const auto init = perm->init.init(); - - if (!init) + if (size) { - 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); @@ -393,7 +396,7 @@ error_code cellGamePatchCheck(vm::ptr size, vm::ptr r if (!init) { - return CELL_GAME_ERROR_BUSY; + return CELL_GAME_ERROR_BROKEN; } perm->dir = Emu.GetTitleID(); @@ -441,7 +444,7 @@ error_code cellGameDataCheck(u32 type, vm::cptr dirName, vm::ptrdir = std::move(name);