summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeWiiCrypted.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2016-01-20 19:58:58 +0100
committerPierre Bourdon <delroth@gmail.com>2016-01-20 19:58:58 +0100
commita14c07413f3c74a788238c5cd75cd5c6b0de32ac (patch)
treeb47cb7068ac2dfe45e906569716d47fbc0f6920f /Source/Core/DiscIO/VolumeWiiCrypted.cpp
parentf98176f38a0abceecccc4b467502a13fa17df12c (diff)
parent92278886b9a2c11405c74853224962f8c59a3c82 (diff)
Merge pull request #3515 from booto/wii-region
DiscIO: Use specified Wii region for discs
Diffstat (limited to 'Source/Core/DiscIO/VolumeWiiCrypted.cpp')
-rw-r--r--Source/Core/DiscIO/VolumeWiiCrypted.cpp47
1 files changed, 44 insertions, 3 deletions
diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.cpp b/Source/Core/DiscIO/VolumeWiiCrypted.cpp
index 16747f8782..3b06a45db2 100644
--- a/Source/Core/DiscIO/VolumeWiiCrypted.cpp
+++ b/Source/Core/DiscIO/VolumeWiiCrypted.cpp
@@ -160,10 +160,51 @@ IVolume::ECountry CVolumeWiiCrypted::GetCountry() const
if (!m_pReader)
return COUNTRY_UNKNOWN;
- u8 country_code;
- m_pReader->Read(3, 1, &country_code);
+ u8 country_byte;
+ if (!m_pReader->Read(3, 1, &country_byte))
+ {
+ return COUNTRY_UNKNOWN;
+ }
+
+ IVolume::ECountry country_value = CountrySwitch(country_byte);
+
+ u32 region_code;
+ if (!ReadSwapped(0x4E000, &region_code, false))
+ {
+ return country_value;
+ }
- return CountrySwitch(country_code);
+ switch (region_code)
+ {
+ case 0:
+ switch (country_value)
+ {
+ case IVolume::COUNTRY_TAIWAN:
+ return IVolume::COUNTRY_TAIWAN;
+ default:
+ return IVolume::COUNTRY_JAPAN;
+ }
+ case 1:
+ return IVolume::COUNTRY_USA;
+ case 2:
+ switch (country_value)
+ {
+ case IVolume::COUNTRY_FRANCE:
+ case IVolume::COUNTRY_GERMANY:
+ case IVolume::COUNTRY_ITALY:
+ case IVolume::COUNTRY_NETHERLANDS:
+ case IVolume::COUNTRY_RUSSIA:
+ case IVolume::COUNTRY_SPAIN:
+ case IVolume::COUNTRY_AUSTRALIA:
+ return country_value;
+ default:
+ return IVolume::COUNTRY_EUROPE;
+ }
+ case 4:
+ return IVolume::COUNTRY_KOREA;
+ default:
+ return country_value;
+ }
}
std::string CVolumeWiiCrypted::GetMakerID() const