diff --git a/Source/Core/Core/TitleDatabase.cpp b/Source/Core/Core/TitleDatabase.cpp index 32871eba30..cd7449b139 100644 --- a/Source/Core/Core/TitleDatabase.cpp +++ b/Source/Core/Core/TitleDatabase.cpp @@ -97,12 +97,14 @@ static bool IsWiiTitle(const std::string& game_id) static bool IsJapaneseGCTitle(const std::string& game_id) { - return IsGCTitle(game_id) && DiscIO::CountrySwitch(game_id[3]) == DiscIO::Country::Japan; + return IsGCTitle(game_id) && DiscIO::CountrySwitch(game_id[3], DiscIO::Platform::GameCubeDisc) == + DiscIO::Country::Japan; } static bool IsNonJapaneseGCTitle(const std::string& game_id) { - return IsGCTitle(game_id) && DiscIO::CountrySwitch(game_id[3]) != DiscIO::Country::Japan; + return IsGCTitle(game_id) && DiscIO::CountrySwitch(game_id[3], DiscIO::Platform::GameCubeDisc) != + DiscIO::Country::Japan; } // Note that this function will not overwrite entries that already are in the maps diff --git a/Source/Core/DiscIO/Enums.cpp b/Source/Core/DiscIO/Enums.cpp index 5318ab6b78..5d3129fd7d 100644 --- a/Source/Core/DiscIO/Enums.cpp +++ b/Source/Core/DiscIO/Enums.cpp @@ -145,7 +145,7 @@ Country TypicalCountryForRegion(Region region) } } -Region RegionSwitch(u8 country_code, Platform platform) +Region RegionSwitch(u8 country_code, Platform platform, Region expected_region) { switch (country_code) { @@ -153,8 +153,10 @@ Region RegionSwitch(u8 country_code, Platform platform) case 'W': return Region::NTSC_J; - case 'B': case 'E': + return expected_region == Region::NTSC_J ? Region::NTSC_J : Region::NTSC_U; + + case 'B': case 'N': case 'Z': return Region::NTSC_U; @@ -183,7 +185,7 @@ Region RegionSwitch(u8 country_code, Platform platform) } } -Country CountrySwitch(u8 country_code) +Country CountrySwitch(u8 country_code, Platform platform, Region region) { switch (country_code) { @@ -222,6 +224,8 @@ Country CountrySwitch(u8 country_code) // NTSC case 'E': + return region == Region::NTSC_J ? Country::Korea : Country::USA; + case 'N': // Japanese import to USA and other NTSC regions case 'Z': // Prince of Persia - The Forgotten Sands (Wii) case 'B': // Ufouria: The Saga (Virtual Console) @@ -236,7 +240,7 @@ Country CountrySwitch(u8 country_code) return Country::Korea; case 'W': - return Country::Taiwan; + return platform == Platform::GameCubeDisc ? Country::Korea : Country::Taiwan; default: if (country_code > 'A') // Silently ignore IOS wads diff --git a/Source/Core/DiscIO/Enums.h b/Source/Core/DiscIO/Enums.h index e7f8927971..6acbee9960 100644 --- a/Source/Core/DiscIO/Enums.h +++ b/Source/Core/DiscIO/Enums.h @@ -77,8 +77,8 @@ bool IsNTSC(Region region); Country TypicalCountryForRegion(Region region); // Avoid using this function if you can. Country codes aren't always reliable region indicators. -Region RegionSwitch(u8 country_code, Platform platform); -Country CountrySwitch(u8 country_code); +Region RegionSwitch(u8 country_code, Platform platform, Region expected_region = Region::Unknown); +Country CountrySwitch(u8 country_code, Platform platform, Region region = Region::Unknown); Region GetSysMenuRegion(u16 title_version); std::string GetSysMenuVersionString(u16 title_version); diff --git a/Source/Core/DiscIO/VolumeGC.cpp b/Source/Core/DiscIO/VolumeGC.cpp index 71506e8393..c984d60f9d 100644 --- a/Source/Core/DiscIO/VolumeGC.cpp +++ b/Source/Core/DiscIO/VolumeGC.cpp @@ -87,18 +87,10 @@ Country VolumeGC::GetCountry(const Partition& partition) const const u8 country = ReadSwapped(3, partition).value_or(0); const Region region = GetRegion(); - // Korean GC releases use NTSC-J. - // E is normally used for America, but it's also used for English-language Korean GC releases. - // K is used by games that are in the Korean language. - // W means Taiwan for Wii games, but on the GC, it's used for English-language Korean releases. - // (There doesn't seem to be any pattern to which of E and W is used for Korean GC releases.) - if (region == Region::NTSC_J && (country == 'E' || country == 'K' || country == 'W')) - return Country::Korea; - - if (RegionSwitch(country, Platform::GameCubeDisc) != region) + if (RegionSwitch(country, Platform::GameCubeDisc, region) != region) return TypicalCountryForRegion(region); - return CountrySwitch(country); + return CountrySwitch(country, Platform::GameCubeDisc, region); } std::string VolumeGC::GetMakerID(const Partition& partition) const diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp index 7a1df3e0d5..ef102df9c1 100644 --- a/Source/Core/DiscIO/VolumeWad.cpp +++ b/Source/Core/DiscIO/VolumeWad.cpp @@ -88,7 +88,7 @@ Country VolumeWAD::GetCountry(const Partition& partition) const if (country_code == 2) // SYSMENU return TypicalCountryForRegion(GetSysMenuRegion(m_tmd.GetTitleVersion())); - return CountrySwitch(country_code); + return CountrySwitch(country_code, Platform::WiiWAD); } const IOS::ES::TMDReader& VolumeWAD::GetTMD(const Partition& partition) const diff --git a/Source/Core/DiscIO/VolumeWii.cpp b/Source/Core/DiscIO/VolumeWii.cpp index 3cb5cf42c0..c64dc3ec05 100644 --- a/Source/Core/DiscIO/VolumeWii.cpp +++ b/Source/Core/DiscIO/VolumeWii.cpp @@ -293,10 +293,10 @@ Country VolumeWii::GetCountry(const Partition& partition) const const u8 country_byte = ReadSwapped(3, partition).value_or(0); const Region region = GetRegion(); - if (RegionSwitch(country_byte, Platform::WiiDisc) != region) + if (RegionSwitch(country_byte, Platform::WiiDisc, region) != region) return TypicalCountryForRegion(region); - return CountrySwitch(country_byte); + return CountrySwitch(country_byte, Platform::WiiDisc, region); } std::string VolumeWii::GetMakerID(const Partition& partition) const