Optimize MetaFileSystem::ReadEntireFile

This commit is contained in:
Henrik Rydgård committed 2021-09-11 19:32:37 +02:00
1 parent f53546362f
commit 8e2b73b05f
2 files changed
+4 -2

No files matched your search

+1 -1
View File
@@ -649,7 +649,7 @@ int SavedataParam::LoadSaveData(SceUtilitySavedataParam *param, const std::strin
std::string filename = GetFileName(param);
std::string filePath = dirPath + "/" + filename;
s64 readSize;
INFO_LOG(SCEUTILITY,"Loading file with size %u in %s",param->dataBufSize,filePath.c_str());
INFO_LOG(SCEUTILITY, "Loading file with size %u in %s", param->dataBufSize, filePath.c_str());
u8 *saveData = nullptr;
int saveSize = -1;
if (!ReadPSPFile(filePath, &saveData, saveSize, &readSize)) {
+3 -1
View File
@@ -588,7 +588,9 @@ int MetaFileSystem::ReadEntireFile(const std::string &filename, std::vector<u8>
if (handle < 0)
return handle;
size_t dataSize = (size_t)GetFileInfo(filename).size;
SeekFile(handle, 0, FILEMOVE_END);
size_t dataSize = GetSeekPos(handle);
SeekFile(handle, 0, FILEMOVE_BEGIN);
data.resize(dataSize);
size_t result = ReadFile(handle, (u8 *)&data[0], dataSize);