From 4c5c2170b65a9e84e6d41118212f630875db4228 Mon Sep 17 00:00:00 2001 From: p-sam Date: Tue, 9 Oct 2018 21:39:48 +0000 Subject: [PATCH] libnx: call retroarch_main_quit on exit --- frontend/drivers/platform_switch.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/frontend/drivers/platform_switch.c b/frontend/drivers/platform_switch.c index 166640ee21..603f9ba13d 100644 --- a/frontend/drivers/platform_switch.c +++ b/frontend/drivers/platform_switch.c @@ -62,10 +62,19 @@ static uint32_t *splashData = NULL; static bool psmInitialized = false; +static AppletHookCookie applet_hook_cookie; + #ifdef NXLINK extern bool nxlink_connected; #endif +static void on_applet_hook(AppletHookType hook, void* param) { + if(hook == AppletHookType_OnExitRequest) { + RARCH_LOG("Got AppletHook OnExitRequest, exiting.\n"); + retroarch_main_quit(); + } +} + #endif /* HAVE_LIBNX */ static void get_first_valid_core(char *path_return) @@ -209,6 +218,7 @@ static void frontend_switch_deinit(void *data) #ifndef HAVE_OPENGL gfxExit(); #endif + appletUnlockExit(); #endif } @@ -609,6 +619,8 @@ static void frontend_switch_init(void *data) #ifdef HAVE_LIBNX nifmInitialize(); + appletLockExit(); + appletHook(&applet_hook_cookie, on_applet_hook, NULL); #ifndef HAVE_OPENGL /* Init Resolution before initDefault */ gfxInitResolution(1280, 720);