Also override the SYSCONF country setting

Fixes https://bugs.dolphin-emu.org/issues/10066
This commit is contained in:
JosJuice
2019-06-30 12:44:38 +02:00
parent 561a4cfcce
commit 393709a45a
6 changed files with 81 additions and 3 deletions

View File

@ -145,6 +145,29 @@ Country TypicalCountryForRegion(Region region)
}
}
Region SysConfCountryToRegion(u8 country_code)
{
if (country_code == 0)
return Region::Unknown;
if (country_code < 0x08) // Japan
return Region::NTSC_J;
if (country_code < 0x40) // Americas
return Region::NTSC_U;
if (country_code < 0x80) // Europe, Oceania, parts of Africa
return Region::PAL;
if (country_code < 0xa8) // Southeast Asia
return country_code == 0x88 ? Region::NTSC_K : Region::NTSC_J;
if (country_code < 0xc0) // Middle East
return Region::NTSC_U;
return Region::Unknown;
}
Region CountryCodeToRegion(u8 country_code, Platform platform, Region expected_region,
std::optional<u16> revision)
{

View File

@ -77,6 +77,7 @@ bool IsWii(Platform volume_type);
bool IsNTSC(Region region);
Country TypicalCountryForRegion(Region region);
Region SysConfCountryToRegion(u8 country_code);
// Avoid using this function if you can. Country codes aren't always reliable region indicators.
Region CountryCodeToRegion(u8 country_code, Platform platform,
Region expected_region = Region::Unknown,