This commit is contained in:
twinaphex 2016-02-10 04:30:33 +01:00
parent 0e017ea925
commit 33f0f72adc
4 changed files with 31 additions and 37 deletions

View File

@ -402,7 +402,10 @@ static void event_deinit_core(bool reinit)
core_ctl(CORE_CTL_RETRO_DEINIT, NULL);
if (reinit)
event_cmd_ctl(EVENT_CMD_DRIVERS_DEINIT, NULL);
{
int flags = DRIVERS_CMD_ALL;
driver_ctl(RARCH_DRIVER_CTL_UNINIT, &flags);
}
/* auto overrides: reload the original config */
if (runloop_ctl(RUNLOOP_CTL_IS_OVERRIDES_ACTIVE, NULL))
@ -1307,18 +1310,6 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
input_overlay_set_alpha_mod(settings->input.overlay_opacity);
#endif
break;
case EVENT_CMD_DRIVERS_DEINIT:
{
int flags = DRIVERS_CMD_ALL;
driver_ctl(RARCH_DRIVER_CTL_UNINIT, &flags);
}
break;
case EVENT_CMD_DRIVERS_INIT:
{
int flags = DRIVERS_CMD_ALL;
driver_ctl(RARCH_DRIVER_CTL_INIT, &flags);
}
break;
case EVENT_CMD_AUDIO_REINIT:
{
int flags = DRIVER_AUDIO;
@ -1328,17 +1319,18 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
break;
case EVENT_CMD_RESET_CONTEXT:
{
/* EVENT_CMD_DRIVERS_DEINIT clears the callback struct so we
/* RARCH_DRIVER_CTL_UNINIT clears the callback struct so we
* need to make sure to keep a copy */
struct retro_hw_render_callback hw_render;
int flags = DRIVERS_CMD_ALL;
memcpy(&hw_render, video_driver_callback(), sizeof(hw_render));
event_cmd_ctl(EVENT_CMD_DRIVERS_DEINIT, NULL);
driver_ctl(RARCH_DRIVER_CTL_UNINIT, &flags);
memcpy(video_driver_callback(), &hw_render, sizeof(hw_render));
event_cmd_ctl(EVENT_CMD_DRIVERS_INIT, NULL);
driver_ctl(RARCH_DRIVER_CTL_INIT, &flags);
}
break;
case EVENT_CMD_QUIT_RETROARCH:

View File

@ -178,10 +178,6 @@ enum event_command
EVENT_CMD_REMOTE_INIT,
/* Deinitializes remote gamepad interface. */
EVENT_CMD_REMOTE_DEINIT,
/* Deinitializes drivers. */
EVENT_CMD_DRIVERS_DEINIT,
/* Initializes drivers. */
EVENT_CMD_DRIVERS_INIT,
/* Reinitializes audio driver. */
EVENT_CMD_AUDIO_REINIT,
/* Resizes windowed scale. Will reinitialize video driver. */

View File

@ -83,7 +83,6 @@ extern "C" {
#define GET_HAT_DIR(x) (x & HAT_MASK)
#define GET_HAT(x) (x & (~HAT_MASK))
/* Drivers for EVENT_CMD_DRIVERS_DEINIT and EVENT_CMD_DRIVERS_INIT */
#define DRIVERS_CMD_ALL \
( DRIVER_AUDIO \
| DRIVER_VIDEO \

View File

@ -1171,6 +1171,7 @@ bool rarch_game_options_validate(char *s, size_t len, bool mkdir)
static int rarch_main_init(int argc, char *argv[])
{
int sjlj_ret;
int flags = DRIVERS_CMD_ALL;
bool *verbosity = NULL;
init_state();
@ -1251,7 +1252,7 @@ static int rarch_main_init(int argc, char *argv[])
if (!event_cmd_ctl(EVENT_CMD_CORE_INIT, &current_core_type))
goto error;
event_cmd_ctl(EVENT_CMD_DRIVERS_INIT, NULL);
driver_ctl(RARCH_DRIVER_CTL_INIT, &flags);
event_cmd_ctl(EVENT_CMD_COMMAND_INIT, NULL);
event_cmd_ctl(EVENT_CMD_REMOTE_INIT, NULL);
event_cmd_ctl(EVENT_CMD_REWIND_INIT, NULL);
@ -1349,26 +1350,32 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
rarch_is_inited = true;
break;
case RARCH_CTL_DESTROY:
rarch_is_inited = false;
rarch_error_on_init = false;
rarch_block_config_read = false;
rarch_force_fullscreen = false;
{
int flags = DRIVERS_CMD_ALL;
runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_DEINIT, NULL);
event_cmd_ctl(EVENT_CMD_DRIVERS_DEINIT, NULL);
event_cmd_ctl(EVENT_CMD_LOG_FILE_DEINIT, NULL);
rarch_is_inited = false;
rarch_error_on_init = false;
rarch_block_config_read = false;
rarch_force_fullscreen = false;
runloop_ctl(RUNLOOP_CTL_STATE_FREE, NULL);
runloop_ctl(RUNLOOP_CTL_GLOBAL_FREE, NULL);
runloop_ctl(RUNLOOP_CTL_DATA_DEINIT, NULL);
config_free();
runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_DEINIT, NULL);
driver_ctl(RARCH_DRIVER_CTL_UNINIT, &flags);
event_cmd_ctl(EVENT_CMD_LOG_FILE_DEINIT, NULL);
runloop_ctl(RUNLOOP_CTL_STATE_FREE, NULL);
runloop_ctl(RUNLOOP_CTL_GLOBAL_FREE, NULL);
runloop_ctl(RUNLOOP_CTL_DATA_DEINIT, NULL);
config_free();
}
break;
case RARCH_CTL_DEINIT:
if (!rarch_ctl(RARCH_CTL_IS_INITED, NULL))
return false;
{
int flags = DRIVERS_CMD_ALL;
if (!rarch_ctl(RARCH_CTL_IS_INITED, NULL))
return false;
event_cmd_ctl(EVENT_CMD_DRIVERS_DEINIT, NULL);
event_cmd_ctl(EVENT_CMD_DRIVERS_INIT, NULL);
driver_ctl(RARCH_DRIVER_CTL_UNINIT, &flags);
}
break;
case RARCH_CTL_PREINIT:
if (!config_realloc())