mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 13:42:47 +00:00
Remove legacy A9LH support
This commit is contained in:
parent
ff491f2993
commit
73e3a18ea8
@ -9,17 +9,10 @@
|
|||||||
// see: https://www.3dbrew.org/wiki/OTP_Registers#Plaintext_OTP
|
// see: https://www.3dbrew.org/wiki/OTP_Registers#Plaintext_OTP
|
||||||
#define IS_DEVKIT ((*(vu8*) (0x01FFB800+0x19)) != 0x0)
|
#define IS_DEVKIT ((*(vu8*) (0x01FFB800+0x19)) != 0x0)
|
||||||
|
|
||||||
// see: https://3dbrew.org/wiki/CONFIG11_Registers
|
|
||||||
// (also returns true for sighaxed systems, maybe change the name later?)
|
|
||||||
#define IS_A9LH ((*(vu32*) 0x101401C0) == 0)
|
|
||||||
|
|
||||||
// https://www.3dbrew.org/wiki/CONFIG9_Registers
|
// https://www.3dbrew.org/wiki/CONFIG9_Registers
|
||||||
// (actually checks for an unlocked OTP)
|
// (actually checks for an unlocked OTP, meaning sighax)
|
||||||
#define IS_UNLOCKED (!((*(vu8*)0x10000000) & 0x2))
|
#define IS_UNLOCKED (!((*(vu8*)0x10000000) & 0x2))
|
||||||
|
|
||||||
// A9LH + unlocked == SigHax
|
|
||||||
#define IS_SIGHAX (IS_A9LH && IS_UNLOCKED)
|
|
||||||
|
|
||||||
// System models
|
// System models
|
||||||
enum SystemModel {
|
enum SystemModel {
|
||||||
MODEL_OLD_3DS = 0,
|
MODEL_OLD_3DS = 0,
|
||||||
|
@ -49,7 +49,7 @@ bool CheckWritePermissions(const char* path) {
|
|||||||
for (u32 i = 0; (i < sizeof(path_lvl1) / sizeof(char*)) && (lvl < 1); i++)
|
for (u32 i = 0; (i < sizeof(path_lvl1) / sizeof(char*)) && (lvl < 1); i++)
|
||||||
if (strncasecmp(path, path_lvl1[i], 256) == 0) lvl = 1;
|
if (strncasecmp(path, path_lvl1[i], 256) == 0) lvl = 1;
|
||||||
}
|
}
|
||||||
if (!IS_A9LH) { // changed SysNAND permission levels on non-A9LH
|
if (!IS_UNLOCKED) { // changed SysNAND permission levels on locked systems
|
||||||
if ((drvtype & DRV_CTRNAND) || (lvl == 2)) lvl = 3;
|
if ((drvtype & DRV_CTRNAND) || (lvl == 2)) lvl = 3;
|
||||||
}
|
}
|
||||||
perm = perms[lvl];
|
perm = perms[lvl];
|
||||||
@ -179,7 +179,7 @@ bool SetWritePermissions(u32 perm, bool add_perm) {
|
|||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case PERM_SYS_LVL3:
|
case PERM_SYS_LVL3:
|
||||||
if (!ShowUnlockSequence(6, "!THIS IS YOUR ONLY WARNING!\n \nYou want to enable SysNAND\nlvl3 writing permissions.\n \nThis enables you to OVERWRITE\n%s", IS_SIGHAX ? "your B9S installation and/or\nBRICK your console!" : IS_A9LH ? "your A9LH installation and/or\nBRICK your console!" : "essential system files and/or\nBRICK your console!"))
|
if (!ShowUnlockSequence(6, "!THIS IS YOUR ONLY WARNING!\n \nYou want to enable SysNAND\nlvl3 writing permissions.\n \nThis enables you to OVERWRITE\nyour bootloader installation,\nessential system files and/or\nBRICK your console!"))
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1037,11 +1037,11 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, PaneData** pan
|
|||||||
bool renamable = (FTYPE_RENAMABLE(filetype));
|
bool renamable = (FTYPE_RENAMABLE(filetype));
|
||||||
bool trimable = (FTYPE_TRIMABLE(filetype)) && !(drvtype & DRV_VIRTUAL) && !(drvtype & DRV_ALIAS) &&
|
bool trimable = (FTYPE_TRIMABLE(filetype)) && !(drvtype & DRV_VIRTUAL) && !(drvtype & DRV_ALIAS) &&
|
||||||
!(drvtype & DRV_CTRNAND) && !(drvtype & DRV_TWLNAND) && !(drvtype & DRV_IMAGE);
|
!(drvtype & DRV_CTRNAND) && !(drvtype & DRV_TWLNAND) && !(drvtype & DRV_IMAGE);
|
||||||
bool transferable = (FTYPE_TRANSFERABLE(filetype) && IS_A9LH && (drvtype & DRV_FAT));
|
bool transferable = (FTYPE_TRANSFERABLE(filetype) && IS_UNLOCKED && (drvtype & DRV_FAT));
|
||||||
bool hsinjectable = (FTYPE_HASCODE(filetype));
|
bool hsinjectable = (FTYPE_HASCODE(filetype));
|
||||||
bool extrcodeable = (FTYPE_HASCODE(filetype));
|
bool extrcodeable = (FTYPE_HASCODE(filetype));
|
||||||
bool extrdiffable = (FTYPE_ISDISADIFF(filetype));
|
bool extrdiffable = (FTYPE_ISDISADIFF(filetype));
|
||||||
bool restorable = (FTYPE_RESTORABLE(filetype) && IS_A9LH && !(drvtype & DRV_SYSNAND));
|
bool restorable = (FTYPE_RESTORABLE(filetype) && IS_UNLOCKED && !(drvtype & DRV_SYSNAND));
|
||||||
bool ebackupable = (FTYPE_EBACKUP(filetype));
|
bool ebackupable = (FTYPE_EBACKUP(filetype));
|
||||||
bool ncsdfixable = (FTYPE_NCSDFIXABLE(filetype));
|
bool ncsdfixable = (FTYPE_NCSDFIXABLE(filetype));
|
||||||
bool xorpadable = (FTYPE_XORPAD(filetype));
|
bool xorpadable = (FTYPE_XORPAD(filetype));
|
||||||
@ -2011,7 +2011,7 @@ u32 GodMode(int entrypoint) {
|
|||||||
u32 last_write_perm = GetWritePermissions();
|
u32 last_write_perm = GetWritePermissions();
|
||||||
u32 last_clipboard_size = 0;
|
u32 last_clipboard_size = 0;
|
||||||
|
|
||||||
bool bootloader = IS_SIGHAX && (entrypoint == ENTRY_NANDBOOT);
|
bool bootloader = IS_UNLOCKED && (entrypoint == ENTRY_NANDBOOT);
|
||||||
bool bootmenu = bootloader && (BOOTMENU_KEY != BUTTON_START) && CheckButton(BOOTMENU_KEY);
|
bool bootmenu = bootloader && (BOOTMENU_KEY != BUTTON_START) && CheckButton(BOOTMENU_KEY);
|
||||||
bool godmode9 = !bootloader;
|
bool godmode9 = !bootloader;
|
||||||
|
|
||||||
@ -2030,7 +2030,7 @@ u32 GodMode(int entrypoint) {
|
|||||||
// get mode string for splash screen
|
// get mode string for splash screen
|
||||||
const char* disp_mode = NULL;
|
const char* disp_mode = NULL;
|
||||||
if (bootloader) disp_mode = "bootloader mode\nR+LEFT for menu";
|
if (bootloader) disp_mode = "bootloader mode\nR+LEFT for menu";
|
||||||
else if (!IS_SIGHAX && (entrypoint == ENTRY_NANDBOOT)) disp_mode = "oldloader mode";
|
else if (!IS_UNLOCKED && (entrypoint == ENTRY_NANDBOOT)) disp_mode = "oldloader mode";
|
||||||
else if (entrypoint == ENTRY_NTRBOOT) disp_mode = "ntrboot mode";
|
else if (entrypoint == ENTRY_NTRBOOT) disp_mode = "ntrboot mode";
|
||||||
else if (entrypoint == ENTRY_UNKNOWN) disp_mode = "unknown mode";
|
else if (entrypoint == ENTRY_UNKNOWN) disp_mode = "unknown mode";
|
||||||
|
|
||||||
@ -2075,7 +2075,7 @@ u32 GodMode(int entrypoint) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check internal clock
|
// check internal clock
|
||||||
if (IS_SIGHAX) { // we could actually do this on any entrypoint
|
if (IS_UNLOCKED) { // we could actually do this on any entrypoint
|
||||||
DsTime dstime;
|
DsTime dstime;
|
||||||
get_dstime(&dstime);
|
get_dstime(&dstime);
|
||||||
if ((DSTIMEGET(&dstime, bcd_Y) < 18) &&
|
if ((DSTIMEGET(&dstime, bcd_Y) < 18) &&
|
||||||
@ -2619,7 +2619,7 @@ u32 ScriptRunner(int entrypoint) {
|
|||||||
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
|
||||||
|
|
||||||
// you didn't really install a scriptrunner to NAND, did you?
|
// you didn't really install a scriptrunner to NAND, did you?
|
||||||
if (IS_SIGHAX && (entrypoint == ENTRY_NANDBOOT))
|
if (IS_UNLOCKED && (entrypoint == ENTRY_NANDBOOT))
|
||||||
BootFirmHandler("0:/iderped.firm", false, false);
|
BootFirmHandler("0:/iderped.firm", false, false);
|
||||||
|
|
||||||
if (PathExist("V:/" VRAM0_AUTORUN_GM9)) {
|
if (PathExist("V:/" VRAM0_AUTORUN_GM9)) {
|
||||||
|
@ -85,14 +85,10 @@ bool GetOtp0x90(void* otp0x90, u32 len)
|
|||||||
bool InitNandCrypto(bool init_full)
|
bool InitNandCrypto(bool init_full)
|
||||||
{
|
{
|
||||||
// part #0: KeyX / KeyY for secret sector 0x96
|
// part #0: KeyX / KeyY for secret sector 0x96
|
||||||
// on a9lh this MUST be run before accessing the SHA register in any other way
|
|
||||||
if (IS_UNLOCKED) { // if OTP is unlocked
|
if (IS_UNLOCKED) { // if OTP is unlocked
|
||||||
// see: https://www.3dbrew.org/wiki/OTP_Registers
|
// see: https://www.3dbrew.org/wiki/OTP_Registers
|
||||||
sha_quick(OtpSha256, (u8*) __OTP_ADDR, 0x90, SHA256_MODE);
|
sha_quick(OtpSha256, (u8*) __OTP_ADDR, 0x90, SHA256_MODE);
|
||||||
Crypto0x96 = true; // valid 100% in that case, others need checking
|
Crypto0x96 = true; // valid 100% in that case, others need checking
|
||||||
} else if (IS_A9LH) { // for a9lh
|
|
||||||
// store the current SHA256 from register
|
|
||||||
memcpy(OtpSha256, (void*) REG_SHAHASH, 32);
|
|
||||||
}
|
}
|
||||||
if (!CheckSector0x96Crypto()) { // if all else fails...
|
if (!CheckSector0x96Crypto()) { // if all else fails...
|
||||||
u8 __attribute__((aligned(32))) otp0x90[0x90];
|
u8 __attribute__((aligned(32))) otp0x90[0x90];
|
||||||
@ -168,8 +164,8 @@ bool InitNandCrypto(bool init_full)
|
|||||||
if (GetNandPartitionInfo(NULL, NP_TYPE_FAT, NP_SUBTYPE_CTR, 0, NAND_SYSNAND) != 0)
|
if (GetNandPartitionInfo(NULL, NP_TYPE_FAT, NP_SUBTYPE_CTR, 0, NAND_SYSNAND) != 0)
|
||||||
LoadKeyFromFile(slot0x05KeyY, 0x05, 'Y', NULL);
|
LoadKeyFromFile(slot0x05KeyY, 0x05, 'Y', NULL);
|
||||||
|
|
||||||
// part #4: AGBSAVE CMAC KEY (set up on A9LH and SigHax)
|
// part #4: AGBSAVE CMAC KEY (set up on unlocked systems)
|
||||||
if (init_full && (IS_A9LH || IS_SIGHAX))
|
if (init_full && IS_UNLOCKED)
|
||||||
LoadKeyFromFile(NULL, 0x24, 'Y', NULL);
|
LoadKeyFromFile(NULL, 0x24, 'Y', NULL);
|
||||||
|
|
||||||
// part #5: FULL INIT
|
// part #5: FULL INIT
|
||||||
|
@ -387,8 +387,8 @@ u32 SafeRestoreNandDump(const char* path) {
|
|||||||
if ((ValidateNandDump(path) != 0) && // NAND dump validation
|
if ((ValidateNandDump(path) != 0) && // NAND dump validation
|
||||||
!ShowPrompt(true, "Error: NAND dump is corrupt.\nStill continue?"))
|
!ShowPrompt(true, "Error: NAND dump is corrupt.\nStill continue?"))
|
||||||
return 1;
|
return 1;
|
||||||
if (!IS_A9LH) {
|
if (!IS_UNLOCKED) {
|
||||||
ShowPrompt(false, "Error: B9S/A9LH not detected.");
|
ShowPrompt(false, "Error: System is locked.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (fvx_stat("S:/essential.exefs", NULL) != FR_OK) {
|
if (fvx_stat("S:/essential.exefs", NULL) != FR_OK) {
|
||||||
|
@ -482,7 +482,7 @@ bool init_vars(const char* path_script) {
|
|||||||
set_var("NULL", ""); // this one is special and should not be changed later
|
set_var("NULL", ""); // this one is special and should not be changed later
|
||||||
set_var("CURRDIR", curr_dir); // script path, never changes
|
set_var("CURRDIR", curr_dir); // script path, never changes
|
||||||
set_var("GM9OUT", OUTPUT_PATH); // output path, never changes
|
set_var("GM9OUT", OUTPUT_PATH); // output path, never changes
|
||||||
set_var("HAX", IS_SIGHAX ? (isntrboot() ? "ntrboot" : "sighax") : IS_A9LH ? "a9lh" : ""); // type of hax running from
|
set_var("HAX", IS_UNLOCKED ? (isntrboot() ? "ntrboot" : "sighax") : ""); // type of hax running from
|
||||||
set_var("ONTYPE", IS_O3DS ? "O3DS" : "N3DS"); // type of the console
|
set_var("ONTYPE", IS_O3DS ? "O3DS" : "N3DS"); // type of the console
|
||||||
set_var("RDTYPE", IS_DEVKIT ? "devkit" : "retail"); // devkit / retail
|
set_var("RDTYPE", IS_DEVKIT ? "devkit" : "retail"); // devkit / retail
|
||||||
char* ptr = set_var("GM9VER", VERSION); // GodMode9 version, truncated below
|
char* ptr = set_var("GM9VER", VERSION); // GodMode9 version, truncated below
|
||||||
|
@ -94,7 +94,7 @@ bool ReadVMemDir(VirtualFile* vfile, VirtualDir* vdir) { // uses a generic vdir
|
|||||||
memcpy(vfile, templates + vdir->index, sizeof(VirtualFile));
|
memcpy(vfile, templates + vdir->index, sizeof(VirtualFile));
|
||||||
|
|
||||||
// process special flags
|
// process special flags
|
||||||
if (((vfile->flags & VFLAG_N3DS_EXT) && (IS_O3DS || IS_SIGHAX)) || // this is not on O3DS consoles and locked by sighax
|
if (((vfile->flags & VFLAG_N3DS_EXT) && (IS_O3DS || IS_UNLOCKED)) || // this is not on O3DS consoles and locked by sighax
|
||||||
((vfile->flags & VFLAG_OTP) && !(IS_UNLOCKED)) || // OTP still locked
|
((vfile->flags & VFLAG_OTP) && !(IS_UNLOCKED)) || // OTP still locked
|
||||||
((vfile->flags & VFLAG_BOOT9) && !(HAS_BOOT9)) || // boot9 not found
|
((vfile->flags & VFLAG_BOOT9) && !(HAS_BOOT9)) || // boot9 not found
|
||||||
((vfile->flags & VFLAG_BOOT11) && !(HAS_BOOT11)) || // boot11 not found
|
((vfile->flags & VFLAG_BOOT11) && !(HAS_BOOT11)) || // boot11 not found
|
||||||
|
Loading…
x
Reference in New Issue
Block a user