diff --git a/source/config.c b/source/config.c index b1a5563..a16bdf7 100644 --- a/source/config.c +++ b/source/config.c @@ -42,7 +42,7 @@ void configureCFW(const char *configPath) "( ) Enable region/language emu. and ext. .code", "( ) Show current NAND in System Settings", "( ) Show GBA boot screen in patched AGB_FIRM", - "( ) Enable splash screen with no screen-init", + "( ) Display splash screen before payloads", "( ) Use a PIN" }; struct multiOption { diff --git a/source/draw.c b/source/draw.c index 4a98161..2dfbea3 100644 --- a/source/draw.c +++ b/source/draw.c @@ -42,13 +42,16 @@ 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) + return false; + initScreens(); - //Don't delay boot if no splash image is on the SD - if(fileRead(fb->top_left, "/luma/splash.bin") + - fileRead(fb->bottom, "/luma/splashbottom.bin")) return true; + fileRead(fb->top_left, "/luma/splash.bin"); + fileRead(fb->bottom, "/luma/splashbottom.bin"); - return false; + return true; } void drawCharacter(char character, int posX, int posY, u32 color) diff --git a/source/firm.c b/source/firm.c index 3e84180..0cd33e7 100755 --- a/source/firm.c +++ b/source/firm.c @@ -179,14 +179,23 @@ void main(void) else { /* If L and R/A/Select or one of the single payload buttons are pressed, - chainload an external payload (verify the PIN if needed)*/ + chainload an external payload (the PIN, if any, has been verified)*/ + + if(CONFIG(6) && loadSplash()) + { + nbChronoStarted = 2; + chrono(0); + chrono(3); + nbChronoStarted = 0; + pressed = HID_PAD; + } + bool shouldLoadPayload = (pressed & SINGLE_PAYLOAD_BUTTONS) || ((pressed & BUTTON_L1) && (pressed & L_PAYLOAD_BUTTONS)); if(shouldLoadPayload) - loadPayload(pressed); + loadPayload(pressed, nbChronoStarted != 2); - //If screens are inited or the corresponding option is set, load splash screen - if((PDN_GPU_CNT != 1 || CONFIG(6)) && loadSplash()) + if(!CONFIG(6) && loadSplash()) { nbChronoStarted = 2; chrono(0); diff --git a/source/fs.c b/source/fs.c index 080327f..0358b87 100644 --- a/source/fs.c +++ b/source/fs.c @@ -46,7 +46,8 @@ u32 fileRead(void *dest, const char *path) { unsigned int read; size = f_size(&file); - f_read(&file, dest, size, &read); + if(dest != NULL) + f_read(&file, dest, size, &read); f_close(&file); } else size = 0; @@ -54,6 +55,11 @@ u32 fileRead(void *dest, const char *path) return size; } +u32 getFileSize(const char *path) +{ + return fileRead(NULL, path); +} + bool fileWrite(const void *buffer, const char *path, u32 size) { FIL file; @@ -75,7 +81,7 @@ void createDirectory(const char *path) f_mkdir(path); } -void loadPayload(u32 pressed) +void loadPayload(u32 pressed, bool needToInitScreens) { const char *pattern; @@ -100,7 +106,7 @@ void loadPayload(u32 pressed) if(result == FR_OK && info.fname[0]) { - initScreens(); + if(needToInitScreens) initScreens(); u32 *const loaderAddress = (u32 *)0x24FFFF00; diff --git a/source/fs.h b/source/fs.h index 3daf016..4e1456d 100644 --- a/source/fs.h +++ b/source/fs.h @@ -30,7 +30,8 @@ extern bool isN3DS; void mountFs(void); u32 fileRead(void *dest, const char *path); +u32 getFileSize(const char *path); bool fileWrite(const void *buffer, const char *path, u32 size); void createDirectory(const char *path); -void loadPayload(u32 pressed); +void loadPayload(u32 pressed, bool needToInitScreens); u32 firmRead(void *dest, u32 firmType); \ No newline at end of file