Attempt to be consistent with conversions between std::string and wxString.

This commit is contained in:
Jordan Woyak 2013-02-27 22:37:38 -06:00
parent e82d976d2f
commit 56f09d3b91
39 changed files with 344 additions and 300 deletions

View File

@ -17,6 +17,7 @@
#include "ARCodeAddEdit.h" #include "ARCodeAddEdit.h"
#include "ARDecrypt.h" #include "ARDecrypt.h"
#include "WxUtils.h"
extern std::vector<ActionReplay::ARCode> arCodes; extern std::vector<ActionReplay::ARCode> arCodes;
@ -38,7 +39,7 @@ CARCodeAddEdit::CARCodeAddEdit(int _selection, wxWindow* parent, wxWindowID id,
} }
else else
{ {
currentName = wxString(arCodes.at(selection).name.c_str(), *wxConvCurrent); currentName = StrToWxStr(arCodes.at(selection).name);
tempEntries = arCodes.at(selection); tempEntries = arCodes.at(selection);
} }
@ -73,7 +74,7 @@ CARCodeAddEdit::CARCodeAddEdit(int _selection, wxWindow* parent, wxWindowID id,
void CARCodeAddEdit::ChangeEntry(wxSpinEvent& event) void CARCodeAddEdit::ChangeEntry(wxSpinEvent& event)
{ {
ActionReplay::ARCode currentCode = arCodes.at((int)arCodes.size() - event.GetPosition()); ActionReplay::ARCode currentCode = arCodes.at((int)arCodes.size() - event.GetPosition());
EditCheatName->SetValue(wxString(currentCode.name.c_str(), *wxConvCurrent)); EditCheatName->SetValue(StrToWxStr(currentCode.name));
UpdateTextCtrl(currentCode); UpdateTextCtrl(currentCode);
} }
@ -84,7 +85,7 @@ void CARCodeAddEdit::SaveCheatData(wxCommandEvent& WXUNUSED (event))
// Split the entered cheat into lines. // Split the entered cheat into lines.
std::vector<std::string> userInputLines; std::vector<std::string> userInputLines;
SplitString(std::string(EditCheatCode->GetValue().mb_str()), '\n', userInputLines); SplitString(WxStrToStr(EditCheatCode->GetValue()), '\n', userInputLines);
for (size_t i = 0; i < userInputLines.size(); i++) for (size_t i = 0; i < userInputLines.size(); i++)
{ {
@ -148,7 +149,7 @@ void CARCodeAddEdit::SaveCheatData(wxCommandEvent& WXUNUSED (event))
// Add a new AR cheat code. // Add a new AR cheat code.
ActionReplay::ARCode newCheat; ActionReplay::ARCode newCheat;
newCheat.name = std::string(EditCheatName->GetValue().mb_str()); newCheat.name = WxStrToStr(EditCheatName->GetValue());
newCheat.ops = decryptedLines; newCheat.ops = decryptedLines;
newCheat.active = true; newCheat.active = true;
@ -157,7 +158,7 @@ void CARCodeAddEdit::SaveCheatData(wxCommandEvent& WXUNUSED (event))
else else
{ {
// Update the currently-selected AR cheat code. // Update the currently-selected AR cheat code.
arCodes.at(selection).name = std::string(EditCheatName->GetValue().mb_str()); arCodes.at(selection).name = WxStrToStr(EditCheatName->GetValue());
arCodes.at(selection).ops = decryptedLines; arCodes.at(selection).ops = decryptedLines;
} }

View File

@ -17,6 +17,7 @@
#include "Common.h" #include "Common.h"
#include "AboutDolphin.h" #include "AboutDolphin.h"
#include "WxUtils.h"
#include "../resources/dolphin_logo.cpp" #include "../resources/dolphin_logo.cpp"
#include "scmrev.h" #include "scmrev.h"
@ -62,7 +63,7 @@ AboutDolphin::AboutDolphin(wxWindow *parent, wxWindowID id,
"and should not be used to play games you do\n" "and should not be used to play games you do\n"
"not legally own."; "not legally own.";
wxStaticText* const Message = new wxStaticText(this, wxID_ANY, wxStaticText* const Message = new wxStaticText(this, wxID_ANY,
wxString::FromAscii(Text.c_str())); StrToWxStr(Text.c_str()));
Message->Wrap(GetSize().GetWidth()); Message->Wrap(GetSize().GetWidth());
wxBoxSizer* const sInfo = new wxBoxSizer(wxVERTICAL); wxBoxSizer* const sInfo = new wxBoxSizer(wxVERTICAL);

View File

@ -24,6 +24,7 @@
#include "ISOProperties.h" #include "ISOProperties.h"
#include "HW/Memmap.h" #include "HW/Memmap.h"
#include "Frame.h" #include "Frame.h"
#include "WxUtils.h"
#define MAX_CHEAT_SEARCH_RESULTS_DISPLAY 256 #define MAX_CHEAT_SEARCH_RESULTS_DISPLAY 256
@ -273,7 +274,7 @@ void wxCheatsWindow::Load_ARCodes()
{ {
ARCode code = GetARCode(i); ARCode code = GetARCode(i);
ARCodeIndex ind; ARCodeIndex ind;
u32 index = m_CheckListBox_CheatsList->Append(wxString(code.name.c_str(), *wxConvCurrent)); u32 index = m_CheckListBox_CheatsList->Append(StrToWxStr(code.name));
m_CheckListBox_CheatsList->Check(index, code.active); m_CheckListBox_CheatsList->Check(index, code.active);
ind.index = i; ind.index = i;
ind.uiIndex = index; ind.uiIndex = index;
@ -291,18 +292,18 @@ void wxCheatsWindow::OnEvent_CheatsList_ItemSelected(wxCommandEvent& WXUNUSED (e
if ((int)indexList[i].uiIndex == index) if ((int)indexList[i].uiIndex == index)
{ {
ARCode code = GetARCode(i); ARCode code = GetARCode(i);
m_Label_Codename->SetLabel(_("Name: ") + wxString(code.name.c_str(), *wxConvCurrent)); m_Label_Codename->SetLabel(_("Name: ") + StrToWxStr(code.name));
char text[CHAR_MAX]; char text[CHAR_MAX];
char* numcodes = text; char* numcodes = text;
sprintf(numcodes, "Number of Codes: %lu", (unsigned long)code.ops.size()); sprintf(numcodes, "Number of Codes: %lu", (unsigned long)code.ops.size());
m_Label_NumCodes->SetLabel(wxString::FromAscii(numcodes)); m_Label_NumCodes->SetLabel(StrToWxStr(numcodes));
m_ListBox_CodesList->Clear(); m_ListBox_CodesList->Clear();
for (size_t j = 0; j < code.ops.size(); j++) for (size_t j = 0; j < code.ops.size(); j++)
{ {
char text2[CHAR_MAX]; char text2[CHAR_MAX];
char* ops = text2; char* ops = text2;
sprintf(ops, "%08x %08x", code.ops[j].cmd_addr, code.ops[j].value); sprintf(ops, "%08x %08x", code.ops[j].cmd_addr, code.ops[j].value);
m_ListBox_CodesList->Append(wxString::FromAscii(ops)); m_ListBox_CodesList->Append(StrToWxStr(ops));
} }
} }
} }
@ -347,7 +348,7 @@ void wxCheatsWindow::OnEvent_ButtonUpdateLog_Press(wxCommandEvent& WXUNUSED (eve
const std::vector<std::string> &arLog = ActionReplay::GetSelfLog(); const std::vector<std::string> &arLog = ActionReplay::GetSelfLog();
for (u32 i = 0; i < arLog.size(); i++) for (u32 i = 0; i < arLog.size(); i++)
{ {
m_TextCtrl_Log->AppendText(wxString::FromAscii(arLog[i].c_str())); m_TextCtrl_Log->AppendText(StrToWxStr(arLog[i].c_str()));
} }
} }
@ -619,7 +620,7 @@ void CreateCodeDialog::PressOK(wxCommandEvent& ev)
// create the new code // create the new code
ActionReplay::ARCode new_cheat; ActionReplay::ARCode new_cheat;
new_cheat.active = false; new_cheat.active = false;
new_cheat.name = std::string(code_name.ToAscii()); new_cheat.name = WxStrToStr(code_name);
const ActionReplay::AREntry new_entry(code_address, code_value); const ActionReplay::AREntry new_entry(code_address, code_value);
new_cheat.ops.push_back(new_entry); new_cheat.ops.push_back(new_entry);

View File

@ -33,6 +33,7 @@
#include "IPC_HLE/WII_IPC_HLE.h" #include "IPC_HLE/WII_IPC_HLE.h"
#include "NANDContentLoader.h" #include "NANDContentLoader.h"
#include "WxUtils.h"
#include "Globals.h" // Local #include "Globals.h" // Local
#include "ConfigMain.h" #include "ConfigMain.h"
#include "ConfigManager.h" #include "ConfigManager.h"
@ -100,7 +101,6 @@ static const wxLanguage langIds[] =
#define EXIDEV_AM_BB_STR _trans("AM-Baseboard") #define EXIDEV_AM_BB_STR _trans("AM-Baseboard")
#define EXIDEV_GECKO_STR "USBGecko" #define EXIDEV_GECKO_STR "USBGecko"
#define CSTR_TRANS(a) wxString(wxGetTranslation(wxT(a))).mb_str()
#define WXSTR_TRANS(a) wxString(wxGetTranslation(wxT(a))) #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.
@ -188,7 +188,7 @@ CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title,
// Update selected ISO paths // Update selected ISO paths
for(u32 i = 0; i < SConfig::GetInstance().m_ISOFolder.size(); i++) for(u32 i = 0; i < SConfig::GetInstance().m_ISOFolder.size(); i++)
{ {
ISOPaths->Append(wxString(SConfig::GetInstance().m_ISOFolder[i].c_str(), *wxConvCurrent)); ISOPaths->Append(StrToWxStr(SConfig::GetInstance().m_ISOFolder[i]));
} }
} }
@ -477,10 +477,10 @@ void CConfigMain::InitializeGUIValues()
// Paths // Paths
RecursiveISOPath->SetValue(SConfig::GetInstance().m_RecursiveISOFolder); RecursiveISOPath->SetValue(SConfig::GetInstance().m_RecursiveISOFolder);
DefaultISO->SetPath(wxString(startup_params.m_strDefaultGCM.c_str(), *wxConvCurrent)); DefaultISO->SetPath(StrToWxStr(startup_params.m_strDefaultGCM));
DVDRoot->SetPath(wxString(startup_params.m_strDVDRoot.c_str(), *wxConvCurrent)); DVDRoot->SetPath(StrToWxStr(startup_params.m_strDVDRoot));
ApploaderPath->SetPath(wxString(startup_params.m_strApploader.c_str(), *wxConvCurrent)); ApploaderPath->SetPath(StrToWxStr(startup_params.m_strApploader));
NANDRoot->SetPath(wxString(SConfig::GetInstance().m_NANDPath.c_str(), *wxConvCurrent)); NANDRoot->SetPath(StrToWxStr(SConfig::GetInstance().m_NANDPath));
} }
void CConfigMain::InitializeGUITooltips() void CConfigMain::InitializeGUITooltips()
@ -958,10 +958,10 @@ void CConfigMain::AudioSettingsChanged(wxCommandEvent& event)
break; break;
case ID_BACKEND: case ID_BACKEND:
VolumeSlider->Enable(SupportsVolumeChanges(std::string(BackendSelection->GetStringSelection().mb_str()))); VolumeSlider->Enable(SupportsVolumeChanges(WxStrToStr(BackendSelection->GetStringSelection())));
Latency->Enable(std::string(BackendSelection->GetStringSelection().mb_str()) == BACKEND_OPENAL); Latency->Enable(WxStrToStr(BackendSelection->GetStringSelection()) == BACKEND_OPENAL);
DPL2Decoder->Enable(std::string(BackendSelection->GetStringSelection().mb_str()) == BACKEND_OPENAL); DPL2Decoder->Enable(WxStrToStr(BackendSelection->GetStringSelection()) == BACKEND_OPENAL);
SConfig::GetInstance().sBackend = BackendSelection->GetStringSelection().mb_str(); SConfig::GetInstance().sBackend = WxStrToStr(BackendSelection->GetStringSelection());
AudioCommon::UpdateSoundStream(); AudioCommon::UpdateSoundStream();
break; break;
@ -982,9 +982,9 @@ void CConfigMain::AddAudioBackends()
for (std::vector<std::string>::const_iterator iter = backends.begin(); for (std::vector<std::string>::const_iterator iter = backends.begin();
iter != backends.end(); ++iter) iter != backends.end(); ++iter)
{ {
BackendSelection->Append(wxString::FromAscii((*iter).c_str())); BackendSelection->Append(StrToWxStr((*iter).c_str()));
int num = BackendSelection->\ int num = BackendSelection->\
FindString(wxString::FromAscii(SConfig::GetInstance().sBackend.c_str())); FindString(StrToWxStr(SConfig::GetInstance().sBackend.c_str()));
BackendSelection->SetSelection(num); BackendSelection->SetSelection(num);
} }
} }
@ -1046,12 +1046,12 @@ void CConfigMain::GCSettingsChanged(wxCommandEvent& event)
void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA) void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
{ {
std::string filename = std::string(wxFileSelector( std::string filename = WxStrToStr(wxFileSelector(
_("Choose a file to open"), _("Choose a file to open"),
wxString::FromUTF8(File::GetUserPath(D_GCUSER_IDX).c_str()), StrToWxStr(File::GetUserPath(D_GCUSER_IDX)),
isSlotA ? wxT(GC_MEMCARDA) : wxT(GC_MEMCARDB), isSlotA ? wxT(GC_MEMCARDA) : wxT(GC_MEMCARDB),
wxEmptyString, wxEmptyString,
_("Gamecube Memory Cards (*.raw,*.gcp)") + wxString(wxT("|*.raw;*.gcp"))).mb_str()); _("Gamecube Memory Cards (*.raw,*.gcp)") + wxString(wxT("|*.raw;*.gcp"))));
if (!filename.empty()) if (!filename.empty())
{ {
@ -1242,7 +1242,7 @@ void CConfigMain::AddRemoveISOPaths(wxCommandEvent& event)
SConfig::GetInstance().m_ISOFolder.clear(); SConfig::GetInstance().m_ISOFolder.clear();
for (unsigned int i = 0; i < ISOPaths->GetCount(); i++) for (unsigned int i = 0; i < ISOPaths->GetCount(); i++)
SConfig::GetInstance().m_ISOFolder.push_back(std::string(ISOPaths->GetStrings()[i].mb_str())); SConfig::GetInstance().m_ISOFolder.push_back(WxStrToStr(ISOPaths->GetStrings()[i]));
} }
void CConfigMain::RecursiveDirectoryChanged(wxCommandEvent& WXUNUSED (event)) void CConfigMain::RecursiveDirectoryChanged(wxCommandEvent& WXUNUSED (event))
@ -1253,24 +1253,24 @@ void CConfigMain::RecursiveDirectoryChanged(wxCommandEvent& WXUNUSED (event))
void CConfigMain::DefaultISOChanged(wxFileDirPickerEvent& WXUNUSED (event)) void CConfigMain::DefaultISOChanged(wxFileDirPickerEvent& WXUNUSED (event))
{ {
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = DefaultISO->GetPath().mb_str(); SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = WxStrToStr(DefaultISO->GetPath());
} }
void CConfigMain::DVDRootChanged(wxFileDirPickerEvent& WXUNUSED (event)) void CConfigMain::DVDRootChanged(wxFileDirPickerEvent& WXUNUSED (event))
{ {
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot = DVDRoot->GetPath().mb_str(); SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot = WxStrToStr(DVDRoot->GetPath());
} }
void CConfigMain::ApploaderPathChanged(wxFileDirPickerEvent& WXUNUSED (event)) void CConfigMain::ApploaderPathChanged(wxFileDirPickerEvent& WXUNUSED (event))
{ {
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strApploader = ApploaderPath->GetPath().mb_str(); SConfig::GetInstance().m_LocalCoreStartupParameter.m_strApploader = WxStrToStr(ApploaderPath->GetPath());
} }
void CConfigMain::NANDRootChanged(wxFileDirPickerEvent& WXUNUSED (event)) void CConfigMain::NANDRootChanged(wxFileDirPickerEvent& WXUNUSED (event))
{ {
std::string NANDPath = std::string NANDPath =
SConfig::GetInstance().m_NANDPath = File::GetUserPath(D_WIIROOT_IDX, std::string(NANDRoot->GetPath().mb_str())); SConfig::GetInstance().m_NANDPath = File::GetUserPath(D_WIIROOT_IDX, WxStrToStr(NANDRoot->GetPath()));
NANDRoot->SetPath(wxString(NANDPath.c_str(), *wxConvCurrent)); NANDRoot->SetPath(wxString(NANDPath));
SConfig::GetInstance().m_SYSCONF->UpdateLocation(); SConfig::GetInstance().m_SYSCONF->UpdateLocation();
DiscIO::cUIDsys::AccessInstance().UpdateLocation(); DiscIO::cUIDsys::AccessInstance().UpdateLocation();
DiscIO::CSharedContent::AccessInstance().UpdateLocation(); DiscIO::CSharedContent::AccessInstance().UpdateLocation();

View File

@ -19,6 +19,7 @@
#include "StringUtil.h" #include "StringUtil.h"
#include "PowerPC/PowerPC.h" #include "PowerPC/PowerPC.h"
#include "BreakpointWindow.h" #include "BreakpointWindow.h"
#include "../WxUtils.h"
BEGIN_EVENT_TABLE(BreakPointDlg, wxDialog) BEGIN_EVENT_TABLE(BreakPointDlg, wxDialog)
EVT_BUTTON(wxID_OK, BreakPointDlg::OnOK) EVT_BUTTON(wxID_OK, BreakPointDlg::OnOK)
@ -42,14 +43,14 @@ void BreakPointDlg::OnOK(wxCommandEvent& event)
{ {
wxString AddressString = m_pEditAddress->GetLineText(0); wxString AddressString = m_pEditAddress->GetLineText(0);
u32 Address = 0; u32 Address = 0;
if (AsciiToHex(AddressString.mb_str(), Address)) if (AsciiToHex(WxStrToStr(AddressString).c_str(), Address))
{ {
PowerPC::breakpoints.Add(Address); PowerPC::breakpoints.Add(Address);
Parent->NotifyUpdate(); Parent->NotifyUpdate();
Close(); Close();
} }
else else
PanicAlert("The address %s is invalid.", (const char *)AddressString.ToUTF8()); PanicAlert("The address %s is invalid.", WxStrToStr(AddressString).c_str());
event.Skip(); event.Skip();
} }

View File

@ -23,6 +23,7 @@
#include "PowerPC/PPCSymbolDB.h" #include "PowerPC/PPCSymbolDB.h"
#include "PowerPC/PowerPC.h" #include "PowerPC/PowerPC.h"
#include "HW/Memmap.h" #include "HW/Memmap.h"
#include "../WxUtils.h"
CBreakPointView::CBreakPointView(wxWindow* parent, const wxWindowID id) CBreakPointView::CBreakPointView(wxWindow* parent, const wxWindowID id)
: wxListCtrl(parent, id, wxDefaultPosition, wxDefaultSize, : wxListCtrl(parent, id, wxDefaultPosition, wxDefaultSize,
@ -50,20 +51,20 @@ void CBreakPointView::Update()
if (!rBP.bTemporary) if (!rBP.bTemporary)
{ {
wxString temp; wxString temp;
temp = wxString::FromAscii(rBP.bOn ? "on" : " "); temp = StrToWxStr(rBP.bOn ? "on" : " ");
int Item = InsertItem(0, temp); int Item = InsertItem(0, temp);
temp = wxString::FromAscii("BP"); temp = StrToWxStr("BP");
SetItem(Item, 1, temp); SetItem(Item, 1, temp);
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rBP.iAddress); Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rBP.iAddress);
if (symbol) if (symbol)
{ {
temp = wxString::FromAscii(g_symbolDB.GetDescription(rBP.iAddress)); temp = StrToWxStr(g_symbolDB.GetDescription(rBP.iAddress));
SetItem(Item, 2, temp); SetItem(Item, 2, temp);
} }
sprintf(szBuffer, "%08x", rBP.iAddress); sprintf(szBuffer, "%08x", rBP.iAddress);
temp = wxString::FromAscii(szBuffer); temp = StrToWxStr(szBuffer);
SetItem(Item, 3, temp); SetItem(Item, 3, temp);
SetItemData(Item, rBP.iAddress); SetItemData(Item, rBP.iAddress);
@ -76,27 +77,27 @@ void CBreakPointView::Update()
const TMemCheck& rMemCheck = rMemChecks[i]; const TMemCheck& rMemCheck = rMemChecks[i];
wxString temp; wxString temp;
temp = wxString::FromAscii((rMemCheck.Break || rMemCheck.Log) ? "on" : " "); temp = StrToWxStr((rMemCheck.Break || rMemCheck.Log) ? "on" : " ");
int Item = InsertItem(0, temp); int Item = InsertItem(0, temp);
temp = wxString::FromAscii("MC"); temp = StrToWxStr("MC");
SetItem(Item, 1, temp); SetItem(Item, 1, temp);
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rMemCheck.StartAddress); Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rMemCheck.StartAddress);
if (symbol) if (symbol)
{ {
temp = wxString::FromAscii(g_symbolDB.GetDescription(rMemCheck.StartAddress)); temp = StrToWxStr(g_symbolDB.GetDescription(rMemCheck.StartAddress));
SetItem(Item, 2, temp); SetItem(Item, 2, temp);
} }
sprintf(szBuffer, "%08x to %08x", rMemCheck.StartAddress, rMemCheck.EndAddress); sprintf(szBuffer, "%08x to %08x", rMemCheck.StartAddress, rMemCheck.EndAddress);
temp = wxString::FromAscii(szBuffer); temp = StrToWxStr(szBuffer);
SetItem(Item, 3, temp); SetItem(Item, 3, temp);
size_t c = 0; size_t c = 0;
if (rMemCheck.OnRead) szBuffer[c++] = 'r'; if (rMemCheck.OnRead) szBuffer[c++] = 'r';
if (rMemCheck.OnWrite) szBuffer[c++] = 'w'; if (rMemCheck.OnWrite) szBuffer[c++] = 'w';
szBuffer[c] = 0x00; szBuffer[c] = 0x00;
temp = wxString::FromAscii(szBuffer); temp = StrToWxStr(szBuffer);
SetItem(Item, 4, temp); SetItem(Item, 4, temp);
SetItemData(Item, rMemCheck.StartAddress); SetItemData(Item, rMemCheck.StartAddress);

View File

@ -23,6 +23,7 @@
#include "Host.h" #include "Host.h"
#include "CodeView.h" #include "CodeView.h"
#include "SymbolDB.h" #include "SymbolDB.h"
#include "../WxUtils.h"
#include <wx/event.h> #include <wx/event.h>
#include <wx/clipbrd.h> #include <wx/clipbrd.h>
@ -223,7 +224,7 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
{ {
char disasm[256]; char disasm[256];
debugger->disasm(selection, disasm, 256); debugger->disasm(selection, disasm, 256);
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(disasm))); wxTheClipboard->SetData(new wxTextDataObject(StrToWxStr(disasm)));
} }
break; break;
@ -231,7 +232,7 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
{ {
char temp[24]; char temp[24];
sprintf(temp, "%08x", debugger->readInstruction(selection)); sprintf(temp, "%08x", debugger->readInstruction(selection));
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(temp))); wxTheClipboard->SetData(new wxTextDataObject(StrToWxStr(temp)));
} }
break; break;
@ -252,7 +253,7 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
debugger->disasm(addr, disasm, 256); debugger->disasm(addr, disasm, 256);
text = text + StringFromFormat("%08x: ", addr) + disasm + "\r\n"; text = text + StringFromFormat("%08x: ", addr) + disasm + "\r\n";
} }
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(text.c_str()))); wxTheClipboard->SetData(new wxTextDataObject(StrToWxStr(text.c_str())));
} }
} }
break; break;
@ -297,12 +298,12 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
Symbol *symbol = symbol_db->GetSymbolFromAddr(selection); Symbol *symbol = symbol_db->GetSymbolFromAddr(selection);
if (symbol) if (symbol)
{ {
wxTextEntryDialog input_symbol(this, wxString::FromAscii("Rename symbol:"), wxTextEntryDialog input_symbol(this, StrToWxStr("Rename symbol:"),
wxGetTextFromUserPromptStr, wxGetTextFromUserPromptStr,
wxString::FromAscii(symbol->name.c_str())); StrToWxStr(symbol->name.c_str()));
if (input_symbol.ShowModal() == wxID_OK) if (input_symbol.ShowModal() == wxID_OK)
{ {
symbol->name = input_symbol.GetValue().mb_str(); symbol->name = WxStrToStr(input_symbol.GetValue());
Refresh(); // Redraw to show the renamed symbol Refresh(); // Redraw to show the renamed symbol
} }
Host_NotifyMapLoaded(); Host_NotifyMapLoaded();
@ -327,23 +328,23 @@ void CCodeView::OnMouseUpR(wxMouseEvent& event)
wxMenu* menu = new wxMenu; wxMenu* menu = new wxMenu;
//menu->Append(IDM_GOTOINMEMVIEW, "&Goto in mem view"); //menu->Append(IDM_GOTOINMEMVIEW, "&Goto in mem view");
menu->Append(IDM_FOLLOWBRANCH, menu->Append(IDM_FOLLOWBRANCH,
wxString::FromAscii("&Follow branch"))->Enable(AddrToBranch(selection) ? true : false); StrToWxStr("&Follow branch"))->Enable(AddrToBranch(selection) ? true : false);
menu->AppendSeparator(); menu->AppendSeparator();
#if wxUSE_CLIPBOARD #if wxUSE_CLIPBOARD
menu->Append(IDM_COPYADDRESS, wxString::FromAscii("Copy &address")); menu->Append(IDM_COPYADDRESS, StrToWxStr("Copy &address"));
menu->Append(IDM_COPYFUNCTION, wxString::FromAscii("Copy &function"))->Enable(isSymbol); menu->Append(IDM_COPYFUNCTION, StrToWxStr("Copy &function"))->Enable(isSymbol);
menu->Append(IDM_COPYCODE, wxString::FromAscii("Copy &code line")); menu->Append(IDM_COPYCODE, StrToWxStr("Copy &code line"));
menu->Append(IDM_COPYHEX, wxString::FromAscii("Copy &hex")); menu->Append(IDM_COPYHEX, StrToWxStr("Copy &hex"));
menu->AppendSeparator(); menu->AppendSeparator();
#endif #endif
menu->Append(IDM_RENAMESYMBOL, wxString::FromAscii("Rename &symbol"))->Enable(isSymbol); menu->Append(IDM_RENAMESYMBOL, StrToWxStr("Rename &symbol"))->Enable(isSymbol);
menu->AppendSeparator(); menu->AppendSeparator();
menu->Append(IDM_RUNTOHERE, _("&Run To Here")); menu->Append(IDM_RUNTOHERE, _("&Run To Here"));
menu->Append(IDM_ADDFUNCTION, _("&Add function")); menu->Append(IDM_ADDFUNCTION, _("&Add function"));
menu->Append(IDM_JITRESULTS, wxString::FromAscii("PPC vs X86")); menu->Append(IDM_JITRESULTS, StrToWxStr("PPC vs X86"));
menu->Append(IDM_INSERTBLR, wxString::FromAscii("Insert &blr")); menu->Append(IDM_INSERTBLR, StrToWxStr("Insert &blr"));
menu->Append(IDM_INSERTNOP, wxString::FromAscii("Insert &nop")); menu->Append(IDM_INSERTNOP, StrToWxStr("Insert &nop"));
menu->Append(IDM_PATCHALERT, wxString::FromAscii("Patch alert")); menu->Append(IDM_PATCHALERT, StrToWxStr("Patch alert"));
PopupMenu(menu); PopupMenu(menu);
event.Skip(true); event.Skip(true);
} }
@ -489,7 +490,7 @@ void CCodeView::OnPaint(wxPaintEvent& event)
dc.SetTextForeground(_T("#000000")); dc.SetTextForeground(_T("#000000"));
} }
dc.DrawText(wxString::FromAscii(dis2), 17 + 17*charWidth, rowY1); dc.DrawText(StrToWxStr(dis2), 17 + 17*charWidth, rowY1);
// ------------ // ------------
} }
@ -499,7 +500,7 @@ void CCodeView::OnPaint(wxPaintEvent& event)
else else
dc.SetTextForeground(_T("#8000FF")); // purple dc.SetTextForeground(_T("#8000FF")); // purple
dc.DrawText(wxString::FromAscii(dis), 17 + (plain ? 1*charWidth : 9*charWidth), rowY1); dc.DrawText(StrToWxStr(dis), 17 + (plain ? 1*charWidth : 9*charWidth), rowY1);
if (desc[0] == 0) if (desc[0] == 0)
{ {
@ -513,7 +514,7 @@ void CCodeView::OnPaint(wxPaintEvent& event)
//UnDecorateSymbolName(desc,temp,255,UNDNAME_COMPLETE); //UnDecorateSymbolName(desc,temp,255,UNDNAME_COMPLETE);
if (strlen(desc)) if (strlen(desc))
{ {
dc.DrawText(wxString::FromAscii(desc), 17 + 35 * charWidth, rowY1); dc.DrawText(StrToWxStr(desc), 17 + 35 * charWidth, rowY1);
} }
} }

