mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 09:39:56 +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)
|
static void read_keybinds_user(config_file_t *conf, unsigned user)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
|
|
||||||
for (i = 0; input_config_bind_map_get_valid(i); i++)
|
for (i = 0; input_config_bind_map_get_valid(i); i++)
|
||||||
{
|
{
|
||||||
struct retro_keybind *bind = (struct retro_keybind*)
|
struct retro_keybind *bind = input_config_get_specific_bind_ptr(user, i);
|
||||||
&settings->input.binds[user][i];
|
|
||||||
|
|
||||||
if (!bind->valid)
|
if (!bind->valid)
|
||||||
continue;
|
continue;
|
||||||
|
@ -150,6 +150,12 @@ const struct input_bind_map input_config_bind_map[RARCH_BIND_LIST_END_NULL] = {
|
|||||||
#endif
|
#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)
|
const struct retro_keybind *input_config_get_specific_bind(unsigned i, unsigned j)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
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);
|
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);
|
const struct retro_keybind *input_config_get_specific_bind(unsigned i, unsigned j);
|
||||||
|
|
||||||
struct retro_keybind *input_config_get_binds(unsigned i);
|
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
|
remap_id = settings->input.remap_ids
|
||||||
[inp_desc_user][inp_desc_button_index_offset];
|
[inp_desc_user][inp_desc_button_index_offset];
|
||||||
|
|
||||||
keybind = (const struct retro_keybind*)
|
keybind = input_config_get_specific_bind(inp_desc_user, remap_id);
|
||||||
&settings->input.binds[inp_desc_user][remap_id];
|
|
||||||
auto_bind = (const struct retro_keybind*)
|
auto_bind = (const struct retro_keybind*)
|
||||||
input_config_get_bind_auto(inp_desc_user, remap_id);
|
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,
|
descriptor,
|
||||||
len);
|
len);
|
||||||
else
|
else
|
||||||
strlcpy(s,
|
{
|
||||||
msg_hash_to_str(settings->input.binds[inp_desc_user][remap_id].enum_idx),
|
const struct retro_keybind *keyptr = input_config_get_specific_bind(inp_desc_user,
|
||||||
len);
|
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
|
else
|
||||||
key = input_config_translate_str_to_bind_id(label);
|
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)
|
if (target)
|
||||||
{
|
{
|
||||||
|
@ -1339,8 +1339,7 @@ static int setting_action_ok_bind_defaults(void *data, bool wraparound)
|
|||||||
if (!setting)
|
if (!setting)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
target = (struct retro_keybind*)
|
target = input_config_get_specific_bind_ptr(setting->index_offset, 0);
|
||||||
&settings->input.binds[setting->index_offset][0];
|
|
||||||
def_binds = (setting->index_offset) ?
|
def_binds = (setting->index_offset) ?
|
||||||
retro_keybinds_rest : retro_keybinds_1;
|
retro_keybinds_rest : retro_keybinds_1;
|
||||||
|
|
||||||
@ -2092,7 +2091,7 @@ static bool setting_append_list_input_player_options(
|
|||||||
|
|
||||||
CONFIG_BIND_ALT(
|
CONFIG_BIND_ALT(
|
||||||
list, list_info,
|
list, list_info,
|
||||||
&settings->input.binds[user][i],
|
input_config_get_specific_bind_ptr(user, i),
|
||||||
user + 1,
|
user + 1,
|
||||||
user,
|
user,
|
||||||
strdup(name),
|
strdup(name),
|
||||||
@ -4410,7 +4409,8 @@ static bool setting_append_list(
|
|||||||
|
|
||||||
CONFIG_BIND_ALT(
|
CONFIG_BIND_ALT(
|
||||||
list, list_info,
|
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_base(i)),
|
||||||
strdup(input_config_bind_map_get_desc(i)),
|
strdup(input_config_bind_map_get_desc(i)),
|
||||||
&retro_keybinds_1[i],
|
&retro_keybinds_1[i],
|
||||||
|
@ -117,8 +117,7 @@ static int menu_input_key_bind_set_mode_common(
|
|||||||
menu_displaylist_ctl(DISPLAYLIST_PROCESS, &info);
|
menu_displaylist_ctl(DISPLAYLIST_PROCESS, &info);
|
||||||
break;
|
break;
|
||||||
case MENU_INPUT_BINDS_CTL_BIND_ALL:
|
case MENU_INPUT_BINDS_CTL_BIND_ALL:
|
||||||
menu_input_binds.target = &settings->input.binds
|
menu_input_binds.target = input_config_get_specific_bind_ptr(index_offset, 0);
|
||||||
[index_offset][0];
|
|
||||||
menu_input_binds.begin = MENU_SETTINGS_BIND_BEGIN;
|
menu_input_binds.begin = MENU_SETTINGS_BIND_BEGIN;
|
||||||
menu_input_binds.last = MENU_SETTINGS_BIND_LAST;
|
menu_input_binds.last = MENU_SETTINGS_BIND_LAST;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user