mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 07:20:36 +00:00
Create Input Bind Timeout setting
This commit is contained in:
parent
9a5b13cccf
commit
f9b535ea91
@ -784,6 +784,8 @@ static const unsigned input_max_users = 5;
|
||||
|
||||
static const unsigned input_poll_type_behavior = 2;
|
||||
|
||||
static const unsigned input_bind_timeout = 5;
|
||||
|
||||
static const unsigned menu_thumbnails_default = 3;
|
||||
|
||||
#ifdef IOS
|
||||
|
@ -632,6 +632,7 @@ static void config_set_defaults(void)
|
||||
#endif
|
||||
|
||||
settings->input.back_as_menu_toggle_enable = true;
|
||||
settings->input.bind_timeout = input_bind_timeout;
|
||||
settings->input.input_descriptor_label_show = input_descriptor_label_show;
|
||||
settings->input.input_descriptor_hide_unbound = input_descriptor_hide_unbound;
|
||||
settings->input.remap_binds_enable = true;
|
||||
@ -1813,6 +1814,7 @@ static bool config_load_file(const char *path, bool set_defaults)
|
||||
|
||||
CONFIG_GET_INT_BASE(conf, settings, content_history_size, "content_history_size");
|
||||
|
||||
CONFIG_GET_INT_BASE(conf, settings, input.bind_timeout, "input_bind_timeout");
|
||||
CONFIG_GET_INT_BASE(conf, settings, input.turbo_period, "input_turbo_period");
|
||||
CONFIG_GET_INT_BASE(conf, settings, input.turbo_duty_cycle, "input_duty_cycle");
|
||||
|
||||
@ -2597,6 +2599,7 @@ bool config_save_file(const char *path)
|
||||
|
||||
RARCH_LOG("Saving config at path: \"%s\"\n", path);
|
||||
|
||||
config_set_int(conf, "input_bind_timeout", settings->input.bind_timeout);
|
||||
config_set_int(conf, "input_turbo_period", settings->input.turbo_period);
|
||||
config_set_int(conf, "input_duty_cycle", settings->input.turbo_duty_cycle);
|
||||
config_set_int(conf, "input_max_users", settings->input.max_users);
|
||||
|
@ -249,6 +249,7 @@ typedef struct settings
|
||||
float overlay_opacity;
|
||||
float overlay_scale;
|
||||
|
||||
unsigned bind_timeout;
|
||||
bool input_descriptor_label_show;
|
||||
bool input_descriptor_hide_unbound;
|
||||
|
||||
|
@ -1673,6 +1673,8 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg)
|
||||
return "input_duty_cycle";
|
||||
case MENU_ENUM_LABEL_INPUT_TURBO_PERIOD:
|
||||
return "input_turbo_period";
|
||||
case MENU_ENUM_LABEL_INPUT_BIND_TIMEOUT:
|
||||
return "input_bind_timeout";
|
||||
case MENU_ENUM_LABEL_INPUT_AXIS_THRESHOLD:
|
||||
return "input_axis_threshold";
|
||||
case MENU_ENUM_LABEL_INPUT_REMAP_BINDS_ENABLE:
|
||||
@ -2705,6 +2707,8 @@ const char *msg_hash_to_str_us(enum msg_hash_enums msg)
|
||||
return "Duty Cycle";
|
||||
case MENU_ENUM_LABEL_VALUE_INPUT_TURBO_PERIOD:
|
||||
return "Turbo Period";
|
||||
case MENU_ENUM_LABEL_VALUE_INPUT_BIND_TIMEOUT:
|
||||
return "Bind Timeout";
|
||||
case MENU_ENUM_LABEL_VALUE_INPUT_AXIS_THRESHOLD:
|
||||
return "Input Axis Threshold";
|
||||
case MENU_ENUM_LABEL_VALUE_INPUT_REMAP_BINDS_ENABLE:
|
||||
|
@ -4207,6 +4207,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
MENU_ENUM_LABEL_INPUT_DESCRIPTOR_HIDE_UNBOUND, PARSE_ONLY_BOOL, false);
|
||||
ret = menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_INPUT_AXIS_THRESHOLD, PARSE_ONLY_FLOAT, false);
|
||||
ret = menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_INPUT_BIND_TIMEOUT, PARSE_ONLY_UINT, false);
|
||||
ret = menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_INPUT_TURBO_PERIOD, PARSE_ONLY_UINT, false);
|
||||
ret = menu_displaylist_parse_settings_enum(menu, info,
|
||||
|
@ -50,9 +50,6 @@ RETRO_BEGIN_DECLS
|
||||
#define MENU_SETTINGS_PLAYLIST_ASSOCIATION_START 0x20000
|
||||
#define MENU_SETTINGS_CHEEVOS_START 0x40000
|
||||
|
||||
|
||||
#define MENU_KEYBOARD_BIND_TIMEOUT_SECONDS 5
|
||||
|
||||
enum menu_image_type
|
||||
{
|
||||
MENU_IMAGE_NONE = 0,
|
||||
|
@ -226,6 +226,7 @@ static bool menu_input_key_bind_custom_bind_keyboard_cb(
|
||||
void *data, unsigned code)
|
||||
{
|
||||
menu_input_t *menu_input = menu_input_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!menu_input)
|
||||
return false;
|
||||
@ -234,7 +235,7 @@ static bool menu_input_key_bind_custom_bind_keyboard_cb(
|
||||
menu_input->binds.begin++;
|
||||
menu_input->binds.target++;
|
||||
menu_input->binds.timeout_end = cpu_features_get_time_usec() +
|
||||
MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000;
|
||||
settings->input.bind_timeout * 1000000;
|
||||
|
||||
return (menu_input->binds.begin <= menu_input->binds.last);
|
||||
}
|
||||
@ -424,7 +425,7 @@ static bool menu_input_key_bind_set_mode(
|
||||
&menu_input->binds, bind_port, false);
|
||||
|
||||
menu_input->binds.timeout_end = cpu_features_get_time_usec() +
|
||||
MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000;
|
||||
settings->input.bind_timeout * 1000000;
|
||||
|
||||
keys.userdata = menu;
|
||||
keys.cb = menu_input_key_bind_custom_bind_keyboard_cb;
|
||||
@ -542,6 +543,7 @@ static bool menu_input_key_bind_iterate(char *s, size_t len)
|
||||
struct menu_bind_state binds;
|
||||
bool timed_out = false;
|
||||
menu_input_t *menu_input = menu_input_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
int64_t current = cpu_features_get_time_usec();
|
||||
int timeout =
|
||||
(menu_input->binds.timeout_end - current) / 1000000;
|
||||
@ -553,7 +555,7 @@ static bool menu_input_key_bind_iterate(char *s, size_t len)
|
||||
menu_input->binds.begin++;
|
||||
menu_input->binds.target++;
|
||||
menu_input->binds.timeout_end = cpu_features_get_time_usec() +
|
||||
MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000;
|
||||
settings->input.bind_timeout * 1000000;
|
||||
timed_out = true;
|
||||
}
|
||||
|
||||
@ -600,7 +602,7 @@ static bool menu_input_key_bind_iterate(char *s, size_t len)
|
||||
|
||||
binds.target++;
|
||||
binds.timeout_end = cpu_features_get_time_usec() +
|
||||
MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000;
|
||||
settings->input.bind_timeout * 1000000;
|
||||
}
|
||||
menu_input->binds = binds;
|
||||
|
||||
|
@ -5881,6 +5881,21 @@ static bool setting_append_list(
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 1.00, 0.001, true, true);
|
||||
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_INPUT_AXIS_THRESHOLD);
|
||||
|
||||
CONFIG_UINT(
|
||||
list, list_info,
|
||||
&settings->input.bind_timeout,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_INPUT_BIND_TIMEOUT),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_BIND_TIMEOUT),
|
||||
input_bind_timeout,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_range(list, list_info, 1, 0, 1, true, false);
|
||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED);
|
||||
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_INPUT_BIND_TIMEOUT);
|
||||
|
||||
CONFIG_UINT(
|
||||
list, list_info,
|
||||
|
@ -260,6 +260,7 @@ enum msg_hash_enums
|
||||
MENU_ENUM_LABEL_INPUT_BIND_DEVICE_TYPE,
|
||||
MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW,
|
||||
MENU_ENUM_LABEL_INPUT_DRIVER_UDEV,
|
||||
MENU_ENUM_LABEL_INPUT_BIND_TIMEOUT,
|
||||
MENU_ENUM_LABEL_INPUT_TURBO_PERIOD,
|
||||
MENU_ENUM_LABEL_INPUT_MAX_USERS,
|
||||
MENU_ENUM_LABEL_INPUT_REMAP_BINDS_ENABLE,
|
||||
@ -301,6 +302,7 @@ enum msg_hash_enums
|
||||
MENU_ENUM_LABEL_VALUE_INPUT_MAX_USERS,
|
||||
MENU_ENUM_LABEL_VALUE_INPUT_REMAP_BINDS_ENABLE,
|
||||
MENU_ENUM_LABEL_VALUE_INPUT_AXIS_THRESHOLD,
|
||||
MENU_ENUM_LABEL_VALUE_INPUT_BIND_TIMEOUT,
|
||||
MENU_ENUM_LABEL_VALUE_INPUT_TURBO_PERIOD,
|
||||
MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_ENABLE,
|
||||
MENU_ENUM_LABEL_VALUE_INPUT_OSK_OVERLAY_ENABLE,
|
||||
|
@ -343,6 +343,10 @@
|
||||
# Path to input remapping file.
|
||||
# input_remapping_path =
|
||||
|
||||
# Input bind timer timeout.
|
||||
# Amount of seconds to wait until proceeding to the next bind. Default: 5, minimum: 1
|
||||
# input_bind_timeout = 1
|
||||
|
||||
# If enabled, overrides the input binds with the remapped binds set for the current core.
|
||||
# input_remap_binds_enable = true
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user