mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 06:40:18 +00:00
(Menu) Refactor zip file handling to be list-based
This commit is contained in:
parent
a6bbc31f95
commit
1f01d62386
@ -1556,8 +1556,6 @@ static bool config_load_file(const char *path, bool set_defaults)
|
||||
|
||||
CONFIG_GET_BOOL_BASE(conf, global, perfcnt_enable, "perfcnt_enable");
|
||||
|
||||
CONFIG_GET_INT_BASE(conf, settings, archive.mode, "archive_mode");
|
||||
|
||||
config_get_path(conf, "recording_output_directory", global->record.output_dir,
|
||||
sizeof(global->record.output_dir));
|
||||
config_get_path(conf, "recording_config_directory", global->record.config_dir,
|
||||
@ -2770,8 +2768,6 @@ bool config_save_file(const char *path)
|
||||
config_set_bool(conf, "core_set_supports_no_game_enable",
|
||||
settings->core.set_supports_no_game_enable);
|
||||
|
||||
config_set_int(conf, "archive_mode", settings->archive.mode);
|
||||
|
||||
config_set_int(conf, "menu_ok_btn", settings->menu_ok_btn);
|
||||
config_set_int(conf, "menu_cancel_btn", settings->menu_cancel_btn);
|
||||
config_set_int(conf, "menu_search_btn", settings->menu_search_btn);
|
||||
|
@ -294,6 +294,125 @@ static int deferred_push_core_content_list(menu_displaylist_info_t *info)
|
||||
}
|
||||
#endif
|
||||
|
||||
static int deferred_archive_action_detect_core(menu_displaylist_info_t *info)
|
||||
{
|
||||
return menu_displaylist_push_list(info, DISPLAYLIST_ARCHIVE_ACTION_DETECT_CORE);
|
||||
}
|
||||
|
||||
static int deferred_archive_action(menu_displaylist_info_t *info)
|
||||
{
|
||||
return menu_displaylist_push_list(info, DISPLAYLIST_ARCHIVE_ACTION);
|
||||
}
|
||||
|
||||
static int deferred_archive_open_detect_core(menu_displaylist_info_t *info)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
|
||||
fill_pathname_join(info->path, menu->scratch2_buf,
|
||||
menu->scratch_buf, sizeof(info->path));
|
||||
fill_pathname_join(info->label, menu->scratch2_buf,
|
||||
menu->scratch_buf, sizeof(info->label));
|
||||
|
||||
info->type_default = MENU_FILE_PLAIN;
|
||||
info->setting = menu_setting_find(info->label);
|
||||
|
||||
|
||||
if (global->core_info)
|
||||
strlcpy(info->exts, core_info_list_get_all_extensions(
|
||||
global->core_info), sizeof(info->exts));
|
||||
else if (global->menu.info.valid_extensions)
|
||||
{
|
||||
if (*global->menu.info.valid_extensions)
|
||||
strlcpy(info->exts, global->menu.info.valid_extensions,
|
||||
sizeof(info->exts));
|
||||
}
|
||||
else
|
||||
strlcpy(info->exts, system->valid_extensions, sizeof(info->exts));
|
||||
|
||||
(void)settings;
|
||||
|
||||
if (settings->multimedia.builtin_mediaplayer_enable ||
|
||||
settings->multimedia.builtin_imageviewer_enable)
|
||||
{
|
||||
struct retro_system_info sysinfo = {0};
|
||||
|
||||
(void)sysinfo;
|
||||
#ifdef HAVE_FFMPEG
|
||||
if (settings->multimedia.builtin_mediaplayer_enable)
|
||||
{
|
||||
libretro_ffmpeg_retro_get_system_info(&sysinfo);
|
||||
strlcat(info->exts, "|", sizeof(info->exts));
|
||||
strlcat(info->exts, sysinfo.valid_extensions, sizeof(info->exts));
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
if (settings->multimedia.builtin_imageviewer_enable)
|
||||
{
|
||||
libretro_imageviewer_retro_get_system_info(&sysinfo);
|
||||
strlcat(info->exts, "|", sizeof(info->exts));
|
||||
strlcat(info->exts, sysinfo.valid_extensions, sizeof(info->exts));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return menu_displaylist_push_list(info, DISPLAYLIST_DEFAULT);
|
||||
}
|
||||
|
||||
static int deferred_archive_open(menu_displaylist_info_t *info)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
|
||||
fill_pathname_join(info->path, menu->scratch2_buf,
|
||||
menu->scratch_buf, sizeof(info->path));
|
||||
fill_pathname_join(info->label, menu->scratch2_buf,
|
||||
menu->scratch_buf, sizeof(info->label));
|
||||
|
||||
info->type_default = MENU_FILE_PLAIN;
|
||||
info->setting = menu_setting_find(info->label);
|
||||
|
||||
if (global->menu.info.valid_extensions)
|
||||
{
|
||||
if (*global->menu.info.valid_extensions)
|
||||
strlcpy(info->exts, global->menu.info.valid_extensions,
|
||||
sizeof(info->exts));
|
||||
}
|
||||
else
|
||||
strlcpy(info->exts, system->valid_extensions, sizeof(info->exts));
|
||||
|
||||
(void)settings;
|
||||
|
||||
if (settings->multimedia.builtin_mediaplayer_enable ||
|
||||
settings->multimedia.builtin_imageviewer_enable)
|
||||
{
|
||||
struct retro_system_info sysinfo = {0};
|
||||
|
||||
(void)sysinfo;
|
||||
#ifdef HAVE_FFMPEG
|
||||
if (settings->multimedia.builtin_mediaplayer_enable)
|
||||
{
|
||||
libretro_ffmpeg_retro_get_system_info(&sysinfo);
|
||||
strlcat(info->exts, "|", sizeof(info->exts));
|
||||
strlcat(info->exts, sysinfo.valid_extensions, sizeof(info->exts));
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
if (settings->multimedia.builtin_imageviewer_enable)
|
||||
{
|
||||
libretro_imageviewer_retro_get_system_info(&sysinfo);
|
||||
strlcat(info->exts, "|", sizeof(info->exts));
|
||||
strlcat(info->exts, sysinfo.valid_extensions, sizeof(info->exts));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return menu_displaylist_push_list(info, DISPLAYLIST_DEFAULT);
|
||||
}
|
||||
|
||||
static int deferred_push_history_list(menu_displaylist_info_t *info)
|
||||
{
|
||||
return menu_displaylist_push_list(info, DISPLAYLIST_HISTORY);
|
||||
@ -546,6 +665,18 @@ static int menu_cbs_init_bind_deferred_push_compare_label(menu_file_list_cbs_t *
|
||||
{
|
||||
switch (label_hash)
|
||||
{
|
||||
case MENU_LABEL_DEFERRED_ARCHIVE_ACTION_DETECT_CORE:
|
||||
cbs->action_deferred_push = deferred_archive_action_detect_core;
|
||||
break;
|
||||
case MENU_LABEL_DEFERRED_ARCHIVE_ACTION:
|
||||
cbs->action_deferred_push = deferred_archive_action;
|
||||
break;
|
||||
case MENU_LABEL_DEFERRED_ARCHIVE_OPEN_DETECT_CORE:
|
||||
cbs->action_deferred_push = deferred_archive_open_detect_core;
|
||||
break;
|
||||
case MENU_LABEL_DEFERRED_ARCHIVE_OPEN:
|
||||
cbs->action_deferred_push = deferred_archive_open;
|
||||
break;
|
||||
case MENU_LABEL_DEFERRED_CORE_CONTENT_LIST:
|
||||
#ifdef HAVE_NETWORKING
|
||||
cbs->action_deferred_push = deferred_push_core_content_list;
|
||||
|
@ -32,125 +32,6 @@
|
||||
#include "../../input/input_common.h"
|
||||
#include "../../input/input_autodetect.h"
|
||||
|
||||
extern char detect_content_path[PATH_MAX_LENGTH];
|
||||
|
||||
static int archive_open(void)
|
||||
{
|
||||
char cat_path[PATH_MAX_LENGTH] = {0};
|
||||
menu_displaylist_info_t info = {0};
|
||||
const char *menu_path = NULL;
|
||||
const char *menu_label = NULL;
|
||||
const char* path = NULL;
|
||||
unsigned int type = 0;
|
||||
size_t entry_idx = 0;
|
||||
menu_navigation_t *nav = menu_navigation_get_ptr();
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
|
||||
if (!menu_list || !nav)
|
||||
return -1;
|
||||
|
||||
menu_list_pop_stack(menu_list);
|
||||
|
||||
menu_list_get_last_stack(menu_list,
|
||||
&menu_path, &menu_label, NULL, NULL);
|
||||
|
||||
if (menu_list_get_size(menu_list) == 0)
|
||||
return 0;
|
||||
|
||||
menu_list_get_at_offset(menu_list->selection_buf,
|
||||
nav->selection_ptr, &path, NULL, &type, &entry_idx);
|
||||
|
||||
fill_pathname_join(cat_path, menu_path, path, sizeof(cat_path));
|
||||
|
||||
fill_pathname_join(detect_content_path, menu_path, path,
|
||||
sizeof(detect_content_path));
|
||||
|
||||
info.list = menu_list->menu_stack;
|
||||
info.type = type;
|
||||
info.directory_ptr = nav->selection_ptr;
|
||||
strlcpy(info.path, cat_path, sizeof(info.path));
|
||||
strlcpy(info.label, menu_label, sizeof(info.label));
|
||||
|
||||
return menu_displaylist_push_list(&info, DISPLAYLIST_GENERIC);
|
||||
}
|
||||
|
||||
static int archive_load(void)
|
||||
{
|
||||
int ret = 0;
|
||||
menu_displaylist_info_t info = {0};
|
||||
const char *menu_path = NULL;
|
||||
const char *menu_label = NULL;
|
||||
const char* path = NULL;
|
||||
size_t entry_idx = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
size_t selected = menu_navigation_get_current_selection();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
|
||||
if (!menu || !menu_list)
|
||||
return -1;
|
||||
|
||||
menu_list_pop_stack(menu_list);
|
||||
|
||||
menu_list_get_last_stack(menu_list, &menu_path, &menu_label, NULL, NULL);
|
||||
|
||||
if (menu_list_get_size(menu_list) == 0)
|
||||
return 0;
|
||||
|
||||
menu_list_get_at_offset(menu_list->selection_buf,
|
||||
selected, &path, NULL, NULL, &entry_idx);
|
||||
|
||||
ret = rarch_defer_core(global->core_info, menu_path, path, menu_label,
|
||||
menu->deferred_path, sizeof(menu->deferred_path));
|
||||
|
||||
fill_pathname_join(detect_content_path, menu_path, path,
|
||||
sizeof(detect_content_path));
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case -1:
|
||||
event_command(EVENT_CMD_LOAD_CORE);
|
||||
menu_common_load_content(false, CORE_TYPE_PLAIN);
|
||||
break;
|
||||
case 0:
|
||||
info.list = menu_list->menu_stack;
|
||||
info.type = 0;
|
||||
info.directory_ptr = selected;
|
||||
strlcpy(info.path, settings->libretro_directory, sizeof(info.path));
|
||||
strlcpy(info.label,
|
||||
menu_hash_to_str(MENU_LABEL_DEFERRED_CORE_LIST), sizeof(info.label));
|
||||
|
||||
ret = menu_displaylist_push_list(&info, DISPLAYLIST_GENERIC);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int load_or_open_zip_iterate(char *s, size_t len, unsigned action)
|
||||
{
|
||||
snprintf(s, len, "Opening compressed file\n"
|
||||
" \n"
|
||||
|
||||
" - OK to open as Folder\n"
|
||||
" - Cancel/Back to Load \n");
|
||||
|
||||
menu_driver_render_messagebox(s);
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case MENU_ACTION_OK:
|
||||
archive_open();
|
||||
break;
|
||||
case MENU_ACTION_CANCEL:
|
||||
archive_load();
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_iterate_help(char *s, size_t len, const char *label)
|
||||
{
|
||||
unsigned i;
|
||||
@ -262,25 +143,6 @@ static int action_iterate_info(char *s, size_t len, const char *label)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int action_iterate_load_open_zip(const char *label, char *s, size_t len, unsigned action)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
switch (settings->archive.mode)
|
||||
{
|
||||
case 0:
|
||||
return load_or_open_zip_iterate(s, len, action);
|
||||
case 1:
|
||||
return archive_load();
|
||||
case 2:
|
||||
return archive_open();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_iterate_menu_viewport(char *s, size_t len,
|
||||
const char *label, unsigned action, uint32_t hash)
|
||||
{
|
||||
@ -474,7 +336,6 @@ enum action_iterate_type
|
||||
ITERATE_TYPE_DEFAULT = 0,
|
||||
ITERATE_TYPE_HELP,
|
||||
ITERATE_TYPE_INFO,
|
||||
ITERATE_TYPE_ZIP,
|
||||
ITERATE_TYPE_MESSAGE,
|
||||
ITERATE_TYPE_VIEWPORT,
|
||||
ITERATE_TYPE_BIND
|
||||
@ -488,8 +349,6 @@ static enum action_iterate_type action_iterate_type(uint32_t hash)
|
||||
return ITERATE_TYPE_HELP;
|
||||
case MENU_LABEL_INFO_SCREEN:
|
||||
return ITERATE_TYPE_INFO;
|
||||
case MENU_LABEL_LOAD_OPEN_ZIP:
|
||||
return ITERATE_TYPE_ZIP;
|
||||
case MENU_LABEL_MESSAGE:
|
||||
return ITERATE_TYPE_MESSAGE;
|
||||
case MENU_LABEL_CUSTOM_VIEWPORT_1:
|
||||
@ -550,10 +409,6 @@ static int action_iterate_main(const char *label, unsigned action)
|
||||
do_pop_stack = true;
|
||||
do_post_iterate = true;
|
||||
break;
|
||||
case ITERATE_TYPE_ZIP:
|
||||
ret = action_iterate_load_open_zip(label, msg, sizeof(msg), action);
|
||||
do_render = true;
|
||||
break;
|
||||
case ITERATE_TYPE_MESSAGE:
|
||||
strlcpy(msg, disp->message_contents, sizeof(msg));
|
||||
pop_selected = &nav->selection_ptr;
|
||||
|
@ -51,8 +51,9 @@ static int rarch_defer_core_wrapper(menu_displaylist_info_t *info,
|
||||
size_t idx, size_t entry_idx, const char *path, uint32_t hash_label,
|
||||
bool is_carchive)
|
||||
{
|
||||
char menu_path_new[PATH_MAX_LENGTH];
|
||||
const char *menu_path = NULL;
|
||||
const char *menu_label = NULL;
|
||||
const char *menu_label = NULL;
|
||||
int ret = 0;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
@ -65,12 +66,27 @@ static int rarch_defer_core_wrapper(menu_displaylist_info_t *info,
|
||||
menu_list_get_last_stack(menu_list,
|
||||
&menu_path, &menu_label, NULL, NULL);
|
||||
|
||||
strlcpy(menu_path_new, menu_path, sizeof(menu_path_new));
|
||||
|
||||
if (
|
||||
!strcmp(menu_label, menu_hash_to_str(MENU_LABEL_DEFERRED_ARCHIVE_OPEN_DETECT_CORE))
|
||||
)
|
||||
{
|
||||
fill_pathname_join(menu_path_new, menu->scratch2_buf, menu->scratch_buf,
|
||||
sizeof(menu_path_new));
|
||||
}
|
||||
else if (!strcmp(menu_label, menu_hash_to_str(MENU_LABEL_DEFERRED_ARCHIVE_OPEN)))
|
||||
{
|
||||
fill_pathname_join(menu_path_new, menu->scratch2_buf, menu->scratch_buf,
|
||||
sizeof(menu_path_new));
|
||||
}
|
||||
|
||||
ret = rarch_defer_core(global->core_info,
|
||||
menu_path, path, menu_label, menu->deferred_path,
|
||||
menu_path_new, path, menu_label, menu->deferred_path,
|
||||
sizeof(menu->deferred_path));
|
||||
|
||||
if (!is_carchive)
|
||||
fill_pathname_join(detect_content_path, menu_path, path,
|
||||
fill_pathname_join(detect_content_path, menu_path_new, path,
|
||||
sizeof(detect_content_path));
|
||||
|
||||
switch (ret)
|
||||
@ -933,9 +949,9 @@ static int action_ok_core_deferred_set(const char *path,
|
||||
static int action_ok_core_load_deferred(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
|
||||
if (!menu)
|
||||
return -1;
|
||||
@ -1030,21 +1046,56 @@ static int action_ok_core_download(const char *path,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_ok_compressed_archive_push_detect_core(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
menu_displaylist_info_t info = {0};
|
||||
const char *menu_path = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
if (!menu_list || !menu)
|
||||
return -1;
|
||||
|
||||
menu_list_get_last_stack(menu_list,
|
||||
&menu_path, NULL, NULL, NULL);
|
||||
|
||||
info.list = menu_list->menu_stack;
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
strlcpy(info.path, path, sizeof(info.path));
|
||||
strlcpy(info.label,
|
||||
menu_hash_to_str(MENU_LABEL_DEFERRED_ARCHIVE_ACTION_DETECT_CORE), sizeof(info.label));
|
||||
|
||||
strlcpy(menu->scratch_buf, path, sizeof(menu->scratch_buf));
|
||||
strlcpy(menu->scratch2_buf, menu_path, sizeof(menu->scratch2_buf));
|
||||
|
||||
return menu_displaylist_push_list(&info, DISPLAYLIST_GENERIC);
|
||||
}
|
||||
|
||||
static int action_ok_compressed_archive_push(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
menu_displaylist_info_t info = {0};
|
||||
const char *menu_path = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
if (!menu_list)
|
||||
if (!menu_list || !menu)
|
||||
return -1;
|
||||
|
||||
menu_list_get_last_stack(menu_list,
|
||||
&menu_path, NULL, NULL, NULL);
|
||||
|
||||
info.list = menu_list->menu_stack;
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
strlcpy(info.path, path, sizeof(info.path));
|
||||
strlcpy(info.label,
|
||||
menu_hash_to_str(MENU_LABEL_LOAD_OPEN_ZIP), sizeof(info.label));
|
||||
menu_hash_to_str(MENU_LABEL_DEFERRED_ARCHIVE_ACTION), sizeof(info.label));
|
||||
|
||||
return menu_displaylist_push_list(&info, DISPLAYLIST_INFO);
|
||||
strlcpy(menu->scratch_buf, path, sizeof(menu->scratch_buf));
|
||||
strlcpy(menu->scratch2_buf, menu_path, sizeof(menu->scratch2_buf));
|
||||
|
||||
return menu_displaylist_push_list(&info, DISPLAYLIST_GENERIC);
|
||||
}
|
||||
|
||||
static int action_ok_directory_push(const char *path,
|
||||
@ -1219,10 +1270,12 @@ static int action_ok_file_load_imageviewer(const char *path,
|
||||
static int action_ok_file_load(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
char menu_path_new[PATH_MAX_LENGTH];
|
||||
const char *menu_label = NULL;
|
||||
const char *menu_path = NULL;
|
||||
rarch_setting_t *setting = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
|
||||
if (!menu_list)
|
||||
@ -1231,20 +1284,31 @@ static int action_ok_file_load(const char *path,
|
||||
menu_list_get_last(menu_list->menu_stack,
|
||||
&menu_path, &menu_label, NULL, NULL);
|
||||
|
||||
strlcpy(menu_path_new, menu_path, sizeof(menu_path_new));
|
||||
|
||||
if (
|
||||
!strcmp(menu_label, menu_hash_to_str(MENU_LABEL_DEFERRED_ARCHIVE_OPEN_DETECT_CORE)) ||
|
||||
!strcmp(menu_label, menu_hash_to_str(MENU_LABEL_DEFERRED_ARCHIVE_OPEN))
|
||||
)
|
||||
{
|
||||
fill_pathname_join(menu_path_new, menu->scratch2_buf, menu->scratch_buf,
|
||||
sizeof(menu_path_new));
|
||||
}
|
||||
|
||||
setting = menu_setting_find(menu_label);
|
||||
|
||||
if (setting && setting->type == ST_PATH)
|
||||
{
|
||||
menu_action_setting_set_current_string_path(setting, menu_path, path);
|
||||
menu_action_setting_set_current_string_path(setting, menu_path_new, path);
|
||||
menu_list_pop_stack_by_needle(menu_list, setting->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type == MENU_FILE_IN_CARCHIVE)
|
||||
fill_pathname_join_delim(global->fullpath, menu_path, path,
|
||||
fill_pathname_join_delim(global->fullpath, menu_path_new, path,
|
||||
'#',sizeof(global->fullpath));
|
||||
else
|
||||
fill_pathname_join(global->fullpath, menu_path, path,
|
||||
fill_pathname_join(global->fullpath, menu_path_new, path,
|
||||
sizeof(global->fullpath));
|
||||
|
||||
menu_common_load_content(true, CORE_TYPE_PLAIN);
|
||||
@ -1653,6 +1717,119 @@ static int action_ok_rdb_entry_submenu(const char *path,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int action_ok_open_archive_detect_core(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
menu_displaylist_info_t info = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
const char *menu_path = menu ? menu->scratch2_buf : NULL;
|
||||
const char *content_path = menu ? menu->scratch_buf : NULL;
|
||||
|
||||
if (!menu_list)
|
||||
return -1;
|
||||
|
||||
fill_pathname_join(detect_content_path, menu_path, content_path,
|
||||
sizeof(detect_content_path));
|
||||
|
||||
info.list = menu_list->menu_stack;
|
||||
info.type = 0;
|
||||
info.directory_ptr = 0;
|
||||
strlcpy(info.path, path, sizeof(info.path));
|
||||
strlcpy(info.label,
|
||||
menu_hash_to_str(MENU_LABEL_DEFERRED_ARCHIVE_OPEN_DETECT_CORE), sizeof(info.label));
|
||||
|
||||
return menu_displaylist_push_list(&info, DISPLAYLIST_GENERIC);
|
||||
}
|
||||
|
||||
static int action_ok_open_archive(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
menu_displaylist_info_t info = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
const char *menu_path = menu ? menu->scratch2_buf : NULL;
|
||||
const char *content_path = menu ? menu->scratch_buf : NULL;
|
||||
|
||||
if (!menu_list)
|
||||
return -1;
|
||||
|
||||
fill_pathname_join(detect_content_path, menu_path, content_path,
|
||||
sizeof(detect_content_path));
|
||||
|
||||
info.list = menu_list->menu_stack;
|
||||
info.type = 0;
|
||||
info.directory_ptr = 0;
|
||||
strlcpy(info.path, path, sizeof(info.path));
|
||||
strlcpy(info.label,
|
||||
menu_hash_to_str(MENU_LABEL_DEFERRED_ARCHIVE_OPEN), sizeof(info.label));
|
||||
|
||||
return menu_displaylist_push_list(&info, DISPLAYLIST_GENERIC);
|
||||
}
|
||||
|
||||
static int action_ok_load_archive(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
const char *menu_path = menu ? menu->scratch2_buf : NULL;
|
||||
const char *content_path = menu ? menu->scratch_buf : NULL;
|
||||
|
||||
fill_pathname_join(detect_content_path, menu_path, content_path,
|
||||
sizeof(detect_content_path));
|
||||
|
||||
strlcpy(global->fullpath, detect_content_path, sizeof(global->fullpath));
|
||||
event_command(EVENT_CMD_LOAD_CORE);
|
||||
menu_common_load_content(false, CORE_TYPE_PLAIN);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_ok_load_archive_detect_core(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
int ret = 0;
|
||||
menu_displaylist_info_t info = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
size_t selected = menu_navigation_get_current_selection();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
const char *menu_path = menu ? menu->scratch2_buf : NULL;
|
||||
const char *content_path = menu ? menu->scratch_buf : NULL;
|
||||
|
||||
if (!menu || !menu_list)
|
||||
return -1;
|
||||
|
||||
ret = rarch_defer_core(global->core_info, menu_path, content_path, label,
|
||||
menu->deferred_path, sizeof(menu->deferred_path));
|
||||
|
||||
fill_pathname_join(detect_content_path, menu_path, content_path,
|
||||
sizeof(detect_content_path));
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case -1:
|
||||
event_command(EVENT_CMD_LOAD_CORE);
|
||||
menu_common_load_content(false, CORE_TYPE_PLAIN);
|
||||
break;
|
||||
case 0:
|
||||
info.list = menu_list->menu_stack;
|
||||
info.type = 0;
|
||||
info.directory_ptr = selected;
|
||||
strlcpy(info.path, settings->libretro_directory, sizeof(info.path));
|
||||
strlcpy(info.label,
|
||||
menu_hash_to_str(MENU_LABEL_DEFERRED_CORE_LIST), sizeof(info.label));
|
||||
|
||||
ret = menu_displaylist_push_list(&info, DISPLAYLIST_GENERIC);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int action_ok_help(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -1759,6 +1936,18 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
|
||||
switch (hash)
|
||||
{
|
||||
case MENU_LABEL_OPEN_ARCHIVE_DETECT_CORE:
|
||||
cbs->action_ok = action_ok_open_archive_detect_core;
|
||||
break;
|
||||
case MENU_LABEL_OPEN_ARCHIVE:
|
||||
cbs->action_ok = action_ok_open_archive;
|
||||
break;
|
||||
case MENU_LABEL_LOAD_ARCHIVE_DETECT_CORE:
|
||||
cbs->action_ok = action_ok_load_archive_detect_core;
|
||||
break;
|
||||
case MENU_LABEL_LOAD_ARCHIVE:
|
||||
cbs->action_ok = action_ok_load_archive;
|
||||
break;
|
||||
case MENU_LABEL_CUSTOM_BIND_ALL:
|
||||
cbs->action_ok = action_ok_lookup_setting;
|
||||
break;
|
||||
@ -2011,10 +2200,14 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
|
||||
case MENU_FILE_CARCHIVE:
|
||||
switch (menu_label_hash)
|
||||
{
|
||||
case MENU_LABEL_DETECT_CORE_LIST:
|
||||
cbs->action_ok = action_ok_compressed_archive_push_detect_core;
|
||||
break;
|
||||
case MENU_LABEL_SCAN_FILE:
|
||||
break;
|
||||
default:
|
||||
cbs->action_ok = action_ok_compressed_archive_push;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MENU_FILE_CORE:
|
||||
@ -2085,6 +2278,7 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
|
||||
break;
|
||||
case MENU_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST:
|
||||
case MENU_LABEL_DETECT_CORE_LIST:
|
||||
case MENU_LABEL_DEFERRED_ARCHIVE_OPEN_DETECT_CORE:
|
||||
#ifdef HAVE_COMPRESSION
|
||||
if (type == MENU_FILE_IN_CARCHIVE)
|
||||
cbs->action_ok = action_ok_file_load_with_detect_core_carchive;
|
||||
|
@ -47,9 +47,9 @@ const char *menu_hash_to_str_de(uint32_t hash)
|
||||
return "MD5";
|
||||
case MENU_LABEL_VALUE_LOAD_CONTENT_LIST:
|
||||
return "Lade Content";
|
||||
case MENU_VALUE_LOAD_ARCHIVE:
|
||||
case MENU_LABEL_VALUE_LOAD_ARCHIVE:
|
||||
return "Lade Archiv";
|
||||
case MENU_VALUE_OPEN_ARCHIVE:
|
||||
case MENU_LABEL_VALUE_OPEN_ARCHIVE:
|
||||
return "Öffne Archiv";
|
||||
case MENU_VALUE_ASK_ARCHIVE:
|
||||
return "Nachfragen";
|
||||
|
@ -58,9 +58,9 @@ const char *menu_hash_to_str_fr(uint32_t hash)
|
||||
return "MD5";
|
||||
case MENU_LABEL_VALUE_LOAD_CONTENT_LIST:
|
||||
return "Charger un contenu";
|
||||
case MENU_VALUE_LOAD_ARCHIVE:
|
||||
case MENU_LABEL_VALUE_LOAD_ARCHIVE:
|
||||
return "Charger l'archive";
|
||||
case MENU_VALUE_OPEN_ARCHIVE:
|
||||
case MENU_LABEL_VALUE_OPEN_ARCHIVE:
|
||||
return "Ouvrir l'archive";
|
||||
case MENU_VALUE_ASK_ARCHIVE:
|
||||
return "Demander";
|
||||
|
@ -37,9 +37,9 @@ const char *menu_hash_to_str_nl(uint32_t hash)
|
||||
return "MD5";
|
||||
case MENU_LABEL_VALUE_LOAD_CONTENT_LIST:
|
||||
return "Laad Content";
|
||||
case MENU_VALUE_LOAD_ARCHIVE:
|
||||
case MENU_LABEL_VALUE_LOAD_ARCHIVE:
|
||||
return "Laad Archief";
|
||||
case MENU_VALUE_OPEN_ARCHIVE:
|
||||
case MENU_LABEL_VALUE_OPEN_ARCHIVE:
|
||||
return "Open Archief";
|
||||
case MENU_VALUE_ASK_ARCHIVE:
|
||||
return "Keuze";
|
||||
|
@ -57,9 +57,9 @@ const char *menu_hash_to_str_pl(uint32_t hash)
|
||||
return "MD5";
|
||||
case MENU_LABEL_VALUE_LOAD_CONTENT_LIST:
|
||||
return "Wczytaj tre¶æ";
|
||||
case MENU_VALUE_LOAD_ARCHIVE:
|
||||
case MENU_LABEL_VALUE_LOAD_ARCHIVE:
|
||||
return "Wczytaj archiwum";
|
||||
case MENU_VALUE_OPEN_ARCHIVE:
|
||||
case MENU_LABEL_VALUE_OPEN_ARCHIVE:
|
||||
return "Otwórz archiwum";
|
||||
case MENU_VALUE_ASK_ARCHIVE:
|
||||
return "Pytaj";
|
||||
|
@ -45,9 +45,9 @@ const char *menu_hash_to_str_pt(uint32_t hash)
|
||||
return "MD5";
|
||||
case MENU_LABEL_VALUE_LOAD_CONTENT_LIST:
|
||||
return "Carregar Conteúdo";
|
||||
case MENU_VALUE_LOAD_ARCHIVE:
|
||||
case MENU_LABEL_VALUE_LOAD_ARCHIVE:
|
||||
return "Carregar Arquivo";
|
||||
case MENU_VALUE_OPEN_ARCHIVE:
|
||||
case MENU_LABEL_VALUE_OPEN_ARCHIVE:
|
||||
return "Abrir Arquivo";
|
||||
case MENU_VALUE_ASK_ARCHIVE:
|
||||
return "Ask";
|
||||
|
@ -26,6 +26,22 @@ static const char *menu_hash_to_str_us_label(uint32_t hash)
|
||||
{
|
||||
switch (hash)
|
||||
{
|
||||
case MENU_LABEL_DEFERRED_ARCHIVE_OPEN_DETECT_CORE:
|
||||
return "deferred_archive_open_detect_core";
|
||||
case MENU_LABEL_DEFERRED_ARCHIVE_OPEN:
|
||||
return "deferred_archive_open";
|
||||
case MENU_LABEL_LOAD_ARCHIVE_DETECT_CORE:
|
||||
return "load_archive_detect_core";
|
||||
case MENU_LABEL_LOAD_ARCHIVE:
|
||||
return "load_archive";
|
||||
case MENU_LABEL_DEFERRED_ARCHIVE_ACTION_DETECT_CORE:
|
||||
return "deferred_archive_action_detect_core";
|
||||
case MENU_LABEL_DEFERRED_ARCHIVE_ACTION:
|
||||
return "deferred_archive_action";
|
||||
case MENU_LABEL_OPEN_ARCHIVE_DETECT_CORE:
|
||||
return "open_archive_detect_core";
|
||||
case MENU_LABEL_OPEN_ARCHIVE:
|
||||
return "open_archive";
|
||||
case MENU_LABEL_INPUT_BACK_AS_MENU_TOGGLE_ENABLE:
|
||||
return "back_as_menu_toggle_enable";
|
||||
case MENU_LABEL_INPUT_MENU_TOGGLE_GAMEPAD_COMBO:
|
||||
@ -620,6 +636,10 @@ const char *menu_hash_to_str_us(uint32_t hash)
|
||||
|
||||
switch (hash)
|
||||
{
|
||||
case MENU_LABEL_VALUE_OPEN_ARCHIVE:
|
||||
return "Open Archive As Folder";
|
||||
case MENU_LABEL_VALUE_LOAD_ARCHIVE:
|
||||
return "Load Archive With Core";
|
||||
case MENU_LABEL_VALUE_INPUT_BACK_AS_MENU_TOGGLE_ENABLE:
|
||||
return "Back As Menu Toggle Enable";
|
||||
case MENU_LABEL_VALUE_INPUT_MENU_TOGGLE_GAMEPAD_COMBO:
|
||||
@ -654,10 +674,6 @@ const char *menu_hash_to_str_us(uint32_t hash)
|
||||
return "MD5";
|
||||
case MENU_LABEL_VALUE_LOAD_CONTENT_LIST:
|
||||
return "Load Content";
|
||||
case MENU_VALUE_LOAD_ARCHIVE:
|
||||
return "Load Archive";
|
||||
case MENU_VALUE_OPEN_ARCHIVE:
|
||||
return "Open Archive";
|
||||
case MENU_VALUE_ASK_ARCHIVE:
|
||||
return "Ask";
|
||||
case MENU_LABEL_VALUE_PRIVACY_SETTINGS:
|
||||
|
@ -2544,6 +2544,30 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
menu_list_clear(info->list);
|
||||
menu_displaylist_parse_generic(info, &need_sort);
|
||||
break;
|
||||
case DISPLAYLIST_ARCHIVE_ACTION:
|
||||
menu_list_clear(info->list);
|
||||
menu_list_push(info->list,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_OPEN_ARCHIVE),
|
||||
menu_hash_to_str(MENU_LABEL_OPEN_ARCHIVE),
|
||||
0, 0, 0);
|
||||
menu_list_push(info->list,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_LOAD_ARCHIVE),
|
||||
menu_hash_to_str(MENU_LABEL_LOAD_ARCHIVE),
|
||||
0, 0, 0);
|
||||
need_push = true;
|
||||
break;
|
||||
case DISPLAYLIST_ARCHIVE_ACTION_DETECT_CORE:
|
||||
menu_list_clear(info->list);
|
||||
menu_list_push(info->list,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_OPEN_ARCHIVE),
|
||||
menu_hash_to_str(MENU_LABEL_OPEN_ARCHIVE_DETECT_CORE),
|
||||
0, 0, 0);
|
||||
menu_list_push(info->list,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_LOAD_ARCHIVE),
|
||||
menu_hash_to_str(MENU_LABEL_LOAD_ARCHIVE_DETECT_CORE),
|
||||
0, 0, 0);
|
||||
need_push = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (need_sort)
|
||||
|
@ -82,6 +82,8 @@ enum
|
||||
DISPLAYLIST_OPTIONS_DISK,
|
||||
DISPLAYLIST_OPTIONS_SHADERS,
|
||||
DISPLAYLIST_ADD_CONTENT_LIST,
|
||||
DISPLAYLIST_ARCHIVE_ACTION,
|
||||
DISPLAYLIST_ARCHIVE_ACTION_DETECT_CORE,
|
||||
DISPLAYLIST_CORE_CONTENT
|
||||
};
|
||||
|
||||
|
@ -69,6 +69,9 @@ typedef struct
|
||||
bool defer_core;
|
||||
char deferred_path[PATH_MAX_LENGTH];
|
||||
|
||||
char scratch_buf[PATH_MAX_LENGTH];
|
||||
char scratch2_buf[PATH_MAX_LENGTH];
|
||||
|
||||
/* Menu display */
|
||||
menu_display_t display;
|
||||
|
||||
|
@ -22,6 +22,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MENU_LABEL_DEFERRED_ARCHIVE_ACTION_DETECT_CORE 0xdc9c0064U
|
||||
#define MENU_LABEL_DEFERRED_ARCHIVE_ACTION 0x7faf0284U
|
||||
#define MENU_LABEL_DEFERRED_ARCHIVE_OPEN_DETECT_CORE 0xd9452498U
|
||||
#define MENU_LABEL_DEFERRED_ARCHIVE_OPEN 0xfa0938b8U
|
||||
|
||||
#define MENU_LABEL_VALUE_INPUT_BACK_AS_MENU_TOGGLE_ENABLE 0x1cf1e6a8U
|
||||
#define MENU_LABEL_INPUT_BACK_AS_MENU_TOGGLE_ENABLE 0x60bacd04U
|
||||
|
||||
@ -70,8 +75,6 @@ extern "C" {
|
||||
#define MENU_VALUE_DIRECTORY_NONE 0x9996c10fU
|
||||
#define MENU_VALUE_DIRECTORY_DEFAULT 0xdcc3a2e4U
|
||||
#define MENU_VALUE_NOT_AVAILABLE 0x0b880503U
|
||||
#define MENU_VALUE_LOAD_ARCHIVE 0xe19ca6c7U
|
||||
#define MENU_VALUE_OPEN_ARCHIVE 0x96da22b9U
|
||||
#define MENU_VALUE_ASK_ARCHIVE 0x0b87d6a4U
|
||||
|
||||
#define MENU_LABEL_UPDATE_ASSETS 0x37fa42daU
|
||||
@ -988,6 +991,14 @@ extern "C" {
|
||||
#define MENU_LABEL_OVERLAY_AUTOLOAD_PREFERRED 0xc9298cbdU
|
||||
#define MENU_LABEL_VALUE_OVERLAY_AUTOLOAD_PREFERRED 0x0e27e33fU
|
||||
|
||||
#define MENU_LABEL_OPEN_ARCHIVE 0x78c0ca58U
|
||||
#define MENU_LABEL_OPEN_ARCHIVE_DETECT_CORE 0x92442638U
|
||||
#define MENU_LABEL_LOAD_ARCHIVE_DETECT_CORE 0x681f2f46U
|
||||
#define MENU_LABEL_LOAD_ARCHIVE 0xc3834e66U
|
||||
|
||||
#define MENU_LABEL_VALUE_OPEN_ARCHIVE 0x96da22b9U
|
||||
#define MENU_LABEL_VALUE_LOAD_ARCHIVE 0xe19ca6c7U
|
||||
|
||||
const char *menu_hash_to_str_de(uint32_t hash);
|
||||
int menu_hash_get_help_de(uint32_t hash, char *s, size_t len);
|
||||
|
||||
|
@ -973,9 +973,7 @@ unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
|
||||
| (1UL << RETRO_DEVICE_ID_JOYPAD_LEFT)
|
||||
| (1UL << RETRO_DEVICE_ID_JOYPAD_RIGHT)
|
||||
| (1UL << RETRO_DEVICE_ID_JOYPAD_L)
|
||||
| (1UL << RETRO_DEVICE_ID_JOYPAD_R)
|
||||
| (1UL << RETRO_DEVICE_ID_JOYPAD_A)
|
||||
| (1UL << RETRO_DEVICE_ID_JOYPAD_B);
|
||||
| (1UL << RETRO_DEVICE_ID_JOYPAD_R);
|
||||
menu_navigation_t *nav = menu_navigation_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_display_t *disp = menu_display_get_ptr();
|
||||
|
@ -1484,30 +1484,6 @@ static void setting_get_string_representation_uint_libretro_device(void *data,
|
||||
strlcpy(s, name, len);
|
||||
}
|
||||
|
||||
static void setting_get_string_representation_uint_archive_mode(void *data,
|
||||
char *s, size_t len)
|
||||
{
|
||||
const char *name = menu_hash_to_str(MENU_VALUE_UNKNOWN);
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
||||
switch (settings->archive.mode)
|
||||
{
|
||||
case 0:
|
||||
name = menu_hash_to_str(MENU_VALUE_ASK_ARCHIVE);
|
||||
break;
|
||||
case 1:
|
||||
name = menu_hash_to_str(MENU_VALUE_LOAD_ARCHIVE);
|
||||
break;
|
||||
case 2:
|
||||
name = menu_hash_to_str(MENU_VALUE_OPEN_ARCHIVE);
|
||||
break;
|
||||
}
|
||||
|
||||
strlcpy(s, name, len);
|
||||
}
|
||||
|
||||
static void setting_get_string_representation_uint_analog_dpad_mode(void *data,
|
||||
char *s, size_t len)
|
||||
{
|
||||
@ -5182,20 +5158,6 @@ static bool setting_append_list_menu_file_browser_options(
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
|
||||
CONFIG_UINT(
|
||||
settings->archive.mode,
|
||||
menu_hash_to_str(MENU_LABEL_ARCHIVE_MODE),
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_ARCHIVE_MODE),
|
||||
0,
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 2, 1, true, true);
|
||||
(*list)[list_info->index - 1].get_string_representation =
|
||||
&setting_get_string_representation_uint_archive_mode;
|
||||
|
||||
END_SUB_GROUP(list, list_info, parent_group);
|
||||
END_GROUP(list, list_info, parent_group);
|
||||
|
||||
|
@ -40,10 +40,6 @@
|
||||
# A directory for where to search for libretro core information.
|
||||
# libretro_info_path =
|
||||
|
||||
# Sets mode for archived files in file browser.
|
||||
# 0 = Ask, 1 = Load Archive, 2 = Open Archive
|
||||
# archive_mode = 0
|
||||
|
||||
# Sets log level for libretro cores (GET_LOG_INTERFACE).
|
||||
# If a log level issued by a libretro core is below libretro_log_level, it is ignored.
|
||||
# DEBUG logs are always ignored unless verbose mode is activated (--verbose).
|
||||
|
Loading…
x
Reference in New Issue
Block a user