Skip to content

Commit

Permalink
(Menu) Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed Feb 5, 2018
1 parent 12cf1bf commit a43d2b6
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 150 deletions.
8 changes: 5 additions & 3 deletions menu/cbs/menu_cbs_deferred_push.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,11 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
{
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_input_hotkey_binds_list);
}
else if (strstr(label,
msg_hash_to_str(MENU_ENUM_LABEL_LOAD_CONTENT_LIST)))
{
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_load_content_list);
}
else
{
if (cbs->enum_idx != MSG_UNKNOWN)
Expand Down Expand Up @@ -1226,9 +1231,6 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
case MENU_LABEL_ADD_CONTENT_LIST:
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_add_content_list);
break;
case MENU_LABEL_LOAD_CONTENT_LIST:
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_load_content_list);
break;
case MENU_LABEL_MANAGEMENT:
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_management_options);
break;
Expand Down
281 changes: 135 additions & 146 deletions menu/cbs/menu_cbs_title.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,187 +305,179 @@ static int action_get_title_input_binds_list(const char *path, const char *label
return 0;
}

static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
const char *label, uint32_t label_hash)
struct cbs_title_lbl_callback
{
if (cbs->setting)
{
const char *parent_group = cbs->setting->parent_group;

if (string_is_equal(parent_group, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU))
&& setting_get_type(cbs->setting) == ST_GROUP)
{
BIND_ACTION_GET_TITLE(cbs, action_get_title_group_settings);
return 0;
}
}
enum msg_hash_enums id;
int (*cbs)(const char *path, const char *label,
unsigned type, char *s, size_t len);
};

if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CORE_SETTINGS_LIST)))
static struct cbs_title_lbl_callback cbs_title_lbl_list[] = {
{
BIND_ACTION_GET_TITLE(cbs, action_get_core_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CONFIGURATION_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_CORE_SETTINGS_LIST,
action_get_title_group_settings
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_configuration_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_SAVING_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_CONFIGURATION_SETTINGS_LIST,
action_get_configuration_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_saving_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_LOGGING_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_SAVING_SETTINGS_LIST,
action_get_saving_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_logging_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_FRAME_THROTTLE_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_LOGGING_SETTINGS_LIST,
action_get_logging_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_frame_throttle_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_REWIND_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_FRAME_THROTTLE_SETTINGS_LIST,
action_get_frame_throttle_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_rewind_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_DISPLAY_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_REWIND_SETTINGS_LIST,
action_get_rewind_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_onscreen_display_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_ONSCREEN_DISPLAY_SETTINGS_LIST,
action_get_onscreen_display_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_onscreen_notifications_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST,
action_get_onscreen_notifications_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_onscreen_overlay_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MENU_VIEWS_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST,
action_get_onscreen_overlay_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_menu_views_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_QUICK_MENU_VIEWS_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_MENU_VIEWS_SETTINGS_LIST,
action_get_menu_views_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_quick_menu_views_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MENU_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_QUICK_MENU_VIEWS_SETTINGS_LIST,
action_get_quick_menu_views_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_menu_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_USER_INTERFACE_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_MENU_SETTINGS_LIST,
action_get_menu_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_user_interface_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MENU_FILE_BROWSER_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_USER_INTERFACE_SETTINGS_LIST,
action_get_user_interface_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_menu_file_browser_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RETRO_ACHIEVEMENTS_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_MENU_FILE_BROWSER_SETTINGS_LIST,
action_get_menu_file_browser_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_retro_achievements_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_WIFI_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_RETRO_ACHIEVEMENTS_SETTINGS_LIST,
action_get_retro_achievements_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_wifi_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_UPDATER_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_WIFI_SETTINGS_LIST,
action_get_wifi_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_updater_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_NETWORK_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_UPDATER_SETTINGS_LIST,
action_get_updater_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_network_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_NETPLAY_LAN_SCAN_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_NETWORK_SETTINGS_LIST,
action_get_network_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_netplay_lan_scan_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_LAKKA_SERVICES_LIST)))
MENU_ENUM_LABEL_DEFERRED_NETPLAY_LAN_SCAN_SETTINGS_LIST,
action_get_netplay_lan_scan_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_lakka_services_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_USER_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_LAKKA_SERVICES_LIST,
action_get_lakka_services_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_user_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DIRECTORY_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_USER_SETTINGS_LIST,
action_get_user_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_directory_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_PRIVACY_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_DIRECTORY_SETTINGS_LIST,
action_get_directory_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_privacy_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_LIST)))
MENU_ENUM_LABEL_DEFERRED_PRIVACY_SETTINGS_LIST,
action_get_privacy_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_download_core_content_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_SUBDIR_LIST)))
MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_LIST,
action_get_download_core_content_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_download_core_content_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST)))
MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_SUBDIR_LIST,
action_get_download_core_content_list,
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_title_goto_favorites);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_IMAGES_LIST)))
MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST,
action_get_title_goto_favorites
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_title_goto_image);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MUSIC_LIST)))
MENU_ENUM_LABEL_DEFERRED_IMAGES_LIST,
action_get_title_goto_image
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_title_goto_music);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_VIDEO_LIST)))
MENU_ENUM_LABEL_DEFERRED_MUSIC_LIST,
action_get_title_goto_music
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_title_goto_video);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DRIVER_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_VIDEO_LIST,
action_get_title_goto_video
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_driver_settings_list);
return 0;
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_AUDIO_SETTINGS_LIST)))
MENU_ENUM_LABEL_DEFERRED_DRIVER_SETTINGS_LIST,
action_get_driver_settings_list
},
{
BIND_ACTION_GET_TITLE(cbs, action_get_audio_settings_list);
return 0;
MENU_ENUM_LABEL_DEFERRED_AUDIO_SETTINGS_LIST,
action_get_audio_settings_list
},
{
MENU_ENUM_LABEL_SYSTEM_INFORMATION,
action_get_system_information_list
},
{
MENU_ENUM_LABEL_NETWORK_INFORMATION,
action_get_network_information_list
},
{
MENU_ENUM_LABEL_LOAD_CONTENT_LIST,
action_get_load_content_list
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_SYSTEM_INFORMATION)))
};

