diff --git a/injector/source/patcher.c b/injector/source/patcher.c index ce77b7f..bda9d33 100644 --- a/injector/source/patcher.c +++ b/injector/source/patcher.c @@ -19,18 +19,6 @@ typedef struct __attribute__((packed)) CFWInfo info = {0}; -int __attribute__((naked)) svcGetCFWInfo(CFWInfo __attribute__((unused)) *out) -{ - __asm__ volatile("svc 0x2E; bx lr"); -} - -static void loadCFWInfo(void) -{ - static bool infoLoaded = false; - if(!infoLoaded) svcGetCFWInfo(&info); - infoLoaded = true; -} - #ifndef PATH_MAX #define PATH_MAX 255 #define CONFIG(a) (((info.config >> (a + 16)) & 1) != 0) @@ -118,6 +106,26 @@ static int fileOpen(IFile *file, FS_ArchiveID archiveId, const char *path, int f return IFile_Open(file, archiveId, archivePath, filePath, flags); } +int __attribute__((naked)) svcGetCFWInfo(CFWInfo __attribute__((unused)) *out) +{ + __asm__ volatile("svc 0x2E; bx lr"); +} + +static void loadCFWInfo(void) +{ + static bool infoLoaded = false; + if(!infoLoaded) + { + svcGetCFWInfo(&info); + IFile file; + if(R_SUCCEEDED(fileOpen(&file, ARCHIVE_SDMC, "/", FS_OPEN_READ))) //init SD card for firmlaunch patches + { + IFile_Close(&file); + } + } + infoLoaded = true; +} + static bool secureInfoExists(void) { static bool exists = false; diff --git a/source/draw.c b/source/draw.c index b23bc09..a6a99f5 100644 --- a/source/draw.c +++ b/source/draw.c @@ -43,7 +43,7 @@ static inline int strlen(const char *string) bool loadSplash(void) { //Don't delay boot nor init the screens if no splash image is on the SD - if(getFileSize("/luma/splash.bin") + getFileSize("/luma/splash.bin") == 0) + if(getFileSize("/luma/splash.bin") + getFileSize("/luma/splashbottom.bin") == 0) return false; initScreens(); diff --git a/source/firm.c b/source/firm.c index 6a0d51e..d757e7e 100755 --- a/source/firm.c +++ b/source/firm.c @@ -397,7 +397,7 @@ static inline void copySection0AndInjectSystemModules(FirmwareType firmType) u8 *pos = arm11Section0, *end = pos + section[0].size; u32 n = 0; - u32 loaderIndex = 0; + u32 loaderIndex = 0, twlBgIndex = 0; while(pos < end) { @@ -421,20 +421,35 @@ static inline void copySection0AndInjectSystemModules(FirmwareType firmType) } if(firmType == NATIVE_FIRM && memcmp(modules[n].name, "loader", 7) == 0) loaderIndex = n; + else if(firmType == TWL_FIRM && memcmp(modules[n].name, "TwlBg", 6) == 0) twlBgIndex = n; n++; } + u32 twlBgSize = 0; + if(firmType == NATIVE_FIRM && modules[loaderIndex].addr != NULL) { modules[loaderIndex].size = injector_size; modules[loaderIndex].addr = injector; } + else if(firmType == TWL_FIRM) + { + twlBgSize = getFileSize("/luma/TwlBg.cxi"); + if(twlBgSize != 0) + { + modules[twlBgIndex].size = twlBgSize; + modules[twlBgIndex].addr = NULL; + } + } + pos = section[0].address; for(u32 i = 0; i < n; i++) { - if(modules[i].addr != NULL) + if(firmType == TWL_FIRM && i == twlBgIndex && twlBgSize != 0) + fileRead(pos, "/luma/TwlBg.cxi"); + else if(modules[i].addr != NULL) memcpy(pos, modules[i].addr, modules[i].size); else { diff --git a/source/patches.h b/source/patches.h index bf64b74..ee3b54a 100644 --- a/source/patches.h +++ b/source/patches.h @@ -53,5 +53,4 @@ void patchP9AccessChecks(u8 *pos, u32 size); void patchUnitInfoValueSet(u8 *pos, u32 size); void reimplementSvcBackdoor(u8 *pos, u32 size); void implementSvcGetCFWInfo(u8 *pos, u32 size); -void applyLegacyFirmPatches(u8 *pos, FirmwareType firmType); -u8 *getUnitInfoValueSet(u8 *pos, u32 size); +void applyLegacyFirmPatches(u8 *pos, FirmwareType firmType); \ No newline at end of file