From 1a54984fe9983bcd55dd73c3947a6e6e59c0bdb2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 2 Sep 2015 00:50:47 +0200 Subject: [PATCH] (menu_cbs_ok.c) Code de-duplication --- menu/cbs/menu_cbs_ok.c | 104 +++++++++++------------------------------ 1 file changed, 28 insertions(+), 76 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index ce68991eb7..bbf6fc9aa1 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1860,82 +1860,6 @@ static int action_ok_load_archive_detect_core(const char *path, return ret; } -static int action_ok_help(const char *path, - const char *label, unsigned type, size_t idx, size_t entry_idx) -{ - menu_displaylist_info_t info = {0}; - menu_list_t *menu_list = menu_list_get_ptr(); - menu_handle_t *menu = menu_driver_get_ptr(); - if (!menu_list) - return -1; - - info.list = menu_list->menu_stack; - strlcpy(info.label, - menu_hash_to_str(MENU_LABEL_HELP), - sizeof(info.label)); - menu->push_help_screen = true; - menu->help_screen_type = MENU_HELP_WELCOME; - - return menu_displaylist_push_list(&info, DISPLAYLIST_HELP); - -} - -static int action_ok_help_controls(const char *path, - const char *label, unsigned type, size_t idx, size_t entry_idx) -{ - menu_displaylist_info_t info = {0}; - menu_list_t *menu_list = menu_list_get_ptr(); - menu_handle_t *menu = menu_driver_get_ptr(); - if (!menu_list) - return -1; - - info.list = menu_list->menu_stack; - strlcpy(info.label, - menu_hash_to_str(MENU_LABEL_HELP_CONTROLS), - sizeof(info.label)); - menu->push_help_screen = true; - menu->help_screen_type = MENU_HELP_CONTROLS; - - return menu_displaylist_push_list(&info, DISPLAYLIST_HELP); -} - -static int action_ok_help_what_is_a_core(const char *path, - const char *label, unsigned type, size_t idx, size_t entry_idx) -{ - menu_displaylist_info_t info = {0}; - menu_list_t *menu_list = menu_list_get_ptr(); - menu_handle_t *menu = menu_driver_get_ptr(); - if (!menu_list) - return -1; - - info.list = menu_list->menu_stack; - strlcpy(info.label, - menu_hash_to_str(MENU_LABEL_HELP_WHAT_IS_A_CORE), - sizeof(info.label)); - menu->push_help_screen = true; - menu->help_screen_type = MENU_HELP_WHAT_IS_A_CORE; - - return menu_displaylist_push_list(&info, DISPLAYLIST_HELP); -} - -static int action_ok_help_audio_video_troubleshooting(const char *path, - const char *label, unsigned type, size_t idx, size_t entry_idx) -{ - menu_displaylist_info_t info = {0}; - menu_list_t *menu_list = menu_list_get_ptr(); - menu_handle_t *menu = menu_driver_get_ptr(); - if (!menu_list) - return -1; - - info.list = menu_list->menu_stack; - strlcpy(info.label, - menu_hash_to_str(MENU_LABEL_HELP_AUDIO_VIDEO_TROUBLESHOOTING), - sizeof(info.label)); - menu->push_help_screen = true; - menu->help_screen_type = MENU_HELP_AUDIO_VIDEO_TROUBLESHOOTING; - - return menu_displaylist_push_list(&info, DISPLAYLIST_HELP); -} static int generic_action_ok_help(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx, @@ -1957,6 +1881,34 @@ static int generic_action_ok_help(const char *path, return menu_displaylist_push_list(&info, DISPLAYLIST_HELP); } +static int action_ok_help_audio_video_troubleshooting(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + return generic_action_ok_help(path, label, type, idx, entry_idx, + MENU_LABEL_HELP_AUDIO_VIDEO_TROUBLESHOOTING, MENU_HELP_AUDIO_VIDEO_TROUBLESHOOTING); +} + +static int action_ok_help(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + return generic_action_ok_help(path, label, type, idx, entry_idx, + MENU_LABEL_HELP, MENU_HELP_WELCOME); +} + +static int action_ok_help_controls(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + return generic_action_ok_help(path, label, type, idx, entry_idx, + MENU_LABEL_HELP_CONTROLS, MENU_HELP_CONTROLS); +} + +static int action_ok_help_what_is_a_core(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + return generic_action_ok_help(path, label, type, idx, entry_idx, + MENU_LABEL_HELP_WHAT_IS_A_CORE, MENU_HELP_WHAT_IS_A_CORE); +} + static int action_ok_help_scanning_content(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) {