diff --git a/nyx/nyx_gui/frontend/fe_emmc_tools.c b/nyx/nyx_gui/frontend/fe_emmc_tools.c index 5193c7b6..6c763ea8 100644 --- a/nyx/nyx_gui/frontend/fe_emmc_tools.c +++ b/nyx/nyx_gui/frontend/fe_emmc_tools.c @@ -30,6 +30,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") @@ -138,7 +142,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; @@ -171,7 +175,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]; @@ -222,7 +226,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); @@ -242,7 +246,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); @@ -263,7 +267,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) @@ -303,7 +307,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); @@ -313,7 +317,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); @@ -325,15 +329,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; } } @@ -346,6 +350,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; @@ -371,7 +376,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); @@ -394,7 +399,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); @@ -409,13 +414,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); @@ -425,7 +430,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); @@ -438,7 +443,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); @@ -536,18 +541,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); } @@ -564,7 +576,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); @@ -643,7 +655,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); @@ -655,7 +667,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); } @@ -686,7 +698,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; } @@ -704,7 +715,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); @@ -725,12 +736,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); @@ -836,9 +847,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); @@ -877,12 +888,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); @@ -919,9 +930,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); @@ -957,6 +968,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; @@ -973,8 +985,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; @@ -987,7 +999,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); @@ -1013,7 +1025,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); @@ -1035,13 +1047,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); @@ -1054,7 +1067,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); @@ -1082,7 +1095,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); @@ -1092,7 +1105,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); @@ -1137,7 +1151,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); @@ -1156,7 +1170,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); @@ -1200,7 +1214,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); @@ -1222,17 +1236,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); @@ -1300,7 +1322,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); @@ -1312,7 +1334,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); } @@ -1344,12 +1366,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); @@ -1394,9 +1416,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) @@ -1493,9 +1515,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); @@ -1529,9 +1551,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); @@ -1568,9 +1590,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 4c3aa2a7..9dc32296 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);