View File

@ -30,6 +30,7 @@
#include "CodeWindow.h" #include "CodeWindow.h"
#include "CodeView.h" #include "CodeView.h"
#include "../WxUtils.h"
#include "FileUtil.h" #include "FileUtil.h"
#include "Core.h" #include "Core.h"
#include "HW/Memmap.h" #include "HW/Memmap.h"
@ -210,7 +211,7 @@ void CCodeWindow::OnAddrBoxChange(wxCommandEvent& event)
wxTextCtrl* pAddrCtrl = (wxTextCtrl*)GetToolBar()->FindControl(IDM_ADDRBOX); wxTextCtrl* pAddrCtrl = (wxTextCtrl*)GetToolBar()->FindControl(IDM_ADDRBOX);
wxString txt = pAddrCtrl->GetValue(); wxString txt = pAddrCtrl->GetValue();
std::string text(txt.mb_str()); std::string text(WxStrToStr(txt));
text = StripSpaces(text); text = StripSpaces(text);
if (text.size() == 8) if (text.size() == 8)
{ {
@ -312,7 +313,7 @@ void CCodeWindow::UpdateLists()
Symbol *caller_symbol = g_symbolDB.GetSymbolFromAddr(caller_addr); Symbol *caller_symbol = g_symbolDB.GetSymbolFromAddr(caller_addr);
if (caller_symbol) if (caller_symbol)
{ {
int idx = callers->Append(wxString::FromAscii(StringFromFormat int idx = callers->Append(StrToWxStr(StringFromFormat
("< %s (%08x)", caller_symbol->name.c_str(), caller_addr).c_str())); ("< %s (%08x)", caller_symbol->name.c_str(), caller_addr).c_str()));
callers->SetClientData(idx, (void*)(u64)caller_addr); callers->SetClientData(idx, (void*)(u64)caller_addr);
} }
@ -325,7 +326,7 @@ void CCodeWindow::UpdateLists()
Symbol *call_symbol = g_symbolDB.GetSymbolFromAddr(call_addr); Symbol *call_symbol = g_symbolDB.GetSymbolFromAddr(call_addr);
if (call_symbol) if (call_symbol)
{ {
int idx = calls->Append(wxString::FromAscii(StringFromFormat int idx = calls->Append(StrToWxStr(StringFromFormat
("> %s (%08x)", call_symbol->name.c_str(), call_addr).c_str())); ("> %s (%08x)", call_symbol->name.c_str(), call_addr).c_str()));
calls->SetClientData(idx, (void*)(u64)call_addr); calls->SetClientData(idx, (void*)(u64)call_addr);
} }
@ -344,12 +345,12 @@ void CCodeWindow::UpdateCallstack()
for (size_t i = 0; i < stack.size(); i++) for (size_t i = 0; i < stack.size(); i++)
{ {
int idx = callstack->Append(wxString::FromAscii(stack[i].Name.c_str())); int idx = callstack->Append(StrToWxStr(stack[i].Name.c_str()));
callstack->SetClientData(idx, (void*)(u64)stack[i].vAddress); callstack->SetClientData(idx, (void*)(u64)stack[i].vAddress);
} }
if (!ret) if (!ret)
callstack->Append(wxString::FromAscii("invalid callstack")); callstack->Append(StrToWxStr("invalid callstack"));
} }
// Create CPU Mode menus // Create CPU Mode menus
@ -360,7 +361,7 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
wxMenu* pCoreMenu = new wxMenu; wxMenu* pCoreMenu = new wxMenu;
wxMenuItem* interpreter = pCoreMenu->Append(IDM_INTERPRETER, _("&Interpreter core"), wxMenuItem* interpreter = pCoreMenu->Append(IDM_INTERPRETER, _("&Interpreter core"),
wxString::FromAscii("This is necessary to get break points" StrToWxStr("This is necessary to get break points"
" and stepping to work as explained in the Developer Documentation. But it can be very" " and stepping to work as explained in the Developer Documentation. But it can be very"
" slow, perhaps slower than 1 fps."), " slow, perhaps slower than 1 fps."),
wxITEM_CHECK); wxITEM_CHECK);
@ -428,7 +429,7 @@ void CCodeWindow::CreateMenuOptions(wxMenu* pMenu)
boottopause->Check(bBootToPause); boottopause->Check(bBootToPause);
wxMenuItem* automaticstart = pMenu->Append(IDM_AUTOMATICSTART, _("&Automatic start"), wxMenuItem* automaticstart = pMenu->Append(IDM_AUTOMATICSTART, _("&Automatic start"),
wxString::FromAscii( StrToWxStr(
"Automatically load the Default ISO when Dolphin starts, or the last game you loaded," "Automatically load the Default ISO when Dolphin starts, or the last game you loaded,"
" if you have not given it an elf file with the --elf command line. [This can be" " if you have not given it an elf file with the --elf command line. [This can be"
" convenient if you are bug-testing with a certain game and want to rebuild" " convenient if you are bug-testing with a certain game and want to rebuild"
@ -515,10 +516,10 @@ void CCodeWindow::OnJitMenu(wxCommandEvent& event)
for (u32 addr = 0x80000000; addr < 0x80100000; addr += 4) for (u32 addr = 0x80000000; addr < 0x80100000; addr += 4)
{ {
const char *name = PPCTables::GetInstructionName(Memory::ReadUnchecked_U32(addr)); const char *name = PPCTables::GetInstructionName(Memory::ReadUnchecked_U32(addr));
if (name && !strcmp((const char *)str.mb_str(), name)) auto const wx_name = WxStrToStr(str);
if (name && (wx_name == name))
{ {
std::string mb_str(str.mb_str()); NOTICE_LOG(POWERPC, "Found %s at %08x", wx_name.c_str(), addr);
NOTICE_LOG(POWERPC, "Found %s at %08x", mb_str.c_str(), addr);
} }
} }
break; break;

View File

@ -25,6 +25,7 @@
#include "DebuggerUIUtil.h" #include "DebuggerUIUtil.h"
#include "../WxUtils.h"
#include "RegisterWindow.h" #include "RegisterWindow.h"
#include "BreakpointWindow.h" #include "BreakpointWindow.h"
#include "MemoryWindow.h" #include "MemoryWindow.h"
@ -65,7 +66,7 @@ void CCodeWindow::Load()
std::string fontDesc; std::string fontDesc;
ini.Get("General", "DebuggerFont", &fontDesc); ini.Get("General", "DebuggerFont", &fontDesc);
if (!fontDesc.empty()) if (!fontDesc.empty())
DebuggerFont.SetNativeFontInfoUserDesc(wxString::FromAscii(fontDesc.c_str())); DebuggerFont.SetNativeFontInfoUserDesc(StrToWxStr(fontDesc.c_str()));
// Boot to pause or not // Boot to pause or not
ini.Get("General", "AutomaticStart", &bAutomaticStart, false); ini.Get("General", "AutomaticStart", &bAutomaticStart, false);
@ -107,7 +108,7 @@ void CCodeWindow::Save()
ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX)); ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
ini.Set("General", "DebuggerFont", ini.Set("General", "DebuggerFont",
std::string(DebuggerFont.GetNativeFontInfoUserDesc().mb_str())); WxStrToStr(DebuggerFont.GetNativeFontInfoUserDesc()));
// Boot to pause or not // Boot to pause or not
ini.Set("General", "AutomaticStart", GetMenuBar()->IsChecked(IDM_AUTOMATICSTART)); ini.Set("General", "AutomaticStart", GetMenuBar()->IsChecked(IDM_AUTOMATICSTART));
@ -154,7 +155,7 @@ void CCodeWindow::CreateMenuSymbols(wxMenuBar *pMenuBar)
pSymbolsMenu->Append(IDM_SAVEMAPFILE, _("&Save symbol map")); pSymbolsMenu->Append(IDM_SAVEMAPFILE, _("&Save symbol map"));
pSymbolsMenu->AppendSeparator(); pSymbolsMenu->AppendSeparator();
pSymbolsMenu->Append(IDM_SAVEMAPFILEWITHCODES, _("Save code"), pSymbolsMenu->Append(IDM_SAVEMAPFILEWITHCODES, _("Save code"),
wxString::FromAscii("Save the entire disassembled code. This may take a several seconds" StrToWxStr("Save the entire disassembled code. This may take a several seconds"
" and may require between 50 and 100 MB of hard drive space. It will only save code" " and may require between 50 and 100 MB of hard drive space. It will only save code"
" that are in the first 4 MB of memory, if you are debugging a game that load .rel" " that are in the first 4 MB of memory, if you are debugging a game that load .rel"
" files with code to memory you may want to increase that to perhaps 8 MB, you can do" " files with code to memory you may want to increase that to perhaps 8 MB, you can do"
@ -284,7 +285,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
if (!path.IsEmpty()) if (!path.IsEmpty())
{ {
std::ifstream f(path.mb_str()); std::ifstream f(WxStrToStr(path));
std::string line; std::string line;
while (std::getline(f, line)) while (std::getline(f, line))
@ -312,13 +313,13 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
{ {
wxTextEntryDialog input_prefix( wxTextEntryDialog input_prefix(
this, this,
wxString::FromAscii("Only export symbols with prefix:\n(Blank for all symbols)"), StrToWxStr("Only export symbols with prefix:\n(Blank for all symbols)"),
wxGetTextFromUserPromptStr, wxGetTextFromUserPromptStr,
wxEmptyString); wxEmptyString);
if (input_prefix.ShowModal() == wxID_OK) if (input_prefix.ShowModal() == wxID_OK)
{ {
std::string prefix(input_prefix.GetValue().mb_str()); std::string prefix(WxStrToStr(input_prefix.GetValue()));
wxString path = wxFileSelector( wxString path = wxFileSelector(
_T("Save signature as"), wxEmptyString, wxEmptyString, wxEmptyString, _T("Save signature as"), wxEmptyString, wxEmptyString, wxEmptyString,
@ -328,8 +329,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
{ {
SignatureDB db; SignatureDB db;
db.Initialize(&g_symbolDB, prefix.c_str()); db.Initialize(&g_symbolDB, prefix.c_str());
std::string filename(path.mb_str()); db.Save(WxStrToStr(path).c_str());
db.Save(path.mb_str());
} }
} }
} }
@ -343,7 +343,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
if (!path.IsEmpty()) if (!path.IsEmpty())
{ {
SignatureDB db; SignatureDB db;
db.Load(path.mb_str()); db.Load(WxStrToStr(path).c_str());
db.Apply(&g_symbolDB); db.Apply(&g_symbolDB);
} }
} }
@ -366,7 +366,7 @@ void CCodeWindow::NotifyMapLoaded()
symbols->Clear(); symbols->Clear();
for (PPCSymbolDB::XFuncMap::iterator iter = g_symbolDB.GetIterator(); iter != g_symbolDB.End(); ++iter) for (PPCSymbolDB::XFuncMap::iterator iter = g_symbolDB.GetIterator(); iter != g_symbolDB.End(); ++iter)
{ {
int idx = symbols->Append(wxString::FromAscii(iter->second.name.c_str())); int idx = symbols->Append(StrToWxStr(iter->second.name.c_str()));
symbols->SetClientData(idx, (void*)&iter->second); symbols->SetClientData(idx, (void*)&iter->second);
} }
symbols->Thaw(); symbols->Thaw();

View File

@ -22,6 +22,7 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include "../WxUtils.h"
#include "StringUtil.h" #include "StringUtil.h"
#include "DSPDebugWindow.h" #include "DSPDebugWindow.h"
#include "DSPRegisterView.h" #include "DSPRegisterView.h"
@ -220,7 +221,7 @@ void DSPDebuggerLLE::UpdateSymbolMap()
for (SymbolDB::XFuncMap::iterator iter = DSPSymbols::g_dsp_symbol_db.GetIterator(); for (SymbolDB::XFuncMap::iterator iter = DSPSymbols::g_dsp_symbol_db.GetIterator();
iter != DSPSymbols::g_dsp_symbol_db.End(); ++iter) iter != DSPSymbols::g_dsp_symbol_db.End(); ++iter)
{ {
int idx = m_SymbolList->Append(wxString::FromAscii(iter->second.name.c_str())); int idx = m_SymbolList->Append(StrToWxStr(iter->second.name.c_str()));
m_SymbolList->SetClientData(idx, (void*)&iter->second); m_SymbolList->SetClientData(idx, (void*)&iter->second);
} }
m_SymbolList->Thaw(); m_SymbolList->Thaw();
@ -250,8 +251,7 @@ void DSPDebuggerLLE::OnAddrBoxChange(wxCommandEvent& event)
wxTextCtrl* pAddrCtrl = (wxTextCtrl*)m_Toolbar->FindControl(ID_ADDRBOX); wxTextCtrl* pAddrCtrl = (wxTextCtrl*)m_Toolbar->FindControl(ID_ADDRBOX);
wxString txt = pAddrCtrl->GetValue(); wxString txt = pAddrCtrl->GetValue();
std::string text(txt.mb_str()); auto text = StripSpaces(WxStrToStr(txt));
text = StripSpaces(text);
if (text.size()) if (text.size())
{ {
u32 addr; u32 addr;

View File

@ -17,7 +17,7 @@
#include "DSPDebugWindow.h" #include "DSPDebugWindow.h"
#include "DSPRegisterView.h" #include "DSPRegisterView.h"
#include "../WxUtils.h"
wxString CDSPRegTable::GetValue(int row, int col) wxString CDSPRegTable::GetValue(int row, int col)
{ {
@ -25,7 +25,7 @@ wxString CDSPRegTable::GetValue(int row, int col)
{ {
switch (col) switch (col)
{ {
case 0: return wxString::FromAscii(pdregname(row)); case 0: return StrToWxStr(pdregname(row));
case 1: return wxString::Format(wxT("0x%04x"), DSPCore_ReadRegister(row)); case 1: return wxString::Format(wxT("0x%04x"), DSPCore_ReadRegister(row));
default: return wxEmptyString; default: return wxEmptyString;
} }

View File

@ -37,6 +37,7 @@
#include "Core.h" #include "Core.h"
#include "StringUtil.h" #include "StringUtil.h"
#include "LogManager.h" #include "LogManager.h"
#include "../WxUtils.h"
#include "../Globals.h" #include "../Globals.h"

View File

@ -15,6 +15,7 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "../WxUtils.h"
#include "MemoryCheckDlg.h" #include "MemoryCheckDlg.h"
#include "Common.h" #include "Common.h"
#include "StringUtil.h" #include "StringUtil.h"
@ -79,9 +80,9 @@ void MemoryCheckDlg::OnOK(wxCommandEvent& event)
u32 StartAddress, EndAddress; u32 StartAddress, EndAddress;
bool EndAddressOK = EndAddressString.Len() && bool EndAddressOK = EndAddressString.Len() &&
AsciiToHex(EndAddressString.mb_str(), EndAddress); AsciiToHex(WxStrToStr(EndAddressString).c_str(), EndAddress);
if (AsciiToHex(StartAddressString.mb_str(), StartAddress) && if (AsciiToHex(WxStrToStr(StartAddressString).c_str(), StartAddress) &&
(OnRead || OnWrite) && (Log || Break)) (OnRead || OnWrite) && (Log || Break))
{ {
TMemCheck MemCheck; TMemCheck MemCheck;

View File

@ -22,6 +22,8 @@
#include "HW/Memmap.h" #include "HW/Memmap.h"
#include "MemoryView.h" #include "MemoryView.h"
#include "../WxUtils.h"
#include <wx/event.h> #include <wx/event.h>
#include <wx/clipbrd.h> #include <wx/clipbrd.h>
@ -149,7 +151,7 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event)
{ {
char temp[24]; char temp[24];
sprintf(temp, "%08x", debugger->readExtraMemory(memory, selection)); sprintf(temp, "%08x", debugger->readExtraMemory(memory, selection));
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(temp))); wxTheClipboard->SetData(new wxTextDataObject(StrToWxStr(temp)));
} }
break; break;
#endif #endif
@ -186,16 +188,16 @@ void CMemoryView::OnMouseDownR(wxMouseEvent& event)
wxMenu* menu = new wxMenu; wxMenu* menu = new wxMenu;
//menu.Append(IDM_GOTOINMEMVIEW, "&Goto in mem view"); //menu.Append(IDM_GOTOINMEMVIEW, "&Goto in mem view");
#if wxUSE_CLIPBOARD #if wxUSE_CLIPBOARD
menu->Append(IDM_COPYADDRESS, wxString::FromAscii("Copy &address")); menu->Append(IDM_COPYADDRESS, StrToWxStr("Copy &address"));
menu->Append(IDM_COPYHEX, wxString::FromAscii("Copy &hex")); menu->Append(IDM_COPYHEX, StrToWxStr("Copy &hex"));
#endif #endif
menu->Append(IDM_TOGGLEMEMORY, wxString::FromAscii("Toggle &memory")); menu->Append(IDM_TOGGLEMEMORY, StrToWxStr("Toggle &memory"));
wxMenu* viewAsSubMenu = new wxMenu; wxMenu* viewAsSubMenu = new wxMenu;
viewAsSubMenu->Append(IDM_VIEWASFP, wxString::FromAscii("FP value")); viewAsSubMenu->Append(IDM_VIEWASFP, StrToWxStr("FP value"));
viewAsSubMenu->Append(IDM_VIEWASASCII, wxString::FromAscii("ASCII")); viewAsSubMenu->Append(IDM_VIEWASASCII, StrToWxStr("ASCII"));
viewAsSubMenu->Append(IDM_VIEWASHEX, wxString::FromAscii("Hex")); viewAsSubMenu->Append(IDM_VIEWASHEX, StrToWxStr("Hex"));
menu->AppendSubMenu(viewAsSubMenu, wxString::FromAscii("View As:")); menu->AppendSubMenu(viewAsSubMenu, StrToWxStr("View As:"));
PopupMenu(menu); PopupMenu(menu);
} }
@ -285,7 +287,7 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
char mem[256]; char mem[256];
debugger->getRawMemoryString(memory, address, mem, 256); debugger->getRawMemoryString(memory, address, mem, 256);
dc.SetTextForeground(_T("#000080")); dc.SetTextForeground(_T("#000080"));
dc.DrawText(wxString::FromAscii(mem), 17+fontSize*(8), rowY1); dc.DrawText(StrToWxStr(mem), 17+fontSize*(8), rowY1);
dc.SetTextForeground(_T("#000000")); dc.SetTextForeground(_T("#000000"));
} }
@ -361,9 +363,9 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
char desc[256] = ""; char desc[256] = "";
if (viewAsType != VIEWAS_HEX) if (viewAsType != VIEWAS_HEX)
dc.DrawText(wxString::FromAscii(dis), textPlacement + fontSize*(8 + 8), rowY1); dc.DrawText(StrToWxStr(dis), textPlacement + fontSize*(8 + 8), rowY1);
else else
dc.DrawText(wxString::FromAscii(dis), textPlacement, rowY1); dc.DrawText(StrToWxStr(dis), textPlacement, rowY1);
if (desc[0] == 0) if (desc[0] == 0)
strcpy(desc, debugger->getDescription(address).c_str()); strcpy(desc, debugger->getDescription(address).c_str());
@ -371,7 +373,7 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
dc.SetTextForeground(_T("#0000FF")); dc.SetTextForeground(_T("#0000FF"));
if (strlen(desc)) if (strlen(desc))
dc.DrawText(wxString::FromAscii(desc), 17+fontSize*((8+8+8+30)*2), rowY1); dc.DrawText(StrToWxStr(desc), 17+fontSize*((8+8+8+30)*2), rowY1);
// Show blue memory check dot // Show blue memory check dot
if (debugger->isMemCheck(address)) if (debugger->isMemCheck(address))

View File

@ -20,6 +20,8 @@
#include <wx/listctrl.h> #include <wx/listctrl.h>
#include <wx/thread.h> #include <wx/thread.h>
#include <wx/listctrl.h> #include <wx/listctrl.h>
#include "../WxUtils.h"
#include "MemoryWindow.h" #include "MemoryWindow.h"
#include "HW/CPU.h" #include "HW/CPU.h"
#include "PowerPC/PowerPC.h" #include "PowerPC/PowerPC.h"
@ -152,8 +154,8 @@ void CMemoryWindow::JumpToAddress(u32 _Address)
void CMemoryWindow::SetMemoryValue(wxCommandEvent& event) void CMemoryWindow::SetMemoryValue(wxCommandEvent& event)
{ {
std::string str_addr = std::string(addrbox->GetValue().mb_str()); std::string str_addr = WxStrToStr(addrbox->GetValue());
std::string str_val = std::string(valbox->GetValue().mb_str()); std::string str_val = WxStrToStr(valbox->GetValue());
u32 addr; u32 addr;
u32 val; u32 val;
@ -179,7 +181,7 @@ void CMemoryWindow::OnAddrBoxChange(wxCommandEvent& event)
if (txt.size()) if (txt.size())
{ {
u32 addr; u32 addr;
sscanf(txt.mb_str(), "%08x", &addr); sscanf(WxStrToStr(txt).c_str(), "%08x", &addr);
memview->Center(addr & ~3); memview->Center(addr & ~3);
} }
@ -349,10 +351,7 @@ void CMemoryWindow::onSearch(wxCommandEvent& event)
tmpstr = new char[newsize + 1]; tmpstr = new char[newsize + 1];
memset(tmpstr, 0, newsize + 1); memset(tmpstr, 0, newsize + 1);
} }
//sprintf(tmpstr, "%s%s", tmpstr, rawData.c_str()); sprintf(tmpstr, "%s%s", tmpstr, WxStrToStr(rawData).c_str());
//strcpy(&tmpstr[1], rawData.ToAscii());
//memcpy(&tmpstr[1], &rawData.c_str()[0], rawData.size());
sprintf(tmpstr, "%s%s", tmpstr, (const char *)rawData.mb_str());
tmp2 = &Dest.front(); tmp2 = &Dest.front();
count = 0; count = 0;
for(i = 0; i < strlen(tmpstr); i++) for(i = 0; i < strlen(tmpstr); i++)
@ -376,7 +375,7 @@ void CMemoryWindow::onSearch(wxCommandEvent& event)
tmpstr = new char[size+1]; tmpstr = new char[size+1];
tmp2 = &Dest.front(); tmp2 = &Dest.front();
sprintf(tmpstr, "%s", (const char *)rawData.mb_str()); sprintf(tmpstr, "%s", WxStrToStr(rawData).c_str());
for(i = 0; i < size; i++) for(i = 0; i < size; i++)
tmp2[i] = tmpstr[i]; tmp2[i] = tmpstr[i];
@ -393,7 +392,7 @@ void CMemoryWindow::onSearch(wxCommandEvent& event)
u32 addr = 0; u32 addr = 0;
if (txt.size()) if (txt.size())
{ {
sscanf(txt.mb_str(), "%08x", &addr); sscanf(WxStrToStr(txt).c_str(), "%08x", &addr);
} }
i = addr+4; i = addr+4;
for( ; i < szRAM; i++) for( ; i < szRAM; i++)

View File

@ -20,6 +20,7 @@
#include "PowerPC/PowerPC.h" #include "PowerPC/PowerPC.h"
#include "HW/ProcessorInterface.h" #include "HW/ProcessorInterface.h"
#include "IniFile.h" #include "IniFile.h"
#include "../WxUtils.h"
// F-zero 80005e60 wtf?? // F-zero 80005e60 wtf??
@ -51,9 +52,9 @@ wxString CRegTable::GetValue(int row, int col)
{ {
if (row < 32) { if (row < 32) {
switch (col) { switch (col) {
case 0: return wxString::FromAscii(GetGPRName(row)); case 0: return StrToWxStr(GetGPRName(row));
case 1: return wxString::Format(wxT("%08x"), GPR(row)); case 1: return wxString::Format(wxT("%08x"), GPR(row));
case 2: return wxString::FromAscii(GetFPRName(row)); case 2: return StrToWxStr(GetFPRName(row));
case 3: return wxString::Format(wxT("%016llx"), riPS0(row)); case 3: return wxString::Format(wxT("%016llx"), riPS0(row));
case 4: return wxString::Format(wxT("%016llx"), riPS1(row)); case 4: return wxString::Format(wxT("%016llx"), riPS1(row));
default: return wxEmptyString; default: return wxEmptyString;
@ -61,7 +62,7 @@ wxString CRegTable::GetValue(int row, int col)
} else { } else {
if (row - 32 < NUM_SPECIALS) { if (row - 32 < NUM_SPECIALS) {
switch (col) { switch (col) {
case 0: return wxString::FromAscii(special_reg_names[row - 32]); case 0: return StrToWxStr(special_reg_names[row - 32]);
case 1: return wxString::Format(wxT("%08x"), GetSpecialRegValue(row - 32)); case 1: return wxString::Format(wxT("%08x"), GetSpecialRegValue(row - 32));
default: return wxEmptyString; default: return wxEmptyString;
} }
@ -91,7 +92,7 @@ static void SetSpecialRegValue(int reg, u32 value) {
void CRegTable::SetValue(int row, int col, const wxString& strNewVal) void CRegTable::SetValue(int row, int col, const wxString& strNewVal)
{ {
u32 newVal = 0; u32 newVal = 0;
if (TryParse(std::string(strNewVal.mb_str()), &newVal)) if (TryParse(WxStrToStr(strNewVal), &newVal))
{ {
if (row < 32) { if (row < 32) {
if (col == 1) if (col == 1)

View File

@ -22,6 +22,7 @@
#include "FifoPlayer/FifoPlayer.h" #include "FifoPlayer/FifoPlayer.h"
#include "FifoPlayer/FifoRecorder.h" #include "FifoPlayer/FifoRecorder.h"
#include "OpcodeDecoding.h" #include "OpcodeDecoding.h"
#include "WxUtils.h"
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
#include <wx/clipbrd.h> #include <wx/clipbrd.h>
@ -395,7 +396,7 @@ void FifoPlayerDlg::OnSaveFile(wxCommandEvent& WXUNUSED(event))
if (!path.empty()) if (!path.empty())
{ {
wxBeginBusyCursor(); wxBeginBusyCursor();
bool result = file->Save(path.mb_str()); bool result = file->Save(WxStrToStr(path).c_str());
wxEndBusyCursor(); wxEndBusyCursor();
if (!result) if (!result)
@ -752,10 +753,10 @@ void FifoPlayerDlg::OnObjectCmdListSelectionChanged(wxCommandEvent& event)
char name[64]="\0", desc[512]="\0"; char name[64]="\0", desc[512]="\0";
GetBPRegInfo(cmddata+1, name, sizeof(name), desc, sizeof(desc)); GetBPRegInfo(cmddata+1, name, sizeof(name), desc, sizeof(desc));
newLabel = _("BP register "); newLabel = _("BP register ");
newLabel += (name[0] != '\0') ? wxString(name, *wxConvCurrent) : wxString::Format(_("UNKNOWN_%02X"), *(cmddata+1)); newLabel += (name[0] != '\0') ? StrToWxStr(name) : wxString::Format(_("UNKNOWN_%02X"), *(cmddata+1));
newLabel += wxT(":\n"); newLabel += wxT(":\n");
if (desc[0] != '\0') if (desc[0] != '\0')
newLabel += wxString(desc, *wxConvCurrent); newLabel += StrToWxStr(desc);
else else
newLabel += _("No description available"); newLabel += _("No description available");
} }

View File

@ -21,6 +21,7 @@
#include "Globals.h" // Local #include "Globals.h" // Local
#include "Frame.h" #include "Frame.h"
#include "LogWindow.h" #include "LogWindow.h"
#include "WxUtils.h"
#include "ConfigManager.h" // Core #include "ConfigManager.h" // Core
@ -548,7 +549,7 @@ void CFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& event)
for (u32 i = 0; i < Perspectives.size(); i++) for (u32 i = 0; i < Perspectives.size(); i++)
{ {
wxMenuItem* mItem = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_0 + i, wxMenuItem* mItem = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_0 + i,
wxString::FromAscii(Perspectives[i].Name.c_str()), StrToWxStr(Perspectives[i].Name.c_str()),
wxT(""), wxITEM_CHECK); wxT(""), wxITEM_CHECK);
menuPopup->Append(mItem); menuPopup->Append(mItem);
if (i == ActivePerspective) mItem->Check(true); if (i == ActivePerspective) mItem->Check(true);
@ -580,7 +581,7 @@ void CFrame::OnToolBar(wxCommandEvent& event)
return; return;
} }
SaveIniPerspectives(); SaveIniPerspectives();
GetStatusBar()->SetStatusText(wxString::FromAscii(std::string GetStatusBar()->SetStatusText(StrToWxStr(std::string
("Saved " + Perspectives[ActivePerspective].Name).c_str()), 0); ("Saved " + Perspectives[ActivePerspective].Name).c_str()), 0);
break; break;
case IDM_PERSPECTIVES_ADD_PANE: case IDM_PERSPECTIVES_ADD_PANE:
@ -633,7 +634,7 @@ void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event)
} }
SPerspectives Tmp; SPerspectives Tmp;
Tmp.Name = dlg.GetValue().mb_str(); Tmp.Name = WxStrToStr(dlg.GetValue());
Tmp.Perspective = m_Mgr->SavePerspective(); Tmp.Perspective = m_Mgr->SavePerspective();
ActivePerspective = (u32)Perspectives.size(); ActivePerspective = (u32)Perspectives.size();
@ -870,7 +871,7 @@ void CFrame::LoadIniPerspectives()
ini.Get(_Section.c_str(), "Width", &_Width, "70,25"); ini.Get(_Section.c_str(), "Width", &_Width, "70,25");
ini.Get(_Section.c_str(), "Height", &_Height, "80,80"); ini.Get(_Section.c_str(), "Height", &_Height, "80,80");
Tmp.Perspective = wxString::FromAscii(_Perspective.c_str()); Tmp.Perspective = StrToWxStr(_Perspective.c_str());
SplitString(_Width, ',', _SWidth); SplitString(_Width, ',', _SWidth);
SplitString(_Height, ',', _SHeight); SplitString(_Height, ',', _SHeight);
@ -940,7 +941,7 @@ void CFrame::SaveIniPerspectives()
for (u32 i = 0; i < Perspectives.size(); i++) for (u32 i = 0; i < Perspectives.size(); i++)
{ {
std::string _Section = "P - " + Perspectives[i].Name; std::string _Section = "P - " + Perspectives[i].Name;
ini.Set(_Section.c_str(), "Perspective", Perspectives[i].Perspective.mb_str()); ini.Set(_Section.c_str(), "Perspective", WxStrToStr(Perspectives[i].Perspective));
std::string SWidth = "", SHeight = ""; std::string SWidth = "", SHeight = "";
for (u32 j = 0; j < Perspectives[i].Width.size(); j++) for (u32 j = 0; j < Perspectives[i].Width.size(); j++)

View File

@ -101,7 +101,7 @@ void CFrame::CreateMenu()
drives = cdio_get_devices(); drives = cdio_get_devices();
// Windows Limitation of 24 character drives // Windows Limitation of 24 character drives
for (unsigned int i = 0; i < drives.size() && i < 24; i++) { for (unsigned int i = 0; i < drives.size() && i < 24; i++) {
externalDrive->Append(IDM_DRIVE1 + i, wxString::FromAscii(drives[i].c_str())); externalDrive->Append(IDM_DRIVE1 + i, StrToWxStr(drives[i].c_str()));
} }
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
@ -601,12 +601,10 @@ void CFrame::DoOpen(bool Boot)
// Should we boot a new game or just change the disc? // Should we boot a new game or just change the disc?
if (Boot && !path.IsEmpty()) if (Boot && !path.IsEmpty())
BootGame(std::string(path.mb_str())); BootGame(WxStrToStr(path));
else else
{ {
char newDiscpath[2048]; DVDInterface::ChangeDisc(WxStrToStr(path).c_str());
strncpy(newDiscpath, path.mb_str(), strlen(path.mb_str())+1);
DVDInterface::ChangeDisc(newDiscpath);
} }
} }
@ -693,7 +691,7 @@ void CFrame::OnPlayRecording(wxCommandEvent& WXUNUSED (event))
GetMenuBar()->FindItem(IDM_RECORDREADONLY)->Check(true); GetMenuBar()->FindItem(IDM_RECORDREADONLY)->Check(true);
} }
if(Movie::PlayInput(path.mb_str())) if (Movie::PlayInput(WxStrToStr(path).c_str()))
BootGame(std::string("")); BootGame(std::string(""));
} }
@ -1015,7 +1013,7 @@ void CFrame::DoStop()
X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()), X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()),
X11Utils::XWindowFromHandle(GetHandle()), false); X11Utils::XWindowFromHandle(GetHandle()), false);
#endif #endif
m_RenderFrame->SetTitle(wxString::FromAscii(scm_rev_str)); m_RenderFrame->SetTitle(StrToWxStr(scm_rev_str));
// Destroy the renderer frame when not rendering to main // Destroy the renderer frame when not rendering to main
m_RenderParent->Unbind(wxEVT_SIZE, &CFrame::OnRenderParentResize, this); m_RenderParent->Unbind(wxEVT_SIZE, &CFrame::OnRenderParentResize, this);
@ -1081,7 +1079,7 @@ void CFrame::DoRecordingSave()
if(path.IsEmpty()) if(path.IsEmpty())
return; return;
Movie::SaveRecording(path.mb_str()); Movie::SaveRecording(WxStrToStr(path).c_str());
if (!paused) if (!paused)
DoPause(); DoPause();
@ -1212,7 +1210,7 @@ void CFrame::StatusBarMessage(const char * Text, ...)
vsnprintf(Str, MAX_BYTES, Text, ArgPtr); vsnprintf(Str, MAX_BYTES, Text, ArgPtr);
va_end(ArgPtr); va_end(ArgPtr);
if (this->GetStatusBar()->IsEnabled()) this->GetStatusBar()->SetStatusText(wxString::FromAscii(Str),0); if (this->GetStatusBar()->IsEnabled()) this->GetStatusBar()->SetStatusText(StrToWxStr(Str),0);
} }
@ -1248,7 +1246,8 @@ void CFrame::OnImportSave(wxCommandEvent& WXUNUSED (event))
if (!path.IsEmpty()) if (!path.IsEmpty())
{ {
CWiiSaveCrypted* saveFile = new CWiiSaveCrypted(path.mb_str()); // TODO: Does this actually need to be dynamically allocated for some reason?
CWiiSaveCrypted* saveFile = new CWiiSaveCrypted(WxStrToStr(path).c_str());
delete saveFile; delete saveFile;
} }
} }
@ -1288,7 +1287,7 @@ void CFrame::OnInstallWAD(wxCommandEvent& event)
_T("Wii WAD file (*.wad)|*.wad"), _T("Wii WAD file (*.wad)|*.wad"),
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST, wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST,
this); this);
fileName = path.mb_str(); fileName = WxStrToStr(path);
break; break;
} }
default: default:
@ -1354,7 +1353,7 @@ void CFrame::ConnectWiimote(int wm_idx, bool connect)
GetUsbPointer()->AccessWiiMote(wm_idx | 0x100)->Activate(connect); GetUsbPointer()->AccessWiiMote(wm_idx | 0x100)->Activate(connect);
wxString msg(wxString::Format(wxT("Wiimote %i %s"), wm_idx + 1, wxString msg(wxString::Format(wxT("Wiimote %i %s"), wm_idx + 1,
connect ? wxT("Connected") : wxT("Disconnected"))); connect ? wxT("Connected") : wxT("Disconnected")));
Core::DisplayMessage(msg.ToAscii(), 3000); Core::DisplayMessage(WxStrToStr(msg), 3000);
Host_UpdateMainFrame(); Host_UpdateMainFrame();
} }
} }
@ -1394,7 +1393,7 @@ void CFrame::OnLoadStateFromFile(wxCommandEvent& WXUNUSED (event))
this); this);
if (!path.IsEmpty()) if (!path.IsEmpty())
State::LoadAs((const char*)path.mb_str()); State::LoadAs(WxStrToStr(path));
} }
void CFrame::OnSaveStateToFile(wxCommandEvent& WXUNUSED (event)) void CFrame::OnSaveStateToFile(wxCommandEvent& WXUNUSED (event))
@ -1408,7 +1407,7 @@ void CFrame::OnSaveStateToFile(wxCommandEvent& WXUNUSED (event))
this); this);
if (!path.IsEmpty()) if (!path.IsEmpty())
State::SaveAs((const char*)path.mb_str()); State::SaveAs(WxStrToStr(path));
} }
void CFrame::OnLoadLastState(wxCommandEvent& WXUNUSED (event)) void CFrame::OnLoadLastState(wxCommandEvent& WXUNUSED (event))

