This commit is contained in:
twinaphex 2017-04-26 00:24:59 +02:00
parent a146dfee79
commit e179108080
11 changed files with 19 additions and 42 deletions

View File

@ -1165,7 +1165,7 @@ static void config_set_defaults(void)
{
for (j = 0; j < RARCH_BIND_LIST_END; j++)
{
const struct retro_keybind *keyval = input_config_get_specific_bind(i, j);
const struct retro_keybind *keyval = &input_config_binds[i][j];
if (keyval->valid)
retro_assert(j == keyval->id);
}
@ -1645,7 +1645,7 @@ static void read_keybinds_user(config_file_t *conf, unsigned user)
for (i = 0; input_config_bind_map_get_valid(i); i++)
{
struct retro_keybind *bind = input_config_get_specific_bind_ptr(user, i);
struct retro_keybind *bind = &input_config_binds[user][i];
if (!bind->valid)
continue;
@ -2797,7 +2797,7 @@ static void save_keybinds_user(config_file_t *conf, unsigned user)
if (prefix)
save_keybind(conf, prefix, input_config_bind_map_get_base(i),
input_config_get_specific_bind(user, i), true, true);
&input_config_binds[user][i], true, true);
}
}
@ -2925,7 +2925,7 @@ bool config_save_autoconf_profile(const char *path, unsigned user)
for (i = 0; i < RARCH_FIRST_META_KEY; i++)
{
save_keybind(conf, "input", input_config_bind_map_get_base(i),
input_config_get_specific_bind(user, i), false, false);
&input_config_binds[user][i], false, false);
}
ret = config_file_write(conf, autoconf_file);

View File

@ -1369,7 +1369,7 @@ static int16_t android_input_state(void *data,
(android->pointer[idx].y != -0x8000);
case RARCH_DEVICE_ID_POINTER_BACK:
{
const struct retro_keybind *keyptr = input_autoconfigure_get_specific_bind(0, RARCH_MENU_TOGGLE);
const struct retro_keybind *keyptr = &input_autoconf_binds[0][RARCH_MENU_TOGGLE];
if (keyptr->joykey == 0)
return android_keyboard_input_pressed(AKEYCODE_BACK);
}
@ -1388,7 +1388,7 @@ static int16_t android_input_state(void *data,
(android->pointer[idx].full_y != -0x8000);
case RARCH_DEVICE_ID_POINTER_BACK:
{
const struct retro_keybind *keyptr = input_autoconfigure_get_specific_bind(0, RARCH_MENU_TOGGLE);
const struct retro_keybind *keyptr = &input_autoconf_binds[0][RARCH_MENU_TOGGLE];
if (keyptr->joykey == 0)
return android_keyboard_input_pressed(AKEYCODE_BACK);
}

View File

@ -153,16 +153,6 @@ 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)
{
return (struct retro_keybind*)&input_config_binds[i][j];
}
const struct retro_keybind *input_config_get_specific_bind(unsigned i, unsigned j)
{
return &input_config_binds[i][j];
}
static const void *input_config_bind_map_get(unsigned i)
{
return (const struct input_bind_map*)&input_config_bind_map[i];
@ -560,7 +550,7 @@ const struct retro_keybind *input_config_get_bind_auto(unsigned port, unsigned i
unsigned joy_idx = settings->input.joypad_map[port];
if (joy_idx < MAX_USERS)
return input_autoconfigure_get_specific_bind(joy_idx, id);
return &input_autoconf_binds[joy_idx][id];
return NULL;
}
@ -603,8 +593,3 @@ void input_config_reset(void)
input_config_pid[i] = 0;
}
}
const struct retro_keybind *input_autoconfigure_get_specific_bind(unsigned i, unsigned j)
{
return &input_autoconf_binds[i][j];
}

View File

@ -92,13 +92,6 @@ 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);
const struct retro_keybind *
input_autoconfigure_get_specific_bind(unsigned i, unsigned j);
void input_config_reset(void);
#endif

View File

@ -175,7 +175,7 @@ void input_remapping_set_defaults(void)
{
for (j = 0; j < RARCH_FIRST_CUSTOM_BIND; j++)
{
const struct retro_keybind *keybind = input_config_get_specific_bind(i, j);
const struct retro_keybind *keybind = &input_config_binds[i][j];
settings->input.remap_ids[i][j] = keybind->id;
}
for (j = 0; j < 4; j++)

View File

@ -453,7 +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 = input_config_get_specific_bind(inp_desc_user, remap_id);
keybind = &input_config_binds[inp_desc_user][remap_id];
auto_bind = (const struct retro_keybind*)
input_config_get_bind_auto(inp_desc_user, remap_id);
@ -469,8 +469,8 @@ static void menu_action_setting_disp_set_label_input_desc(
len);
else
{
const struct retro_keybind *keyptr = input_config_get_specific_bind(inp_desc_user,
remap_id);
const struct retro_keybind *keyptr = &input_config_binds[inp_desc_user]
[remap_id];
strlcpy(s, msg_hash_to_str(keyptr->enum_idx), len);
}

View File

@ -137,8 +137,7 @@ static int action_scan_input_desc(const char *path,
else
key = input_config_translate_str_to_bind_id(label);
target = input_config_get_specific_bind_ptr(inp_desc_user,
key);
target = &input_config_binds[inp_desc_user][key];
if (target)
{

View File

@ -111,8 +111,8 @@ static int action_start_input_desc(unsigned type, const char *label)
if (inp_desc_button_index_offset < RARCH_FIRST_CUSTOM_BIND)
{
const struct retro_keybind *keyptr = input_config_get_specific_bind(inp_desc_user,
inp_desc_button_index_offset);
const struct retro_keybind *keyptr = &input_config_binds[inp_desc_user]
[inp_desc_button_index_offset];
settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset] = keyptr->id;
}
else

View File

@ -1338,7 +1338,7 @@ static int setting_action_ok_bind_defaults(void *data, bool wraparound)
if (!setting)
return -1;
target = input_config_get_specific_bind_ptr(setting->index_offset, 0);
target = &input_config_binds[setting->index_offset][0];
def_binds = (setting->index_offset) ?
retro_keybinds_rest : retro_keybinds_1;
@ -2090,7 +2090,7 @@ static bool setting_append_list_input_player_options(
CONFIG_BIND_ALT(
list, list_info,
input_config_get_specific_bind_ptr(user, i),
&input_config_binds[user][i],
user + 1,
user,
strdup(name),
@ -4408,7 +4408,7 @@ static bool setting_append_list(
CONFIG_BIND_ALT(
list, list_info,
input_config_get_specific_bind_ptr(0, i),
&input_config_binds[0][i],
0, 0,
strdup(input_config_bind_map_get_base(i)),
strdup(input_config_bind_map_get_desc(i)),

View File

@ -96,7 +96,7 @@ int menu_dialog_iterate(char *s, size_t len, const char *label)
for (i = 0; i < ARRAY_SIZE(binds); i++)
{
const struct retro_keybind *keybind = input_config_get_specific_bind(0, binds[i]);
const struct retro_keybind *keybind = &input_config_binds[0][binds[i]];
const struct retro_keybind *auto_bind =
(const struct retro_keybind*)
input_config_get_bind_auto(0, binds[i]);

View File

@ -116,7 +116,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 = input_config_get_specific_bind_ptr(index_offset, 0);
menu_input_binds.target = &input_config_binds[index_offset][0];
menu_input_binds.begin = MENU_SETTINGS_BIND_BEGIN;
menu_input_binds.last = MENU_SETTINGS_BIND_LAST;