From ae9de182f35f86ad1f192655d95614f3be08db5a Mon Sep 17 00:00:00 2001 From: gnick79 Date: Wed, 23 Mar 2011 00:54:31 +0000 Subject: [PATCH] * 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 --- Source/Core/DolphinWX/Src/VideoConfigDiag.cpp | 37 ++++++++++++++++++- Source/Core/DolphinWX/Src/VideoConfigDiag.h | 6 +++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp index 05ffdf334d..d26be7d6b9 100644 --- a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp @@ -5,7 +5,6 @@ #include -#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); diff --git a/Source/Core/DolphinWX/Src/VideoConfigDiag.h b/Source/Core/DolphinWX/Src/VideoConfigDiag.h index 238e1b82b6..50e57ba603 100644 --- a/Source/Core/DolphinWX/Src/VideoConfigDiag.h +++ b/Source/Core/DolphinWX/Src/VideoConfigDiag.h @@ -6,6 +6,7 @@ #include #include "VideoConfig.h" +#include "Frame.h" #include #include @@ -16,6 +17,8 @@ #include #include #include +#include + template 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&);