mirror of https://github.com/mgba-emu/mgba.git
GBA: Fix PARv3 IO codes, add master code support
This commit is contained in:
parent
178f9a83bb
commit
d38f99e041
|
@ -507,6 +507,10 @@ static bool _addPAR3(struct GBACheatSet* cheats, uint32_t op1, uint32_t op2) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (op2 == 0x001DC0DE) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
switch (op1) {
|
switch (op1) {
|
||||||
case 0x00000000:
|
case 0x00000000:
|
||||||
return _addPAR3Special(cheats, op2);
|
return _addPAR3Special(cheats, op2);
|
||||||
|
@ -515,6 +519,18 @@ static bool _addPAR3(struct GBACheatSet* cheats, uint32_t op1, uint32_t op2) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (op1 >> 24 == 0xC4) {
|
||||||
|
if (cheats->hook) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
cheats->hook = malloc(sizeof(*cheats->hook));
|
||||||
|
cheats->hook->address = BASE_CART0 | (op1 & (SIZE_CART0 - 1));
|
||||||
|
cheats->hook->mode = MODE_THUMB;
|
||||||
|
cheats->hook->refs = 1;
|
||||||
|
cheats->hook->reentries = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (op1 & PAR3_COND) {
|
if (op1 & PAR3_COND) {
|
||||||
return _addPAR3Cond(cheats, op1, op2);
|
return _addPAR3Cond(cheats, op1, op2);
|
||||||
}
|
}
|
||||||
|
@ -522,8 +538,6 @@ static bool _addPAR3(struct GBACheatSet* cheats, uint32_t op1, uint32_t op2) {
|
||||||
int width = 1 << ((op1 & PAR3_WIDTH) >> PAR3_WIDTH_BASE);
|
int width = 1 << ((op1 & PAR3_WIDTH) >> PAR3_WIDTH_BASE);
|
||||||
struct GBACheat* cheat = GBACheatListAppend(&cheats->list);
|
struct GBACheat* cheat = GBACheatListAppend(&cheats->list);
|
||||||
cheat->address = _parAddr(op1);
|
cheat->address = _parAddr(op1);
|
||||||
cheat->width = width;
|
|
||||||
cheat->operand = op2 & (0xFFFFFFFFU >> ((4 - width) * 8));
|
|
||||||
cheat->operandOffset = 0;
|
cheat->operandOffset = 0;
|
||||||
cheat->addressOffset = 0;
|
cheat->addressOffset = 0;
|
||||||
cheat->repeat = 1;
|
cheat->repeat = 1;
|
||||||
|
@ -546,10 +560,14 @@ static bool _addPAR3(struct GBACheatSet* cheats, uint32_t op1, uint32_t op2) {
|
||||||
cheat->type = CHEAT_ADD;
|
cheat->type = CHEAT_ADD;
|
||||||
break;
|
break;
|
||||||
case PAR3_BASE_OTHER:
|
case PAR3_BASE_OTHER:
|
||||||
|
width = ((op1 >> 24) & 1) + 1;
|
||||||
cheat->type = CHEAT_ASSIGN;
|
cheat->type = CHEAT_ASSIGN;
|
||||||
cheat->address = BASE_IO | (op1 & OFFSET_MASK);
|
cheat->address = BASE_IO | (op1 & OFFSET_MASK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cheat->width = width;
|
||||||
|
cheat->operand = op2 & (0xFFFFFFFFU >> ((4 - width) * 8));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue