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