mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
(Menu) Move menu_parse_and_resolve to menu_entries.c
This commit is contained in:
parent
902a90bb29
commit
5aff93ab25
@ -502,65 +502,6 @@ static int menu_start_screen_iterate(unsigned action)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned menu_common_type_is(unsigned type)
|
|
||||||
{
|
|
||||||
if (
|
|
||||||
type == MENU_SETTINGS ||
|
|
||||||
type == MENU_SETTINGS_GENERAL_OPTIONS ||
|
|
||||||
type == MENU_SETTINGS_CORE_OPTIONS ||
|
|
||||||
type == MENU_SETTINGS_CORE_INFO ||
|
|
||||||
type == MENU_SETTINGS_VIDEO_OPTIONS ||
|
|
||||||
type == MENU_SETTINGS_FONT_OPTIONS ||
|
|
||||||
type == MENU_SETTINGS_SHADER_OPTIONS ||
|
|
||||||
type == MENU_SETTINGS_SHADER_PARAMETERS ||
|
|
||||||
type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS ||
|
|
||||||
type == MENU_SETTINGS_AUDIO_OPTIONS ||
|
|
||||||
type == MENU_SETTINGS_DISK_OPTIONS ||
|
|
||||||
type == MENU_SETTINGS_PATH_OPTIONS ||
|
|
||||||
type == MENU_SETTINGS_PRIVACY_OPTIONS ||
|
|
||||||
type == MENU_SETTINGS_OVERLAY_OPTIONS ||
|
|
||||||
type == MENU_SETTINGS_USER_OPTIONS ||
|
|
||||||
type == MENU_SETTINGS_NETPLAY_OPTIONS ||
|
|
||||||
type == MENU_SETTINGS_OPTIONS ||
|
|
||||||
type == MENU_SETTINGS_DRIVERS ||
|
|
||||||
type == MENU_SETTINGS_PERFORMANCE_COUNTERS ||
|
|
||||||
type == MENU_SETTINGS_PERFORMANCE_COUNTERS_LIBRETRO ||
|
|
||||||
type == MENU_SETTINGS_PERFORMANCE_COUNTERS_FRONTEND ||
|
|
||||||
type == MENU_SETTINGS_INPUT_OPTIONS
|
|
||||||
)
|
|
||||||
return MENU_SETTINGS;
|
|
||||||
|
|
||||||
if (
|
|
||||||
(
|
|
||||||
type >= MENU_SETTINGS_SHADER_0 &&
|
|
||||||
type <= MENU_SETTINGS_SHADER_LAST &&
|
|
||||||
(((type - MENU_SETTINGS_SHADER_0) % 3) == 0)) ||
|
|
||||||
type == MENU_SETTINGS_SHADER_PRESET)
|
|
||||||
return MENU_SETTINGS_SHADER_OPTIONS;
|
|
||||||
|
|
||||||
if (
|
|
||||||
type == MENU_BROWSER_DIR_PATH ||
|
|
||||||
type == MENU_CONTENT_DIR_PATH ||
|
|
||||||
type == MENU_ASSETS_DIR_PATH ||
|
|
||||||
type == MENU_SHADER_DIR_PATH ||
|
|
||||||
type == MENU_FILTER_DIR_PATH ||
|
|
||||||
type == MENU_DSP_FILTER_DIR_PATH ||
|
|
||||||
type == MENU_SAVESTATE_DIR_PATH ||
|
|
||||||
type == MENU_LIBRETRO_DIR_PATH ||
|
|
||||||
type == MENU_LIBRETRO_INFO_DIR_PATH ||
|
|
||||||
type == MENU_CONFIG_DIR_PATH ||
|
|
||||||
type == MENU_SAVEFILE_DIR_PATH ||
|
|
||||||
type == MENU_OVERLAY_DIR_PATH ||
|
|
||||||
type == MENU_SCREENSHOT_DIR_PATH ||
|
|
||||||
type == MENU_AUTOCONFIG_DIR_PATH ||
|
|
||||||
type == MENU_EXTRACTION_DIR_PATH ||
|
|
||||||
type == MENU_SYSTEM_DIR_PATH)
|
|
||||||
return MENU_FILE_DIRECTORY;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void menu_common_setting_push_current_menu(file_list_t *list,
|
static void menu_common_setting_push_current_menu(file_list_t *list,
|
||||||
const char *path, const char *label, unsigned type,
|
const char *path, const char *label, unsigned type,
|
||||||
size_t directory_ptr, unsigned action)
|
size_t directory_ptr, unsigned action)
|
||||||
@ -1686,240 +1627,6 @@ static int menu_viewport_iterate(unsigned action)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int menu_parse_and_resolve(void)
|
|
||||||
{
|
|
||||||
size_t i, list_size;
|
|
||||||
unsigned menu_type = 0;
|
|
||||||
|
|
||||||
const char *dir = NULL;
|
|
||||||
const char *label = NULL;
|
|
||||||
/* Directory parse */
|
|
||||||
file_list_get_last(driver.menu->menu_stack, &dir, &label, &menu_type);
|
|
||||||
|
|
||||||
if (
|
|
||||||
menu_type == MENU_SETTINGS_DEFERRED_CORE ||
|
|
||||||
menu_type == MENU_SETTINGS_OPEN_HISTORY
|
|
||||||
)
|
|
||||||
return menu_entries_push(driver.menu, dir, label, menu_type);
|
|
||||||
|
|
||||||
if (!((menu_type == MENU_FILE_DIRECTORY ||
|
|
||||||
menu_common_type_is(menu_type) == MENU_SETTINGS_SHADER_OPTIONS ||
|
|
||||||
menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY ||
|
|
||||||
menu_type == MENU_SETTINGS_OVERLAY_PRESET ||
|
|
||||||
menu_type == MENU_CONTENT_HISTORY_PATH ||
|
|
||||||
menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER ||
|
|
||||||
menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER ||
|
|
||||||
menu_type == MENU_SETTINGS_CORE ||
|
|
||||||
menu_type == MENU_SETTINGS_CONFIG ||
|
|
||||||
menu_type == MENU_SETTINGS_DISK_APPEND)))
|
|
||||||
return - 1;
|
|
||||||
|
|
||||||
file_list_clear(driver.menu->selection_buf);
|
|
||||||
|
|
||||||
if (!*dir)
|
|
||||||
{
|
|
||||||
#if defined(GEKKO)
|
|
||||||
#ifdef HW_RVL
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"sd:/", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"usb:/", "", menu_type, 0);
|
|
||||||
#endif
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"carda:/", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"cardb:/", "", menu_type, 0);
|
|
||||||
#elif defined(_XBOX1)
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"C:", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"D:", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"E:", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"F:", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"G:", "", menu_type, 0);
|
|
||||||
#elif defined(_XBOX360)
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"game:", "", menu_type, 0);
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
unsigned drives = GetLogicalDrives();
|
|
||||||
char drive[] = " :\\";
|
|
||||||
for (i = 0; i < 32; i++)
|
|
||||||
{
|
|
||||||
drive[0] = 'A' + i;
|
|
||||||
if (drives & (1 << i))
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
drive, "", menu_type, 0);
|
|
||||||
}
|
|
||||||
#elif defined(__CELLOS_LV2__)
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"/app_home/", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"/dev_hdd0/", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"/dev_hdd1/", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"/host_root/", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"/dev_usb000/", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"/dev_usb001/", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"/dev_usb002/", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"/dev_usb003/", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"/dev_usb004/", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"/dev_usb005/", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"/dev_usb006/", "", menu_type, 0);
|
|
||||||
#elif defined(PSP)
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"ms0:/", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"ef0:/", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"host0:/", "", menu_type, 0);
|
|
||||||
#elif defined(IOS)
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
"/var/mobile/", "", menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf,
|
|
||||||
g_defaults.core_dir, "",menu_type, 0);
|
|
||||||
file_list_push(driver.menu->selection_buf, "/", "",
|
|
||||||
menu_type, 0);
|
|
||||||
#else
|
|
||||||
file_list_push(driver.menu->selection_buf, "/", "",
|
|
||||||
menu_type, 0);
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#if defined(GEKKO) && defined(HW_RVL)
|
|
||||||
LWP_MutexLock(gx_device_mutex);
|
|
||||||
int dev = gx_get_device_from_path(dir);
|
|
||||||
|
|
||||||
if (dev != -1 && !gx_devices[dev].mounted && gx_devices[dev].interface->isInserted())
|
|
||||||
fatMountSimple(gx_devices[dev].name, gx_devices[dev].interface);
|
|
||||||
|
|
||||||
LWP_MutexUnlock(gx_device_mutex);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *exts;
|
|
||||||
char ext_buf[1024];
|
|
||||||
if (menu_type == MENU_SETTINGS_CORE)
|
|
||||||
exts = EXT_EXECUTABLES;
|
|
||||||
else if (menu_type == MENU_SETTINGS_CONFIG)
|
|
||||||
exts = "cfg";
|
|
||||||
else if (menu_type == MENU_SETTINGS_SHADER_PRESET)
|
|
||||||
exts = "cgp|glslp";
|
|
||||||
else if (menu_common_type_is(menu_type) == MENU_SETTINGS_SHADER_OPTIONS)
|
|
||||||
exts = "cg|glsl";
|
|
||||||
else if (menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER)
|
|
||||||
exts = "filt";
|
|
||||||
else if (menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER)
|
|
||||||
exts = "dsp";
|
|
||||||
else if (menu_type == MENU_SETTINGS_OVERLAY_PRESET)
|
|
||||||
exts = "cfg";
|
|
||||||
else if (menu_type == MENU_CONTENT_HISTORY_PATH)
|
|
||||||
exts = "cfg";
|
|
||||||
else if (menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY)
|
|
||||||
exts = ""; // we ignore files anyway
|
|
||||||
else if (driver.menu->defer_core)
|
|
||||||
exts = driver.menu->core_info ? core_info_list_get_all_extensions(driver.menu->core_info) : "";
|
|
||||||
else if (driver.menu->info.valid_extensions)
|
|
||||||
{
|
|
||||||
exts = ext_buf;
|
|
||||||
if (*driver.menu->info.valid_extensions)
|
|
||||||
snprintf(ext_buf, sizeof(ext_buf), "%s|zip", driver.menu->info.valid_extensions);
|
|
||||||
else
|
|
||||||
*ext_buf = '\0';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
exts = g_extern.system.valid_extensions;
|
|
||||||
|
|
||||||
struct string_list *str_list = dir_list_new(dir, exts, true);
|
|
||||||
if (!str_list)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
dir_list_sort(str_list, true);
|
|
||||||
|
|
||||||
if (menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY)
|
|
||||||
file_list_push(driver.menu->selection_buf, "<Use this directory>", "",
|
|
||||||
MENU_FILE_USE_DIRECTORY, 0);
|
|
||||||
|
|
||||||
list_size = str_list->size;
|
|
||||||
for (i = 0; i < str_list->size; i++)
|
|
||||||
{
|
|
||||||
bool is_dir = str_list->elems[i].attr.b;
|
|
||||||
|
|
||||||
if ((menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY) && !is_dir)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Need to preserve slash first time.
|
|
||||||
const char *path = str_list->elems[i].data;
|
|
||||||
if (*dir)
|
|
||||||
path = path_basename(path);
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
|
||||||
if (menu_type == MENU_SETTINGS_CORE && (is_dir || strcasecmp(path, SALAMANDER_FILE) == 0))
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Push menu_type further down in the chain.
|
|
||||||
// Needed for shader manager currently.
|
|
||||||
file_list_push(driver.menu->selection_buf, path, "",
|
|
||||||
is_dir ? menu_type : MENU_FILE_PLAIN, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
menu_entries_push(driver.menu, dir, label, menu_type);
|
|
||||||
string_list_free(str_list);
|
|
||||||
|
|
||||||
switch (menu_type)
|
|
||||||
{
|
|
||||||
case MENU_SETTINGS_CORE:
|
|
||||||
{
|
|
||||||
file_list_t *list = (file_list_t*)driver.menu->selection_buf;
|
|
||||||
file_list_get_last(driver.menu->menu_stack, &dir, NULL, &menu_type);
|
|
||||||
list_size = file_list_get_size(list);
|
|
||||||
|
|
||||||
for (i = 0; i < list_size; i++)
|
|
||||||
{
|
|
||||||
char core_path[PATH_MAX], display_name[256];
|
|
||||||
const char *path = NULL;
|
|
||||||
unsigned type = 0;
|
|
||||||
|
|
||||||
file_list_get_at_offset(list, i, &path, NULL, &type);
|
|
||||||
if (type != MENU_FILE_PLAIN)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
fill_pathname_join(core_path, dir, path, sizeof(core_path));
|
|
||||||
|
|
||||||
if (driver.menu->core_info &&
|
|
||||||
core_info_list_get_display_name(driver.menu->core_info,
|
|
||||||
core_path, display_name, sizeof(display_name)))
|
|
||||||
file_list_set_alt_at_offset(list, i, display_name);
|
|
||||||
}
|
|
||||||
file_list_sort_on_alt(driver.menu->selection_buf);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
driver.menu->scroll_indices_size = 0;
|
|
||||||
if (menu_type != MENU_SETTINGS_OPEN_HISTORY)
|
|
||||||
menu_build_scroll_indices(driver.menu->selection_buf);
|
|
||||||
|
|
||||||
// Before a refresh, we could have deleted a file on disk, causing
|
|
||||||
// selection_ptr to suddendly be out of range. Ensure it doesn't overflow.
|
|
||||||
if (driver.menu->selection_ptr >= file_list_get_size(driver.menu->selection_buf) && file_list_get_size(driver.menu->selection_buf))
|
|
||||||
menu_set_navigation(driver.menu, file_list_get_size(driver.menu->selection_buf) - 1);
|
|
||||||
else if (!file_list_get_size(driver.menu->selection_buf))
|
|
||||||
menu_clear_navigation(driver.menu);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This only makes sense for PC so far.
|
// This only makes sense for PC so far.
|
||||||
// Consoles use set_keybind callbacks instead.
|
// Consoles use set_keybind callbacks instead.
|
||||||
static int menu_custom_bind_iterate(void *data, unsigned action)
|
static int menu_custom_bind_iterate(void *data, unsigned action)
|
||||||
|
@ -27,100 +27,6 @@
|
|||||||
#define MAX_COUNTERS 64
|
#define MAX_COUNTERS 64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
// Shader stuff
|
|
||||||
MENU_SETTINGS_GENERAL_OPTIONS = MENU_SETTINGS + 1,
|
|
||||||
MENU_SETTINGS_VIDEO_OPTIONS,
|
|
||||||
MENU_SETTINGS_VIDEO_RESOLUTION,
|
|
||||||
MENU_SETTINGS_CUSTOM_VIEWPORT,
|
|
||||||
MENU_SETTINGS_CUSTOM_VIEWPORT_2,
|
|
||||||
MENU_SETTINGS_VIDEO_SOFTFILTER,
|
|
||||||
MENU_SETTINGS_VIDEO_OPTIONS_LAST,
|
|
||||||
MENU_SETTINGS_FONT_OPTIONS,
|
|
||||||
MENU_SETTINGS_SHADER_OPTIONS,
|
|
||||||
MENU_SETTINGS_SHADER_FILTER,
|
|
||||||
MENU_SETTINGS_SHADER_PRESET,
|
|
||||||
MENU_SETTINGS_SHADER_APPLY,
|
|
||||||
MENU_SETTINGS_SHADER_PARAMETERS, // Modifies current shader directly. Will not get saved to CGP.
|
|
||||||
MENU_SETTINGS_SHADER_PRESET_PARAMETERS, // Modifies shader preset currently in menu.
|
|
||||||
MENU_SETTINGS_SHADER_PASSES,
|
|
||||||
MENU_SETTINGS_SHADER_PARAMETER_0,
|
|
||||||
MENU_SETTINGS_SHADER_PARAMETER_LAST = MENU_SETTINGS_SHADER_PARAMETER_0 + (GFX_MAX_PARAMETERS - 1),
|
|
||||||
MENU_SETTINGS_SHADER_0,
|
|
||||||
MENU_SETTINGS_SHADER_0_FILTER,
|
|
||||||
MENU_SETTINGS_SHADER_0_SCALE,
|
|
||||||
MENU_SETTINGS_SHADER_LAST = MENU_SETTINGS_SHADER_0_SCALE + (3 * (GFX_MAX_SHADERS - 1)),
|
|
||||||
MENU_SETTINGS_SHADER_PRESET_SAVE,
|
|
||||||
|
|
||||||
// settings options are done here too
|
|
||||||
MENU_SETTINGS_OPEN_FILEBROWSER,
|
|
||||||
MENU_SETTINGS_OPEN_FILEBROWSER_DEFERRED_CORE,
|
|
||||||
MENU_SETTINGS_OPEN_HISTORY,
|
|
||||||
MENU_SETTINGS_CORE,
|
|
||||||
MENU_SETTINGS_CORE_INFO,
|
|
||||||
MENU_SETTINGS_DEFERRED_CORE,
|
|
||||||
MENU_SETTINGS_CONFIG,
|
|
||||||
MENU_SETTINGS_CORE_OPTIONS,
|
|
||||||
MENU_SETTINGS_AUDIO_OPTIONS,
|
|
||||||
MENU_SETTINGS_INPUT_OPTIONS,
|
|
||||||
MENU_SETTINGS_PATH_OPTIONS,
|
|
||||||
MENU_SETTINGS_OVERLAY_OPTIONS,
|
|
||||||
MENU_SETTINGS_USER_OPTIONS,
|
|
||||||
MENU_SETTINGS_NETPLAY_OPTIONS,
|
|
||||||
MENU_SETTINGS_PRIVACY_OPTIONS,
|
|
||||||
MENU_SETTINGS_OPTIONS,
|
|
||||||
MENU_SETTINGS_DRIVERS,
|
|
||||||
MENU_SETTINGS_PERFORMANCE_COUNTERS,
|
|
||||||
MENU_SETTINGS_PERFORMANCE_COUNTERS_LIBRETRO,
|
|
||||||
MENU_SETTINGS_PERFORMANCE_COUNTERS_FRONTEND,
|
|
||||||
MENU_SETTINGS_SAVESTATE_SAVE,
|
|
||||||
MENU_SETTINGS_SAVESTATE_LOAD,
|
|
||||||
MENU_SETTINGS_DISK_OPTIONS,
|
|
||||||
MENU_SETTINGS_DISK_INDEX,
|
|
||||||
MENU_SETTINGS_DISK_APPEND,
|
|
||||||
MENU_SCREENSHOT_DIR_PATH,
|
|
||||||
MENU_BROWSER_DIR_PATH,
|
|
||||||
MENU_CONTENT_HISTORY_PATH,
|
|
||||||
MENU_CONTENT_DIR_PATH,
|
|
||||||
MENU_ASSETS_DIR_PATH,
|
|
||||||
MENU_FILTER_DIR_PATH,
|
|
||||||
MENU_DSP_FILTER_DIR_PATH,
|
|
||||||
MENU_SHADER_DIR_PATH,
|
|
||||||
MENU_SAVESTATE_DIR_PATH,
|
|
||||||
MENU_SAVEFILE_DIR_PATH,
|
|
||||||
MENU_LIBRETRO_DIR_PATH,
|
|
||||||
MENU_LIBRETRO_INFO_DIR_PATH,
|
|
||||||
MENU_CONFIG_DIR_PATH,
|
|
||||||
MENU_OVERLAY_DIR_PATH,
|
|
||||||
MENU_SYSTEM_DIR_PATH,
|
|
||||||
MENU_AUTOCONFIG_DIR_PATH,
|
|
||||||
MENU_EXTRACTION_DIR_PATH,
|
|
||||||
MENU_SETTINGS_AUDIO_DSP_FILTER,
|
|
||||||
|
|
||||||
MENU_SETTINGS_OVERLAY_PRESET,
|
|
||||||
MENU_SETTINGS_BIND_PLAYER,
|
|
||||||
MENU_SETTINGS_BIND_DEVICE,
|
|
||||||
MENU_SETTINGS_BIND_DEVICE_TYPE,
|
|
||||||
MENU_SETTINGS_BIND_ANALOG_MODE,
|
|
||||||
|
|
||||||
// Match up with libretro order for simplicity.
|
|
||||||
MENU_SETTINGS_BIND_BEGIN,
|
|
||||||
MENU_SETTINGS_BIND_LAST = MENU_SETTINGS_BIND_BEGIN + RARCH_ANALOG_RIGHT_Y_MINUS,
|
|
||||||
MENU_SETTINGS_BIND_ALL_LAST = MENU_SETTINGS_BIND_BEGIN + RARCH_MENU_TOGGLE,
|
|
||||||
|
|
||||||
MENU_SETTINGS_CUSTOM_BIND_MODE,
|
|
||||||
MENU_SETTINGS_CUSTOM_BIND,
|
|
||||||
MENU_SETTINGS_CUSTOM_BIND_KEYBOARD,
|
|
||||||
MENU_SETTINGS_CUSTOM_BIND_ALL,
|
|
||||||
MENU_SETTINGS_CUSTOM_BIND_DEFAULT_ALL,
|
|
||||||
MENU_SETTINGS_ONSCREEN_KEYBOARD_ENABLE,
|
|
||||||
MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN,
|
|
||||||
MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_END = MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN + (MAX_COUNTERS - 1),
|
|
||||||
MENU_SETTINGS_PERF_COUNTERS_BEGIN,
|
|
||||||
MENU_SETTINGS_PERF_COUNTERS_END = MENU_SETTINGS_PERF_COUNTERS_BEGIN + (MAX_COUNTERS - 1)
|
|
||||||
} menu_settings_t;
|
|
||||||
|
|
||||||
#ifdef GEKKO
|
#ifdef GEKKO
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -698,3 +698,61 @@ void menu_push_info_screen(void)
|
|||||||
{
|
{
|
||||||
file_list_push(driver.menu->menu_stack, "", "help", 0, 0);
|
file_list_push(driver.menu->menu_stack, "", "help", 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned menu_common_type_is(unsigned type)
|
||||||
|
{
|
||||||
|
if (
|
||||||
|
type == MENU_SETTINGS ||
|
||||||
|
type == MENU_SETTINGS_GENERAL_OPTIONS ||
|
||||||
|
type == MENU_SETTINGS_CORE_OPTIONS ||
|
||||||
|
type == MENU_SETTINGS_CORE_INFO ||
|
||||||
|
type == MENU_SETTINGS_VIDEO_OPTIONS ||
|
||||||
|
type == MENU_SETTINGS_FONT_OPTIONS ||
|
||||||
|
type == MENU_SETTINGS_SHADER_OPTIONS ||
|
||||||
|
type == MENU_SETTINGS_SHADER_PARAMETERS ||
|
||||||
|
type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS ||
|
||||||
|
type == MENU_SETTINGS_AUDIO_OPTIONS ||
|
||||||
|
type == MENU_SETTINGS_DISK_OPTIONS ||
|
||||||
|
type == MENU_SETTINGS_PATH_OPTIONS ||
|
||||||
|
type == MENU_SETTINGS_PRIVACY_OPTIONS ||
|
||||||
|
type == MENU_SETTINGS_OVERLAY_OPTIONS ||
|
||||||
|
type == MENU_SETTINGS_USER_OPTIONS ||
|
||||||
|
type == MENU_SETTINGS_NETPLAY_OPTIONS ||
|
||||||
|
type == MENU_SETTINGS_OPTIONS ||
|
||||||
|
type == MENU_SETTINGS_DRIVERS ||
|
||||||
|
type == MENU_SETTINGS_PERFORMANCE_COUNTERS ||
|
||||||
|
type == MENU_SETTINGS_PERFORMANCE_COUNTERS_LIBRETRO ||
|
||||||
|
type == MENU_SETTINGS_PERFORMANCE_COUNTERS_FRONTEND ||
|
||||||
|
type == MENU_SETTINGS_INPUT_OPTIONS
|
||||||
|
)
|
||||||
|
return MENU_SETTINGS;
|
||||||
|
|
||||||
|
if (
|
||||||
|
(
|
||||||
|
type >= MENU_SETTINGS_SHADER_0 &&
|
||||||
|
type <= MENU_SETTINGS_SHADER_LAST &&
|
||||||
|
(((type - MENU_SETTINGS_SHADER_0) % 3) == 0)) ||
|
||||||
|
type == MENU_SETTINGS_SHADER_PRESET)
|
||||||
|
return MENU_SETTINGS_SHADER_OPTIONS;
|
||||||
|
|
||||||
|
if (
|
||||||
|
type == MENU_BROWSER_DIR_PATH ||
|
||||||
|
type == MENU_CONTENT_DIR_PATH ||
|
||||||
|
type == MENU_ASSETS_DIR_PATH ||
|
||||||
|
type == MENU_SHADER_DIR_PATH ||
|
||||||
|
type == MENU_FILTER_DIR_PATH ||
|
||||||
|
type == MENU_DSP_FILTER_DIR_PATH ||
|
||||||
|
type == MENU_SAVESTATE_DIR_PATH ||
|
||||||
|
type == MENU_LIBRETRO_DIR_PATH ||
|
||||||
|
type == MENU_LIBRETRO_INFO_DIR_PATH ||
|
||||||
|
type == MENU_CONFIG_DIR_PATH ||
|
||||||
|
type == MENU_SAVEFILE_DIR_PATH ||
|
||||||
|
type == MENU_OVERLAY_DIR_PATH ||
|
||||||
|
type == MENU_SCREENSHOT_DIR_PATH ||
|
||||||
|
type == MENU_AUTOCONFIG_DIR_PATH ||
|
||||||
|
type == MENU_EXTRACTION_DIR_PATH ||
|
||||||
|
type == MENU_SYSTEM_DIR_PATH)
|
||||||
|
return MENU_FILE_DIRECTORY;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -80,6 +80,100 @@ typedef enum
|
|||||||
MENU_ACTION_NOOP
|
MENU_ACTION_NOOP
|
||||||
} menu_action_t;
|
} menu_action_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
// Shader stuff
|
||||||
|
MENU_SETTINGS_GENERAL_OPTIONS = MENU_SETTINGS + 1,
|
||||||
|
MENU_SETTINGS_VIDEO_OPTIONS,
|
||||||
|
MENU_SETTINGS_VIDEO_RESOLUTION,
|
||||||
|
MENU_SETTINGS_CUSTOM_VIEWPORT,
|
||||||
|
MENU_SETTINGS_CUSTOM_VIEWPORT_2,
|
||||||
|
MENU_SETTINGS_VIDEO_SOFTFILTER,
|
||||||
|
MENU_SETTINGS_VIDEO_OPTIONS_LAST,
|
||||||
|
MENU_SETTINGS_FONT_OPTIONS,
|
||||||
|
MENU_SETTINGS_SHADER_OPTIONS,
|
||||||
|
MENU_SETTINGS_SHADER_FILTER,
|
||||||
|
MENU_SETTINGS_SHADER_PRESET,
|
||||||
|
MENU_SETTINGS_SHADER_APPLY,
|
||||||
|
MENU_SETTINGS_SHADER_PARAMETERS, // Modifies current shader directly. Will not get saved to CGP.
|
||||||
|
MENU_SETTINGS_SHADER_PRESET_PARAMETERS, // Modifies shader preset currently in menu.
|
||||||
|
MENU_SETTINGS_SHADER_PASSES,
|
||||||
|
MENU_SETTINGS_SHADER_PARAMETER_0,
|
||||||
|
MENU_SETTINGS_SHADER_PARAMETER_LAST = MENU_SETTINGS_SHADER_PARAMETER_0 + (GFX_MAX_PARAMETERS - 1),
|
||||||
|
MENU_SETTINGS_SHADER_0,
|
||||||
|
MENU_SETTINGS_SHADER_0_FILTER,
|
||||||
|
MENU_SETTINGS_SHADER_0_SCALE,
|
||||||
|
MENU_SETTINGS_SHADER_LAST = MENU_SETTINGS_SHADER_0_SCALE + (3 * (GFX_MAX_SHADERS - 1)),
|
||||||
|
MENU_SETTINGS_SHADER_PRESET_SAVE,
|
||||||
|
|
||||||
|
// settings options are done here too
|
||||||
|
MENU_SETTINGS_OPEN_FILEBROWSER,
|
||||||
|
MENU_SETTINGS_OPEN_FILEBROWSER_DEFERRED_CORE,
|
||||||
|
MENU_SETTINGS_OPEN_HISTORY,
|
||||||
|
MENU_SETTINGS_CORE,
|
||||||
|
MENU_SETTINGS_CORE_INFO,
|
||||||
|
MENU_SETTINGS_DEFERRED_CORE,
|
||||||
|
MENU_SETTINGS_CONFIG,
|
||||||
|
MENU_SETTINGS_CORE_OPTIONS,
|
||||||
|
MENU_SETTINGS_AUDIO_OPTIONS,
|
||||||
|
MENU_SETTINGS_INPUT_OPTIONS,
|
||||||
|
MENU_SETTINGS_PATH_OPTIONS,
|
||||||
|
MENU_SETTINGS_OVERLAY_OPTIONS,
|
||||||
|
MENU_SETTINGS_USER_OPTIONS,
|
||||||
|
MENU_SETTINGS_NETPLAY_OPTIONS,
|
||||||
|
MENU_SETTINGS_PRIVACY_OPTIONS,
|
||||||
|
MENU_SETTINGS_OPTIONS,
|
||||||
|
MENU_SETTINGS_DRIVERS,
|
||||||
|
MENU_SETTINGS_PERFORMANCE_COUNTERS,
|
||||||
|
MENU_SETTINGS_PERFORMANCE_COUNTERS_LIBRETRO,
|
||||||
|
MENU_SETTINGS_PERFORMANCE_COUNTERS_FRONTEND,
|
||||||
|
MENU_SETTINGS_SAVESTATE_SAVE,
|
||||||
|
MENU_SETTINGS_SAVESTATE_LOAD,
|
||||||
|
MENU_SETTINGS_DISK_OPTIONS,
|
||||||
|
MENU_SETTINGS_DISK_INDEX,
|
||||||
|
MENU_SETTINGS_DISK_APPEND,
|
||||||
|
MENU_SCREENSHOT_DIR_PATH,
|
||||||
|
MENU_BROWSER_DIR_PATH,
|
||||||
|
MENU_CONTENT_HISTORY_PATH,
|
||||||
|
MENU_CONTENT_DIR_PATH,
|
||||||
|
MENU_ASSETS_DIR_PATH,
|
||||||
|
MENU_FILTER_DIR_PATH,
|
||||||
|
MENU_DSP_FILTER_DIR_PATH,
|
||||||
|
MENU_SHADER_DIR_PATH,
|
||||||
|
MENU_SAVESTATE_DIR_PATH,
|
||||||
|
MENU_SAVEFILE_DIR_PATH,
|
||||||
|
MENU_LIBRETRO_DIR_PATH,
|
||||||
|
MENU_LIBRETRO_INFO_DIR_PATH,
|
||||||
|
MENU_CONFIG_DIR_PATH,
|
||||||
|
MENU_OVERLAY_DIR_PATH,
|
||||||
|
MENU_SYSTEM_DIR_PATH,
|
||||||
|
MENU_AUTOCONFIG_DIR_PATH,
|
||||||
|
MENU_EXTRACTION_DIR_PATH,
|
||||||
|
MENU_SETTINGS_AUDIO_DSP_FILTER,
|
||||||
|
|
||||||
|
MENU_SETTINGS_OVERLAY_PRESET,
|
||||||
|
MENU_SETTINGS_BIND_PLAYER,
|
||||||
|
MENU_SETTINGS_BIND_DEVICE,
|
||||||
|
MENU_SETTINGS_BIND_DEVICE_TYPE,
|
||||||
|
MENU_SETTINGS_BIND_ANALOG_MODE,
|
||||||
|
|
||||||
|
// Match up with libretro order for simplicity.
|
||||||
|
MENU_SETTINGS_BIND_BEGIN,
|
||||||
|
MENU_SETTINGS_BIND_LAST = MENU_SETTINGS_BIND_BEGIN + RARCH_ANALOG_RIGHT_Y_MINUS,
|
||||||
|
MENU_SETTINGS_BIND_ALL_LAST = MENU_SETTINGS_BIND_BEGIN + RARCH_MENU_TOGGLE,
|
||||||
|
|
||||||
|
MENU_SETTINGS_CUSTOM_BIND_MODE,
|
||||||
|
MENU_SETTINGS_CUSTOM_BIND,
|
||||||
|
MENU_SETTINGS_CUSTOM_BIND_KEYBOARD,
|
||||||
|
MENU_SETTINGS_CUSTOM_BIND_ALL,
|
||||||
|
MENU_SETTINGS_CUSTOM_BIND_DEFAULT_ALL,
|
||||||
|
MENU_SETTINGS_ONSCREEN_KEYBOARD_ENABLE,
|
||||||
|
MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN,
|
||||||
|
MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_END = MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN + (MAX_COUNTERS - 1),
|
||||||
|
MENU_SETTINGS_PERF_COUNTERS_BEGIN,
|
||||||
|
MENU_SETTINGS_PERF_COUNTERS_END = MENU_SETTINGS_PERF_COUNTERS_BEGIN + (MAX_COUNTERS - 1)
|
||||||
|
} menu_settings_t;
|
||||||
|
|
||||||
void menu_poll_bind_get_rested_axes(struct menu_bind_state *state);
|
void menu_poll_bind_get_rested_axes(struct menu_bind_state *state);
|
||||||
void menu_poll_bind_state(struct menu_bind_state *state);
|
void menu_poll_bind_state(struct menu_bind_state *state);
|
||||||
bool menu_poll_find_trigger(struct menu_bind_state *state, struct menu_bind_state *new_state);
|
bool menu_poll_find_trigger(struct menu_bind_state *state, struct menu_bind_state *new_state);
|
||||||
@ -107,6 +201,7 @@ void menu_flush_stack_type(unsigned final_type);
|
|||||||
void menu_update_system_info(menu_handle_t *menu, bool *load_no_content);
|
void menu_update_system_info(menu_handle_t *menu, bool *load_no_content);
|
||||||
void menu_build_scroll_indices(file_list_t *buf);
|
void menu_build_scroll_indices(file_list_t *buf);
|
||||||
void menu_push_info_screen(void);
|
void menu_push_info_screen(void);
|
||||||
|
unsigned menu_common_type_is(unsigned type);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "menu_entries.h"
|
#include "menu_entries.h"
|
||||||
#include "backend/menu_common_backend.h"
|
#include "backend/menu_common_backend.h"
|
||||||
#include "../../settings_data.h"
|
#include "../../settings_data.h"
|
||||||
|
#include "../../file_ext.h"
|
||||||
|
|
||||||
static inline struct gfx_shader *shader_manager_get_current_shader(menu_handle_t *menu, unsigned type)
|
static inline struct gfx_shader *shader_manager_get_current_shader(menu_handle_t *menu, unsigned type)
|
||||||
{
|
{
|
||||||
@ -547,3 +548,237 @@ int menu_entries_push(menu_handle_t *menu,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int menu_parse_and_resolve(void)
|
||||||
|
{
|
||||||
|
size_t i, list_size;
|
||||||
|
unsigned menu_type = 0;
|
||||||
|
|
||||||
|
const char *dir = NULL;
|
||||||
|
const char *label = NULL;
|
||||||
|
/* Directory parse */
|
||||||
|
file_list_get_last(driver.menu->menu_stack, &dir, &label, &menu_type);
|
||||||
|
|
||||||
|
if (
|
||||||
|
menu_type == MENU_SETTINGS_DEFERRED_CORE ||
|
||||||
|
menu_type == MENU_SETTINGS_OPEN_HISTORY
|
||||||
|
)
|
||||||
|
return menu_entries_push(driver.menu, dir, label, menu_type);
|
||||||
|
|
||||||
|
if (!((menu_type == MENU_FILE_DIRECTORY ||
|
||||||
|
menu_common_type_is(menu_type) == MENU_SETTINGS_SHADER_OPTIONS ||
|
||||||
|
menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY ||
|
||||||
|
menu_type == MENU_SETTINGS_OVERLAY_PRESET ||
|
||||||
|
menu_type == MENU_CONTENT_HISTORY_PATH ||
|
||||||
|
menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER ||
|
||||||
|
menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER ||
|
||||||
|
menu_type == MENU_SETTINGS_CORE ||
|
||||||
|
menu_type == MENU_SETTINGS_CONFIG ||
|
||||||
|
menu_type == MENU_SETTINGS_DISK_APPEND)))
|
||||||
|
return - 1;
|
||||||
|
|
||||||
|
file_list_clear(driver.menu->selection_buf);
|
||||||
|
|
||||||
|
if (!*dir)
|
||||||
|
{
|
||||||
|
#if defined(GEKKO)
|
||||||
|
#ifdef HW_RVL
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"sd:/", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"usb:/", "", menu_type, 0);
|
||||||
|
#endif
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"carda:/", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"cardb:/", "", menu_type, 0);
|
||||||
|
#elif defined(_XBOX1)
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"C:", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"D:", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"E:", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"F:", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"G:", "", menu_type, 0);
|
||||||
|
#elif defined(_XBOX360)
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"game:", "", menu_type, 0);
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
unsigned drives = GetLogicalDrives();
|
||||||
|
char drive[] = " :\\";
|
||||||
|
for (i = 0; i < 32; i++)
|
||||||
|
{
|
||||||
|
drive[0] = 'A' + i;
|
||||||
|
if (drives & (1 << i))
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
drive, "", menu_type, 0);
|
||||||
|
}
|
||||||
|
#elif defined(__CELLOS_LV2__)
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"/app_home/", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"/dev_hdd0/", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"/dev_hdd1/", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"/host_root/", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"/dev_usb000/", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"/dev_usb001/", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"/dev_usb002/", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"/dev_usb003/", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"/dev_usb004/", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"/dev_usb005/", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"/dev_usb006/", "", menu_type, 0);
|
||||||
|
#elif defined(PSP)
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"ms0:/", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"ef0:/", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"host0:/", "", menu_type, 0);
|
||||||
|
#elif defined(IOS)
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
"/var/mobile/", "", menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf,
|
||||||
|
g_defaults.core_dir, "",menu_type, 0);
|
||||||
|
file_list_push(driver.menu->selection_buf, "/", "",
|
||||||
|
menu_type, 0);
|
||||||
|
#else
|
||||||
|
file_list_push(driver.menu->selection_buf, "/", "",
|
||||||
|
menu_type, 0);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#if defined(GEKKO) && defined(HW_RVL)
|
||||||
|
LWP_MutexLock(gx_device_mutex);
|
||||||
|
int dev = gx_get_device_from_path(dir);
|
||||||
|
|
||||||
|
if (dev != -1 && !gx_devices[dev].mounted && gx_devices[dev].interface->isInserted())
|
||||||
|
fatMountSimple(gx_devices[dev].name, gx_devices[dev].interface);
|
||||||
|
|
||||||
|
LWP_MutexUnlock(gx_device_mutex);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const char *exts;
|
||||||
|
char ext_buf[1024];
|
||||||
|
if (menu_type == MENU_SETTINGS_CORE)
|
||||||
|
exts = EXT_EXECUTABLES;
|
||||||
|
else if (menu_type == MENU_SETTINGS_CONFIG)
|
||||||
|
exts = "cfg";
|
||||||
|
else if (menu_type == MENU_SETTINGS_SHADER_PRESET)
|
||||||
|
exts = "cgp|glslp";
|
||||||
|
else if (menu_common_type_is(menu_type) == MENU_SETTINGS_SHADER_OPTIONS)
|
||||||
|
exts = "cg|glsl";
|
||||||
|
else if (menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER)
|
||||||
|
exts = "filt";
|
||||||
|
else if (menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER)
|
||||||
|
exts = "dsp";
|
||||||
|
else if (menu_type == MENU_SETTINGS_OVERLAY_PRESET)
|
||||||
|
exts = "cfg";
|
||||||
|
else if (menu_type == MENU_CONTENT_HISTORY_PATH)
|
||||||
|
exts = "cfg";
|
||||||
|
else if (menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY)
|
||||||
|
exts = ""; // we ignore files anyway
|
||||||
|
else if (driver.menu->defer_core)
|
||||||
|
exts = driver.menu->core_info ? core_info_list_get_all_extensions(driver.menu->core_info) : "";
|
||||||
|
else if (driver.menu->info.valid_extensions)
|
||||||
|
{
|
||||||
|
exts = ext_buf;
|
||||||
|
if (*driver.menu->info.valid_extensions)
|
||||||
|
snprintf(ext_buf, sizeof(ext_buf), "%s|zip", driver.menu->info.valid_extensions);
|
||||||
|
else
|
||||||
|
*ext_buf = '\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
exts = g_extern.system.valid_extensions;
|
||||||
|
|
||||||
|
struct string_list *str_list = dir_list_new(dir, exts, true);
|
||||||
|
if (!str_list)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
dir_list_sort(str_list, true);
|
||||||
|
|
||||||
|
if (menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY)
|
||||||
|
file_list_push(driver.menu->selection_buf, "<Use this directory>", "",
|
||||||
|
MENU_FILE_USE_DIRECTORY, 0);
|
||||||
|
|
||||||
|
list_size = str_list->size;
|
||||||
|
for (i = 0; i < str_list->size; i++)
|
||||||
|
{
|
||||||
|
bool is_dir = str_list->elems[i].attr.b;
|
||||||
|
|
||||||
|
if ((menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY) && !is_dir)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Need to preserve slash first time.
|
||||||
|
const char *path = str_list->elems[i].data;
|
||||||
|
if (*dir)
|
||||||
|
path = path_basename(path);
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
||||||
|
if (menu_type == MENU_SETTINGS_CORE && (is_dir || strcasecmp(path, SALAMANDER_FILE) == 0))
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Push menu_type further down in the chain.
|
||||||
|
// Needed for shader manager currently.
|
||||||
|
file_list_push(driver.menu->selection_buf, path, "",
|
||||||
|
is_dir ? menu_type : MENU_FILE_PLAIN, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
menu_entries_push(driver.menu, dir, label, menu_type);
|
||||||
|
string_list_free(str_list);
|
||||||
|
|
||||||
|
switch (menu_type)
|
||||||
|
{
|
||||||
|
case MENU_SETTINGS_CORE:
|
||||||
|
{
|
||||||
|
file_list_t *list = (file_list_t*)driver.menu->selection_buf;
|
||||||
|
file_list_get_last(driver.menu->menu_stack, &dir, NULL, &menu_type);
|
||||||
|
list_size = file_list_get_size(list);
|
||||||
|
|
||||||
|
for (i = 0; i < list_size; i++)
|
||||||
|
{
|
||||||
|
char core_path[PATH_MAX], display_name[256];
|
||||||
|
const char *path = NULL;
|
||||||
|
unsigned type = 0;
|
||||||
|
|
||||||
|
file_list_get_at_offset(list, i, &path, NULL, &type);
|
||||||
|
if (type != MENU_FILE_PLAIN)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
fill_pathname_join(core_path, dir, path, sizeof(core_path));
|
||||||
|
|
||||||
|
if (driver.menu->core_info &&
|
||||||
|
core_info_list_get_display_name(driver.menu->core_info,
|
||||||
|
core_path, display_name, sizeof(display_name)))
|
||||||
|
file_list_set_alt_at_offset(list, i, display_name);
|
||||||
|
}
|
||||||
|
file_list_sort_on_alt(driver.menu->selection_buf);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
driver.menu->scroll_indices_size = 0;
|
||||||
|
if (menu_type != MENU_SETTINGS_OPEN_HISTORY)
|
||||||
|
menu_build_scroll_indices(driver.menu->selection_buf);
|
||||||
|
|
||||||
|
// Before a refresh, we could have deleted a file on disk, causing
|
||||||
|
// selection_ptr to suddendly be out of range. Ensure it doesn't overflow.
|
||||||
|
if (driver.menu->selection_ptr >= file_list_get_size(driver.menu->selection_buf) && file_list_get_size(driver.menu->selection_buf))
|
||||||
|
menu_set_navigation(driver.menu, file_list_get_size(driver.menu->selection_buf) - 1);
|
||||||
|
else if (!file_list_get_size(driver.menu->selection_buf))
|
||||||
|
menu_clear_navigation(driver.menu);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -21,5 +21,6 @@
|
|||||||
|
|
||||||
int menu_entries_push(menu_handle_t *menu, const char *path,
|
int menu_entries_push(menu_handle_t *menu, const char *path,
|
||||||
const char *label, unsigned menu_type);
|
const char *label, unsigned menu_type);
|
||||||
|
int menu_parse_and_resolve(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user