target-bsnes: Patch up broken recent-game entries.

In f09c45f, we fixed native file picker dialogs, so they would correctly set the
"option" field to Auto when loading games, instead of leaving it set to an empty
string which effectively forced NTSC mode. However, this wouldn't fix up the old
entries in the Recent Games menu, so we will patch them up if we encounter them.
This commit is contained in:
Tim Allen 2020-11-04 15:45:15 +11:00 committed by Screwtapello
parent 33cb7eb106
commit a2571fe106
1 changed files with 14 additions and 0 deletions

View File

@ -468,6 +468,20 @@ auto Presentation::updateRecentGames() -> void {
} }
} }
//replace any empty option strings with "Auto", to work around a bug in bsnes
//v115 and below.
for(auto entry : settings[{"Game/Recent"}]) {
auto old_games = entry.text();
if(!old_games) continue;
vector<string> new_games;
for(auto& game : old_games.split("|")) {
auto parts = game.split(";", 1L);
if(parts[0] == "") parts[0] = "Auto";
new_games.append(parts.merge(";"));
}
entry.setValue(new_games.merge("|"));
}
//update list //update list
for(auto index : range(RecentGames)) { for(auto index : range(RecentGames)) {
MenuItem item{&loadRecentGame}; MenuItem item{&loadRecentGame};