diff --git a/rpcs3/Emu/Cell/Modules/cellGame.cpp b/rpcs3/Emu/Cell/Modules/cellGame.cpp index 1f297fb53a..bd253ad648 100644 --- a/rpcs3/Emu/Cell/Modules/cellGame.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGame.cpp @@ -140,7 +140,10 @@ s32 cellHddGameCheck(ppu_thread& ppu, u32 version, vm::cptr dirName, u32 e vm::var get; vm::var set; - get->hddFreeSizeKB = 40 * 1024 * 1024; // 40 GB, TODO: Use the free space of the computer's HDD where RPCS3 is being run. + // 40 GB - 1 kilobyte. The reasoning is that many games take this number and multiply it by 1024, to get the amount of bytes. With 40GB exactly, + // this will result in an overflow, and the size would be 0, preventing the game from running. By reducing 1 kilobyte, we make sure that even + // after said overflow, the number would still be high enough to contain the game's data. + get->hddFreeSizeKB = 40 * 1024 * 1024 - 1; get->isNewData = CELL_HDDGAME_ISNEWDATA_EXIST; get->sysSizeKB = 0; // TODO get->atime = 0; // TODO @@ -262,7 +265,7 @@ error_code cellGameBootCheck(vm::ptr type, vm::ptr attributes, vm::ptr if (size) { // TODO: Use the free space of the computer's HDD where RPCS3 is being run. - size->hddFreeSizeKB = 40000000; // 40 GB + 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; @@ -318,7 +321,7 @@ error_code cellGamePatchCheck(vm::ptr size, vm::ptr r if (size) { // TODO: Use the free space of the computer's HDD where RPCS3 is being run. - size->hddFreeSizeKB = 40000000; // 40 GB + size->hddFreeSizeKB = 40 * 1024 * 1024 - 1; // Read explanation in cellHddGameCheck // TODO: Calculate data size for patch data, if necessary. size->sizeKB = CELL_GAME_SIZEKB_NOTCALC; @@ -350,7 +353,7 @@ error_code cellGameDataCheck(u32 type, vm::cptr dirName, vm::ptrhddFreeSizeKB = 40000000; //40 GB + size->hddFreeSizeKB = 40 * 1024 * 1024 - 1; // Read explanation in cellHddGameCheck // TODO: Calculate data size for game data, if necessary. size->sizeKB = CELL_GAME_SIZEKB_NOTCALC; @@ -462,7 +465,7 @@ error_code cellGameDataCheckCreate2(ppu_thread& ppu, u32 version, vm::cptr // TODO: Use the free space of the computer's HDD where RPCS3 is being run. - cbGet->hddFreeSizeKB = 40000000; //40 GB + cbGet->hddFreeSizeKB = 40 * 1024 * 1024 - 1; // Read explanation in cellHddGameCheck strcpy_trunc(cbGet->contentInfoPath, dir); diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index 7b57992379..2876188126 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -314,7 +314,7 @@ static NEVER_INLINE s32 savedata_op(ppu_thread& ppu, u32 operation, u32 version, auto delete_save = [&](const std::string& del_path) { strcpy_trunc(doneGet->dirName, save_entries[selected].dirName); - doneGet->hddFreeSizeKB = 40 * 1024 * 1024; // 40 GB + doneGet->hddFreeSizeKB = 40 * 1024 * 1024 - 1; // Read explanation in cellHddGameCheck doneGet->sizeKB = 0; doneGet->excResult = CELL_OK; std::memset(doneGet->reserved, 0, sizeof(doneGet->reserved)); @@ -481,7 +481,7 @@ static NEVER_INLINE s32 savedata_op(ppu_thread& ppu, u32 operation, u32 version, // error } - statGet->hddFreeSizeKB = 40 * 1024 * 1024; // 40 GB + statGet->hddFreeSizeKB = 40 * 1024 * 1024 - 1; // Read explanation in cellHddGameCheck statGet->isNewData = save_entry.isNew = psf.empty(); statGet->dir.atime = save_entry.atime = dir_info.atime;