Merge pull request #164 from lioncash/cstr-cull

Kill off some usages of c_str.
This commit is contained in:
Pierre Bourdon 2014-03-15 00:57:56 +01:00
commit 8d679e76d2
170 changed files with 812 additions and 704 deletions

View File

@ -71,7 +71,7 @@ namespace AudioCommon
{ {
std::string audio_file_name = File::GetUserPath(D_DUMPAUDIO_IDX) + "audiodump.wav"; std::string audio_file_name = File::GetUserPath(D_DUMPAUDIO_IDX) + "audiodump.wav";
File::CreateFullPath(audio_file_name); File::CreateFullPath(audio_file_name);
mixer->StartLogAudio(audio_file_name.c_str()); mixer->StartLogAudio(audio_file_name);
} }
return soundStream; return soundStream;

View File

@ -4,6 +4,8 @@
#pragma once #pragma once
#include <string>
#include "AudioCommon/WaveFile.h" #include "AudioCommon/WaveFile.h"
#include "Common/StdMutex.h" #include "Common/StdMutex.h"
@ -57,23 +59,31 @@ public:
// --------------------- // ---------------------
virtual void StartLogAudio(const char *filename) { virtual void StartLogAudio(const std::string& filename)
if (! m_logAudio) { {
if (! m_logAudio)
{
m_logAudio = true; m_logAudio = true;
g_wave_writer.Start(filename, GetSampleRate()); g_wave_writer.Start(filename, GetSampleRate());
g_wave_writer.SetSkipSilence(false); g_wave_writer.SetSkipSilence(false);
NOTICE_LOG(DSPHLE, "Starting Audio logging"); NOTICE_LOG(DSPHLE, "Starting Audio logging");
} else { }
else
{
WARN_LOG(DSPHLE, "Audio logging has already been started"); WARN_LOG(DSPHLE, "Audio logging has already been started");
} }
} }
virtual void StopLogAudio() { virtual void StopLogAudio()
if (m_logAudio) { {
if (m_logAudio)
{
m_logAudio = false; m_logAudio = false;
g_wave_writer.Stop(); g_wave_writer.Stop();
NOTICE_LOG(DSPHLE, "Stopping Audio logging"); NOTICE_LOG(DSPHLE, "Stopping Audio logging");
} else { }
else
{
WARN_LOG(DSPHLE, "Audio logging has already been stopped"); WARN_LOG(DSPHLE, "Audio logging has already been stopped");
} }
} }

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <string>
#include "AudioCommon/WaveFile.h" #include "AudioCommon/WaveFile.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
@ -21,7 +23,7 @@ WaveFileWriter::~WaveFileWriter()
Stop(); Stop();
} }
bool WaveFileWriter::Start(const char *filename, unsigned int HLESampleRate) bool WaveFileWriter::Start(const std::string& filename, unsigned int HLESampleRate)
{ {
if (!conv_buffer) if (!conv_buffer)
conv_buffer = new short[BUF_SIZE]; conv_buffer = new short[BUF_SIZE];
@ -29,14 +31,14 @@ bool WaveFileWriter::Start(const char *filename, unsigned int HLESampleRate)
// Check if the file is already open // Check if the file is already open
if (file) if (file)
{ {
PanicAlertT("The file %s was already open, the file header will not be written.", filename); PanicAlertT("The file %s was already open, the file header will not be written.", filename.c_str());
return false; return false;
} }
file.Open(filename, "wb"); file.Open(filename, "wb");
if (!file) if (!file)
{ {
PanicAlertT("The file %s could not be opened for writing. Please check if it's already opened by another program.", filename); PanicAlertT("The file %s could not be opened for writing. Please check if it's already opened by another program.", filename.c_str());
return false; return false;
} }

View File

@ -14,6 +14,7 @@
#pragma once #pragma once
#include <string>
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
class WaveFileWriter class WaveFileWriter
@ -31,7 +32,7 @@ public:
WaveFileWriter(); WaveFileWriter();
~WaveFileWriter(); ~WaveFileWriter();
bool Start(const char *filename, unsigned int HLESampleRate); bool Start(const std::string& filename, unsigned int HLESampleRate);
void Stop(); void Stop();
void SetSkipSilence(bool skip) { skip_silence = skip; } void SetSkipSilence(bool skip) { skip_silence = skip; }

View File

@ -262,7 +262,7 @@ public:
} }
} }
void DoMarker(const char* prevName, u32 arbitraryNumber = 0x42) void DoMarker(const std::string& prevName, u32 arbitraryNumber = 0x42)
{ {
u32 cookie = arbitraryNumber; u32 cookie = arbitraryNumber;
Do(cookie); Do(cookie);
@ -270,7 +270,7 @@ public:
if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber) if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber)
{ {
PanicAlertT("Error: After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting savestate load...", PanicAlertT("Error: After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting savestate load...",
prevName, cookie, cookie, arbitraryNumber, arbitraryNumber); prevName.c_str(), cookie, cookie, arbitraryNumber, arbitraryNumber);
mode = PointerWrap::MODE_MEASURE; mode = PointerWrap::MODE_MEASURE;
} }
} }

View File

@ -939,12 +939,12 @@ std::string GetThemeDir(const std::string& theme_name)
return dir; return dir;
} }
bool WriteStringToFile(const std::string &str, const char *filename) bool WriteStringToFile(const std::string &str, const std::string& filename)
{ {
return File::IOFile(filename, "wb").WriteBytes(str.data(), str.size()); return File::IOFile(filename, "wb").WriteBytes(str.data(), str.size());
} }
bool ReadFileToString(const char *filename, std::string &str) bool ReadFileToString(const std::string& filename, std::string &str)
{ {
File::IOFile file(filename, "rb"); File::IOFile file(filename, "rb");
auto const f = file.GetHandle(); auto const f = file.GetHandle();

View File

@ -143,8 +143,8 @@ std::string GetBundleDirectory();
std::string &GetExeDirectory(); std::string &GetExeDirectory();
#endif #endif
bool WriteStringToFile(const std::string &str, const char *filename); bool WriteStringToFile(const std::string& str, const std::string& filename);
bool ReadFileToString(const char *filename, std::string &str); bool ReadFileToString(const std::string& filename, std::string& str);
// simple wrapper for cstdlib file functions to // simple wrapper for cstdlib file functions to
// hopefully will make error checking easier // hopefully will make error checking easier

View File

@ -6,6 +6,7 @@
#include <cstring> #include <cstring>
#include <fstream> #include <fstream>
#include <string>
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
@ -48,7 +49,7 @@ class LinearDiskCache
{ {
public: public:
// return number of read entries // return number of read entries
u32 OpenAndRead(const char *filename, LinearDiskCacheReader<K, V> &reader) u32 OpenAndRead(const std::string& filename, LinearDiskCacheReader<K, V> &reader)
{ {
using std::ios_base; using std::ios_base;

View File

@ -33,6 +33,7 @@
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <ctime> #include <ctime>
#include <string>
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
@ -188,7 +189,7 @@ static unsigned int write_empty(FILE* file, u64 count)
return 0; return 0;
} }
bool SDCardCreate(u64 disk_size /*in MB*/, const char* filename) bool SDCardCreate(u64 disk_size /*in MB*/, const std::string& filename)
{ {
u32 sectors_per_fat; u32 sectors_per_fat;
u32 sectors_per_disk; u32 sectors_per_disk;
@ -196,7 +197,8 @@ bool SDCardCreate(u64 disk_size /*in MB*/, const char* filename)
// Convert MB to bytes // Convert MB to bytes
disk_size *= 1024 * 1024; disk_size *= 1024 * 1024;
if (disk_size < 0x800000 || disk_size > 0x800000000ULL) { if (disk_size < 0x800000 || disk_size > 0x800000000ULL)
{
ERROR_LOG(COMMON, "Trying to create SD Card image of size %" PRIu64 "MB is out of range (8MB-32GB)", disk_size/(1024*1024)); ERROR_LOG(COMMON, "Trying to create SD Card image of size %" PRIu64 "MB is out of range (8MB-32GB)", disk_size/(1024*1024));
return false; return false;
} }
@ -212,7 +214,7 @@ bool SDCardCreate(u64 disk_size /*in MB*/, const char* filename)
FILE* const f = file.GetHandle(); FILE* const f = file.GetHandle();
if (!f) if (!f)
{ {
ERROR_LOG(COMMON, "Could not create file '%s', aborting...\n", filename); ERROR_LOG(COMMON, "Could not create file '%s', aborting...\n", filename.c_str());
return false; return false;
} }
@ -229,31 +231,51 @@ bool SDCardCreate(u64 disk_size /*in MB*/, const char* filename)
* zero sectors * zero sectors
*/ */
if (write_sector(f, s_boot_sector)) goto FailWrite; if (write_sector(f, s_boot_sector))
if (write_sector(f, s_fsinfo_sector)) goto FailWrite; goto FailWrite;
if (write_sector(f, s_fsinfo_sector))
goto FailWrite;
if (BACKUP_BOOT_SECTOR > 0) if (BACKUP_BOOT_SECTOR > 0)
{ {
if (write_empty(f, BACKUP_BOOT_SECTOR - 2)) goto FailWrite; if (write_empty(f, BACKUP_BOOT_SECTOR - 2))
if (write_sector(f, s_boot_sector)) goto FailWrite; goto FailWrite;
if (write_sector(f, s_fsinfo_sector)) goto FailWrite;
if (write_empty(f, RESERVED_SECTORS - 2 - BACKUP_BOOT_SECTOR)) goto FailWrite; if (write_sector(f, s_boot_sector))
goto FailWrite;
if (write_sector(f, s_fsinfo_sector))
goto FailWrite;
if (write_empty(f, RESERVED_SECTORS - 2 - BACKUP_BOOT_SECTOR))
goto FailWrite;
} }
else else
{
if (write_empty(f, RESERVED_SECTORS - 2)) goto FailWrite; if (write_empty(f, RESERVED_SECTORS - 2)) goto FailWrite;
}
if (write_sector(f, s_fat_head)) goto FailWrite; if (write_sector(f, s_fat_head))
if (write_empty(f, sectors_per_fat-1)) goto FailWrite; goto FailWrite;
if (write_sector(f, s_fat_head)) goto FailWrite; if (write_empty(f, sectors_per_fat - 1))
if (write_empty(f, sectors_per_fat-1)) goto FailWrite; goto FailWrite;
if (write_empty(f, sectors_per_disk - RESERVED_SECTORS - 2*sectors_per_fat)) goto FailWrite; if (write_sector(f, s_fat_head))
goto FailWrite;
if (write_empty(f, sectors_per_fat - 1))
goto FailWrite;
if (write_empty(f, sectors_per_disk - RESERVED_SECTORS - 2*sectors_per_fat))
goto FailWrite;
return true; return true;
FailWrite: FailWrite:
ERROR_LOG(COMMON, "Could not write to '%s', aborting...\n", filename); ERROR_LOG(COMMON, "Could not write to '%s', aborting...\n", filename.c_str());
if (unlink(filename) < 0) if (unlink(filename.c_str()) < 0)
ERROR_LOG(COMMON, "unlink(%s) failed\n%s", filename, GetLastErrorMsg()); ERROR_LOG(COMMON, "unlink(%s) failed\n%s", filename.c_str(), GetLastErrorMsg());
return false; return false;
} }

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#include <string>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
bool SDCardCreate(u64 disk_size /*in MB*/, const char* filename); bool SDCardCreate(u64 disk_size /*in MB*/, const std::string& filename);

View File

@ -26,10 +26,10 @@
#endif #endif
// faster than sscanf // faster than sscanf
bool AsciiToHex(const char* _szValue, u32& result) bool AsciiToHex(const std::string& _szValue, u32& result)
{ {
char *endptr = nullptr; char *endptr = nullptr;
const u32 value = strtoul(_szValue, &endptr, 16); const u32 value = strtoul(_szValue.c_str(), &endptr, 16);
if (!endptr || *endptr) if (!endptr || *endptr)
return false; return false;

View File

@ -76,7 +76,7 @@ static bool TryParse(const std::string &str, N *const output)
} }
// TODO: kill this // TODO: kill this
bool AsciiToHex(const char* _szValue, u32& result); bool AsciiToHex(const std::string& _szValue, u32& result);
std::string TabsToSpaces(int tab_size, const std::string &in); std::string TabsToSpaces(int tab_size, const std::string &in);

View File

@ -39,13 +39,14 @@ void SymbolDB::Index()
} }
} }
Symbol *SymbolDB::GetSymbolFromName(const char *name) Symbol* SymbolDB::GetSymbolFromName(const std::string& name)
{ {
for (auto& func : functions) for (auto& func : functions)
{ {
if (!strcmp(func.second.name.c_str(), name)) if (func.second.name == name)
return &func.second; return &func.second;
} }
return nullptr; return nullptr;
} }

View File

@ -84,8 +84,9 @@ public:
void AddCompleteSymbol(const Symbol &symbol); void AddCompleteSymbol(const Symbol &symbol);
Symbol *GetSymbolFromName(const char *name); Symbol* GetSymbolFromName(const std::string& name);
Symbol *GetSymbolFromHash(u32 hash) { Symbol* GetSymbolFromHash(u32 hash)
{
XFuncPtrMap::iterator iter = checksumToFunction.find(hash); XFuncPtrMap::iterator iter = checksumToFunction.find(hash);
if (iter != checksumToFunction.end()) if (iter != checksumToFunction.end())
return iter->second; return iter->second;

View File

@ -16,7 +16,7 @@ SysConf::SysConf()
: m_IsValid(false) : m_IsValid(false)
{ {
m_FilenameDefault = File::GetUserPath(F_WIISYSCONF_IDX); m_FilenameDefault = File::GetUserPath(F_WIISYSCONF_IDX);
m_IsValid = LoadFromFile(m_FilenameDefault.c_str()); m_IsValid = LoadFromFile(m_FilenameDefault);
} }
SysConf::~SysConf() SysConf::~SysConf()
@ -32,10 +32,11 @@ void SysConf::Clear()
{ {
for (auto i = m_Entries.begin(); i < m_Entries.end() - 1; ++i) for (auto i = m_Entries.begin(); i < m_Entries.end() - 1; ++i)
delete [] i->data; delete [] i->data;
m_Entries.clear(); m_Entries.clear();
} }
bool SysConf::LoadFromFile(const char *filename) bool SysConf::LoadFromFile(const std::string& filename)
{ {
// Basic check // Basic check
if (!File::Exists(filename)) if (!File::Exists(filename))
@ -55,8 +56,10 @@ bool SysConf::LoadFromFile(const char *filename)
return true; return true;
} }
else else
{
return false; return false;
} }
}
File::IOFile f(filename, "rb"); File::IOFile f(filename, "rb");
if (f.IsOpen()) if (f.IsOpen())
@ -361,7 +364,7 @@ void SysConf::GenerateSysConf()
m_Filename = m_FilenameDefault; m_Filename = m_FilenameDefault;
} }
bool SysConf::SaveToFile(const char *filename) bool SysConf::SaveToFile(const std::string& filename)
{ {
File::IOFile f(filename, "r+b"); File::IOFile f(filename, "r+b");
@ -393,7 +396,8 @@ bool SysConf::Save()
{ {
if (!m_IsValid) if (!m_IsValid)
return false; return false;
return SaveToFile(m_Filename.c_str());
return SaveToFile(m_Filename);
} }
void SysConf::UpdateLocation() void SysConf::UpdateLocation()
@ -416,6 +420,6 @@ bool SysConf::Reload()
std::string& filename = m_Filename.empty() ? m_FilenameDefault : m_Filename; std::string& filename = m_Filename.empty() ? m_FilenameDefault : m_Filename;
m_IsValid = LoadFromFile(filename.c_str()); m_IsValid = LoadFromFile(filename);
return m_IsValid; return m_IsValid;
} }

View File

