UI: fix ISO property dialog for display Jap name / description.

a function duplicate from GameListCtrl, who can merge them and put them in a suitable place?

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2497 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hyperiris 2009-03-01 04:16:15 +00:00
parent 0710bbb3a7
commit 5a872dfcd9
2 changed files with 64 additions and 4 deletions

View File

@ -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;
}

View File

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