Skip to content

Commit

Permalink
Fixed cheat functionality (LumaTeam#1117)
Browse files Browse the repository at this point in the history
  • Loading branch information
tstambaugh92 authored and fincs committed Aug 9, 2018
1 parent bb74a35 commit 1c5a0ea
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion sysmodules/rosalina/include/menus/cheats.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
#define CHEATS_PER_MENU_PAGE 18

void RosalinaMenu_Cheats(void);
void Cheat_ApplyKeyCheats();
void Cheat_ApplyCheats();
4 changes: 1 addition & 3 deletions sysmodules/rosalina/source/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@ void menuThreadMain(void)
}
else
{
if (HID_PAD & 0xFFF) {
Cheat_ApplyKeyCheats();
}
Cheat_ApplyCheats();
}
svcSleepThread(50 * 1000 * 1000LL);
}
Expand Down
14 changes: 7 additions & 7 deletions sysmodules/rosalina/source/menus/cheats.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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]);
}
}
}
Expand Down

0 comments on commit 1c5a0ea

Please sign in to comment.