Block messing with system titles on SysNAND

This commit is contained in:
Pk11 2022-01-09 20:05:07 -06:00
parent e75e230b23
commit 643bc4143c
4 changed files with 30 additions and 12 deletions

View File

@ -9,7 +9,7 @@ This has *barely* been tested and should be used with *extreme caution*. Please
## Features ## Features
- Install DSiWare and homebrew onto your hiyaCFW SDNAND and SysNAND DSi Menus. - Install DSiWare and homebrew onto your hiyaCFW SDNAND and SysNAND DSi Menus.
- Delete system titles and others hidden from Data Management. - Delete system titles and others hidden from Data Management on SDNAND.
- Backup and restore installed titles. - Backup and restore installed titles.

View File

@ -299,12 +299,8 @@ bool install(char* fpath, bool systemTitle)
return false; return false;
} }
if(!sdnandMode && !nandio_unlock_writing())
return false;
//start installation //start installation
clearScreen(&bottomScreen); clearScreen(&bottomScreen);
iprintf("Installing %s\n\n", fpath); swiWaitForVBlank();
tDSiHeader* h = getRomHeader(fpath); tDSiHeader* h = getRomHeader(fpath);
@ -327,8 +323,7 @@ bool install(char* fpath, bool systemTitle)
//title id must be one of these //title id must be one of these
if (h->tid_high == 0x00030004 || if (h->tid_high == 0x00030004 ||
h->tid_high == 0x00030005 || h->tid_high == 0x00030005 ||
h->tid_high == 0x00030015 || h->tid_high == 0x00030015)
h->tid_high == 0x00030017)
{} {}
else else
{ {
@ -340,6 +335,24 @@ bool install(char* fpath, bool systemTitle)
goto error; goto error;
} }
if (!sdnandMode &&
(h->tid_high == 0x00030005 ||
h->tid_high == 0x00030015))
{
iprintf("\x1B[31m"); //red
iprintf("Error: ");
iprintf("\x1B[33m"); //yellow
iprintf("This title cannot be\ninstalled to SysNAND.\n");
iprintf("\x1B[47m"); //white
goto error;
}
if(!sdnandMode && !nandio_unlock_writing())
return false;
clearScreen(&bottomScreen);
iprintf("Installing %s\n\n", fpath); swiWaitForVBlank();
//get install size //get install size
iprintf("Install Size: "); iprintf("Install Size: ");
swiWaitForVBlank(); swiWaitForVBlank();
@ -371,7 +384,7 @@ bool install(char* fpath, bool systemTitle)
{ {
if (!_checkDsiSpace(installSize)) if (!_checkDsiSpace(installSize))
{ {
if (choicePrint("Install as system title?")) if (sdnandMode && choicePrint("Install as system title?"))
{ {
h->tid_high = 0x00030015; h->tid_high = 0x00030015;
fixHeader = true; fixHeader = true;

View File

@ -100,7 +100,8 @@ void installMenu()
break; break;
case INSTALL_MENU_SYSTEM_TITLE: case INSTALL_MENU_SYSTEM_TITLE:
install(m->items[m->cursor].value, true); if (sdnandMode)
install(m->items[m->cursor].value, true);
break; break;
case INSTALL_MENU_DELETE: case INSTALL_MENU_DELETE:
@ -247,7 +248,7 @@ static int subMenu()
Menu* m = newMenu(); Menu* m = newMenu();
addMenuItem(m, "Install", NULL, 0); addMenuItem(m, "Install", NULL, 0);
addMenuItem(m, "Install as System Title", NULL, 0); addMenuItem(m, sdnandMode ? "Install as System Title" : "\x1B[37m[Disabled]\x1B[47m", NULL, 0);
addMenuItem(m, "Delete", NULL, 0); addMenuItem(m, "Delete", NULL, 0);
addMenuItem(m, "Back - [B]", NULL, 0); addMenuItem(m, "Back - [B]", NULL, 0);

View File

@ -79,12 +79,16 @@ static void generateList(Menu* m)
{ {
if (!m) return; if (!m) return;
const int NUM_OF_DIRS = 3; const int NUM_OF_DIRS = sdnandMode ? 3 : 1;
const char* dirs[] = { const char* sdnandDirs[] = {
"00030004", "00030004",
"00030005", "00030005",
"00030015" "00030015"
}; };
const char* nandDirs[] = {
"00030004"
};
const char** dirs = sdnandMode ? sdnandDirs : nandDirs;
//Reset menu //Reset menu
clearMenu(m); clearMenu(m);