Merge branch 'chinhodado-cleanup'

This commit is contained in:
Henrik Rydgard 2015-03-01 16:58:23 +01:00
commit 32825471a6
26 changed files with 39 additions and 47 deletions

View File

@ -131,7 +131,8 @@ void CWCheatEngine::Exit() {
exit2 = true;
}
static inline std::vector<std::string> makeCodeParts(const std::vector<std::string> CodesList) { //Takes a single code line and creates a two-part vector for each code. Feeds to CreateCodeList
// Takes a single code line and creates a two-part vector for each code. Feeds to CreateCodeList
static inline std::vector<std::string> makeCodeParts(const std::vector<std::string>& CodesList) {
std::string currentcode;
std::vector<std::string> finalList;
char split_char = '\n';

View File

@ -152,7 +152,7 @@ PSPOskDialog::PSPOskDialog() : PSPDialog() {
PSPOskDialog::~PSPOskDialog() {
}
void PSPOskDialog::ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16_le> em_address)
void PSPOskDialog::ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16_le>& em_address)
{
if (!em_address.IsValid())
{
@ -182,7 +182,7 @@ void PSPOskDialog::ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16_
_string = stringBuffer;
}
void GetWideStringFromPSPPointer(std::wstring& _string, const PSPPointer<u16_le> em_address)
void GetWideStringFromPSPPointer(std::wstring& _string, const PSPPointer<u16_le>& em_address)
{
if (!em_address.IsValid())
{

View File

@ -217,7 +217,7 @@ protected:
}
private:
void ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16_le> em_address);
void ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16_le>& em_address);
void ConvertUCS2ToUTF8(std::string& _string, const wchar_t *input);
void RenderKeyboard();
#if defined(USING_WIN_UI)

View File

@ -579,7 +579,7 @@ bool SavedataParam::Load(SceUtilitySavedataParam *param, const std::string &save
return true;
}
bool SavedataParam::LoadSaveData(SceUtilitySavedataParam *param, const std::string &saveDirName, const std::string dirPath, bool secureMode) {
bool SavedataParam::LoadSaveData(SceUtilitySavedataParam *param, const std::string &saveDirName, const std::string& dirPath, bool secureMode) {
u8 *data_ = param->dataBuf;
std::string filePath = dirPath+"/"+GetFileName(param);
s64 readSize;
@ -668,7 +668,7 @@ void SavedataParam::LoadNotCryptedSave(SceUtilitySavedataParam *param, u8 *data,
memcpy(data, saveData, std::min((u32)saveSize, (u32)param->dataBufSize));
}
void SavedataParam::LoadSFO(SceUtilitySavedataParam *param, const std::string dirPath) {
void SavedataParam::LoadSFO(SceUtilitySavedataParam *param, const std::string& dirPath) {
ParamSFOData sfoFile;
std::string sfopath = dirPath+"/" + SFO_FILENAME;
PSPFileInfo sfoInfo = pspFileSystem.GetFileInfo(sfopath);
@ -720,7 +720,7 @@ std::set<std::string> SavedataParam::getSecureFileNames(std::string dirPath) {
return secureFileNames;
}
void SavedataParam::LoadFile(const std::string dirPath, const std::string filename, PspUtilitySavedataFileData *fileData) {
void SavedataParam::LoadFile(const std::string& dirPath, const std::string& filename, PspUtilitySavedataFileData *fileData) {
std::string filePath = dirPath + "/" + filename;
s64 readSize = -1;
if(!fileData->buf.IsValid())

View File

@ -354,11 +354,11 @@ private:
void SetFileInfo(SaveFileInfo &saveInfo, PSPFileInfo &info, std::string saveName);
void ClearFileInfo(SaveFileInfo &saveInfo, std::string saveName);
bool LoadSaveData(SceUtilitySavedataParam *param, const std::string &saveDirName, const std::string dirPath, bool secureMode);
bool LoadSaveData(SceUtilitySavedataParam *param, const std::string &saveDirName, const std::string& dirPath, bool secureMode);
void LoadCryptedSave(SceUtilitySavedataParam *param, u8 *data, u8 *saveData, int &saveSize, int prevCryptMode, bool &saveDone);
void LoadNotCryptedSave(SceUtilitySavedataParam *param, u8 *data, u8 *saveData, int &saveSize);
void LoadSFO(SceUtilitySavedataParam *param, const std::string dirPath);
void LoadFile(const std::string dirPath, const std::string filename, PspUtilitySavedataFileData *fileData);
void LoadSFO(SceUtilitySavedataParam *param, const std::string& dirPath);
void LoadFile(const std::string& dirPath, const std::string& filename, PspUtilitySavedataFileData *fileData);
int DecryptSave(unsigned int mode, unsigned char *data, int *dataLen, int *alignedLen, unsigned char *cryptkey);
int EncryptData(unsigned int mode, unsigned char *data, int *dataLen, int *alignedLen, unsigned char *hash, unsigned char *cryptkey);

View File

@ -176,7 +176,7 @@ bool ParamSFOData::WriteSFO(u8 **paramsfo, size_t *size)
total_size += sizeof(Header);
// Get size info
for (std::map<std::string,ValueData>::iterator it = values.begin(); it != values.end(); it++)
for (auto it = values.begin(); it != values.end(); ++it)
{
key_size += it->first.size()+1;
data_size += it->second.max_size;
@ -205,7 +205,7 @@ bool ParamSFOData::WriteSFO(u8 **paramsfo, size_t *size)
u8* key_ptr = data + header.key_table_start;
u8* data_ptr = data + header.data_table_start;
for (std::map<std::string,ValueData>::iterator it = values.begin(); it != values.end(); it++)
for (auto it = values.begin(); it != values.end(); ++it)
{
u16 offset = (u16)(key_ptr - (data+header.key_table_start));
index_ptr->key_table_offset = offset;

View File

@ -2148,9 +2148,8 @@ static int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesCo
if (avret < 0) {
ERROR_LOG(ME, "swr_convert: Error while converting %d", avret);
}
}
if (res == ATDECODE_GOTFRAME)
break;
}
}
}

View File

@ -71,7 +71,7 @@ struct Mbx : public KernelObject
bool inserted = false;
if (nmb.attr & SCE_KERNEL_MBA_THPRI)
{
for (std::vector<MbxWaitingThread>::iterator it = waitingThreads.begin(); it != waitingThreads.end(); it++)
for (auto it = waitingThreads.begin(); it != waitingThreads.end(); ++it)
{
if (__KernelGetThreadPrio(id) < __KernelGetThreadPrio(it->threadID))
{

View File

@ -3608,7 +3608,7 @@ bool __KernelCheckCallbacks() {
bool processed = false;
u32 error;
for (std::vector<SceUID>::iterator iter = threadqueue.begin(); iter != threadqueue.end(); iter++) {
for (auto iter = threadqueue.begin(); iter != threadqueue.end(); ++iter) {
Thread *thread = kernelObjects.Get<Thread>(*iter, error);
if (thread && __KernelCheckThreadCallbacks(thread, false)) {
processed = true;
@ -3690,7 +3690,7 @@ std::vector<DebugThreadInfo> GetThreadsInfo()
std::vector<DebugThreadInfo> threadList;
u32 error;
for (std::vector<SceUID>::iterator iter = threadqueue.begin(); iter != threadqueue.end(); iter++)
for (auto iter = threadqueue.begin(); iter != threadqueue.end(); ++iter)
{
Thread *t = kernelObjects.Get<Thread>(*iter, error);
if (!t)

View File

@ -740,7 +740,7 @@ static void SaveFrame(AVFrame *pFrame, int width, int height)
// check the existence of pmp media context
static bool isContextExist(u32 ctxAddr){
for (std::list<u32>::iterator it = pmp_ContextList.begin(); it != pmp_ContextList.end(); it++){
for (auto it = pmp_ContextList.begin(); it != pmp_ContextList.end(); ++it){
if (*it == ctxAddr){
return true;
}
@ -1016,7 +1016,7 @@ void __VideoPmpInit() {
void __VideoPmpShutdown() {
#ifdef USE_FFMPEG
// We need to empty pmp_queue to not leak memory.
for (std::list<AVFrame *>::iterator it = pmp_queue.begin(); it != pmp_queue.end(); it++){
for (auto it = pmp_queue.begin(); it != pmp_queue.end(); ++it){
av_free(*it);
}
pmp_queue.clear();

View File

@ -1000,7 +1000,7 @@ static u32 sceNetAdhocctlAddHandler(u32 handlerPtr, u32 handlerArg) {
handler.entryPoint = handlerPtr;
handler.argument = handlerArg;
for (std::map<int, AdhocctlHandler>::iterator it = adhocctlHandlers.begin(); it != adhocctlHandlers.end(); it++) {
for (auto it = adhocctlHandlers.begin(); it != adhocctlHandlers.end(); ++it) {
if (it->second.entryPoint == handlerPtr) {
foundHandler = true;
break;

View File

@ -183,7 +183,7 @@ void Jit::GetStateAndFlushAll(RegCacheState &state)
FlushAll();
}
void Jit::RestoreState(const RegCacheState state)
void Jit::RestoreState(const RegCacheState& state)
{
gpr.RestoreState(state.gpr);
fpr.RestoreState(state.fpr);

View File

@ -187,7 +187,7 @@ public:
private:
void GetStateAndFlushAll(RegCacheState &state);
void RestoreState(const RegCacheState state);
void RestoreState(const RegCacheState& state);
void FlushAll();
void FlushPrefixV();
void WriteDowncount(int offset = 0);

View File

@ -234,7 +234,7 @@ bool JitSafeMem::PrepareSlowWrite()
return false;
}
void JitSafeMem::DoSlowWrite(const void *safeFunc, const OpArg src, int suboffset)
void JitSafeMem::DoSlowWrite(const void *safeFunc, const OpArg& src, int suboffset)
{
if (iaddr_ != (u32) -1)
jit_->MOV(32, R(EAX), Imm32((iaddr_ + suboffset) & alignMask_));

View File

@ -36,9 +36,9 @@ public:
// Emit code proceeding a slow write call, returns true if slow write is needed.
bool PrepareSlowWrite();
// Emit a slow write from src.
void DoSlowWrite(const void *safeFunc, const Gen::OpArg src, int suboffset = 0);
void DoSlowWrite(const void *safeFunc, const Gen::OpArg& src, int suboffset = 0);
template <typename T>
void DoSlowWrite(void (*safeFunc)(T val, u32 addr), const Gen::OpArg src, int suboffset = 0) {
void DoSlowWrite(void (*safeFunc)(T val, u32 addr), const Gen::OpArg& src, int suboffset = 0) {
DoSlowWrite((const void *)safeFunc, src, suboffset);
}

View File

@ -396,7 +396,7 @@ void GPRRegCache::GetState(GPRRegCacheState &state) const {
memcpy(state.xregs, xregs, sizeof(xregs));
}
void GPRRegCache::RestoreState(const GPRRegCacheState state) {
void GPRRegCache::RestoreState(const GPRRegCacheState& state) {
memcpy(regs, state.regs, sizeof(regs));
memcpy(xregs, state.xregs, sizeof(xregs));
}

View File

@ -112,7 +112,7 @@ public:
u32 GetImm(MIPSGPReg preg) const;
void GetState(GPRRegCacheState &state) const;
void RestoreState(const GPRRegCacheState state);
void RestoreState(const GPRRegCacheState& state);
MIPSState *mips;

View File

@ -1066,7 +1066,7 @@ void FPURegCache::GetState(FPURegCacheState &state) const {
memcpy(state.xregs, xregs, sizeof(xregs));
}
void FPURegCache::RestoreState(const FPURegCacheState state) {
void FPURegCache::RestoreState(const FPURegCacheState& state) {
memcpy(regs, state.regs, sizeof(regs));
memcpy(xregs, state.xregs, sizeof(xregs));
pendingFlush = true;

View File

@ -206,7 +206,7 @@ public:
void SimpleRegV(const u8 v, int flags);
void GetState(FPURegCacheState &state) const;
void RestoreState(const FPURegCacheState state);
void RestoreState(const FPURegCacheState& state);
MIPSState *mips;

View File

@ -480,7 +480,7 @@ Opcode Read_Opcode_JIT(u32 address)
// WARNING! No checks!
// We assume that _Address is cached
void Write_Opcode_JIT(const u32 _Address, const Opcode _Value)
void Write_Opcode_JIT(const u32 _Address, const Opcode& _Value)
{
Memory::WriteUnchecked_U32(_Value.encoding, _Address);
}

View File

@ -141,7 +141,7 @@ MemoryInitedLock Lock();
// used by JIT to read instructions. Does not resolve replacements.
Opcode Read_Opcode_JIT(const u32 _Address);
// used by JIT. Reads in the "Locked cache" mode
void Write_Opcode_JIT(const u32 _Address, const Opcode _Value);
void Write_Opcode_JIT(const u32 _Address, const Opcode& _Value);
// Should be used by analyzers, disassemblers etc. Does resolve replacements.
Opcode Read_Instruction(const u32 _Address, bool resolveReplacements = false);

View File

@ -121,13 +121,13 @@ inline float bern2deriv(float x) { return 3 * (2 - 3 * x) * x; }
inline float bern3deriv(float x) { return 3 * x * x; }
// http://en.wikipedia.org/wiki/Bernstein_polynomial
static Vec3Packedf Bernstein3D(const Vec3Packedf p0, const Vec3Packedf p1, const Vec3Packedf p2, const Vec3Packedf p3, float x) {
static Vec3Packedf Bernstein3D(const Vec3Packedf& p0, const Vec3Packedf& p1, const Vec3Packedf& p2, const Vec3Packedf& p3, float x) {
if (x == 0) return p0;
else if (x == 1) return p3;
return p0 * bern0(x) + p1 * bern1(x) + p2 * bern2(x) + p3 * bern3(x);
}
static Vec3Packedf Bernstein3DDerivative(const Vec3Packedf p0, const Vec3Packedf p1, const Vec3Packedf p2, const Vec3Packedf p3, float x) {
static Vec3Packedf Bernstein3DDerivative(const Vec3Packedf& p0, const Vec3Packedf& p1, const Vec3Packedf& p2, const Vec3Packedf& p3, float x) {
return p0 * bern0deriv(x) + p1 * bern1deriv(x) + p2 * bern2deriv(x) + p3 * bern3deriv(x);
}

View File

@ -513,7 +513,6 @@ void GameSettingsScreen::CreateViews() {
const HRESULT result = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, myDocumentsPath);
const std::string PPSSPPpath = File::GetExeDirectory();
const std::string installedFile = PPSSPPpath + "installed.txt";
const std::string path = File::GetExeDirectory();
installed_ = File::Exists(installedFile);
otherinstalled_ = false;
if (!installed_ && result == S_OK) {
@ -658,10 +657,8 @@ UI::EventReturn GameSettingsScreen::OnJitAffectingSetting(UI::EventParams &e) {
UI::EventReturn GameSettingsScreen::OnSavePathMydoc(UI::EventParams &e) {
const std::string PPSSPPpath = File::GetExeDirectory();
const std::string installedFile = PPSSPPpath + "installed.txt";
const std::string path = File::GetExeDirectory();
installed_ = File::Exists(installedFile);
if (otherinstalled_) {
const std::string PPSSPPpath = File::GetExeDirectory();
File::Delete(PPSSPPpath + "installed.txt");
File::CreateEmptyFile(PPSSPPpath + "installed.txt");
otherinstalled_ = false;

View File

@ -599,15 +599,10 @@ static bool DisasmNeonF2F3(uint32_t op, char *text) {
}
return DisasmArithNeon(op, opname, text, includeSuffix);
case 0x31:
temp = (op >> 4) & 0xF1;
switch (temp) {
default:
if (op & 0x100)
opname = "MLS";
else
opname = "SUB";
break;
}
if (op & 0x100)
opname = "MLS";
else
opname = "SUB";
return DisasmArithNeon(op, opname, text);
case 0x30:
case 0x34:

View File

@ -322,7 +322,7 @@ std::vector<u32> TranslateDebugBufferToCompare(const GPUDebugBuffer *buffer, u32
return data;
}
double CompareScreenshot(const std::vector<u32> &pixels, u32 stride, u32 w, u32 h, const std::string screenshotFilename, std::string &error)
double CompareScreenshot(const std::vector<u32> &pixels, u32 stride, u32 w, u32 h, const std::string& screenshotFilename, std::string &error)
{
if (pixels.size() < stride * h)
{

View File

@ -32,4 +32,4 @@ std::string GetTestName(const std::string &bootFilename);
bool CompareOutput(const std::string &bootFilename, const std::string &output, bool verbose);
std::vector<u32> TranslateDebugBufferToCompare(const GPUDebugBuffer *buffer, u32 stride, u32 h);
double CompareScreenshot(const std::vector<u32> &pixels, u32 stride, u32 w, u32 h, const std::string screenshotFilename, std::string &error);
double CompareScreenshot(const std::vector<u32> &pixels, u32 stride, u32 w, u32 h, const std::string& screenshotFilename, std::string &error);