From 36ffe3a521450760358c18d45881ae2e8fb574df Mon Sep 17 00:00:00 2001 From: SternXD Date: Thu, 20 Nov 2025 19:03:03 -0500 Subject: [PATCH] GameList: Add RegionToFlagFilename function to map regions to flag filenames Signed-off-by: SternXD --- pcsx2/GameList.cpp | 38 ++++++++++++++++++++++++++++++++++++++ pcsx2/GameList.h | 1 + 2 files changed, 39 insertions(+) diff --git a/pcsx2/GameList.cpp b/pcsx2/GameList.cpp index ab3f9ffe92..cc242dcd6c 100644 --- a/pcsx2/GameList.cpp +++ b/pcsx2/GameList.cpp @@ -150,6 +150,44 @@ const char* GameList::RegionToString(Region region, bool translate) return name; } +const char* GameList::RegionToFlagFilename(Region region) +{ + static constexpr std::array(Region::Count)> flag_names = { + "br", // NTSC-B + "cn", // NTSC-C + "hk", // NTSC-HK + "jp", // NTSC-J + "kr", // NTSC-K + "tw", // NTSC-T + "us", // NTSC-U + "Other", // Other + "au", // PAL-A + "za", // PAL-AF + "at", // PAL-AU + "be", // PAL-BE + "eu", // PAL-E + "fr", // PAL-F + "fi", // PAL-FI + "de", // PAL-G + "gr", // PAL-GR + "it", // PAL-I + "in", // PAL-IN + "eu", // PAL-M + "nl", // PAL-NL + "no", // PAL-NO + "pt", // PAL-P + "pl", // PAL-PL + "ru", // PAL-R + "es", // PAL-S + "scn", // PAL-SC + "se", // PAL-SW + "ch", // PAL-SWI + "gb", // PAL-UK + }; + + return flag_names.at(static_cast(region)); +} + const char* GameList::EntryCompatibilityRatingToString(CompatibilityRating rating, bool translate) { const char* name = ""; diff --git a/pcsx2/GameList.h b/pcsx2/GameList.h index 107e487fe1..b639161614 100644 --- a/pcsx2/GameList.h +++ b/pcsx2/GameList.h @@ -106,6 +106,7 @@ namespace GameList const char* EntryTypeToString(EntryType type, bool translate); const char* RegionToString(Region region, bool translate); + const char* RegionToFlagFilename(Region region); const char* EntryCompatibilityRatingToString(CompatibilityRating rating, bool translate); /// Fills in boot parameters (iso or elf) based on the game list entry.