mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 06:40:18 +00:00
Wrap settings->input.binds
This commit is contained in:
parent
4845c4b4db
commit
8d0e3d7777
@ -1642,12 +1642,10 @@ static void read_keybinds_axis(config_file_t *conf, unsigned user,
|
||||
static void read_keybinds_user(config_file_t *conf, unsigned user)
|
||||
{
|
||||
unsigned i;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
for (i = 0; input_config_bind_map_get_valid(i); i++)
|
||||
{
|
||||
struct retro_keybind *bind = (struct retro_keybind*)
|
||||
&settings->input.binds[user][i];
|
||||
struct retro_keybind *bind = input_config_get_specific_bind_ptr(user, i);
|
||||
|
||||
if (!bind->valid)
|
||||
continue;
|
||||
|
@ -150,6 +150,12 @@ const struct input_bind_map input_config_bind_map[RARCH_BIND_LIST_END_NULL] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
struct retro_keybind *input_config_get_specific_bind_ptr(unsigned i, unsigned j)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
return (struct retro_keybind*)&settings->input.binds[i][j];
|
||||
}
|
||||
|
||||
const struct retro_keybind *input_config_get_specific_bind(unsigned i, unsigned j)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
@ -89,6 +89,8 @@ void input_config_set_vid(unsigned port, unsigned vid);
|
||||
|
||||
int32_t input_config_get_vid(unsigned port);
|
||||
|
||||
struct retro_keybind *input_config_get_specific_bind_ptr(unsigned i, unsigned j);
|
||||
|
||||
const struct retro_keybind *input_config_get_specific_bind(unsigned i, unsigned j);
|
||||
|
||||
struct retro_keybind *input_config_get_binds(unsigned i);
|
||||
|
@ -453,8 +453,7 @@ static void menu_action_setting_disp_set_label_input_desc(
|
||||
remap_id = settings->input.remap_ids
|
||||
[inp_desc_user][inp_desc_button_index_offset];
|
||||
|
||||
keybind = (const struct retro_keybind*)
|
||||
&settings->input.binds[inp_desc_user][remap_id];
|
||||
keybind = input_config_get_specific_bind(inp_desc_user, remap_id);
|
||||
auto_bind = (const struct retro_keybind*)
|
||||
input_config_get_bind_auto(inp_desc_user, remap_id);
|
||||
|
||||
@ -469,9 +468,12 @@ static void menu_action_setting_disp_set_label_input_desc(
|
||||
descriptor,
|
||||
len);
|
||||
else
|
||||
strlcpy(s,
|
||||
msg_hash_to_str(settings->input.binds[inp_desc_user][remap_id].enum_idx),
|
||||
len);
|
||||
{
|
||||
const struct retro_keybind *keyptr = input_config_get_specific_bind(inp_desc_user,
|
||||
remap_id);
|
||||
|
||||
strlcpy(s, msg_hash_to_str(keyptr->enum_idx), len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -138,7 +138,8 @@ static int action_scan_input_desc(const char *path,
|
||||
else
|
||||
key = input_config_translate_str_to_bind_id(label);
|
||||
|
||||
target = (struct retro_keybind*)&settings->input.binds[inp_desc_user][key];
|
||||
target = input_config_get_specific_bind_ptr(inp_desc_user,
|
||||
key);
|
||||
|
||||
if (target)
|
||||
{
|
||||
|
@ -1339,8 +1339,7 @@ static int setting_action_ok_bind_defaults(void *data, bool wraparound)
|
||||
if (!setting)
|
||||
return -1;
|
||||
|
||||
target = (struct retro_keybind*)
|
||||
&settings->input.binds[setting->index_offset][0];
|
||||
target = input_config_get_specific_bind_ptr(setting->index_offset, 0);
|
||||
def_binds = (setting->index_offset) ?
|
||||
retro_keybinds_rest : retro_keybinds_1;
|
||||
|
||||
@ -2092,7 +2091,7 @@ static bool setting_append_list_input_player_options(
|
||||
|
||||
CONFIG_BIND_ALT(
|
||||
list, list_info,
|
||||
&settings->input.binds[user][i],
|
||||
input_config_get_specific_bind_ptr(user, i),
|
||||
user + 1,
|
||||
user,
|
||||
strdup(name),
|
||||
@ -4410,7 +4409,8 @@ static bool setting_append_list(
|
||||
|
||||
CONFIG_BIND_ALT(
|
||||
list, list_info,
|
||||
&settings->input.binds[0][i], 0, 0,
|
||||
input_config_get_specific_bind_ptr(0, i),
|
||||
0, 0,
|
||||
strdup(input_config_bind_map_get_base(i)),
|
||||
strdup(input_config_bind_map_get_desc(i)),
|
||||
&retro_keybinds_1[i],
|
||||
|
@ -117,8 +117,7 @@ static int menu_input_key_bind_set_mode_common(
|
||||
menu_displaylist_ctl(DISPLAYLIST_PROCESS, &info);
|
||||
break;
|
||||
case MENU_INPUT_BINDS_CTL_BIND_ALL:
|
||||
menu_input_binds.target = &settings->input.binds
|
||||
[index_offset][0];
|
||||
menu_input_binds.target = input_config_get_specific_bind_ptr(index_offset, 0);
|
||||
menu_input_binds.begin = MENU_SETTINGS_BIND_BEGIN;
|
||||
menu_input_binds.last = MENU_SETTINGS_BIND_LAST;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user