Merge master into Debuffer
This commit is contained in:
commit
2b31a4ab5c
@ -48,9 +48,8 @@ typedef struct CheatDescription
|
|||||||
{
|
{
|
||||||
u32 active;
|
u32 active;
|
||||||
u32 valid;
|
u32 valid;
|
||||||
u32 keyActivated;
|
char hasKeyCode;
|
||||||
u32 keyCombo;
|
char name[39];
|
||||||
char name[40];
|
|
||||||
u32 codesCount;
|
u32 codesCount;
|
||||||
u64 codes[0];
|
u64 codes[0];
|
||||||
} CheatDescription;
|
} CheatDescription;
|
||||||
@ -116,7 +115,6 @@ typedef struct CheatState
|
|||||||
|
|
||||||
CheatState cheat_state = { 0 };
|
CheatState cheat_state = { 0 };
|
||||||
u8 cheatCount = 0;
|
u8 cheatCount = 0;
|
||||||
u8 hasKeyActivated = 0;
|
|
||||||
u64 cheatTitleInfo = -1ULL;
|
u64 cheatTitleInfo = -1ULL;
|
||||||
|
|
||||||
char failureReason[64];
|
char failureReason[64];
|
||||||
@ -846,6 +844,7 @@ static Result Cheat_MapMemoryAndApplyCheat(u32 pid, CheatDescription* const chea
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
sprintf(failureReason, "Debug process failed");
|
||||||
svcCloseHandle(processHandle);
|
svcCloseHandle(processHandle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -871,8 +870,7 @@ static CheatDescription* Cheat_AllocCheat()
|
|||||||
cheat->active = 0;
|
cheat->active = 0;
|
||||||
cheat->valid = 1;
|
cheat->valid = 1;
|
||||||
cheat->codesCount = 0;
|
cheat->codesCount = 0;
|
||||||
cheat->keyActivated = 0;
|
cheat->hasKeyCode = 0;
|
||||||
cheat->keyCombo = 0;
|
|
||||||
cheat->name[0] = '\0';
|
cheat->name[0] = '\0';
|
||||||
|
|
||||||
cheats[cheatCount] = cheat;
|
cheats[cheatCount] = cheat;
|
||||||
@ -1084,7 +1082,6 @@ static void Cheat_LoadCheatsIntoMemory(u64 titleId)
|
|||||||
{
|
{
|
||||||
cheatCount = 0;
|
cheatCount = 0;
|
||||||
cheatTitleInfo = titleId;
|
cheatTitleInfo = titleId;
|
||||||
hasKeyActivated = 0;
|
|
||||||
|
|
||||||
char path[64] = { 0 };
|
char path[64] = { 0 };
|
||||||
sprintf(path, "/luma/titles/%016llX/cheats.txt", titleId);
|
sprintf(path, "/luma/titles/%016llX/cheats.txt", titleId);
|
||||||
@ -1131,12 +1128,7 @@ static void Cheat_LoadCheatsIntoMemory(u64 titleId)
|
|||||||
cheatSize += sizeof(u64);
|
cheatSize += sizeof(u64);
|
||||||
if (((tmp >> 32) & 0xFFFFFFFF) == 0xDD000000)
|
if (((tmp >> 32) & 0xFFFFFFFF) == 0xDD000000)
|
||||||
{
|
{
|
||||||
if (tmp & 0xFFFFFFFF)
|
cheat->hasKeyCode = 1;
|
||||||
{
|
|
||||||
// Not empty key code
|
|
||||||
cheat->keyCombo |= (tmp & 0xFFF);
|
|
||||||
cheat->keyActivated = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1207,28 +1199,21 @@ void Cheat_ApplyCheats(void)
|
|||||||
if (!titleId)
|
if (!titleId)
|
||||||
{
|
{
|
||||||
cheatCount = 0;
|
cheatCount = 0;
|
||||||
hasKeyActivated = 0;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (titleId != cheatTitleInfo)
|
if (titleId != cheatTitleInfo)
|
||||||
{
|
{
|
||||||
cheatCount = 0;
|
cheatCount = 0;
|
||||||
hasKeyActivated = 0;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 keys = HID_PAD & 0xFFF;
|
|
||||||
for (int i = 0; i < cheatCount; i++)
|
for (int i = 0; i < cheatCount; i++)
|
||||||
{
|
{
|
||||||
if (cheats[i]->active && !(cheats[i]->keyActivated))
|
if (cheats[i]->active)
|
||||||
{
|
{
|
||||||
Cheat_MapMemoryAndApplyCheat(pid, cheats[i]);
|
Cheat_MapMemoryAndApplyCheat(pid, cheats[i]);
|
||||||
}
|
}
|
||||||
else if (cheats[i]->active && cheats[i]->keyActivated && (cheats[i]->keyCombo & keys) == keys)
|
|
||||||
{
|
|
||||||
Cheat_MapMemoryAndApplyCheat(pid, cheats[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1290,7 +1275,7 @@ void RosalinaMenu_Cheats(void)
|
|||||||
char buf[65] = { 0 };
|
char buf[65] = { 0 };
|
||||||
s32 j = page * CHEATS_PER_MENU_PAGE + i;
|
s32 j = page * CHEATS_PER_MENU_PAGE + i;
|
||||||
const char * checkbox = (cheats[j]->active ? "(x) " : "( ) ");
|
const char * checkbox = (cheats[j]->active ? "(x) " : "( ) ");
|
||||||
const char * keyAct = (cheats[j]->keyActivated ? "*" : " ");
|
const char * keyAct = (cheats[j]->hasKeyCode ? "*" : " ");
|
||||||
sprintf(buf, "%s%s%s", checkbox, keyAct, cheats[j]->name);
|
sprintf(buf, "%s%s%s", checkbox, keyAct, cheats[j]->name);
|
||||||
|
|
||||||
Draw_DrawString(30, 30 + i * SPACING_Y, cheats[j]->valid ? COLOR_WHITE : COLOR_RED, buf);
|
Draw_DrawString(30, 30 + i * SPACING_Y, cheats[j]->valid ? COLOR_WHITE : COLOR_RED, buf);
|
||||||
@ -1326,15 +1311,6 @@ void RosalinaMenu_Cheats(void)
|
|||||||
{
|
{
|
||||||
r = Cheat_MapMemoryAndApplyCheat(pid, cheats[selected]);
|
r = Cheat_MapMemoryAndApplyCheat(pid, cheats[selected]);
|
||||||
}
|
}
|
||||||
hasKeyActivated = 0;
|
|
||||||
for (int i = 0; i < cheatCount; i++)
|
|
||||||
{
|
|
||||||
if (cheats[i]->active && cheats[i]->keyActivated)
|
|
||||||
{
|
|
||||||
hasKeyActivated = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (pressed & BUTTON_DOWN)
|
else if (pressed & BUTTON_DOWN)
|
||||||
selected++;
|
selected++;
|
||||||
|
Reference in New Issue
Block a user