More refactors pt. 2

This commit is contained in:
twinaphex 2015-05-12 12:37:42 +02:00
parent e2d7139c71
commit 35a55f97ae
3 changed files with 17 additions and 20 deletions

View File

@ -74,6 +74,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
ret = menu_entries_push_list(menu, info->list, ret = menu_entries_push_list(menu, info->list,
info->path, info->label, info->type, info->flags); info->path, info->label, info->type, info->flags);
break; break;
case DISPLAYLIST_DEFAULT:
case DISPLAYLIST_CORES: case DISPLAYLIST_CORES:
case DISPLAYLIST_CORES_DETECTED: case DISPLAYLIST_CORES_DETECTED:
case DISPLAYLIST_SHADER_PASS: case DISPLAYLIST_SHADER_PASS:
@ -92,7 +93,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
case DISPLAYLIST_CONTENT_HISTORY: case DISPLAYLIST_CONTENT_HISTORY:
ret = menu_entries_parse_list(info->list, info->menu_list, ret = menu_entries_parse_list(info->list, info->menu_list,
info->path, info->label, info->type, info->path, info->label, info->type,
info->type_default, info->exts, NULL); info->type_default, info->exts, info->setting);
break; break;
case DISPLAYLIST_PERFCOUNTER_SELECTION: case DISPLAYLIST_PERFCOUNTER_SELECTION:
menu_list_clear(info->list); menu_list_clear(info->list);

View File

@ -19,6 +19,7 @@
#include <stdint.h> #include <stdint.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include "menu_list.h" #include "menu_list.h"
#include "menu_setting.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -29,6 +30,7 @@ enum
DISPLAYLIST_NONE = 0, DISPLAYLIST_NONE = 0,
DISPLAYLIST_MAIN_MENU, DISPLAYLIST_MAIN_MENU,
DISPLAYLIST_SETTINGS, DISPLAYLIST_SETTINGS,
DISPLAYLIST_DEFAULT,
DISPLAYLIST_CORES, DISPLAYLIST_CORES,
DISPLAYLIST_CORES_DETECTED, DISPLAYLIST_CORES_DETECTED,
DISPLAYLIST_PERFCOUNTER_SELECTION, DISPLAYLIST_PERFCOUNTER_SELECTION,
@ -60,6 +62,7 @@ typedef struct menu_displaylist_info
unsigned type; unsigned type;
unsigned type_default; unsigned type_default;
unsigned flags; unsigned flags;
rarch_setting_t *setting;
} menu_displaylist_info_t; } menu_displaylist_info_t;
int menu_displaylist_deferred_push(menu_displaylist_info_t *info); int menu_displaylist_deferred_push(menu_displaylist_info_t *info);

View File

@ -2197,35 +2197,28 @@ static int deferred_push_detect_core_list(void *data, void *userdata,
static int deferred_push_default(void *data, void *userdata, static int deferred_push_default(void *data, void *userdata,
const char *path, const char *label, unsigned type) const char *path, const char *label, unsigned type)
{ {
char ext_buf[PATH_MAX_LENGTH]; menu_displaylist_info_t info = {0};
const char *exts = NULL;
file_list_t *list = (file_list_t*)data;
file_list_t *menu_list = (file_list_t*)userdata;
rarch_setting_t *setting = (rarch_setting_t*)
menu_setting_find(label);
global_t *global = global_get_ptr(); global_t *global = global_get_ptr();
if (!list || !menu_list) info.list = (file_list_t*)data;
return -1; info.menu_list = (file_list_t*)userdata;
info.type = type;
info.type_default = MENU_FILE_PLAIN;
strlcpy(info.path, path, sizeof(info.path));
strlcpy(info.label, label, sizeof(info.label));
info.setting = menu_setting_find(label);
if (setting && setting->browser_selection_type == ST_DIR) if (info.setting && info.setting->browser_selection_type == ST_DIR) {}
exts = ""; /* we ignore files anyway */
else if (global->menu.info.valid_extensions) else if (global->menu.info.valid_extensions)
{ {
exts = ext_buf;
if (*global->menu.info.valid_extensions) if (*global->menu.info.valid_extensions)
snprintf(ext_buf, sizeof(ext_buf), "%s", snprintf(info.exts, sizeof(info.exts), "%s",
global->menu.info.valid_extensions); global->menu.info.valid_extensions);
else
*ext_buf = '\0';
} }
else else
exts = global->system.valid_extensions; strlcpy(info.exts, global->system.valid_extensions, sizeof(info.exts));
menu_entries_parse_list(list, menu_list, path, label, return menu_displaylist_push_list(&info, DISPLAYLIST_DEFAULT);
type, MENU_FILE_PLAIN, exts, setting);
return 0;
} }
void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs, void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs,