From eb503e0464eeb467ddb32c384442a0478af59dd4 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Jan 2016 03:41:30 +0100 Subject: [PATCH] Start getting rid of hardcoded core\. references --- command_event.c | 2 +- dynamic.c | 20 +++++++++----------- dynamic.h | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/command_event.c b/command_event.c index da598ef0a8..db18c7ec62 100644 --- a/command_event.c +++ b/command_event.c @@ -578,7 +578,7 @@ static bool event_init_core(void *data) if (!core_type) return false; - init_libretro_sym(*core_type); + init_libretro_sym(*core_type, &core); runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_INIT, NULL); /* auto overrides: apply overrides */ diff --git a/dynamic.c b/dynamic.c index 31c92711c7..f1030494b9 100644 --- a/dynamic.c +++ b/dynamic.c @@ -50,23 +50,21 @@ #ifdef HAVE_DYNAMIC #define SYMBOL(x) do { \ function_t func = dylib_proc(lib_handle, #x); \ - memcpy(&core.x, &func, sizeof(func)); \ - if (core.x == NULL) { RARCH_ERR("Failed to load symbol: \"%s\"\n", #x); retro_fail(1, "init_libretro_sym()"); } \ + memcpy(¤t_core->x, &func, sizeof(func)); \ + if (current_core->x == NULL) { RARCH_ERR("Failed to load symbol: \"%s\"\n", #x); retro_fail(1, "init_libretro_sym()"); } \ } while (0) static dylib_t lib_handle; #else -#define SYMBOL(x) core.x = x +#define SYMBOL(x) current_core->x = x #endif -#define SYMBOL_DUMMY(x) core.x = libretro_dummy_##x - +#define SYMBOL_DUMMY(x) current_core->x = libretro_dummy_##x #ifdef HAVE_FFMPEG -#define SYMBOL_FFMPEG(x) core.x = libretro_ffmpeg_##x +#define SYMBOL_FFMPEG(x) current_core->x = libretro_ffmpeg_##x #endif - #ifdef HAVE_IMAGEVIEWER -#define SYMBOL_IMAGEVIEWER(x) core.x = libretro_imageviewer_##x +#define SYMBOL_IMAGEVIEWER(x) current_core->x = libretro_imageviewer_##x #endif struct retro_core_t core; @@ -308,7 +306,7 @@ static void load_dynamic_core(void) * * Setup libretro callback symbols. **/ -static void load_symbols(enum rarch_core_type type) +static void load_symbols(enum rarch_core_type type, struct retro_core_t *current_core) { switch (type) { @@ -512,13 +510,13 @@ void libretro_get_current_core_pathname(char *name, size_t size) * Initializes libretro symbols and * setups environment callback functions. **/ -void init_libretro_sym(enum rarch_core_type type) +void init_libretro_sym(enum rarch_core_type type, struct retro_core_t *current_core) { /* Guarantee that we can do "dirty" casting. * Every OS that this program supports should pass this. */ retro_assert(sizeof(void*) == sizeof(void (*)(void))); - load_symbols(type); + load_symbols(type, current_core); } /** diff --git a/dynamic.h b/dynamic.h index aa37662743..899ff80632 100644 --- a/dynamic.h +++ b/dynamic.h @@ -162,7 +162,7 @@ extern struct retro_core_t core; * Initializes libretro symbols and * setups environment callback functions. **/ -void init_libretro_sym(enum rarch_core_type type); +void init_libretro_sym(enum rarch_core_type type, struct retro_core_t *core); /** * uninit_libretro_sym: