diff --git a/driver-contexts/camera_driver.c b/driver-contexts/camera_driver.c index a05ad9d80c..2fcbaa45b8 100644 --- a/driver-contexts/camera_driver.c +++ b/driver-contexts/camera_driver.c @@ -138,4 +138,5 @@ void uninit_camera(void) if (driver.camera->free) driver.camera->free(driver.camera_data); } + driver.camera_data = NULL; } diff --git a/driver-contexts/location_driver.c b/driver-contexts/location_driver.c index fe9f577d99..867ac5d7dc 100644 --- a/driver-contexts/location_driver.c +++ b/driver-contexts/location_driver.c @@ -137,4 +137,5 @@ void uninit_location(void) if (driver.location->free) driver.location->free(driver.location_data); } + driver.location_data = NULL; } diff --git a/driver-contexts/osk_driver.c b/driver-contexts/osk_driver.c index 13aa90ec31..62be3a065e 100644 --- a/driver-contexts/osk_driver.c +++ b/driver-contexts/osk_driver.c @@ -87,4 +87,5 @@ void uninit_osk(void) { if (driver.osk_data && driver.osk && driver.osk->free) driver.osk->free(driver.osk_data); + driver.osk_data = NULL; } diff --git a/driver.c b/driver.c index 1aa3280c74..5156b78537 100644 --- a/driver.c +++ b/driver.c @@ -509,56 +509,13 @@ bool driver_update_system_av_info(const struct retro_system_av_info *info) void global_init_drivers(void) { - find_audio_driver(); - find_input_driver(); - find_image_driver(); -#ifdef HAVE_MENU - find_menu_driver(); -#endif - init_video_input(); + init_drivers_pre(); + init_drivers(); } void global_uninit_drivers(void) { - if (driver.video && driver.video_data) - { - driver.video->free(driver.video_data); - driver.video_data = NULL; - } - - if (driver.input && driver.input_data) - { - driver.input->free(driver.input_data); - driver.input_data = NULL; - } - -#ifdef HAVE_CAMERA - if (driver.camera && driver.camera_data) - { - if (g_extern.system.camera_callback.deinitialized) - g_extern.system.camera_callback.deinitialized(); - driver.camera->free(driver.camera_data); - driver.camera_data = NULL; - } -#endif - -#ifdef HAVE_LOCATION - if (driver.location && driver.location_data) - { - if (g_extern.system.location_callback.deinitialized) - g_extern.system.location_callback.deinitialized(); - driver.location->free(driver.location_data); - driver.location_data = NULL; - } -#endif - -#ifdef HAVE_OSK - if (driver.osk && driver.osk_data) - { - driver.osk->free(driver.osk_data); - driver.osk_data = NULL; - } -#endif + uninit_drivers(); } void init_drivers(void)