mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-11 20:44:24 +00:00
Builtin image viewer should now work
This commit is contained in:
parent
8882f762c4
commit
57ae359e62
@ -1011,6 +1011,9 @@ bool event_command(enum event_command cmd)
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT_FFMPEG);
|
||||
break;
|
||||
#endif
|
||||
case EVENT_CMD_LOAD_CONTENT_IMAGEVIEWER:
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT_IMAGEVIEWER);
|
||||
break;
|
||||
case EVENT_CMD_LOAD_CONTENT:
|
||||
#ifdef HAVE_DYNAMIC
|
||||
event_command(EVENT_CMD_LOAD_CONTENT_PERSIST);
|
||||
|
@ -33,6 +33,7 @@ enum event_command
|
||||
#ifdef HAVE_FFMPEG
|
||||
EVENT_CMD_LOAD_CONTENT_FFMPEG,
|
||||
#endif
|
||||
EVENT_CMD_LOAD_CONTENT_IMAGEVIEWER,
|
||||
/* Loads core. */
|
||||
EVENT_CMD_LOAD_CORE_DEINIT,
|
||||
EVENT_CMD_LOAD_CORE,
|
||||
|
@ -449,8 +449,11 @@ static void config_set_defaults(void)
|
||||
settings->load_dummy_on_core_shutdown = load_dummy_on_core_shutdown;
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
settings->mediaplayer.builtin_enable = true;
|
||||
settings->multimedia.builtin_mediaplayer_enable = true;
|
||||
#else
|
||||
settings->multimedia.builtin_mediaplayer_enable = false;
|
||||
#endif
|
||||
settings->multimedia.builtin_imageviewer_enable = true;
|
||||
settings->video.scale = scale;
|
||||
settings->video.fullscreen = global->force_fullscreen ? true : fullscreen;
|
||||
settings->video.windowed_fullscreen = windowed_fullscreen;
|
||||
@ -1442,9 +1445,8 @@ static bool config_load_file(const char *path, bool set_defaults)
|
||||
CONFIG_GET_BOOL_BASE(conf, settings, ui.suspend_screensaver_enable, "suspend_screensaver_enable");
|
||||
CONFIG_GET_BOOL_BASE(conf, settings, fps_show, "fps_show");
|
||||
CONFIG_GET_BOOL_BASE(conf, settings, load_dummy_on_core_shutdown, "load_dummy_on_core_shutdown");
|
||||
#ifdef HAVE_FFMPEG
|
||||
CONFIG_GET_BOOL_BASE(conf, settings, mediaplayer.builtin_enable, "builtin_mediaplayer_enable");
|
||||
#endif
|
||||
CONFIG_GET_BOOL_BASE(conf, settings, multimedia.builtin_mediaplayer_enable, "builtin_mediaplayer_enable");
|
||||
CONFIG_GET_BOOL_BASE(conf, settings, multimedia.builtin_imageviewer_enable, "builtin_imageviewer_enable");
|
||||
|
||||
config_get_path(conf, "libretro_info_path", settings->libretro_info_path, sizeof(settings->libretro_info_path));
|
||||
|
||||
@ -2307,10 +2309,10 @@ bool config_save_file(const char *path)
|
||||
settings->input.input_descriptor_hide_unbound);
|
||||
config_set_bool(conf, "load_dummy_on_core_shutdown",
|
||||
settings->load_dummy_on_core_shutdown);
|
||||
#ifdef HAVE_FFMPEG
|
||||
config_set_bool(conf, "builtin_mediaplayer_enable",
|
||||
settings->mediaplayer.builtin_enable);
|
||||
#endif
|
||||
settings->multimedia.builtin_mediaplayer_enable);
|
||||
config_set_bool(conf, "builtin_imageviewer_enable",
|
||||
settings->multimedia.builtin_imageviewer_enable);
|
||||
config_set_bool(conf, "fps_show", settings->fps_show);
|
||||
config_set_bool(conf, "ui_menubar_enable", settings->ui.menubar_enable);
|
||||
config_set_path(conf, "libretro_path", settings->libretro);
|
||||
|
@ -266,12 +266,11 @@ typedef struct settings
|
||||
bool set_supports_no_game_enable;
|
||||
} core;
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
struct
|
||||
{
|
||||
bool builtin_enable;
|
||||
} mediaplayer;
|
||||
#endif
|
||||
bool builtin_mediaplayer_enable;
|
||||
bool builtin_imageviewer_enable;
|
||||
} multimedia;
|
||||
|
||||
int state_slot;
|
||||
|
||||
|
@ -444,15 +444,25 @@ static int deferred_push_detect_core_list(menu_displaylist_info_t *info)
|
||||
|
||||
(void)settings;
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
if (settings->mediaplayer.builtin_enable)
|
||||
if (settings->multimedia.builtin_mediaplayer_enable ||
|
||||
settings->multimedia.builtin_imageviewer_enable)
|
||||
{
|
||||
struct retro_system_info sysinfo = {0};
|
||||
libretro_ffmpeg_retro_get_system_info(&sysinfo);
|
||||
strlcat(info->exts, "|", sizeof(info->exts));
|
||||
strlcat(info->exts, sysinfo.valid_extensions, sizeof(info->exts));
|
||||
}
|
||||
#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));
|
||||
}
|
||||
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);
|
||||
}
|
||||
@ -478,15 +488,25 @@ static int deferred_push_default(menu_displaylist_info_t *info)
|
||||
|
||||
(void)settings;
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
if (settings->mediaplayer.builtin_enable)
|
||||
if (settings->multimedia.builtin_mediaplayer_enable ||
|
||||
settings->multimedia.builtin_imageviewer_enable)
|
||||
{
|
||||
struct retro_system_info sysinfo = {0};
|
||||
libretro_ffmpeg_retro_get_system_info(&sysinfo);
|
||||
strlcat(info->exts, "|", sizeof(info->exts));
|
||||
strlcat(info->exts, sysinfo.valid_extensions, sizeof(info->exts));
|
||||
}
|
||||
#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
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
return menu_displaylist_push_list(info, DISPLAYLIST_DEFAULT);
|
||||
}
|
||||
|
@ -633,6 +633,19 @@ static void menu_action_setting_disp_set_label_menu_file_image(
|
||||
path, "(IMG)", s2, len2);
|
||||
}
|
||||
|
||||
static void menu_action_setting_disp_set_label_menu_file_imageviewer(
|
||||
file_list_t* list,
|
||||
unsigned *w, unsigned type, unsigned i,
|
||||
const char *label,
|
||||
char *s, size_t len,
|
||||
const char *entry_label,
|
||||
const char *path,
|
||||
char *s2, size_t len2)
|
||||
{
|
||||
menu_action_setting_generic_disp_set_label(w, s, len,
|
||||
path, "(IMAGE)", s2, len2);
|
||||
}
|
||||
|
||||
static void menu_action_setting_disp_set_label_movie(
|
||||
file_list_t* list,
|
||||
unsigned *w, unsigned type, unsigned i,
|
||||
@ -1005,6 +1018,10 @@ static int menu_cbs_init_bind_get_string_representation_compare_type(
|
||||
cbs->action_get_value =
|
||||
menu_action_setting_disp_set_label_menu_file_image;
|
||||
break;
|
||||
case MENU_FILE_IMAGEVIEWER:
|
||||
cbs->action_get_value =
|
||||
menu_action_setting_disp_set_label_menu_file_imageviewer;
|
||||
break;
|
||||
case MENU_FILE_USE_DIRECTORY:
|
||||
cbs->action_get_value =
|
||||
menu_action_setting_disp_set_label_menu_file_use_directory;
|
||||
|
@ -455,6 +455,7 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs,
|
||||
case MENU_FILE_REMAP:
|
||||
case MENU_FILE_MOVIE:
|
||||
case MENU_FILE_MUSIC:
|
||||
case MENU_FILE_IMAGEVIEWER:
|
||||
case MENU_FILE_PLAYLIST_COLLECTION:
|
||||
case MENU_SETTING_GROUP:
|
||||
switch (menu_label_hash)
|
||||
|
@ -1127,6 +1127,27 @@ static int action_ok_file_load_ffmpeg(const char *path,
|
||||
}
|
||||
#endif
|
||||
|
||||
static int action_ok_file_load_imageviewer(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
const char *menu_path = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
|
||||
if (!menu_list)
|
||||
return -1;
|
||||
|
||||
menu_list_get_last(menu_list->menu_stack,
|
||||
&menu_path, NULL, NULL, NULL);
|
||||
|
||||
fill_pathname_join(global->fullpath, menu_path, path,
|
||||
sizeof(global->fullpath));
|
||||
|
||||
menu_common_load_content(true, CORE_TYPE_IMAGEVIEWER);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_ok_file_load(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -1917,6 +1938,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
|
||||
cbs->action_ok = action_ok_file_load_ffmpeg;
|
||||
#endif
|
||||
break;
|
||||
case MENU_FILE_IMAGEVIEWER:
|
||||
cbs->action_ok = action_ok_file_load_imageviewer;
|
||||
break;
|
||||
case MENU_SETTINGS:
|
||||
case MENU_SETTING_GROUP:
|
||||
case MENU_SETTING_SUBGROUP:
|
||||
|
@ -386,6 +386,7 @@ static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs,
|
||||
case MENU_FILE_REMAP:
|
||||
case MENU_FILE_MOVIE:
|
||||
case MENU_FILE_MUSIC:
|
||||
case MENU_FILE_IMAGEVIEWER:
|
||||
case MENU_FILE_PLAYLIST_COLLECTION:
|
||||
case MENU_SETTING_GROUP:
|
||||
switch (menu_label_hash)
|
||||
|
@ -574,6 +574,8 @@ static const char *menu_hash_to_str_us_label(uint32_t hash)
|
||||
return "update_glsl_shaders";
|
||||
case MENU_LABEL_SCREEN_RESOLUTION:
|
||||
return "screen_resolution";
|
||||
case MENU_LABEL_USE_BUILTIN_IMAGE_VIEWER:
|
||||
return "use_builtin_image_viewer";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1404,6 +1406,8 @@ const char *menu_hash_to_str_us(uint32_t hash)
|
||||
return "Frame Throttle Settings";
|
||||
case MENU_VALUE_SEARCH:
|
||||
return "Search:";
|
||||
case MENU_LABEL_VALUE_USE_BUILTIN_IMAGE_VIEWER:
|
||||
return "Use Builtin Image Viewer";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ void menu_common_load_content(bool persist, enum rarch_core_type type)
|
||||
break;
|
||||
#endif
|
||||
case CORE_TYPE_IMAGEVIEWER:
|
||||
/* TODO/FIXME */
|
||||
event_command(EVENT_CMD_LOAD_CONTENT_IMAGEVIEWER);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,7 @@ typedef enum
|
||||
MENU_FILE_CARCHIVE,
|
||||
MENU_FILE_IN_CARCHIVE,
|
||||
MENU_FILE_IMAGE,
|
||||
MENU_FILE_IMAGEVIEWER,
|
||||
MENU_FILE_REMAP,
|
||||
MENU_FILE_DOWNLOAD_CORE,
|
||||
MENU_FILE_DOWNLOAD_CORE_INFO,
|
||||
|
@ -1980,24 +1980,30 @@ static int menu_displaylist_parse_generic(menu_displaylist_info_t *info, bool *n
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
if (settings->mediaplayer.builtin_enable)
|
||||
if (settings->multimedia.builtin_mediaplayer_enable ||
|
||||
settings->multimedia.builtin_imageviewer_enable)
|
||||
{
|
||||
switch (rarch_path_is_media_type(path))
|
||||
{
|
||||
case RARCH_CONTENT_MOVIE:
|
||||
file_type = MENU_FILE_MOVIE;
|
||||
#ifdef HAVE_FFMPEG
|
||||
if (settings->multimedia.builtin_mediaplayer_enable)
|
||||
file_type = MENU_FILE_MOVIE;
|
||||
#endif
|
||||
break;
|
||||
case RARCH_CONTENT_MUSIC:
|
||||
file_type = MENU_FILE_MUSIC;
|
||||
#ifdef HAVE_FFMPEG
|
||||
if (settings->multimedia.builtin_mediaplayer_enable)
|
||||
file_type = MENU_FILE_MUSIC;
|
||||
#endif
|
||||
break;
|
||||
case RARCH_CONTENT_IMAGE:
|
||||
file_type = MENU_FILE_IMAGE;
|
||||
if (settings->multimedia.builtin_imageviewer_enable)
|
||||
file_type = MENU_FILE_IMAGEVIEWER;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
menu_list_push(info->list, path, label,
|
||||
file_type, 0, 0);
|
||||
|
@ -944,6 +944,9 @@ extern "C" {
|
||||
|
||||
#define MENU_LABEL_VALUE_INPUT_USER_BINDS 0x75fda711U
|
||||
|
||||
#define MENU_LABEL_USE_BUILTIN_IMAGE_VIEWER 0x5203b5bbU
|
||||
#define MENU_LABEL_VALUE_USE_BUILTIN_IMAGE_VIEWER 0x1ab45d3eU
|
||||
|
||||
const char *menu_hash_to_str_de(uint32_t hash);
|
||||
int menu_hash_get_help_de(uint32_t hash, char *s, size_t len);
|
||||
|
||||
|
@ -4862,7 +4862,7 @@ static bool setting_append_list_multimedia_options(
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
CONFIG_BOOL(
|
||||
settings->mediaplayer.builtin_enable,
|
||||
settings->multimedia.builtin_mediaplayer_enable,
|
||||
menu_hash_to_str(MENU_LABEL_USE_BUILTIN_PLAYER),
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_USE_BUILTIN_PLAYER),
|
||||
true,
|
||||
@ -4875,6 +4875,19 @@ static bool setting_append_list_multimedia_options(
|
||||
general_read_handler);
|
||||
#endif
|
||||
|
||||
CONFIG_BOOL(
|
||||
settings->multimedia.builtin_imageviewer_enable,
|
||||
menu_hash_to_str(MENU_LABEL_USE_BUILTIN_IMAGE_VIEWER),
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_USE_BUILTIN_IMAGE_VIEWER),
|
||||
true,
|
||||
menu_hash_to_str(MENU_VALUE_OFF),
|
||||
menu_hash_to_str(MENU_VALUE_ON),
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
|
||||
END_SUB_GROUP(list, list_info, parent_group);
|
||||
END_GROUP(list, list_info, parent_group);
|
||||
|
||||
|
30
retroarch.c
30
retroarch.c
@ -1204,29 +1204,36 @@ int rarch_main_init(int argc, char *argv[])
|
||||
validate_cpu_features();
|
||||
config_load();
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (settings && settings->mediaplayer.builtin_enable)
|
||||
if (settings && (settings->multimedia.builtin_mediaplayer_enable ||
|
||||
settings->multimedia.builtin_imageviewer_enable))
|
||||
{
|
||||
switch (rarch_path_is_media_type(global->fullpath))
|
||||
{
|
||||
case RARCH_CONTENT_MOVIE:
|
||||
case RARCH_CONTENT_MUSIC:
|
||||
global->has_set_libretro = false;
|
||||
global->core_type = CORE_TYPE_FFMPEG;
|
||||
if (settings->multimedia.builtin_mediaplayer_enable)
|
||||
{
|
||||
#ifdef HAVE_FFMPEG
|
||||
global->has_set_libretro = false;
|
||||
global->core_type = CORE_TYPE_FFMPEG;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case RARCH_CONTENT_IMAGE:
|
||||
global->has_set_libretro = false;
|
||||
global->core_type = CORE_TYPE_IMAGEVIEWER;
|
||||
if (settings->multimedia.builtin_imageviewer_enable)
|
||||
{
|
||||
global->has_set_libretro = false;
|
||||
global->core_type = CORE_TYPE_IMAGEVIEWER;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
init_libretro_sym(global->core_type);
|
||||
rarch_system_info_init();
|
||||
@ -1397,6 +1404,15 @@ void rarch_main_set_state(unsigned cmd)
|
||||
driver->frontend_ctx->content_loaded();
|
||||
break;
|
||||
#endif
|
||||
case RARCH_ACTION_STATE_LOAD_CONTENT_IMAGEVIEWER:
|
||||
#ifdef HAVE_MENU
|
||||
/* If content loading fails, we go back to menu. */
|
||||
if (!menu_load_content(CORE_TYPE_IMAGEVIEWER))
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING);
|
||||
#endif
|
||||
if (driver->frontend_ctx && driver->frontend_ctx->content_loaded)
|
||||
driver->frontend_ctx->content_loaded();
|
||||
break;
|
||||
case RARCH_ACTION_STATE_MENU_RUNNING_FINISHED:
|
||||
#ifdef HAVE_MENU
|
||||
menu_setting_apply_deferred();
|
||||
|
@ -34,6 +34,7 @@ enum action_state
|
||||
#ifdef HAVE_FFMPEG
|
||||
RARCH_ACTION_STATE_LOAD_CONTENT_FFMPEG,
|
||||
#endif
|
||||
RARCH_ACTION_STATE_LOAD_CONTENT_IMAGEVIEWER,
|
||||
RARCH_ACTION_STATE_MENU_RUNNING,
|
||||
RARCH_ACTION_STATE_MENU_RUNNING_FINISHED,
|
||||
RARCH_ACTION_STATE_QUIT,
|
||||
|
Loading…
Reference in New Issue
Block a user