From d032bc5691fbd9e005c12a4e198450fb3cbc7bb8 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Wed, 15 Apr 2015 17:27:37 +0300 Subject: [PATCH] vfsLocalDir, rFile routines improved --- Utilities/rFile.cpp | 142 ++-- Utilities/rFile.h | 10 +- rpcs3/Emu/FS/vfsDirBase.h | 2 + rpcs3/Emu/FS/vfsLocalDir.cpp | 31 +- rpcs3/Emu/Memory/vm_ptr.h | 28 +- rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp | 773 +++++--------------- rpcs3/Emu/SysCalls/Modules/cellSaveData.h | 12 +- rpcs3/Emu/System.cpp | 1 - rpcs3/Emu/System.h | 2 - 9 files changed, 334 insertions(+), 667 deletions(-) diff --git a/Utilities/rFile.cpp b/Utilities/rFile.cpp index e38e6d2b62..ab85ecea5f 100644 --- a/Utilities/rFile.cpp +++ b/Utilities/rFile.cpp @@ -5,23 +5,37 @@ #include #include #include "rFile.h" -#include "errno.h" #ifdef _WIN32 #include -// Maybe in StrFmt? -std::wstring ConvertUTF8ToWString(const std::string &source) +#define GET_API_ERROR static_cast(GetLastError()) + +std::unique_ptr ConvertUTF8ToWChar(const std::string& source) { - int len = (int)source.size(); - int size = (int)MultiByteToWideChar(CP_UTF8, 0, source.c_str(), len, NULL, 0); - std::wstring str; - str.resize(size); - if (size > 0) { - MultiByteToWideChar(CP_UTF8, 0, source.c_str(), len, &str[0], size); + const size_t length = source.size() + 1; // size + null terminator + + const int size = length && length <= INT_MAX ? static_cast(length) : throw std::length_error(__FUNCTION__); + + std::unique_ptr buffer(new wchar_t[length]); // allocate buffer assuming that length is the max possible size + + if (!MultiByteToWideChar(CP_UTF8, 0, source.c_str(), size, buffer.get(), size)) + { + LOG_ERROR(GENERAL, "ConvertUTF8ToWChar(source='%s') failed: 0x%llx", source.c_str(), GET_API_ERROR); } - return str; + + return buffer; } + +time_t to_time_t(const FILETIME& ft) +{ + ULARGE_INTEGER v; + v.LowPart = ft.dwLowDateTime; + v.HighPart = ft.dwHighDateTime; + + return v.QuadPart / 10000000ULL - 11644473600ULL; +} + #else #include #include @@ -30,62 +44,79 @@ std::wstring ConvertUTF8ToWString(const std::string &source) #else #include #endif -#endif +#include "errno.h" -#ifdef _WIN32 -#define GET_API_ERROR static_cast(GetLastError()) -#else #define GET_API_ERROR static_cast(errno) + #endif -bool getFileInfo(const char *path, FileInfo *fileInfo) +bool get_file_info(const std::string& path, FileInfo& info) { // TODO: Expand relative paths? - fileInfo->fullName = path; + info.fullName = path; #ifdef _WIN32 WIN32_FILE_ATTRIBUTE_DATA attrs; - if (!GetFileAttributesExW(ConvertUTF8ToWString(path).c_str(), GetFileExInfoStandard, &attrs)) { - fileInfo->size = 0; - fileInfo->isDirectory = false; - fileInfo->isWritable = false; - fileInfo->exists = false; + if (!GetFileAttributesExW(ConvertUTF8ToWChar(path).get(), GetFileExInfoStandard, &attrs)) + { + info.exists = false; + info.isDirectory = false; + info.isWritable = false; + info.size = 0; return false; } - fileInfo->size = (uint64_t)attrs.nFileSizeLow | ((uint64_t)attrs.nFileSizeHigh << 32); - fileInfo->isDirectory = (attrs.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; - fileInfo->isWritable = (attrs.dwFileAttributes & FILE_ATTRIBUTE_READONLY) == 0; - fileInfo->exists = true; + + info.exists = true; + info.isDirectory = (attrs.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; + info.isWritable = (attrs.dwFileAttributes & FILE_ATTRIBUTE_READONLY) == 0; + info.size = (uint64_t)attrs.nFileSizeLow | ((uint64_t)attrs.nFileSizeHigh << 32); + info.atime = to_time_t(attrs.ftLastAccessTime); + info.mtime = to_time_t(attrs.ftLastWriteTime); + info.ctime = to_time_t(attrs.ftCreationTime); #else struct stat64 file_info; - int result = stat64(path, &file_info); - - if (result < 0) { - fileInfo->size = 0; - fileInfo->isDirectory = false; - fileInfo->isWritable = false; - fileInfo->exists = false; + if (stat64(path, &file_info) < 0) + { + info.exists = false; + info.isDirectory = false; + info.isWritable = false; + info.size = 0; return false; } - fileInfo->isDirectory = S_ISDIR(file_info.st_mode); - fileInfo->isWritable = false; - fileInfo->size = file_info.st_size; - fileInfo->exists = true; - // HACK: approximation - if (file_info.st_mode & 0200) - fileInfo->isWritable = true; + info.exists = true; + info.isDirectory = S_ISDIR(file_info.st_mode); + info.isWritable = file_info.st_mode & 0200; // HACK: approximation + info.size = file_info.st_size; + info.atime = file_info.st_atime; + info.mtime = file_info.st_mtime; + info.ctime = file_info.st_ctime; #endif return true; } -bool rIsDir(const std::string &filename) { - FileInfo info; - getFileInfo(filename.c_str(), &info); - return info.isDirectory; +bool rIsDir(const std::string& dir) +{ +#ifdef _WIN32 + DWORD attrs; + if ((attrs = GetFileAttributesW(ConvertUTF8ToWChar(dir).get())) == INVALID_FILE_ATTRIBUTES) + { + return false; + } + + return (attrs & FILE_ATTRIBUTE_DIRECTORY) != 0; +#else + struct stat64 file_info; + if (stat64(path, &file_info) < 0) + { + return false; + } + + return S_ISDIR(file_info.st_mode); +#endif } -bool rMkdir(const std::string &dir) +bool rMkdir(const std::string& dir) { #ifdef _WIN32 return !_mkdir(dir.c_str()); @@ -94,7 +125,7 @@ bool rMkdir(const std::string &dir) #endif } -bool rMkpath(const std::string &path) +bool rMkpath(const std::string& path) { size_t start=0, pos; std::string dir; @@ -121,10 +152,10 @@ bool rMkpath(const std::string &path) return true; } -bool rRmdir(const std::string &dir) +bool rRmdir(const std::string& dir) { #ifdef _WIN32 - if (!RemoveDirectory(ConvertUTF8ToWString(dir).c_str())) + if (!RemoveDirectory(ConvertUTF8ToWChar(dir).get())) #else if (rmdir(dir.c_str())) #endif @@ -136,11 +167,11 @@ bool rRmdir(const std::string &dir) return true; } -bool rRename(const std::string &from, const std::string &to) +bool rRename(const std::string& from, const std::string& to) { // TODO: Deal with case-sensitivity #ifdef _WIN32 - if (!MoveFile(ConvertUTF8ToWString(from).c_str(), ConvertUTF8ToWString(to).c_str())) + if (!MoveFile(ConvertUTF8ToWChar(from).get(), ConvertUTF8ToWChar(to).get())) #else if (rename(from.c_str(), to.c_str())) #endif @@ -191,7 +222,7 @@ int OSCopyFile(const char* source, const char* destination, bool overwrite) bool rCopy(const std::string& from, const std::string& to, bool overwrite) { #ifdef _WIN32 - if (!CopyFile(ConvertUTF8ToWString(from).c_str(), ConvertUTF8ToWString(to).c_str(), !overwrite)) + if (!CopyFile(ConvertUTF8ToWChar(from).get(), ConvertUTF8ToWChar(to).get(), !overwrite)) #else if (OSCopyFile(from.c_str(), to.c_str(), overwrite)) #endif @@ -203,21 +234,20 @@ bool rCopy(const std::string& from, const std::string& to, bool overwrite) return true; } -bool rExists(const std::string &file) +bool rExists(const std::string& file) { #ifdef _WIN32 - std::wstring wstr = ConvertUTF8ToWString(file); - return GetFileAttributes(wstr.c_str()) != 0xFFFFFFFF; + return GetFileAttributes(ConvertUTF8ToWChar(file).get()) != 0xFFFFFFFF; #else struct stat buffer; - return (stat (file.c_str(), &buffer) == 0); + return stat(file.c_str(), &buffer) == 0; #endif } -bool rRemoveFile(const std::string &file) +bool rRemoveFile(const std::string& file) { #ifdef _WIN32 - if (!DeleteFile(ConvertUTF8ToWString(file).c_str())) + if (!DeleteFile(ConvertUTF8ToWChar(file).get())) #else if (unlink(file.c_str())) #endif diff --git a/Utilities/rFile.h b/Utilities/rFile.h index 174ff797e9..d94e0d63fb 100644 --- a/Utilities/rFile.h +++ b/Utilities/rFile.h @@ -1,16 +1,20 @@ #pragma once -struct FileInfo { +struct FileInfo +{ std::string name; std::string fullName; bool exists; bool isDirectory; bool isWritable; uint64_t size; + time_t atime; + time_t mtime; + time_t ctime; }; -bool getFileInfo(const char *path, FileInfo *fileInfo); -bool rIsDir(const std::string& filename); +bool get_file_info(const std::string& path, FileInfo& fileInfo); +bool rIsDir(const std::string& dir); bool rRmdir(const std::string& dir); bool rMkdir(const std::string& dir); bool rMkpath(const std::string& path); diff --git a/rpcs3/Emu/FS/vfsDirBase.h b/rpcs3/Emu/FS/vfsDirBase.h index 654cc72d01..4bb707a941 100644 --- a/rpcs3/Emu/FS/vfsDirBase.h +++ b/rpcs3/Emu/FS/vfsDirBase.h @@ -16,12 +16,14 @@ struct DirEntryInfo { std::string name; u32 flags; + u64 size; time_t create_time; time_t access_time; time_t modify_time; DirEntryInfo() : flags(0) + , size(0) , create_time(0) , access_time(0) , modify_time(0) diff --git a/rpcs3/Emu/FS/vfsLocalDir.cpp b/rpcs3/Emu/FS/vfsLocalDir.cpp index cad28f5a64..3d88c57b28 100644 --- a/rpcs3/Emu/FS/vfsLocalDir.cpp +++ b/rpcs3/Emu/FS/vfsLocalDir.cpp @@ -12,30 +12,29 @@ vfsLocalDir::~vfsLocalDir() bool vfsLocalDir::Open(const std::string& path) { - if(!vfsDirBase::Open(path)) - return false; - - if(!dir.Open(path)) + if (!vfsDirBase::Open(path) || !dir.Open(path)) + { return false; + } std::string name; - for(bool is_ok = dir.GetFirst(&name); is_ok; is_ok = dir.GetNext(&name)) + + for (bool is_ok = dir.GetFirst(&name); is_ok; is_ok = dir.GetNext(&name)) { - std::string dir_path = path + "/" + name; + FileInfo file_info; + get_file_info(path + "/" + name, file_info); m_entries.emplace_back(); - // TODO: Use same info structure as fileinfo? + DirEntryInfo& info = m_entries.back(); + info.name = name; - - FileInfo fileinfo; - getFileInfo(dir_path.c_str(), &fileinfo); - - // Not sure of purpose for below. I hope these don't need to be correct - info.flags |= rIsDir(dir_path) ? DirEntry_TypeDir : DirEntry_TypeFile; - if(fileinfo.isWritable) info.flags |= DirEntry_PermWritable; - info.flags |= DirEntry_PermReadable; // Always? - info.flags |= DirEntry_PermExecutable; // Always? + info.flags |= file_info.isDirectory ? DirEntry_TypeDir | DirEntry_PermExecutable : DirEntry_TypeFile; + info.flags |= file_info.isWritable ? DirEntry_PermWritable | DirEntry_PermReadable : DirEntry_PermReadable; + info.size = file_info.size; + info.access_time = file_info.atime; + info.modify_time = file_info.mtime; + info.create_time = file_info.ctime; } return true; diff --git a/rpcs3/Emu/Memory/vm_ptr.h b/rpcs3/Emu/Memory/vm_ptr.h index 79fca811d9..9a00011942 100644 --- a/rpcs3/Emu/Memory/vm_ptr.h +++ b/rpcs3/Emu/Memory/vm_ptr.h @@ -410,35 +410,47 @@ namespace vm static_assert(!sizeof(AT), "vm::_ptr_base<> error: use RT(T...) format for functions instead of RT(*)(T...)"); }; - //BE pointer to LE data + // BE pointer to LE data template using bptrl = _ptr_base::type>; - //BE pointer to BE data + // BE pointer to BE data template using bptrb = _ptr_base::type, lvl, typename to_be_t::type>; - //LE pointer to BE data + // LE pointer to BE data template using lptrb = _ptr_base::type, lvl, AT>; - //LE pointer to LE data + // LE pointer to LE data template using lptrl = _ptr_base; namespace ps3 { - //default pointer for HLE functions (LE pointer to BE data) + // default pointer for HLE functions (LE pointer to BE data) template using ptr = lptrb; - //default pointer for HLE structures (BE pointer to BE data) + // default pointer for HLE structures (BE pointer to BE data) template using bptr = bptrb; } namespace psv { - //default pointer for HLE functions & structures (LE pointer to LE data) + // default pointer for HLE functions & structures (LE pointer to LE data) template using ptr = lptrl; } - //PS3 emulation is main now, so lets it be as default + // PS3 emulation is main now, so lets it be as default using namespace ps3; + + struct null_t + { + template operator _ptr_base() const + { + const std::array value = {}; + return _ptr_base::make(value[0]); + } + }; + + // vm::null is convertible to any vm::ptr type as null pointer in virtual memory + static const null_t null; } namespace fmt diff --git a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp index 0177187f73..1a574fedbe 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp @@ -21,96 +21,64 @@ extern Module cellSysutil; // Auxiliary Classes -class sortSaveDataEntry +class SortSaveDataEntry { - u32 sortType; - u32 sortOrder; + const u32 m_type; + const u32 m_order; + public: - sortSaveDataEntry(u32 type, u32 order) : sortType(type), sortOrder(order) {} + SortSaveDataEntry(u32 type, u32 order) + : m_type(type) + , m_order(order) + { + } + bool operator()(const SaveDataEntry& entry1, const SaveDataEntry& entry2) const { - if (sortOrder == CELL_SAVEDATA_SORTORDER_DESCENT) + if (m_order == CELL_SAVEDATA_SORTORDER_DESCENT) { - if (sortType == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME) - return entry1.st_mtime_ >= entry2.st_mtime_; - if (sortType == CELL_SAVEDATA_SORTTYPE_SUBTITLE) + if (m_type == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME) + { + return entry1.mtime >= entry2.mtime; + } + + if (m_type == CELL_SAVEDATA_SORTTYPE_SUBTITLE) + { return entry1.subtitle >= entry2.subtitle; + } } - if (sortOrder == CELL_SAVEDATA_SORTORDER_ASCENT) + + if (m_order == CELL_SAVEDATA_SORTORDER_ASCENT) { - if (sortType == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME) - return entry1.st_mtime_ < entry2.st_mtime_; - if (sortType == CELL_SAVEDATA_SORTTYPE_SUBTITLE) + if (m_type == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME) + { + return entry1.mtime < entry2.mtime; + } + + if (m_type == CELL_SAVEDATA_SORTTYPE_SUBTITLE) + { return entry1.subtitle < entry2.subtitle; + } } + return true; } }; // Auxiliary Functions -u64 getSaveDataSize(const std::string& dirName) +u64 get_save_data_size(const std::string& dir) { - vfsDir dir(dirName); - if (!dir.IsOpened()) - return 0; + u64 result = 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(); + for (const auto entry : vfsDir(dir)) + { + if ((entry->flags & DirEntry_TypeMask) == DirEntry_TypeFile) + { + result += vfsFile(dir + "/" + entry->name).GetSize(); } } - return totalSize; -} -void addSaveDataEntry(std::vector& saveEntries, const std::string& saveDir) -{ - // PSF parameters - vfsFile f(saveDir + "/PARAM.SFO"); - PSFLoader psf(f); - if(!psf.Load(false)) - return; - - // PNG icon - std::string localPath; - Emu.GetVFS().GetDevice(saveDir + "/ICON0.PNG", localPath); - - u64 atime = 0; - u64 mtime = 0; - u64 ctime = 0; - - cellSysutil.Error("Running _stat in cellSaveData. Please report this to a RPCS3 developer!"); - - std::string real_path; - struct stat buf; - - Emu.GetVFS().GetDevice(f.GetPath(), real_path); - - if (stat(real_path.c_str(), &buf) != 0) - cellSysutil.Error("stat failed! (%s)", real_path.c_str()); - else - { - atime = buf.st_atime; - mtime = buf.st_mtime; - ctime = buf.st_ctime; - } - - SaveDataEntry 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 = (u32)(getSaveDataSize(saveDir) / 1024); - saveEntry.st_atime_ = atime; - saveEntry.st_mtime_ = mtime; - saveEntry.st_ctime_ = ctime; - saveEntry.iconBuf = NULL; // TODO: Here should be the PNG buffer - saveEntry.iconBufSize = 0; // TODO: Size of the PNG file - saveEntry.isNew = false; - - saveEntries.push_back(saveEntry); + return result; } void addNewSaveDataEntry(std::vector& saveEntries, vm::ptr newData) @@ -119,8 +87,8 @@ void addNewSaveDataEntry(std::vector& saveEntries, vm::ptrdirName.get_ptr(); saveEntry.title = newData->icon->title.get_ptr(); saveEntry.subtitle = newData->icon->title.get_ptr(); - saveEntry.iconBuf = newData->icon->iconBuf.get_ptr(); - saveEntry.iconBufSize = newData->icon->iconBufSize; + //saveEntry.iconBuf = newData->icon->iconBuf.get_ptr(); + //saveEntry.iconBufSize = newData->icon->iconBufSize; saveEntry.isNew = true; // TODO: Add information stored in newData->iconPosition. (It's not very relevant) @@ -175,8 +143,8 @@ void setSaveDataFixed(std::vector& saveEntries, vm::ptrnewIcon) { - saveEntries[0].iconBuf = fixedSet->newIcon->iconBuf.get_ptr(); - saveEntries[0].iconBufSize = fixedSet->newIcon->iconBufSize; + //saveEntries[0].iconBuf = fixedSet->newIcon->iconBuf.get_ptr(); + //saveEntries[0].iconBufSize = fixedSet->newIcon->iconBufSize; saveEntries[0].title = fixedSet->newIcon->title.get_ptr(); saveEntries[0].subtitle = fixedSet->newIcon->title.get_ptr(); } @@ -334,7 +302,8 @@ enum : u32 SAVEDATA_OP_FIXED_DELETE = 14, }; -s32 savedata_op( +__noinline s32 savedata_op( + PPUThread& CPU, u32 operation, u32 version, vm::ptr dirName, @@ -351,11 +320,128 @@ s32 savedata_op( u32 userId, vm::ptr funcDone) { + static const std::string base_dir = "/dev_hdd0/home/00000001/savedata/"; // TODO: Get the path of the current or specified user + vm::stackvar result(CPU); + vm::stackvar listGet(CPU); + vm::stackvar listSet(CPU); + vm::stackvar statGet(CPU); + vm::stackvar statSet(CPU); + + result->userdata = userdata; + + std::vector save_entries; + + if (setList) + { + listGet->dirNum = 0; + listGet->dirListNum = 0; + listGet->dirList.set(setBuf->buf.addr()); + memset(listGet->reserved, 0, sizeof(listGet->reserved)); + + const auto prefix_list = fmt::split(setList->dirNamePrefix.get_ptr(), { "|" }); + + for (const auto entry : vfsDir(base_dir)) + { + if ((entry->flags & DirEntry_TypeMask) != DirEntry_TypeDir) + { + continue; + } + + for (const auto& prefix : prefix_list) + { + if (entry->name.substr(0, prefix.size()) == prefix) + { + // Count the amount of matches and the amount of listed directories + if (listGet->dirListNum++ < setBuf->dirListMax) + { + listGet->dirNum++; + + // PSF parameters + vfsFile f(base_dir + entry->name + "/PARAM.SFO"); + PSFLoader psf(f); + if (!psf.Load(false)) + { + break; + } + + SaveDataEntry save_entry; + save_entry.dirName = psf.GetString("SAVEDATA_DIRECTORY"); + save_entry.listParam = psf.GetString("SAVEDATA_LIST_PARAM"); + save_entry.title = psf.GetString("TITLE"); + save_entry.subtitle = psf.GetString("SUB_TITLE"); + save_entry.details = psf.GetString("DETAIL"); + save_entry.sizeKB = get_save_data_size(base_dir + entry->name) / 1024; + save_entry.atime = entry->access_time; + save_entry.mtime = entry->modify_time; + save_entry.ctime = entry->create_time; + //save_entry.iconBuf = NULL; // TODO: Here should be the PNG buffer + //save_entry.iconBufSize = 0; // TODO: Size of the PNG file + save_entry.isNew = false; + + save_entries.push_back(save_entry); + } + + break; + } + } + } + + // Sort the entries + std::sort(save_entries.begin(), save_entries.end(), SortSaveDataEntry(setList->sortType, setList->sortOrder)); + + // Fill the listGet->dirList array + auto dir_list = listGet->dirList.get_ptr(); + + for (const auto& entry : save_entries) + { + auto& dir = *dir_list++; + strcpy_trunc(dir.dirName, entry.dirName); + strcpy_trunc(dir.listParam, entry.listParam); + memset(dir.reserved, 0, sizeof(dir.reserved)); + } + + // Data List Callback + funcList(result, listGet, listSet); + } + + + + + setSaveDataList(save_entries, listSet->fixedList, listSet->fixedListNum); + if (listSet->newData) + addNewSaveDataEntry(save_entries, listSet->newData); + if (save_entries.size() == 0) { + cellSysutil.Error("cellSaveDataListLoad2: No save entries found!"); // TODO: Find a better way to handle this error + return CELL_OK; + } + + u32 focusIndex = focusSaveDataEntry(save_entries, listSet->focusPosition); + // TODO: Display the dialog here + u32 selectedIndex = focusIndex; // TODO: Until the dialog is implemented, select always the focused entry + getSaveDataStat(save_entries[selectedIndex], statGet); + result->userdata = userdata; + + funcStat(result, statGet, statSet); + Memory.Free(statGet->fileList.addr()); + if (result->result < 0) { + cellSysutil.Error("cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. + return CELL_SAVEDATA_ERROR_CBRESULT; + } + + /*if (statSet->setParam) + // TODO: Write PARAM.SFO file + */ + + // Enter the loop where the save files are read/created/deleted. + s32 ret = modifySaveDataFiles(funcFile, result, base_dir + (char*)statGet->dir.dirName); + + return ret; } // Functions s32 cellSaveDataListSave2( + PPUThread& CPU, u32 version, vm::ptr setList, vm::ptr setBuf, @@ -368,85 +454,11 @@ s32 cellSaveDataListSave2( cellSysutil.Warning("cellSaveDataListSave2(version=%d, setList=*0x%x, setBuf=*0x%x, funcList=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, setList, setBuf, funcList, funcStat, funcFile, container, userdata); - vm::var result; - vm::var listGet; - vm::var listSet; - vm::var statGet; - vm::var statSet; - - 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 = setList->dirNamePrefix.get_ptr(); - std::vector saveEntries; - - for (const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read()) - { - if (entry->flags & DirEntry_TypeDir && entry->name.substr(0, 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 + entry->name; - addSaveDataEntry(saveEntries, saveDir); - } - } - - // Sort the entries and fill the listGet->dirList array - std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder)); - listGet->dirList.set(setBuf->buf.addr()); - auto dirList = listGet->dirList.get_ptr(); - - for (u32 i = 0; iresult < 0) { - cellSysutil.Error("cellSaveDataListSave2: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. - return CELL_SAVEDATA_ERROR_CBRESULT; - } - - setSaveDataList(saveEntries, listSet->fixedList, listSet->fixedListNum); - if (listSet->newData) - addNewSaveDataEntry(saveEntries, listSet->newData); - if (saveEntries.size() == 0) { - cellSysutil.Error("cellSaveDataListSave2: No save entries found!"); // TODO: Find a better way to handle this error - return CELL_OK; - } - - u32 focusIndex = focusSaveDataEntry(saveEntries, listSet->focusPosition); - // TODO: Display the dialog here - u32 selectedIndex = focusIndex; // TODO: Until the dialog is implemented, select always the focused entry - getSaveDataStat(saveEntries[selectedIndex], statGet); - result->userdata = userdata; - - funcStat(result, statGet, statSet); - Memory.Free(statGet->fileList.addr()); - if (result->result < 0) { - cellSysutil.Error("cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. - return CELL_SAVEDATA_ERROR_CBRESULT; - } - - /*if (statSet->setParam) - addNewSaveDataEntry(saveEntries, (u32)listSet->newData.addr()); // TODO: This *is* wrong - */ - - // Enter the loop where the save files are read/created/deleted. - s32 ret = modifySaveDataFiles(funcFile, result, saveBaseDir + (char*)statGet->dir.dirName); - - return ret; + return savedata_op(CPU, SAVEDATA_OP_LIST_SAVE, version, vm::null, 1, setList, setBuf, funcList, vm::null, funcStat, funcFile, container, 2, userdata, 0, vm::null); } s32 cellSaveDataListLoad2( + PPUThread& CPU, u32 version, vm::ptr setList, vm::ptr setBuf, @@ -459,86 +471,11 @@ s32 cellSaveDataListLoad2( cellSysutil.Warning("cellSaveDataListLoad2(version=%d, setList=*0x%x, setBuf=*0x%x, funcList=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, setList, setBuf, funcList, funcStat, funcFile, container, userdata); - vm::var result; - vm::var listGet; - vm::var listSet; - vm::var statGet; - vm::var statSet; - - 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 = setList->dirNamePrefix.get_ptr(); - std::vector saveEntries; - - for (const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read()) - { - if (entry->flags & DirEntry_TypeDir && entry->name.substr(0, 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 + entry->name; - addSaveDataEntry(saveEntries, saveDir); - } - } - - // Sort the entries and fill the listGet->dirList array - std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder)); - listGet->dirList.set(setBuf->buf.addr()); - auto dirList = listGet->dirList.get_ptr(); - - for (u32 i = 0; iresult < 0) { - cellSysutil.Error("cellSaveDataListLoad2: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. - return CELL_SAVEDATA_ERROR_CBRESULT; - } - - setSaveDataList(saveEntries, listSet->fixedList, listSet->fixedListNum); - if (listSet->newData) - addNewSaveDataEntry(saveEntries, listSet->newData); - if (saveEntries.size() == 0) { - cellSysutil.Error("cellSaveDataListLoad2: No save entries found!"); // TODO: Find a better way to handle this error - return CELL_OK; - } - - u32 focusIndex = focusSaveDataEntry(saveEntries, listSet->focusPosition); - // TODO: Display the dialog here - u32 selectedIndex = focusIndex; // TODO: Until the dialog is implemented, select always the focused entry - getSaveDataStat(saveEntries[selectedIndex], statGet); - result->userdata = userdata; - - funcStat(result, statGet, statSet); - Memory.Free(statGet->fileList.addr()); - if (result->result < 0) { - cellSysutil.Error("cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. - return CELL_SAVEDATA_ERROR_CBRESULT; - } - - /*if (statSet->setParam) - // TODO: Write PARAM.SFO file - */ - - // Enter the loop where the save files are read/created/deleted. - s32 ret = modifySaveDataFiles(funcFile, result, saveBaseDir + (char*)statGet->dir.dirName); - - return ret; + return savedata_op(CPU, SAVEDATA_OP_LIST_LOAD, version, vm::null, 1, setList, setBuf, funcList, vm::null, funcStat, funcFile, container, 2, userdata, 0, vm::null); } s32 cellSaveDataFixedSave2( + PPUThread& CPU, u32 version, vm::ptr setList, vm::ptr setBuf, @@ -551,70 +488,11 @@ s32 cellSaveDataFixedSave2( cellSysutil.Warning("cellSaveDataFixedSave2(version=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, setList, setBuf, funcFixed, funcStat, funcFile, container, userdata); - vm::var result; - vm::var listGet; - vm::var fixedSet; - vm::var statGet; - vm::var statSet; - - 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 = setList->dirNamePrefix.get_ptr(); - std::vector saveEntries; - for (const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read()) - { - if (entry->flags & DirEntry_TypeDir && entry->name.substr(0, 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 + entry->name; - addSaveDataEntry(saveEntries, saveDir); - } - } - - // Sort the entries and fill the listGet->dirList array - std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder)); - listGet->dirList.set(setBuf->buf.addr()); - auto dirList = listGet->dirList.get_ptr(); - for (u32 i = 0; iresult < 0) { - cellSysutil.Error("cellSaveDataFixedSave2: CellSaveDataFixedCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. - return CELL_SAVEDATA_ERROR_CBRESULT; - } - setSaveDataFixed(saveEntries, fixedSet); - getSaveDataStat(saveEntries[0], statGet); // There should be only one element in this list - // TODO: Display the Yes|No dialog here - result->userdata = userdata; - - funcStat(result, statGet, statSet); - Memory.Free(statGet->fileList.addr()); - if (result->result < 0) { - cellSysutil.Error("cellSaveDataFixedSave2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. - return CELL_SAVEDATA_ERROR_CBRESULT; - } - /*if (statSet->setParam) - // TODO: Write PARAM.SFO file - */ - - // Enter the loop where the save files are read/created/deleted. - s32 ret = modifySaveDataFiles(funcFile, result, saveBaseDir + (char*)statGet->dir.dirName); - - return ret; + return savedata_op(CPU, SAVEDATA_OP_FIXED_SAVE, version, vm::null, 1, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 2, userdata, 0, vm::null); } s32 cellSaveDataFixedLoad2( + PPUThread& CPU, u32 version, vm::ptr setList, vm::ptr setBuf, @@ -627,70 +505,11 @@ s32 cellSaveDataFixedLoad2( cellSysutil.Warning("cellSaveDataFixedLoad2(version=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, setList, setBuf, funcFixed, funcStat, funcFile, container, userdata); - vm::var result; - vm::var listGet; - vm::var fixedSet; - vm::var statGet; - vm::var statSet; - - 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 = setList->dirNamePrefix.get_ptr(); - std::vector saveEntries; - for (const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read()) - { - if (entry->flags & DirEntry_TypeDir && entry->name.substr(0, 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 + entry->name; - addSaveDataEntry(saveEntries, saveDir); - } - } - - // Sort the entries and fill the listGet->dirList array - std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder)); - listGet->dirList.set(setBuf->buf.addr()); - auto dirList = listGet->dirList.get_ptr(); - for (u32 i = 0; iresult < 0) { - cellSysutil.Error("cellSaveDataFixedLoad2: CellSaveDataFixedCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. - return CELL_SAVEDATA_ERROR_CBRESULT; - } - setSaveDataFixed(saveEntries, fixedSet); - getSaveDataStat(saveEntries[0], statGet); // There should be only one element in this list - // TODO: Display the Yes|No dialog here - result->userdata = userdata; - - funcStat(result, statGet, statSet); - Memory.Free(statGet->fileList.addr()); - if (result->result < 0) { - cellSysutil.Error("cellSaveDataFixedLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. - return CELL_SAVEDATA_ERROR_CBRESULT; - } - /*if (statSet->setParam) - // TODO: Write PARAM.SFO file - */ - - // Enter the loop where the save files are read/created/deleted. - s32 ret = modifySaveDataFiles(funcFile, result, saveBaseDir + (char*)statGet->dir.dirName); - - return ret; + return savedata_op(CPU, SAVEDATA_OP_FIXED_LOAD, version, vm::null, 1, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 2, userdata, 0, vm::null); } s32 cellSaveDataAutoSave2( + PPUThread& CPU, u32 version, vm::ptr dirName, u32 errDialog, @@ -703,55 +522,11 @@ s32 cellSaveDataAutoSave2( cellSysutil.Warning("cellSaveDataAutoSave2(version=%d, dirName=*0x%x, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, dirName, errDialog, setBuf, funcStat, funcFile, container, userdata); - vm::var result; - vm::var statGet; - vm::var statSet; - - 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 dirN = dirName.get_ptr(); - std::vector saveEntries; - for (const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read()) - { - if (entry->flags & DirEntry_TypeDir && entry->name == dirN) { - addSaveDataEntry(saveEntries, saveBaseDir + dirN); - } - } - - // The target entry does not exist - if (saveEntries.size() == 0) { - SaveDataEntry entry; - entry.dirName = dirN; - entry.sizeKB = 0; - entry.isNew = true; - saveEntries.push_back(entry); - } - - getSaveDataStat(saveEntries[0], statGet); // There should be only one element in this list - result->userdata = userdata; - funcStat(result, statGet, statSet); - - if (statGet->fileList) - Memory.Free(statGet->fileList.addr()); - - if (result->result < 0) { - cellSysutil.Error("cellSaveDataAutoSave2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. - return CELL_SAVEDATA_ERROR_CBRESULT; - } - /*if (statSet->setParam) - // TODO: Write PARAM.SFO file - */ - - // Enter the loop where the save files are read/created/deleted. - s32 ret = modifySaveDataFiles(funcFile, result, saveBaseDir + (char*)statGet->dir.dirName); - - return CELL_OK; + return savedata_op(CPU, SAVEDATA_OP_AUTO_SAVE, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 2, userdata, 0, vm::null); } s32 cellSaveDataAutoLoad2( + PPUThread& CPU, u32 version, vm::ptr dirName, u32 errDialog, @@ -764,50 +539,11 @@ s32 cellSaveDataAutoLoad2( cellSysutil.Warning("cellSaveDataAutoLoad2(version=%d, dirName=*0x%x, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, dirName, errDialog, setBuf, funcStat, funcFile, container, userdata); - vm::var result; - vm::var statGet; - vm::var statSet; - - 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 dirN = dirName.get_ptr(); - std::vector saveEntries; - for (const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read()) - { - if (entry->flags & DirEntry_TypeDir && entry->name == dirN) { - addSaveDataEntry(saveEntries, saveBaseDir + dirN); - } - } - - // The target entry does not exist - if (saveEntries.size() == 0) { - cellSysutil.Error("cellSaveDataAutoLoad2: Couldn't find save entry (%s)", dirN.c_str()); - return CELL_OK; // TODO: Can anyone check the actual behaviour of a PS3 when saves are not found? - } - - getSaveDataStat(saveEntries[0], statGet); // There should be only one element in this list - result->userdata = userdata; - funcStat(result, statGet, statSet); - - Memory.Free(statGet->fileList.addr()); - if (result->result < 0) { - cellSysutil.Error("cellSaveDataAutoLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. - return CELL_SAVEDATA_ERROR_CBRESULT; - } - /*if (statSet->setParam) - // TODO: Write PARAM.SFO file - */ - - // Enter the loop where the save files are read/created/deleted. - s32 ret = modifySaveDataFiles(funcFile, result, saveBaseDir + (char*)statGet->dir.dirName); - - return CELL_OK; + return savedata_op(CPU, SAVEDATA_OP_AUTO_LOAD, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 2, userdata, 0, vm::null); } s32 cellSaveDataListAutoSave( + PPUThread& CPU, u32 version, u32 errDialog, vm::ptr setList, @@ -818,79 +554,14 @@ s32 cellSaveDataListAutoSave( u32 container, vm::ptr userdata) { - cellSysutil.Todo("cellSaveDataListAutoSave(version=%d, errDialog=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", + cellSysutil.Warning("cellSaveDataListAutoSave(version=%d, errDialog=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, errDialog, setList, setBuf, funcFixed, funcStat, funcFile, container, userdata); - //vm::var result; - //vm::var listGet; - //vm::var fixedSet; - //vm::var statGet; - //vm::var statSet; - - //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 = setList->dirNamePrefix.get_ptr(); - //std::vector saveEntries; - - //for (const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read()) - //{ - // if (entry->flags & DirEntry_TypeDir && entry->name.substr(0, 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 + entry->name; - // addSaveDataEntry(saveEntries, saveDir); - // } - //} - - //// Sort the entries and fill the listGet->dirList array - //std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder)); - //listGet->dirList = vm::bptr::make(setBuf->buf.addr()); - //auto dirList = vm::get_ptr(listGet->dirList.addr()); - - //for (u32 i = 0; iresult < 0) { - // cellSysutil.Error("cellSaveDataListAutoSave: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. - // return CELL_SAVEDATA_ERROR_CBRESULT; - //} - - //setSaveDataFixed(saveEntries, fixedSet); - //getSaveDataStat(saveEntries[0], statGet); // There should be only one element in this list - //// TODO: Display the Yes|No dialog here - //result->userdata = userdata; - - //funcStat(result, statGet, statSet); - //Memory.Free(statGet->fileList.addr()); - //if (result->result < 0) { - // cellSysutil.Error("cellSaveDataListAutoSave: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. - // return CELL_SAVEDATA_ERROR_CBRESULT; - //} - - ///*if (statSet->setParam) - //// TODO: Write PARAM.SFO file - //*/ - - //// Enter the loop where the save files are read/created/deleted. - //s32 ret = modifySaveDataFiles(funcFile, result, saveBaseDir + (char*)statGet->dir.dirName); - return CELL_OK; + return savedata_op(CPU, SAVEDATA_OP_LIST_AUTO_SAVE, version, vm::null, errDialog, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 0, userdata, 0, vm::null); } s32 cellSaveDataListAutoLoad( + PPUThread& CPU, u32 version, u32 errDialog, vm::ptr setList, @@ -901,78 +572,10 @@ s32 cellSaveDataListAutoLoad( u32 container, vm::ptr userdata) { - cellSysutil.Todo("cellSaveDataListAutoLoad(version=%d, errDialog=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", + cellSysutil.Warning("cellSaveDataListAutoLoad(version=%d, errDialog=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, errDialog, setList, setBuf, funcFixed, funcStat, funcFile, container, userdata); - //vm::var result; - //vm::var listGet; - //vm::var fixedSet; - //vm::var statGet; - //vm::var statSet; - - //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 = setList->dirNamePrefix.get_ptr(); - //std::vector saveEntries; - - //for (const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read()) - //{ - // if (entry->flags & DirEntry_TypeDir && entry->name.substr(0, 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 + entry->name; - // addSaveDataEntry(saveEntries, saveDir); - // } - //} - - //// Sort the entries and fill the listGet->dirList array - //std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder)); - //listGet->dirList = vm::bptr::make(setBuf->buf.addr()); - //auto dirList = vm::get_ptr(listGet->dirList.addr()); - - //for (u32 i = 0; idirList[i].reserved)); - //} - - //funcFixed(result, listGet, fixedSet); - - //if (result->result < 0) { - // cellSysutil.Error("cellSaveDataListAutoLoad: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. - // return CELL_SAVEDATA_ERROR_CBRESULT; - //} - - //setSaveDataFixed(saveEntries, fixedSet); - //getSaveDataStat(saveEntries[0], statGet); // There should be only one element in this list - //// TODO: Display the Yes|No dialog here - //result->userdata = userdata; - - //funcStat(result, statGet, statSet); - //Memory.Free(statGet->fileList.addr()); - - //if (result->result < 0) { - // cellSysutil.Error("cellSaveDataFixedLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. - // return CELL_SAVEDATA_ERROR_CBRESULT; - //} - - ///*if (statSet->setParam) - //// TODO: Write PARAM.SFO file - //*/ - - //// Enter the loop where the save files are read/created/deleted. - //s32 ret = modifySaveDataFiles(funcFile, result, saveBaseDir + (char*)statGet->dir.dirName); - - return CELL_OK; + return savedata_op(CPU, SAVEDATA_OP_LIST_AUTO_LOAD, version, vm::null, errDialog, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 0, userdata, 0, vm::null); } s32 cellSaveDataDelete2(u32 container) @@ -983,6 +586,7 @@ s32 cellSaveDataDelete2(u32 container) } s32 cellSaveDataFixedDelete( + PPUThread& CPU, vm::ptr setList, vm::ptr setBuf, vm::ptr funcFixed, @@ -997,6 +601,7 @@ s32 cellSaveDataFixedDelete( } s32 cellSaveDataUserListSave( + PPUThread& CPU, u32 version, u32 userId, vm::ptr setList, @@ -1014,6 +619,7 @@ s32 cellSaveDataUserListSave( } s32 cellSaveDataUserListLoad( + PPUThread& CPU, u32 version, u32 userId, vm::ptr setList, @@ -1031,6 +637,7 @@ s32 cellSaveDataUserListLoad( } s32 cellSaveDataUserFixedSave( + PPUThread& CPU, u32 version, u32 userId, vm::ptr setList, @@ -1048,6 +655,7 @@ s32 cellSaveDataUserFixedSave( } s32 cellSaveDataUserFixedLoad( + PPUThread& CPU, u32 version, u32 userId, vm::ptr setList, @@ -1065,6 +673,7 @@ s32 cellSaveDataUserFixedLoad( } s32 cellSaveDataUserAutoSave( + PPUThread& CPU, u32 version, u32 userId, vm::ptr dirName, @@ -1082,6 +691,7 @@ s32 cellSaveDataUserAutoSave( } s32 cellSaveDataUserAutoLoad( + PPUThread& CPU, u32 version, u32 userId, vm::ptr dirName, @@ -1099,6 +709,7 @@ s32 cellSaveDataUserAutoLoad( } s32 cellSaveDataUserListAutoSave( + PPUThread& CPU, u32 version, u32 userId, u32 errDialog, @@ -1117,6 +728,7 @@ s32 cellSaveDataUserListAutoSave( } s32 cellSaveDataUserListAutoLoad( + PPUThread& CPU, u32 version, u32 userId, u32 errDialog, @@ -1135,6 +747,7 @@ s32 cellSaveDataUserListAutoLoad( } s32 cellSaveDataUserFixedDelete( + PPUThread& CPU, u32 userId, vm::ptr setList, vm::ptr setBuf, @@ -1159,6 +772,7 @@ void cellSaveDataEnableOverlay(s32 enable) // Functions (Extensions) s32 cellSaveDataListDelete( + PPUThread& CPU, vm::ptr setList, vm::ptr setBuf, vm::ptr funcList, @@ -1172,6 +786,7 @@ s32 cellSaveDataListDelete( } s32 cellSaveDataListImport( + PPUThread& CPU, vm::ptr setList, u32 maxSizeKB, vm::ptr funcDone, @@ -1184,6 +799,7 @@ s32 cellSaveDataListImport( } s32 cellSaveDataListExport( + PPUThread& CPU, vm::ptr setList, u32 maxSizeKB, vm::ptr funcDone, @@ -1196,6 +812,7 @@ s32 cellSaveDataListExport( } s32 cellSaveDataFixedImport( + PPUThread& CPU, vm::ptr dirName, u32 maxSizeKB, vm::ptr funcDone, @@ -1208,6 +825,7 @@ s32 cellSaveDataFixedImport( } s32 cellSaveDataFixedExport( + PPUThread& CPU, vm::ptr dirName, u32 maxSizeKB, vm::ptr funcDone, @@ -1232,6 +850,7 @@ s32 cellSaveDataGetListItem( } s32 cellSaveDataUserListDelete( + PPUThread& CPU, u32 userId, vm::ptr setList, vm::ptr setBuf, @@ -1246,6 +865,7 @@ s32 cellSaveDataUserListDelete( } s32 cellSaveDataUserListImport( + PPUThread& CPU, u32 userId, vm::ptr setList, u32 maxSizeKB, @@ -1259,6 +879,7 @@ s32 cellSaveDataUserListImport( } s32 cellSaveDataUserListExport( + PPUThread& CPU, u32 userId, vm::ptr setList, u32 maxSizeKB, @@ -1272,6 +893,7 @@ s32 cellSaveDataUserListExport( } s32 cellSaveDataUserFixedImport( + PPUThread& CPU, u32 userId, vm::ptr dirName, u32 maxSizeKB, @@ -1285,6 +907,7 @@ s32 cellSaveDataUserFixedImport( } s32 cellSaveDataUserFixedExport( + PPUThread& CPU, u32 userId, vm::ptr dirName, u32 maxSizeKB, diff --git a/rpcs3/Emu/SysCalls/Modules/cellSaveData.h b/rpcs3/Emu/SysCalls/Modules/cellSaveData.h index 48a7f0c60f..e804ad4dc6 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSaveData.h +++ b/rpcs3/Emu/SysCalls/Modules/cellSaveData.h @@ -271,11 +271,11 @@ struct SaveDataEntry std::string title; std::string subtitle; std::string details; - u32 sizeKB; - s64 st_atime_; - s64 st_mtime_; - s64 st_ctime_; - void* iconBuf; - u32 iconBufSize; + u64 sizeKB; + s64 atime; + s64 mtime; + s64 ctime; + //void* iconBuf; + //u32 iconBufSize; bool isNew; }; diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index ae8ee24328..7e3a9b21f2 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -72,7 +72,6 @@ Emulator::~Emulator() delete m_callback_manager; delete m_event_manager; delete m_module_manager; - delete m_sync_prim_manager; delete m_vfs; } diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index 3d31c35d08..5f8c114132 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -21,7 +21,6 @@ class CallbackManager; class CPUThread; class EventManager; class ModuleManager; -class SyncPrimManager; struct VFS; struct EmuInfo @@ -91,7 +90,6 @@ class Emulator CallbackManager* m_callback_manager; EventManager* m_event_manager; ModuleManager* m_module_manager; - SyncPrimManager* m_sync_prim_manager; VFS* m_vfs; EmuInfo m_info;