From cd5b93feb1a2d27cf99508cc6b547852fc364549 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Tue, 6 Jul 2021 10:09:06 +0300 Subject: [PATCH] nyx: tools: improve error messaging when restore folder is empty --- nyx/nyx_gui/frontend/fe_emmc_tools.c | 34 +++++++++++++++++++--------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/nyx/nyx_gui/frontend/fe_emmc_tools.c b/nyx/nyx_gui/frontend/fe_emmc_tools.c index b0df269..81cf8bb 100644 --- a/nyx/nyx_gui/frontend/fe_emmc_tools.c +++ b/nyx/nyx_gui/frontend/fe_emmc_tools.c @@ -379,7 +379,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, "#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); @@ -995,18 +995,30 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa return 0; } - else if (f_stat(outFilename, &fno) && !gui->raw_emummc) + else if (f_stat(outFilename, &fno)) { - s_printf(gui->txt_buf, "#FFDD00 Error (%d) file not found#\n#FFDD00 %s.#\n\n", res, outFilename); - lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf); - manual_system_maintenance(true); + if (!gui->raw_emummc) + { + s_printf(gui->txt_buf, "#FFDD00 Error (%d) file not found#\n#FFDD00 %s.#\n\n", res, outFilename); + lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf); + manual_system_maintenance(true); - // Attempt a smaller restore. - break; - } - else if (f_stat(outFilename, &fno) && gui->raw_emummc) - { - totalSectors = (u32)((u64)totalCheckFileSize >> (u64)9); + // Attempt a smaller restore. + if (numSplitParts) + break; + } + else + totalSectors = (u32)((u64)totalCheckFileSize >> (u64)9); + + // Restore folder is empty. + if (!numSplitParts) + { + s_printf(gui->txt_buf, "#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); + + return 0; + } } else {