mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-09 12:36:23 +02:00
Merge pull request #2330 from makotech222/cwcheatUI
CWCheat: Fix bug with titles containing "/"
This commit is contained in:
commit
cbdc26c508
1 file changed
+13
-7
+13
-7
@@ -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<std::string> codelist;
|
||||
@@ -99,7 +106,7 @@ void CWCheatEngine::CreateCodeList() {
|
||||
}
|
||||
parts = makeCodeParts(codelist);
|
||||
}
|
||||
inline std::vector<std::string> makeCodeParts(std::vector<std::string> CodesList) {
|
||||
inline std::vector<std::string> makeCodeParts(std::vector<std::string> CodesList) { //Takes a single code line and creates a two-part vector for all codes. Feeds to CreateCodeList
|
||||
std::string currentcode;
|
||||
std::vector<std::string> finalList;
|
||||
char split_char = '\n';
|
||||
@@ -120,7 +127,7 @@ inline std::vector<std::string> makeCodeParts(std::vector<std::string> CodesList
|
||||
}
|
||||
return finalList;
|
||||
}
|
||||
std::vector<int> CWCheatEngine::GetNextCode() {
|
||||
std::vector<int> 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<std::string> 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<std::string> CWCheatEngine::GetCodesList() {
|
||||
std::vector<std::string> CWCheatEngine::GetCodesList() { //Reads the entire cheat list from the appropriate .ini.
|
||||
std::string line;
|
||||
std::vector<std::string> codesList; // Read from INI here
|
||||
std::ifstream list(activeCheatFile.c_str());
|
||||
|
||||
Reference in new issue
Block a user