Fixed cheat functionality (#1117)

This commit is contained in:
tstambaugh92 2018-08-09 08:21:16 -04:00 committed by fincs
parent bc06b17823
commit 2219b19d5f
3 changed files with 9 additions and 11 deletions

View File

@ -33,4 +33,4 @@
#define CHEATS_PER_MENU_PAGE 18
void RosalinaMenu_Cheats(void);
void Cheat_ApplyKeyCheats();
void Cheat_ApplyCheats();

View File

@ -169,9 +169,7 @@ void menuThreadMain(void)
}
else
{
if (HID_PAD & 0xFFF) {
Cheat_ApplyKeyCheats();
}
Cheat_ApplyCheats();
}
svcSleepThread(50 * 1000 * 1000LL);
}

View File

@ -465,7 +465,7 @@ static u32 Cheat_ApplyCheat(const Handle processHandle, const CheatDescription*
case 0xB:
// B Type
// Format: BXXXXXXX 00000000
// Description: Loads offset register.
// Description: Loads offset register with value at given XXXXXXX
if (!skipExecution)
{
u32 value;
@ -1120,16 +1120,12 @@ static u32 Cheat_GetCurrentPID(u64* titleId)
}
}
void Cheat_ApplyKeyCheats(void)
void Cheat_ApplyCheats(void)
{
if (!cheatCount)
{
return;
}
if (!hasKeyActivated)
{
return;
}
u64 titleId = 0;
u32 pid = Cheat_GetCurrentPID(&titleId);
@ -1151,9 +1147,13 @@ void Cheat_ApplyKeyCheats(void)
u32 keys = HID_PAD & 0xFFF;
for (int i = 0; i < cheatCount; i++)
{
if (cheats[i]->active && cheats[i]->keyActivated && (cheats[i]->keyCombo & keys) == keys)
if (cheats[i]->active && !(cheats[i]->keyActivated))
{
Cheat_MapMemoryAndApplyCheat(pid, cheats[i]);
}
else if (cheats[i]->active && cheats[i]->keyActivated && (cheats[i]->keyCombo & keys) == keys)
{
Cheat_MapMemoryAndApplyCheat(pid, cheats[i]);
}
}
}