From 503c24453a988d08646d66ce1d88ca92c41c0fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandro=20S=C3=A1nchez=20Bach?= Date: Fri, 28 Mar 2014 20:06:15 +0100 Subject: [PATCH] cellSaveData* progress & reverted commit 950fcfe * Reverted commit https://github.com/DHrpcs3/rpcs3/commit/950fcfe4ef6da8aad5198fc12b029862545cfc4e (Reverted ConLog changes) that fixed the "Bad flip!" error since there is a better way of solving it. It will be fixed soon. * Moved cellSaveData to cellSysutil (but preserving the functions in a separated file named: cellSysutil_SaveData.cpp). * Progress on cellSaveDataList* functions. * Added a small margin to the new Settings dialog. :-) --- rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp | 435 ------------------ rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp | 32 ++ .../SysCalls/Modules/cellSysutil_SaveData.cpp | 396 ++++++++++++++++ .../SysCalls/Modules/cellSysutil_SaveData.h | 238 ++++++++++ rpcs3/Gui/ConLog.cpp | 54 ++- rpcs3/Gui/ConLog.h | 6 +- rpcs3/Gui/MainFrame.cpp | 8 +- rpcs3/rpcs3.vcxproj | 2 +- rpcs3/rpcs3.vcxproj.filters | 4 +- 9 files changed, 702 insertions(+), 473 deletions(-) delete mode 100644 rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp create mode 100644 rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp create mode 100644 rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.h diff --git a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp deleted file mode 100644 index d0cf1a4dda..0000000000 --- a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp +++ /dev/null @@ -1,435 +0,0 @@ -#include "stdafx.h" -#include "Emu/SysCalls/SysCalls.h" -#include "Emu/SysCalls/SC_FUNC.h" - -// TODO: Is this really a module? Or is everything part of cellSysutil? -void cellSaveData_init(); -Module cellSaveData("cellSaveData", cellSaveData_init); - -// Error codes -enum -{ - CELL_SAVEDATA_RET_OK = 0, - CELL_SAVEDATA_RET_CANCEL = 1, - CELL_SAVEDATA_ERROR_CBRESULT, - CELL_SAVEDATA_ERROR_ACCESS_ERROR, - CELL_SAVEDATA_ERROR_INTERNAL, - CELL_SAVEDATA_ERROR_PARAM, - CELL_SAVEDATA_ERROR_NOSPACE, - CELL_SAVEDATA_ERROR_BROKEN, - CELL_SAVEDATA_ERROR_FAILURE, - CELL_SAVEDATA_ERROR_BUSY, - CELL_SAVEDATA_ERROR_NOUSER, -}; - -// Constants -enum -{ - // CellSaveDataParamSize - CELL_SAVEDATA_DIRNAME_SIZE = 32, - CELL_SAVEDATA_FILENAME_SIZE = 13, - CELL_SAVEDATA_SECUREFILEID_SIZE = 16, - CELL_SAVEDATA_PREFIX_SIZE = 256, - CELL_SAVEDATA_LISTITEM_MAX = 2048, - CELL_SAVEDATA_SECUREFILE_MAX = 113, - CELL_SAVEDATA_DIRLIST_MAX = 2048, - CELL_SAVEDATA_INVALIDMSG_MAX = 256, - CELL_SAVEDATA_INDICATORMSG_MAX = 64, - - // CellSaveDataSystemParamSize - CELL_SAVEDATA_SYSP_TITLE_SIZE = 128, - CELL_SAVEDATA_SYSP_SUBTITLE_SIZE = 128, - CELL_SAVEDATA_SYSP_DETAIL_SIZE = 1024, - CELL_SAVEDATA_SYSP_LPARAM_SIZE = 8, -}; - -// Datatypes -struct CellSaveDataSetList -{ - be_t sortType; - be_t sortOrder; - be_t dirNamePrefix_addr; // char* -}; - -struct CellSaveDataSetBuf -{ - be_t dirListMax; - be_t fileListMax; - be_t reserved[6]; - be_t bufSize; - be_t buf_addr; // void* -}; - -struct CellSaveDataNewDataIcon -{ - be_t title_addr; // char* - be_t iconBufSize; - be_t iconBuf_addr; // void* -}; - -struct CellSaveDataListNewData -{ - be_t iconPosition; - be_t dirName_addr; // char* - be_t icon_addr; // CellSaveDataNewDataIcon* -}; - -struct CellSaveDataDirList -{ - s8 dirName[CELL_SAVEDATA_DIRNAME_SIZE]; - s8 listParam[CELL_SAVEDATA_SYSP_LPARAM_SIZE]; -}; - -struct CellSaveDataListGet -{ - be_t dirNum; - be_t dirListNum; - be_t dirList_addr; // CellSaveDataDirList* -}; - -struct CellSaveDataListSet -{ - be_t focusPosition; - be_t focusDirName_addr; // char* - be_t fixedListNum; - be_t fixedList_addr; // CellSaveDataDirList* - be_t newData_addr; // CellSaveDataListNewData* -}; - -struct CellSaveDataFixedSet -{ - be_t dirName_addr; // char* - be_t newIcon_addr; // CellSaveDataNewDataIcon* - be_t option; -}; - -struct CellSaveDataSystemFileParam -{ - s8 title[CELL_SAVEDATA_SYSP_TITLE_SIZE]; - s8 subTitle[CELL_SAVEDATA_SYSP_SUBTITLE_SIZE]; - s8 detail[CELL_SAVEDATA_SYSP_DETAIL_SIZE]; - be_t attribute; - s8 reserved2[4]; - s8 listParam[CELL_SAVEDATA_SYSP_LPARAM_SIZE]; - s8 reserved[256]; -}; - -struct CellSaveDataDirStat -{ - be_t st_atime_; - be_t st_mtime_; - be_t st_ctime_; - s8 dirName[CELL_SAVEDATA_DIRNAME_SIZE]; -}; - -struct CellSaveDataFileStat -{ - be_t fileType; - u8 reserved1[4]; - be_t st_size; - be_t st_atime_; - be_t st_mtime_; - be_t st_ctime_; - u8 fileName[CELL_SAVEDATA_FILENAME_SIZE]; - u8 reserved2[3]; -}; - -struct CellSaveDataStatGet -{ - be_t hddFreeSizeKB; - be_t isNewData; - CellSaveDataDirStat dir; - CellSaveDataSystemFileParam getParam; - be_t bind; - be_t sizeKB; - be_t sysSizeKB; - be_t fileNum; - be_t fileListNum; - be_t fileList_addr; // CellSaveDataFileStat* -}; - -struct CellSaveDataAutoIndicator -{ - be_t dispPosition; - be_t dispMode; - be_t dispMsg_addr; // char* - be_t picBufSize; - be_t picBuf_addr; // void* -}; - -struct CellSaveDataStatSet -{ - be_t setParam_addr; // CellSaveDataSystemFileParam* - be_t reCreateMode; - be_t indicator_addr; // CellSaveDataAutoIndicator* -}; - -struct CellSaveDataFileGet -{ - be_t excSize; -}; - -struct CellSaveDataFileSet -{ - be_t fileOperation; - be_t reserved_addr; // void* - be_t fileType; - u8 secureFileId[CELL_SAVEDATA_SECUREFILEID_SIZE]; - be_t fileName_addr; // char* - be_t fileOffset; - be_t fileSize; - be_t fileBufSize; - be_t fileBuf_addr; // void* -}; - -struct CellSaveDataCBResult -{ - be_t result; - be_t progressBarInc; - be_t errNeedSizeKB; - be_t invalidMsg_addr; // char* - be_t userdata_addr; // void* -}; - -struct CellSaveDataDoneGet -{ - be_t excResult; - s8 dirName[CELL_SAVEDATA_DIRNAME_SIZE]; - be_t sizeKB; - be_t hddFreeSizeKB; -}; - -// Functions -int cellSaveDataListSave2() //u32 version, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataListCallback funcList, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataListLoad2() //u32 version, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataListCallback funcList, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataFixedSave2() //u32 version, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile,sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataFixedLoad2() //u32 version, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataAutoSave2() //u32 version, const char *dirName, u32 errDialog, CellSaveDataSetBuf *setBuf, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataAutoLoad2() //u32 version, const char *dirName, u32 errDialog, CellSaveDataSetBuf *setBuf, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataListAutoSave() //u32 version, u32 errDialog, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile,sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataListAutoLoad() //u32 version, u32 errDialog, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataDelete2() //sys_memory_container_t container -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_CANCEL; -} - -int cellSaveDataFixedDelete() //CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataUserListSave() //u32 version, CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataListCallback funcList, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataUserListLoad() //u32 version, CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataListCallback funcList, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataUserFixedSave() //u32 version, CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataUserFixedLoad() //u32 version, CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataUserAutoSave() //u32 version, CellSysutilUserId userId, const char *dirName, u32 errDialog, CellSaveDataSetBuf *setBuf, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataUserAutoLoad() //u32 version, CellSysutilUserId userId, const char *dirName, u32 errDialog, CellSaveDataSetBuf *setBuf, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataUserListAutoSave() //u32 version, CellSysutilUserId userId, u32 errDialog, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataUserListAutoLoad() //u32 version, CellSysutilUserId userId, u32 errDialog, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataUserFixedDelete() //CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -//void cellSaveDataEnableOverlay(); //int enable - - -// Functions (Extensions) -int cellSaveDataListDelete() //CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataListCallback funcList, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataListImport() //CellSaveDataSetList *setList, u32 maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataListExport() //CellSaveDataSetList *setList, u32 maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataFixedImport() //const char *dirName, u32 maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataFixedExport() //const char *dirName, u32 maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataGetListItem() //const char *dirName, CellSaveDataDirStat *dir, CellSaveDataSystemFileParam *sysFileParam, mem32_t bind, mem32_t sizeKB -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataUserListDelete() //CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataListCallback funcList, CellSaveDataDoneCallback funcDone,sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataUserListImport() //CellSysutilUserId userId, CellSaveDataSetList *setList, u32 maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataUserListExport() //CellSysutilUserId userId, CellSaveDataSetList *setList, u32 maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataUserFixedImport() //CellSysutilUserId userId, const char *dirName, u32 maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataUserFixedExport() //CellSysutilUserId userId, const char *dirName, u32 maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -int cellSaveDataUserGetListItem() //CellSysutilUserId userId, const char *dirName, CellSaveDataDirStat *dir, CellSaveDataSystemFileParam *sysFileParam, mem32_t bind, mem32_t sizeKB -{ - UNIMPLEMENTED_FUNC(cellSaveData); - return CELL_SAVEDATA_RET_OK; -} - -// Callback Functions -void (*CellSaveDataFixedCallback)(); //CellSaveDataCBResult *cbResult, CellSaveDataListGet *get, CellSaveDataFixedSet *set - -void (*CellSaveDataListCallback)(); //CellSaveDataCBResult *cbResult, CellSaveDataListGet *get, CellSaveDataListSet *set - -void (*CellSaveDataStatCallback)(); //CellSaveDataCBResult *cbResult, CellSaveDataStatGet *get, CellSaveDataStatSet *set - -void (*CellSaveDataFileCallback)(); //CellSaveDataCBResult *cbResult, CellSaveDataFileGet *get, CellSaveDataFileSet *set - -void (*CellSaveDataDoneCallback)(); //CellSaveDataCBResult *cbResult, CellSaveDataDoneGet *get - -void cellSaveData_init() -{ - cellSaveData.AddFunc(0x04c06fc2, cellSaveDataGetListItem); - cellSaveData.AddFunc(0x273d116a, cellSaveDataUserListExport); - cellSaveData.AddFunc(0x27cb8bc2, cellSaveDataListDelete); - cellSaveData.AddFunc(0x39d6ee43, cellSaveDataUserListImport); - cellSaveData.AddFunc(0x46a2d878, cellSaveDataFixedExport); - cellSaveData.AddFunc(0x491cc554, cellSaveDataListExport); - cellSaveData.AddFunc(0x52541151, cellSaveDataFixedImport); - cellSaveData.AddFunc(0x529231b0, cellSaveDataUserFixedImport); - cellSaveData.AddFunc(0x6b4e0de6, cellSaveDataListImport); - cellSaveData.AddFunc(0x7048a9ba, cellSaveDataUserListDelete); - cellSaveData.AddFunc(0x95ae2cde, cellSaveDataUserFixedExport); - cellSaveData.AddFunc(0xf6482036, cellSaveDataUserGetListItem); - cellSaveData.AddFunc(0x2de0d663, cellSaveDataListSave2); - cellSaveData.AddFunc(0x1dfbfdd6, cellSaveDataListLoad2); - cellSaveData.AddFunc(0x2aae9ef5, cellSaveDataFixedSave2); - cellSaveData.AddFunc(0x2a8eada2, cellSaveDataFixedLoad2); - cellSaveData.AddFunc(0x8b7ed64b, cellSaveDataAutoSave2); - cellSaveData.AddFunc(0xfbd5c856, cellSaveDataAutoLoad2); - cellSaveData.AddFunc(0x4dd03a4e, cellSaveDataListAutoSave); - cellSaveData.AddFunc(0x21425307, cellSaveDataListAutoLoad); - cellSaveData.AddFunc(0xedadd797, cellSaveDataDelete2); - cellSaveData.AddFunc(0x0f03cfb0, cellSaveDataUserListSave); - cellSaveData.AddFunc(0x39dd8425, cellSaveDataUserListLoad); - cellSaveData.AddFunc(0x40b34847, cellSaveDataUserFixedSave); - cellSaveData.AddFunc(0x6e7264ed, cellSaveDataUserFixedLoad); - cellSaveData.AddFunc(0x52aac4fa, cellSaveDataUserAutoSave); - cellSaveData.AddFunc(0xcdc6aefd, cellSaveDataUserAutoLoad); - cellSaveData.AddFunc(0x0e091c36, cellSaveDataUserListAutoSave); - //cellSaveData.AddFunc(0xe7fa820b, cellSaveDataEnableOverlay); -} diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp index d95ee607b6..40141a8d91 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp @@ -4,6 +4,7 @@ #include "Emu/Audio/sysutil_audio.h" #include "cellSysutil.h" +#include "cellSysutil_SaveData.h" #include "Loader/PSF.h" @@ -949,4 +950,35 @@ void cellSysutil_init() //cellSysutil.AddFunc(0xf82e2ef7, cellHddGameGetSizeKB); //cellSysutil.AddFunc(0x9ca9ffa7, cellHddGameSetSystemVer); //cellSysutil.AddFunc(0xafd605b3, cellHddGameExitBroken); + + //cellSysutil_SaveData + //cellSysutil.AddFunc(0x04c06fc2, cellSaveDataGetListItem); + //cellSysutil.AddFunc(0x273d116a, cellSaveDataUserListExport); + //cellSysutil.AddFunc(0x27cb8bc2, cellSaveDataListDelete); + //cellSysutil.AddFunc(0x39d6ee43, cellSaveDataUserListImport); + //cellSysutil.AddFunc(0x46a2d878, cellSaveDataFixedExport); + //cellSysutil.AddFunc(0x491cc554, cellSaveDataListExport); + //cellSysutil.AddFunc(0x52541151, cellSaveDataFixedImport); + //cellSysutil.AddFunc(0x529231b0, cellSaveDataUserFixedImport); + //cellSysutil.AddFunc(0x6b4e0de6, cellSaveDataListImport); + //cellSysutil.AddFunc(0x7048a9ba, cellSaveDataUserListDelete); + //cellSysutil.AddFunc(0x95ae2cde, cellSaveDataUserFixedExport); + //cellSysutil.AddFunc(0xf6482036, cellSaveDataUserGetListItem); + cellSysutil.AddFunc(0x2de0d663, cellSaveDataListSave2); + cellSysutil.AddFunc(0x1dfbfdd6, cellSaveDataListLoad2); + //cellSysutil.AddFunc(0x2aae9ef5, cellSaveDataFixedSave2); + //cellSysutil.AddFunc(0x2a8eada2, cellSaveDataFixedLoad2); + //cellSysutil.AddFunc(0x8b7ed64b, cellSaveDataAutoSave2); + //cellSysutil.AddFunc(0xfbd5c856, cellSaveDataAutoLoad2); + //cellSysutil.AddFunc(0x4dd03a4e, cellSaveDataListAutoSave); + //cellSysutil.AddFunc(0x21425307, cellSaveDataListAutoLoad); + //cellSysutil.AddFunc(0xedadd797, cellSaveDataDelete2); + //cellSysutil.AddFunc(0x0f03cfb0, cellSaveDataUserListSave); + //cellSysutil.AddFunc(0x39dd8425, cellSaveDataUserListLoad); + //cellSysutil.AddFunc(0x40b34847, cellSaveDataUserFixedSave); + //cellSysutil.AddFunc(0x6e7264ed, cellSaveDataUserFixedLoad); + //cellSysutil.AddFunc(0x52aac4fa, cellSaveDataUserAutoSave); + //cellSysutil.AddFunc(0xcdc6aefd, cellSaveDataUserAutoLoad); + //cellSysutil.AddFunc(0x0e091c36, cellSaveDataUserListAutoSave); + //cellSysutil.AddFunc(0xe7fa820b, cellSaveDataEnableOverlay); } diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp new file mode 100644 index 0000000000..335ca66030 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp @@ -0,0 +1,396 @@ +#include "stdafx.h" +#include "Emu/SysCalls/SysCalls.h" +#include "Emu/SysCalls/SC_FUNC.h" +#include + +#include "cellSysutil_SaveData.h" +#include "Loader/PSF.h" +#include "stblib/stb_image.h" + +//#include "Emu/SysCalls/Dialogs/SaveDataList.h" + +extern Module cellSysutil; + +// Auxiliary Classes +class sortSaveDataEntry +{ + u32 sortType; + u32 sortOrder; +public: + sortSaveDataEntry(u32 type, u32 order) : sortType(type), sortOrder(order) {} + bool operator()(const SaveDataListEntry& entry1, const SaveDataListEntry& entry2) const + { + if (sortOrder == CELL_SAVEDATA_SORTORDER_DESCENT) + { + if (sortType == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME) + return entry1.timestamp >= entry2.timestamp; + else //if (sortType == CELL_SAVEDATA_SORTTYPE_SUBTITLE) + return entry1.subtitle >= entry2.subtitle; + } + else //if (sortOrder == CELL_SAVEDATA_SORTORDER_ASCENT) + { + if (sortType == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME) + return entry1.timestamp < entry2.timestamp; + else //if (sortType == CELL_SAVEDATA_SORTTYPE_SUBTITLE) + return entry1.subtitle < entry2.subtitle; + } + } +}; + + +// Auxiliary Functions +u64 getSaveDataSize(const std::string& dirName) +{ + vfsDir dir(dirName); + if (!dir.IsOpened()) + return 0; + + u64 totalSize = 0; + for(const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read()) { + if (entry->flags & DirEntry_TypeFile) { + vfsFile file(dirName+"/"+entry->name); + totalSize += file.GetSize(); + } + } + return totalSize; +} + +void getSaveDataEntry(std::vector& saveEntries, const std::string& saveDir) +{ + // PSF parameters + vfsFile f(saveDir + "/PARAM.SFO"); + PSFLoader psf(f); + if(!psf.Load(false)) + return; + + // PNG icon + wxString localPath; + int width, height, actual_components; + Emu.GetVFS().GetDevice(saveDir + "/ICON0.PNG", localPath); + + SaveDataListEntry saveEntry; + saveEntry.dirName = psf.GetString("SAVEDATA_DIRECTORY"); + saveEntry.listParam = psf.GetString("SAVEDATA_LIST_PARAM"); + saveEntry.title = psf.GetString("TITLE"); + saveEntry.subtitle = psf.GetString("SUB_TITLE"); + saveEntry.details = psf.GetString("DETAIL"); + saveEntry.sizeKb = getSaveDataSize(saveDir)/1024; + saveEntry.timestamp = 0; // TODO + saveEntry.iconBuffer = stbi_load(localPath.mb_str(), &width, &height, &actual_components, 3); + + saveEntries.push_back(saveEntry); +} + + +// Functions +int cellSaveDataListSave2(u32 version, mem_ptr_t setList, mem_ptr_t setBuf, + mem_func_ptr_t funcList, mem_func_ptr_t funcStat, mem_func_ptr_t funcFile, + u32 container, u32 userdata) +{ + cellSysutil.Warning("cellSaveDataListSave2(version=%d, setList_addr=0x%x, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)", + version, setList.GetAddr(), setBuf.GetAddr(), funcList.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata); + + if (!setList.IsGood() || !setBuf.IsGood() || !funcList.IsGood() || !funcStat.IsGood() || !funcFile.IsGood()) + return CELL_SAVEDATA_ERROR_PARAM; + + MemoryAllocator result; + MemoryAllocator listGet; + MemoryAllocator listSet; + + std::string saveBaseDir = "/dev_hdd0/home/00000001/savedata/"; // TODO: Get the path of the current user + vfsDir dir(saveBaseDir); + if(!dir.IsOpened()) + return CELL_SAVEDATA_ERROR_INTERNAL; + + std::string dirNamePrefix = Memory.ReadString(setList->dirNamePrefix_addr).mb_str(); + std::vector saveEntries; + for(const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read()) + { + if (entry->flags & DirEntry_TypeDir || entry->name.Left(dirNamePrefix.size()) == dirNamePrefix) + { + // Count the amount of matches and the amount of listed directories + listGet->dirListNum++; + if (listGet->dirListNum > setBuf->dirListMax) + continue; + listGet->dirNum++; + + std::string saveDir = saveBaseDir + (const char*)(entry->name.mb_str()); + getSaveDataEntry(saveEntries, saveDir); + } + } + + // Sort the entries and fill the listGet->dirList array + std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder)); + listGet->dirList_addr = setBuf->buf_addr; + CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList_addr); + for (u32 i=0; i statGet; + MemoryAllocator statSet; + funcStat(result.GetAddr(), statGet.GetAddr(), statSet.GetAddr()); + + MemoryAllocator fileGet; + MemoryAllocator fileSet; + funcFile(result.GetAddr(), fileGet.GetAddr(), fileSet.GetAddr()); + + for (auto& entry : saveEntries) { + delete[] entry.iconBuffer; + entry.iconBuffer = nullptr; + } + + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataListLoad2(u32 version, mem_ptr_t setList, mem_ptr_t setBuf, + mem_func_ptr_t funcList, mem_func_ptr_t funcStat, mem_func_ptr_t funcFile, + u32 container, u32 userdata) +{ + cellSysutil.Warning("cellSaveDataListLoad2(version=%d, setList_addr=0x%x, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)", + version, setList.GetAddr(), setBuf.GetAddr(), funcList.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata); + + if (!setList.IsGood() || !setBuf.IsGood() || !funcList.IsGood() || !funcStat.IsGood() || !funcFile.IsGood()) + return CELL_SAVEDATA_ERROR_PARAM; + + MemoryAllocator result; + MemoryAllocator listGet; + MemoryAllocator listSet; + + std::string saveBaseDir = "/dev_hdd0/home/00000001/savedata/"; // TODO: Get the path of the current user + vfsDir dir(saveBaseDir); + if(!dir.IsOpened()) + return CELL_SAVEDATA_ERROR_INTERNAL; + + std::string dirNamePrefix = Memory.ReadString(setList->dirNamePrefix_addr).mb_str(); + std::vector saveEntries; + for(const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read()) + { + if (entry->flags & DirEntry_TypeDir || entry->name.Left(dirNamePrefix.size()) == dirNamePrefix) + { + // Count the amount of matches and the amount of listed directories + listGet->dirListNum++; + if (listGet->dirListNum > setBuf->dirListMax) + continue; + listGet->dirNum++; + + std::string saveDir = saveBaseDir + (const char*)(entry->name.mb_str()); + getSaveDataEntry(saveEntries, saveDir); + } + } + + // Sort the entries and fill the listGet->dirList array + std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder)); + listGet->dirList_addr = setBuf->buf_addr; + CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList_addr); + for (u32 i=0; i statGet; + MemoryAllocator statSet; + funcStat(result.GetAddr(), statGet.GetAddr(), statSet.GetAddr()); + + MemoryAllocator fileGet; + MemoryAllocator fileSet; + funcFile(result.GetAddr(), fileGet.GetAddr(), fileSet.GetAddr()); + + for (auto& entry : saveEntries) { + delete[] entry.iconBuffer; + entry.iconBuffer = nullptr; + } + + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataFixedSave2(u32 version, mem_ptr_t setList, mem_ptr_t setBuf, + mem_func_ptr_t funcFixed, mem_func_ptr_t funcStat, mem_func_ptr_t funcFile, + u32 container, u32 userdata_addr) +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataFixedLoad2(u32 version, mem_ptr_t setList, mem_ptr_t setBuf, + mem_func_ptr_t funcFixed, mem_func_ptr_t funcStat, mem_func_ptr_t funcFile, + u32 container, u32 userdata_addr) +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataAutoSave2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_t setBuf, + mem_func_ptr_t funcStat, mem_func_ptr_t funcFile, + u32 container, u32 userdata_addr) +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataAutoLoad2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_t setBuf, + mem_func_ptr_t funcStat, mem_func_ptr_t funcFile, + u32 container, u32 userdata_addr) +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataListAutoSave() //u32 version, u32 errDialog, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile,sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataListAutoLoad() //u32 version, u32 errDialog, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataDelete2() //sys_memory_container_t container +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_CANCEL; +} + +int cellSaveDataFixedDelete() //CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserListSave() //u32 version, CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataListCallback funcList, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserListLoad() //u32 version, CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataListCallback funcList, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserFixedSave() //u32 version, CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserFixedLoad() //u32 version, CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserAutoSave() //u32 version, CellSysutilUserId userId, const char *dirName, u32 errDialog, CellSaveDataSetBuf *setBuf, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserAutoLoad() //u32 version, CellSysutilUserId userId, const char *dirName, u32 errDialog, CellSaveDataSetBuf *setBuf, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserListAutoSave() //u32 version, CellSysutilUserId userId, u32 errDialog, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserListAutoLoad() //u32 version, CellSysutilUserId userId, u32 errDialog, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserFixedDelete() //CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +//void cellSaveDataEnableOverlay(); //int enable + + +// Functions (Extensions) +int cellSaveDataListDelete() //CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataListCallback funcList, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataListImport() //CellSaveDataSetList *setList, u32 maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataListExport() //CellSaveDataSetList *setList, u32 maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataFixedImport() //const char *dirName, u32 maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataFixedExport() //const char *dirName, u32 maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataGetListItem() //const char *dirName, CellSaveDataDirStat *dir, CellSaveDataSystemFileParam *sysFileParam, mem32_t bind, mem32_t sizeKB +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserListDelete() //CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataListCallback funcList, CellSaveDataDoneCallback funcDone,sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserListImport() //CellSysutilUserId userId, CellSaveDataSetList *setList, u32 maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserListExport() //CellSysutilUserId userId, CellSaveDataSetList *setList, u32 maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserFixedImport() //CellSysutilUserId userId, const char *dirName, u32 maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserFixedExport() //CellSysutilUserId userId, const char *dirName, u32 maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserGetListItem() //CellSysutilUserId userId, const char *dirName, CellSaveDataDirStat *dir, CellSaveDataSystemFileParam *sysFileParam, mem32_t bind, mem32_t sizeKB +{ + UNIMPLEMENTED_FUNC(cellSysutil); + return CELL_SAVEDATA_RET_OK; +} diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.h b/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.h new file mode 100644 index 0000000000..16cf91ca72 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.h @@ -0,0 +1,238 @@ +#pragma once + +// Return codes +enum +{ + CELL_SAVEDATA_RET_OK = 0, + CELL_SAVEDATA_RET_CANCEL = 1, + CELL_SAVEDATA_ERROR_CBRESULT = 0x8002b401, + CELL_SAVEDATA_ERROR_ACCESS_ERROR = 0x8002b402, + CELL_SAVEDATA_ERROR_INTERNAL = 0x8002b403, + CELL_SAVEDATA_ERROR_PARAM = 0x8002b404, + CELL_SAVEDATA_ERROR_NOSPACE = 0x8002b405, + CELL_SAVEDATA_ERROR_BROKEN = 0x8002b406, + CELL_SAVEDATA_ERROR_FAILURE = 0x8002b407, + CELL_SAVEDATA_ERROR_BUSY = 0x8002b408, + CELL_SAVEDATA_ERROR_NOUSER = 0x8002b409, + CELL_SAVEDATA_ERROR_SIZEOVER = 0x8002b40a, + CELL_SAVEDATA_ERROR_NODATA = 0x8002b40b, + CELL_SAVEDATA_ERROR_NOTSUPPORTED = 0x8002b40c, +}; + +// Constants +enum +{ + // CellSaveDataParamSize + CELL_SAVEDATA_DIRNAME_SIZE = 32, + CELL_SAVEDATA_FILENAME_SIZE = 13, + CELL_SAVEDATA_SECUREFILEID_SIZE = 16, + CELL_SAVEDATA_PREFIX_SIZE = 256, + CELL_SAVEDATA_LISTITEM_MAX = 2048, + CELL_SAVEDATA_SECUREFILE_MAX = 113, + CELL_SAVEDATA_DIRLIST_MAX = 2048, + CELL_SAVEDATA_INVALIDMSG_MAX = 256, + CELL_SAVEDATA_INDICATORMSG_MAX = 64, + + // CellSaveDataSystemParamSize + CELL_SAVEDATA_SYSP_TITLE_SIZE = 128, + CELL_SAVEDATA_SYSP_SUBTITLE_SIZE = 128, + CELL_SAVEDATA_SYSP_DETAIL_SIZE = 1024, + CELL_SAVEDATA_SYSP_LPARAM_SIZE = 8, + + // CellSaveDataSortType + CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME = 0, + CELL_SAVEDATA_SORTTYPE_SUBTITLE = 1, + + // CellSaveDataSortOrder + CELL_SAVEDATA_SORTORDER_DESCENT = 0, + CELL_SAVEDATA_SORTORDER_ASCENT = 1, +}; + + +// Datatypes +struct CellSaveDataSetList +{ + be_t sortType; + be_t sortOrder; + be_t dirNamePrefix_addr; // char* +}; + +struct CellSaveDataSetBuf +{ + be_t dirListMax; + be_t fileListMax; + be_t reserved[6]; + be_t bufSize; + be_t buf_addr; // void* +}; + +struct CellSaveDataNewDataIcon +{ + be_t title_addr; // char* + be_t iconBufSize; + be_t iconBuf_addr; // void* +}; + +struct CellSaveDataListNewData +{ + be_t iconPosition; + be_t dirName_addr; // char* + be_t icon_addr; // CellSaveDataNewDataIcon* +}; + +struct CellSaveDataDirList +{ + s8 dirName[CELL_SAVEDATA_DIRNAME_SIZE]; + s8 listParam[CELL_SAVEDATA_SYSP_LPARAM_SIZE]; +}; + +struct CellSaveDataListGet +{ + be_t dirNum; + be_t dirListNum; + be_t dirList_addr; // CellSaveDataDirList* +}; + +struct CellSaveDataListSet +{ + be_t focusPosition; + be_t focusDirName_addr; // char* + be_t fixedListNum; + be_t fixedList_addr; // CellSaveDataDirList* + be_t newData_addr; // CellSaveDataListNewData* +}; + +struct CellSaveDataFixedSet +{ + be_t dirName_addr; // char* + be_t newIcon_addr; // CellSaveDataNewDataIcon* + be_t option; +}; + +struct CellSaveDataSystemFileParam +{ + s8 title[CELL_SAVEDATA_SYSP_TITLE_SIZE]; + s8 subTitle[CELL_SAVEDATA_SYSP_SUBTITLE_SIZE]; + s8 detail[CELL_SAVEDATA_SYSP_DETAIL_SIZE]; + be_t attribute; + s8 reserved2[4]; + s8 listParam[CELL_SAVEDATA_SYSP_LPARAM_SIZE]; + s8 reserved[256]; +}; + +struct CellSaveDataDirStat +{ + be_t st_atime_; + be_t st_mtime_; + be_t st_ctime_; + s8 dirName[CELL_SAVEDATA_DIRNAME_SIZE]; +}; + +struct CellSaveDataFileStat +{ + be_t fileType; + u8 reserved1[4]; + be_t st_size; + be_t st_atime_; + be_t st_mtime_; + be_t st_ctime_; + u8 fileName[CELL_SAVEDATA_FILENAME_SIZE]; + u8 reserved2[3]; +}; + +struct CellSaveDataStatGet +{ + be_t hddFreeSizeKB; + be_t isNewData; + CellSaveDataDirStat dir; + CellSaveDataSystemFileParam getParam; + be_t bind; + be_t sizeKB; + be_t sysSizeKB; + be_t fileNum; + be_t fileListNum; + be_t fileList_addr; // CellSaveDataFileStat* +}; + +struct CellSaveDataAutoIndicator +{ + be_t dispPosition; + be_t dispMode; + be_t dispMsg_addr; // char* + be_t picBufSize; + be_t picBuf_addr; // void* +}; + +struct CellSaveDataStatSet +{ + be_t setParam_addr; // CellSaveDataSystemFileParam* + be_t reCreateMode; + be_t indicator_addr; // CellSaveDataAutoIndicator* +}; + +struct CellSaveDataFileGet +{ + be_t excSize; +}; + +struct CellSaveDataFileSet +{ + be_t fileOperation; + be_t reserved_addr; // void* + be_t fileType; + u8 secureFileId[CELL_SAVEDATA_SECUREFILEID_SIZE]; + be_t fileName_addr; // char* + be_t fileOffset; + be_t fileSize; + be_t fileBufSize; + be_t fileBuf_addr; // void* +}; + +struct CellSaveDataCBResult +{ + be_t result; + be_t progressBarInc; + be_t errNeedSizeKB; + be_t invalidMsg_addr; // char* + be_t userdata_addr; // void* +}; + +struct CellSaveDataDoneGet +{ + be_t excResult; + s8 dirName[CELL_SAVEDATA_DIRNAME_SIZE]; + be_t sizeKB; + be_t hddFreeSizeKB; +}; + + +// Callback Functions +typedef void (*CellSaveDataFixedCallback)(mem_ptr_t cbResult, mem_ptr_t get, mem_ptr_t set); +typedef void (*CellSaveDataListCallback) (mem_ptr_t cbResult, mem_ptr_t get, mem_ptr_t set); +typedef void (*CellSaveDataStatCallback) (mem_ptr_t cbResult, mem_ptr_t get, mem_ptr_t set); +typedef void (*CellSaveDataFileCallback) (mem_ptr_t cbResult, mem_ptr_t get, mem_ptr_t set); +typedef void (*CellSaveDataDoneCallback) (mem_ptr_t cbResult, mem_ptr_t get); + + +// Auxiliary Structs +struct SaveDataListEntry +{ + std::string dirName; + std::string listParam; + std::string title; + std::string subtitle; + std::string details; + u32 sizeKb; + u64 timestamp; + void* iconBuffer; +}; + + +// Function declarations +int cellSaveDataListSave2(u32 version, mem_ptr_t setList, mem_ptr_t setBuf, + mem_func_ptr_t funcList, mem_func_ptr_t funcStat, mem_func_ptr_t funcFile, + u32 container, u32 userdata_addr); + +int cellSaveDataListLoad2(u32 version, mem_ptr_t setList, mem_ptr_t setBuf, + mem_func_ptr_t funcList, mem_func_ptr_t funcStat, mem_func_ptr_t funcFile, + u32 container, u32 userdata_addr); diff --git a/rpcs3/Gui/ConLog.cpp b/rpcs3/Gui/ConLog.cpp index 953a4977ab..4895d74113 100644 --- a/rpcs3/Gui/ConLog.cpp +++ b/rpcs3/Gui/ConLog.cpp @@ -14,22 +14,23 @@ std::mutex g_cs_conlog; static const uint max_item_count = 500; static const uint buffer_size = 1024 * 64; -static const std::string g_log_colors[] = +static const wxString g_log_colors[] = { "Black", "Green", "White", "Yellow", "Red", }; struct LogPacket { - std::string m_prefix; - std::string m_text; - std::string m_colour; + wxString m_prefix; + wxString m_text; + wxString m_colour; - LogPacket(const std::string& prefix, const std::string& text, const std::string& colour) + LogPacket(const wxString& prefix, const wxString& text, const wxString& colour) : m_prefix(prefix) , m_text(text) , m_colour(colour) - { + { + } LogPacket() @@ -45,9 +46,9 @@ struct _LogBuffer : public MTPacketBuffer void _push(const LogPacket& data) { - const u32 sprefix = data.m_prefix.length(); - const u32 stext = data.m_text.length(); - const u32 scolour = data.m_colour.length(); + const u32 sprefix = data.m_prefix.length() * sizeof(wxChar); + const u32 stext = data.m_text.length() * sizeof(wxChar); + const u32 scolour = data.m_colour.length() * sizeof(wxChar); m_buffer.Reserve( sizeof(u32) + sprefix + @@ -58,17 +59,17 @@ struct _LogBuffer : public MTPacketBuffer memcpy(&m_buffer[c_put], &sprefix, sizeof(u32)); c_put += sizeof(u32); - memcpy(&m_buffer[c_put], data.m_prefix.c_str(), sprefix); + memcpy(&m_buffer[c_put], data.m_prefix.wx_str(), sprefix); c_put += sprefix; memcpy(&m_buffer[c_put], &stext, sizeof(u32)); c_put += sizeof(u32); - memcpy(&m_buffer[c_put], data.m_text.c_str(), stext); + memcpy(&m_buffer[c_put], data.m_text.wx_str(), stext); c_put += stext; memcpy(&m_buffer[c_put], &scolour, sizeof(u32)); c_put += sizeof(u32); - memcpy(&m_buffer[c_put], data.m_colour.c_str(), scolour); + memcpy(&m_buffer[c_put], data.m_colour.wx_str(), scolour); c_put += scolour; m_put = c_put; @@ -83,20 +84,17 @@ struct _LogBuffer : public MTPacketBuffer const u32& sprefix = *(u32*)&m_buffer[c_get]; c_get += sizeof(u32); - ret.m_prefix.resize(sprefix); - if(sprefix) memcpy((void*)ret.m_prefix.c_str(), &m_buffer[c_get], sprefix); + ret.m_prefix = wxString((wxChar*)&m_buffer[c_get], sprefix / sizeof(wxChar)); c_get += sprefix; const u32& stext = *(u32*)&m_buffer[c_get]; c_get += sizeof(u32); - ret.m_text.resize(stext); - if(stext) memcpy((void*)ret.m_text.c_str(), &m_buffer[c_get], stext); + ret.m_text = wxString((wxChar*)&m_buffer[c_get], stext / sizeof(wxChar)); c_get += stext; const u32& scolour = *(u32*)&m_buffer[c_get]; c_get += sizeof(u32); - ret.m_colour.resize(scolour); - if(scolour) memcpy((void*)ret.m_colour.c_str(), &m_buffer[c_get], scolour); + ret.m_colour = wxString((wxChar*)&m_buffer[c_get], scolour / sizeof(wxChar)); c_get += scolour; m_get = c_get; @@ -116,7 +114,7 @@ LogWriter::LogWriter() } } -void LogWriter::WriteToLog(std::string prefix, std::string value, u8 lvl/*, wxColour bgcolour*/) +void LogWriter::WriteToLog(wxString prefix, wxString value, u8 lvl/*, wxColour bgcolour*/) { if(!prefix.empty()) { @@ -126,8 +124,8 @@ void LogWriter::WriteToLog(std::string prefix, std::string value, u8 lvl/*, wxCo } } - if(m_logfile.IsOpened()) - m_logfile.Write(wxString(prefix.empty() ? "" : std::string("[" + prefix + "]: ") + value + "\n").wx_str()); + if(m_logfile.IsOpened() && !prefix.empty()) + m_logfile.Write(wxString("[") + prefix + "]: " + value + "\n"); if(!ConLogFrame || Ini.HLELogLvl.GetValue() == 4 || (lvl != 0 && lvl <= Ini.HLELogLvl.GetValue())) return; @@ -174,7 +172,7 @@ void LogWriter::Write(const wxString fmt, ...) va_end(list); - WriteToLog("!", (const char *)frmt.ToAscii(), 2); + WriteToLog("!", frmt, 2); } void LogWriter::Error(const wxString fmt, ...) @@ -187,7 +185,7 @@ void LogWriter::Error(const wxString fmt, ...) va_end(list); - WriteToLog("E", static_cast(frmt), 4); + WriteToLog("E", frmt, 4); } void LogWriter::Warning(const wxString fmt, ...) @@ -200,7 +198,7 @@ void LogWriter::Warning(const wxString fmt, ...) va_end(list); - WriteToLog("W", static_cast(frmt), 3); + WriteToLog("W", frmt, 3); } void LogWriter::Success(const wxString fmt, ...) @@ -213,7 +211,7 @@ void LogWriter::Success(const wxString fmt, ...) va_end(list); - WriteToLog("S", static_cast(frmt), 1); + WriteToLog("S", frmt, 1); } void LogWriter::SkipLn() @@ -278,9 +276,9 @@ void LogFrame::Task() const int cur_item = m_log.GetItemCount(); - m_log.InsertItem(cur_item, wxString(item.m_prefix).wx_str()); - m_log.SetItem(cur_item, 1, wxString(item.m_text).wx_str()); - m_log.SetItemTextColour(cur_item, wxString(item.m_colour).wx_str()); + m_log.InsertItem(cur_item, item.m_prefix); + m_log.SetItem(cur_item, 1, item.m_text); + m_log.SetItemTextColour(cur_item, item.m_colour); m_log.SetColumnWidth(0, -1); // crashes on exit m_log.SetColumnWidth(1, -1); diff --git a/rpcs3/Gui/ConLog.h b/rpcs3/Gui/ConLog.h index fec015d43a..79aec07cf1 100644 --- a/rpcs3/Gui/ConLog.h +++ b/rpcs3/Gui/ConLog.h @@ -8,10 +8,10 @@ class LogWriter wxFile m_logfile; wxColour m_txtcolour; - std::string m_prefix; - std::string m_value; + //wxString m_prefix; + //wxString m_value; - virtual void WriteToLog(std::string prefix, std::string value, u8 lvl); + virtual void WriteToLog(wxString prefix, wxString value, u8 lvl); public: LogWriter(); diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index 3219d1f61d..c405b9ad9d 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -322,11 +322,11 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) } wxDialog diag(this, wxID_ANY, "Settings", wxDefaultPosition); - static const u32 m_height = 400; - static const u32 m_width = 385; + static const u32 height = 400; + static const u32 width = 385; // Settings panels - wxNotebook* nb_config = new wxNotebook(&diag, wxID_ANY, wxDefaultPosition, wxSize(m_width, m_height)); + wxNotebook* nb_config = new wxNotebook(&diag, wxID_ANY, wxPoint(6,6), wxSize(width, height)); wxPanel* p_system = new wxPanel(nb_config, wxID_ANY); wxPanel* p_cpu = new wxPanel(nb_config, wxID_ANY); wxPanel* p_graphics = new wxPanel(nb_config, wxID_ANY); @@ -541,7 +541,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) diag.SetSizerAndFit(s_subpanel_system, false); diag.SetSizerAndFit(s_b_panel, false); - diag.SetSize(m_width, m_height + 80); + diag.SetSize(width+26, height+80); if(diag.ShowModal() == wxID_OK) { diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 383acdad94..2ae058702f 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -301,12 +301,12 @@ - + diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index 01ebc7bc58..9450c462e2 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -472,10 +472,10 @@ Loader - + Emu\SysCalls\Modules - + Emu\SysCalls\Modules