summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeGC.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2017-07-16 13:53:22 +0200
committerJosJuice <josjuice@gmail.com>2017-07-16 14:29:43 +0200
commitebf0f64a01818fb9cea91e5fdecf615e5e45cd91 (patch)
treeb59e3730d91eca2894b1de6a40f613d58dc07a77 /Source/Core/DiscIO/VolumeGC.cpp
parentfe10e8aa6c990bd1d45a68377c50b3dd140cf5b4 (diff)
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).
Diffstat (limited to 'Source/Core/DiscIO/VolumeGC.cpp')
-rw-r--r--Source/Core/DiscIO/VolumeGC.cpp14
1 files changed, 10 insertions, 4 deletions
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<u8> country_code = ReadSwapped<u8>(3, PARTITION_NONE);
- return country_code ? RegionSwitchGC(*country_code) : Region::UNKNOWN_REGION;
+ const std::optional<u32> region_code = ReadSwapped<u32>(0x458, PARTITION_NONE);
+ return region_code ? static_cast<Region>(*region_code) : Region::UNKNOWN_REGION;
}
Country VolumeGC::GetCountry(const Partition& partition) const
{
- const std::optional<u8> country_code = ReadSwapped<u8>(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<u8>(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