From 3e8234ab38784984462b9ab05fc2402253726f6a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 27 May 2017 19:13:22 +0200 Subject: [PATCH] Cleanups --- menu/drivers/xmb.c | 2 +- menu/menu_displaylist.c | 168 ++++++++++++++++++---------------------- menu/menu_displaylist.h | 2 +- 3 files changed, 77 insertions(+), 95 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index ecf0bd230e..62cf183ce5 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -4006,7 +4006,7 @@ static int deferred_push_content_actions(menu_displaylist_info_t *info) if (!menu_displaylist_ctl( DISPLAYLIST_HORIZONTAL_CONTENT_ACTIONS, info)) return -1; - menu_displaylist_process(&info); + menu_displaylist_process(info); return 0; } diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 5bdcd0f248..ccc851ad60 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3747,85 +3747,6 @@ static void menu_displaylist_parse_playlist_associations( string_list_free(str_list); } -static void menu_displaylist_push_list_process(menu_displaylist_info_t *info) -{ - size_t idx = 0; - - if (info->need_navigation_clear) - { - bool pending_push = true; - menu_driver_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push); - } - - if (info->need_entries_refresh) - { - bool refresh = false; - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); - } - - if (info->need_sort) - file_list_sort_on_alt(info->list); - -#if defined(HAVE_NETWORKING) && !defined(HAVE_LAKKA) - if (info->download_core) - { - menu_entries_append_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE), - msg_hash_to_str(MENU_ENUM_LABEL_CORE_UPDATER_LIST), - MENU_ENUM_LABEL_CORE_UPDATER_LIST, - MENU_SETTING_ACTION, 0, 0); - } -#endif - - if (info->push_builtin_cores) - { -#if defined(HAVE_VIDEO_PROCESSOR) - menu_entries_append_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_START_VIDEO_PROCESSOR), - msg_hash_to_str(MENU_ENUM_LABEL_START_VIDEO_PROCESSOR), - MENU_ENUM_LABEL_START_VIDEO_PROCESSOR, - MENU_SETTING_ACTION, 0, 0); -#endif - -#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORKGAMEPAD) && defined(HAVE_NETWORKGAMEPAD_CORE) - menu_entries_append_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_START_NET_RETROPAD), - msg_hash_to_str(MENU_ENUM_LABEL_START_NET_RETROPAD), - MENU_ENUM_LABEL_START_NET_RETROPAD, - MENU_SETTING_ACTION, 0, 0); -#endif - } - - if (!string_is_empty(new_entry)) - { - menu_entries_prepend(info->list, - new_path_entry, - new_lbl_entry, - new_type, - FILE_TYPE_CORE, 0, 0); - menu_entries_set_alt_at_offset(info->list, 0, - new_entry); - - new_type = MSG_UNKNOWN; - new_lbl_entry[0] = '\0'; - new_path_entry[0] = '\0'; - new_entry[0] = '\0'; - } - - if (info->need_refresh) - menu_entries_ctl(MENU_ENTRIES_CTL_REFRESH, info->list); - - if (info->need_clear) - menu_navigation_set_selection(idx); - - if (info->need_push) - { - info->label_hash = msg_hash_calculate(info->label); - menu_driver_populate_entries(info); - ui_companion_driver_notify_list_loaded(info->list, info->menu_list); - } -} - static bool menu_displaylist_push_internal( const char *label, menu_displaylist_ctx_entry_t *entry, @@ -3992,10 +3913,7 @@ bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry) return false; if (menu_displaylist_push_internal(label, entry, &info)) - { - menu_displaylist_push_list_process(&info); - return true; - } + return menu_displaylist_process(&info); cbs = menu_entries_get_last_stack_actiondata(); @@ -4076,17 +3994,84 @@ static void wifi_scan_callback(void *task_data, } #endif -bool menu_displaylist_process(void *data) +bool menu_displaylist_process(menu_displaylist_info_t *info) { - menu_displaylist_info_t *info = (menu_displaylist_info_t*)data; + size_t idx = 0; - if (info) + if (info->need_navigation_clear) { - menu_displaylist_push_list_process(info); - return true; + bool pending_push = true; + menu_driver_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push); } - return false; + if (info->need_entries_refresh) + { + bool refresh = false; + menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); + } + + if (info->need_sort) + file_list_sort_on_alt(info->list); + +#if defined(HAVE_NETWORKING) && !defined(HAVE_LAKKA) + if (info->download_core) + { + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE), + msg_hash_to_str(MENU_ENUM_LABEL_CORE_UPDATER_LIST), + MENU_ENUM_LABEL_CORE_UPDATER_LIST, + MENU_SETTING_ACTION, 0, 0); + } +#endif + + if (info->push_builtin_cores) + { +#if defined(HAVE_VIDEO_PROCESSOR) + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_START_VIDEO_PROCESSOR), + msg_hash_to_str(MENU_ENUM_LABEL_START_VIDEO_PROCESSOR), + MENU_ENUM_LABEL_START_VIDEO_PROCESSOR, + MENU_SETTING_ACTION, 0, 0); +#endif + +#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORKGAMEPAD) && defined(HAVE_NETWORKGAMEPAD_CORE) + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_START_NET_RETROPAD), + msg_hash_to_str(MENU_ENUM_LABEL_START_NET_RETROPAD), + MENU_ENUM_LABEL_START_NET_RETROPAD, + MENU_SETTING_ACTION, 0, 0); +#endif + } + + if (!string_is_empty(new_entry)) + { + menu_entries_prepend(info->list, + new_path_entry, + new_lbl_entry, + new_type, + FILE_TYPE_CORE, 0, 0); + menu_entries_set_alt_at_offset(info->list, 0, + new_entry); + + new_type = MSG_UNKNOWN; + new_lbl_entry[0] = '\0'; + new_path_entry[0] = '\0'; + new_entry[0] = '\0'; + } + + if (info->need_refresh) + menu_entries_ctl(MENU_ENTRIES_CTL_REFRESH, info->list); + + if (info->need_clear) + menu_navigation_set_selection(idx); + + if (info->need_push) + { + info->label_hash = msg_hash_calculate(info->label); + menu_driver_populate_entries(info); + ui_companion_driver_notify_list_loaded(info->list, info->menu_list); + } + return true; } bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) @@ -4254,10 +4239,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) if (string_is_equal(info->path, file_path_str(FILE_PATH_CONTENT_HISTORY))) { if (menu_displaylist_ctl(DISPLAYLIST_HISTORY, info) && info) - { - menu_displaylist_push_list_process(info); - return true; - } + return menu_displaylist_process(info); return false; } else diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 359e2afec2..b1459d436e 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -203,7 +203,7 @@ typedef struct menu_displaylist_ctx_entry file_list_t *list; } menu_displaylist_ctx_entry_t; -bool menu_displaylist_process(void *data); +bool menu_displaylist_process(menu_displaylist_info_t *info); bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry);