diff --git a/source/tegraexplorer/common/common.h b/source/tegraexplorer/common/common.h index b0e97d0..99df700 100644 --- a/source/tegraexplorer/common/common.h +++ b/source/tegraexplorer/common/common.h @@ -59,8 +59,7 @@ enum mainmenu_tools_return { TOOLS_DISPLAY_INFO = 1, TOOLS_DISPLAY_GPIO, TOOLS_DUMPFIRMWARE, - TOOLS_DUMPUSERSAVE, - TOOLS_DUMP_BOOT + TOOLS_DUMPUSERSAVE }; extern menu_entry mainmenu_tools[]; diff --git a/source/tegraexplorer/common/structs.c b/source/tegraexplorer/common/structs.c index 89fc0ff..acb2319 100644 --- a/source/tegraexplorer/common/structs.c +++ b/source/tegraexplorer/common/structs.c @@ -26,8 +26,7 @@ menu_entry mainmenu_tools[] = { {"\nDisplay Console Info", COLOR_GREEN, ISMENU}, {"Display GPIO pins", COLOR_VIOLET, ISMENU}, {"Dump Firmware", COLOR_BLUE, ISMENU}, - {"Dump User Saves", COLOR_YELLOW, ISMENU}, - {"Dump bis", COLOR_ORANGE, ISMENU} + {"Dump User Saves", COLOR_YELLOW, ISMENU} }; menu_entry mainmenu_format[] = { @@ -81,6 +80,7 @@ gpt_entry_rule gpt_fs_rules[] = { menu_entry mmcmenu_start[] = { {"Back", COLOR_ORANGE, ISMENU}, + {"Dump File Partitions", COLOR_ORANGE, ISMENU}, {"Clipboard -> Partition\n", COLOR_ORANGE, ISMENU}, {"BOOT0/1", COLOR_BLUE, isBOOT | ISMENU} }; diff --git a/source/tegraexplorer/emmc/emmcdumpbis.c b/source/tegraexplorer/emmc/emmcdumpbis.c index c11f157..36955dc 100644 --- a/source/tegraexplorer/emmc/emmcdumpbis.c +++ b/source/tegraexplorer/emmc/emmcdumpbis.c @@ -81,6 +81,7 @@ int existsCheck(char *path){ return 1; } +/* int dump_emmc_parts(u16 parts, u8 mmctype){ char *path; char basepath[] = "sd:/tegraexplorer/partition_dumps"; @@ -131,6 +132,7 @@ int dump_emmc_parts(u16 parts, u8 mmctype){ btn_wait(); return 0; } +*/ int emmcDumpBoot(char *basePath){ emmc_part_t bootPart; @@ -152,7 +154,9 @@ int emmcDumpBoot(char *basePath){ if (!existsCheck(path)) continue; + SWAPCOLOR(COLOR_BLUE); gfx_printf("Dumping %s\n", bootPart.name); + RESETCOLOR; dump_emmc_part(path, &storage, &bootPart); free(path); @@ -171,6 +175,9 @@ int emmcDumpSpecific(char *part, char *path){ return 1; } + SWAPCOLOR(COLOR_VIOLET); + gfx_printf("Dumping %s\n", part); + RESETCOLOR; dump_emmc_part(path, &storage, system_part); return 0; diff --git a/source/tegraexplorer/emmc/emmcmenu.c b/source/tegraexplorer/emmc/emmcmenu.c index 2fdf955..2f663a0 100644 --- a/source/tegraexplorer/emmc/emmcmenu.c +++ b/source/tegraexplorer/emmc/emmcmenu.c @@ -77,7 +77,7 @@ void addEntry(emmc_part_t *part, u8 property, int spot){ } int fillMmcMenu(short mmcType){ - int count = 3, i; + int count = 4, i; if (mmcMenuEntries != NULL) clearfileobjects(&mmcMenuEntries); @@ -89,7 +89,7 @@ int fillMmcMenu(short mmcType){ createfileobjects(count, &mmcMenuEntries); - for (i = 0; i < 3; i++){ + for (i = 0; i < 4; i++){ utils_copystring(mmcmenu_start[i].name, &mmcMenuEntries[i].name); mmcMenuEntries[i].property = mmcmenu_start[i].property; mmcMenuEntries[i].storage = mmcmenu_start[i].storage; @@ -127,7 +127,7 @@ int handleEntries(short mmcType, menu_entry part){ res = emmcDumpBoot("sd:/tegraexplorer/partition_dumps"); } else { - gfx_printf("Dumping %s...\n", part.name); + //gfx_printf("Dumping %s...\n", part.name); res = emmcDumpSpecific(part.name, fsutil_getnextloc("sd:/tegraexplorer/partition_dumps", part.name)); } @@ -141,16 +141,19 @@ int handleEntries(short mmcType, menu_entry part){ } emmc_part_t *mmcFindPart(char *path, short mmcType){ - char *filename, *extention; + char *filename, *extention, *path_local; emmc_part_t *part; - filename = strrchr(path, '/') + 1; - extention = strrchr(path, '.'); + + utils_copystring(path, &path_local); + filename = strrchr(path_local, '/') + 1; + extention = strrchr(path_local, '.'); if (extention != NULL) *extention = '\0'; if (checkGptRules(filename)){ gfx_errDisplay("mmcFindPart", ERR_CANNOT_COPY_FILE_TO_FS_PART, 1); + free(path_local); return NULL; } @@ -158,6 +161,7 @@ emmc_part_t *mmcFindPart(char *path, short mmcType){ if (part != NULL){ emummc_storage_set_mmc_partition(&storage, 0); + free(path_local); return part; } @@ -171,12 +175,14 @@ emmc_part_t *mmcFindPart(char *path, short mmcType){ strcpy(part->name, filename); emummc_storage_set_mmc_partition(&storage, (!strcmp(filename, "BOOT0")) ? 1 : 2); + free(path_local); return part; } //gfx_printf("Path: %s\nFilename: %s", path, filename); //btn_wait(); gfx_errDisplay("mmcFindPart", ERR_NO_DESTENATION, 2); + free(path_local); return NULL; } @@ -201,6 +207,22 @@ int makeMmcMenu(short mmcType){ case 0: return 0; case 1: + gfx_clearscreen(); + f_mkdir("sd:/tegraexplorer"); + f_mkdir("sd:/tegraexplorer/partition_dumps"); + + for (int i = 0; i < count; i++){ + if (mmcMenuEntries[i].property & ISMENU || mmcMenuEntries[i].property & ISDIR) + continue; + + //gfx_printf("Dumping %s...\n", mmcMenuEntries[i].name); + emmcDumpSpecific(mmcMenuEntries[i].name, fsutil_getnextloc("sd:/tegraexplorer/partition_dumps", mmcMenuEntries[i].name)); + } + + gfx_printf("\nDone!"); + btn_wait(); + break; + case 2: if (!(clipboardhelper & ISDIR) && (clipboardhelper & OPERATIONCOPY)){ gfx_clearscreen(); if (!mmcFlashFile(clipboard, mmcType)){ @@ -211,7 +233,7 @@ int makeMmcMenu(short mmcType){ } else gfx_errDisplay("mmcMenu", ERR_EMPTY_CLIPBOARD, 0); - break; + break; default: handleEntries(mmcType, mmcMenuEntries[selection]); break; diff --git a/source/tegraexplorer/emmc/emmcoperations.h b/source/tegraexplorer/emmc/emmcoperations.h index 97c49e5..3fed9ae 100644 --- a/source/tegraexplorer/emmc/emmcoperations.h +++ b/source/tegraexplorer/emmc/emmcoperations.h @@ -2,7 +2,6 @@ #include "../../utils/types.h" #include "../../storage/nx_emmc.h" -int dump_emmc_parts(u16 parts, u8 mmctype); int restore_bis_using_file(char *path, u8 mmctype); int emmcDumpSpecific(char *part, char *path); int restore_emmc_part(char *path, sdmmc_storage_t *mmcstorage, emmc_part_t *part); diff --git a/source/tegraexplorer/mainmenu.c b/source/tegraexplorer/mainmenu.c index 3acd1f7..acc8672 100644 --- a/source/tegraexplorer/mainmenu.c +++ b/source/tegraexplorer/mainmenu.c @@ -60,7 +60,7 @@ void MainMenu_MountSD(){ void MainMenu_Tools(){ //res = makemenu(toolsmenu, 8); - res = menu_make(mainmenu_tools, 6, "-- Tools Menu --"); + res = menu_make(mainmenu_tools, 5, "-- Tools Menu --"); switch(res){ case TOOLS_DISPLAY_INFO: @@ -78,9 +78,6 @@ void MainMenu_Tools(){ dumpusersaves(res); break; - case TOOLS_DUMP_BOOT: - dump_emmc_parts(PART_BOOT | PART_PKG2, SYSMMC); - break; } }