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).
This commit is contained in:
parent
fe10e8aa6c
commit
ebf0f64a01
|
@ -40,10 +40,10 @@ enum class Country
|
||||||
NUMBER_OF_COUNTRIES
|
NUMBER_OF_COUNTRIES
|
||||||
};
|
};
|
||||||
|
|
||||||
// Regions 0 - 2 and 4 match Nintendo's Wii region numbering.
|
// Regions 0 - 2 and 4 match Nintendo's GameCube/Wii region numbering.
|
||||||
enum class Region
|
enum class Region
|
||||||
{
|
{
|
||||||
NTSC_J = 0, // Japan and Taiwan
|
NTSC_J = 0, // Japan and Taiwan (and South Korea for GameCube only)
|
||||||
NTSC_U = 1, // Mainly North America
|
NTSC_U = 1, // Mainly North America
|
||||||
PAL = 2, // Mainly Europe and Oceania
|
PAL = 2, // Mainly Europe and Oceania
|
||||||
UNKNOWN_REGION = 3, // 3 seems to be unused? Anyway, we need an UNKNOWN_REGION. Let's put it here
|
UNKNOWN_REGION = 3, // 3 seems to be unused? Anyway, we need an UNKNOWN_REGION. Let's put it here
|
||||||
|
|
|
@ -60,14 +60,20 @@ std::string VolumeGC::GetGameID(const Partition& partition) const
|
||||||
|
|
||||||
Region VolumeGC::GetRegion() const
|
Region VolumeGC::GetRegion() const
|
||||||
{
|
{
|
||||||
const std::optional<u8> country_code = ReadSwapped<u8>(3, PARTITION_NONE);
|
const std::optional<u32> region_code = ReadSwapped<u32>(0x458, PARTITION_NONE);
|
||||||
return country_code ? RegionSwitchGC(*country_code) : Region::UNKNOWN_REGION;
|
return region_code ? static_cast<Region>(*region_code) : Region::UNKNOWN_REGION;
|
||||||
}
|
}
|
||||||
|
|
||||||
Country VolumeGC::GetCountry(const Partition& partition) const
|
Country VolumeGC::GetCountry(const Partition& partition) const
|
||||||
{
|
{
|
||||||
const std::optional<u8> country_code = ReadSwapped<u8>(3, partition);
|
// The 0 that we use as a default value is mapped to COUNTRY_UNKNOWN and UNKNOWN_REGION
|
||||||
return country_code ? CountrySwitch(*country_code) : Country::COUNTRY_UNKNOWN;
|
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
|
std::string VolumeGC::GetMakerID(const Partition& partition) const
|
||||||
|
|
Loading…
Reference in New Issue