summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeGC.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/VolumeGC.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/VolumeGC.cpp')
-rw-r--r--Source/Core/DiscIO/VolumeGC.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/Source/Core/DiscIO/VolumeGC.cpp b/Source/Core/DiscIO/VolumeGC.cpp
index 58faed4fe8..fcba359931 100644
--- a/Source/Core/DiscIO/VolumeGC.cpp
+++ b/Source/Core/DiscIO/VolumeGC.cpp
@@ -61,13 +61,20 @@ std::string CVolumeGC::GetGameID() const
return DecodeString(ID);
}
-Country CVolumeGC::GetCountry() const
+Region CVolumeGC::GetRegion() const
{
- if (!m_pReader)
- return Country::COUNTRY_UNKNOWN;
+ u8 country_code;
+ if (!m_pReader->Read(3, 1, &country_code))
+ return Region::UNKNOWN_REGION;
+ return RegionSwitchGC(country_code);
+}
+
+Country CVolumeGC::GetCountry() const
+{
u8 country_code;
- m_pReader->Read(3, 1, &country_code);
+ if (!m_pReader->Read(3, 1, &country_code))
+ return Country::COUNTRY_UNKNOWN;
return CountrySwitch(country_code);
}
@@ -247,7 +254,7 @@ void CVolumeGC::ExtractBannerInformation(const GCBanner& banner_file, bool is_bn
if (is_bnr1) // NTSC
{
- bool is_japanese = GetCountry() == Country::COUNTRY_JAPAN;
+ bool is_japanese = GetRegion() == Region::NTSC_J;
number_of_languages = 1;
start_language = is_japanese ? Language::LANGUAGE_JAPANESE : Language::LANGUAGE_ENGLISH;
}