static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
const char *label, uint32_t label_hash)
{
unsigned k;

if (cbs->setting)
{
BIND_ACTION_GET_TITLE(cbs, action_get_system_information_list);
return 0;
const char *parent_group = cbs->setting->parent_group;

if (string_is_equal(parent_group, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU))
&& setting_get_type(cbs->setting) == ST_GROUP)
{
BIND_ACTION_GET_TITLE(cbs, action_get_title_group_settings);
return 0;
}
}
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NETWORK_INFORMATION)))

for (k = 0; k < ARRAY_SIZE(cbs_title_lbl_list); k++)
{
BIND_ACTION_GET_TITLE(cbs, action_get_network_information_list);
return 0;
if (string_is_equal(label, msg_hash_to_str(cbs_title_lbl_list[k].id)))
{
BIND_ACTION_GET_TITLE(cbs, cbs_title_lbl_list[k].cbs);
return 0;
}
}
else if (cbs->enum_idx != MSG_UNKNOWN)

if (cbs->enum_idx != MSG_UNKNOWN)
{
switch (cbs->enum_idx)
{
Expand Down Expand Up @@ -937,9 +929,6 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_LOAD_CONTENT_SPECIAL:
BIND_ACTION_GET_TITLE(cbs, action_get_load_content_special);
break;
case MENU_LABEL_LOAD_CONTENT_LIST:
BIND_ACTION_GET_TITLE(cbs, action_get_load_content_list);
break;
case MENU_LABEL_ONLINE_UPDATER:
BIND_ACTION_GET_TITLE(cbs, action_get_online_updater_list);
break;
Expand Down
1 change: 0 additions & 1 deletion msg_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -1956,7 +1956,6 @@ enum msg_hash_enums
#define MENU_LABEL_HELP_AUDIO_VIDEO_TROUBLESHOOTING 0xd44d395cU

/* Main menu */
#define MENU_LABEL_LOAD_CONTENT_LIST 0x5745de1fU
#define MENU_LABEL_LOAD_CONTENT_HISTORY 0xfe1d79e5U
#define MENU_LABEL_ADD_CONTENT_LIST 0x046f4668U
#define MENU_LABEL_ONLINE_UPDATER 0xcac0025eU
Expand Down

0 comments on commit a43d2b6

Please sign in to comment.