Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions config.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -1906,4 +1906,13 @@

#define DEFAULT_FILTER_BY_CURRENT_CORE false

/* Filter file browser to core-supported extensions only.
* On webOS TVs this often hides content when no core is loaded or the
* wrong core is selected — default off so Load Content lists files. */
#if defined(WEBOS)
#define DEFAULT_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE false
#else
#define DEFAULT_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE true
#endif

#endif
2 changes: 1 addition & 1 deletion configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -2078,7 +2078,7 @@ static struct config_bool_setting *populate_settings_bool(
SETTING_BOOL("filter_by_current_core", &settings->bools.filter_by_current_core, true, DEFAULT_FILTER_BY_CURRENT_CORE, false);
SETTING_BOOL("menu_use_preferred_system_color_theme", &settings->bools.menu_use_preferred_system_color_theme, true, DEFAULT_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, false);
SETTING_BOOL("menu_navigation_wraparound_enable", &settings->bools.menu_navigation_wraparound_enable, true, true, false);
SETTING_BOOL("menu_navigation_browser_filter_supported_extensions_enable", &settings->bools.menu_navigation_browser_filter_supported_extensions_enable, true, true, false);
SETTING_BOOL("menu_navigation_browser_filter_supported_extensions_enable", &settings->bools.menu_navigation_browser_filter_supported_extensions_enable, true, DEFAULT_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE, false);
SETTING_BOOL("menu_show_advanced_settings", &settings->bools.menu_show_advanced_settings, true, DEFAULT_SHOW_ADVANCED_SETTINGS, false);
SETTING_BOOL("menu_thumbnail_background_enable", &settings->bools.menu_thumbnail_background_enable, true, DEFAULT_MENU_THUMBNAIL_BACKGROUND_ENABLE, false);
#ifdef HAVE_MATERIALUI
Expand Down
96 changes: 79 additions & 17 deletions frontend/drivers/platform_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1784,6 +1784,31 @@ static void frontend_unix_get_env(int *argc,
getcwd(base_path, sizeof(base_path));
#elif defined(DINGUX)
dingux_get_base_path(base_path, sizeof(base_path));
#elif defined(WEBOS)
/* Jailer: HOME/XDG often do not point at the package. Prefer
* <app>/.config/retroarch so cores, system, and content defaults match
* where the app actually stores data. */
{
char app_dir[PATH_MAX_LENGTH];

app_dir[0] = '\0';
fill_pathname_application_dir(app_dir, sizeof(app_dir));
if (!string_is_empty(app_dir))
fill_pathname_join(base_path, app_dir, ".config/retroarch",
sizeof(base_path));
else
strlcpy(base_path, "/media/developer/temp", sizeof(base_path));

/* Start file browser on shared storage when available (user content). */
if (path_is_directory("/media/internal"))
strlcpy(g_defaults.dirs[DEFAULT_DIR_MENU_CONTENT],
"/media/internal",
sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONTENT]));
else
strlcpy(g_defaults.dirs[DEFAULT_DIR_MENU_CONTENT],
base_path,
sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONTENT]));
}
#else
const char *xdg = getenv("XDG_CONFIG_HOME");
const char *home = getenv("HOME");
Expand Down Expand Up @@ -2360,23 +2385,58 @@ static int frontend_unix_parse_drive_list(void *data, bool load_content)
}

#elif defined(WEBOS)
if (path_is_directory("/media/developer/temp"))
menu_entries_append(list, "/media/developer/temp",
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0, NULL);

if (path_is_directory("/media/internal"))
menu_entries_append(list, "/media/internal",
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0, NULL);
/* Prefer real storage paths. Do not list jail root "/" — readdir on
* /proc and /sys under jailer can stall the UI for a long time. */
{
char app_dir[PATH_MAX_LENGTH];
char app_config[PATH_MAX_LENGTH];
size_t wi;
static const char *const webos_storage[] = {
"/media/developer/temp",
"/media/developer",
"/media/internal/downloads",
"/media/internal",
"/tmp/usb",
"/tmp",
NULL
};

/* Application package, config tree, and downloads (common content). */
app_dir[0] = '\0';
fill_pathname_application_dir(app_dir, sizeof(app_dir));
if (!string_is_empty(app_dir) && path_is_directory(app_dir))
{
menu_entries_append(list, app_dir,
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0, NULL);

if (path_is_directory("/tmp/usb"))
menu_entries_append(list, "/tmp/usb",
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0, NULL);
fill_pathname_join_special(app_config, app_dir, ".config/retroarch",
sizeof(app_config));
if (path_is_directory(app_config))
menu_entries_append(list, app_config,
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0, NULL);

fill_pathname_join_special(app_config, app_dir,
".config/retroarch/downloads", sizeof(app_config));
if (path_is_directory(app_config))
menu_entries_append(list, app_config,
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0, NULL);
}

for (wi = 0; webos_storage[wi]; wi++)
{
if (path_is_directory(webos_storage[wi]))
menu_entries_append(list, webos_storage[wi],
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0, NULL);
}
}
#else
char base_path[PATH_MAX] = {0};
char udisks_media_path[PATH_MAX] = {0};
Expand Down Expand Up @@ -2446,7 +2506,8 @@ static int frontend_unix_parse_drive_list(void *data, bool load_content)
}
#endif

#ifdef ANDROID
#if !defined(WEBOS)
#if defined(ANDROID)
if (!g_android->is_play_store_build)
#else
if (1)
Expand All @@ -2457,6 +2518,7 @@ static int frontend_unix_parse_drive_list(void *data, bool load_content)
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0, NULL);
}
#endif

#if defined(ANDROID) && defined(HAVE_SAF)
if (g_android->have_saf)
Expand Down
11 changes: 11 additions & 0 deletions libretro-common/lists/dir_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,17 @@ static int dir_list_read(const char *dir,

fill_pathname_join_special(file_path, dir, name, sizeof(file_path));

#if defined(WEBOS)
/* Skip virtual / dangerous FS nodes under jail root — readdir+stat
* on /proc or /sys can stall the main thread for a long time. */
if ( (string_is_equal(dir, "/") || string_is_equal(dir, "//"))
&& ( string_is_equal(name, "proc")
|| string_is_equal(name, "sys")
|| string_is_equal(name, "dev")
|| string_is_equal(name, "run")))
continue;
#endif

if (retro_dirent_is_dir(entry, NULL))
{
/* Exclude this frequent hidden dir on platforms which can not handle hidden attribute */
Expand Down
14 changes: 14 additions & 0 deletions menu/menu_displaylist.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,20 @@ static int filebrowser_parse(
|| string_is_equal(label, "cursor_manager_list"))
allow_parent_directory = false;

#if defined(WEBOS)
/* Parent-directory navigation can still reach "/". Re-show the
* platform drive list instead of readdir() on jail root, which
* freezes the UI when /proc or /sys is scanned. */
if (string_is_equal(full_path, "/") || string_is_equal(full_path, "//"))
{
frontend_driver_parse_drive_list(info_list, true);
allow_parent_directory = false;
count = 1; /* info_list already has drives; avoid "No items" */
ret = true;
goto end;
}
#endif

if (filebrowser_type == FILEBROWSER_SELECT_FILE_SUBSYSTEM)
{
runloop_state_t *runloop_st = runloop_state_get_ptr();
Expand Down