Kill off some usages of c_str.

Also changes some function params, but this is ok.
Some simplifications were also able to be made (ie. killing off strcmps with ==, etc).
This commit is contained in:
Lioncash 2014-03-12 15:33:41 -04:00
commit a82675b7d5
170 changed files with 812 additions and 704 deletions

View file

@ -112,8 +112,8 @@ void CARCodeAddEdit::SaveCheatData(wxCommandEvent& WXUNUSED (event))
if (pieces.size() == 2 && pieces[0].size() == 8 && pieces[1].size() == 8)
{
// Decrypted code line.
u32 addr = strtoul(pieces[0].c_str(), nullptr, 16);
u32 value = strtoul(pieces[1].c_str(), nullptr, 16);
u32 addr = std::stoul(pieces[0], nullptr, 16);
u32 value = std::stoul(pieces[1], nullptr, 16);
decryptedLines.push_back(ActionReplay::AREntry(addr, value));
continue;

View file

@ -1062,7 +1062,7 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
{
if (File::Exists(filename))
{
GCMemcard memorycard(filename.c_str());
GCMemcard memorycard(filename);
if (!memorycard.IsValid())
{
PanicAlertT("Cannot use that file as a memory card.\n%s\n" \

View file

@ -42,7 +42,7 @@ void BreakPointDlg::OnOK(wxCommandEvent& event)
{
wxString AddressString = m_pEditAddress->GetLineText(0);
u32 Address = 0;
if (AsciiToHex(WxStrToStr(AddressString).c_str(), Address))
if (AsciiToHex(WxStrToStr(AddressString), Address))
{
PowerPC::breakpoints.Add(Address);
Parent->NotifyUpdate();

View file

@ -195,7 +195,7 @@ void CCodeWindow::OnProfilerMenu(wxCommandEvent& event)
{
std::string filename = File::GetUserPath(D_DUMP_IDX) + "Debug/profiler.txt";
File::CreateFullPath(filename);
Profiler::WriteProfileResults(filename.c_str());
Profiler::WriteProfileResults(filename);
wxFileType* filetype = nullptr;
if (!(filetype = wxTheMimeTypesManager->GetFileTypeFromExtension(_T("txt"))))
@ -235,7 +235,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
{
PPCAnalyst::FindFunctions(0x80000000, 0x81800000, &g_symbolDB);
SignatureDB db;
if (db.Load((File::GetSysDirectory() + TOTALDB).c_str()))
if (db.Load(File::GetSysDirectory() + TOTALDB))
{
db.Apply(&g_symbolDB);
Parent->StatusBarMessage("Generated symbol names from '%s'", TOTALDB);
@ -255,23 +255,23 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
g_symbolDB.Clear();
PPCAnalyst::FindFunctions(0x81300000, 0x81800000, &g_symbolDB);
SignatureDB db;
if (db.Load((File::GetSysDirectory() + TOTALDB).c_str()))
if (db.Load(File::GetSysDirectory() + TOTALDB))
db.Apply(&g_symbolDB);
Parent->StatusBarMessage("'%s' not found, scanning for common functions instead", writable_map_file.c_str());
}
else
{
g_symbolDB.LoadMap(existing_map_file.c_str());
g_symbolDB.LoadMap(existing_map_file);
Parent->StatusBarMessage("Loaded symbols from '%s'", existing_map_file.c_str());
}
HLE::PatchFunctions();
NotifyMapLoaded();
break;
case IDM_SAVEMAPFILE:
g_symbolDB.SaveMap(writable_map_file.c_str());
g_symbolDB.SaveMap(writable_map_file);
break;
case IDM_SAVEMAPFILEWITHCODES:
g_symbolDB.SaveMap(writable_map_file.c_str(), true);
g_symbolDB.SaveMap(writable_map_file, true);
break;
case IDM_RENAME_SYMBOLS:
@ -328,8 +328,8 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
if (!path.IsEmpty())
{
SignatureDB db;
db.Initialize(&g_symbolDB, prefix.c_str());
db.Save(WxStrToStr(path).c_str());
db.Initialize(&g_symbolDB, prefix);
db.Save(WxStrToStr(path));
}
}
}
@ -343,7 +343,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
if (!path.IsEmpty())
{
SignatureDB db;
db.Load(WxStrToStr(path).c_str());
db.Load(WxStrToStr(path));
db.Apply(&g_symbolDB);
}
}

View file

@ -278,50 +278,50 @@ void GFXDebuggerPanel::OnDumpButton(wxCommandEvent& event)
switch (m_pDumpList->GetSelection())
{
case 0: // Pixel Shader
DumpPixelShader(dump_path.c_str());
DumpPixelShader(dump_path);
break;
case 1: // Vertex Shader
DumpVertexShader(dump_path.c_str());
DumpVertexShader(dump_path);
break;
case 2: // Pixel Shader Constants
DumpPixelShaderConstants(dump_path.c_str());
DumpPixelShaderConstants(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
break;
case 3: // Vertex Shader Constants
DumpVertexShaderConstants(dump_path.c_str());
DumpVertexShaderConstants(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
break;
case 4: // Textures
DumpTextures(dump_path.c_str());
DumpTextures(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
break;
case 5: // Frame Buffer
DumpFrameBuffer(dump_path.c_str());
DumpFrameBuffer(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
break;
case 6: // Geometry
DumpGeometry(dump_path.c_str());
DumpGeometry(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
break;
case 7: // Vertex Description
DumpVertexDecl(dump_path.c_str());
DumpVertexDecl(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
break;
case 8: // Vertex Matrices
DumpMatrices(dump_path.c_str());
DumpMatrices(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
break;
case 9: // Statistics
DumpStats(dump_path.c_str());
DumpStats(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
break;
}

View file

@ -81,9 +81,9 @@ void MemoryCheckDlg::OnOK(wxCommandEvent& event)
u32 StartAddress, EndAddress;
bool EndAddressOK = EndAddressString.Len() &&
AsciiToHex(WxStrToStr(EndAddressString).c_str(), EndAddress);
AsciiToHex(WxStrToStr(EndAddressString), EndAddress);
if (AsciiToHex(WxStrToStr(StartAddressString).c_str(), StartAddress) &&
if (AsciiToHex(WxStrToStr(StartAddressString), StartAddress) &&
(OnRead || OnWrite) && (Log || Break))
{
TMemCheck MemCheck;

View file

@ -413,7 +413,7 @@ void FifoPlayerDlg::OnSaveFile(wxCommandEvent& WXUNUSED(event))
{
// Attempt to save the file to the path the user chose
wxBeginBusyCursor();
bool result = file->Save(WxStrToStr(path).c_str());
bool result = file->Save(WxStrToStr(path));
wxEndBusyCursor();
// Wasn't able to save the file, shit's whack, yo.

View file

@ -579,7 +579,7 @@ void CFrame::OnToolBar(wxCommandEvent& event)
}
SaveIniPerspectives();
GetStatusBar()->SetStatusText(StrToWxStr(std::string
("Saved " + Perspectives[ActivePerspective].Name).c_str()), 0);
("Saved " + Perspectives[ActivePerspective].Name)), 0);
break;
case IDM_PERSPECTIVES_ADD_PANE:
AddPane();
@ -869,12 +869,14 @@ void CFrame::LoadIniPerspectives()
for (auto& Width : _SWidth)
{
int _Tmp;
if (TryParse(Width.c_str(), &_Tmp)) Tmp.Width.push_back(_Tmp);
if (TryParse(Width, &_Tmp))
Tmp.Width.push_back(_Tmp);
}
for (auto& Height : _SHeight)
{
int _Tmp;
if (TryParse(Height.c_str(), &_Tmp)) Tmp.Height.push_back(_Tmp);
if (TryParse(Height, &_Tmp))
Tmp.Height.push_back(_Tmp);
}
Perspectives.push_back(Tmp);
}

View file

@ -674,7 +674,7 @@ void CFrame::DoOpen(bool Boot)
}
else
{
DVDInterface::ChangeDisc(WxStrToStr(path).c_str());
DVDInterface::ChangeDisc(WxStrToStr(path));
}
}
@ -771,7 +771,7 @@ void CFrame::OnPlayRecording(wxCommandEvent& WXUNUSED (event))
GetMenuBar()->FindItem(IDM_RECORDREADONLY)->Check(true);
}
if (Movie::PlayInput(WxStrToStr(path).c_str()))
if (Movie::PlayInput(WxStrToStr(path)))
BootGame(std::string(""));
}
@ -1183,7 +1183,7 @@ void CFrame::DoRecordingSave()
if (path.IsEmpty())
return;
Movie::SaveRecording(WxStrToStr(path).c_str());
Movie::SaveRecording(WxStrToStr(path));
if (!paused)
DoPause();
@ -1822,7 +1822,7 @@ void CFrame::GameListChanged(wxCommandEvent& event)
break;
case IDM_PURGECACHE:
CFileSearch::XStringVector Directories;
Directories.push_back(File::GetUserPath(D_CACHE_IDX).c_str());
Directories.push_back(File::GetUserPath(D_CACHE_IDX));
CFileSearch::XStringVector Extensions;
Extensions.push_back("*.cache");

View file

@ -7,7 +7,7 @@
#include "VideoCommon/RenderBase.h"
// Show the current FPS
void cInterfaceEGL::UpdateFPSDisplay(const char *text)
void cInterfaceEGL::UpdateFPSDisplay(const std::string& text)
{
Platform.UpdateFPSDisplay(text);
}
@ -20,7 +20,7 @@ void cInterfaceEGL::SwapInterval(int Interval)
eglSwapInterval(GLWin.egl_dpy, Interval);
}
void* cInterfaceEGL::GetFuncAddress(std::string name)
void* cInterfaceEGL::GetFuncAddress(const std::string& name)
{
return (void*)eglGetProcAddress(name.c_str());
}

View file

@ -5,6 +5,7 @@
#pragma once
#include <EGL/egl.h>
#include <string>
#include "Core/ConfigManager.h"
#include "DolphinWX/GLInterface/InterfaceBase.h"
@ -26,7 +27,7 @@ public:
EGLDisplay EGLGetDisplay(void);
EGLNativeWindowType CreateWindow(void);
void DestroyWindow(void);
void UpdateFPSDisplay(const char *text);
void UpdateFPSDisplay(const std::string& text);
void ToggleFullscreen(bool fullscreen);
void SwapBuffers();
};
@ -41,8 +42,8 @@ public:
void SwapInterval(int Interval);
void Swap();
void SetMode(u32 mode) { s_opengl_mode = mode; }
void UpdateFPSDisplay(const char *Text);
void* GetFuncAddress(std::string name);
void UpdateFPSDisplay(const std::string& text);
void* GetFuncAddress(const std::string& name);
bool Create(void *&window_handle);
bool MakeCurrent();
void Shutdown();

View file

@ -2,6 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <string>
#include "Core/Host.h"
#include "DolphinWX/GLInterface/GLInterface.h"
@ -13,9 +15,9 @@ typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);
PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = nullptr;
// Show the current FPS
void cInterfaceGLX::UpdateFPSDisplay(const char *text)
void cInterfaceGLX::UpdateFPSDisplay(const std::string& text)
{
XStoreName(GLWin.evdpy, GLWin.win, text);
XStoreName(GLWin.evdpy, GLWin.win, text.c_str());
}
void cInterfaceGLX::SwapInterval(int Interval)

View file

@ -4,6 +4,8 @@
#pragma once
#include <string>
#include "DolphinWX/GLInterface/InterfaceBase.h"
#include "DolphinWX/GLInterface/X11_Util.h"
@ -15,7 +17,7 @@ public:
friend class cX11Window;
void SwapInterval(int Interval) override;
void Swap() override;
void UpdateFPSDisplay(const char *Text) override;
void UpdateFPSDisplay(const std::string& text) override;
void* GetFuncAddress(std::string name) override;
bool Create(void *&window_handle) override;
bool MakeCurrent() override;

View file

@ -4,6 +4,8 @@
#pragma once
#include <string>
#include "Common/Common.h"
enum GLInterfaceMode {
@ -23,7 +25,7 @@ protected:
u32 s_opengl_mode;
public:
virtual void Swap() {}
virtual void UpdateFPSDisplay(const char *Text) {}
virtual void UpdateFPSDisplay(const std::string& text) {}
virtual void SetMode(u32 mode) { s_opengl_mode = GLInterfaceMode::MODE_OPENGL; }
virtual u32 GetMode() { return s_opengl_mode; }
virtual void* GetFuncAddress(std::string name) { return nullptr; }

View file

@ -2,6 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <string>
#include "Core/Host.h"
#include "DolphinWX/GLInterface/GLInterface.h"
@ -185,7 +186,7 @@ void cPlatform::DestroyWindow(void)
#endif
}
void cPlatform::UpdateFPSDisplay(const char *text)
void cPlatform::UpdateFPSDisplay(const std::string& text)
{
#if HAVE_WAYLAND
if (cPlatform::platform == EGL_PLATFORM_WAYLAND)

View file

@ -2,6 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <string>
#include "Core/Host.h"
#include "DolphinWX/GLInterface/GLInterface.h"
@ -55,11 +57,9 @@ bool cInterfaceWGL::PeekMessages()
}
// Show the current FPS
void cInterfaceWGL::UpdateFPSDisplay(const char *text)
void cInterfaceWGL::UpdateFPSDisplay(const std::string& text)
{
TCHAR temp[512];
swprintf_s(temp, sizeof(temp)/sizeof(TCHAR), _T("%hs"), text);
EmuWindow::SetWindowText(temp);
EmuWindow::SetWindowText(text);
}
// Create rendering window.

View file

@ -4,6 +4,7 @@
#pragma once
#include <string>
#include "DolphinWX/GLInterface/InterfaceBase.h"
class cInterfaceWGL : public cInterfaceBase
@ -11,7 +12,7 @@ class cInterfaceWGL : public cInterfaceBase
public:
void SwapInterval(int Interval);
void Swap();
void UpdateFPSDisplay(const char *Text);
void UpdateFPSDisplay(const std::string& text);
void* GetFuncAddress(std::string name);
bool Create(void *&window_handle);
bool MakeCurrent();

View file

@ -379,9 +379,9 @@ void cWaylandInterface::DestroyWindow(void)
wl_surface_destroy(GLWin.wl_surface);
}
void cWaylandInterface::UpdateFPSDisplay(const char *text)
void cWaylandInterface::UpdateFPSDisplay(const std::string& text)
{
wl_shell_surface_set_title(GLWin.wl_shell_surface, text);
wl_shell_surface_set_title(GLWin.wl_shell_surface, text.c_str());
}
void cWaylandInterface::ToggleFullscreen(bool fullscreen)

View file

@ -4,6 +4,7 @@
#pragma once
#include <string>
#include <wayland-client.h>
#include <wayland-cursor.h>
#include <wayland-egl.h>
@ -22,7 +23,7 @@ public:
void *EGLGetDisplay(void);
void *CreateWindow(void);
void DestroyWindow(void);
void UpdateFPSDisplay(const char *text);
void UpdateFPSDisplay(const std::string& text);
void ToggleFullscreen(bool fullscreen);
void SwapBuffers();
};

View file

@ -106,9 +106,9 @@ void cXInterface::DestroyWindow(void)
XFreeColormap(GLWin.evdpy, GLWin.attr.colormap);
}
void cXInterface::UpdateFPSDisplay(const char *text)
void cXInterface::UpdateFPSDisplay(const std::string& text)
{
XStoreName(GLWin.evdpy, GLWin.win, text);
XStoreName(GLWin.evdpy, GLWin.win, text.c_str());
}
void cXInterface::SwapBuffers()

View file

@ -4,6 +4,7 @@
#pragma once
#include <string>
#include <X11/keysym.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@ -19,7 +20,7 @@ public:
void *EGLGetDisplay(void);
void *CreateWindow(void);
void DestroyWindow(void);
void UpdateFPSDisplay(const char *text);
void UpdateFPSDisplay(const std::string& text);
void SwapBuffers();
};
#else

View file

@ -500,16 +500,14 @@ void CGameListCtrl::ScanForISOs()
bool duplicate = false;
for (auto& Directory : Directories)
{
if (strcmp(Directory.c_str(),
Entry.physicalName.c_str()) == 0)
if (Directory == Entry.physicalName)
{
duplicate = true;
break;
}
}
if (!duplicate)
Directories.push_back(
Entry.physicalName.c_str());
Directories.push_back(Entry.physicalName);
}
}
}
@ -949,7 +947,7 @@ void CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED (event))
wxFileName path = wxFileName::FileName(StrToWxStr(iso->GetFileName()));
path.MakeAbsolute();
WxUtils::Explore(path.GetPath().char_str());
WxUtils::Explore(WxStrToStr(path.GetPath()));
}
void CGameListCtrl::OnOpenSaveFolder(wxCommandEvent& WXUNUSED (event))
@ -959,7 +957,7 @@ void CGameListCtrl::OnOpenSaveFolder(wxCommandEvent& WXUNUSED (event))
return;
std::string path = iso->GetWiiFSPath();
if (!path.empty())
WxUtils::Explore(path.c_str());
WxUtils::Explore(path);
}
void CGameListCtrl::OnExportSave(wxCommandEvent& WXUNUSED (event))
@ -1056,7 +1054,7 @@ void CGameListCtrl::OnWiki(wxCommandEvent& WXUNUSED (event))
else
wikiUrl = ReplaceAll(wikiUrl, "[GAME_NAME]", "");
WxUtils::Launch(wikiUrl.c_str());
WxUtils::Launch(wikiUrl);
}
void CGameListCtrl::MultiCompressCB(const char* text, float percent, void* arg)
@ -1128,8 +1126,8 @@ void CGameListCtrl::CompressSelection(bool _compress)
wxYES_NO) == wxNO)
continue;
all_good &= DiscIO::CompressFileToBlob(iso->GetFileName().c_str(),
OutputFileName.c_str(),
all_good &= DiscIO::CompressFileToBlob(iso->GetFileName(),
OutputFileName,
(iso->GetPlatform() == GameListItem::WII_DISC) ? 1 : 0,
16384, &MultiCompressCB, &progressDialog);
}
@ -1240,11 +1238,11 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
if (iso->IsCompressed())
all_good = DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(),
path.char_str(), &CompressCB, &dialog);
all_good = DiscIO::DecompressBlobToFile(iso->GetFileName(),
WxStrToStr(path), &CompressCB, &dialog);
else
all_good = DiscIO::CompressFileToBlob(iso->GetFileName().c_str(),
path.char_str(),
all_good = DiscIO::CompressFileToBlob(iso->GetFileName(),
WxStrToStr(path),
(iso->GetPlatform() == GameListItem::WII_DISC) ? 1 : 0,
16384, &CompressCB, &dialog);
}
@ -1326,7 +1324,7 @@ void CGameListCtrl::OnDropFiles(wxDropFilesEvent& event)
main_frame->GetMenuBar()->FindItem(IDM_RECORDREADONLY)->Check(true);
}
if (Movie::PlayInput(file.GetFullPath().c_str()))
if (Movie::PlayInput(WxStrToStr(file.GetFullPath())))
main_frame->BootGame(std::string(""));
}
else if (!Core::IsRunning())
@ -1335,6 +1333,6 @@ void CGameListCtrl::OnDropFiles(wxDropFilesEvent& event)
}
else
{
DVDInterface::ChangeDisc(WxStrToStr(file.GetFullPath()).c_str());
DVDInterface::ChangeDisc(WxStrToStr(file.GetFullPath()));
}
}

