From 7f81d7a4a8cdc4aa0e1ddf44cc869910acdcea2e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Jan 2016 04:03:02 +0100 Subject: [PATCH] Create CORE_CTL_RETRO_SYMBOLS_INIT --- command_event.c | 6 +----- libretro_version_1.c | 10 ++++++++++ libretro_version_1.h | 2 ++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/command_event.c b/command_event.c index db18c7ec62a1..fea8685c1fba 100644 --- a/command_event.c +++ b/command_event.c @@ -410,8 +410,6 @@ static void event_deinit_core(bool reinit) config_unload_override(); runloop_ctl(RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE, NULL); } - - uninit_libretro_sym(&core); } static void event_init_cheats(void) @@ -573,12 +571,10 @@ static bool event_init_core(void *data) { retro_ctx_environ_info_t info; settings_t *settings = config_get_ptr(); - enum rarch_core_type *core_type = (enum rarch_core_type*)data; - if (!core_type) + if (!core_ctl(CORE_CTL_RETRO_SYMBOLS_INIT, data)) return false; - init_libretro_sym(*core_type, &core); runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_INIT, NULL); /* auto overrides: apply overrides */ diff --git a/libretro_version_1.c b/libretro_version_1.c index 98a971d61918..9e32819a98d1 100644 --- a/libretro_version_1.c +++ b/libretro_version_1.c @@ -174,6 +174,15 @@ bool core_ctl(enum core_ctl_state state, void *data) switch (state) { + case CORE_CTL_RETRO_SYMBOLS_INIT: + { + enum rarch_core_type *core_type = (enum rarch_core_type*)data; + + if (!core_type) + return false; + init_libretro_sym(*core_type, &core); + } + break; case CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE: { retro_ctx_controller_info_t *pad = (retro_ctx_controller_info_t*)data; @@ -278,6 +287,7 @@ bool core_ctl(enum core_ctl_state state, void *data) video_driver_callback_destroy_context(); video_driver_unset_callback(); core.retro_deinit(); + uninit_libretro_sym(&core); break; case CORE_CTL_RETRO_UNLOAD_GAME: core.retro_unload_game(); diff --git a/libretro_version_1.h b/libretro_version_1.h index 8482cad00565..a9faffd2872a 100644 --- a/libretro_version_1.h +++ b/libretro_version_1.h @@ -75,6 +75,8 @@ enum core_ctl_state CORE_CTL_RETRO_UNSERIALIZE, + CORE_CTL_RETRO_SYMBOLS_INIT, + /* Compare libretro core API version against API version * used by RetroArch. *