diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index a5c10450a0..0c24587d90 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -125,7 +125,10 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW SplitPath(fileName, 0, &filename, &extension); // hyperiris: temp fix, need real work - SetTitle(wxString::Format(_("%s%s: %s - %s"), filename.c_str(), extension.c_str(), OpenGameListItem->GetUniqueID().c_str(), OpenGameListItem->GetName(0).c_str())); + wxString name; + CopySJISToString(name, OpenGameListItem->GetName(0).c_str()); + + SetTitle(wxString::Format(_("%s%s: %s - %s"), filename.c_str(), extension.c_str(), OpenGameListItem->GetUniqueID().c_str(), name)); } CISOProperties::~CISOProperties() @@ -776,7 +779,61 @@ void CISOProperties::OnChangeBannerLang(wxCommandEvent& event) void CISOProperties::ChangeBannerDetails(int lang) { - m_ShortName->SetValue(wxString(OpenGameListItem->GetName(lang).c_str(), wxConvUTF8)); - m_Maker->SetValue(wxString(OpenGameListItem->GetCompany().c_str(), wxConvUTF8));//dev too - m_Comment->SetValue(wxString(OpenGameListItem->GetDescription(lang).c_str(), wxConvUTF8)); + wxString name; + CopySJISToString(name, OpenGameListItem->GetName(lang).c_str()); + wxString description; + CopySJISToString(description, OpenGameListItem->GetDescription(lang).c_str()); + + m_ShortName->SetValue(name); + m_Maker->SetValue(OpenGameListItem->GetCompany().c_str());//dev too + m_Comment->SetValue(description); } + +bool CISOProperties::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/ISOProperties.h b/Source/Core/DolphinWX/Src/ISOProperties.h index 8f15cbb659..d42ac12354 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.h +++ b/Source/Core/DolphinWX/Src/ISOProperties.h @@ -235,5 +235,8 @@ class CISOProperties : public wxDialog void ActionReplayList_Load(); void ActionReplayList_Save(); void ChangeBannerDetails(int lang); + + // HyperIris: duplicate from GameListCtrl, who can merge them and put them in a suitable place? + bool CopySJISToString(wxString& _rDestination, const char* _src); }; #endif