From 843c46053f4e142841c4fc64dcf044befa0d3114 Mon Sep 17 00:00:00 2001 From: OV2 Date: Tue, 3 Jul 2018 20:42:34 +0200 Subject: [PATCH] macOS: only try to enable valid cheats --- macosx/mac-cheat.cpp | 2 +- macosx/mac-cheatfinder.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/macosx/mac-cheat.cpp b/macosx/mac-cheat.cpp index 881655044..6e56c3b87 100755 --- a/macosx/mac-cheat.cpp +++ b/macosx/mac-cheat.cpp @@ -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); } } diff --git a/macosx/mac-cheatfinder.cpp b/macosx/mac-cheatfinder.cpp index e0155ddcf..454935498 100755 --- a/macosx/mac-cheatfinder.cpp +++ b/macosx/mac-cheatfinder.cpp @@ -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); } }