mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-28 07:36:51 +00:00
Clean this mess up
This commit is contained in:
parent
b8041cc93b
commit
dbbcba41a5
15
command.c
15
command.c
@ -1020,10 +1020,7 @@ static void command_event_deinit_core(bool reinit)
|
||||
core_uninit_symbols();
|
||||
|
||||
if (reinit)
|
||||
{
|
||||
int flags = DRIVERS_CMD_ALL;
|
||||
driver_ctl(RARCH_DRIVER_CTL_UNINIT, &flags);
|
||||
}
|
||||
driver_uninit(DRIVERS_CMD_ALL);
|
||||
|
||||
command_event(CMD_EVENT_DISABLE_OVERRIDES, NULL);
|
||||
command_event(CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET, NULL);
|
||||
@ -2085,9 +2082,8 @@ bool command_event(enum event_command cmd, void *data)
|
||||
break;
|
||||
case CMD_EVENT_AUDIO_REINIT:
|
||||
{
|
||||
int flags = DRIVER_AUDIO_MASK;
|
||||
driver_ctl(RARCH_DRIVER_CTL_UNINIT, &flags);
|
||||
drivers_init(flags);
|
||||
driver_uninit(DRIVER_AUDIO_MASK);
|
||||
drivers_init(DRIVER_AUDIO_MASK);
|
||||
}
|
||||
break;
|
||||
case CMD_EVENT_RESET_CONTEXT:
|
||||
@ -2095,18 +2091,17 @@ bool command_event(enum event_command cmd, void *data)
|
||||
/* RARCH_DRIVER_CTL_UNINIT clears the callback struct so we
|
||||
* need to make sure to keep a copy */
|
||||
struct retro_hw_render_callback hwr_copy;
|
||||
int flags = DRIVERS_CMD_ALL;
|
||||
struct retro_hw_render_callback *hwr = video_driver_get_hw_context();
|
||||
const struct retro_hw_render_context_negotiation_interface *iface =
|
||||
video_driver_get_context_negotiation_interface();
|
||||
memcpy(&hwr_copy, hwr, sizeof(hwr_copy));
|
||||
|
||||
driver_ctl(RARCH_DRIVER_CTL_UNINIT, &flags);
|
||||
driver_uninit(DRIVERS_CMD_ALL);
|
||||
|
||||
memcpy(hwr, &hwr_copy, sizeof(*hwr));
|
||||
video_driver_set_context_negotiation_interface(iface);
|
||||
|
||||
drivers_init(flags);
|
||||
drivers_init(DRIVERS_CMD_ALL);
|
||||
}
|
||||
break;
|
||||
case CMD_EVENT_SHUTDOWN:
|
||||
|
15
driver.c
15
driver.c
@ -390,7 +390,7 @@ void drivers_init(int flags)
|
||||
* Typically, if a driver intends to make use of this, it should
|
||||
* set this to true at the end of its 'init' function.
|
||||
**/
|
||||
static void uninit_drivers(int flags)
|
||||
void driver_uninit(int flags)
|
||||
{
|
||||
core_info_deinit_list();
|
||||
core_info_free_current_core();
|
||||
@ -441,19 +441,6 @@ bool driver_ctl(enum driver_ctl_state state, void *data)
|
||||
wifi_driver_ctl(RARCH_WIFI_CTL_DESTROY, NULL);
|
||||
core_uninit_libretro_callbacks();
|
||||
break;
|
||||
case RARCH_DRIVER_CTL_UNINIT:
|
||||
{
|
||||
int *flags = (int*)data;
|
||||
if (!flags)
|
||||
return false;
|
||||
uninit_drivers(*flags);
|
||||
}
|
||||
break;
|
||||
case RARCH_DRIVER_CTL_UNINIT_ALL:
|
||||
{
|
||||
int flags = DRIVERS_CMD_ALL;
|
||||
return driver_ctl(RARCH_DRIVER_CTL_UNINIT, &flags);
|
||||
}
|
||||
case RARCH_DRIVER_CTL_INIT_PRE:
|
||||
audio_driver_find_driver();
|
||||
video_driver_find_driver();
|
||||
|
9
driver.h
9
driver.h
@ -65,13 +65,6 @@ 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,
|
||||
|
||||
RARCH_DRIVER_CTL_UNINIT_ALL,
|
||||
|
||||
/* Attempts to find a default driver for
|
||||
* all driver types.
|
||||
*
|
||||
@ -115,6 +108,8 @@ bool driver_ctl(enum driver_ctl_state state, void *data);
|
||||
* audio and video drivers instead. */
|
||||
void driver_set_nonblock_state(void);
|
||||
|
||||
void driver_uninit(int flags);
|
||||
|
||||
void drivers_init(int flags);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
@ -1409,7 +1409,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
rarch_force_fullscreen = false;
|
||||
|
||||
retroarch_msg_queue_deinit();
|
||||
driver_ctl(RARCH_DRIVER_CTL_UNINIT_ALL, NULL);
|
||||
driver_uninit(DRIVERS_CMD_ALL);
|
||||
command_event(CMD_EVENT_LOG_FILE_DEINIT, NULL);
|
||||
|
||||
rarch_ctl(RARCH_CTL_STATE_FREE, NULL);
|
||||
@ -1459,7 +1459,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
break;
|
||||
case RARCH_CTL_INIT:
|
||||
if (rarch_is_inited)
|
||||
driver_ctl(RARCH_DRIVER_CTL_UNINIT_ALL, NULL);
|
||||
driver_uninit(DRIVERS_CMD_ALL);
|
||||
|
||||
#ifdef HAVE_THREAD_STORAGE
|
||||
sthread_tls_create(&rarch_tls);
|
||||
|
Loading…
x
Reference in New Issue
Block a user