Implement input descriptor labels

This commit is contained in:
twinaphex 2014-12-04 13:26:27 +01:00
parent 7aff514f94
commit e3e5f5f8a8
5 changed files with 38 additions and 3 deletions

View File

@ -636,6 +636,10 @@ static const unsigned turbo_duty_cycle = 3;
* gamepads, plug-and-play style. */
static const bool input_autodetect_enable = true;
/* Show the input descriptors set by the core instead
* of the default ones. */
static const bool input_descriptor_label_show = true;
#ifndef IS_SALAMANDER
#include "intl/intl.h"

View File

@ -378,6 +378,7 @@ struct settings
float overlay_scale;
char autoconfig_dir[PATH_MAX];
bool input_descriptor_label_show;
} input;
struct

View File

@ -316,6 +316,10 @@
# joypads, Plug-and-Play style.
# input_autodetect_enable = true
# Show the input descriptors set by the core instead of the
# default ones.
# input_descriptor_label_show = true
# Directory for joypad autoconfigs.
# If a joypad is plugged in, that joypad will be autoconfigured if a config file
# corresponding to that joypad is present in joypad_autoconfig_dir.

View File

@ -437,9 +437,11 @@ static void config_set_defaults(void)
g_settings.menu.navigation.wraparound.vertical_enable = true;
#endif
g_settings.location.allow = false;
g_settings.camera.allow = false;
g_settings.input.input_descriptor_label_show = input_descriptor_label_show;
rarch_assert(sizeof(g_settings.input.binds[0]) >= sizeof(retro_keybinds_1));
rarch_assert(sizeof(g_settings.input.binds[1]) >= sizeof(retro_keybinds_rest));
memcpy(g_settings.input.binds[0], retro_keybinds_1, sizeof(retro_keybinds_1));
@ -996,6 +998,8 @@ static bool config_load_file(const char *path, bool set_defaults)
CONFIG_GET_FLOAT(input.axis_threshold, "input_axis_threshold");
CONFIG_GET_BOOL(input.netplay_client_swap_input,
"netplay_client_swap_input");
CONFIG_GET_BOOL(input.input_descriptor_label_show,
"input_descriptor_label_show");
for (i = 0; i < MAX_PLAYERS; i++)
{
@ -1553,6 +1557,10 @@ bool config_save_file(const char *path)
config_set_float(conf, "input_axis_threshold",
g_settings.input.axis_threshold);
config_set_bool(conf, "netplay_client_swap_input",
g_settings.input.netplay_client_swap_input);
config_set_bool(conf, "input_descriptor_label_show",
g_settings.input.input_descriptor_label_show);
config_set_bool(conf, "load_dummy_on_core_shutdown",
g_settings.load_dummy_on_core_shutdown);
config_set_bool(conf, "fps_show", g_settings.fps_show);

View File

@ -1292,8 +1292,7 @@ int setting_data_get_description(const char *label, char *msg,
" \n"
"This driver requires an active TTY. Keyboard \n"
"events are read directly from the TTY which \n"
"makes it simpler, but not as flexible as udev. \n"
"Mice, etc, are not supported at all. \n"
"makes it simpler, but not as flexible as udev. \n" "Mice, etc, are not supported at all. \n"
" \n"
"This driver uses the older joystick API \n"
"(/dev/input/js*).");
@ -4309,6 +4308,19 @@ static bool setting_data_append_list_input_options(
subgroup_info.name,
general_write_handler,
general_read_handler);
CONFIG_BOOL(
g_settings.input.input_descriptor_label_show,
"input_descriptor_label_show",
"Show Core Input Descriptor Labels",
input_descriptor_label_show,
"OFF",
"ON",
group_info.name,
subgroup_info.name,
general_write_handler,
general_read_handler);
END_SUB_GROUP(list, list_info);
START_SUB_GROUP(
@ -4525,7 +4537,13 @@ static bool setting_data_append_list_input_options(
if (!keybind || keybind->meta)
continue;
snprintf(label, sizeof(label), "%s %s", buffer[player], keybind->desc);
if (g_settings.input.input_descriptor_label_show)
snprintf(label, sizeof(label), "%s %s", buffer[player],
g_extern.system.input_desc_btn[player][i]
? g_extern.system.input_desc_btn[player][i] : keybind->desc);
else
snprintf(label, sizeof(label), "%s %s", buffer[player], keybind->desc);
snprintf(name, sizeof(name), "p%u_%s", player + 1, keybind->base);
CONFIG_BIND(