mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-08 23:25:40 +12:00
[ActionReplay] More conditional ops
This commit is contained in:
parent
4a45599303
commit
0588b99674
3 changed files with 24 additions and 15 deletions
|
@ -13,7 +13,7 @@ class Cheats {
|
||||||
public:
|
public:
|
||||||
enum class CheatType {
|
enum class CheatType {
|
||||||
ActionReplay, // CTRPF cheats
|
ActionReplay, // CTRPF cheats
|
||||||
Gateway,
|
// TODO: Other cheat devices and standards?
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Cheat {
|
struct Cheat {
|
||||||
|
|
|
@ -96,14 +96,28 @@ void ActionReplay::runInstruction(const Cheat& cheat, u32 instruction) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Less Than (YYYYYYYY < [XXXXXXX + offset])
|
#define MAKE_IF_INSTRUCTION(opcode, comparator) \
|
||||||
case 0x4: {
|
case opcode: { \
|
||||||
const u32 baseAddr = Helpers::getBits<0, 28>(instruction);
|
const u32 baseAddr = Helpers::getBits<0, 28>(instruction); \
|
||||||
const u32 imm = cheat[pc++];
|
const u32 imm = cheat[pc++]; \
|
||||||
const u32 value = read32(baseAddr + *activeOffset);
|
const u32 value = read32(baseAddr + *activeOffset); \
|
||||||
Helpers::panic("TODO: How do ActionReplay conditional blocks work?");
|
\
|
||||||
break;
|
pushConditionBlock(imm comparator value); \
|
||||||
}
|
break; \
|
||||||
|
}
|
||||||
|
|
||||||
|
// Greater Than (YYYYYYYY > [XXXXXXX + offset]) (Unsigned)
|
||||||
|
MAKE_IF_INSTRUCTION(3, >)
|
||||||
|
|
||||||
|
// Less Than (YYYYYYYY < [XXXXXXX + offset]) (Unsigned)
|
||||||
|
MAKE_IF_INSTRUCTION(4, <)
|
||||||
|
|
||||||
|
// Equal to (YYYYYYYY == [XXXXXXX + offset]) (Unsigned)
|
||||||
|
MAKE_IF_INSTRUCTION(5, ==)
|
||||||
|
|
||||||
|
// Not Equal (YYYYYYYY != [XXXXXXX + offset]) (Unsigned)
|
||||||
|
MAKE_IF_INSTRUCTION(6, !=)
|
||||||
|
#undef MAKE_IF_INSTRUCTION
|
||||||
|
|
||||||
case 0xD: executeDType(cheat, instruction); break;
|
case 0xD: executeDType(cheat, instruction); break;
|
||||||
default: Helpers::panic("Unimplemented ActionReplay instruction type %X", type); break;
|
default: Helpers::panic("Unimplemented ActionReplay instruction type %X", type); break;
|
||||||
|
|
|
@ -17,12 +17,7 @@ void Cheats::run() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CheatType::Gateway: {
|
default: Helpers::panic("Unknown cheat device!");
|
||||||
Helpers::panic("Gateway cheats not supported yet! Only Action Replay is supported!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default: Helpers::panic("Unknown cheat type");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue