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
- 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.

View File

@ -299,12 +299,8 @@ bool install(char* fpath, bool systemTitle)
return false;
}
if(!sdnandMode && !nandio_unlock_writing())
return false;
//start installation
clearScreen(&bottomScreen);
iprintf("Installing %s\n\n", fpath); swiWaitForVBlank();
tDSiHeader* h = getRomHeader(fpath);
@ -327,8 +323,7 @@ bool install(char* fpath, bool systemTitle)
//title id must be one of these
if (h->tid_high == 0x00030004 ||
h->tid_high == 0x00030005 ||
h->tid_high == 0x00030015 ||
h->tid_high == 0x00030017)
h->tid_high == 0x00030015)
{}
else
{
@ -340,6 +335,24 @@ bool install(char* fpath, bool systemTitle)
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
iprintf("Install Size: ");
swiWaitForVBlank();
@ -371,7 +384,7 @@ bool install(char* fpath, bool systemTitle)
{
if (!_checkDsiSpace(installSize))
{
if (choicePrint("Install as system title?"))
if (sdnandMode && choicePrint("Install as system title?"))
{
h->tid_high = 0x00030015;
fixHeader = true;

View File

@ -100,6 +100,7 @@ void installMenu()
break;
case INSTALL_MENU_SYSTEM_TITLE:
if (sdnandMode)
install(m->items[m->cursor].value, true);
break;
@ -247,7 +248,7 @@ static int subMenu()
Menu* m = newMenu();
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, "Back - [B]", NULL, 0);

View File

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