From 86d01c33997a313cc37213ffe183ddf9c0b513aa Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Mon, 7 Nov 2022 05:33:47 +0100 Subject: [PATCH] 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. --- Source/Core/Common/CommonPaths.h | 2 ++ Source/Core/Core/Config/MainSettings.cpp | 7 ++++--- Source/Core/Core/Config/MainSettings.h | 10 +++++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Source/Core/Common/CommonPaths.h b/Source/Core/Common/CommonPaths.h index cb8aacddf8..187231f743 100644 --- a/Source/Core/Common/CommonPaths.h +++ b/Source/Core/Common/CommonPaths.h @@ -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" diff --git a/Source/Core/Core/Config/MainSettings.cpp b/Source/Core/Core/Config/MainSettings.cpp index 091fd3504f..4a8ae957f0 100644 --- a/Source/Core/Core/Config/MainSettings.cpp +++ b/Source/Core/Core/Config/MainSettings.cpp @@ -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"); diff --git a/Source/Core/Core/Config/MainSettings.h b/Source/Core/Core/Config/MainSettings.h index f30ef02a38..0730681f2d 100644 --- a/Source/Core/Core/Config/MainSettings.h +++ b/Source/Core/Core/Config/MainSettings.h @@ -344,8 +344,16 @@ void SetUSBDeviceWhitelist(const std::set>& 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