mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
proper unicode literal and wstring to wxstring conversions.
Fixes issue 5156.
This commit is contained in:
parent
fd616ccb0c
commit
04a7e33f0b
@ -448,7 +448,7 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
|
||||
#else
|
||||
// on linux the wrong string is returned from wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)
|
||||
// it returns CP-932, in order to use iconv we need to use CP932
|
||||
wxCSConv SJISConv(L"CP932");
|
||||
wxCSConv SJISConv(wxT("CP932"));
|
||||
#endif
|
||||
|
||||
GameListItem& rISOFile = *m_ISOFiles[_Index];
|
||||
@ -468,10 +468,13 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
|
||||
// Set the game's banner in the second column
|
||||
SetItemColumnImage(_Index, COLUMN_BANNER, ImageIndex);
|
||||
|
||||
std::wstring wname;
|
||||
const std::wstring& wdescription = rISOFile.GetDescription();
|
||||
std::wstring wstring_name;
|
||||
const std::wstring& wstring_description = rISOFile.GetDescription();
|
||||
std::string company;
|
||||
|
||||
wxString name;
|
||||
wxString description;
|
||||
|
||||
// We show the company string on Gamecube only
|
||||
// On Wii we show the description instead as the company string is empty
|
||||
if (rISOFile.GetPlatform() == GameListItem::GAMECUBE_DISC)
|
||||
@ -482,13 +485,11 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
|
||||
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
||||
case DiscIO::IVolume::COUNTRY_JAPAN:
|
||||
{
|
||||
rISOFile.GetName(wname, -1);
|
||||
wxString name = wxString(rISOFile.GetName(0).c_str(), SJISConv);
|
||||
rISOFile.GetName(wstring_name, -1);
|
||||
name = wxString(rISOFile.GetName(0).c_str(), SJISConv);
|
||||
m_gameList.append(StringFromFormat("%s (J)\n", (const char *)name.c_str()));
|
||||
SetItem(_Index, COLUMN_TITLE, name, -1);
|
||||
SetItem(_Index, COLUMN_NOTES, wxString(company.size() ?
|
||||
company.c_str() : rISOFile.GetDescription(0).c_str(),
|
||||
SJISConv), -1);
|
||||
description = wxString(company.size() ? company.c_str() :
|
||||
rISOFile.GetDescription(0).c_str(), SJISConv);
|
||||
}
|
||||
break;
|
||||
case DiscIO::IVolume::COUNTRY_USA:
|
||||
@ -496,28 +497,24 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
|
||||
default:
|
||||
{
|
||||
wxCSConv WindowsCP1252(wxFontMapper::GetEncodingName(wxFONTENCODING_CP1252));
|
||||
rISOFile.GetName(wname, SelectedLanguage);
|
||||
rISOFile.GetName(wstring_name, SelectedLanguage);
|
||||
|
||||
SetItem(_Index, COLUMN_TITLE,
|
||||
wxString(
|
||||
rISOFile.GetName(SelectedLanguage).c_str(), WindowsCP1252),
|
||||
-1);
|
||||
name = wxString(rISOFile.GetName(SelectedLanguage).c_str(), WindowsCP1252);
|
||||
m_gameList.append(StringFromFormat("%s (%c)\n",
|
||||
rISOFile.GetName(SelectedLanguage).c_str(), (rISOFile.GetCountry() == DiscIO::IVolume::COUNTRY_USA)?'U':'E'));
|
||||
SetItem(_Index, COLUMN_NOTES,
|
||||
wxString(company.size() ?
|
||||
company.c_str() :
|
||||
rISOFile.GetDescription(SelectedLanguage).c_str(), WindowsCP1252),
|
||||
-1);
|
||||
description = wxString(company.size() ? company.c_str() :
|
||||
rISOFile.GetDescription(SelectedLanguage).c_str(), WindowsCP1252);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (wname.length())
|
||||
SetItem(_Index, COLUMN_TITLE, wname, -1);
|
||||
if (wdescription.length())
|
||||
SetItem(_Index, COLUMN_NOTES, wdescription, -1);
|
||||
|
||||
if (wstring_name.length())
|
||||
name = wstring_name.c_str();
|
||||
if (wstring_description.length())
|
||||
description = wstring_description.c_str();
|
||||
|
||||
SetItem(_Index, COLUMN_TITLE, name, -1);
|
||||
SetItem(_Index, COLUMN_NOTES, description, -1);
|
||||
|
||||
#ifndef _WIN32
|
||||
// Emulation state
|
||||
|
@ -158,7 +158,7 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
|
||||
std::wstring wname;
|
||||
wxString name;
|
||||
if (OpenGameListItem->GetName(wname))
|
||||
name = wname;
|
||||
name = wname.c_str();
|
||||
else
|
||||
name = wxString(OpenISO->GetName().c_str(), wxConvUTF8);
|
||||
m_Name->SetValue(name);
|
||||
@ -1280,7 +1280,7 @@ void CISOProperties::ChangeBannerDetails(int lang)
|
||||
#else
|
||||
// on linux the wrong string is returned from wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)
|
||||
// it returns CP-932, in order to use iconv we need to use CP932
|
||||
wxCSConv SJISConv(L"CP932");
|
||||
wxCSConv SJISConv(wxT("CP932"));
|
||||
#endif
|
||||
switch (OpenGameListItem->GetCountry())
|
||||
{
|
||||
@ -1288,11 +1288,11 @@ void CISOProperties::ChangeBannerDetails(int lang)
|
||||
case DiscIO::IVolume::COUNTRY_JAPAN:
|
||||
|
||||
if (OpenGameListItem->GetName(wname, -1))
|
||||
shortName = wname;
|
||||
shortName = wname.c_str();
|
||||
else
|
||||
shortName = wxString(OpenGameListItem->GetName(0).c_str(), SJISConv);
|
||||
|
||||
if ((comment = OpenGameListItem->GetDescription()).size() == 0)
|
||||
if ((comment = OpenGameListItem->GetDescription().c_str()).size() == 0)
|
||||
comment = wxString(OpenGameListItem->GetDescription(0).c_str(), SJISConv);
|
||||
maker = wxString(OpenGameListItem->GetCompany().c_str(), SJISConv);
|
||||
break;
|
||||
@ -1302,10 +1302,10 @@ void CISOProperties::ChangeBannerDetails(int lang)
|
||||
{
|
||||
wxCSConv WindowsCP1252(wxFontMapper::GetEncodingName(wxFONTENCODING_CP1252));
|
||||
if (OpenGameListItem->GetName(wname, lang))
|
||||
shortName = wname;
|
||||
shortName = wname.c_str();
|
||||
else
|
||||
shortName = wxString(OpenGameListItem->GetName(lang).c_str(), WindowsCP1252);
|
||||
if ((comment = OpenGameListItem->GetDescription()).size() == 0)
|
||||
if ((comment = OpenGameListItem->GetDescription().c_str()).size() == 0)
|
||||
comment = wxString(OpenGameListItem->GetDescription(lang).c_str(), WindowsCP1252);
|
||||
maker = wxString(OpenGameListItem->GetCompany().c_str(), WindowsCP1252);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos,
|
||||
#else
|
||||
// on linux the wrong string is returned from wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)
|
||||
// it returns CP-932, in order to use iconv we need to use CP932
|
||||
m_SJISConv = wxCSConv(L"CP932");
|
||||
m_SJISConv = wxCSConv(wxT("CP932"));
|
||||
#endif
|
||||
|
||||
m_LogManager = LogManager::GetInstance();
|
||||
|
@ -716,7 +716,7 @@ bool CMemcardManager::ReloadMemcard(const char *fileName, int card)
|
||||
#else
|
||||
// on linux the wrong string is returned from wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)
|
||||
// it returns CP-932, in order to use iconv we need to use CP932
|
||||
wxCSConv SJISConv(L"CP932");
|
||||
wxCSConv SJISConv(wxT("CP932"));
|
||||
#endif
|
||||
wxTitle = wxString(title, ascii ? *wxConvCurrent : SJISConv);
|
||||
wxComment = wxString(comment, ascii ? *wxConvCurrent : SJISConv);
|
||||
|
Loading…
Reference in New Issue
Block a user