@ -163,8 +163,8 @@ public:
} }
bool Save(); bool Save();
bool SaveToFile(const char* filename); bool SaveToFile(const std::string& filename);
bool LoadFromFile(const char* filename); bool LoadFromFile(const std::string& filename);
bool Reload(); bool Reload();
// This function is used when the NAND root is changed // This function is used when the NAND root is changed
void UpdateLocation(); void UpdateLocation();

View File

@ -126,7 +126,7 @@ bool CBoot::LoadMapFromFilename()
{ {
std::string strMapFilename; std::string strMapFilename;
bool found = FindMapFile(&strMapFilename, nullptr); bool found = FindMapFile(&strMapFilename, nullptr);
if (found && g_symbolDB.LoadMap(strMapFilename.c_str())) if (found && g_symbolDB.LoadMap(strMapFilename))
{ {
UpdateDebugger_MapLoaded(); UpdateDebugger_MapLoaded();
return true; return true;
@ -149,7 +149,7 @@ bool CBoot::Load_BS2(const std::string& _rBootROMFilename)
// Load the whole ROM dump // Load the whole ROM dump
std::string data; std::string data;
if (!File::ReadFileToString(_rBootROMFilename.c_str(), data)) if (!File::ReadFileToString(_rBootROMFilename, data))
return false; return false;
u32 ipl_hash = HashAdler32((const u8*)data.data(), data.size()); u32 ipl_hash = HashAdler32((const u8*)data.data(), data.size());
@ -247,7 +247,7 @@ bool CBoot::BootUp()
{ {
PPCAnalyst::FindFunctions(0x80004000, 0x811fffff, &g_symbolDB); PPCAnalyst::FindFunctions(0x80004000, 0x811fffff, &g_symbolDB);
SignatureDB db; SignatureDB db;
if (db.Load((File::GetSysDirectory() + TOTALDB).c_str())) if (db.Load(File::GetSysDirectory() + TOTALDB))
{ {
db.Apply(&g_symbolDB); db.Apply(&g_symbolDB);
HLE::PatchFunctions(); HLE::PatchFunctions();
@ -268,7 +268,7 @@ bool CBoot::BootUp()
// DOL // DOL
case SCoreStartupParameter::BOOT_DOL: case SCoreStartupParameter::BOOT_DOL:
{ {
CDolLoader dolLoader(_StartupPara.m_strFilename.c_str()); CDolLoader dolLoader(_StartupPara.m_strFilename);
// Check if we have gotten a Wii file or not // Check if we have gotten a Wii file or not
bool dolWii = dolLoader.IsWii(); bool dolWii = dolLoader.IsWii();
if (dolWii != _StartupPara.bWii) if (dolWii != _StartupPara.bWii)
@ -284,7 +284,7 @@ bool CBoot::BootUp()
} }
else if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty()) else if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty())
{ {
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str()); VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM);
BS2Success = EmulatedBS2(dolWii); BS2Success = EmulatedBS2(dolWii);
} }
@ -320,7 +320,7 @@ bool CBoot::BootUp()
} }
// Check if we have gotten a Wii file or not // Check if we have gotten a Wii file or not
bool elfWii = IsElfWii(_StartupPara.m_strFilename.c_str()); bool elfWii = IsElfWii(_StartupPara.m_strFilename);
if (elfWii != _StartupPara.bWii) if (elfWii != _StartupPara.bWii)
{ {
PanicAlertT("Warning - starting ELF in wrong console mode!"); PanicAlertT("Warning - starting ELF in wrong console mode!");
@ -334,7 +334,7 @@ bool CBoot::BootUp()
} }
else if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty()) else if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty())
{ {
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str()); VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM);
BS2Success = EmulatedBS2(elfWii); BS2Success = EmulatedBS2(elfWii);
} }
@ -362,7 +362,7 @@ bool CBoot::BootUp()
else // Poor man's bootup else // Poor man's bootup
{ {
Load_FST(elfWii); Load_FST(elfWii);
Boot_ELF(_StartupPara.m_strFilename.c_str()); Boot_ELF(_StartupPara.m_strFilename);
} }
UpdateDebugger_MapLoaded(); UpdateDebugger_MapLoaded();
Dolphin_Debugger::AddAutoBreakpoints(); Dolphin_Debugger::AddAutoBreakpoints();
@ -371,7 +371,7 @@ bool CBoot::BootUp()
// Wii WAD // Wii WAD
case SCoreStartupParameter::BOOT_WII_NAND: case SCoreStartupParameter::BOOT_WII_NAND:
Boot_WiiWAD(_StartupPara.m_strFilename.c_str()); Boot_WiiWAD(_StartupPara.m_strFilename);
if (LoadMapFromFilename()) if (LoadMapFromFilename())
HLE::PatchFunctions(); HLE::PatchFunctions();

View File

