mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
DiscIO: Add GetRegion function and Region enum
Instead of needing different switch cases for converting countries to regions in multiple places, we now only need a single country-to-region switch case (in DiscIO/Enums.cpp), and we get a nice Region type.
This commit is contained in:
@ -57,14 +57,21 @@ bool CVolumeWAD::Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) cons
|
||||
return m_pReader->Read(_Offset, _Length, _pBuffer);
|
||||
}
|
||||
|
||||
Region CVolumeWAD::GetRegion() const
|
||||
{
|
||||
u8 country_code;
|
||||
if (!Read(m_tmd_offset + 0x0193, 1, &country_code))
|
||||
return Region::UNKNOWN_REGION;
|
||||
|
||||
return RegionSwitchWii(country_code);
|
||||
}
|
||||
|
||||
Country CVolumeWAD::GetCountry() const
|
||||
{
|
||||
if (!m_pReader)
|
||||
return Country::COUNTRY_UNKNOWN;
|
||||
|
||||
// read the last digit of the titleID in the ticket
|
||||
u8 country_code;
|
||||
Read(m_tmd_offset + 0x0193, 1, &country_code);
|
||||
if (!Read(m_tmd_offset + 0x0193, 1, &country_code))
|
||||
return Country::COUNTRY_UNKNOWN;
|
||||
|
||||
if (country_code == 2) // SYSMENU
|
||||
{
|
||||
|
Reference in New Issue
Block a user