This commit is contained in:
Nanquitas
2018-11-15 13:49:35 +01:00
12 changed files with 72 additions and 29 deletions

View File

@@ -12,7 +12,7 @@
#define HBLDR_3DSX_TID (*(vu64 *)0x1FF81100)
u32 config, multiConfig, bootConfig;
bool isN3DS, isSafeMode, isSdMode;
bool isN3DS, needToInitSd, isSdMode;
const char CODE_PATH[] = {0x01, 0x00, 0x00, 0x00, 0x2E, 0x63, 0x6F, 0x64, 0x65, 0x00, 0x00, 0x00};
@@ -47,12 +47,12 @@ static inline void loadCFWInfo(void)
if(R_FAILED(svcGetSystemInfo(&out, 0x10000, 0x201))) svcBreak(USERBREAK_ASSERT);
isN3DS = (bool)out;
if(R_FAILED(svcGetSystemInfo(&out, 0x10000, 0x202))) svcBreak(USERBREAK_ASSERT);
isSafeMode = (bool)out;
needToInitSd = (bool)out;
if(R_FAILED(svcGetSystemInfo(&out, 0x10000, 0x203))) svcBreak(USERBREAK_ASSERT);
isSdMode = (bool)out;
IFile file;
if(isSafeMode) fileOpen(&file, ARCHIVE_SDMC, "/", FS_OPEN_READ); //Init SD card if SAFE_MODE is being booted
if(needToInitSd) fileOpen(&file, ARCHIVE_SDMC, "/", FS_OPEN_READ); //Init SD card if SAFE_MODE is being booted
}
static int lzss_decompress(u8 *end)

View File

@@ -39,7 +39,7 @@ enum singleOptions
};
extern u32 config, multiConfig, bootConfig;
extern bool isN3DS, isSafeMode, isSdMode;
extern bool isN3DS, needToInitSd, isSdMode;
void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 roSize, u32 dataSize, u32 roAddress, u32 dataAddress);
Result fileOpen(IFile *file, FS_ArchiveID archiveId, const char *path, int flags);

View File

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

View File

@@ -175,9 +175,7 @@ void menuThreadMain(void)
}
else
{
if (HID_PAD & 0xFFF) {
Cheat_ApplyKeyCheats();
}
Cheat_ApplyCheats();
}
// Check for home button on O3DS Mode3 with plugin loaded

View File

@@ -465,10 +465,12 @@ 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)
{
cheat_state.offset = (arg0 & 0x0FFFFFFF);
u32 value;
if (!Cheat_Read32(processHandle, arg0 & 0x0FFFFFFF, &value)) return 0;
cheat_state.offset = value;
}
break;
case 0xC:
@@ -1118,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);
@@ -1149,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]);
}
}
}