From f9f4a6951233e4a3ea42e5ecad17e84ac1bf2bf9 Mon Sep 17 00:00:00 2001 From: Hugo Hromic <hhromic@gmail.com> Date: Fri, 10 Jul 2020 23:55:37 +0100 Subject: [PATCH] (Drivers/Video) Implement frontend signal handling in null video driver Allows RetroArch to gracefully exit when receiving stop signals, e.g. `SIGINT` or `SIGTERM`, when using the null video driver. --- retroarch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/retroarch.c b/retroarch.c index 8cdb46826f..2b6bedcbae 100644 --- a/retroarch.c +++ b/retroarch.c @@ -410,6 +410,8 @@ static void *video_null_init(const video_info_t *video, *input = NULL; *input_data = NULL; + frontend_driver_install_signal_handler(); + return (void*)-1; } @@ -422,7 +424,7 @@ static bool video_null_frame(void *data, const void *frame, static void video_null_free(void *data) { } static void video_null_set_nonblock_state(void *a, bool b, bool c, unsigned d) { } -static bool video_null_alive(void *data) { return true; } +static bool video_null_alive(void *data) { return frontend_driver_get_signal_handler_state() != 1; } static bool video_null_focus(void *data) { return true; } static bool video_null_has_windowed(void *data) { return true; } static bool video_null_suppress_screensaver(void *data, bool enable) { return false; }