mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 21:52:48 +00:00
Allow booting FIRM images
... works only with latest boot9strap nightly
This commit is contained in:
parent
7522f73685
commit
b9eea8e92b
@ -49,5 +49,6 @@
|
|||||||
#define FTYPE_XORPAD(tp) (tp&(BIN_NCCHNFO))
|
#define FTYPE_XORPAD(tp) (tp&(BIN_NCCHNFO))
|
||||||
#define FTYPE_SCRIPT(tp) (tp&(TXT_SCRIPT))
|
#define FTYPE_SCRIPT(tp) (tp&(TXT_SCRIPT))
|
||||||
#define FTYPE_PAYLOAD(tp) (tp&(BIN_LAUNCH))
|
#define FTYPE_PAYLOAD(tp) (tp&(BIN_LAUNCH))
|
||||||
|
#define FTYPE_BOOTABLE(tp) (tp&(SYS_FIRM))
|
||||||
|
|
||||||
u32 IdentifyFileType(const char* path);
|
u32 IdentifyFileType(const char* path);
|
||||||
|
@ -885,9 +885,10 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, DirStruct* cur
|
|||||||
bool xorpadable = (FTYPE_XORPAD(filetype));
|
bool xorpadable = (FTYPE_XORPAD(filetype));
|
||||||
bool scriptable = (FTYPE_SCRIPT(filetype));
|
bool scriptable = (FTYPE_SCRIPT(filetype));
|
||||||
bool launchable = ((FTYPE_PAYLOAD(filetype)) && (drvtype & DRV_FAT) && !IS_SIGHAX);
|
bool launchable = ((FTYPE_PAYLOAD(filetype)) && (drvtype & DRV_FAT) && !IS_SIGHAX);
|
||||||
|
bool bootable = ((FTYPE_BOOTABLE(filetype)) && !PathExist("0:/bootonce.firm") && IS_SIGHAX); // works only with boot9strap nightly
|
||||||
bool special_opt = mountable || verificable || decryptable || encryptable || cia_buildable || cia_buildable_legit || cxi_dumpable ||
|
bool special_opt = mountable || verificable || decryptable || encryptable || cia_buildable || cia_buildable_legit || cxi_dumpable ||
|
||||||
tik_buildable || key_buildable || titleinfo || renamable || transferable || hsinjectable || restorable || xorpadable ||
|
tik_buildable || key_buildable || titleinfo || renamable || transferable || hsinjectable || restorable || xorpadable ||
|
||||||
ebackupable || launchable || scriptable;
|
ebackupable || launchable || bootable || scriptable;
|
||||||
|
|
||||||
char pathstr[32+1];
|
char pathstr[32+1];
|
||||||
TruncateString(pathstr, curr_entry->path, 32, 8);
|
TruncateString(pathstr, curr_entry->path, 32, 8);
|
||||||
@ -1044,6 +1045,7 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, DirStruct* cur
|
|||||||
int xorpad = (xorpadable) ? ++n_opt : -1;
|
int xorpad = (xorpadable) ? ++n_opt : -1;
|
||||||
int xorpad_inplace = (xorpadable) ? ++n_opt : -1;
|
int xorpad_inplace = (xorpadable) ? ++n_opt : -1;
|
||||||
int launch = (launchable) ? ++n_opt : -1;
|
int launch = (launchable) ? ++n_opt : -1;
|
||||||
|
int boot = (bootable) ? ++n_opt : -1;
|
||||||
int script = (scriptable) ? ++n_opt : -1;
|
int script = (scriptable) ? ++n_opt : -1;
|
||||||
if (mount > 0) optionstr[mount-1] = "Mount image to drive";
|
if (mount > 0) optionstr[mount-1] = "Mount image to drive";
|
||||||
if (restore > 0) optionstr[restore-1] = "Restore SysNAND (safe)";
|
if (restore > 0) optionstr[restore-1] = "Restore SysNAND (safe)";
|
||||||
@ -1064,6 +1066,7 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, DirStruct* cur
|
|||||||
if (xorpad > 0) optionstr[xorpad-1] = "Build XORpads (SD output)";
|
if (xorpad > 0) optionstr[xorpad-1] = "Build XORpads (SD output)";
|
||||||
if (xorpad_inplace > 0) optionstr[xorpad_inplace-1] = "Build XORpads (inplace)";
|
if (xorpad_inplace > 0) optionstr[xorpad_inplace-1] = "Build XORpads (inplace)";
|
||||||
if (launch > 0) optionstr[launch-1] = "Launch as ARM9 payload";
|
if (launch > 0) optionstr[launch-1] = "Launch as ARM9 payload";
|
||||||
|
if (boot > 0) optionstr[boot-1] = "Boot FIRM via boot9strap";
|
||||||
if (script > 0) optionstr[script-1] = "Execute GM9 script";
|
if (script > 0) optionstr[script-1] = "Execute GM9 script";
|
||||||
|
|
||||||
// auto select when there is only one option
|
// auto select when there is only one option
|
||||||
@ -1406,6 +1409,14 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, DirStruct* cur
|
|||||||
} // failed load is basically impossible here
|
} // failed load is basically impossible here
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
} else if ((user_select == boot)) {
|
||||||
|
size_t payload_size = FileGetSize(curr_entry->path);
|
||||||
|
if (ShowUnlockSequence(3, "%s (%dkB)\nBoot FIRM via boot9strap?", pathstr, payload_size / 1024)) {
|
||||||
|
u32 flags = OVERWRITE_ALL;
|
||||||
|
if (PathMoveCopy("0:/bootonce.firm", curr_entry->path, &flags, false))
|
||||||
|
Reboot();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
} else if ((user_select == script)) {
|
} else if ((user_select == script)) {
|
||||||
static bool show_disclaimer = true;
|
static bool show_disclaimer = true;
|
||||||
if (show_disclaimer) ShowPrompt(false, "Warning: Do not run scripts\nfrom untrusted sources.");
|
if (show_disclaimer) ShowPrompt(false, "Warning: Do not run scripts\nfrom untrusted sources.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user