From 4a3c9a0945515ff5b6e8277c2ab661b5007e7c9e Mon Sep 17 00:00:00 2001 From: rmc Date: Sun, 5 Nov 2023 01:28:19 -0400 Subject: [PATCH 1/8] Allow more types of titles to be installed - Allow dev apps with special TID to install (0x00030011) - Patch dev titles to be system - Add TwlNmenu to blacklist as it is potentially unsafe. See https://randommeaninglesscharacters.com/dsidev/twlnmenu.html - Allow all region content to be installed - Add all region PictoChat and Download Play to blacklist - Allow different region Launcher to be installed --- arm9/src/install.c | 30 +++++++++++++++++++++++++----- arm9/src/rom.c | 1 + arm9/src/storage.c | 5 +++-- arm9/src/titlemenu.c | 16 +++++++++------- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/arm9/src/install.c b/arm9/src/install.c index 1392ef8..269f07a 100644 --- a/arm9/src/install.c +++ b/arm9/src/install.c @@ -384,9 +384,11 @@ bool install(char* fpath, bool systemTitle) fixHeader = true; //title id must be one of these - if (h->tid_high == 0x00030004 || - h->tid_high == 0x00030005 || - h->tid_high == 0x00030015) + if (h->tid_high == 0x00030004 || // DSiWare + h->tid_high == 0x00030005 || // "unimportant" system titles + h->tid_high == 0x00030011 || // SRLs in the TWL SDK + h->tid_high == 0x00030015 || // system titles + h->tid_high == 0x00030017) // Launcher {} else { @@ -398,10 +400,23 @@ bool install(char* fpath, bool systemTitle) goto error; } + //patch dev titles to system titles on SysNAND. + // + //software released through the TWL SDK usually comes as a TAD and an SRL + //things like NandFiler have a TAD with a TID of 0x00030015 and an SRL with 0x00030011 + //the TAD is the installable version, so I'm assuming that 0x00030015 is what the console wants to see on NAND + //this changes the SRL TID accordingly + //not entirely sure why there's even any difference. I think the installed TAD and SRL the same as each other (minus the TID) + if(!sdnandMode && h->tid_high == 0x00030011) + { + h->tid_high = 0x00030015; + fixHeader = true; + } + //offer to patch system titles to normal DSiWare on SysNAND if(!sdnandMode && h->tid_high != 0x00030004) { - if(choiceBox("This is set as a system title,\nwould you like to patch it to\nbe a normal DSiWare?\n\nThis is safer, but invalidates\nRSA checks and may not work.\n\nIf the title is homebrew this isstrongly recommended.") == YES) + if(choiceBox("This is set as a system/dev\ntitle, would you like to patch\nit to be a normal DSiWare?\n\nThis is safer, but invalidates\nRSA checks and may not work.\n\nIf the title is homebrew this isstrongly recommended.") == YES) { h->tid_high = 0x00030004; fixHeader = true; @@ -430,12 +445,17 @@ bool install(char* fpath, bool systemTitle) tidLow == 0x484e4900 || // Nintendo DSi Camera tidLow == 0x484e4a00 || // Nintendo Zone tidLow == 0x484e4b00 // Nintendo DSi Sound + )) || (h->tid_high == 0x00030011 && ( + tidLow == 0x34544e00 // TwlNmenu (blocking due to -2011 and brick potential) )) || (h->tid_high == 0x00030015 && ( tidLow == 0x484e4200 || // System Settings tidLow == 0x484e4600 // Nintendo DSi Shop + )) || (h->tid_high == 0x00030017 && ( + tidLow == 0x484e4100 // Launcher ))) && ( (h->tid_low & 0xFF) == region || //only blacklist console region - (h->tid_low & 0xFF) == 'A' || //and 'A' (all region) + h->tid_low == 0x484e4541 || //and block specifically international PictoChat + h->tid_low == 0x484e4441 || //and Download Play for good measure region == 0 //if the region check failed somehow, blacklist everything )) { diff --git a/arm9/src/rom.c b/arm9/src/rom.c index 2d20728..fab9ddc 100644 --- a/arm9/src/rom.c +++ b/arm9/src/rom.c @@ -212,6 +212,7 @@ void printRomInfo(char const* fpath) { if (h->tid_high == 0x00030004 || h->tid_high == 0x00030005 || + h->tid_high == 0x00030011 || // TID for software in TWL SDK h->tid_high == 0x00030015 || h->tid_high == 0x00030017 || h->tid_high == 0x00030000) diff --git a/arm9/src/storage.c b/arm9/src/storage.c index a15a31d..827c286 100644 --- a/arm9/src/storage.c +++ b/arm9/src/storage.c @@ -436,11 +436,12 @@ int getMenuSlotsFree() { //Get number of open menu slots by subtracting the number of directories in the title folders //Find a better way to do this - const int NUM_OF_DIRS = 3; + const int NUM_OF_DIRS = 4; const char* dirs[] = { "00030004", "00030005", - "00030015" + "00030015", + "00030017" }; int freeSlots = getMenuSlots(); diff --git a/arm9/src/titlemenu.c b/arm9/src/titlemenu.c index 3b231c3..a367963 100644 --- a/arm9/src/titlemenu.c +++ b/arm9/src/titlemenu.c @@ -88,14 +88,15 @@ static void generateList(Menu* m) { if (!m) return; - const int NUM_OF_DIRS = 3; + const int NUM_OF_DIRS = 4; const char* dirs[] = { "00030004", "00030005", - "00030015" + "00030015", + "00030017" }; - const char* blacklist[3][6] = { + const char* blacklist[4][6] = { { // 00030004 NULL //nothing blacklisted }, @@ -110,6 +111,11 @@ static void generateList(Menu* m) { // 00030015 "484e42", // System Settings "484e46", // Nintendo DSi Shop + "34544e", // TwlNmenu (blocking due to -2011 and brick potential) + NULL + }, + { + "484e41", // Launcher NULL } }; @@ -152,10 +158,6 @@ static void generateList(Menu* m) sprintf(titleId, "%s%02x", blacklist[i][j], region); if (strcmp(titleId, ent->d_name) == 0) blacklisted = true; - - sprintf(titleId, "%s41", blacklist[i][j]); // also blacklist region 'a' - if (strcmp(titleId, ent->d_name) == 0) - blacklisted = true; } if (blacklisted) continue; } From 70869549a97a3d0b279b176f7220915cfb117687 Mon Sep 17 00:00:00 2001 From: rmc Date: Sun, 5 Nov 2023 12:33:43 -0500 Subject: [PATCH 2/8] Add SystemUpdater to blocklist iirc one or two versions of TWL SystemUpdater can fit within the NAND. Definitely block it in case. --- arm9/src/install.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arm9/src/install.c b/arm9/src/install.c index 269f07a..88b1a52 100644 --- a/arm9/src/install.c +++ b/arm9/src/install.c @@ -456,6 +456,7 @@ bool install(char* fpath, bool systemTitle) (h->tid_low & 0xFF) == region || //only blacklist console region h->tid_low == 0x484e4541 || //and block specifically international PictoChat h->tid_low == 0x484e4441 || //and Download Play for good measure + h->tid_low == 0x30535541 || //just to be safe also block sysupdaters. iirc one dos fit in NAND if you've removed some things region == 0 //if the region check failed somehow, blacklist everything )) { From 347371c66a6ddf23c3f3a7df69037b53595d5a24 Mon Sep 17 00:00:00 2001 From: rmc Date: Fri, 24 Nov 2023 16:26:40 -0500 Subject: [PATCH 3/8] Fix home menu error - The home menu cannot be installed as a normal DSiWare title. Only allow it to be installed as a home menu, or a system title. - Fix (hopefully) Download Play, PictoChat, and TwlNmenu from being listed in "Titles" option - Add TWL EVA to install blocklist as it uses `00030011` --- arm9/src/install.c | 24 +++++++++++++++++------- arm9/src/titlemenu.c | 9 +++++++-- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/arm9/src/install.c b/arm9/src/install.c index 88b1a52..c3a7a67 100644 --- a/arm9/src/install.c +++ b/arm9/src/install.c @@ -414,7 +414,7 @@ bool install(char* fpath, bool systemTitle) } //offer to patch system titles to normal DSiWare on SysNAND - if(!sdnandMode && h->tid_high != 0x00030004) + if(!sdnandMode && h->tid_high != 0x00030004 || != 0x00030017) //do not allow patching home menus to be normal DSiWare! This will trigger "ERROR! - 0x0000000000000008 HWINFO_SECURE" on prototype launchers. May also cause issues on the prod versions. { if(choiceBox("This is set as a system/dev\ntitle, would you like to patch\nit to be a normal DSiWare?\n\nThis is safer, but invalidates\nRSA checks and may not work.\n\nIf the title is homebrew this isstrongly recommended.") == YES) { @@ -423,6 +423,16 @@ bool install(char* fpath, bool systemTitle) } } + //offer to patch home menus to be system titles on SysNAND + if(!sdnandMode && h->tid_high == 0x00030017) + { + if(choiceBox("This title is a home menu.\nWould you like to patch it to bea system title?\n\nThis is safer and prevents your\nhome menu from being hidden.") == YES) + { + h->tid_high = 0x00030015; + fixHeader = true; + } + } + //no system titles without Unlaunch if (!unlaunchFound && h->tid_high != 0x00030004) { @@ -445,18 +455,18 @@ bool install(char* fpath, bool systemTitle) tidLow == 0x484e4900 || // Nintendo DSi Camera tidLow == 0x484e4a00 || // Nintendo Zone tidLow == 0x484e4b00 // Nintendo DSi Sound - )) || (h->tid_high == 0x00030011 && ( - tidLow == 0x34544e00 // TwlNmenu (blocking due to -2011 and brick potential) )) || (h->tid_high == 0x00030015 && ( tidLow == 0x484e4200 || // System Settings tidLow == 0x484e4600 // Nintendo DSi Shop )) || (h->tid_high == 0x00030017 && ( tidLow == 0x484e4100 // Launcher ))) && ( - (h->tid_low & 0xFF) == region || //only blacklist console region - h->tid_low == 0x484e4541 || //and block specifically international PictoChat - h->tid_low == 0x484e4441 || //and Download Play for good measure - h->tid_low == 0x30535541 || //just to be safe also block sysupdaters. iirc one dos fit in NAND if you've removed some things + (h->tid_low & 0xFF) == region || // Only blacklist console region, or the following programs that have all-region codes: + h->tid_low == 0x484e4541 || // PictoChat + h->tid_low == 0x484e4441 || // Download Play + h->tid_low == 0x30535541 || // Twl SystemUpdater (iirc one version fits in NAND) + h->tid_low == 0x34544e41 || // TwlNmenu (blocking due to potential to uninstall system titles) + h->tid_low == 0x54574c41 || // TWL EVA region == 0 //if the region check failed somehow, blacklist everything )) { diff --git a/arm9/src/titlemenu.c b/arm9/src/titlemenu.c index a367963..d52aaca 100644 --- a/arm9/src/titlemenu.c +++ b/arm9/src/titlemenu.c @@ -111,10 +111,9 @@ static void generateList(Menu* m) { // 00030015 "484e42", // System Settings "484e46", // Nintendo DSi Shop - "34544e", // TwlNmenu (blocking due to -2011 and brick potential) NULL }, - { + { // 00030017 "484e41", // Launcher NULL } @@ -158,6 +157,12 @@ static void generateList(Menu* m) sprintf(titleId, "%s%02x", blacklist[i][j], region); if (strcmp(titleId, ent->d_name) == 0) blacklisted = true; + + // also blacklist specific all-region titles + if (strcmp("484e4441", ent->d_name) == 0 || // Download Play + ("484e4541", ent->d_name) == 0 || // PictoChat + ("34544e41", ent->d_name) == 0) // TwlNmenu + blacklisted = true; } if (blacklisted) continue; } From 85dff8ccd068ce01dc6f9ee9dfb3ef0fc1fb4a82 Mon Sep 17 00:00:00 2001 From: rmc Date: Fri, 24 Nov 2023 16:37:12 -0500 Subject: [PATCH 4/8] Mistake Can you tell I don't do much programming? lol --- arm9/src/install.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm9/src/install.c b/arm9/src/install.c index c3a7a67..68e6d6b 100644 --- a/arm9/src/install.c +++ b/arm9/src/install.c @@ -414,7 +414,7 @@ bool install(char* fpath, bool systemTitle) } //offer to patch system titles to normal DSiWare on SysNAND - if(!sdnandMode && h->tid_high != 0x00030004 || != 0x00030017) //do not allow patching home menus to be normal DSiWare! This will trigger "ERROR! - 0x0000000000000008 HWINFO_SECURE" on prototype launchers. May also cause issues on the prod versions. + if(!sdnandMode && h->tid_high != 0x00030004 || h->tid_high != 0x00030017) //do not allow patching home menus to be normal DSiWare! This will trigger "ERROR! - 0x0000000000000008 HWINFO_SECURE" on prototype launchers. May also cause issues on the prod versions. { if(choiceBox("This is set as a system/dev\ntitle, would you like to patch\nit to be a normal DSiWare?\n\nThis is safer, but invalidates\nRSA checks and may not work.\n\nIf the title is homebrew this isstrongly recommended.") == YES) { From 939e25758e327b5207d3a6e011aee6d8c14a6d92 Mon Sep 17 00:00:00 2001 From: rmc Date: Fri, 24 Nov 2023 16:55:32 -0500 Subject: [PATCH 5/8] Oh so that's how operators work --- arm9/src/install.c | 7 +++++-- arm9/src/titlemenu.c | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arm9/src/install.c b/arm9/src/install.c index 68e6d6b..767681a 100644 --- a/arm9/src/install.c +++ b/arm9/src/install.c @@ -414,7 +414,7 @@ bool install(char* fpath, bool systemTitle) } //offer to patch system titles to normal DSiWare on SysNAND - if(!sdnandMode && h->tid_high != 0x00030004 || h->tid_high != 0x00030017) //do not allow patching home menus to be normal DSiWare! This will trigger "ERROR! - 0x0000000000000008 HWINFO_SECURE" on prototype launchers. May also cause issues on the prod versions. + if((!sdnandMode && h->tid_high != 0x00030004) && (!sdnandMode && h->tid_high != 0x00030017)) //do not allow patching home menus to be normal DSiWare! This will trigger "ERROR! - 0x0000000000000008 HWINFO_SECURE" on prototype launchers. May also cause issues on the prod versions. { if(choiceBox("This is set as a system/dev\ntitle, would you like to patch\nit to be a normal DSiWare?\n\nThis is safer, but invalidates\nRSA checks and may not work.\n\nIf the title is homebrew this isstrongly recommended.") == YES) { @@ -457,7 +457,10 @@ bool install(char* fpath, bool systemTitle) tidLow == 0x484e4b00 // Nintendo DSi Sound )) || (h->tid_high == 0x00030015 && ( tidLow == 0x484e4200 || // System Settings - tidLow == 0x484e4600 // Nintendo DSi Shop + tidLow == 0x484e4600 || // Nintendo DSi Shop + tidLow == 0x30535500 || // Twl SystemUpdater + tidLow == 0x34544e00 || // TwlNmenu + tidLow == 0x54574c00 // TWL EVA )) || (h->tid_high == 0x00030017 && ( tidLow == 0x484e4100 // Launcher ))) && ( diff --git a/arm9/src/titlemenu.c b/arm9/src/titlemenu.c index d52aaca..cb8d18d 100644 --- a/arm9/src/titlemenu.c +++ b/arm9/src/titlemenu.c @@ -159,9 +159,9 @@ static void generateList(Menu* m) blacklisted = true; // also blacklist specific all-region titles - if (strcmp("484e4441", ent->d_name) == 0 || // Download Play - ("484e4541", ent->d_name) == 0 || // PictoChat - ("34544e41", ent->d_name) == 0) // TwlNmenu + if ((strcmp("484e4441", ent->d_name) == 0) || // Download Play + (strcmp("484e4541", ent->d_name) == 0) || // PictoChat + (strcmp("34544e41", ent->d_name) == 0)) // TwlNmenu blacklisted = true; } if (blacklisted) continue; From 82acb444f2cbff20aa9f44058cf759a9e20f5171 Mon Sep 17 00:00:00 2001 From: rmc Date: Fri, 24 Nov 2023 17:16:46 -0500 Subject: [PATCH 6/8] Final commit, I pinky promise. Sorry for all the commits! I don't know C and don't have devkitarm set up, so I'm guessing and relying on github actions. This should be the final thing though. --- arm9/src/install.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arm9/src/install.c b/arm9/src/install.c index 767681a..a30107d 100644 --- a/arm9/src/install.c +++ b/arm9/src/install.c @@ -455,12 +455,14 @@ bool install(char* fpath, bool systemTitle) tidLow == 0x484e4900 || // Nintendo DSi Camera tidLow == 0x484e4a00 || // Nintendo Zone tidLow == 0x484e4b00 // Nintendo DSi Sound - )) || (h->tid_high == 0x00030015 && ( - tidLow == 0x484e4200 || // System Settings - tidLow == 0x484e4600 || // Nintendo DSi Shop + )) || (h->tid_high == 0x00030011 && ( tidLow == 0x30535500 || // Twl SystemUpdater tidLow == 0x34544e00 || // TwlNmenu tidLow == 0x54574c00 // TWL EVA + )) || (h->tid_high == 0x00030015 && ( + tidLow == 0x484e4200 || // System Settings + tidLow == 0x484e4600 || // Nintendo DSi Shop + tidLow == 0x34544e00 || // TwlNmenu )) || (h->tid_high == 0x00030017 && ( tidLow == 0x484e4100 // Launcher ))) && ( From b835275f1788c49856dc76616bf4a76c40afb757 Mon Sep 17 00:00:00 2001 From: rmc Date: Fri, 24 Nov 2023 17:27:07 -0500 Subject: [PATCH 7/8] Welp, broke that promise pretty damn fast. --- arm9/src/install.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm9/src/install.c b/arm9/src/install.c index a30107d..01670c4 100644 --- a/arm9/src/install.c +++ b/arm9/src/install.c @@ -462,7 +462,7 @@ bool install(char* fpath, bool systemTitle) )) || (h->tid_high == 0x00030015 && ( tidLow == 0x484e4200 || // System Settings tidLow == 0x484e4600 || // Nintendo DSi Shop - tidLow == 0x34544e00 || // TwlNmenu + tidLow == 0x34544e00 // TwlNmenu )) || (h->tid_high == 0x00030017 && ( tidLow == 0x484e4100 // Launcher ))) && ( From 5e6c763c9ecc32ac4b93d271c143d1488da984e4 Mon Sep 17 00:00:00 2001 From: Lillian Skinner <56081713+rvtr@users.noreply.github.com> Date: Sat, 23 Dec 2023 14:22:14 -0500 Subject: [PATCH 8/8] Update arm9/src/install.c Co-authored-by: Pk11 --- arm9/src/install.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm9/src/install.c b/arm9/src/install.c index 01670c4..e9a9dfd 100644 --- a/arm9/src/install.c +++ b/arm9/src/install.c @@ -414,7 +414,7 @@ bool install(char* fpath, bool systemTitle) } //offer to patch system titles to normal DSiWare on SysNAND - if((!sdnandMode && h->tid_high != 0x00030004) && (!sdnandMode && h->tid_high != 0x00030017)) //do not allow patching home menus to be normal DSiWare! This will trigger "ERROR! - 0x0000000000000008 HWINFO_SECURE" on prototype launchers. May also cause issues on the prod versions. + if(!sdnandMode && h->tid_high != 0x00030004 && h->tid_high != 0x00030017) //do not allow patching home menus to be normal DSiWare! This will trigger "ERROR! - 0x0000000000000008 HWINFO_SECURE" on prototype launchers. May also cause issues on the prod versions. { if(choiceBox("This is set as a system/dev\ntitle, would you like to patch\nit to be a normal DSiWare?\n\nThis is safer, but invalidates\nRSA checks and may not work.\n\nIf the title is homebrew this isstrongly recommended.") == YES) {