fix: Some saved states was not recognized by the manager

This commit is contained in:
lantzelot-swe 2022-06-29 22:34:22 +02:00
parent 28795a8d5b
commit fc341cac63
1 changed files with 7 additions and 13 deletions

View File

@ -118,7 +118,9 @@ public class SavedStatesManager
} }
String fileName = model.getInfoModel().getGamesFile(); String fileName = model.getInfoModel().getGamesFile();
Path saveFolder = new File(SAVES + getGameFolderName(fileName, model.getInfoModel().getTitle())).toPath(); String gameFolderName = getGameFolderName(fileName, model.getInfoModel().getTitle());
Path saveFolder = new File(SAVES + gameFolderName).toPath();
int numberofSaves = 0; int numberofSaves = 0;
//Check which ones are available //Check which ones are available
Path mta0Path = saveFolder.resolve(MTA0); Path mta0Path = saveFolder.resolve(MTA0);
@ -162,7 +164,7 @@ public class SavedStatesManager
numberofSaves++; numberofSaves++;
} }
//Update current map also //Update current map also
savedStatesMap.put(fileName, numberofSaves); savedStatesMap.put(gameFolderName.toUpperCase(), numberofSaves);
} }
public void readSavedStates() public void readSavedStates()
@ -547,7 +549,7 @@ public class SavedStatesManager
savesAvailable++; savesAvailable++;
} }
//Add to map //Add to map
savedStatesMap.put(sourcePath.toFile().getName(), savesAvailable); savedStatesMap.put(sourcePath.toFile().getName().toUpperCase(), savesAvailable);
} }
catch (Exception e) catch (Exception e)
{ {
@ -563,16 +565,8 @@ public class SavedStatesManager
public int getNumberOfSavedStatesForGame(String gameFileName, String title) public int getNumberOfSavedStatesForGame(String gameFileName, String title)
{ {
String fileName = getGameFolderName(gameFileName, title); String fileName = getGameFolderName(gameFileName, title).toUpperCase();
if (savedStatesMap.get(fileName) == null) return savedStatesMap.get(fileName) == null ? 0 : savedStatesMap.get(fileName);
{
//Check with only uppercase also
return savedStatesMap.get(fileName.toUpperCase()) != null ? savedStatesMap.get(fileName.toUpperCase()) : 0;
}
else
{
return savedStatesMap.get(fileName);
}
} }
public void checkEnablementOfPalNtscMenuItem(boolean check) public void checkEnablementOfPalNtscMenuItem(boolean check)