Replace "Enable splash screen with no screen-init" by "Display splash screen before payloads".

The screens will be initied if and only if there are splash files to display.
This commit is contained in:
TuxSH 2016-08-13 22:23:14 +02:00
parent 457b4cec13
commit 3bc966f84e
5 changed files with 32 additions and 13 deletions

View File

@ -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 {

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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);