mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
Merge pull request #8529 from huwpascoe/mame_overlay
video_layout (mame artwork)
This commit is contained in:
commit
fbec6b84e8
@ -835,6 +835,17 @@ ifeq ($(HAVE_OVERLAY), 1)
|
||||
led/drivers/led_overlay.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_VIDEO_LAYOUT), 1)
|
||||
DEFINES += -DHAVE_VIDEO_LAYOUT
|
||||
OBJ += gfx/video_layout.o \
|
||||
gfx/video_layout/view.o \
|
||||
gfx/video_layout/element.o \
|
||||
gfx/video_layout/component.o \
|
||||
gfx/video_layout/internal.o \
|
||||
gfx/video_layout/scope.o \
|
||||
gfx/video_layout/load.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_STB_FONT), 1)
|
||||
OBJ += gfx/drivers_font_renderer/stb.o
|
||||
OBJ += gfx/drivers_font_renderer/stb_unicode.o
|
||||
|
@ -10,6 +10,7 @@ DEFINES := -DRARCH_INTERNAL -DHAVE_MAIN -s USE_PTHREADS=$(PTHREAD)
|
||||
DEFINES += -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_GLSL -DHAVE_FILTERS_BUILTIN -DHAVE_STB_FONT
|
||||
|
||||
HAVE_OVERLAY = 1
|
||||
HAVE_VIDEO_LAYOUT = 1
|
||||
HAVE_CC_RESAMPLER = 1
|
||||
HAVE_EGL = 1
|
||||
HAVE_OPENGLES = 1
|
||||
|
@ -189,6 +189,7 @@ else ifeq ($(libogc_platform), 1)
|
||||
HAVE_RTGA := 1
|
||||
HAVE_IBXM := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_VIDEO_LAYOUT := 1
|
||||
HAVE_ZLIB := 1
|
||||
WANT_ZLIB := 1
|
||||
HAVE_7ZIP := 1
|
||||
@ -306,6 +307,7 @@ else ifeq ($(platform), vita)
|
||||
HAVE_VITA2D := 1
|
||||
HAVE_NETWORKING := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_VIDEO_LAYOUT := 1
|
||||
HAVE_MATERIALUI := 1
|
||||
HAVE_XMB := 1
|
||||
HAVE_STB_FONT := 1
|
||||
@ -324,6 +326,7 @@ else ifeq ($(platform), windows_msvc6_x86)
|
||||
HAVE_NETWORK_CMD := 1
|
||||
HAVE_NETPLAYDISCOVERY := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_VIDEO_LAYOUT := 1
|
||||
HAVE_MATERIALUI := 1
|
||||
HAVE_XMB := 1
|
||||
HAVE_STB_FONT := 1
|
||||
@ -366,6 +369,7 @@ else ifeq ($(platform), windows_msvc2003_x86)
|
||||
HAVE_NETWORK_CMD := 1
|
||||
HAVE_NETPLAYDISCOVERY := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_VIDEO_LAYOUT := 1
|
||||
HAVE_MATERIALUI := 1
|
||||
HAVE_XMB := 1
|
||||
HAVE_STB_FONT := 1
|
||||
@ -413,6 +417,7 @@ else ifeq ($(platform), windows_msvc2005_x86)
|
||||
HAVE_NETWORK_CMD := 1
|
||||
HAVE_NETPLAYDISCOVERY := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_VIDEO_LAYOUT := 1
|
||||
HAVE_MATERIALUI := 1
|
||||
HAVE_XMB := 1
|
||||
HAVE_STB_FONT := 1
|
||||
@ -461,6 +466,7 @@ else ifneq (,$(findstring windows_msvc2010,$(platform)))
|
||||
HAVE_NETWORK_CMD := 1
|
||||
HAVE_NETPLAYDISCOVERY := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_VIDEO_LAYOUT := 1
|
||||
HAVE_MATERIALUI := 1
|
||||
HAVE_XMB := 1
|
||||
HAVE_STB_FONT := 1
|
||||
@ -532,6 +538,7 @@ else ifneq (,$(findstring windows_msvc2012,$(platform)))
|
||||
HAVE_NETWORK_CMD := 1
|
||||
HAVE_NETPLAYDISCOVERY := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_VIDEO_LAYOUT := 1
|
||||
HAVE_MATERIALUI := 1
|
||||
HAVE_XMB := 1
|
||||
HAVE_STB_FONT := 1
|
||||
@ -607,6 +614,7 @@ else ifneq (,$(findstring windows_msvc2013,$(platform)))
|
||||
HAVE_NETWORK_CMD := 1
|
||||
HAVE_NETPLAYDISCOVERY := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_VIDEO_LAYOUT := 1
|
||||
HAVE_MATERIALUI := 1
|
||||
HAVE_XMB := 1
|
||||
HAVE_STB_FONT := 1
|
||||
@ -682,6 +690,7 @@ else ifneq (,$(findstring windows_msvc2015,$(platform)))
|
||||
HAVE_NETWORK_CMD := 1
|
||||
HAVE_NETPLAYDISCOVERY := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_VIDEO_LAYOUT := 1
|
||||
HAVE_MATERIALUI := 1
|
||||
HAVE_XMB := 1
|
||||
HAVE_STB_FONT := 1
|
||||
@ -862,6 +871,10 @@ ifeq ($(HAVE_OVERLAY), 1)
|
||||
CFLAGS += -DHAVE_OVERLAY
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_VIDEO_LAYOUT), 1)
|
||||
CFLAGS += -DHAVE_VIDEO_LAYOUT
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_NETWORKING), 1)
|
||||
CFLAGS += -DHAVE_NETWORKING
|
||||
endif
|
||||
|
@ -59,6 +59,7 @@ ifeq ($(HAVE_OPENGL), 1)
|
||||
HAVE_XMB = 1
|
||||
HAVE_OZONE = 1
|
||||
HAVE_OVERLAY = 1
|
||||
HAVE_VIDEO_LAYOUT = 1
|
||||
else
|
||||
HAVE_RGUI = 1
|
||||
HAVE_MATERIALUI = 0
|
||||
|
@ -54,6 +54,7 @@ HAVE_7ZIP := 1
|
||||
HAVE_NETWORKING := 1
|
||||
HAVE_NETWORK_CMD := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_VIDEO_LAYOUT := 1
|
||||
HAVE_LANGEXTRA := 1
|
||||
HAVE_CHEEVOS := 1
|
||||
HAVE_SHADERPIPELINE := 1
|
||||
|
@ -15,7 +15,7 @@ LDFLAGS = -L$(PNDSDK)/usr/lib -Wl,-rpath,$(PNDSDK)/usr/lib
|
||||
|
||||
LIBS = -lGLESv2 -lEGL -ldl -lm -lpthread -lrt -lasound
|
||||
DEFINES = -std=gnu99 -DHAVE_THREADS -DHAVE_GETOPT_LONG=1 -DHAVE_GRIFFIN -DRARCH_INTERNAL
|
||||
DEFINES += -D__ARM_ARCH_6__ -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_GLSL -DHAVE_DYNAMIC -DHAVE_RPNG -DHAVE_RJPEG -DWANT_ZLIB -DHAVE_OVERLAY -DHAVE_ALSA -DHAVE_ZLIB -D__linux__
|
||||
DEFINES += -D__ARM_ARCH_6__ -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_GLSL -DHAVE_DYNAMIC -DHAVE_RPNG -DHAVE_RJPEG -DWANT_ZLIB -DHAVE_OVERLAY -DHAVE_VIDEO_LAYOUT -DHAVE_ALSA -DHAVE_ZLIB -D__linux__
|
||||
DEFINES += $(INCDIRS)
|
||||
DEFINES += -D__OPENPANDORA__ -DPANDORA
|
||||
DEFINES += -marm -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize
|
||||
|
@ -31,6 +31,7 @@ else
|
||||
HAVE_RTGA := 1
|
||||
HAVE_ZLIB := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_VIDEO_LAYOUT := 1
|
||||
HAVE_7ZIP := 1
|
||||
HAVE_EGL := 1
|
||||
HAVE_MENU_WIDGETS := 1
|
||||
|
@ -69,7 +69,7 @@ endif
|
||||
|
||||
PPU_SRCS = griffin/griffin.c
|
||||
|
||||
DEFINES += -DHAVE_MENU -DHAVE_MENU_WIDGETS -DHAVE_RGUI -DHAVE_XMB -DHAVE_LIBRETRODB -DHAVE_MATERIALUI -DHAVE_SHADERPIPELINE -DRARCH_INTERNAL -DMSB_FIRST -DHAVE_OVERLAY -DHAVE_CC_RESAMPLER -DHAVE_STB_VORBIS -DHAVE_STB_FONT -DHAVE_RUNAHEAD -DHAVE_DR_MP3 -DHAVE_DR_FLAC
|
||||
DEFINES += -DHAVE_MENU -DHAVE_MENU_WIDGETS -DHAVE_RGUI -DHAVE_XMB -DHAVE_LIBRETRODB -DHAVE_MATERIALUI -DHAVE_SHADERPIPELINE -DRARCH_INTERNAL -DMSB_FIRST -DHAVE_OVERLAY -DHAVE_VIDEO_LAYOUT -DHAVE_VIDEO_LAYOUT -DHAVE_CC_RESAMPLER -DHAVE_STB_VORBIS -DHAVE_STB_FONT -DHAVE_RUNAHEAD -DHAVE_DR_MP3 -DHAVE_DR_FLAC
|
||||
|
||||
ifeq ($(DEX_BUILD), 1)
|
||||
DEFINES += -DDEX_BUILD
|
||||
|
@ -110,7 +110,7 @@ PPU_LDLIBS = $(FONT_LIBS) $(GL_LIBS) $(WHOLE_START) -lretro_ps3 $(WHOLE_END) -l
|
||||
|
||||
PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe
|
||||
|
||||
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -D__CELLOS_LV2__ -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=0 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_STB_VORBIS
|
||||
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_VIDEO_LAYOUT -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -D__CELLOS_LV2__ -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=0 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_STB_VORBIS
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
PPU_OPTIMIZE_LV := -O0 -g
|
||||
|
@ -89,7 +89,7 @@ ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
endif
|
||||
|
||||
SHARED_FLAGS := -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts -DHAVE_CC_RESAMPLER
|
||||
SHARED_FLAGS := -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_VIDEO_LAYOUT -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts -DHAVE_CC_RESAMPLER
|
||||
CFLAGS += -std=gnu99 $(SHARED_FLAGS)
|
||||
CXXFLAGS += $(SHARED_FLAGS)
|
||||
|
||||
|
@ -38,6 +38,7 @@ else
|
||||
HAVE_MENU := 1
|
||||
HAVE_MENU_COMMON := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_VIDEO_LAYOUT := 1
|
||||
HAVE_MATERIALUI := 1
|
||||
HAVE_XMB := 1
|
||||
HAVE_RGUI := 1
|
||||
|
@ -133,6 +133,7 @@ endif
|
||||
HAVE_CHEEVOS = 1
|
||||
# WANT_IFADDRS = 1
|
||||
HAVE_OVERLAY = 1
|
||||
HAVE_VIDEO_LAYOUT = 1
|
||||
HAVE_STATIC_VIDEO_FILTERS = 1
|
||||
HAVE_STATIC_AUDIO_FILTERS = 1
|
||||
WANT_LIBFAT = 1
|
||||
|
@ -80,7 +80,7 @@ OBJDIR := obj-w32
|
||||
OS := Win32
|
||||
OBJ :=
|
||||
LIBS := -lm
|
||||
DEFINES := -I. -Ilibretro-common/include -DRARCH_INTERNAL -DHAVE_OVERLAY
|
||||
DEFINES := -I. -Ilibretro-common/include -DRARCH_INTERNAL -DHAVE_OVERLAY -DHAVE_VIDEO_LAYOUT
|
||||
LDFLAGS := -L. -static-libgcc
|
||||
|
||||
include Makefile.common
|
||||
|
@ -1250,6 +1250,12 @@ static struct config_path_setting *populate_settings_path(settings_t *settings,
|
||||
#ifdef HAVE_OVERLAY
|
||||
SETTING_PATH("input_overlay",
|
||||
settings->paths.path_overlay, false, NULL, true);
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
SETTING_PATH("video_layout_path",
|
||||
settings->paths.path_video_layout, false, NULL, true);
|
||||
SETTING_PATH("video_layout_directory",
|
||||
settings->paths.directory_video_layout, true, NULL, true);
|
||||
#endif
|
||||
SETTING_PATH("video_record_config",
|
||||
settings->paths.path_record_config, false, NULL, true);
|
||||
@ -1307,6 +1313,10 @@ static struct config_path_setting *populate_settings_path(settings_t *settings,
|
||||
SETTING_PATH("overlay_directory",
|
||||
settings->paths.directory_overlay, true, NULL, true);
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
SETTING_PATH("video_layout_directory",
|
||||
settings->paths.directory_video_layout, true, NULL, true);
|
||||
#endif
|
||||
#ifndef HAVE_DYNAMIC
|
||||
SETTING_PATH("libretro_path",
|
||||
path_get_ptr(RARCH_PATH_CORE), false, NULL, false);
|
||||
@ -1503,6 +1513,9 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("menu_show_latency", &settings->bools.menu_show_latency, true, true, false);
|
||||
SETTING_BOOL("menu_show_rewind", &settings->bools.menu_show_rewind, true, true, false);
|
||||
SETTING_BOOL("menu_show_overlays", &settings->bools.menu_show_overlays, true, true, false);
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
SETTING_BOOL("menu_show_video_layout", &settings->bools.menu_show_video_layout, true, true, false);
|
||||
#endif
|
||||
SETTING_BOOL("menu_show_help", &settings->bools.menu_show_help, true, menu_show_help, false);
|
||||
SETTING_BOOL("menu_show_quit_retroarch", &settings->bools.menu_show_quit_retroarch, true, menu_show_quit_retroarch, false);
|
||||
SETTING_BOOL("menu_show_reboot", &settings->bools.menu_show_reboot, true, menu_show_reboot, false);
|
||||
@ -1552,6 +1565,9 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("input_overlay_show_physical_inputs", &settings->bools.input_overlay_show_physical_inputs, true, false, false);
|
||||
SETTING_BOOL("input_overlay_hide_in_menu", &settings->bools.input_overlay_hide_in_menu, true, overlay_hide_in_menu, false);
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
SETTING_BOOL("video_layout_enable", &settings->bools.video_layout_enable, true, true, false);
|
||||
#endif
|
||||
#ifdef HAVE_COMMAND
|
||||
SETTING_BOOL("network_cmd_enable", &settings->bools.network_cmd_enable, true, network_cmd_enable, false);
|
||||
SETTING_BOOL("stdin_cmd_enable", &settings->bools.stdin_cmd_enable, true, stdin_cmd_enable, false);
|
||||
@ -1701,6 +1717,9 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
|
||||
SETTING_UINT("video_fullscreen_x", &settings->uints.video_fullscreen_x, true, fullscreen_x, false);
|
||||
SETTING_UINT("video_fullscreen_y", &settings->uints.video_fullscreen_y, true, fullscreen_y, false);
|
||||
SETTING_UINT("video_window_opacity", &settings->uints.video_window_opacity, true, window_opacity, false);
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
SETTING_UINT("video_layout_selected_view", &settings->uints.video_layout_selected_view, true, 0, false);
|
||||
#endif
|
||||
#ifdef HAVE_COMMAND
|
||||
SETTING_UINT("network_cmd_port", &settings->uints.network_cmd_port, true, network_cmd_port, false);
|
||||
#endif
|
||||
@ -2150,6 +2169,9 @@ void config_set_defaults(void)
|
||||
*settings->paths.path_rgui_theme_preset = '\0';
|
||||
*settings->paths.path_content_database = '\0';
|
||||
*settings->paths.path_overlay = '\0';
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
*settings->paths.path_video_layout = '\0';
|
||||
#endif
|
||||
*settings->paths.path_record_config = '\0';
|
||||
*settings->paths.path_stream_config = '\0';
|
||||
*settings->paths.path_stream_url = '\0';
|
||||
@ -2246,6 +2268,14 @@ void config_set_defaults(void)
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]))
|
||||
{
|
||||
fill_pathname_expand_special(settings->paths.directory_video_layout,
|
||||
g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT],
|
||||
sizeof(settings->paths.directory_video_layout));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]))
|
||||
@ -3005,6 +3035,10 @@ static bool config_load_file(const char *path, settings_t *settings)
|
||||
#ifdef HAVE_OVERLAY
|
||||
if (string_is_equal(settings->paths.directory_overlay, "default"))
|
||||
*settings->paths.directory_overlay = '\0';
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
if (string_is_equal(settings->paths.directory_video_layout, "default"))
|
||||
*settings->paths.directory_video_layout = '\0';
|
||||
#endif
|
||||
if (string_is_equal(settings->paths.directory_system, "default"))
|
||||
*settings->paths.directory_system = '\0';
|
||||
|
@ -106,6 +106,9 @@ typedef struct settings
|
||||
bool video_memory_show;
|
||||
bool video_msg_bgcolor_enable;
|
||||
bool video_3ds_lcd_bottom;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
bool video_layout_enable;
|
||||
#endif
|
||||
|
||||
/* Audio */
|
||||
bool audio_enable;
|
||||
@ -168,6 +171,9 @@ typedef struct settings
|
||||
bool menu_show_latency;
|
||||
bool menu_show_rewind;
|
||||
bool menu_show_overlays;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
bool menu_show_video_layout;
|
||||
#endif
|
||||
bool menu_materialui_icons_enable;
|
||||
bool menu_rgui_background_filler_thickness_enable;
|
||||
bool menu_rgui_border_filler_thickness_enable;
|
||||
@ -437,6 +443,9 @@ typedef struct settings
|
||||
unsigned video_record_scale_factor;
|
||||
unsigned video_stream_scale_factor;
|
||||
unsigned video_3ds_display_mode;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
unsigned video_layout_selected_view;
|
||||
#endif
|
||||
|
||||
unsigned menu_timedate_style;
|
||||
unsigned menu_thumbnails;
|
||||
@ -568,6 +577,9 @@ typedef struct settings
|
||||
char path_cheat_database[PATH_MAX_LENGTH];
|
||||
char path_content_database[PATH_MAX_LENGTH];
|
||||
char path_overlay[PATH_MAX_LENGTH];
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
char path_video_layout[PATH_MAX_LENGTH];
|
||||
#endif
|
||||
char path_record_config[PATH_MAX_LENGTH];
|
||||
char path_stream_config[PATH_MAX_LENGTH];
|
||||
char path_stream_url[8192];
|
||||
@ -596,6 +608,9 @@ typedef struct settings
|
||||
char directory_cursor[PATH_MAX_LENGTH];
|
||||
char directory_input_remapping[PATH_MAX_LENGTH];
|
||||
char directory_overlay[PATH_MAX_LENGTH];
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
char directory_video_layout[PATH_MAX_LENGTH];
|
||||
#endif
|
||||
char directory_resampler[PATH_MAX_LENGTH];
|
||||
char directory_screenshot[PATH_MAX_LENGTH];
|
||||
char directory_system[PATH_MAX_LENGTH];
|
||||
|
@ -38,6 +38,9 @@ enum default_dirs
|
||||
DEFAULT_DIR_CORE,
|
||||
DEFAULT_DIR_CORE_INFO,
|
||||
DEFAULT_DIR_OVERLAY,
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
DEFAULT_DIR_VIDEO_LAYOUT,
|
||||
#endif
|
||||
DEFAULT_DIR_PORT,
|
||||
DEFAULT_DIR_SHADER,
|
||||
DEFAULT_DIR_SAVESTATE,
|
||||
|
@ -387,6 +387,9 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
|
||||
#endif
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], home_dir_buf, "info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], home_dir_buf, "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT], home_dir_buf, "layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
|
||||
#endif
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG], home_dir_buf, "autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], home_dir_buf, "downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], home_dir_buf, "assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
|
||||
@ -426,6 +429,9 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], bundle_path_buf, "Contents/Resources/cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], bundle_path_buf, "Contents/Resources/info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], bundle_path_buf, "Contents/Resources/overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT], bundle_path_buf, "Contents/Resources/layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
|
||||
#endif
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG], bundle_path_buf, "Contents/Resources/autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], bundle_path_buf, "Contents/Resources/assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], bundle_path_buf, "Contents/Resources/database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
|
||||
|
@ -172,6 +172,10 @@ static void frontend_emscripten_get_env(int *argc, char *argv[],
|
||||
"bundle/info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], base_path,
|
||||
"bundle/overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT], base_path,
|
||||
"bundle/layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
|
||||
#endif
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER], base_path,
|
||||
"bundle/shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
|
||||
|
||||
|
@ -221,6 +221,10 @@ static void frontend_gx_get_environment_settings(
|
||||
sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], g_defaults.dirs[DEFAULT_DIR_CORE],
|
||||
"overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT], g_defaults.dirs[DEFAULT_DIR_CORE],
|
||||
"layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
|
||||
#endif
|
||||
fill_pathname_join(g_defaults.path.config, g_defaults.dirs[DEFAULT_DIR_PORT],
|
||||
"retroarch.cfg", sizeof(g_defaults.path.config));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM], g_defaults.dirs[DEFAULT_DIR_PORT],
|
||||
|
@ -167,6 +167,10 @@ static void frontend_orbis_get_environment_settings(int *argc, char *argv[],
|
||||
"temp", sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], user_path,
|
||||
"overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT], user_path,
|
||||
"layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
|
||||
#endif
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS], user_path,
|
||||
"thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_LOGS], user_path,
|
||||
|
@ -242,6 +242,11 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY],
|
||||
g_defaults.dirs[DEFAULT_DIR_CORE],
|
||||
"overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT],
|
||||
g_defaults.dirs[DEFAULT_DIR_CORE],
|
||||
"layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
|
||||
#endif
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS],
|
||||
g_defaults.dirs[DEFAULT_DIR_CORE],
|
||||
"assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
|
||||
|
@ -145,6 +145,10 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[],
|
||||
"temp", sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], user_path,
|
||||
"overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT], user_path,
|
||||
"layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
|
||||
#endif
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS], user_path,
|
||||
"thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_LOGS], user_path,
|
||||
|
@ -98,6 +98,10 @@ static void frontend_qnx_get_environment_settings(int *argc, char *argv[],
|
||||
"info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], data_path,
|
||||
"overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT], data_path,
|
||||
"layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
|
||||
#endif
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADERS], data_path,
|
||||
"shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADERS]));
|
||||
|
||||
|
@ -229,6 +229,11 @@ static void frontend_switch_get_environment_settings(int *argc, char *argv[], vo
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], g_defaults.dirs[DEFAULT_DIR_PORT],
|
||||
"overlay", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT], g_defaults.dirs[DEFAULT_DIR_PORT],
|
||||
"layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
|
||||
#endif
|
||||
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], g_defaults.dirs[DEFAULT_DIR_PORT],
|
||||
"downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
|
||||
|
||||
|
@ -1574,6 +1574,10 @@ static void frontend_unix_get_env(int *argc,
|
||||
"shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], app_dir,
|
||||
"overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT], app_dir,
|
||||
"layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
|
||||
#endif
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], app_dir,
|
||||
"cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO],
|
||||
@ -1920,6 +1924,10 @@ static void frontend_unix_get_env(int *argc,
|
||||
"cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], base_path,
|
||||
"overlay", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT], base_path,
|
||||
"layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
|
||||
#endif
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], base_path,
|
||||
"downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT], base_path,
|
||||
|
@ -353,6 +353,10 @@ static void frontend_uwp_environment_get(int *argc, char *argv[],
|
||||
"~\\thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_OVERLAY],
|
||||
"~\\overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT],
|
||||
"~\\layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
|
||||
#endif
|
||||
/* This one is an exception: cores have to be loaded from
|
||||
* the install directory,
|
||||
* since this is the only place UWP apps can take .dlls from */
|
||||
|
@ -447,6 +447,10 @@ static void frontend_win32_environment_get(int *argc, char *argv[],
|
||||
":\\thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_OVERLAY],
|
||||
":\\overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT],
|
||||
":\\layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
|
||||
#endif
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CORE],
|
||||
":\\cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CORE_INFO],
|
||||
|
@ -123,6 +123,12 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
|
||||
g_defaults.dirs[DEFAULT_DIR_CORE],
|
||||
"overlays",
|
||||
sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT],
|
||||
g_defaults.dirs[DEFAULT_DIR_CORE],
|
||||
"layouts",
|
||||
sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
|
||||
#endif
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS],
|
||||
g_defaults.dirs[DEFAULT_DIR_CORE],
|
||||
"media", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
|
||||
|
@ -204,6 +204,13 @@ struct gl
|
||||
GLuint texture[GFX_MAX_TEXTURES];
|
||||
GLuint hw_render_fbo[GFX_MAX_TEXTURES];
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
bool video_layout_resize;
|
||||
GLuint video_layout_fbo;
|
||||
GLuint video_layout_fbo_texture;
|
||||
GLuint video_layout_white_texture;
|
||||
#endif
|
||||
|
||||
unsigned tex_index; /* For use with PREV. */
|
||||
unsigned textures;
|
||||
unsigned fbo_feedback_pass;
|
||||
|
@ -359,6 +359,9 @@ video_driver_t video_caca = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
caca_gfx_get_poke_interface,
|
||||
NULL /* wrap_type_to_enum */
|
||||
|
@ -1289,6 +1289,9 @@ video_driver_t video_ctr =
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
ctr_get_poke_interface
|
||||
};
|
||||
|
@ -1753,6 +1753,9 @@ video_driver_t video_d3d10 = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
d3d10_get_overlay_interface,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
d3d10_gfx_get_poke_interface,
|
||||
NULL, /* d3d10_wrap_type_to_enum */
|
||||
|
@ -1815,6 +1815,9 @@ video_driver_t video_d3d11 = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
d3d11_get_overlay_interface,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
d3d11_gfx_get_poke_interface,
|
||||
NULL, /* d3d11_wrap_type_to_enum */
|
||||
|
@ -1863,6 +1863,9 @@ video_driver_t video_d3d12 = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
d3d12_get_overlay_interface,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
d3d12_gfx_get_poke_interface,
|
||||
NULL, /* d3d12_wrap_type_to_enum */
|
||||
|
@ -1904,6 +1904,9 @@ video_driver_t video_d3d8 = {
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
d3d8_get_overlay_interface,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
d3d8_get_poke_interface
|
||||
};
|
||||
|
@ -2121,6 +2121,9 @@ video_driver_t video_d3d9 = {
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
d3d9_get_overlay_interface,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
d3d9_get_poke_interface,
|
||||
NULL, /* wrap_type_to_enum */
|
||||
|
@ -711,6 +711,9 @@ video_driver_t video_dispmanx = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
dispmanx_gfx_get_poke_interface
|
||||
};
|
||||
|
@ -1036,6 +1036,9 @@ video_driver_t video_drm = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
drm_gfx_get_poke_interface
|
||||
};
|
||||
|
@ -1555,6 +1555,9 @@ video_driver_t video_exynos = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
exynos_gfx_get_poke_interface
|
||||
};
|
||||
|
@ -696,6 +696,9 @@ video_driver_t video_gdi = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
gdi_gfx_get_poke_interface,
|
||||
};
|
||||
|
343
gfx/drivers/gl.c
343
gfx/drivers/gl.c
@ -979,7 +979,7 @@ static void gl2_create_fbo_textures(gl_t *gl,
|
||||
glGenTextures(chain->fbo_pass, chain->fbo_texture);
|
||||
|
||||
for (i = 0; i < chain->fbo_pass; i++)
|
||||
gl2_create_fbo_texture(gl,
|
||||
gl2_create_fbo_texture(gl,
|
||||
(gl2_renderchain_data_t*)gl->renderchain_data,
|
||||
i, chain->fbo_texture[i]);
|
||||
|
||||
@ -2556,6 +2556,318 @@ static void gl2_pbo_async_readback(gl_t *gl)
|
||||
gl2_renderchain_unbind_pbo();
|
||||
}
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
|
||||
static float video_layout_layer_tex_coord[] = {
|
||||
0.0f, 1.0f,
|
||||
1.0f, 1.0f,
|
||||
0.0f, 0.0f,
|
||||
1.0f, 0.0f,
|
||||
};
|
||||
|
||||
static void gl2_video_layout_fbo_init(gl_t *gl, unsigned width, unsigned height)
|
||||
{
|
||||
glGenTextures(1, &gl->video_layout_fbo_texture);
|
||||
glBindTexture(GL_TEXTURE_2D, gl->video_layout_fbo_texture);
|
||||
|
||||
gl2_load_texture_image(GL_TEXTURE_2D, 0, RARCH_GL_INTERNAL_FORMAT32,
|
||||
width, height, 0, GL_RGBA, GL_FLOAT, NULL);
|
||||
|
||||
gl2_gen_fb(1, &gl->video_layout_fbo);
|
||||
gl2_bind_fb(gl->video_layout_fbo);
|
||||
|
||||
gl2_fb_texture_2d(RARCH_GL_FRAMEBUFFER, RARCH_GL_COLOR_ATTACHMENT0,
|
||||
GL_TEXTURE_2D, gl->video_layout_fbo_texture, 0);
|
||||
|
||||
if (gl2_check_fb_status(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
||||
RARCH_LOG("Unable to create FBO for video_layout\n");
|
||||
|
||||
gl2_bind_fb(0);
|
||||
}
|
||||
|
||||
static void gl2_video_layout_fbo_free(gl_t *gl)
|
||||
{
|
||||
if (gl->video_layout_fbo)
|
||||
{
|
||||
gl2_delete_fb(1, &gl->video_layout_fbo);
|
||||
gl->video_layout_fbo = 0;
|
||||
}
|
||||
|
||||
if (gl->video_layout_fbo_texture)
|
||||
{
|
||||
glDeleteTextures(1, &gl->video_layout_fbo_texture);
|
||||
gl->video_layout_fbo_texture = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void gl2_video_layout_viewport(gl_t *gl, video_frame_info_t *video_info)
|
||||
{
|
||||
if (!video_layout_valid())
|
||||
return;
|
||||
|
||||
if (gl->video_layout_resize)
|
||||
{
|
||||
if (gl->video_layout_fbo)
|
||||
gl2_video_layout_fbo_free(gl);
|
||||
|
||||
gl2_video_layout_fbo_init(gl, video_info->width, video_info->height);
|
||||
|
||||
video_layout_view_change();
|
||||
|
||||
gl->video_layout_resize = false;
|
||||
}
|
||||
|
||||
if (video_layout_view_on_change())
|
||||
{
|
||||
video_layout_bounds_t b;
|
||||
b.x = 0.0f;
|
||||
b.y = 0.0f;
|
||||
b.w = (float)video_info->width;
|
||||
b.h = (float)video_info->height;
|
||||
video_layout_view_fit_bounds(b);
|
||||
}
|
||||
|
||||
if (video_layout_screen_count())
|
||||
{
|
||||
const video_layout_bounds_t *bounds;
|
||||
bounds = video_layout_screen(0);
|
||||
|
||||
glViewport(
|
||||
bounds->x, video_info->height - bounds->y - bounds->h,
|
||||
bounds->w, bounds->h
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static void gl2_video_layout_render(gl_t *gl, video_frame_info_t *video_info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!video_layout_valid())
|
||||
return;
|
||||
|
||||
glViewport(0, 0, video_info->width, video_info->height);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
for (i = 0; i < video_layout_layer_count(); ++i)
|
||||
video_layout_layer_render(video_info, i);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
static void gl2_video_layout_init(gl_t *gl)
|
||||
{
|
||||
uint32_t px;
|
||||
|
||||
gl->video_layout_resize = true;
|
||||
|
||||
/* white 1px texture for drawing solid colors */
|
||||
px = 0xFFFFFFFF;
|
||||
|
||||
glGenTextures(1, &gl->video_layout_white_texture);
|
||||
gl_load_texture_data(gl->video_layout_white_texture,
|
||||
RARCH_WRAP_EDGE, TEXTURE_FILTER_NEAREST,
|
||||
sizeof(uint32_t), 1, 1, &px, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
static void gl2_video_layout_free(gl_t *gl)
|
||||
{
|
||||
gl2_video_layout_fbo_free(gl);
|
||||
|
||||
if (gl->video_layout_white_texture)
|
||||
{
|
||||
glDeleteTextures(1, &gl->video_layout_white_texture);
|
||||
gl->video_layout_white_texture = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void *gl2_video_layout_take_image(void *video_driver_data, struct texture_image image)
|
||||
{
|
||||
unsigned alignment;
|
||||
GLuint tex;
|
||||
|
||||
tex = 0;
|
||||
alignment = video_pixel_get_alignment(image.width * sizeof(uint32_t));
|
||||
|
||||
glGenTextures(1, &tex);
|
||||
|
||||
gl_load_texture_data(tex,
|
||||
RARCH_WRAP_EDGE, TEXTURE_FILTER_MIPMAP_LINEAR,
|
||||
alignment, image.width, image.height, image.pixels, sizeof(uint32_t));
|
||||
|
||||
free(image.pixels);
|
||||
|
||||
return (void*)(uintptr_t)tex;
|
||||
}
|
||||
|
||||
static void gl2_video_layout_free_image(void *video_driver_data, void *image)
|
||||
{
|
||||
GLuint tex;
|
||||
tex = (GLuint)(uintptr_t)image;
|
||||
glDeleteTextures(1, &tex);
|
||||
}
|
||||
|
||||
static void gl2_video_layout_layer_begin(const video_layout_render_info_t *info)
|
||||
{
|
||||
gl_t *gl;
|
||||
gl = (gl_t*)info->video_driver_data;
|
||||
|
||||
gl2_bind_fb(gl->video_layout_fbo);
|
||||
|
||||
glClearColor(0, 0, 0, 0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
gl->shader->use(gl, gl->shader_data,
|
||||
VIDEO_SHADER_STOCK_BLEND, true);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
static void gl2_video_layout_image(const video_layout_render_info_t *info, void *image_handle, void *alpha_handle)
|
||||
{
|
||||
/* TODO alpha_handle */
|
||||
|
||||
gl_t *gl;
|
||||
video_frame_info_t *video_info;
|
||||
video_layout_bounds_t b;
|
||||
float coord[8];
|
||||
float color[16];
|
||||
int i;
|
||||
|
||||
gl = (gl_t*)info->video_driver_data;
|
||||
video_info = (video_frame_info_t*)info->video_driver_frame_data;
|
||||
|
||||
b = info->bounds;
|
||||
b.x /= video_info->width;
|
||||
b.y /= video_info->height;
|
||||
b.w /= video_info->width;
|
||||
b.h /= video_info->height;
|
||||
|
||||
coord[0] = b.x;
|
||||
coord[1] = 1.f - b.y;
|
||||
coord[2] = b.x + b.w;
|
||||
coord[3] = 1.f - b.y;
|
||||
coord[4] = b.x;
|
||||
coord[5] = 1.f - (b.y + b.h);
|
||||
coord[6] = b.x + b.w;
|
||||
coord[7] = 1.f - (b.y + b.h);
|
||||
|
||||
i = 0;
|
||||
while(i < 16)
|
||||
{
|
||||
color[i++] = info->color.r;
|
||||
color[i++] = info->color.g;
|
||||
color[i++] = info->color.b;
|
||||
color[i++] = info->color.a;
|
||||
}
|
||||
|
||||
gl->coords.vertex = coord;
|
||||
gl->coords.tex_coord = tex_coords;
|
||||
gl->coords.color = color;
|
||||
gl->coords.vertices = 4;
|
||||
|
||||
gl->shader->set_coords(gl->shader_data, &gl->coords);
|
||||
gl->shader->set_mvp(gl->shader_data, &gl->mvp_no_rot);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, (GLuint)(uintptr_t)image_handle);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
static void gl2_video_layout_text(const video_layout_render_info_t *info, const char *str)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
static void gl2_video_layout_counter(const video_layout_render_info_t *info, int value)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
static void gl2_video_layout_rect(const video_layout_render_info_t *info)
|
||||
{
|
||||
gl_t *gl;
|
||||
gl = (gl_t*)info->video_driver_data;
|
||||
|
||||
gl2_video_layout_image(info, (void*)(uintptr_t)gl->video_layout_white_texture, NULL);
|
||||
}
|
||||
|
||||
static void gl2_video_layout_screen(const video_layout_render_info_t *info, int screen_index)
|
||||
{
|
||||
gl2_video_layout_rect(info);
|
||||
}
|
||||
|
||||
static void gl2_video_layout_ellipse(const video_layout_render_info_t *info)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
static void gl2_video_layout_led_dot(const video_layout_render_info_t *info, int dot_count, int dot_mask)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
static void gl2_video_layout_led_seg(const video_layout_render_info_t *info, video_layout_led_t seg_layout, int seg_mask)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
static void gl2_video_layout_layer_end(const video_layout_render_info_t *info, video_layout_blend_t blend_type)
|
||||
{
|
||||
gl_t *gl;
|
||||
gl = (gl_t*)info->video_driver_data;
|
||||
|
||||
switch (blend_type)
|
||||
{
|
||||
case VIDEO_LAYOUT_BLEND_ALPHA:
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
break;
|
||||
case VIDEO_LAYOUT_BLEND_ADD:
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
break;
|
||||
case VIDEO_LAYOUT_BLEND_MOD:
|
||||
glBlendFunc(GL_DST_COLOR, GL_ZERO);
|
||||
break;
|
||||
}
|
||||
|
||||
gl2_bind_fb(0);
|
||||
|
||||
gl->coords.vertex = gl->vertex_ptr;
|
||||
gl->coords.tex_coord = video_layout_layer_tex_coord;
|
||||
gl->coords.color = gl->white_color_ptr;
|
||||
gl->coords.vertices = 4;
|
||||
|
||||
gl->shader->set_coords(gl->shader_data, &gl->coords);
|
||||
gl->shader->set_mvp(gl->shader_data, &gl->mvp_no_rot);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, gl->video_layout_fbo_texture);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
gl->coords.tex_coord = gl->tex_info.coord;
|
||||
}
|
||||
|
||||
static video_layout_render_interface_t gl2_video_layout_render_interface =
|
||||
{
|
||||
gl2_video_layout_take_image,
|
||||
gl2_video_layout_free_image,
|
||||
gl2_video_layout_layer_begin,
|
||||
gl2_video_layout_screen,
|
||||
gl2_video_layout_image,
|
||||
gl2_video_layout_text,
|
||||
gl2_video_layout_counter,
|
||||
gl2_video_layout_rect,
|
||||
gl2_video_layout_ellipse,
|
||||
gl2_video_layout_led_dot,
|
||||
gl2_video_layout_led_seg,
|
||||
gl2_video_layout_layer_end
|
||||
};
|
||||
|
||||
static const video_layout_render_interface_t *gl2_get_video_layout_render_interface(void *data)
|
||||
{
|
||||
return &gl2_video_layout_render_interface;
|
||||
}
|
||||
|
||||
#endif /* HAVE_VIDEO_LAYOUT */
|
||||
|
||||
static bool gl2_frame(void *data, const void *frame,
|
||||
unsigned frame_width, unsigned frame_height,
|
||||
uint64_t frame_count,
|
||||
@ -2617,8 +2929,16 @@ static bool gl2_frame(void *data, const void *frame,
|
||||
}
|
||||
else
|
||||
gl2_set_viewport(gl, video_info, width, height, false, true);
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
gl->video_layout_resize = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
gl2_video_layout_viewport(gl, video_info);
|
||||
#endif
|
||||
|
||||
if (frame)
|
||||
gl->tex_index = ((gl->tex_index + 1) % gl->textures);
|
||||
|
||||
@ -2711,7 +3031,7 @@ static bool gl2_frame(void *data, const void *frame,
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
if (gl->fbo_inited)
|
||||
gl2_renderchain_render(gl,
|
||||
gl2_renderchain_render(gl,
|
||||
chain,
|
||||
video_info,
|
||||
frame_count, &gl->tex_info, &feedback_info);
|
||||
@ -2720,6 +3040,10 @@ static bool gl2_frame(void *data, const void *frame,
|
||||
gl2_renderchain_bind_prev_texture(gl,
|
||||
chain, &gl->tex_info);
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
gl2_video_layout_render(gl, video_info);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_MENU)
|
||||
if (gl->menu_texture_enable)
|
||||
{
|
||||
@ -2858,10 +3182,14 @@ static void gl2_free(void *data)
|
||||
if (!gl)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
gl2_video_layout_free(gl);
|
||||
#endif
|
||||
|
||||
gl2_context_bind_hw_render(gl, false);
|
||||
|
||||
if (gl->have_sync)
|
||||
gl2_renderchain_fence_free(gl,
|
||||
gl2_renderchain_fence_free(gl,
|
||||
(gl2_renderchain_data_t*)
|
||||
gl->renderchain_data);
|
||||
|
||||
@ -3598,6 +3926,10 @@ static void *gl2_init(const video_info_t *video,
|
||||
goto error;
|
||||
}
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
gl2_video_layout_init(gl);
|
||||
#endif
|
||||
|
||||
gl2_context_bind_hw_render(gl, true);
|
||||
|
||||
return gl;
|
||||
@ -3781,7 +4113,7 @@ static bool gl2_set_shader(void *data,
|
||||
gl2_init_textures_data(gl);
|
||||
|
||||
if (gl->hw_render_use)
|
||||
gl2_renderchain_init_hw_render(gl,
|
||||
gl2_renderchain_init_hw_render(gl,
|
||||
(gl2_renderchain_data_t*)gl->renderchain_data,
|
||||
gl->tex_w, gl->tex_h);
|
||||
}
|
||||
@ -4233,6 +4565,9 @@ video_driver_t video_gl2 = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
gl2_get_overlay_interface,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
gl2_get_video_layout_render_interface,
|
||||
#endif
|
||||
gl2_get_poke_interface,
|
||||
gl2_wrap_type_to_enum,
|
||||
|
@ -1544,6 +1544,9 @@ video_driver_t video_gl1 = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
gl1_get_overlay_interface,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
gl1_gfx_get_poke_interface,
|
||||
gl1_wrap_type_to_enum,
|
||||
|
@ -2057,6 +2057,9 @@ video_driver_t video_gl_core = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
gl_core_get_overlay_interface,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
gl_core_get_poke_interface,
|
||||
gl_core_wrap_type_to_enum,
|
||||
|
@ -1777,6 +1777,9 @@ video_driver_t video_wiiu =
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
gx2_get_overlay_interface, /* overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
wiiu_gfx_get_poke_interface,
|
||||
NULL, /* wrap_type_to_enum */
|
||||
|
@ -1683,6 +1683,9 @@ video_driver_t video_gx = {
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
gx_get_overlay_interface,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
gx_get_poke_interface,
|
||||
};
|
||||
|
@ -452,6 +452,9 @@ video_driver_t video_metal = {
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
metal_get_overlay_interface,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
metal_get_poke_interface,
|
||||
NULL, /* metal_wrap_type_to_enum */
|
||||
|
@ -139,6 +139,9 @@ video_driver_t video_null = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
null_gfx_get_poke_interface,
|
||||
};
|
||||
|
@ -1186,6 +1186,9 @@ video_driver_t video_omap = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
omap_gfx_get_poke_interface
|
||||
};
|
||||
|
@ -518,6 +518,9 @@ video_driver_t video_ps2 = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
ps2_gfx_get_poke_interface,
|
||||
};
|
||||
|
@ -981,6 +981,9 @@ video_driver_t video_psp1 = {
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
psp_get_poke_interface
|
||||
};
|
||||
|
@ -790,6 +790,9 @@ video_driver_t video_sdl2 = {
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
sdl2_gfx_poke_interface
|
||||
};
|
||||
|
@ -598,6 +598,9 @@ video_driver_t video_sdl = {
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
sdl_get_poke_interface
|
||||
};
|
||||
|
@ -664,6 +664,9 @@ video_driver_t video_sixel = {
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
sixel_gfx_get_poke_interface,
|
||||
NULL /* wrap_type_to_enum */
|
||||
|
@ -992,6 +992,9 @@ video_driver_t video_sunxi = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
sunxi_gfx_get_poke_interface
|
||||
};
|
||||
|
@ -453,6 +453,9 @@ video_driver_t video_switch = {
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
switch_get_poke_interface,
|
||||
};
|
||||
|
@ -802,6 +802,9 @@ video_driver_t video_switch = {
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
switch_overlay_interface, /* switch_overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
switch_get_poke_interface,
|
||||
};
|
||||
|
@ -519,6 +519,9 @@ video_driver_t video_vg = {
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
vg_get_poke_interface
|
||||
};
|
||||
|
@ -451,6 +451,9 @@ video_driver_t video_vga = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
vga_gfx_get_poke_interface,
|
||||
};
|
||||
|
@ -983,6 +983,9 @@ video_driver_t video_vita2d = {
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
vita2d_get_overlay_interface,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
vita2d_gfx_get_poke_interface,
|
||||
};
|
||||
|
@ -2816,6 +2816,9 @@ video_driver_t video_vulkan = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
vulkan_get_overlay_interface,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
vulkan_get_poke_interface,
|
||||
NULL, /* vulkan_wrap_type_to_enum */
|
||||
|
@ -326,6 +326,9 @@ video_driver_t video_xenon360 = {
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
xenon360_gfx_get_poke_interface
|
||||
};
|
||||
|
@ -262,6 +262,9 @@ video_driver_t video_xshm = {
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL,
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
xshm_gfx_poke_interface
|
||||
};
|
||||
|
@ -1000,6 +1000,9 @@ video_driver_t video_xvideo = {
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
xv_get_poke_interface
|
||||
};
|
||||
|
@ -52,6 +52,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
#include "video_layout.h"
|
||||
#endif
|
||||
|
||||
#include "video_thread_wrapper.h"
|
||||
#include "video_driver.h"
|
||||
#include "video_display_server.h"
|
||||
@ -842,6 +846,10 @@ static void video_driver_free_internal(void)
|
||||
bool is_threaded = video_driver_is_threaded_internal();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
video_layout_deinit();
|
||||
#endif
|
||||
|
||||
command_event(CMD_EVENT_OVERLAY_DEINIT, NULL);
|
||||
|
||||
if (!video_driver_is_video_cache_context())
|
||||
@ -1099,6 +1107,15 @@ static bool video_driver_init_internal(bool *video_is_threaded)
|
||||
command_event(CMD_EVENT_OVERLAY_DEINIT, NULL);
|
||||
command_event(CMD_EVENT_OVERLAY_INIT, NULL);
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
if(settings->bools.video_layout_enable)
|
||||
{
|
||||
video_layout_init(video_driver_data, video_driver_layout_render_interface());
|
||||
video_layout_load(settings->paths.path_video_layout);
|
||||
video_layout_view_select(settings->uints.video_layout_selected_view);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!core_is_game_loaded())
|
||||
video_driver_cached_frame_set(&dummy_pixels, 4, 4, 8);
|
||||
|
||||
@ -1201,6 +1218,16 @@ bool video_driver_overlay_interface(const video_overlay_interface_t **iface)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
const video_layout_render_interface_t *video_driver_layout_render_interface(void)
|
||||
{
|
||||
if (!current_video)
|
||||
return NULL;
|
||||
|
||||
return current_video->video_layout_render_interface(video_driver_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
void *video_driver_read_frame_raw(unsigned *width,
|
||||
unsigned *height, size_t *pitch)
|
||||
{
|
||||
|
@ -34,6 +34,10 @@
|
||||
#include "../input/input_overlay.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
#include "video_layout.h"
|
||||
#endif
|
||||
|
||||
#include "video_defines.h"
|
||||
#include "video_coord_array.h"
|
||||
#include "video_filter.h"
|
||||
@ -798,6 +802,9 @@ typedef struct video_driver
|
||||
#ifdef HAVE_OVERLAY
|
||||
void (*overlay_interface)(void *data,
|
||||
const video_overlay_interface_t **iface);
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
const video_layout_render_interface_t *(*video_layout_render_interface)(void *data);
|
||||
#endif
|
||||
void (*poke_interface)(void *data, const video_poke_interface_t **iface);
|
||||
unsigned (*wrap_type_to_enum)(enum gfx_wrap_type type);
|
||||
@ -950,6 +957,10 @@ bool video_driver_overlay_interface(
|
||||
const video_overlay_interface_t **iface);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
const video_layout_render_interface_t *video_driver_layout_render_interface(void);
|
||||
#endif
|
||||
|
||||
void * video_driver_read_frame_raw(unsigned *width,
|
||||
unsigned *height, size_t *pitch);
|
||||
|
||||
|
470
gfx/video_layout.c
Normal file
470
gfx/video_layout.c
Normal file
@ -0,0 +1,470 @@
|
||||
#include "video_layout.h"
|
||||
#include "video_layout/view.h"
|
||||
#include "video_driver.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <formats/rxml.h>
|
||||
#include <file/file_path.h>
|
||||
#include <file/archive_file.h>
|
||||
#include <compat/strl.h>
|
||||
#include <verbosity.h>
|
||||
|
||||
bool load(view_array_t *view_array, rxml_document_t *doc);
|
||||
|
||||
typedef struct io
|
||||
{
|
||||
char *name;
|
||||
int base_value;
|
||||
int value;
|
||||
}
|
||||
io_t;
|
||||
|
||||
typedef struct video_layout_state
|
||||
{
|
||||
video_layout_render_info_t render_info;
|
||||
const video_layout_render_interface_t *render;
|
||||
|
||||
view_array_t view_array;
|
||||
|
||||
view_t *view;
|
||||
int view_index;
|
||||
|
||||
io_t *io;
|
||||
int io_count;
|
||||
|
||||
void **images;
|
||||
int images_count;
|
||||
|
||||
char *base_path;
|
||||
|
||||
bool is_archive;
|
||||
bool view_changed;
|
||||
}
|
||||
video_layout_state_t;
|
||||
|
||||
static video_layout_state_t *video_layout_state = NULL;
|
||||
|
||||
void video_layout_init(void *video_driver_data, const video_layout_render_interface_t *render)
|
||||
{
|
||||
if (video_layout_state)
|
||||
video_layout_deinit();
|
||||
|
||||
video_layout_state = (video_layout_state_t*)calloc(1, sizeof(video_layout_state_t));
|
||||
video_layout_state->render_info.video_driver_data = video_driver_data;
|
||||
video_layout_state->render = render;
|
||||
|
||||
vec_size((void**)&video_layout_state->images, sizeof(void*), 1);
|
||||
|
||||
video_layout_state->images[0] = NULL;
|
||||
video_layout_state->images_count = 1;
|
||||
}
|
||||
|
||||
void video_layout_deinit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!video_layout_state)
|
||||
return;
|
||||
|
||||
free(video_layout_state->base_path);
|
||||
|
||||
for (i = 1; i < video_layout_state->images_count; ++i)
|
||||
{
|
||||
video_layout_state->render->free_image(
|
||||
video_layout_state->render_info.video_driver_data,
|
||||
video_layout_state->images[i]
|
||||
);
|
||||
}
|
||||
|
||||
free(video_layout_state->images);
|
||||
|
||||
for (i = 0; i < video_layout_state->io_count; ++i)
|
||||
free(video_layout_state->io[i].name);
|
||||
|
||||
free(video_layout_state->io);
|
||||
|
||||
view_array_deinit(&video_layout_state->view_array);
|
||||
|
||||
free(video_layout_state);
|
||||
video_layout_state = NULL;
|
||||
}
|
||||
|
||||
int video_layout_io_assign(const char *name, int base_value)
|
||||
{
|
||||
int index;
|
||||
|
||||
index = video_layout_state->io_count;
|
||||
|
||||
vec_size((void**)&video_layout_state->io, sizeof(io_t), ++video_layout_state->io_count);
|
||||
|
||||
video_layout_state->io[index].name = init_string(name);
|
||||
video_layout_state->io[index].base_value = base_value;
|
||||
video_layout_state->io[index].value = base_value;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
int video_layout_io_find(const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < video_layout_state->io_count; ++i)
|
||||
{
|
||||
if (strcmp(video_layout_state->io[i].name, name) == 0)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int video_layout_io_get(int index)
|
||||
{
|
||||
return video_layout_state->io[index].value;
|
||||
}
|
||||
|
||||
void video_layout_io_set(int index, int value)
|
||||
{
|
||||
video_layout_state->io[index].value = value;
|
||||
}
|
||||
|
||||
bool video_layout_load(const char *path)
|
||||
{
|
||||
rxml_document_t *doc;
|
||||
bool result;
|
||||
|
||||
if(!path || !strlen(path))
|
||||
return true;
|
||||
|
||||
video_layout_state->is_archive = path_is_compressed_file(path);
|
||||
|
||||
doc = NULL;
|
||||
|
||||
if(video_layout_state->is_archive)
|
||||
{
|
||||
void *buf;
|
||||
int64_t len;
|
||||
|
||||
char respath[PATH_MAX_LENGTH];
|
||||
strlcpy(respath, path, sizeof(respath));
|
||||
strlcat(respath, "#", sizeof(respath));
|
||||
set_string(&video_layout_state->base_path, respath);
|
||||
|
||||
strlcat(respath, "default.lay", sizeof(respath));
|
||||
if (file_archive_compressed_read(respath, &buf, NULL, &len))
|
||||
{
|
||||
char *str;
|
||||
if ((str = (char*)realloc(buf, (size_t)len + 1)))
|
||||
{
|
||||
str[(size_t)len] = '\0';
|
||||
doc = rxml_load_document_string(str);
|
||||
free(str);
|
||||
}
|
||||
else free(buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char respath[PATH_MAX_LENGTH];
|
||||
fill_pathname_basedir(respath, path, sizeof(respath));
|
||||
set_string(&video_layout_state->base_path, respath);
|
||||
doc = rxml_load_document(path);
|
||||
}
|
||||
|
||||
if (!doc)
|
||||
{
|
||||
RARCH_LOG("video_layout: unable to open file \"%s\"\n", path);
|
||||
return false;
|
||||
}
|
||||
|
||||
result = load(&video_layout_state->view_array, doc);
|
||||
rxml_free_document(doc);
|
||||
|
||||
video_layout_view_select(video_layout_view_index());
|
||||
return result;
|
||||
}
|
||||
|
||||
bool video_layout_valid(void)
|
||||
{
|
||||
return video_layout_state && video_layout_state->view;
|
||||
}
|
||||
|
||||
static int video_layout_load_image(const char *path)
|
||||
{
|
||||
struct texture_image image;
|
||||
void *handle;
|
||||
int index;
|
||||
|
||||
image.supports_rgba = video_driver_supports_rgba();
|
||||
|
||||
if (video_layout_state->is_archive)
|
||||
{
|
||||
void *buf;
|
||||
int64_t len;
|
||||
|
||||
char respath[PATH_MAX_LENGTH];
|
||||
strlcpy(respath, video_layout_state->base_path, sizeof(respath));
|
||||
strlcat(respath, path, sizeof(respath));
|
||||
|
||||
if (!file_archive_compressed_read(respath, &buf, NULL, &len))
|
||||
{
|
||||
RARCH_LOG("video_layout: failed to decompress image: %s\n", respath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!image_texture_load_buffer(&image, image_texture_get_type(path), buf, (size_t)len))
|
||||
{
|
||||
free(buf);
|
||||
|
||||
RARCH_LOG("video_layout: failed to load image: %s\n", respath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
free(buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
char respath[PATH_MAX_LENGTH];
|
||||
strlcpy(respath, video_layout_state->base_path, sizeof(respath));
|
||||
strlcat(respath, path, sizeof(respath));
|
||||
|
||||
if (!image_texture_load(&image, respath))
|
||||
{
|
||||
RARCH_LOG("video_layout: failed to load image: %s\n", respath);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
handle = video_layout_state->render->take_image(
|
||||
video_layout_state->render_info.video_driver_data, image);
|
||||
|
||||
if (!handle)
|
||||
return 0;
|
||||
|
||||
index = video_layout_state->images_count;
|
||||
|
||||
vec_size((void**)&video_layout_state->images, sizeof(void*), ++video_layout_state->images_count);
|
||||
|
||||
video_layout_state->images[index] = handle;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
int video_layout_view_count(void)
|
||||
{
|
||||
return video_layout_state->view_array.views_count;
|
||||
}
|
||||
|
||||
const char *video_layout_view_name(int index)
|
||||
{
|
||||
return video_layout_state->view_array.views[index].name;
|
||||
}
|
||||
|
||||
int video_layout_view_select(int index)
|
||||
{
|
||||
index = MAX(0, MIN(index, video_layout_state->view_array.views_count - 1));
|
||||
|
||||
video_layout_state->view_index = index;
|
||||
video_layout_state->view = video_layout_state->view_array.views_count ?
|
||||
&video_layout_state->view_array.views[index] : NULL;
|
||||
|
||||
video_layout_view_change();
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
int video_layout_view_cycle(void)
|
||||
{
|
||||
return video_layout_view_select(
|
||||
(video_layout_state->view_index + 1) % video_layout_state->view_array.views_count);
|
||||
}
|
||||
|
||||
int video_layout_view_index(void)
|
||||
{
|
||||
return video_layout_state->view_index;
|
||||
}
|
||||
|
||||
void video_layout_view_change(void)
|
||||
{
|
||||
video_layout_state->view_changed = true;
|
||||
}
|
||||
|
||||
bool video_layout_view_on_change(void)
|
||||
{
|
||||
if (video_layout_state->view_changed)
|
||||
{
|
||||
video_layout_state->view_changed = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void video_layout_view_fit_bounds(video_layout_bounds_t bounds)
|
||||
{
|
||||
view_t *view;
|
||||
float c, dx, dy;
|
||||
int i, j, k;
|
||||
|
||||
view = video_layout_state->view;
|
||||
|
||||
c = MIN(bounds.w / view->bounds.w, bounds.h / view->bounds.h);
|
||||
|
||||
dx = view->bounds.w * c;
|
||||
dy = view->bounds.h * c;
|
||||
|
||||
view->render_bounds.w = dx;
|
||||
view->render_bounds.h = dy;
|
||||
view->render_bounds.x = (bounds.w - dx) / 2.f;
|
||||
view->render_bounds.y = (bounds.h - dy) / 2.f;
|
||||
|
||||
for (i = 0; i < view->layers_count; ++i)
|
||||
{
|
||||
layer_t *layer;
|
||||
layer = &view->layers[i];
|
||||
|
||||
for (j = 0; j < layer->elements_count; ++j)
|
||||
{
|
||||
element_t *elem;
|
||||
elem = &layer->elements[j];
|
||||
|
||||
elem->render_bounds.x = elem->bounds.x * view->render_bounds.w + view->render_bounds.x;
|
||||
elem->render_bounds.y = elem->bounds.y * view->render_bounds.h + view->render_bounds.y;
|
||||
elem->render_bounds.w = elem->bounds.w * view->render_bounds.w;
|
||||
elem->render_bounds.h = elem->bounds.h * view->render_bounds.h;
|
||||
|
||||
for (k = 0; k < elem->components_count; ++k)
|
||||
{
|
||||
component_t *comp;
|
||||
comp = &elem->components[k];
|
||||
|
||||
comp->render_bounds.x = comp->bounds.x * elem->render_bounds.w + elem->render_bounds.x;
|
||||
comp->render_bounds.y = comp->bounds.y * elem->render_bounds.h + elem->render_bounds.y;
|
||||
comp->render_bounds.w = comp->bounds.w * elem->render_bounds.w;
|
||||
comp->render_bounds.h = comp->bounds.h * elem->render_bounds.h;
|
||||
|
||||
if (comp->type == VIDEO_LAYOUT_C_SCREEN)
|
||||
view->screens[comp->attr.screen.index] = comp->render_bounds;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int video_layout_layer_count(void)
|
||||
{
|
||||
return video_layout_state->view->layers_count;
|
||||
}
|
||||
|
||||
void video_layout_layer_render(void *video_driver_frame_data, int index)
|
||||
{
|
||||
video_layout_render_info_t *info;
|
||||
const video_layout_render_interface_t *r;
|
||||
layer_t *layer;
|
||||
int i, j;
|
||||
|
||||
info = &video_layout_state->render_info;
|
||||
r = video_layout_state->render;
|
||||
layer = &video_layout_state->view->layers[index];
|
||||
|
||||
info->video_driver_frame_data = video_driver_frame_data;
|
||||
|
||||
r->layer_begin(info);
|
||||
|
||||
for (i = 0; i < layer->elements_count; ++i)
|
||||
{
|
||||
element_t *elem;
|
||||
elem = &layer->elements[i];
|
||||
|
||||
if (elem->o_bind != -1)
|
||||
elem->state = video_layout_state->io[elem->o_bind].value;
|
||||
|
||||
for (j = 0; j < elem->components_count; ++j)
|
||||
{
|
||||
component_t *comp;
|
||||
comp = &elem->components[j];
|
||||
|
||||
if (comp->enabled_state != -1)
|
||||
{
|
||||
if(comp->enabled_state != elem->state)
|
||||
continue;
|
||||
}
|
||||
|
||||
info->bounds = comp->render_bounds;
|
||||
info->orientation = comp->orientation;
|
||||
info->color = comp->color;
|
||||
|
||||
switch (comp->type)
|
||||
{
|
||||
case VIDEO_LAYOUT_C_UNKNOWN:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_SCREEN:
|
||||
r->screen(info, comp->attr.screen.index);
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_RECT:
|
||||
r->rect(info);
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DISK:
|
||||
r->ellipse(info);
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_IMAGE:
|
||||
if(!comp->attr.image.loaded)
|
||||
{
|
||||
comp->attr.image.image_idx = video_layout_load_image(comp->attr.image.file);
|
||||
if(comp->attr.image.alpha_file)
|
||||
comp->attr.image.alpha_idx = video_layout_load_image(comp->attr.image.alpha_file);
|
||||
comp->attr.image.loaded = true;
|
||||
}
|
||||
r->image(info,
|
||||
video_layout_state->images[comp->attr.image.image_idx],
|
||||
video_layout_state->images[comp->attr.image.alpha_idx]);
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_TEXT:
|
||||
r->text(info, comp->attr.text.string);
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_COUNTER:
|
||||
r->counter(info, MIN(elem->state, comp->attr.counter.max_state));
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DOTMATRIX_X1:
|
||||
r->led_dot(info, 1, elem->state);
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DOTMATRIX_H5:
|
||||
r->led_dot(info, 5, elem->state);
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DOTMATRIX_H8:
|
||||
r->led_dot(info, 8, elem->state);
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_7:
|
||||
r->led_seg(info, VIDEO_LAYOUT_LED_7, elem->state);
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_8_GTS1:
|
||||
r->led_seg(info, VIDEO_LAYOUT_LED_8_GTS1, elem->state);
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_14:
|
||||
r->led_seg(info, VIDEO_LAYOUT_LED_14, elem->state);
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_14_SC:
|
||||
r->led_seg(info, VIDEO_LAYOUT_LED_14_SC, elem->state);
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_16:
|
||||
r->led_seg(info, VIDEO_LAYOUT_LED_16, elem->state);
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_16_SC:
|
||||
r->led_seg(info, VIDEO_LAYOUT_LED_16_SC, elem->state);
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_REEL:
|
||||
/* not implemented */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
r->layer_end(info, layer->blend);
|
||||
}
|
||||
|
||||
const video_layout_bounds_t *video_layout_screen(int index)
|
||||
{
|
||||
return &video_layout_state->view->screens[index];
|
||||
}
|
||||
|
||||
int video_layout_screen_count(void)
|
||||
{
|
||||
return video_layout_state->view->screens_count;
|
||||
}
|
77
gfx/video_layout.h
Normal file
77
gfx/video_layout.h
Normal file
@ -0,0 +1,77 @@
|
||||
#ifndef VIDEO_LAYOUT_H
|
||||
#define VIDEO_LAYOUT_H
|
||||
#include "video_layout/types.h"
|
||||
#include <boolean.h>
|
||||
#include <formats/image.h>
|
||||
|
||||
typedef struct video_layout_render_info
|
||||
{
|
||||
void *video_driver_data;
|
||||
void *video_driver_frame_data;
|
||||
|
||||
video_layout_bounds_t bounds;
|
||||
video_layout_orientation_t orientation;
|
||||
video_layout_color_t color;
|
||||
}
|
||||
video_layout_render_info_t;
|
||||
|
||||
typedef enum video_layout_led
|
||||
{
|
||||
VIDEO_LAYOUT_LED_7, /* digit with . */
|
||||
VIDEO_LAYOUT_LED_8_GTS1, /* digit with vertical split */
|
||||
VIDEO_LAYOUT_LED_14, /* alphanumeric */
|
||||
VIDEO_LAYOUT_LED_14_SC, /* alphanumeric with ., */
|
||||
VIDEO_LAYOUT_LED_16, /* full alphanumeric */
|
||||
VIDEO_LAYOUT_LED_16_SC /* full alphanumeric with ., */
|
||||
}
|
||||
video_layout_led_t;
|
||||
|
||||
typedef struct video_layout_render_interface
|
||||
{
|
||||
void *(*take_image) (void *video_driver_data, struct texture_image image);
|
||||
void (*free_image) (void *video_driver_data, void *image);
|
||||
|
||||
void (*layer_begin) (const video_layout_render_info_t *info);
|
||||
|
||||
void (*screen) (const video_layout_render_info_t *info, int screen_index);
|
||||
void (*image) (const video_layout_render_info_t *info, void *image_handle, void *alpha_handle);
|
||||
void (*text) (const video_layout_render_info_t *info, const char *str);
|
||||
void (*counter) (const video_layout_render_info_t *info, int value);
|
||||
void (*rect) (const video_layout_render_info_t *info);
|
||||
void (*ellipse) (const video_layout_render_info_t *info);
|
||||
void (*led_dot) (const video_layout_render_info_t *info, int dot_count, int dot_mask);
|
||||
void (*led_seg) (const video_layout_render_info_t *info, video_layout_led_t seg_layout, int seg_mask);
|
||||
|
||||
void (*layer_end) (const video_layout_render_info_t *info, video_layout_blend_t blend_type);
|
||||
}
|
||||
video_layout_render_interface_t;
|
||||
|
||||
void video_layout_init (void *video_driver_data, const video_layout_render_interface_t *render);
|
||||
void video_layout_deinit (void);
|
||||
|
||||
int video_layout_io_assign (const char *name, int base_value);
|
||||
int video_layout_io_get (int index);
|
||||
void video_layout_io_set (int index, int value);
|
||||
|
||||
bool video_layout_load (const char *path);
|
||||
bool video_layout_valid (void);
|
||||
|
||||
int video_layout_view_count (void);
|
||||
const char *video_layout_view_name (int index);
|
||||
|
||||
int video_layout_view_select (int index);
|
||||
int video_layout_view_cycle (void);
|
||||
int video_layout_view_index (void);
|
||||
|
||||
void video_layout_view_change (void);
|
||||
bool video_layout_view_on_change (void);
|
||||
void video_layout_view_fit_bounds (video_layout_bounds_t bounds);
|
||||
|
||||
int video_layout_layer_count (void);
|
||||
void video_layout_layer_render (void *video_driver_frame_data, int index);
|
||||
|
||||
const video_layout_bounds_t
|
||||
*video_layout_screen (int index);
|
||||
int video_layout_screen_count (void);
|
||||
|
||||
#endif
|
165
gfx/video_layout/component.c
Normal file
165
gfx/video_layout/component.c
Normal file
@ -0,0 +1,165 @@
|
||||
#include "component.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void component_init(component_t *comp, comp_type_t type)
|
||||
{
|
||||
comp->type = type;
|
||||
comp->bounds = make_bounds();
|
||||
comp->render_bounds = make_bounds_unit();
|
||||
comp->orientation = VIDEO_LAYOUT_ROT0;
|
||||
comp->color = make_color_white();
|
||||
comp->enabled_state = -1;
|
||||
|
||||
switch (comp->type)
|
||||
{
|
||||
case VIDEO_LAYOUT_C_UNKNOWN:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_SCREEN:
|
||||
comp->attr.screen.index = 0;
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_RECT:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DISK:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_IMAGE:
|
||||
comp->attr.image.file = NULL;
|
||||
comp->attr.image.alpha_file = NULL;
|
||||
comp->attr.image.image_idx = 0;
|
||||
comp->attr.image.alpha_idx = 0;
|
||||
comp->attr.image.loaded = false;
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_TEXT:
|
||||
comp->attr.text.string = NULL;
|
||||
comp->attr.text.align = VIDEO_LAYOUT_TEXT_ALIGN_CENTER;
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_COUNTER:
|
||||
comp->attr.counter.digits = 2;
|
||||
comp->attr.counter.max_state = 999;
|
||||
comp->attr.counter.align = VIDEO_LAYOUT_TEXT_ALIGN_CENTER;
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DOTMATRIX_X1:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DOTMATRIX_H5:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DOTMATRIX_H8:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_7:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_8_GTS1:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_14:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_14_SC:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_16:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_16_SC:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_REEL:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void component_copy(component_t *comp, const component_t *src)
|
||||
{
|
||||
comp->type = src->type;
|
||||
comp->bounds = src->bounds;
|
||||
comp->render_bounds = src->render_bounds;
|
||||
comp->orientation = src->orientation;
|
||||
comp->color = src->color;
|
||||
comp->enabled_state = src->enabled_state;
|
||||
|
||||
switch (comp->type)
|
||||
{
|
||||
case VIDEO_LAYOUT_C_UNKNOWN:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_SCREEN:
|
||||
comp->attr.screen.index = src->attr.screen.index;
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_RECT:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DISK:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_IMAGE:
|
||||
comp->attr.image.file = init_string(src->attr.image.file);
|
||||
comp->attr.image.alpha_file = init_string(src->attr.image.alpha_file);
|
||||
comp->attr.image.image_idx = src->attr.image.image_idx;
|
||||
comp->attr.image.alpha_idx = src->attr.image.alpha_idx;
|
||||
comp->attr.image.loaded = src->attr.image.loaded;
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_TEXT:
|
||||
comp->attr.text.string = init_string(src->attr.text.string);
|
||||
comp->attr.text.align = src->attr.text.align;
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_COUNTER:
|
||||
comp->attr.counter.digits = src->attr.counter.digits;
|
||||
comp->attr.counter.max_state = src->attr.counter.max_state;
|
||||
comp->attr.counter.align = src->attr.counter.align;
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DOTMATRIX_X1:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DOTMATRIX_H5:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DOTMATRIX_H8:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_7:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_8_GTS1:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_14:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_14_SC:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_16:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_16_SC:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_REEL:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void component_deinit(component_t *comp)
|
||||
{
|
||||
switch (comp->type)
|
||||
{
|
||||
case VIDEO_LAYOUT_C_UNKNOWN:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_SCREEN:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_RECT:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DISK:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_IMAGE:
|
||||
free(comp->attr.image.file);
|
||||
free(comp->attr.image.alpha_file);
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_TEXT:
|
||||
free(comp->attr.text.string);
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_COUNTER:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DOTMATRIX_X1:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DOTMATRIX_H5:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DOTMATRIX_H8:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_7:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_8_GTS1:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_14:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_14_SC:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_16:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_16_SC:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_REEL:
|
||||
break;
|
||||
}
|
||||
}
|
53
gfx/video_layout/component.h
Normal file
53
gfx/video_layout/component.h
Normal file
@ -0,0 +1,53 @@
|
||||
#ifndef VIDEO_LAYOUT_COMPONENT_H
|
||||
#define VIDEO_LAYOUT_COMPONENT_H
|
||||
|
||||
#include "internal.h"
|
||||
#include "component_attr.h"
|
||||
|
||||
typedef enum comp_type
|
||||
{
|
||||
VIDEO_LAYOUT_C_UNKNOWN,
|
||||
VIDEO_LAYOUT_C_SCREEN,
|
||||
VIDEO_LAYOUT_C_RECT,
|
||||
VIDEO_LAYOUT_C_DISK,
|
||||
VIDEO_LAYOUT_C_IMAGE,
|
||||
VIDEO_LAYOUT_C_TEXT,
|
||||
VIDEO_LAYOUT_C_COUNTER,
|
||||
VIDEO_LAYOUT_C_DOTMATRIX_X1,
|
||||
VIDEO_LAYOUT_C_DOTMATRIX_H5,
|
||||
VIDEO_LAYOUT_C_DOTMATRIX_H8,
|
||||
VIDEO_LAYOUT_C_LED_7,
|
||||
VIDEO_LAYOUT_C_LED_8_GTS1,
|
||||
VIDEO_LAYOUT_C_LED_14,
|
||||
VIDEO_LAYOUT_C_LED_14_SC,
|
||||
VIDEO_LAYOUT_C_LED_16,
|
||||
VIDEO_LAYOUT_C_LED_16_SC,
|
||||
VIDEO_LAYOUT_C_REEL
|
||||
}
|
||||
comp_type_t;
|
||||
|
||||
union comp_attr
|
||||
{
|
||||
c_attr_screen_t screen;
|
||||
c_attr_image_t image;
|
||||
c_attr_text_t text;
|
||||
c_attr_counter_t counter;
|
||||
};
|
||||
|
||||
typedef struct component
|
||||
{
|
||||
comp_type_t type;
|
||||
video_layout_bounds_t bounds;
|
||||
video_layout_bounds_t render_bounds;
|
||||
video_layout_orientation_t orientation;
|
||||
video_layout_color_t color;
|
||||
int enabled_state;
|
||||
union comp_attr attr;
|
||||
}
|
||||
component_t;
|
||||
|
||||
void component_init (component_t *comp, comp_type_t type);
|
||||
void component_copy (component_t *comp, const component_t *src);
|
||||
void component_deinit (component_t *comp);
|
||||
|
||||
#endif
|
35
gfx/video_layout/component_attr.h
Normal file
35
gfx/video_layout/component_attr.h
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef VIDEO_LAYOUT_COMPONENT_ATTR_H
|
||||
#define VIDEO_LAYOUT_COMPONENT_ATTR_H
|
||||
|
||||
typedef struct c_attr_screen
|
||||
{
|
||||
int index;
|
||||
}
|
||||
c_attr_screen_t;
|
||||
|
||||
typedef struct c_attr_image
|
||||
{
|
||||
char *file;
|
||||
char *alpha_file;
|
||||
int image_idx;
|
||||
int alpha_idx;
|
||||
bool loaded;
|
||||
}
|
||||
c_attr_image_t;
|
||||
|
||||
typedef struct c_attr_text
|
||||
{
|
||||
char *string;
|
||||
video_layout_text_align_t align;
|
||||
}
|
||||
c_attr_text_t;
|
||||
|
||||
typedef struct c_attr_counter
|
||||
{
|
||||
int digits;
|
||||
int max_state;
|
||||
video_layout_text_align_t align;
|
||||
}
|
||||
c_attr_counter_t;
|
||||
|
||||
#endif
|
78
gfx/video_layout/element.c
Normal file
78
gfx/video_layout/element.c
Normal file
@ -0,0 +1,78 @@
|
||||
#include "element.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
void element_init(element_t *elem, const char *name, int components_count)
|
||||
{
|
||||
elem->name = init_string(name);
|
||||
elem->state = -1;
|
||||
elem->o_bind = -1;
|
||||
elem->i_bind = -1;
|
||||
elem->i_mask = -1;
|
||||
elem->i_raw = false;
|
||||
|
||||
elem->bounds = make_bounds();
|
||||
elem->render_bounds = make_bounds_unit();
|
||||
|
||||
elem->components = (component_t*)(components_count > 0 ?
|
||||
calloc(components_count, sizeof(component_t)) : NULL);
|
||||
elem->components_count = components_count;
|
||||
}
|
||||
|
||||
void element_copy(element_t *elem, const element_t *src)
|
||||
{
|
||||
int i;
|
||||
|
||||
elem->name = init_string(src->name);
|
||||
elem->state = src->state;
|
||||
|
||||
elem->bounds = src->bounds;
|
||||
elem->render_bounds = src->render_bounds;
|
||||
|
||||
elem->components = (component_t*)(src->components_count > 0 ?
|
||||
calloc(src->components_count, sizeof(component_t)) : NULL);
|
||||
|
||||
for (i = 0; i < src->components_count; ++i)
|
||||
component_copy(&elem->components[i], &src->components[i]);
|
||||
|
||||
elem->components_count = src->components_count;
|
||||
}
|
||||
|
||||
void element_deinit(element_t *elem)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < elem->components_count; ++i)
|
||||
component_deinit(&elem->components[i]);
|
||||
free(elem->components);
|
||||
|
||||
free(elem->name);
|
||||
}
|
||||
|
||||
void element_apply_orientation(element_t *elem, video_layout_orientation_t orientation)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < elem->components_count; ++i)
|
||||
{
|
||||
component_t *comp;
|
||||
comp = &elem->components[i];
|
||||
comp->orientation ^= orientation;
|
||||
|
||||
if (orientation & VIDEO_LAYOUT_SWAP_XY)
|
||||
{
|
||||
video_layout_bounds_t b;
|
||||
b = comp->bounds;
|
||||
|
||||
comp->bounds.x = b.y;
|
||||
comp->bounds.y = b.x;
|
||||
comp->bounds.w = b.h;
|
||||
comp->bounds.h = b.w;
|
||||
}
|
||||
|
||||
if (orientation & VIDEO_LAYOUT_FLIP_X)
|
||||
comp->bounds.x = 1.0f - comp->bounds.x - comp->bounds.w;
|
||||
|
||||
if (orientation & VIDEO_LAYOUT_FLIP_Y)
|
||||
comp->bounds.y = 1.0f - comp->bounds.y - comp->bounds.h;
|
||||
}
|
||||
}
|
28
gfx/video_layout/element.h
Normal file
28
gfx/video_layout/element.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef VIDEO_LAYOUT_ELEMENT_H
|
||||
#define VIDEO_LAYOUT_ELEMENT_H
|
||||
#include "internal.h"
|
||||
#include "component.h"
|
||||
|
||||
typedef struct element
|
||||
{
|
||||
char *name;
|
||||
int state;
|
||||
int o_bind;
|
||||
int i_bind;
|
||||
int i_mask;
|
||||
bool i_raw;
|
||||
|
||||
video_layout_bounds_t bounds;
|
||||
video_layout_bounds_t render_bounds;
|
||||
|
||||
component_t *components;
|
||||
int components_count;
|
||||
}
|
||||
element_t;
|
||||
|
||||
void element_init (element_t *elem, const char *name, int components_count);
|
||||
void element_copy (element_t *elem, const element_t *src);
|
||||
void element_deinit (element_t *elem);
|
||||
void element_apply_orientation (element_t *elem, video_layout_orientation_t orientation);
|
||||
|
||||
#endif
|
181
gfx/video_layout/internal.c
Normal file
181
gfx/video_layout/internal.c
Normal file
@ -0,0 +1,181 @@
|
||||
#include "internal.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <compat/posix_string.h>
|
||||
|
||||
char *init_string(const char *src)
|
||||
{
|
||||
return src ? strdup(src) : NULL;
|
||||
}
|
||||
|
||||
void set_string(char **string, const char *src)
|
||||
{
|
||||
free(*string);
|
||||
*string = src ? strdup(src) : NULL;
|
||||
}
|
||||
|
||||
bool vec_size(void **target, size_t elem_size, int count)
|
||||
{
|
||||
const int seg = 4;
|
||||
|
||||
if (--count % seg == 0)
|
||||
{
|
||||
void *resized = realloc(*target, elem_size * (count + seg));
|
||||
if (!resized)
|
||||
return false;
|
||||
*target = resized;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool is_decimal(const char *str)
|
||||
{
|
||||
float v;
|
||||
|
||||
v = 0.0f;
|
||||
sscanf(str, "%f", &v);
|
||||
return (v && v != (int)v);
|
||||
}
|
||||
|
||||
int get_int(const char *str)
|
||||
{
|
||||
int res;
|
||||
|
||||
res = 0;
|
||||
|
||||
if (str[0] == '#')
|
||||
++str;
|
||||
|
||||
if (str[0] == '$')
|
||||
{
|
||||
unsigned hex;
|
||||
|
||||
++str;
|
||||
sscanf(str, "%x", &hex);
|
||||
res = (int)hex;
|
||||
}
|
||||
else
|
||||
{
|
||||
sscanf(str, "%i", &res);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
float get_dec(const char *str)
|
||||
{
|
||||
float res;
|
||||
|
||||
res = 0.0f;
|
||||
sscanf(str, "%f", &res);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
video_layout_color_t make_color(void)
|
||||
{
|
||||
video_layout_color_t color;
|
||||
color.r = 0.0f;
|
||||
color.g = 0.0f;
|
||||
color.b = 0.0f;
|
||||
color.a = 0.0f;
|
||||
return color;
|
||||
}
|
||||
|
||||
video_layout_color_t make_color_white(void)
|
||||
{
|
||||
video_layout_color_t color;
|
||||
color.r = 1.0f;
|
||||
color.g = 1.0f;
|
||||
color.b = 1.0f;
|
||||
color.a = 1.0f;
|
||||
return color;
|
||||
}
|
||||
|
||||
video_layout_color_t make_color_v(float v)
|
||||
{
|
||||
video_layout_color_t color;
|
||||
color.r = v;
|
||||
color.g = v;
|
||||
color.b = v;
|
||||
color.a = 1.0f;
|
||||
return color;
|
||||
}
|
||||
|
||||
video_layout_color_t make_color_rgb(float r, float g, float b)
|
||||
{
|
||||
video_layout_color_t color;
|
||||
color.r = r;
|
||||
color.g = g;
|
||||
color.b = b;
|
||||
color.a = 1.0f;
|
||||
return color;
|
||||
}
|
||||
|
||||
video_layout_color_t make_color_rgba(float r, float g, float b, float a)
|
||||
{
|
||||
video_layout_color_t color;
|
||||
color.r = r;
|
||||
color.g = g;
|
||||
color.b = b;
|
||||
color.a = a;
|
||||
return color;
|
||||
}
|
||||
|
||||
void color_mod(video_layout_color_t *dst, const video_layout_color_t *src)
|
||||
{
|
||||
dst->r *= src->r;
|
||||
dst->g *= src->g;
|
||||
dst->b *= src->b;
|
||||
dst->a *= src->a;
|
||||
}
|
||||
|
||||
video_layout_bounds_t make_bounds(void)
|
||||
{
|
||||
video_layout_bounds_t bounds;
|
||||
bounds.x = 0.0f;
|
||||
bounds.y = 0.0f;
|
||||
bounds.w = 0.0f;
|
||||
bounds.h = 0.0f;
|
||||
return bounds;
|
||||
}
|
||||
|
||||
video_layout_bounds_t make_bounds_unit(void)
|
||||
{
|
||||
video_layout_bounds_t bounds;
|
||||
bounds.x = 0.0f;
|
||||
bounds.y = 0.0f;
|
||||
bounds.w = 1.0f;
|
||||
bounds.h = 1.0f;
|
||||
return bounds;
|
||||
}
|
||||
|
||||
video_layout_bounds_t bounds_union(const video_layout_bounds_t *a, const video_layout_bounds_t *b)
|
||||
{
|
||||
video_layout_bounds_t bounds;
|
||||
|
||||
if (!bounds_valid(a)) return *b;
|
||||
if (!bounds_valid(b)) return *a;
|
||||
|
||||
bounds.x = MIN(a->x, b->x);
|
||||
bounds.y = MIN(a->y, b->y);
|
||||
bounds.w = MAX(a->x + a->w, b->x + b->w) - bounds.x;
|
||||
bounds.h = MAX(a->y + a->h, b->y + b->h) - bounds.y;
|
||||
|
||||
return bounds;
|
||||
}
|
||||
|
||||
void bounds_scale(video_layout_bounds_t *dst, const video_layout_bounds_t *dim)
|
||||
{
|
||||
dst->x *= dim->w;
|
||||
dst->y *= dim->h;
|
||||
dst->w *= dim->w;
|
||||
dst->h *= dim->h;
|
||||
}
|
||||
|
||||
bool bounds_valid(const video_layout_bounds_t *bounds)
|
||||
{
|
||||
return (bounds->w > 0 && bounds->h > 0);
|
||||
}
|
29
gfx/video_layout/internal.h
Normal file
29
gfx/video_layout/internal.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef VIDEO_LAYOUT_INTERNAL_H
|
||||
#define VIDEO_LAYOUT_INTERNAL_H
|
||||
#include "types.h"
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <boolean.h>
|
||||
#include <stddef.h>
|
||||
|
||||
char *init_string (const char *src);
|
||||
void set_string (char **string, const char *src);
|
||||
bool vec_size (void **target, size_t elem_size, int count);
|
||||
|
||||
bool is_decimal (const char *str);
|
||||
int get_int (const char *str);
|
||||
float get_dec (const char *str);
|
||||
|
||||
video_layout_color_t make_color (void);
|
||||
video_layout_color_t make_color_white (void);
|
||||
video_layout_color_t make_color_v (float v);
|
||||
video_layout_color_t make_color_rgb (float r, float g, float b);
|
||||
video_layout_color_t make_color_rgba (float r, float g, float b, float a);
|
||||
void color_mod (video_layout_color_t *dst, const video_layout_color_t *src);
|
||||
|
||||
video_layout_bounds_t make_bounds (void);
|
||||
video_layout_bounds_t make_bounds_unit (void);
|
||||
video_layout_bounds_t bounds_union (const video_layout_bounds_t *a, const video_layout_bounds_t *b);
|
||||
void bounds_scale (video_layout_bounds_t *dst, const video_layout_bounds_t *dim);
|
||||
bool bounds_valid (const video_layout_bounds_t *bounds);
|
||||
|
||||
#endif
|
762
gfx/video_layout/load.c
Normal file
762
gfx/video_layout/load.c
Normal file
@ -0,0 +1,762 @@
|
||||
#include "internal.h"
|
||||
#include "view.h"
|
||||
#include "scope.h"
|
||||
#include <formats/rxml.h>
|
||||
#include <verbosity.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int video_layout_io_find(const char *name);
|
||||
|
||||
static const char *const comp_type_str[] = {
|
||||
NULL, /* VIDEO_LAYOUT_C_UNKNOWN */
|
||||
NULL, /* VIDEO_LAYOUT_C_SCREEN */
|
||||
"rect",
|
||||
"disk",
|
||||
"image",
|
||||
"text",
|
||||
"dotmatrixdot",
|
||||
"dotmatrix5dot",
|
||||
"dotmatrix",
|
||||
"led7seg",
|
||||
"led8seg_gts1",
|
||||
"led14seg",
|
||||
"led14segsc",
|
||||
"led16seg",
|
||||
"led16segsc",
|
||||
"simplecounter",
|
||||
"reel"
|
||||
};
|
||||
|
||||
static const char *const video_layout_internal_device_params[] =
|
||||
{
|
||||
"devicetag" , ":",
|
||||
"devicebasetag" , "root",
|
||||
"devicename" , "RetroArch",
|
||||
"deviceshortname" , "libretro"
|
||||
};
|
||||
|
||||
static const char *const video_layout_internal_screen_params[] =
|
||||
{
|
||||
"scr#physicalxaspect" , "1",
|
||||
"scr#physicalyaspect" , "1",
|
||||
"scr#nativexaspect" , "1",
|
||||
"scr#nativeyaspect" , "1",
|
||||
"scr#width" , "1",
|
||||
"scr#height" , "1"
|
||||
};
|
||||
|
||||
static int child_count(rxml_node_t *node)
|
||||
{
|
||||
int res;
|
||||
rxml_node_t *child;
|
||||
|
||||
res = 0;
|
||||
|
||||
for (child = node->children; child; child = child->next)
|
||||
++res;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static comp_type_t comp_type_from_str(const char *s)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 2; i < ARRAY_SIZE(comp_type_str); ++i)
|
||||
{
|
||||
if (strcmp(s, comp_type_str[i]) == 0)
|
||||
return (comp_type_t)(int)i;
|
||||
}
|
||||
|
||||
return VIDEO_LAYOUT_C_UNKNOWN;
|
||||
}
|
||||
|
||||
static void init_device_params(scope_t *scope)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(video_layout_internal_device_params); i += 2)
|
||||
{
|
||||
scope_param(scope, video_layout_internal_device_params[i], video_layout_internal_device_params[i + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
static void init_screen_params(scope_t *scope, int screen_index)
|
||||
{
|
||||
char buf[64];
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(video_layout_internal_screen_params); i += 2)
|
||||
{
|
||||
strcpy(buf, video_layout_internal_screen_params[i + 1]);
|
||||
buf[3] = '0' + screen_index;
|
||||
|
||||
scope_param(scope, video_layout_internal_screen_params[i], buf);
|
||||
}
|
||||
}
|
||||
|
||||
static video_layout_bounds_t parse_bounds(scope_t *scope, rxml_node_t *node)
|
||||
{
|
||||
video_layout_bounds_t bounds;
|
||||
const char *prop;
|
||||
|
||||
bounds = make_bounds_unit();
|
||||
|
||||
if ((prop = scope_eval(scope, rxml_node_attrib(node, "x")))) bounds.x = get_dec(prop);
|
||||
if ((prop = scope_eval(scope, rxml_node_attrib(node, "y")))) bounds.y = get_dec(prop);
|
||||
if ((prop = scope_eval(scope, rxml_node_attrib(node, "width")))) bounds.w = get_dec(prop);
|
||||
if ((prop = scope_eval(scope, rxml_node_attrib(node, "height")))) bounds.h = get_dec(prop);
|
||||
|
||||
if ((prop = scope_eval(scope, rxml_node_attrib(node, "left")))) bounds.x = get_dec(prop);
|
||||
if ((prop = scope_eval(scope, rxml_node_attrib(node, "top")))) bounds.y = get_dec(prop);
|
||||
if ((prop = scope_eval(scope, rxml_node_attrib(node, "right")))) bounds.w = get_dec(prop) - bounds.x;
|
||||
if ((prop = scope_eval(scope, rxml_node_attrib(node, "bottom")))) bounds.h = get_dec(prop) - bounds.y;
|
||||
|
||||
return bounds;
|
||||
}
|
||||
|
||||
static video_layout_color_t parse_color(scope_t *scope, rxml_node_t *node)
|
||||
{
|
||||
video_layout_color_t color;
|
||||
const char *prop;
|
||||
|
||||
color = make_color_white();
|
||||
|
||||
if ((prop = scope_eval(scope, rxml_node_attrib(node, "red")))) color.r = get_dec(prop);
|
||||
if ((prop = scope_eval(scope, rxml_node_attrib(node, "green")))) color.g = get_dec(prop);
|
||||
if ((prop = scope_eval(scope, rxml_node_attrib(node, "blue")))) color.b = get_dec(prop);
|
||||
if ((prop = scope_eval(scope, rxml_node_attrib(node, "alpha")))) color.a = get_dec(prop);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
static video_layout_orientation_t parse_orientation(scope_t *scope, rxml_node_t *node)
|
||||
{
|
||||
video_layout_orientation_t result;
|
||||
const char *prop;
|
||||
|
||||
result = VIDEO_LAYOUT_ROT0;
|
||||
|
||||
if ((prop = scope_eval(scope, rxml_node_attrib(node, "rotate"))))
|
||||
{
|
||||
if (strcmp(prop, "90") == 0)
|
||||
result = VIDEO_LAYOUT_ROT90;
|
||||
|
||||
else if (strcmp(prop, "180") == 0)
|
||||
result = VIDEO_LAYOUT_ROT180;
|
||||
|
||||
else if (strcmp(prop, "270") == 0)
|
||||
result = VIDEO_LAYOUT_ROT270;
|
||||
}
|
||||
|
||||
if ((prop = scope_eval(scope, rxml_node_attrib(node, "swapxy"))))
|
||||
{
|
||||
if (strcmp(prop, "no") != 0)
|
||||
result ^= VIDEO_LAYOUT_SWAP_XY;
|
||||
}
|
||||
|
||||
if ((prop = scope_eval(scope, rxml_node_attrib(node, "flipx"))))
|
||||
{
|
||||
if (strcmp(prop, "no") != 0)
|
||||
result ^= VIDEO_LAYOUT_FLIP_X;
|
||||
}
|
||||
|
||||
if ((prop = scope_eval(scope, rxml_node_attrib(node, "flipy"))))
|
||||
{
|
||||
if (strcmp(prop, "no") != 0)
|
||||
result ^= VIDEO_LAYOUT_FLIP_Y;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool load_param(scope_t *scope, rxml_node_t *node, bool can_repeat)
|
||||
{
|
||||
const char *name;
|
||||
const char *value;
|
||||
const char *start;
|
||||
|
||||
if (!(name = rxml_node_attrib(node, "name")))
|
||||
{
|
||||
RARCH_LOG("video_layout: <param> is missing 'name' attribute\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
value = rxml_node_attrib(node, "value");
|
||||
start = rxml_node_attrib(node, "start");
|
||||
|
||||
if (can_repeat && start)
|
||||
{
|
||||
const char *inc = rxml_node_attrib(node, "increment");
|
||||
const char *ls = rxml_node_attrib(node, "lshift");
|
||||
const char *rs = rxml_node_attrib(node, "rshift");
|
||||
|
||||
if (inc || ls || rs)
|
||||
{
|
||||
scope_generator(scope, name, start, inc, ls, rs);
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_LOG("video_layout: invalid generator <param name=\"%s\" /> missing increment/shift\n",
|
||||
scope_eval(scope, name));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (name && value)
|
||||
{
|
||||
scope_param(scope, name, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_LOG("video_layout: invalid parameter <param name=\"%s\" /> missing value\n",
|
||||
scope_eval(scope, name));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool load_component(scope_t *scope, component_t *comp, rxml_node_t *node)
|
||||
{
|
||||
comp_type_t type;
|
||||
bool result;
|
||||
const char *state;
|
||||
const char *attr;
|
||||
rxml_node_t *n;
|
||||
|
||||
type = comp_type_from_str(node->name);
|
||||
result = true;
|
||||
|
||||
if (type == VIDEO_LAYOUT_C_UNKNOWN)
|
||||
{
|
||||
RARCH_LOG("video_layout: invalid component <%s />\n", node->name);
|
||||
return false;
|
||||
}
|
||||
|
||||
component_init(comp, type);
|
||||
|
||||
if ((state = rxml_node_attrib(node, "state")))
|
||||
comp->enabled_state = get_int(scope_eval(scope, state));
|
||||
|
||||
for (n = node->children; n; n = n->next)
|
||||
{
|
||||
if (strcmp(n->name, "bounds") == 0)
|
||||
comp->bounds = parse_bounds(scope, n);
|
||||
|
||||
else if (strcmp(n->name, "color") == 0)
|
||||
comp->color = parse_color(scope, n);
|
||||
}
|
||||
|
||||
switch (comp->type)
|
||||
{
|
||||
case VIDEO_LAYOUT_C_UNKNOWN:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_SCREEN:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_RECT:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DISK:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_IMAGE:
|
||||
{
|
||||
if (!(attr = rxml_node_attrib(node, "file")))
|
||||
{
|
||||
RARCH_LOG("video_layout: invalid component <%s />, missing 'file' attribute\n", node->name);
|
||||
result = false;
|
||||
}
|
||||
set_string(&comp->attr.image.file, scope_eval(scope, attr));
|
||||
|
||||
if ((attr = rxml_node_attrib(node, "alphafile")))
|
||||
set_string(&comp->attr.image.alpha_file, scope_eval(scope, attr));
|
||||
}
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_TEXT:
|
||||
{
|
||||
if (!(attr = rxml_node_attrib(node, "string")))
|
||||
{
|
||||
RARCH_LOG("video_layout: invalid component <%s />, missing 'string' attribute\n", node->name);
|
||||
result = false;
|
||||
}
|
||||
set_string(&comp->attr.text.string, scope_eval(scope, attr));
|
||||
|
||||
if ((attr = rxml_node_attrib(node, "align")))
|
||||
comp->attr.text.align = (video_layout_text_align_t)get_int(scope_eval(scope, attr));
|
||||
}
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_COUNTER:
|
||||
{
|
||||
if ((attr = rxml_node_attrib(node, "digits")))
|
||||
comp->attr.counter.digits = get_int(scope_eval(scope, attr));
|
||||
|
||||
if ((attr = rxml_node_attrib(node, "maxstate")))
|
||||
comp->attr.counter.max_state = get_int(scope_eval(scope, attr));
|
||||
|
||||
if ((attr = rxml_node_attrib(node, "align")))
|
||||
comp->attr.counter.align = (video_layout_text_align_t)get_int(scope_eval(scope, attr));
|
||||
}
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DOTMATRIX_X1:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DOTMATRIX_H5:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_DOTMATRIX_H8:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_7:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_8_GTS1:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_14:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_14_SC:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_16:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_LED_16_SC:
|
||||
break;
|
||||
case VIDEO_LAYOUT_C_REEL:
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool load_element(scope_t *scope, rxml_node_t *node)
|
||||
{
|
||||
const char *name;
|
||||
const char *state;
|
||||
bool result;
|
||||
int i;
|
||||
element_t *elem;
|
||||
rxml_node_t *n;
|
||||
video_layout_bounds_t dim;
|
||||
|
||||
result = true;
|
||||
|
||||
if (!(name = rxml_node_attrib(node, "name")))
|
||||
{
|
||||
RARCH_LOG("video_layout: <element> is missing 'name' attribute\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
elem = scope_add_element(scope);
|
||||
element_init(elem, scope_eval(scope, name), child_count(node));
|
||||
|
||||
if ((state = rxml_node_attrib(node, "defstate")))
|
||||
elem->state = get_int(scope_eval(scope, state));
|
||||
|
||||
i = 0;
|
||||
for (n = node->children; n; n = n->next, ++i)
|
||||
{
|
||||
component_t *comp;
|
||||
comp = &elem->components[i];
|
||||
|
||||
if (load_component(scope, comp, n))
|
||||
elem->bounds = bounds_union(&elem->bounds, &comp->bounds);
|
||||
else
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (bounds_valid(&elem->bounds))
|
||||
{
|
||||
dim.x = elem->bounds.x / elem->bounds.w;
|
||||
dim.y = elem->bounds.y / elem->bounds.h;
|
||||
dim.w = 1.0f / elem->bounds.w;
|
||||
dim.h = 1.0f / elem->bounds.h;
|
||||
}
|
||||
else
|
||||
{
|
||||
dim = make_bounds_unit();
|
||||
}
|
||||
|
||||
for (i = 0; i < elem->components_count; ++i)
|
||||
{
|
||||
component_t *comp;
|
||||
comp = &elem->components[i];
|
||||
|
||||
if (bounds_valid(&comp->bounds))
|
||||
bounds_scale(&comp->bounds, &dim);
|
||||
else
|
||||
comp->bounds = dim;
|
||||
|
||||
comp->bounds.x -= dim.x;
|
||||
comp->bounds.y -= dim.y;
|
||||
}
|
||||
|
||||
elem->bounds = make_bounds_unit();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool load_screen(scope_t *scope, element_t *elem, rxml_node_t *node)
|
||||
{
|
||||
const char *index;
|
||||
component_t *comp;
|
||||
|
||||
index = rxml_node_attrib(node, "index");
|
||||
|
||||
element_init(elem, NULL, 1);
|
||||
comp = &elem->components[0];
|
||||
|
||||
component_init(comp, VIDEO_LAYOUT_C_SCREEN);
|
||||
comp->bounds = make_bounds_unit();
|
||||
comp->attr.screen.index = get_int(scope_eval(scope, index));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void merge_group(scope_t *scope, view_t *view, view_t *group,
|
||||
bool has_bounds, video_layout_bounds_t n_bounds, video_layout_orientation_t n_orient, video_layout_color_t n_color)
|
||||
{
|
||||
bool constrain;
|
||||
int i, j, k;
|
||||
|
||||
constrain = bounds_valid(&n_bounds);
|
||||
|
||||
for (i = 0; i < group->layers_count; ++i)
|
||||
{
|
||||
layer_t *group_layer;
|
||||
layer_t *layer;
|
||||
|
||||
group_layer = &group->layers[i];
|
||||
layer = view_emplace_layer(view, group_layer->name);
|
||||
|
||||
for (j = 0; j < group_layer->elements_count; ++j)
|
||||
{
|
||||
element_t *elem;
|
||||
elem = layer_add_element(layer);
|
||||
|
||||
element_copy(elem, &group_layer->elements[j]);
|
||||
|
||||
for (k = 0; k < elem->components_count; ++k)
|
||||
color_mod(&elem->components->color, &n_color);
|
||||
|
||||
if (n_orient)
|
||||
element_apply_orientation(elem, n_orient);
|
||||
|
||||
if (constrain)
|
||||
{
|
||||
bounds_scale(&elem->bounds, &n_bounds);
|
||||
elem->bounds.x += n_bounds.x;
|
||||
elem->bounds.y += n_bounds.y;
|
||||
}
|
||||
|
||||
if (!has_bounds)
|
||||
view->bounds = bounds_union(&view->bounds, &elem->bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool load_view(scope_t *scope, view_t *view, rxml_node_t *node, bool is_named)
|
||||
{
|
||||
bool result, has_bounds;
|
||||
rxml_node_t *n;
|
||||
rxml_node_t *o;
|
||||
int i;
|
||||
|
||||
if (is_named)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
if (!(name = rxml_node_attrib(node, "name")))
|
||||
{
|
||||
RARCH_LOG("video_layout: <view> is missing 'name' attribute\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
view_init(view, scope_eval(scope, name));
|
||||
}
|
||||
|
||||
result = true;
|
||||
has_bounds = false;
|
||||
|
||||
for (n = node->children; n; n = n->next)
|
||||
{
|
||||
video_layout_color_t n_color;
|
||||
video_layout_bounds_t n_bounds;
|
||||
video_layout_orientation_t n_orient;
|
||||
|
||||
if (strcmp(n->name, "param") == 0)
|
||||
{
|
||||
if (!load_param(scope, n, true))
|
||||
result = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
else if (strcmp(n->name, "bounds") == 0)
|
||||
{
|
||||
view->bounds = parse_bounds(scope, n);
|
||||
has_bounds = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
n_color = make_color_white();
|
||||
n_bounds = make_bounds();
|
||||
n_orient = VIDEO_LAYOUT_ROT0;
|
||||
|
||||
for (o = n->children; o; o = o->next)
|
||||
{
|
||||
if (strcmp(o->name, "color") == 0)
|
||||
n_color = parse_color(scope, o);
|
||||
|
||||
else if (strcmp(o->name, "bounds") == 0)
|
||||
n_bounds = parse_bounds(scope, o);
|
||||
|
||||
else if (strcmp(o->name, "orientation") == 0)
|
||||
n_orient = parse_orientation(scope, o);
|
||||
}
|
||||
|
||||
if (strcmp(n->name, "group") == 0)
|
||||
{
|
||||
const char *ref;
|
||||
if ((ref = rxml_node_attrib(n, "ref")))
|
||||
{
|
||||
view_t *group;
|
||||
if ((group = scope_find_group(scope, scope_eval(scope, ref))))
|
||||
{
|
||||
merge_group(scope, view, group, has_bounds, n_bounds, n_orient, n_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_LOG("video_layout: group \"%s\" is missing\n", scope_eval(scope, ref));
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_LOG("video_layout: <group> is missing 'ref' attribute\n");
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
else if (strcmp(n->name, "repeat") == 0)
|
||||
{
|
||||
const char *count_s;
|
||||
int count;
|
||||
|
||||
if (!(count_s = rxml_node_attrib(n, "count")))
|
||||
{
|
||||
RARCH_LOG("video_layout: <repeat> is missing 'count' attribute\n");
|
||||
result = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
count = get_int(scope_eval(scope, count_s));
|
||||
|
||||
scope_push(scope);
|
||||
|
||||
for (o = n->children; o; o = o->next)
|
||||
{
|
||||
if (strcmp(o->name, "param") == 0)
|
||||
{
|
||||
if (!load_param(scope, o, true))
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
view_t rep;
|
||||
view_init(&rep, NULL);
|
||||
|
||||
if (!load_view(scope, &rep, n, false))
|
||||
result = false;
|
||||
|
||||
merge_group(scope, view, &rep, has_bounds, n_bounds, n_orient, n_color);
|
||||
|
||||
view_deinit(&rep);
|
||||
|
||||
scope_repeat(scope);
|
||||
}
|
||||
|
||||
scope_pop(scope);
|
||||
}
|
||||
|
||||
else /* element */
|
||||
{
|
||||
layer_t *layer;
|
||||
element_t *elem;
|
||||
|
||||
layer = view_emplace_layer(view, n->name);
|
||||
elem = layer_add_element(layer);
|
||||
|
||||
if (strcmp(n->name, "screen") == 0)
|
||||
{
|
||||
if (!load_screen(scope, elem, n))
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *elem_name;
|
||||
const char *attr;
|
||||
|
||||
if ((elem_name = rxml_node_attrib(n, "element")))
|
||||
{
|
||||
element_t *elem_src;
|
||||
if ((elem_src = scope_find_element(scope, elem_name)))
|
||||
{
|
||||
element_copy(elem, elem_src);
|
||||
|
||||
if ((attr = rxml_node_attrib(n, "name")))
|
||||
elem->o_bind = video_layout_io_find(scope_eval(scope, attr));
|
||||
|
||||
if ((attr = rxml_node_attrib(n, "inputtag")))
|
||||
elem->i_bind = video_layout_io_find(scope_eval(scope, attr));
|
||||
|
||||
if ((attr = rxml_node_attrib(n, "inputmask")))
|
||||
elem->i_mask = get_int(scope_eval(scope, attr));
|
||||
|
||||
if ((attr = rxml_node_attrib(n, "inputraw")))
|
||||
elem->i_raw = get_int(scope_eval(scope, attr)) ? true : false;
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_LOG("video_layout: element \"%s\" is missing\n", scope_eval(scope, elem_name));
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_LOG("video_layout: <%s> is missing 'element' attribute\n", n->name);
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < elem->components_count; ++i)
|
||||
color_mod(&elem->components->color, &n_color);
|
||||
|
||||
elem->bounds = n_bounds;
|
||||
|
||||
if (n_orient)
|
||||
element_apply_orientation(elem, n_orient);
|
||||
|
||||
if (!has_bounds)
|
||||
view->bounds = bounds_union(&view->bounds, &elem->bounds);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool load_group(scope_t *scope, rxml_node_t *node)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
view_t *group = scope_add_group(scope);
|
||||
|
||||
scope_push(scope);
|
||||
|
||||
if (!load_view(scope, group, node, true))
|
||||
result = false;
|
||||
|
||||
scope_pop(scope);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool load_top_level(scope_t *scope, int *view_count, rxml_node_t *root)
|
||||
{
|
||||
bool result;
|
||||
rxml_node_t *node;
|
||||
|
||||
result = true;
|
||||
*view_count = 0;
|
||||
|
||||
for (node = root->children; node; node = node->next)
|
||||
{
|
||||
if (strcmp(node->name, "param") == 0)
|
||||
{
|
||||
if (!load_param(scope, node, false))
|
||||
result = false;
|
||||
}
|
||||
|
||||
else if (strcmp(node->name, "element") == 0)
|
||||
{
|
||||
if (!load_element(scope, node))
|
||||
result = false;
|
||||
}
|
||||
|
||||
else if (strcmp(node->name, "group") == 0)
|
||||
{
|
||||
if (!load_group(scope, node))
|
||||
result = false;
|
||||
}
|
||||
|
||||
else if (strcmp(node->name, "view") == 0)
|
||||
++(*view_count);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool load_views(scope_t *scope, view_array_t *view_array, rxml_node_t *root)
|
||||
{
|
||||
bool result;
|
||||
int i;
|
||||
rxml_node_t *node;
|
||||
|
||||
result = true;
|
||||
i = 0;
|
||||
|
||||
for (node = root->children; node; node = node->next)
|
||||
{
|
||||
if (strcmp(node->name, "view") == 0)
|
||||
{
|
||||
view_t *view;
|
||||
view = &view_array->views[i];
|
||||
|
||||
scope_push(scope);
|
||||
|
||||
if (!load_view(scope, view, node, true))
|
||||
result = false;
|
||||
|
||||
view_sort_layers(view);
|
||||
view_normalize(view);
|
||||
view_count_screens(view);
|
||||
|
||||
scope_pop(scope);
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool load(view_array_t *view_array, rxml_document_t *doc)
|
||||
{
|
||||
bool result;
|
||||
rxml_node_t *root;
|
||||
scope_t scope;
|
||||
int view_count;
|
||||
|
||||
root = rxml_root_node(doc);
|
||||
|
||||
if (strcmp(root->name, "mamelayout") ||
|
||||
strcmp(rxml_node_attrib(root, "version"), "2"))
|
||||
{
|
||||
RARCH_LOG("video_layout: invalid MAME Layout file\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
result = false;
|
||||
|
||||
scope_init(&scope);
|
||||
init_device_params(&scope);
|
||||
init_screen_params(&scope, 0);
|
||||
init_screen_params(&scope, 1);
|
||||
|
||||
if (!load_top_level(&scope, &view_count, root))
|
||||
result = false;
|
||||
|
||||
view_array_init(view_array, view_count);
|
||||
|
||||
if (!load_views(&scope, view_array, root))
|
||||
result = false;
|
||||
|
||||
scope_deinit(&scope);
|
||||
|
||||
return result;
|
||||
}
|
339
gfx/video_layout/scope.c
Normal file
339
gfx/video_layout/scope.c
Normal file
@ -0,0 +1,339 @@
|
||||
#include "scope.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
union number
|
||||
{
|
||||
int val_int;
|
||||
float val_dec;
|
||||
};
|
||||
|
||||
typedef struct generator
|
||||
{
|
||||
bool is_decimal;
|
||||
union number value;
|
||||
union number increment;
|
||||
int shift;
|
||||
}
|
||||
generator_t;
|
||||
|
||||
struct param
|
||||
{
|
||||
char *name;
|
||||
char *value;
|
||||
generator_t *generator;
|
||||
param_t *prev;
|
||||
int level;
|
||||
};
|
||||
|
||||
static void param_deinit(param_t *param)
|
||||
{
|
||||
free(param->generator);
|
||||
free(param->value);
|
||||
free(param->name);
|
||||
}
|
||||
|
||||
static param_t *param_find(scope_t *scope, const char *name, int level)
|
||||
{
|
||||
param_t *param;
|
||||
param = scope->param;
|
||||
|
||||
while (param && param->level >= level)
|
||||
{
|
||||
if (strcmp(param->name, name) == 0)
|
||||
{
|
||||
return param;
|
||||
}
|
||||
param = param->prev;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void scope_init(scope_t *scope)
|
||||
{
|
||||
scope->level = 0;
|
||||
|
||||
scope->param = NULL;
|
||||
|
||||
scope->elements = NULL;
|
||||
scope->elements_count = 0;
|
||||
|
||||
scope->groups = NULL;
|
||||
scope->groups_count = 0;
|
||||
}
|
||||
|
||||
void scope_deinit(scope_t *scope)
|
||||
{
|
||||
int i;
|
||||
param_t *param;
|
||||
param_t *prev;
|
||||
|
||||
for (i = 0; i < scope->elements_count; ++i)
|
||||
element_deinit(&scope->elements[i]);
|
||||
free(scope->elements);
|
||||
|
||||
for (i = 0; i < scope->groups_count; ++i)
|
||||
view_deinit(&scope->groups[i]);
|
||||
free(scope->groups);
|
||||
|
||||
for (param = scope->param; param; param = prev)
|
||||
{
|
||||
prev = param->prev;
|
||||
param_deinit(param);
|
||||
free(param);
|
||||
}
|
||||
}
|
||||
|
||||
void scope_push(scope_t *scope)
|
||||
{
|
||||
++scope->level;
|
||||
}
|
||||
|
||||
void scope_pop(scope_t *scope)
|
||||
{
|
||||
param_t *param;
|
||||
|
||||
--scope->level;
|
||||
|
||||
while ((param = scope->param))
|
||||
{
|
||||
if (param->level <= scope->level)
|
||||
break;
|
||||
|
||||
scope->param = param->prev;
|
||||
param_deinit(param);
|
||||
free(param);
|
||||
}
|
||||
}
|
||||
|
||||
void scope_repeat(scope_t *scope)
|
||||
{
|
||||
param_t *param;
|
||||
|
||||
for (param = scope->param; param && param->level >= scope->level; param = param->prev)
|
||||
{
|
||||
generator_t *gen;
|
||||
if ((gen = param->generator))
|
||||
{
|
||||
char tmp[SCOPE_BUFFER_SIZE];
|
||||
tmp[0] = '\0';
|
||||
|
||||
if (gen->is_decimal)
|
||||
{
|
||||
gen->value.val_dec += gen->increment.val_dec;
|
||||
if (gen->shift > 0)
|
||||
gen->value.val_dec = (float)((int)gen->value.val_dec << gen->shift);
|
||||
else if (gen->shift < 0)
|
||||
gen->value.val_dec = (float)((int)gen->value.val_dec >> -gen->shift);
|
||||
sprintf(tmp, "%f", gen->value.val_dec);
|
||||
}
|
||||
else
|
||||
{
|
||||
gen->value.val_int += gen->increment.val_int;
|
||||
if(gen->shift > 0)
|
||||
gen->value.val_int <<= gen->shift;
|
||||
else if (gen->shift < 0)
|
||||
gen->value.val_int >>= -gen->shift;
|
||||
sprintf(tmp, "%d", gen->value.val_int);
|
||||
}
|
||||
|
||||
set_string(¶m->value, tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void scope_param(scope_t *scope, const char *name, const char *value)
|
||||
{
|
||||
char *eval_name;
|
||||
char *eval_value;
|
||||
param_t *param;
|
||||
|
||||
eval_name = init_string(scope_eval(scope, name));
|
||||
eval_value = init_string(scope_eval(scope, value));
|
||||
|
||||
if ((param = param_find(scope, eval_name, scope->level)))
|
||||
{
|
||||
free(param->value);
|
||||
param->value = eval_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
param = (param_t*)malloc(sizeof(param_t));
|
||||
param->name = init_string(name);
|
||||
param->value = eval_value;
|
||||
param->generator = NULL;
|
||||
param->level = scope->level;
|
||||
param->prev = scope->param;
|
||||
scope->param = param;
|
||||
}
|
||||
|
||||
free(eval_name);
|
||||
}
|
||||
|
||||
void scope_generator(scope_t *scope, const char *name, const char *start, const char *increment, const char *lshift, const char *rshift)
|
||||
{
|
||||
char *e_name;
|
||||
char *e_val;
|
||||
char *e_inc;
|
||||
generator_t *gen;
|
||||
param_t *param;
|
||||
|
||||
e_name = init_string(scope_eval(scope, name));
|
||||
|
||||
if (param_find(scope, e_name, scope->level))
|
||||
{
|
||||
free(e_name);
|
||||
return;
|
||||
}
|
||||
|
||||
e_val = init_string(scope_eval(scope, start));
|
||||
e_inc = init_string(scope_eval(scope, increment));
|
||||
|
||||
gen = (generator_t*)malloc(sizeof(generator_t));
|
||||
|
||||
param = (param_t*)malloc(sizeof(param_t));
|
||||
param->name = init_string(e_name);
|
||||
param->value = init_string(e_val);
|
||||
param->generator = gen;
|
||||
param->level = scope->level;
|
||||
param->prev = scope->param;
|
||||
scope->param = param;
|
||||
|
||||
gen->is_decimal = is_decimal(e_val) | is_decimal(e_inc);
|
||||
|
||||
if (gen->is_decimal)
|
||||
{
|
||||
gen->value.val_dec = get_dec(e_val);
|
||||
gen->increment.val_dec = get_dec(e_inc);
|
||||
}
|
||||
else
|
||||
{
|
||||
gen->value.val_int = get_int(e_val);
|
||||
gen->increment.val_int = get_int(e_inc);
|
||||
}
|
||||
|
||||
gen->shift = 0;
|
||||
|
||||
if (lshift)
|
||||
gen->shift += get_int(scope_eval(scope, lshift));
|
||||
|
||||
if (rshift)
|
||||
gen->shift -= get_int(scope_eval(scope, rshift));
|
||||
|
||||
free(e_inc);
|
||||
free(e_val);
|
||||
free(e_name);
|
||||
}
|
||||
|
||||
const char *scope_eval(scope_t *scope, const char *src)
|
||||
{
|
||||
const char* next;
|
||||
bool in_var;
|
||||
|
||||
char tmp[SCOPE_BUFFER_SIZE];
|
||||
|
||||
if (!src)
|
||||
return NULL;
|
||||
|
||||
scope->eval[0] = '\0';
|
||||
next = src;
|
||||
|
||||
while (next[0] != '\0')
|
||||
{
|
||||
const char* cur;
|
||||
cur = next;
|
||||
|
||||
if ((in_var = (next[0] == '~')))
|
||||
++cur;
|
||||
|
||||
next = strchr(cur, '~');
|
||||
|
||||
if (next && next != cur)
|
||||
{
|
||||
size_t len;
|
||||
len = next - cur;
|
||||
|
||||
if (in_var)
|
||||
{
|
||||
param_t *param;
|
||||
|
||||
strncpy(tmp, cur, len);
|
||||
tmp[len] = '\0';
|
||||
|
||||
if ((param = param_find(scope, tmp, 0)))
|
||||
strcat(scope->eval, param->value);
|
||||
else
|
||||
strcat(scope->eval, tmp);
|
||||
|
||||
++next;
|
||||
}
|
||||
else
|
||||
{
|
||||
strncat(scope->eval, cur, len);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (in_var)
|
||||
--cur;
|
||||
strcat(scope->eval, cur);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return scope->eval;
|
||||
}
|
||||
|
||||
element_t *scope_add_element(scope_t *scope)
|
||||
{
|
||||
element_t *elem;
|
||||
|
||||
vec_size((void**)&scope->elements, sizeof(element_t), ++scope->elements_count);
|
||||
|
||||
elem = &scope->elements[scope->elements_count - 1];
|
||||
element_init(elem, NULL, 0);
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
element_t *scope_find_element(scope_t *scope, const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < scope->elements_count; ++i)
|
||||
{
|
||||
if (strcmp(name, scope->elements[i].name) == 0)
|
||||
return &scope->elements[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
view_t *scope_add_group(scope_t *scope)
|
||||
{
|
||||
view_t *group;
|
||||
|
||||
vec_size((void**)&scope->groups, sizeof(view_t), ++scope->groups_count);
|
||||
|
||||
group = &scope->groups[scope->groups_count - 1];
|
||||
view_init(group, NULL);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
view_t *scope_find_group(scope_t *scope, const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < scope->groups_count; ++i)
|
||||
{
|
||||
if (strcmp(name, scope->groups[i].name) == 0)
|
||||
return &scope->groups[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
42
gfx/video_layout/scope.h
Normal file
42
gfx/video_layout/scope.h
Normal file
@ -0,0 +1,42 @@
|
||||
#ifndef VIDEO_LAYOUT_SCOPE_H
|
||||
#define VIDEO_LAYOUT_SCOPE_H
|
||||
#include "view.h"
|
||||
#include "element.h"
|
||||
|
||||
#define SCOPE_BUFFER_SIZE 256
|
||||
|
||||
typedef struct param param_t;
|
||||
|
||||
typedef struct scope
|
||||
{
|
||||
int level;
|
||||
|
||||
param_t *param;
|
||||
|
||||
element_t *elements;
|
||||
int elements_count;
|
||||
|
||||
view_t *groups;
|
||||
int groups_count;
|
||||
|
||||
char eval[SCOPE_BUFFER_SIZE];
|
||||
}
|
||||
scope_t;
|
||||
|
||||
void scope_init (scope_t *scope);
|
||||
void scope_deinit (scope_t *scope);
|
||||
void scope_push (scope_t *scope);
|
||||
void scope_pop (scope_t *scope);
|
||||
void scope_repeat (scope_t *scope);
|
||||
|
||||
void scope_param (scope_t *scope, const char *name, const char *value);
|
||||
void scope_generator (scope_t *scope, const char *name, const char *start, const char *increment, const char *lshift, const char *rshift);
|
||||
const char *scope_eval (scope_t *scope, const char *src);
|
||||
|
||||
element_t *scope_add_element (scope_t *scope);
|
||||
element_t *scope_find_element (scope_t *scope, const char *name);
|
||||
|
||||
view_t *scope_add_group (scope_t *scope);
|
||||
view_t *scope_find_group (scope_t *scope, const char *name);
|
||||
|
||||
#endif
|
49
gfx/video_layout/types.h
Normal file
49
gfx/video_layout/types.h
Normal file
@ -0,0 +1,49 @@
|
||||
#ifndef VIDEO_LAYOUT_TYPES_H
|
||||
#define VIDEO_LAYOUT_TYPES_H
|
||||
|
||||
typedef unsigned char video_layout_orientation_t;
|
||||
|
||||
#define VIDEO_LAYOUT_FLIP_X 1
|
||||
#define VIDEO_LAYOUT_FLIP_Y 2
|
||||
#define VIDEO_LAYOUT_SWAP_XY 4
|
||||
|
||||
#define VIDEO_LAYOUT_ROT0 0
|
||||
#define VIDEO_LAYOUT_ROT90 VIDEO_LAYOUT_SWAP_XY | VIDEO_LAYOUT_FLIP_X
|
||||
#define VIDEO_LAYOUT_ROT180 VIDEO_LAYOUT_FLIP_X | VIDEO_LAYOUT_FLIP_Y
|
||||
#define VIDEO_LAYOUT_ROT270 VIDEO_LAYOUT_SWAP_XY | VIDEO_LAYOUT_FLIP_Y
|
||||
|
||||
typedef enum video_layout_blend
|
||||
{
|
||||
VIDEO_LAYOUT_BLEND_ALPHA,
|
||||
VIDEO_LAYOUT_BLEND_ADD,
|
||||
VIDEO_LAYOUT_BLEND_MOD
|
||||
}
|
||||
video_layout_blend_t;
|
||||
|
||||
typedef enum video_layout_text_align
|
||||
{
|
||||
VIDEO_LAYOUT_TEXT_ALIGN_CENTER,
|
||||
VIDEO_LAYOUT_TEXT_ALIGN_LEFT,
|
||||
VIDEO_LAYOUT_TEXT_ALIGN_RIGHT
|
||||
}
|
||||
video_layout_text_align_t;
|
||||
|
||||
typedef struct video_layout_color
|
||||
{
|
||||
float r;
|
||||
float g;
|
||||
float b;
|
||||
float a;
|
||||
}
|
||||
video_layout_color_t;
|
||||
|
||||
typedef struct video_layout_bounds
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float w;
|
||||
float h;
|
||||
}
|
||||
video_layout_bounds_t;
|
||||
|
||||
#endif
|
259
gfx/video_layout/view.c
Normal file
259
gfx/video_layout/view.c
Normal file
@ -0,0 +1,259 @@
|
||||
#include "view.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void layer_init(layer_t *layer, const char *name)
|
||||
{
|
||||
layer->name = init_string(name);
|
||||
layer->blend = VIDEO_LAYOUT_BLEND_ALPHA;
|
||||
layer->elements = NULL;
|
||||
layer->elements_count = 0;
|
||||
}
|
||||
|
||||
void layer_deinit(layer_t *layer)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < layer->elements_count; ++i)
|
||||
element_deinit(&layer->elements[i]);
|
||||
|
||||
free(layer->elements);
|
||||
free(layer->name);
|
||||
}
|
||||
|
||||
element_t *layer_add_element(layer_t *layer)
|
||||
{
|
||||
element_t *elem;
|
||||
|
||||
vec_size((void**)&layer->elements, sizeof(element_t), ++layer->elements_count);
|
||||
|
||||
elem = &layer->elements[layer->elements_count - 1];
|
||||
element_init(elem, NULL, 0);
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
void view_init(view_t *view, const char *name)
|
||||
{
|
||||
view->name = init_string(name);
|
||||
view->bounds = make_bounds();
|
||||
view->render_bounds = make_bounds_unit();
|
||||
view->layers = NULL;
|
||||
view->layers_count = 0;
|
||||
view->screens = NULL;
|
||||
view->screens_count = 0;
|
||||
}
|
||||
|
||||
void view_deinit(view_t *view)
|
||||
{
|
||||
int i;
|
||||
|
||||
free(view->screens);
|
||||
|
||||
for (i = 0; i < view->layers_count; ++i)
|
||||
layer_deinit(&view->layers[i]);
|
||||
|
||||
free(view->layers);
|
||||
free(view->name);
|
||||
}
|
||||
|
||||
layer_t *view_find_layer(view_t *view, const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < view->layers_count; ++i)
|
||||
{
|
||||
if (strcmp(name, view->layers[i].name) == 0)
|
||||
return &view->layers[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
layer_t *view_emplace_layer(view_t *view, const char *name)
|
||||
{
|
||||
layer_t *layer = view_find_layer(view, name);
|
||||
|
||||
if (!layer)
|
||||
{
|
||||
vec_size((void**)&view->layers, sizeof(layer_t), ++view->layers_count);
|
||||
|
||||
layer = &view->layers[view->layers_count - 1];
|
||||
layer_init(layer, name);
|
||||
}
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
void view_sort_layers(view_t *view)
|
||||
{
|
||||
layer_t sorted[6];
|
||||
layer_t *layer;
|
||||
int i = 0;
|
||||
|
||||
/* retroarch frame *= screen's color */
|
||||
if ((layer = view_find_layer(view, "screen")))
|
||||
{
|
||||
layer->blend = VIDEO_LAYOUT_BLEND_MOD;
|
||||
sorted[i] = *layer;
|
||||
++i;
|
||||
}
|
||||
|
||||
if ((layer = view_find_layer(view, "overlay")))
|
||||
{
|
||||
layer->blend = VIDEO_LAYOUT_BLEND_MOD;
|
||||
sorted[i] = *layer;
|
||||
++i;
|
||||
}
|
||||
|
||||
if ((layer = view_find_layer(view, "backdrop")))
|
||||
{
|
||||
layer->blend = VIDEO_LAYOUT_BLEND_ADD;
|
||||
sorted[i] = *layer;
|
||||
++i;
|
||||
}
|
||||
|
||||
if ((layer = view_find_layer(view, "bezel")))
|
||||
{
|
||||
layer->blend = VIDEO_LAYOUT_BLEND_ALPHA;
|
||||
sorted[i] = *layer;
|
||||
++i;
|
||||
}
|
||||
|
||||
if ((layer = view_find_layer(view, "cpanel")))
|
||||
{
|
||||
layer->blend = VIDEO_LAYOUT_BLEND_ALPHA;
|
||||
sorted[i] = *layer;
|
||||
++i;
|
||||
}
|
||||
|
||||
if ((layer = view_find_layer(view, "marquee")))
|
||||
{
|
||||
layer->blend = VIDEO_LAYOUT_BLEND_ALPHA;
|
||||
sorted[i] = *layer;
|
||||
++i;
|
||||
}
|
||||
|
||||
for (i = 0; i < view->layers_count; ++i)
|
||||
view->layers[i] = sorted[i];
|
||||
}
|
||||
|
||||
void view_normalize(view_t *view)
|
||||
{
|
||||
video_layout_bounds_t dim;
|
||||
int i, j;
|
||||
|
||||
if (bounds_valid(&view->bounds))
|
||||
{
|
||||
dim.x = view->bounds.x / view->bounds.w;
|
||||
dim.y = view->bounds.y / view->bounds.h;
|
||||
dim.w = 1.0f / view->bounds.w;
|
||||
dim.h = 1.0f / view->bounds.h;
|
||||
|
||||
if (view->bounds.w < view->bounds.h)
|
||||
{
|
||||
view->bounds.w = view->bounds.w / view->bounds.h;
|
||||
view->bounds.h = 1.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
view->bounds.h = view->bounds.h / view->bounds.w;
|
||||
view->bounds.w = 1.f;
|
||||
}
|
||||
|
||||
view->bounds.x = 0;
|
||||
view->bounds.y = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dim = view->bounds = make_bounds_unit();
|
||||
}
|
||||
|
||||
for (i = 0; i < view->layers_count; ++i)
|
||||
{
|
||||
layer_t *layer;
|
||||
layer = &view->layers[i];
|
||||
|
||||
for (j = 0; j < layer->elements_count; ++j)
|
||||
{
|
||||
element_t *elem;
|
||||
elem = &layer->elements[j];
|
||||
|
||||
if (bounds_valid(&elem->bounds))
|
||||
{
|
||||
bounds_scale(&elem->bounds, &dim);
|
||||
}
|
||||
else
|
||||
{
|
||||
elem->bounds = dim;
|
||||
}
|
||||
|
||||
elem->bounds.x -= dim.x;
|
||||
elem->bounds.y -= dim.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void view_count_screens(view_t *view)
|
||||
{
|
||||
int idx, i, j, k;
|
||||
|
||||
idx = -1;
|
||||
|
||||
for (i = 0; i < view->layers_count; ++i)
|
||||
{
|
||||
layer_t *layer = &view->layers[i];
|
||||
for (j = 0; j < layer->elements_count; ++j)
|
||||
{
|
||||
element_t *elem = &layer->elements[j];
|
||||
for (k = 0; k < elem->components_count; ++k)
|
||||
{
|
||||
component_t *comp = &elem->components[k];
|
||||
if (comp->type == VIDEO_LAYOUT_C_SCREEN)
|
||||
idx = MAX(idx, comp->attr.screen.index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (view->screens_count)
|
||||
{
|
||||
free(view->screens);
|
||||
view->screens_count = 0;
|
||||
}
|
||||
|
||||
if ((++idx))
|
||||
{
|
||||
view->screens = (video_layout_bounds_t*)calloc(idx, sizeof(video_layout_bounds_t));
|
||||
view->screens_count = idx;
|
||||
}
|
||||
}
|
||||
|
||||
void view_array_init(view_array_t *view_array, int views_count)
|
||||
{
|
||||
view_array->views = (view_t*)(views_count > 0 ?
|
||||
calloc(views_count, sizeof(view_t)) : NULL);
|
||||
view_array->views_count = views_count;
|
||||
}
|
||||
|
||||
void view_array_deinit(view_array_t *view_array)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < view_array->views_count; ++i)
|
||||
view_deinit(&view_array->views[i]);
|
||||
free(view_array->views);
|
||||
view_array->views = NULL;
|
||||
view_array->views_count = 0;
|
||||
}
|
||||
|
||||
view_t *view_array_find(view_array_t *view_array, const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < view_array->views_count; ++i)
|
||||
{
|
||||
if (strcmp(name, view_array->views[i].name) == 0)
|
||||
return &view_array->views[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
53
gfx/video_layout/view.h
Normal file
53
gfx/video_layout/view.h
Normal file
@ -0,0 +1,53 @@
|
||||
#ifndef VIDEO_LAYOUT_VIEW_H
|
||||
#define VIDEO_LAYOUT_VIEW_H
|
||||
#include "internal.h"
|
||||
#include "element.h"
|
||||
|
||||
typedef struct layer
|
||||
{
|
||||
char *name;
|
||||
video_layout_blend_t blend;
|
||||
|
||||
element_t *elements;
|
||||
int elements_count;
|
||||
}
|
||||
layer_t;
|
||||
|
||||
typedef struct view
|
||||
{
|
||||
char *name;
|
||||
video_layout_bounds_t bounds;
|
||||
video_layout_bounds_t render_bounds;
|
||||
|
||||
layer_t *layers;
|
||||
int layers_count;
|
||||
|
||||
video_layout_bounds_t *screens;
|
||||
int screens_count;
|
||||
}
|
||||
view_t;
|
||||
|
||||
typedef struct view_array
|
||||
{
|
||||
view_t *views;
|
||||
int views_count;
|
||||
}
|
||||
view_array_t;
|
||||
|
||||
void layer_init (layer_t *layer, const char *name);
|
||||
void layer_deinit (layer_t *layer);
|
||||
element_t *layer_add_element (layer_t *layer);
|
||||
|
||||
void view_init (view_t *view, const char *name);
|
||||
void view_deinit (view_t *view);
|
||||
layer_t *view_find_layer (view_t *view, const char *name);
|
||||
layer_t *view_emplace_layer (view_t *view, const char *name);
|
||||
void view_sort_layers (view_t *view);
|
||||
void view_normalize (view_t *view);
|
||||
void view_count_screens (view_t *view);
|
||||
|
||||
void view_array_init (view_array_t *view_array, int views_count);
|
||||
void view_array_deinit (view_array_t *view_array);
|
||||
view_t *view_array_find (view_array_t *view_array, const char *name);
|
||||
|
||||
#endif
|
@ -1310,6 +1310,9 @@ static const video_driver_t video_thread = {
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
video_thread_get_overlay_interface, /* get_overlay_interface */
|
||||
#endif
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
NULL,
|
||||
#endif
|
||||
video_thread_get_poke_interface,
|
||||
NULL,
|
||||
|
@ -475,6 +475,16 @@ VIDEO DRIVER
|
||||
|
||||
#include "../deps/ibxm/ibxm.c"
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
#include "../gfx/video_layout.c"
|
||||
#include "../gfx/video_layout/view.c"
|
||||
#include "../gfx/video_layout/element.c"
|
||||
#include "../gfx/video_layout/component.c"
|
||||
#include "../gfx/video_layout/internal.c"
|
||||
#include "../gfx/video_layout/scope.c"
|
||||
#include "../gfx/video_layout/load.c"
|
||||
#endif
|
||||
|
||||
/*============================================================
|
||||
FONTS
|
||||
============================================================ */
|
||||
|
@ -359,6 +359,10 @@ MSG_HASH(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_DISPLAY_SETTINGS_LIST,
|
||||
"deferred_onscreen_display_settings_list")
|
||||
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST,
|
||||
"deferred_onscreen_overlay_settings_list")
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_VIDEO_LAYOUT_SETTINGS_LIST,
|
||||
"deferred_onscreen_video_layout_settings_list")
|
||||
#endif
|
||||
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST,
|
||||
"deferred_onscreen_notifications_settings_list")
|
||||
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_SETTINGS_LIST,
|
||||
@ -803,6 +807,10 @@ MSG_HASH(MENU_ENUM_LABEL_ONSCREEN_DISPLAY_SETTINGS,
|
||||
"onscreen_display_settings")
|
||||
MSG_HASH(MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS,
|
||||
"onscreen_overlay_settings")
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
MSG_HASH(MENU_ENUM_LABEL_ONSCREEN_VIDEO_LAYOUT_SETTINGS,
|
||||
"onscreen_video_layout_settings")
|
||||
#endif
|
||||
MSG_HASH(MENU_ENUM_LABEL_ONSCREEN_NOTIFICATIONS_SETTINGS,
|
||||
"onscreen_notifications_settings")
|
||||
MSG_HASH(MENU_ENUM_LABEL_OPEN_ARCHIVE,
|
||||
@ -813,6 +821,10 @@ MSG_HASH(MENU_ENUM_LABEL_OVERLAY_AUTOLOAD_PREFERRED,
|
||||
"overlay_autoload_preferred")
|
||||
MSG_HASH(MENU_ENUM_LABEL_OVERLAY_DIRECTORY,
|
||||
"overlay_directory")
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
MSG_HASH(MENU_ENUM_LABEL_VIDEO_LAYOUT_DIRECTORY,
|
||||
"video_layout_directory")
|
||||
#endif
|
||||
MSG_HASH(MENU_ENUM_LABEL_OVERLAY_OPACITY,
|
||||
"input_overlay_opacity")
|
||||
MSG_HASH(MENU_ENUM_LABEL_OVERLAY_PRESET,
|
||||
@ -1337,6 +1349,14 @@ MSG_HASH(MENU_ENUM_LABEL_VIDEO_FULLSCREEN_X,
|
||||
"video_fullscreen_x")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VIDEO_FULLSCREEN_Y,
|
||||
"video_fullscreen_y")
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
MSG_HASH(MENU_ENUM_LABEL_VIDEO_LAYOUT_ENABLE,
|
||||
"video_layout_enable")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VIDEO_LAYOUT_PATH,
|
||||
"video_layout_path")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VIDEO_LAYOUT_SELECTED_VIEW,
|
||||
"video_layout_selected_view")
|
||||
#endif
|
||||
MSG_HASH(MENU_ENUM_LABEL_WIFI_DRIVER,
|
||||
"wifi_driver")
|
||||
MSG_HASH(MENU_ENUM_LABEL_WIFI_SETTINGS,
|
||||
@ -1639,6 +1659,10 @@ MSG_HASH(MENU_ENUM_LABEL_CONTENT_SHOW_LATENCY,
|
||||
"menu_show_latency_settings")
|
||||
MSG_HASH(MENU_ENUM_LABEL_CONTENT_SHOW_OVERLAYS,
|
||||
"menu_show_overlay_settings")
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
MSG_HASH(MENU_ENUM_LABEL_CONTENT_SHOW_VIDEO_LAYOUT,
|
||||
"menu_show_video_layout_settings")
|
||||
#endif
|
||||
MSG_HASH(MENU_ENUM_LABEL_AUDIO_ENABLE_MENU,
|
||||
"audio_enable_menu")
|
||||
MSG_HASH(MENU_ENUM_LABEL_AUDIO_MIXER_SETTINGS,
|
||||
|
@ -631,6 +631,21 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
|
||||
snprintf(s, len,
|
||||
"Overlay opacity.");
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case MENU_ENUM_LABEL_VIDEO_LAYOUT_ENABLE:
|
||||
snprintf(s, len,
|
||||
"Enable or disable the current video layout.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VIDEO_LAYOUT_PATH:
|
||||
snprintf(s, len,
|
||||
"Path to video layout.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VIDEO_LAYOUT_SELECTED_VIEW:
|
||||
snprintf(s, len,
|
||||
"Layouts can contain multiple views. \n"
|
||||
"Select a view.");
|
||||
break;
|
||||
#endif
|
||||
case MENU_ENUM_LABEL_INPUT_BIND_TIMEOUT:
|
||||
snprintf(s, len,
|
||||
"Input bind timer timeout (in seconds). \n"
|
||||
@ -1825,6 +1840,15 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
|
||||
"Defines a directory where overlays are \n"
|
||||
"kept for easy access.");
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case MENU_ENUM_LABEL_VIDEO_LAYOUT_DIRECTORY:
|
||||
snprintf(s, len,
|
||||
"Video Layout Directory. \n"
|
||||
" \n"
|
||||
"Defines a directory where video layouts are \n"
|
||||
"kept for easy access.");
|
||||
break;
|
||||
#endif
|
||||
case MENU_ENUM_LABEL_INPUT_MAX_USERS:
|
||||
snprintf(s, len,
|
||||
"Maximum amount of users supported by \n"
|
||||
|
@ -2028,6 +2028,16 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_ONSCREEN_OVERLAY_SETTINGS,
|
||||
"Adjust Bezels and Onscreen controls"
|
||||
)
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_ONSCREEN_VIDEO_LAYOUT_SETTINGS,
|
||||
"Video Layout"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_ONSCREEN_VIDEO_LAYOUT_SETTINGS,
|
||||
"Adjust Video Layout"
|
||||
)
|
||||
#endif
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_ONSCREEN_NOTIFICATIONS_SETTINGS,
|
||||
"Onscreen Notifications"
|
||||
@ -2056,6 +2066,12 @@ MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_OVERLAY_DIRECTORY,
|
||||
"Overlay"
|
||||
)
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_VIDEO_LAYOUT_DIRECTORY,
|
||||
"Video Layout"
|
||||
)
|
||||
#endif
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_OVERLAY_OPACITY,
|
||||
"Overlay Opacity"
|
||||
@ -3748,6 +3764,32 @@ MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN_Y,
|
||||
"Fullscreen Height"
|
||||
)
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_VIDEO_LAYOUT_ENABLE,
|
||||
"Enable Video Layout"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_VIDEO_LAYOUT_ENABLE,
|
||||
"Video layouts are used for bezels and other artwork."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_VIDEO_LAYOUT_PATH,
|
||||
"Video Layout Path"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_VIDEO_LAYOUT_PATH,
|
||||
"Select a video layout from the file browser."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_VIDEO_LAYOUT_SELECTED_VIEW,
|
||||
"Selected View"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_VIDEO_LAYOUT_SELECTED_VIEW,
|
||||
"Select a view within the loaded layout."
|
||||
)
|
||||
#endif
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_WIFI_DRIVER,
|
||||
"Wi-Fi"
|
||||
@ -6260,6 +6302,12 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OVERLAY_DIRECTORY,
|
||||
"Defines a directory where overlays are kept for easy access."
|
||||
)
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_VIDEO_LAYOUT_DIRECTORY,
|
||||
"Defines a directory where video layouts are kept for easy access."
|
||||
)
|
||||
#endif
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_CHEAT_DATABASE_PATH,
|
||||
"Cheat files are kept here."
|
||||
@ -7047,6 +7095,16 @@ MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_OVERLAYS,
|
||||
"Show Overlay Settings"
|
||||
)
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_VIDEO_LAYOUT,
|
||||
"Show Video Layout Settings"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_CONTENT_SHOW_VIDEO_LAYOUT,
|
||||
"Show/hide Video Layout options."
|
||||
)
|
||||
#endif
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE_MENU,
|
||||
"Mixer"
|
||||
|
@ -29,14 +29,27 @@
|
||||
#include <formats/image.h>
|
||||
#include <file/nbio.h>
|
||||
|
||||
enum video_image_format
|
||||
|
||||
enum image_type_enum image_texture_get_type(const char *path)
|
||||
{
|
||||
IMAGE_FORMAT_NONE = 0,
|
||||
IMAGE_FORMAT_TGA,
|
||||
IMAGE_FORMAT_PNG,
|
||||
IMAGE_FORMAT_JPEG,
|
||||
IMAGE_FORMAT_BMP
|
||||
};
|
||||
#ifdef HAVE_RTGA
|
||||
if (strstr(path, ".tga"))
|
||||
return IMAGE_TYPE_TGA;
|
||||
#endif
|
||||
#ifdef HAVE_RPNG
|
||||
if (strstr(path, ".png"))
|
||||
return IMAGE_TYPE_PNG;
|
||||
#endif
|
||||
#ifdef HAVE_RJPEG
|
||||
if (strstr(path, ".jpg") || strstr(path, ".jpeg"))
|
||||
return IMAGE_TYPE_JPEG;
|
||||
#endif
|
||||
#ifdef HAVE_RBMP
|
||||
if (strstr(path, ".bmp"))
|
||||
return IMAGE_TYPE_BMP;
|
||||
#endif
|
||||
return IMAGE_TYPE_NONE;
|
||||
}
|
||||
|
||||
bool image_texture_set_color_shifts(
|
||||
unsigned *r_shift, unsigned *g_shift, unsigned *b_shift,
|
||||
@ -214,53 +227,29 @@ void image_texture_free(struct texture_image *img)
|
||||
img->pixels = NULL;
|
||||
}
|
||||
|
||||
static enum video_image_format image_texture_get_type(const char *path)
|
||||
bool image_texture_load_buffer(struct texture_image *out_img,
|
||||
enum image_type_enum type, void *buffer, size_t buffer_len)
|
||||
{
|
||||
#ifdef HAVE_RTGA
|
||||
if (strstr(path, ".tga"))
|
||||
return IMAGE_FORMAT_TGA;
|
||||
#endif
|
||||
#ifdef HAVE_RPNG
|
||||
if (strstr(path, ".png"))
|
||||
return IMAGE_FORMAT_PNG;
|
||||
#endif
|
||||
#ifdef HAVE_RJPEG
|
||||
if (strstr(path, ".jpg") || strstr(path, ".jpeg"))
|
||||
return IMAGE_FORMAT_JPEG;
|
||||
#endif
|
||||
#ifdef HAVE_RBMP
|
||||
if (strstr(path, ".bmp"))
|
||||
return IMAGE_FORMAT_BMP;
|
||||
#endif
|
||||
return IMAGE_FORMAT_NONE;
|
||||
}
|
||||
unsigned r_shift, g_shift, b_shift, a_shift;
|
||||
image_texture_set_color_shifts(&r_shift, &g_shift, &b_shift,
|
||||
&a_shift, out_img);
|
||||
|
||||
static enum image_type_enum image_texture_convert_fmt_to_type(enum video_image_format fmt)
|
||||
{
|
||||
switch (fmt)
|
||||
if (type != IMAGE_TYPE_NONE)
|
||||
{
|
||||
#ifdef HAVE_RPNG
|
||||
case IMAGE_FORMAT_PNG:
|
||||
return IMAGE_TYPE_PNG;
|
||||
#endif
|
||||
#ifdef HAVE_RJPEG
|
||||
case IMAGE_FORMAT_JPEG:
|
||||
return IMAGE_TYPE_JPEG;
|
||||
#endif
|
||||
#ifdef HAVE_RBMP
|
||||
case IMAGE_FORMAT_BMP:
|
||||
return IMAGE_TYPE_BMP;
|
||||
#endif
|
||||
#ifdef HAVE_RTGA
|
||||
case IMAGE_FORMAT_TGA:
|
||||
return IMAGE_TYPE_TGA;
|
||||
#endif
|
||||
case IMAGE_FORMAT_NONE:
|
||||
default:
|
||||
break;
|
||||
if (image_texture_load_internal(
|
||||
type, buffer, buffer_len, out_img,
|
||||
a_shift, r_shift, g_shift, b_shift))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return IMAGE_TYPE_NONE;
|
||||
out_img->supports_rgba = false;
|
||||
out_img->pixels = NULL;
|
||||
out_img->width = 0;
|
||||
out_img->height = 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool image_texture_load(struct texture_image *out_img,
|
||||
@ -270,12 +259,12 @@ bool image_texture_load(struct texture_image *out_img,
|
||||
size_t file_len = 0;
|
||||
struct nbio_t *handle = NULL;
|
||||
void *ptr = NULL;
|
||||
enum video_image_format fmt = image_texture_get_type(path);
|
||||
enum image_type_enum type = image_texture_get_type(path);
|
||||
|
||||
image_texture_set_color_shifts(&r_shift, &g_shift, &b_shift,
|
||||
&a_shift, out_img);
|
||||
|
||||
if (fmt != IMAGE_FORMAT_NONE)
|
||||
if (type != IMAGE_TYPE_NONE)
|
||||
{
|
||||
handle = (struct nbio_t*)nbio_open(path, NBIO_READ);
|
||||
if (!handle)
|
||||
@ -290,7 +279,7 @@ bool image_texture_load(struct texture_image *out_img,
|
||||
goto error;
|
||||
|
||||
if (image_texture_load_internal(
|
||||
image_texture_convert_fmt_to_type(fmt),
|
||||
type,
|
||||
ptr, file_len, out_img,
|
||||
a_shift, r_shift, g_shift, b_shift))
|
||||
goto success;
|
||||
|
@ -66,20 +66,17 @@ static void rxml_free_node(struct rxml_node *node)
|
||||
{
|
||||
struct rxml_attrib_node *next_attrib = NULL;
|
||||
|
||||
if (!attrib_node_head)
|
||||
continue;
|
||||
|
||||
next_attrib = (struct rxml_attrib_node*)attrib_node_head->next;
|
||||
|
||||
if (!next_attrib)
|
||||
continue;
|
||||
|
||||
if (attrib_node_head->attrib)
|
||||
free(attrib_node_head->attrib);
|
||||
if (attrib_node_head->value)
|
||||
free(attrib_node_head->value);
|
||||
if (attrib_node_head)
|
||||
free(attrib_node_head);
|
||||
if (next_attrib)
|
||||
{
|
||||
if (attrib_node_head->attrib)
|
||||
free(attrib_node_head->attrib);
|
||||
if (attrib_node_head->value)
|
||||
free(attrib_node_head->value);
|
||||
if (attrib_node_head)
|
||||
free(attrib_node_head);
|
||||
}
|
||||
|
||||
attrib_node_head = next_attrib;
|
||||
}
|
||||
@ -420,8 +417,6 @@ rxml_document_t *rxml_load_document(const char *path)
|
||||
{
|
||||
rxml_document_t *doc;
|
||||
char *memory_buffer = NULL;
|
||||
char *new_memory_buffer = NULL;
|
||||
const char *mem_ptr = NULL;
|
||||
long len = 0;
|
||||
RFILE *file = filestream_open(path,
|
||||
RETRO_VFS_FILE_ACCESS_READ,
|
||||
@ -429,10 +424,6 @@ rxml_document_t *rxml_load_document(const char *path)
|
||||
if (!file)
|
||||
return NULL;
|
||||
|
||||
doc = (rxml_document_t*)calloc(1, sizeof(*doc));
|
||||
if (!doc)
|
||||
goto error;
|
||||
|
||||
len = filestream_get_size(file);
|
||||
memory_buffer = (char*)malloc(len + 1);
|
||||
if (!memory_buffer)
|
||||
@ -445,17 +436,38 @@ rxml_document_t *rxml_load_document(const char *path)
|
||||
filestream_close(file);
|
||||
file = NULL;
|
||||
|
||||
mem_ptr = memory_buffer;
|
||||
doc = rxml_load_document_string(memory_buffer);
|
||||
|
||||
free(memory_buffer);
|
||||
return doc;
|
||||
|
||||
error:
|
||||
free(memory_buffer);
|
||||
if(file)
|
||||
filestream_close(file);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rxml_document_t *rxml_load_document_string(const char *str)
|
||||
{
|
||||
rxml_document_t *doc;
|
||||
char *memory_buffer = NULL;
|
||||
const char *mem_ptr = NULL;
|
||||
|
||||
doc = (rxml_document_t*)calloc(1, sizeof(*doc));
|
||||
if (!doc)
|
||||
goto error;
|
||||
|
||||
mem_ptr = str;
|
||||
|
||||
if (!validate_header(&mem_ptr))
|
||||
goto error;
|
||||
|
||||
new_memory_buffer = purge_xml_comments(mem_ptr);
|
||||
if (!new_memory_buffer)
|
||||
memory_buffer = purge_xml_comments(mem_ptr);
|
||||
if (!memory_buffer)
|
||||
goto error;
|
||||
|
||||
free(memory_buffer);
|
||||
mem_ptr = memory_buffer = new_memory_buffer;
|
||||
mem_ptr = memory_buffer;
|
||||
|
||||
doc->root_node = rxml_parse_node(&mem_ptr);
|
||||
if (!doc->root_node)
|
||||
@ -466,7 +478,6 @@ rxml_document_t *rxml_load_document(const char *path)
|
||||
|
||||
error:
|
||||
free(memory_buffer);
|
||||
filestream_close(file);
|
||||
rxml_free_document(doc);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#define __RARCH_IMAGE_CONTEXT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <retro_common_api.h>
|
||||
|
||||
@ -56,6 +57,8 @@ enum image_type_enum
|
||||
IMAGE_TYPE_TGA
|
||||
};
|
||||
|
||||
enum image_type_enum image_texture_get_type(const char *path);
|
||||
|
||||
bool image_texture_set_color_shifts(unsigned *r_shift, unsigned *g_shift,
|
||||
unsigned *b_shift, unsigned *a_shift,
|
||||
struct texture_image *out_img);
|
||||
@ -64,6 +67,9 @@ bool image_texture_color_convert(unsigned r_shift,
|
||||
unsigned g_shift, unsigned b_shift, unsigned a_shift,
|
||||
struct texture_image *out_img);
|
||||
|
||||
bool image_texture_load_buffer(struct texture_image *img,
|
||||
enum image_type_enum type, void *buffer, size_t buffer_len);
|
||||
|
||||
bool image_texture_load(struct texture_image *img, const char *path);
|
||||
void image_texture_free(struct texture_image *img);
|
||||
|
||||
|
@ -46,7 +46,7 @@ struct rxml_attrib_node
|
||||
struct rxml_attrib_node *next;
|
||||
};
|
||||
|
||||
struct rxml_node
|
||||
typedef struct rxml_node
|
||||
{
|
||||
char *name;
|
||||
char *data;
|
||||
@ -54,9 +54,10 @@ struct rxml_node
|
||||
|
||||
struct rxml_node *children;
|
||||
struct rxml_node *next;
|
||||
};
|
||||
} rxml_node_t;
|
||||
|
||||
rxml_document_t *rxml_load_document(const char *path);
|
||||
rxml_document_t *rxml_load_document_string(const char *str);
|
||||
void rxml_free_document(rxml_document_t *doc);
|
||||
|
||||
struct rxml_node *rxml_root_node(rxml_document_t *doc);
|
||||
|
@ -120,6 +120,9 @@ generic_deferred_push(deferred_push_remap_file_load, DISPLAYLIST_
|
||||
generic_deferred_push(deferred_push_record_configfile, DISPLAYLIST_RECORD_CONFIG_FILES)
|
||||
generic_deferred_push(deferred_push_stream_configfile, DISPLAYLIST_STREAM_CONFIG_FILES)
|
||||
generic_deferred_push(deferred_push_input_overlay, DISPLAYLIST_OVERLAYS)
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
generic_deferred_push(deferred_push_video_layout_path, DISPLAYLIST_VIDEO_LAYOUT_PATH)
|
||||
#endif
|
||||
generic_deferred_push(deferred_push_video_font_path, DISPLAYLIST_FONTS)
|
||||
generic_deferred_push(deferred_push_xmb_font_path, DISPLAYLIST_FONTS)
|
||||
generic_deferred_push(deferred_push_content_history_path, DISPLAYLIST_CONTENT_HISTORY)
|
||||
@ -147,6 +150,9 @@ generic_deferred_push(deferred_push_cheat_search_settings_list, DISPLAYLIST_
|
||||
generic_deferred_push(deferred_push_onscreen_display_settings_list, DISPLAYLIST_ONSCREEN_DISPLAY_SETTINGS_LIST)
|
||||
generic_deferred_push(deferred_push_onscreen_notifications_settings_list, DISPLAYLIST_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST)
|
||||
generic_deferred_push(deferred_push_onscreen_overlay_settings_list, DISPLAYLIST_ONSCREEN_OVERLAY_SETTINGS_LIST)
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
generic_deferred_push(deferred_push_onscreen_video_layout_settings_list, DISPLAYLIST_ONSCREEN_VIDEO_LAYOUT_SETTINGS_LIST)
|
||||
#endif
|
||||
generic_deferred_push(deferred_push_menu_file_browser_settings_list,DISPLAYLIST_MENU_FILE_BROWSER_SETTINGS_LIST)
|
||||
generic_deferred_push(deferred_push_menu_views_settings_list, DISPLAYLIST_MENU_VIEWS_SETTINGS_LIST)
|
||||
generic_deferred_push(deferred_push_quick_menu_views_settings_list, DISPLAYLIST_QUICK_MENU_VIEWS_SETTINGS_LIST)
|
||||
@ -718,6 +724,13 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_onscreen_overlay_settings_list);
|
||||
return 0;
|
||||
}
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_VIDEO_LAYOUT_SETTINGS_LIST)))
|
||||
{
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_onscreen_video_layout_settings_list);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MENU_FILE_BROWSER_SETTINGS_LIST)))
|
||||
{
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_menu_file_browser_settings_list);
|
||||
@ -1267,6 +1280,11 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
|
||||
case MENU_ENUM_LABEL_INPUT_OVERLAY:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_input_overlay);
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case MENU_ENUM_LABEL_VIDEO_LAYOUT_PATH:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_video_layout_path);
|
||||
break;
|
||||
#endif
|
||||
case MENU_ENUM_LABEL_VIDEO_FONT_PATH:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_video_font_path);
|
||||
break;
|
||||
@ -1303,6 +1321,11 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
|
||||
case MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_onscreen_overlay_settings_list);
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case MENU_ENUM_LABEL_DEFERRED_ONSCREEN_VIDEO_LAYOUT_SETTINGS_LIST:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_onscreen_video_layout_settings_list);
|
||||
break;
|
||||
#endif
|
||||
case MENU_ENUM_LABEL_DEFERRED_AUDIO_SETTINGS_LIST:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_audio_settings_list);
|
||||
break;
|
||||
@ -1505,6 +1528,11 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
|
||||
case MENU_LABEL_INPUT_OVERLAY:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_input_overlay);
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case MENU_LABEL_VIDEO_LAYOUT_PATH:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_video_layout_path);
|
||||
break;
|
||||
#endif
|
||||
case MENU_LABEL_VIDEO_FONT_PATH:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_video_font_path);
|
||||
break;
|
||||
|
@ -983,6 +983,21 @@ static void menu_action_setting_disp_set_label_menu_file_overlay(
|
||||
path, "(OVERLAY)", s2, len2);
|
||||
}
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
static void menu_action_setting_disp_set_label_menu_file_video_layout(
|
||||
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, "(Video Layout)", s2, len2);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void menu_action_setting_disp_set_label_menu_file_config(
|
||||
file_list_t* list,
|
||||
unsigned *w, unsigned type, unsigned i,
|
||||
@ -1499,6 +1514,12 @@ static int menu_cbs_init_bind_get_string_representation_compare_type(
|
||||
BIND_ACTION_GET_VALUE(cbs,
|
||||
menu_action_setting_disp_set_label_menu_file_overlay);
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case FILE_TYPE_VIDEO_LAYOUT:
|
||||
BIND_ACTION_GET_VALUE(cbs,
|
||||
menu_action_setting_disp_set_label_menu_file_video_layout);
|
||||
break;
|
||||
#endif
|
||||
case FILE_TYPE_FONT:
|
||||
BIND_ACTION_GET_VALUE(cbs,
|
||||
menu_action_setting_disp_set_label_menu_file_font);
|
||||
|
@ -647,6 +647,9 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs,
|
||||
case FILE_TYPE_SHADER_PRESET:
|
||||
case FILE_TYPE_IMAGE:
|
||||
case FILE_TYPE_OVERLAY:
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case FILE_TYPE_VIDEO_LAYOUT:
|
||||
#endif
|
||||
case FILE_TYPE_VIDEOFILTER:
|
||||
case FILE_TYPE_AUDIOFILTER:
|
||||
case FILE_TYPE_CONFIG:
|
||||
|
@ -105,6 +105,9 @@ enum
|
||||
ACTION_OK_SET_PATH_AUDIO_FILTER,
|
||||
ACTION_OK_SET_PATH_VIDEO_FILTER,
|
||||
ACTION_OK_SET_PATH_OVERLAY,
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
ACTION_OK_SET_PATH_VIDEO_LAYOUT,
|
||||
#endif
|
||||
ACTION_OK_SET_DIRECTORY,
|
||||
ACTION_OK_SHOW_WIMP,
|
||||
ACTION_OK_LOAD_CHEAT_FILE_APPEND,
|
||||
@ -203,6 +206,10 @@ static enum msg_hash_enums action_ok_dl_to_enum(unsigned lbl)
|
||||
return MENU_ENUM_LABEL_DEFERRED_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST;
|
||||
case ACTION_OK_DL_ONSCREEN_OVERLAY_SETTINGS_LIST:
|
||||
return MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case ACTION_OK_DL_ONSCREEN_VIDEO_LAYOUT_SETTINGS_LIST:
|
||||
return MENU_ENUM_LABEL_DEFERRED_ONSCREEN_VIDEO_LAYOUT_SETTINGS_LIST;
|
||||
#endif
|
||||
case ACTION_OK_DL_MENU_SETTINGS_LIST:
|
||||
return MENU_ENUM_LABEL_DEFERRED_MENU_SETTINGS_LIST;
|
||||
case ACTION_OK_DL_MENU_VIEWS_SETTINGS_LIST:
|
||||
@ -877,6 +884,9 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
case ACTION_OK_DL_ONSCREEN_DISPLAY_SETTINGS_LIST:
|
||||
case ACTION_OK_DL_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST:
|
||||
case ACTION_OK_DL_ONSCREEN_OVERLAY_SETTINGS_LIST:
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case ACTION_OK_DL_ONSCREEN_VIDEO_LAYOUT_SETTINGS_LIST:
|
||||
#endif
|
||||
case ACTION_OK_DL_MENU_SETTINGS_LIST:
|
||||
case ACTION_OK_DL_MENU_VIEWS_SETTINGS_LIST:
|
||||
case ACTION_OK_DL_QUICK_MENU_VIEWS_SETTINGS_LIST:
|
||||
@ -1544,6 +1554,12 @@ static int generic_action_ok(const char *path,
|
||||
flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST);
|
||||
ret = set_path_generic(menu_label, action_path);
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case ACTION_OK_SET_PATH_VIDEO_LAYOUT:
|
||||
flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_VIDEO_LAYOUT_SETTINGS_LIST);
|
||||
ret = set_path_generic(menu_label, action_path);
|
||||
break;
|
||||
#endif
|
||||
case ACTION_OK_SET_PATH:
|
||||
flush_type = MENU_SETTINGS;
|
||||
ret = set_path_generic(menu_label, action_path);
|
||||
@ -1601,6 +1617,9 @@ static int (funcname)(const char *path, const char *label, unsigned type, size_t
|
||||
default_action_ok_set(action_ok_set_path_audiofilter, ACTION_OK_SET_PATH_VIDEO_FILTER, MSG_UNKNOWN)
|
||||
default_action_ok_set(action_ok_set_path_videofilter, ACTION_OK_SET_PATH_AUDIO_FILTER, MSG_UNKNOWN)
|
||||
default_action_ok_set(action_ok_set_path_overlay, ACTION_OK_SET_PATH_OVERLAY, MSG_UNKNOWN)
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
default_action_ok_set(action_ok_set_path_video_layout,ACTION_OK_SET_PATH_VIDEO_LAYOUT, MSG_UNKNOWN)
|
||||
#endif
|
||||
default_action_ok_set(action_ok_set_path, ACTION_OK_SET_PATH, MSG_UNKNOWN)
|
||||
default_action_ok_set(action_ok_load_core, ACTION_OK_LOAD_CORE, MSG_UNKNOWN)
|
||||
default_action_ok_set(action_ok_sideload_core, ACTION_OK_SIDELOAD_CORE, MSG_UNKNOWN)
|
||||
@ -4217,6 +4236,9 @@ default_action_ok_func(action_ok_cheat_start_or_cont, ACTION_OK_DL_CHEAT_SEARCH_
|
||||
default_action_ok_func(action_ok_onscreen_display_list, ACTION_OK_DL_ONSCREEN_DISPLAY_SETTINGS_LIST)
|
||||
default_action_ok_func(action_ok_onscreen_notifications_list, ACTION_OK_DL_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST)
|
||||
default_action_ok_func(action_ok_onscreen_overlay_list, ACTION_OK_DL_ONSCREEN_OVERLAY_SETTINGS_LIST)
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
default_action_ok_func(action_ok_onscreen_video_layout_list, ACTION_OK_DL_ONSCREEN_VIDEO_LAYOUT_SETTINGS_LIST)
|
||||
#endif
|
||||
default_action_ok_func(action_ok_menu_list, ACTION_OK_DL_MENU_SETTINGS_LIST)
|
||||
default_action_ok_func(action_ok_quick_menu_override_options, ACTION_OK_DL_QUICK_MENU_OVERRIDE_OPTIONS_LIST)
|
||||
default_action_ok_func(action_ok_menu_views_list, ACTION_OK_DL_MENU_VIEWS_SETTINGS_LIST)
|
||||
@ -5818,6 +5840,11 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS:
|
||||
BIND_ACTION_OK(cbs, action_ok_onscreen_overlay_list);
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case MENU_ENUM_LABEL_ONSCREEN_VIDEO_LAYOUT_SETTINGS:
|
||||
BIND_ACTION_OK(cbs, action_ok_onscreen_video_layout_list);
|
||||
break;
|
||||
#endif
|
||||
case MENU_ENUM_LABEL_MENU_SETTINGS:
|
||||
BIND_ACTION_OK(cbs, action_ok_menu_list);
|
||||
break;
|
||||
@ -6352,6 +6379,11 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
|
||||
case FILE_TYPE_OVERLAY:
|
||||
BIND_ACTION_OK(cbs, action_ok_set_path_overlay);
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case FILE_TYPE_VIDEO_LAYOUT:
|
||||
BIND_ACTION_OK(cbs, action_ok_set_path_video_layout);
|
||||
break;
|
||||
#endif
|
||||
case FILE_TYPE_AUDIOFILTER:
|
||||
BIND_ACTION_OK(cbs, action_ok_set_path_audiofilter);
|
||||
break;
|
||||
|
@ -531,6 +531,9 @@ static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs,
|
||||
case FILE_TYPE_SHADER_PRESET:
|
||||
case FILE_TYPE_IMAGE:
|
||||
case FILE_TYPE_OVERLAY:
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case FILE_TYPE_VIDEO_LAYOUT:
|
||||
#endif
|
||||
case FILE_TYPE_VIDEOFILTER:
|
||||
case FILE_TYPE_AUDIOFILTER:
|
||||
case FILE_TYPE_CONFIG:
|
||||
|
@ -300,6 +300,10 @@ default_sublabel_macro(action_bind_sublabel_overlay_opacity, MENU_
|
||||
default_sublabel_macro(action_bind_sublabel_overlay_scale, MENU_ENUM_SUBLABEL_OVERLAY_SCALE)
|
||||
default_sublabel_macro(action_bind_sublabel_overlay_enable, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_ENABLE)
|
||||
default_sublabel_macro(action_bind_sublabel_overlay_preset, MENU_ENUM_SUBLABEL_OVERLAY_PRESET)
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
default_sublabel_macro(action_bind_sublabel_video_layout_enable, MENU_ENUM_SUBLABEL_VIDEO_LAYOUT_ENABLE)
|
||||
default_sublabel_macro(action_bind_sublabel_video_layout_path, MENU_ENUM_SUBLABEL_VIDEO_LAYOUT_PATH)
|
||||
#endif
|
||||
default_sublabel_macro(action_bind_sublabel_netplay_public_announce, MENU_ENUM_SUBLABEL_NETPLAY_PUBLIC_ANNOUNCE)
|
||||
default_sublabel_macro(action_bind_sublabel_netplay_ip_address, MENU_ENUM_SUBLABEL_NETPLAY_IP_ADDRESS)
|
||||
default_sublabel_macro(action_bind_sublabel_netplay_tcp_udp_port, MENU_ENUM_SUBLABEL_NETPLAY_TCP_UDP_PORT)
|
||||
@ -421,6 +425,9 @@ default_sublabel_macro(action_bind_sublabel_quick_menu_show_controls,
|
||||
default_sublabel_macro(action_bind_sublabel_quick_menu_show_cheats, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CHEATS)
|
||||
default_sublabel_macro(action_bind_sublabel_quick_menu_show_shaders, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SHADERS)
|
||||
default_sublabel_macro(action_bind_sublabel_content_show_overlays, MENU_ENUM_SUBLABEL_CONTENT_SHOW_OVERLAYS)
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
default_sublabel_macro(action_bind_sublabel_content_show_video_layout, MENU_ENUM_SUBLABEL_CONTENT_SHOW_VIDEO_LAYOUT)
|
||||
#endif
|
||||
default_sublabel_macro(action_bind_sublabel_content_show_rewind, MENU_ENUM_SUBLABEL_CONTENT_SHOW_REWIND)
|
||||
default_sublabel_macro(action_bind_sublabel_content_show_latency, MENU_ENUM_SUBLABEL_CONTENT_SHOW_LATENCY)
|
||||
default_sublabel_macro(action_bind_sublabel_quick_menu_show_save_core_overrides, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES)
|
||||
@ -470,6 +477,9 @@ default_sublabel_macro(action_bind_sublabel_savefile_directory,
|
||||
default_sublabel_macro(action_bind_sublabel_savestate_directory, MENU_ENUM_SUBLABEL_SAVESTATE_DIRECTORY)
|
||||
default_sublabel_macro(action_bind_sublabel_screenshot_directory, MENU_ENUM_SUBLABEL_SCREENSHOT_DIRECTORY)
|
||||
default_sublabel_macro(action_bind_sublabel_overlay_directory, MENU_ENUM_SUBLABEL_OVERLAY_DIRECTORY)
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
default_sublabel_macro(action_bind_sublabel_video_layout_directory, MENU_ENUM_SUBLABEL_VIDEO_LAYOUT_DIRECTORY)
|
||||
#endif
|
||||
default_sublabel_macro(action_bind_sublabel_cheatfile_directory, MENU_ENUM_SUBLABEL_CHEAT_DATABASE_PATH)
|
||||
default_sublabel_macro(action_bind_sublabel_audio_filter_directory, MENU_ENUM_SUBLABEL_AUDIO_FILTER_DIR)
|
||||
default_sublabel_macro(action_bind_sublabel_video_filter_directory, MENU_ENUM_SUBLABEL_VIDEO_FILTER_DIR)
|
||||
@ -508,6 +518,9 @@ default_sublabel_macro(action_bind_sublabel_midi_input,
|
||||
default_sublabel_macro(action_bind_sublabel_midi_output, MENU_ENUM_SUBLABEL_MIDI_OUTPUT)
|
||||
default_sublabel_macro(action_bind_sublabel_midi_volume, MENU_ENUM_SUBLABEL_MIDI_VOLUME)
|
||||
default_sublabel_macro(action_bind_sublabel_onscreen_overlay_settings_list, MENU_ENUM_SUBLABEL_ONSCREEN_OVERLAY_SETTINGS)
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
default_sublabel_macro(action_bind_sublabel_onscreen_video_layout_settings_list, MENU_ENUM_SUBLABEL_ONSCREEN_VIDEO_LAYOUT_SETTINGS)
|
||||
#endif
|
||||
default_sublabel_macro(action_bind_sublabel_onscreen_notifications_settings_list, MENU_ENUM_SUBLABEL_ONSCREEN_NOTIFICATIONS_SETTINGS)
|
||||
#ifdef HAVE_QT
|
||||
default_sublabel_macro(action_bind_sublabel_show_wimp, MENU_ENUM_SUBLABEL_SHOW_WIMP)
|
||||
@ -1156,6 +1169,11 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_OVERLAY_DIRECTORY:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_overlay_directory);
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case MENU_ENUM_LABEL_VIDEO_LAYOUT_DIRECTORY:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_layout_directory);
|
||||
break;
|
||||
#endif
|
||||
case MENU_ENUM_LABEL_SCREENSHOT_DIRECTORY:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_screenshot_directory);
|
||||
break;
|
||||
@ -1282,6 +1300,11 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_CONTENT_SHOW_OVERLAYS:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_content_show_overlays);
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case MENU_ENUM_LABEL_CONTENT_SHOW_VIDEO_LAYOUT:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_content_show_video_layout);
|
||||
break;
|
||||
#endif
|
||||
case MENU_ENUM_LABEL_QUICK_MENU_SHOW_SHADERS:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_quick_menu_show_shaders);
|
||||
break;
|
||||
@ -1687,6 +1710,14 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_OVERLAY_SCALE:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_overlay_scale);
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case MENU_ENUM_LABEL_VIDEO_LAYOUT_ENABLE:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_layout_enable);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VIDEO_LAYOUT_PATH:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_layout_path);
|
||||
break;
|
||||
#endif
|
||||
case MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_audio_dsp_plugin);
|
||||
break;
|
||||
@ -2378,6 +2409,11 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_onscreen_overlay_settings_list);
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case MENU_ENUM_LABEL_ONSCREEN_VIDEO_LAYOUT_SETTINGS:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_onscreen_video_layout_settings_list);
|
||||
break;
|
||||
#endif
|
||||
case MENU_ENUM_LABEL_ONSCREEN_NOTIFICATIONS_SETTINGS:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_onscreen_notifications_settings_list);
|
||||
break;
|
||||
|
@ -138,6 +138,9 @@ default_title_macro(action_get_cheat_search_settings_list, MENU_ENUM_LABEL_
|
||||
default_title_macro(action_get_onscreen_display_settings_list, MENU_ENUM_LABEL_VALUE_ONSCREEN_DISPLAY_SETTINGS)
|
||||
default_title_macro(action_get_onscreen_notifications_settings_list, MENU_ENUM_LABEL_VALUE_ONSCREEN_NOTIFICATIONS_SETTINGS)
|
||||
default_title_macro(action_get_onscreen_overlay_settings_list, MENU_ENUM_LABEL_VALUE_ONSCREEN_OVERLAY_SETTINGS)
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
default_title_macro(action_get_onscreen_video_layout_settings_list, MENU_ENUM_LABEL_VALUE_ONSCREEN_VIDEO_LAYOUT_SETTINGS)
|
||||
#endif
|
||||
default_title_macro(action_get_menu_views_settings_list, MENU_ENUM_LABEL_VALUE_MENU_VIEWS_SETTINGS)
|
||||
default_title_macro(action_get_quick_menu_views_settings_list, MENU_ENUM_LABEL_VALUE_QUICK_MENU_VIEWS_SETTINGS)
|
||||
default_title_macro(action_get_menu_settings_list, MENU_ENUM_LABEL_VALUE_MENU_SETTINGS)
|
||||
@ -208,6 +211,9 @@ default_fill_title_macro(action_get_title_audio_filter_directory, MENU_ENUM_LABE
|
||||
default_fill_title_macro(action_get_title_video_filter_directory, MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_DIR)
|
||||
default_fill_title_macro(action_get_title_savefile_directory, MENU_ENUM_LABEL_VALUE_SAVEFILE_DIRECTORY)
|
||||
default_fill_title_macro(action_get_title_overlay_directory, MENU_ENUM_LABEL_VALUE_OVERLAY_DIRECTORY)
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
default_fill_title_macro(action_get_title_video_layout_directory, MENU_ENUM_LABEL_VALUE_VIDEO_LAYOUT_DIRECTORY)
|
||||
#endif
|
||||
default_fill_title_macro(action_get_title_system_directory, MENU_ENUM_LABEL_VALUE_SYSTEM_DIRECTORY)
|
||||
default_fill_title_macro(action_get_title_assets_directory, MENU_ENUM_LABEL_VALUE_ASSETS_DIRECTORY)
|
||||
default_fill_title_macro(action_get_title_extraction_directory, MENU_ENUM_LABEL_VALUE_CACHE_DIRECTORY)
|
||||
@ -421,6 +427,13 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_onscreen_overlay_settings_list);
|
||||
return 0;
|
||||
}
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_VIDEO_LAYOUT_SETTINGS_LIST)))
|
||||
{
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_onscreen_video_layout_settings_list);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MENU_VIEWS_SETTINGS_LIST)))
|
||||
{
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_menu_views_settings_list);
|
||||
@ -662,6 +675,11 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_OVERLAY_DIRECTORY:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_title_overlay_directory);
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case MENU_ENUM_LABEL_VIDEO_LAYOUT_DIRECTORY:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_title_video_layout_directory);
|
||||
break;
|
||||
#endif
|
||||
case MENU_ENUM_LABEL_RGUI_BROWSER_DIRECTORY:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_title_browser_directory);
|
||||
break;
|
||||
@ -827,6 +845,11 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_onscreen_overlay_settings_list);
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case MENU_ENUM_LABEL_DEFERRED_ONSCREEN_VIDEO_LAYOUT_SETTINGS_LIST:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_onscreen_video_layout_settings_list);
|
||||
break;
|
||||
#endif
|
||||
case MENU_ENUM_LABEL_DEFERRED_CORE_SETTINGS_LIST:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_core_settings_list);
|
||||
break;
|
||||
@ -997,6 +1020,11 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
|
||||
case MENU_LABEL_OVERLAY_DIRECTORY:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_title_overlay_directory);
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case MENU_LABEL_VIDEO_LAYOUT_DIRECTORY:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_title_video_layout_directory);
|
||||
break;
|
||||
#endif
|
||||
case MENU_LABEL_RGUI_BROWSER_DIRECTORY:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_title_browser_directory);
|
||||
break;
|
||||
|
@ -2669,6 +2669,9 @@ static void materialui_list_insert(void *userdata,
|
||||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_VIEWS_SETTINGS)) ||
|
||||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_MENU_SETTINGS)) ||
|
||||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS)) ||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_ONSCREEN_VIDEO_LAYOUT_SETTINGS)) ||
|
||||
#endif
|
||||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_ONSCREEN_NOTIFICATIONS_SETTINGS)) ||
|
||||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_ACCOUNTS_LIST)) ||
|
||||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_REWIND_SETTINGS)) ||
|
||||
|
@ -159,6 +159,11 @@ int generic_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_action a
|
||||
case FILE_TYPE_OVERLAY:
|
||||
enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_OVERLAY;
|
||||
break;
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case FILE_TYPE_VIDEO_LAYOUT:
|
||||
enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_VIDEO_LAYOUT;
|
||||
break;
|
||||
#endif
|
||||
case FILE_TYPE_CHEAT:
|
||||
enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_CHEAT;
|
||||
break;
|
||||
|
@ -124,6 +124,9 @@ menu_texture_item ozone_entries_icon_get_texture(ozone_handle_t *ozone,
|
||||
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_IMAGE];
|
||||
case MENU_ENUM_LABEL_UPDATE_OVERLAYS:
|
||||
case MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS:
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case MENU_ENUM_LABEL_ONSCREEN_VIDEO_LAYOUT_SETTINGS:
|
||||
#endif
|
||||
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_OVERLAY];
|
||||
case MENU_ENUM_LABEL_UPDATE_CG_SHADERS:
|
||||
case MENU_ENUM_LABEL_UPDATE_GLSL_SHADERS:
|
||||
|
@ -2262,6 +2262,9 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
|
||||
return xmb->textures.list[XMB_TEXTURE_IMAGE];
|
||||
case MENU_ENUM_LABEL_UPDATE_OVERLAYS:
|
||||
case MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS:
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
case MENU_ENUM_LABEL_ONSCREEN_VIDEO_LAYOUT_SETTINGS:
|
||||
#endif
|
||||
return xmb->textures.list[XMB_TEXTURE_OVERLAY];
|
||||
case MENU_ENUM_LABEL_UPDATE_CG_SHADERS:
|
||||
case MENU_ENUM_LABEL_UPDATE_GLSL_SHADERS:
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user