bugfix: when doing a Rescan ROMs, restore the originally selected ROM afterwards (fixes #1451)

This commit is contained in:
Dimitris Panokostas 2024-10-03 21:29:28 +02:00
parent db3953c758
commit 9d78ea1e07
No known key found for this signature in database
GPG Key ID: 330156A68E9E0929

View File

@ -219,6 +219,8 @@ void make_rom_symlink(const std::string& kickstart_short_name, const int kicksta
if (!std::filesystem::exists(kickstart_long_path))
{
const int roms[2] = { kickstart_number, -1 };
// copy the existing prefs->romfile to a backup variable, so we can restore it afterwards
const std::string old_romfile = prefs->romfile;
if (configure_rom(prefs, roms, 0) == 1)
{
try {
@ -236,6 +238,8 @@ void make_rom_symlink(const std::string& kickstart_short_name, const int kicksta
}
}
}
// restore the original prefs->romfile
strcpy(prefs->romfile, old_romfile.c_str());
}
}