mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
(menu_filebrowser.c) No more dependencies on settings_t
This commit is contained in:
parent
2ed50d2579
commit
cf8f2ac56c
@ -11028,7 +11028,15 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
count++;
|
||||
}
|
||||
else
|
||||
filebrowser_parse(info, type);
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
filebrowser_parse(info, type,
|
||||
settings->bools.show_hidden_files,
|
||||
settings->bools.multimedia_builtin_mediaplayer_enable,
|
||||
settings->bools.multimedia_builtin_imageviewer_enable,
|
||||
settings->bools.menu_navigation_browser_filter_supported_extensions_enable
|
||||
);
|
||||
}
|
||||
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "../menu_driver.h"
|
||||
#include "../menu_displaylist.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../paths.h"
|
||||
|
||||
#include "../../content.h"
|
||||
@ -56,24 +55,27 @@ void filebrowser_set_type(enum filebrowser_enums type)
|
||||
filebrowser_types = type;
|
||||
}
|
||||
|
||||
void filebrowser_parse(menu_displaylist_info_t *info, unsigned type_data)
|
||||
void filebrowser_parse(
|
||||
menu_displaylist_info_t *info,
|
||||
unsigned type_data,
|
||||
bool show_hidden_files,
|
||||
bool builtin_mediaplayer_enable,
|
||||
bool builtin_imageviewer_enable,
|
||||
bool filter_ext
|
||||
)
|
||||
{
|
||||
size_t i, list_size;
|
||||
const struct retro_subsystem_info *subsystem;
|
||||
struct string_list *str_list = NULL;
|
||||
unsigned items_found = 0;
|
||||
unsigned files_count = 0;
|
||||
unsigned dirs_count = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
enum menu_displaylist_ctl_state type = (enum menu_displaylist_ctl_state)
|
||||
type_data;
|
||||
const char *path = info ? info->path : NULL;
|
||||
bool path_is_compressed = !string_is_empty(path)
|
||||
? path_is_compressed_file(path) : false;
|
||||
bool filter_ext =
|
||||
settings->bools.menu_navigation_browser_filter_supported_extensions_enable;
|
||||
|
||||
rarch_system_info_t *system = runloop_get_system_info();
|
||||
const struct retro_subsystem_info *subsystem;
|
||||
rarch_system_info_t *system = runloop_get_system_info();
|
||||
|
||||
/* Core fully loaded, use the subsystem data */
|
||||
if (system->subsystem.data)
|
||||
@ -82,25 +84,28 @@ void filebrowser_parse(menu_displaylist_info_t *info, unsigned type_data)
|
||||
else
|
||||
subsystem = subsystem_data + content_get_subsystem();
|
||||
|
||||
if (info && (info->type_default == FILE_TYPE_SHADER_PRESET ||
|
||||
info->type_default == FILE_TYPE_SHADER))
|
||||
filter_ext = true;
|
||||
if (info)
|
||||
{
|
||||
if (info->type_default == FILE_TYPE_SHADER_PRESET ||
|
||||
info->type_default == FILE_TYPE_SHADER)
|
||||
filter_ext = true;
|
||||
|
||||
if (info && string_is_equal(info->label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_SCAN_FILE)))
|
||||
filter_ext = false;
|
||||
if (string_is_equal(info->label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_SCAN_FILE)))
|
||||
filter_ext = false;
|
||||
}
|
||||
|
||||
if (info && path_is_compressed)
|
||||
{
|
||||
if (filebrowser_types != FILEBROWSER_SELECT_FILE_SUBSYSTEM)
|
||||
str_list = file_archive_get_file_list(path, info->exts);
|
||||
else if (subsystem && subsystem_current_count > 0)
|
||||
str_list = file_archive_get_file_list(path, subsystem->roms[content_get_subsystem_rom_id()].valid_extensions);
|
||||
str_list = file_archive_get_file_list(path,
|
||||
subsystem->roms[
|
||||
content_get_subsystem_rom_id()].valid_extensions);
|
||||
}
|
||||
else if (!string_is_empty(path))
|
||||
{
|
||||
bool show_hidden_files = settings->bools.show_hidden_files;
|
||||
|
||||
if (filebrowser_types == FILEBROWSER_SELECT_FILE_SUBSYSTEM)
|
||||
{
|
||||
if (subsystem && subsystem_current_count > 0 && content_get_subsystem_rom_id() < subsystem->num_roms)
|
||||
@ -242,20 +247,20 @@ void filebrowser_parse(menu_displaylist_info_t *info, unsigned type_data)
|
||||
if (!is_dir && path_is_media_type(path) == RARCH_CONTENT_MUSIC)
|
||||
file_type = FILE_TYPE_MUSIC;
|
||||
else if (!is_dir &&
|
||||
(settings->bools.multimedia_builtin_mediaplayer_enable ||
|
||||
settings->bools.multimedia_builtin_imageviewer_enable))
|
||||
(builtin_mediaplayer_enable ||
|
||||
builtin_imageviewer_enable))
|
||||
{
|
||||
switch (path_is_media_type(path))
|
||||
{
|
||||
case RARCH_CONTENT_MOVIE:
|
||||
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
|
||||
if (settings->bools.multimedia_builtin_mediaplayer_enable)
|
||||
if (builtin_mediaplayer_enable)
|
||||
file_type = FILE_TYPE_MOVIE;
|
||||
#endif
|
||||
break;
|
||||
case RARCH_CONTENT_IMAGE:
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
if (settings->bools.multimedia_builtin_imageviewer_enable
|
||||
if (builtin_imageviewer_enable
|
||||
&& type != DISPLAYLIST_IMAGES)
|
||||
file_type = FILE_TYPE_IMAGEVIEWER;
|
||||
else
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <retro_common_api.h>
|
||||
|
||||
#include "../menu_displaylist.h"
|
||||
@ -46,7 +47,14 @@ void filebrowser_clear_type(void);
|
||||
|
||||
void filebrowser_set_type(enum filebrowser_enums type);
|
||||
|
||||
void filebrowser_parse(menu_displaylist_info_t *data, unsigned type);
|
||||
void filebrowser_parse(
|
||||
menu_displaylist_info_t *info,
|
||||
unsigned type_data,
|
||||
bool show_hidden_files,
|
||||
bool builtin_mediaplayer_enable,
|
||||
bool builtin_imageviewer_enable,
|
||||
bool filter_ext
|
||||
);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user