mirror of https://github.com/mgba-emu/mgba.git
GBA Cheats: More minor fixes
This commit is contained in:
parent
4b40c5cd1a
commit
32f7f35ee9
|
@ -174,6 +174,7 @@ bool GBACheatAddGameSharkRaw(struct GBACheatSet* cheats, uint32_t op1, uint32_t
|
||||||
cheat->address = op2 & 0x0FFFFFFF;
|
cheat->address = op2 & 0x0FFFFFFF;
|
||||||
cheat->operand = op1 & 0xFFFF;
|
cheat->operand = op1 & 0xFFFF;
|
||||||
cheat->repeat = (op1 >> 16) & 0xFF;
|
cheat->repeat = (op1 >> 16) & 0xFF;
|
||||||
|
cheat->negativeRepeat = 0;
|
||||||
return true;
|
return true;
|
||||||
case GSA_HOOK:
|
case GSA_HOOK:
|
||||||
if (cheats->hook) {
|
if (cheats->hook) {
|
||||||
|
@ -190,6 +191,7 @@ bool GBACheatAddGameSharkRaw(struct GBACheatSet* cheats, uint32_t op1, uint32_t
|
||||||
}
|
}
|
||||||
cheat->operand = op2;
|
cheat->operand = op2;
|
||||||
cheat->repeat = 1;
|
cheat->repeat = 1;
|
||||||
|
cheat->negativeRepeat = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ bool GBACheatAddProActionReplayRaw(struct GBACheatSet* cheats, uint32_t op1, uin
|
||||||
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));
|
||||||
incompleteCheat->operandOffset = op2 >> 24;
|
incompleteCheat->operandOffset = op2 >> 24;
|
||||||
incompleteCheat->repeat = (op2 >> 16) & 0xFF;
|
incompleteCheat->repeat = ((op2 >> 16) & 0xFF) + 1;
|
||||||
incompleteCheat->addressOffset = (op2 & 0xFFFF) * incompleteCheat->width;
|
incompleteCheat->addressOffset = (op2 & 0xFFFF) * incompleteCheat->width;
|
||||||
cheats->incompleteCheat = COMPLETE;
|
cheats->incompleteCheat = COMPLETE;
|
||||||
return true;
|
return true;
|
||||||
|
@ -342,7 +342,7 @@ int GBACheatProActionReplayProbability(uint32_t op1, uint32_t op2) {
|
||||||
return 0x100;
|
return 0x100;
|
||||||
}
|
}
|
||||||
if (!op1) {
|
if (!op1) {
|
||||||
probability += 0x20;
|
probability += 0x40;
|
||||||
uint32_t address = _parAddr(op2);
|
uint32_t address = _parAddr(op2);
|
||||||
switch (op2 & 0xFE000000) {
|
switch (op2 & 0xFE000000) {
|
||||||
case PAR3_OTHER_FILL_1:
|
case PAR3_OTHER_FILL_1:
|
||||||
|
@ -363,8 +363,8 @@ int GBACheatProActionReplayProbability(uint32_t op1, uint32_t op2) {
|
||||||
case PAR3_OTHER_BUTTON_4:
|
case PAR3_OTHER_BUTTON_4:
|
||||||
case PAR3_OTHER_ENDIF:
|
case PAR3_OTHER_ENDIF:
|
||||||
case PAR3_OTHER_ELSE:
|
case PAR3_OTHER_ELSE:
|
||||||
if (op2 & 0x01FFFFFF) {
|
if (op2 & 0x01000000) {
|
||||||
probability -= 0x20;
|
probability -= 0x40;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -421,6 +421,7 @@ M_TEST_DEFINE(doPARv3IfX) {
|
||||||
mCheatRefresh(device, set);
|
mCheatRefresh(device, set);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000000, -1), 0x1);
|
assert_int_equal(core->rawRead8(core, 0x03000000, -1), 0x1);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000001, -1), 0x11);
|
assert_int_equal(core->rawRead8(core, 0x03000001, -1), 0x11);
|
||||||
|
set->deinit(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
M_TEST_DEFINE(doPARv3IfXxX) {
|
M_TEST_DEFINE(doPARv3IfXxX) {
|
||||||
|
@ -483,6 +484,7 @@ M_TEST_DEFINE(doPARv3IfXxX) {
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000002, -1), 0x21);
|
assert_int_equal(core->rawRead8(core, 0x03000002, -1), 0x21);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000003, -1), 0x32);
|
assert_int_equal(core->rawRead8(core, 0x03000003, -1), 0x32);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x41);
|
assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x41);
|
||||||
|
set->deinit(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
M_TEST_DEFINE(doPARv3IfXElse) {
|
M_TEST_DEFINE(doPARv3IfXElse) {
|
||||||
|
@ -517,6 +519,7 @@ M_TEST_DEFINE(doPARv3IfXElse) {
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000000, -1), 0x1);
|
assert_int_equal(core->rawRead8(core, 0x03000000, -1), 0x1);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000001, -1), 0x11);
|
assert_int_equal(core->rawRead8(core, 0x03000001, -1), 0x11);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000002, -1), 0x22);
|
assert_int_equal(core->rawRead8(core, 0x03000002, -1), 0x22);
|
||||||
|
set->deinit(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
M_TEST_DEFINE(doPARv3IfXElsexX) {
|
M_TEST_DEFINE(doPARv3IfXElsexX) {
|
||||||
|
@ -587,6 +590,7 @@ M_TEST_DEFINE(doPARv3IfXElsexX) {
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000003, -1), 0x32);
|
assert_int_equal(core->rawRead8(core, 0x03000003, -1), 0x32);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x42);
|
assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x42);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000005, -1), 0x51);
|
assert_int_equal(core->rawRead8(core, 0x03000005, -1), 0x51);
|
||||||
|
set->deinit(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
M_TEST_DEFINE(doPARv3IfXElsexXElse) {
|
M_TEST_DEFINE(doPARv3IfXElsexXElse) {
|
||||||
|
@ -664,6 +668,7 @@ M_TEST_DEFINE(doPARv3IfXElsexXElse) {
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x42);
|
assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x42);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000005, -1), 0x51);
|
assert_int_equal(core->rawRead8(core, 0x03000005, -1), 0x51);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000006, -1), 0x62);
|
assert_int_equal(core->rawRead8(core, 0x03000006, -1), 0x62);
|
||||||
|
set->deinit(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
M_TEST_DEFINE(doPARv3IfXContain1) {
|
M_TEST_DEFINE(doPARv3IfXContain1) {
|
||||||
|
@ -725,6 +730,7 @@ M_TEST_DEFINE(doPARv3IfXContain1) {
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000002, -1), 0x21);
|
assert_int_equal(core->rawRead8(core, 0x03000002, -1), 0x21);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000003, -1), 0x31);
|
assert_int_equal(core->rawRead8(core, 0x03000003, -1), 0x31);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x41);
|
assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x41);
|
||||||
|
set->deinit(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
M_TEST_DEFINE(doPARv3IfXContain1Else) {
|
M_TEST_DEFINE(doPARv3IfXContain1Else) {
|
||||||
|
@ -794,6 +800,7 @@ M_TEST_DEFINE(doPARv3IfXContain1Else) {
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000003, -1), 0x31);
|
assert_int_equal(core->rawRead8(core, 0x03000003, -1), 0x31);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x41);
|
assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x41);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000005, -1), 0x52);
|
assert_int_equal(core->rawRead8(core, 0x03000005, -1), 0x52);
|
||||||
|
set->deinit(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
M_TEST_DEFINE(doPARv3IfXElseContain1) {
|
M_TEST_DEFINE(doPARv3IfXElseContain1) {
|
||||||
|
@ -863,6 +870,7 @@ M_TEST_DEFINE(doPARv3IfXElseContain1) {
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000003, -1), 0x32);
|
assert_int_equal(core->rawRead8(core, 0x03000003, -1), 0x32);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x41);
|
assert_int_equal(core->rawRead8(core, 0x03000004, -1), 0x41);
|
||||||
assert_int_equal(core->rawRead8(core, 0x03000005, -1), 0x52);
|
assert_int_equal(core->rawRead8(core, 0x03000005, -1), 0x52);
|
||||||
|
set->deinit(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
M_TEST_DEFINE(doPARv3IfXContain1ElseContain1) {
|
M_TEST_DEFINE(doPARv3IfXContain1ElseContain1) {
|
||||||
|
|
Loading…
Reference in New Issue