(menu_cbs_ok.c) Code de-duplication

This commit is contained in:
twinaphex 2015-09-02 00:47:44 +02:00
parent ce43122b6f
commit 87d41c10d2

View File

@ -1937,8 +1937,9 @@ static int action_ok_help_audio_video_troubleshooting(const char *path,
return menu_displaylist_push_list(&info, DISPLAYLIST_HELP);
}
static int action_ok_help_scanning_content(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
static int generic_action_ok_help(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx,
unsigned id, unsigned id2)
{
menu_displaylist_info_t info = {0};
menu_list_t *menu_list = menu_list_get_ptr();
@ -1948,50 +1949,33 @@ static int action_ok_help_scanning_content(const char *path,
info.list = menu_list->menu_stack;
strlcpy(info.label,
menu_hash_to_str(MENU_LABEL_HELP_SCANNING_CONTENT),
menu_hash_to_str(id),
sizeof(info.label));
menu->push_help_screen = true;
menu->help_screen_type = MENU_HELP_SCANNING_CONTENT;
menu->help_screen_type = id2;
return menu_displaylist_push_list(&info, DISPLAYLIST_HELP);
}
static int action_ok_help_scanning_content(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_SCANNING_CONTENT, MENU_HELP_SCANNING_CONTENT);
}
static int action_ok_help_change_virtual_gamepad(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_CHANGE_VIRTUAL_GAMEPAD),
sizeof(info.label));
menu->push_help_screen = true;
menu->help_screen_type = MENU_HELP_CHANGE_VIRTUAL_GAMEPAD;
return menu_displaylist_push_list(&info, DISPLAYLIST_HELP);
return generic_action_ok_help(path, label, type, idx, entry_idx,
MENU_LABEL_HELP_CHANGE_VIRTUAL_GAMEPAD, MENU_HELP_CHANGE_VIRTUAL_GAMEPAD);
}
static int action_ok_help_load_content(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_LOADING_CONTENT),
sizeof(info.label));
menu->push_help_screen = true;
menu->help_screen_type = MENU_HELP_LOADING_CONTENT;
return menu_displaylist_push_list(&info, DISPLAYLIST_HELP);
return generic_action_ok_help(path, label, type, idx, entry_idx,
MENU_LABEL_HELP_LOADING_CONTENT, MENU_HELP_LOADING_CONTENT);
}
static int action_ok_video_resolution(const char *path,