mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-12 09:09:29 +01:00
Merge pull request #4334 from shenweip/patch-13
Add support for saveNameListData "<>".
This commit is contained in:
commit
5683b1def3
2 files changed
+41
-5
No files matched your search
@@ -1092,14 +1092,42 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param)
|
||||
{
|
||||
hasMultipleFileName = true;
|
||||
saveDataList = new SaveFileInfo[saveDataListCount];
|
||||
|
||||
|
||||
// get and stock file info for each file
|
||||
int realCount = 0;
|
||||
for (int i = 0; i < saveDataListCount; i++)
|
||||
{
|
||||
// TODO: Maybe we should fill the list with existing files instead?
|
||||
if (strcmp(saveNameListData[i], "<>") == 0)
|
||||
for (int i = 0; i < saveDataListCount; i++) {
|
||||
// "<>" means saveName can be anything...
|
||||
if (strcmp(saveNameListData[i], "<>") == 0) {
|
||||
std::string fileDataPath = "";
|
||||
auto allSaves = pspFileSystem.GetDirListing(savePath);
|
||||
std::string gameName = GetGameName(param);
|
||||
std::string saveName = "";
|
||||
for(auto it = allSaves.begin(); it != allSaves.end(); ++it) {
|
||||
|
||||
if(strncmp(it->name.c_str(),gameName.c_str(),strlen(gameName.c_str())) == 0) {
|
||||
saveName = it->name.substr(strlen(gameName.c_str()));
|
||||
|
||||
if(IsInSaveDataList(saveName, realCount)) // Already in SaveDataList, skip...
|
||||
continue;
|
||||
|
||||
fileDataPath = savePath + it->name + "/" + param->fileName;
|
||||
PSPFileInfo info = pspFileSystem.GetFileInfo(fileDataPath);
|
||||
if (info.exists) {
|
||||
SetFileInfo(realCount, info, saveName);
|
||||
DEBUG_LOG(SCEUTILITY,"%s Exist",fileDataPath.c_str());
|
||||
++realCount;
|
||||
} else {
|
||||
if (listEmptyFile) {
|
||||
ClearFileInfo(saveDataList[realCount], saveName);
|
||||
DEBUG_LOG(SCEUTILITY,"Don't Exist");
|
||||
++realCount;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
DEBUG_LOG(SCEUTILITY,"Name : %s",saveNameListData[i]);
|
||||
|
||||
@@ -1450,3 +1478,10 @@ bool SavedataParam::IsSaveEncrypted(SceUtilitySavedataParam* param, const std::s
|
||||
return isCrypted;
|
||||
}
|
||||
|
||||
bool SavedataParam::IsInSaveDataList(std::string saveName, int count) {
|
||||
for(int i = 0; i < count; ++i) {
|
||||
if(strcmp(saveDataList[i].saveName.c_str(),saveName.c_str()) == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -303,6 +303,7 @@ public:
|
||||
int GetFilesList(SceUtilitySavedataParam* param);
|
||||
bool GetSize(SceUtilitySavedataParam* param);
|
||||
bool IsSaveEncrypted(SceUtilitySavedataParam* param, const std::string &saveDirName);
|
||||
bool IsInSaveDataList(std::string saveName, int count);
|
||||
|
||||
std::string GetGameName(SceUtilitySavedataParam* param);
|
||||
std::string GetSaveName(SceUtilitySavedataParam* param);
|
||||
|
||||
Reference in new issue
Block a user