diff --git a/source/main.c b/source/main.c index e3c98b7..7efee43 100644 --- a/source/main.c +++ b/source/main.c @@ -347,7 +347,7 @@ void dump_sysnand() { h_cfg.emummc_force_disable = true; b_cfg.extra_cfg &= ~EXTRA_CFG_DUMP_EMUMMC; - dump_keys(); + //dump_keys(); } void dump_emunand() @@ -356,7 +356,7 @@ void dump_emunand() return; emu_cfg.enabled = 1; b_cfg.extra_cfg |= EXTRA_CFG_DUMP_EMUMMC; - dump_keys(); + //dump_keys(); } ment_t ment_top[] = { diff --git a/source/tegraexplorer/fs/filemenu.c b/source/tegraexplorer/fs/filemenu.c index bdb8503..3d35915 100644 --- a/source/tegraexplorer/fs/filemenu.c +++ b/source/tegraexplorer/fs/filemenu.c @@ -47,7 +47,7 @@ void viewbytes(char *path){ return; } - msleep(200); + while (btn_read() & BTN_POWER); while (1){ f_lseek(&in, offset * 16); @@ -143,9 +143,9 @@ int filemenu(menu_entry file){ (attribs.fattrib & AM_ARC) ? 'A' : '-'); } - SETBIT(fs_menu_file[7].property, ISHIDE, !(strstr(file.name, ".bin") != NULL && file.property & ISKB)); - SETBIT(fs_menu_file[8].property, ISHIDE, !(strstr(file.name, ".te") != NULL)); - SETBIT(fs_menu_file[10].property, ISHIDE, !(strstr(file.name, ".bis") != NULL)); + SETBIT(fs_menu_file[7].property, ISHIDE, !(strstr(file.name, ".bin") != NULL && file.property & ISKB) && strstr(file.name, ".rom") == NULL); + SETBIT(fs_menu_file[8].property, ISHIDE, strstr(file.name, ".te") == NULL); + SETBIT(fs_menu_file[10].property, ISHIDE, strstr(file.name, ".bis") == NULL); temp = menu_make(fs_menu_file, 11, "-- File Menu --"); diff --git a/source/tegraexplorer/utils/tools.c b/source/tegraexplorer/utils/tools.c index fc5832d..3ca0135 100644 --- a/source/tegraexplorer/utils/tools.c +++ b/source/tegraexplorer/utils/tools.c @@ -1,3 +1,4 @@ +#include #include "tools.h" #include "../gfx/gfxutils.h" #include "../../libs/fatfs/ff.h" @@ -13,6 +14,9 @@ #include "../emmc/emmc.h" #include "../common/common.h" #include "../fs/fsactions.h" +#include "../fs/fsutils.h" +#include "../../mem/heap.h" +#include "../utils/utils.h" extern bool sd_mount(); extern void sd_unmount(); @@ -96,10 +100,8 @@ int dumpfirmware(int mmc){ FILINFO fno; bool fail = false; int ret, amount = 0; - char path[100] = "emmc:/Contents/registered"; - char sdfolderpath[100] = ""; - char syspath[100] = ""; - char sdpath[100] = ""; + char sysbase[] = "emmc:/Contents/registered"; + char *syspathtemp, *syspath, *sdpath, *sdbase; pkg1_info pkg1 = returnpkg1info(); u32 timer = get_tmr_s(); @@ -109,26 +111,33 @@ int dumpfirmware(int mmc){ gfx_printf("PKG1 version: %d\n", pkg1.ver); - ret = f_mkdir("sd:/tegraexplorer"); - gfx_printf("Creating sd:/tegraexplorer %d\n", ret); + gfx_printf("Creating folders...\n"); + f_mkdir("sd:/tegraexplorer"); + f_mkdir("sd:/tegraexplorer/Firmware"); - ret = f_mkdir("sd:/tegraexplorer/Firmware"); - gfx_printf("Creating sd:/tegraexplorer/Firmware %d\n", ret); + sdbase = calloc(32 + strlen(pkg1.id), sizeof(char)); + sprintf(sdbase, "sd:/tegraexplorer/Firmware/%d (%s)", pkg1.ver, pkg1.id); + gfx_printf("Out: %s\n", sdbase); + f_mkdir(sdbase); - sprintf(sdfolderpath, "sd:/tegraexplorer/Firmware/%d (%s)", pkg1.ver, pkg1.id); - ret = f_mkdir(sdfolderpath); - gfx_printf("Creating %s %d\n", sdfolderpath, ret); + if ((ret = f_opendir(&dir, sysbase))) + fail = true; - ret = f_opendir(&dir, path); - gfx_printf("Result opening system:/ %d\n\n%k", ret, COLOR_GREEN); + gfx_printf("Starting dump...\n"); + SWAPCOLOR(COLOR_GREEN); + + printerrors = 0; while(!f_readdir(&dir, &fno) && fno.fname[0] && !fail){ - sprintf(sdpath, "%s/%s", sdfolderpath, fno.fname); - - if (fno.fattrib & AM_DIR) - sprintf(syspath, "%s/%s/00", path, fno.fname); + utils_copystring(fsutil_getnextloc(sdbase, fno.fname), &sdpath); + utils_copystring(fsutil_getnextloc(sysbase, fno.fname), &syspathtemp); + + if (fno.fattrib & AM_DIR){ + utils_copystring(fsutil_getnextloc(syspathtemp, "00"), &syspath); + free(syspathtemp); + } else - sprintf(syspath, "%s/%s", path, fno.fname); + syspath = syspathtemp; ret = fsact_copy(syspath, sdpath, 0); @@ -136,42 +145,40 @@ int dumpfirmware(int mmc){ if (ret != 0) fail = true; + + free(sdpath); + free(syspath); } + printerrors = 1; + if (fail) gfx_printf("%k\n\nDump failed! Aborting (%d)", COLOR_RED, ret); gfx_printf("%k\n\nPress any button to continue...\nTime taken: %ds", COLOR_WHITE, get_tmr_s() - timer); - + free(sdbase); btn_wait(); return fail; } void dumpusersaves(int mmc){ - int res; - connect_mmc(mmc); mount_mmc("USER", 2); gfx_clearscreen(); - res = f_mkdir("sd:/tegraexplorer"); - gfx_printf("Creating sd:/tegraexplorer, res: %d\nCopying:\n", res); + gfx_printf("Creating folders...\n"); + f_mkdir("sd:/tegraexplorer"); + + gfx_printf("Starting dump...\n"); SWAPCOLOR(COLOR_GREEN); - res = fsact_copy_recursive("emmc:/save", "sd:/tegraexplorer"); - - SWAPCOLOR(COLOR_ORANGE); - gfx_printf("\rResult copy_recursive() %d\n\n", res); - - if (res){ - SWAPCOLOR(COLOR_RED); - gfx_printf("Dump failed!\n"); - } - else - gfx_printf("Saves are located in SD:/tegraexplorer/save\n"); + if(fsact_copy_recursive("emmc:/save", "sd:/tegraexplorer")) + return; + RESETCOLOR; + gfx_printf("\n\nSaves are located in SD:/tegraexplorer/save\n"); gfx_printf("Press any key to continue"); btn_wait(); }