Skip to content

Commit

Permalink
TADs now install!
Browse files Browse the repository at this point in the history
  • Loading branch information
rvtr committed Apr 2, 2024
1 parent aea4371 commit 6786ee2
Show file tree
Hide file tree
Showing 12 changed files with 186 additions and 221 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export TOPDIR := $(CURDIR)
NITRO_FILES :=

# These set the information text in the nds file
GAME_TITLE := NAND Title Manager
GAME_SUBTITLE1 := JeffRuLz, Pk11
GAME_TITLE := TAD Delivery Tool
GAME_SUBTITLE1 := JeffRuLz, Pk11, rmc

GAME_CODE := HTNA
GAME_LABEL := NANDTM_TAD
GAME_CODE := 4TDA
GAME_LABEL := TAD_DELIVERY

include $(DEVKITARM)/ds_rules

Expand Down
7 changes: 1 addition & 6 deletions arm9/src/backupmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,7 @@ static void generateList(Menu* m)
}
else
{
if (strcasecmp(strrchr(ent->d_name, '.'), ".nds") == 0 ||
strcasecmp(strrchr(ent->d_name, '.'), ".app") == 0 ||
strcasecmp(strrchr(ent->d_name, '.'), ".dsi") == 0 ||
strcasecmp(strrchr(ent->d_name, '.'), ".ids") == 0 ||
strcasecmp(strrchr(ent->d_name, '.'), ".srl") == 0 ||
strcasecmp(strrchr(ent->d_name, '.'), ".cia") == 0)
if (strcasecmp(strrchr(ent->d_name, '.'), ".tad") == 0)
{
if (count < m->page * ITEMS_PER_PAGE)
count += 1;
Expand Down
11 changes: 3 additions & 8 deletions arm9/src/install.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ static void _createTicket(tDSiHeader *h, char* ticketPath)
}
}

