From 91e2f6d9db99d7ab1c15d1295c1ff315676124dc Mon Sep 17 00:00:00 2001 From: CTCaer Date: Wed, 27 Aug 2025 15:56:04 +0300 Subject: [PATCH] nyx: backup/restore UX improvements - Fix the verification % and bar if restored backup is smaller than partition - Use orange bar for restoring when writing to eMMC/emuMMC. - Fix bar color on restoring after verification - Allow verification to be aborted for all parts in partial mode (FAT32 or small card) --- nyx/nyx_gui/frontend/fe_emmc_tools.c | 150 +++++++++++++++----------- nyx/nyx_gui/frontend/gui.h | 3 + nyx/nyx_gui/frontend/gui_emmc_tools.c | 15 ++- 3 files changed, 102 insertions(+), 66 deletions(-) diff --git a/nyx/nyx_gui/frontend/fe_emmc_tools.c b/nyx/nyx_gui/frontend/fe_emmc_tools.c index 8478a79a..fa323776 100644 --- a/nyx/nyx_gui/frontend/fe_emmc_tools.c +++ b/nyx/nyx_gui/frontend/fe_emmc_tools.c @@ -29,6 +29,10 @@ #include "../config.h" #include +#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") @@ -137,7 +141,7 @@ static void _update_filename(char *outFilename, u32 sdPathLen, u32 currPartIdx) itoa(currPartIdx, &outFilename[sdPathLen], 10); } -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) +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) { FIL fp; FIL hashFp; @@ -170,7 +174,7 @@ static int _dump_emmc_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage, u32 lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf); manual_system_maintenance(true); - return 1; + return VERIF_STATUS_ERROR; } char chunkSizeAscii[10]; @@ -221,7 +225,7 @@ static int _dump_emmc_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage, u32 if (n_cfg.verification == 3) f_close(&hashFp); - return 1; + return VERIF_STATUS_ERROR; } manual_system_maintenance(false); se_calc_sha256(hashEm, NULL, bufEm, num << 9, 0, SHA_INIT_HASH, false); @@ -241,7 +245,7 @@ static int _dump_emmc_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage, u32 if (n_cfg.verification == 3) f_close(&hashFp); - return 1; + return VERIF_STATUS_ERROR; } manual_system_maintenance(false); se_calc_sha256_finalize(hashEm, NULL); @@ -262,7 +266,7 @@ static int _dump_emmc_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage, u32 if (n_cfg.verification == 3) f_close(&hashFp); - return 1; + return VERIF_STATUS_ERROR; } if (n_cfg.verification == 3) @@ -302,7 +306,7 @@ static int _dump_emmc_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage, u32 // Check for cancellation combo. if (btn_read_vol() == (BTN_VOL_UP | BTN_VOL_DOWN)) { - s_printf(gui->txt_buf, "#FFDD00 Verification was cancelled!#\n"); + strcpy(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); @@ -312,7 +316,7 @@ static int _dump_emmc_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage, u32 f_close(&fp); f_close(&hashFp); - return 0; + return VERIF_STATUS_ABORT; } } free(clmt); @@ -324,15 +328,15 @@ static int _dump_emmc_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage, u32 lv_label_set_text(gui->label_pct, gui->txt_buf); manual_system_maintenance(true); - return 0; + return VERIF_STATUS_OK; } else { - s_printf(gui->txt_buf, "\n#FFDD00 File not found or could not be loaded!#\n#FFDD00 Verification failed..#\n"); + strcpy(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 1; + return VERIF_STATUS_ERROR; } } @@ -345,6 +349,7 @@ 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; @@ -370,7 +375,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) { - s_printf(gui->txt_buf, "\n#FFDD00 Failed to find a partition...#\n"); + strcpy(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); @@ -393,7 +398,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, lv_theme_get_current()->bar.bg); + lv_bar_set_style(gui->bar, LV_BAR_STYLE_BG, gui->bar_white_bg); lv_bar_set_style(gui->bar, LV_BAR_STYLE_INDIC, gui->bar_white_ind); manual_system_maintenance(true); @@ -408,13 +413,13 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part, { isSmallSdCard = true; - s_printf(gui->txt_buf, "\n#FFBA00 Free space is smaller than backup size.#\n"); + strcpy(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) { - s_printf(gui->txt_buf, "#FFDD00 Not enough free space for Partial Backup!#\n"); + strcpy(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); @@ -424,7 +429,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)) { - s_printf(gui->txt_buf, "\n#AEFD14 Partial Backup in progress. Continuing...#\n"); + strcpy(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); @@ -437,7 +442,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part, if (!maxSplitParts) { - s_printf(gui->txt_buf, "\n#FFDD00 Not enough free space for Partial Backup!#\n"); + strcpy(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); @@ -535,18 +540,25 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part, memset(&fp, 0, sizeof(fp)); currPartIdx++; - if (n_cfg.verification && !gui->raw_emummc) + if (verification && !gui->raw_emummc) { // Verify part. - if (_dump_emmc_verify(gui, storage, lbaStartPart, outFilename, part)) + res = _emmc_sd_copy_verify(gui, storage, lbaStartPart, outFilename, part); + switch (res) { - s_printf(gui->txt_buf, "#FFDD00 Please try again...#\n"); + case VERIF_STATUS_OK: + break; + case VERIF_STATUS_ERROR: + strcpy(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, lv_theme_get_current()->bar.bg); + + lv_bar_set_style(gui->bar, LV_BAR_STYLE_BG, gui->bar_white_bg); lv_bar_set_style(gui->bar, LV_BAR_STYLE_INDIC, gui->bar_white_ind); } @@ -563,7 +575,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part, } else { - s_printf(gui->txt_buf, "\n#FF0000 Error creating partial.idx file!#\n"); + strcpy(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); @@ -642,7 +654,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part, msleep(150); if (retryCount >= 3) { - s_printf(gui->txt_buf, "#FF0000 Aborting...#\nPlease try again...\n"); + strcpy(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); @@ -654,7 +666,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part, } else { - s_printf(gui->txt_buf, "#FFDD00 Retrying...#\n"); + strcpy(gui->txt_buf, "#FFDD00 Retrying...#\n"); lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf); manual_system_maintenance(true); } @@ -685,7 +697,6 @@ 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; } @@ -703,7 +714,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)) { - s_printf(gui->txt_buf, "\n#FFDD00 The backup was cancelled!#\n"); + strcpy(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); @@ -724,12 +735,12 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part, f_close(&fp); free(clmt); - if (n_cfg.verification && !gui->raw_emummc) + if (verification && !gui->raw_emummc) { // Verify last part or single file backup. - if (_dump_emmc_verify(gui, storage, lbaStartPart, outFilename, part)) + if (_emmc_sd_copy_verify(gui, storage, lbaStartPart, outFilename, part) == VERIF_STATUS_ERROR) { - s_printf(gui->txt_buf, "\n#FFDD00 Please try again...#\n"); + strcpy(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); @@ -833,9 +844,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) - s_printf(txt_buf, "#FFDD00 Failed!#\n"); + strcpy(txt_buf, "#FFDD00 Failed!#\n"); else - s_printf(txt_buf, "Done!\n"); + strcpy(txt_buf, "Done!\n"); lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf); manual_system_maintenance(true); @@ -874,12 +885,12 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui) // If a part failed, don't continue. if (!res) { - s_printf(txt_buf, "#FFDD00 Failed!#\n"); + strcpy(txt_buf, "#FFDD00 Failed!#\n"); lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf); break; } else - s_printf(txt_buf, "Done!\n"); + strcpy(txt_buf, "Done!\n"); lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf); manual_system_maintenance(true); @@ -916,9 +927,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) - s_printf(txt_buf, "#FFDD00 Failed!#\n"); + strcpy(txt_buf, "#FFDD00 Failed!#\n"); else - s_printf(txt_buf, "Done!\n"); + strcpy(txt_buf, "Done!\n"); lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf); manual_system_maintenance(true); @@ -954,6 +965,7 @@ 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; @@ -970,8 +982,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, lv_theme_get_current()->bar.bg); - lv_bar_set_style(gui->bar, LV_BAR_STYLE_INDIC, gui->bar_white_ind); + 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); manual_system_maintenance(true); bool use_multipart = false; @@ -984,7 +996,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. - s_printf(gui->txt_buf, "\nNo single file, checking for part files...\n"); + strcpy(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); @@ -1010,7 +1022,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa if ((u32)((u64)totalCheckFileSize >> (u64)9) > totalSectors) { - s_printf(gui->txt_buf, "\n#FF8000 Size of SD Card split backup exceeds#\n#FF8000 eMMC's selected part size!#\n#FFDD00 Aborting...#"); + strcpy(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); @@ -1032,13 +1044,14 @@ 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); - lba_end = totalSectors + part->lba_start - 1; + part->lba_end = totalSectors + part->lba_start - 1; + lba_end = part->lba_end; } // Restore folder is empty. if (!numSplitParts) { - s_printf(gui->txt_buf, "\n#FFDD00 Restore folder is empty.#\n\n"); + strcpy(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); @@ -1051,7 +1064,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)) { - s_printf(gui->txt_buf, "\n#FFDD00 The split file must be a#\n#FFDD00 multiple of 4 MiB.#\n#FFDD00 Aborting...#"); + strcpy(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); @@ -1079,7 +1092,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); - s_printf(gui->txt_buf, "\n#FF0000 Size of SD Card split backup does not match#\n#FF0000 eMMC's selected part size!#\n"); + strcpy(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); @@ -1089,7 +1102,8 @@ 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); - lba_end = totalSectors + part->lba_start - 1; + part->lba_end = totalSectors + part->lba_start - 1; + lba_end = part->lba_end; } use_multipart = true; _update_filename(outFilename, sdPathLen, 0); @@ -1134,7 +1148,7 @@ multipart_not_allowed: { if (((u32)((u64)f_size(&fp) >> (u64)9)) > totalSectors) { - s_printf(gui->txt_buf, "\n#FF8000 Size of SD Card backup exceeds#\n#FF8000 eMMC's selected part size!#\n#FFDD00 Aborting...#"); + strcpy(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); @@ -1153,7 +1167,7 @@ multipart_not_allowed: if (!(btn_wait() & BTN_POWER)) { lv_obj_del(warn_mbox_bg); - s_printf(gui->txt_buf, "\n#FF0000 Size of the SD Card backup does not match#\n#FF0000 eMMC's selected part size.#\n"); + strcpy(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); @@ -1197,7 +1211,7 @@ multipart_not_allowed: _get_valid_partition(§or_start, §or_size, &part_idx, false); if (!part_idx || !sector_size) { - s_printf(gui->txt_buf, "\n#FFDD00 Failed to find a partition...#\n"); + strcpy(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); @@ -1219,17 +1233,25 @@ multipart_not_allowed: memset(&fp, 0, sizeof(fp)); currPartIdx++; - if (n_cfg.verification && !gui->raw_emummc) + if (verification && !gui->raw_emummc) { // Verify part. - if (_dump_emmc_verify(gui, storage, lbaStartPart, outFilename, part)) + res = _emmc_sd_copy_verify(gui, storage, lbaStartPart, outFilename, part); + switch (res) { - s_printf(gui->txt_buf, "\n#FFDD00 Please try again...#\n"); + case VERIF_STATUS_OK: + break; + case VERIF_STATUS_ERROR: + strcpy(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); @@ -1297,7 +1319,7 @@ multipart_not_allowed: msleep(150); if (retryCount >= 3) { - s_printf(gui->txt_buf, "#FF0000 Aborting...#\n" + strcpy(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); @@ -1309,7 +1331,7 @@ multipart_not_allowed: } else { - s_printf(gui->txt_buf, "#FFDD00 Retrying...#\n"); + strcpy(gui->txt_buf, "#FFDD00 Retrying...#\n"); lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf); manual_system_maintenance(true); } @@ -1341,12 +1363,12 @@ multipart_not_allowed: f_close(&fp); free(clmt); - if (n_cfg.verification && !gui->raw_emummc) + if (verification && !gui->raw_emummc) { // Verify restored data. - if (_dump_emmc_verify(gui, storage, lbaStartPart, outFilename, part)) + if (_emmc_sd_copy_verify(gui, storage, lbaStartPart, outFilename, part) == VERIF_STATUS_ERROR) { - s_printf(gui->txt_buf, "#FFDD00 Please try again...#\n"); + strcpy(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); @@ -1391,9 +1413,9 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui) manual_system_maintenance(true); if (!gui->raw_emummc) - s_printf(txt_buf, "#FFDD00 This may render the device inoperative!#\n\n"); + strcpy(txt_buf, "#FFDD00 This may render the device inoperative!#"); else - s_printf(txt_buf, "#FFDD00 This may render the emuMMC inoperative!#\n\n"); + strcpy(txt_buf, "#FFDD00 This may render the emuMMC inoperative!#"); strcat(txt_buf, "\n\n#FFDD00 Are you really sure?#"); if (gui->raw_emummc) @@ -1490,9 +1512,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) - s_printf(txt_buf, "#FFDD00 Failed!#\n"); + strcpy(txt_buf, "#FFDD00 Failed!#\n"); else if (res > 0) - s_printf(txt_buf, "Done!\n"); + strcpy(txt_buf, "Done!\n"); if (res >= 0) lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf); @@ -1526,9 +1548,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) - s_printf(txt_buf, "#FFDD00 Failed!#\n"); + strcpy(txt_buf, "#FFDD00 Failed!#\n"); else if (res > 0) - s_printf(txt_buf, "Done!\n"); + strcpy(txt_buf, "Done!\n"); if (res >= 0) lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf); @@ -1565,9 +1587,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) - s_printf(txt_buf, "#FFDD00 Failed!#\n"); + strcpy(txt_buf, "#FFDD00 Failed!#\n"); else if (res > 0) - s_printf(txt_buf, "Done!\n"); + strcpy(txt_buf, "Done!\n"); if (res >= 0) lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf); diff --git a/nyx/nyx_gui/frontend/gui.h b/nyx/nyx_gui/frontend/gui.h index 3f134440..beb5a222 100644 --- a/nyx/nyx_gui/frontend/gui.h +++ b/nyx/nyx_gui/frontend/gui.h @@ -28,7 +28,10 @@ typedef struct _emmc_tool_gui_t lv_obj_t *bar; lv_style_t *bar_teal_bg; lv_style_t *bar_teal_ind; + lv_style_t *bar_white_bg; lv_style_t *bar_white_ind; + lv_style_t *bar_orange_bg; + lv_style_t *bar_orange_ind; char *txt_buf; char *base_path; bool raw_emummc; diff --git a/nyx/nyx_gui/frontend/gui_emmc_tools.c b/nyx/nyx_gui/frontend/gui_emmc_tools.c index 793f58d1..775002fc 100644 --- a/nyx/nyx_gui/frontend/gui_emmc_tools.c +++ b/nyx/nyx_gui/frontend/gui_emmc_tools.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 CTCaer + * Copyright (c) 2018-2025 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, @@ -101,7 +101,7 @@ static void _create_window_backup_restore(emmcPartType_t type, const char* win_l lv_obj_align(label_info, label_sep, LV_ALIGN_OUT_BOTTOM_LEFT, LV_DPI / 4, LV_DPI / 10); emmc_tool_gui_ctxt.label_info = label_info; - static lv_style_t bar_teal_bg, bar_teal_ind, bar_white_ind; + static lv_style_t bar_teal_bg, bar_teal_ind, bar_orange_bg, bar_orange_ind, bar_white_ind; lv_style_copy(&bar_teal_bg, lv_theme_get_current()->bar.bg); bar_teal_bg.body.main_color = LV_COLOR_HEX(0x005a47); @@ -111,12 +111,23 @@ static void _create_window_backup_restore(emmcPartType_t type, const char* win_l bar_teal_ind.body.main_color = LV_COLOR_HEX(0x00FFC9); bar_teal_ind.body.grad_color = bar_teal_ind.body.main_color; + lv_style_copy(&bar_orange_bg, lv_theme_get_current()->bar.bg); + bar_orange_bg.body.main_color = LV_COLOR_HEX(0x755000); + bar_orange_bg.body.grad_color = bar_orange_bg.body.main_color; + + lv_style_copy(&bar_orange_ind, lv_theme_get_current()->bar.indic); + bar_orange_ind.body.main_color = LV_COLOR_HEX(0xFFAE00); + bar_orange_ind.body.grad_color = bar_orange_ind.body.main_color; + lv_style_copy(&bar_white_ind, lv_theme_get_current()->bar.indic); bar_white_ind.body.main_color = LV_COLOR_HEX(0xF0F0F0); bar_white_ind.body.grad_color = bar_white_ind.body.main_color; emmc_tool_gui_ctxt.bar_teal_bg = &bar_teal_bg; emmc_tool_gui_ctxt.bar_teal_ind = &bar_teal_ind; + emmc_tool_gui_ctxt.bar_orange_bg = &bar_orange_bg; + emmc_tool_gui_ctxt.bar_orange_ind = &bar_orange_ind; + emmc_tool_gui_ctxt.bar_white_bg = lv_theme_get_current()->bar.bg; emmc_tool_gui_ctxt.bar_white_ind = &bar_white_ind; lv_obj_t *bar = lv_bar_create(h1, NULL);