diff --git a/Source/Core/DiscIO/Src/BannerLoader.cpp b/Source/Core/DiscIO/Src/BannerLoader.cpp index a36e4e0ebc..02242d5b29 100644 --- a/Source/Core/DiscIO/Src/BannerLoader.cpp +++ b/Source/Core/DiscIO/Src/BannerLoader.cpp @@ -94,55 +94,6 @@ bool IBannerLoader::CopyToStringAndCheck(std::string& _rDestination, const char* 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 returnCode = false; @@ -172,7 +123,7 @@ bool IBannerLoader::CopyUnicodeToString( std::string& _rDestination, const u16* #else // FIXME: Horribly broke on non win32 // _rDestination = _src; - returnCode = true; + returnCode = false; #endif return returnCode; } diff --git a/Source/Core/DiscIO/Src/BannerLoader.h b/Source/Core/DiscIO/Src/BannerLoader.h index 83fc9f7e95..1a455c7a86 100644 --- a/Source/Core/DiscIO/Src/BannerLoader.h +++ b/Source/Core/DiscIO/Src/BannerLoader.h @@ -38,17 +38,17 @@ class IBannerLoader 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 GetDescription(std::string& _rDescription, DiscIO::IVolume::ECountry language) = 0; + virtual bool GetDescription(std::string* _rDescription) = 0; protected: bool CopyToStringAndCheck(std::string& _rDestination, const char* _src); - bool CopySJISToString(std::string& _rDestination, const char* _src); + bool CopyUnicodeToString(std::string& _rDestination, const u16* _src); }; diff --git a/Source/Core/DiscIO/Src/BannerLoaderGC.cpp b/Source/Core/DiscIO/Src/BannerLoaderGC.cpp index 9d1ad055d7..d4071b7dd1 100644 --- a/Source/Core/DiscIO/Src/BannerLoaderGC.cpp +++ b/Source/Core/DiscIO/Src/BannerLoaderGC.cpp @@ -92,9 +92,12 @@ CBannerLoaderGC::GetBanner(u32* _pBannerImage) 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; @@ -109,21 +112,10 @@ CBannerLoaderGC::GetName(std::string& _rName, DiscIO::IVolume::ECountry language case CBannerLoaderGC::BANNER_BNR1: { DVDBanner* pBanner = (DVDBanner*)m_pBannerFile; - if (DiscIO::IVolume::COUNTRY_JAP == language) - { - // dunno, if dolphin using unicode, it will be better = =; - if (CopySJISToString(_rName, pBanner->comment.shortTitle)) - { - returnCode = true; - } - } - else - { - if (CopyToStringAndCheck(_rName, pBanner->comment.shortTitle))//language != 0 ? pBanner->comment[0].shortTitle : pBanner->comment[0].longTitle)) - { - returnCode = true; - } - } + char tempBuffer[33] = {0}; + memcpy(tempBuffer, pBanner->comment.shortTitle, 32); + _rName[0] = tempBuffer; + returnCode = true; } break; case CBannerLoaderGC::BANNER_BNR2: @@ -131,10 +123,15 @@ CBannerLoaderGC::GetName(std::string& _rName, DiscIO::IVolume::ECountry language DVDBanner2* pBanner = (DVDBanner2*)m_pBannerFile; 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; } @@ -165,9 +162,12 @@ CBannerLoaderGC::GetCompany(std::string& _rCompany) 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; @@ -182,32 +182,23 @@ CBannerLoaderGC::GetDescription(std::string& _rDescription, DiscIO::IVolume::ECo case CBannerLoaderGC::BANNER_BNR1: { DVDBanner* pBanner = (DVDBanner*)m_pBannerFile; - if (DiscIO::IVolume::COUNTRY_JAP == language) - { - // dunno, if dolphin using unicode, it will be better = =; - if (CopySJISToString(_rDescription, pBanner->comment.comment)) - { - returnCode = true; - } - } - else - { - if (CopyToStringAndCheck(_rDescription, pBanner->comment.comment))//language != 0 ? pBanner->comment[0].shortTitle : pBanner->comment[0].longTitle)) - { - returnCode = true; - } - } + char tempBuffer[129] = {0}; + memcpy(tempBuffer, pBanner->comment.comment, 128); + _rDescription[0] = tempBuffer; + returnCode = true; } break; case CBannerLoaderGC::BANNER_BNR2: { DVDBanner2* pBanner = (DVDBanner2*)m_pBannerFile; - u32 languageID = SConfig::GetInstance().m_InterfaceLanguage; - if (CopyToStringAndCheck(_rDescription, pBanner->comment[languageID].comment))//language != 0 ? pBanner->comment[0].shortTitle : pBanner->comment[0].longTitle)) + for (int i = 0; i< 6; i++) { - returnCode = true; + char tempBuffer[129] = {0}; + memcpy(tempBuffer, pBanner->comment[i].comment, 128); + _rDescription[i] = tempBuffer; } + returnCode = true; } break; } diff --git a/Source/Core/DiscIO/Src/BannerLoaderGC.h b/Source/Core/DiscIO/Src/BannerLoaderGC.h index 0e3f7ba0ef..a72830cbab 100644 --- a/Source/Core/DiscIO/Src/BannerLoaderGC.h +++ b/Source/Core/DiscIO/Src/BannerLoaderGC.h @@ -35,11 +35,11 @@ class CBannerLoaderGC 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 GetDescription(std::string& _rDescription, DiscIO::IVolume::ECountry language); + virtual bool GetDescription(std::string* _rDescription); private: diff --git a/Source/Core/DiscIO/Src/BannerLoaderWii.cpp b/Source/Core/DiscIO/Src/BannerLoaderWii.cpp index 92feccdd3a..12b7ba2e3e 100644 --- a/Source/Core/DiscIO/Src/BannerLoaderWii.cpp +++ b/Source/Core/DiscIO/Src/BannerLoaderWii.cpp @@ -115,9 +115,12 @@ CBannerLoaderWii::StupidWideCharToString(u16* _pSrc, size_t _max) } 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()) { @@ -126,19 +129,17 @@ CBannerLoaderWii::GetName(std::string& _rName, DiscIO::IVolume::ECountry languag // find Banner type 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]); - } - else -#endif - { - // very stupid - _rName = StupidWideCharToString(pBanner->m_Comment[0], WII_BANNER_COMMENT_SIZE); + for (int i = 0; i < 6; i++) + { + _rName[i] = name; + } return true; } - return true; + return false; } @@ -151,9 +152,12 @@ CBannerLoaderWii::GetCompany(std::string& _rCompany) 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()) { @@ -162,17 +166,16 @@ CBannerLoaderWii::GetDescription(std::string& _rDescription, DiscIO::IVolume::EC // find Banner type 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]); - } - else - { - // very stupid - _rDescription = StupidWideCharToString(pBanner->m_Comment[1], WII_BANNER_COMMENT_SIZE); + for (int i = 0; i< 6; i++) + { + _rDescription[i] = description; + } return true; } - return false; } diff --git a/Source/Core/DiscIO/Src/BannerLoaderWii.h b/Source/Core/DiscIO/Src/BannerLoaderWii.h index 5b7890b1fb..80a1ab4636 100644 --- a/Source/Core/DiscIO/Src/BannerLoaderWii.h +++ b/Source/Core/DiscIO/Src/BannerLoaderWii.h @@ -35,11 +35,11 @@ class CBannerLoaderWii 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 GetDescription(std::string& _rDescription, DiscIO::IVolume::ECountry language); + virtual bool GetDescription(std::string* _rDescription); private: diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index 91b1d3d1ba..7a63afd31d 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -92,7 +92,7 @@ CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title, { // Control refreshing of the ISOs list bRefreshList = false; - bRefreshCache = false; + // Load Wii SYSCONF FullSYSCONFPath = FULL_WII_USER_DIR "shared2/sys/SYSCONF"; pStream = NULL; @@ -532,7 +532,7 @@ void CConfigMain::CreateGUIControls() 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 // save anything, it will be a corrupted file @@ -592,7 +592,6 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event) case ID_INTERFACE_LANG: SConfig::GetInstance().m_InterfaceLanguage = (INTERFACE_LANGUAGE)InterfaceLang->GetSelection(); bRefreshList = true; - bRefreshCache = true; break; case ID_ALLWAYS_HLEBIOS: // Core diff --git a/Source/Core/DolphinWX/Src/ConfigMain.h b/Source/Core/DolphinWX/Src/ConfigMain.h index cfe9a0d2b4..046dabef1c 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.h +++ b/Source/Core/DolphinWX/Src/ConfigMain.h @@ -43,7 +43,6 @@ class CConfigMain void OnConfig(wxCommandEvent& event); bool bRefreshList; - bool bRefreshCache; private: diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 104c898208..036f8217bd 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -511,7 +511,7 @@ void CFrame::OnConfigMain(wxCommandEvent& WXUNUSED (event)) { CConfigMain ConfigMain(this); if (ConfigMain.ShowModal() == wxID_OK) - m_GameListCtrl->Update(ConfigMain.bRefreshCache); + m_GameListCtrl->Update(); } diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp index 70468309ce..55b261ef03 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp @@ -18,6 +18,7 @@ #include "Globals.h" #include +#include #include @@ -45,15 +46,32 @@ std::string CGameListCtrl::m_currentFilename; static int currentColumn = 0; 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) { - 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_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_SIZE: return (one.GetFileSize() < other.GetFileSize()); 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) { @@ -135,7 +153,7 @@ void CGameListCtrl::Update(bool bUpdateCache) Hide(); - ScanForISOs(bUpdateCache); + ScanForISOs(); ClearAll(); @@ -233,9 +251,44 @@ void CGameListCtrl::InsertItemInReportView(long _Index) // title: 0xFF0000 // 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_NOTES, wxString::FromAscii(rISOFile.GetDescription().c_str()), -1); + SetItem(_Index, COLUMN_SIZE, NiceSizeFormat(rISOFile.GetFileSize()), -1); // 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(); CFileSearch::XStringVector Directories(SConfig::GetInstance().m_ISOFolder); @@ -407,7 +460,7 @@ void CGameListCtrl::ScanForISOs(bool bUpdateCache) { break; } - GameListItem ISOFile(rFilenames[i], bUpdateCache); + GameListItem ISOFile(rFilenames[i]); if (ISOFile.IsValid()) { m_ISOFiles.push_back(ISOFile); @@ -446,14 +499,31 @@ int wxCALLBACK wxListCompare(long item1, long item2, long 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) { 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: return strcasecmp(iso1->GetCompany().c_str(),iso2->GetCompany().c_str()) *t; 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: return strcasecmp(iso1->GetIssues().c_str(),iso2->GetIssues().c_str()) *t; 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; +} \ No newline at end of file diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.h b/Source/Core/DolphinWX/Src/GameListCtrl.h index a707059f29..ae793cb25b 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.h +++ b/Source/Core/DolphinWX/Src/GameListCtrl.h @@ -31,7 +31,7 @@ public: CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style); ~CGameListCtrl(); - void Update(bool bUpdateCache = false); + void Update(); void BrowseForDirectory(); const GameListItem *GetSelectedISO(); const GameListItem *GetISO(int index) const; @@ -60,7 +60,7 @@ private: void InitBitmaps(); void InsertItemInReportView(long _Index); void SetBackgroundColor(); - void ScanForISOs(bool bUpdateCache); + void ScanForISOs(); DECLARE_EVENT_TABLE() @@ -90,6 +90,9 @@ private: static size_t m_numberItem; static void CompressCB(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); }; diff --git a/Source/Core/DolphinWX/Src/ISOFile.cpp b/Source/Core/DolphinWX/Src/ISOFile.cpp index 8abe3858ac..e0d7a01c00 100644 --- a/Source/Core/DolphinWX/Src/ISOFile.cpp +++ b/Source/Core/DolphinWX/Src/ISOFile.cpp @@ -32,14 +32,14 @@ #include "ChunkFile.h" #include "../resources/no_banner.cpp" -#define CACHE_REVISION 0x105 +#define CACHE_REVISION 0x106 #define DVD_BANNER_WIDTH 96 #define DVD_BANNER_HEIGHT 32 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_FileSize(0) , m_Valid(false) @@ -48,7 +48,7 @@ GameListItem::GameListItem(const std::string& _rFileName, bool bUpdateCache) , m_ImageSize(0) { - if ((bUpdateCache == false) && LoadFromCache()) + if (LoadFromCache()) { m_Valid = true; } @@ -58,11 +58,11 @@ GameListItem::GameListItem(const std::string& _rFileName, bool bUpdateCache) if (pVolume != NULL) { - m_Name = _rFileName; + m_Name[0] = _rFileName; m_Country = pVolume->GetCountry(); m_FileSize = File::GetSize(_rFileName.c_str()); m_VolumeSize = pVolume->GetSize(); - m_Name = pVolume->GetName(); + m_Name[0] = pVolume->GetName(); m_UniqueID = pVolume->GetUniqueID(); m_BlobCompressed = DiscIO::IsCompressedBlob(_rFileName.c_str()); @@ -77,9 +77,9 @@ GameListItem::GameListItem(const std::string& _rFileName, bool bUpdateCache) { 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->GetDescription(m_Description, m_Country); + pBannerLoader->GetDescription(m_Description); if (pBannerLoader->GetBanner(g_ImageTemp)) { m_ImageSize = DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT * 3; @@ -149,9 +149,11 @@ void GameListItem::SaveToCache() 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_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_FileSize); p.Do(m_VolumeSize); @@ -170,3 +172,21 @@ std::string GameListItem::CreateCacheFilename() fullname += Filename; 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]; +} diff --git a/Source/Core/DolphinWX/Src/ISOFile.h b/Source/Core/DolphinWX/Src/ISOFile.h index 4e83d4ce54..09e6e7a7fc 100644 --- a/Source/Core/DolphinWX/Src/ISOFile.h +++ b/Source/Core/DolphinWX/Src/ISOFile.h @@ -24,14 +24,14 @@ class PointerWrap; class GameListItem { public: - GameListItem(const std::string& _rFileName, bool bUpdateCache = false); + GameListItem(const std::string& _rFileName); ~GameListItem(); bool IsValid() const {return m_Valid;} 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& GetDescription() const {return m_Description;} + const std::string& GetDescription(int index) const; const std::string& GetUniqueID() const {return m_UniqueID;} DiscIO::IVolume::ECountry GetCountry() const {return m_Country;} const std::string& GetIssues() const {return m_Issues;} @@ -43,12 +43,11 @@ public: #endif void DoState(PointerWrap &p); - private: std::string m_FileName; - std::string m_Name; + std::string m_Name[6]; std::string m_Company; - std::string m_Description; + std::string m_Description[6]; std::string m_UniqueID; std::string m_Issues; diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index 9502a70c70..ff370944a5 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -113,10 +113,14 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW //m_Version; //if (OpenISO_.GetBNRVersion() == "BNR1") 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_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->Connect(wxID_ANY, wxEVT_RIGHT_DOWN, wxMouseEventHandler(CISOProperties::RightClickOnBanner), (wxObject*)NULL, this); @@ -128,7 +132,9 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW std::string 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()