[Core/Dialog/ELF/FileSystems/HLE/HW/Util] Added const reference for function params

This commit is contained in:
Herman Semenov 2023-12-14 14:22:24 +03:00
parent 5a0d54be83
commit af41281761
43 changed files with 83 additions and 83 deletions

View File

@ -1838,7 +1838,7 @@ int Config::GetPSPLanguage() {
} }
} }
void PlayTimeTracker::Start(std::string gameId) { void PlayTimeTracker::Start(const std::string &gameId) {
if (gameId.empty()) { if (gameId.empty()) {
return; return;
} }
@ -1860,7 +1860,7 @@ void PlayTimeTracker::Start(std::string gameId) {
tracker_[gameId] = playTime; tracker_[gameId] = playTime;
} }
void PlayTimeTracker::Stop(std::string gameId) { void PlayTimeTracker::Stop(const std::string &gameId) {
if (gameId.empty()) { if (gameId.empty()) {
return; return;
} }

View File

@ -48,8 +48,8 @@ public:
}; };
// It's OK to call these redundantly. // It's OK to call these redundantly.
void Start(std::string gameId); void Start(const std::string &gameId);
void Stop(std::string gameId); void Stop(const std::string &gameId);
void Load(const Section *section); void Load(const Section *section);
void Save(Section *section); void Save(Section *section);

View File

@ -418,7 +418,7 @@ void Core_MemoryException(u32 address, u32 accessSize, u32 pc, MemoryExceptionTy
} }
} }
void Core_MemoryExceptionInfo(u32 address, u32 accessSize, u32 pc, MemoryExceptionType type, std::string additionalInfo, bool forceReport) { void Core_MemoryExceptionInfo(u32 address, u32 accessSize, u32 pc, MemoryExceptionType type, const std::string &additionalInfo, bool forceReport) {
const char *desc = MemoryExceptionTypeAsString(type); const char *desc = MemoryExceptionTypeAsString(type);
// In jit, we only flush PC when bIgnoreBadMemAccess is off. // In jit, we only flush PC when bIgnoreBadMemAccess is off.
if ((g_Config.iCpuCore == (int)CPUCore::JIT || g_Config.iCpuCore == (int)CPUCore::JIT_IR) && g_Config.bIgnoreBadMemAccess) { if ((g_Config.iCpuCore == (int)CPUCore::JIT || g_Config.iCpuCore == (int)CPUCore::JIT_IR) && g_Config.bIgnoreBadMemAccess) {

View File

@ -105,7 +105,7 @@ enum class ExecExceptionType {
// Separate one for without info, to avoid having to allocate a string // Separate one for without info, to avoid having to allocate a string
void Core_MemoryException(u32 address, u32 accessSize, u32 pc, MemoryExceptionType type); void Core_MemoryException(u32 address, u32 accessSize, u32 pc, MemoryExceptionType type);
void Core_MemoryExceptionInfo(u32 address, u32 accessSize, u32 pc, MemoryExceptionType type, std::string additionalInfo, bool forceReport); void Core_MemoryExceptionInfo(u32 address, u32 accessSize, u32 pc, MemoryExceptionType type, const std::string &additionalInfo, bool forceReport);
void Core_ExecException(u32 address, u32 pc, ExecExceptionType type); void Core_ExecException(u32 address, u32 pc, ExecExceptionType type);
void Core_Break(u32 pc); void Core_Break(u32 pc);

View File

@ -820,7 +820,7 @@ void DisassemblyMacro::setMacroLi(u32 _immediate, u8 _rt)
numOpcodes = 2; numOpcodes = 2;
} }
void DisassemblyMacro::setMacroMemory(std::string _name, u32 _immediate, u8 _rt, int _dataSize) void DisassemblyMacro::setMacroMemory(const std::string &_name, u32 _immediate, u8 _rt, int _dataSize)
{ {
type = MACRO_MEMORYIMM; type = MACRO_MEMORYIMM;
name = _name; name = _name;

View File

@ -120,7 +120,7 @@ public:
DisassemblyMacro(u32 _address): address(_address) { } DisassemblyMacro(u32 _address): address(_address) { }
void setMacroLi(u32 _immediate, u8 _rt); void setMacroLi(u32 _immediate, u8 _rt);
void setMacroMemory(std::string _name, u32 _immediate, u8 _rt, int _dataSize); void setMacroMemory(const std::string &_name, u32 _immediate, u8 _rt, int _dataSize);
void recheck() override { }; void recheck() override { };
int getNumLines() override { return 1; }; int getNumLines() override { return 1; };

View File

@ -49,7 +49,7 @@ static const std::string SFO_FILENAME = "PARAM.SFO";
namespace namespace
{ {
std::vector<std::string> GetPSPFileList (std::string dirpath) { std::vector<std::string> GetPSPFileList (const std::string &dirpath) {
std::vector<std::string> FileList; std::vector<std::string> FileList;
auto Fileinfos = pspFileSystem.GetDirListing(dirpath); auto Fileinfos = pspFileSystem.GetDirListing(dirpath);
@ -258,7 +258,7 @@ int PSPGamedataInstallDialog::Shutdown(bool force) {
return PSPDialog::Shutdown(force); return PSPDialog::Shutdown(force);
} }
std::string PSPGamedataInstallDialog::GetGameDataInstallFileName(const SceUtilityGamedataInstallParam *param, std::string filename) { std::string PSPGamedataInstallDialog::GetGameDataInstallFileName(const SceUtilityGamedataInstallParam *param, const std::string &filename) {
if (!param) if (!param)
return ""; return "";
std::string GameDataInstallPath = saveBasePath + param->gameName + param->dataName + "/"; std::string GameDataInstallPath = saveBasePath + param->gameName + param->dataName + "/";

View File

@ -44,7 +44,7 @@ public:
void DoState(PointerWrap &p) override; void DoState(PointerWrap &p) override;
int Abort(); int Abort();
std::string GetGameDataInstallFileName(const SceUtilityGamedataInstallParam *param, std::string filename); std::string GetGameDataInstallFileName(const SceUtilityGamedataInstallParam *param, const std::string &filename);
protected: protected:
// TODO: Manage status correctly. // TODO: Manage status correctly.

View File

@ -179,7 +179,7 @@ void PSPMsgDialog::FormatErrorCode(uint32_t code) {
} }
} }
void PSPMsgDialog::DisplayMessage(std::string text, bool hasYesNo, bool hasOK) { void PSPMsgDialog::DisplayMessage(const std::string &text, bool hasYesNo, bool hasOK) {
auto di = GetI18NCategory(I18NCat::DIALOG); auto di = GetI18NCategory(I18NCat::DIALOG);
PPGeStyle buttonStyle = FadedStyle(PPGeAlign::BOX_CENTER, FONT_SCALE); PPGeStyle buttonStyle = FadedStyle(PPGeAlign::BOX_CENTER, FONT_SCALE);

View File

@ -76,7 +76,7 @@ protected:
private: private:
void FormatErrorCode(uint32_t code); void FormatErrorCode(uint32_t code);
void DisplayMessage(std::string text, bool hasYesNo = false, bool hasOK = false); void DisplayMessage(const std::string &text, bool hasYesNo = false, bool hasOK = false);
enum Flags enum Flags
{ {

View File

@ -103,7 +103,7 @@ void PSPNetconfDialog::DrawIndicator() {
PPGeDrawImage(456, 248, 20.0f, 20.0f, 1, 10, 1, 10, 10, 10, FadedImageStyle()); PPGeDrawImage(456, 248, 20.0f, 20.0f, 1, 10, 1, 10, 10, 10, FadedImageStyle());
} }
void PSPNetconfDialog::DisplayMessage(std::string text1, std::string text2a, std::string text2b, std::string text3a, std::string text3b, bool hasYesNo, bool hasOK) { void PSPNetconfDialog::DisplayMessage(const std::string &text1, const std::string &text2a, const std::string &text2b, const std::string &text3a, const std::string &text3b, bool hasYesNo, bool hasOK) {
auto di = GetI18NCategory(I18NCat::DIALOG); auto di = GetI18NCategory(I18NCat::DIALOG);
PPGeStyle buttonStyle = FadedStyle(PPGeAlign::BOX_CENTER, FONT_SCALE); PPGeStyle buttonStyle = FadedStyle(PPGeAlign::BOX_CENTER, FONT_SCALE);

View File

@ -52,7 +52,7 @@ protected:
} }
private: private:
void DisplayMessage(std::string text1, std::string text2a = "", std::string text2b = "", std::string text3a = "", std::string text3b = "", bool hasYesNo = false, bool hasOK = false); void DisplayMessage(const std::string &text1, const std::string &text2a = "", const std::string &text2b = "", const std::string &text3a = "", const std::string &text3b = "", bool hasYesNo = false, bool hasOK = false);
void DrawBanner(); void DrawBanner();
void DrawIndicator(); void DrawIndicator();

View File

@ -100,7 +100,7 @@ void PSPNpSigninDialog::DrawLogo() {
PPGeDrawImage(416, 22, 64.0f, 64.0f, 1, 10, 1, 10, 64, 64, FadedImageStyle()); PPGeDrawImage(416, 22, 64.0f, 64.0f, 1, 10, 1, 10, 64, 64, FadedImageStyle());
} }
void PSPNpSigninDialog::DisplayMessage(std::string text1, std::string text2a, std::string text2b, std::string text3a, std::string text3b, bool hasYesNo, bool hasOK) { void PSPNpSigninDialog::DisplayMessage(const std::string &text1, const std::string &text2a, const std::string &text2b, const std::string &text3a, const std::string &text3b, bool hasYesNo, bool hasOK) {
auto di = GetI18NCategory(I18NCat::DIALOG); auto di = GetI18NCategory(I18NCat::DIALOG);
PPGeStyle buttonStyle = FadedStyle(PPGeAlign::BOX_CENTER, FONT_SCALE); PPGeStyle buttonStyle = FadedStyle(PPGeAlign::BOX_CENTER, FONT_SCALE);

View File

@ -48,7 +48,7 @@ protected:
} }
private: private:
void DisplayMessage(std::string text1, std::string text2a = "", std::string text2b = "", std::string text3a = "", std::string text3b = "", bool hasYesNo = false, bool hasOK = false); void DisplayMessage(const std::string &text1, const std::string &text2a = "", const std::string &text2b = "", const std::string &text3a = "", const std::string &text3b = "", bool hasYesNo = false, bool hasOK = false);
void DrawBanner(); void DrawBanner();
void DrawIndicator(); void DrawIndicator();
void DrawLogo(); void DrawLogo();

View File

@ -580,7 +580,7 @@ void PSPSaveDialog::DisplaySaveDataInfo2(bool showNewData) {
PPGeDrawText(saveinfoTxt.c_str(), 8, 200, textStyle); PPGeDrawText(saveinfoTxt.c_str(), 8, 200, textStyle);
} }
void PSPSaveDialog::DisplayMessage(std::string text, bool hasYesNo) void PSPSaveDialog::DisplayMessage(const std::string &text, bool hasYesNo)
{ {
PPGeStyle textStyle = FadedStyle(PPGeAlign::BOX_CENTER, FONT_SCALE); PPGeStyle textStyle = FadedStyle(PPGeAlign::BOX_CENTER, FONT_SCALE);

View File

@ -94,7 +94,7 @@ private:
void DisplaySaveIcon(bool checkExists); void DisplaySaveIcon(bool checkExists);
void DisplaySaveDataInfo1(); void DisplaySaveDataInfo1();
void DisplaySaveDataInfo2(bool showNewData = false); void DisplaySaveDataInfo2(bool showNewData = false);
void DisplayMessage(std::string text, bool hasYesNo = false); void DisplayMessage(const std::string &text, bool hasYesNo = false);
const std::string GetSelectedSaveDirName() const; const std::string GetSelectedSaveDirName() const;
void JoinIOThread(); void JoinIOThread();

View File

@ -63,7 +63,7 @@ namespace
truncate_cpy(str, strLength, value.c_str()); truncate_cpy(str, strLength, value.c_str());
} }
bool ReadPSPFile(std::string filename, u8 **data, s64 dataSize, s64 *readSize) bool ReadPSPFile(const std::string &filename, u8 **data, s64 dataSize, s64 *readSize)
{ {
int handle = pspFileSystem.OpenFile(filename, FILEACCESS_READ); int handle = pspFileSystem.OpenFile(filename, FILEACCESS_READ);
if (handle < 0) if (handle < 0)
@ -86,7 +86,7 @@ namespace
return result != 0; return result != 0;
} }
bool WritePSPFile(std::string filename, const u8 *data, SceSize dataSize) bool WritePSPFile(const std::string &filename, const u8 *data, SceSize dataSize)
{ {
int handle = pspFileSystem.OpenFile(filename, (FileAccess)(FILEACCESS_WRITE | FILEACCESS_CREATE | FILEACCESS_TRUNCATE)); int handle = pspFileSystem.OpenFile(filename, (FileAccess)(FILEACCESS_WRITE | FILEACCESS_CREATE | FILEACCESS_TRUNCATE));
if (handle < 0) if (handle < 0)
@ -110,7 +110,7 @@ namespace
return info; return info;
} }
bool PSPMatch(std::string text, std::string regexp) bool PSPMatch(const std::string &text, const std::string &regexp)
{ {
if(text.empty() && regexp.empty()) if(text.empty() && regexp.empty())
return true; return true;
@ -1607,7 +1607,7 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param)
return 0; return 0;
} }
void SavedataParam::SetFileInfo(SaveFileInfo &saveInfo, PSPFileInfo &info, std::string saveName, std::string savrDir) void SavedataParam::SetFileInfo(SaveFileInfo &saveInfo, PSPFileInfo &info, const std::string &saveName, const std::string &savrDir)
{ {
saveInfo.size = info.size; saveInfo.size = info.size;
saveInfo.saveName = saveName; saveInfo.saveName = saveName;
@ -1647,7 +1647,7 @@ void SavedataParam::SetFileInfo(SaveFileInfo &saveInfo, PSPFileInfo &info, std::
} }
} }
void SavedataParam::SetFileInfo(int idx, PSPFileInfo &info, std::string saveName, std::string saveDir) void SavedataParam::SetFileInfo(int idx, PSPFileInfo &info, const std::string &saveName, const std::string &saveDir)
{ {
SetFileInfo(saveDataList[idx], info, saveName, saveDir); SetFileInfo(saveDataList[idx], info, saveName, saveDir);
saveDataList[idx].idx = idx; saveDataList[idx].idx = idx;
@ -1679,7 +1679,7 @@ void SavedataParam::ClearFileInfo(SaveFileInfo &saveInfo, const std::string &sav
} }
} }
PSPFileInfo SavedataParam::GetSaveInfo(std::string saveDir) { PSPFileInfo SavedataParam::GetSaveInfo(const std::string &saveDir) {
PSPFileInfo info = pspFileSystem.GetFileInfo(saveDir); PSPFileInfo info = pspFileSystem.GetFileInfo(saveDir);
if (info.exists) { if (info.exists) {
info.access = 0777; info.access = 0777;
@ -1970,7 +1970,7 @@ int SavedataParam::GetSaveCryptMode(const SceUtilitySavedataParam *param, const
return 0; return 0;
} }
bool SavedataParam::IsInSaveDataList(std::string saveName, int count) { bool SavedataParam::IsInSaveDataList(const std::string &saveName, int count) {
for(int i = 0; i < count; ++i) { for(int i = 0; i < count; ++i) {
if(strcmp(saveDataList[i].saveName.c_str(),saveName.c_str()) == 0) if(strcmp(saveDataList[i].saveName.c_str(),saveName.c_str()) == 0)
return true; return true;

View File

@ -318,7 +318,7 @@ public:
int GetFilesList(SceUtilitySavedataParam* param, u32 requestAddr); int GetFilesList(SceUtilitySavedataParam* param, u32 requestAddr);
bool GetSize(SceUtilitySavedataParam* param); bool GetSize(SceUtilitySavedataParam* param);
int GetSaveCryptMode(const SceUtilitySavedataParam *param, const std::string &saveDirName); int GetSaveCryptMode(const SceUtilitySavedataParam *param, const std::string &saveDirName);
bool IsInSaveDataList(std::string saveName, int count); bool IsInSaveDataList(const std::string &saveName, int count);
std::string GetGameName(const SceUtilitySavedataParam *param) const; std::string GetGameName(const SceUtilitySavedataParam *param) const;
std::string GetSaveName(const SceUtilitySavedataParam *param) const; std::string GetSaveName(const SceUtilitySavedataParam *param) const;
@ -361,10 +361,10 @@ public:
private: private:
void Clear(); void Clear();
void SetFileInfo(int idx, PSPFileInfo &info, std::string saveName, std::string saveDir = ""); void SetFileInfo(int idx, PSPFileInfo &info, const std::string &saveName, const std::string &saveDir = "");
void SetFileInfo(SaveFileInfo &saveInfo, PSPFileInfo &info, std::string saveName, std::string saveDir = ""); void SetFileInfo(SaveFileInfo &saveInfo, PSPFileInfo &info, const std::string &saveName, const std::string &saveDir = "");
void ClearFileInfo(SaveFileInfo &saveInfo, const std::string &saveName); void ClearFileInfo(SaveFileInfo &saveInfo, const std::string &saveName);
PSPFileInfo GetSaveInfo(std::string saveDir); PSPFileInfo GetSaveInfo(const std::string &saveDir);
int LoadSaveData(SceUtilitySavedataParam *param, const std::string &saveDirName, const std::string& dirPath, bool secureMode); int LoadSaveData(SceUtilitySavedataParam *param, const std::string &saveDirName, const std::string& dirPath, bool secureMode);
u32 LoadCryptedSave(SceUtilitySavedataParam *param, u8 *data, const u8 *saveData, int &saveSize, int prevCryptMode, const u8 *expectedHash, bool &saveDone); u32 LoadCryptedSave(SceUtilitySavedataParam *param, u8 *data, const u8 *saveData, int &saveSize, int prevCryptMode, const u8 *expectedHash, bool &saveDone);

View File

@ -43,38 +43,38 @@ struct IndexTable
u32_le data_table_offset; /* Offset of the param_data from start of data_table */ u32_le data_table_offset; /* Offset of the param_data from start of data_table */
}; };
void ParamSFOData::SetValue(std::string key, unsigned int value, int max_size) { void ParamSFOData::SetValue(const std::string &key, unsigned int value, int max_size) {
values[key].type = VT_INT; values[key].type = VT_INT;
values[key].i_value = value; values[key].i_value = value;
values[key].max_size = max_size; values[key].max_size = max_size;
} }
void ParamSFOData::SetValue(std::string key, std::string value, int max_size) { void ParamSFOData::SetValue(const std::string &key, const std::string &value, int max_size) {
values[key].type = VT_UTF8; values[key].type = VT_UTF8;
values[key].s_value = value; values[key].s_value = value;
values[key].max_size = max_size; values[key].max_size = max_size;
} }
void ParamSFOData::SetValue(std::string key, const u8 *value, unsigned int size, int max_size) { void ParamSFOData::SetValue(const std::string &key, const u8 *value, unsigned int size, int max_size) {
values[key].type = VT_UTF8_SPE; values[key].type = VT_UTF8_SPE;
values[key].SetData(value, size); values[key].SetData(value, size);
values[key].max_size = max_size; values[key].max_size = max_size;
} }
int ParamSFOData::GetValueInt(std::string key) const { int ParamSFOData::GetValueInt(const std::string &key) const {
std::map<std::string,ValueData>::const_iterator it = values.find(key); std::map<std::string,ValueData>::const_iterator it = values.find(key);
if(it == values.end() || it->second.type != VT_INT) if(it == values.end() || it->second.type != VT_INT)
return 0; return 0;
return it->second.i_value; return it->second.i_value;
} }
std::string ParamSFOData::GetValueString(std::string key) const { std::string ParamSFOData::GetValueString(const std::string &key) const {
std::map<std::string,ValueData>::const_iterator it = values.find(key); std::map<std::string,ValueData>::const_iterator it = values.find(key);
if(it == values.end() || (it->second.type != VT_UTF8)) if(it == values.end() || (it->second.type != VT_UTF8))
return ""; return "";
return it->second.s_value; return it->second.s_value;
} }
const u8 *ParamSFOData::GetValueData(std::string key, unsigned int *size) const { const u8 *ParamSFOData::GetValueData(const std::string &key, unsigned int *size) const {
std::map<std::string,ValueData>::const_iterator it = values.find(key); std::map<std::string,ValueData>::const_iterator it = values.find(key);
if(it == values.end() || (it->second.type != VT_UTF8_SPE)) if(it == values.end() || (it->second.type != VT_UTF8_SPE))
return 0; return 0;
@ -195,7 +195,7 @@ bool ParamSFOData::ReadSFO(const u8 *paramsfo, size_t size) {
return true; return true;
} }
int ParamSFOData::GetDataOffset(const u8 *paramsfo, std::string dataName) { int ParamSFOData::GetDataOffset(const u8 *paramsfo, const std::string &dataName) {
const Header *header = (const Header *)paramsfo; const Header *header = (const Header *)paramsfo;
if (header->magic != 0x46535000) if (header->magic != 0x46535000)
return -1; return -1;
@ -320,7 +320,7 @@ void ParamSFOData::ValueData::SetData(const u8* data, int size) {
u_size = size; u_size = size;
} }
std::string ParamSFOData::GenerateFakeID(std::string filename) const { std::string ParamSFOData::GenerateFakeID(const std::string &filename) const {
// Generates fake gameID for homebrew based on it's folder name. // Generates fake gameID for homebrew based on it's folder name.
// Should probably not be a part of ParamSFO, but it'll be called in same places. // Should probably not be a part of ParamSFO, but it'll be called in same places.
std::string file = PSP_CoreParameter().fileToStart.ToString(); std::string file = PSP_CoreParameter().fileToStart.ToString();

View File

@ -27,16 +27,16 @@
class ParamSFOData class ParamSFOData
{ {
public: public:
void SetValue(std::string key, unsigned int value, int max_size); void SetValue(const std::string &key, unsigned int value, int max_size);
void SetValue(std::string key, std::string value, int max_size); void SetValue(const std::string &key, const std::string &value, int max_size);
void SetValue(std::string key, const u8 *value, unsigned int size, int max_size); void SetValue(const std::string &key, const u8 *value, unsigned int size, int max_size);
int GetValueInt(std::string key) const; int GetValueInt(const std::string &key) const;
std::string GetValueString(std::string key) const; std::string GetValueString(const std::string &key) const;
const u8 *GetValueData(std::string key, unsigned int *size) const; const u8 *GetValueData(const std::string &key, unsigned int *size) const;
std::vector<std::string> GetKeys() const; std::vector<std::string> GetKeys() const;
std::string GenerateFakeID(std::string filename = "") const; std::string GenerateFakeID(const std::string &filename = "") const;
std::string GetDiscID(); std::string GetDiscID();
@ -51,7 +51,7 @@ public:
} }
} }
int GetDataOffset(const u8 *paramsfo, std::string dataName); int GetDataOffset(const u8 *paramsfo, const std::string &dataName);
void Clear(); void Clear();

View File

@ -966,7 +966,7 @@ VFSFileSystem::~VFSFileSystem() {
entries.clear(); entries.clear();
} }
std::string VFSFileSystem::GetLocalPath(std::string localPath) { std::string VFSFileSystem::GetLocalPath(const std::string &localPath) {
return basePath + localPath; return basePath + localPath;
} }

View File

@ -145,5 +145,5 @@ private:
std::string basePath; std::string basePath;
IHandleAllocator *hAlloc; IHandleAllocator *hAlloc;
std::string GetLocalPath(std::string localpath); std::string GetLocalPath(const std::string &localpath);
}; };

View File

@ -30,7 +30,7 @@
const int sectorSize = 2048; const int sectorSize = 2048;
bool parseLBN(std::string filename, u32 *sectorStart, u32 *readSize) { bool parseLBN(const std::string &filename, u32 *sectorStart, u32 *readSize) {
// The format of this is: "/sce_lbn" "0x"? HEX* ANY* "_size" "0x"? HEX* ANY* // The format of this is: "/sce_lbn" "0x"? HEX* ANY* "_size" "0x"? HEX* ANY*
// That means that "/sce_lbn/_size1/" is perfectly valid. // That means that "/sce_lbn/_size1/" is perfectly valid.
// Most commonly, it looks like /sce_lbn0x10_size0x100 or /sce_lbn10_size100 (always hex.) // Most commonly, it looks like /sce_lbn0x10_size0x100 or /sce_lbn10_size100 (always hex.)

View File

@ -25,7 +25,7 @@
#include "BlockDevices.h" #include "BlockDevices.h"
bool parseLBN(std::string filename, u32 *sectorStart, u32 *readSize); bool parseLBN(const std::string &filename, u32 *sectorStart, u32 *readSize);
class ISOFileSystem : public IFileSystem { class ISOFileSystem : public IFileSystem {
public: public:

View File

@ -274,7 +274,7 @@ std::string MetaFileSystem::NormalizePrefix(std::string prefix) const {
return prefix; return prefix;
} }
void MetaFileSystem::Mount(std::string prefix, std::shared_ptr<IFileSystem> system) { void MetaFileSystem::Mount(const std::string &prefix, std::shared_ptr<IFileSystem> system) {
std::lock_guard<std::recursive_mutex> guard(lock); std::lock_guard<std::recursive_mutex> guard(lock);
MountPoint x; MountPoint x;
@ -297,7 +297,7 @@ void MetaFileSystem::UnmountAll() {
currentDir.clear(); currentDir.clear();
} }
void MetaFileSystem::Unmount(std::string prefix) { void MetaFileSystem::Unmount(const std::string &prefix) {
for (auto iter = fileSystems.begin(); iter != fileSystems.end(); iter++) { for (auto iter = fileSystems.begin(); iter != fileSystems.end(); iter++) {
if (iter->prefix == prefix) { if (iter->prefix == prefix) {
fileSystems.erase(iter); fileSystems.erase(iter);
@ -306,7 +306,7 @@ void MetaFileSystem::Unmount(std::string prefix) {
} }
} }
bool MetaFileSystem::Remount(std::string prefix, std::shared_ptr<IFileSystem> system) { bool MetaFileSystem::Remount(const std::string &prefix, std::shared_ptr<IFileSystem> system) {
std::lock_guard<std::recursive_mutex> guard(lock); std::lock_guard<std::recursive_mutex> guard(lock);
for (auto &it : fileSystems) { for (auto &it : fileSystems) {
if (it.prefix == prefix) { if (it.prefix == prefix) {

View File

@ -57,12 +57,12 @@ public:
Reset(); Reset();
} }
void Mount(std::string prefix, std::shared_ptr<IFileSystem> system); void Mount(const std::string &prefix, std::shared_ptr<IFileSystem> system);
// Fails if there's not already a file system at prefix. // Fails if there's not already a file system at prefix.
bool Remount(std::string prefix, std::shared_ptr<IFileSystem> system); bool Remount(const std::string &prefix, std::shared_ptr<IFileSystem> system);
void UnmountAll(); void UnmountAll();
void Unmount(std::string prefix); void Unmount(const std::string &prefix);
// The pointer returned from these are for temporary usage only. Do not store. // The pointer returned from these are for temporary usage only. Do not store.
IFileSystem *GetSystem(const std::string &prefix); IFileSystem *GetSystem(const std::string &prefix);

View File

@ -1310,7 +1310,7 @@ void timeoutFriendsRecursive(SceNetAdhocctlPeerInfo * node, int32_t* count) {
if (count != NULL) (*count)++; if (count != NULL) (*count)++;
} }
void sendChat(std::string chatString) { void sendChat(const std::string &chatString) {
SceNetAdhocctlChatPacketC2S chat; SceNetAdhocctlChatPacketC2S chat;
auto n = GetI18NCategory(I18NCat::NETWORKING); auto n = GetI18NCategory(I18NCat::NETWORKING);
chat.base.opcode = OPCODE_CHAT; chat.base.opcode = OPCODE_CHAT;

View File

@ -1038,7 +1038,7 @@ void addFriend(SceNetAdhocctlConnectPacketS2C * packet);
* Send chat or get that * Send chat or get that
* @param std::string ChatString * @param std::string ChatString
*/ */
void sendChat(std::string chatString); void sendChat(const std::string &chatString);
std::vector<std::string> getChatLog(); std::vector<std::string> getChatLog();
int GetChatChangeID(); int GetChatChangeID();
int GetChatMessageCount(); int GetChatMessageCount();

View File

@ -125,7 +125,7 @@ struct MsgPipeWaitingThread
} }
}; };
static bool __KernelMsgPipeThreadSortPriority(MsgPipeWaitingThread thread1, MsgPipeWaitingThread thread2) static bool __KernelMsgPipeThreadSortPriority(const MsgPipeWaitingThread &thread1, const MsgPipeWaitingThread &thread2)
{ {
return __KernelThreadSortPriority(thread1.threadID, thread2.threadID); return __KernelThreadSortPriority(thread1.threadID, thread2.threadID);
} }

View File

@ -1233,7 +1233,7 @@ void __UpdateAdhocctlHandlers(u32 flag, u32 error) {
adhocctlEvents.push_back({ flag, error }); adhocctlEvents.push_back({ flag, error });
} }
void __UpdateMatchingHandler(MatchingArgs ArgsPtr) { void __UpdateMatchingHandler(const MatchingArgs &ArgsPtr) {
std::lock_guard<std::recursive_mutex> adhocGuard(adhocEvtMtx); std::lock_guard<std::recursive_mutex> adhocGuard(adhocEvtMtx);
matchingEvents.push_back(ArgsPtr); matchingEvents.push_back(ArgsPtr);
} }

View File

@ -102,7 +102,7 @@ void __NetAdhocInit();
void __NetAdhocShutdown(); void __NetAdhocShutdown();
void __NetAdhocDoState(PointerWrap &p); void __NetAdhocDoState(PointerWrap &p);
void __UpdateAdhocctlHandlers(u32 flags, u32 error); void __UpdateAdhocctlHandlers(u32 flags, u32 error);
void __UpdateMatchingHandler(MatchingArgs params); void __UpdateMatchingHandler(const MatchingArgs &params);
// I have to call this from netdialog // I have to call this from netdialog
int sceNetAdhocctlGetState(u32 ptrToStatus); int sceNetAdhocctlGetState(u32 ptrToStatus);

View File

@ -39,7 +39,7 @@ bool AsyncIOManager::HasOperation(u32 handle) {
return false; return false;
} }
void AsyncIOManager::ScheduleOperation(AsyncIOEvent ev) { void AsyncIOManager::ScheduleOperation(const AsyncIOEvent &ev) {
{ {
std::lock_guard<std::mutex> guard(resultsLock_); std::lock_guard<std::mutex> guard(resultsLock_);
if (!resultsPending_.insert(ev.handle).second) { if (!resultsPending_.insert(ev.handle).second) {
@ -143,7 +143,7 @@ void AsyncIOManager::Write(u32 handle, const u8 *buf, size_t bytes) {
EventResult(handle, AsyncIOResult(result, usec)); EventResult(handle, AsyncIOResult(result, usec));
} }
void AsyncIOManager::EventResult(u32 handle, AsyncIOResult result) { void AsyncIOManager::EventResult(u32 handle, const AsyncIOResult &result) {
std::lock_guard<std::mutex> guard(resultsLock_); std::lock_guard<std::mutex> guard(resultsLock_);
if (results_.find(handle) != results_.end()) { if (results_.find(handle) != results_.end()) {
ERROR_LOG_REPORT(SCEIO, "Overwriting previous result for file action on handle %d", handle); ERROR_LOG_REPORT(SCEIO, "Overwriting previous result for file action on handle %d", handle);

View File

@ -83,7 +83,7 @@ public:
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
bool HasOperation(u32 handle); bool HasOperation(u32 handle);
void ScheduleOperation(AsyncIOEvent ev); void ScheduleOperation(const AsyncIOEvent &ev);
void Shutdown(); void Shutdown();
bool HasResult(u32 handle); bool HasResult(u32 handle);
@ -102,7 +102,7 @@ private:
void Read(u32 handle, u8 *buf, size_t bytes, u32 invalidateAddr); void Read(u32 handle, u8 *buf, size_t bytes, u32 invalidateAddr);
void Write(u32 handle, const u8 *buf, size_t bytes); void Write(u32 handle, const u8 *buf, size_t bytes);
void EventResult(u32 handle, AsyncIOResult result); void EventResult(u32 handle, const AsyncIOResult &result);
std::mutex resultsLock_; std::mutex resultsLock_;
std::condition_variable resultsWait_; std::condition_variable resultsWait_;

View File

@ -608,7 +608,7 @@ bool IsKeyMapped(InputDeviceID device, int key) {
return false; return false;
} }
bool ReplaceSingleKeyMapping(int btn, int index, MultiInputMapping key) { bool ReplaceSingleKeyMapping(int btn, int index, const MultiInputMapping &key) {
std::lock_guard<std::recursive_mutex> guard(g_controllerMapLock); std::lock_guard<std::recursive_mutex> guard(g_controllerMapLock);
// Check for duplicate // Check for duplicate
for (int i = 0; i < (int)g_controllerMap[btn].size(); ++i) { for (int i = 0; i < (int)g_controllerMap[btn].size(); ++i) {

View File

@ -188,7 +188,7 @@ namespace KeyMap {
// Any configuration will be saved to the Core config. // Any configuration will be saved to the Core config.
void SetInputMapping(int psp_key, const MultiInputMapping &key, bool replace); void SetInputMapping(int psp_key, const MultiInputMapping &key, bool replace);
// Return false if bind was a duplicate and got removed // Return false if bind was a duplicate and got removed
bool ReplaceSingleKeyMapping(int btn, int index, MultiInputMapping key); bool ReplaceSingleKeyMapping(int btn, int index, const MultiInputMapping &key);
MappedAnalogAxes MappedAxesForDevice(InputDeviceID deviceId); MappedAnalogAxes MappedAxesForDevice(InputDeviceID deviceId);

View File

@ -37,7 +37,7 @@
static std::map<std::string, std::unique_ptr<FileLoaderFactory>> factories; static std::map<std::string, std::unique_ptr<FileLoaderFactory>> factories;
void RegisterFileLoaderFactory(std::string prefix, std::unique_ptr<FileLoaderFactory> factory) { void RegisterFileLoaderFactory(const std::string &prefix, std::unique_ptr<FileLoaderFactory> factory) {
factories[prefix] = std::move(factory); factories[prefix] = std::move(factory);
} }

View File

@ -152,7 +152,7 @@ public:
virtual ~FileLoaderFactory() {} virtual ~FileLoaderFactory() {}
virtual FileLoader *ConstructFileLoader(const Path &filename) = 0; virtual FileLoader *ConstructFileLoader(const Path &filename) = 0;
}; };
void RegisterFileLoaderFactory(std::string prefix, std::unique_ptr<FileLoaderFactory> factory); void RegisterFileLoaderFactory(const std::string &prefix, std::unique_ptr<FileLoaderFactory> factory);
// Can modify the string filename, as it calls IdentifyFile above. // Can modify the string filename, as it calls IdentifyFile above.
bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string); bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string);

View File

@ -623,7 +623,7 @@ namespace Reporting
return true; return true;
} }
bool Enable(bool flag, std::string host) bool Enable(bool flag, const std::string &host)
{ {
if (IsSupported() && IsEnabled() != flag) if (IsSupported() && IsEnabled() != flag)
{ {

View File

@ -53,7 +53,7 @@ namespace Reporting
// Set the current enabled state of the reporting system and desired reporting server host. // Set the current enabled state of the reporting system and desired reporting server host.
// Returns if anything was changed. // Returns if anything was changed.
bool Enable(bool flag, std::string host); bool Enable(bool flag, const std::string &host);
// Use the default reporting setting (per compiled settings) of host and enabled state. // Use the default reporting setting (per compiled settings) of host and enabled state.
void EnableDefault(); void EnableDefault();

View File

@ -397,7 +397,7 @@ namespace SaveState
pspFileSystem.DoState(p); pspFileSystem.DoState(p);
} }
void Enqueue(SaveState::Operation op) void Enqueue(const SaveState::Operation &op)
{ {
if (Achievements::HardcoreModeActive()) { if (Achievements::HardcoreModeActive()) {
if (g_Config.bAchievementsSaveStateInHardcoreMode && ((op.type == SaveState::SAVESTATE_SAVE) || (op.type == SAVESTATE_SAVE_SCREENSHOT))) { if (g_Config.bAchievementsSaveStateInHardcoreMode && ((op.type == SaveState::SAVESTATE_SAVE) || (op.type == SAVESTATE_SAVE_SCREENSHOT))) {

View File

@ -86,12 +86,12 @@ Path GameManager::GetTempFilename() const {
#endif #endif
} }
bool GameManager::IsGameInstalled(std::string name) { bool GameManager::IsGameInstalled(const std::string &name) {
Path pspGame = GetSysDirectory(DIRECTORY_GAME); Path pspGame = GetSysDirectory(DIRECTORY_GAME);
return File::Exists(pspGame / name); return File::Exists(pspGame / name);
} }
bool GameManager::DownloadAndInstall(std::string storeFileUrl) { bool GameManager::DownloadAndInstall(const std::string &storeFileUrl) {
if (curDownload_.get() != nullptr) { if (curDownload_.get() != nullptr) {
ERROR_LOG(HLE, "Can only process one download at a time"); ERROR_LOG(HLE, "Can only process one download at a time");
return false; return false;
@ -107,7 +107,7 @@ bool GameManager::DownloadAndInstall(std::string storeFileUrl) {
return true; return true;
} }
bool GameManager::IsDownloading(std::string storeZipUrl) { bool GameManager::IsDownloading(const std::string &storeZipUrl) {
if (curDownload_) if (curDownload_)
return curDownload_->url() == storeZipUrl; return curDownload_->url() == storeZipUrl;
return false; return false;
@ -128,7 +128,7 @@ float GameManager::DownloadSpeedKBps() {
return 0.0f; return 0.0f;
} }
void GameManager::UninstallGame(std::string name) { void GameManager::UninstallGame(const std::string &name) {
SetCurrentThreadName("UninstallGame"); SetCurrentThreadName("UninstallGame");
AndroidJNIThreadContext context; // Destructor detaches. AndroidJNIThreadContext context; // Destructor detaches.
@ -285,7 +285,7 @@ ZipFileContents DetectZipFileContents(struct zip *z, ZipFileInfo *info) {
} }
// Parameters need to be by value, since this is a thread func. // Parameters need to be by value, since this is a thread func.
bool GameManager::InstallGame(Path url, Path fileName, bool deleteAfter) { bool GameManager::InstallGame(const Path &url, const Path &fileName, bool deleteAfter) {
SetCurrentThreadName("InstallGame"); SetCurrentThreadName("InstallGame");
if (installDonePending_) { if (installDonePending_) {

View File

@ -42,11 +42,11 @@ class GameManager {
public: public:
GameManager(); GameManager();
bool IsGameInstalled(std::string name); bool IsGameInstalled(const std::string &name);
// This starts off a background process. // This starts off a background process.
bool DownloadAndInstall(std::string storeZipUrl); bool DownloadAndInstall(const std::string &storeZipUrl);
bool IsDownloading(std::string storeZipUrl); bool IsDownloading(const std::string &storeZipUrl);
// Cancels the download in progress, if any. // Cancels the download in progress, if any.
bool CancelDownload(); bool CancelDownload();
@ -79,12 +79,12 @@ public:
private: private:
// TODO: The return value on this is a bit pointless, we can't get at it. // TODO: The return value on this is a bit pointless, we can't get at it.
bool InstallGame(Path url, Path tempFileName, bool deleteAfter); bool InstallGame(const Path &url, const Path &tempFileName, bool deleteAfter);
bool InstallMemstickGame(struct zip *z, const Path &zipFile, const Path &dest, const ZipFileInfo &info, bool allowRoot, bool deleteAfter); bool InstallMemstickGame(struct zip *z, const Path &zipFile, const Path &dest, const ZipFileInfo &info, bool allowRoot, bool deleteAfter);
bool InstallMemstickZip(struct zip *z, const Path &zipFile, const Path &dest, const ZipFileInfo &info, bool deleteAfter); bool InstallMemstickZip(struct zip *z, const Path &zipFile, const Path &dest, const ZipFileInfo &info, bool deleteAfter);
bool InstallZippedISO(struct zip *z, int isoFileIndex, const Path &zipfile, bool deleteAfter); bool InstallZippedISO(struct zip *z, int isoFileIndex, const Path &zipfile, bool deleteAfter);
bool InstallRawISO(const Path &zipFile, const std::string &originalName, bool deleteAfter); bool InstallRawISO(const Path &zipFile, const std::string &originalName, bool deleteAfter);
void UninstallGame(std::string name); void UninstallGame(const std::string &name);
void InstallDone(); void InstallDone();

View File

@ -948,7 +948,7 @@ static PPGeTextDrawerImage PPGeGetTextImage(const char *text, const PPGeStyle &s
return im; return im;
} }
static void PPGeDrawTextImage(PPGeTextDrawerImage im, float x, float y, const PPGeStyle &style) { static void PPGeDrawTextImage(const PPGeTextDrawerImage &im, float x, float y, const PPGeStyle &style) {
if (!im.ptr) { if (!im.ptr) {
return; return;
} }