From c7a9182d594fb025faf614cf6554b7158f7922d3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 6 Apr 2016 00:20:14 +0200 Subject: [PATCH] Create CORE_CTL_{INPUT_DESCRIPTORS} --- configuration.c | 3 ++- dynamic.c | 2 +- libretro_version_1.c | 9 +++++++++ libretro_version_1.h | 8 +++++++- menu/menu_displaylist.c | 4 ++-- menu/menu_setting.c | 2 +- runloop.c | 2 ++ runloop.h | 1 - 8 files changed, 24 insertions(+), 7 deletions(-) diff --git a/configuration.c b/configuration.c index a679bb23a2..490263a7e3 100644 --- a/configuration.c +++ b/configuration.c @@ -32,6 +32,7 @@ #include "input/input_remapping.h" #include "defaults.h" #include "general.h" +#include "libretro_version_1.h" #include "retroarch.h" #include "system.h" #include "verbosity.h" @@ -2422,7 +2423,7 @@ void config_load(void) config_save_file(global->path.core_specific_config); /* Flush out some states that could have been set by core environment variables */ - global->has_set.input_descriptors = false; + core_ctl(CORE_CTL_UNSET_INPUT_DESCRIPTORS, NULL); if (!rarch_ctl(RARCH_CTL_IS_BLOCK_CONFIG_READ, NULL)) { diff --git a/dynamic.c b/dynamic.c index a265907cba..0799b42d4e 100644 --- a/dynamic.c +++ b/dynamic.c @@ -873,7 +873,7 @@ bool rarch_environment_cb(unsigned cmd, void *data) } } - global->has_set.input_descriptors = true; + core_ctl(CORE_CTL_SET_INPUT_DESCRIPTORS, NULL); break; } diff --git a/libretro_version_1.c b/libretro_version_1.c index 90984827a8..08288e39db 100644 --- a/libretro_version_1.c +++ b/libretro_version_1.c @@ -173,6 +173,7 @@ static void retro_set_rewind_callbacks(void) bool core_ctl(enum core_ctl_state state, void *data) { + static bool has_set_input_descriptors = false; static struct retro_callbacks retro_ctx; switch (state) @@ -366,6 +367,14 @@ bool core_ctl(enum core_ctl_state state, void *data) } } break; + case CORE_CTL_HAS_SET_INPUT_DESCRIPTORS: + return has_set_input_descriptors; + case CORE_CTL_SET_INPUT_DESCRIPTORS: + has_set_input_descriptors = true; + break; + case CORE_CTL_UNSET_INPUT_DESCRIPTORS: + has_set_input_descriptors = false; + break; case CORE_CTL_NONE: default: break; diff --git a/libretro_version_1.h b/libretro_version_1.h index 3eef98c498..01799e00d7 100644 --- a/libretro_version_1.h +++ b/libretro_version_1.h @@ -108,7 +108,13 @@ enum core_ctl_state CORE_CTL_RETRO_LOAD_GAME, - CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE + CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE, + + CORE_CTL_HAS_SET_INPUT_DESCRIPTORS, + + CORE_CTL_SET_INPUT_DESCRIPTORS, + + CORE_CTL_UNSET_INPUT_DESCRIPTORS }; typedef struct retro_ctx_input_state_info diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 2b79867bf9..ab2eb9a3b7 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -35,6 +35,7 @@ #include "../general.h" #include "../retroarch.h" #include "../system.h" +#include "../libretro_version_1.h" #include "../frontend/frontend_driver.h" #include "../ui/ui_companion_driver.h" #include "../gfx/video_shader_driver.h" @@ -2026,7 +2027,6 @@ static int menu_displaylist_parse_load_content_settings( menu_displaylist_info_t *info) { menu_handle_t *menu = NULL; - global_t *global = global_get_ptr(); #ifdef HAVE_CHEEVOS settings_t *settings = config_get_ptr(); #endif @@ -2077,7 +2077,7 @@ static int menu_displaylist_parse_load_content_settings( menu_hash_to_str(MENU_LABEL_CORE_OPTIONS), MENU_SETTING_ACTION, 0, 0); - if (global->has_set.input_descriptors) + if (core_ctl(CORE_CTL_HAS_SET_INPUT_DESCRIPTORS, NULL)) menu_entries_push(info->list, menu_hash_to_str(MENU_LABEL_VALUE_CORE_INPUT_REMAPPING_OPTIONS), menu_hash_to_str(MENU_LABEL_CORE_INPUT_REMAPPING_OPTIONS), diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 83e7921535..e5919b276d 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -3327,7 +3327,7 @@ static bool setting_append_list_input_player_options( if ( settings->input.input_descriptor_label_show && (i < RARCH_FIRST_META_KEY) - && (global->has_set.input_descriptors) + && (core_ctl(CORE_CTL_HAS_SET_INPUT_DESCRIPTORS, NULL)) && (i != RARCH_TURBO_ENABLE) ) { diff --git a/runloop.c b/runloop.c index 2437396fe1..4ed991aaa8 100644 --- a/runloop.c +++ b/runloop.c @@ -901,6 +901,8 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL); runloop_overrides_active = false; + core_ctl(CORE_CTL_UNSET_INPUT_DESCRIPTORS, NULL); + global = global_get_ptr(); memset(global, 0, sizeof(struct global)); } diff --git a/runloop.h b/runloop.h index b8f8af2e59..68b4b0a28a 100644 --- a/runloop.h +++ b/runloop.h @@ -184,7 +184,6 @@ typedef struct global struct { - bool input_descriptors; bool save_path; bool state_path; bool libretro_device[MAX_USERS];