From 5207b009736e0d471ea42ea2235c039fa3951984 Mon Sep 17 00:00:00 2001 From: RipleyTom Date: Tue, 4 Dec 2018 17:03:47 +0100 Subject: [PATCH] Extra Handling of result value of funcStat CB. --- rpcs3/Emu/Cell/Modules/cellSaveData.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index 1b8da125e8..f96e86038f 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "stdafx.h" #include "Emu/System.h" #include "Emu/Cell/PPUModule.h" #include "Emu/Cell/Modules/cellSysutil.h" @@ -479,7 +479,7 @@ static NEVER_INLINE s32 savedata_op(ppu_thread& ppu, u32 operation, u32 version, fs::stat_t dir_info{}; if (!fs::stat(dir_path, dir_info)) { - // error + // funcStat is called even if the directory doesn't exist. } statGet->hddFreeSizeKB = 40 * 1024 * 1024 - 1; // Read explanation in cellHddGameCheck @@ -576,10 +576,23 @@ static NEVER_INLINE s32 savedata_op(ppu_thread& ppu, u32 operation, u32 version, { cellSaveData.warning("savedata_op(): funcStat returned result=%d.", result->result); + // Skip and error + if (result->result >= CELL_SAVEDATA_CBRESULT_OK_LAST_NOCONFIRM || result->result < CELL_SAVEDATA_CBRESULT_ERR_INVALID) + { + // ****** sysutil savedata parameter error : 22 ****** + return CELL_SAVEDATA_ERROR_PARAM; + } + if (result->result < CELL_SAVEDATA_CBRESULT_OK_NEXT) { return CELL_SAVEDATA_ERROR_CBRESULT; } + + // Skip and return without error + if (result->result == CELL_SAVEDATA_CBRESULT_OK_LAST) + { + return CELL_OK; + } } if (statSet->setParam) @@ -656,11 +669,6 @@ static NEVER_INLINE s32 savedata_op(ppu_thread& ppu, u32 operation, u32 version, return CELL_SAVEDATA_ERROR_PARAM; } } - - if (result->result != CELL_SAVEDATA_CBRESULT_OK_NEXT) - { - funcFile = vm::null; - } }