From c885fed9da6f6b0c5862b99904bbb5edbba144fe Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 22 Mar 2019 20:47:05 +0100 Subject: DiscIO: Make Korean GC checks in Enums.cpp less fragile --- Source/Core/DiscIO/Enums.cpp | 50 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 11 deletions(-) (limited to 'Source/Core/DiscIO/Enums.cpp') diff --git a/Source/Core/DiscIO/Enums.cpp b/Source/Core/DiscIO/Enums.cpp index e46ca238d0..f3f1f3bf71 100644 --- a/Source/Core/DiscIO/Enums.cpp +++ b/Source/Core/DiscIO/Enums.cpp @@ -145,7 +145,8 @@ Country TypicalCountryForRegion(Region region) } } -Region CountryCodeToRegion(u8 country_code, Platform platform, Region expected_region) +Region CountryCodeToRegion(u8 country_code, Platform platform, Region expected_region, + std::optional revision) { switch (country_code) { @@ -159,11 +160,24 @@ Region CountryCodeToRegion(u8 country_code, Platform platform, Region expected_r return Region::NTSC_J; // Korean GC games in English or Taiwanese Wii games case 'E': - if (expected_region == Region::NTSC_J) - return Region::NTSC_J; // Korean GC games in English - else + if (platform != Platform::GameCubeDisc) return Region::NTSC_U; // The most common country code for NTSC-U + if (revision) + { + if (*revision >= 0x30) + return Region::NTSC_J; // Korean GC games in English + else + return Region::NTSC_U; // The most common country code for NTSC-U + } + else + { + if (expected_region == Region::NTSC_J) + return Region::NTSC_J; // Korean GC games in English + else + return Region::NTSC_U; // The most common country code for NTSC-U + } + case 'B': case 'N': return Region::NTSC_U; @@ -198,7 +212,8 @@ Region CountryCodeToRegion(u8 country_code, Platform platform, Region expected_r } } -Country CountryCodeToCountry(u8 country_code, Platform platform, Region region) +Country CountryCodeToCountry(u8 country_code, Platform platform, Region region, + std::optional revision) { switch (country_code) { @@ -214,10 +229,10 @@ Country CountryCodeToCountry(u8 country_code, Platform platform, Region region) return region == Region::NTSC_U ? Country::USA : Country::Europe; case 'W': - if (region == Region::PAL) - return Country::Europe; // Only the Nordic version of Ratatouille (Wii) - else if (platform == Platform::GameCubeDisc) + if (platform == Platform::GameCubeDisc) return Country::Korea; // GC games in English released in Korea + else if (region == Region::PAL) + return Country::Europe; // Only the Nordic version of Ratatouille (Wii) else return Country::Taiwan; // Wii games in traditional Chinese released in Taiwan @@ -251,11 +266,24 @@ Country CountryCodeToCountry(u8 country_code, Platform platform, Region region) // NTSC case 'E': - if (region == Region::NTSC_J) - return Country::Korea; // GC games in English released in Korea - else + if (platform != Platform::GameCubeDisc) return Country::USA; // The most common country code for NTSC-U + if (revision) + { + if (*revision >= 0x30) + return Country::Korea; // GC games in English released in Korea + else + return Country::USA; // The most common country code for NTSC-U + } + else + { + if (region == Region::NTSC_J) + return Country::Korea; // GC games in English released in Korea + else + return Country::USA; // The most common country code for NTSC-U + } + case 'B': // PAL games released on NTSC-U VC case 'N': // NTSC-J games released on NTSC-U VC return Country::USA; -- cgit v1.2.3