summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/Enums.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/Enums.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/Enums.cpp')
-rw-r--r--Source/Core/DiscIO/Enums.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/Source/Core/DiscIO/Enums.cpp b/Source/Core/DiscIO/Enums.cpp
index 385fff1317..6689470f32 100644
--- a/Source/Core/DiscIO/Enums.cpp
+++ b/Source/Core/DiscIO/Enums.cpp
@@ -13,6 +13,50 @@ namespace DiscIO
{
// Increment CACHE_REVISION (ISOFile.cpp & GameFile.cpp) if the code below is modified
+Region RegionSwitchGC(u8 country_code)
+{
+ Region region = RegionSwitchWii(country_code);
+ return region == Region::NTSC_K ? Region::UNKNOWN_REGION : region;
+}
+
+Region RegionSwitchWii(u8 country_code)
+{
+ switch (country_code)
+ {
+ case 'J':
+ case 'W':
+ return Region::NTSC_J;
+
+ case 'B':
+ case 'E':
+ case 'N':
+ case 'Z':
+ return Region::NTSC_U;
+
+ case 'D':
+ case 'F':
+ case 'H':
+ case 'I':
+ case 'L':
+ case 'M':
+ case 'P':
+ case 'R':
+ case 'S':
+ case 'U':
+ case 'X':
+ case 'Y':
+ return Region::PAL;
+
+ case 'K':
+ case 'Q':
+ case 'T':
+ return Region::NTSC_K;
+
+ default:
+ return Region::UNKNOWN_REGION;
+ }
+}
+
Country CountrySwitch(u8 country_code)
{
switch (country_code)