mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Cleanup menu_displaylist_parse
This commit is contained in:
parent
5364ff24a9
commit
70c1f86341
@ -195,11 +195,7 @@ static void menu_displaylist_parse_drive_list(file_list_t *list)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int menu_displaylist_parse(
|
static int menu_displaylist_parse(menu_displaylist_info_t *info)
|
||||||
file_list_t *list, file_list_t *menu_list,
|
|
||||||
const char *dir, const char *label, unsigned type,
|
|
||||||
unsigned default_type_plain, const char *exts,
|
|
||||||
rarch_setting_t *setting)
|
|
||||||
{
|
{
|
||||||
size_t i, list_size;
|
size_t i, list_size;
|
||||||
bool path_is_compressed, push_dir;
|
bool path_is_compressed, push_dir;
|
||||||
@ -211,20 +207,17 @@ static int menu_displaylist_parse(
|
|||||||
|
|
||||||
(void)device;
|
(void)device;
|
||||||
|
|
||||||
if (!list || !menu_list)
|
menu_list_clear(info->list);
|
||||||
return -1;
|
|
||||||
|
|
||||||
menu_list_clear(list);
|
if (!*info->path)
|
||||||
|
|
||||||
if (!*dir)
|
|
||||||
{
|
{
|
||||||
menu_displaylist_parse_drive_list(list);
|
menu_displaylist_parse_drive_list(info->list);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(GEKKO) && defined(HW_RVL)
|
#if defined(GEKKO) && defined(HW_RVL)
|
||||||
slock_lock(gx_device_mutex);
|
slock_lock(gx_device_mutex);
|
||||||
device = gx_get_device_from_path(dir);
|
device = gx_get_device_from_path(info->path);
|
||||||
|
|
||||||
if (device != -1 && !gx_devices[device].mounted &&
|
if (device != -1 && !gx_devices[device].mounted &&
|
||||||
gx_devices[device].interface->isInserted())
|
gx_devices[device].interface->isInserted())
|
||||||
@ -233,18 +226,19 @@ static int menu_displaylist_parse(
|
|||||||
slock_unlock(gx_device_mutex);
|
slock_unlock(gx_device_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
path_is_compressed = path_is_compressed_file(dir);
|
path_is_compressed = path_is_compressed_file(info->path);
|
||||||
push_dir = (setting && setting->browser_selection_type == ST_DIR);
|
push_dir = (info->setting
|
||||||
|
&& info->setting->browser_selection_type == ST_DIR);
|
||||||
|
|
||||||
if (path_is_compressed)
|
if (path_is_compressed)
|
||||||
str_list = compressed_file_list_new(dir,exts);
|
str_list = compressed_file_list_new(info->path, info->exts);
|
||||||
else
|
else
|
||||||
str_list = dir_list_new(dir,
|
str_list = dir_list_new(info->path,
|
||||||
settings->menu.navigation.browser.filter.supported_extensions_enable
|
settings->menu.navigation.browser.filter.supported_extensions_enable
|
||||||
? exts : NULL, true);
|
? info->exts : NULL, true);
|
||||||
|
|
||||||
if (push_dir)
|
if (push_dir)
|
||||||
menu_list_push(list, "<Use this directory>", "",
|
menu_list_push(info->list, "<Use this directory>", "",
|
||||||
MENU_FILE_USE_DIRECTORY, 0);
|
MENU_FILE_USE_DIRECTORY, 0);
|
||||||
|
|
||||||
if (!str_list)
|
if (!str_list)
|
||||||
@ -273,7 +267,7 @@ static int menu_displaylist_parse(
|
|||||||
break;
|
break;
|
||||||
case RARCH_PLAIN_FILE:
|
case RARCH_PLAIN_FILE:
|
||||||
default:
|
default:
|
||||||
if (!strcmp(label, "detect_core_list"))
|
if (!strcmp(info->label, "detect_core_list"))
|
||||||
{
|
{
|
||||||
if (path_is_compressed_file(str_list->elems[i].data))
|
if (path_is_compressed_file(str_list->elems[i].data))
|
||||||
{
|
{
|
||||||
@ -284,7 +278,7 @@ static int menu_displaylist_parse(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_type = (menu_file_type_t)default_type_plain;
|
file_type = (menu_file_type_t)info->type_default;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,13 +290,13 @@ static int menu_displaylist_parse(
|
|||||||
/* Need to preserve slash first time. */
|
/* Need to preserve slash first time. */
|
||||||
path = str_list->elems[i].data;
|
path = str_list->elems[i].data;
|
||||||
|
|
||||||
if (*dir && !path_is_compressed)
|
if (*info->path && !path_is_compressed)
|
||||||
path = path_basename(path);
|
path = path_basename(path);
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
||||||
#ifdef RARCH_CONSOLE
|
#ifdef RARCH_CONSOLE
|
||||||
if (!strcmp(label, "core_list") && (is_dir ||
|
if (!strcmp(info->label, "core_list") && (is_dir ||
|
||||||
strcasecmp(path, SALAMANDER_FILE) == 0))
|
strcasecmp(path, SALAMANDER_FILE) == 0))
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
@ -310,33 +304,35 @@ static int menu_displaylist_parse(
|
|||||||
|
|
||||||
/* Push type further down in the chain.
|
/* Push type further down in the chain.
|
||||||
* Needed for shader manager currently. */
|
* Needed for shader manager currently. */
|
||||||
if (!strcmp(label, "core_list"))
|
if (!strcmp(info->label, "core_list"))
|
||||||
{
|
{
|
||||||
/* Compressed cores are unsupported */
|
/* Compressed cores are unsupported */
|
||||||
if (file_type == MENU_FILE_CARCHIVE)
|
if (file_type == MENU_FILE_CARCHIVE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
menu_list_push(list, path, "",
|
menu_list_push(info->list, path, "",
|
||||||
is_dir ? MENU_FILE_DIRECTORY : MENU_FILE_CORE, 0);
|
is_dir ? MENU_FILE_DIRECTORY : MENU_FILE_CORE, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
menu_list_push(list, path, "",
|
menu_list_push(info->list, path, "",
|
||||||
file_type, 0);
|
file_type, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
string_list_free(str_list);
|
string_list_free(str_list);
|
||||||
|
|
||||||
if (!strcmp(label, "core_list"))
|
if (!strcmp(info->label, "core_list"))
|
||||||
{
|
{
|
||||||
|
const char *dir = NULL;
|
||||||
menu_list_get_last_stack(menu->menu_list, &dir, NULL, NULL);
|
menu_list_get_last_stack(menu->menu_list, &dir, NULL, NULL);
|
||||||
list_size = file_list_get_size(list);
|
list_size = file_list_get_size(info->list);
|
||||||
|
|
||||||
for (i = 0; i < list_size; i++)
|
for (i = 0; i < list_size; i++)
|
||||||
{
|
{
|
||||||
|
unsigned type = 0;
|
||||||
char core_path[PATH_MAX_LENGTH], display_name[PATH_MAX_LENGTH];
|
char core_path[PATH_MAX_LENGTH], display_name[PATH_MAX_LENGTH];
|
||||||
const char *path = NULL;
|
const char *path = NULL;
|
||||||
|
|
||||||
menu_list_get_at_offset(list, i, &path, NULL, &type);
|
menu_list_get_at_offset(info->list, i, &path, NULL, &type);
|
||||||
|
|
||||||
if (type != MENU_FILE_CORE)
|
if (type != MENU_FILE_CORE)
|
||||||
continue;
|
continue;
|
||||||
@ -346,12 +342,12 @@ static int menu_displaylist_parse(
|
|||||||
if (global->core_info &&
|
if (global->core_info &&
|
||||||
core_info_list_get_display_name(global->core_info,
|
core_info_list_get_display_name(global->core_info,
|
||||||
core_path, display_name, sizeof(display_name)))
|
core_path, display_name, sizeof(display_name)))
|
||||||
menu_list_set_alt_at_offset(list, i, display_name);
|
menu_list_set_alt_at_offset(info->list, i, display_name);
|
||||||
}
|
}
|
||||||
menu_list_sort_on_alt(list);
|
menu_list_sort_on_alt(info->list);
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_list_refresh(list);
|
menu_list_refresh(info->list);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -654,9 +650,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
|||||||
case DISPLAYLIST_RECORD_CONFIG_FILES:
|
case DISPLAYLIST_RECORD_CONFIG_FILES:
|
||||||
case DISPLAYLIST_CONFIG_FILES:
|
case DISPLAYLIST_CONFIG_FILES:
|
||||||
case DISPLAYLIST_CONTENT_HISTORY:
|
case DISPLAYLIST_CONTENT_HISTORY:
|
||||||
ret = menu_displaylist_parse(info->list, info->menu_list,
|
ret = menu_displaylist_parse(info);
|
||||||
info->path, info->label, info->type,
|
|
||||||
info->type_default, info->exts, info->setting);
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
need_push = true;
|
need_push = true;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user