mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 05:32:47 +00:00
A9NC / bootloader: check for FIRM in FCRAM on start
This commit is contained in:
parent
59928d7573
commit
93a6a183c5
@ -1536,6 +1536,16 @@ u32 GodMode(bool is_b9s) {
|
|||||||
bootloader = !is_b9s && IS_SIGHAX && !bootloader; // default bootloader
|
bootloader = !is_b9s && IS_SIGHAX && !bootloader; // default bootloader
|
||||||
#endif
|
#endif
|
||||||
bool godmode9 = !bootloader && !bootmenu;
|
bool godmode9 = !bootloader && !bootmenu;
|
||||||
|
FirmHeader* firm_in_mem = (FirmHeader*) DIR_BUFFER;
|
||||||
|
if (bootloader || bootmenu) {
|
||||||
|
for (u8* addr = (u8*) 0x20000200; addr < (u8*) 0x24000000; addr += 0x400000) {
|
||||||
|
if (ValidateFirmHeader((FirmHeader*) (void*) addr, 0x100000) == 0) {
|
||||||
|
memmove(firm_in_mem, addr, 0x100000);
|
||||||
|
if (memcmp(addr, "FIRM", 4) == 0) memcpy(addr, "NOPE", 4); // prevent bootloops
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ClearScreenF(true, true, COLOR_STD_BG);
|
ClearScreenF(true, true, COLOR_STD_BG);
|
||||||
@ -1552,10 +1562,6 @@ u32 GodMode(bool is_b9s) {
|
|||||||
InitNandCrypto(!is_b9s);
|
InitNandCrypto(!is_b9s);
|
||||||
InitExtFS();
|
InitExtFS();
|
||||||
|
|
||||||
GetDirContents(current_dir, "");
|
|
||||||
clipboard->n_entries = 0;
|
|
||||||
memset(panedata, 0x00, 0x10000);
|
|
||||||
|
|
||||||
// check for embedded essential backup
|
// check for embedded essential backup
|
||||||
if (IS_SIGHAX && !PathExist("S:/essential.exefs") && CheckGenuineNandNcsd() &&
|
if (IS_SIGHAX && !PathExist("S:/essential.exefs") && CheckGenuineNandNcsd() &&
|
||||||
ShowPrompt(true, "Essential files backup not found.\nCreate one now?")) {
|
ShowPrompt(true, "Essential files backup not found.\nCreate one now?")) {
|
||||||
@ -1589,6 +1595,7 @@ u32 GodMode(bool is_b9s) {
|
|||||||
while (timer_msec( timer ) < 500); // show splash for at least 0.5 sec
|
while (timer_msec( timer ) < 500); // show splash for at least 0.5 sec
|
||||||
|
|
||||||
|
|
||||||
|
// bootmenu handler
|
||||||
if (bootmenu) {
|
if (bootmenu) {
|
||||||
bootloader = false;
|
bootloader = false;
|
||||||
while (!bootloader && !godmode9) {
|
while (!bootloader && !godmode9) {
|
||||||
@ -1614,13 +1621,18 @@ u32 GodMode(bool is_b9s) {
|
|||||||
}
|
}
|
||||||
if (bootloader) {
|
if (bootloader) {
|
||||||
const char* bootfirm_paths[] = { BOOTFIRM_PATHS };
|
const char* bootfirm_paths[] = { BOOTFIRM_PATHS };
|
||||||
|
if (ValidateFirm(firm_in_mem, 0x100000, false) == 0) BootFirm(firm_in_mem, "0:/bootonce.firm");
|
||||||
for (u32 i = 0; i < sizeof(bootfirm_paths) / sizeof(char*); i++) {
|
for (u32 i = 0; i < sizeof(bootfirm_paths) / sizeof(char*); i++) {
|
||||||
BootFirmHandler(bootfirm_paths[i], false, (BOOTFIRM_TEMPS >> i) & 0x1);
|
BootFirmHandler(bootfirm_paths[i], false, (BOOTFIRM_TEMPS >> i) & 0x1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GetDirContents(current_dir, "");
|
||||||
|
clipboard->n_entries = 0;
|
||||||
|
memset(panedata, 0x00, 0x10000);
|
||||||
ClearScreenF(true, true, COLOR_STD_BG); // clear splash
|
ClearScreenF(true, true, COLOR_STD_BG); // clear splash
|
||||||
|
|
||||||
while (godmode9) { // this is the main loop
|
while (godmode9) { // this is the main loop
|
||||||
int curr_drvtype = DriveType(current_path);
|
int curr_drvtype = DriveType(current_path);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user