From f4fc179cae3fa5b83d93c70cb3a5c957148f647a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 7 Dec 2015 14:24:28 +0100 Subject: [PATCH] Add some more private libretro environs --- dynamic.c | 18 ++++++++++++------ libretro_private.h | 4 ++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/dynamic.c b/dynamic.c index ee9d31a6eb..38d280d76b 100644 --- a/dynamic.c +++ b/dynamic.c @@ -67,7 +67,6 @@ static dylib_t lib_handle; #endif struct retro_core_t core; -static bool ignore_environment_cb; #ifdef HAVE_DYNAMIC static bool *load_no_content_hook; @@ -115,9 +114,9 @@ void libretro_get_environment_info(void (*func)(retro_environment_t), /* It's possible that we just set get_system_info callback to the currently running core. * Make sure we reset it to the actual environment callback. * Ignore any environment callbacks here in case we're running on the non-current core. */ - ignore_environment_cb = true; + rarch_environment_cb(RETRO_ENVIRONMENT_SET_IGNORE_ENVIRON_CB, NULL); func(rarch_environment_cb); - ignore_environment_cb = false; + rarch_environment_cb(RETRO_ENVIRONMENT_UNSET_IGNORE_ENVIRON_CB, NULL); } static dylib_t libretro_get_system_info_lib(const char *path, @@ -604,9 +603,10 @@ static void rarch_log_libretro(enum retro_log_level level, bool rarch_environment_cb(unsigned cmd, void *data) { unsigned p; - settings_t *settings = config_get_ptr(); - global_t *global = global_get_ptr(); - rarch_system_info_t *system = rarch_system_info_get_ptr(); + static bool ignore_environment_cb = false; + settings_t *settings = config_get_ptr(); + global_t *global = global_get_ptr(); + rarch_system_info_t *system = rarch_system_info_get_ptr(); if (ignore_environment_cb) return false; @@ -1232,6 +1232,12 @@ bool rarch_environment_cb(unsigned cmd, void *data) RARCH_LOG("Environ (Private) EXEC.\n"); } break; + case RETRO_ENVIRONMENT_SET_IGNORE_ENVIRON_CB: + ignore_environment_cb = true; + break; + case RETRO_ENVIRONMENT_UNSET_IGNORE_ENVIRON_CB: + ignore_environment_cb = false; + break; default: RARCH_LOG("Environ UNSUPPORTED (#%u).\n", cmd); diff --git a/libretro_private.h b/libretro_private.h index 7d1a3cccda..1badd414a1 100644 --- a/libretro_private.h +++ b/libretro_private.h @@ -60,6 +60,10 @@ * _EXEC. NULL means no game. */ +#define RETRO_ENVIRONMENT_SET_IGNORE_ENVIRON_CB (RETRO_ENVIRONMENT_PRIVATE | 3) + +#define RETRO_ENVIRONMENT_UNSET_IGNORE_ENVIRON_CB (RETRO_ENVIRONMENT_PRIVATE | 4) + #endif