From 0c4be1f917d8cd5e92ce0553c707fcb18926183f Mon Sep 17 00:00:00 2001 From: "Such Meme, Many Skill" Date: Wed, 21 Aug 2019 00:12:26 +0200 Subject: [PATCH] Implement hacky solution to launch firmwaredumper // i swear this shit hates me --- source/meme/main.c | 2 +- source/meme/mainfunctions.c | 27 ++++++++------------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/source/meme/main.c b/source/meme/main.c index 9cf4982..a395fa5 100644 --- a/source/meme/main.c +++ b/source/meme/main.c @@ -91,7 +91,7 @@ void meme_main(){ break; case 3: ret = messagebox("\nThis will dump your firmware to your sd!\nThis might take a while\n\nVol-/+ to cancel\nPower to continue..."); - if (ret == 0) wtf(itemsinfolder, muhbits); + if (ret == 0 && sd_mounted) sdexplorer(itemsinfolder, muhbits, "DumpFirmware"); break; } } diff --git a/source/meme/mainfunctions.c b/source/meme/mainfunctions.c index 3ac8ed5..ed114d1 100644 --- a/source/meme/mainfunctions.c +++ b/source/meme/mainfunctions.c @@ -84,8 +84,6 @@ int dumpfirmware(char *items[], unsigned int *muhbits){ f_mkdir("sd:/tegraexplorer"); f_mkdir("sd:/tegraexplorer/firmware"); - readfolder(items, muhbits, path); - if (f_opendir(&dir, path)) { messagebox("Failed to open directory!"); return -1; @@ -99,19 +97,10 @@ int dumpfirmware(char *items[], unsigned int *muhbits){ f_closedir(&dir); - for (i = 0; i <= foldersize; i++){ + for (i = 0; i < foldersize; i++){ if (muhbits[i] & AM_DIR){ - sprintf(tempnand, "%s/%s", path, items[i]); - if(f_opendir(&dir, tempnand)){ - messagebox("Failure opening folder"); - return -2; - } sprintf(tempnand, "%s/%s/00", path, items[i]); sprintf(tempsd, "%s/%s", sdpath, items[i]); - //messagebox(tempnand); - //dumptosd(tempnand); - //btn_wait(); - //messagebox(tempsd); ret = copy(tempnand, tempsd, 0); if (ret != 0) { messagebox("Copy failed! (infolder)"); @@ -128,22 +117,22 @@ int dumpfirmware(char *items[], unsigned int *muhbits){ return 1; } } - gfx_printf("Copied %d / %d nca files\r", i + 1, foldersize + 1); + gfx_printf("Copied %d / %d nca files\r", i + 1, foldersize); } + messagebox("\nDump completed!\n\nThe firmware dump is located \n in sd:/tegraexplorer/firmware"); return 0; } -void wtf(char *items[], unsigned int *muhbits){ - dumpfirmware(items, muhbits); // DOESNT WORK -} - void sdexplorer(char *items[], unsigned int *muhbits, char *rootpath){ - //dumpfirmware(items, muhbits); // WORKS ?!?!?!?! + if (strcmp(rootpath, "DumpFirmware") == 0){ + dumpfirmware(items, muhbits); + return; + } int value = 1; int copymode = -1; int folderamount = 0; char path[PATHSIZE] = ""; - static char clipboard[PATHSIZE + 1] = ""; + char clipboard[PATHSIZE + 1] = ""; strcpy(path, rootpath); char app[20], rpp[20]; int temp = -1;