From c491207b783ce866d35d9ff21d8a168bbb474d96 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 11 Dec 2015 11:23:32 +0100 Subject: [PATCH] Create RARCH_DRIVER_CTL_UNINIT --- command_event.c | 4 ++-- driver.c | 10 +++++++++- driver.h | 13 ++++--------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/command_event.c b/command_event.c index 65bee9f5c8..82f6ca23c3 100644 --- a/command_event.c +++ b/command_event.c @@ -1266,7 +1266,7 @@ bool event_command(enum event_command cmd) case EVENT_CMD_DRIVERS_DEINIT: { int flags = DRIVERS_CMD_ALL; - uninit_drivers(flags); + driver_ctl(RARCH_DRIVER_CTL_UNINIT, &flags); } break; case EVENT_CMD_DRIVERS_INIT: @@ -1278,7 +1278,7 @@ bool event_command(enum event_command cmd) case EVENT_CMD_AUDIO_REINIT: { int flags = DRIVER_AUDIO; - uninit_drivers(flags); + driver_ctl(RARCH_DRIVER_CTL_UNINIT, &flags); driver_ctl(RARCH_DRIVER_CTL_INIT, &flags); } break; diff --git a/driver.c b/driver.c index d7248ee8c9..024eb10878 100644 --- a/driver.c +++ b/driver.c @@ -381,7 +381,7 @@ static void init_drivers(int flags) * Deinitializes drivers. * @flags determines which drivers get deinitialized. **/ -void uninit_drivers(int flags) +static void uninit_drivers(int flags) { #ifdef HAVE_MENU if (flags & DRIVER_MENU) @@ -439,6 +439,14 @@ bool driver_ctl(enum driver_ctl_state state, void *data) camera_driver_ctl(RARCH_CAMERA_CTL_DESTROY, NULL); retro_uninit_libretro_cbs(); break; + case RARCH_DRIVER_CTL_UNINIT: + { + int *flags = (int*)data; + if (!flags) + return false; + uninit_drivers(*flags); + } + return true; case RARCH_DRIVER_CTL_INIT: { int *flags = (int*)data; diff --git a/driver.h b/driver.h index a37cd8c641..cee7846799 100644 --- a/driver.h +++ b/driver.h @@ -175,6 +175,10 @@ enum driver_ctl_state { RARCH_DRIVER_CTL_NONE = 0, RARCH_DRIVER_CTL_DEINIT, + /* Deinitializes drivers. + * @data is a bitmask which determines + * which drivers get deinitialized. */ + RARCH_DRIVER_CTL_UNINIT, /* Initializes drivers. * @data is a bitmask which determines * which drivers get initialized. */ @@ -216,15 +220,6 @@ enum driver_ctl_state * Typically, if a driver intends to make use of this, it should * set this to true at the end of its 'init' function. */ -/** - * uninit_drivers: - * @flags : Bitmask of drivers to deinitialize. - * - * Deinitializes drivers. - * @flags determines which drivers get deinitialized. - **/ -void uninit_drivers(int flags); - bool find_first_driver(const char *label, char *s, size_t len); /**