(menu_cbs_deferred_push.c) Cut down on some more code duplication
This commit is contained in:
parent
554a3ccd68
commit
e39f28f989
|
@ -318,9 +318,11 @@ enum
|
||||||
{
|
{
|
||||||
PUSH_ARCHIVE_OPEN_DETECT_CORE = 0,
|
PUSH_ARCHIVE_OPEN_DETECT_CORE = 0,
|
||||||
PUSH_ARCHIVE_OPEN,
|
PUSH_ARCHIVE_OPEN,
|
||||||
PUSH_DEFAULT
|
PUSH_DEFAULT,
|
||||||
|
PUSH_DETECT_CORE_LIST,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int general_push(menu_displaylist_info_t *info, unsigned id, unsigned type)
|
static int general_push(menu_displaylist_info_t *info, unsigned id, unsigned type)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
@ -328,20 +330,25 @@ static int general_push(menu_displaylist_info_t *info, unsigned id, unsigned typ
|
||||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
|
|
||||||
if (id != PUSH_DEFAULT)
|
switch (id)
|
||||||
{
|
{
|
||||||
fill_pathname_join(info->path, menu->scratch2_buf,
|
case PUSH_DEFAULT:
|
||||||
menu->scratch_buf, sizeof(info->path));
|
case PUSH_DETECT_CORE_LIST:
|
||||||
fill_pathname_join(info->label, menu->scratch2_buf,
|
break;
|
||||||
menu->scratch_buf, sizeof(info->label));
|
default:
|
||||||
|
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));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->type_default = MENU_FILE_PLAIN;
|
info->type_default = MENU_FILE_PLAIN;
|
||||||
info->setting = menu_setting_find(info->label);
|
|
||||||
|
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
case PUSH_ARCHIVE_OPEN_DETECT_CORE:
|
case PUSH_ARCHIVE_OPEN_DETECT_CORE:
|
||||||
|
info->setting = menu_setting_find(info->label);
|
||||||
if (global->core_info.list)
|
if (global->core_info.list)
|
||||||
strlcpy(info->exts, core_info_list_get_all_extensions(
|
strlcpy(info->exts, core_info_list_get_all_extensions(
|
||||||
global->core_info.list), sizeof(info->exts));
|
global->core_info.list), sizeof(info->exts));
|
||||||
|
@ -355,6 +362,7 @@ static int general_push(menu_displaylist_info_t *info, unsigned id, unsigned typ
|
||||||
strlcpy(info->exts, system->valid_extensions, sizeof(info->exts));
|
strlcpy(info->exts, system->valid_extensions, sizeof(info->exts));
|
||||||
break;
|
break;
|
||||||
case PUSH_ARCHIVE_OPEN:
|
case PUSH_ARCHIVE_OPEN:
|
||||||
|
info->setting = menu_setting_find(info->label);
|
||||||
if (global->menu.info.valid_extensions)
|
if (global->menu.info.valid_extensions)
|
||||||
{
|
{
|
||||||
if (*global->menu.info.valid_extensions)
|
if (*global->menu.info.valid_extensions)
|
||||||
|
@ -365,6 +373,7 @@ static int general_push(menu_displaylist_info_t *info, unsigned id, unsigned typ
|
||||||
strlcpy(info->exts, system->valid_extensions, sizeof(info->exts));
|
strlcpy(info->exts, system->valid_extensions, sizeof(info->exts));
|
||||||
break;
|
break;
|
||||||
case PUSH_DEFAULT:
|
case PUSH_DEFAULT:
|
||||||
|
info->setting = menu_setting_find(info->label);
|
||||||
if (info->setting && info->setting->browser_selection_type == ST_DIR) {}
|
if (info->setting && info->setting->browser_selection_type == ST_DIR) {}
|
||||||
else if (global->menu.info.valid_extensions)
|
else if (global->menu.info.valid_extensions)
|
||||||
{
|
{
|
||||||
|
@ -375,6 +384,11 @@ static int general_push(menu_displaylist_info_t *info, unsigned id, unsigned typ
|
||||||
else
|
else
|
||||||
strlcpy(info->exts, system->valid_extensions, sizeof(info->exts));
|
strlcpy(info->exts, system->valid_extensions, sizeof(info->exts));
|
||||||
break;
|
break;
|
||||||
|
case PUSH_DETECT_CORE_LIST:
|
||||||
|
if (global->core_info.list)
|
||||||
|
strlcpy(info->exts, core_info_list_get_all_extensions(
|
||||||
|
global->core_info.list), sizeof(info->exts));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)settings;
|
(void)settings;
|
||||||
|
@ -406,6 +420,11 @@ static int general_push(menu_displaylist_info_t *info, unsigned id, unsigned typ
|
||||||
return menu_displaylist_push_list(info, type);
|
return menu_displaylist_push_list(info, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int deferred_push_detect_core_list(menu_displaylist_info_t *info)
|
||||||
|
{
|
||||||
|
return general_push(info, PUSH_DETECT_CORE_LIST, DISPLAYLIST_CORES_DETECTED);
|
||||||
|
}
|
||||||
|
|
||||||
static int deferred_archive_open_detect_core(menu_displaylist_info_t *info)
|
static int deferred_archive_open_detect_core(menu_displaylist_info_t *info)
|
||||||
{
|
{
|
||||||
return general_push(info, PUSH_ARCHIVE_OPEN_DETECT_CORE, DISPLAYLIST_DEFAULT);
|
return general_push(info, PUSH_ARCHIVE_OPEN_DETECT_CORE, DISPLAYLIST_DEFAULT);
|
||||||
|
@ -577,44 +596,6 @@ static int deferred_push_content_history_path(menu_displaylist_info_t *info)
|
||||||
return menu_displaylist_push_list(info, DISPLAYLIST_CONTENT_HISTORY);
|
return menu_displaylist_push_list(info, DISPLAYLIST_CONTENT_HISTORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int deferred_push_detect_core_list(menu_displaylist_info_t *info)
|
|
||||||
{
|
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
global_t *global = global_get_ptr();
|
|
||||||
|
|
||||||
info->type_default = MENU_FILE_PLAIN;
|
|
||||||
if (global->core_info.list)
|
|
||||||
strlcpy(info->exts, core_info_list_get_all_extensions(
|
|
||||||
global->core_info.list), 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_CORES_DETECTED);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int menu_cbs_init_bind_deferred_push_compare_label(menu_file_list_cbs_t *cbs,
|
static int menu_cbs_init_bind_deferred_push_compare_label(menu_file_list_cbs_t *cbs,
|
||||||
|
|
Loading…
Reference in New Issue