View File

@ -257,7 +257,7 @@ void CGameListCtrl::BrowseForDirectory()
if (dialog.ShowModal() == wxID_OK) if (dialog.ShowModal() == wxID_OK)
{ {
std::string sPath(dialog.GetPath().mb_str()); std::string sPath(WxStrToStr(dialog.GetPath()));
std::vector<std::string>::iterator itResult = std::find( std::vector<std::string>::iterator itResult = std::find(
SConfig::GetInstance().m_ISOFolder.begin(), SConfig::GetInstance().m_ISOFolder.begin(),
SConfig::GetInstance().m_ISOFolder.end(), sPath); SConfig::GetInstance().m_ISOFolder.end(), sPath);
@ -402,7 +402,7 @@ wxString NiceSizeFormat(s64 _size)
wxString NiceString; wxString NiceString;
char tempstr[32]; char tempstr[32];
sprintf(tempstr,"%3.1f %s", f, sizes[s]); sprintf(tempstr,"%3.1f %s", f, sizes[s]);
NiceString = wxString::FromAscii(tempstr); NiceString = StrToWxStr(tempstr);
return(NiceString); return(NiceString);
} }
@ -614,7 +614,7 @@ void CGameListCtrl::ScanForISOs()
// Update with the progress (i) and the message // Update with the progress (i) and the message
dialog.Update(i, wxString::Format(_("Scanning %s"), dialog.Update(i, wxString::Format(_("Scanning %s"),
wxString(FileName.c_str(), *wxConvCurrent).c_str())); StrToWxStr(FileName).c_str()));
if (dialog.WasCancelled()) if (dialog.WasCancelled())
break; break;
@ -858,7 +858,7 @@ void CGameListCtrl::OnMouseMotion(wxMouseEvent& event)
char temp[2048]; char temp[2048];
sprintf(temp, "^ %s%s%s", emuState[emu_state - 1], sprintf(temp, "^ %s%s%s", emuState[emu_state - 1],
issues.size() > 0 ? " :\n" : "", issues.c_str()); issues.size() > 0 ? " :\n" : "", issues.c_str());
toolTip = new wxEmuStateTip(this, wxString(temp, *wxConvCurrent), &toolTip); toolTip = new wxEmuStateTip(this, StrToWxStr(temp), &toolTip);
} }
else else
toolTip = new wxEmuStateTip(this, _("Not Set"), &toolTip); toolTip = new wxEmuStateTip(this, _("Not Set"), &toolTip);
@ -1115,9 +1115,9 @@ void CGameListCtrl::OnWiki(wxCommandEvent& WXUNUSED (event))
void CGameListCtrl::MultiCompressCB(const char* text, float percent, void* arg) void CGameListCtrl::MultiCompressCB(const char* text, float percent, void* arg)
{ {
percent = (((float)m_currentItem) + percent) / (float)m_numberItem; percent = (((float)m_currentItem) + percent) / (float)m_numberItem;
wxString textString(StringFromFormat("%s (%i/%i) - %s", wxString textString(StrToWxStr(StringFromFormat("%s (%i/%i) - %s",
m_currentFilename.c_str(), (int)m_currentItem+1, m_currentFilename.c_str(), (int)m_currentItem+1,
(int)m_numberItem, text).c_str(), *wxConvCurrent); (int)m_numberItem, text)));
((wxProgressDialog*)arg)->Update((int)(percent*1000), textString); ((wxProgressDialog*)arg)->Update((int)(percent*1000), textString);
} }
@ -1170,13 +1170,13 @@ void CGameListCtrl::CompressSelection(bool _compress)
std::string OutputFileName; std::string OutputFileName;
BuildCompleteFilename(OutputFileName, BuildCompleteFilename(OutputFileName,
(const char *)browseDialog.GetPath().mb_str(wxConvUTF8), WxStrToStr(browseDialog.GetPath()),
FileName); FileName);
if (wxFileExists(wxString::FromAscii(OutputFileName.c_str())) && if (wxFileExists(StrToWxStr(OutputFileName.c_str())) &&
wxMessageBox( wxMessageBox(
wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"), wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"),
wxString(OutputFileName.c_str(), *wxConvCurrent).c_str()), StrToWxStr(OutputFileName).c_str()),
_("Confirm File Overwrite"), _("Confirm File Overwrite"),
wxYES_NO) == wxNO) wxYES_NO) == wxNO)
continue; continue;
@ -1198,13 +1198,13 @@ void CGameListCtrl::CompressSelection(bool _compress)
std::string OutputFileName; std::string OutputFileName;
BuildCompleteFilename(OutputFileName, BuildCompleteFilename(OutputFileName,
(const char *)browseDialog.GetPath().mb_str(wxConvUTF8), WxStrToStr(browseDialog.GetPath()),
FileName); FileName);
if (wxFileExists(wxString::FromAscii(OutputFileName.c_str())) && if (wxFileExists(StrToWxStr(OutputFileName.c_str())) &&
wxMessageBox( wxMessageBox(
wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"), wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"),
wxString(OutputFileName.c_str(), *wxConvCurrent).c_str()), StrToWxStr(OutputFileName).c_str()),
_("Confirm File Overwrite"), _("Confirm File Overwrite"),
wxYES_NO) == wxNO) wxYES_NO) == wxNO)
continue; continue;
@ -1225,7 +1225,7 @@ void CGameListCtrl::CompressSelection(bool _compress)
void CGameListCtrl::CompressCB(const char* text, float percent, void* arg) void CGameListCtrl::CompressCB(const char* text, float percent, void* arg)
{ {
((wxProgressDialog*)arg)-> ((wxProgressDialog*)arg)->
Update((int)(percent*1000), wxString(text, *wxConvCurrent)); Update((int)(percent*1000), StrToWxStr(text));
} }
void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event)) void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
@ -1251,8 +1251,8 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
path = wxFileSelector( path = wxFileSelector(
_("Save decompressed GCM/ISO"), _("Save decompressed GCM/ISO"),
wxString(FilePath.c_str(), *wxConvCurrent), StrToWxStr(FilePath),
wxString(FileName.c_str(), *wxConvCurrent) + FileType.After('*'), StrToWxStr(FileName) + FileType.After('*'),
wxEmptyString, wxEmptyString,
FileType + wxT("|") + wxGetTranslation(wxALL_FILES), FileType + wxT("|") + wxGetTranslation(wxALL_FILES),
wxFD_SAVE, wxFD_SAVE,
@ -1262,8 +1262,8 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
{ {
path = wxFileSelector( path = wxFileSelector(
_("Save compressed GCM/ISO"), _("Save compressed GCM/ISO"),
wxString(FilePath.c_str(), *wxConvCurrent), StrToWxStr(FilePath),
wxString(FileName.c_str(), *wxConvCurrent) + _T(".gcz"), StrToWxStr(FileName) + _T(".gcz"),
wxEmptyString, wxEmptyString,
_("All compressed GC/Wii ISO files (gcz)") + _("All compressed GC/Wii ISO files (gcz)") +
wxString::Format(wxT("|*.gcz|%s"), wxGetTranslation(wxALL_FILES)), wxString::Format(wxT("|*.gcz|%s"), wxGetTranslation(wxALL_FILES)),

View File

@ -13,6 +13,7 @@
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
#include "GeckoCodeDiag.h" #include "GeckoCodeDiag.h"
#include "WxUtils.h"
#include <SFML/Network/Http.hpp> #include <SFML/Network/Http.hpp>
@ -76,7 +77,7 @@ void CodeConfigPanel::UpdateCodeList()
gcodes_end = m_gcodes.end(); gcodes_end = m_gcodes.end();
for (; gcodes_iter!=gcodes_end; ++gcodes_iter) for (; gcodes_iter!=gcodes_end; ++gcodes_iter)
{ {
m_listbox_gcodes->Append(wxString(gcodes_iter->name.c_str(), *wxConvCurrent)); m_listbox_gcodes->Append(StrToWxStr(gcodes_iter->name));
if (gcodes_iter->enabled) if (gcodes_iter->enabled)
m_listbox_gcodes->Check(m_listbox_gcodes->GetCount()-1, true); m_listbox_gcodes->Check(m_listbox_gcodes->GetCount()-1, true);
} }
@ -109,7 +110,7 @@ void CodeConfigPanel::UpdateInfoBox(wxCommandEvent&)
if (sel > -1) if (sel > -1)
{ {
m_infobox.label_name->SetLabel(wxGetTranslation(wxstr_name) + wxString(m_gcodes[sel].name.c_str(), *wxConvCurrent)); m_infobox.label_name->SetLabel(wxGetTranslation(wxstr_name) + StrToWxStr(m_gcodes[sel].name));
// notes textctrl // notes textctrl
m_infobox.textctrl_notes->Clear(); m_infobox.textctrl_notes->Clear();
@ -117,10 +118,10 @@ void CodeConfigPanel::UpdateInfoBox(wxCommandEvent&)
notes_iter = m_gcodes[sel].notes.begin(), notes_iter = m_gcodes[sel].notes.begin(),
notes_end = m_gcodes[sel].notes.end(); notes_end = m_gcodes[sel].notes.end();
for (; notes_iter!=notes_end; ++notes_iter) for (; notes_iter!=notes_end; ++notes_iter)
m_infobox.textctrl_notes->AppendText(wxString(notes_iter->c_str(), *wxConvCurrent)); m_infobox.textctrl_notes->AppendText(StrToWxStr(*notes_iter));
m_infobox.textctrl_notes->ScrollLines(-99); // silly m_infobox.textctrl_notes->ScrollLines(-99); // silly
m_infobox.label_creator->SetLabel(wxGetTranslation(wxstr_creator) + wxString(m_gcodes[sel].creator.c_str(), *wxConvCurrent)); m_infobox.label_creator->SetLabel(wxGetTranslation(wxstr_creator) + StrToWxStr(m_gcodes[sel].creator));
// add codes to info listbox // add codes to info listbox
std::vector<GeckoCode::Code>::const_iterator std::vector<GeckoCode::Code>::const_iterator

View File

@ -28,6 +28,7 @@
#include "StringUtil.h" #include "StringUtil.h"
#include "Hash.h" #include "Hash.h"
#include "IniFile.h" #include "IniFile.h"
#include "WxUtils.h"
#include "Filesystem.h" #include "Filesystem.h"
#include "BannerLoader.h" #include "BannerLoader.h"
@ -331,7 +332,7 @@ const std::string GameListItem::GetWiiFSPath() const
File::CreateFullPath(Path); File::CreateFullPath(Path);
if (Path[0] == '.') if (Path[0] == '.')
ret = std::string(wxGetCwd().mb_str()) + std::string(Path).substr(strlen(ROOT_DIR)); ret = WxStrToStr(wxGetCwd()) + std::string(Path).substr(strlen(ROOT_DIR));
else else
ret = std::string(Path); ret = std::string(Path);
} }

View File

@ -23,6 +23,7 @@
#include "CommonPaths.h" #include "CommonPaths.h"
#include "Globals.h" #include "Globals.h"
#include "WxUtils.h"
#include "VolumeCreator.h" #include "VolumeCreator.h"
#include "Filesystem.h" #include "Filesystem.h"
#include "ISOProperties.h" #include "ISOProperties.h"
@ -663,10 +664,10 @@ void CISOProperties::OnExtractFile(wxCommandEvent& WXUNUSED (event))
{ {
int partitionNum = wxAtoi(File.SubString(10, 11)); int partitionNum = wxAtoi(File.SubString(10, 11));
File.Remove(0, 12); // Remove "Partition x/" File.Remove(0, 12); // Remove "Partition x/"
WiiDisc.at(partitionNum).FileSystem->ExportFile(File.mb_str(), Path.mb_str()); WiiDisc.at(partitionNum).FileSystem->ExportFile(WxStrToStr(File).c_str(), WxStrToStr(Path).c_str());
} }
else else
pFileSystem->ExportFile(File.mb_str(), Path.mb_str()); pFileSystem->ExportFile(WxStrToStr(File).c_str(), WxStrToStr(Path).c_str());
} }
void CISOProperties::ExportDir(const char* _rFullPath, const char* _rExportFolder, const int partitionNum) void CISOProperties::ExportDir(const char* _rFullPath, const char* _rExportFolder, const int partitionNum)
@ -727,7 +728,7 @@ void CISOProperties::ExportDir(const char* _rFullPath, const char* _rExportFolde
(u32)(((float)(i - index[0]) / (float)(index[1] - index[0])) * 100))); (u32)(((float)(i - index[0]) / (float)(index[1] - index[0])) * 100)));
dialog.Update(i, wxString::Format(_("Extracting %s"), dialog.Update(i, wxString::Format(_("Extracting %s"),
wxString(fst[i]->m_FullPath, *wxConvCurrent).c_str())); StrToWxStr(fst[i]->m_FullPath).c_str()));
if (dialog.WasCancelled()) if (dialog.WasCancelled())
break; break;
@ -778,9 +779,9 @@ void CISOProperties::OnExtractDir(wxCommandEvent& event)
{ {
if (DiscIO::IsVolumeWiiDisc(OpenISO)) if (DiscIO::IsVolumeWiiDisc(OpenISO))
for (u32 i = 0; i < WiiDisc.size(); i++) for (u32 i = 0; i < WiiDisc.size(); i++)
ExportDir(NULL, Path.mb_str(), i); ExportDir(NULL, WxStrToStr(Path).c_str(), i);
else else
ExportDir(NULL, Path.mb_str()); ExportDir(NULL, WxStrToStr(Path).c_str());
return; return;
} }
@ -798,10 +799,10 @@ void CISOProperties::OnExtractDir(wxCommandEvent& event)
{ {
int partitionNum = wxAtoi(Directory.SubString(10, 11)); int partitionNum = wxAtoi(Directory.SubString(10, 11));
Directory.Remove(0, 12); // Remove "Partition x/" Directory.Remove(0, 12); // Remove "Partition x/"
ExportDir(Directory.mb_str(), Path.mb_str(), partitionNum); ExportDir(WxStrToStr(Directory).c_str(), WxStrToStr(Path).c_str(), partitionNum);
} }
else else
ExportDir(Directory.mb_str(), Path.mb_str()); ExportDir(WxStrToStr(Directory).c_str(), WxStrToStr(Path).c_str());
} }
void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event) void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event)
@ -821,15 +822,15 @@ void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event)
bool ret = false; bool ret = false;
if (event.GetId() == IDM_EXTRACTAPPLOADER) if (event.GetId() == IDM_EXTRACTAPPLOADER)
{ {
ret = FS->ExportApploader(Path.mb_str()); ret = FS->ExportApploader(WxStrToStr(Path).c_str());
} }
else if (event.GetId() == IDM_EXTRACTDOL) else if (event.GetId() == IDM_EXTRACTDOL)
{ {
ret = FS->ExportDOL(Path.mb_str()); ret = FS->ExportDOL(WxStrToStr(Path).c_str());
} }
if (!ret) if (!ret)
PanicAlertT("Failed to extract to %s!", (const char *)Path.mb_str()); PanicAlertT("Failed to extract to %s!", WxStrToStr(Path).c_str());
} }
class IntegrityCheckThread : public wxThread class IntegrityCheckThread : public wxThread
@ -989,7 +990,7 @@ void CISOProperties::LoadGameConfig()
GameIni.Get("EmuState", "EmulationIssues", &sTemp); GameIni.Get("EmuState", "EmulationIssues", &sTemp);
if (!sTemp.empty()) if (!sTemp.empty())
{ {
EmuIssues->SetValue(wxString(sTemp.c_str(), *wxConvCurrent)); EmuIssues->SetValue(StrToWxStr(sTemp.c_str()));
} }
EmuIssues->Enable(EmuState->GetSelection() != 0); EmuIssues->Enable(EmuState->GetSelection() != 0);
@ -1075,7 +1076,7 @@ bool CISOProperties::SaveGameConfig()
GameIni.Get("EmuState","EmulationIssues", &sTemp); GameIni.Get("EmuState","EmulationIssues", &sTemp);
if (EmuIssues->GetValue() != sTemp) if (EmuIssues->GetValue() != sTemp)
bRefreshList = true; bRefreshList = true;
GameIni.Set("EmuState", "EmulationIssues", (const char*)EmuIssues->GetValue().mb_str(*wxConvCurrent)); GameIni.Set("EmuState", "EmulationIssues", WxStrToStr(EmuIssues->GetValue()));
PatchList_Save(); PatchList_Save();
ActionReplayList_Save(); ActionReplayList_Save();
@ -1156,7 +1157,7 @@ void CISOProperties::PatchList_Load()
for (std::vector<PatchEngine::Patch>::const_iterator it = onFrame.begin(); it != onFrame.end(); ++it) for (std::vector<PatchEngine::Patch>::const_iterator it = onFrame.begin(); it != onFrame.end(); ++it)
{ {
PatchEngine::Patch p = *it; PatchEngine::Patch p = *it;
Patches->Append(wxString(p.name.c_str(), *wxConvCurrent)); Patches->Append(StrToWxStr(p.name.c_str()));
Patches->Check(index, p.active); Patches->Check(index, p.active);
++index; ++index;
} }
@ -1209,7 +1210,7 @@ void CISOProperties::PatchButtonClicked(wxCommandEvent& event)
CPatchAddEdit dlg(-1, this, 1, _("Add Patch")); CPatchAddEdit dlg(-1, this, 1, _("Add Patch"));
if (dlg.ShowModal() == wxID_OK) if (dlg.ShowModal() == wxID_OK)
{ {
Patches->Append(wxString(onFrame.back().name.c_str(), *wxConvCurrent)); Patches->Append(StrToWxStr(onFrame.back().name));
Patches->Check((unsigned int)(onFrame.size() - 1), onFrame.back().active); Patches->Check((unsigned int)(onFrame.size() - 1), onFrame.back().active);
} }
} }
@ -1238,7 +1239,7 @@ void CISOProperties::ActionReplayList_Load()
for (std::vector<ActionReplay::ARCode>::const_iterator it = arCodes.begin(); it != arCodes.end(); ++it) for (std::vector<ActionReplay::ARCode>::const_iterator it = arCodes.begin(); it != arCodes.end(); ++it)
{ {
ActionReplay::ARCode arCode = *it; ActionReplay::ARCode arCode = *it;
Cheats->Append(wxString(arCode.name.c_str(), *wxConvCurrent)); Cheats->Append(StrToWxStr(arCode.name));
Cheats->Check(index, arCode.active); Cheats->Check(index, arCode.active);
++index; ++index;
} }
@ -1256,7 +1257,7 @@ void CISOProperties::ActionReplayList_Save()
for (std::vector<ActionReplay::AREntry>::const_iterator iter2 = code.ops.begin(); iter2 != code.ops.end(); ++iter2) for (std::vector<ActionReplay::AREntry>::const_iterator iter2 = code.ops.begin(); iter2 != code.ops.end(); ++iter2)
{ {
lines.push_back(std::string(wxString::Format(wxT("%08X %08X"), iter2->cmd_addr, iter2->value).mb_str())); lines.push_back(WxStrToStr(wxString::Format(wxT("%08X %08X"), iter2->cmd_addr, iter2->value)));
} }
++index; ++index;
} }
@ -1364,5 +1365,6 @@ void CISOProperties::ChangeBannerDetails(int lang)
std::string filename, extension; std::string filename, extension;
SplitPath(OpenGameListItem->GetFileName(), 0, &filename, &extension); SplitPath(OpenGameListItem->GetFileName(), 0, &filename, &extension);
// Also sets the window's title // Also sets the window's title
SetTitle(wxString(StringFromFormat("%s%s: %s - ", filename.c_str(), extension.c_str(), OpenGameListItem->GetUniqueID().c_str()).c_str(), *wxConvCurrent)+shortName); SetTitle(StrToWxStr(StringFromFormat("%s%s: %s - ", filename.c_str(),
extension.c_str(), OpenGameListItem->GetUniqueID().c_str()).c_str()) + shortName);
} }

View File

@ -17,10 +17,7 @@
#include "InputConfigDiag.h" #include "InputConfigDiag.h"
#include "UDPConfigDiag.h" #include "UDPConfigDiag.h"
#include "WxUtils.h"
#define WXSTR_FROM_STR(s) (wxString::FromUTF8((s).c_str()))
#define WXTSTR_FROM_CSTR(s) (wxGetTranslation(wxString::FromUTF8(s)))
#define STR_FROM_WXSTR(w) (std::string((w).ToUTF8()))
void GamepadPage::ConfigUDPWii(wxCommandEvent &event) void GamepadPage::ConfigUDPWii(wxCommandEvent &event)
{ {
@ -37,7 +34,7 @@ void GamepadPage::ConfigExtension(wxCommandEvent& event)
if (ex->switch_extension) if (ex->switch_extension)
{ {
wxDialog dlg(this, -1, wxDialog dlg(this, -1,
WXTSTR_FROM_CSTR(ex->attachments[ex->switch_extension]->GetName().c_str()), StrToWxStr(ex->attachments[ex->switch_extension]->GetName().c_str()),
wxDefaultPosition, wxDefaultSize); wxDefaultPosition, wxDefaultSize);
wxBoxSizer* const main_szr = new wxBoxSizer(wxVERTICAL); wxBoxSizer* const main_szr = new wxBoxSizer(wxVERTICAL);
@ -67,7 +64,7 @@ PadSettingExtension::PadSettingExtension(wxWindow* const parent, ControllerEmu::
e = extension->attachments.end(); e = extension->attachments.end();
for (; i!=e; ++i) for (; i!=e; ++i)
((wxChoice*)wxcontrol)->Append(WXTSTR_FROM_CSTR((*i)->GetName().c_str())); ((wxChoice*)wxcontrol)->Append(StrToWxStr((*i)->GetName().c_str()));
UpdateGUI(); UpdateGUI();
} }
@ -83,7 +80,7 @@ void PadSettingExtension::UpdateValue()
} }
PadSettingCheckBox::PadSettingCheckBox(wxWindow* const parent, ControlState& _value, const char* const label) PadSettingCheckBox::PadSettingCheckBox(wxWindow* const parent, ControlState& _value, const char* const label)
: PadSetting(new wxCheckBox(parent, -1, WXTSTR_FROM_CSTR(label), wxDefaultPosition)) : PadSetting(new wxCheckBox(parent, -1, StrToWxStr(label), wxDefaultPosition))
, value(_value) , value(_value)
{ {
UpdateGUI(); UpdateGUI();
@ -119,8 +116,8 @@ ControlDialog::ControlDialog(GamepadPage* const parent, InputPlugin& plugin, Con
m_devq = m_parent->controller->default_device; m_devq = m_parent->controller->default_device;
// GetStrings() sounds slow :/ // GetStrings() sounds slow :/
//device_cbox = new wxComboBox(this, -1, WXSTR_FROM_STR(ref->device_qualifier.ToString()), wxDefaultPosition, wxSize(256,-1), parent->device_cbox->GetStrings(), wxTE_PROCESS_ENTER); //device_cbox = new wxComboBox(this, -1, StrToWxStr(ref->device_qualifier.ToString()), wxDefaultPosition, wxSize(256,-1), parent->device_cbox->GetStrings(), wxTE_PROCESS_ENTER);
device_cbox = new wxComboBox(this, -1, WXSTR_FROM_STR(m_devq.ToString()), wxDefaultPosition, wxSize(256,-1), parent->device_cbox->GetStrings(), wxTE_PROCESS_ENTER); device_cbox = new wxComboBox(this, -1, StrToWxStr(m_devq.ToString()), wxDefaultPosition, wxSize(256,-1), parent->device_cbox->GetStrings(), wxTE_PROCESS_ENTER);
device_cbox->Bind(wxEVT_COMMAND_COMBOBOX_SELECTED, &ControlDialog::SetDevice, this); device_cbox->Bind(wxEVT_COMMAND_COMBOBOX_SELECTED, &ControlDialog::SetDevice, this);
device_cbox->Bind(wxEVT_COMMAND_TEXT_ENTER, &ControlDialog::SetDevice, this); device_cbox->Bind(wxEVT_COMMAND_TEXT_ENTER, &ControlDialog::SetDevice, this);
@ -145,9 +142,9 @@ ControlButton::ControlButton(wxWindow* const parent, ControllerInterface::Contro
, control_reference(_ref) , control_reference(_ref)
{ {
if (label.empty()) if (label.empty())
SetLabel(WXSTR_FROM_STR(_ref->expression)); SetLabel(StrToWxStr(_ref->expression));
else else
SetLabel(WXSTR_FROM_STR(label)); SetLabel(StrToWxStr(label));
} }
void InputConfigDialog::UpdateProfileComboBox() void InputConfigDialog::UpdateProfileComboBox()
@ -169,7 +166,7 @@ void InputConfigDialog::UpdateProfileComboBox()
for (; si!=se; ++si) for (; si!=se; ++si)
{ {
std::string str(si->begin() + si->find_last_of('/') + 1 , si->end() - 4) ; std::string str(si->begin() + si->find_last_of('/') + 1 , si->end() - 4) ;
strs.push_back(WXSTR_FROM_STR(str)); strs.push_back(StrToWxStr(str));
} }
std::vector< GamepadPage* >::iterator i = m_padpages.begin(), std::vector< GamepadPage* >::iterator i = m_padpages.begin(),
@ -209,7 +206,7 @@ void ControlDialog::UpdateListContents()
i = dev->Inputs().begin(), i = dev->Inputs().begin(),
e = dev->Inputs().end(); e = dev->Inputs().end();
for (; i!=e; ++i) for (; i!=e; ++i)
control_lbox->Append(WXSTR_FROM_STR((*i)->GetName())); control_lbox->Append(StrToWxStr((*i)->GetName()));
} }
else else
{ {
@ -218,7 +215,7 @@ void ControlDialog::UpdateListContents()
i = dev->Outputs().begin(), i = dev->Outputs().begin(),
e = dev->Outputs().end(); e = dev->Outputs().end();
for (; i!=e; ++i) for (; i!=e; ++i)
control_lbox->Append(WXSTR_FROM_STR((*i)->GetName())); control_lbox->Append(StrToWxStr((*i)->GetName()));
} }
} }
} }
@ -227,7 +224,7 @@ void ControlDialog::SelectControl(const std::string& name)
{ {
//UpdateGUI(); //UpdateGUI();
const int f = control_lbox->FindString(WXSTR_FROM_STR(name)); const int f = control_lbox->FindString(StrToWxStr(name));
if (f >= 0) if (f >= 0)
control_lbox->Select(f); control_lbox->Select(f);
} }
@ -235,7 +232,7 @@ void ControlDialog::SelectControl(const std::string& name)
void ControlDialog::UpdateGUI() void ControlDialog::UpdateGUI()
{ {
// update textbox // update textbox
textctrl->SetValue(WXSTR_FROM_STR(control_reference->expression)); textctrl->SetValue(StrToWxStr(control_reference->expression));
// updates the "bound controls:" label // updates the "bound controls:" label
m_bound_label->SetLabel(wxString::Format(_("Bound Controls: %lu"), m_bound_label->SetLabel(wxString::Format(_("Bound Controls: %lu"),
@ -244,7 +241,7 @@ void ControlDialog::UpdateGUI()
void GamepadPage::UpdateGUI() void GamepadPage::UpdateGUI()
{ {
device_cbox->SetValue(WXSTR_FROM_STR(controller->default_device.ToString())); device_cbox->SetValue(StrToWxStr(controller->default_device.ToString()));
std::vector< ControlGroupBox* >::const_iterator g = control_groups.begin(), std::vector< ControlGroupBox* >::const_iterator g = control_groups.begin(),
ge = control_groups.end(); ge = control_groups.end();
@ -255,7 +252,7 @@ void GamepadPage::UpdateGUI()
, e = (*g)->control_buttons.end(); , e = (*g)->control_buttons.end();
for (; i!=e; ++i) for (; i!=e; ++i)
//if (std::string::npos == (*i)->control_reference->expression.find_first_of("`|&!#")) //if (std::string::npos == (*i)->control_reference->expression.find_first_of("`|&!#"))
(*i)->SetLabel(WXSTR_FROM_STR((*i)->control_reference->expression)); (*i)->SetLabel(StrToWxStr((*i)->control_reference->expression));
//else //else
//(*i)->SetLabel(wxT("...")); //(*i)->SetLabel(wxT("..."));
@ -294,7 +291,7 @@ void GamepadPage::LoadDefaults(wxCommandEvent&)
void ControlDialog::SetControl(wxCommandEvent&) void ControlDialog::SetControl(wxCommandEvent&)
{ {
control_reference->expression = STR_FROM_WXSTR(textctrl->GetValue()); control_reference->expression = WxStrToStr(textctrl->GetValue());
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock); std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device); g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
@ -304,10 +301,10 @@ void ControlDialog::SetControl(wxCommandEvent&)
void GamepadPage::SetDevice(wxCommandEvent&) void GamepadPage::SetDevice(wxCommandEvent&)
{ {
controller->default_device.FromString(STR_FROM_WXSTR(device_cbox->GetValue())); controller->default_device.FromString(WxStrToStr(device_cbox->GetValue()));
// show user what it was validated as // show user what it was validated as
device_cbox->SetValue(WXSTR_FROM_STR(controller->default_device.ToString())); device_cbox->SetValue(StrToWxStr(controller->default_device.ToString()));
// this will set all the controls to this default device // this will set all the controls to this default device
controller->UpdateDefaultDevice(); controller->UpdateDefaultDevice();
@ -319,10 +316,10 @@ void GamepadPage::SetDevice(wxCommandEvent&)
void ControlDialog::SetDevice(wxCommandEvent&) void ControlDialog::SetDevice(wxCommandEvent&)
{ {
m_devq.FromString(STR_FROM_WXSTR(device_cbox->GetValue())); m_devq.FromString(WxStrToStr(device_cbox->GetValue()));
// show user what it was validated as // show user what it was validated as
device_cbox->SetValue(WXSTR_FROM_STR(m_devq.ToString())); device_cbox->SetValue(StrToWxStr(m_devq.ToString()));
// update gui // update gui
UpdateListContents(); UpdateListContents();
@ -349,12 +346,12 @@ void ControlDialog::SetSelectedControl(wxCommandEvent&)
// non-default device // non-default device
if (false == (m_devq == m_parent->controller->default_device)) if (false == (m_devq == m_parent->controller->default_device))
expr.append(wxT('`')).append(WXSTR_FROM_STR(m_devq.ToString())).append(wxT('`')); expr.append(wxT('`')).append(StrToWxStr(m_devq.ToString())).append(wxT('`'));
// append the control name // append the control name
expr += control_lbox->GetString(num); expr += control_lbox->GetString(num);
control_reference->expression = STR_FROM_WXSTR(expr); control_reference->expression = WxStrToStr(expr);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock); std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device); g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
@ -380,12 +377,12 @@ void ControlDialog::AppendControl(wxCommandEvent& event)
// non-default device // non-default device
if (false == (m_devq == m_parent->controller->default_device)) if (false == (m_devq == m_parent->controller->default_device))
expr.append(wxT('`')).append(WXSTR_FROM_STR(m_devq.ToString())).append(wxT('`')); expr.append(wxT('`')).append(StrToWxStr(m_devq.ToString())).append(wxT('`'));
// append the control name // append the control name
expr += control_lbox->GetString(num); expr += control_lbox->GetString(num);
control_reference->expression = STR_FROM_WXSTR(expr); control_reference->expression = WxStrToStr(expr);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock); std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device); g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
@ -475,7 +472,7 @@ void GamepadPage::DetectControl(wxCommandEvent& event)
g_controller_interface.UpdateReference(btn->control_reference, controller->default_device); g_controller_interface.UpdateReference(btn->control_reference, controller->default_device);
} }
btn->SetLabel(WXSTR_FROM_STR(btn->control_reference->expression)); btn->SetLabel(StrToWxStr(btn->control_reference->expression));
} }
} }
@ -565,7 +562,7 @@ void GamepadPage::GetProfilePath(std::string& path)
path += PROFILES_PATH; path += PROFILES_PATH;
path += m_plugin.profile_name; path += m_plugin.profile_name;
path += '/'; path += '/';
path += STR_FROM_WXSTR(profile_cbox->GetValue()); path += WxStrToStr(profile_cbox->GetValue());
path += ".ini"; path += ".ini";
} }
} }
@ -615,7 +612,7 @@ void GamepadPage::DeleteProfile(wxCommandEvent&)
if (File::Exists(fnamecstr) && if (File::Exists(fnamecstr) &&
AskYesNoT("Are you sure you want to delete \"%s\"?", AskYesNoT("Are you sure you want to delete \"%s\"?",
STR_FROM_WXSTR(profile_cbox->GetValue()).c_str())) WxStrToStr(profile_cbox->GetValue()).c_str()))
{ {
File::Delete(fnamecstr); File::Delete(fnamecstr);
@ -637,9 +634,9 @@ void InputConfigDialog::UpdateDeviceComboBox()
for (; di!=de; ++di) for (; di!=de; ++di)
{ {
dq.FromDevice(*di); dq.FromDevice(*di);
(*i)->device_cbox->Append(WXSTR_FROM_STR(dq.ToString())); (*i)->device_cbox->Append(StrToWxStr(dq.ToString()));
} }
(*i)->device_cbox->SetValue(WXSTR_FROM_STR((*i)->controller->default_device.ToString())); (*i)->device_cbox->SetValue(StrToWxStr((*i)->controller->default_device.ToString()));
} }
} }
@ -680,7 +677,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
for (; ci != ce; ++ci) for (; ci != ce; ++ci)
{ {
wxStaticText* const label = new wxStaticText(parent, -1, WXTSTR_FROM_CSTR((*ci)->name)); wxStaticText* const label = new wxStaticText(parent, -1, StrToWxStr((*ci)->name));
ControlButton* const control_button = new ControlButton(parent, (*ci)->control_ref, 80); ControlButton* const control_button = new ControlButton(parent, (*ci)->control_ref, 80);
control_button->SetFont(m_SmallFont); control_button->SetFont(m_SmallFont);
@ -734,7 +731,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
PadSettingSpin* setting = new PadSettingSpin(parent, *i); PadSettingSpin* setting = new PadSettingSpin(parent, *i);
setting->wxcontrol->Bind(wxEVT_COMMAND_SPINCTRL_UPDATED, &GamepadPage::AdjustSetting, eventsink); setting->wxcontrol->Bind(wxEVT_COMMAND_SPINCTRL_UPDATED, &GamepadPage::AdjustSetting, eventsink);
options.push_back(setting); options.push_back(setting);
szr->Add(new wxStaticText(parent, -1, WXTSTR_FROM_CSTR((*i)->name))); szr->Add(new wxStaticText(parent, -1, StrToWxStr((*i)->name)));
szr->Add(setting->wxcontrol, 0, wxLEFT, 0); szr->Add(setting->wxcontrol, 0, wxLEFT, 0);
} }
@ -760,7 +757,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
options.push_back(threshold_cbox); options.push_back(threshold_cbox);
wxBoxSizer* const szr = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* const szr = new wxBoxSizer(wxHORIZONTAL);
szr->Add(new wxStaticText(parent, -1, WXTSTR_FROM_CSTR(group->settings[0]->name)), szr->Add(new wxStaticText(parent, -1, StrToWxStr(group->settings[0]->name)),
0, wxCENTER|wxRIGHT, 3); 0, wxCENTER|wxRIGHT, 3);
szr->Add(threshold_cbox->wxcontrol, 0, wxRIGHT, 3); szr->Add(threshold_cbox->wxcontrol, 0, wxRIGHT, 3);
@ -795,7 +792,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
setting->wxcontrol->Bind(wxEVT_COMMAND_SPINCTRL_UPDATED, &GamepadPage::AdjustSetting, eventsink); setting->wxcontrol->Bind(wxEVT_COMMAND_SPINCTRL_UPDATED, &GamepadPage::AdjustSetting, eventsink);
options.push_back(setting); options.push_back(setting);
wxBoxSizer* const szr = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* const szr = new wxBoxSizer(wxHORIZONTAL);
szr->Add(new wxStaticText(parent, -1, WXTSTR_FROM_CSTR((*i)->name)), 0, wxCENTER|wxRIGHT, 3); szr->Add(new wxStaticText(parent, -1, StrToWxStr((*i)->name)), 0, wxCENTER|wxRIGHT, 3);
szr->Add(setting->wxcontrol, 0, wxRIGHT, 3); szr->Add(setting->wxcontrol, 0, wxRIGHT, 3);
Add(szr, 0, wxALL|wxCENTER, 3); Add(szr, 0, wxALL|wxCENTER, 3);
} }
@ -859,7 +856,7 @@ ControlGroupsSizer::ControlGroupsSizer(ControllerEmu* const controller, wxWindow
{ {
ControlGroupBox* control_group_box = new ControlGroupBox(controller->groups[i], parent, eventsink); ControlGroupBox* control_group_box = new ControlGroupBox(controller->groups[i], parent, eventsink);
wxStaticBoxSizer *control_group = wxStaticBoxSizer *control_group =
new wxStaticBoxSizer(wxVERTICAL, parent, WXTSTR_FROM_CSTR(controller->groups[i]->name)); new wxStaticBoxSizer(wxVERTICAL, parent, StrToWxStr(controller->groups[i]->name));
control_group->Add(control_group_box); control_group->Add(control_group_box);
const size_t grp_size = controller->groups[i]->controls.size() + controller->groups[i]->settings.size(); const size_t grp_size = controller->groups[i]->controls.size() + controller->groups[i]->settings.size();
@ -955,7 +952,7 @@ GamepadPage::GamepadPage(wxWindow* parent, InputPlugin& plugin, const unsigned i
InputConfigDialog::InputConfigDialog(wxWindow* const parent, InputPlugin& plugin, const std::string& name, const int tab_num) InputConfigDialog::InputConfigDialog(wxWindow* const parent, InputPlugin& plugin, const std::string& name, const int tab_num)
: wxDialog(parent, wxID_ANY, WXTSTR_FROM_CSTR(name.c_str()), wxPoint(128,-1), wxDefaultSize) : wxDialog(parent, wxID_ANY, StrToWxStr(name.c_str()), wxPoint(128,-1), wxDefaultSize)
, m_plugin(plugin) , m_plugin(plugin)
{ {
m_pad_notebook = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT); m_pad_notebook = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT);
@ -963,7 +960,7 @@ InputConfigDialog::InputConfigDialog(wxWindow* const parent, InputPlugin& plugin
{ {
GamepadPage* gp = new GamepadPage(m_pad_notebook, m_plugin, i, this); GamepadPage* gp = new GamepadPage(m_pad_notebook, m_plugin, i, this);
m_padpages.push_back(gp); m_padpages.push_back(gp);
m_pad_notebook->AddPage(gp, wxString::Format(wxT("%s %u"), WXTSTR_FROM_CSTR(m_plugin.gui_name), 1+i)); m_pad_notebook->AddPage(gp, wxString::Format(wxT("%s %u"), StrToWxStr(m_plugin.gui_name), 1+i));
} }
m_pad_notebook->SetSelection(tab_num); m_pad_notebook->SetSelection(tab_num);

View File

@ -16,6 +16,7 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "InputConfigDiag.h" #include "InputConfigDiag.h"
#include "WxUtils.h"
void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event)) void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
{ {
@ -48,7 +49,7 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
// label for sticks and stuff // label for sticks and stuff
if (64 == bitmap.GetHeight()) if (64 == bitmap.GetHeight())
dc.DrawText(wxString::FromAscii((*g)->control_group->name).Upper(), 4, 2); dc.DrawText(StrToWxStr((*g)->control_group->name).Upper(), 4, 2);
switch ( (*g)->control_group->type ) switch ( (*g)->control_group->type )
{ {
@ -227,7 +228,7 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
// text // text
const char* const name = (*g)->control_group->controls[n]->name; const char* const name = (*g)->control_group->controls[n]->name;
// bit of hax so ZL, ZR show up as L, R // bit of hax so ZL, ZR show up as L, R
dc.DrawText(wxString::FromAscii((name[1] && name[1] < 'a') ? name[1] : name[0]), n*12 + 2, 1); dc.DrawText(StrToWxStr((name[1] && name[1] < 'a') ? name[1] : name[0]), n*12 + 2, 1);
} }
delete[] bitmasks; delete[] bitmasks;
@ -263,7 +264,7 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
dc.DrawRectangle(0, n*12, trigs[n], 14); dc.DrawRectangle(0, n*12, trigs[n], 14);
// text // text
dc.DrawText(wxString::FromAscii((*g)->control_group->controls[n]->name), 3, n*12 + 1); dc.DrawText(StrToWxStr((*g)->control_group->controls[n]->name), 3, n*12 + 1);
} }
delete[] trigs; delete[] trigs;
@ -298,8 +299,8 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
dc.DrawRectangle(64, n*12, 32, 14); dc.DrawRectangle(64, n*12, 32, 14);
// text // text
dc.DrawText(wxString::FromAscii((*g)->control_group->controls[n+trigger_count]->name), 3, n*12 + 1); dc.DrawText(StrToWxStr((*g)->control_group->controls[n+trigger_count]->name), 3, n*12 + 1);
dc.DrawText(wxString::FromAscii((*g)->control_group->controls[n]->name[0]), 64 + 3, n*12 + 1); dc.DrawText(StrToWxStr((*g)->control_group->controls[n]->name[0]), 64 + 3, n*12 + 1);
} }
// threshold box // threshold box

View File

@ -20,6 +20,7 @@
#include "ConsoleListener.h" #include "ConsoleListener.h"
#include "LogWindow.h" #include "LogWindow.h"
#include "FileUtil.h" #include "FileUtil.h"
#include "WxUtils.h"
LogConfigWindow::LogConfigWindow(wxWindow* parent, CLogWindow *log_window, wxWindowID id) LogConfigWindow::LogConfigWindow(wxWindow* parent, CLogWindow *log_window, wxWindowID id)
: wxPanel(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _("Log Configuration")) : wxPanel(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _("Log Configuration"))
@ -74,7 +75,7 @@ void LogConfigWindow::CreateGUIControls()
m_checks = new wxCheckListBox(this, wxID_ANY); m_checks = new wxCheckListBox(this, wxID_ANY);
m_checks->Bind(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, &LogConfigWindow::OnLogCheck, this); m_checks->Bind(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, &LogConfigWindow::OnLogCheck, this);
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++) for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
m_checks->Append(wxString::FromAscii(m_LogManager->GetFullName((LogTypes::LOG_TYPE)i))); m_checks->Append(StrToWxStr(m_LogManager->GetFullName((LogTypes::LOG_TYPE)i)));
// Sizers // Sizers
wxStaticBoxSizer* sbOutputs = new wxStaticBoxSizer(wxVERTICAL, this, _("Logger Outputs")); wxStaticBoxSizer* sbOutputs = new wxStaticBoxSizer(wxVERTICAL, this, _("Logger Outputs"));

