Fix crashing on empy newlines. Increase max cheat list to 128

This commit is contained in:
Steven Cherry 2013-08-29 19:08:31 -05:00
parent e6d371c675
commit a2a3613457
2 changed files with 8 additions and 5 deletions

View File

@ -16,9 +16,6 @@ void hleCheat(u64 userdata, int cyclesLate);
void trim2(std::string& str); void trim2(std::string& str);
void __CheatInit() { void __CheatInit() {
//Moved createFullPath to CheatInit from the constructor because it spams the log and constantly checks if exists. In here, only checks once.
// Cheats aren't working on Android yet - need to figure out the directory structure
gameTitle = g_paramSFO.GetValueString("DISC_ID"); gameTitle = g_paramSFO.GetValueString("DISC_ID");
#ifdef ANDROID #ifdef ANDROID
activeCheatFile = g_Config.memCardDirectory + "PSP/Cheats/" + gameTitle + ".ini"; activeCheatFile = g_Config.memCardDirectory + "PSP/Cheats/" + gameTitle + ".ini";
@ -195,7 +192,9 @@ std::vector<std::string> CWCheatEngine::GetCodesList() { //Reads the entire chea
std::ifstream list(activeCheatFile.c_str()); std::ifstream list(activeCheatFile.c_str());
for (int i = 0; !list.eof(); i ++) { for (int i = 0; !list.eof(); i ++) {
getline(list, line, '\n'); getline(list, line, '\n');
codesList.push_back(line); if (line.length() > 8){
codesList.push_back(line);
}
} }
for(size_t i = 0; i < codesList.size(); i++) { for(size_t i = 0; i < codesList.size(); i++) {
trim2(codesList[i]); trim2(codesList[i]);
@ -506,6 +505,10 @@ void CWCheatEngine::Run() {
} }
break; break;
} }
default:
{
break;
}
} }
} }
} }

View File

@ -46,7 +46,7 @@ protected:
private: private:
UI::EventReturn OnCheckBox(UI::EventParams &params); UI::EventReturn OnCheckBox(UI::EventParams &params);
bool enableCheat [64]; bool enableCheat [128];
std::vector<std::string> formattedList; std::vector<std::string> formattedList;
std::vector<int> locations; std::vector<int> locations;