diff --git a/Source/Core/DiscIO/Src/CISOBlob.cpp b/Source/Core/DiscIO/Src/CISOBlob.cpp index 97ba9a6c06..6eb1f5d4f8 100644 --- a/Source/Core/DiscIO/Src/CISOBlob.cpp +++ b/Source/Core/DiscIO/Src/CISOBlob.cpp @@ -15,10 +15,6 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ -#ifdef _WIN32 -#include "stdafx.h" -#endif - #include "Blob.h" #include "CISOBlob.h" diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp index c682468632..9dcdc30aaa 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp @@ -399,11 +399,8 @@ void CGameListCtrl::InsertItemInReportView(long _Index) // title: 0xFF0000 // company: 0x007030 int ImageIndex = -1; -#ifdef _WIN32 - wxCSConv SJISConv(wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)); -#else - wxCSConv SJISConv(wxFontMapper::GetEncodingName(wxFONTENCODING_EUC_JP)); -#endif + static wxCSConv *SJISConv = WxUtils::SJISConv(); + GameListItem& rISOFile = m_ISOFiles[_Index]; m_gamePath.append(rISOFile.GetFileName() + '\n'); @@ -435,12 +432,12 @@ void CGameListCtrl::InsertItemInReportView(long _Index) case DiscIO::IVolume::COUNTRY_TAIWAN: case DiscIO::IVolume::COUNTRY_JAPAN: { - wxString name = wxString(rISOFile.GetName(0).c_str(), SJISConv); + wxString 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); + *SJISConv), -1); } break; case DiscIO::IVolume::COUNTRY_USA: @@ -470,9 +467,9 @@ void CGameListCtrl::InsertItemInReportView(long _Index) { m_gameList.append(StringFromFormat("%s (WAD)\n", rISOFile.GetName(0).c_str())); SetItem(_Index, COLUMN_TITLE, - wxString(rISOFile.GetName(0).c_str(), SJISConv), -1); + wxString(rISOFile.GetName(0).c_str(), *SJISConv), -1); SetItem(_Index, COLUMN_NOTES, - wxString(rISOFile.GetDescription(0).c_str(), SJISConv), -1); + wxString(rISOFile.GetDescription(0).c_str(), *SJISConv), -1); } #ifndef _WIN32 diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index ef1bbe3278..972dea2b2c 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -27,6 +27,7 @@ #include "GeckoCodeDiag.h" #include "ConfigManager.h" #include "StringUtil.h" +#include "WxUtils.h" #include "../resources/isoprop_file.xpm" #include "../resources/isoprop_folder.xpm" @@ -1248,17 +1249,14 @@ void CISOProperties::ChangeBannerDetails(int lang) || OpenGameListItem->GetCountry() == DiscIO::IVolume::COUNTRY_TAIWAN || OpenGameListItem->GetPlatform() == GameListItem::WII_WAD) { -#ifdef _WIN32 - wxCSConv SJISConv(wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)); -#else - wxCSConv SJISConv(wxFontMapper::GetEncodingName(wxFONTENCODING_EUC_JP)); -#endif - wxString name = wxString(OpenGameListItem->GetName(0).c_str(), SJISConv); + static wxCSConv * SJISConv = WxUtils::SJISConv(); + + wxString name = wxString(OpenGameListItem->GetName(0).c_str(), *SJISConv); // Updates the informations shown in the window m_ShortName->SetValue(name); - m_Comment->SetValue(wxString(OpenGameListItem->GetDescription(0).c_str(), SJISConv)); - m_Maker->SetValue(wxString(OpenGameListItem->GetCompany().c_str(), SJISConv));//dev too + m_Comment->SetValue(wxString(OpenGameListItem->GetDescription(0).c_str(), *SJISConv)); + m_Maker->SetValue(wxString(OpenGameListItem->GetCompany().c_str(), *SJISConv));//dev too std::string filename, extension; SplitPath(OpenGameListItem->GetFileName(), 0, &filename, &extension); diff --git a/Source/Core/DolphinWX/Src/LogWindow.cpp b/Source/Core/DolphinWX/Src/LogWindow.cpp index cc8651424a..85a8b090cc 100644 --- a/Source/Core/DolphinWX/Src/LogWindow.cpp +++ b/Source/Core/DolphinWX/Src/LogWindow.cpp @@ -22,6 +22,7 @@ #include "FileUtil.h" #include "DebuggerUIUtil.h" #include +#include "WxUtils.h" // Milliseconds between msgQueue flushes to wxTextCtrl #define UPDATETIME 200 @@ -50,11 +51,7 @@ CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos, , m_Log(NULL), m_cmdline(NULL), m_FontChoice(NULL) , m_LogSection(1) { -#ifdef _WIN32 - m_SJISConv = new wxCSConv(wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)); -#else - m_SJISConv = new wxCSConv(wxFontMapper::GetEncodingName(wxFONTENCODING_EUC_JP)); -#endif + m_SJISConv = WxUtils::SJISConv(); m_LogManager = LogManager::GetInstance(); for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) diff --git a/Source/Core/DolphinWX/Src/WxUtils.cpp b/Source/Core/DolphinWX/Src/WxUtils.cpp index 04e0d1453b..423d3d0865 100644 --- a/Source/Core/DolphinWX/Src/WxUtils.cpp +++ b/Source/Core/DolphinWX/Src/WxUtils.cpp @@ -19,9 +19,26 @@ #include #include +#include namespace WxUtils { + wxCSConv *SJISConv() +{ +#ifdef _WIN32 + + static bool validCP932 = ::IsValidCodePage(932) != 0; + if (validCP932) + { + return new wxCSConv(wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)); + } + WARN_LOG(COMMON, "Cannot Convert from Charset Windows Japanese cp 932"); + return (wxCSConv*)wxConvCurrent; +#else + return new wxCSConv(wxFontMapper::GetEncodingName(wxFONTENCODING_EUC_JP)); +#endif +} + // Launch a file according to its mime type void Launch(const char *filename) { diff --git a/Source/Core/DolphinWX/Src/WxUtils.h b/Source/Core/DolphinWX/Src/WxUtils.h index 8e837e9e96..3bb9d3539f 100644 --- a/Source/Core/DolphinWX/Src/WxUtils.h +++ b/Source/Core/DolphinWX/Src/WxUtils.h @@ -20,6 +20,8 @@ namespace WxUtils { +wxCSConv * SJISConv(); + // Launch a file according to its mime type void Launch(const char *filename);