mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 22:13:51 +00:00
Add filebrowser_get_type and filebrowser_clear_type
This commit is contained in:
parent
faa8ddf413
commit
f1acb16401
@ -47,7 +47,7 @@ static int action_cancel_pop_default(const char *path,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST)
|
||||
)
|
||||
)
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
|
||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &new_selection_ptr);
|
||||
menu_entries_pop_stack(&new_selection_ptr, 0, 1);
|
||||
|
@ -330,7 +330,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
dl_type = DISPLAYLIST_GENERIC;
|
||||
break;
|
||||
case ACTION_OK_DL_AUDIO_DSP_PLUGIN:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info.directory_ptr = idx;
|
||||
info_path = settings->directory.audio_filter;
|
||||
info_label = msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN);
|
||||
@ -338,7 +338,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
|
||||
break;
|
||||
case ACTION_OK_DL_SHADER_PASS:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
info_path = settings->directory.video_shader;
|
||||
@ -380,7 +380,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
dl_type = DISPLAYLIST_GENERIC;
|
||||
break;
|
||||
case ACTION_OK_DL_SHADER_PRESET:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
info_path = settings->directory.video_shader;
|
||||
@ -403,7 +403,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
dl_type = DISPLAYLIST_FILE_BROWSER_SCAN_DIR;
|
||||
break;
|
||||
case ACTION_OK_DL_REMAP_FILE:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
info_path = settings->directory.input_remapping;
|
||||
@ -411,7 +411,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
|
||||
break;
|
||||
case ACTION_OK_DL_RECORD_CONFIGFILE:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
info.type = type;
|
||||
@ -422,7 +422,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
}
|
||||
break;
|
||||
case ACTION_OK_DL_DISK_IMAGE_APPEND_LIST:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
info_path = settings->directory.menu_content;
|
||||
@ -430,7 +430,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
|
||||
break;
|
||||
case ACTION_OK_DL_PLAYLIST_COLLECTION:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
info_path = path;
|
||||
@ -438,7 +438,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
dl_type = DISPLAYLIST_GENERIC;
|
||||
break;
|
||||
case ACTION_OK_DL_CHEAT_FILE:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
info_path = settings->path.cheat_database;
|
||||
@ -446,7 +446,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
|
||||
break;
|
||||
case ACTION_OK_DL_CORE_LIST:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
info_path = settings->directory.libretro;
|
||||
@ -470,7 +470,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_COLLECTION;
|
||||
break;
|
||||
case ACTION_OK_DL_RDB_ENTRY:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
fill_pathname_join_delim(tmp,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RDB_ENTRY_DETAIL),
|
||||
path, '|', sizeof(tmp));
|
||||
@ -544,7 +544,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
dl_type = DISPLAYLIST_GENERIC;
|
||||
break;
|
||||
case ACTION_OK_DL_DATABASE_MANAGER_LIST:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
fill_pathname_join(tmp,
|
||||
settings->path.content_database,
|
||||
path, sizeof(tmp));
|
||||
@ -557,7 +557,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
dl_type = DISPLAYLIST_GENERIC;
|
||||
break;
|
||||
case ACTION_OK_DL_CURSOR_MANAGER_LIST:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
fill_pathname_join(tmp, settings->directory.cursor,
|
||||
path, sizeof(tmp));
|
||||
|
||||
@ -1636,8 +1636,18 @@ static int action_ok_cheat_apply_changes(const char *path,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_ok_lookup_setting(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
return menu_setting_set(type, label, MENU_ACTION_OK, false);
|
||||
}
|
||||
|
||||
|
||||
static int action_ok_menu_wallpaper(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
filebrowser_set_type(FILEBROWSER_SELECT_IMAGE);
|
||||
return action_ok_lookup_setting(path, label, type, idx, entry_idx);
|
||||
}
|
||||
|
||||
static int action_ok_menu_wallpaper_load(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
@ -1999,7 +2009,7 @@ static int action_ok_remap_file_save_game(const char *path,
|
||||
int action_ok_path_use_directory(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
return generic_action_ok(NULL, label, type, idx, entry_idx,
|
||||
ACTION_OK_SET_DIRECTORY, MSG_UNKNOWN);
|
||||
}
|
||||
@ -2875,12 +2885,6 @@ static int action_ok_shader_apply_changes(const char *path,
|
||||
return generic_action_ok_command(CMD_EVENT_SHADERS_APPLY_CHANGES);
|
||||
}
|
||||
|
||||
static int action_ok_lookup_setting(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
return menu_setting_set(type, label, MENU_ACTION_OK, false);
|
||||
}
|
||||
|
||||
static int action_ok_rdb_entry_submenu(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -3283,7 +3287,7 @@ static int action_ok_push_content_list(const char *path,
|
||||
static int action_ok_push_scan_file(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
return action_ok_push_content_list(path, label, type, idx, entry_idx);
|
||||
}
|
||||
|
||||
@ -3291,7 +3295,8 @@ static int action_ok_scan_directory_list(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
|
||||
filebrowser_clear_type();
|
||||
return generic_action_ok_displaylist_push(path,
|
||||
settings->directory.menu_content, label, type, idx,
|
||||
entry_idx, ACTION_OK_DL_SCAN_DIR_LIST);
|
||||
@ -3311,7 +3316,7 @@ static int action_ok_push_downloads_dir(const char *path,
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
return generic_action_ok_displaylist_push(path, settings->directory.core_assets,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES),
|
||||
type, idx,
|
||||
@ -3343,7 +3348,7 @@ int action_ok_push_filebrowser_list_dir_select(const char *path,
|
||||
static int action_ok_push_default(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
return generic_action_ok_displaylist_push(path, NULL, label, type, idx,
|
||||
entry_idx, ACTION_OK_DL_PUSH_DEFAULT);
|
||||
}
|
||||
@ -3814,6 +3819,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
{
|
||||
switch (cbs->enum_idx)
|
||||
{
|
||||
case MENU_ENUM_LABEL_MENU_WALLPAPER:
|
||||
BIND_ACTION_OK(cbs, action_ok_menu_wallpaper);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_BROWSE_START:
|
||||
BIND_ACTION_OK(cbs, action_ok_browse_url_start);
|
||||
break;
|
||||
|
@ -3682,7 +3682,7 @@ static bool menu_displaylist_push_internal(
|
||||
}
|
||||
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB)))
|
||||
{
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type = 42;
|
||||
strlcpy(info->exts,
|
||||
file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT),
|
||||
@ -3697,7 +3697,7 @@ static bool menu_displaylist_push_internal(
|
||||
}
|
||||
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_TAB)))
|
||||
{
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type = 42;
|
||||
strlcpy(info->exts,
|
||||
file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT),
|
||||
@ -3712,8 +3712,7 @@ static bool menu_displaylist_push_internal(
|
||||
}
|
||||
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_IMAGES_TAB)))
|
||||
{
|
||||
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type = 42;
|
||||
strlcpy(info->exts,
|
||||
file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT),
|
||||
@ -3748,7 +3747,7 @@ static bool menu_displaylist_push_internal(
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type = 42;
|
||||
strlcpy(info->exts,
|
||||
file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT),
|
||||
@ -6053,7 +6052,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
info->need_push = true;
|
||||
break;
|
||||
case DISPLAYLIST_DATABASES:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type_default = FILE_TYPE_RDB;
|
||||
strlcpy(info->exts,
|
||||
file_path_str(FILE_PATH_RDB_EXTENSION),
|
||||
@ -6092,7 +6091,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
info->need_push = true;
|
||||
break;
|
||||
case DISPLAYLIST_DATABASE_CURSORS:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type_default = FILE_TYPE_CURSOR;
|
||||
strlcpy(info->exts, "dbc", sizeof(info->exts));
|
||||
strlcpy(info->path, settings->directory.cursor, sizeof(info->path));
|
||||
@ -6103,14 +6102,14 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
|
||||
ext_name[0] = '\0';
|
||||
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type_default = FILE_TYPE_PLAIN;
|
||||
if (frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
|
||||
strlcpy(info->exts, ext_name, sizeof(info->exts));
|
||||
}
|
||||
break;
|
||||
case DISPLAYLIST_CONFIG_FILES:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type_default = FILE_TYPE_CONFIG;
|
||||
strlcpy(info->exts, "cfg", sizeof(info->exts));
|
||||
break;
|
||||
@ -6123,7 +6122,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
#endif
|
||||
str_list = string_list_new();
|
||||
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type_default = FILE_TYPE_SHADER_PRESET;
|
||||
|
||||
#ifdef HAVE_CG
|
||||
@ -6149,7 +6148,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
|
||||
str_list = string_list_new();
|
||||
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type_default = FILE_TYPE_SHADER;
|
||||
|
||||
|
||||
@ -6167,12 +6166,12 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
}
|
||||
break;
|
||||
case DISPLAYLIST_VIDEO_FILTERS:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type_default = FILE_TYPE_VIDEOFILTER;
|
||||
strlcpy(info->exts, "filt", sizeof(info->exts));
|
||||
break;
|
||||
case DISPLAYLIST_IMAGES:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type_default = FILE_TYPE_IMAGE;
|
||||
{
|
||||
union string_list_elem_attr attr;
|
||||
@ -6198,37 +6197,37 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
}
|
||||
break;
|
||||
case DISPLAYLIST_AUDIO_FILTERS:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type_default = FILE_TYPE_AUDIOFILTER;
|
||||
strlcpy(info->exts, "dsp", sizeof(info->exts));
|
||||
break;
|
||||
case DISPLAYLIST_CHEAT_FILES:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type_default = FILE_TYPE_CHEAT;
|
||||
strlcpy(info->exts, "cht", sizeof(info->exts));
|
||||
break;
|
||||
case DISPLAYLIST_CONTENT_HISTORY:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type_default = FILE_TYPE_PLAIN;
|
||||
strlcpy(info->exts, "lpl", sizeof(info->exts));
|
||||
break;
|
||||
case DISPLAYLIST_FONTS:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type_default = FILE_TYPE_FONT;
|
||||
strlcpy(info->exts, "ttf", sizeof(info->exts));
|
||||
break;
|
||||
case DISPLAYLIST_OVERLAYS:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type_default = FILE_TYPE_OVERLAY;
|
||||
strlcpy(info->exts, "cfg", sizeof(info->exts));
|
||||
break;
|
||||
case DISPLAYLIST_RECORD_CONFIG_FILES:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type_default = FILE_TYPE_RECORD_CONFIG;
|
||||
strlcpy(info->exts, "cfg", sizeof(info->exts));
|
||||
break;
|
||||
case DISPLAYLIST_REMAP_FILES:
|
||||
filebrowser_set_type(FILEBROWSER_NONE);
|
||||
filebrowser_clear_type();
|
||||
info->type_default = FILE_TYPE_REMAP;
|
||||
strlcpy(info->exts, "rmp", sizeof(info->exts));
|
||||
break;
|
||||
|
@ -35,11 +35,37 @@
|
||||
#include "../../configuration.h"
|
||||
#include "../../paths.h"
|
||||
|
||||
#if 0
|
||||
#define FILEBROWSER_DEBUG
|
||||
#endif
|
||||
|
||||
static enum filebrowser_enums filebrowser_types = FILEBROWSER_NONE;
|
||||
|
||||
enum filebrowser_enums filebrowser_get_type(void)
|
||||
{
|
||||
return filebrowser_types;
|
||||
}
|
||||
|
||||
void filebrowser_clear_type(void)
|
||||
{
|
||||
#ifdef FILEBROWSER_DEBUG
|
||||
RARCH_LOG("filebrowser_clear_type \n");
|
||||
#endif
|
||||
filebrowser_types = FILEBROWSER_NONE;
|
||||
}
|
||||
|
||||
void filebrowser_set_type(enum filebrowser_enums type)
|
||||
{
|
||||
filebrowser_types = type;
|
||||
#ifdef FILEBROWSER_DEBUG
|
||||
RARCH_LOG("filebrowser_set_type: %d \n", type);
|
||||
#endif
|
||||
if (filebrowser_types != FILEBROWSER_SELECT_IMAGE)
|
||||
{
|
||||
filebrowser_types = type;
|
||||
#ifdef FILEBROWSER_DEBUG
|
||||
RARCH_LOG("filebrowser_set_type MODIFIED: %d \n", type);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void filebrowser_parse(void *data, unsigned type_data, bool extensions_honored)
|
||||
@ -57,6 +83,7 @@ void filebrowser_parse(void *data, unsigned type_data, bool extensions_honored)
|
||||
bool filter_ext =
|
||||
settings->menu.navigation.browser.filter.supported_extensions_enable;
|
||||
|
||||
|
||||
if (string_is_equal(info->label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_SCAN_FILE)))
|
||||
filter_ext = false;
|
||||
|
@ -31,9 +31,14 @@ enum filebrowser_enums
|
||||
FILEBROWSER_NONE = 0,
|
||||
FILEBROWSER_SELECT_DIR,
|
||||
FILEBROWSER_SCAN_DIR,
|
||||
FILEBROWSER_SELECT_IMAGE,
|
||||
FILEBROWSER_SELECT_COLLECTION
|
||||
};
|
||||
|
||||
enum filebrowser_enums filebrowser_get_type(void);
|
||||
|
||||
void filebrowser_clear_type(void);
|
||||
|
||||
void filebrowser_set_type(enum filebrowser_enums type);
|
||||
|
||||
void filebrowser_parse(void *data, unsigned type,
|
||||
|
Loading…
x
Reference in New Issue
Block a user