Actually fix issue 3659.

check for cp932 using ::IsValidCodePage before creating the wxCSConv
if it is possible for linux distro or mac to remove the euc_jap cp from install a similar check may be added in WxUtils.cpp

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6928 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2011-01-27 01:05:24 +00:00
parent cbc520a70a
commit 826e37a279
6 changed files with 33 additions and 26 deletions

View File

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

View File

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

View File

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

View File

@ -22,6 +22,7 @@
#include "FileUtil.h"
#include "DebuggerUIUtil.h"
#include <wx/fontmap.h>
#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)

View File

@ -19,9 +19,26 @@
#include <wx/wx.h>
#include <wx/string.h>
#include <wx/fontmap.h>
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)
{

View File

@ -20,6 +20,8 @@
namespace WxUtils {
wxCSConv * SJISConv();
// Launch a file according to its mime type
void Launch(const char *filename);