System: Load game settings from first disc of multi-disc games

This commit is contained in:
Stenzek 2024-05-18 14:07:05 +10:00
parent 073ac87be2
commit 9bdf23cba7
No known key found for this signature in database
1 changed files with 5 additions and 2 deletions

View File

@ -952,8 +952,11 @@ std::optional<DiscRegion> System::GetRegionForPath(const char* image_path)
std::string System::GetGameSettingsPath(std::string_view game_serial) std::string System::GetGameSettingsPath(std::string_view game_serial)
{ {
const std::string sanitized_serial(Path::SanitizeFileName(game_serial)); // multi-disc games => always use the first disc
return Path::Combine(EmuFolders::GameSettings, fmt::format("{}.ini", sanitized_serial)); const GameDatabase::Entry* entry = GameDatabase::GetEntryForSerial(game_serial);
const std::string_view serial_for_path =
(entry && !entry->disc_set_serials.empty()) ? entry->disc_set_serials.front() : game_serial;
return Path::Combine(EmuFolders::GameSettings, fmt::format("{}.ini", Path::SanitizeFileName(serial_for_path)));
} }
std::string System::GetInputProfilePath(std::string_view name) std::string System::GetInputProfilePath(std::string_view name)