mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-17 12:47:46 +00:00
Add a check to avoid the same savedatas are set into SaveDataList.
This commit is contained in:
parent
e699eb95b2
commit
f4b60f22b0
@ -1103,9 +1103,14 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param)
|
||||
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;
|
||||
saveName = it->name.substr(strlen(gameName.c_str()));
|
||||
PSPFileInfo info = pspFileSystem.GetFileInfo(fileDataPath);
|
||||
if (info.exists) {
|
||||
SetFileInfo(realCount, info, saveName);
|
||||
@ -1473,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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user