Don't expose input_bind_map outside anymore

This commit is contained in:
twinaphex 2015-11-28 00:51:33 +01:00
parent 1f5b121505
commit 0ca0bd182b
4 changed files with 41 additions and 14 deletions

View File

@ -116,14 +116,38 @@ const struct input_bind_map input_config_bind_map[RARCH_BIND_LIST_END_NULL] = {
#endif
};
const char *input_bind_map_get_base(const void *data)
const void *input_bind_map_get(unsigned i)
{
const struct input_bind_map* keybind = (const struct input_bind_map*)data;
const struct input_bind_map* keybind = (const struct input_bind_map*)&input_config_bind_map[i];
if (!keybind)
return NULL;
return keybind;
}
unsigned input_bind_map_get_meta(unsigned i)
{
const struct input_bind_map* keybind = (const struct input_bind_map*)input_bind_map_get(i);
if (!keybind)
return 0;
return keybind->meta;
}
const char *input_bind_map_get_base(unsigned i)
{
const struct input_bind_map* keybind = (const struct input_bind_map*)input_bind_map_get(i);
if (!keybind)
return NULL;
return keybind->base;
}
const char *input_bind_map_get_desc(unsigned i)
{
const struct input_bind_map* keybind = (const struct input_bind_map*)input_bind_map_get(i);
if (!keybind)
return NULL;
return keybind->desc;
}
/**
* input_translate_coord_viewport:
* @mouse_x : Pointer X coordinate.

View File

@ -40,7 +40,13 @@ struct input_bind_map
extern const struct input_bind_map input_config_bind_map[];
const char *input_bind_map_get_base(const void *data);
const void *input_bind_map_get(unsigned i);
const char *input_bind_map_get_base(unsigned i);
unsigned input_bind_map_get_meta(unsigned i);
const char *input_bind_map_get_desc(unsigned i);
/**
* input_translate_coord_viewport:

View File

@ -2624,7 +2624,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
for (i = 0; i < RARCH_BIND_LIST_END; i++)
{
ret = menu_displaylist_parse_settings(menu, info,
input_bind_map_get_base(&input_config_bind_map[i]), PARSE_ONLY_BIND, false);
input_bind_map_get_base(i), PARSE_ONLY_BIND, false);
(void)ret;
}
}

View File

@ -3161,10 +3161,8 @@ static bool setting_append_list_input_player_options(
char label[PATH_MAX_LENGTH];
char name[PATH_MAX_LENGTH];
bool do_add = true;
const struct input_bind_map* keybind =
(const struct input_bind_map*)&input_config_bind_map[i];
if (!keybind || keybind->meta)
if (!input_bind_map_get_meta(i))
continue;
strlcpy(label, buffer[user], sizeof(label));
@ -3190,9 +3188,9 @@ static bool setting_append_list_input_player_options(
}
}
else
strlcat(label, keybind->desc, sizeof(label));
strlcat(label, input_bind_map_get_desc(i), sizeof(label));
snprintf(name, sizeof(name), "p%u_%s", user + 1, keybind->base);
snprintf(name, sizeof(name), "p%u_%s", user + 1, input_bind_map_get_base(i));
if (do_add)
{
@ -5103,16 +5101,15 @@ static bool setting_append_list_input_hotkey_options(
for (i = 0; i < RARCH_BIND_LIST_END; i ++)
{
const struct input_bind_map* keybind = (const struct input_bind_map*)
&input_config_bind_map[i];
if (!keybind || !keybind->meta)
if (!input_bind_map_get_meta(i))
continue;
CONFIG_BIND(
list, list_info,
&settings->input.binds[0][i], 0, 0,
strdup(keybind->base), strdup(keybind->desc), &retro_keybinds_1[i],
strdup(input_bind_map_get_base(i)),
strdup(input_bind_map_get_desc(i)),
&retro_keybinds_1[i],
&group_info, &subgroup_info, parent_group);
(*list)[list_info->index - 1].bind_type = i + MENU_SETTINGS_BIND_BEGIN;
}