Start consolidating all parse functions into one function

This commit is contained in:
twinaphex 2015-05-19 00:34:29 +02:00
parent 362e431765
commit 135dd8aec2
1 changed files with 158 additions and 146 deletions

View File

@ -201,7 +201,9 @@ static void menu_displaylist_parse_drive_list(file_list_t *list)
#endif
}
static int menu_displaylist_parse(menu_displaylist_info_t *info, bool *need_sort)
static int menu_displaylist_parse(menu_displaylist_info_t *info,
unsigned type, bool *need_sort, bool *need_refresh,
bool *need_push)
{
size_t i, list_size;
bool path_is_compressed, push_dir;
@ -213,6 +215,42 @@ static int menu_displaylist_parse(menu_displaylist_info_t *info, bool *need_sort
(void)device;
menu_list_clear(info->list);
switch (type)
{
case DISPLAYLIST_CORE_OPTIONS:
if (global->system.core_options)
{
size_t opts = core_option_size(global->system.core_options);
for (i = 0; i < opts; i++)
menu_list_push(info->list,
core_option_get_desc(global->system.core_options, i), "",
MENU_SETTINGS_CORE_OPTION_START + i, 0);
}
else
menu_list_push(info->list, "No options available.", "",
MENU_SETTINGS_CORE_OPTION_NONE, 0);
*need_push = true;
break;
case DISPLAYLIST_DEFAULT:
case DISPLAYLIST_CORES:
case DISPLAYLIST_CORES_DETECTED:
case DISPLAYLIST_SHADER_PASS:
case DISPLAYLIST_SHADER_PRESET:
case DISPLAYLIST_DATABASES:
case DISPLAYLIST_DATABASE_CURSORS:
case DISPLAYLIST_VIDEO_FILTERS:
case DISPLAYLIST_AUDIO_FILTERS:
case DISPLAYLIST_IMAGES:
case DISPLAYLIST_OVERLAYS:
case DISPLAYLIST_FONTS:
case DISPLAYLIST_CHEAT_FILES:
case DISPLAYLIST_REMAP_FILES:
case DISPLAYLIST_RECORD_CONFIG_FILES:
case DISPLAYLIST_CONFIG_FILES:
case DISPLAYLIST_CONTENT_HISTORY:
if (!*info->path)
{
menu_displaylist_parse_drive_list(info->list);
@ -367,6 +405,11 @@ static int menu_displaylist_parse(menu_displaylist_info_t *info, bool *need_sort
*need_sort = true;
}
*need_refresh = true;
*need_push = true;
break;
}
return 0;
}
@ -604,27 +647,6 @@ int menu_displaylist_parse_horizontal_content_actions(menu_displaylist_info_t *i
return 0;
}
static int menu_displaylist_parse_core_options(menu_displaylist_info_t *info)
{
unsigned i;
global_t *global = global_get_ptr();
if (global->system.core_options)
{
size_t opts = core_option_size(global->system.core_options);
for (i = 0; i < opts; i++)
menu_list_push(info->list,
core_option_get_desc(global->system.core_options, i), "",
MENU_SETTINGS_CORE_OPTION_START + i, 0);
}
else
menu_list_push(info->list, "No options available.", "",
MENU_SETTINGS_CORE_OPTION_NONE, 0);
return 0;
}
#ifdef HAVE_SHADER_MANAGER
static int deferred_push_video_shader_parameters_common(
menu_displaylist_info_t *info,
@ -1951,19 +1973,9 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
case DISPLAYLIST_RECORD_CONFIG_FILES:
case DISPLAYLIST_CONFIG_FILES:
case DISPLAYLIST_CONTENT_HISTORY:
menu_list_clear(info->list);
ret = menu_displaylist_parse(info, &need_sort);
if (ret == 0)
{
need_refresh = true;
need_push = true;
}
break;
case DISPLAYLIST_CORE_OPTIONS:
menu_list_clear(info->list);
ret = menu_displaylist_parse_core_options(info);
need_push = true;
ret = menu_displaylist_parse(info, type,
&need_sort, &need_refresh, &need_push);
break;
case DISPLAYLIST_CORE_INFO:
menu_list_clear(info->list);