DiscIO: Move the Korean GC mess out of VolumeGC

This commit is contained in:
JosJuice 2018-10-05 20:14:23 +02:00
parent 08d0b98988
commit 57d05293fd
6 changed files with 19 additions and 21 deletions

View File

@ -97,12 +97,14 @@ static bool IsWiiTitle(const std::string& game_id)
static bool IsJapaneseGCTitle(const std::string& game_id)
{
return IsGCTitle(game_id) && DiscIO::CountrySwitch(game_id[3]) == DiscIO::Country::Japan;
return IsGCTitle(game_id) && DiscIO::CountrySwitch(game_id[3], DiscIO::Platform::GameCubeDisc) ==
DiscIO::Country::Japan;
}
static bool IsNonJapaneseGCTitle(const std::string& game_id)
{
return IsGCTitle(game_id) && DiscIO::CountrySwitch(game_id[3]) != DiscIO::Country::Japan;
return IsGCTitle(game_id) && DiscIO::CountrySwitch(game_id[3], DiscIO::Platform::GameCubeDisc) !=
DiscIO::Country::Japan;
}
// Note that this function will not overwrite entries that already are in the maps

View File

@ -145,7 +145,7 @@ Country TypicalCountryForRegion(Region region)
}
}
Region RegionSwitch(u8 country_code, Platform platform)
Region RegionSwitch(u8 country_code, Platform platform, Region expected_region)
{
switch (country_code)
{
@ -153,8 +153,10 @@ Region RegionSwitch(u8 country_code, Platform platform)
case 'W':
return Region::NTSC_J;
case 'B':
case 'E':
return expected_region == Region::NTSC_J ? Region::NTSC_J : Region::NTSC_U;
case 'B':
case 'N':
case 'Z':
return Region::NTSC_U;
@ -183,7 +185,7 @@ Region RegionSwitch(u8 country_code, Platform platform)
}
}
Country CountrySwitch(u8 country_code)
Country CountrySwitch(u8 country_code, Platform platform, Region region)
{
switch (country_code)
{
@ -222,6 +224,8 @@ Country CountrySwitch(u8 country_code)
// NTSC
case 'E':
return region == Region::NTSC_J ? Country::Korea : Country::USA;
case 'N': // Japanese import to USA and other NTSC regions
case 'Z': // Prince of Persia - The Forgotten Sands (Wii)
case 'B': // Ufouria: The Saga (Virtual Console)
@ -236,7 +240,7 @@ Country CountrySwitch(u8 country_code)
return Country::Korea;
case 'W':
return Country::Taiwan;
return platform == Platform::GameCubeDisc ? Country::Korea : Country::Taiwan;
default:
if (country_code > 'A') // Silently ignore IOS wads

View File

@ -77,8 +77,8 @@ bool IsNTSC(Region region);
Country TypicalCountryForRegion(Region region);
// Avoid using this function if you can. Country codes aren't always reliable region indicators.
Region RegionSwitch(u8 country_code, Platform platform);
Country CountrySwitch(u8 country_code);
Region RegionSwitch(u8 country_code, Platform platform, Region expected_region = Region::Unknown);
Country CountrySwitch(u8 country_code, Platform platform, Region region = Region::Unknown);
Region GetSysMenuRegion(u16 title_version);
std::string GetSysMenuVersionString(u16 title_version);

View File

@ -87,18 +87,10 @@ Country VolumeGC::GetCountry(const Partition& partition) const
const u8 country = ReadSwapped<u8>(3, partition).value_or(0);
const Region region = GetRegion();
// 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::Korea;
if (RegionSwitch(country, Platform::GameCubeDisc) != region)
if (RegionSwitch(country, Platform::GameCubeDisc, region) != region)
return TypicalCountryForRegion(region);
return CountrySwitch(country);
return CountrySwitch(country, Platform::GameCubeDisc, region);
}
std::string VolumeGC::GetMakerID(const Partition& partition) const

View File

@ -88,7 +88,7 @@ Country VolumeWAD::GetCountry(const Partition& partition) const
if (country_code == 2) // SYSMENU
return TypicalCountryForRegion(GetSysMenuRegion(m_tmd.GetTitleVersion()));
return CountrySwitch(country_code);
return CountrySwitch(country_code, Platform::WiiWAD);
}
const IOS::ES::TMDReader& VolumeWAD::GetTMD(const Partition& partition) const

View File

@ -293,10 +293,10 @@ Country VolumeWii::GetCountry(const Partition& partition) const
const u8 country_byte = ReadSwapped<u8>(3, partition).value_or(0);
const Region region = GetRegion();
if (RegionSwitch(country_byte, Platform::WiiDisc) != region)
if (RegionSwitch(country_byte, Platform::WiiDisc, region) != region)
return TypicalCountryForRegion(region);
return CountrySwitch(country_byte);
return CountrySwitch(country_byte, Platform::WiiDisc, region);
}
std::string VolumeWii::GetMakerID(const Partition& partition) const