View file

@ -73,7 +73,7 @@ GameListItem::GameListItem(const std::string& _rFileName)
m_VolumeSize = pVolume->GetSize();
m_UniqueID = pVolume->GetUniqueID();
m_BlobCompressed = DiscIO::IsCompressedBlob(_rFileName.c_str());
m_BlobCompressed = DiscIO::IsCompressedBlob(_rFileName);
m_IsDiscTwo = pVolume->IsDiscTwo();
m_Revision = pVolume->GetRevision();
@ -278,32 +278,31 @@ std::string GameListItem::GetName(int _index) const
const std::string GameListItem::GetWiiFSPath() const
{
DiscIO::IVolume *Iso = DiscIO::CreateVolumeFromFilename(m_FileName);
DiscIO::IVolume *iso = DiscIO::CreateVolumeFromFilename(m_FileName);
std::string ret;
if (Iso == nullptr)
if (iso == nullptr)
return ret;
if (DiscIO::IsVolumeWiiDisc(Iso) || DiscIO::IsVolumeWadFile(Iso))
if (DiscIO::IsVolumeWiiDisc(iso) || DiscIO::IsVolumeWadFile(iso))
{
char Path[250];
u64 Title;
u64 title;
Iso->GetTitleID((u8*)&Title);
Title = Common::swap64(Title);
iso->GetTitleID((u8*)&title);
title = Common::swap64(title);
sprintf(Path, "%stitle/%08x/%08x/data/",
File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(Title>>32), (u32)Title);
const std::string path = StringFromFormat("%stitle/%08x/%08x/data/",
File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(title>>32), (u32)title);
if (!File::Exists(Path))
File::CreateFullPath(Path);
if (!File::Exists(path))
File::CreateFullPath(path);
if (Path[0] == '.')
ret = WxStrToStr(wxGetCwd()) + std::string(Path).substr(strlen(ROOT_DIR));
if (path[0] == '.')
ret = WxStrToStr(wxGetCwd()) + path.substr(strlen(ROOT_DIR));
else
ret = std::string(Path);
ret = path;
}
delete Iso;
delete iso;
return ret;
}

