Create CORE_CTL_{INPUT_DESCRIPTORS}

This commit is contained in:
twinaphex 2016-04-06 00:20:14 +02:00
parent 9a90008543
commit c7a9182d59
8 changed files with 24 additions and 7 deletions

View File

@ -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))
{

View File

@ -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;
}

View File

@ -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;

View File

@ -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

View File

@ -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),

View File

@ -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)
)
{

View File

@ -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));
}

View File

@ -184,7 +184,6 @@ typedef struct global
struct
{
bool input_descriptors;
bool save_path;
bool state_path;
bool libretro_device[MAX_USERS];