diff --git a/injector/source/patcher.c b/injector/source/patcher.c index be5ef69..ae00636 100644 --- a/injector/source/patcher.c +++ b/injector/source/patcher.c @@ -325,7 +325,7 @@ void patchCode(u64 progId, u8 *code, u32 size) 0xE0, 0x1E, 0xFF, 0x2F, 0xE1, 0x01, 0x01 }; - static const u8 mostRecentFpdVer = 0x06; + u8 mostRecentFpdVer = 0x06; u8 *fpdVer = memsearch(code, fpdVerPattern, size, sizeof(fpdVerPattern)); @@ -348,7 +348,7 @@ void patchCode(u64 progId, u8 *code, u32 size) const u32 currentNand = BOOTCFG_NAND; const u32 matchingFirm = BOOTCFG_FIRM == (currentNand != 0); - u16 *verString; + static const u16 *verString; switch(currentNand) { case 1: diff --git a/source/exceptions.c b/source/exceptions.c index dfdfe96..d1a2048 100644 --- a/source/exceptions.c +++ b/source/exceptions.c @@ -86,8 +86,8 @@ void detectAndProcessExceptionDumps(void) if(dumpHeader->magic[0] == 0xDEADC0DE && dumpHeader->magic[1] == 0xDEADCAFE && (dumpHeader->processor == 9 || dumpHeader->processor == 11)) { - vu32 *regs = (vu32 *)((vu8 *)dumpHeader + sizeof(ExceptionDumpHeader)); - vu8 *additionalData = (vu8 *)dumpHeader + dumpHeader->totalSize - dumpHeader->additionalDataSize; + const vu32 *regs = (vu32 *)((vu8 *)dumpHeader + sizeof(ExceptionDumpHeader)); + const vu8 *additionalData = (vu8 *)dumpHeader + dumpHeader->totalSize - dumpHeader->additionalDataSize; const char *handledExceptionNames[] = { "FIQ", "undefined instruction", "prefetch abort", "data abort" @@ -132,7 +132,7 @@ void detectAndProcessExceptionDumps(void) { posY += SPACING_Y; char processName[] = "Current process: --------"; - memcpy(processName + 17, (char *)additionalData, 8); + memcpy(processName + 17, (void *)additionalData, 8); posY = drawString(processName, 10, posY, COLOR_WHITE); } @@ -166,7 +166,7 @@ void detectAndProcessExceptionDumps(void) u32 size = dumpHeader->totalSize; char path[42]; char fileName[] = "crash_dump_00000000.dmp"; - char *pathFolder = dumpHeader->processor == 9 ? "/luma/dumps/arm9" : "/luma/dumps/arm11"; + const char *pathFolder = dumpHeader->processor == 9 ? "/luma/dumps/arm9" : "/luma/dumps/arm11"; findDumpFile(pathFolder, fileName); memcpy(path, pathFolder, strlen(pathFolder) + 1); diff --git a/source/firm.c b/source/firm.c index 0cc07f9..d0d5ec7 100755 --- a/source/firm.c +++ b/source/firm.c @@ -42,7 +42,7 @@ extern u16 launchedFirmTidLow[8]; //Defined in start.s -static firmHeader *const firm = (firmHeader *)0x24000000; +static firmHeader *firm = (firmHeader *)0x24000000; static const firmSectionHeader *section; u32 emuOffset; @@ -490,7 +490,7 @@ static inline void copySection0AndInjectSystemModules(FirmwareType firmType) src < srcEnd; src += srcModuleSize, dst += dstModuleSize) { srcModuleSize = *(u32 *)(src + 0x104) * 0x200; - char *moduleName = (char *)(src + 0x200); + const char *moduleName = (char *)(src + 0x200); char fileName[30] = "/luma/sysmodules/"; const char *ext = ".cxi"; @@ -503,11 +503,11 @@ static inline void copySection0AndInjectSystemModules(FirmwareType firmType) if(fileSize) dstModuleSize = fileSize; else { - void *module; + const void *module; if(firmType == NATIVE_FIRM && memcmp(moduleName, "loader", 6) == 0) { - module = (void *)injector; + module = injector; dstModuleSize = injector_size; } else @@ -530,13 +530,13 @@ static inline void copySection0AndInjectSystemModules(void) src < srcEnd; src += srcModuleSize, dst += dstModuleSize) { srcModuleSize = *(u32 *)(src + 0x104) * 0x200; - char *moduleName = (char *)(src + 0x200); + const char *moduleName = (const char *)(src + 0x200); - void *module; + const void *module; if(memcmp(moduleName, "loader", 6) == 0) { - module = (void *)injector; + module = injector; dstModuleSize = injector_size; } else diff --git a/source/fs.c b/source/fs.c index 43a8ac6..0a0d6b0 100644 --- a/source/fs.c +++ b/source/fs.c @@ -127,7 +127,7 @@ void loadPayload(u32 pressed) { initScreens(); - u32 *const loaderAddress = (u32 *)0x24FFFF00; + u32 *loaderAddress = (u32 *)0x24FFFF00; memcpy(loaderAddress, loader, loader_size); diff --git a/source/patches.c b/source/patches.c index 9bf0108..d5c8be8 100644 --- a/source/patches.c +++ b/source/patches.c @@ -123,7 +123,7 @@ void patchFirmlaunches(u8 *pos, u32 size, u32 process9MemAddr) void patchFirmWrites(u8 *pos, u32 size) { //Look for FIRM writing code - u8 *const off1 = memsearch(pos, "exe:", size, 4); + u8 *off1 = memsearch(pos, "exe:", size, 4); const u8 pattern[] = {0x00, 0x28, 0x01, 0xDA}; u16 *off2 = (u16 *)memsearch(off1 - 0x100, pattern, 0x100, sizeof(pattern)); @@ -251,7 +251,7 @@ void patchArm9ExceptionHandlersInstall(u8 *pos, u32 size) { const u8 pattern[] = {0x03, 0xA0, 0xE3, 0x18}; - u32* off = (u32 *)(memsearch(pos, pattern, size, sizeof(pattern)) + 0x13); + u32 *off = (u32 *)(memsearch(pos, pattern, size, sizeof(pattern)) + 0x13); for(u32 r0 = 0x08000000; *off != 0xE3A01040; off++) //Until mov r1, #0x40 {