View file

@ -735,11 +735,11 @@ void CISOProperties::OnExtractFile(wxCommandEvent& WXUNUSED (event))
{
int partitionNum = wxAtoi(File.Mid(File.find_first_of("/"), 1));
File.Remove(0, File.find_first_of("/") +1); // Remove "Partition x/"
WiiDisc.at(partitionNum).FileSystem->ExportFile(WxStrToStr(File).c_str(), WxStrToStr(Path).c_str());
WiiDisc.at(partitionNum).FileSystem->ExportFile(WxStrToStr(File), WxStrToStr(Path));
}
else
{
pFileSystem->ExportFile(WxStrToStr(File).c_str(), WxStrToStr(Path).c_str());
pFileSystem->ExportFile(WxStrToStr(File), WxStrToStr(Path));
}
}
@ -915,11 +915,11 @@ void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event)
bool ret = false;
if (event.GetId() == IDM_EXTRACTAPPLOADER)
{
ret = FS->ExportApploader(WxStrToStr(Path).c_str());
ret = FS->ExportApploader(WxStrToStr(Path));
}
else if (event.GetId() == IDM_EXTRACTDOL)
{
ret = FS->ExportDOL(WxStrToStr(Path).c_str());
ret = FS->ExportDOL(WxStrToStr(Path));
}
if (!ret)
@ -1135,7 +1135,7 @@ bool CISOProperties::SaveGameConfig()
ActionReplayList_Save();
Gecko::SaveCodes(GameIniLocal, m_geckocode_panel->GetCodes());
bool success = GameIniLocal.Save(GameIniFileLocal.c_str());
bool success = GameIniLocal.Save(GameIniFileLocal);
// If the resulting file is empty, delete it. Kind of a hack, but meh.
if (success && File::GetSize(GameIniFileLocal) == 0)

