From 980b9aaab3b525f30815b6eebe9321b9d3d57596 Mon Sep 17 00:00:00 2001 From: darkf Date: Sat, 20 Dec 2014 03:45:27 -0800 Subject: [PATCH 1/2] cellSaveData: allocate file list properly --- rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp index 79cfb5e18a..becafff4c5 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp @@ -215,11 +215,11 @@ void getSaveDataStat(SaveDataEntry entry, vm::ptr statGet) } } - // TODO: Fix the crash - // statGet's fileList doesn't seem to be initiliazed properly, when called by cellSaveDataAutoSave2, thus causing a crash during memcpy. - statGet->fileList = vm::bptr::make(be_t::make((u32)Memory.Alloc(sizeof(CellSaveDataFileStat) * (u32)fileEntries.size(), sizeof(CellSaveDataFileStat)))); - for (u32 i = 0; i < fileEntries.size(); i++) - memcpy(&statGet->fileList[i], &fileEntries[i], sizeof(CellSaveDataFileStat)); + statGet->fileList = vm::ptr::make((u32)Memory.Alloc(sizeof(CellSaveDataFileStat) * fileEntries.size(), 8)); + for (u32 i = 0; i < fileEntries.size(); i++) { + CellSaveDataFileStat *dst = &statGet->fileList[i]; + memcpy(dst, &fileEntries[i], sizeof(CellSaveDataFileStat)); + } } s32 modifySaveDataFiles(vm::ptr funcFile, vm::ptr result, const std::string& saveDataDir) From e0ff129dd173b932833491856816ff4574312def Mon Sep 17 00:00:00 2001 From: darkf Date: Sat, 20 Dec 2014 03:46:09 -0800 Subject: [PATCH 2/2] vfsLocalFile: log when Create fails --- rpcs3/Emu/FS/vfsLocalFile.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/FS/vfsLocalFile.cpp b/rpcs3/Emu/FS/vfsLocalFile.cpp index aea1e02e0c..0e716c40af 100644 --- a/rpcs3/Emu/FS/vfsLocalFile.cpp +++ b/rpcs3/Emu/FS/vfsLocalFile.cpp @@ -75,7 +75,12 @@ bool vfsLocalFile::Create(const std::string& path) if(m != '/' && m != '\\' && !rExists(path)) // ??? { rFile f; - return f.Create(path); + if (!f.Create(path)) { + LOG_NOTICE(HLE, "vfsLocalFile::Create: couldn't create file"); + return false; + } + else + return true; } return true;