* Added proper string conversion support to VideoSettings (now you should see list titles correctly)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7400 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
gnick79 2011-03-23 00:54:31 +00:00
parent 47c81bf0e8
commit ae9de182f3
2 changed files with 41 additions and 2 deletions

View File

@ -5,7 +5,6 @@
#include <wx/intl.h>
#include "Frame.h"
#include "ISOFile.h"
#include "GameListCtrl.h"
@ -130,6 +129,39 @@ void VideoConfigDiag::Event_Close(wxCloseEvent& ev)
TextureCache::InvalidateDefer(); // For settings like hi-res textures/texture format/etc.
}
wxString VideoConfigDiag::FormatString(const GameListItem *item)
{
wxString title;
if (item->GetCountry() == DiscIO::IVolume::COUNTRY_JAPAN
|| item->GetCountry() == DiscIO::IVolume::COUNTRY_TAIWAN
|| item->GetPlatform() == GameListItem::WII_WAD)
{
#ifdef _WIN32
wxCSConv SJISConv(*(wxCSConv*)wxConvCurrent);
static bool validCP932 = ::IsValidCodePage(932) != 0;
if (validCP932)
{
SJISConv = wxCSConv(wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS));
}
else
{
WARN_LOG(COMMON, "Cannot Convert from Charset Windows Japanese cp 932");
}
#else
wxCSConv SJISConv(wxFontMapper::GetEncodingName(wxFONTENCODING_EUC_JP));
#endif
title = wxString(item->GetName(0).c_str(), SJISConv);
}
else // Do the same for PAL/US Games (assuming ISO 8859-1)
{
title = wxString::From8BitData(item->GetName(0).c_str());
}
return title;
}
// TODO: implement some hack to increase the tooltip display duration, because some of these are way too long for anyone to read in 5 seconds.
wxString profile_tooltip = wxTRANSLATE("Selects which game should be affected by the configuration changes done in this dialog.\nThe (Default) profile affects the standard settings used for every game.");
@ -183,6 +215,7 @@ wxString cache_efb_copies_tooltip = wxTRANSLATE("When using EFB to RAM we very o
wxString def_profile = _("< as Default Profile >");
VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, const std::string& _ininame)
: wxDialog(parent, -1,
wxString::Format(_("Dolphin %s Graphics Configuration"),
@ -255,7 +288,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
{
const GameListItem* item = GameListCtrl->GetISO(GameListCtrl->GetItemData(index));
if (!item) continue;
profile_cb->AppendString(wxString::FromAscii(item->GetName(0).c_str()));
profile_cb->AppendString(FormatString(item));
}
profile_cb->Select(cur_profile);

View File

@ -6,6 +6,7 @@
#include <string>
#include "VideoConfig.h"
#include "Frame.h"
#include <wx/wx.h>
#include <wx/textctrl.h>
@ -16,6 +17,8 @@
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/spinctrl.h>
#include <wx/fontmap.h>
template <typename U>
class BoolSettingCB : public wxCheckBox
@ -121,6 +124,9 @@ protected:
ev.Skip();
}
//Retrieve a title game with correct format
wxString FormatString(const GameListItem *item);
void Event_ClickClose(wxCommandEvent&);
void Event_Close(wxCloseEvent&);