From 976925c69788beebe92cfe22255a93d430cf10bc Mon Sep 17 00:00:00 2001 From: CTCaer Date: Sat, 21 Mar 2020 22:27:17 +0200 Subject: [PATCH] nyx: Allow cancellation of emuMMC creation --- nyx/nyx_gui/frontend/fe_emummc_tools.c | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/nyx/nyx_gui/frontend/fe_emummc_tools.c b/nyx/nyx_gui/frontend/fe_emummc_tools.c index f8f9cdf..7a2d633 100644 --- a/nyx/nyx_gui/frontend/fe_emummc_tools.c +++ b/nyx/nyx_gui/frontend/fe_emummc_tools.c @@ -29,6 +29,7 @@ #include "../sec/se.h" #include "../storage/nx_emmc.h" #include "../storage/sdmmc.h" +#include "../utils/btn.h" #include "../utils/sprintf.h" #include "../utils/util.h" @@ -215,6 +216,23 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto clmt = f_expand_cltbl(&fp, 0x400000, MIN(totalSize, multipartSplitSize)); } + // Check for cancellation combo. + u32 btn = btn_wait_timeout(0, BTN_VOL_DOWN | BTN_VOL_UP); + if ((btn & BTN_VOL_DOWN) && (btn & BTN_VOL_UP)) + { + s_printf(gui->txt_buf, "#FFDD00 The emuMMC was cancelled!#\n"); + lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf); + manual_system_maintenance(true); + + f_close(&fp); + free(clmt); + f_unlink(outFilename); + + msleep(1000); + + return 0; + } + retryCount = 0; num = MIN(totalSectors, NUM_SECTORS_PER_ITER); while (!sdmmc_storage_read(storage, lba_curr, num, buf)) @@ -484,6 +502,19 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part while (totalSectors > 0) { + // Check for cancellation combo. + u32 btn = btn_wait_timeout(0, BTN_VOL_DOWN | BTN_VOL_UP); + if ((btn & BTN_VOL_DOWN) && (btn & BTN_VOL_UP)) + { + s_printf(gui->txt_buf, "#FFDD00 The emuMMC was cancelled!#\n"); + lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf); + manual_system_maintenance(true); + + msleep(1000); + + return 0; + } + retryCount = 0; num = MIN(totalSectors, NUM_SECTORS_PER_ITER);