diff --git a/source/config.c b/source/config.c index 71eb2c8a..d100cc38 100644 --- a/source/config.c +++ b/source/config.c @@ -87,8 +87,6 @@ void configureCFW(const char *configPath) //Boring configuration menu while(pressed != BUTTON_START) { - pressed = 0; - do { //In any case, if the current option is enabled (or a multiple choice option is selected) we must display a red 'x' if(selectedOption < multiOptionsAmount) diff --git a/source/firm.c b/source/firm.c index dd0571bf..4571cdf3 100755 --- a/source/firm.c +++ b/source/firm.c @@ -339,16 +339,14 @@ static inline void patchReboots(u8 *arm9Section, u8 *proc9Offset) static inline void injectLoader(void) { - u32 loaderOffset, - loaderSize; + u32 loaderSize; - getLoader((u8 *)firm + section[0].offset, section[0].size, &loaderOffset, &loaderSize); + void *loaderOffset = getLoader((u8 *)firm + section[0].offset, section[0].size, &loaderSize); //Check that the injector CXI isn't larger than the original - if(injector_size <= (int)loaderSize) + if((u32)injector_size <= loaderSize) { - memset32((void *)loaderOffset, 0, loaderSize); - memcpy((void *)loaderOffset, injector, injector_size); + memcpy(loaderOffset, injector, injector_size); //Patch content size and ExeFS size to match the repaced loader's ones *((u32 *)loaderOffset + 0x41) = loaderSize / 0x200; diff --git a/source/patches.c b/source/patches.c index 61352461..2a73a118 100644 --- a/source/patches.c +++ b/source/patches.c @@ -77,10 +77,11 @@ u8 *getUnitInfoValueSet(u8 *pos, u32 size) return memsearch(pos, pattern, size, 4) + 3; } -void getLoader(u8 *pos, u32 size, u32 *loaderOffset, u32 *loaderSize) +void *getLoader(u8 *pos, u32 size, u32 *loaderSize) { u8 *const off = memsearch(pos, "loade", size, 5); - *loaderOffset = (u32)off - 0x200; *loaderSize = *(u32 *)(off - 0xFC) * 0x200; + + return off - 0x200; } \ No newline at end of file diff --git a/source/patches.h b/source/patches.h index 0011433f..7b2a44e4 100644 --- a/source/patches.h +++ b/source/patches.h @@ -26,4 +26,4 @@ void *getReboot(u8 *pos, u32 size); u32 getfOpen(u8 *proc9Offset, void *rebootOffset); u16 *getFirmWrite(u8 *pos, u32 size); u8 *getUnitInfoValueSet(u8 *pos, u32 size); -void getLoader(u8 *pos, u32 size, u32 *loaderOffset, u32 *loaderSize); \ No newline at end of file +void *getLoader(u8 *pos, u32 size, u32 *loaderSize); \ No newline at end of file