all repos — mgba @ 32f7f35ee9088694c58cb22b0e3803684a42d8a1

mGBA Game Boy Advance Emulator

GBA Cheats: More minor fixes
Vicki Pfau vi@endrift.com
Sun, 19 Nov 2017 10:50:27 -0800
commit

32f7f35ee9088694c58cb22b0e3803684a42d8a1

parent

4b40c5cd1a319866407984e560f312f7fd31702a

3 files changed, 14 insertions(+), 4 deletions(-)

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

@@ -174,6 +174,7 @@ cheat->width = 2;

cheat->address = op2 & 0x0FFFFFFF; cheat->operand = op1 & 0xFFFF; cheat->repeat = (op1 >> 16) & 0xFF; + cheat->negativeRepeat = 0; return true; case GSA_HOOK: if (cheats->hook) {

@@ -190,6 +191,7 @@ return false;

} cheat->operand = op2; cheat->repeat = 1; + cheat->negativeRepeat = 0; return true; }
M src/gba/cheats/parv3.csrc/gba/cheats/parv3.c

@@ -223,7 +223,7 @@ if (cheats->incompleteCheat != COMPLETE) {

struct mCheat* incompleteCheat = mCheatListGetPointer(&cheats->d.list, cheats->incompleteCheat); incompleteCheat->operand = op1 & (0xFFFFFFFFU >> ((4 - incompleteCheat->width) * 8)); incompleteCheat->operandOffset = op2 >> 24; - incompleteCheat->repeat = (op2 >> 16) & 0xFF; + incompleteCheat->repeat = ((op2 >> 16) & 0xFF) + 1; incompleteCheat->addressOffset = (op2 & 0xFFFF) * incompleteCheat->width; cheats->incompleteCheat = COMPLETE; return true;

@@ -342,7 +342,7 @@ if (op1 == 0xDEADFACE && !(op2 & 0xFFFF0000)) {

return 0x100; } if (!op1) { - probability += 0x20; + probability += 0x40; uint32_t address = _parAddr(op2); switch (op2 & 0xFE000000) { case PAR3_OTHER_FILL_1:

@@ -363,8 +363,8 @@ case PAR3_OTHER_BUTTON_2:

case PAR3_OTHER_BUTTON_4: case PAR3_OTHER_ENDIF: case PAR3_OTHER_ELSE: - if (op2 & 0x01FFFFFF) { - probability -= 0x20; + if (op2 & 0x01000000) { + probability -= 0x40; } break; default:
M src/gba/test/cheats.csrc/gba/test/cheats.c

@@ -421,6 +421,7 @@ core->rawWrite8(core, 0x03000000, -1, 0x1);

mCheatRefresh(device, set); assert_int_equal(core->rawRead8(core, 0x03000000, -1), 0x1); assert_int_equal(core->rawRead8(core, 0x03000001, -1), 0x11); + set->deinit(set); } M_TEST_DEFINE(doPARv3IfXxX) {

@@ -483,6 +484,7 @@ assert_int_equal(core->rawRead8(core, 0x03000001, -1), 0x1);

assert_int_equal(core->rawRead8(core, 0x03000002, -1), 0x21); assert_int_equal(core->rawRead8(core, 0x03000003, -1), 0x32); assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x41); + set->deinit(set); } M_TEST_DEFINE(doPARv3IfXElse) {

@@ -517,6 +519,7 @@ mCheatRefresh(device, set);

assert_int_equal(core->rawRead8(core, 0x03000000, -1), 0x1); assert_int_equal(core->rawRead8(core, 0x03000001, -1), 0x11); assert_int_equal(core->rawRead8(core, 0x03000002, -1), 0x22); + set->deinit(set); } M_TEST_DEFINE(doPARv3IfXElsexX) {

@@ -587,6 +590,7 @@ assert_int_equal(core->rawRead8(core, 0x03000002, -1), 0x21);

assert_int_equal(core->rawRead8(core, 0x03000003, -1), 0x32); assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x42); assert_int_equal(core->rawRead8(core, 0x03000005, -1), 0x51); + set->deinit(set); } M_TEST_DEFINE(doPARv3IfXElsexXElse) {

@@ -664,6 +668,7 @@ assert_int_equal(core->rawRead8(core, 0x03000003, -1), 0x32);

assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x42); assert_int_equal(core->rawRead8(core, 0x03000005, -1), 0x51); assert_int_equal(core->rawRead8(core, 0x03000006, -1), 0x62); + set->deinit(set); } M_TEST_DEFINE(doPARv3IfXContain1) {

@@ -725,6 +730,7 @@ assert_int_equal(core->rawRead8(core, 0x03000001, -1), 0x1);

assert_int_equal(core->rawRead8(core, 0x03000002, -1), 0x21); assert_int_equal(core->rawRead8(core, 0x03000003, -1), 0x31); assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x41); + set->deinit(set); } M_TEST_DEFINE(doPARv3IfXContain1Else) {

@@ -794,6 +800,7 @@ assert_int_equal(core->rawRead8(core, 0x03000002, -1), 0x21);

assert_int_equal(core->rawRead8(core, 0x03000003, -1), 0x31); assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x41); assert_int_equal(core->rawRead8(core, 0x03000005, -1), 0x52); + set->deinit(set); } M_TEST_DEFINE(doPARv3IfXElseContain1) {

@@ -863,6 +870,7 @@ assert_int_equal(core->rawRead8(core, 0x03000002, -1), 0x21);

assert_int_equal(core->rawRead8(core, 0x03000003, -1), 0x32); assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x41); assert_int_equal(core->rawRead8(core, 0x03000005, -1), 0x52); + set->deinit(set); } M_TEST_DEFINE(doPARv3IfXContain1ElseContain1) {