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

Fix (not) asking to make sure to flash in scripts

This commit is contained in:
Such Meme, Many Skill 2020-05-08 20:57:26 +02:00
parent 73ca98c6a8
commit 19fe7f15a9
5 changed files with 17 additions and 9 deletions

View file

@ -73,6 +73,7 @@ int ini_parse(link_t *dst, char *ini_path, bool is_dir)
char *filelist = NULL; char *filelist = NULL;
FIL fp; FIL fp;
ini_sec_t *csec = NULL; ini_sec_t *csec = NULL;
bool firstIniRun = true;
char *filename = (char *)malloc(256); char *filename = (char *)malloc(256);
@ -116,10 +117,17 @@ int ini_parse(link_t *dst, char *ini_path, bool is_dir)
do do
{ {
if (firstIniRun){
firstIniRun = false;
strcpy(lbuf, "[Unknown]");
lblen = 9;
}
else {
// Fetch one line. // Fetch one line.
lbuf[0] = 0; lbuf[0] = 0;
f_gets(lbuf, 512, &fp); f_gets(lbuf, 512, &fp);
lblen = strlen(lbuf); lblen = strlen(lbuf);
}
// Remove trailing newline. Depends on 'FF_USE_STRFUNC 2' that removes \r. // Remove trailing newline. Depends on 'FF_USE_STRFUNC 2' that removes \r.
if (lblen && lbuf[lblen - 1] == '\n') if (lblen && lbuf[lblen - 1] == '\n')

View file

@ -159,7 +159,7 @@ int makeMmcMenu(short mmcType){
case 2: case 2:
if (!(clipboardhelper & ISDIR) && (clipboardhelper & OPERATIONCOPY)){ if (!(clipboardhelper & ISDIR) && (clipboardhelper & OPERATIONCOPY)){
gfx_clearscreen(); gfx_clearscreen();
if (!mmcFlashFile(clipboard, mmcType)){ if (!mmcFlashFile(clipboard, mmcType, true)){
gfx_printf("\nDone!"); gfx_printf("\nDone!");
hidWait(); hidWait();
} }

View file

@ -4,7 +4,7 @@
int emmcDumpSpecific(char *part, char *path); int emmcDumpSpecific(char *part, char *path);
int emmcDumpBoot(char *basePath); int emmcDumpBoot(char *basePath);
int mmcFlashFile(char *path, short mmcType); int mmcFlashFile(char *path, short mmcType, bool warnings);
int emmcDumpPart(char *path, sdmmc_storage_t *mmcstorage, emmc_part_t *part); int emmcDumpPart(char *path, sdmmc_storage_t *mmcstorage, emmc_part_t *part);
int emmcRestorePart(char *path, sdmmc_storage_t *mmcstorage, emmc_part_t *part); int emmcRestorePart(char *path, sdmmc_storage_t *mmcstorage, emmc_part_t *part, bool warnings);

View file

@ -17,7 +17,7 @@
extern sdmmc_storage_t storage; extern sdmmc_storage_t storage;
extern emmc_part_t *system_part; extern emmc_part_t *system_part;
int emmcRestorePart(char *path, sdmmc_storage_t *mmcstorage, emmc_part_t *part){ int emmcRestorePart(char *path, sdmmc_storage_t *mmcstorage, emmc_part_t *part, bool warnings){
FIL fp; FIL fp;
FILINFO fno; FILINFO fno;
u8 *buf; u8 *buf;
@ -54,10 +54,10 @@ int emmcRestorePart(char *path, sdmmc_storage_t *mmcstorage, emmc_part_t *part){
gfx_printf("Flashing %s\n", part->name); gfx_printf("Flashing %s\n", part->name);
if (totalSize < totalSizeDest){ if (totalSize < totalSizeDest && warnings){
SWAPCOLOR(COLOR_ORANGE); SWAPCOLOR(COLOR_ORANGE);
gfx_printf("File is too small for destination.\nDo you want to flash it anyway?\n\nB to Cancel\n"); gfx_printf("File is too small for destination.\nDo you want to flash it anyway?\n\nB to Cancel\n");
u8 btnres = gfx_makewaitmenu( u32 btnres = gfx_makewaitmenu(
"A to Confirm", "A to Confirm",
3 3
); );
@ -214,13 +214,13 @@ emmc_part_t *mmcFindPart(char *path, short mmcType){
return NULL; return NULL;
} }
int mmcFlashFile(char *path, short mmcType){ int mmcFlashFile(char *path, short mmcType, bool warnings){
emmc_part_t *part; emmc_part_t *part;
int res; int res;
part = mmcFindPart(path, mmcType); part = mmcFindPart(path, mmcType);
if (part != NULL){ if (part != NULL){
res = emmcRestorePart(path, &storage, part); res = emmcRestorePart(path, &storage, part, warnings);
emummc_storage_set_mmc_partition(&storage, 0); emummc_storage_set_mmc_partition(&storage, 0);
return res; return res;
} }

View file

@ -524,7 +524,7 @@ int part_mmc_restorePart(){
if (currentlyMounted < 0) if (currentlyMounted < 0)
return -1; return -1;
return mmcFlashFile(path, currentlyMounted); return mmcFlashFile(path, currentlyMounted, false);
} }
int part_fs_extractBisFile(){ int part_fs_extractBisFile(){