GBA Cheats: More minor fixes

This commit is contained in:
Vicki Pfau 2017-11-19 10:50:27 -08:00
parent 4b40c5cd1a
commit 32f7f35ee9
3 changed files with 14 additions and 4 deletions

View File

@ -174,6 +174,7 @@ bool GBACheatAddGameSharkRaw(struct GBACheatSet* cheats, uint32_t op1, uint32_t
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 @@ bool GBACheatAddGameSharkRaw(struct GBACheatSet* cheats, uint32_t op1, uint32_t
}
cheat->operand = op2;
cheat->repeat = 1;
cheat->negativeRepeat = 0;
return true;
}

View File

@ -223,7 +223,7 @@ bool GBACheatAddProActionReplayRaw(struct GBACheatSet* cheats, uint32_t op1, uin
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 @@ int GBACheatProActionReplayProbability(uint32_t op1, uint32_t op2) {
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 @@ int GBACheatProActionReplayProbability(uint32_t op1, uint32_t op2) {
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:

View File

@ -421,6 +421,7 @@ M_TEST_DEFINE(doPARv3IfX) {
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 @@ M_TEST_DEFINE(doPARv3IfXxX) {
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 @@ M_TEST_DEFINE(doPARv3IfXElse) {
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 @@ M_TEST_DEFINE(doPARv3IfXElsexX) {
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 @@ M_TEST_DEFINE(doPARv3IfXElsexXElse) {
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 @@ M_TEST_DEFINE(doPARv3IfXContain1) {
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 @@ M_TEST_DEFINE(doPARv3IfXContain1Else) {
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 @@ M_TEST_DEFINE(doPARv3IfXElseContain1) {
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) {