Reduce dependence on MENU_VALUE_

This commit is contained in:
twinaphex 2016-06-17 20:43:42 +02:00
parent 84e3a8c717
commit 41c7d76017
5 changed files with 49 additions and 36 deletions

View File

@ -383,7 +383,8 @@ static int bind_left_generic(unsigned type, const char *label,
}
static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
const char *label, uint32_t label_hash, uint32_t menu_label_hash, const char *elem0)
const char *label, uint32_t label_hash, const char *menu_label,
uint32_t menu_label_hash, const char *elem0)
{
unsigned i;
@ -444,13 +445,15 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_SCREEN_RESOLUTION:
BIND_ACTION_LEFT(cbs, action_left_video_resolution);
break;
case MENU_ENUM_LABEL_NO_ITEMS:
case MENU_ENUM_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE:
switch (menu_label_hash)
if ( string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_MAIN_MENU)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_HORIZONTAL_MENU))
)
{
case MENU_VALUE_HORIZONTAL_MENU:
case MENU_VALUE_MAIN_MENU:
BIND_ACTION_LEFT(cbs, action_left_mainmenu);
break;
BIND_ACTION_LEFT(cbs, action_left_mainmenu);
break;
}
default:
return -1;
@ -480,12 +483,13 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
BIND_ACTION_LEFT(cbs, action_left_video_resolution);
break;
case MENU_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE:
switch (menu_label_hash)
if ( string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_MAIN_MENU)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_HORIZONTAL_MENU))
)
{
case MENU_VALUE_HORIZONTAL_MENU:
case MENU_VALUE_MAIN_MENU:
BIND_ACTION_LEFT(cbs, action_left_mainmenu);
break;
BIND_ACTION_LEFT(cbs, action_left_mainmenu);
break;
}
default:
return -1;
@ -614,7 +618,7 @@ int menu_cbs_init_bind_left(menu_file_list_cbs_t *cbs,
}
}
if (menu_cbs_init_bind_left_compare_label(cbs, label, label_hash, menu_label_hash, elem0) == 0)
if (menu_cbs_init_bind_left_compare_label(cbs, label, label_hash, menu_label, menu_label_hash, elem0) == 0)
return 0;
if (menu_cbs_init_bind_left_compare_type(cbs, type, label_hash, menu_label, menu_label_hash) == 0)

View File

@ -498,7 +498,8 @@ static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs,
}
static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
const char *label, uint32_t label_hash, uint32_t menu_label_hash, const char *elem0)
const char *label, uint32_t label_hash, const char *menu_label,
uint32_t menu_label_hash, const char *elem0)
{
unsigned i;
@ -559,13 +560,15 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_SCREEN_RESOLUTION:
BIND_ACTION_RIGHT(cbs, action_right_video_resolution);
break;
case MENU_ENUM_LABEL_NO_ITEMS:
case MENU_ENUM_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE:
switch (menu_label_hash)
if ( string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_MAIN_MENU)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_HORIZONTAL_MENU))
)
{
case MENU_VALUE_HORIZONTAL_MENU:
case MENU_VALUE_MAIN_MENU:
BIND_ACTION_RIGHT(cbs, action_right_mainmenu);
break;
BIND_ACTION_RIGHT(cbs, action_right_mainmenu);
break;
}
default:
return -1;
@ -594,12 +597,13 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
BIND_ACTION_RIGHT(cbs, action_right_video_resolution);
break;
case MENU_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE:
switch (menu_label_hash)
if ( string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_MAIN_MENU)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_HORIZONTAL_MENU))
)
{
case MENU_VALUE_HORIZONTAL_MENU:
case MENU_VALUE_MAIN_MENU:
BIND_ACTION_RIGHT(cbs, action_right_mainmenu);
break;
BIND_ACTION_RIGHT(cbs, action_right_mainmenu);
break;
}
default:
return -1;
@ -634,7 +638,8 @@ int menu_cbs_init_bind_right(menu_file_list_cbs_t *cbs,
}
}
if (menu_cbs_init_bind_right_compare_label(cbs, label, label_hash, menu_label_hash, elem0) == 0)
if (menu_cbs_init_bind_right_compare_label(cbs, label, label_hash, menu_label,
menu_label_hash, elem0) == 0)
return 0;
if (menu_cbs_init_bind_right_compare_type(cbs, type, label_hash, menu_label_hash) == 0)

