From 841773d9e410fe3e582b8a988ef6db9fc367f9b0 Mon Sep 17 00:00:00 2001 From: LiquidFenrir Date: Sun, 31 Dec 2017 05:01:01 +0100 Subject: [PATCH] fix pressing the power button shutting down the console instead of showing the poweroff screen (#123) --- include/common.h | 2 -- source/main.c | 13 ++++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/common.h b/include/common.h index b7a468f..4b35d1e 100644 --- a/include/common.h +++ b/include/common.h @@ -74,6 +74,4 @@ enum TextureID { TEXTURE_ICON, // always the last }; -void exit_function(void); - #endif diff --git a/source/main.c b/source/main.c index 38c2cc5..99ad475 100644 --- a/source/main.c +++ b/source/main.c @@ -105,7 +105,7 @@ static void exit_thread(void) } } -void exit_function(void) +void exit_function(bool power_pressed) { stop_install_check(); for(int i = 0; i < MODE_AMOUNT; i++) @@ -120,7 +120,7 @@ void exit_function(void) exit_screens(); exit_services(); - if(installed_themes) + if(!power_pressed && installed_themes) { if(homebrew) { @@ -361,7 +361,11 @@ int main(void) pp2d_end_draw(); - if(kDown & KEY_START) break; + if(kDown & KEY_START) + { + exit_function(false); + return 0; + } if(!install_mode) { @@ -708,7 +712,6 @@ int main(void) } } - exit_function(); - + exit_function(true); return 0; }