GameList: Show (Disc 1) for first disc of two-disc games

Append disc label to the first disc of two-disc games too, rather than
only labelling the second disc.
This commit is contained in:
Dentomologist
2024-04-11 16:35:18 -07:00
parent 1fa5c3485c
commit 37b89d5b71
4 changed files with 82 additions and 6 deletions

View File

@ -135,6 +135,7 @@ GameFile::GameFile(std::string path) : m_file_path(std::move(path))
m_maker_id = volume->GetMakerID();
m_revision = volume->GetRevision().value_or(0);
m_disc_number = volume->GetDiscNumber().value_or(0);
m_is_two_disc_game = CheckIfTwoDiscGame(m_game_id);
m_apploader_date = volume->GetApploaderDate();
m_volume_banner.buffer = volume->GetBanner(&m_volume_banner.width, &m_volume_banner.height);
@ -321,6 +322,7 @@ void GameFile::DoState(PointerWrap& p)
p.Do(m_compression_method);
p.Do(m_revision);
p.Do(m_disc_number);
p.Do(m_is_two_disc_game);
p.Do(m_apploader_date);
p.Do(m_custom_name);
@ -547,6 +549,77 @@ std::vector<DiscIO::Language> GameFile::GetLanguages() const
return languages;
}
bool GameFile::CheckIfTwoDiscGame(const std::string& game_id) const
{
constexpr size_t GAME_ID_PREFIX_SIZE = 3;
if (game_id.size() < GAME_ID_PREFIX_SIZE)
return false;
static constexpr std::array<std::string_view, 30> two_disc_game_id_prefixes = {
// Resident Evil
"DBJ",
// The Lord of the Rings: The Third Age
"G3A",
// Teenage Mutant Ninja Turtles 3: Mutant Nightmare
"G3Q",
// Resident Evil 4
"G4B",
// Tiger Woods PGA Tour 2005
"G5T",
// Resident Evil
"GBI",
// Resident Evil Zero
"GBZ",
// Conan
"GC9",
// Resident Evil Code: Veronica X
"GCD",
// Tom Clancy's Splinter Cell: Chaos Theory
"GCJ",
// Freaky Flyers
"GFF",
// GoldenEye: Rogue Agent
"GGI",
// Metal Gear Solid: The Twin Snakes
"GGS",
// Baten Kaitos Origins
"GK4",
// Killer7
"GK7",
// Baten Kaitos: Eternal Wings and the Lost Ocean
"GKB",
// Lupin the 3rd: Lost Treasure by the Sea
"GL3",
// Enter the Matrix
"GMX",
// Teenage Mutant Ninja Turtles 2: Battle Nexus
"GNI",
// GoldenEye: Rogue Agent
"GOY",
// Tales of Symphonia
"GQS",
// Medal of Honor: Rising Sun
"GR8",
"GRZ",
// Tales of Symphonia
"GTO",
// Tiger Woods PGA Tour 2004
"GW4",
// Tom Clancy's Splinter Cell: Double Agent (GC)
"GWY",
// Dragon Quest X: Mezameshi Itsutsu no Shuzoku Online
"S4M",
"S4S",
"S6T",
"SDQ",
};
static_assert(std::is_sorted(two_disc_game_id_prefixes.begin(), two_disc_game_id_prefixes.end()));
std::string_view game_id_prefix(game_id.data(), GAME_ID_PREFIX_SIZE);
return std::binary_search(two_disc_game_id_prefixes.begin(), two_disc_game_id_prefixes.end(),
game_id_prefix);
}
std::string GameFile::GetNetPlayName(const Core::TitleDatabase& title_database) const
{
std::vector<std::string> info;