macOS: only try to enable valid cheats

This commit is contained in:
OV2 2018-07-03 20:42:34 +02:00
parent b65b07112c
commit 843c46053f
2 changed files with 3 additions and 2 deletions

View File

@ -296,7 +296,7 @@ static void DetachCheatItems (void)
char code[10];
snprintf(code, 10, "%x=%x", citem[i].address, citem[i].value);
int index = S9xAddCheatGroup(citem[i].description, code);
if(citem[i].enabled)
if(citem[i].enabled && index >= 0)
S9xEnableCheatGroup(index);
}
}

View File

@ -1470,7 +1470,8 @@ static void CheatFinderAddEntry (SInt64 value, char *description)
char code[10];
snprintf(code, 10, "%x=%x", addr + i + 0x7E0000, (UInt8) ((v & (0x000000FF << (i * 8))) >> (i * 8)));
int index = S9xAddCheatGroup(description, code);
S9xEnableCheatGroup(index);
if(index >= 0)
S9xEnableCheatGroup(index);
}
}