View file

@ -113,7 +113,7 @@ void PadSettingExtension::UpdateValue()
extension->switch_extension = ((wxChoice*)wxcontrol)->GetSelection();
}
PadSettingCheckBox::PadSettingCheckBox(wxWindow* const parent, ControlState& _value, const char* const label)
PadSettingCheckBox::PadSettingCheckBox(wxWindow* const parent, ControlState& _value, const std::string& label)
: PadSetting(new wxCheckBox(parent, -1, wxGetTranslation(StrToWxStr(label))))
, value(_value)
{

View file

@ -84,7 +84,7 @@ public:
class PadSettingCheckBox : public PadSetting
{
public:
PadSettingCheckBox(wxWindow* const parent, ControlState& _value, const char* const label);
PadSettingCheckBox(wxWindow* const parent, ControlState& _value, const std::string& label);
void UpdateGUI() override;
void UpdateValue() override;

View file

@ -128,12 +128,12 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
, d_of = box / 256.0
, x_of = box / 2.0;
if (strcmp(g->control_group->name, "Main Stick") == 0)
if (g->control_group->name == "Main Stick")
{
max = (87.0f / 127.0f) * 100;
diagonal = (55.0f / 127.0f) * 100.0;
}
else if (strcmp(g->control_group->name,"C-Stick") == 0)
else if (g->control_group->name == "C-Stick")
{
max = (74.0f / 127.0f) * 100;
diagonal = (46.0f / 127.0f) * 100;
@ -278,7 +278,7 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
dc.DrawRectangle(n * 12, 0, 14, 12);
// text
const char* const name = g->control_group->controls[n]->name;
const std::string name = g->control_group->controls[n]->name;
// bit of hax so ZL, ZR show up as L, R
dc.DrawText(StrToWxStr(std::string(1, (name[1] && name[1] < 'a') ? name[1] : name[0])), n*12 + 2, 1);
}

View file

@ -386,7 +386,7 @@ void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event))
if (playMovie && movieFile != wxEmptyString)
{
if (Movie::PlayInput(movieFile.char_str()))
if (Movie::PlayInput(WxStrToStr(movieFile)))
{
if (LoadFile && FileToLoad != wxEmptyString)
{
@ -602,7 +602,7 @@ void Host_UpdateMainFrame()
}
}
void Host_UpdateTitle(const char* title)
void Host_UpdateTitle(const std::string& title)
{
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATETITLE);
event.SetString(StrToWxStr(title));
@ -668,11 +668,11 @@ void Host_SetStartupDebuggingParameters()
StartUp.bEnableDebugging = main_frame->g_pCodeWindow ? true : false; // RUNNING_DEBUG
}
void Host_UpdateStatusBar(const char* _pText, int Field)
void Host_UpdateStatusBar(const std::string& text, int Field)
{
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATESTATUSBAR);
// Set the event string
event.SetString(StrToWxStr(_pText));
event.SetString(StrToWxStr(text));
// Update statusbar field
event.SetInt(Field);
// Post message

