add the function to read the game name and description from the banner as unicode

This commit is contained in:
LPFaint99 2011-12-18 21:56:13 -08:00
parent a73ad3554c
commit 7f4efa094e
3 changed files with 43 additions and 1 deletions

View File

@ -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:

View File

@ -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)

View File

@ -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: