add partition flashing
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "emmcfile.h"
|
||||
#include <storage/nx_sd.h>
|
||||
#include "../fs/fsutils.h"
|
||||
#include "../utils/utils.h"
|
||||
|
||||
MenuEntry_t GptMenuHeader[] = {
|
||||
{.optionUnion = COLORTORGB(COLOR_ORANGE), .name = "<- Back"},
|
||||
@@ -33,6 +34,8 @@ void GptMenu(u8 MMCType){
|
||||
if (connectMMC(MMCType))
|
||||
return;
|
||||
|
||||
GptMenuHeader[1].optionUnion = (TConf.explorerCopyMode == CMODE_Copy) ? (COLORTORGB(COLOR_ORANGE)) : (COLORTORGB(COLOR_GREY) | SKIPBIT);
|
||||
|
||||
Vector_t GptMenu = newVec(sizeof(MenuEntry_t), 15);
|
||||
GptMenu.count = ARR_LEN(GptMenuHeader);
|
||||
memcpy(GptMenu.data, GptMenuHeader, sizeof(MenuEntry_t) * ARR_LEN(GptMenuHeader));
|
||||
@@ -74,9 +77,40 @@ void GptMenu(u8 MMCType){
|
||||
|
||||
res = newMenu(&GptMenu, res, 40, 20, ALWAYSREDRAW | ENABLEB, GptMenu.count);
|
||||
|
||||
if (res < 2){
|
||||
if (res < 1){
|
||||
break;
|
||||
}
|
||||
else if (res == 1){
|
||||
gfx_clearscreen();
|
||||
char *fileName = CpyStr(strrchr(TConf.srcCopy, '/') + 1);
|
||||
|
||||
for (int i = 0; i < strlen(fileName); i++){
|
||||
if (fileName[i] >= 'a' && fileName[i] <= 'z')
|
||||
fileName[i] &= ~BIT(5);
|
||||
}
|
||||
|
||||
gfx_printf("Are you sure you want to flash %s? ", fileName);
|
||||
if (MakeYesNoHorzMenu(3, COLOR_DEFAULT)){
|
||||
RESETCOLOR;
|
||||
gfx_printf("\nFlashing %s... ", fileName);
|
||||
ErrCode_t a = DumpOrWriteEmmcPart(TConf.srcCopy, fileName, 1, 0);
|
||||
if (a.err){
|
||||
if (a.err == TE_WARN_FILE_TOO_SMALL_FOR_DEST){
|
||||
gfx_printf("\r%s is too small for the destination. Flash anyway? ", fileName);
|
||||
if (MakeYesNoHorzMenu(3, COLOR_DEFAULT)){
|
||||
RESETCOLOR;
|
||||
gfx_printf("\nFlashing %s... ", fileName);
|
||||
a = DumpOrWriteEmmcPart(TConf.srcCopy, fileName, 1, 1);
|
||||
}
|
||||
else {
|
||||
a.err = 0;
|
||||
}
|
||||
}
|
||||
DrawError(a);
|
||||
}
|
||||
}
|
||||
free(fileName);
|
||||
}
|
||||
else if (entries[res].icon == 127){
|
||||
unmountMMCPart();
|
||||
ErrCode_t err = mountMMCPart(entries[res].name);
|
||||
@@ -107,9 +141,21 @@ void GptMenu(u8 MMCType){
|
||||
|
||||
char *path = CombinePaths("sd:/tegraexplorer/Dumps", entries[res].name);
|
||||
|
||||
ErrCode_t a = DumpEmmcPart(path, entries[res].name);
|
||||
if (a.err)
|
||||
ErrCode_t a = DumpOrWriteEmmcPart(path, entries[res].name, 0, 0);
|
||||
if (a.err){
|
||||
if (a.err == TE_WARN_FILE_EXISTS){
|
||||
gfx_printf("\rDest file for %s exists already. Overwrite? ", entries[res].name);
|
||||
if (MakeYesNoHorzMenu(3, COLOR_DEFAULT)){
|
||||
RESETCOLOR;
|
||||
gfx_printf("\nDumping %s... ", entries[res].name);
|
||||
a = DumpOrWriteEmmcPart(path, entries[res].name, 0, 1);
|
||||
}
|
||||
else {
|
||||
a.err = 0;
|
||||
}
|
||||
}
|
||||
DrawError(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user