From ebf0f64a01818fb9cea91e5fdecf615e5e45cd91 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 16 Jul 2017 13:53:22 +0200 Subject: Detect GC region based on the actual region value The county code isn't 100% reliable for detecting the region. For instance, some games released in Korea have the country code E even though they're region-locked to NTSC-J consoles. This commit makes the GC disc region detection match the Wii disc region detection (apart from the region value being in a different place on the disc). --- Source/Core/DiscIO/VolumeGC.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'Source/Core/DiscIO/VolumeGC.cpp') diff --git a/Source/Core/DiscIO/VolumeGC.cpp b/Source/Core/DiscIO/VolumeGC.cpp index 1a89917812..5941af4a56 100644 --- a/Source/Core/DiscIO/VolumeGC.cpp +++ b/Source/Core/DiscIO/VolumeGC.cpp @@ -60,14 +60,20 @@ std::string VolumeGC::GetGameID(const Partition& partition) const Region VolumeGC::GetRegion() const { - const std::optional country_code = ReadSwapped(3, PARTITION_NONE); - return country_code ? RegionSwitchGC(*country_code) : Region::UNKNOWN_REGION; + const std::optional region_code = ReadSwapped(0x458, PARTITION_NONE); + return region_code ? static_cast(*region_code) : Region::UNKNOWN_REGION; } Country VolumeGC::GetCountry(const Partition& partition) const { - const std::optional country_code = ReadSwapped(3, partition); - return country_code ? CountrySwitch(*country_code) : Country::COUNTRY_UNKNOWN; + // The 0 that we use as a default value is mapped to COUNTRY_UNKNOWN and UNKNOWN_REGION + const u8 country_byte = ReadSwapped(3, partition).value_or(0); + const Region region = GetRegion(); + + if (RegionSwitchGC(country_byte) != region) + return TypicalCountryForRegion(region); + + return CountrySwitch(country_byte); } std::string VolumeGC::GetMakerID(const Partition& partition) const -- cgit v1.2.3 From c8b4645039fb7bc846d4030a94d76f19d12c6564 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 16 Jul 2017 14:25:55 +0200 Subject: Detect Korean GC releases as Korean when possible According to http://scanlines16.com/en/blog-3/retro-gaming/game-cube/gamecube-korean-master-list/, Korean GC releases use the following country codes: - E or W for games in English - K for games in Korean - Unknown value for games in Japanese (my guess is that they might have made the discs bit-for-bit identical to Japanese releases because the regions of these games are already set to NTSC-J) As far as I know, the GC has no Taiwanese releases, which is what the W country code is used for on the Wii. But I could be wrong. A small note: The country_byte == 'K' check in the code isn't actually necessary as long as RegionSwitchGC returns NTSC_J for 'K', but I thought it would be better to not rely on that. --- Source/Core/DiscIO/VolumeGC.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'Source/Core/DiscIO/VolumeGC.cpp') diff --git a/Source/Core/DiscIO/VolumeGC.cpp b/Source/Core/DiscIO/VolumeGC.cpp index 5941af4a56..dd13ecdcd0 100644 --- a/Source/Core/DiscIO/VolumeGC.cpp +++ b/Source/Core/DiscIO/VolumeGC.cpp @@ -67,13 +67,21 @@ Region VolumeGC::GetRegion() const Country VolumeGC::GetCountry(const Partition& partition) const { // The 0 that we use as a default value is mapped to COUNTRY_UNKNOWN and UNKNOWN_REGION - const u8 country_byte = ReadSwapped(3, partition).value_or(0); + const u8 country = ReadSwapped(3, partition).value_or(0); const Region region = GetRegion(); - if (RegionSwitchGC(country_byte) != region) + // 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::COUNTRY_KOREA; + + if (RegionSwitchGC(country) != region) return TypicalCountryForRegion(region); - return CountrySwitch(country_byte); + return CountrySwitch(country); } std::string VolumeGC::GetMakerID(const Partition& partition) const -- cgit v1.2.3 From be8e93f472ba8630622dd71a5b50a065ca942977 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 16 Jul 2017 14:52:17 +0200 Subject: Ensure that Volume::GetRegion doesn't return invalid enum values --- Source/Core/DiscIO/VolumeGC.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/VolumeGC.cpp') diff --git a/Source/Core/DiscIO/VolumeGC.cpp b/Source/Core/DiscIO/VolumeGC.cpp index dd13ecdcd0..46ac57278c 100644 --- a/Source/Core/DiscIO/VolumeGC.cpp +++ b/Source/Core/DiscIO/VolumeGC.cpp @@ -61,7 +61,10 @@ std::string VolumeGC::GetGameID(const Partition& partition) const Region VolumeGC::GetRegion() const { const std::optional region_code = ReadSwapped(0x458, PARTITION_NONE); - return region_code ? static_cast(*region_code) : Region::UNKNOWN_REGION; + if (!region_code) + return Region::UNKNOWN_REGION; + const Region region = static_cast(*region_code); + return region <= Region::PAL ? region : Region::UNKNOWN_REGION; } Country VolumeGC::GetCountry(const Partition& partition) const -- cgit v1.2.3