Create driver_ctl

This commit is contained in:
twinaphex 2015-12-11 10:43:53 +01:00
parent 47dbee7102
commit f2911269d5
4 changed files with 31 additions and 15 deletions

View File

@ -45,18 +45,6 @@
#define HASH_AUDIO_RESAMPLER_DRIVER 0xedcba9ecU
#define HASH_RECORD_DRIVER 0x144cd2cfU
void driver_free(void)
{
video_driver_ctl(RARCH_DISPLAY_CTL_DESTROY, NULL);
audio_driver_ctl(RARCH_AUDIO_CTL_DESTROY, NULL);
input_driver_ctl(RARCH_INPUT_CTL_DESTROY, NULL);
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_DESTROY, NULL);
#endif
location_driver_ctl(RARCH_LOCATION_CTL_DESTROY, NULL);
camera_driver_ctl(RARCH_CAMERA_CTL_DESTROY, NULL);
retro_uninit_libretro_cbs();
}
/**
* find_driver_nonempty:
* @label : string of driver type to be found.
@ -472,3 +460,25 @@ void uninit_drivers(int flags)
audio_driver_ctl(RARCH_AUDIO_CTL_DESTROY_DATA, NULL);
}
bool driver_ctl(enum driver_ctl_state state, void *data)
{
switch (state)
{
case RARCH_DRIVER_CTL_DEINIT:
video_driver_ctl(RARCH_DISPLAY_CTL_DESTROY, NULL);
audio_driver_ctl(RARCH_AUDIO_CTL_DESTROY, NULL);
input_driver_ctl(RARCH_INPUT_CTL_DESTROY, NULL);
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_DESTROY, NULL);
#endif
location_driver_ctl(RARCH_LOCATION_CTL_DESTROY, NULL);
camera_driver_ctl(RARCH_CAMERA_CTL_DESTROY, NULL);
retro_uninit_libretro_cbs();
break;
case RARCH_DRIVER_CTL_NONE:
default:
break;
}
return false;
}

View File

@ -172,6 +172,12 @@ enum
DRIVERS_VIDEO_INPUT = 1 << 6
};
enum driver_ctl_state
{
RARCH_DRIVER_CTL_NONE = 0,
RARCH_DRIVER_CTL_DEINIT
};
/* TODO/FIXME - comment needs to be moved to each respective driver */
@ -286,7 +292,7 @@ bool driver_update_system_av_info(const void *data);
**/
int find_driver_index(const char * label, const char *drv);
void driver_free(void);
bool driver_ctl(enum driver_ctl_state state, void *data);
#ifdef __cplusplus
}

View File

@ -89,7 +89,7 @@ void main_exit(void *args)
frontend_driver_shutdown(false);
driver_free();
driver_ctl(RARCH_DRIVER_CTL_DEINIT, NULL);
ui_companion_driver_free();
frontend_driver_free();
}

View File

@ -875,7 +875,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
}
break;
case RUNLOOP_CTL_CLEAR_STATE:
driver_free();
driver_ctl(RARCH_DRIVER_CTL_DEINIT, NULL);
runloop_ctl(RUNLOOP_CTL_STATE_FREE, NULL);
runloop_ctl(RUNLOOP_CTL_GLOBAL_FREE, NULL);
break;