all repos — mgba @ 83e6545bb5232250a16d1c9bc484c3af8706b931

mGBA Game Boy Advance Emulator

GBA Cheats: More fixes
Vicki Pfau vi@endrift.com
Mon, 27 Nov 2017 13:12:48 -0800
commit

83e6545bb5232250a16d1c9bc484c3af8706b931

parent

97a23975ab28e4fa7a96ff0fd06902ca0edf1717

2 files changed, 9 insertions(+), 1 deletions(-)

jump to
M src/gba/cheats/parv3.csrc/gba/cheats/parv3.c

@@ -222,8 +222,15 @@ }

if (cheats->incompleteCheat != COMPLETE) { struct mCheat* incompleteCheat = mCheatListGetPointer(&cheats->d.list, cheats->incompleteCheat); incompleteCheat->operand = op1 & (0xFFFFFFFFU >> ((4 - incompleteCheat->width) * 8)); + if (cheats->incompleteCheat > 0) { + struct mCheat* lastCheat = mCheatListGetPointer(&cheats->d.list, cheats->incompleteCheat - 1); + if (lastCheat->type == CHEAT_IF_BUTTON) { + cheats->incompleteCheat = COMPLETE; + return true; + } + } incompleteCheat->operandOffset = op2 >> 24; - incompleteCheat->repeat = ((op2 >> 16) & 0xFF) + 1; + incompleteCheat->repeat = (op2 >> 16) & 0xFF; incompleteCheat->addressOffset = (op2 & 0xFFFF) * incompleteCheat->width; cheats->incompleteCheat = COMPLETE; return true;
M src/gba/test/cheats.csrc/gba/test/cheats.c

@@ -1016,6 +1016,7 @@ assert_int_equal(core->rawRead8(core, 0x03000005, -1), 0x51);

assert_int_equal(core->rawRead8(core, 0x03000006, -1), 0x62); assert_int_equal(core->rawRead8(core, 0x03000007, -1), 0x71); assert_int_equal(core->rawRead8(core, 0x03000008, -1), 0x82); + set->deinit(set); } M_TEST_SUITE_DEFINE_SETUP_TEARDOWN(GBACheats,