From 40adf4b94441d9f0284fa714b96c3f6346f7caf7 Mon Sep 17 00:00:00 2001 From: Eladash <18193363+elad335@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:03:55 +0200 Subject: [PATCH] HLE: clear lower bits of Free Disk Space value --- rpcs3/Emu/Cell/Modules/cellGame.cpp | 14 +++++++------- rpcs3/Emu/Cell/Modules/cellSaveData.cpp | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellGame.cpp b/rpcs3/Emu/Cell/Modules/cellGame.cpp index 7aacb6b116..dce605f808 100644 --- a/rpcs3/Emu/Cell/Modules/cellGame.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGame.cpp @@ -418,10 +418,10 @@ error_code cellHddGameCheck(ppu_thread& ppu, u32 version, vm::cptr dirName const std::string local_dir = vfs::get(dir); - // 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 + // 40 GB - 256 kilobytes. 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 256 kilobytes, 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->hddFreeSizeKB = 40 * 1024 * 1024 - 256; get->isNewData = CELL_HDDGAME_ISNEWDATA_EXIST; get->sysSizeKB = 0; // TODO get->st_atime_ = 0; // TODO @@ -758,7 +758,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 = 40 * 1024 * 1024 - 1; // Read explanation in cellHddGameCheck + size->hddFreeSizeKB = 40 * 1024 * 1024 - 256; // Read explanation in cellHddGameCheck // TODO: Calculate data size for HG and DG games, if necessary. size->sizeKB = CELL_GAME_SIZEKB_NOTCALC; @@ -803,7 +803,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 = 40 * 1024 * 1024 - 1; // Read explanation in cellHddGameCheck + size->hddFreeSizeKB = 40 * 1024 * 1024 - 256; // Read explanation in cellHddGameCheck // TODO: Calculate data size for patch data, if necessary. size->sizeKB = CELL_GAME_SIZEKB_NOTCALC; @@ -875,7 +875,7 @@ error_code cellGameDataCheck(u32 type, vm::cptr dirName, vm::ptrhddFreeSizeKB = 40 * 1024 * 1024 - 1; // Read explanation in cellHddGameCheck + size->hddFreeSizeKB = 40 * 1024 * 1024 - 256; // Read explanation in cellHddGameCheck // TODO: Calculate data size for game data, if necessary. size->sizeKB = sfo.empty() ? 0 : CELL_GAME_SIZEKB_NOTCALC; @@ -1042,7 +1042,7 @@ error_code cellGameDataCheckCreate2(ppu_thread& ppu, u32 version, vm::cptr cbGet->isNewData = new_data; // TODO: Use the free space of the computer's HDD where RPCS3 is being run. - cbGet->hddFreeSizeKB = 40 * 1024 * 1024 - 1; // Read explanation in cellHddGameCheck + cbGet->hddFreeSizeKB = 40 * 1024 * 1024 - 256; // Read explanation in cellHddGameCheck strcpy_trunc(cbGet->contentInfoPath, dir); strcpy_trunc(cbGet->gameDataPath, usrdir); diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index ddc122cab4..fdf3bbc5ff 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -1104,7 +1104,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v auto delete_save = [&]() { strcpy_trunc(doneGet->dirName, save_entries[selected].dirName); - doneGet->hddFreeSizeKB = 40 * 1024 * 1024 - 1; // Read explanation in cellHddGameCheck + doneGet->hddFreeSizeKB = 40 * 1024 * 1024 - 256; // Read explanation in cellHddGameCheck doneGet->excResult = CELL_OK; std::memset(doneGet->reserved, 0, sizeof(doneGet->reserved)); @@ -1446,7 +1446,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v // funcStat is called even if the directory doesn't exist. } - statGet->hddFreeSizeKB = 40 * 1024 * 1024 - 1; // Read explanation in cellHddGameCheck + statGet->hddFreeSizeKB = 40 * 1024 * 1024 - 256; // Read explanation in cellHddGameCheck statGet->isNewData = save_entry.isNew = psf.empty(); statGet->dir.atime = save_entry.atime = dir_info.atime;