Skip to content

Commit

Permalink
Start getting rid of hardcoded core\. references
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed Jan 28, 2016
1 parent 6e3041e commit eb503e0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion command_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
20 changes: 9 additions & 11 deletions dynamic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(&current_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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion dynamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit eb503e0

Please sign in to comment.