bool install(char* fpath, bool systemTitle)
bool install(char* tadPath, bool systemTitle)
{
bool result = false;

Expand All @@ -365,6 +365,7 @@ bool install(char* fpath, bool systemTitle)

//start installation
clearScreen(&bottomScreen);
char* fpath = decryptTad(tadPath);

tDSiHeader* h = getRomHeader(fpath);

Expand Down Expand Up @@ -694,13 +695,7 @@ bool install(char* fpath, bool systemTitle)
{
int result = 0;

if (romIsCia(fpath)) {
result = copyFilePart(fpath, 0x3900, fileSize, appPath);
} else if (romIsTad(fpath)) {
result = decryptTad(fpath);
} else {
result = copyFile(fpath, appPath);
}
result = copyFile(fpath, appPath);

if (result != 0)
{
Expand Down
10 changes: 2 additions & 8 deletions arm9/src/installmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,7 @@ static void generateList(Menu* m)
}
else
{
if (strcasecmp(strrchr(ent->d_name, '.'), ".nds") == 0 ||
strcasecmp(strrchr(ent->d_name, '.'), ".app") == 0 ||
strcasecmp(strrchr(ent->d_name, '.'), ".dsi") == 0 ||
strcasecmp(strrchr(ent->d_name, '.'), ".ids") == 0 ||
strcasecmp(strrchr(ent->d_name, '.'), ".srl") == 0 ||
strcasecmp(strrchr(ent->d_name, '.'), ".tad") == 0 ||
strcasecmp(strrchr(ent->d_name, '.'), ".cia") == 0)
if (strcasecmp(strrchr(ent->d_name, '.'), ".tad") == 0)
{
if (count < m->page * ITEMS_PER_PAGE)
count += 1;
Expand Down Expand Up @@ -238,7 +232,7 @@ static void printItem(Menu* m)
if (m->items[m->cursor].directory)
clearScreen(&topScreen);
else
printRomInfo(m->items[m->cursor].value);
printTadInfo(m->items[m->cursor].value);
}

static int subMenu()
Expand Down
60 changes: 10 additions & 50 deletions arm9/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ bool programEnd = false;
bool sdnandMode = true;
bool unlaunchFound = false;
bool unlaunchPatches = false;
bool devkpFound = false;
bool launcherDSiFound = false;
bool arm7Exiting = false;
bool charging = false;
u8 batteryLevel = 0;
Expand Down Expand Up @@ -57,32 +55,30 @@ static int _mainMenu(int cursor)
//top screen
clearScreen(&topScreen);

iprintf("\t\tNAND Title Manager\n");
iprintf("\t\tTAD Delivery Tool\n");
iprintf("\t\t\tmodified from\n");
iprintf("\tTitle Manager for HiyaCFW\n");
iprintf("\tand Nand Title Manager\n");
iprintf("\nversion %s\n", VERSION);
iprintf("\n\n\x1B[41mWARNING:\x1B[47m This tool can write to\nyour internal NAND!\n\nThis always has a risk, albeit\nlow, of \x1B[41mbricking\x1B[47m your system\nand should be done with caution!\n");
iprintf("\n\t \x1B[46mhttps://dsi.cfw.guide\x1B[47m\n");
iprintf("\n\n \x1B[46mgithub.com/Epicpkmn11/NTM/wiki\x1B[47m\n");
iprintf("\n\n \x1B[46mgithub.com/rvtr/TDT\x1B[47m\n");
iprintf("\x1b[22;0HJeff - 2018-2019");
iprintf("\x1b[23;0HPk11 - 2022-2023");
iprintf("\x1b[24;0Hrmc - 2024-2024");

//menu
Menu* m = newMenu();
setMenuHeader(m, "MAIN MENU");

char modeStr[32], datamanStr[32], launcherStr[32];
char modeStr[32];
sprintf(modeStr, "Mode: %s", sdnandMode ? "SDNAND" : "\x1B[41mSysNAND\x1B[47m");
sprintf(datamanStr, "\x1B[%02omEnable Data Management", devkpFound ? 037 : 047);
sprintf(launcherStr, "\x1B[%02omUninstall region mod", launcherDSiFound ? 047 : 037);
addMenuItem(m, modeStr, NULL, 0);
addMenuItem(m, "Install", NULL, 0);
addMenuItem(m, "Titles", NULL, 0);
addMenuItem(m, "Restore", NULL, 0);
//addMenuItem(m, "Restore", NULL, 0);
addMenuItem(m, "Test", NULL, 0);
addMenuItem(m, "Fix FAT copy mismatch", NULL, 0);
addMenuItem(m, datamanStr, NULL, 0);
addMenuItem(m, launcherStr, NULL, 0);
addMenuItem(m, "\x1B[47mExit", NULL, 0);

m->cursor = cursor;
Expand Down Expand Up @@ -207,19 +203,13 @@ int main(int argc, char **argv)
}
else if (!unlaunchPatches)
{
messageBox("Unlaunch's Launcher Patches are\nnot enabled. You will need to\nprovide TMD files or reinstall.\n\n\x1B[46mhttps://dsi.cfw.guide/\x1B[47m");
messageBox("Unlaunch's Launcher Patches are\nnot enabled. You will need these\nif you patch any TADs.\n\n\x1B[46mhttps://dsi.cfw.guide/\x1B[47m");
}
}

//check for dev.kp (Data Management visible)
devkpFound = (access("sd:/sys/dev.kp", F_OK) == 0);

//check for launcher.dsi (Language patcher)
launcherDSiFound = (access("nand:/launcher.dsi", F_OK) == 0);

messageBox("\x1B[41mWARNING:\x1B[47m This tool can write to\nyour internal NAND!\n\nThis always has a risk, albeit\nlow, of \x1B[41mbricking\x1B[47m your system\nand should be done with caution!\n\nIf you have not yet done so,\nyou should make a NAND backup.");

messageBox("If you are following a video\nguide, please stop.\n\nVideo guides for console moddingare often outdated or straight\nup incorrect to begin with.\n\nThe recommended guide for\nmodding your DSi is:\n\n\x1B[46mhttps://dsi.cfw.guide/\x1B[47m\n\nFor more information on using\nNTM, see the official wiki:\n\n\x1B[46mhttps://github.com/Epicpkmn11/\n\t\t\t\t\t\t\t\tNTM/wiki\x1B[47m");
messageBox("If you are following a video\nguide, please stop.\n\nVideo guides for console moddingare often outdated or straight\nup incorrect to begin with.\n\nThe recommended guide for\nmodding your DSi is:\n\n\x1B[46mhttps://dsi.cfw.guide/\x1B[47m\n\nFor more information on using\nTDT, see the official repo:\n\n\x1B[46mhttps://github.com/rvtr/TDT\x1B[47m");
//main menu
int cursor = 0;

Expand All @@ -231,7 +221,6 @@ int main(int argc, char **argv)
{
case MAIN_MENU_MODE:
sdnandMode = !sdnandMode;
devkpFound = (access(sdnandMode ? "sd:/sys/dev.kp" : "nand:/sys/dev.kp", F_OK) == 0);
break;

case MAIN_MENU_INSTALL:
Expand All @@ -241,11 +230,11 @@ int main(int argc, char **argv)
case MAIN_MENU_TITLES:
titleMenu();
break;

/*
case MAIN_MENU_BACKUP:
backupMenu();
break;

*/
case MAIN_MENU_TEST:
testMenu();
break;
Expand All @@ -259,35 +248,6 @@ int main(int argc, char **argv)
}
break;

case MAIN_MENU_DATA_MANAGEMENT:
if (!devkpFound && (choiceBox("Make Data Management visible\nin System Settings?") == YES) && (sdnandMode || nandio_unlock_writing()))
{
//ensure sys folder exists
if(access(sdnandMode ? "sd:/sys" : "nand:/sys", F_OK) != 0)
mkdir(sdnandMode ? "sd:/sys" : "nand:/sys", 0777);

//create empty file
FILE *file = fopen(sdnandMode ? "sd:/sys/dev.kp" : "nand:/sys/dev.kp", "wb");
fclose(file);

if(!sdnandMode)
nandio_lock_writing();
devkpFound = (access(sdnandMode ? "sd:/sys/dev.kp" : "nand:/sys/dev.kp", F_OK) == 0);
messageBox("Data Management is now visible\nin System Settings.\n");
}
break;
case MAIN_MENU_LANGUAGE_PATCHER:
if (launcherDSiFound && (choiceBox("Uninstall the language patched\nDSi Menu? (launcher.dsi)") == YES) && nandio_unlock_writing())
{
//delete launcher.dsi
remove("nand:/launcher.dsi");

nandio_lock_writing();
launcherDSiFound = (access("nand:/launcher.dsi", F_OK) == 0);
messageBox("The language patched DSi Menu\nhas been removed.\n");
}
break;

case MAIN_MENU_EXIT:
programEnd = true;
break;
Expand Down
Loading

0 comments on commit 6786ee2

Please sign in to comment.