(menu_entries_cbs_start.c) Refactor

This commit is contained in:
twinaphex 2015-06-05 12:38:46 +02:00
parent e8be9b2bd1
commit 0f101fdf82

View File

@ -266,6 +266,39 @@ static int action_start_lookup_setting(unsigned type, const char *label)
return ret;
}
int menu_entries_cbs_init_bind_start_compare_label(menu_file_list_cbs_t *cbs,
uint32_t hash)
{
switch (hash)
{
case MENU_LABEL_REMAP_FILE_LOAD:
cbs->action_start = action_start_remap_file_load;
break;
case MENU_LABEL_VIDEO_FILTER:
cbs->action_start = action_start_video_filter_file_load;
break;
case MENU_LABEL_VIDEO_SHADER_PASS:
cbs->action_start = action_start_shader_pass;
break;
case MENU_LABEL_VIDEO_SHADER_SCALE_PASS:
cbs->action_start = action_start_shader_scale_pass;
break;
case MENU_LABEL_VIDEO_SHADER_FILTER_PASS:
cbs->action_start = action_start_shader_filter_pass;
break;
case MENU_LABEL_VIDEO_SHADER_NUM_PASSES:
cbs->action_start = action_start_shader_num_passes;
break;
case MENU_LABEL_CHEAT_NUM_PASSES:
cbs->action_start = action_start_cheat_num_passes;
break;
default:
return -1;
}
return 0;
}
void menu_entries_cbs_init_bind_start(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1)
@ -276,22 +309,11 @@ void menu_entries_cbs_init_bind_start(menu_file_list_cbs_t *cbs,
return;
cbs->action_start = action_start_lookup_setting;
if (menu_entries_cbs_init_bind_start_compare_label(cbs, hash) == 0)
return;
if (hash == MENU_LABEL_REMAP_FILE_LOAD)
cbs->action_start = action_start_remap_file_load;
else if (hash == MENU_LABEL_VIDEO_FILTER)
cbs->action_start = action_start_video_filter_file_load;
else if (hash == MENU_LABEL_VIDEO_SHADER_PASS)
cbs->action_start = action_start_shader_pass;
else if (!strcmp(label, "video_shader_scale_pass"))
cbs->action_start = action_start_shader_scale_pass;
else if (!strcmp(label, "video_shader_filter_pass"))
cbs->action_start = action_start_shader_filter_pass;
else if (!strcmp(label, "video_shader_num_passes"))
cbs->action_start = action_start_shader_num_passes;
else if (!strcmp(label, "cheat_num_passes"))
cbs->action_start = action_start_cheat_num_passes;
else if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
cbs->action_start = action_start_shader_action_parameter;
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0