diff --git a/CHANGES b/CHANGES index 63afede0a..8eab3139b 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,7 @@ Bugfixes: - GB Video: Fix video frames getting missed when LCDC is off - LR35902: Fix events running with the wrong cycle active - GB Video: Clear screen when LCDC is off + - GBA Cheats: Fix key-activated CodeBreaker cheats Misc: - All: Only update version info if needed - FFmpeg: Encoding cleanup diff --git a/src/core/cheats.c b/src/core/cheats.c index 617dbb56f..efcbf4aa0 100644 --- a/src/core/cheats.c +++ b/src/core/cheats.c @@ -349,6 +349,11 @@ void mCheatRefresh(struct mCheatDevice* device, struct mCheatSet* cheats) { conditionRemaining = cheat->repeat; negativeConditionRemaining = cheat->negativeRepeat; break; + case CHEAT_IF_NAND: + condition = !(_readMem(device->p, address, cheat->width) & operand); + conditionRemaining = cheat->repeat; + negativeConditionRemaining = cheat->negativeRepeat; + break; } if (performAssignment) { diff --git a/src/core/cheats.h b/src/core/cheats.h index 75697bf73..1cc3dedc6 100644 --- a/src/core/cheats.h +++ b/src/core/cheats.h @@ -27,7 +27,8 @@ enum mCheatType { CHEAT_IF_ULT, CHEAT_IF_UGT, CHEAT_IF_AND, - CHEAT_IF_LAND + CHEAT_IF_LAND, + CHEAT_IF_NAND }; struct mCheat { diff --git a/src/gba/cheats/codebreaker.c b/src/gba/cheats/codebreaker.c index a90e367f6..5c7f6fb58 100644 --- a/src/gba/cheats/codebreaker.c +++ b/src/gba/cheats/codebreaker.c @@ -276,9 +276,9 @@ bool GBACheatAddCodeBreaker(struct GBACheatSet* cheats, uint32_t op1, uint16_t o switch (op1 & 0x0FFFFFFF) { case 0x20: cheat = mCheatListAppend(&cheats->d.list); - cheat->type = CHEAT_IF_AND; + cheat->type = CHEAT_IF_NAND; cheat->width = 2; - cheat->address = BASE_IO | REG_JOYSTAT; + cheat->address = BASE_IO | REG_KEYINPUT; cheat->operand = op2; cheat->repeat = 1; return true;