pointless micro optimisations
This commit is contained in:
parent
3ada5b9bc8
commit
4b170b94d5
|
@ -28,7 +28,7 @@ using Platform::LogLevel;
|
||||||
// TODO: more user-friendly error reporting
|
// TODO: more user-friendly error reporting
|
||||||
|
|
||||||
|
|
||||||
ARCodeFile::ARCodeFile(std::string filename)
|
ARCodeFile::ARCodeFile(const std::string& filename)
|
||||||
{
|
{
|
||||||
Filename = filename;
|
Filename = filename;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ typedef std::list<ARCodeCat> ARCodeCatList;
|
||||||
class ARCodeFile
|
class ARCodeFile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ARCodeFile(std::string filename);
|
ARCodeFile(const std::string& filename);
|
||||||
~ARCodeFile();
|
~ARCodeFile();
|
||||||
|
|
||||||
bool Error;
|
bool Error;
|
||||||
|
|
|
@ -769,7 +769,7 @@ void DSi_SDHost::CheckSwapFIFO()
|
||||||
|
|
||||||
#define MMC_DESC (Internal?"NAND":"SDcard")
|
#define MMC_DESC (Internal?"NAND":"SDcard")
|
||||||
|
|
||||||
DSi_MMCStorage::DSi_MMCStorage(DSi_SDHost* host, bool internal, std::string filename)
|
DSi_MMCStorage::DSi_MMCStorage(DSi_SDHost* host, bool internal, const std::string& filename)
|
||||||
: DSi_SDDevice(host)
|
: DSi_SDDevice(host)
|
||||||
{
|
{
|
||||||
Internal = internal;
|
Internal = internal;
|
||||||
|
@ -780,7 +780,7 @@ DSi_MMCStorage::DSi_MMCStorage(DSi_SDHost* host, bool internal, std::string file
|
||||||
ReadOnly = false;
|
ReadOnly = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DSi_MMCStorage::DSi_MMCStorage(DSi_SDHost* host, bool internal, std::string filename, u64 size, bool readonly, std::string sourcedir)
|
DSi_MMCStorage::DSi_MMCStorage(DSi_SDHost* host, bool internal, const std::string& filename, u64 size, bool readonly, const std::string& sourcedir)
|
||||||
: DSi_SDDevice(host)
|
: DSi_SDDevice(host)
|
||||||
{
|
{
|
||||||
Internal = internal;
|
Internal = internal;
|
||||||
|
|
|
@ -125,8 +125,8 @@ protected:
|
||||||
class DSi_MMCStorage : public DSi_SDDevice
|
class DSi_MMCStorage : public DSi_SDDevice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DSi_MMCStorage(DSi_SDHost* host, bool internal, std::string filename);
|
DSi_MMCStorage(DSi_SDHost* host, bool internal, const std::string& filename);
|
||||||
DSi_MMCStorage(DSi_SDHost* host, bool internal, std::string filename, u64 size, bool readonly, std::string sourcedir);
|
DSi_MMCStorage(DSi_SDHost* host, bool internal, const std::string& filename, u64 size, bool readonly, const std::string& sourcedir);
|
||||||
~DSi_MMCStorage();
|
~DSi_MMCStorage();
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace fs = std::filesystem;
|
||||||
#endif // __WIN32__
|
#endif // __WIN32__
|
||||||
|
|
||||||
|
|
||||||
FATStorage::FATStorage(std::string filename, u64 size, bool readonly, std::string sourcedir)
|
FATStorage::FATStorage(const std::string& filename, u64 size, bool readonly, const std::string& sourcedir)
|
||||||
{
|
{
|
||||||
ReadOnly = readonly;
|
ReadOnly = readonly;
|
||||||
Load(filename, size, sourcedir);
|
Load(filename, size, sourcedir);
|
||||||
|
@ -69,7 +69,7 @@ void FATStorage::Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FATStorage::InjectFile(std::string path, u8* data, u32 len)
|
bool FATStorage::InjectFile(const std::string& path, u8* data, u32 len)
|
||||||
{
|
{
|
||||||
if (!File) return false;
|
if (!File) return false;
|
||||||
if (FF_File) return false;
|
if (FF_File) return false;
|
||||||
|
@ -89,9 +89,10 @@ bool FATStorage::InjectFile(std::string path, u8* data, u32 len)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
path = "0:/" + path;
|
std::string prefixedPath("0:/");
|
||||||
|
prefixedPath += path;
|
||||||
FF_FIL file;
|
FF_FIL file;
|
||||||
res = f_open(&file, path.c_str(), FA_CREATE_ALWAYS | FA_WRITE);
|
res = f_open(&file, prefixedPath.c_str(), FA_CREATE_ALWAYS | FA_WRITE);
|
||||||
if (res != FR_OK)
|
if (res != FR_OK)
|
||||||
{
|
{
|
||||||
f_unmount("0:");
|
f_unmount("0:");
|
||||||
|
@ -345,7 +346,7 @@ void FATStorage::SaveIndex()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FATStorage::ExportFile(std::string path, fs::path out)
|
bool FATStorage::ExportFile(const std::string& path, fs::path out)
|
||||||
{
|
{
|
||||||
FF_FIL file;
|
FF_FIL file;
|
||||||
FILE* fout;
|
FILE* fout;
|
||||||
|
@ -393,7 +394,7 @@ bool FATStorage::ExportFile(std::string path, fs::path out)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FATStorage::ExportDirectory(std::string path, std::string outbase, int level)
|
void FATStorage::ExportDirectory(const std::string& path, const std::string& outbase, int level)
|
||||||
{
|
{
|
||||||
if (level >= 32) return;
|
if (level >= 32) return;
|
||||||
|
|
||||||
|
@ -492,7 +493,7 @@ void FATStorage::ExportDirectory(std::string path, std::string outbase, int leve
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FATStorage::DeleteHostDirectory(std::string path, std::string outbase, int level)
|
bool FATStorage::DeleteHostDirectory(const std::string& path, const std::string& outbase, int level)
|
||||||
{
|
{
|
||||||
if (level >= 32) return false;
|
if (level >= 32) return false;
|
||||||
|
|
||||||
|
@ -565,7 +566,7 @@ bool FATStorage::DeleteHostDirectory(std::string path, std::string outbase, int
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FATStorage::ExportChanges(std::string outbase)
|
void FATStorage::ExportChanges(const std::string& outbase)
|
||||||
{
|
{
|
||||||
// reflect changes in the FAT volume to the host filesystem
|
// reflect changes in the FAT volume to the host filesystem
|
||||||
// * delete directories and files that exist in the index but not in the volume
|
// * delete directories and files that exist in the index but not in the volume
|
||||||
|
@ -652,7 +653,7 @@ bool FATStorage::CanFitFile(u32 len)
|
||||||
return (freeclusters >= len);
|
return (freeclusters >= len);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FATStorage::DeleteDirectory(std::string path, int level)
|
bool FATStorage::DeleteDirectory(const std::string& path, int level)
|
||||||
{
|
{
|
||||||
if (level >= 32) return false;
|
if (level >= 32) return false;
|
||||||
if (path.length() < 1) return false;
|
if (path.length() < 1) return false;
|
||||||
|
@ -710,7 +711,7 @@ bool FATStorage::DeleteDirectory(std::string path, int level)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FATStorage::CleanupDirectory(std::string sourcedir, std::string path, int level)
|
void FATStorage::CleanupDirectory(const std::string& sourcedir, const std::string& path, int level)
|
||||||
{
|
{
|
||||||
if (level >= 32) return;
|
if (level >= 32) return;
|
||||||
|
|
||||||
|
@ -778,7 +779,7 @@ void FATStorage::CleanupDirectory(std::string sourcedir, std::string path, int l
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FATStorage::ImportFile(std::string path, fs::path in)
|
bool FATStorage::ImportFile(const std::string& path, fs::path in)
|
||||||
{
|
{
|
||||||
FF_FIL file;
|
FF_FIL file;
|
||||||
FILE* fin;
|
FILE* fin;
|
||||||
|
@ -825,7 +826,7 @@ bool FATStorage::ImportFile(std::string path, fs::path in)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FATStorage::ImportDirectory(std::string sourcedir)
|
bool FATStorage::ImportDirectory(const std::string& sourcedir)
|
||||||
{
|
{
|
||||||
// remove whatever isn't in the index
|
// remove whatever isn't in the index
|
||||||
CleanupDirectory(sourcedir, "", 0);
|
CleanupDirectory(sourcedir, "", 0);
|
||||||
|
@ -938,7 +939,7 @@ u64 FATStorage::GetDirectorySize(fs::path sourcedir)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FATStorage::Load(std::string filename, u64 size, std::string sourcedir)
|
bool FATStorage::Load(const std::string& filename, u64 size, const std::string& sourcedir)
|
||||||
{
|
{
|
||||||
FilePath = filename;
|
FilePath = filename;
|
||||||
FileSize = size;
|
FileSize = size;
|
||||||
|
|
|
@ -31,13 +31,13 @@
|
||||||
class FATStorage
|
class FATStorage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FATStorage(std::string filename, u64 size, bool readonly, std::string sourcedir);
|
FATStorage(const std::string& filename, u64 size, bool readonly, const std::string& sourcedir);
|
||||||
~FATStorage();
|
~FATStorage();
|
||||||
|
|
||||||
bool Open();
|
bool Open();
|
||||||
void Close();
|
void Close();
|
||||||
|
|
||||||
bool InjectFile(std::string path, u8* data, u32 len);
|
bool InjectFile(const std::string& path, u8* data, u32 len);
|
||||||
|
|
||||||
u32 ReadSectors(u32 start, u32 num, u8* data);
|
u32 ReadSectors(u32 start, u32 num, u8* data);
|
||||||
u32 WriteSectors(u32 start, u32 num, u8* data);
|
u32 WriteSectors(u32 start, u32 num, u8* data);
|
||||||
|
@ -62,19 +62,19 @@ private:
|
||||||
void LoadIndex();
|
void LoadIndex();
|
||||||
void SaveIndex();
|
void SaveIndex();
|
||||||
|
|
||||||
bool ExportFile(std::string path, std::filesystem::path out);
|
bool ExportFile(const std::string& path, std::filesystem::path out);
|
||||||
void ExportDirectory(std::string path, std::string outbase, int level);
|
void ExportDirectory(const std::string& path, const std::string& outbase, int level);
|
||||||
bool DeleteHostDirectory(std::string path, std::string outbase, int level);
|
bool DeleteHostDirectory(const std::string& path, const std::string& outbase, int level);
|
||||||
void ExportChanges(std::string outbase);
|
void ExportChanges(const std::string& outbase);
|
||||||
|
|
||||||
bool CanFitFile(u32 len);
|
bool CanFitFile(u32 len);
|
||||||
bool DeleteDirectory(std::string path, int level);
|
bool DeleteDirectory(const std::string& path, int level);
|
||||||
void CleanupDirectory(std::string sourcedir, std::string path, int level);
|
void CleanupDirectory(const std::string& sourcedir, const std::string& path, int level);
|
||||||
bool ImportFile(std::string path, std::filesystem::path in);
|
bool ImportFile(const std::string& path, std::filesystem::path in);
|
||||||
bool ImportDirectory(std::string sourcedir);
|
bool ImportDirectory(const std::string& sourcedir);
|
||||||
u64 GetDirectorySize(std::filesystem::path sourcedir);
|
u64 GetDirectorySize(std::filesystem::path sourcedir);
|
||||||
|
|
||||||
bool Load(std::string filename, u64 size, std::string sourcedir);
|
bool Load(const std::string& filename, u64 size, const std::string& sourcedir);
|
||||||
bool Save();
|
bool Save();
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -377,7 +377,7 @@ bool NeedsDirectBoot()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupDirectBoot(std::string romname)
|
void SetupDirectBoot(const std::string& romname)
|
||||||
{
|
{
|
||||||
if (ConsoleType == 1)
|
if (ConsoleType == 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -244,7 +244,7 @@ void EjectCart();
|
||||||
bool CartInserted();
|
bool CartInserted();
|
||||||
|
|
||||||
bool NeedsDirectBoot();
|
bool NeedsDirectBoot();
|
||||||
void SetupDirectBoot(std::string romname);
|
void SetupDirectBoot(const std::string& romname);
|
||||||
|
|
||||||
bool LoadGBACart(const u8* romdata, u32 romlen, const u8* savedata, u32 savelen);
|
bool LoadGBACart(const u8* romdata, u32 romlen, const u8* savedata, u32 savelen);
|
||||||
void LoadGBAAddon(int type);
|
void LoadGBAAddon(int type);
|
||||||
|
|
|
@ -232,7 +232,7 @@ void CartCommon::Reset()
|
||||||
DSiMode = false;
|
DSiMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CartCommon::SetupDirectBoot(std::string romname)
|
void CartCommon::SetupDirectBoot(const std::string& romname)
|
||||||
{
|
{
|
||||||
CmdEncMode = 2;
|
CmdEncMode = 2;
|
||||||
DataEncMode = 2;
|
DataEncMode = 2;
|
||||||
|
@ -1217,7 +1217,7 @@ void CartHomebrew::Reset()
|
||||||
SD = nullptr;
|
SD = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CartHomebrew::SetupDirectBoot(std::string romname)
|
void CartHomebrew::SetupDirectBoot(const std::string& romname)
|
||||||
{
|
{
|
||||||
CartCommon::SetupDirectBoot(romname);
|
CartCommon::SetupDirectBoot(romname);
|
||||||
|
|
||||||
|
@ -1746,7 +1746,7 @@ void LoadSave(const u8* savedata, u32 savelen)
|
||||||
Cart->LoadSave(savedata, savelen);
|
Cart->LoadSave(savedata, savelen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupDirectBoot(std::string romname)
|
void SetupDirectBoot(const std::string& romname)
|
||||||
{
|
{
|
||||||
if (Cart)
|
if (Cart)
|
||||||
Cart->SetupDirectBoot(romname);
|
Cart->SetupDirectBoot(romname);
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
virtual u32 Checksum();
|
virtual u32 Checksum();
|
||||||
|
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
virtual void SetupDirectBoot(std::string romname);
|
virtual void SetupDirectBoot(const std::string& romname);
|
||||||
|
|
||||||
virtual void DoSavestate(Savestate* file);
|
virtual void DoSavestate(Savestate* file);
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ private:
|
||||||
u8 IRCmd;
|
u8 IRCmd;
|
||||||
};
|
};
|
||||||
|
|
||||||
// CartRetailBT - Pokémon Typing Adventure (SPI BT controller)
|
// CartRetailBT - Pok<EFBFBD>mon Typing Adventure (SPI BT controller)
|
||||||
class CartRetailBT : public CartRetail
|
class CartRetailBT : public CartRetail
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -187,7 +187,7 @@ public:
|
||||||
virtual u32 Type() override { return 0x201; }
|
virtual u32 Type() override { return 0x201; }
|
||||||
|
|
||||||
void Reset() override;
|
void Reset() override;
|
||||||
void SetupDirectBoot(std::string romname) override;
|
void SetupDirectBoot(const std::string& romname) override;
|
||||||
|
|
||||||
void DoSavestate(Savestate* file) override;
|
void DoSavestate(Savestate* file) override;
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ void DecryptSecureArea(u8* out);
|
||||||
|
|
||||||
bool LoadROM(const u8* romdata, u32 romlen);
|
bool LoadROM(const u8* romdata, u32 romlen);
|
||||||
void LoadSave(const u8* savedata, u32 savelen);
|
void LoadSave(const u8* savedata, u32 savelen);
|
||||||
void SetupDirectBoot(std::string romname);
|
void SetupDirectBoot(const std::string& romname);
|
||||||
|
|
||||||
/// This function is intended to allow frontends to save and load SRAM
|
/// This function is intended to allow frontends to save and load SRAM
|
||||||
/// without using melonDS APIs.
|
/// without using melonDS APIs.
|
||||||
|
|
|
@ -108,11 +108,11 @@ bool GetConfigArray(ConfigEntry entry, void* data);
|
||||||
// Looks in the user's data directory first, then the system's.
|
// Looks in the user's data directory first, then the system's.
|
||||||
// If on Windows or a portable UNIX build, this simply calls OpenLocalFile().
|
// If on Windows or a portable UNIX build, this simply calls OpenLocalFile().
|
||||||
|
|
||||||
FILE* OpenFile(std::string path, std::string mode, bool mustexist=false);
|
FILE* OpenFile(const std::string& path, const std::string& mode, bool mustexist=false);
|
||||||
FILE* OpenLocalFile(std::string path, std::string mode);
|
FILE* OpenLocalFile(const std::string& path, const std::string& mode);
|
||||||
FILE* OpenDataFile(std::string path);
|
FILE* OpenDataFile(const std::string& path);
|
||||||
|
|
||||||
inline bool FileExists(std::string name)
|
inline bool FileExists(const std::string& name)
|
||||||
{
|
{
|
||||||
FILE* f = OpenFile(name, "rb");
|
FILE* f = OpenFile(name, "rb");
|
||||||
if (!f) return false;
|
if (!f) return false;
|
||||||
|
@ -120,7 +120,7 @@ inline bool FileExists(std::string name)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool LocalFileExists(std::string name)
|
inline bool LocalFileExists(const std::string& name)
|
||||||
{
|
{
|
||||||
FILE* f = OpenLocalFile(name, "rb");
|
FILE* f = OpenLocalFile(name, "rb");
|
||||||
if (!f) return false;
|
if (!f) return false;
|
||||||
|
|
|
@ -49,7 +49,7 @@ using Platform::LogLevel;
|
||||||
// TODO: buffering system! or something of that sort
|
// TODO: buffering system! or something of that sort
|
||||||
// repeated fread/fwrite is slow on Switch
|
// repeated fread/fwrite is slow on Switch
|
||||||
|
|
||||||
Savestate::Savestate(std::string filename, bool save)
|
Savestate::Savestate(const std::string& filename, bool save)
|
||||||
{
|
{
|
||||||
const char* magic = "MELN";
|
const char* magic = "MELN";
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
class Savestate
|
class Savestate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Savestate(std::string filename, bool save);
|
Savestate(const std::string& filename, bool save);
|
||||||
~Savestate();
|
~Savestate();
|
||||||
|
|
||||||
bool Error;
|
bool Error;
|
||||||
|
|
|
@ -288,7 +288,7 @@ bool GetConfigArray(ConfigEntry entry, void* data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FILE* OpenFile(std::string path, std::string mode, bool mustexist)
|
FILE* OpenFile(const std::string& path, const std::string& mode, bool mustexist)
|
||||||
{
|
{
|
||||||
QFile f(QString::fromStdString(path));
|
QFile f(QString::fromStdString(path));
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ FILE* OpenFile(std::string path, std::string mode, bool mustexist)
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE* OpenLocalFile(std::string path, std::string mode)
|
FILE* OpenLocalFile(const std::string& path, const std::string& mode)
|
||||||
{
|
{
|
||||||
QString qpath = QString::fromStdString(path);
|
QString qpath = QString::fromStdString(path);
|
||||||
QDir dir(qpath);
|
QDir dir(qpath);
|
||||||
|
|
|
@ -58,7 +58,7 @@ ARCodeFile* CheatFile = nullptr;
|
||||||
bool CheatsOn = false;
|
bool CheatsOn = false;
|
||||||
|
|
||||||
|
|
||||||
int LastSep(std::string path)
|
int LastSep(const std::string& path)
|
||||||
{
|
{
|
||||||
int i = path.length() - 1;
|
int i = path.length() - 1;
|
||||||
while (i >= 0)
|
while (i >= 0)
|
||||||
|
@ -72,32 +72,45 @@ int LastSep(std::string path)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetAssetPath(bool gba, std::string configpath, std::string ext, std::string file="")
|
std::string GetAssetPath(bool gba, const std::string& configpath, const std::string& ext, const std::string& file = "")
|
||||||
{
|
{
|
||||||
|
std::string result;
|
||||||
|
|
||||||
if (configpath.empty())
|
if (configpath.empty())
|
||||||
configpath = gba ? BaseGBAROMDir : BaseROMDir;
|
result = gba ? BaseGBAROMDir : BaseROMDir;
|
||||||
|
else
|
||||||
if (file.empty())
|
result = configpath;
|
||||||
{
|
|
||||||
file = gba ? BaseGBAAssetName : BaseAssetName;
|
|
||||||
if (file.empty())
|
|
||||||
file = "firmware";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// cut off trailing slashes
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
int i = configpath.length() - 1;
|
int i = result.length() - 1;
|
||||||
if (i < 0) break;
|
if (i < 0) break;
|
||||||
if (configpath[i] == '/' || configpath[i] == '\\')
|
if (result[i] == '/' || result[i] == '\\')
|
||||||
configpath = configpath.substr(0, i);
|
result.resize(i);
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!configpath.empty())
|
if (!result.empty())
|
||||||
configpath += "/";
|
result += '/';
|
||||||
|
|
||||||
return configpath + file + ext;
|
if (file.empty())
|
||||||
|
{
|
||||||
|
std::string& baseName = gba ? BaseGBAAssetName : BaseAssetName;
|
||||||
|
if (baseName.empty())
|
||||||
|
result += "firmware";
|
||||||
|
else
|
||||||
|
result += baseName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result += file;
|
||||||
|
}
|
||||||
|
|
||||||
|
result += ext;
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -288,7 +301,7 @@ bool SavestateExists(int slot)
|
||||||
return Platform::FileExists(ssfile);
|
return Platform::FileExists(ssfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LoadState(std::string filename)
|
bool LoadState(const std::string& filename)
|
||||||
{
|
{
|
||||||
// backup
|
// backup
|
||||||
Savestate* backup = new Savestate("timewarp.mln", true);
|
Savestate* backup = new Savestate("timewarp.mln", true);
|
||||||
|
@ -335,7 +348,7 @@ bool LoadState(std::string filename)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SaveState(std::string filename)
|
bool SaveState(const std::string& filename)
|
||||||
{
|
{
|
||||||
Savestate* state = new Savestate(filename, true);
|
Savestate* state = new Savestate(filename, true);
|
||||||
if (state->Error)
|
if (state->Error)
|
||||||
|
|
|
@ -49,8 +49,8 @@ QString GBACartLabel();
|
||||||
|
|
||||||
std::string GetSavestateName(int slot);
|
std::string GetSavestateName(int slot);
|
||||||
bool SavestateExists(int slot);
|
bool SavestateExists(int slot);
|
||||||
bool LoadState(std::string filename);
|
bool LoadState(const std::string& filename);
|
||||||
bool SaveState(std::string filename);
|
bool SaveState(const std::string& filename);
|
||||||
void UndoStateLoad();
|
void UndoStateLoad();
|
||||||
|
|
||||||
void EnableCheats(bool enable);
|
void EnableCheats(bool enable);
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
using Platform::Log;
|
using Platform::Log;
|
||||||
using Platform::LogLevel;
|
using Platform::LogLevel;
|
||||||
|
|
||||||
SaveManager::SaveManager(std::string path) : QThread()
|
SaveManager::SaveManager(const std::string& path) : QThread()
|
||||||
{
|
{
|
||||||
SecondaryBuffer = nullptr;
|
SecondaryBuffer = nullptr;
|
||||||
SecondaryBufferLength = 0;
|
SecondaryBufferLength = 0;
|
||||||
|
@ -71,7 +71,7 @@ std::string SaveManager::GetPath()
|
||||||
return Path;
|
return Path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveManager::SetPath(std::string path, bool reload)
|
void SaveManager::SetPath(const std::string& path, bool reload)
|
||||||
{
|
{
|
||||||
Path = path;
|
Path = path;
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,11 @@ class SaveManager : public QThread
|
||||||
void run() override;
|
void run() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SaveManager(std::string path);
|
SaveManager(const std::string& path);
|
||||||
~SaveManager();
|
~SaveManager();
|
||||||
|
|
||||||
std::string GetPath();
|
std::string GetPath();
|
||||||
void SetPath(std::string path, bool reload);
|
void SetPath(const std::string& path, bool reload);
|
||||||
|
|
||||||
void RequestFlush(const u8* savedata, u32 savelen, u32 writeoffset, u32 writelen);
|
void RequestFlush(const u8* savedata, u32 savelen, u32 writeoffset, u32 writelen);
|
||||||
void CheckFlush();
|
void CheckFlush();
|
||||||
|
|
|
@ -279,7 +279,7 @@ void micClose()
|
||||||
micDevice = 0;
|
micDevice = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void micLoadWav(std::string name)
|
void micLoadWav(const std::string& name)
|
||||||
{
|
{
|
||||||
SDL_AudioSpec format;
|
SDL_AudioSpec format;
|
||||||
memset(&format, 0, sizeof(SDL_AudioSpec));
|
memset(&format, 0, sizeof(SDL_AudioSpec));
|
||||||
|
|
Loading…
Reference in New Issue