Do not initialize the screens in the very common case where the user has only one payload, etc.
This commit is contained in:
parent
be6d64260c
commit
b5b5db6e8c
@ -238,7 +238,8 @@ u32 loadNintendoFirm(FirmwareType *firmType, FirmwareSource nandType, bool loadF
|
||||
void loadHomebrewFirm(u32 pressed)
|
||||
{
|
||||
char path[10 + 255];
|
||||
bool found = !pressed ? payloadMenu(path) : findPayload(path, pressed);
|
||||
bool hasDisplayedMenu = false;
|
||||
bool found = !pressed ? payloadMenu(path, &hasDisplayedMenu) : findPayload(path, pressed);
|
||||
|
||||
if(!found) return;
|
||||
|
||||
@ -253,10 +254,12 @@ void loadHomebrewFirm(u32 pressed)
|
||||
else sprintf(absPath, "nand:/rw/luma/%s", path);
|
||||
|
||||
char *argv[2] = {absPath, (char *)fbs};
|
||||
bool wantsScreenInit = (firm->reserved2[0] & 1) != 0;
|
||||
|
||||
initScreens();
|
||||
if(!hasDisplayedMenu && wantsScreenInit)
|
||||
initScreens(); // Don't init the screens unless we have to, if not already done
|
||||
|
||||
launchFirm((firm->reserved2[0] & 1) ? 2 : 1, argv);
|
||||
launchFirm(wantsScreenInit ? 2 : 1, argv);
|
||||
}
|
||||
|
||||
static inline void mergeSection0(FirmwareType firmType, u32 firmVersion, bool loadFromStorage)
|
||||
|
@ -154,10 +154,11 @@ bool findPayload(char *path, u32 pressed)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool payloadMenu(char *path)
|
||||
bool payloadMenu(char *path, bool *hasDisplayedMenu)
|
||||
{
|
||||
DIR dir;
|
||||
|
||||
*hasDisplayedMenu = false;
|
||||
if(f_opendir(&dir, "payloads") != FR_OK) return false;
|
||||
|
||||
FILINFO info;
|
||||
@ -189,6 +190,7 @@ bool payloadMenu(char *path)
|
||||
if(payloadNum != 1)
|
||||
{
|
||||
initScreens();
|
||||
*hasDisplayedMenu = true;
|
||||
|
||||
drawString(true, 10, 10, COLOR_TITLE, "Luma3DS chainloader");
|
||||
drawString(true, 10, 10 + SPACING_Y, COLOR_TITLE, "Press A to select, START to quit");
|
||||
|
@ -36,6 +36,6 @@ u32 getFileSize(const char *path);
|
||||
bool fileWrite(const void *buffer, const char *path, u32 size);
|
||||
bool fileDelete(const char *path);
|
||||
bool findPayload(char *path, u32 pressed);
|
||||
bool payloadMenu(char *path);
|
||||
bool payloadMenu(char *path, bool *hasDisplayedMenu);
|
||||
u32 firmRead(void *dest, u32 firmType);
|
||||
void findDumpFile(const char *folderPath, char *fileName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user