}
Cheats[NumCheats].Descr = strdup(name);
Cheats[NumCheats].Enabled = 0;
+ Cheats[NumCheats].WasEnabled = 0;
Cheats[NumCheats].First = NumCodes;
Cheats[NumCheats].n = 0;
NumCheats++;
Cheats[NumCheats].Descr = strdup(buf + 1);
Cheats[NumCheats].Enabled = 0;
}
+ Cheats[NumCheats].WasEnabled = 0;
Cheats[NumCheats].First = NumCodes;
// apply all enabled cheats
void ApplyCheats() {
int i, j, k, endindex;
+ int was_enabled;
for (i = 0; i < NumCheats; i++) {
+ was_enabled = Cheats[i].WasEnabled;
if (!Cheats[i].Enabled) {
- continue;
+ if (!Cheats[i].WasEnabled)
+ continue;
}
+ Cheats[i].WasEnabled = Cheats[i].Enabled;
// process all cheat codes
endindex = Cheats[i].First + Cheats[i].n;
u16 val = CheatCodes[j].Val;
u32 taddr;
+ if (!was_enabled) {
+ switch (type) {
+ case CHEAT_CONST16:
+ CheatCodes[j].OldVal = psxMu16(addr);
+ break;
+ case CHEAT_CONST8:
+ CheatCodes[j].OldVal = psxMu8(addr);
+ break;
+ }
+ }
+ else if (!Cheats[i].Enabled) {
+ val = CheatCodes[j].OldVal;
+ if (type != CHEAT_CONST16 && type != CHEAT_CONST8)
+ continue;
+ }
+
switch (type) {
case CHEAT_CONST8:
psxMu8ref(addr) = (u8)val;
Cheats[NumCheats].Descr = strdup(descr[0] ? descr : _("(Untitled)"));
Cheats[NumCheats].Enabled = 0;
+ Cheats[NumCheats].WasEnabled = 0;
Cheats[NumCheats].First = NumCodes;
Cheats[NumCheats].n = 0;