From 3105540c996dfa3955dc182170bfac7de7a56f35 Mon Sep 17 00:00:00 2001 From: Pablo Curiel Date: Mon, 3 Aug 2020 14:13:24 -0400 Subject: [PATCH] Block HOME button presses during dumping operations in code templates. --- code_templates/gc_key_area.c | 4 ++++ code_templates/system_title_dumper.c | 2 ++ code_templates/threaded_usb_bktr_dumper.c | 4 ++++ source/main.c | 2 ++ 4 files changed, 12 insertions(+) diff --git a/code_templates/gc_key_area.c b/code_templates/gc_key_area.c index aee8098..bceece5 100644 --- a/code_templates/gc_key_area.c +++ b/code_templates/gc_key_area.c @@ -69,6 +69,8 @@ int main(int argc, char *argv[]) if (status == GameCardStatus_InsertedAndInfoNotLoaded) consolePrint("gamecard inserted but info couldn't be loaded from it. check nogc patch setting.\n"); } + utilsChangeHomeButtonBlockStatus(true); + consolePrint("gamecard detected.\n"); if (!gamecardGetKeyArea(&gc_key_area)) @@ -94,6 +96,8 @@ int main(int argc, char *argv[]) consolePrint("successfully saved key area to \"%s\"\n", path); + utilsChangeHomeButtonBlockStatus(false); + out2: consolePrint("press any button to exit\n"); utilsWaitForButtonPress(KEY_NONE); diff --git a/code_templates/system_title_dumper.c b/code_templates/system_title_dumper.c index 15290f3..1f5bdf7 100644 --- a/code_templates/system_title_dumper.c +++ b/code_templates/system_title_dumper.c @@ -358,7 +358,9 @@ int main(int argc, char *argv[]) if (menu == 3) { consoleClear(); + utilsChangeHomeButtonBlockStatus(true); dumpFsSection(cur_title_info, &(nca_ctx->fs_contexts[selected_idx])); + utilsChangeHomeButtonBlockStatus(false); } if (error || menu >= 3) diff --git a/code_templates/threaded_usb_bktr_dumper.c b/code_templates/threaded_usb_bktr_dumper.c index 835f9c7..59b7d61 100644 --- a/code_templates/threaded_usb_bktr_dumper.c +++ b/code_templates/threaded_usb_bktr_dumper.c @@ -429,6 +429,8 @@ int main(int argc, char *argv[]) time_t btn_cancel_start_tmr = 0, btn_cancel_end_tmr = 0; bool btn_cancel_cur_state = false, btn_cancel_prev_state = false; + utilsChangeHomeButtonBlockStatus(true); + consolePrint("hold b to cancel\n\n"); start = time(NULL); @@ -483,6 +485,8 @@ int main(int argc, char *argv[]) thrd_join(write_thread, NULL); consolePrint("write_thread done: %lu\n", time(NULL)); + utilsChangeHomeButtonBlockStatus(false); + if (shared_data.read_error || shared_data.write_error) { consolePrint("usb transfer error\n"); diff --git a/source/main.c b/source/main.c index 15290f3..1f5bdf7 100644 --- a/source/main.c +++ b/source/main.c @@ -358,7 +358,9 @@ int main(int argc, char *argv[]) if (menu == 3) { consoleClear(); + utilsChangeHomeButtonBlockStatus(true); dumpFsSection(cur_title_info, &(nca_ctx->fs_contexts[selected_idx])); + utilsChangeHomeButtonBlockStatus(false); } if (error || menu >= 3)