1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-22 11:56:42 +00:00

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_GPIO,
TOOLS_DUMPFIRMWARE,
TOOLS_DUMPUSERSAVE,
TOOLS_DUMP_BOOT
TOOLS_DUMPUSERSAVE
};
extern menu_entry mainmenu_tools[];

View file

@ -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}
};

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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;
}
}