mirror of https://github.com/mgba-emu/mgba.git
GBA: Add more Pro Action Replay v3 skeleton
This commit is contained in:
parent
05e18ac255
commit
3d44065826
|
@ -13,7 +13,7 @@ const uint32_t GBA_CHEAT_DEVICE_ID = 0xABADC0DE;
|
|||
DEFINE_VECTOR(GBACheatList, struct GBACheat);
|
||||
|
||||
static const uint32_t _gsa1S[4] = { 0x09F4FBBD, 0x9681884A, 0x352027E9, 0xF3DEE5A7 };
|
||||
static const uint32_t _gsa3S[4] = { 0x7AA9648F, 0x7FAE6994, 0xC0EFAAD5, 0x42712C57 };
|
||||
static const uint32_t _par3S[4] = { 0x7AA9648F, 0x7FAE6994, 0xC0EFAAD5, 0x42712C57 };
|
||||
|
||||
static const uint8_t _gsa1T1[256] = {
|
||||
0x31, 0x1C, 0x23, 0xE5, 0x89, 0x8E, 0xA1, 0x37, 0x74, 0x6D, 0x67, 0xFC, 0x1F, 0xC0, 0xB1, 0x94,
|
||||
|
@ -53,6 +53,44 @@ static const uint8_t _gsa1T2[256] = {
|
|||
0x5C, 0x1B, 0x19, 0xDB, 0x0F, 0xF3, 0xF8, 0x49, 0xEB, 0x36, 0xF6, 0x40, 0x6F, 0xAD, 0xC1, 0x8C
|
||||
};
|
||||
|
||||
static const uint8_t _par3T1[256] = {
|
||||
0xD0, 0xFF, 0xBA, 0xE5, 0xC1, 0xC7, 0xDB, 0x5B, 0x16, 0xE3, 0x6E, 0x26, 0x62, 0x31, 0x2E, 0x2A,
|
||||
0xD1, 0xBB, 0x4A, 0xE6, 0xAE, 0x2F, 0x0A, 0x90, 0x29, 0x90, 0xB6, 0x67, 0x58, 0x2A, 0xB4, 0x45,
|
||||
0x7B, 0xCB, 0xF0, 0x73, 0x84, 0x30, 0x81, 0xC2, 0xD7, 0xBE, 0x89, 0xD7, 0x4E, 0x73, 0x5C, 0xC7,
|
||||
0x80, 0x1B, 0xE5, 0xE4, 0x43, 0xC7, 0x46, 0xD6, 0x6F, 0x7B, 0xBF, 0xED, 0xE5, 0x27,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, 0x50, 0x1C, 0x64, 0x77, 0xAA,
|
||||
0x3E, 0xAC, 0xD3, 0x3D, 0xCE, 0x60, 0xCA, 0x5D, 0xA0, 0x92, 0x78, 0xC6, 0x51, 0xFE, 0xF9, 0x30
|
||||
};
|
||||
|
||||
static const uint8_t _par3T2[256] = {
|
||||
0xAA, 0xAF, 0xF0, 0x72, 0x90, 0xF7, 0x71, 0x27, 0x06, 0x11, 0xEB, 0x9C, 0x37, 0x12, 0x72, 0xAA,
|
||||
0x65, 0xBC, 0x0D, 0x4A, 0x76, 0xF6, 0x5C, 0xAA, 0xB0, 0x7A, 0x7D, 0x81, 0xC1, 0xCE, 0x2F, 0x9F,
|
||||
0x02, 0x75, 0x38, 0xC8, 0xFC, 0x66, 0x05, 0xC2, 0x2C, 0xBD, 0x91, 0xAD, 0x03, 0xB1, 0x88, 0x93,
|
||||
0x31, 0xC6, 0xAB, 0x40, 0x23, 0x43, 0x76, 0x54, 0xCA, 0xE7, 0x00, 0x96, 0x9F, 0xD8, 0x24, 0x8B,
|
||||
0xE4, 0xDC, 0xDE, 0x48, 0x2C, 0xCB, 0xF7, 0x84, 0x1D, 0x45, 0xE5, 0xF1, 0x75, 0xA0, 0xED, 0xCD,
|
||||
0x4B, 0x24, 0x8A, 0xB3, 0x98, 0x7B, 0x12, 0xB8, 0xF5, 0x63, 0x97, 0xB3, 0xA6, 0xA6, 0x0B, 0xDC,
|
||||
0xD8, 0x4C, 0xA8, 0x99, 0x27, 0x0F, 0x8F, 0x94, 0x63, 0x0F, 0xB0, 0x11, 0x94, 0xC7, 0xE9, 0x7F,
|
||||
0x3B, 0x40, 0x72, 0x4C, 0xDB, 0x84, 0x78, 0xFE, 0xB8, 0x56, 0x08, 0x80, 0xDF, 0x20, 0x2F, 0xB9,
|
||||
0x66, 0x2D, 0x60, 0x63, 0xF5, 0x18, 0x15, 0x1B, 0x86, 0x85, 0xB9, 0xB4, 0x68, 0x0E, 0xC6, 0xD1,
|
||||
0x8A, 0x81, 0x2B, 0xB3, 0xF6, 0x48, 0xF0, 0x4F, 0x9C, 0x28, 0x1C, 0xA4, 0x51, 0x2F, 0xD7, 0x4B,
|
||||
0x17, 0xE7, 0xCC, 0x50, 0x9F, 0xD0, 0xD1, 0x40, 0x0C, 0x0D, 0xCA, 0x83, 0xFA, 0x5E, 0xCA, 0xEC,
|
||||
0xBF, 0x4E, 0x7C, 0x8F, 0xF0, 0xAE, 0xC2, 0xD3, 0x28, 0x41, 0x9B, 0xC8, 0x04, 0xB9, 0x4A, 0xBA,
|
||||
0x72, 0xE2, 0xB5, 0x06, 0x2C, 0x1E, 0x0B, 0x2C, 0x7F, 0x11, 0xA9, 0x26, 0x51, 0x9D, 0x3F, 0xF8,
|
||||
0x62, 0x11, 0x2E, 0x89, 0xD2, 0x9D, 0x35, 0xB1, 0xE4, 0x0A, 0x4D, 0x93, 0x01, 0xA7, 0xD1, 0x2D,
|
||||
0x00, 0x87, 0xE2, 0x2D, 0xA4, 0xE9, 0x0A, 0x06, 0x66, 0xF8, 0x1F, 0x44, 0x75, 0xB5, 0x6B, 0x1C,
|
||||
0xFC, 0x31, 0x09, 0x48, 0xA3, 0xFF, 0x92, 0x12, 0x58, 0xE9, 0xFA, 0xAE, 0x4F, 0xE2, 0xB4, 0xCC
|
||||
};
|
||||
|
||||
static int32_t _readMem(struct ARMCore* cpu, uint32_t address, int width) {
|
||||
switch (width) {
|
||||
case 1:
|
||||
|
@ -499,10 +537,10 @@ bool GBACheatAddGameShark(struct GBACheatSet* set, uint32_t op1, uint32_t op2) {
|
|||
}
|
||||
o1 = op1;
|
||||
o2 = op2;
|
||||
_decryptGameShark(&o1, &o2, _gsa3S);
|
||||
_decryptGameShark(&o1, &o2, _par3S);
|
||||
if ((o1 & 0xFE000000) == 0xC4000000 && !(o2 & 0xFFFF0000)) {
|
||||
set->gsaVersion = 3;
|
||||
memcpy(set->gsaSeeds, _gsa3S, 4 * sizeof(uint32_t));
|
||||
memcpy(set->gsaSeeds, _par3S, 4 * sizeof(uint32_t));
|
||||
return _addGSA3(set, o1, o2);
|
||||
}
|
||||
break;
|
||||
|
@ -617,10 +655,22 @@ void GBACheatRefresh(struct GBACheatDevice* device) {
|
|||
condition = _readMem(device->p->cpu, address, cheat->width) > operand;
|
||||
conditionRemaining = cheat->repeat;
|
||||
break;
|
||||
case CHEAT_IF_ULT:
|
||||
condition = (uint32_t) _readMem(device->p->cpu, address, cheat->width) < (uint32_t) operand;
|
||||
conditionRemaining = cheat->repeat;
|
||||
break;
|
||||
case CHEAT_IF_UGT:
|
||||
condition = (uint32_t) _readMem(device->p->cpu, address, cheat->width) > (uint32_t) operand;
|
||||
conditionRemaining = cheat->repeat;
|
||||
break;
|
||||
case CHEAT_IF_AND:
|
||||
condition = _readMem(device->p->cpu, address, cheat->width) & operand;
|
||||
conditionRemaining = cheat->repeat;
|
||||
break;
|
||||
case CHEAT_IF_LAND:
|
||||
condition = _readMem(device->p->cpu, address, cheat->width) && operand;
|
||||
conditionRemaining = cheat->repeat;
|
||||
break;
|
||||
}
|
||||
|
||||
if (performAssignment) {
|
||||
|
|
|
@ -22,7 +22,10 @@ enum GBACheatType {
|
|||
CHEAT_IF_NE,
|
||||
CHEAT_IF_LT,
|
||||
CHEAT_IF_GT,
|
||||
CHEAT_IF_AND
|
||||
CHEAT_IF_ULT,
|
||||
CHEAT_IF_UGT,
|
||||
CHEAT_IF_AND,
|
||||
CHEAT_IF_LAND
|
||||
};
|
||||
|
||||
enum GBACodeBreakerType {
|
||||
|
@ -56,6 +59,69 @@ enum GBAGameSharkType {
|
|||
GSA_HOOK = 0xF
|
||||
};
|
||||
|
||||
enum GBAActionReplay3Condition {
|
||||
PAR3_COND_OTHER = 0x00000000,
|
||||
PAR3_COND_EQ = 0x08000000,
|
||||
PAR3_COND_NE = 0x10000000,
|
||||
PAR3_COND_LT = 0x18000000,
|
||||
PAR3_COND_GT = 0x20000000,
|
||||
PAR3_COND_ULT = 0x28000000,
|
||||
PAR3_COND_UGT = 0x30000000,
|
||||
PAR3_COND_LAND = 0x38000000,
|
||||
};
|
||||
|
||||
enum GBAActionReplay3Width {
|
||||
PAR3_WIDTH_1 = 0x00000000,
|
||||
PAR3_WIDTH_2 = 0x02000000,
|
||||
PAR3_WIDTH_4 = 0x04000000,
|
||||
PAR3_WIDTH_FALSE = 0x06000000,
|
||||
};
|
||||
|
||||
enum GBAActionReplay3Action {
|
||||
PAR3_ACTION_NEXT = 0x00000000,
|
||||
PAR3_ACTION_NEXT_TWO = 0x40000000,
|
||||
PAR3_ACTION_BLOCK = 0x80000000,
|
||||
PAR3_ACTION_DISABLE = 0xC0000000,
|
||||
};
|
||||
|
||||
enum GBAActionReplay3Base {
|
||||
PAR3_BASE_ASSIGN_1 = 0x00000000,
|
||||
PAR3_BASE_ASSIGN_2 = 0x02000000,
|
||||
PAR3_BASE_ASSIGN_4 = 0x04000000,
|
||||
PAR3_BASE_INDIRECT_1 = 0x40000000,
|
||||
PAR3_BASE_INDIRECT_2 = 0x42000000,
|
||||
PAR3_BASE_INDIRECT_4 = 0x44000000,
|
||||
PAR3_BASE_ADD_1 = 0x80000000,
|
||||
PAR3_BASE_ADD_2 = 0x82000000,
|
||||
PAR3_BASE_ADD_4 = 0x84000000,
|
||||
PAR3_BASE_HOOK = 0xC4000000,
|
||||
PAR3_BASE_IO_2 = 0xC6000000,
|
||||
PAR3_BASE_IO_3 = 0xC7000000,
|
||||
};
|
||||
|
||||
enum GBAActionReplay3Other {
|
||||
PAR3_OTHER_END = 0x00000000,
|
||||
PAR3_OTHER_SLOWDOWN = 0x08000000,
|
||||
PAR3_OTHER_BUTTON_1 = 0x10000000,
|
||||
PAR3_OTHER_BUTTON_2 = 0x12000000,
|
||||
PAR3_OTHER_BUTTON_4 = 0x14000000,
|
||||
PAR3_OTHER_PATCH_1 = 0x18000000,
|
||||
PAR3_OTHER_PATCH_2 = 0x1A000000,
|
||||
PAR3_OTHER_PATCH_3 = 0x1C000000,
|
||||
PAR3_OTHER_PATCH_4 = 0x1E000000,
|
||||
PAR3_OTHER_ENDIF = 0x40000000,
|
||||
PAR3_OTHER_ELSE = 0x60000000,
|
||||
PAR3_OTHER_FILL_1 = 0x80000000,
|
||||
PAR3_OTHER_FILL_2 = 0x82000000,
|
||||
PAR3_OTHER_FILL_4 = 0x84000000,
|
||||
};
|
||||
|
||||
enum {
|
||||
PAR3_COND = 0x38000000,
|
||||
PAR3_WIDTH = 0x06000000,
|
||||
PAR3_ACTION = 0xC0000000
|
||||
};
|
||||
|
||||
struct GBACheat {
|
||||
enum GBACheatType type;
|
||||
int width;
|
||||
|
|
Loading…
Reference in New Issue