mirror of https://github.com/mgba-emu/mgba.git
GBA Cheats: More fixes
This commit is contained in:
parent
8ab6987823
commit
721224306c
|
@ -250,8 +250,15 @@ bool GBACheatAddProActionReplayRaw(struct GBACheatSet* cheats, uint32_t op1, uin
|
||||||
if (cheats->incompleteCheat != COMPLETE) {
|
if (cheats->incompleteCheat != COMPLETE) {
|
||||||
struct mCheat* incompleteCheat = mCheatListGetPointer(&cheats->d.list, cheats->incompleteCheat);
|
struct mCheat* incompleteCheat = mCheatListGetPointer(&cheats->d.list, cheats->incompleteCheat);
|
||||||
incompleteCheat->operand = op1 & (0xFFFFFFFFU >> ((4 - incompleteCheat->width) * 8));
|
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->operandOffset = op2 >> 24;
|
||||||
incompleteCheat->repeat = ((op2 >> 16) & 0xFF) + 1;
|
incompleteCheat->repeat = (op2 >> 16) & 0xFF;
|
||||||
incompleteCheat->addressOffset = (op2 & 0xFFFF) * incompleteCheat->width;
|
incompleteCheat->addressOffset = (op2 & 0xFFFF) * incompleteCheat->width;
|
||||||
cheats->incompleteCheat = COMPLETE;
|
cheats->incompleteCheat = COMPLETE;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1037,9 +1037,12 @@ M_TEST_DEFINE(doPARv3IfButton) {
|
||||||
|
|
||||||
mCheatPressButton(device, true);
|
mCheatPressButton(device, true);
|
||||||
mCheatRefresh(device, set);
|
mCheatRefresh(device, set);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000000, -1), 0);
|
assert_int_equal(core->rawRead8(core, 0x03000000, -1), 0x1);
|
||||||
|
|
||||||
mCheatPressButton(device, false);
|
mCheatPressButton(device, false);
|
||||||
|
mCheatRefresh(device, set);
|
||||||
|
assert_int_equal(core->rawRead8(core, 0x03000000, -1), 0x1);
|
||||||
|
|
||||||
core->rawWrite8(core, 0x03000000, -1, 0);
|
core->rawWrite8(core, 0x03000000, -1, 0);
|
||||||
mCheatRefresh(device, set);
|
mCheatRefresh(device, set);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000000, -1), 0);
|
assert_int_equal(core->rawRead8(core, 0x03000000, -1), 0);
|
||||||
|
|
Loading…
Reference in New Issue