From df2f6d137e5e1b9e7ffe8a51f9952ab555a45898 Mon Sep 17 00:00:00 2001 From: Stevoisiak Date: Mon, 23 Feb 2015 19:50:19 -0500 Subject: [PATCH] VolumeWad: Move country identification to GetCountry() Brings the code more in line with the rest of the game volume code --- Source/Core/DiscIO/VolumeWad.cpp | 22 ++++++++++++---------- Source/Core/DiscIO/VolumeWad.h | 1 - 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp index 0a74312d1a..2cbfbc92fd 100644 --- a/Source/Core/DiscIO/VolumeWad.cpp +++ b/Source/Core/DiscIO/VolumeWad.cpp @@ -31,15 +31,6 @@ CVolumeWAD::CVolumeWAD(IBlobReader* _pReader) m_offset = ALIGN_40(m_hdr_size) + ALIGN_40(m_cert_size); m_tmd_offset = ALIGN_40(m_hdr_size) + ALIGN_40(m_cert_size) + ALIGN_40(m_tick_size); m_opening_bnr_offset = m_tmd_offset + ALIGN_40(m_tmd_size) + ALIGN_40(m_data_size); - - // read the last digit of the titleID in the ticket - Read(m_tmd_offset + 0x0193, 1, &m_Country); - if (m_Country == 2) // SYSMENU - { - u16 titlever = 0; - Read(m_tmd_offset + 0x01dc, 2, (u8*)&titlever); - m_Country = GetSysMenuRegion(Common::swap16(titlever)); - } } CVolumeWAD::~CVolumeWAD() @@ -62,7 +53,18 @@ IVolume::ECountry CVolumeWAD::GetCountry() const if (!m_pReader) return COUNTRY_UNKNOWN; - return CountrySwitch(m_Country); + // read the last digit of the titleID in the ticket + u8 CountryCode; + Read(m_tmd_offset + 0x0193, 1, &CountryCode); + + if (CountryCode == 2) // SYSMENU + { + u16 titlever = 0; + Read(m_tmd_offset + 0x01dc, 2, (u8*)&titlever); + CountryCode = GetSysMenuRegion(Common::swap16(titlever)); + } + + return CountrySwitch(CountryCode); } std::string CVolumeWAD::GetUniqueID() const diff --git a/Source/Core/DiscIO/VolumeWad.h b/Source/Core/DiscIO/VolumeWad.h index 4180e96b5c..043365a6b5 100644 --- a/Source/Core/DiscIO/VolumeWad.h +++ b/Source/Core/DiscIO/VolumeWad.h @@ -48,7 +48,6 @@ private: u32 m_tick_size; u32 m_tmd_size; u32 m_data_size; - u8 m_Country; }; } // namespace