diff --git a/Core/CwCheat.cpp b/Core/CwCheat.cpp index 554985c6c7..2c0d93934f 100644 --- a/Core/CwCheat.cpp +++ b/Core/CwCheat.cpp @@ -20,9 +20,16 @@ void trim2(std::string& str); void __CheatInit() { //Moved createFullPath to CheatInit from the constructor because it spams the log and constantly checks if exists. In here, only checks once. std::string gameTitle = g_paramSFO.GetValueString("DISC_ID") + " - " + g_paramSFO.GetValueString("TITLE"); + //These 3 statements clean up the title, which sometimes contain characters that will cause problems when creating the .ini if (gameTitle.find("™")!= std::string::npos) { gameTitle.erase (gameTitle.find("™"), std::string::npos); } + while (gameTitle.find("/")!= std::string::npos) { + gameTitle.replace (gameTitle.find("/"),1," "); + } + if (gameTitle.find(":")!= std::string::npos) { + gameTitle.replace (gameTitle.find(":"),1," "); + } activeCheatFile = CHEATS_DIR + "/" + gameTitle +".ini"; File::CreateFullPath(CHEATS_DIR); @@ -51,7 +58,7 @@ void __CheatShutdown() { void hleCheat(u64 userdata, int cyclesLate) { CoreTiming::ScheduleEvent(msToCycles(77), CheatEvent, 0); - if (g_Config.bReloadCheats == true) { + if (g_Config.bReloadCheats == true) { //Checks if the "reload cheats" button has been pressed. cheatEngine->CreateCodeList(); g_Config.bReloadCheats = false; } @@ -67,7 +74,7 @@ CWCheatEngine::CWCheatEngine() { void CWCheatEngine::Exit() { exit2 = true; } -void CWCheatEngine::CreateCodeList() { +void CWCheatEngine::CreateCodeList() { //Creates code list to be used in function GetNextCode initialCodesList = GetCodesList(); std::string currentcode, codename; std::vector codelist; @@ -99,7 +106,7 @@ void CWCheatEngine::CreateCodeList() { } parts = makeCodeParts(codelist); } -inline std::vector makeCodeParts(std::vector CodesList) { +inline std::vector makeCodeParts(std::vector CodesList) { //Takes a single code line and creates a two-part vector for all codes. Feeds to CreateCodeList std::string currentcode; std::vector finalList; char split_char = '\n'; @@ -120,7 +127,7 @@ inline std::vector makeCodeParts(std::vector CodesList } return finalList; } -std::vector CWCheatEngine::GetNextCode() { +std::vector CWCheatEngine::GetNextCode() { // Feeds a size-2 vector of ints to Run() which contains the address and value of one cheat. std::string code1; std::string code2; std::vector splitCode; @@ -162,8 +169,7 @@ void CWCheatEngine::SkipAllCodes() { currentCode = codes.size(); } -int CWCheatEngine::GetAddress(int value) { - // The User space base address has to be added to given value +int CWCheatEngine::GetAddress(int value) { //Returns static address used by ppsspp. Some games may not like this, and causes cheats to not work without offset return (value + 0x08800000) & 0x3FFFFFFF; } @@ -178,7 +184,7 @@ inline void trim2(std::string& str) { else str.erase(str.begin(), str.end()); } -std::vector CWCheatEngine::GetCodesList() { +std::vector CWCheatEngine::GetCodesList() { //Reads the entire cheat list from the appropriate .ini. std::string line; std::vector codesList; // Read from INI here std::ifstream list(activeCheatFile.c_str());