(menu_entries_cbs_{left|right}.c) Cleanups

This commit is contained in:
twinaphex 2015-06-07 18:10:01 +02:00
parent 22608f0633
commit 81dbf00a5b
2 changed files with 28 additions and 23 deletions

View File

@ -346,6 +346,20 @@ static int bind_left_generic(unsigned type, const char *label,
static int menu_entries_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
const char *label, uint32_t label_hash)
{
unsigned i;
for (i = 0; i < MAX_USERS; i++)
{
char label_setting[PATH_MAX_LENGTH];
snprintf(label_setting, sizeof(label_setting), "input_player%d_joypad_index", i + 1);
if (!strcmp(label, label_setting))
{
cbs->action_left = bind_left_generic;
return 0;
}
}
if (strstr(label, "rdb_entry"))
cbs->action_left = action_left_scroll;
else
@ -453,8 +467,6 @@ void menu_entries_cbs_init_bind_left(menu_file_list_cbs_t *cbs,
const char *elem0, const char *elem1, const char *menu_label,
uint32_t label_hash, uint32_t menu_label_hash)
{
int i;
if (!cbs)
return;
@ -469,16 +481,6 @@ void menu_entries_cbs_init_bind_left(menu_file_list_cbs_t *cbs,
cbs->action_left = bind_left_generic;
for (i = 0; i < MAX_USERS; i++)
{
char label_setting[PATH_MAX_LENGTH];
snprintf(label_setting, sizeof(label_setting), "input_player%d_joypad_index", i + 1);
if (!strcmp(label, label_setting))
cbs->action_left = bind_left_generic;
}
if (menu_entries_cbs_init_bind_left_compare_label(cbs, label, label_hash) == 0)
return;

View File

@ -418,6 +418,20 @@ static int menu_entries_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *c
static int menu_entries_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
const char *label, uint32_t label_hash, uint32_t menu_label_hash)
{
unsigned i;
for (i = 0; i < MAX_USERS; i++)
{
char label_setting[PATH_MAX_LENGTH];
snprintf(label_setting, sizeof(label_setting), "input_player%d_joypad_index", i + 1);
if (!strcmp(label, label_setting))
{
cbs->action_right = bind_right_generic;
return 0;
}
}
if (strstr(label, "rdb_entry"))
cbs->action_right = action_right_scroll;
else
@ -456,8 +470,6 @@ void menu_entries_cbs_init_bind_right(menu_file_list_cbs_t *cbs,
const char *elem0, const char *elem1, const char *menu_label,
uint32_t label_hash, uint32_t menu_label_hash)
{
int i;
if (!cbs)
return;
@ -472,15 +484,6 @@ void menu_entries_cbs_init_bind_right(menu_file_list_cbs_t *cbs,
cbs->action_right = bind_right_generic;
for (i = 0; i < MAX_USERS; i++)
{
char label_setting[PATH_MAX_LENGTH];
snprintf(label_setting, sizeof(label_setting), "input_player%d_joypad_index", i + 1);
if (!strcmp(label, label_setting))
cbs->action_right = bind_right_generic;
}
if (menu_entries_cbs_init_bind_right_compare_label(cbs, label, label_hash, menu_label_hash) == 0)
return;