mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-09 17:49:01 +00: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:
parent
6aef0630f7
commit
66ea9f5cc1
26 changed files with 218 additions and 158 deletions
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue