game name and description WIP: cache all 6 languages, so we don't need refresh cache after we changes language.

move some WIN32 code to CGameListCtrl.
nakee, please check linux build, sorry I've not enough time to setup a linux dev environment.
and, who can read German helps me to test game name and description display, thanks.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2090 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hyperiris 2009-02-03 15:03:34 +00:00
parent 4660943322
commit 9e3fed40f2
14 changed files with 244 additions and 154 deletions

View File

@ -94,55 +94,6 @@ bool IBannerLoader::CopyToStringAndCheck(std::string& _rDestination, const char*
return(bResult); return(bResult);
} }
bool IBannerLoader::CopySJISToString( std::string& _rDestination, const char* _src )
{
bool returnCode = false;
#ifdef WIN32
// HyperIris: because dolphin using "Use Multi-Byte Character Set",
// we must convert the SJIS chars to unicode then to our windows local by hand
u32 unicodeNameSize = MultiByteToWideChar(932, MB_PRECOMPOSED,
_src, (int)strlen(_src), NULL, NULL);
if (unicodeNameSize > 0)
{
u16* pUnicodeStrBuffer = new u16[unicodeNameSize + 1];
if (pUnicodeStrBuffer)
{
memset(pUnicodeStrBuffer, 0, (unicodeNameSize + 1) * sizeof(u16));
if (MultiByteToWideChar(932, MB_PRECOMPOSED,
_src, (int)strlen(_src),
(LPWSTR)pUnicodeStrBuffer, unicodeNameSize))
{
u32 ansiNameSize = WideCharToMultiByte(CP_ACP, 0,
(LPCWSTR)pUnicodeStrBuffer, unicodeNameSize,
NULL, NULL, NULL, NULL);
if (ansiNameSize > 0)
{
char* pAnsiStrBuffer = new char[ansiNameSize + 1];
if (pAnsiStrBuffer)
{
memset(pAnsiStrBuffer, 0, (ansiNameSize + 1) * sizeof(char));
if (WideCharToMultiByte(CP_ACP, 0,
(LPCWSTR)pUnicodeStrBuffer, unicodeNameSize,
pAnsiStrBuffer, ansiNameSize, NULL, NULL))
{
_rDestination = pAnsiStrBuffer;
returnCode = true;
}
delete pAnsiStrBuffer;
}
}
}
delete pUnicodeStrBuffer;
}
}
#else
// not implement other than windows
_rDestination = _src;
returnCode = true;
#endif
return returnCode;
}
bool IBannerLoader::CopyUnicodeToString( std::string& _rDestination, const u16* _src ) bool IBannerLoader::CopyUnicodeToString( std::string& _rDestination, const u16* _src )
{ {
bool returnCode = false; bool returnCode = false;
@ -172,7 +123,7 @@ bool IBannerLoader::CopyUnicodeToString( std::string& _rDestination, const u16*
#else #else
// FIXME: Horribly broke on non win32 // FIXME: Horribly broke on non win32
// _rDestination = _src; // _rDestination = _src;
returnCode = true; returnCode = false;
#endif #endif
return returnCode; return returnCode;
} }

View File

@ -38,17 +38,17 @@ class IBannerLoader
virtual bool GetBanner(u32* _pBannerImage) = 0; virtual bool GetBanner(u32* _pBannerImage) = 0;
virtual bool GetName(std::string& _rName, DiscIO::IVolume::ECountry language) = 0; virtual bool GetName(std::string* _rName) = 0;
virtual bool GetCompany(std::string& _rCompany) = 0; virtual bool GetCompany(std::string& _rCompany) = 0;
virtual bool GetDescription(std::string& _rDescription, DiscIO::IVolume::ECountry language) = 0; virtual bool GetDescription(std::string* _rDescription) = 0;
protected: protected:
bool CopyToStringAndCheck(std::string& _rDestination, const char* _src); bool CopyToStringAndCheck(std::string& _rDestination, const char* _src);
bool CopySJISToString(std::string& _rDestination, const char* _src);
bool CopyUnicodeToString(std::string& _rDestination, const u16* _src); bool CopyUnicodeToString(std::string& _rDestination, const u16* _src);
}; };

View File

@ -92,9 +92,12 @@ CBannerLoaderGC::GetBanner(u32* _pBannerImage)
bool bool
CBannerLoaderGC::GetName(std::string& _rName, DiscIO::IVolume::ECountry language) CBannerLoaderGC::GetName(std::string _rName[])
{ {
_rName = "no name"; for (int i = 0; i < 6; i++)
{
_rName[i] = "no name";
}
bool returnCode = false; bool returnCode = false;
@ -109,21 +112,10 @@ CBannerLoaderGC::GetName(std::string& _rName, DiscIO::IVolume::ECountry language
case CBannerLoaderGC::BANNER_BNR1: case CBannerLoaderGC::BANNER_BNR1:
{ {
DVDBanner* pBanner = (DVDBanner*)m_pBannerFile; DVDBanner* pBanner = (DVDBanner*)m_pBannerFile;
if (DiscIO::IVolume::COUNTRY_JAP == language) char tempBuffer[33] = {0};
{ memcpy(tempBuffer, pBanner->comment.shortTitle, 32);
// dunno, if dolphin using unicode, it will be better = =; _rName[0] = tempBuffer;
if (CopySJISToString(_rName, pBanner->comment.shortTitle)) returnCode = true;
{
returnCode = true;
}
}
else
{
if (CopyToStringAndCheck(_rName, pBanner->comment.shortTitle))//language != 0 ? pBanner->comment[0].shortTitle : pBanner->comment[0].longTitle))
{
returnCode = true;
}
}
} }
break; break;
case CBannerLoaderGC::BANNER_BNR2: case CBannerLoaderGC::BANNER_BNR2:
@ -131,10 +123,15 @@ CBannerLoaderGC::GetName(std::string& _rName, DiscIO::IVolume::ECountry language
DVDBanner2* pBanner = (DVDBanner2*)m_pBannerFile; DVDBanner2* pBanner = (DVDBanner2*)m_pBannerFile;
u32 languageID = SConfig::GetInstance().m_InterfaceLanguage; u32 languageID = SConfig::GetInstance().m_InterfaceLanguage;
if (CopyToStringAndCheck(_rName, pBanner->comment[languageID].shortTitle))//language != 0 ? pBanner->comment[0].shortTitle : pBanner->comment[0].longTitle)) for (int i = 0; i < 6; i++)
{ {
returnCode = true; char tempBuffer[33] = {0};
memcpy(tempBuffer, pBanner->comment[i].shortTitle, 32);
_rName[i] = tempBuffer;
} }
returnCode = true;
} }
break; break;
} }
@ -165,9 +162,12 @@ CBannerLoaderGC::GetCompany(std::string& _rCompany)
bool bool
CBannerLoaderGC::GetDescription(std::string& _rDescription, DiscIO::IVolume::ECountry language) CBannerLoaderGC::GetDescription(std::string* _rDescription)
{ {
_rDescription = ""; for (int i = 0; i< 6; i++)
{
_rDescription[i] = "";
}
bool returnCode = false; bool returnCode = false;
@ -182,32 +182,23 @@ CBannerLoaderGC::GetDescription(std::string& _rDescription, DiscIO::IVolume::ECo
case CBannerLoaderGC::BANNER_BNR1: case CBannerLoaderGC::BANNER_BNR1:
{ {
DVDBanner* pBanner = (DVDBanner*)m_pBannerFile; DVDBanner* pBanner = (DVDBanner*)m_pBannerFile;
if (DiscIO::IVolume::COUNTRY_JAP == language) char tempBuffer[129] = {0};
{ memcpy(tempBuffer, pBanner->comment.comment, 128);
// dunno, if dolphin using unicode, it will be better = =; _rDescription[0] = tempBuffer;
if (CopySJISToString(_rDescription, pBanner->comment.comment)) returnCode = true;
{
returnCode = true;
}
}
else
{
if (CopyToStringAndCheck(_rDescription, pBanner->comment.comment))//language != 0 ? pBanner->comment[0].shortTitle : pBanner->comment[0].longTitle))
{
returnCode = true;
}
}
} }
break; break;
case CBannerLoaderGC::BANNER_BNR2: case CBannerLoaderGC::BANNER_BNR2:
{ {
DVDBanner2* pBanner = (DVDBanner2*)m_pBannerFile; DVDBanner2* pBanner = (DVDBanner2*)m_pBannerFile;
u32 languageID = SConfig::GetInstance().m_InterfaceLanguage; for (int i = 0; i< 6; i++)
if (CopyToStringAndCheck(_rDescription, pBanner->comment[languageID].comment))//language != 0 ? pBanner->comment[0].shortTitle : pBanner->comment[0].longTitle))
{ {
returnCode = true; char tempBuffer[129] = {0};
memcpy(tempBuffer, pBanner->comment[i].comment, 128);
_rDescription[i] = tempBuffer;
} }
returnCode = true;
} }
break; break;
} }

View File

@ -35,11 +35,11 @@ class CBannerLoaderGC
virtual bool GetBanner(u32* _pBannerImage); virtual bool GetBanner(u32* _pBannerImage);
virtual bool GetName(std::string& _rName, DiscIO::IVolume::ECountry language); virtual bool GetName(std::string* _rName);
virtual bool GetCompany(std::string& _rCompany); virtual bool GetCompany(std::string& _rCompany);
virtual bool GetDescription(std::string& _rDescription, DiscIO::IVolume::ECountry language); virtual bool GetDescription(std::string* _rDescription);
private: private:

View File

@ -115,9 +115,12 @@ CBannerLoaderWii::StupidWideCharToString(u16* _pSrc, size_t _max)
} }
bool bool
CBannerLoaderWii::GetName(std::string& _rName, DiscIO::IVolume::ECountry language) CBannerLoaderWii::GetName(std::string* _rName)
{ {
_rName = "no name"; for (int i = 0; i < 6; i++)
{
_rName[i] = "no name";
}
if (!IsValid()) if (!IsValid())
{ {
@ -126,19 +129,17 @@ CBannerLoaderWii::GetName(std::string& _rName, DiscIO::IVolume::ECountry languag
// find Banner type // find Banner type
SWiiBanner* pBanner = (SWiiBanner*)m_pBannerFile; SWiiBanner* pBanner = (SWiiBanner*)m_pBannerFile;
#ifdef _WIN32
if (DiscIO::IVolume::COUNTRY_JAP == language) std::string name;
if (CopyUnicodeToString(name, pBanner->m_Comment[0]))
{ {
return CopyUnicodeToString(_rName, pBanner->m_Comment[0]); for (int i = 0; i < 6; i++)
} {
else _rName[i] = name;
#endif }
{
// very stupid
_rName = StupidWideCharToString(pBanner->m_Comment[0], WII_BANNER_COMMENT_SIZE);
return true; return true;
} }
return true; return false;
} }
@ -151,9 +152,12 @@ CBannerLoaderWii::GetCompany(std::string& _rCompany)
bool bool
CBannerLoaderWii::GetDescription(std::string& _rDescription, DiscIO::IVolume::ECountry language) CBannerLoaderWii::GetDescription(std::string* _rDescription)
{ {
_rDescription = ""; for (int i = 0; i< 6; i++)
{
_rDescription[i] = "";
}
if (!IsValid()) if (!IsValid())
{ {
@ -162,17 +166,16 @@ CBannerLoaderWii::GetDescription(std::string& _rDescription, DiscIO::IVolume::EC
// find Banner type // find Banner type
SWiiBanner* pBanner = (SWiiBanner*)m_pBannerFile; SWiiBanner* pBanner = (SWiiBanner*)m_pBannerFile;
if (DiscIO::IVolume::COUNTRY_JAP == language)
std::string description;
if (CopyUnicodeToString(description, pBanner->m_Comment[1]))
{ {
return CopyUnicodeToString(_rDescription, pBanner->m_Comment[1]); for (int i = 0; i< 6; i++)
} {
else _rDescription[i] = description;
{ }
// very stupid
_rDescription = StupidWideCharToString(pBanner->m_Comment[1], WII_BANNER_COMMENT_SIZE);
return true; return true;
} }
return false; return false;
} }

View File

@ -35,11 +35,11 @@ class CBannerLoaderWii
virtual bool GetBanner(u32* _pBannerImage); virtual bool GetBanner(u32* _pBannerImage);
virtual bool GetName(std::string& _rName, DiscIO::IVolume::ECountry language); virtual bool GetName(std::string* _rName);
virtual bool GetCompany(std::string& _rCompany); virtual bool GetCompany(std::string& _rCompany);
virtual bool GetDescription(std::string& _rDescription, DiscIO::IVolume::ECountry language); virtual bool GetDescription(std::string* _rDescription);
private: private:

View File

@ -92,7 +92,7 @@ CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title,
{ {
// Control refreshing of the ISOs list // Control refreshing of the ISOs list
bRefreshList = false; bRefreshList = false;
bRefreshCache = false;
// Load Wii SYSCONF // Load Wii SYSCONF
FullSYSCONFPath = FULL_WII_USER_DIR "shared2/sys/SYSCONF"; FullSYSCONFPath = FULL_WII_USER_DIR "shared2/sys/SYSCONF";
pStream = NULL; pStream = NULL;
@ -532,7 +532,7 @@ void CConfigMain::CreateGUIControls()
void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event)) void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event))
{ {
EndModal((bRefreshList || bRefreshCache) ? wxID_OK : wxID_CLOSE); EndModal((bRefreshList) ? wxID_OK : wxID_CLOSE);
// First check that we did successfully populate m_SYSCONF earlier, otherwise don't // First check that we did successfully populate m_SYSCONF earlier, otherwise don't
// save anything, it will be a corrupted file // save anything, it will be a corrupted file
@ -592,7 +592,6 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
case ID_INTERFACE_LANG: case ID_INTERFACE_LANG:
SConfig::GetInstance().m_InterfaceLanguage = (INTERFACE_LANGUAGE)InterfaceLang->GetSelection(); SConfig::GetInstance().m_InterfaceLanguage = (INTERFACE_LANGUAGE)InterfaceLang->GetSelection();
bRefreshList = true; bRefreshList = true;
bRefreshCache = true;
break; break;
case ID_ALLWAYS_HLEBIOS: // Core case ID_ALLWAYS_HLEBIOS: // Core

View File

@ -43,7 +43,6 @@ class CConfigMain
void OnConfig(wxCommandEvent& event); void OnConfig(wxCommandEvent& event);
bool bRefreshList; bool bRefreshList;
bool bRefreshCache;
private: private:

View File

@ -511,7 +511,7 @@ void CFrame::OnConfigMain(wxCommandEvent& WXUNUSED (event))
{ {
CConfigMain ConfigMain(this); CConfigMain ConfigMain(this);
if (ConfigMain.ShowModal() == wxID_OK) if (ConfigMain.ShowModal() == wxID_OK)
m_GameListCtrl->Update(ConfigMain.bRefreshCache); m_GameListCtrl->Update();
} }

View File

@ -18,6 +18,7 @@
#include "Globals.h" #include "Globals.h"
#include <wx/imaglist.h> #include <wx/imaglist.h>
#include <wx/fontmap.h>
#include <algorithm> #include <algorithm>
@ -45,15 +46,32 @@ std::string CGameListCtrl::m_currentFilename;
static int currentColumn = 0; static int currentColumn = 0;
bool operator < (const GameListItem &one, const GameListItem &other) bool operator < (const GameListItem &one, const GameListItem &other)
{ {
int indexOne = 0;
int indexOther = 0;
switch (one.GetCountry())
{
case DiscIO::IVolume::COUNTRY_JAP:;
case DiscIO::IVolume::COUNTRY_USA:indexOne = 0; break;
default: indexOne = (int)SConfig::GetInstance().m_InterfaceLanguage;
}
switch (other.GetCountry())
{
case DiscIO::IVolume::COUNTRY_JAP:;
case DiscIO::IVolume::COUNTRY_USA:indexOther = 0; break;
default: indexOther = (int)SConfig::GetInstance().m_InterfaceLanguage;
}
switch(currentColumn) switch(currentColumn)
{ {
case CGameListCtrl::COLUMN_TITLE: return strcasecmp(one.GetName().c_str(), other.GetName().c_str()) < 0; case CGameListCtrl::COLUMN_TITLE: return strcasecmp(one.GetName(indexOne).c_str(), other.GetName(indexOther).c_str()) < 0;
case CGameListCtrl::COLUMN_COMPANY: return strcasecmp(one.GetCompany().c_str(), other.GetCompany().c_str()) < 0; case CGameListCtrl::COLUMN_COMPANY: return strcasecmp(one.GetCompany().c_str(), other.GetCompany().c_str()) < 0;
case CGameListCtrl::COLUMN_NOTES: return strcasecmp(one.GetDescription().c_str(), other.GetDescription().c_str()) < 0; case CGameListCtrl::COLUMN_NOTES: return strcasecmp(one.GetDescription(indexOne).c_str(), other.GetDescription(indexOther).c_str()) < 0;
case CGameListCtrl::COLUMN_COUNTRY: return (one.GetCountry() < other.GetCountry()); case CGameListCtrl::COLUMN_COUNTRY: return (one.GetCountry() < other.GetCountry());
case CGameListCtrl::COLUMN_SIZE: return (one.GetFileSize() < other.GetFileSize()); case CGameListCtrl::COLUMN_SIZE: return (one.GetFileSize() < other.GetFileSize());
case CGameListCtrl::COLUMN_ISSUES: return strcasecmp(one.GetIssues().c_str(), other.GetIssues().c_str()) < 0; case CGameListCtrl::COLUMN_ISSUES: return strcasecmp(one.GetIssues().c_str(), other.GetIssues().c_str()) < 0;
default: return strcasecmp(one.GetName().c_str(), other.GetName().c_str()) < 0; default: return strcasecmp(one.GetName(indexOne).c_str(), other.GetName(indexOther).c_str()) < 0;
} }
} }
@ -125,7 +143,7 @@ void CGameListCtrl::BrowseForDirectory()
} }
} }
void CGameListCtrl::Update(bool bUpdateCache) void CGameListCtrl::Update()
{ {
if (m_imageListSmall) if (m_imageListSmall)
{ {
@ -135,7 +153,7 @@ void CGameListCtrl::Update(bool bUpdateCache)
Hide(); Hide();
ScanForISOs(bUpdateCache); ScanForISOs();
ClearAll(); ClearAll();
@ -233,9 +251,44 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
// title: 0xFF0000 // title: 0xFF0000
// company: 0x007030 // company: 0x007030
SetItem(_Index, COLUMN_TITLE, wxString::FromAscii(rISOFile.GetName().c_str()), -1); switch (rISOFile.GetCountry())
{
case DiscIO::IVolume::COUNTRY_JAP:
{
// keep these codes, when we move to wx unicode...
//wxCSConv convFrom(wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS));
//wxCSConv convTo(wxFontMapper::GetEncodingName(wxFONTENCODING_DEFAULT));
//SetItem(_Index, COLUMN_TITLE, wxString(wxString(rISOFile.GetName()).wc_str(convFrom) , convTo), -1);
//SetItem(_Index, COLUMN_NOTES, wxString(wxString(rISOFile.GetDescription()).wc_str(convFrom) , convTo), -1);
wxString name;
if (CopySJISToString(name, rISOFile.GetName(0).c_str()))
{
SetItem(_Index, COLUMN_TITLE, name, -1);
}
wxString description;
if (CopySJISToString(description, rISOFile.GetDescription(0).c_str()))
{
SetItem(_Index, COLUMN_NOTES, description, -1);
}
}
break;
case DiscIO::IVolume::COUNTRY_USA:
SetItem(_Index, COLUMN_TITLE, wxString(rISOFile.GetName(0).c_str()), -1);
SetItem(_Index, COLUMN_NOTES, wxString(rISOFile.GetDescription(0).c_str()), -1);
break;
default:
SetItem(_Index, COLUMN_TITLE,
//wxString::FromAscii(rISOFile.GetName((int)SConfig::GetInstance().m_InterfaceLanguage).c_str()), -1);
wxString(rISOFile.GetName((int)SConfig::GetInstance().m_InterfaceLanguage).c_str()), -1);
SetItem(_Index, COLUMN_NOTES,
//wxString::FromAscii(rISOFile.GetDescription((int)SConfig::GetInstance().m_InterfaceLanguage).c_str()), -1);
wxString(rISOFile.GetDescription((int)SConfig::GetInstance().m_InterfaceLanguage).c_str()), -1);
break;
}
SetItem(_Index, COLUMN_COMPANY, wxString::FromAscii(rISOFile.GetCompany().c_str()), -1); SetItem(_Index, COLUMN_COMPANY, wxString::FromAscii(rISOFile.GetCompany().c_str()), -1);
SetItem(_Index, COLUMN_NOTES, wxString::FromAscii(rISOFile.GetDescription().c_str()), -1);
SetItem(_Index, COLUMN_SIZE, NiceSizeFormat(rISOFile.GetFileSize()), -1); SetItem(_Index, COLUMN_SIZE, NiceSizeFormat(rISOFile.GetFileSize()), -1);
// Load the INI file for columns that read from it // Load the INI file for columns that read from it
@ -363,7 +416,7 @@ void CGameListCtrl::SetBackgroundColor()
} }
} }
void CGameListCtrl::ScanForISOs(bool bUpdateCache) void CGameListCtrl::ScanForISOs()
{ {
m_ISOFiles.clear(); m_ISOFiles.clear();
CFileSearch::XStringVector Directories(SConfig::GetInstance().m_ISOFolder); CFileSearch::XStringVector Directories(SConfig::GetInstance().m_ISOFolder);
@ -407,7 +460,7 @@ void CGameListCtrl::ScanForISOs(bool bUpdateCache)
{ {
break; break;
} }
GameListItem ISOFile(rFilenames[i], bUpdateCache); GameListItem ISOFile(rFilenames[i]);
if (ISOFile.IsValid()) if (ISOFile.IsValid())
{ {
m_ISOFiles.push_back(ISOFile); m_ISOFiles.push_back(ISOFile);
@ -446,14 +499,31 @@ int wxCALLBACK wxListCompare(long item1, long item2, long sortData)
sortData = -sortData; sortData = -sortData;
} }
int indexOne = 0;
int indexOther = 0;
switch (iso1->GetCountry())
{
case DiscIO::IVolume::COUNTRY_JAP:;
case DiscIO::IVolume::COUNTRY_USA:indexOne = 0; break;
default: indexOne = (int)SConfig::GetInstance().m_InterfaceLanguage;
}
switch (iso2->GetCountry())
{
case DiscIO::IVolume::COUNTRY_JAP:;
case DiscIO::IVolume::COUNTRY_USA:indexOther = 0; break;
default: indexOther = (int)SConfig::GetInstance().m_InterfaceLanguage;
}
switch(sortData) switch(sortData)
{ {
case CGameListCtrl::COLUMN_TITLE: case CGameListCtrl::COLUMN_TITLE:
return strcasecmp(iso1->GetName().c_str(),iso2->GetName().c_str()) *t; return strcasecmp(iso1->GetName(indexOne).c_str(),iso2->GetName(indexOther).c_str()) *t;
case CGameListCtrl::COLUMN_COMPANY: case CGameListCtrl::COLUMN_COMPANY:
return strcasecmp(iso1->GetCompany().c_str(),iso2->GetCompany().c_str()) *t; return strcasecmp(iso1->GetCompany().c_str(),iso2->GetCompany().c_str()) *t;
case CGameListCtrl::COLUMN_NOTES: case CGameListCtrl::COLUMN_NOTES:
return strcasecmp(iso1->GetDescription().c_str(),iso2->GetDescription().c_str()) *t; return strcasecmp(iso1->GetDescription(indexOne).c_str(),iso2->GetDescription(indexOther).c_str()) *t;
case CGameListCtrl::COLUMN_ISSUES: case CGameListCtrl::COLUMN_ISSUES:
return strcasecmp(iso1->GetIssues().c_str(),iso2->GetIssues().c_str()) *t; return strcasecmp(iso1->GetIssues().c_str(),iso2->GetIssues().c_str()) *t;
case CGameListCtrl::COLUMN_COUNTRY: case CGameListCtrl::COLUMN_COUNTRY:
@ -839,3 +909,52 @@ void CGameListCtrl::UnselectAll()
} }
} }
bool CGameListCtrl::CopySJISToString( wxString& _rDestination, const char* _src )
{
bool returnCode = false;
#ifdef WIN32
// HyperIris: because dolphin using "Use Multi-Byte Character Set",
// we must convert the SJIS chars to unicode then to our windows local by hand
u32 unicodeNameSize = MultiByteToWideChar(932, MB_PRECOMPOSED,
_src, (int)strlen(_src), NULL, NULL);
if (unicodeNameSize > 0)
{
u16* pUnicodeStrBuffer = new u16[unicodeNameSize + 1];
if (pUnicodeStrBuffer)
{
memset(pUnicodeStrBuffer, 0, (unicodeNameSize + 1) * sizeof(u16));
if (MultiByteToWideChar(932, MB_PRECOMPOSED,
_src, (int)strlen(_src),
(LPWSTR)pUnicodeStrBuffer, unicodeNameSize))
{
u32 ansiNameSize = WideCharToMultiByte(CP_ACP, 0,
(LPCWSTR)pUnicodeStrBuffer, unicodeNameSize,
NULL, NULL, NULL, NULL);
if (ansiNameSize > 0)
{
char* pAnsiStrBuffer = new char[ansiNameSize + 1];
if (pAnsiStrBuffer)
{
memset(pAnsiStrBuffer, 0, (ansiNameSize + 1) * sizeof(char));
if (WideCharToMultiByte(CP_ACP, 0,
(LPCWSTR)pUnicodeStrBuffer, unicodeNameSize,
pAnsiStrBuffer, ansiNameSize, NULL, NULL))
{
_rDestination = pAnsiStrBuffer;
returnCode = true;
}
delete pAnsiStrBuffer;
}
}
}
delete pUnicodeStrBuffer;
}
}
#else
// not implement other than windows
//_rDestination = _src;
//returnCode = true;
#endif
return returnCode;
}

View File

@ -31,7 +31,7 @@ public:
CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style); CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
~CGameListCtrl(); ~CGameListCtrl();
void Update(bool bUpdateCache = false); void Update();
void BrowseForDirectory(); void BrowseForDirectory();
const GameListItem *GetSelectedISO(); const GameListItem *GetSelectedISO();
const GameListItem *GetISO(int index) const; const GameListItem *GetISO(int index) const;
@ -60,7 +60,7 @@ private:
void InitBitmaps(); void InitBitmaps();
void InsertItemInReportView(long _Index); void InsertItemInReportView(long _Index);
void SetBackgroundColor(); void SetBackgroundColor();
void ScanForISOs(bool bUpdateCache); void ScanForISOs();
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
@ -90,6 +90,9 @@ private:
static size_t m_numberItem; static size_t m_numberItem;
static void CompressCB(const char* text, float percent, void* arg); static void CompressCB(const char* text, float percent, void* arg);
static void MultiCompressCB(const char* text, float percent, void* arg); static void MultiCompressCB(const char* text, float percent, void* arg);
// hyperiris: put it here will be nice, if we moce to wx unicode, it simple to fix
bool CopySJISToString(wxString& _rDestination, const char* _src);
}; };

