mirror of
https://github.com/libretro/RetroArch
synced 2025-02-11 06:40:48 +00:00
Start implementing action OK for ST_BIND
This commit is contained in:
parent
1a994ef1c3
commit
c53632be81
@ -145,6 +145,7 @@ int menu_action_handle_setting(rarch_setting_t *setting,
|
|||||||
case ST_FLOAT:
|
case ST_FLOAT:
|
||||||
case ST_STRING:
|
case ST_STRING:
|
||||||
case ST_DIR:
|
case ST_DIR:
|
||||||
|
case ST_BIND:
|
||||||
return setting_handler(setting, action);
|
return setting_handler(setting, action);
|
||||||
case ST_PATH:
|
case ST_PATH:
|
||||||
return menu_entries_set_current_path_selection(setting,
|
return menu_entries_set_current_path_selection(setting,
|
||||||
|
@ -1093,6 +1093,44 @@ rarch_setting_t setting_data_string_setting(enum setting_type type,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int setting_data_bind_action_ok(void *data, unsigned action)
|
||||||
|
{
|
||||||
|
struct retro_keybind *bind = NULL;
|
||||||
|
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||||
|
|
||||||
|
if (!setting)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (!driver.menu)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
bind = (struct retro_keybind*)&setting->value.keybind;
|
||||||
|
|
||||||
|
driver.menu->binds.begin = setting->bind_type;
|
||||||
|
driver.menu->binds.last = setting->bind_type;
|
||||||
|
driver.menu->binds.target = bind;
|
||||||
|
driver.menu->binds.player = setting->index;
|
||||||
|
file_list_push(driver.menu->menu_stack, "", "",
|
||||||
|
driver.menu->bind_mode_keyboard ?
|
||||||
|
MENU_SETTINGS_CUSTOM_BIND_KEYBOARD : MENU_SETTINGS_CUSTOM_BIND,
|
||||||
|
driver.menu->selection_ptr);
|
||||||
|
|
||||||
|
if (driver.menu->bind_mode_keyboard)
|
||||||
|
{
|
||||||
|
driver.menu->binds.timeout_end = rarch_get_time_usec() +
|
||||||
|
MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000;
|
||||||
|
input_keyboard_wait_keys(driver.menu,
|
||||||
|
menu_custom_bind_keyboard_cb);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menu_poll_bind_get_rested_axes(&driver.menu->binds);
|
||||||
|
menu_poll_bind_state(&driver.menu->binds);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
rarch_setting_t setting_data_bind_setting(const char* name,
|
rarch_setting_t setting_data_bind_setting(const char* name,
|
||||||
const char* short_description, struct retro_keybind* target,
|
const char* short_description, struct retro_keybind* target,
|
||||||
uint32_t index, const struct retro_keybind* default_value,
|
uint32_t index, const struct retro_keybind* default_value,
|
||||||
@ -1105,6 +1143,8 @@ rarch_setting_t setting_data_bind_setting(const char* name,
|
|||||||
result.default_value.keybind = default_value;
|
result.default_value.keybind = default_value;
|
||||||
result.index = index;
|
result.index = index;
|
||||||
|
|
||||||
|
result.action_ok = setting_data_bind_action_ok;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4292,6 +4332,7 @@ static bool setting_data_append_list_input_options(
|
|||||||
CONFIG_BIND(g_settings.input.binds[0][i], 0,
|
CONFIG_BIND(g_settings.input.binds[0][i], 0,
|
||||||
bind->base, bind->desc, &retro_keybinds_1[i],
|
bind->base, bind->desc, &retro_keybinds_1[i],
|
||||||
group_info.name, subgroup_info.name);
|
group_info.name, subgroup_info.name);
|
||||||
|
settings_list_current_add_bind_type(list, list_info, i + MENU_SETTINGS_BIND_BEGIN);
|
||||||
}
|
}
|
||||||
END_SUB_GROUP(list, list_info);
|
END_SUB_GROUP(list, list_info);
|
||||||
|
|
||||||
|
@ -61,6 +61,15 @@ static void null_write_handler(void *data)
|
|||||||
(void)data;
|
(void)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void settings_list_current_add_bind_type(
|
||||||
|
rarch_setting_t **list,
|
||||||
|
rarch_setting_info_t *list_info,
|
||||||
|
unsigned type)
|
||||||
|
{
|
||||||
|
unsigned index = list_info->index - 1;
|
||||||
|
(*list)[index].bind_type = type;
|
||||||
|
}
|
||||||
|
|
||||||
void settings_list_current_add_flags(
|
void settings_list_current_add_flags(
|
||||||
rarch_setting_t **list,
|
rarch_setting_t **list,
|
||||||
rarch_setting_info_t *list_info,
|
rarch_setting_info_t *list_info,
|
||||||
|
@ -168,6 +168,7 @@ typedef struct rarch_setting
|
|||||||
const char *on_label;
|
const char *on_label;
|
||||||
} boolean;
|
} boolean;
|
||||||
|
|
||||||
|
unsigned bind_type;
|
||||||
float step;
|
float step;
|
||||||
const char *rounding_fraction;
|
const char *rounding_fraction;
|
||||||
bool enforce_minrange;
|
bool enforce_minrange;
|
||||||
@ -183,6 +184,11 @@ void settings_list_current_add_flags(
|
|||||||
rarch_setting_info_t *list_info,
|
rarch_setting_info_t *list_info,
|
||||||
unsigned values);
|
unsigned values);
|
||||||
|
|
||||||
|
void settings_list_current_add_bind_type(
|
||||||
|
rarch_setting_t **list,
|
||||||
|
rarch_setting_info_t *list_info,
|
||||||
|
unsigned type);
|
||||||
|
|
||||||
void settings_list_current_add_range(
|
void settings_list_current_add_range(
|
||||||
rarch_setting_t **list,
|
rarch_setting_t **list,
|
||||||
rarch_setting_info_t *list_info,
|
rarch_setting_info_t *list_info,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user