Bugfixes + relocate tools: dump bis

This commit is contained in:
Such Meme, Many Skill
2020-04-05 00:22:23 +02:00
parent 7dc3500a17
commit 070f9c676d
6 changed files with 40 additions and 16 deletions

View File

@@ -59,8 +59,7 @@ enum mainmenu_tools_return {
TOOLS_DISPLAY_INFO = 1, TOOLS_DISPLAY_INFO = 1,
TOOLS_DISPLAY_GPIO, TOOLS_DISPLAY_GPIO,
TOOLS_DUMPFIRMWARE, TOOLS_DUMPFIRMWARE,
TOOLS_DUMPUSERSAVE, TOOLS_DUMPUSERSAVE
TOOLS_DUMP_BOOT
}; };
extern menu_entry mainmenu_tools[]; extern menu_entry mainmenu_tools[];

View File

@@ -26,8 +26,7 @@ menu_entry mainmenu_tools[] = {
{"\nDisplay Console Info", COLOR_GREEN, ISMENU}, {"\nDisplay Console Info", COLOR_GREEN, ISMENU},
{"Display GPIO pins", COLOR_VIOLET, ISMENU}, {"Display GPIO pins", COLOR_VIOLET, ISMENU},
{"Dump Firmware", COLOR_BLUE, ISMENU}, {"Dump Firmware", COLOR_BLUE, ISMENU},
{"Dump User Saves", COLOR_YELLOW, ISMENU}, {"Dump User Saves", COLOR_YELLOW, ISMENU}
{"Dump bis", COLOR_ORANGE, ISMENU}
}; };
menu_entry mainmenu_format[] = { menu_entry mainmenu_format[] = {
@@ -81,6 +80,7 @@ gpt_entry_rule gpt_fs_rules[] = {
menu_entry mmcmenu_start[] = { menu_entry mmcmenu_start[] = {
{"Back", COLOR_ORANGE, ISMENU}, {"Back", COLOR_ORANGE, ISMENU},
{"Dump File Partitions", COLOR_ORANGE, ISMENU},
{"Clipboard -> Partition\n", COLOR_ORANGE, ISMENU}, {"Clipboard -> Partition\n", COLOR_ORANGE, ISMENU},
{"BOOT0/1", COLOR_BLUE, isBOOT | ISMENU} {"BOOT0/1", COLOR_BLUE, isBOOT | ISMENU}
}; };

View File

@@ -81,6 +81,7 @@ int existsCheck(char *path){
return 1; return 1;
} }
/*
int dump_emmc_parts(u16 parts, u8 mmctype){ int dump_emmc_parts(u16 parts, u8 mmctype){
char *path; char *path;
char basepath[] = "sd:/tegraexplorer/partition_dumps"; char basepath[] = "sd:/tegraexplorer/partition_dumps";
@@ -131,6 +132,7 @@ int dump_emmc_parts(u16 parts, u8 mmctype){
btn_wait(); btn_wait();
return 0; return 0;
} }
*/
int emmcDumpBoot(char *basePath){ int emmcDumpBoot(char *basePath){
emmc_part_t bootPart; emmc_part_t bootPart;
@@ -152,7 +154,9 @@ int emmcDumpBoot(char *basePath){
if (!existsCheck(path)) if (!existsCheck(path))
continue; continue;
SWAPCOLOR(COLOR_BLUE);
gfx_printf("Dumping %s\n", bootPart.name); gfx_printf("Dumping %s\n", bootPart.name);
RESETCOLOR;
dump_emmc_part(path, &storage, &bootPart); dump_emmc_part(path, &storage, &bootPart);
free(path); free(path);
@@ -171,6 +175,9 @@ int emmcDumpSpecific(char *part, char *path){
return 1; return 1;
} }
SWAPCOLOR(COLOR_VIOLET);
gfx_printf("Dumping %s\n", part);
RESETCOLOR;
dump_emmc_part(path, &storage, system_part); dump_emmc_part(path, &storage, system_part);
return 0; return 0;

View File

@@ -77,7 +77,7 @@ void addEntry(emmc_part_t *part, u8 property, int spot){
} }
int fillMmcMenu(short mmcType){ int fillMmcMenu(short mmcType){
int count = 3, i; int count = 4, i;
if (mmcMenuEntries != NULL) if (mmcMenuEntries != NULL)
clearfileobjects(&mmcMenuEntries); clearfileobjects(&mmcMenuEntries);
@@ -89,7 +89,7 @@ int fillMmcMenu(short mmcType){
createfileobjects(count, &mmcMenuEntries); createfileobjects(count, &mmcMenuEntries);
for (i = 0; i < 3; i++){ for (i = 0; i < 4; i++){
utils_copystring(mmcmenu_start[i].name, &mmcMenuEntries[i].name); utils_copystring(mmcmenu_start[i].name, &mmcMenuEntries[i].name);
mmcMenuEntries[i].property = mmcmenu_start[i].property; mmcMenuEntries[i].property = mmcmenu_start[i].property;
mmcMenuEntries[i].storage = mmcmenu_start[i].storage; mmcMenuEntries[i].storage = mmcmenu_start[i].storage;
@@ -127,7 +127,7 @@ int handleEntries(short mmcType, menu_entry part){
res = emmcDumpBoot("sd:/tegraexplorer/partition_dumps"); res = emmcDumpBoot("sd:/tegraexplorer/partition_dumps");
} }
else { 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)); 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){ emmc_part_t *mmcFindPart(char *path, short mmcType){
char *filename, *extention; char *filename, *extention, *path_local;
emmc_part_t *part; 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) if (extention != NULL)
*extention = '\0'; *extention = '\0';
if (checkGptRules(filename)){ if (checkGptRules(filename)){
gfx_errDisplay("mmcFindPart", ERR_CANNOT_COPY_FILE_TO_FS_PART, 1); gfx_errDisplay("mmcFindPart", ERR_CANNOT_COPY_FILE_TO_FS_PART, 1);
free(path_local);
return NULL; return NULL;
} }
@@ -158,6 +161,7 @@ emmc_part_t *mmcFindPart(char *path, short mmcType){
if (part != NULL){ if (part != NULL){
emummc_storage_set_mmc_partition(&storage, 0); emummc_storage_set_mmc_partition(&storage, 0);
free(path_local);
return part; return part;
} }
@@ -171,12 +175,14 @@ emmc_part_t *mmcFindPart(char *path, short mmcType){
strcpy(part->name, filename); strcpy(part->name, filename);
emummc_storage_set_mmc_partition(&storage, (!strcmp(filename, "BOOT0")) ? 1 : 2); emummc_storage_set_mmc_partition(&storage, (!strcmp(filename, "BOOT0")) ? 1 : 2);
free(path_local);
return part; return part;
} }
//gfx_printf("Path: %s\nFilename: %s", path, filename); //gfx_printf("Path: %s\nFilename: %s", path, filename);
//btn_wait(); //btn_wait();
gfx_errDisplay("mmcFindPart", ERR_NO_DESTENATION, 2); gfx_errDisplay("mmcFindPart", ERR_NO_DESTENATION, 2);
free(path_local);
return NULL; return NULL;
} }
@@ -201,6 +207,22 @@ int makeMmcMenu(short mmcType){
case 0: case 0:
return 0; return 0;
case 1: 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)){ if (!(clipboardhelper & ISDIR) && (clipboardhelper & OPERATIONCOPY)){
gfx_clearscreen(); gfx_clearscreen();
if (!mmcFlashFile(clipboard, mmcType)){ if (!mmcFlashFile(clipboard, mmcType)){

View File

@@ -2,7 +2,6 @@
#include "../../utils/types.h" #include "../../utils/types.h"
#include "../../storage/nx_emmc.h" #include "../../storage/nx_emmc.h"
int dump_emmc_parts(u16 parts, u8 mmctype);
int restore_bis_using_file(char *path, u8 mmctype); int restore_bis_using_file(char *path, u8 mmctype);
int emmcDumpSpecific(char *part, char *path); int emmcDumpSpecific(char *part, char *path);
int restore_emmc_part(char *path, sdmmc_storage_t *mmcstorage, emmc_part_t *part); int restore_emmc_part(char *path, sdmmc_storage_t *mmcstorage, emmc_part_t *part);

View File

@@ -60,7 +60,7 @@ void MainMenu_MountSD(){
void MainMenu_Tools(){ void MainMenu_Tools(){
//res = makemenu(toolsmenu, 8); //res = makemenu(toolsmenu, 8);
res = menu_make(mainmenu_tools, 6, "-- Tools Menu --"); res = menu_make(mainmenu_tools, 5, "-- Tools Menu --");
switch(res){ switch(res){
case TOOLS_DISPLAY_INFO: case TOOLS_DISPLAY_INFO:
@@ -78,9 +78,6 @@ void MainMenu_Tools(){
dumpusersaves(res); dumpusersaves(res);
break; break;
case TOOLS_DUMP_BOOT:
dump_emmc_parts(PART_BOOT | PART_PKG2, SYSMMC);
break;
} }
} }