Permalink
Browse files

DiscIO: Merge RegionSwitchGC and RegionSwitchWii

  • Loading branch information...
JosJuice committed Oct 5, 2018
1 parent d741c23 commit 08d0b98988af1ff0991d660911b4a400980676d5
@@ -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
@@ -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;
@@ -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);
@@ -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);
@@ -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);

0 comments on commit 08d0b98

Please sign in to comment.