View File

@ -32,6 +32,7 @@
#include "Host.h" // Core #include "Host.h" // Core
#include "HW/Wiimote.h" #include "HW/Wiimote.h"
#include "WxUtils.h"
#include "Globals.h" // Local #include "Globals.h" // Local
#include "Main.h" #include "Main.h"
#include "ConfigManager.h" #include "ConfigManager.h"
@ -211,7 +212,7 @@ bool DolphinApp::OnInit()
} }
#ifdef _WIN32 #ifdef _WIN32
if (!wxSetWorkingDirectory(wxString(File::GetExeDirectory().c_str(), *wxConvCurrent))) if (!wxSetWorkingDirectory(StrToWxStr(File::GetExeDirectory())))
{ {
INFO_LOG(CONSOLE, "set working directory failed"); INFO_LOG(CONSOLE, "set working directory failed");
} }
@ -246,7 +247,7 @@ bool DolphinApp::OnInit()
if (selectVideoBackend && videoBackendName != wxEmptyString) if (selectVideoBackend && videoBackendName != wxEmptyString)
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend =
std::string(videoBackendName.mb_str()); WxStrToStr(videoBackendName);
if (selectAudioEmulation) if (selectAudioEmulation)
{ {
@ -296,7 +297,7 @@ bool DolphinApp::OnInit()
#endif #endif
main_frame = new CFrame((wxFrame*)NULL, wxID_ANY, main_frame = new CFrame((wxFrame*)NULL, wxID_ANY,
wxString::FromAscii(scm_rev_str), StrToWxStr(scm_rev_str),
wxPoint(x, y), wxSize(w, h), wxPoint(x, y), wxSize(w, h),
UseDebugger, BatchMode, UseLogger); UseDebugger, BatchMode, UseLogger);
SetTopWindow(main_frame); SetTopWindow(main_frame);
@ -317,7 +318,7 @@ void DolphinApp::MacOpenFile(const wxString &fileName)
LoadFile = true; LoadFile = true;
if (m_afterinit == NULL) if (m_afterinit == NULL)
main_frame->BootGame(std::string(FileToLoad.mb_str())); main_frame->BootGame(WxStrToStr(FileToLoad));
} }
void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event)) void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event))
@ -331,7 +332,7 @@ void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event))
// First check if we have an exec command line. // First check if we have an exec command line.
if (LoadFile && FileToLoad != wxEmptyString) if (LoadFile && FileToLoad != wxEmptyString)
{ {
main_frame->BootGame(std::string(FileToLoad.mb_str())); main_frame->BootGame(WxStrToStr(FileToLoad));
} }
// If we have selected Automatic Start, start the default ISO, // If we have selected Automatic Start, start the default ISO,
// or if no default ISO exists, start the last loaded ISO // or if no default ISO exists, start the last loaded ISO
@ -418,7 +419,7 @@ void Host_SysMessage(const char *fmt, ...)
va_end(list); va_end(list);
if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0; if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0;
//wxMessageBox(wxString::FromAscii(msg)); //wxMessageBox(StrToWxStr(msg));
PanicAlert("%s", msg); PanicAlert("%s", msg);
} }
@ -427,14 +428,13 @@ bool wxMsgAlert(const char* caption, const char* text, bool yes_no, int /*Style*
#ifdef __WXGTK__ #ifdef __WXGTK__
if (wxIsMainThread()) if (wxIsMainThread())
#endif #endif
return wxYES == wxMessageBox(wxString::FromUTF8(text), return wxYES == wxMessageBox(StrToWxStr(text), StrToWxStr(caption),
wxString::FromUTF8(caption),
(yes_no) ? wxYES_NO : wxOK, wxGetActiveWindow()); (yes_no) ? wxYES_NO : wxOK, wxGetActiveWindow());
#ifdef __WXGTK__ #ifdef __WXGTK__
else else
{ {
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_PANIC); wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_PANIC);
event.SetString(wxString::FromUTF8(caption) + wxT(":") + wxString::FromUTF8(text)); event.SetString(StrToWxStr(caption) + wxT(":") + StrToWxStr(text));
event.SetInt(yes_no); event.SetInt(yes_no);
main_frame->GetEventHandler()->AddPendingEvent(event); main_frame->GetEventHandler()->AddPendingEvent(event);
main_frame->panic_event.Wait(); main_frame->panic_event.Wait();
@ -445,7 +445,7 @@ bool wxMsgAlert(const char* caption, const char* text, bool yes_no, int /*Style*
std::string wxStringTranslator(const char *text) std::string wxStringTranslator(const char *text)
{ {
return (const char *)wxString(wxGetTranslation(wxString::From8BitData(text))).ToUTF8(); return WxStrToStr(wxGetTranslation(wxString::From8BitData(text)));
} }
// Accessor for the main window class // Accessor for the main window class
@ -536,7 +536,7 @@ void Host_UpdateMainFrame()
void Host_UpdateTitle(const char* title) void Host_UpdateTitle(const char* title)
{ {
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATETITLE); wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATETITLE);
event.SetString(wxString::FromAscii(title)); event.SetString(StrToWxStr(title));
main_frame->GetEventHandler()->AddPendingEvent(event); main_frame->GetEventHandler()->AddPendingEvent(event);
} }
@ -603,7 +603,7 @@ void Host_UpdateStatusBar(const char* _pText, int Field)
{ {
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATESTATUSBAR); wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATESTATUSBAR);
// Set the event string // Set the event string
event.SetString(wxString::FromAscii(_pText)); event.SetString(StrToWxStr(_pText));
// Update statusbar field // Update statusbar field
event.SetInt(Field); event.SetInt(Field);
// Post message // Post message

View File

@ -17,6 +17,8 @@
#include "MemcardManager.h" #include "MemcardManager.h"
#include "Common.h" #include "Common.h"
#include "WxUtils.h"
#include "wx/mstream.h" #include "wx/mstream.h"
#define ARROWS slot ? _T("") : ARROW[slot], slot ? ARROW[slot] : _T("") #define ARROWS slot ? _T("") : ARROW[slot], slot ? ARROW[slot] : _T("")
@ -290,7 +292,7 @@ void CMemcardManager::ChangePath(int slot)
} }
else else
{ {
if (m_MemcardPath[slot]->GetPath().length() && ReloadMemcard(m_MemcardPath[slot]->GetPath().mb_str(), slot)) if (m_MemcardPath[slot]->GetPath().length() && ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()).c_str(), slot))
{ {
if (memoryCard[slot2]) if (memoryCard[slot2])
{ {
@ -345,7 +347,7 @@ void CMemcardManager::OnPageChange(wxCommandEvent& event)
m_NextPage[slot]->Disable(); m_NextPage[slot]->Disable();
m_MemcardList[slot]->nextPage = false; m_MemcardList[slot]->nextPage = false;
} }
ReloadMemcard(m_MemcardPath[slot]->GetPath().mb_str(), slot); ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()).c_str(), slot);
break; break;
case ID_PREVPAGE_A: case ID_PREVPAGE_A:
slot = SLOT_A; slot = SLOT_A;
@ -361,7 +363,7 @@ void CMemcardManager::OnPageChange(wxCommandEvent& event)
m_PrevPage[slot]->Disable(); m_PrevPage[slot]->Disable();
m_MemcardList[slot]->prevPage = false; m_MemcardList[slot]->prevPage = false;
} }
ReloadMemcard(m_MemcardPath[slot]->GetPath().mb_str(), slot); ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()).c_str(), slot);
break; break;
} }
} }
@ -373,7 +375,7 @@ void CMemcardManager::OnMenuChange(wxCommandEvent& event)
{ {
case ID_MEMCARDPATH_A: case ID_MEMCARDPATH_A:
case ID_MEMCARDPATH_B: case ID_MEMCARDPATH_B:
DefaultMemcard[_id - ID_MEMCARDPATH_A] = m_MemcardPath[_id - ID_MEMCARDPATH_A]->GetPath().mb_str(); DefaultMemcard[_id - ID_MEMCARDPATH_A] = WxStrToStr(m_MemcardPath[_id - ID_MEMCARDPATH_A]->GetPath());
return; return;
case ID_USEPAGES: case ID_USEPAGES:
mcmSettings.usePages = !mcmSettings.usePages; mcmSettings.usePages = !mcmSettings.usePages;
@ -400,8 +402,8 @@ void CMemcardManager::OnMenuChange(wxCommandEvent& event)
break; break;
} }
if (memoryCard[SLOT_A]) ReloadMemcard(m_MemcardPath[SLOT_A]->GetPath().mb_str(), SLOT_A); if (memoryCard[SLOT_A]) ReloadMemcard(WxStrToStr(m_MemcardPath[SLOT_A]->GetPath()).c_str(), SLOT_A);
if (memoryCard[SLOT_B]) ReloadMemcard(m_MemcardPath[SLOT_B]->GetPath().mb_str(), SLOT_B); if (memoryCard[SLOT_B]) ReloadMemcard(WxStrToStr(m_MemcardPath[SLOT_B]->GetPath()).c_str(), SLOT_B);
} }
bool CMemcardManager::CopyDeleteSwitch(u32 error, int slot) bool CMemcardManager::CopyDeleteSwitch(u32 error, int slot)
{ {
@ -416,7 +418,7 @@ bool CMemcardManager::CopyDeleteSwitch(u32 error, int slot)
memoryCard[slot]->FixChecksums(); memoryCard[slot]->FixChecksums();
if (!memoryCard[slot]->Save()) PanicAlert(E_SAVEFAILED); if (!memoryCard[slot]->Save()) PanicAlert(E_SAVEFAILED);
page[slot] = FIRSTPAGE; page[slot] = FIRSTPAGE;
ReloadMemcard(m_MemcardPath[slot]->GetPath().mb_str(), slot); ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()).c_str(), slot);
} }
break; break;
case NOMEMCARD: case NOMEMCARD:
@ -517,7 +519,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
wxString fileName = wxFileSelector( wxString fileName = wxFileSelector(
_("Select a save file to import"), _("Select a save file to import"),
(strcmp(DefaultIOPath.c_str(), "/Users/GC") == 0) (strcmp(DefaultIOPath.c_str(), "/Users/GC") == 0)
? wxString::FromAscii("") ? StrToWxStr("")
: wxString::From8BitData(DefaultIOPath.c_str()), : wxString::From8BitData(DefaultIOPath.c_str()),
wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString,
_("GameCube Savegame files(*.gci;*.gcs;*.sav)") + wxString(wxT("|*.gci;*.gcs;*.sav|")) + _("GameCube Savegame files(*.gci;*.gcs;*.sav)") + wxString(wxT("|*.gci;*.gcs;*.sav|")) +
@ -532,11 +534,11 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
_("GCI File(*.gci)") + wxString(_T("|*.gci")), _("GCI File(*.gci)") + wxString(_T("|*.gci")),
wxFD_OVERWRITE_PROMPT|wxFD_SAVE, this); wxFD_OVERWRITE_PROMPT|wxFD_SAVE, this);
if (temp2.empty()) break; if (temp2.empty()) break;
fileName2 = temp2.mb_str(); fileName2 = WxStrToStr(temp2);
} }
if (fileName.length() > 0) if (fileName.length() > 0)
{ {
CopyDeleteSwitch(memoryCard[slot]->ImportGci(fileName.mb_str(), fileName2), slot); CopyDeleteSwitch(memoryCard[slot]->ImportGci(WxStrToStr(fileName).c_str(), fileName2), slot);
} }
} }
break; break;
@ -564,9 +566,9 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
if (fileName.length() > 0) if (fileName.length() > 0)
{ {
if (!CopyDeleteSwitch(memoryCard[slot]->ExportGci(index, fileName.mb_str(), ""), -1)) if (!CopyDeleteSwitch(memoryCard[slot]->ExportGci(index, WxStrToStr(fileName).c_str(), ""), -1))
{ {
File::Delete(std::string(fileName.mb_str())); File::Delete(WxStrToStr(fileName));
} }
} }
} }
@ -576,7 +578,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
case ID_EXPORTALL_B: case ID_EXPORTALL_B:
{ {
std::string path1, path2, mpath; std::string path1, path2, mpath;
mpath = m_MemcardPath[slot]->GetPath().mb_str(); mpath = WxStrToStr(m_MemcardPath[slot]->GetPath());
SplitPath(mpath, &path1, &path2, NULL); SplitPath(mpath, &path1, &path2, NULL);
path1 += path2; path1 += path2;
File::CreateDir(path1); File::CreateDir(path1);

View File

@ -18,6 +18,7 @@
#include <FileUtil.h> #include <FileUtil.h>
#include <IniFile.h> #include <IniFile.h>
#include "WxUtils.h"
#include "NetPlay.h" #include "NetPlay.h"
#include "NetWindow.h" #include "NetWindow.h"
#include "Frame.h" #include "Frame.h"
@ -72,7 +73,7 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl*
std::string address; std::string address;
netplay_section.Get("Address", &address, "localhost"); netplay_section.Get("Address", &address, "localhost");
m_connect_ip_text = new wxTextCtrl(connect_tab, wxID_ANY, wxString::FromAscii(address.c_str())); m_connect_ip_text = new wxTextCtrl(connect_tab, wxID_ANY, StrToWxStr(address.c_str()));
wxStaticText* const port_lbl = new wxStaticText(connect_tab, wxID_ANY, _("Port :"), wxStaticText* const port_lbl = new wxStaticText(connect_tab, wxID_ANY, _("Port :"),
wxDefaultPosition, wxDefaultSize); wxDefaultPosition, wxDefaultSize);
@ -80,7 +81,7 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl*
// string? w/e // string? w/e
std::string port; std::string port;
netplay_section.Get("ConnectPort", &port, "2626"); netplay_section.Get("ConnectPort", &port, "2626");
m_connect_port_text = new wxTextCtrl(connect_tab, wxID_ANY, wxString::FromAscii(port.c_str())); m_connect_port_text = new wxTextCtrl(connect_tab, wxID_ANY, StrToWxStr(port.c_str()));
wxButton* const connect_btn = new wxButton(connect_tab, wxID_ANY, _("Connect")); wxButton* const connect_btn = new wxButton(connect_tab, wxID_ANY, _("Connect"));
connect_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &NetPlaySetupDiag::OnJoin, this); connect_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &NetPlaySetupDiag::OnJoin, this);
@ -113,7 +114,7 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl*
// string? w/e // string? w/e
std::string port; std::string port;
netplay_section.Get("HostPort", &port, "2626"); netplay_section.Get("HostPort", &port, "2626");
m_host_port_text = new wxTextCtrl(host_tab, wxID_ANY, wxString::FromAscii(port.c_str())); m_host_port_text = new wxTextCtrl(host_tab, wxID_ANY, StrToWxStr(port.c_str()));
wxButton* const host_btn = new wxButton(host_tab, wxID_ANY, _("Host")); wxButton* const host_btn = new wxButton(host_tab, wxID_ANY, _("Host"));
host_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &NetPlaySetupDiag::OnHost, this); host_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &NetPlaySetupDiag::OnHost, this);
@ -124,7 +125,7 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl*
std::istringstream ss(game_list->GetGameNames()); std::istringstream ss(game_list->GetGameNames());
std::string game; std::string game;
while (std::getline(ss,game)) while (std::getline(ss,game))
m_game_lbox->Append(wxString(game.c_str(), *wxConvCurrent)); m_game_lbox->Append(StrToWxStr(game));
wxBoxSizer* const top_szr = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* const top_szr = new wxBoxSizer(wxHORIZONTAL);
top_szr->Add(port_lbl, 0, wxCENTER | wxRIGHT, 5); top_szr->Add(port_lbl, 0, wxCENTER | wxRIGHT, 5);
@ -167,10 +168,10 @@ NetPlaySetupDiag::~NetPlaySetupDiag()
inifile.Load(dolphin_ini); inifile.Load(dolphin_ini);
IniFile::Section& netplay_section = *inifile.GetOrCreateSection("NetPlay"); IniFile::Section& netplay_section = *inifile.GetOrCreateSection("NetPlay");
netplay_section.Set("Nickname", m_nickname_text->GetValue().mb_str()); netplay_section.Set("Nickname", WxStrToStr(m_nickname_text->GetValue()));
netplay_section.Set("Address", m_connect_ip_text->GetValue().mb_str()); netplay_section.Set("Address", WxStrToStr(m_connect_ip_text->GetValue()));
netplay_section.Set("ConnectPort", m_connect_port_text->GetValue().mb_str()); netplay_section.Set("ConnectPort", WxStrToStr(m_connect_port_text->GetValue()));
netplay_section.Set("HostPort", m_host_port_text->GetValue().mb_str()); netplay_section.Set("HostPort", WxStrToStr(m_host_port_text->GetValue()));
inifile.Save(dolphin_ini); inifile.Save(dolphin_ini);
main_frame->g_NetPlaySetupDiag = NULL; main_frame->g_NetPlaySetupDiag = NULL;
@ -191,13 +192,13 @@ void NetPlaySetupDiag::OnHost(wxCommandEvent&)
return; return;
} }
std::string game(m_game_lbox->GetStringSelection().mb_str()); std::string game(WxStrToStr(m_game_lbox->GetStringSelection()));
npd = new NetPlayDiag(m_parent, m_game_list, game, true); npd = new NetPlayDiag(m_parent, m_game_list, game, true);
unsigned long port = 0; unsigned long port = 0;
m_host_port_text->GetValue().ToULong(&port); m_host_port_text->GetValue().ToULong(&port);
netplay_ptr = new NetPlayServer(u16(port) netplay_ptr = new NetPlayServer(u16(port)
, std::string(m_nickname_text->GetValue().mb_str()), npd, game); , WxStrToStr(m_nickname_text->GetValue()), npd, game);
if (netplay_ptr->is_connected) if (netplay_ptr->is_connected)
{ {
npd->Show(); npd->Show();
@ -222,8 +223,8 @@ void NetPlaySetupDiag::OnJoin(wxCommandEvent&)
npd = new NetPlayDiag(m_parent, m_game_list, ""); npd = new NetPlayDiag(m_parent, m_game_list, "");
unsigned long port = 0; unsigned long port = 0;
m_connect_port_text->GetValue().ToULong(&port); m_connect_port_text->GetValue().ToULong(&port);
netplay_ptr = new NetPlayClient(std::string(m_connect_ip_text->GetValue().mb_str()) netplay_ptr = new NetPlayClient(WxStrToStr(m_connect_ip_text->GetValue())
, (u16)port, npd, std::string(m_nickname_text->GetValue().mb_str())); , (u16)port, npd, WxStrToStr(m_nickname_text->GetValue()));
if (netplay_ptr->is_connected) if (netplay_ptr->is_connected)
{ {
npd->Show(); npd->Show();
@ -250,7 +251,7 @@ NetPlayDiag::NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game
// top crap // top crap
m_game_btn = new wxButton(panel, wxID_ANY, m_game_btn = new wxButton(panel, wxID_ANY,
wxString(m_selected_game.c_str(), *wxConvCurrent).Prepend(_(" Game : ")), StrToWxStr(m_selected_game).Prepend(_(" Game : ")),
wxDefaultPosition, wxDefaultSize, wxBU_LEFT); wxDefaultPosition, wxDefaultSize, wxBU_LEFT);
if (is_hosting) if (is_hosting)
@ -351,7 +352,7 @@ void NetPlayDiag::OnChat(wxCommandEvent&)
if (s.Length()) if (s.Length())
{ {
netplay_ptr->SendChatMessage(std::string(s.mb_str())); netplay_ptr->SendChatMessage(WxStrToStr(s));
m_chat_text->AppendText(s.Prepend(wxT(" >> ")).Append(wxT('\n'))); m_chat_text->AppendText(s.Prepend(wxT(" >> ")).Append(wxT('\n')));
m_chat_msg_text->Clear(); m_chat_msg_text->Clear();
} }
@ -412,7 +413,7 @@ void NetPlayDiag::OnMsgChangeGame(const std::string& filename)
{ {
wxCommandEvent evt(wxEVT_THREAD, NP_GUI_EVT_CHANGE_GAME); wxCommandEvent evt(wxEVT_THREAD, NP_GUI_EVT_CHANGE_GAME);
// TODO: using a wxString in AddPendingEvent from another thread is unsafe i guess? // TODO: using a wxString in AddPendingEvent from another thread is unsafe i guess?
evt.SetString(wxString(filename.c_str(), *wxConvCurrent)); evt.SetString(StrToWxStr(filename));
GetEventHandler()->AddPendingEvent(evt); GetEventHandler()->AddPendingEvent(evt);
} }
@ -436,7 +437,7 @@ void NetPlayDiag::OnPadBuffHelp(wxCommandEvent&)
<< time * (60.0f/1000) << "(60fps) / " << time * (60.0f/1000) << "(60fps) / "
<< time * (50.0f/1000) << "(50fps) >\n"; << time * (50.0f/1000) << "(50fps) >\n";
m_chat_text->AppendText(wxString(ss.str().c_str(), *wxConvCurrent)); m_chat_text->AppendText(StrToWxStr(ss.str()));
} }
void NetPlayDiag::OnAdjustBuffer(wxCommandEvent& event) void NetPlayDiag::OnAdjustBuffer(wxCommandEvent& event)
@ -447,7 +448,7 @@ void NetPlayDiag::OnAdjustBuffer(wxCommandEvent& event)
std::ostringstream ss; std::ostringstream ss;
ss << "< Pad Buffer: " << val << " >"; ss << "< Pad Buffer: " << val << " >";
netplay_ptr->SendChatMessage(ss.str()); netplay_ptr->SendChatMessage(ss.str());
m_chat_text->AppendText(wxString(ss.str().c_str(), *wxConvCurrent).Append(wxT('\n'))); m_chat_text->AppendText(StrToWxStr(ss.str()).Append(wxT('\n')));
} }
void NetPlayDiag::OnQuit(wxCommandEvent&) void NetPlayDiag::OnQuit(wxCommandEvent&)
@ -468,7 +469,7 @@ void NetPlayDiag::OnThread(wxCommandEvent& event)
m_player_lbox->Clear(); m_player_lbox->Clear();
std::istringstream ss(tmps); std::istringstream ss(tmps);
while (std::getline(ss, tmps)) while (std::getline(ss, tmps))
m_player_lbox->Append(wxString(tmps.c_str(), *wxConvCurrent)); m_player_lbox->Append(StrToWxStr(tmps));
m_player_lbox->SetSelection(selection); m_player_lbox->SetSelection(selection);
@ -477,7 +478,7 @@ void NetPlayDiag::OnThread(wxCommandEvent& event)
case NP_GUI_EVT_CHANGE_GAME : case NP_GUI_EVT_CHANGE_GAME :
// update selected game :/ // update selected game :/
{ {
m_selected_game.assign(event.GetString().mb_str()); m_selected_game.assign(WxStrToStr(event.GetString()));
m_game_btn->SetLabel(event.GetString().Prepend(_(" Game : "))); m_game_btn->SetLabel(event.GetString().Prepend(_(" Game : ")));
} }
break; break;
@ -503,7 +504,7 @@ void NetPlayDiag::OnThread(wxCommandEvent& event)
std::string s; std::string s;
chat_msgs.Pop(s); chat_msgs.Pop(s);
//PanicAlert("message: %s", s.c_str()); //PanicAlert("message: %s", s.c_str());
m_chat_text->AppendText(wxString(s.c_str(), *wxConvCurrent).Append(wxT('\n'))); m_chat_text->AppendText(StrToWxStr(s).Append(wxT('\n')));
} }
} }
@ -515,7 +516,7 @@ void NetPlayDiag::OnChangeGame(wxCommandEvent&)
if (game_name.length()) if (game_name.length())
{ {
m_selected_game = std::string(game_name.mb_str()); m_selected_game = WxStrToStr(game_name);
netplay_ptr->ChangeGame(m_selected_game); netplay_ptr->ChangeGame(m_selected_game);
m_game_btn->SetLabel(game_name.Prepend(_(" Game : "))); m_game_btn->SetLabel(game_name.Prepend(_(" Game : ")));
} }
@ -553,7 +554,7 @@ ChangeGameDiag::ChangeGameDiag(wxWindow* const parent, const CGameListCtrl* cons
std::istringstream ss(game_list->GetGameNames()); std::istringstream ss(game_list->GetGameNames());
std::string game; std::string game;
while (std::getline(ss,game)) while (std::getline(ss,game))
m_game_lbox->Append(wxString(game.c_str(), *wxConvCurrent)); m_game_lbox->Append(StrToWxStr(game));
wxButton* const ok_btn = new wxButton(this, wxID_OK, _("Change")); wxButton* const ok_btn = new wxButton(this, wxID_OK, _("Change"));
ok_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ChangeGameDiag::OnPick, this); ok_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ChangeGameDiag::OnPick, this);

View File

@ -17,6 +17,7 @@
#include "PHackSettings.h" #include "PHackSettings.h"
#include "ConfigManager.h" #include "ConfigManager.h"
#include "WxUtils.h"
extern PHackData PHack_Data; extern PHackData PHack_Data;
@ -97,8 +98,8 @@ void CPHackSettings::LoadPHackData()
if (sTemp.empty()) if (sTemp.empty())
sTemp = wxString(_("(UNKNOWN)")).char_str(); sTemp = wxString(_("(UNKNOWN)")).char_str();
if (i == 0) if (i == 0)
PHackChoice->Append(wxString("-------------", *wxConvCurrent)); PHackChoice->Append(StrToWxStr("-------------"));
PHackChoice->Append(wxString(sTemp.c_str(), *wxConvCurrent)); PHackChoice->Append(StrToWxStr(sTemp));
} }
PHackChoice->Select(0); PHackChoice->Select(0);
@ -106,8 +107,8 @@ void CPHackSettings::LoadPHackData()
PHackSZFar->Set3StateValue((wxCheckBoxState)PHack_Data.PHackSZFar); PHackSZFar->Set3StateValue((wxCheckBoxState)PHack_Data.PHackSZFar);
PHackExP->Set3StateValue((wxCheckBoxState)PHack_Data.PHackExP); PHackExP->Set3StateValue((wxCheckBoxState)PHack_Data.PHackExP);
PHackZNear->SetValue(wxString(PHack_Data.PHZNear.c_str(), *wxConvCurrent)); PHackZNear->SetValue(StrToWxStr(PHack_Data.PHZNear));
PHackZFar->SetValue(wxString(PHack_Data.PHZFar.c_str(), *wxConvCurrent)); PHackZFar->SetValue(StrToWxStr(PHack_Data.PHZFar));
} }
void CPHackSettings::SetRefresh(wxCommandEvent& event) void CPHackSettings::SetRefresh(wxCommandEvent& event)
@ -128,9 +129,9 @@ void CPHackSettings::SetRefresh(wxCommandEvent& event)
PHPresetsIni.Get(sIndex, "PH_ExtraParam", &bTemp); PHPresetsIni.Get(sIndex, "PH_ExtraParam", &bTemp);
PHackExP->Set3StateValue((wxCheckBoxState)bTemp); PHackExP->Set3StateValue((wxCheckBoxState)bTemp);
PHPresetsIni.Get(sIndex, "PH_ZNear", &sTemp); PHPresetsIni.Get(sIndex, "PH_ZNear", &sTemp);
PHackZNear->SetValue(wxString(sTemp.c_str(), *wxConvCurrent)); PHackZNear->SetValue(StrToWxStr(sTemp));
PHPresetsIni.Get(sIndex, "PH_ZFar", &sTemp); PHPresetsIni.Get(sIndex, "PH_ZFar", &sTemp);
PHackZFar->SetValue(wxString(sTemp.c_str(), *wxConvCurrent)); PHackZFar->SetValue(StrToWxStr(sTemp));
} }
} }

View File

@ -16,6 +16,7 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "PatchAddEdit.h" #include "PatchAddEdit.h"
#include "WxUtils.h"
extern std::vector<PatchEngine::Patch> onFrame; extern std::vector<PatchEngine::Patch> onFrame;
@ -48,7 +49,7 @@ void CPatchAddEdit::CreateGUIControls(int _selection)
} }
else else
{ {
currentName = wxString(onFrame.at(_selection).name.c_str(), *wxConvCurrent); currentName = StrToWxStr(onFrame.at(_selection).name.c_str());
tempEntries = onFrame.at(_selection).entries; tempEntries = onFrame.at(_selection).entries;
} }
@ -66,7 +67,7 @@ void CPatchAddEdit::CreateGUIControls(int _selection)
EntrySelection->SetValue((int)tempEntries.size()-1); EntrySelection->SetValue((int)tempEntries.size()-1);
wxArrayString wxArrayStringFor_EditPatchType; wxArrayString wxArrayStringFor_EditPatchType;
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
wxArrayStringFor_EditPatchType.Add(wxString::FromAscii(PatchEngine::PatchTypeStrings[i])); wxArrayStringFor_EditPatchType.Add(StrToWxStr(PatchEngine::PatchTypeStrings[i]));
EditPatchType = new wxRadioBox(this, ID_EDITPATCH_TYPE, _("Type"), wxDefaultPosition, wxDefaultSize, wxArrayStringFor_EditPatchType, 3, wxRA_SPECIFY_COLS); EditPatchType = new wxRadioBox(this, ID_EDITPATCH_TYPE, _("Type"), wxDefaultPosition, wxDefaultSize, wxArrayStringFor_EditPatchType, 3, wxRA_SPECIFY_COLS);
EditPatchType->SetSelection((int)tempEntries.at(0).type); EditPatchType->SetSelection((int)tempEntries.at(0).type);
wxStaticText* EditPatchValueText = new wxStaticText(this, ID_EDITPATCH_VALUE_TEXT, _("Value:")); wxStaticText* EditPatchValueText = new wxStaticText(this, ID_EDITPATCH_VALUE_TEXT, _("Value:"));
@ -121,7 +122,7 @@ void CPatchAddEdit::SavePatchData(wxCommandEvent& event)
if (selection == -1) if (selection == -1)
{ {
PatchEngine::Patch newPatch; PatchEngine::Patch newPatch;
newPatch.name = std::string(EditPatchName->GetValue().mb_str()); newPatch.name = WxStrToStr(EditPatchName->GetValue());
newPatch.entries = tempEntries; newPatch.entries = tempEntries;
newPatch.active = true; newPatch.active = true;
@ -129,7 +130,7 @@ void CPatchAddEdit::SavePatchData(wxCommandEvent& event)
} }
else else
{ {
onFrame.at(selection).name = std::string(EditPatchName->GetValue().mb_str()); onFrame.at(selection).name = WxStrToStr(EditPatchName->GetValue());
onFrame.at(selection).entries = tempEntries; onFrame.at(selection).entries = tempEntries;
} }

View File

@ -4,6 +4,8 @@
#include "Common.h" #include "Common.h"
#include "ControllerEmu.h" #include "ControllerEmu.h"
#include "IniFile.h" #include "IniFile.h"
#include "WxUtils.h"
#include <string> #include <string>
UDPConfigDiag::UDPConfigDiag(wxWindow * const parent, UDPWrapper * _wrp) : UDPConfigDiag::UDPConfigDiag(wxWindow * const parent, UDPWrapper * _wrp) :
@ -26,7 +28,7 @@ UDPConfigDiag::UDPConfigDiag(wxWindow * const parent, UDPWrapper * _wrp) :
wxBoxSizer *const port_sizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *const port_sizer = new wxBoxSizer(wxHORIZONTAL);
port_sizer->Add(new wxStaticText(this, wxID_ANY, _("UDP Port:")), 0, wxALIGN_CENTER); port_sizer->Add(new wxStaticText(this, wxID_ANY, _("UDP Port:")), 0, wxALIGN_CENTER);
port_tbox = new wxTextCtrl(this, wxID_ANY, wxString::FromUTF8(wrp->port.c_str())); port_tbox = new wxTextCtrl(this, wxID_ANY, StrToWxStr(wrp->port));
port_sizer->Add(port_tbox, 1, wxLEFT | wxEXPAND, 5); port_sizer->Add(port_tbox, 1, wxLEFT | wxEXPAND, 5);
enable->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &UDPConfigDiag::ChangeState, this); enable->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &UDPConfigDiag::ChangeState, this);
@ -71,7 +73,7 @@ void UDPConfigDiag::ChangeUpdateFlags(wxCommandEvent & WXUNUSED(event))
void UDPConfigDiag::ChangeState(wxCommandEvent & WXUNUSED(event)) void UDPConfigDiag::ChangeState(wxCommandEvent & WXUNUSED(event))
{ {
wrp->udpEn=enable->GetValue(); wrp->udpEn = enable->GetValue();
wrp->port=port_tbox->GetValue().mb_str(wxConvUTF8); wrp->port = WxStrToStr(port_tbox->GetValue());
wrp->Refresh(); wrp->Refresh();
} }

View File

@ -141,7 +141,7 @@ wxArrayString GetListOfResolutions()
if (std::find(resos.begin(), resos.end(), strRes) == resos.end()) if (std::find(resos.begin(), resos.end(), strRes) == resos.end())
{ {
resos.push_back(strRes); resos.push_back(strRes);
retlist.Add(wxString::FromAscii(res)); retlist.Add(StrToWxStr(res));
} }
ZeroMemory(&dmi, sizeof(dmi)); ZeroMemory(&dmi, sizeof(dmi));
} }
@ -212,9 +212,9 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
it = g_available_video_backends.begin(), it = g_available_video_backends.begin(),
itend = g_available_video_backends.end(); itend = g_available_video_backends.end();
for (; it != itend; ++it) for (; it != itend; ++it)
choice_backend->AppendString(wxGetTranslation(wxString::FromAscii((*it)->GetName().c_str()))); choice_backend->AppendString(wxGetTranslation(StrToWxStr((*it)->GetName().c_str())));
choice_backend->SetStringSelection(wxGetTranslation(wxString::FromAscii(g_video_backend->GetName().c_str()))); choice_backend->SetStringSelection(wxGetTranslation(StrToWxStr(g_video_backend->GetName().c_str())));
choice_backend->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &VideoConfigDiag::Event_Backend, this); choice_backend->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &VideoConfigDiag::Event_Backend, this);
szr_basic->Add(label_backend, 1, wxALIGN_CENTER_VERTICAL, 5); szr_basic->Add(label_backend, 1, wxALIGN_CENTER_VERTICAL, 5);
@ -236,7 +236,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
it = vconfig.backend_info.Adapters.begin(), it = vconfig.backend_info.Adapters.begin(),
itend = vconfig.backend_info.Adapters.end(); itend = vconfig.backend_info.Adapters.end();
for (; it != itend; ++it) for (; it != itend; ++it)
choice_adapter->AppendString(wxString::FromAscii(it->c_str())); choice_adapter->AppendString(StrToWxStr(it->c_str()));
choice_adapter->Select(vconfig.iAdapter); choice_adapter->Select(vconfig.iAdapter);
@ -259,7 +259,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
RegisterControl(choice_display_resolution, wxGetTranslation(display_res_desc)); RegisterControl(choice_display_resolution, wxGetTranslation(display_res_desc));
choice_display_resolution->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &VideoConfigDiag::Event_DisplayResolution, this); choice_display_resolution->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &VideoConfigDiag::Event_DisplayResolution, this);
choice_display_resolution->SetStringSelection(wxString::FromAscii(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str())); choice_display_resolution->SetStringSelection(StrToWxStr(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str()));
szr_display->Add(label_display_resolution, 1, wxALIGN_CENTER_VERTICAL, 0); szr_display->Add(label_display_resolution, 1, wxALIGN_CENTER_VERTICAL, 0);
szr_display->Add(choice_display_resolution); szr_display->Add(choice_display_resolution);
@ -355,7 +355,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
it = vconfig.backend_info.AAModes.begin(), it = vconfig.backend_info.AAModes.begin(),
itend = vconfig.backend_info.AAModes.end(); itend = vconfig.backend_info.AAModes.end();
for (; it != itend; ++it) for (; it != itend; ++it)
choice_aamode->AppendString(wxGetTranslation(wxString::FromAscii(it->c_str()))); choice_aamode->AppendString(wxGetTranslation(StrToWxStr(it->c_str())));
choice_aamode->Select(vconfig.iMultisampleMode); choice_aamode->Select(vconfig.iMultisampleMode);
szr_enh->Add(text_aamode, 1, wxALIGN_CENTER_VERTICAL, 0); szr_enh->Add(text_aamode, 1, wxALIGN_CENTER_VERTICAL, 0);
@ -380,12 +380,12 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
it = vconfig.backend_info.PPShaders.begin(), it = vconfig.backend_info.PPShaders.begin(),
itend = vconfig.backend_info.PPShaders.end(); itend = vconfig.backend_info.PPShaders.end();
for (; it != itend; ++it) for (; it != itend; ++it)
choice_ppshader->AppendString(wxString::FromAscii(it->c_str())); choice_ppshader->AppendString(StrToWxStr(it->c_str()));
if (vconfig.sPostProcessingShader.empty()) if (vconfig.sPostProcessingShader.empty())
choice_ppshader->Select(0); choice_ppshader->Select(0);
else else
choice_ppshader->SetStringSelection(wxString::FromAscii(vconfig.sPostProcessingShader.c_str())); choice_ppshader->SetStringSelection(StrToWxStr(vconfig.sPostProcessingShader.c_str()));
choice_ppshader->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &VideoConfigDiag::Event_PPShader, this); choice_ppshader->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &VideoConfigDiag::Event_PPShader, this);
@ -595,7 +595,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
void VideoConfigDiag::Event_DisplayResolution(wxCommandEvent &ev) void VideoConfigDiag::Event_DisplayResolution(wxCommandEvent &ev)
{ {
SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution = SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution =
choice_display_resolution->GetStringSelection().mb_str(); WxStrToStr(choice_display_resolution->GetStringSelection());
#if defined(HAVE_XRANDR) && HAVE_XRANDR #if defined(HAVE_XRANDR) && HAVE_XRANDR
main_frame->m_XRRConfig->Update(); main_frame->m_XRRConfig->Update();
#endif #endif

View File

@ -20,6 +20,7 @@
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
#include "MsgHandler.h" #include "MsgHandler.h"
#include "WxUtils.h"
template <typename W> template <typename W>
class BoolSetting : public W class BoolSetting : public W
@ -99,7 +100,7 @@ protected:
else else
{ {
// Select current backend again // Select current backend again
choice_backend->SetStringSelection(wxString::FromAscii(g_video_backend->GetName().c_str())); choice_backend->SetStringSelection(StrToWxStr(g_video_backend->GetName().c_str()));
} }
} }
@ -129,7 +130,7 @@ protected:
{ {
const int sel = ev.GetInt(); const int sel = ev.GetInt();
if (sel) if (sel)
vconfig.sPostProcessingShader = ev.GetString().mb_str(); vconfig.sPostProcessingShader = WxStrToStr(ev.GetString());
else else
vconfig.sPostProcessingShader.clear(); vconfig.sPostProcessingShader.clear();

View File

@ -20,12 +20,14 @@
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/string.h> #include <wx/string.h>
#include "WxUtils.h"
namespace WxUtils { namespace WxUtils {
// Launch a file according to its mime type // Launch a file according to its mime type
void Launch(const char *filename) void Launch(const char *filename)
{ {
if (! ::wxLaunchDefaultBrowser(wxString(filename, *wxConvCurrent))) if (! ::wxLaunchDefaultBrowser(StrToWxStr(filename)))
{ {
// WARN_LOG // WARN_LOG
} }
@ -34,7 +36,7 @@ void Launch(const char *filename)
// Launch an file explorer window on a certain path // Launch an file explorer window on a certain path
void Explore(const char *path) void Explore(const char *path)
{ {
wxString wxPath = wxString(path, *wxConvCurrent); wxString wxPath = StrToWxStr(path);
// Default to file // Default to file
if (! wxPath.Contains(wxT("://"))) if (! wxPath.Contains(wxT("://")))
{ {
@ -52,3 +54,13 @@ void Explore(const char *path)
} }
} // namespace } // namespace
std::string WxStrToStr(const wxString& str)
{
return str.ToUTF8();
}
wxString StrToWxStr(const std::string& str)
{
return wxString::FromUTF8(str.c_str());
}

View File

@ -18,7 +18,11 @@
#ifndef WXUTILS_H #ifndef WXUTILS_H
#define WXUTILS_H #define WXUTILS_H
namespace WxUtils { #include <string>
#include <wx/string.h>
namespace WxUtils
{
// Launch a file according to its mime type // Launch a file according to its mime type
void Launch(const char *filename); void Launch(const char *filename);
@ -28,4 +32,7 @@ void Explore(const char *path);
} // namespace } // namespace
std::string WxStrToStr(const wxString& str);
wxString StrToWxStr(const std::string& str);
#endif // WXUTILS #endif // WXUTILS

View File

@ -16,6 +16,7 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "X11Utils.h" #include "X11Utils.h"
#include "WxUtils.h"
#include <unistd.h> #include <unistd.h>
#include <spawn.h> #include <spawn.h>
@ -350,7 +351,7 @@ void XRRConfiguration::AddResolutions(wxArrayString& arrayStringFor_FullscreenRe
if (std::find(resos.begin(), resos.end(), strRes) == resos.end()) if (std::find(resos.begin(), resos.end(), strRes) == resos.end())
{ {
resos.push_back(strRes); resos.push_back(strRes);
arrayStringFor_FullscreenResolution.Add(wxString::FromUTF8(strRes.c_str())); arrayStringFor_FullscreenResolution.Add(StrToWxStr(strRes));
} }
} }
} }

View File

@ -24,6 +24,7 @@
#include <cstdio> #include <cstdio>
#include "GLUtil.h" #include "GLUtil.h"
#include "WxUtils.h"
#include "FileUtil.h" #include "FileUtil.h"
@ -1538,7 +1539,7 @@ void TakeScreenshot(ScrStrct* threadStruct)
// Save the screenshot and finally kill the wxImage object // Save the screenshot and finally kill the wxImage object
// This is really expensive when saving to PNG, but not at all when using BMP // This is really expensive when saving to PNG, but not at all when using BMP
threadStruct->img->SaveFile(wxString::FromAscii(threadStruct->filename.c_str()), threadStruct->img->SaveFile(StrToWxStr(threadStruct->filename.c_str()),
wxBITMAP_TYPE_PNG); wxBITMAP_TYPE_PNG);
threadStruct->img->Destroy(); threadStruct->img->Destroy();

View File

@ -34,7 +34,7 @@ IntegerSetting<T>::IntegerSetting(wxWindow* parent, const wxString& label, T& se
VideoConfigDialog::VideoConfigDialog(wxWindow* parent, const std::string& title, const std::string& _ininame) : VideoConfigDialog::VideoConfigDialog(wxWindow* parent, const std::string& title, const std::string& _ininame) :
wxDialog(parent, -1, wxDialog(parent, -1,
wxString(wxT("Dolphin ")).append(wxString::FromAscii(title.c_str())).append(wxT(" Graphics Configuration")), wxString(wxT("Dolphin ")).append(StrToWxStr(title.c_str())).append(wxT(" Graphics Configuration")),
wxDefaultPosition, wxDefaultSize), wxDefaultPosition, wxDefaultSize),
vconfig(g_SWVideoConfig), vconfig(g_SWVideoConfig),
ininame(_ininame) ininame(_ininame)
@ -64,10 +64,10 @@ VideoConfigDialog::VideoConfigDialog(wxWindow* parent, const std::string& title,
it = g_available_video_backends.begin(), it = g_available_video_backends.begin(),
itend = g_available_video_backends.end(); itend = g_available_video_backends.end();
for (; it != itend; ++it) for (; it != itend; ++it)
choice_backend->AppendString(wxString::FromAscii((*it)->GetName().c_str())); choice_backend->AppendString(StrToWxStr((*it)->GetName()));
// TODO: How to get the translated plugin name? // TODO: How to get the translated plugin name?
choice_backend->SetStringSelection(wxString::FromAscii(g_video_backend->GetName().c_str())); choice_backend->SetStringSelection(StrToWxStr(g_video_backend->GetName()));
choice_backend->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &VideoConfigDialog::Event_Backend, this); choice_backend->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &VideoConfigDialog::Event_Backend, this);
szr_rendering->Add(label_backend, 1, wxALIGN_CENTER_VERTICAL, 5); szr_rendering->Add(label_backend, 1, wxALIGN_CENTER_VERTICAL, 5);