@ -25,7 +25,7 @@ class CBoot
public: public:
static bool BootUp(); static bool BootUp();
static bool IsElfWii(const char *filename); static bool IsElfWii(const std::string& filename);
// Tries to find a map file for the current game by looking first in the // Tries to find a map file for the current game by looking first in the
// local user directory, then in the shared user directory. // local user directory, then in the shared user directory.
@ -46,8 +46,8 @@ private:
static void UpdateDebugger_MapLoaded(const char* _gameID = nullptr); static void UpdateDebugger_MapLoaded(const char* _gameID = nullptr);
static bool LoadMapFromFilename(); static bool LoadMapFromFilename();
static bool Boot_ELF(const char *filename); static bool Boot_ELF(const std::string& filename);
static bool Boot_WiiWAD(const char *filename); static bool Boot_WiiWAD(const std::string& filename);
static bool EmulatedBS2_GC(); static bool EmulatedBS2_GC();
static bool EmulatedBS2_Wii(); static bool EmulatedBS2_Wii();

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <string>
#include "Common/CommonFuncs.h" #include "Common/CommonFuncs.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
@ -14,14 +16,14 @@ CDolLoader::CDolLoader(u8* _pBuffer, u32 _Size)
Initialize(_pBuffer, _Size); Initialize(_pBuffer, _Size);
} }
CDolLoader::CDolLoader(const char* _szFilename) CDolLoader::CDolLoader(const std::string& filename)
: m_isWii(false) : m_isWii(false)
{ {
const u64 size = File::GetSize(_szFilename); const u64 size = File::GetSize(filename);
u8* const tmpBuffer = new u8[(size_t)size]; u8* const tmpBuffer = new u8[(size_t)size];
{ {
File::IOFile pStream(_szFilename, "rb"); File::IOFile pStream(filename, "rb");
pStream.ReadBytes(tmpBuffer, (size_t)size); pStream.ReadBytes(tmpBuffer, (size_t)size);
} }

View File

@ -4,12 +4,14 @@
#pragma once #pragma once
#include <string>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
class CDolLoader class CDolLoader
{ {
public: public:
CDolLoader(const char* _szFilename); CDolLoader(const std::string& filename);
CDolLoader(u8* _pBuffer, u32 _Size); CDolLoader(u8* _pBuffer, u32 _Size);
~CDolLoader(); ~CDolLoader();

View File

@ -10,7 +10,7 @@
#include "Core/HLE/HLE.h" #include "Core/HLE/HLE.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
bool CBoot::IsElfWii(const char *filename) bool CBoot::IsElfWii(const std::string& filename)
{ {
/* We already check if filename existed before we called this function, so /* We already check if filename existed before we called this function, so
there is no need for another check, just read the file right away */ there is no need for another check, just read the file right away */
@ -55,7 +55,7 @@ bool CBoot::IsElfWii(const char *filename)
} }
bool CBoot::Boot_ELF(const char *filename) bool CBoot::Boot_ELF(const std::string& filename)
{ {
const u64 filesize = File::GetSize(filename); const u64 filesize = File::GetSize(filename);
u8 *mem = new u8[(size_t)filesize]; u8 *mem = new u8[(size_t)filesize];

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <memory> #include <memory>
#include <string>
#include "Common/CommonPaths.h" #include "Common/CommonPaths.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
@ -45,9 +46,8 @@ typedef struct {
u32 unknown[6]; u32 unknown[6];
} StateFlags; } StateFlags;
bool CBoot::Boot_WiiWAD(const char* _pFilename) bool CBoot::Boot_WiiWAD(const std::string& _pFilename)
{ {
std::string state_filename(Common::GetTitleDataPath(TITLEID_SYSMENU) + WII_STATE); std::string state_filename(Common::GetTitleDataPath(TITLEID_SYSMENU) + WII_STATE);
if (File::Exists(state_filename)) if (File::Exists(state_filename))
@ -102,7 +102,7 @@ bool CBoot::Boot_WiiWAD(const char* _pFilename)
} }
else else
{ {
pDolLoader.reset(new CDolLoader(pContent->m_Filename.c_str())); pDolLoader.reset(new CDolLoader(pContent->m_Filename));
} }
pDolLoader->Load(); pDolLoader->Load();
PC = pDolLoader->GetEntryPoint() | 0x80000000; PC = pDolLoader->GetEntryPoint() | 0x80000000;

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <cctype>
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#include "VideoCommon/EmuWindow.h" #include "VideoCommon/EmuWindow.h"
@ -109,15 +111,17 @@ bool PanicAlertToVideo(const char* text, bool yes_no)
return true; return true;
} }
void DisplayMessage(const char *message, int time_in_ms) void DisplayMessage(const std::string& message, int time_in_ms)
{ {
SCoreStartupParameter& _CoreParameter = SCoreStartupParameter& _CoreParameter =
SConfig::GetInstance().m_LocalCoreStartupParameter; SConfig::GetInstance().m_LocalCoreStartupParameter;
// Actually displaying non-ASCII could cause things to go pear-shaped // Actually displaying non-ASCII could cause things to go pear-shaped
for (const char *c = message; *c != '\0'; ++c) for (const char& c : message)
if (*c < ' ') {
if (!std::isprint(c))
return; return;
}
g_video_backend->Video_AddMessage(message, time_in_ms); g_video_backend->Video_AddMessage(message, time_in_ms);
@ -575,7 +579,7 @@ void SaveScreenShot()
SetState(CORE_PAUSE); SetState(CORE_PAUSE);
g_video_backend->Video_Screenshot(GenerateScreenshotName().c_str()); g_video_backend->Video_Screenshot(GenerateScreenshotName());
if (!bPaused) if (!bPaused)
SetState(CORE_RUN); SetState(CORE_RUN);
@ -716,13 +720,11 @@ void UpdateTitle()
#endif #endif
// This is our final "frame counter" string // This is our final "frame counter" string
std::string SMessage = StringFromFormat("%s | %s", std::string SMessage = StringFromFormat("%s | %s", SSettings.c_str(), SFPS.c_str());
SSettings.c_str(), SFPS.c_str()); std::string TMessage = StringFromFormat("%s | %s", scm_rev_str, SMessage.c_str());
std::string TMessage = StringFromFormat("%s | ", scm_rev_str) +
SMessage;
// Show message // Show message
g_video_backend->UpdateFPSDisplay(SMessage.c_str()); g_video_backend->UpdateFPSDisplay(SMessage);
// Update the audio timestretcher with the current speed // Update the audio timestretcher with the current speed
if (soundStream) if (soundStream)
@ -734,11 +736,13 @@ void UpdateTitle()
if (_CoreParameter.bRenderToMain && if (_CoreParameter.bRenderToMain &&
SConfig::GetInstance().m_InterfaceStatusbar) SConfig::GetInstance().m_InterfaceStatusbar)
{ {
Host_UpdateStatusBar(SMessage.c_str()); Host_UpdateStatusBar(SMessage);
Host_UpdateTitle(scm_rev_str); Host_UpdateTitle(scm_rev_str);
} }
else else
Host_UpdateTitle(TMessage.c_str()); {
Host_UpdateTitle(TMessage);
}
} }
} // Core } // Core

View File

@ -59,12 +59,7 @@ void* GetWindowHandle();
void StartTrace(bool write); void StartTrace(bool write);
// This displays messages in a user-visible way. // This displays messages in a user-visible way.
void DisplayMessage(const char *message, int time_in_ms); void DisplayMessage(const std::string& message, int time_in_ms);
inline void DisplayMessage(const std::string &message, int time_in_ms)
{
DisplayMessage(message.c_str(), time_in_ms);
}
std::string GetStateFileName(); std::string GetStateFileName();
void SetStateFileName(std::string val); void SetStateFileName(std::string val);

View File

@ -190,14 +190,14 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
} }
else if (!strcasecmp(Extension.c_str(), ".elf")) else if (!strcasecmp(Extension.c_str(), ".elf"))
{ {
bWii = CBoot::IsElfWii(m_strFilename.c_str()); bWii = CBoot::IsElfWii(m_strFilename);
Region = USA_DIR; Region = USA_DIR;
m_BootType = BOOT_ELF; m_BootType = BOOT_ELF;
bNTSC = true; bNTSC = true;
} }
else if (!strcasecmp(Extension.c_str(), ".dol")) else if (!strcasecmp(Extension.c_str(), ".dol"))
{ {
CDolLoader dolfile(m_strFilename.c_str()); CDolLoader dolfile(m_strFilename);
bWii = dolfile.IsWii(); bWii = dolfile.IsWii();
Region = USA_DIR; Region = USA_DIR;
m_BootType = BOOT_DOL; m_BootType = BOOT_DOL;

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <cinttypes> #include <cinttypes>
#include <string>
#include <vector> #include <vector>
#include "Common/FifoQueue.h" #include "Common/FifoQueue.h"
@ -23,7 +24,7 @@ namespace CoreTiming
struct EventType struct EventType
{ {
TimedCallback callback; TimedCallback callback;
const char *name; std::string name;
}; };
std::vector<EventType> event_types; std::vector<EventType> event_types;
@ -79,7 +80,7 @@ void FreeEvent(Event* ev)
static void EmptyTimedCallback(u64 userdata, int cyclesLate) {} static void EmptyTimedCallback(u64 userdata, int cyclesLate) {}
int RegisterEvent(const char *name, TimedCallback callback) int RegisterEvent(const std::string& name, TimedCallback callback)
{ {
EventType type; EventType type;
type.name = name; type.name = name;
@ -89,9 +90,9 @@ int RegisterEvent(const char *name, TimedCallback callback)
// we want event type names to remain unique so that we can use them for serialization. // we want event type names to remain unique so that we can use them for serialization.
for (auto& event_type : event_types) for (auto& event_type : event_types)
{ {
if (!strcmp(name, event_type.name)) if (name == event_type.name)
{ {
WARN_LOG(POWERPC, "Discarded old event type \"%s\" because a new type with the same name was registered.", name); WARN_LOG(POWERPC, "Discarded old event type \"%s\" because a new type with the same name was registered.", name.c_str());
// we don't know if someone might be holding on to the type index, // we don't know if someone might be holding on to the type index,
// so we gut the old event type instead of actually removing it. // so we gut the old event type instead of actually removing it.
event_type.name = "_discarded_event"; event_type.name = "_discarded_event";
@ -154,7 +155,7 @@ void EventDoState(PointerWrap &p, BaseEvent* ev)
bool foundMatch = false; bool foundMatch = false;
for (unsigned int i = 0; i < event_types.size(); ++i) for (unsigned int i = 0; i < event_types.size(); ++i)
{ {
if (!strcmp(name.c_str(), event_types[i].name)) if (name == event_types[i].name)
{ {
ev->type = i; ev->type = i;
foundMatch = true; foundMatch = true;
@ -467,11 +468,9 @@ std::string GetScheduledEventsSummary()
if (t >= event_types.size()) if (t >= event_types.size())
PanicAlertT("Invalid event type %i", t); PanicAlertT("Invalid event type %i", t);
const char *name = event_types[ptr->type].name; const std::string& name = event_types[ptr->type].name;
if (!name)
name = "[unknown]";
text += StringFromFormat("%s : %" PRIi64 " %016" PRIx64 "\n", name, ptr->time, ptr->userdata); text += StringFromFormat("%s : %" PRIi64 " %016" PRIx64 "\n", name.c_str(), ptr->time, ptr->userdata);
ptr = ptr->next; ptr = ptr->next;
} }
return text; return text;

View File

@ -36,7 +36,7 @@ u64 GetIdleTicks();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
// Returns the event_type identifier. if name is not unique, an existing event_type will be discarded. // Returns the event_type identifier. if name is not unique, an existing event_type will be discarded.
int RegisterEvent(const char *name, TimedCallback callback); int RegisterEvent(const std::string& name, TimedCallback callback);
void UnregisterAllEvents(); void UnregisterAllEvents();
// userdata MAY NOT CONTAIN POINTERS. userdata might get written and reloaded from disk, // userdata MAY NOT CONTAIN POINTERS. userdata might get written and reloaded from disk,

View File

@ -42,6 +42,7 @@ Initial import
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <map> #include <map>
#include <string>
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
@ -94,7 +95,7 @@ DSPAssembler::~DSPAssembler()
free(gdg_buffer); free(gdg_buffer);
} }
bool DSPAssembler::Assemble(const char *text, std::vector<u16> &code, std::vector<int> *line_numbers) bool DSPAssembler::Assemble(const std::string& text, std::vector<u16> &code, std::vector<int> *line_numbers)
{ {
if (line_numbers) if (line_numbers)
line_numbers->clear(); line_numbers->clear();

View File

@ -73,7 +73,7 @@ public:
// one for each word of code, indicating the source assembler code line number it came from. // one for each word of code, indicating the source assembler code line number it came from.
// If returns false, call GetErrorString to get some text to present to the user. // If returns false, call GetErrorString to get some text to present to the user.
bool Assemble(const char *text, std::vector<u16> &code, std::vector<int> *line_numbers = nullptr); bool Assemble(const std::string& text, std::vector<u16> &code, std::vector<int> *line_numbers = nullptr);
std::string GetErrorString() const { return last_error_str; } std::string GetErrorString() const { return last_error_str; }
err_t GetError() const { return last_error; } err_t GetError() const { return last_error; }

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <iostream> #include <iostream>
#include <string>
#include <vector> #include <vector>
#include "Common/Common.h" #include "Common/Common.h"
@ -13,7 +14,7 @@
#include "Core/DSP/DSPCodeUtil.h" #include "Core/DSP/DSPCodeUtil.h"
#include "Core/DSP/DSPDisassembler.h" #include "Core/DSP/DSPDisassembler.h"
bool Assemble(const char *text, std::vector<u16> &code, bool force) bool Assemble(const std::string& text, std::vector<u16> &code, bool force)
{ {
AssemblerSettings settings; AssemblerSettings settings;
// settings.pc = 0; // settings.pc = 0;
@ -194,7 +195,7 @@ void BinaryStringBEToCode(const std::string &str, std::vector<u16> &code)
} }
} }
bool LoadBinary(const char *filename, std::vector<u16> &code) bool LoadBinary(const std::string& filename, std::vector<u16> &code)
{ {
std::string buffer; std::string buffer;
if (!File::ReadFileToString(filename, buffer)) if (!File::ReadFileToString(filename, buffer))
@ -204,7 +205,7 @@ bool LoadBinary(const char *filename, std::vector<u16> &code)
return true; return true;
} }
bool SaveBinary(const std::vector<u16> &code, const char *filename) bool SaveBinary(const std::vector<u16> &code, const std::string& filename)
{ {
std::string buffer; std::string buffer;
CodeToBinaryStringBE(code, buffer); CodeToBinaryStringBE(code, buffer);

View File

@ -9,7 +9,7 @@
#include "Common/Common.h" #include "Common/Common.h"
bool Assemble(const char *text, std::vector<u16> &code, bool force = false); bool Assemble(const std::string& text, std::vector<u16> &code, bool force = false);
bool Disassemble(const std::vector<u16> &code, bool line_numbers, std::string &text); bool Disassemble(const std::vector<u16> &code, bool line_numbers, std::string &text);
bool Compare(const std::vector<u16> &code1, const std::vector<u16> &code2); bool Compare(const std::vector<u16> &code1, const std::vector<u16> &code2);
void GenRandomCode(u32 size, std::vector<u16> &code); void GenRandomCode(u32 size, std::vector<u16> &code);
@ -23,5 +23,5 @@ void CodeToBinaryStringBE(const std::vector<u16> &code, std::string &str);
void BinaryStringBEToCode(const std::string &str, std::vector<u16> &code); void BinaryStringBEToCode(const std::string &str, std::vector<u16> &code);
// Load code (big endian binary). // Load code (big endian binary).
bool LoadBinary(const char *filename, std::vector<u16> &code); bool LoadBinary(const std::string& filename, std::vector<u16> &code);
bool SaveBinary(const std::vector<u16> &code, const char *filename); bool SaveBinary(const std::vector<u16> &code, const std::string& filename);

View File

@ -44,7 +44,7 @@ bool init_hax = false;
DSPEmitter *dspjit = nullptr; DSPEmitter *dspjit = nullptr;
Common::Event step_event; Common::Event step_event;
static bool LoadRom(const char *fname, int size_in_words, u16 *rom) static bool LoadRom(const std::string& fname, int size_in_words, u16 *rom)
{ {
File::IOFile pFile(fname, "rb"); File::IOFile pFile(fname, "rb");
const size_t size_in_bytes = size_in_words * sizeof(u16); const size_t size_in_bytes = size_in_words * sizeof(u16);
@ -70,12 +70,12 @@ static bool LoadRom(const char *fname, int size_in_words, u16 *rom)
"Use DSPSpy to dump the file from your physical console.\n" "Use DSPSpy to dump the file from your physical console.\n"
"\n" "\n"
"You may use the DSP HLE engine which does not require ROM dumps.\n" "You may use the DSP HLE engine which does not require ROM dumps.\n"
"(Choose it from the \"Audio\" tab of the configuration dialog.)", fname); "(Choose it from the \"Audio\" tab of the configuration dialog.)", fname.c_str());
return false; return false;
} }
// Returns false iff the hash fails and the user hits "Yes" // Returns false iff the hash fails and the user hits "Yes"
static bool VerifyRoms(const char *irom_filename, const char *coef_filename) static bool VerifyRoms(const std::string& irom_filename, const std::string& coef_filename)
{ {
struct DspRomHashes struct DspRomHashes
{ {
@ -136,8 +136,7 @@ static void DSPCore_FreeMemoryPages()
g_dsp.irom = g_dsp.iram = g_dsp.dram = g_dsp.coef = nullptr; g_dsp.irom = g_dsp.iram = g_dsp.dram = g_dsp.coef = nullptr;
} }
bool DSPCore_Init(const char *irom_filename, const char *coef_filename, bool DSPCore_Init(const std::string& irom_filename, const std::string& coef_filename, bool bUsingJIT)
bool bUsingJIT)
{ {
g_dsp.step_counter = 0; g_dsp.step_counter = 0;
cyclesLeft = 0; cyclesLeft = 0;

View File

@ -25,6 +25,8 @@
#pragma once #pragma once
#include <string>
#include "Common/Thread.h" #include "Common/Thread.h"
#include "Core/DSP/DSPBreakpoints.h" #include "Core/DSP/DSPBreakpoints.h"
@ -268,8 +270,7 @@ extern DSPEmitter *dspjit;
extern u16 cyclesLeft; extern u16 cyclesLeft;
extern bool init_hax; extern bool init_hax;
bool DSPCore_Init(const char *irom_filename, const char *coef_filename, bool DSPCore_Init(const std::string& irom_filename, const std::string& coef_filename, bool bUsingJIT);
bool bUsingJIT);
void DSPCore_Reset(); void DSPCore_Reset();
void DSPCore_Shutdown(); // Frees all allocated memory. void DSPCore_Shutdown(); // Frees all allocated memory.

View File

@ -25,6 +25,7 @@
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <string>
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
@ -333,7 +334,7 @@ bool DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16
return true; return true;
} }
bool DSPDisassembler::DisFile(const char* name, int base_addr, int pass, std::string &output) bool DSPDisassembler::DisFile(const std::string& name, int base_addr, int pass, std::string &output)
{ {
File::IOFile in(name, "rb"); File::IOFile in(name, "rb");
if (!in) if (!in)

View File

@ -25,6 +25,7 @@
#pragma once #pragma once
#include <map> #include <map>
#include <string>
#include <vector> #include <vector>
#include "Common/Common.h" #include "Common/Common.h"
@ -73,7 +74,7 @@ public:
private: private:
// Moves PC forward and writes the result to dest. // Moves PC forward and writes the result to dest.
bool DisFile(const char* name, int base_addr, int pass, std::string &output); bool DisFile(const std::string& name, int base_addr, int pass, std::string &output);
char* DisParams(const DSPOPCTemplate& opc, u16 op1, u16 op2, char* strbuf); char* DisParams(const DSPOPCTemplate& opc, u16 op1, u16 op2, char* strbuf);
std::map<u16, int> unk_opcodes; std::map<u16, int> unk_opcodes;

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <functional> #include <functional>
#include <string>
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
@ -139,9 +140,9 @@ void PrintCallstack(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level)
}); });
} }
void PrintDataBuffer(LogTypes::LOG_TYPE type, u8* _pData, size_t _Size, const char* _title) void PrintDataBuffer(LogTypes::LOG_TYPE type, u8* _pData, size_t _Size, const std::string& _title)
{ {
GENERIC_LOG(type, LogTypes::LDEBUG, "%s", _title); GENERIC_LOG(type, LogTypes::LDEBUG, "%s", _title.c_str());
for (u32 j = 0; j < _Size;) for (u32 j = 0; j < _Size;)
{ {
std::string hex_line = ""; std::string hex_line = "";

View File

@ -21,7 +21,7 @@ struct CallstackEntry
bool GetCallstack(std::vector<CallstackEntry> &output); bool GetCallstack(std::vector<CallstackEntry> &output);
void PrintCallstack(); void PrintCallstack();
void PrintCallstack(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level); void PrintCallstack(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level);
void PrintDataBuffer(LogTypes::LOG_TYPE _Log, u8* _pData, size_t _Size, const char* _title); void PrintDataBuffer(LogTypes::LOG_TYPE _Log, u8* _pData, size_t _Size, const std::string& _title);
void AddAutoBreakpoints(); void AddAutoBreakpoints();

View File

@ -3,16 +3,17 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <cstdio> #include <cstdio>
#include <string>
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Core/Debugger/Dump.h" #include "Core/Debugger/Dump.h"
CDump::CDump(const char* _szFilename) : CDump::CDump(const std::string& filename) :
m_pData(nullptr) m_pData(nullptr)
{ {
File::IOFile pStream(_szFilename, "rb"); File::IOFile pStream(filename, "rb");
if (pStream) if (pStream)
{ {
m_size = (size_t)pStream.GetSize(); m_size = (size_t)pStream.GetSize();

View File

@ -8,13 +8,14 @@
// //
#pragma once #pragma once
#include <string>
#include "Common/Common.h" #include "Common/Common.h"
class CDump class CDump
{ {
public: public:
CDump(const char* _szFilename); CDump(const std::string& filename);
~CDump(); ~CDump();
int GetNumberOfSteps(); int GetNumberOfSteps();

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <string>
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Core/FifoPlayer/FifoDataFile.h" #include "Core/FifoPlayer/FifoDataFile.h"
@ -41,7 +43,7 @@ void FifoDataFile::AddFrame(const FifoFrameInfo &frameInfo)
m_Frames.push_back(frameInfo); m_Frames.push_back(frameInfo);
} }
bool FifoDataFile::Save(const char *filename) bool FifoDataFile::Save(const std::string& filename)
{ {
File::IOFile file; File::IOFile file;
if (!file.Open(filename, "wb")) if (!file.Open(filename, "wb"))

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#include <string>
#include <vector> #include <vector>
#include "Common/Common.h" #include "Common/Common.h"
@ -68,7 +69,7 @@ public:
const FifoFrameInfo &GetFrame(size_t frame) const { return m_Frames[frame]; } const FifoFrameInfo &GetFrame(size_t frame) const { return m_Frames[frame]; }
size_t GetFrameCount() { return m_Frames.size(); } size_t GetFrameCount() { return m_Frames.size(); }
bool Save(const char *filename); bool Save(const std::string& filename);
static FifoDataFile *Load(const std::string &filename, bool flagsOnly); static FifoDataFile *Load(const std::string &filename, bool flagsOnly);

View File

@ -73,7 +73,7 @@ bool InstallCodeHandler()
u32 codelist_location = 0x800028B8; // Debugger on location (0x800022A8 = Debugger off, using codehandleronly.bin) u32 codelist_location = 0x800028B8; // Debugger on location (0x800022A8 = Debugger off, using codehandleronly.bin)
std::string data; std::string data;
std::string _rCodeHandlerFilename = File::GetSysDirectory() + GECKO_CODE_HANDLER; std::string _rCodeHandlerFilename = File::GetSysDirectory() + GECKO_CODE_HANDLER;
if (!File::ReadFileToString(_rCodeHandlerFilename.c_str(), data)) if (!File::ReadFileToString(_rCodeHandlerFilename, data))
{ {
NOTICE_LOG(ACTIONREPLAY, "Could not enable cheats because codehandler.bin was missing."); NOTICE_LOG(ACTIONREPLAY, "Could not enable cheats because codehandler.bin was missing.");
return false; return false;

View File

@ -156,9 +156,10 @@ bool IsEnabled(int flags)
return true; return true;
} }
u32 UnPatch(std::string patchName) u32 UnPatch(const std::string& patchName)
{ {
Symbol *symbol = g_symbolDB.GetSymbolFromName(patchName.c_str()); Symbol* symbol = g_symbolDB.GetSymbolFromName(patchName);
if (symbol) if (symbol)
{ {
for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4) for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4)
@ -168,6 +169,7 @@ u32 UnPatch(std::string patchName)
} }
return symbol->address; return symbol->address;
} }
return 0; return 0;
} }

View File

@ -29,7 +29,7 @@ namespace HLE
void PatchFunctions(); void PatchFunctions();
void Patch(u32 pc, const char *func_name); void Patch(u32 pc, const char *func_name);
u32 UnPatch(std::string patchName); u32 UnPatch(const std::string& patchName);
void Execute(u32 _CurrentPC, u32 _Instruction); void Execute(u32 _CurrentPC, u32 _Instruction);
u32 GetFunctionIndex(u32 em_address); u32 GetFunctionIndex(u32 em_address);

View File

@ -71,7 +71,7 @@ void ExecuteDOL(u8* dolFile, u32 fileSize)
g_symbolDB.Clear(); g_symbolDB.Clear();
PPCAnalyst::FindFunctions(0x80004000, 0x811fffff, &g_symbolDB); PPCAnalyst::FindFunctions(0x80004000, 0x811fffff, &g_symbolDB);
SignatureDB db; SignatureDB db;
if (db.Load((File::GetSysDirectory() + TOTALDB).c_str())) if (db.Load(File::GetSysDirectory() + TOTALDB))
{ {
db.Apply(&g_symbolDB); db.Apply(&g_symbolDB);
HLE::PatchFunctions(); HLE::PatchFunctions();
@ -127,17 +127,17 @@ void ExecuteDOL(u8* dolFile, u32 fileSize)
void LoadDOLFromDisc(std::string dol) void LoadDOLFromDisc(std::string dol)
{ {
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(SConfig::GetInstance().m_LastFilename.c_str()); DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(SConfig::GetInstance().m_LastFilename);
DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(pVolume); DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(pVolume);
if (dol.length() > 1 && dol.compare(0, 1, "/") == 0) if (dol.length() > 1 && dol.compare(0, 1, "/") == 0)
dol = dol.substr(1); dol = dol.substr(1);
u32 fileSize = (u32) pFileSystem->GetFileSize(dol.c_str()); u32 fileSize = (u32) pFileSystem->GetFileSize(dol);
u8* dolFile = new u8[fileSize]; u8* dolFile = new u8[fileSize];
if (fileSize > 0) if (fileSize > 0)
{ {
pFileSystem->ReadFile(dol.c_str(), dolFile, fileSize); pFileSystem->ReadFile(dol, dolFile, fileSize);
ExecuteDOL(dolFile, fileSize); ExecuteDOL(dolFile, fileSize);
} }
delete[] dolFile; delete[] dolFile;
@ -145,7 +145,7 @@ void LoadDOLFromDisc(std::string dol)
void LoadBootDOLFromDisc() void LoadBootDOLFromDisc()
{ {
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(SConfig::GetInstance().m_LastFilename.c_str()); DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(SConfig::GetInstance().m_LastFilename);
DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(pVolume); DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(pVolume);
u32 fileSize = pFileSystem->GetBootDOLSize(); u32 fileSize = pFileSystem->GetBootDOLSize();
u8* dolFile = new u8[fileSize]; u8* dolFile = new u8[fileSize];
@ -159,7 +159,7 @@ void LoadBootDOLFromDisc()
u32 GetDolFileSize(std::string dol) u32 GetDolFileSize(std::string dol)
{ {
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(SConfig::GetInstance().m_LastFilename.c_str()); DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(SConfig::GetInstance().m_LastFilename);
DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(pVolume); DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(pVolume);
std::string dolFile; std::string dolFile;
@ -169,7 +169,7 @@ u32 GetDolFileSize(std::string dol)
else else
dolFile = dol; dolFile = dol;
return (u32)pFileSystem->GetFileSize(dolFile.c_str()); return (u32)pFileSystem->GetFileSize(dolFile);
} }
u16 GetIOSVersion() u16 GetIOSVersion()

View File

@ -143,7 +143,7 @@ bool DSPLLE::Initialize(void *hWnd, bool bWii, bool bDSPThread)
irom_file = File::GetSysDirectory() + GC_SYS_DIR DIR_SEP DSP_IROM; irom_file = File::GetSysDirectory() + GC_SYS_DIR DIR_SEP DSP_IROM;
if (!File::Exists(coef_file)) if (!File::Exists(coef_file))
coef_file = File::GetSysDirectory() + GC_SYS_DIR DIR_SEP DSP_COEF; coef_file = File::GetSysDirectory() + GC_SYS_DIR DIR_SEP DSP_COEF;
if (!DSPCore_Init(irom_file.c_str(), coef_file.c_str(), AudioCommon::UseJIT())) if (!DSPCore_Init(irom_file, coef_file, AudioCommon::UseJIT()))
return false; return false;
g_dsp.cpu_ram = Memory::GetPointer(0); g_dsp.cpu_ram = Memory::GetPointer(0);

View File

@ -8,9 +8,11 @@
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <string>
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/StringUtil.h"
#include "Core/DSP/DSPCodeUtil.h" #include "Core/DSP/DSPCodeUtil.h"
#include "Core/DSP/DSPCore.h" #include "Core/DSP/DSPCore.h"
@ -21,10 +23,8 @@
bool DumpDSPCode(const u8 *code_be, int size_in_bytes, u32 crc) bool DumpDSPCode(const u8 *code_be, int size_in_bytes, u32 crc)
{ {
char binFile[MAX_PATH]; const std::string binFile = StringFromFormat("%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX).c_str(), crc);
char txtFile[MAX_PATH]; const std::string txtFile = StringFromFormat("%sDSP_UC_%08X.txt", File::GetUserPath(D_DUMPDSP_IDX).c_str(), crc);
sprintf(binFile, "%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX).c_str(), crc);
sprintf(txtFile, "%sDSP_UC_%08X.txt", File::GetUserPath(D_DUMPDSP_IDX).c_str(), crc);
File::IOFile pFile(binFile, "wb"); File::IOFile pFile(binFile, "wb");
if (pFile) if (pFile)
@ -34,7 +34,7 @@ bool DumpDSPCode(const u8 *code_be, int size_in_bytes, u32 crc)
} }
else else
{ {
PanicAlert("Can't open file (%s) to dump UCode!!", binFile); PanicAlert("Can't open file (%s) to dump UCode!!", binFile.c_str());
return false; return false;
} }

View File

@ -80,12 +80,12 @@ void DisassembleRange(u16 start, u16 end)
// TODO: ? // TODO: ?
} }
bool ReadAnnotatedAssembly(const char *filename) bool ReadAnnotatedAssembly(const std::string& filename)
{ {
File::IOFile f(filename, "r"); File::IOFile f(filename, "r");
if (!f) if (!f)
{ {
ERROR_LOG(DSPLLE, "Bah! ReadAnnotatedAssembly couldn't find the file %s", filename); ERROR_LOG(DSPLLE, "Bah! ReadAnnotatedAssembly couldn't find the file %s", filename.c_str());
return false; return false;
} }
char line[512]; char line[512];

View File

@ -4,6 +4,8 @@
#pragma once #pragma once
#include <string>
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/SymbolDB.h" #include "Common/SymbolDB.h"
@ -22,7 +24,7 @@ public:
extern DSPSymbolDB g_dsp_symbol_db; extern DSPSymbolDB g_dsp_symbol_db;
bool ReadAnnotatedAssembly(const char *filename); bool ReadAnnotatedAssembly(const std::string& filename);
void AutoDisassembly(u16 start_addr, u16 end_addr); void AutoDisassembly(u16 start_addr, u16 end_addr);
void Clear(); void Clear();

View File

@ -317,15 +317,15 @@ void InsertDiscCallback(u64 userdata, int cyclesLate)
delete _FileName; delete _FileName;
} }
void ChangeDisc(const char* _newFileName) void ChangeDisc(const std::string& newFileName)
{ {
std::string* _FileName = new std::string(_newFileName); std::string* _FileName = new std::string(newFileName);
CoreTiming::ScheduleEvent_Threadsafe(0, ejectDisc); CoreTiming::ScheduleEvent_Threadsafe(0, ejectDisc);
CoreTiming::ScheduleEvent_Threadsafe(500000000, insertDisc, (u64)_FileName); CoreTiming::ScheduleEvent_Threadsafe(500000000, insertDisc, (u64)_FileName);
if (Movie::IsRecordingInput()) if (Movie::IsRecordingInput())
{ {
Movie::g_bDiscChange = true; Movie::g_bDiscChange = true;
std::string fileName = _newFileName; std::string fileName = newFileName;
auto sizeofpath = fileName.find_last_of("/\\") + 1; auto sizeofpath = fileName.find_last_of("/\\") + 1;
if (fileName.substr(sizeofpath).length() > 40) if (fileName.substr(sizeofpath).length() > 40)
{ {

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#include <string>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
class PointerWrap; class PointerWrap;
@ -21,7 +22,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
// Disc detection and swapping // Disc detection and swapping
void SetDiscInside(bool _DiscInside); void SetDiscInside(bool _DiscInside);
bool IsDiscInside(); bool IsDiscInside();
void ChangeDisc(const char* _FileName); void ChangeDisc(const std::string& fileName);
// Lid Functions // Lid Functions
void SetLidOpen(bool _bOpen = true); void SetLidOpen(bool _bOpen = true);

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <cinttypes> #include <cinttypes>
#include <string>
#include "Common/ColorUtil.h" #include "Common/ColorUtil.h"
#include "Core/HW/GCMemcard.h" #include "Core/HW/GCMemcard.h"
@ -14,7 +15,7 @@ static void ByteSwap(u8 *valueA, u8 *valueB)
*valueB = tmp; *valueB = tmp;
} }
GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis) GCMemcard::GCMemcard(const std::string& filename, bool forceCreation, bool sjis)
: m_valid(false) : m_valid(false)
, m_fileName(filename) , m_fileName(filename)
{ {
@ -23,7 +24,7 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis)
File::IOFile mcdFile(m_fileName, "rb"); File::IOFile mcdFile(m_fileName, "rb");
if (!mcdFile.IsOpen()) if (!mcdFile.IsOpen())
{ {
if (!forceCreation && !AskYesNoT("\"%s\" does not exist.\n Create a new 16MB Memcard?", filename)) if (!forceCreation && !AskYesNoT("\"%s\" does not exist.\n Create a new 16MB Memcard?", filename.c_str()))
{ {
return; return;
} }
@ -43,12 +44,12 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis)
auto size = mcdFile.GetSize(); auto size = mcdFile.GetSize();
if (size < MC_FST_BLOCKS*BLOCK_SIZE) if (size < MC_FST_BLOCKS*BLOCK_SIZE)
{ {
PanicAlertT("%s failed to load as a memorycard \nfile is not large enough to be a valid memory card file (0x%x bytes)", filename, (unsigned) size); PanicAlertT("%s failed to load as a memorycard \nfile is not large enough to be a valid memory card file (0x%x bytes)", filename.c_str(), (unsigned) size);
return; return;
} }
if (size % BLOCK_SIZE) if (size % BLOCK_SIZE)
{ {
PanicAlertT("%s failed to load as a memorycard \n Card file size is invalid (0x%x bytes)", filename, (unsigned) size); PanicAlertT("%s failed to load as a memorycard \n Card file size is invalid (0x%x bytes)", filename.c_str(), (unsigned) size);
return; return;
} }
@ -63,7 +64,7 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis)
case MemCard2043Mb: case MemCard2043Mb:
break; break;
default: default:
PanicAlertT("%s failed to load as a memorycard \n Card size is invalid (0x%x bytes)", filename, (unsigned) size); PanicAlertT("%s failed to load as a memorycard \n Card size is invalid (0x%x bytes)", filename.c_str(), (unsigned) size);
return; return;
} }
} }
@ -795,7 +796,7 @@ u32 GCMemcard::CopyFrom(const GCMemcard& source, u8 index)
} }
} }
u32 GCMemcard::ImportGci(const char *inputFile, const std::string &outputFile) u32 GCMemcard::ImportGci(const std::string& inputFile, const std::string &outputFile)
{ {
if (outputFile.empty() && !m_valid) if (outputFile.empty() && !m_valid)
return OPENFAIL; return OPENFAIL;
@ -809,7 +810,7 @@ u32 GCMemcard::ImportGci(const char *inputFile, const std::string &outputFile)
return result; return result;
} }
u32 GCMemcard::ImportGciInternal(FILE* gcih, const char *inputFile, const std::string &outputFile) u32 GCMemcard::ImportGciInternal(FILE* gcih, const std::string& inputFile, const std::string &outputFile)
{ {
File::IOFile gci(gcih); File::IOFile gci(gcih);
unsigned int offset; unsigned int offset;
@ -898,18 +899,11 @@ u32 GCMemcard::ImportGciInternal(FILE* gcih, const char *inputFile, const std::s
return ret; return ret;
} }
u32 GCMemcard::ExportGci(u8 index, const char *fileName, const std::string &directory) const u32 GCMemcard::ExportGci(u8 index, const std::string& fileName, const std::string &directory) const
{ {
File::IOFile gci; File::IOFile gci;
int offset = GCI; int offset = GCI;
if (!fileName)
{
std::string gciFilename;
if (!GCI_FileName(index, gciFilename)) return SUCCESS;
gci.Open(directory + DIR_SEP + gciFilename, "wb");
}
else
{
gci.Open(fileName, "wb"); gci.Open(fileName, "wb");
std::string fileType; std::string fileType;
@ -922,7 +916,6 @@ u32 GCMemcard::ExportGci(u8 index, const char *fileName, const std::string &dire
{ {
offset = SAV; offset = SAV;
} }
}
if (!gci) if (!gci)
return OPENFAIL; return OPENFAIL;

View File

@ -4,6 +4,8 @@
#pragma once #pragma once
#include <string>
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/CommonPaths.h" #include "Common/CommonPaths.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
@ -169,12 +171,12 @@ private:
}; };
#pragma pack(pop) #pragma pack(pop)
u32 ImportGciInternal(FILE* gcih, const char *inputFile, const std::string &outputFile); u32 ImportGciInternal(FILE* gcih, const std::string& inputFile, const std::string &outputFile);
static void FormatInternal(GCMC_Header &GCP); static void FormatInternal(GCMC_Header &GCP);
void initDirBatPointers() ; void initDirBatPointers() ;
public: public:
GCMemcard(const char* fileName, bool forceCreation=false, bool sjis=false); GCMemcard(const std::string& fileName, bool forceCreation=false, bool sjis=false);
bool IsValid() const { return m_valid; } bool IsValid() const { return m_valid; }
bool IsAsciiEncoding() const; bool IsAsciiEncoding() const;
bool Save(); bool Save();
@ -233,10 +235,10 @@ public:
u32 CopyFrom(const GCMemcard& source, u8 index); u32 CopyFrom(const GCMemcard& source, u8 index);
// reads a .gci/.gcs/.sav file and calls ImportFile or saves out a gci file // reads a .gci/.gcs/.sav file and calls ImportFile or saves out a gci file
u32 ImportGci(const char* inputFile,const std::string &outputFile); u32 ImportGci(const std::string& inputFile,const std::string &outputFile);
// writes a .gci file to disk containing index // writes a .gci file to disk containing index
u32 ExportGci(u8 index, const char* fileName, const std::string &directory) const; u32 ExportGci(u8 index, const std::string& fileName, const std::string &directory) const;
// GCI files are untouched, SAV files are byteswapped // GCI files are untouched, SAV files are byteswapped
// GCS files have the block count set, default is 1 (For export as GCS) // GCS files have the block count set, default is 1 (For export as GCS)

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#include <string>
// Host - defines an interface for the emulator core to communicate back to the // Host - defines an interface for the emulator core to communicate back to the
// OS-specific layer // OS-specific layer
@ -38,8 +39,8 @@ void Host_UpdateBreakPointView();
void Host_UpdateDisasmDialog(); void Host_UpdateDisasmDialog();
void Host_UpdateLogDisplay(); void Host_UpdateLogDisplay();
void Host_UpdateMainFrame(); void Host_UpdateMainFrame();
void Host_UpdateStatusBar(const char* _pText, int Filed = 0); void Host_UpdateStatusBar(const std::string& text, int Filed = 0);
void Host_UpdateTitle(const char* title); void Host_UpdateTitle(const std::string& title);
// TODO (neobrain): Remove these from host! // TODO (neobrain): Remove these from host!
void* Host_GetInstance(); void* Host_GetInstance();

View File

@ -100,35 +100,35 @@ void Init()
u32 i = 0; u32 i = 0;
// Build hardware devices // Build hardware devices
g_DeviceMap[i] = new CWII_IPC_HLE_Device_usb_oh1_57e_305(i, std::string("/dev/usb/oh1/57e/305")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_usb_oh1_57e_305(i, "/dev/usb/oh1/57e/305"); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_stm_immediate(i, std::string("/dev/stm/immediate")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_stm_immediate(i, "/dev/stm/immediate"); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_stm_eventhook(i, std::string("/dev/stm/eventhook")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_stm_eventhook(i, "/dev/stm/eventhook"); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_fs(i, std::string("/dev/fs")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_fs(i, "/dev/fs"); i++;
// IOS allows two ES devices at a time // IOS allows two ES devices at a time
for (u32 j=0; j<ES_MAX_COUNT; j++) for (u32 j=0; j<ES_MAX_COUNT; j++)
{ {
g_DeviceMap[i] = es_handles[j] = new CWII_IPC_HLE_Device_es(i, std::string("/dev/es")); i++; g_DeviceMap[i] = es_handles[j] = new CWII_IPC_HLE_Device_es(i, "/dev/es"); i++;
es_inuse[j] = false; es_inuse[j] = false;
} }
g_DeviceMap[i] = new CWII_IPC_HLE_Device_di(i, std::string("/dev/di")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_di(i, std::string("/dev/di")); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_kd_request(i, std::string("/dev/net/kd/request")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_kd_request(i, "/dev/net/kd/request"); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_kd_time(i, std::string("/dev/net/kd/time")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_kd_time(i, "/dev/net/kd/time"); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_ncd_manage(i, std::string("/dev/net/ncd/manage")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_ncd_manage(i, "/dev/net/ncd/manage"); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_wd_command(i, std::string("/dev/net/wd/command")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_wd_command(i, "/dev/net/wd/command"); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_ip_top(i, std::string("/dev/net/ip/top")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_ip_top(i, "/dev/net/ip/top"); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_ssl(i, std::string("/dev/net/ssl")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_ssl(i, "/dev/net/ssl"); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_usb_kbd(i, std::string("/dev/usb/kbd")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_usb_kbd(i, "/dev/usb/kbd"); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_sdio_slot0(i, std::string("/dev/sdio/slot0")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_sdio_slot0(i, "/dev/sdio/slot0"); i++;
g_DeviceMap[i] = new CWII_IPC_HLE_Device_stub(i, std::string("/dev/sdio/slot1")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_stub(i, "/dev/sdio/slot1"); i++;
#if defined(__LIBUSB__) || defined(_WIN32) #if defined(__LIBUSB__) || defined(_WIN32)
g_DeviceMap[i] = new CWII_IPC_HLE_Device_hid(i, std::string("/dev/usb/hid")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_hid(i, "/dev/usb/hid"); i++;
#else #else
g_DeviceMap[i] = new CWII_IPC_HLE_Device_stub(i, std::string("/dev/usb/hid")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_stub(i, "/dev/usb/hid"); i++;
#endif #endif
g_DeviceMap[i] = new CWII_IPC_HLE_Device_stub(i, std::string("/dev/usb/oh1")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_stub(i, "/dev/usb/oh1"); i++;
g_DeviceMap[i] = new IWII_IPC_HLE_Device(i, std::string("_Unimplemented_Device_")); i++; g_DeviceMap[i] = new IWII_IPC_HLE_Device(i, "_Unimplemented_Device_"); i++;
enque_reply = CoreTiming::RegisterEvent("IPCReply", EnqueReplyCallback); enque_reply = CoreTiming::RegisterEvent("IPCReply", EnqueReplyCallback);
} }
@ -190,7 +190,7 @@ void SetDefaultContentFile(const std::string& _rFilename)
{ {
for (const auto& entry : g_DeviceMap) for (const auto& entry : g_DeviceMap)
{ {
if (entry.second && entry.second->GetDeviceName().find(std::string("/dev/es")) == 0) if (entry.second && entry.second->GetDeviceName().find("/dev/es") == 0)
{ {
((CWII_IPC_HLE_Device_es*)entry.second)->LoadWAD(_rFilename); ((CWII_IPC_HLE_Device_es*)entry.second)->LoadWAD(_rFilename);
} }
@ -205,7 +205,7 @@ void ES_DIVerify(u8 *_pTMD, u32 _sz)
void SDIO_EventNotify() void SDIO_EventNotify()
{ {
CWII_IPC_HLE_Device_sdio_slot0 *pDevice = CWII_IPC_HLE_Device_sdio_slot0 *pDevice =
(CWII_IPC_HLE_Device_sdio_slot0*)GetDeviceByName(std::string("/dev/sdio/slot0")); (CWII_IPC_HLE_Device_sdio_slot0*)GetDeviceByName("/dev/sdio/slot0");
if (pDevice) if (pDevice)
pDevice->EventNotify(); pDevice->EventNotify();
} }

View File

@ -922,7 +922,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
} }
else else
{ {
pDolLoader.reset(new CDolLoader(pContent->m_Filename.c_str())); pDolLoader.reset(new CDolLoader(pContent->m_Filename));
} }
pDolLoader->Load(); // TODO: Check why sysmenu does not load the DOL correctly pDolLoader->Load(); // TODO: Check why sysmenu does not load the DOL correctly
PC = pDolLoader->GetEntryPoint() | 0x80000000; PC = pDolLoader->GetEntryPoint() | 0x80000000;
@ -1111,7 +1111,7 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz)
if (Movie::IsRecordingInput()) if (Movie::IsRecordingInput())
{ {
// TODO: Check for the actual save data // TODO: Check for the actual save data
if (File::Exists((savePath + "banner.bin").c_str())) if (File::Exists(savePath + "banner.bin"))
Movie::g_bClearSave = false; Movie::g_bClearSave = false;
else else
Movie::g_bClearSave = true; Movie::g_bClearSave = true;
@ -1120,34 +1120,34 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz)
// TODO: Force the game to save to another location, instead of moving the user's save. // TODO: Force the game to save to another location, instead of moving the user's save.
if (Movie::IsPlayingInput() && Movie::IsConfigSaved() && Movie::IsStartingFromClearSave()) if (Movie::IsPlayingInput() && Movie::IsConfigSaved() && Movie::IsStartingFromClearSave())
{ {
if (File::Exists((savePath + "banner.bin").c_str())) if (File::Exists(savePath + "banner.bin"))
{ {
if (File::Exists((savePath + "../backup/").c_str())) if (File::Exists(savePath + "../backup/"))
{ {
// The last run of this game must have been to play back a movie, so their save is already backed up. // The last run of this game must have been to play back a movie, so their save is already backed up.
File::DeleteDirRecursively(savePath.c_str()); File::DeleteDirRecursively(savePath);
} }
else else
{ {
#ifdef _WIN32 #ifdef _WIN32
MoveFile(UTF8ToTStr(savePath).c_str(), UTF8ToTStr(savePath + "../backup/").c_str()); MoveFile(UTF8ToTStr(savePath).c_str(), UTF8ToTStr(savePath + "../backup/").c_str());
#else #else
File::CopyDir(savePath.c_str(),(savePath + "../backup/").c_str()); File::CopyDir(savePath, savePath + "../backup/");
File::DeleteDirRecursively(savePath.c_str()); File::DeleteDirRecursively(savePath);
#endif #endif
} }
} }
} }
else if (File::Exists((savePath + "../backup/").c_str())) else if (File::Exists(savePath + "../backup/"))
{ {
// Delete the save made by a previous movie, and copy back the user's save. // Delete the save made by a previous movie, and copy back the user's save.
if (File::Exists((savePath + "banner.bin").c_str())) if (File::Exists(savePath + "banner.bin"))
File::DeleteDirRecursively(savePath); File::DeleteDirRecursively(savePath);
#ifdef _WIN32 #ifdef _WIN32
MoveFile(UTF8ToTStr(savePath + "../backup/").c_str(), UTF8ToTStr(savePath).c_str()); MoveFile(UTF8ToTStr(savePath + "../backup/").c_str(), UTF8ToTStr(savePath).c_str());
#else #else
File::CopyDir((savePath + "../backup/").c_str(), savePath.c_str()); File::CopyDir(savePath + "../backup/", savePath);
File::DeleteDirRecursively((savePath + "../backup/").c_str()); File::DeleteDirRecursively(savePath + "../backup/");
#endif #endif
} }

View File

@ -35,7 +35,7 @@ bool CWII_IPC_HLE_Device_fs::Open(u32 _CommandAddress, u32 _Mode)
{ {
std::string Path = File::GetUserPath(D_WIIUSER_IDX) + "tmp"; std::string Path = File::GetUserPath(D_WIIUSER_IDX) + "tmp";
File::DeleteDirRecursively(Path); File::DeleteDirRecursively(Path);
File::CreateDir(Path.c_str()); File::CreateDir(Path);
} }
Memory::Write_U32(GetDeviceID(), _CommandAddress+4); Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
@ -505,10 +505,11 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
if (p.GetMode() == PointerWrap::MODE_READ) if (p.GetMode() == PointerWrap::MODE_READ)
{ {
File::DeleteDirRecursively(Path); File::DeleteDirRecursively(Path);
File::CreateDir(Path.c_str()); File::CreateDir(Path);
//now restore from the stream //now restore from the stream
while (1) { while (1)
{
char type = 0; char type = 0;
p.Do(type); p.Do(type);
if (!type) if (!type)
@ -520,7 +521,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
{ {
case 'd': case 'd':
{ {
File::CreateDir(name.c_str()); File::CreateDir(name);
break; break;
} }
case 'f': case 'f':
@ -531,7 +532,8 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
File::IOFile handle(name, "wb"); File::IOFile handle(name, "wb");
char buf[65536]; char buf[65536];
u32 count = size; u32 count = size;
while (count > 65536) { while (count > 65536)
{
p.DoArray(&buf[0], 65536); p.DoArray(&buf[0], 65536);
handle.WriteArray(&buf[0], 65536); handle.WriteArray(&buf[0], 65536);
count -= 65536; count -= 65536;

View File

@ -53,7 +53,7 @@ void CWII_IPC_HLE_Device_sdio_slot0::OpenInternal()
if (!m_Card) if (!m_Card)
{ {
WARN_LOG(WII_IPC_SD, "Failed to open SD Card image, trying to create a new 128MB image..."); WARN_LOG(WII_IPC_SD, "Failed to open SD Card image, trying to create a new 128MB image...");
if (SDCardCreate(128, filename.c_str())) if (SDCardCreate(128, filename))
{ {
WARN_LOG(WII_IPC_SD, "Successfully created %s", filename.c_str()); WARN_LOG(WII_IPC_SD, "Successfully created %s", filename.c_str());
m_Card.Open(filename, "r+b"); m_Card.Open(filename, "r+b");

View File

@ -435,14 +435,14 @@ bool BeginRecordingInput(int controllers)
if (File::Exists(tmpStateFilename)) if (File::Exists(tmpStateFilename))
File::Delete(tmpStateFilename); File::Delete(tmpStateFilename);
State::SaveAs(tmpStateFilename.c_str()); State::SaveAs(tmpStateFilename);
g_bRecordingFromSaveState = true; g_bRecordingFromSaveState = true;
// This is only done here if starting from save state because otherwise we won't have the titleid. Otherwise it's set in WII_IPC_HLE_Device_es.cpp. // This is only done here if starting from save state because otherwise we won't have the titleid. Otherwise it's set in WII_IPC_HLE_Device_es.cpp.
// TODO: find a way to GetTitleDataPath() from Movie::Init() // TODO: find a way to GetTitleDataPath() from Movie::Init()
if (Core::g_CoreStartupParameter.bWii) if (Core::g_CoreStartupParameter.bWii)
{ {
if (File::Exists((Common::GetTitleDataPath(g_titleID) + "banner.bin").c_str())) if (File::Exists(Common::GetTitleDataPath(g_titleID) + "banner.bin"))
Movie::g_bClearSave = false; Movie::g_bClearSave = false;
else else
Movie::g_bClearSave = true; Movie::g_bClearSave = true;
@ -711,9 +711,9 @@ void ReadHeader()
memcpy(MD5, tmpHeader.md5, 16); memcpy(MD5, tmpHeader.md5, 16);
} }
bool PlayInput(const char *filename) bool PlayInput(const std::string& filename)
{ {
if (!filename || g_playMode != MODE_NONE) if (g_playMode != MODE_NONE)
return false; return false;
if (!File::Exists(filename)) if (!File::Exists(filename))
@ -753,7 +753,7 @@ bool PlayInput(const char *filename)
// Load savestate (and skip to frame data) // Load savestate (and skip to frame data)
if (tmpHeader.bFromSaveState) if (tmpHeader.bFromSaveState)
{ {
const std::string stateFilename = std::string(filename) + ".sav"; const std::string stateFilename = filename + ".sav";
if (File::Exists(stateFilename)) if (File::Exists(stateFilename))
Core::SetStateFileName(stateFilename); Core::SetStateFileName(stateFilename);
g_bRecordingFromSaveState = true; g_bRecordingFromSaveState = true;
@ -782,12 +782,12 @@ void DoState(PointerWrap &p)
// other variables (such as g_totalBytes and g_totalFrames) are set in LoadInput // other variables (such as g_totalBytes and g_totalFrames) are set in LoadInput
} }
void LoadInput(const char *filename) void LoadInput(const std::string& filename)
{ {
File::IOFile t_record; File::IOFile t_record;
if (!t_record.Open(filename, "r+b")) if (!t_record.Open(filename, "r+b"))
{ {
PanicAlertT("Failed to read %s", filename); PanicAlertT("Failed to read %s", filename.c_str());
EndPlayInput(false); EndPlayInput(false);
return; return;
} }
@ -796,7 +796,7 @@ void LoadInput(const char *filename)
if (tmpHeader.filetype[0] != 'D' || tmpHeader.filetype[1] != 'T' || tmpHeader.filetype[2] != 'M' || tmpHeader.filetype[3] != 0x1A) if (tmpHeader.filetype[0] != 'D' || tmpHeader.filetype[1] != 'T' || tmpHeader.filetype[2] != 'M' || tmpHeader.filetype[3] != 0x1A)
{ {
PanicAlertT("Savestate movie %s is corrupted, movie recording stopping...", filename); PanicAlertT("Savestate movie %s is corrupted, movie recording stopping...", filename.c_str());
EndPlayInput(false); EndPlayInput(false);
return; return;
} }
@ -1002,7 +1002,7 @@ void PlayController(SPADStatus *PadStatus, int controllerID)
for (int i = 0; i < numPaths; i++) for (int i = 0; i < numPaths; i++)
{ {
path = SConfig::GetInstance().m_ISOFolder[i]; path = SConfig::GetInstance().m_ISOFolder[i];
if (File::Exists((path + '/' + g_discChange.c_str()).c_str())) if (File::Exists(path + '/' + g_discChange))
{ {
found = true; found = true;
break; break;
@ -1010,7 +1010,7 @@ void PlayController(SPADStatus *PadStatus, int controllerID)
} }
if (found) if (found)
{ {
DVDInterface::ChangeDisc((path + '/' + g_discChange.c_str()).c_str()); DVDInterface::ChangeDisc(path + '/' + g_discChange);
Core::SetState(Core::CORE_RUN); Core::SetState(Core::CORE_RUN);
} }
else else
@ -1091,7 +1091,7 @@ void EndPlayInput(bool cont)
} }
} }
void SaveRecording(const char *filename) void SaveRecording(const std::string& filename)
{ {
File::IOFile save_record(filename, "wb"); File::IOFile save_record(filename, "wb");
// Create the real header now and write it // Create the real header now and write it
@ -1145,15 +1145,14 @@ void SaveRecording(const char *filename)
if (success && g_bRecordingFromSaveState) if (success && g_bRecordingFromSaveState)
{ {
std::string stateFilename = filename; std::string stateFilename = filename + ".sav";
stateFilename.append(".sav");
success = File::Copy(tmpStateFilename, stateFilename); success = File::Copy(tmpStateFilename, stateFilename);
} }
if (success) if (success)
Core::DisplayMessage(StringFromFormat("DTM %s saved", filename).c_str(), 2000); Core::DisplayMessage(StringFromFormat("DTM %s saved", filename.c_str()), 2000);
else else
Core::DisplayMessage(StringFromFormat("Failed to save %s", filename).c_str(), 2000); Core::DisplayMessage(StringFromFormat("Failed to save %s", filename.c_str()), 2000);
} }
void SetInputManip(ManipFunction func) void SetInputManip(ManipFunction func)

View File

@ -18,10 +18,12 @@ struct ReportFeatures;
// Per-(video )Movie actions // Per-(video )Movie actions
namespace Movie { namespace Movie
{
// Enumerations and structs // Enumerations and structs
enum PlayMode { enum PlayMode
{
MODE_NONE = 0, MODE_NONE = 0,
MODE_RECORDING, MODE_RECORDING,
MODE_PLAYING MODE_PLAYING
@ -29,7 +31,8 @@ enum PlayMode {
// Gamecube Controller State // Gamecube Controller State
#pragma pack(push,1) #pragma pack(push,1)
struct ControllerState { struct ControllerState
{
bool Start:1, A:1, B:1, X:1, Y:1, Z:1; // Binary buttons, 6 bits bool Start:1, A:1, B:1, X:1, Y:1, Z:1; // Binary buttons, 6 bits
bool DPadUp:1, DPadDown:1, // Binary D-Pad buttons, 4 bits bool DPadUp:1, DPadDown:1, // Binary D-Pad buttons, 4 bits
DPadLeft:1, DPadRight:1; DPadLeft:1, DPadRight:1;
@ -66,7 +69,8 @@ extern std::string g_discChange;
extern u32 g_rerecords; extern u32 g_rerecords;
#pragma pack(push,1) #pragma pack(push,1)
struct DTMHeader { struct DTMHeader
{
u8 filetype[4]; // Unique Identifier (always "DTM"0x1A) u8 filetype[4]; // Unique Identifier (always "DTM"0x1A)
u8 gameID[6]; // The Game ID u8 gameID[6]; // The Game ID
@ -161,13 +165,13 @@ bool BeginRecordingInput(int controllers);
void RecordInput(SPADStatus *PadStatus, int controllerID); void RecordInput(SPADStatus *PadStatus, int controllerID);
void RecordWiimote(int wiimote, u8 *data, u8 size); void RecordWiimote(int wiimote, u8 *data, u8 size);
bool PlayInput(const char *filename); bool PlayInput(const std::string& filename);
void LoadInput(const char *filename); void LoadInput(const std::string& filename);
void ReadHeader(); void ReadHeader();
void PlayController(SPADStatus *PadStatus, int controllerID); void PlayController(SPADStatus *PadStatus, int controllerID);
bool PlayWiimote(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf, int irMode); bool PlayWiimote(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf, int irMode);
void EndPlayInput(bool cont); void EndPlayInput(bool cont);
void SaveRecording(const char *filename); void SaveRecording(const std::string& filename);
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
void CheckMD5(); void CheckMD5();
void GetMD5(); void GetMD5();

View File

@ -47,14 +47,13 @@ std::vector<Patch> onFrame;
std::map<u32, int> speedHacks; std::map<u32, int> speedHacks;
std::vector<std::string> discList; std::vector<std::string> discList;
void LoadPatchSection(const char *section, std::vector<Patch>& patches, void LoadPatchSection(const std::string& section, std::vector<Patch>& patches, IniFile& globalIni, IniFile& localIni)
IniFile& globalIni, IniFile& localIni)
{ {
// Load the name of all enabled patches // Load the name of all enabled patches
std::string enabledSectionName = std::string(section) + "_Enabled"; std::string enabledSectionName = section + "_Enabled";
std::vector<std::string> enabledLines; std::vector<std::string> enabledLines;
std::set<std::string> enabledNames; std::set<std::string> enabledNames;
localIni.GetLines(enabledSectionName.c_str(), enabledLines); localIni.GetLines(enabledSectionName, enabledLines);
for (const std::string& line : enabledLines) for (const std::string& line : enabledLines)
{ {
if (line.size() != 0 && line[0] == '$') if (line.size() != 0 && line[0] == '$')

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#include <string>
#include "Common/IniFile.h" #include "Common/IniFile.h"
namespace PatchEngine namespace PatchEngine
@ -36,7 +37,7 @@ struct Patch
}; };
int GetSpeedhackCycles(const u32 addr); int GetSpeedhackCycles(const u32 addr);
void LoadPatchSection(const char *section, std::vector<Patch> &patches, void LoadPatchSection(const std::string& section, std::vector<Patch> &patches,
IniFile &globalIni, IniFile &localIni); IniFile &globalIni, IniFile &localIni);
void LoadPatches(); void LoadPatches();
void ApplyFramePatches(); void ApplyFramePatches();

View File

@ -4,6 +4,7 @@
#include <algorithm> #include <algorithm>
#include <cinttypes> #include <cinttypes>
#include <string>
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
@ -123,7 +124,7 @@ namespace JitInterface
return jit; return jit;
} }
void WriteProfileResults(const char *filename) void WriteProfileResults(const std::string& filename)
{ {
// Can't really do this with no jit core available // Can't really do this with no jit core available
#if _M_X86 #if _M_X86
@ -157,7 +158,7 @@ namespace JitInterface
File::IOFile f(filename, "w"); File::IOFile f(filename, "w");
if (!f) if (!f)
{ {
PanicAlert("Failed to open %s", filename); PanicAlert("Failed to open %s", filename.c_str());
return; return;
} }
fprintf(f.GetHandle(), "origAddr\tblkName\tcost\ttimeCost\tpercent\ttimePercent\tOvAllinBlkTime(ms)\tblkCodeSize\n"); fprintf(f.GetHandle(), "origAddr\tblkName\tcost\ttimeCost\tpercent\ttimePercent\tOvAllinBlkTime(ms)\tblkCodeSize\n");

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#include <string>
#include "Common/ChunkFile.h" #include "Common/ChunkFile.h"
#include "Core/PowerPC/CPUCoreBase.h" #include "Core/PowerPC/CPUCoreBase.h"
@ -16,7 +17,7 @@ namespace JitInterface
CPUCoreBase *GetCore(); CPUCoreBase *GetCore();
// Debugging // Debugging
void WriteProfileResults(const char *filename); void WriteProfileResults(const std::string& filename);
// Memory Utilities // Memory Utilities
bool IsInCodeSpace(u8 *ptr); bool IsInCodeSpace(u8 *ptr);

View File

@ -55,7 +55,7 @@ Symbol *PPCSymbolDB::AddFunction(u32 startAddr)
} }
} }
void PPCSymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const char *name, int type) void PPCSymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const std::string& name, int type)
{ {
XFuncMap::iterator iter = functions.find(startAddr); XFuncMap::iterator iter = functions.find(startAddr);
if (iter != functions.end()) if (iter != functions.end())
@ -196,7 +196,7 @@ void PPCSymbolDB::LogFunctionCall(u32 addr)
// This one can load both leftover map files on game discs (like Zelda), and mapfiles // This one can load both leftover map files on game discs (like Zelda), and mapfiles
// produced by SaveSymbolMap below. // produced by SaveSymbolMap below.
bool PPCSymbolDB::LoadMap(const char *filename) bool PPCSymbolDB::LoadMap(const std::string& filename)
{ {
File::IOFile f(filename, "r"); File::IOFile f(filename, "r");
if (!f) if (!f)
@ -263,11 +263,12 @@ bool PPCSymbolDB::LoadMap(const char *filename)
// =================================================== // ===================================================
/* Save the map file and save a code file */ /* Save the map file and save a code file */
// ---------------- // ----------------
bool PPCSymbolDB::SaveMap(const char *filename, bool WithCodes) const bool PPCSymbolDB::SaveMap(const std::string& filename, bool WithCodes) const
{ {
// Format the name for the codes version // Format the name for the codes version
std::string mapFile = filename; std::string mapFile = filename;
if (WithCodes) mapFile = mapFile.substr(0, mapFile.find_last_of(".")) + "_code.map"; if (WithCodes)
mapFile = mapFile.substr(0, mapFile.find_last_of(".")) + "_code.map";
// Check size // Check size
const int wxYES_NO = 0x00000002 | 0x00000008; const int wxYES_NO = 0x00000002 | 0x00000008;
@ -277,7 +278,9 @@ bool PPCSymbolDB::SaveMap(const char *filename, bool WithCodes) const
"No symbol names are generated. Do you want to replace '%s' with a blank file?", "No symbol names are generated. Do you want to replace '%s' with a blank file?",
mapFile.c_str()).c_str(), "Confirm", wxYES_NO)) return false; mapFile.c_str()).c_str(), "Confirm", wxYES_NO)) return false;
} }
if (WithCodes) Host_UpdateStatusBar("Saving code, please stand by ...");
if (WithCodes)
Host_UpdateStatusBar("Saving code, please stand by ...");
// Make a file // Make a file
File::IOFile f(mapFile, "w"); File::IOFile f(mapFile, "w");

View File

@ -26,7 +26,7 @@ public:
~PPCSymbolDB(); ~PPCSymbolDB();
Symbol *AddFunction(u32 startAddr) override; Symbol *AddFunction(u32 startAddr) override;
void AddKnownSymbol(u32 startAddr, u32 size, const char *name, int type = Symbol::SYMBOL_FUNCTION); void AddKnownSymbol(u32 startAddr, u32 size, const std::string& name, int type = Symbol::SYMBOL_FUNCTION);
Symbol *GetSymbolFromAddr(u32 addr) override; Symbol *GetSymbolFromAddr(u32 addr) override;
@ -34,8 +34,8 @@ public:
void FillInCallers(); void FillInCallers();
bool LoadMap(const char *filename); bool LoadMap(const std::string& filename);
bool SaveMap(const char *filename, bool WithCodes = false) const; bool SaveMap(const std::string& filename, bool WithCodes = false) const;
void PrintCalls(u32 funcAddr) const; void PrintCalls(u32 funcAddr) const;
void PrintCallers(u32 funcAddr) const; void PrintCallers(u32 funcAddr) const;

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <string>
#include "Core/PowerPC/JitInterface.h" #include "Core/PowerPC/JitInterface.h"
namespace Profiler namespace Profiler
@ -10,7 +11,7 @@ namespace Profiler
bool g_ProfileBlocks; bool g_ProfileBlocks;
bool g_ProfileInstructions; bool g_ProfileInstructions;
void WriteProfileResults(const char *filename) void WriteProfileResults(const std::string& filename)
{ {
JitInterface::WriteProfileResults(filename); JitInterface::WriteProfileResults(filename);
} }

View File

@ -5,6 +5,8 @@
#pragma once #pragma once
#include <string>
#ifdef _WIN32 #ifdef _WIN32
#if _M_X86_32 #if _M_X86_32
@ -58,5 +60,5 @@ namespace Profiler
extern bool g_ProfileBlocks; extern bool g_ProfileBlocks;
extern bool g_ProfileInstructions; extern bool g_ProfileInstructions;
void WriteProfileResults(const char *filename); void WriteProfileResults(const std::string& filename);
} }

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <string>
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
@ -11,7 +13,8 @@
#include "Core/PowerPC/PPCSymbolDB.h" #include "Core/PowerPC/PPCSymbolDB.h"
#include "Core/PowerPC/SignatureDB.h" #include "Core/PowerPC/SignatureDB.h"
namespace { namespace
{
// On-disk format for SignatureDB entries. // On-disk format for SignatureDB entries.
struct FuncDesc struct FuncDesc
@ -23,7 +26,7 @@ struct FuncDesc
} // namespace } // namespace
bool SignatureDB::Load(const char *filename) bool SignatureDB::Load(const std::string& filename)
{ {
File::IOFile f(filename, "rb"); File::IOFile f(filename, "rb");
if (!f) if (!f)
@ -47,7 +50,7 @@ bool SignatureDB::Load(const char *filename)
return true; return true;
} }
bool SignatureDB::Save(const char *filename) bool SignatureDB::Save(const std::string& filename)
{ {
File::IOFile f(filename, "wb"); File::IOFile f(filename, "wb");
if (!f) if (!f)
@ -72,7 +75,7 @@ bool SignatureDB::Save(const char *filename)
} }
//Adds a known function to the hash database //Adds a known function to the hash database
u32 SignatureDB::Add(u32 startAddr, u32 size, const char *name) u32 SignatureDB::Add(u32 startAddr, u32 size, const std::string& name)
{ {
u32 hash = ComputeCodeChecksum(startAddr, startAddr + size); u32 hash = ComputeCodeChecksum(startAddr, startAddr + size);
@ -83,6 +86,7 @@ u32 SignatureDB::Add(u32 startAddr, u32 size, const char *name)
FuncDB::iterator iter = database.find(hash); FuncDB::iterator iter = database.find(hash);
if (iter == database.end()) if (iter == database.end())
database[hash] = temp_dbfunc; database[hash] = temp_dbfunc;
return hash; return hash;
} }
@ -126,12 +130,11 @@ void SignatureDB::Apply(PPCSymbolDB *symbol_db)
symbol_db->Index(); symbol_db->Index();
} }
void SignatureDB::Initialize(PPCSymbolDB *symbol_db, const char *prefix) void SignatureDB::Initialize(PPCSymbolDB *symbol_db, const std::string& prefix)
{ {
std::string prefix_str(prefix);
for (const auto& symbol : symbol_db->Symbols()) for (const auto& symbol : symbol_db->Symbols())
{ {
if ((symbol.second.name.substr(0, prefix_str.size()) == prefix_str) || prefix_str.empty()) if ((symbol.second.name.substr(0, prefix.size()) == prefix) || prefix.empty())
{ {
DBFunc temp_dbfunc; DBFunc temp_dbfunc;
temp_dbfunc.name = symbol.second.name; temp_dbfunc.name = symbol.second.name;

View File

@ -31,15 +31,15 @@ class SignatureDB
public: public:
// Returns the hash. // Returns the hash.
u32 Add(u32 startAddr, u32 size, const char *name); u32 Add(u32 startAddr, u32 size, const std::string& name);
bool Load(const char *filename); // Does not clear. Remember to clear first if that's what you want. bool Load(const std::string& filename); // Does not clear. Remember to clear first if that's what you want.
bool Save(const char *filename); bool Save(const std::string& filename);
void Clean(const char *prefix); void Clean(const char *prefix);
void Clear(); void Clear();
void List(); void List();
void Initialize(PPCSymbolDB *func_db, const char *prefix = ""); void Initialize(PPCSymbolDB *func_db, const std::string& prefix = "");
void Apply(PPCSymbolDB *func_db); void Apply(PPCSymbolDB *func_db);
static u32 ComputeCodeChecksum(u32 offsetStart, u32 offsetEnd); static u32 ComputeCodeChecksum(u32 offsetStart, u32 offsetEnd);

View File

@ -235,7 +235,7 @@ void CompressAndDumpState(CompressAndDumpState_args save_args)
} }
if ((Movie::IsRecordingInput() || Movie::IsPlayingInput()) && !Movie::IsJustStartingRecordingInputFromSaveState()) if ((Movie::IsRecordingInput() || Movie::IsPlayingInput()) && !Movie::IsJustStartingRecordingInputFromSaveState())
Movie::SaveRecording((filename + ".dtm").c_str()); Movie::SaveRecording(filename + ".dtm");
else if (!Movie::IsRecordingInput() && !Movie::IsPlayingInput()) else if (!Movie::IsRecordingInput() && !Movie::IsPlayingInput())
File::Delete(filename + ".dtm"); File::Delete(filename + ".dtm");
@ -290,8 +290,7 @@ void CompressAndDumpState(CompressAndDumpState_args save_args)
f.WriteBytes(buffer_data, buffer_size); f.WriteBytes(buffer_data, buffer_size);
} }
Core::DisplayMessage(StringFromFormat("Saved State to %s", Core::DisplayMessage(StringFromFormat("Saved State to %s", filename.c_str()), 2000);
filename.c_str()).c_str(), 2000);
g_compressAndDumpStateSyncEvent.Set(); g_compressAndDumpStateSyncEvent.Set();
} }
@ -444,7 +443,7 @@ void LoadAs(const std::string& filename)
std::lock_guard<std::mutex> lk(g_cs_undo_load_buffer); std::lock_guard<std::mutex> lk(g_cs_undo_load_buffer);
SaveToBuffer(g_undo_load_buffer); SaveToBuffer(g_undo_load_buffer);
if (Movie::IsRecordingInput() || Movie::IsPlayingInput()) if (Movie::IsRecordingInput() || Movie::IsPlayingInput())
Movie::SaveRecording((File::GetUserPath(D_STATESAVES_IDX) + "undo.dtm").c_str()); Movie::SaveRecording(File::GetUserPath(D_STATESAVES_IDX) + "undo.dtm");
else if (File::Exists(File::GetUserPath(D_STATESAVES_IDX) +"undo.dtm")) else if (File::Exists(File::GetUserPath(D_STATESAVES_IDX) +"undo.dtm"))
File::Delete(File::GetUserPath(D_STATESAVES_IDX) + "undo.dtm"); File::Delete(File::GetUserPath(D_STATESAVES_IDX) + "undo.dtm");
} }
@ -471,9 +470,9 @@ void LoadAs(const std::string& filename)
{ {
if (loadedSuccessfully) if (loadedSuccessfully)
{ {
Core::DisplayMessage(StringFromFormat("Loaded state from %s", filename.c_str()).c_str(), 2000); Core::DisplayMessage(StringFromFormat("Loaded state from %s", filename.c_str()), 2000);
if (File::Exists(filename + ".dtm")) if (File::Exists(filename + ".dtm"))
Movie::LoadInput((filename + ".dtm").c_str()); Movie::LoadInput(filename + ".dtm");
else if (!Movie::IsJustStartingRecordingInputFromSaveState() && !Movie::IsJustStartingPlayingInputFromSaveState()) else if (!Movie::IsJustStartingRecordingInputFromSaveState() && !Movie::IsJustStartingPlayingInputFromSaveState())
Movie::EndPlayInput(false); Movie::EndPlayInput(false);
} }
@ -522,7 +521,7 @@ void VerifyAt(const std::string& filename)
DoState(p); DoState(p);
if (p.GetMode() == PointerWrap::MODE_VERIFY) if (p.GetMode() == PointerWrap::MODE_VERIFY)
Core::DisplayMessage(StringFromFormat("Verified state at %s", filename.c_str()).c_str(), 2000); Core::DisplayMessage(StringFromFormat("Verified state at %s", filename.c_str()), 2000);
else else
Core::DisplayMessage("Unable to Verify : Can't verify state from other revisions !", 4000); Core::DisplayMessage("Unable to Verify : Can't verify state from other revisions !", 4000);
} }
@ -623,7 +622,7 @@ void UndoLoadState()
{ {
LoadFromBuffer(g_undo_load_buffer); LoadFromBuffer(g_undo_load_buffer);
if (Movie::IsRecordingInput() || Movie::IsPlayingInput()) if (Movie::IsRecordingInput() || Movie::IsPlayingInput())
Movie::LoadInput((File::GetUserPath(D_STATESAVES_IDX) + "undo.dtm").c_str()); Movie::LoadInput(File::GetUserPath(D_STATESAVES_IDX) + "undo.dtm");
} }
else else
{ {
@ -639,7 +638,7 @@ void UndoLoadState()
// Load the state that the last save state overwritten on // Load the state that the last save state overwritten on
void UndoSaveState() void UndoSaveState()
{ {
LoadAs((File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav").c_str()); LoadAs(File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav");
} }
} // namespace State } // namespace State

View File

@ -33,7 +33,8 @@ void SectorReader::SetSectorSize(int blocksize)
m_blocksize = blocksize; m_blocksize = blocksize;
} }
SectorReader::~SectorReader() { SectorReader::~SectorReader()
{
for (u8*& block : cache) for (u8*& block : cache)
{ {
delete [] block; delete [] block;
@ -100,6 +101,7 @@ bool SectorReader::Read(u64 offset, u64 size, u8* out_ptr)
block++; block++;
} }
} }
return true; return true;
} }
@ -112,12 +114,13 @@ bool SectorReader::ReadMultipleAlignedBlocks(u64 block_num, u64 num_blocks, u8 *
return false; return false;
memcpy(out_ptr + i * m_blocksize, data, m_blocksize); memcpy(out_ptr + i * m_blocksize, data, m_blocksize);
} }
return true; return true;
} }
IBlobReader* CreateBlobReader(const char* filename) IBlobReader* CreateBlobReader(const std::string& filename)
{ {
if (cdio_is_cdrom(std::string(filename))) if (cdio_is_cdrom(filename))
return DriveReader::Create(filename); return DriveReader::Create(filename);
if (!File::Exists(filename)) if (!File::Exists(filename))

View File

@ -14,6 +14,7 @@
// detect whether the file is a compressed blob, or just a big hunk of data, or a drive, and // detect whether the file is a compressed blob, or just a big hunk of data, or a drive, and
// automatically do the right thing. // automatically do the right thing.
#include <string>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
namespace DiscIO namespace DiscIO
@ -63,13 +64,13 @@ public:
}; };
// Factory function - examines the path to choose the right type of IBlobReader, and returns one. // Factory function - examines the path to choose the right type of IBlobReader, and returns one.
IBlobReader* CreateBlobReader(const char *filename); IBlobReader* CreateBlobReader(const std::string& filename);
typedef void (*CompressCB)(const char *text, float percent, void* arg); typedef void (*CompressCB)(const char *text, float percent, void* arg);
bool CompressFileToBlob(const char *infile, const char *outfile, u32 sub_type = 0, int sector_size = 16384, bool CompressFileToBlob(const std::string& infile, const std::string& outfile, u32 sub_type = 0, int sector_size = 16384,
CompressCB callback = nullptr, void *arg = nullptr); CompressCB callback = nullptr, void *arg = nullptr);
bool DecompressBlobToFile(const char *infile, const char *outfile, bool DecompressBlobToFile(const std::string& infile, const std::string& outfile,
CompressCB callback = nullptr, void *arg = nullptr); CompressCB callback = nullptr, void *arg = nullptr);
} // namespace } // namespace

View File

@ -29,7 +29,7 @@ CISOFileReader::CISOFileReader(std::FILE* file)
m_ciso_map[idx] = (1 == header.map[idx]) ? count++ : UNUSED_BLOCK_ID; m_ciso_map[idx] = (1 == header.map[idx]) ? count++ : UNUSED_BLOCK_ID;
} }
CISOFileReader* CISOFileReader::Create(const char* filename) CISOFileReader* CISOFileReader::Create(const std::string& filename)
{ {
if (IsCISOBlob(filename)) if (IsCISOBlob(filename))
{ {
@ -37,8 +37,10 @@ CISOFileReader* CISOFileReader::Create(const char* filename)
return new CISOFileReader(f.ReleaseHandle()); return new CISOFileReader(f.ReleaseHandle());
} }
else else
{
return nullptr; return nullptr;
} }
}
u64 CISOFileReader::GetDataSize() const u64 CISOFileReader::GetDataSize() const
{ {
@ -79,7 +81,7 @@ bool CISOFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr)
return true; return true;
} }
bool IsCISOBlob(const char* filename) bool IsCISOBlob(const std::string& filename)
{ {
File::IOFile f(filename, "rb"); File::IOFile f(filename, "rb");

View File

@ -5,6 +5,7 @@
#pragma once #pragma once
#include <cstdio> #include <cstdio>
#include <string>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
@ -13,7 +14,7 @@
namespace DiscIO namespace DiscIO
{ {
bool IsCISOBlob(const char* filename); bool IsCISOBlob(const std::string& filename);
static const u32 CISO_HEADER_SIZE = 0x8000; static const u32 CISO_HEADER_SIZE = 0x8000;
static const u32 CISO_MAP_SIZE = CISO_HEADER_SIZE - sizeof(u32) - sizeof(char) * 4; static const u32 CISO_MAP_SIZE = CISO_HEADER_SIZE - sizeof(u32) - sizeof(char) * 4;
@ -33,7 +34,7 @@ struct CISOHeader
class CISOFileReader : public IBlobReader class CISOFileReader : public IBlobReader
{ {
public: public:
static CISOFileReader* Create(const char* filename); static CISOFileReader* Create(const std::string& filename);
u64 GetDataSize() const override; u64 GetDataSize() const override;
u64 GetRawSize() const override; u64 GetRawSize() const override;

View File

@ -25,7 +25,7 @@
namespace DiscIO namespace DiscIO
{ {
CompressedBlobReader::CompressedBlobReader(const char *filename) : file_name(filename) CompressedBlobReader::CompressedBlobReader(const std::string& filename) : file_name(filename)
{ {
m_file.Open(filename, "rb"); m_file.Open(filename, "rb");
file_size = File::GetSize(filename); file_size = File::GetSize(filename);
@ -50,7 +50,7 @@ CompressedBlobReader::CompressedBlobReader(const char *filename) : file_name(fil
memset(zlib_buffer, 0, zlib_buffer_size); memset(zlib_buffer, 0, zlib_buffer_size);
} }
CompressedBlobReader* CompressedBlobReader::Create(const char* filename) CompressedBlobReader* CompressedBlobReader::Create(const std::string& filename)
{ {
if (IsCompressedBlob(filename)) if (IsCompressedBlob(filename))
return new CompressedBlobReader(filename); return new CompressedBlobReader(filename);
@ -140,14 +140,14 @@ void CompressedBlobReader::GetBlock(u64 block_num, u8 *out_ptr)
} }
} }
bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type, bool CompressFileToBlob(const std::string& infile, const std::string& outfile, u32 sub_type,
int block_size, CompressCB callback, void* arg) int block_size, CompressCB callback, void* arg)
{ {
bool scrubbing = false; bool scrubbing = false;
if (IsCompressedBlob(infile)) if (IsCompressedBlob(infile))
{ {
PanicAlertT("%s is already compressed! Cannot compress it further.", infile); PanicAlertT("%s is already compressed! Cannot compress it further.", infile.c_str());
return false; return false;
} }
@ -155,7 +155,7 @@ bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type,
{ {
if (!DiscScrubber::SetupScrub(infile, block_size)) if (!DiscScrubber::SetupScrub(infile, block_size))
{ {
PanicAlertT("%s failed to be scrubbed. Probably the image is corrupt.", infile); PanicAlertT("%s failed to be scrubbed. Probably the image is corrupt.", infile.c_str());
return false; return false;
} }
@ -278,7 +278,7 @@ cleanup:
return true; return true;
} }
bool DecompressBlobToFile(const char* infile, const char* outfile, CompressCB callback, void* arg) bool DecompressBlobToFile(const std::string& infile, const std::string& outfile, CompressCB callback, void* arg)
{ {
if (!IsCompressedBlob(infile)) if (!IsCompressedBlob(infile))
{ {
@ -320,7 +320,7 @@ bool DecompressBlobToFile(const char* infile, const char* outfile, CompressCB ca
return true; return true;
} }
bool IsCompressedBlob(const char* filename) bool IsCompressedBlob(const std::string& filename)
{ {
File::IOFile f(filename, "rb"); File::IOFile f(filename, "rb");

View File

@ -23,7 +23,7 @@
namespace DiscIO namespace DiscIO
{ {
bool IsCompressedBlob(const char* filename); bool IsCompressedBlob(const std::string& filename);
const u32 kBlobCookie = 0xB10BC001; const u32 kBlobCookie = 0xB10BC001;
@ -46,7 +46,7 @@ struct CompressedBlobHeader // 32 bytes
class CompressedBlobReader : public SectorReader class CompressedBlobReader : public SectorReader
{ {
public: public:
static CompressedBlobReader* Create(const char *filename); static CompressedBlobReader* Create(const std::string& filename);
~CompressedBlobReader(); ~CompressedBlobReader();
const CompressedBlobHeader &GetHeader() const { return header; } const CompressedBlobHeader &GetHeader() const { return header; }
u64 GetDataSize() const override { return header.data_size; } u64 GetDataSize() const override { return header.data_size; }
@ -54,7 +54,7 @@ public:
u64 GetBlockCompressedSize(u64 block_num) const; u64 GetBlockCompressedSize(u64 block_num) const;
void GetBlock(u64 block_num, u8* out_ptr) override; void GetBlock(u64 block_num, u8* out_ptr) override;
private: private:
CompressedBlobReader(const char *filename); CompressedBlobReader(const std::string& filename);
CompressedBlobHeader header; CompressedBlobHeader header;
u64* block_pointers; u64* block_pointers;

View File

@ -81,10 +81,10 @@ bool ParsePartitionData(SPartition& _rPartition);
u32 GetDOLSize(u64 _DOLOffset); u32 GetDOLSize(u64 _DOLOffset);
bool SetupScrub(const char* filename, int block_size) bool SetupScrub(const std::string& filename, int block_size)
{ {
bool success = true; bool success = true;
m_Filename = std::string(filename); m_Filename = filename;
m_BlockSize = block_size; m_BlockSize = block_size;
if (CLUSTER_SIZE % m_BlockSize != 0) if (CLUSTER_SIZE % m_BlockSize != 0)
@ -102,7 +102,7 @@ bool SetupScrub(const char* filename, int block_size)
// Warn if not DVD5 or DVD9 size // Warn if not DVD5 or DVD9 size
if (numClusters != 0x23048 && numClusters != 0x46090) if (numClusters != 0x23048 && numClusters != 0x46090)
WARN_LOG(DISCIO, "%s is not a standard sized Wii disc! (%x blocks)", filename, numClusters); WARN_LOG(DISCIO, "%s is not a standard sized Wii disc! (%x blocks)", filename.c_str(), numClusters);
// Table of free blocks // Table of free blocks
m_FreeTable = new u8[numClusters]; m_FreeTable = new u8[numClusters];

View File

@ -13,6 +13,7 @@
#pragma once #pragma once
#include <string>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
namespace File { class IOFile; } namespace File { class IOFile; }
@ -23,7 +24,7 @@ namespace DiscIO
namespace DiscScrubber namespace DiscScrubber
{ {
bool SetupScrub(const char* filename, int block_size); bool SetupScrub(const std::string& filename, int block_size);
void GetNextBlock(File::IOFile& in, u8* buffer); void GetNextBlock(File::IOFile& in, u8* buffer);
void Cleanup(); void Cleanup();

View File

@ -4,6 +4,7 @@
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <string>
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
@ -17,7 +18,7 @@
namespace DiscIO namespace DiscIO
{ {
DriveReader::DriveReader(const char *drive) DriveReader::DriveReader(const std::string& drive)
{ {
#ifdef _WIN32 #ifdef _WIN32
SectorReader::SetSectorSize(2048); SectorReader::SetSectorSize(2048);
@ -56,8 +57,10 @@ DriveReader::DriveReader(const char *drive)
#endif #endif
} }
else else
NOTICE_LOG(DISCIO, "Load from DVD backup failed or no disc in drive %s", drive); {
} // DriveReader::DriveReader NOTICE_LOG(DISCIO, "Load from DVD backup failed or no disc in drive %s", drive.c_str());
}
}
DriveReader::~DriveReader() DriveReader::~DriveReader()
{ {
@ -79,14 +82,16 @@ DriveReader::~DriveReader()
#endif #endif
} }
DriveReader *DriveReader::Create(const char *drive) DriveReader* DriveReader::Create(const std::string& drive)
{ {
DriveReader* reader = new DriveReader(drive); DriveReader* reader = new DriveReader(drive);
if (!reader->IsOK()) if (!reader->IsOK())
{ {
delete reader; delete reader;
return nullptr; return nullptr;
} }
return reader; return reader;
} }

View File

@ -4,6 +4,8 @@
#pragma once #pragma once
#include <string>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "DiscIO/Blob.h" #include "DiscIO/Blob.h"
@ -19,7 +21,7 @@ namespace DiscIO
class DriveReader : public SectorReader class DriveReader : public SectorReader
{ {
private: private:
DriveReader(const char *drive); DriveReader(const std::string& drive);
void GetBlock(u64 block_num, u8 *out_ptr) override; void GetBlock(u64 block_num, u8 *out_ptr) override;
#ifdef _WIN32 #ifdef _WIN32
@ -33,7 +35,7 @@ private:
s64 size; s64 size;
public: public:
static DriveReader *Create(const char *drive); static DriveReader* Create(const std::string& drive);
~DriveReader(); ~DriveReader();
u64 GetDataSize() const override { return size; } u64 GetDataSize() const override { return size; }
u64 GetRawSize() const override { return size; } u64 GetRawSize() const override { return size; }

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <string>
#include "DiscIO/FileBlob.h" #include "DiscIO/FileBlob.h"
namespace DiscIO namespace DiscIO
@ -13,7 +14,7 @@ PlainFileReader::PlainFileReader(std::FILE* file)
m_size = m_file.GetSize(); m_size = m_file.GetSize();
} }
PlainFileReader* PlainFileReader::Create(const char* filename) PlainFileReader* PlainFileReader::Create(const std::string& filename)
{ {
File::IOFile f(filename, "rb"); File::IOFile f(filename, "rb");
if (f) if (f)

View File

@ -5,6 +5,7 @@
#pragma once #pragma once
#include <cstdio> #include <cstdio>
#include <string>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
@ -21,7 +22,7 @@ class PlainFileReader : public IBlobReader
s64 m_size; s64 m_size;
public: public:
static PlainFileReader* Create(const char* filename); static PlainFileReader* Create(const std::string& filename);
u64 GetDataSize() const override { return m_size; } u64 GetDataSize() const override { return m_size; }
u64 GetRawSize() const override { return m_size; } u64 GetRawSize() const override { return m_size; }

View File

@ -33,7 +33,7 @@ CFileSystemGCWii::~CFileSystemGCWii()
m_FileInfoVector.clear(); m_FileInfoVector.clear();
} }
u64 CFileSystemGCWii::GetFileSize(const char* _rFullPath) u64 CFileSystemGCWii::GetFileSize(const std::string& _rFullPath)
{ {
if (!m_Initialized) if (!m_Initialized)
InitFileSystem(); InitFileSystem();
@ -63,7 +63,7 @@ const char* CFileSystemGCWii::GetFileName(u64 _Address)
return nullptr; return nullptr;
} }
u64 CFileSystemGCWii::ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) u64 CFileSystemGCWii::ReadFile(const std::string& _rFullPath, u8* _pBuffer, size_t _MaxBufferSize)
{ {
if (!m_Initialized) if (!m_Initialized)
InitFileSystem(); InitFileSystem();
@ -75,14 +75,14 @@ u64 CFileSystemGCWii::ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _Max
if (pFileInfo->m_FileSize > _MaxBufferSize) if (pFileInfo->m_FileSize > _MaxBufferSize)
return 0; return 0;
DEBUG_LOG(DISCIO, "Filename: %s. Offset: %" PRIx64 ". Size: %" PRIx64, _rFullPath, DEBUG_LOG(DISCIO, "Filename: %s. Offset: %" PRIx64 ". Size: %" PRIx64, _rFullPath.c_str(),
pFileInfo->m_Offset, pFileInfo->m_FileSize); pFileInfo->m_Offset, pFileInfo->m_FileSize);
m_rVolume->Read(pFileInfo->m_Offset, pFileInfo->m_FileSize, _pBuffer); m_rVolume->Read(pFileInfo->m_Offset, pFileInfo->m_FileSize, _pBuffer);
return pFileInfo->m_FileSize; return pFileInfo->m_FileSize;
} }
bool CFileSystemGCWii::ExportFile(const char* _rFullPath, const char* _rExportFilename) bool CFileSystemGCWii::ExportFile(const std::string& _rFullPath, const std::string& _rExportFilename)
{ {
if (!m_Initialized) if (!m_Initialized)
InitFileSystem(); InitFileSystem();
@ -122,7 +122,7 @@ bool CFileSystemGCWii::ExportFile(const char* _rFullPath, const char* _rExportFi
return result; return result;
} }
bool CFileSystemGCWii::ExportApploader(const char* _rExportFolder) const bool CFileSystemGCWii::ExportApploader(const std::string& _rExportFolder) const
{ {
u32 AppSize = Read32(0x2440 + 0x14);// apploader size u32 AppSize = Read32(0x2440 + 0x14);// apploader size
AppSize += Read32(0x2440 + 0x18); // + trailer size AppSize += Read32(0x2440 + 0x18); // + trailer size
@ -177,7 +177,7 @@ bool CFileSystemGCWii::GetBootDOL(u8* &buffer, u32 DolSize) const
return m_rVolume->Read(DolOffset, DolSize, buffer); return m_rVolume->Read(DolOffset, DolSize, buffer);
} }
bool CFileSystemGCWii::ExportDOL(const char* _rExportFolder) const bool CFileSystemGCWii::ExportDOL(const std::string& _rExportFolder) const
{ {
u32 DolOffset = Read32(0x420) << m_OffsetShift; u32 DolOffset = Read32(0x420) << m_OffsetShift;
u32 DolSize = GetBootDOLSize(); u32 DolSize = GetBootDOLSize();
@ -232,14 +232,14 @@ size_t CFileSystemGCWii::GetFileList(std::vector<const SFileInfo *> &_rFilenames
return m_FileInfoVector.size(); return m_FileInfoVector.size();
} }
const SFileInfo* CFileSystemGCWii::FindFileInfo(const char* _rFullPath) const SFileInfo* CFileSystemGCWii::FindFileInfo(const std::string& _rFullPath)
{ {
if (!m_Initialized) if (!m_Initialized)
InitFileSystem(); InitFileSystem();
for (auto& fileInfo : m_FileInfoVector) for (auto& fileInfo : m_FileInfoVector)
{ {
if (!strcasecmp(fileInfo.m_FullPath, _rFullPath)) if (!strcasecmp(fileInfo.m_FullPath, _rFullPath.c_str()))
return &fileInfo; return &fileInfo;
} }

View File

@ -22,13 +22,13 @@ public:
CFileSystemGCWii(const IVolume* _rVolume); CFileSystemGCWii(const IVolume* _rVolume);
virtual ~CFileSystemGCWii(); virtual ~CFileSystemGCWii();
virtual bool IsValid() const override { return m_Valid; } virtual bool IsValid() const override { return m_Valid; }
virtual u64 GetFileSize(const char* _rFullPath) override; virtual u64 GetFileSize(const std::string& _rFullPath) override;
virtual size_t GetFileList(std::vector<const SFileInfo *> &_rFilenames) override; virtual size_t GetFileList(std::vector<const SFileInfo *> &_rFilenames) override;
virtual const char* GetFileName(u64 _Address) override; virtual const char* GetFileName(u64 _Address) override;
virtual u64 ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) override; virtual u64 ReadFile(const std::string& _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) override;
virtual bool ExportFile(const char* _rFullPath, const char* _rExportFilename) override; virtual bool ExportFile(const std::string& _rFullPath, const std::string&_rExportFilename) override;
virtual bool ExportApploader(const char* _rExportFolder) const override; virtual bool ExportApploader(const std::string& _rExportFolder) const override;
virtual bool ExportDOL(const char* _rExportFolder) const override; virtual bool ExportDOL(const std::string& _rExportFolder) const override;
virtual bool GetBootDOL(u8* &buffer, u32 DolSize) const override; virtual bool GetBootDOL(u8* &buffer, u32 DolSize) const override;
virtual u32 GetBootDOLSize() const override; virtual u32 GetBootDOLSize() const override;
@ -40,7 +40,7 @@ private:
std::vector <SFileInfo> m_FileInfoVector; std::vector <SFileInfo> m_FileInfoVector;
u32 Read32(u64 _Offset) const; u32 Read32(u64 _Offset) const;
std::string GetStringFromOffset(u64 _Offset) const; std::string GetStringFromOffset(u64 _Offset) const;
const SFileInfo* FindFileInfo(const char* _rFullPath); const SFileInfo* FindFileInfo(const std::string& _rFullPath);
bool DetectFileSystem(); bool DetectFileSystem();
void InitFileSystem(); void InitFileSystem();
size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const char* _szDirectory, u64 _NameTableOffset); size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const char* _szDirectory, u64 _NameTableOffset);

View File

@ -6,6 +6,7 @@
#include <cstddef> #include <cstddef>
#include <cstring> #include <cstring>
#include <string>
#include <vector> #include <vector>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
@ -43,11 +44,11 @@ public:
virtual ~IFileSystem(); virtual ~IFileSystem();
virtual bool IsValid() const = 0; virtual bool IsValid() const = 0;
virtual size_t GetFileList(std::vector<const SFileInfo *> &_rFilenames) = 0; virtual size_t GetFileList(std::vector<const SFileInfo *> &_rFilenames) = 0;
virtual u64 GetFileSize(const char* _rFullPath) = 0; virtual u64 GetFileSize(const std::string& _rFullPath) = 0;
virtual u64 ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) = 0; virtual u64 ReadFile(const std::string& _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) = 0;
virtual bool ExportFile(const char* _rFullPath, const char* _rExportFilename) = 0; virtual bool ExportFile(const std::string& _rFullPath, const std::string& _rExportFilename) = 0;
virtual bool ExportApploader(const char* _rExportFolder) const = 0; virtual bool ExportApploader(const std::string& _rExportFolder) const = 0;
virtual bool ExportDOL(const char* _rExportFolder) const = 0; virtual bool ExportDOL(const std::string& _rExportFolder) const = 0;
virtual const char* GetFileName(u64 _Address) = 0; virtual const char* GetFileName(u64 _Address) = 0;
virtual bool GetBootDOL(u8* &buffer, u32 DolSize) const = 0; virtual bool GetBootDOL(u8* &buffer, u32 DolSize) const = 0;
virtual u32 GetBootDOLSize() const = 0; virtual u32 GetBootDOLSize() const = 0;

View File

@ -74,7 +74,7 @@ EDiscType GetDiscType(IBlobReader& _rReader);
IVolume* CreateVolumeFromFilename(const std::string& _rFilename, u32 _PartitionGroup, u32 _VolumeNum) IVolume* CreateVolumeFromFilename(const std::string& _rFilename, u32 _PartitionGroup, u32 _VolumeNum)
{ {
IBlobReader* pReader = CreateBlobReader(_rFilename.c_str()); IBlobReader* pReader = CreateBlobReader(_rFilename);
if (pReader == nullptr) if (pReader == nullptr)
return nullptr; return nullptr;

View File

@ -133,7 +133,7 @@ bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
_dbg_assert_(DVDINTERFACE, fileIter->first <= _Offset); _dbg_assert_(DVDINTERFACE, fileIter->first <= _Offset);
u64 fileOffset = _Offset - fileIter->first; u64 fileOffset = _Offset - fileIter->first;
PlainFileReader* reader = PlainFileReader::Create(fileIter->second.c_str()); PlainFileReader* reader = PlainFileReader::Create(fileIter->second);
if (reader == nullptr) if (reader == nullptr)
return false; return false;
@ -326,12 +326,12 @@ bool CVolumeDirectory::SetApploader(const std::string& _rApploader)
} }
} }
void CVolumeDirectory::SetDOL(const std::string& _rDOL) void CVolumeDirectory::SetDOL(const std::string& rDOL)
{ {
if (!_rDOL.empty()) if (!rDOL.empty())
{ {
std::string data; std::string data;
File::ReadFileToString(_rDOL.c_str(), data); File::ReadFileToString(rDOL, data);
m_DOLSize = data.size(); m_DOLSize = data.size();
m_DOL = new u8[m_DOLSize]; m_DOL = new u8[m_DOLSize];
copy(data.begin(), data.end(), m_DOL); copy(data.begin(), data.end(), m_DOL);

View File

@ -23,10 +23,10 @@ static inline u64 align(u64 value, u64 bounds)
return (value + (bounds - 1)) & (~(bounds - 1)); return (value + (bounds - 1)) & (~(bounds - 1));
} }
WbfsFileReader::WbfsFileReader(const char* filename) WbfsFileReader::WbfsFileReader(const std::string& filename)
: m_total_files(0), m_size(0), m_wlba_table(nullptr), m_good(true) : m_total_files(0), m_size(0), m_wlba_table(nullptr), m_good(true)
{ {
if (!filename || (strlen(filename) < 4) || !OpenFiles(filename) || !ReadHeader()) if (filename.length() < 4 || !OpenFiles(filename) || !ReadHeader())
{ {
m_good = false; m_good = false;
return; return;
@ -48,7 +48,7 @@ WbfsFileReader::~WbfsFileReader()
delete[] m_wlba_table; delete[] m_wlba_table;
} }
bool WbfsFileReader::OpenFiles(const char* filename) bool WbfsFileReader::OpenFiles(const std::string& filename)
{ {
m_total_files = 0; m_total_files = 0;
@ -171,7 +171,7 @@ File::IOFile& WbfsFileReader::SeekToCluster(u64 offset, u64* available)
return m_files[0]->file; return m_files[0]->file;
} }
WbfsFileReader* WbfsFileReader::Create(const char* filename) WbfsFileReader* WbfsFileReader::Create(const std::string& filename)
{ {
WbfsFileReader* reader = new WbfsFileReader(filename); WbfsFileReader* reader = new WbfsFileReader(filename);
@ -186,7 +186,7 @@ WbfsFileReader* WbfsFileReader::Create(const char* filename)
} }
} }
bool IsWbfsBlob(const char* filename) bool IsWbfsBlob(const std::string& filename)
{ {
File::IOFile f(filename, "rb"); File::IOFile f(filename, "rb");

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#include <string>
#include <vector> #include <vector>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
@ -15,10 +16,10 @@ namespace DiscIO
class WbfsFileReader : public IBlobReader class WbfsFileReader : public IBlobReader
{ {
WbfsFileReader(const char* filename); WbfsFileReader(const std::string& filename);
~WbfsFileReader(); ~WbfsFileReader();
bool OpenFiles(const char* filename); bool OpenFiles(const std::string& filename);
bool ReadHeader(); bool ReadHeader();
File::IOFile& SeekToCluster(u64 offset, u64* available); File::IOFile& SeekToCluster(u64 offset, u64* available);
@ -54,14 +55,14 @@ class WbfsFileReader : public IBlobReader
bool m_good; bool m_good;
public: public:
static WbfsFileReader* Create(const char* filename); static WbfsFileReader* Create(const std::string& filename);
u64 GetDataSize() const override { return m_size; } u64 GetDataSize() const override { return m_size; }
u64 GetRawSize() const override { return m_size; } u64 GetRawSize() const override { return m_size; }
bool Read(u64 offset, u64 nbytes, u8* out_ptr) override; bool Read(u64 offset, u64 nbytes, u8* out_ptr) override;
}; };
bool IsWbfsBlob(const char* filename); bool IsWbfsBlob(const std::string& filename);
} // namespace } // namespace

View File

@ -34,7 +34,7 @@ private:
WiiWAD::WiiWAD(const std::string& _rName) WiiWAD::WiiWAD(const std::string& _rName)
{ {
DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rName.c_str()); DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rName);
if (pReader == nullptr || File::IsDirectory(_rName)) if (pReader == nullptr || File::IsDirectory(_rName))
{ {
m_Valid = false; m_Valid = false;
@ -120,7 +120,7 @@ bool WiiWAD::ParseWAD(DiscIO::IBlobReader& _rReader)
bool WiiWAD::IsWiiWAD(const std::string& _rName) bool WiiWAD::IsWiiWAD(const std::string& _rName)
{ {
DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rName.c_str()); DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rName);
if (pReader == nullptr) if (pReader == nullptr)
return false; return false;

View File

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

View File

@ -1062,7 +1062,7 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
{ {
if (File::Exists(filename)) if (File::Exists(filename))
{ {
GCMemcard memorycard(filename.c_str()); GCMemcard memorycard(filename);
if (!memorycard.IsValid()) if (!memorycard.IsValid())
{ {
PanicAlertT("Cannot use that file as a memory card.\n%s\n" \ 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); wxString AddressString = m_pEditAddress->GetLineText(0);
u32 Address = 0; u32 Address = 0;
if (AsciiToHex(WxStrToStr(AddressString).c_str(), Address)) if (AsciiToHex(WxStrToStr(AddressString), Address))
{ {
PowerPC::breakpoints.Add(Address); PowerPC::breakpoints.Add(Address);
Parent->NotifyUpdate(); Parent->NotifyUpdate();

View File

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

View File

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

View File

@ -81,9 +81,9 @@ void MemoryCheckDlg::OnOK(wxCommandEvent& event)
u32 StartAddress, EndAddress; u32 StartAddress, EndAddress;
bool EndAddressOK = EndAddressString.Len() && 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)) (OnRead || OnWrite) && (Log || Break))
{ {
TMemCheck MemCheck; 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 // Attempt to save the file to the path the user chose
wxBeginBusyCursor(); wxBeginBusyCursor();
bool result = file->Save(WxStrToStr(path).c_str()); bool result = file->Save(WxStrToStr(path));
wxEndBusyCursor(); wxEndBusyCursor();
// Wasn't able to save the file, shit's whack, yo. // Wasn't able to save the file, shit's whack, yo.

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More