View File

@ -26,6 +26,8 @@ static const char *menu_hash_to_str_us_label_enum(enum menu_hash_enums msg)
{
switch (msg)
{
case MENU_ENUM_LABEL_NO_ITEMS:
return "no_items";
case MENU_ENUM_LABEL_SETTINGS_TAB:
return "settings_tab";
case MENU_ENUM_LABEL_HISTORY_TAB:

View File

@ -2693,8 +2693,8 @@ static int menu_displaylist_parse_load_content_settings(
else
menu_entries_add_enum(info->list,
menu_hash_to_str_enum(MENU_ENUM_LABEL_VALUE_NO_ITEMS),
"",
MENU_ENUM_LABEL_UNKNOWN,
menu_hash_to_str_enum(MENU_ENUM_LABEL_NO_ITEMS),
MENU_ENUM_LABEL_NO_ITEMS,
MENU_SETTING_NO_ITEM, 0, 0);
return 0;
@ -2944,8 +2944,8 @@ static int menu_displaylist_parse_options(
#else
menu_entries_add_enum(info->list,
menu_hash_to_str_enum(MENU_ENUM_LABEL_VALUE_NO_ITEMS),
"",
MENU_ENUM_LABEL_UNKNOWN,
menu_hash_to_str_enum(MENU_ENUM_LABEL_NO_ITEMS),
MENU_ENUM_LABEL_NO_ITEMS,
MENU_SETTING_NO_ITEM, 0, 0);
#endif
@ -3165,8 +3165,8 @@ static int menu_displaylist_parse_generic(
{
menu_entries_add_enum(info->list,
menu_hash_to_str_enum(MENU_ENUM_LABEL_VALUE_NO_ITEMS),
"",
MENU_ENUM_LABEL_UNKNOWN,
menu_hash_to_str_enum(MENU_ENUM_LABEL_NO_ITEMS),
MENU_ENUM_LABEL_NO_ITEMS,
MENU_SETTING_NO_ITEM, 0, 0);
#ifdef HAVE_NETWORKING
if (hash_label == MENU_LABEL_CORE_LIST)
@ -3312,8 +3312,8 @@ static int menu_displaylist_parse_generic(
{
menu_entries_add_enum(info->list,
menu_hash_to_str_enum(MENU_ENUM_LABEL_VALUE_NO_ITEMS),
"",
MENU_ENUM_LABEL_UNKNOWN,
menu_hash_to_str_enum(MENU_ENUM_LABEL_NO_ITEMS),
MENU_ENUM_LABEL_NO_ITEMS,
MENU_SETTING_NO_ITEM, 0, 0);
}
@ -3772,8 +3772,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
#else
menu_entries_add_enum(info->list,
menu_hash_to_str_enum(MENU_ENUM_LABEL_VALUE_NO_ITEMS),
"",
MENU_ENUM_LABEL_UNKNOWN,
menu_hash_to_str_enum(MENU_ENUM_LABEL_NO_ITEMS),
MENU_ENUM_LABEL_NO_ITEMS,
MENU_SETTING_NO_ITEM, 0, 0);
ret = 0;
#endif
@ -3792,8 +3792,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
#else
menu_entries_add_enum(info->list,
menu_hash_to_str_enum(MENU_ENUM_LABEL_VALUE_NO_ITEMS),
"",
MENU_ENUM_LABEL_UNKNOWN,
menu_hash_to_str_enum(MENU_ENUM_LABEL_NO_ITEMS),
MENU_ENUM_LABEL_NO_ITEMS,
MENU_SETTING_NO_ITEM, 0, 0);
ret = 0;
#endif

View File

@ -346,6 +346,8 @@ enum menu_hash_enums
MENU_ENUM_LABEL_VALUE_PAUSE_LIBRETRO,
MENU_ENUM_LABEL_VALUE_DIRECTORY_NOT_FOUND,
MENU_ENUM_LABEL_NO_ITEMS,
MENU_ENUM_LABEL_VALUE_NO_ITEMS,
MENU_ENUM_LABEL_UI_MENUBAR_ENABLE,