Moved key combo calculation to loading cheat phase

This commit is contained in:
Duckbill 2017-12-22 12:39:09 +03:00
parent 8052946517
commit 0e67b0f026

View File

@ -118,7 +118,7 @@ u8 Cheat_getNextTypeE(const CheatDescription* cheat) {
>> (typeEMapping[cheat_state.typeEIdx])) & 0xFF); >> (typeEMapping[cheat_state.typeEIdx])) & 0xFF);
} }
void Cheat_applyCheat(CheatDescription* const cheat) { void Cheat_applyCheat(const CheatDescription* const cheat) {
cheat_state.index = 0; cheat_state.index = 0;
cheat_state.offset = 0; cheat_state.offset = 0;
cheat_state.data = 0; cheat_state.data = 0;
@ -130,8 +130,6 @@ void Cheat_applyCheat(CheatDescription* const cheat) {
cheat_state.ifCount = 0; cheat_state.ifCount = 0;
cheat_state.storedIfCount = 0; cheat_state.storedIfCount = 0;
cheat->keyCombo = 0;
while (cheat_state.index < cheat->codesCount) { while (cheat_state.index < cheat->codesCount) {
u32 skipExecution = cheat_state.ifStack & 0x00000001; u32 skipExecution = cheat_state.ifStack & 0x00000001;
u32 arg0 = (u32) ((cheat->codes[cheat_state.index] >> 32) u32 arg0 = (u32) ((cheat->codes[cheat_state.index] >> 32)
@ -585,7 +583,6 @@ void Cheat_applyCheat(CheatDescription* const cheat) {
case 0x0D: case 0x0D:
// DD Type // DD Type
{ {
cheat->keyCombo |= (arg1 & 0xFFF);
u32 newSkip; u32 newSkip;
if ((HID_PAD & arg1) == arg1) { if ((HID_PAD & arg1) == arg1) {
newSkip = 0; newSkip = 0;
@ -763,7 +760,8 @@ void loadCheatsIntoMemory(u64 titleId) {
tmp = (tmp << 8) + buffer[k]; tmp = (tmp << 8) + buffer[k];
} }
Cheats_addCode(cheat, tmp); Cheats_addCode(cheat, tmp);
if (((tmp >> 56) & 0xFF) == 0xDD) { if (((tmp >> 32) & 0xFFFFFFFF) == 0xDD000000) {
cheat->keyCombo |= (tmp & 0xFFF);
cheat->keyActivated = 1; cheat->keyActivated = 1;
} }
} }