mirror of
https://github.com/libretro/RetroArch
synced 2025-02-22 03:40:43 +00:00
Cleanups
This commit is contained in:
parent
a146dfee79
commit
e179108080
@ -1165,7 +1165,7 @@ static void config_set_defaults(void)
|
|||||||
{
|
{
|
||||||
for (j = 0; j < RARCH_BIND_LIST_END; j++)
|
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)
|
if (keyval->valid)
|
||||||
retro_assert(j == keyval->id);
|
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++)
|
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)
|
if (!bind->valid)
|
||||||
continue;
|
continue;
|
||||||
@ -2797,7 +2797,7 @@ static void save_keybinds_user(config_file_t *conf, unsigned user)
|
|||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
save_keybind(conf, prefix, input_config_bind_map_get_base(i),
|
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++)
|
for (i = 0; i < RARCH_FIRST_META_KEY; i++)
|
||||||
{
|
{
|
||||||
save_keybind(conf, "input", input_config_bind_map_get_base(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);
|
ret = config_file_write(conf, autoconf_file);
|
||||||
|
@ -1369,7 +1369,7 @@ static int16_t android_input_state(void *data,
|
|||||||
(android->pointer[idx].y != -0x8000);
|
(android->pointer[idx].y != -0x8000);
|
||||||
case RARCH_DEVICE_ID_POINTER_BACK:
|
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)
|
if (keyptr->joykey == 0)
|
||||||
return android_keyboard_input_pressed(AKEYCODE_BACK);
|
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);
|
(android->pointer[idx].full_y != -0x8000);
|
||||||
case RARCH_DEVICE_ID_POINTER_BACK:
|
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)
|
if (keyptr->joykey == 0)
|
||||||
return android_keyboard_input_pressed(AKEYCODE_BACK);
|
return android_keyboard_input_pressed(AKEYCODE_BACK);
|
||||||
}
|
}
|
||||||
|
@ -153,16 +153,6 @@ 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)
|
|
||||||
{
|
|
||||||
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)
|
static const void *input_config_bind_map_get(unsigned i)
|
||||||
{
|
{
|
||||||
return (const struct input_bind_map*)&input_config_bind_map[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];
|
unsigned joy_idx = settings->input.joypad_map[port];
|
||||||
|
|
||||||
if (joy_idx < MAX_USERS)
|
if (joy_idx < MAX_USERS)
|
||||||
return input_autoconfigure_get_specific_bind(joy_idx, id);
|
return &input_autoconf_binds[joy_idx][id];
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,8 +593,3 @@ void input_config_reset(void)
|
|||||||
input_config_pid[i] = 0;
|
input_config_pid[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct retro_keybind *input_autoconfigure_get_specific_bind(unsigned i, unsigned j)
|
|
||||||
{
|
|
||||||
return &input_autoconf_binds[i][j];
|
|
||||||
}
|
|
||||||
|
@ -92,13 +92,6 @@ 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_autoconfigure_get_specific_bind(unsigned i, unsigned j);
|
|
||||||
|
|
||||||
void input_config_reset(void);
|
void input_config_reset(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -175,7 +175,7 @@ void input_remapping_set_defaults(void)
|
|||||||
{
|
{
|
||||||
for (j = 0; j < RARCH_FIRST_CUSTOM_BIND; j++)
|
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;
|
settings->input.remap_ids[i][j] = keybind->id;
|
||||||
}
|
}
|
||||||
for (j = 0; j < 4; j++)
|
for (j = 0; j < 4; j++)
|
||||||
|
@ -453,7 +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 = 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*)
|
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,8 +469,8 @@ static void menu_action_setting_disp_set_label_input_desc(
|
|||||||
len);
|
len);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const struct retro_keybind *keyptr = input_config_get_specific_bind(inp_desc_user,
|
const struct retro_keybind *keyptr = &input_config_binds[inp_desc_user]
|
||||||
remap_id);
|
[remap_id];
|
||||||
|
|
||||||
strlcpy(s, msg_hash_to_str(keyptr->enum_idx), len);
|
strlcpy(s, msg_hash_to_str(keyptr->enum_idx), len);
|
||||||
}
|
}
|
||||||
|
@ -137,8 +137,7 @@ 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 = input_config_get_specific_bind_ptr(inp_desc_user,
|
target = &input_config_binds[inp_desc_user][key];
|
||||||
key);
|
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
|
@ -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)
|
if (inp_desc_button_index_offset < RARCH_FIRST_CUSTOM_BIND)
|
||||||
{
|
{
|
||||||
const struct retro_keybind *keyptr = input_config_get_specific_bind(inp_desc_user,
|
const struct retro_keybind *keyptr = &input_config_binds[inp_desc_user]
|
||||||
inp_desc_button_index_offset);
|
[inp_desc_button_index_offset];
|
||||||
settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset] = keyptr->id;
|
settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset] = keyptr->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1338,7 +1338,7 @@ static int setting_action_ok_bind_defaults(void *data, bool wraparound)
|
|||||||
if (!setting)
|
if (!setting)
|
||||||
return -1;
|
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) ?
|
def_binds = (setting->index_offset) ?
|
||||||
retro_keybinds_rest : retro_keybinds_1;
|
retro_keybinds_rest : retro_keybinds_1;
|
||||||
|
|
||||||
@ -2090,7 +2090,7 @@ static bool setting_append_list_input_player_options(
|
|||||||
|
|
||||||
CONFIG_BIND_ALT(
|
CONFIG_BIND_ALT(
|
||||||
list, list_info,
|
list, list_info,
|
||||||
input_config_get_specific_bind_ptr(user, i),
|
&input_config_binds[user][i],
|
||||||
user + 1,
|
user + 1,
|
||||||
user,
|
user,
|
||||||
strdup(name),
|
strdup(name),
|
||||||
@ -4408,7 +4408,7 @@ static bool setting_append_list(
|
|||||||
|
|
||||||
CONFIG_BIND_ALT(
|
CONFIG_BIND_ALT(
|
||||||
list, list_info,
|
list, list_info,
|
||||||
input_config_get_specific_bind_ptr(0, i),
|
&input_config_binds[0][i],
|
||||||
0, 0,
|
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)),
|
||||||
|
@ -96,7 +96,7 @@ int menu_dialog_iterate(char *s, size_t len, const char *label)
|
|||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(binds); i++)
|
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 *auto_bind =
|
||||||
(const struct retro_keybind*)
|
(const struct retro_keybind*)
|
||||||
input_config_get_bind_auto(0, binds[i]);
|
input_config_get_bind_auto(0, binds[i]);
|
||||||
|
@ -116,7 +116,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 = 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.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