DiscIO: Make Korean GC checks in Enums.cpp less fragile

This commit is contained in:
JosJuice
2019-03-22 20:47:05 +01:00
parent c028a84531
commit c885fed9da
6 changed files with 60 additions and 26 deletions

View File

@ -145,7 +145,8 @@ Country TypicalCountryForRegion(Region region)
}
}
Region CountryCodeToRegion(u8 country_code, Platform platform, Region expected_region)
Region CountryCodeToRegion(u8 country_code, Platform platform, Region expected_region,
std::optional<u16> revision)
{
switch (country_code)
{
@ -159,11 +160,24 @@ Region CountryCodeToRegion(u8 country_code, Platform platform, Region expected_r
return Region::NTSC_J; // Korean GC games in English or Taiwanese Wii games
case 'E':
if (expected_region == Region::NTSC_J)
return Region::NTSC_J; // Korean GC games in English
else
if (platform != Platform::GameCubeDisc)
return Region::NTSC_U; // The most common country code for NTSC-U
if (revision)
{
if (*revision >= 0x30)
return Region::NTSC_J; // Korean GC games in English
else
return Region::NTSC_U; // The most common country code for NTSC-U
}
else
{
if (expected_region == Region::NTSC_J)
return Region::NTSC_J; // Korean GC games in English
else
return Region::NTSC_U; // The most common country code for NTSC-U
}
case 'B':
case 'N':
return Region::NTSC_U;
@ -198,7 +212,8 @@ Region CountryCodeToRegion(u8 country_code, Platform platform, Region expected_r
}
}
Country CountryCodeToCountry(u8 country_code, Platform platform, Region region)
Country CountryCodeToCountry(u8 country_code, Platform platform, Region region,
std::optional<u16> revision)
{
switch (country_code)
{
@ -214,10 +229,10 @@ Country CountryCodeToCountry(u8 country_code, Platform platform, Region region)
return region == Region::NTSC_U ? Country::USA : Country::Europe;
case 'W':
if (region == Region::PAL)
return Country::Europe; // Only the Nordic version of Ratatouille (Wii)
else if (platform == Platform::GameCubeDisc)
if (platform == Platform::GameCubeDisc)
return Country::Korea; // GC games in English released in Korea
else if (region == Region::PAL)
return Country::Europe; // Only the Nordic version of Ratatouille (Wii)
else
return Country::Taiwan; // Wii games in traditional Chinese released in Taiwan
@ -251,11 +266,24 @@ Country CountryCodeToCountry(u8 country_code, Platform platform, Region region)
// NTSC
case 'E':
if (region == Region::NTSC_J)
return Country::Korea; // GC games in English released in Korea
else
if (platform != Platform::GameCubeDisc)
return Country::USA; // The most common country code for NTSC-U
if (revision)
{
if (*revision >= 0x30)
return Country::Korea; // GC games in English released in Korea
else
return Country::USA; // The most common country code for NTSC-U
}
else
{
if (region == Region::NTSC_J)
return Country::Korea; // GC games in English released in Korea
else
return Country::USA; // The most common country code for NTSC-U
}
case 'B': // PAL games released on NTSC-U VC
case 'N': // NTSC-J games released on NTSC-U VC
return Country::USA;