From fae46bf1940bab35e2a08a580a8e9a8dee717185 Mon Sep 17 00:00:00 2001 From: Eladash Date: Fri, 20 Mar 2020 07:01:05 +0200 Subject: [PATCH] cellSaveData: Add CELL_SAVEDATA_ERROR_NOUSER --- rpcs3/Emu/Cell/Modules/cellSaveData.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index ac13e73e87..5a4e5215c5 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -5,6 +5,7 @@ #include "Emu/Cell/lv2/sys_process.h" #include "Emu/Cell/PPUModule.h" #include "Emu/Cell/Modules/cellSysutil.h" +#include "Emu/Cell/Modules/cellUserInfo.h" #include "cellSaveData.h" #include "cellMsgDialog.h" @@ -527,6 +528,12 @@ static s32 savedata_check_args(u32 operation, u32 version, vm::cptr dirNam } } + if (userId > CELL_SYSUTIL_USERID_MAX) + { + // ****** sysutil savedata parameter error : 91 ****** + return 91; + } + return CELL_OK; } @@ -573,6 +580,11 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v // path of the specified user (00000001 by default) const std::string base_dir = vfs::get(fmt::format("/dev_hdd0/home/%08u/savedata/", userId ? userId : Emu.GetUsrId())); + if (userId && !fs::is_dir(base_dir)) + { + return CELL_SAVEDATA_ERROR_NOUSER; + } + result->userdata = userdata; // probably should be assigned only once (allows the callback to change it) SaveDataEntry save_entry; @@ -1891,10 +1903,11 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v static NEVER_INLINE error_code savedata_get_list_item(vm::cptr dirName, vm::ptr dir, vm::ptr sysFileParam, vm::ptr bind, vm::ptr sizeKB, u32 userId) { - if (userId == 0) + if (userId == CELL_SYSUTIL_USERID_CURRENT) { userId = Emu.GetUsrId(); } + std::string save_path = vfs::get(fmt::format("/dev_hdd0/home/%08u/savedata/%s/", userId, dirName.get_ptr())); std::string sfo = save_path + "PARAM.SFO";