Nyx: emuMMC Manage window, Tools UI, and misc updates
- Add gui_emu_tools: emuMMC Manage window with correct positioning (LV_PROTECT_PARENT + re-parent to win) - Tools: single SD button (tap = SD partition manager, 3s hold = eMMC) - Remove emuSD from Nyx UI (tabs, UMS, partition manager); keep bootloader emusd - Shorten Create emuMMC description text by one character - Storage/build/config and dependency updates Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2018 naehrwert
|
||||
* Copyright (c) 2018 Rajko Stojadinovic
|
||||
* Copyright (c) 2018-2025 CTCaer
|
||||
* Copyright (c) 2018-2024 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
//! fix the dram stuff and the pop ups
|
||||
|
||||
#include <storage/boot_storage.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -29,10 +30,6 @@
|
||||
#include "../config.h"
|
||||
#include <libs/fatfs/ff.h>
|
||||
|
||||
#define VERIF_STATUS_OK 0
|
||||
#define VERIF_STATUS_ERROR 1
|
||||
#define VERIF_STATUS_ABORT 2
|
||||
|
||||
#define NUM_SECTORS_PER_ITER 8192 // 4MB Cache.
|
||||
#define OUT_FILENAME_SZ 128
|
||||
#define HASH_FILENAME_SZ (OUT_FILENAME_SZ + 11) // 11 == strlen(".sha256sums")
|
||||
@@ -141,7 +138,7 @@ static void _update_filename(char *outFilename, u32 sdPathLen, u32 currPartIdx)
|
||||
itoa(currPartIdx, &outFilename[sdPathLen], 10);
|
||||
}
|
||||
|
||||
static int _emmc_sd_copy_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage, u32 lba_curr, const char *outFilename, const emmc_part_t *part)
|
||||
static int _dump_emmc_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage, u32 lba_curr, const char *outFilename, const emmc_part_t *part)
|
||||
{
|
||||
FIL fp;
|
||||
FIL hashFp;
|
||||
@@ -174,7 +171,7 @@ static int _emmc_sd_copy_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage,
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
return VERIF_STATUS_ERROR;
|
||||
return 1;
|
||||
}
|
||||
|
||||
char chunkSizeAscii[10];
|
||||
@@ -225,11 +222,10 @@ static int _emmc_sd_copy_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage,
|
||||
if (n_cfg.verification == 3)
|
||||
f_close(&hashFp);
|
||||
|
||||
return VERIF_STATUS_ERROR;
|
||||
return 1;
|
||||
}
|
||||
manual_system_maintenance(false);
|
||||
|
||||
se_sha_hash_256_async(hashEm, bufEm, num << 9);
|
||||
se_calc_sha256(hashEm, NULL, bufEm, num << 9, 0, SHA_INIT_HASH, false);
|
||||
|
||||
f_lseek(&fp, (u64)sdFileSector << (u64)9);
|
||||
if (f_read_fast(&fp, bufSd, num << 9))
|
||||
@@ -246,11 +242,11 @@ static int _emmc_sd_copy_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage,
|
||||
if (n_cfg.verification == 3)
|
||||
f_close(&hashFp);
|
||||
|
||||
return VERIF_STATUS_ERROR;
|
||||
return 1;
|
||||
}
|
||||
manual_system_maintenance(false);
|
||||
se_sha_hash_256_finalize(hashEm);
|
||||
se_sha_hash_256_oneshot(hashSd, bufSd, num << 9);
|
||||
se_calc_sha256_finalize(hashEm, NULL);
|
||||
se_calc_sha256_oneshot(hashSd, bufSd, num << 9);
|
||||
res = memcmp(hashEm, hashSd, SE_SHA_256_SIZE / 2);
|
||||
|
||||
if (res)
|
||||
@@ -267,7 +263,7 @@ static int _emmc_sd_copy_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage,
|
||||
if (n_cfg.verification == 3)
|
||||
f_close(&hashFp);
|
||||
|
||||
return VERIF_STATUS_ERROR;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (n_cfg.verification == 3)
|
||||
@@ -307,7 +303,7 @@ static int _emmc_sd_copy_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage,
|
||||
// Check for cancellation combo.
|
||||
if (btn_read_vol() == (BTN_VOL_UP | BTN_VOL_DOWN))
|
||||
{
|
||||
strcpy(gui->txt_buf, "#FFDD00 Verification was cancelled!#\n");
|
||||
s_printf(gui->txt_buf, "#FFDD00 Verification was cancelled!#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -317,7 +313,7 @@ static int _emmc_sd_copy_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage,
|
||||
f_close(&fp);
|
||||
f_close(&hashFp);
|
||||
|
||||
return VERIF_STATUS_ABORT;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
free(clmt);
|
||||
@@ -329,15 +325,15 @@ static int _emmc_sd_copy_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage,
|
||||
lv_label_set_text(gui->label_pct, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
return VERIF_STATUS_OK;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(gui->txt_buf, "\n#FFDD00 File not found or could not be loaded!#\n#FFDD00 Verification failed..#\n");
|
||||
s_printf(gui->txt_buf, "\n#FFDD00 File not found or could not be loaded!#\n#FFDD00 Verification failed..#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
return VERIF_STATUS_ERROR;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,7 +346,6 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
|
||||
|
||||
partial_sd_full_unmount = false;
|
||||
|
||||
u32 verification = n_cfg.verification;
|
||||
u32 multipartSplitSize = (1u << 31);
|
||||
u32 lba_end = part->lba_end;
|
||||
u32 totalSectors = part->lba_end - part->lba_start + 1;
|
||||
@@ -376,7 +371,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
|
||||
_get_valid_partition(§or_start, §or_size, &part_idx, true);
|
||||
if (!part_idx || !sector_size)
|
||||
{
|
||||
strcpy(gui->txt_buf, "\n#FFDD00 Failed to find a partition...#\n");
|
||||
s_printf(gui->txt_buf, "\n#FFDD00 Failed to find a partition...#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -399,7 +394,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
|
||||
|
||||
lv_bar_set_value(gui->bar, 0);
|
||||
lv_label_set_text(gui->label_pct, " "SYMBOL_DOT" 0%");
|
||||
lv_bar_set_style(gui->bar, LV_BAR_STYLE_BG, gui->bar_white_bg);
|
||||
lv_bar_set_style(gui->bar, LV_BAR_STYLE_BG, lv_theme_get_current()->bar.bg);
|
||||
lv_bar_set_style(gui->bar, LV_BAR_STYLE_INDIC, gui->bar_white_ind);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -414,13 +409,13 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
|
||||
{
|
||||
isSmallSdCard = true;
|
||||
|
||||
strcpy(gui->txt_buf, "\n#FFBA00 Free space is smaller than backup size.#\n");
|
||||
s_printf(gui->txt_buf, "\n#FFBA00 Free space is smaller than backup size.#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
if (!maxSplitParts)
|
||||
{
|
||||
strcpy(gui->txt_buf, "#FFDD00 Not enough free space for Partial Backup!#\n");
|
||||
s_printf(gui->txt_buf, "#FFDD00 Not enough free space for Partial Backup!#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -430,7 +425,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
|
||||
// Check if we are continuing a previous raw eMMC or USER partition backup in progress.
|
||||
if (f_open(&partialIdxFp, partialIdxFilename, FA_READ) == FR_OK && totalSectors > (FAT32_FILESIZE_LIMIT / EMMC_BLOCKSIZE))
|
||||
{
|
||||
strcpy(gui->txt_buf, "\n#AEFD14 Partial Backup in progress. Continuing...#\n");
|
||||
s_printf(gui->txt_buf, "\n#AEFD14 Partial Backup in progress. Continuing...#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -443,7 +438,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
|
||||
|
||||
if (!maxSplitParts)
|
||||
{
|
||||
strcpy(gui->txt_buf, "\n#FFDD00 Not enough free space for Partial Backup!#\n");
|
||||
s_printf(gui->txt_buf, "\n#FFDD00 Not enough free space for Partial Backup!#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -541,25 +536,18 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
|
||||
memset(&fp, 0, sizeof(fp));
|
||||
currPartIdx++;
|
||||
|
||||
if (verification && !gui->raw_emummc)
|
||||
if (n_cfg.verification && !gui->raw_emummc)
|
||||
{
|
||||
// Verify part.
|
||||
res = _emmc_sd_copy_verify(gui, storage, lbaStartPart, outFilename, part);
|
||||
switch (res)
|
||||
if (_dump_emmc_verify(gui, storage, lbaStartPart, outFilename, part))
|
||||
{
|
||||
case VERIF_STATUS_OK:
|
||||
break;
|
||||
case VERIF_STATUS_ERROR:
|
||||
strcpy(gui->txt_buf, "\n#FFDD00 Please try again...#\n");
|
||||
s_printf(gui->txt_buf, "#FFDD00 Please try again...#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
return 0;
|
||||
case VERIF_STATUS_ABORT:
|
||||
verification = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
lv_bar_set_style(gui->bar, LV_BAR_STYLE_BG, gui->bar_white_bg);
|
||||
return 0;
|
||||
}
|
||||
lv_bar_set_style(gui->bar, LV_BAR_STYLE_BG, lv_theme_get_current()->bar.bg);
|
||||
lv_bar_set_style(gui->bar, LV_BAR_STYLE_INDIC, gui->bar_white_ind);
|
||||
}
|
||||
|
||||
@@ -576,7 +564,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(gui->txt_buf, "\n#FF0000 Error creating partial.idx file!#\n");
|
||||
s_printf(gui->txt_buf, "\n#FF0000 Error creating partial.idx file!#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -655,7 +643,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
|
||||
msleep(150);
|
||||
if (retryCount >= 3)
|
||||
{
|
||||
strcpy(gui->txt_buf, "#FF0000 Aborting...#\nPlease try again...\n");
|
||||
s_printf(gui->txt_buf, "#FF0000 Aborting...#\nPlease try again...\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -667,7 +655,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(gui->txt_buf, "#FFDD00 Retrying...#\n");
|
||||
s_printf(gui->txt_buf, "#FFDD00 Retrying...#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
}
|
||||
@@ -698,6 +686,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
|
||||
s_printf(gui->txt_buf, " "SYMBOL_DOT" %d%%", pct);
|
||||
lv_label_set_text(gui->label_pct, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
prevPct = pct;
|
||||
}
|
||||
|
||||
@@ -715,7 +704,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
|
||||
// Check for cancellation combo.
|
||||
if (btn_read_vol() == (BTN_VOL_UP | BTN_VOL_DOWN))
|
||||
{
|
||||
strcpy(gui->txt_buf, "\n#FFDD00 The backup was cancelled!#\n");
|
||||
s_printf(gui->txt_buf, "\n#FFDD00 The backup was cancelled!#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -736,12 +725,12 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
|
||||
f_close(&fp);
|
||||
free(clmt);
|
||||
|
||||
if (verification && !gui->raw_emummc)
|
||||
if (n_cfg.verification && !gui->raw_emummc)
|
||||
{
|
||||
// Verify last part or single file backup.
|
||||
if (_emmc_sd_copy_verify(gui, storage, lbaStartPart, outFilename, part) == VERIF_STATUS_ERROR)
|
||||
if (_dump_emmc_verify(gui, storage, lbaStartPart, outFilename, part))
|
||||
{
|
||||
strcpy(gui->txt_buf, "\n#FFDD00 Please try again...#\n");
|
||||
s_printf(gui->txt_buf, "\n#FFDD00 Please try again...#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -781,14 +770,16 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
|
||||
lv_label_set_text(gui->label_info, "Checking for available free space...");
|
||||
manual_system_maintenance(true);
|
||||
|
||||
if (!sd_mount())
|
||||
if (!boot_storage_mount())
|
||||
{
|
||||
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init SD!#");
|
||||
lv_label_set_text(gui->label_info, "#FFDD00 Failed to storage!#");
|
||||
goto out;
|
||||
}
|
||||
|
||||
// Get SD Card free space for Partial Backup.
|
||||
f_getfree("", &sd_fs.free_clst, NULL);
|
||||
FATFS *fs = boot_storage_get_fs();
|
||||
|
||||
f_getfree("", &fs->free_clst, NULL);
|
||||
|
||||
if (!emmc_initialize(false))
|
||||
{
|
||||
@@ -845,9 +836,9 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
|
||||
res = _dump_emmc_part(gui, sdPath, i, &emmc_storage, &bootPart);
|
||||
|
||||
if (!res)
|
||||
strcpy(txt_buf, "#FFDD00 Failed!#\n");
|
||||
s_printf(txt_buf, "#FFDD00 Failed!#\n");
|
||||
else
|
||||
strcpy(txt_buf, "Done!\n");
|
||||
s_printf(txt_buf, "Done!\n");
|
||||
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
@@ -886,12 +877,12 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
|
||||
// If a part failed, don't continue.
|
||||
if (!res)
|
||||
{
|
||||
strcpy(txt_buf, "#FFDD00 Failed!#\n");
|
||||
s_printf(txt_buf, "#FFDD00 Failed!#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
||||
break;
|
||||
}
|
||||
else
|
||||
strcpy(txt_buf, "Done!\n");
|
||||
s_printf(txt_buf, "Done!\n");
|
||||
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
@@ -928,9 +919,9 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
|
||||
res = _dump_emmc_part(gui, sdPath, 2, &emmc_storage, &rawPart);
|
||||
|
||||
if (!res)
|
||||
strcpy(txt_buf, "#FFDD00 Failed!#\n");
|
||||
s_printf(txt_buf, "#FFDD00 Failed!#\n");
|
||||
else
|
||||
strcpy(txt_buf, "Done!\n");
|
||||
s_printf(txt_buf, "Done!\n");
|
||||
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
@@ -954,11 +945,11 @@ out:
|
||||
free(txt_buf);
|
||||
free(gui->base_path);
|
||||
if (!partial_sd_full_unmount)
|
||||
sd_unmount();
|
||||
boot_storage_unmount();
|
||||
else
|
||||
{
|
||||
partial_sd_full_unmount = false;
|
||||
sd_end();
|
||||
boot_storage_end();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -966,7 +957,6 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
|
||||
{
|
||||
static const u32 SECTORS_TO_MIB_COEFF = 11;
|
||||
|
||||
u32 verification = n_cfg.verification;
|
||||
u32 lba_end = part->lba_end;
|
||||
u32 totalSectors = part->lba_end - part->lba_start + 1;
|
||||
u32 currPartIdx = 0;
|
||||
@@ -983,8 +973,8 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
|
||||
|
||||
lv_bar_set_value(gui->bar, 0);
|
||||
lv_label_set_text(gui->label_pct, " "SYMBOL_DOT" 0%");
|
||||
lv_bar_set_style(gui->bar, LV_BAR_STYLE_BG, gui->bar_orange_bg);
|
||||
lv_bar_set_style(gui->bar, LV_BAR_STYLE_INDIC, gui->bar_orange_ind);
|
||||
lv_bar_set_style(gui->bar, LV_BAR_STYLE_BG, lv_theme_get_current()->bar.bg);
|
||||
lv_bar_set_style(gui->bar, LV_BAR_STYLE_INDIC, gui->bar_white_ind);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
bool use_multipart = false;
|
||||
@@ -997,7 +987,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
|
||||
if (f_stat(outFilename, &fno))
|
||||
{
|
||||
// If not, check if there are partial files and the total size matches.
|
||||
strcpy(gui->txt_buf, "\nNo single file, checking for part files...\n");
|
||||
s_printf(gui->txt_buf, "\nNo single file, checking for part files...\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -1023,7 +1013,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
|
||||
|
||||
if ((u32)((u64)totalCheckFileSize >> (u64)9) > totalSectors)
|
||||
{
|
||||
strcpy(gui->txt_buf, "\n#FF8000 Size of SD Card split backup exceeds#\n#FF8000 eMMC's selected part size!#\n#FFDD00 Aborting...#");
|
||||
s_printf(gui->txt_buf, "\n#FF8000 Size of SD Card split backup exceeds#\n#FF8000 eMMC's selected part size!#\n#FFDD00 Aborting...#");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -1045,14 +1035,13 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
|
||||
{
|
||||
// Set new total sectors and lba end sector for percentage calculations.
|
||||
totalSectors = (u32)((u64)totalCheckFileSize >> (u64)9);
|
||||
part->lba_end = totalSectors + part->lba_start - 1;
|
||||
lba_end = part->lba_end;
|
||||
lba_end = totalSectors + part->lba_start - 1;
|
||||
}
|
||||
|
||||
// Restore folder is empty.
|
||||
if (!numSplitParts)
|
||||
{
|
||||
strcpy(gui->txt_buf, "\n#FFDD00 Restore folder is empty.#\n\n");
|
||||
s_printf(gui->txt_buf, "\n#FFDD00 Restore folder is empty.#\n\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -1065,7 +1054,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
|
||||
|
||||
if (check_4MB_aligned && (((u64)fno.fsize) % SZ_4M))
|
||||
{
|
||||
strcpy(gui->txt_buf, "\n#FFDD00 The split file must be a#\n#FFDD00 multiple of 4 MiB.#\n#FFDD00 Aborting...#");
|
||||
s_printf(gui->txt_buf, "\n#FFDD00 The split file must be a#\n#FFDD00 multiple of 4 MiB.#\n#FFDD00 Aborting...#");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -1093,7 +1082,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
|
||||
if (!(btn_wait() & BTN_POWER))
|
||||
{
|
||||
lv_obj_del(warn_mbox_bg);
|
||||
strcpy(gui->txt_buf, "\n#FF0000 Size of SD Card split backup does not match#\n#FF0000 eMMC's selected part size!#\n");
|
||||
s_printf(gui->txt_buf, "\n#FF0000 Size of SD Card split backup does not match#\n#FF0000 eMMC's selected part size!#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -1103,8 +1092,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
|
||||
|
||||
// Set new total sectors and lba end sector for percentage calculations.
|
||||
totalSectors = (u32)((u64)totalCheckFileSize >> (u64)9);
|
||||
part->lba_end = totalSectors + part->lba_start - 1;
|
||||
lba_end = part->lba_end;
|
||||
lba_end = totalSectors + part->lba_start - 1;
|
||||
}
|
||||
use_multipart = true;
|
||||
_update_filename(outFilename, sdPathLen, 0);
|
||||
@@ -1149,7 +1137,7 @@ multipart_not_allowed:
|
||||
{
|
||||
if (((u32)((u64)f_size(&fp) >> (u64)9)) > totalSectors)
|
||||
{
|
||||
strcpy(gui->txt_buf, "\n#FF8000 Size of SD Card backup exceeds#\n#FF8000 eMMC's selected part size!#\n#FFDD00 Aborting...#");
|
||||
s_printf(gui->txt_buf, "\n#FF8000 Size of SD Card backup exceeds#\n#FF8000 eMMC's selected part size!#\n#FFDD00 Aborting...#");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -1168,7 +1156,7 @@ multipart_not_allowed:
|
||||
if (!(btn_wait() & BTN_POWER))
|
||||
{
|
||||
lv_obj_del(warn_mbox_bg);
|
||||
strcpy(gui->txt_buf, "\n#FF0000 Size of the SD Card backup does not match#\n#FF0000 eMMC's selected part size.#\n");
|
||||
s_printf(gui->txt_buf, "\n#FF0000 Size of the SD Card backup does not match#\n#FF0000 eMMC's selected part size.#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -1212,7 +1200,7 @@ multipart_not_allowed:
|
||||
_get_valid_partition(§or_start, §or_size, &part_idx, false);
|
||||
if (!part_idx || !sector_size)
|
||||
{
|
||||
strcpy(gui->txt_buf, "\n#FFDD00 Failed to find a partition...#\n");
|
||||
s_printf(gui->txt_buf, "\n#FFDD00 Failed to find a partition...#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -1234,25 +1222,17 @@ multipart_not_allowed:
|
||||
memset(&fp, 0, sizeof(fp));
|
||||
currPartIdx++;
|
||||
|
||||
if (verification && !gui->raw_emummc)
|
||||
if (n_cfg.verification && !gui->raw_emummc)
|
||||
{
|
||||
// Verify part.
|
||||
res = _emmc_sd_copy_verify(gui, storage, lbaStartPart, outFilename, part);
|
||||
switch (res)
|
||||
if (_dump_emmc_verify(gui, storage, lbaStartPart, outFilename, part))
|
||||
{
|
||||
case VERIF_STATUS_OK:
|
||||
break;
|
||||
case VERIF_STATUS_ERROR:
|
||||
strcpy(gui->txt_buf, "\n#FFDD00 Please try again...#\n");
|
||||
s_printf(gui->txt_buf, "\n#FFDD00 Please try again...#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
return 0;
|
||||
case VERIF_STATUS_ABORT:
|
||||
verification = 0;
|
||||
break;
|
||||
}
|
||||
lv_bar_set_style(gui->bar, LV_BAR_STYLE_BG, gui->bar_orange_bg);
|
||||
lv_bar_set_style(gui->bar, LV_BAR_STYLE_INDIC, gui->bar_orange_ind);
|
||||
}
|
||||
|
||||
_update_filename(outFilename, sdPathLen, currPartIdx);
|
||||
@@ -1320,7 +1300,7 @@ multipart_not_allowed:
|
||||
msleep(150);
|
||||
if (retryCount >= 3)
|
||||
{
|
||||
strcpy(gui->txt_buf, "#FF0000 Aborting...#\n"
|
||||
s_printf(gui->txt_buf, "#FF0000 Aborting...#\n"
|
||||
"#FF0000 This device may be in an inoperative state!#\n"
|
||||
"#FFDD00 Please try again now!#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
@@ -1332,7 +1312,7 @@ multipart_not_allowed:
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(gui->txt_buf, "#FFDD00 Retrying...#\n");
|
||||
s_printf(gui->txt_buf, "#FFDD00 Retrying...#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
}
|
||||
@@ -1364,12 +1344,12 @@ multipart_not_allowed:
|
||||
f_close(&fp);
|
||||
free(clmt);
|
||||
|
||||
if (verification && !gui->raw_emummc)
|
||||
if (n_cfg.verification && !gui->raw_emummc)
|
||||
{
|
||||
// Verify restored data.
|
||||
if (_emmc_sd_copy_verify(gui, storage, lbaStartPart, outFilename, part) == VERIF_STATUS_ERROR)
|
||||
if (_dump_emmc_verify(gui, storage, lbaStartPart, outFilename, part))
|
||||
{
|
||||
strcpy(gui->txt_buf, "\n#FFDD00 Please try again...#\n");
|
||||
s_printf(gui->txt_buf, "#FFDD00 Please try again...#\n");
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
@@ -1394,7 +1374,7 @@ multipart_not_allowed:
|
||||
f_close(&fp_raw);
|
||||
|
||||
s_printf(sdPath, "emuMMC/RAW%d", part_idx);
|
||||
save_emummc_cfg(part_idx, sector_start, sdPath);
|
||||
save_emummc_cfg(part_idx, sector_start, sdPath, DRIVE_SD);
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -1413,18 +1393,12 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
|
||||
|
||||
manual_system_maintenance(true);
|
||||
|
||||
if (!gui->raw_emummc)
|
||||
strcpy(txt_buf, "#FFDD00 This may render the device inoperative!#");
|
||||
else
|
||||
strcpy(txt_buf, "#FFDD00 This may render the emuMMC inoperative!#");
|
||||
strcat(txt_buf, "\n\n#FFDD00 Are you really sure?#");
|
||||
|
||||
if (gui->raw_emummc)
|
||||
strcat(txt_buf, "\n\nOnly the 1st emuMMC found can be restored!");
|
||||
|
||||
s_printf(txt_buf,
|
||||
"#FFDD00 This may render the device inoperative!#\n\n"
|
||||
"#FFDD00 Are you really sure?#");
|
||||
if ((restoreType & PART_BOOT) || (restoreType & PART_GP_ALL))
|
||||
{
|
||||
strcat(txt_buf,
|
||||
s_printf(txt_buf + strlen(txt_buf),
|
||||
"\n\nThe mode you selected will only restore\nthe partitions that it can find.\n"
|
||||
"If it is not found, it will be skipped\nand continue with the next.");
|
||||
}
|
||||
@@ -1513,9 +1487,9 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
|
||||
res = _restore_emmc_part(gui, sdPath, i, &emmc_storage, &bootPart, false);
|
||||
|
||||
if (!res)
|
||||
strcpy(txt_buf, "#FFDD00 Failed!#\n");
|
||||
s_printf(txt_buf, "#FFDD00 Failed!#\n");
|
||||
else if (res > 0)
|
||||
strcpy(txt_buf, "Done!\n");
|
||||
s_printf(txt_buf, "Done!\n");
|
||||
|
||||
if (res >= 0)
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
||||
@@ -1549,9 +1523,9 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
|
||||
res = _restore_emmc_part(gui, sdPath, 0, &emmc_storage, part, false);
|
||||
|
||||
if (!res)
|
||||
strcpy(txt_buf, "#FFDD00 Failed!#\n");
|
||||
s_printf(txt_buf, "#FFDD00 Failed!#\n");
|
||||
else if (res > 0)
|
||||
strcpy(txt_buf, "Done!\n");
|
||||
s_printf(txt_buf, "Done!\n");
|
||||
|
||||
if (res >= 0)
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
||||
@@ -1588,9 +1562,9 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
|
||||
res = _restore_emmc_part(gui, sdPath, 2, &emmc_storage, &rawPart, true);
|
||||
|
||||
if (!res)
|
||||
strcpy(txt_buf, "#FFDD00 Failed!#\n");
|
||||
s_printf(txt_buf, "#FFDD00 Failed!#\n");
|
||||
else if (res > 0)
|
||||
strcpy(txt_buf, "Done!\n");
|
||||
s_printf(txt_buf, "Done!\n");
|
||||
|
||||
if (res >= 0)
|
||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
||||
|
||||
Reference in New Issue
Block a user