From 2219b19d5f60b8680fcbbbb868db7077bc406ed4 Mon Sep 17 00:00:00 2001 From: tstambaugh92 <42028641+tstambaugh92@users.noreply.github.com> Date: Thu, 9 Aug 2018 08:21:16 -0400 Subject: [PATCH] Fixed cheat functionality (#1117) --- sysmodules/rosalina/include/menus/cheats.h | 2 +- sysmodules/rosalina/source/menu.c | 4 +--- sysmodules/rosalina/source/menus/cheats.c | 14 +++++++------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/sysmodules/rosalina/include/menus/cheats.h b/sysmodules/rosalina/include/menus/cheats.h index cd66c6c..b95e36c 100644 --- a/sysmodules/rosalina/include/menus/cheats.h +++ b/sysmodules/rosalina/include/menus/cheats.h @@ -33,4 +33,4 @@ #define CHEATS_PER_MENU_PAGE 18 void RosalinaMenu_Cheats(void); -void Cheat_ApplyKeyCheats(); +void Cheat_ApplyCheats(); diff --git a/sysmodules/rosalina/source/menu.c b/sysmodules/rosalina/source/menu.c index ae32bf3..7d1145e 100644 --- a/sysmodules/rosalina/source/menu.c +++ b/sysmodules/rosalina/source/menu.c @@ -169,9 +169,7 @@ void menuThreadMain(void) } else { - if (HID_PAD & 0xFFF) { - Cheat_ApplyKeyCheats(); - } + Cheat_ApplyCheats(); } svcSleepThread(50 * 1000 * 1000LL); } diff --git a/sysmodules/rosalina/source/menus/cheats.c b/sysmodules/rosalina/source/menus/cheats.c index beb543f..ed8cad9 100644 --- a/sysmodules/rosalina/source/menus/cheats.c +++ b/sysmodules/rosalina/source/menus/cheats.c @@ -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]); } } }