diff options
| author | LPFaint99 <lpfaint99@gmail.com> | 2011-12-18 21:56:13 -0800 |
|---|---|---|
| committer | LPFaint99 <lpfaint99@gmail.com> | 2011-12-18 21:56:13 -0800 |
| commit | 7f4efa094ee23b05bb349a333ef55ae0d5276a6c (patch) | |
| tree | bb711380324d39395d332761e5785e55e3dadfd4 /Source/Core/DiscIO | |
| parent | a73ad3554c8a33762d97dacd52bf38e888ab8d43 (diff) | |
add the function to read the game name and description from the banner as unicode
Diffstat (limited to 'Source/Core/DiscIO')
| -rw-r--r-- | Source/Core/DiscIO/Src/BannerLoader.h | 3 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Src/BannerLoaderWii.cpp | 38 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Src/BannerLoaderWii.h | 3 |
3 files changed, 43 insertions, 1 deletions
diff --git a/Source/Core/DiscIO/Src/BannerLoader.h b/Source/Core/DiscIO/Src/BannerLoader.h index 02d60858e4..1fe48dd364 100644 --- a/Source/Core/DiscIO/Src/BannerLoader.h +++ b/Source/Core/DiscIO/Src/BannerLoader.h @@ -39,10 +39,11 @@ class IBannerLoader virtual bool GetBanner(u32* _pBannerImage) = 0; virtual bool GetName(std::string* _rName) = 0; - + virtual bool GetName(std::vector<std::wstring>& _rNames) {return false;}; virtual bool GetCompany(std::string& _rCompany) = 0; virtual bool GetDescription(std::string* _rDescription) = 0; + virtual bool GetDescription(std::wstring& _rDescription) {return false;}; protected: diff --git a/Source/Core/DiscIO/Src/BannerLoaderWii.cpp b/Source/Core/DiscIO/Src/BannerLoaderWii.cpp index 9c02ef8d08..88a660c739 100644 --- a/Source/Core/DiscIO/Src/BannerLoaderWii.cpp +++ b/Source/Core/DiscIO/Src/BannerLoaderWii.cpp @@ -164,6 +164,26 @@ bool CBannerLoaderWii::GetName(std::string* _rName) return false; } +bool CBannerLoaderWii::GetName(std::vector<std::wstring>& _rNames) +{ + if (IsValid()) + { + // find Banner type + SWiiBanner* pBanner = (SWiiBanner*)m_pBannerFile; + + std::wstring temp; + for (int i = 0; i < WII_BANNER_COMMENT_SIZE; ++i) + { + temp.push_back(Common::swap16(pBanner->m_Comment[0][i])); + } + temp.push_back('\0'); + _rNames.push_back(temp); + return true; + } + + return false; +} + bool CBannerLoaderWii::GetCompany(std::string& _rCompany) { _rCompany = "N/A"; @@ -190,6 +210,24 @@ bool CBannerLoaderWii::GetDescription(std::string* _rDescription) return false; } +bool CBannerLoaderWii::GetDescription(std::wstring& _rDescription) +{ + if (IsValid()) + { + // find Banner type + SWiiBanner* pBanner = (SWiiBanner*)m_pBannerFile; + + std::wstring description; + for (int i = 0; i < WII_BANNER_COMMENT_SIZE; ++i) + description.push_back(Common::swap16(pBanner->m_Comment[1][i])); + + description.push_back('\0'); + _rDescription = description; + return true; + } + return false; +} + void CBannerLoaderWii::decode5A3image(u32* dst, u16* src, int width, int height) { for (int y = 0; y < height; y += 4) diff --git a/Source/Core/DiscIO/Src/BannerLoaderWii.h b/Source/Core/DiscIO/Src/BannerLoaderWii.h index fb28f5a2e0..bfc87dc19e 100644 --- a/Source/Core/DiscIO/Src/BannerLoaderWii.h +++ b/Source/Core/DiscIO/Src/BannerLoaderWii.h @@ -37,10 +37,13 @@ class CBannerLoaderWii virtual bool GetName(std::string* _rName); + bool GetName(std::vector<std::wstring>& _rNames); + virtual bool GetCompany(std::string& _rCompany); virtual bool GetDescription(std::string* _rDescription); + bool GetDescription(std::wstring& _rDescription); private: |
