diff --git a/source/fs.c b/source/fs.c index ea1bfa8..b97b614 100644 --- a/source/fs.c +++ b/source/fs.c @@ -64,9 +64,10 @@ bool mountFs(bool isSd, bool switchToCtrNand) u32 fileRead(void *dest, const char *path, u32 maxSize) { FIL file; - u32 ret = 0; + u32 ret; - if(f_open(&file, path, FA_READ) == FR_OK) + if(f_open(&file, path, FA_READ) != FR_OK) ret = 0; + else { u32 size = f_size(&file); if(dest == NULL) ret = size; @@ -191,11 +192,12 @@ u32 firmRead(void *dest, u32 firmType) concatenateStrings(path, "/content"); DIR dir; - FILINFO info; u32 firmVersion = 0xFFFFFFFF; if(f_opendir(&dir, path) == FR_OK) { + FILINFO info; + //Parse the target directory while(f_readdir(&dir, &info) == FR_OK && info.fname[0] != 0) { @@ -228,12 +230,13 @@ u32 firmRead(void *dest, u32 firmType) void findDumpFile(const char *path, char *fileName) { DIR dir; - FILINFO info; FRESULT result; u32 n = 0; while(n <= 99999999) { + FILINFO info; + result = f_findfirst(&dir, &info, path, fileName); if(result != FR_OK || !info.fname[0]) break; diff --git a/source/patches.c b/source/patches.c index 4fcfd60..2c8d8b3 100644 --- a/source/patches.c +++ b/source/patches.c @@ -48,13 +48,13 @@ u8 *getProcess9Info(u8 *pos, u32 size, u32 *process9Size, u32 *process9MemAddr) u32 *getKernel11Info(u8 *pos, u32 size, u32 *baseK11VA, u8 **freeK11Space, u32 **arm11SvcHandler, u32 **arm11ExceptionsPage) { const u8 pattern[] = {0x00, 0xB0, 0x9C, 0xE5}; - bool ret = true; + bool res = true; *arm11ExceptionsPage = (u32 *)memsearch(pos, pattern, size, sizeof(pattern)); u32 *arm11SvcTable; - if(*arm11ExceptionsPage == NULL) ret = false; + if(*arm11ExceptionsPage == NULL) res = false; else { *arm11ExceptionsPage -= 0xB; @@ -69,10 +69,10 @@ u32 *getKernel11Info(u8 *pos, u32 size, u32 *baseK11VA, u8 **freeK11Space, u32 * *freeK11Space = memsearch(pos, pattern2, size, sizeof(pattern2)); - if(*freeK11Space == NULL) ret = false; + if(*freeK11Space == NULL) res = false; else (*freeK11Space)++; - if(!ret) error("Failed to get Kernel11 data."); + if(!res) error("Failed to get Kernel11 data."); return arm11SvcTable; } diff --git a/source/pin.c b/source/pin.c index 3f181f6..05cda07 100644 --- a/source/pin.c +++ b/source/pin.c @@ -50,7 +50,7 @@ void newPin(bool allowSkipping, u32 pinMode) u8 length = 4 + 2 * (pinMode - 1); - char *title = allowSkipping ? "Press START to skip or enter a new PIN" : "Enter a new PIN to proceed"; + const char *title = allowSkipping ? "Press START to skip or enter a new PIN" : "Enter a new PIN to proceed"; drawString(title, true, 10, 10, COLOR_TITLE); drawString("PIN ( digits): ", true, 10, 10 + 2 * SPACING_Y, COLOR_WHITE); drawCharacter('0' + length, true, 10 + 5 * SPACING_X, 10 + 2 * SPACING_Y, COLOR_WHITE);