DiscIO: Merge RegionSwitchGC and RegionSwitchWii

This commit is contained in:
JosJuice 2018-10-05 17:48:59 +02:00
parent d741c239d2
commit 08d0b98988
5 changed files with 7 additions and 15 deletions

View File

@ -298,7 +298,7 @@ DiscIO::Region TMDReader::GetRegion() const
if (GetTitleId() == Titles::SYSTEM_MENU)
return DiscIO::GetSysMenuRegion(GetTitleVersion());
return DiscIO::RegionSwitchWii(static_cast<u8>(GetTitleId() & 0xff));
return DiscIO::RegionSwitch(static_cast<u8>(GetTitleId() & 0xff), DiscIO::Platform::WiiWAD);
}
std::string TMDReader::GetGameID() const

View File

@ -145,13 +145,7 @@ Country TypicalCountryForRegion(Region region)
}
}
Region RegionSwitchGC(u8 country_code)
{
Region region = RegionSwitchWii(country_code);
return region == Region::NTSC_K ? Region::NTSC_J : region;
}
Region RegionSwitchWii(u8 country_code)
Region RegionSwitch(u8 country_code, Platform platform)
{
switch (country_code)
{
@ -182,7 +176,7 @@ Region RegionSwitchWii(u8 country_code)
case 'K':
case 'Q':
case 'T':
return Region::NTSC_K;
return platform == Platform::GameCubeDisc ? Region::NTSC_J : Region::NTSC_K;
default:
return Region::Unknown;

View File

@ -77,9 +77,7 @@ bool IsNTSC(Region region);
Country TypicalCountryForRegion(Region region);
// Avoid using this function if you can. Country codes aren't always reliable region indicators.
Region RegionSwitchGC(u8 country_code);
// Avoid using this function if you can. Country codes aren't always reliable region indicators.
Region RegionSwitchWii(u8 country_code);
Region RegionSwitch(u8 country_code, Platform platform);
Country CountrySwitch(u8 country_code);
Region GetSysMenuRegion(u16 title_version);

View File

@ -95,7 +95,7 @@ Country VolumeGC::GetCountry(const Partition& partition) const
if (region == Region::NTSC_J && (country == 'E' || country == 'K' || country == 'W'))
return Country::Korea;
if (RegionSwitchGC(country) != region)
if (RegionSwitch(country, Platform::GameCubeDisc) != region)
return TypicalCountryForRegion(region);
return CountrySwitch(country);

View File

@ -290,10 +290,10 @@ Region VolumeWii::GetRegion() const
Country VolumeWii::GetCountry(const Partition& partition) const
{
// The 0 that we use as a default value is mapped to Country::Unknown and Region::Unknown
u8 country_byte = ReadSwapped<u8>(3, partition).value_or(0);
const u8 country_byte = ReadSwapped<u8>(3, partition).value_or(0);
const Region region = GetRegion();
if (RegionSwitchWii(country_byte) != region)
if (RegionSwitch(country_byte, Platform::WiiDisc) != region)
return TypicalCountryForRegion(region);
return CountrySwitch(country_byte);