mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-26 03:35:26 +00:00
Return a more meaningful type from GetSysMenuRegion
This commit is contained in:
parent
04c49aa395
commit
9d54e4a9de
@ -118,7 +118,7 @@ u64 TMDReader::GetIOSId() const
|
||||
DiscIO::Region TMDReader::GetRegion() const
|
||||
{
|
||||
if (GetTitleId() == 0x0000000100000002)
|
||||
return DiscIO::RegionSwitchWii(DiscIO::GetSysMenuRegion(GetTitleVersion()));
|
||||
return DiscIO::GetSysMenuRegion(GetTitleVersion());
|
||||
|
||||
return DiscIO::RegionSwitchWii(static_cast<u8>(GetTitleId() & 0xff));
|
||||
}
|
||||
|
@ -18,6 +18,23 @@ bool IsNTSC(Region region)
|
||||
|
||||
// Increment CACHE_REVISION (ISOFile.cpp & GameFile.cpp) if the code below is modified
|
||||
|
||||
Country TypicalCountryForRegion(Region region)
|
||||
{
|
||||
switch (region)
|
||||
{
|
||||
case Region::NTSC_J:
|
||||
return Country::COUNTRY_JAPAN;
|
||||
case Region::NTSC_U:
|
||||
return Country::COUNTRY_USA;
|
||||
case Region::PAL:
|
||||
return Country::COUNTRY_EUROPE;
|
||||
case Region::NTSC_K:
|
||||
return Country::COUNTRY_KOREA;
|
||||
default:
|
||||
return Country::COUNTRY_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
Region RegionSwitchGC(u8 country_code)
|
||||
{
|
||||
Region region = RegionSwitchWii(country_code);
|
||||
@ -124,23 +141,23 @@ Country CountrySwitch(u8 country_code)
|
||||
}
|
||||
}
|
||||
|
||||
u8 GetSysMenuRegion(u16 title_version)
|
||||
Region GetSysMenuRegion(u16 title_version)
|
||||
{
|
||||
if (title_version == 33)
|
||||
return 'A'; // 1.0 uses 33 as the version number in all regions
|
||||
return Region::UNKNOWN_REGION; // 1.0 uses 33 as the version number in all regions
|
||||
|
||||
switch (title_version & 0xf)
|
||||
{
|
||||
case 0:
|
||||
return 'J';
|
||||
return Region::NTSC_J;
|
||||
case 1:
|
||||
return 'E';
|
||||
return Region::NTSC_U;
|
||||
case 2:
|
||||
return 'P';
|
||||
return Region::PAL;
|
||||
case 6:
|
||||
return 'K';
|
||||
return Region::NTSC_K;
|
||||
default:
|
||||
return 'A';
|
||||
return Region::UNKNOWN_REGION;
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,16 +170,16 @@ std::string GetSysMenuVersionString(u16 title_version)
|
||||
|
||||
switch (GetSysMenuRegion(title_version))
|
||||
{
|
||||
case 'J':
|
||||
case Region::NTSC_J:
|
||||
region_letter = "J";
|
||||
break;
|
||||
case 'E':
|
||||
case Region::NTSC_U:
|
||||
region_letter = "U";
|
||||
break;
|
||||
case 'P':
|
||||
case Region::PAL:
|
||||
region_letter = "E";
|
||||
break;
|
||||
case 'K':
|
||||
case Region::NTSC_K:
|
||||
region_letter = "K";
|
||||
break;
|
||||
}
|
||||
|
@ -69,10 +69,11 @@ enum class Language
|
||||
};
|
||||
|
||||
bool IsNTSC(Region region);
|
||||
Country TypicalCountryForRegion(Region region);
|
||||
Region RegionSwitchGC(u8 country_code);
|
||||
Region RegionSwitchWii(u8 country_code);
|
||||
Country CountrySwitch(u8 country_code);
|
||||
u8 GetSysMenuRegion(u16 title_version);
|
||||
Region GetSysMenuRegion(u16 title_version);
|
||||
std::string GetSysMenuVersionString(u16 title_version);
|
||||
std::string GetCompanyFromID(const std::string& company_id);
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ Country CVolumeWAD::GetCountry() const
|
||||
|
||||
u8 country_code = static_cast<u8>(m_tmd.GetTitleId() & 0xff);
|
||||
if (country_code == 2) // SYSMENU
|
||||
country_code = GetSysMenuRegion(m_tmd.GetTitleVersion());
|
||||
return TypicalCountryForRegion(GetSysMenuRegion(m_tmd.GetTitleVersion()));
|
||||
|
||||
return CountrySwitch(country_code);
|
||||
}
|
||||
|
@ -174,22 +174,10 @@ Country CVolumeWiiCrypted::GetCountry() const
|
||||
|
||||
const Region region = GetRegion();
|
||||
|
||||
if (RegionSwitchWii(country_byte) == region)
|
||||
return CountrySwitch(country_byte);
|
||||
if (RegionSwitchWii(country_byte) != region)
|
||||
return TypicalCountryForRegion(region);
|
||||
|
||||
switch (region)
|
||||
{
|
||||
case Region::NTSC_J:
|
||||
return Country::COUNTRY_JAPAN;
|
||||
case Region::NTSC_U:
|
||||
return Country::COUNTRY_USA;
|
||||
case Region::PAL:
|
||||
return Country::COUNTRY_EUROPE;
|
||||
case Region::NTSC_K:
|
||||
return Country::COUNTRY_KOREA;
|
||||
default:
|
||||
return Country::COUNTRY_UNKNOWN;
|
||||
}
|
||||
return CountrySwitch(country_byte);
|
||||
}
|
||||
|
||||
std::string CVolumeWiiCrypted::GetMakerID() const
|
||||
|
Loading…
x
Reference in New Issue
Block a user