summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeWad.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2016-12-23 18:41:21 +0100
committerJosJuice <josjuice@gmail.com>2017-01-02 20:57:11 +0100
commit66ea9f5cc18ca6beb87ddd7f7a291d96669ad653 (patch)
tree011a81833e2b2b5452b390ba4f58181ab77e8d66 /Source/Core/DiscIO/VolumeWad.cpp
parent6aef0630f74e61d6847fc1f1186056df8bd42651 (diff)
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.
Diffstat (limited to 'Source/Core/DiscIO/VolumeWad.cpp')
-rw-r--r--Source/Core/DiscIO/VolumeWad.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp
index 3254190be9..7c089ad10a 100644
--- a/Source/Core/DiscIO/VolumeWad.cpp
+++ b/Source/Core/DiscIO/VolumeWad.cpp
@@ -57,14 +57,21 @@ bool CVolumeWAD::Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) cons
return m_pReader->Read(_Offset, _Length, _pBuffer);
}
-Country CVolumeWAD::GetCountry() const
+Region CVolumeWAD::GetRegion() const
{
- if (!m_pReader)
- return Country::COUNTRY_UNKNOWN;
+ u8 country_code;
+ if (!Read(m_tmd_offset + 0x0193, 1, &country_code))
+ return Region::UNKNOWN_REGION;
+
+ return RegionSwitchWii(country_code);
+}
+Country CVolumeWAD::GetCountry() const
+{
// 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
{