diff --git a/desmume/src/cheatSystem.cpp b/desmume/src/cheatSystem.cpp index 4d2c4d8dd..ed0e3bf92 100644 --- a/desmume/src/cheatSystem.cpp +++ b/desmume/src/cheatSystem.cpp @@ -39,9 +39,6 @@ void CHEATS::init(char *path) clear(); strcpy((char *)filename, path); - if (stack) delete [] stack; - stack = NULL; - load(); } @@ -505,7 +502,7 @@ BOOL CHEATS::getList(CHEATS_LIST *cheat) } //memcpy(cheat, &list[currentGet++], sizeof(CHEATS_LIST)); *cheat = list[currentGet++]; - if (currentGet >= list.size()) + if (currentGet > list.size()) { currentGet = 0; return FALSE; @@ -621,6 +618,8 @@ BOOL CHEATS::load() } trim(buf); if ((strlen(buf) == 0) || (buf[0] == ';')) continue; + if(!strnicmp(buf,"name=",5)) continue; + if(!strnicmp(buf,"serial=",7)) continue; memset(&tmp_cht, 0, sizeof(tmp_cht)); if ((buf[0] == 'D') && (buf[1] == 'S')) // internal @@ -649,7 +648,7 @@ BOOL CHEATS::load() continue; } - tmp_cht.enabled = (buf[3] == '0')?false:true; + tmp_cht.enabled = (buf[3] == '0')?FALSE:TRUE; u32 descr_pos = (u32)(std::max(strchr((char*)buf, ';') - buf, 0)); if (descr_pos != 0) strcpy(tmp_cht.description, (buf + descr_pos + 1)); @@ -688,36 +687,10 @@ BOOL CHEATS::load() return FALSE; } -//BOOL CHEATS::push() -//{ -// if (stack) return FALSE; -// stack = new u8 [sizeof(list)]; -// memcpy(stack, list, sizeof(list)); -// numStack = num; -// return TRUE; -//} -// -//BOOL CHEATS::pop() -//{ -// if (!stack) return FALSE; -// memcpy(list, stack, sizeof(list)); -// num = numStack; -// delete [] stack; -// stack = NULL; -// return TRUE; -//} -// -//void CHEATS::stackClear() -//{ -// if (!stack) return; -// delete [] stack; -// stack = NULL; -//} - void CHEATS::process() { if (CommonSettings.cheatsDisable) return; - if (!list.size() == 0) return; + if (list.size() == 0) return; size_t num = list.size(); for (size_t i = 0; i < num; i++) { diff --git a/desmume/src/cheatSystem.h b/desmume/src/cheatSystem.h index e5982632e..be7c9bbb2 100644 --- a/desmume/src/cheatSystem.h +++ b/desmume/src/cheatSystem.h @@ -50,9 +50,6 @@ private: u8 filename[MAX_PATH]; u32 currentGet; - u8 *stack; - u16 numStack; - void clear(); void ARparser(CHEATS_LIST& cheat); BOOL XXcodePreParser(CHEATS_LIST *cheat, char *code); @@ -61,8 +58,6 @@ private: public: CHEATS() : currentGet(0) - , stack(0) - , numStack(0) { memset(filename, 0, sizeof(filename)); } @@ -82,9 +77,6 @@ public: u32 getSize(); BOOL save(); BOOL load(); - //BOOL push(); - //BOOL pop(); - //void stackClear(); void process(); void getXXcodeString(CHEATS_LIST cheat, char *res_buf); };