View File

@ -32,14 +32,14 @@
#include "ChunkFile.h" #include "ChunkFile.h"
#include "../resources/no_banner.cpp" #include "../resources/no_banner.cpp"
#define CACHE_REVISION 0x105 #define CACHE_REVISION 0x106
#define DVD_BANNER_WIDTH 96 #define DVD_BANNER_WIDTH 96
#define DVD_BANNER_HEIGHT 32 #define DVD_BANNER_HEIGHT 32
static u32 g_ImageTemp[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT]; static u32 g_ImageTemp[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT];
GameListItem::GameListItem(const std::string& _rFileName, bool bUpdateCache) GameListItem::GameListItem(const std::string& _rFileName)
: m_FileName(_rFileName) : m_FileName(_rFileName)
, m_FileSize(0) , m_FileSize(0)
, m_Valid(false) , m_Valid(false)
@ -48,7 +48,7 @@ GameListItem::GameListItem(const std::string& _rFileName, bool bUpdateCache)
, m_ImageSize(0) , m_ImageSize(0)
{ {
if ((bUpdateCache == false) && LoadFromCache()) if (LoadFromCache())
{ {
m_Valid = true; m_Valid = true;
} }
@ -58,11 +58,11 @@ GameListItem::GameListItem(const std::string& _rFileName, bool bUpdateCache)
if (pVolume != NULL) if (pVolume != NULL)
{ {
m_Name = _rFileName; m_Name[0] = _rFileName;
m_Country = pVolume->GetCountry(); m_Country = pVolume->GetCountry();
m_FileSize = File::GetSize(_rFileName.c_str()); m_FileSize = File::GetSize(_rFileName.c_str());
m_VolumeSize = pVolume->GetSize(); m_VolumeSize = pVolume->GetSize();
m_Name = pVolume->GetName(); m_Name[0] = pVolume->GetName();
m_UniqueID = pVolume->GetUniqueID(); m_UniqueID = pVolume->GetUniqueID();
m_BlobCompressed = DiscIO::IsCompressedBlob(_rFileName.c_str()); m_BlobCompressed = DiscIO::IsCompressedBlob(_rFileName.c_str());
@ -77,9 +77,9 @@ GameListItem::GameListItem(const std::string& _rFileName, bool bUpdateCache)
{ {
if (pBannerLoader->IsValid()) if (pBannerLoader->IsValid())
{ {
pBannerLoader->GetName(m_Name, m_Country); //m_Country == DiscIO::IVolume::COUNTRY_JAP ? 1 : 0); pBannerLoader->GetName(m_Name); //m_Country == DiscIO::IVolume::COUNTRY_JAP ? 1 : 0);
pBannerLoader->GetCompany(m_Company); pBannerLoader->GetCompany(m_Company);
pBannerLoader->GetDescription(m_Description, m_Country); pBannerLoader->GetDescription(m_Description);
if (pBannerLoader->GetBanner(g_ImageTemp)) if (pBannerLoader->GetBanner(g_ImageTemp))
{ {
m_ImageSize = DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT * 3; m_ImageSize = DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT * 3;
@ -149,9 +149,11 @@ void GameListItem::SaveToCache()
void GameListItem::DoState(PointerWrap &p) void GameListItem::DoState(PointerWrap &p)
{ {
p.Do(m_Name); p.Do(m_Name[0]); p.Do(m_Name[1]); p.Do(m_Name[2]);
p.Do(m_Name[3]); p.Do(m_Name[4]); p.Do(m_Name[5]);
p.Do(m_Company); p.Do(m_Company);
p.Do(m_Description); p.Do(m_Description[0]); p.Do(m_Description[1]); p.Do(m_Description[2]);
p.Do(m_Description[3]); p.Do(m_Description[4]); p.Do(m_Description[5]);
p.Do(m_UniqueID); p.Do(m_UniqueID);
p.Do(m_FileSize); p.Do(m_FileSize);
p.Do(m_VolumeSize); p.Do(m_VolumeSize);
@ -170,3 +172,21 @@ std::string GameListItem::CreateCacheFilename()
fullname += Filename; fullname += Filename;
return fullname; return fullname;
} }
const std::string& GameListItem::GetDescription(int index) const
{
if ((index >=0) && (index < 6))
{
return m_Description[index];
}
return m_Description[0];
}
const std::string& GameListItem::GetName(int index) const
{
if ((index >=0) && (index < 6))
{
return m_Name[index];
}
return m_Name[0];
}

View File

@ -24,14 +24,14 @@ class PointerWrap;
class GameListItem class GameListItem
{ {
public: public:
GameListItem(const std::string& _rFileName, bool bUpdateCache = false); GameListItem(const std::string& _rFileName);
~GameListItem(); ~GameListItem();
bool IsValid() const {return m_Valid;} bool IsValid() const {return m_Valid;}
const std::string& GetFileName() const {return m_FileName;} const std::string& GetFileName() const {return m_FileName;}
const std::string& GetName() const {return m_Name;} const std::string& GetName(int index) const;
const std::string& GetCompany() const {return m_Company;} const std::string& GetCompany() const {return m_Company;}
const std::string& GetDescription() const {return m_Description;} const std::string& GetDescription(int index) const;
const std::string& GetUniqueID() const {return m_UniqueID;} const std::string& GetUniqueID() const {return m_UniqueID;}
DiscIO::IVolume::ECountry GetCountry() const {return m_Country;} DiscIO::IVolume::ECountry GetCountry() const {return m_Country;}
const std::string& GetIssues() const {return m_Issues;} const std::string& GetIssues() const {return m_Issues;}
@ -43,12 +43,11 @@ public:
#endif #endif
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
private: private:
std::string m_FileName; std::string m_FileName;
std::string m_Name; std::string m_Name[6];
std::string m_Company; std::string m_Company;
std::string m_Description; std::string m_Description[6];
std::string m_UniqueID; std::string m_UniqueID;
std::string m_Issues; std::string m_Issues;

View File

@ -113,10 +113,14 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
//m_Version; //m_Version;
//if (OpenISO_.GetBNRVersion() == "BNR1") //if (OpenISO_.GetBNRVersion() == "BNR1")
m_Lang->Enable(false); m_Lang->Enable(false);
m_ShortName->SetValue(wxString(OpenISO_.GetName().c_str(), wxConvUTF8));
// hyperiris: temp fix, need real work
m_ShortName->SetValue(wxString(OpenISO_.GetName(0).c_str(), wxConvUTF8));
//m_LongName->SetValue(wxString(OpenISO_.GetLongName().c_str(), wxConvUTF8)); //m_LongName->SetValue(wxString(OpenISO_.GetLongName().c_str(), wxConvUTF8));
m_Maker->SetValue(wxString(OpenISO_.GetCompany().c_str(), wxConvUTF8));//dev too m_Maker->SetValue(wxString(OpenISO_.GetCompany().c_str(), wxConvUTF8));//dev too
m_Comment->SetValue(wxString(OpenISO_.GetDescription().c_str(), wxConvUTF8));
// hyperiris: temp fix, need real work
m_Comment->SetValue(wxString(OpenISO_.GetDescription(0).c_str(), wxConvUTF8));
m_Banner->SetBitmap(OpenISO_.GetImage()); m_Banner->SetBitmap(OpenISO_.GetImage());
m_Banner->Connect(wxID_ANY, wxEVT_RIGHT_DOWN, m_Banner->Connect(wxID_ANY, wxEVT_RIGHT_DOWN,
wxMouseEventHandler(CISOProperties::RightClickOnBanner), (wxObject*)NULL, this); wxMouseEventHandler(CISOProperties::RightClickOnBanner), (wxObject*)NULL, this);
@ -128,7 +132,9 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
std::string filename, extension; std::string filename, extension;
SplitPath(fileName, 0, &filename, &extension); SplitPath(fileName, 0, &filename, &extension);
SetTitle(wxString::Format(_("%s%s: %s - %s"), filename.c_str(), extension.c_str(), OpenISO_.GetUniqueID().c_str(), OpenISO_.GetName().c_str()));
// hyperiris: temp fix, need real work
SetTitle(wxString::Format(_("%s%s: %s - %s"), filename.c_str(), extension.c_str(), OpenISO_.GetUniqueID().c_str(), OpenISO_.GetName(0).c_str()));
} }
CISOProperties::~CISOProperties() CISOProperties::~CISOProperties()