View file

@ -70,9 +70,9 @@ void* Host_GetRenderHandle()
void* Host_GetInstance() { return nullptr; }
void Host_UpdateTitle(const char* title)
void Host_UpdateTitle(const std::string& title)
{
LOGI(title);
LOGI(title.c_str());
};
void Host_UpdateLogDisplay(){}
@ -112,7 +112,7 @@ void Host_ConnectWiimote(int wm_idx, bool connect) {}
void Host_SetWaitCursor(bool enable){}
void Host_UpdateStatusBar(const char* _pText, int Filed){}
void Host_UpdateStatusBar(const std::string& text, int filed){}
void Host_SysMessage(const char *fmt, ...)
{

View file

@ -7,6 +7,7 @@
#include <cstdio>
#include <cstring>
#include <getopt.h>
#include <string>
#include "Common/Common.h"
#include "Common/LogManager.h"
@ -65,7 +66,7 @@ void* Host_GetRenderHandle()
void* Host_GetInstance() { return nullptr; }
void Host_UpdateTitle(const char* title){};
void Host_UpdateTitle(const std::string& title){};
void Host_UpdateLogDisplay(){}
@ -108,7 +109,7 @@ void Host_ConnectWiimote(int wm_idx, bool connect) {}
void Host_SetWaitCursor(bool enable){}
void Host_UpdateStatusBar(const char* _pText, int Filed){}
void Host_UpdateStatusBar(const std::string& text, int filed){}
void Host_SysMessage(const char *fmt, ...)
{

View file

@ -305,7 +305,7 @@ void CMemcardManager::ChangePath(int slot)
}
else
{
if (m_MemcardPath[slot]->GetPath().length() && ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()).c_str(), slot))
if (m_MemcardPath[slot]->GetPath().length() && ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()), slot))
{
if (memoryCard[slot2])
{
@ -360,7 +360,7 @@ void CMemcardManager::OnPageChange(wxCommandEvent& event)
m_NextPage[slot]->Disable();
m_MemcardList[slot]->nextPage = false;
}
ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()).c_str(), slot);
ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()), slot);
break;
case ID_PREVPAGE_A:
slot = SLOT_A;
@ -376,7 +376,7 @@ void CMemcardManager::OnPageChange(wxCommandEvent& event)
m_PrevPage[slot]->Disable();
m_MemcardList[slot]->prevPage = false;
}
ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()).c_str(), slot);
ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()), slot);
break;
}
}
@ -415,8 +415,8 @@ void CMemcardManager::OnMenuChange(wxCommandEvent& event)
break;
}
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);
if (memoryCard[SLOT_A]) ReloadMemcard(WxStrToStr(m_MemcardPath[SLOT_A]->GetPath()), SLOT_A);
if (memoryCard[SLOT_B]) ReloadMemcard(WxStrToStr(m_MemcardPath[SLOT_B]->GetPath()), SLOT_B);
}
bool CMemcardManager::CopyDeleteSwitch(u32 error, int slot)
{
@ -431,7 +431,7 @@ bool CMemcardManager::CopyDeleteSwitch(u32 error, int slot)
memoryCard[slot]->FixChecksums();
if (!memoryCard[slot]->Save()) PanicAlert(E_SAVEFAILED);
page[slot] = FIRSTPAGE;
ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()).c_str(), slot);
ReloadMemcard(WxStrToStr(m_MemcardPath[slot]->GetPath()), slot);
}
break;
case NOMEMCARD:
@ -557,7 +557,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
}
if (fileName.length() > 0)
{
CopyDeleteSwitch(memoryCard[slot]->ImportGci(WxStrToStr(fileName).c_str(), fileName2), slot);
CopyDeleteSwitch(memoryCard[slot]->ImportGci(WxStrToStr(fileName), fileName2), slot);
}
}
break;
@ -585,7 +585,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
if (fileName.length() > 0)
{
if (!CopyDeleteSwitch(memoryCard[slot]->ExportGci(index, WxStrToStr(fileName).c_str(), ""), -1))
if (!CopyDeleteSwitch(memoryCard[slot]->ExportGci(index, WxStrToStr(fileName), ""), -1))
{
File::Delete(WxStrToStr(fileName));
}
@ -622,7 +622,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
}
}
bool CMemcardManager::ReloadMemcard(const char *fileName, int card)
bool CMemcardManager::ReloadMemcard(const std::string& fileName, int card)
{
if (memoryCard[card]) delete memoryCard[card];

View file

@ -116,7 +116,7 @@ class CMemcardManager : public wxDialog
void CreateGUIControls();
void CopyDeleteClick(wxCommandEvent& event);
bool ReloadMemcard(const char *fileName, int card);
bool ReloadMemcard(const std::string& fileName, int card);
void OnMenuChange(wxCommandEvent& event);
void OnPageChange(wxCommandEvent& event);
void OnPathChange(wxFileDirPickerEvent& event);

View file

@ -65,7 +65,7 @@ void CWiiSaveCrypted::ExportAllSaves()
if (entry.isDirectory)
{
u32 gameid;
if (AsciiToHex(entry.virtualName.c_str(), gameid))
if (AsciiToHex(entry.virtualName, gameid))
{
std::string bannerPath = StringFromFormat("%s%08x/data/banner.bin", folder.c_str(), gameid);
if (File::Exists(bannerPath))

View file

@ -37,9 +37,8 @@ CPHackSettings::CPHackSettings(wxWindow* parent, wxWindowID id, const wxString&
: wxDialog(parent, id, title, position, size, style)
{
CreateGUIControls();
std::string _iniFilename;
_iniFilename = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP "PH_PRESETS.ini";
PHPresetsIni.Load(_iniFilename.c_str());
std::string _iniFilename = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP "PH_PRESETS.ini";
PHPresetsIni.Load(_iniFilename);
PHPresetsIni.SortSections();
LoadPHackData();

View file

@ -87,7 +87,7 @@ void VideoConfigDiag::Event_ClickClose(wxCommandEvent&)
void VideoConfigDiag::Event_Close(wxCloseEvent& ev)
{
g_Config.Save((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str());
g_Config.Save(File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini");
EndModal(wxID_OK);
}
@ -213,7 +213,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
, vconfig(g_Config)
, ininame(_ininame)
{
vconfig.Load((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str());
vconfig.Load(File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini");
Bind(wxEVT_UPDATE_UI, &VideoConfigDiag::OnUpdateUI, this);

View file

@ -17,10 +17,11 @@
#import <AppKit/AppKit.h>
#endif
namespace WxUtils {
namespace WxUtils
{
// Launch a file according to its mime type
void Launch(const char *filename)
void Launch(const std::string& filename)
{
if (! ::wxLaunchDefaultBrowser(StrToWxStr(filename)))
{
@ -29,7 +30,7 @@ void Launch(const char *filename)
}
// Launch an file explorer window on a certain path
void Explore(const char *path)
void Explore(const std::string& path)
{
wxString wxPath = StrToWxStr(path);
#ifndef _WIN32

View file

@ -16,10 +16,10 @@ namespace WxUtils
{
// Launch a file according to its mime type
void Launch(const char *filename);
void Launch(const std::string& filename);
// Launch an file explorer window on a certain path
void Explore(const char *path);
void Explore(const std::string& path);
double GetCurrentBitmapLogicalScale();