fix crash on windows while changing exi/si devices when interface language is Japanese or Chinese

This commit is contained in:
LPFaint99 2012-03-22 14:52:20 -07:00
parent d95e31af3f
commit 9c9e593479
2 changed files with 17 additions and 17 deletions

View File

@ -90,7 +90,7 @@ static const wxLanguage langIds[] =
#define EXIDEV_GECKO_STR "USBGecko" #define EXIDEV_GECKO_STR "USBGecko"
#define CSTR_TRANS(a) wxString(wxGetTranslation(wxT(a))).mb_str() #define CSTR_TRANS(a) wxString(wxGetTranslation(wxT(a))).mb_str()
#define WXSTR_TRANS(a) wxString(wxGetTranslation(wxT(a)))
#ifdef WIN32 #ifdef WIN32
//only used with xgettext to be picked up as translatable string. //only used with xgettext to be picked up as translatable string.
//win32 does not have wx on its path, the provided wxALL_FILES //win32 does not have wx on its path, the provided wxALL_FILES
@ -979,7 +979,7 @@ void CConfigMain::GCSettingsChanged(wxCommandEvent& event)
case ID_GC_EXIDEVICE_SLOTB: case ID_GC_EXIDEVICE_SLOTB:
exidevice++; exidevice++;
case ID_GC_EXIDEVICE_SLOTA: case ID_GC_EXIDEVICE_SLOTA:
ChooseEXIDevice(std::string(event.GetString().mb_str()), exidevice); ChooseEXIDevice(event.GetString(), exidevice);
break; break;
case ID_GC_EXIDEVICE_SLOTA_PATH: case ID_GC_EXIDEVICE_SLOTA_PATH:
ChooseMemcardPath(SConfig::GetInstance().m_strMemoryCardA, true); ChooseMemcardPath(SConfig::GetInstance().m_strMemoryCardA, true);
@ -994,7 +994,7 @@ void CConfigMain::GCSettingsChanged(wxCommandEvent& event)
case ID_GC_SIDEVICE1: case ID_GC_SIDEVICE1:
sidevice++; sidevice++;
case ID_GC_SIDEVICE0: case ID_GC_SIDEVICE0:
ChooseSIDevice(std::string(event.GetString().mb_str()), sidevice); ChooseSIDevice(event.GetString(), sidevice);
break; break;
} }
} }
@ -1044,16 +1044,16 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
} }
} }
void CConfigMain::ChooseSIDevice(std::string deviceName, int deviceNum) void CConfigMain::ChooseSIDevice(wxString deviceName, int deviceNum)
{ {
SIDevices tempType; SIDevices tempType;
if (!deviceName.compare(CSTR_TRANS(SIDEV_STDCONT_STR))) if (!deviceName.compare(WXSTR_TRANS(SIDEV_STDCONT_STR)))
tempType = SIDEVICE_GC_CONTROLLER; tempType = SIDEVICE_GC_CONTROLLER;
else if (!deviceName.compare(CSTR_TRANS(SIDEV_BONGO_STR))) else if (!deviceName.compare(WXSTR_TRANS(SIDEV_BONGO_STR)))
tempType = SIDEVICE_GC_TARUKONGA; tempType = SIDEVICE_GC_TARUKONGA;
else if (!deviceName.compare(SIDEV_GBA_STR)) else if (!deviceName.compare(wxT(SIDEV_GBA_STR)))
tempType = SIDEVICE_GC_GBA; tempType = SIDEVICE_GC_GBA;
else if (!deviceName.compare(CSTR_TRANS(SIDEV_AM_BB_STR))) else if (!deviceName.compare(WXSTR_TRANS(SIDEV_AM_BB_STR)))
tempType = SIDEVICE_AM_BASEBOARD; tempType = SIDEVICE_AM_BASEBOARD;
else else
tempType = SIDEVICE_NONE; tempType = SIDEVICE_NONE;
@ -1067,21 +1067,21 @@ void CConfigMain::ChooseSIDevice(std::string deviceName, int deviceNum)
} }
} }
void CConfigMain::ChooseEXIDevice(std::string deviceName, int deviceNum) void CConfigMain::ChooseEXIDevice(wxString deviceName, int deviceNum)
{ {
TEXIDevices tempType; TEXIDevices tempType;
if (!deviceName.compare(CSTR_TRANS(EXIDEV_MEMCARD_STR))) if (!deviceName.compare(WXSTR_TRANS(EXIDEV_MEMCARD_STR)))
tempType = EXIDEVICE_MEMORYCARD; tempType = EXIDEVICE_MEMORYCARD;
else if (!deviceName.compare(CSTR_TRANS(EXIDEV_MIC_STR))) else if (!deviceName.compare(WXSTR_TRANS(EXIDEV_MIC_STR)))
tempType = EXIDEVICE_MIC; tempType = EXIDEVICE_MIC;
else if (!deviceName.compare(EXIDEV_BBA_STR)) else if (!deviceName.compare(wxT(EXIDEV_BBA_STR)))
tempType = EXIDEVICE_ETH; tempType = EXIDEVICE_ETH;
else if (!deviceName.compare(CSTR_TRANS(EXIDEV_AM_BB_STR))) else if (!deviceName.compare(WXSTR_TRANS(EXIDEV_AM_BB_STR)))
tempType = EXIDEVICE_AM_BASEBOARD; tempType = EXIDEVICE_AM_BASEBOARD;
else if (!deviceName.compare(EXIDEV_GECKO_STR)) else if (!deviceName.compare(wxT(EXIDEV_GECKO_STR)))
tempType = EXIDEVICE_GECKO; tempType = EXIDEVICE_GECKO;
else if (!deviceName.compare(CSTR_TRANS(DEV_NONE_STR))) else if (!deviceName.compare(WXSTR_TRANS(DEV_NONE_STR)))
tempType = EXIDEVICE_NONE; tempType = EXIDEVICE_NONE;
else else
tempType = EXIDEVICE_DUMMY; tempType = EXIDEVICE_DUMMY;

View File

@ -253,8 +253,8 @@ private:
void GCSettingsChanged(wxCommandEvent& event); void GCSettingsChanged(wxCommandEvent& event);
void ChooseMemcardPath(std::string& strMemcard, bool isSlotA); void ChooseMemcardPath(std::string& strMemcard, bool isSlotA);
void ChooseSIDevice(std::string deviceName, int deviceNum); void ChooseSIDevice(wxString deviceName, int deviceNum);
void ChooseEXIDevice(std::string deviceName, int deviceNum); void ChooseEXIDevice(wxString deviceName, int deviceNum);
void WiiSettingsChanged(wxCommandEvent& event); void WiiSettingsChanged(wxCommandEvent& event);
// Change from IPL.LNG value to country code // Change from IPL.LNG value to country code