diff --git a/injector/source/patcher.c b/injector/source/patcher.c index 0f12451..c8ef156 100644 --- a/injector/source/patcher.c +++ b/injector/source/patcher.c @@ -172,7 +172,7 @@ static inline bool loadTitleLocaleConfig(u64 progId, u8 *regionId, u8 *languageI IFile file; - if(R_FAILED(openLumaFile(&file, path))) return 0; + if(R_FAILED(openLumaFile(&file, path))) return true; bool ret; u64 fileSize; diff --git a/source/crypto.c b/source/crypto.c index 5e51793..1f4417e 100755 --- a/source/crypto.c +++ b/source/crypto.c @@ -425,7 +425,7 @@ bool decryptNusFirm(const Ticket *ticket, Cxi *cxi, u32 ncchSize) __attribute__((aligned(4))) const u8 keyY0x3D[AES_BLOCK_SIZE] = {0x0C, 0x76, 0x72, 0x30, 0xF0, 0x99, 0x8F, 0x1C, 0x46, 0x82, 0x82, 0x02, 0xFA, 0xAC, 0xBE, 0x4C}; __attribute__((aligned(4))) u8 titleKey[AES_BLOCK_SIZE], - cetkIv[AES_BLOCK_SIZE] = {0}; + cetkIv[AES_BLOCK_SIZE] = {0}; memcpy(titleKey, ticket->titleKey, sizeof(titleKey)); memcpy(cetkIv, ticket->titleId, sizeof(ticket->titleId)); diff --git a/source/emunand.c b/source/emunand.c index 82b8b72..d748804 100644 --- a/source/emunand.c +++ b/source/emunand.c @@ -164,6 +164,7 @@ static inline u32 patchMpu(u8 *pos, u32 size) u32 patchEmuNand(u8 *arm9Section, u32 kernel9Size, u8 *process9Offset, u32 process9Size, u32 emuHeader, u8 *kernel9Address) { u8 *freeK9Space; + if(!getFreeK9Space(arm9Section, kernel9Size, &freeK9Space)) return 1; u32 ret = 0; diff --git a/source/exceptions.c b/source/exceptions.c index 3bc072b..6739bbf 100644 --- a/source/exceptions.c +++ b/source/exceptions.c @@ -89,7 +89,7 @@ void detectAndProcessExceptionDumps(void) { volatile ExceptionDumpHeader *dumpHeader = (volatile ExceptionDumpHeader *)0x25000000; - if(dumpHeader->magic[0] != 0xDEADC0DE || dumpHeader->magic[1] == 0xDEADCAFE || (dumpHeader->processor != 9 && dumpHeader->processor != 11)) return; + if(dumpHeader->magic[0] != 0xDEADC0DE || dumpHeader->magic[1] != 0xDEADCAFE || (dumpHeader->processor != 9 && dumpHeader->processor != 11)) return; const vu32 *regs = (vu32 *)((vu8 *)dumpHeader + sizeof(ExceptionDumpHeader)); const vu8 *stackDump = (vu8 *)regs + dumpHeader->registerDumpSize + dumpHeader->codeDumpSize; diff --git a/source/fs.c b/source/fs.c index e1c9105..20d2a1a 100644 --- a/source/fs.c +++ b/source/fs.c @@ -38,23 +38,17 @@ static FATFS sdFs, static bool switchToMainDir(bool isSd) { const char *mainDir = isSd ? "/luma" : "/rw/luma"; - bool ret; switch(f_chdir(mainDir)) { case FR_OK: - ret = true; - break; + return true; case FR_NO_PATH: f_mkdir(mainDir); - ret = switchToMainDir(isSd); - break; + return switchToMainDir(isSd); default: - ret = false; - break; + return false; } - - return ret; } bool mountFs(bool isSd, bool switchToCtrNand) @@ -191,6 +185,7 @@ void payloadMenu(void) while(f_readdir(&dir, &info) == FR_OK && info.fname[0] != 0 && payloadNum < 20) { if(info.fname[0] == '.' || memcmp(info.altname + 8, ".BIN", 4) != 0) continue; + u32 nameLength = strlen(info.fname) - 4; if(nameLength > 48) continue;