From 7f4efa094ee23b05bb349a333ef55ae0d5276a6c Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Sun, 18 Dec 2011 21:56:13 -0800 Subject: [PATCH] add the function to read the game name and description from the banner as unicode --- Source/Core/DiscIO/Src/BannerLoader.h | 3 +- Source/Core/DiscIO/Src/BannerLoaderWii.cpp | 38 ++++++++++++++++++++++ Source/Core/DiscIO/Src/BannerLoaderWii.h | 3 ++ 3 files changed, 43 insertions(+), 1 deletion(-) 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& _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& _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& _rNames); + virtual bool GetCompany(std::string& _rCompany); virtual bool GetDescription(std::string* _rDescription); + bool GetDescription(std::wstring& _rDescription); private: