Config: Add option to use JPN as the Japanese region directory in GetDirectoryForRegion().

See https://bugs.dolphin-emu.org/issues/13076 for motivation for this.
This commit is contained in:
Admiral H. Curtiss 2022-11-07 05:33:47 +01:00
parent 2132e005c3
commit 86d01c3399
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
3 changed files with 15 additions and 4 deletions

View File

@ -28,9 +28,11 @@
#endif
// Dirs in both User and Sys
// Legacy setups used /JAP/ while newer setups use /JPN/ by default.
#define EUR_DIR "EUR"
#define USA_DIR "USA"
#define JAP_DIR "JAP"
#define JPN_DIR "JPN"
// Subdirs in the User dir returned by GetUserPath(D_USER_IDX)
#define GC_USER_DIR "GC"

View File

@ -561,7 +561,7 @@ DiscIO::Region ToGameCubeRegion(DiscIO::Region region)
return DiscIO::Region::NTSC_J;
}
const char* GetDirectoryForRegion(DiscIO::Region region)
const char* GetDirectoryForRegion(DiscIO::Region region, RegionDirectoryStyle style)
{
if (region == DiscIO::Region::Unknown)
region = ToGameCubeRegion(Config::Get(Config::MAIN_FALLBACK_REGION));
@ -569,7 +569,7 @@ const char* GetDirectoryForRegion(DiscIO::Region region)
switch (region)
{
case DiscIO::Region::NTSC_J:
return JAP_DIR;
return style == RegionDirectoryStyle::Legacy ? JAP_DIR : JPN_DIR;
case DiscIO::Region::NTSC_U:
return USA_DIR;
@ -578,8 +578,9 @@ const char* GetDirectoryForRegion(DiscIO::Region region)
return EUR_DIR;
case DiscIO::Region::NTSC_K:
// See ToGameCubeRegion
ASSERT_MSG(BOOT, false, "NTSC-K is not a valid GameCube region");
return JAP_DIR; // See ToGameCubeRegion
return style == RegionDirectoryStyle::Legacy ? JAP_DIR : JPN_DIR;
default:
ASSERT_MSG(BOOT, false, "Default case should not be reached");

View File

@ -344,8 +344,16 @@ void SetUSBDeviceWhitelist(const std::set<std::pair<u16, u16>>& devices);
// Replaces NTSC-K with some other region, and doesn't replace non-NTSC-K regions
DiscIO::Region ToGameCubeRegion(DiscIO::Region region);
// The region argument must be valid for GameCube (i.e. must not be NTSC-K)
const char* GetDirectoryForRegion(DiscIO::Region region);
enum class RegionDirectoryStyle
{
Legacy,
Modern,
};
const char* GetDirectoryForRegion(DiscIO::Region region,
RegionDirectoryStyle style = RegionDirectoryStyle::Legacy);
std::string GetBootROMPath(const std::string& region_directory);
// Builds the memory card according to the configuration with the given region and size. If the
// given region is std::nullopt, the region in the configured path is used if there is one, or the