diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000000..bb8f7892cf --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,35 @@ +# First and foremost consider this: +- Only RetroArch bugs should be filed here. Not core bugs or game bugs +- This is not a forum or a help section, this is strictly developer oriented + +## Description + +[Description of the bug] + +### Expected behavior + +[What you expected to happen] + +### Actual behavior + +[What is actually happening] + +### Steps to reproduce the bug + +1. [First step] +2. [Second step] +3. [and so on...] + +### Bisect Results + +[Try to bisect and tell us when this started happening] + +### Version/Commit +You can find this information under Information/System Information + +- RetroArch: [version/commit] + +### Environment information + +- OS: [The operating system you're running] +- Compiler: [In case you are running local builds] diff --git a/.gitignore b/.gitignore index 85b23f3d15..74d1108101 100644 --- a/.gitignore +++ b/.gitignore @@ -65,6 +65,9 @@ menu/driverspzarch.c # Ctags /tags +# CLion +/cmake-build-debug/ + # Android /pkg/android/phoenix/obj/ /pkg/android/phoenix/assets/ diff --git a/Makefile b/Makefile index c31e4bdb95..0b2013e54f 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,11 @@ LIBS := DEFINES := -DHAVE_CONFIG_H -DRARCH_INTERNAL -DHAVE_OVERLAY DEFINES += -DGLOBAL_CONFIG_DIR='"$(GLOBAL_CONFIG_DIR)"' +ifneq ($(findstring DOS,$(OS)),) + CFLAGS += -march=i386 + LDFLAGS += -lemu +endif + ifneq ($(findstring Win32,$(OS)),) LDFLAGS += -static-libgcc endif diff --git a/Makefile.common b/Makefile.common index e3e3d219ae..f9247a28bb 100644 --- a/Makefile.common +++ b/Makefile.common @@ -26,6 +26,15 @@ ifeq ($(HAVE_VIDEO_PROCESSOR), 1) DEFINES += -DHAVE_VIDEO_PROCESSOR endif +ifeq ($(HAVE_MENU), 1) + DEFINES += -DHAVE_MENU + HAVE_MENU_COMMON = 1 +endif + +ifeq ($(HAVE_SOCKET_LEGACY), 1) + DEFINES += -DHAVE_SOCKET_LEGACY +endif + ifeq ($(HAVE_HID), 1) DEFINES += -DHAVE_HID endif @@ -34,6 +43,10 @@ ifeq ($(HAVE_LIBRETRODB), 1) DEFINES += -DHAVE_LIBRETRODB endif +ifeq ($(HAVE_VITA2D), 1) + DEFINES += -DHAVE_VITA2D +endif + ifeq ($(HAVE_FBO), 1) DEFINES += -DHAVE_FBO endif @@ -81,6 +94,11 @@ CFLAGS += -I$(LIBRETRO_COMM_DIR)/include # Switches +ifeq ($(HAVE_NETLOGGER), 1) + CFLAGS += -DHAVE_LOGGER + DEFINES += -DHAVE_LOGGER + OBJ += network/net_logger.o +endif # System @@ -232,6 +250,7 @@ OBJ += frontend/frontend.o \ performance_counters.o \ verbosity.o + ifeq ($(HAVE_CC_RESAMPLER), 1) DEFINES += -DHAVE_CC_RESAMPLER OBJ += audio/drivers_resampler/cc_resampler.o @@ -422,7 +441,8 @@ endif ifeq ($(HAVE_NEON),1) OBJ += $(LIBRETRO_COMM_DIR)/audio/resampler/drivers/sinc_resampler_neon.o \ - audio/drivers_resampler/cc_resampler_neon.o + audio/drivers_resampler/cc_resampler_neon.o \ + memory/neon/memcpy-neon.o # When compiled without this, tries to attempt to compile sinc lerp, # which will error out # @@ -441,8 +461,11 @@ ifeq ($(HAVE_NEON),1) endif ifneq ($(findstring Win32,$(OS)),) -HAVE_VULKAN=1 -DEFINES += -DHAVE_VULKAN + # if user explicitly sets --disable-vulkan on Windows, then disable it + ifneq ($(HAVE_NO_VULKAN),1) + HAVE_VULKAN=1 + DEFINES += -DHAVE_VULKAN + endif endif HW_CONTEXT_MENU_DRIVERS=$(HAVE_RGUI) @@ -474,10 +497,10 @@ ifeq ($(HW_CONTEXT_MENU_DRIVERS), 1) HAVE_XMB = 1 endif else - HAVE_ZARCH = 0 - HAVE_MATERIALUI = 0 - #HAVE_NUKLEAR = 0 - HAVE_XMB = 0 + HAVE_ZARCH ?= 0 + HAVE_MATERIALUI ?= 0 + #HAVE_NUKLEAR ?= 0 + HAVE_XMB ?= 0 endif ifeq ($(HAVE_RGUI), 1) @@ -487,6 +510,7 @@ ifeq ($(HAVE_RGUI), 1) ifeq ($(HAVE_MATERIALUI), 1) OBJ += menu/drivers/materialui.o DEFINES += -DHAVE_MATERIALUI + HAVE_MENU_COMMON = 1 endif ifeq ($(HAVE_NUKLEAR), 1) OBJ += menu/drivers/nuklear/nk_common.o @@ -502,10 +526,13 @@ ifeq ($(HAVE_ZARCH), 1) OBJ += menu/drivers/zarch.o DEFINES += -DHAVE_ZARCH endif + +endif + ifeq ($(HAVE_XMB), 1) OBJ += menu/drivers/xmb.o DEFINES += -DHAVE_XMB -endif + HAVE_MENU_COMMON = 1 endif ifeq ($(HAVE_LAKKA), 1) @@ -554,9 +581,14 @@ ifeq ($(HAVE_MENU_COMMON), 1) menu/drivers/null.o endif +ifeq ($(HAVE_OVERLAY), 1) + DEFINES += -DHAVE_OVERLAY +endif + ifeq ($(HAVE_STB_FONT), 1) OBJ += gfx/drivers_font_renderer/stb.o OBJ += gfx/drivers_font_renderer/stb_unicode.o + DEFINES += -DHAVE_STB_FONT endif ifeq ($(HAVE_FREETYPE), 1) @@ -580,6 +612,30 @@ ifeq ($(HAVE_THREAD_STORAGE), 1) DEFINES += -DHAVE_THREAD_STORAGE endif +ifeq ($(HAVE_VITA2D), 1) + OBJ += $(DEPS_DIR)/libvita2d/source/vita2d.o \ + $(DEPS_DIR)/libvita2d/source/vita2d_texture.o \ + $(DEPS_DIR)/libvita2d/source/vita2d_draw.o \ + $(DEPS_DIR)/libvita2d/source/utils.o + + OBJ += $(DEPS_DIR)/libvita2d/shader/clear_v_gxp.o \ + $(DEPS_DIR)/libvita2d/shader/clear_f_gxp.o \ + $(DEPS_DIR)/libvita2d/shader/color_v_gxp.o \ + $(DEPS_DIR)/libvita2d/shader/color_f_gxp.o \ + $(DEPS_DIR)/libvita2d/shader/texture_v_gxp.o \ + $(DEPS_DIR)/libvita2d/shader/texture_f_gxp.o \ + $(DEPS_DIR)/libvita2d/shader/texture_tint_f_gxp.o + +ifeq ($(HAVE_MENU),1) + OBJ += menu/drivers_display/menu_display_vita2d.o +endif + + OBJ += gfx/drivers/vita2d_gfx.o \ + gfx/drivers_font/vita2d_font.o + + CFLAGS += -I$(DEPS_DIR)/libvita2d/include +endif + ifeq ($(HAVE_WAYLAND), 1) OBJ += gfx/drivers_context/wayland_ctx.o DEFINES += $(WAYLAND_CFLAGS) $(WAYLAND_CURSOR_CFLAGS) @@ -925,8 +981,7 @@ ifeq ($(HAVE_OMAP), 1) endif ifeq ($(HAVE_EXYNOS), 1) - OBJ += gfx/drivers/exynos_gfx.o \ - memory/neon/memcpy-neon.o + OBJ += gfx/drivers/exynos_gfx.o LIBS += $(DRM_LIBS) $(EXYNOS_LIBS) DEFINES += $(DRM_CFLAGS) $(EXYNOS_CFLAGS) HAVE_AND_WILL_USE_DRM = 1 @@ -1110,7 +1165,8 @@ ifeq ($(HAVE_NETWORKING), 1) network/net_http_special.o \ tasks/task_http.o \ tasks/task_netplay_lan_scan.o \ - tasks/task_wifi.o + tasks/task_wifi.o \ + tasks/task_netplay_find_content.o ifneq ($(HAVE_SOCKET_LEGACY),1) OBJ += $(LIBRETRO_COMM_DIR)/net/net_ifinfo.o @@ -1161,6 +1217,13 @@ ifneq ($(findstring Win32,$(OS)),) input/drivers_keyboard/keyboard_event_win32.o \ gfx/common/win32_common.o \ frontend/drivers/platform_win32.o + + OBJ += gfx/drivers/gdi_gfx.o \ + gfx/drivers_context/gdi_ctx.o \ + gfx/drivers_font/gdi_font.o \ + menu/drivers_display/menu_display_gdi.o + + LIBS += -lmsimg32 endif ifeq ($(HAVE_AVFOUNDATION), 1) @@ -1206,3 +1269,11 @@ ifeq ($(HAVE_COCOA),1) ui/drivers/cocoa/cocoa_common.o \ gfx/drivers_context/cocoa_gl_ctx.o endif + +ifneq ($(findstring DOS,$(OS)),) + OBJ += gfx/drivers/vga_gfx.o gfx/drivers_font/vga_font.o + + ifeq ($(HAVE_MENU_COMMON), 1) + OBJ += menu/drivers_display/menu_display_vga.o + endif +endif diff --git a/Makefile.griffin b/Makefile.griffin index 5c9d62ec3a..34c05785e3 100644 --- a/Makefile.griffin +++ b/Makefile.griffin @@ -1,13 +1,15 @@ -DEBUG = 0 -HAVE_LOGGER = 0 -HAVE_FILE_LOGGER = 0 -HAVE_CC_RESAMPLER = 1 -WHOLE_ARCHIVE_LINK = 0 -BIG_STACK = 1 +ROOT_DIR := . +DEPS_DIR := $(ROOT_DIR)/deps +DEBUG = 0 +HAVE_LOGGER = 0 +HAVE_FILE_LOGGER = 0 +HAVE_CC_RESAMPLER = 1 +WHOLE_ARCHIVE_LINK = 0 +BIG_STACK = 1 PC_DEVELOPMENT_IP_ADDRESS = 255.255.255.255 PC_DEVELOPMENT_UDP_PORT = 3490 -RARCH_CONSOLE = 0 -USBGECKO = 0 +RARCH_CONSOLE = 0 +USBGECKO = 0 ifneq ($(EMSCRIPTEN),) platform = emscripten @@ -219,19 +221,20 @@ else ifeq ($(platform), vita) -lScePower_stub -lSceRtc_stub -lSceCommonDialog_stub -lScePgf_stub \ -lSceMotion_stub -lSceAppMgr_stub -lpng -lm -lc - PLATEXTRA := deps/libvita2d/shader/compiled/clear_v_gxp.o \ - deps/libvita2d/shader/compiled/clear_f_gxp.o \ - deps/libvita2d/shader/compiled/color_v_gxp.o \ - deps/libvita2d/shader/compiled/color_f_gxp.o \ - deps/libvita2d/shader/compiled/texture_v_gxp.o \ - deps/libvita2d/shader/compiled/texture_f_gxp.o \ - deps/libvita2d/shader/compiled/texture_tint_f_gxp.o - PLATOBJS += \ - libretro-common/audio/conversion/s16_to_float_neon.o \ - libretro-common/audio/conversion/float_to_s16_neon.o \ - memory/neon/memcpy-neon.o \ - libretro-common/audio/resampler/drivers/sinc_resampler_neon.o \ - audio/drivers_resampler/cc_resampler_neon.o + PLATOBJS += $(DEPS_DIR)/libvita2d/shader/clear_v_gxp.o \ + $(DEPS_DIR)/libvita2d/shader/clear_f_gxp.o \ + $(DEPS_DIR)/libvita2d/shader/color_v_gxp.o \ + $(DEPS_DIR)/libvita2d/shader/color_f_gxp.o \ + $(DEPS_DIR)/libvita2d/shader/texture_v_gxp.o \ + $(DEPS_DIR)/libvita2d/shader/texture_f_gxp.o \ + $(DEPS_DIR)/libvita2d/shader/texture_tint_f_gxp.o + + PLATOBJS += \ + libretro-common/audio/conversion/s16_to_float_neon.o \ + libretro-common/audio/conversion/float_to_s16_neon.o \ + memory/neon/memcpy-neon.o \ + libretro-common/audio/resampler/drivers/sinc_resampler_neon.o \ + audio/drivers_resampler/cc_resampler_neon.o LIBDIRS += -L. LDFLAGS += -Wl,-q diff --git a/Makefile.vita b/Makefile.vita new file mode 100644 index 0000000000..9b27cb4b32 --- /dev/null +++ b/Makefile.vita @@ -0,0 +1,198 @@ +TARGET := retroarch_vita +DEBUG ?= 0 +GRIFFIN_BUILD = 0 +WHOLE_ARCHIVE_LINK = 0 + +VITA_TITLE_ID := RETROARCH +VITA_TITLE_NAME := RetroArch + +PC_DEVELOPMENT_IP_ADDRESS = +PC_DEVELOPMENT_UDP_PORT = + +OBJ := + +DEFINES := + +ifeq ($(GRIFFIN_BUILD), 1) + OBJ += griffin/griffin.o + DEFINES += -DHAVE_GRIFFIN=1 + DEFINES += -DHAVE_NEON -DHAVE_MENU -DHAVE_XMB -DHAVE_MATERIALUI -DHAVE_LIBRETRODB + DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -DHAVE_CC_RESAMPLER + ifeq ($(DEBUG), 1) + DEFINES += -DHAVE_NETLOGGER + endif +else + + HAVE_NEON := 1 + HAVE_FILTERS_BUILTIN := 1 + HAVE_LANGEXTRA := 1 + HAVE_RPNG := 1 + HAVE_RJPEG := 1 + HAVE_RBMP := 1 + HAVE_RTGA := 1 + HAVE_ZLIB := 1 + HAVE_7ZIP := 1 + HAVE_VITA2D := 1 + HAVE_NETWORKING := 1 + HAVE_SOCKET_LEGACY := 1 + HAVE_MENU := 1 + HAVE_MENU_COMMON := 1 + HAVE_OVERLAY := 1 + HAVE_MATERIALUI := 1 + HAVE_XMB := 1 + HAVE_RGUI := 1 + HAVE_STB_FONT := 1 + HAVE_THREADS := 1 + HAVE_LIBRETRODB := 1 + HAVE_CC_RESAMPLER := 1 + RARCH_CONSOLE := 1 + + ifeq ($(DEBUG), 1) + HAVE_NETLOGGER = 1 + endif + + include Makefile.common + BLACKLIST := + OBJ := $(filter-out $(BLACKLIST),$(OBJ)) + + OBJ += input/drivers/psp_input.o + OBJ += input/drivers_joypad/psp_joypad.o + OBJ += audio/drivers/psp_audio.o + OBJ += frontend/drivers/platform_psp.o + OBJ += gfx/video_filters/2xsai.o + OBJ += gfx/video_filters/super2xsai.o + OBJ += gfx/video_filters/supereagle.o + OBJ += gfx/video_filters/2xbr.o + OBJ += gfx/video_filters/darken.o + OBJ += gfx/video_filters/epx.o + OBJ += gfx/video_filters/scale2x.o + OBJ += gfx/video_filters/blargg_ntsc_snes.o + OBJ += gfx/video_filters/lq2x.o + OBJ += gfx/video_filters/phosphor2x.o + OBJ += libretro-common/audio/dsp_filters/echo.o + OBJ += libretro-common/audio/dsp_filters/eq.o + OBJ += libretro-common/audio/dsp_filters/chorus.o + OBJ += libretro-common/audio/dsp_filters/iir.o + OBJ += libretro-common/audio/dsp_filters/panning.o + OBJ += libretro-common/audio/dsp_filters/phaser.o + OBJ += libretro-common/audio/dsp_filters/reverb.o + OBJ += libretro-common/audio/dsp_filters/wahwah.o +endif + + +ifeq ($(strip $(VITASDK)),) +$(error "Please set VITASDK in your environment. export VITASDK=vitasdk") +endif + +export PATH := $(PATH):$(VITASDK)/bin + +PREFIX := arm-vita-eabi- + +CC := $(PREFIX)gcc +CXX := $(PREFIX)g++ +AS := $(PREFIX)as +AR := $(PREFIX)ar +OBJCOPY := $(PREFIX)objcopy +STRIP := $(PREFIX)strip +NM := $(PREFIX)nm +LD := $(CXX) + +INCDIRS := -I. -Ideps/zlib -Ideps/7zip -Ilibretro-common/include +LIBDIRS := -L. + +ARCHFLAGS := -march=armv7-a -mfpu=neon -mfloat-abi=hard -DVITA +CFLAGS += $(ARCHFLAGS) -mword-relocations -fno-optimize-sibling-calls + +ifeq ($(DEBUG), 1) + CFLAGS += -O2 -g +else + CFLAGS += -O3 +endif + +ASFLAGS := $(CFLAGS) +LDFLAGS := -Wl,-q + +CFLAGS += -Wall -ffast-math +CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE +CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES) + +ifneq ($(PC_DEVELOPMENT_IP_ADDRESS),) + CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS='"$(PC_DEVELOPMENT_IP_ADDRESS)"' +endif + +ifneq ($(PC_DEVELOPMENT_UDP_PORT),) + CFLAGS += -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) +endif + +ifeq ($(WHOLE_ARCHIVE_LINK), 1) + WHOLE_START := -Wl,--whole-archive + WHOLE_END := -Wl,--no-whole-archive +endif +CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions + +VITA_LIBS := -lSceDisplay_stub -lSceGxm_stub -lSceNet_stub -lSceNetCtl_stub \ + -lSceSysmodule_stub -lSceCtrl_stub -lSceTouch_stub -lSceAudio_stub \ + -lScePower_stub -lSceRtc_stub -lSceCommonDialog_stub -lScePgf_stub \ + -lSceFiber_stub -lSceMotion_stub -lSceAppMgr_stub -lpthread -lpng -lz + +LIBS := $(WHOLE_START) -lretro_vita $(WHOLE_END) $(VITA_LIBS) -lm -lc + +TARGETS := $(TARGET).vpk + +DEPFLAGS = -MT $@ -MMD -MP -MF $*.Tdepend +POSTCOMPILE = mv -f $*.Tdepend $*.depend + + +all: $(TARGETS) + +%.o: %.cpp +%.o: %.cpp %.depend + $(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS) $(DEPFLAGS) + $(POSTCOMPILE) + +%.o: %.c +%.o: %.c %.depend + $(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) $(DEPFLAGS) + $(POSTCOMPILE) + + +%.o: %.S +%.o: %.S %.depend + $(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS) + $(POSTCOMPILE) + +%.o: %.s +%.o: %.s %.depend + $(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS) + $(POSTCOMPILE) + +%.depend: ; + +$(TARGET).elf: $(OBJ) libretro_vita.a + $(LD) $(OBJ) $(LDFLAGS) $(LIBDIRS) $(LIBS) -o $@ + +%.velf: %.elf + vita-elf-create $< $@ + +%.self: %.velf + vita-make-fself -c -s $< $@ + +%.vpk: %.self + vita-mksfoex -s TITLE_ID=$(VITA_TITLE_ID) "$(VITA_TITLE_NAME)" param.sfo + vita-pack-vpk -s param.sfo -b $< $@ + +clean: + rm -f $(OBJ) $(TARGET).elf $(TARGET).velf $(TARGET).self param.sfo $(TARGET).vpk + rm -f $(OBJ:.o=.depend) + +# Useful for developers +vpksend: $(TARGET).vpk + curl -T $< ftp://$(PSVITAIP):1337/ux0:/ + +send: $(TARGET).self + curl -T $< ftp://$(PSVITAIP):1337/ux0:/app/$(VITA_TITLE_ID)/eboot.bin + +.PHONY: clean all send vpksend +.PRECIOUS: %.depend + +-include $(OBJ:.o=.depend) diff --git a/Makefile.vita.salamander b/Makefile.vita.salamander index 2ff3976a32..8e86cdb0a1 100644 --- a/Makefile.vita.salamander +++ b/Makefile.vita.salamander @@ -21,7 +21,7 @@ RARCH_DEFINES = -DVITA -DIS_SALAMANDER -DRARCH_CONSOLE LIBDIR = LDFLAGS = -LIBS = -lSceKernel_stub -lSceDisplay_stub -lSceGxm_stub -lSceNet_stub -lSceNetCtl_stub\ +LIBS = -lSceDisplay_stub -lSceGxm_stub -lSceNet_stub -lSceNetCtl_stub\ -lSceSysmodule_stub -lSceCtrl_stub -lSceAudio_stub -lSceFiber_stub\ -lScePower_stub -lSceRtc_stub -lSceCommonDialog_stub -lScePgf_stub \ -lSceMotion_stub -lSceAppMgr_stub -lfreetype -lpng -lm -lc @@ -48,7 +48,7 @@ OBJS = frontend/frontend_salamander.o \ libretro-common/file/retro_stat.o \ libretro-common/hash/rhash.o \ file_path_str.o \ - verbosity.o + verbosity.o all: $(TARGET).vpk @@ -67,7 +67,7 @@ $(TARGET).elf: $(OBJS) %.o: %.png $(PREFIX)-ld -r -b binary -o $@ $^ - + clean: @rm -rf $(TARGET).vpk $(TARGET).velf $(TARGET).elf $(OBJS) \ eboot.bin param.sfo diff --git a/audio/audio_driver.c b/audio/audio_driver.c index e0a2f09d28..084c1e573e 100644 --- a/audio/audio_driver.c +++ b/audio/audio_driver.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -456,11 +456,9 @@ static bool audio_driver_init_internal(bool audio_cb_inited) RARCH_WARN("Audio rate control was desired, but driver does not support needed features.\n"); } + /* If we start muted, stop the audio driver, so subsequent unmute works. */ if (!audio_cb_inited && audio_driver_active && settings->audio.mute_enable) - { - /* If we start muted, stop the audio driver, so subsequent unmute works. */ audio_driver_stop(); - } command_event(CMD_EVENT_DSP_FILTER_INIT, NULL); @@ -472,7 +470,7 @@ static bool audio_driver_init_internal(bool audio_cb_inited) && !settings->audio.mute_enable && audio_cb_inited ) - audio_driver_start(); + audio_driver_start(false); return true; @@ -509,6 +507,9 @@ void audio_driver_set_nonblocking_state(bool enable) static bool audio_driver_flush(const int16_t *data, size_t samples) { struct resampler_data src_data; + bool is_paused = false; + bool is_idle = false; + bool is_slowmotion = false; static struct retro_perf_counter resampler_proc = {0}; static struct retro_perf_counter audio_convert_s16 = {0}; const void *output_data = NULL; @@ -525,7 +526,9 @@ static bool audio_driver_flush(const int16_t *data, size_t samples) if (recording_data) recording_push_audio(data, samples); - if (runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL) || settings->audio.mute_enable) + runloop_get_status(&is_paused, &is_idle, &is_slowmotion); + + if (is_paused || settings->audio.mute_enable) return true; if (!audio_driver_active || !audio_driver_input_data) return false; @@ -597,7 +600,7 @@ static bool audio_driver_flush(const int16_t *data, size_t samples) src_data.ratio = audio_source_ratio_current; - if (runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, NULL)) + if (is_slowmotion) src_data.ratio *= settings->slowmotion_ratio; performance_counter_init(&resampler_proc, "resampler_proc"); @@ -965,12 +968,12 @@ bool audio_driver_toggle_mute(void) return true; } -bool audio_driver_start(void) +bool audio_driver_start(bool is_shutdown) { if (!current_audio || !current_audio->start || !audio_driver_context_audio_data) return false; - return current_audio->start(audio_driver_context_audio_data); + return current_audio->start(audio_driver_context_audio_data, is_shutdown); } bool audio_driver_stop(void) diff --git a/audio/audio_driver.h b/audio/audio_driver.h index 02cbd3983c..10ce09f044 100644 --- a/audio/audio_driver.h +++ b/audio/audio_driver.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -55,7 +55,7 @@ typedef struct audio_driver bool (*stop)(void *data); /* Starts driver. */ - bool (*start)(void *data); + bool (*start)(void *data, bool is_shutdown); /* Is the audio driver currently running? */ bool (*alive)(void *data); @@ -171,7 +171,7 @@ bool audio_driver_find_driver(void); bool audio_driver_toggle_mute(void); -bool audio_driver_start(void); +bool audio_driver_start(bool is_shutdown); bool audio_driver_stop(void); diff --git a/audio/audio_thread_wrapper.c b/audio/audio_thread_wrapper.c index 24d5fa299e..7e383a112d 100644 --- a/audio/audio_thread_wrapper.c +++ b/audio/audio_thread_wrapper.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -35,6 +35,7 @@ typedef struct audio_thread bool stopped; bool stopped_ack; bool is_paused; + bool is_shutdown; bool use_float; int inited; @@ -100,7 +101,7 @@ static void audio_thread_loop(void *data) scond_wait(thr->cond, thr->lock); } - thr->driver->start(thr->driver_data); + thr->driver->start(thr->driver_data, thr->is_shutdown); } slock_unlock(thr->lock); @@ -197,7 +198,7 @@ static bool audio_thread_stop(void *data) return true; } -static bool audio_thread_start(void *data) +static bool audio_thread_start(void *data, bool is_shutdown) { audio_thread_t *thr = (audio_thread_t*)data; @@ -206,7 +207,8 @@ static bool audio_thread_start(void *data) audio_driver_enable_callback(); - thr->is_paused = false; + thr->is_paused = false; + thr->is_shutdown = is_shutdown; audio_thread_unblock(thr); return true; diff --git a/audio/audio_thread_wrapper.h b/audio/audio_thread_wrapper.h index c47a7fd116..298941d4ff 100644 --- a/audio/audio_thread_wrapper.h +++ b/audio/audio_thread_wrapper.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/audio/drivers/alsa.c b/audio/drivers/alsa.c index 992948ac5b..3bdf9b41bc 100644 --- a/audio/drivers/alsa.c +++ b/audio/drivers/alsa.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -270,7 +271,7 @@ static void alsa_set_nonblock_state(void *data, bool state) alsa->nonblock = state; } -static bool alsa_start(void *data) +static bool alsa_start(void *data, bool is_shutdown) { alsa_t *alsa = (alsa_t*)data; diff --git a/audio/drivers/alsa_qsa.c b/audio/drivers/alsa_qsa.c index 399128cc88..ef0fbab51d 100644 --- a/audio/drivers/alsa_qsa.c +++ b/audio/drivers/alsa_qsa.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -290,7 +290,7 @@ static bool alsa_qsa_alive(void *data) return false; } -static bool alsa_qsa_start(void *data) +static bool alsa_qsa_start(void *data, bool is_shutdown) { alsa_t *alsa = (alsa_t*)data; diff --git a/audio/drivers/alsathread.c b/audio/drivers/alsathread.c index 977705b1a0..c4e9d06f65 100644 --- a/audio/drivers/alsathread.c +++ b/audio/drivers/alsathread.c @@ -318,7 +318,7 @@ static void alsa_thread_set_nonblock_state(void *data, bool state) alsa->nonblock = state; } -static bool alsa_thread_start(void *data) +static bool alsa_thread_start(void *data, bool is_shutdown) { alsa_thread_t *alsa = (alsa_thread_t*)data; diff --git a/audio/drivers/coreaudio.c b/audio/drivers/coreaudio.c index d9e73a1251..bac9e59d0a 100644 --- a/audio/drivers/coreaudio.c +++ b/audio/drivers/coreaudio.c @@ -139,7 +139,7 @@ static void choose_output_device(coreaudio_t *dev, const char* device) AudioObjectPropertyAddress propaddr = { kAudioHardwarePropertyDevices, - kAudioObjectPropertyScopeGlobal, + kAudioObjectPropertyScopeOutput, kAudioObjectPropertyElementMaster }; UInt32 size = 0; @@ -155,14 +155,13 @@ static void choose_output_device(coreaudio_t *dev, const char* device) &propaddr, 0, 0, &size, devices) != noErr) goto done; - propaddr.mScope = kAudioDevicePropertyScopeOutput; propaddr.mSelector = kAudioDevicePropertyDeviceName; - size = 1024; for (i = 0; i < deviceCount; i ++) { char device_name[1024]; device_name[0] = 0; + size = 1024; if (AudioObjectGetPropertyData(devices[i], &propaddr, 0, 0, &size, device_name) == noErr @@ -398,7 +397,7 @@ static bool coreaudio_stop(void *data) return dev->is_paused ? true : false; } -static bool coreaudio_start(void *data) +static bool coreaudio_start(void *data, bool is_shutdown) { coreaudio_t *dev = (coreaudio_t*)data; if (!dev) diff --git a/audio/drivers/ctr_csnd_audio.c b/audio/drivers/ctr_csnd_audio.c index 04be820551..e7b2115549 100644 --- a/audio/drivers/ctr_csnd_audio.c +++ b/audio/drivers/ctr_csnd_audio.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2016 - Ali Bouhlel + * Copyright (C) 2014-2017 - Ali Bouhlel * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -20,7 +20,6 @@ #include "../audio_driver.h" #include "../../performance_counters.h" -#include "../../runloop.h" typedef struct { @@ -95,7 +94,8 @@ Result csndPlaySound_custom(int chn, u32 flags, float vol, float pan, if (loopMode == CSND_LOOPMODE_NORMAL && paddr1 > paddr0) { - // Now that the first block is playing, configure the size of the subsequent blocks + /* Now that the first block is playing, + * configure the size of the subsequent blocks */ size -= paddr1 - paddr0; CSND_SetBlock(chn, 1, paddr1, size); } @@ -149,7 +149,9 @@ static void ctr_csnd_audio_free(void *data) { ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data; -// csndExit(); +#if 0 + csndExit(); +#endif CSND_SetPlayState(0x8, 0); CSND_SetPlayState(0x9, 0); csndExecCmds(false); @@ -242,14 +244,13 @@ static bool ctr_csnd_audio_alive(void *data) return ctr->playing; } -static bool ctr_csnd_audio_start(void *data) +static bool ctr_csnd_audio_start(void *data, bool is_shutdown) { ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data; /* Prevents restarting audio when the menu * is toggled off on shutdown */ - - if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL)) + if (is_shutdown) return true; #if 0 diff --git a/audio/drivers/ctr_dsp_audio.c b/audio/drivers/ctr_dsp_audio.c index f906c67b79..66578bba5c 100644 --- a/audio/drivers/ctr_dsp_audio.c +++ b/audio/drivers/ctr_dsp_audio.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2016 - Ali Bouhlel + * Copyright (C) 2014-2017 - Ali Bouhlel * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -19,7 +19,6 @@ #include "../audio_driver.h" #include "../../performance_counters.h" -#include "../../runloop.h" #include "../../ctr/ctr_debug.h" typedef struct @@ -60,7 +59,7 @@ static void *ctr_dsp_audio_init(const char *device, unsigned rate, unsigned late ctr->channel = 0; ndspSetOutputMode(NDSP_OUTPUT_STEREO); - ndspSetClippingMode(NDSP_CLIP_SOFT); //?? + ndspSetClippingMode(NDSP_CLIP_SOFT); /* ?? */ ndspSetOutputCount(1); ndspChnReset(ctr->channel); ndspChnSetFormat(ctr->channel, NDSP_FORMAT_STEREO_PCM16); @@ -162,14 +161,13 @@ static bool ctr_dsp_audio_alive(void *data) return ctr->playing; } -static bool ctr_dsp_audio_start(void *data) +static bool ctr_dsp_audio_start(void *data, bool is_shutdown) { ctr_dsp_audio_t* ctr = (ctr_dsp_audio_t*)data; /* Prevents restarting audio when the menu * is toggled off on shutdown */ - - if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL)) + if (is_shutdown) return true; ndspSetMasterVol(1.0); diff --git a/audio/drivers/dsound.c b/audio/drivers/dsound.c index 2f33ab29df..1af78d9c15 100644 --- a/audio/drivers/dsound.c +++ b/audio/drivers/dsound.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -396,7 +396,7 @@ static bool dsound_stop(void *data) return (ds->is_paused) ? true : false; } -static bool dsound_start(void *data) +static bool dsound_start(void *data, bool is_shutdown) { dsound_t *ds = (dsound_t*)data; diff --git a/audio/drivers/gx_audio.c b/audio/drivers/gx_audio.c index 55a95d4cab..d495c4e6f2 100644 --- a/audio/drivers/gx_audio.c +++ b/audio/drivers/gx_audio.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -173,7 +173,7 @@ static void gx_audio_set_nonblock_state(void *data, bool state) wa->nonblock = state; } -static bool gx_audio_start(void *data) +static bool gx_audio_start(void *data, bool is_shutdown) { gx_audio_t *wa = (gx_audio_t*)data; diff --git a/audio/drivers/jack.c b/audio/drivers/jack.c index 08ce009148..ee0cb78d70 100644 --- a/audio/drivers/jack.c +++ b/audio/drivers/jack.c @@ -322,7 +322,7 @@ static void ja_set_nonblock_state(void *data, bool state) jd->nonblock = state; } -static bool ja_start(void *data) +static bool ja_start(void *data, bool is_shutdown) { jack_t *jd = (jack_t*)data; if (jd) diff --git a/audio/drivers/nullaudio.c b/audio/drivers/nullaudio.c index 991105e699..d0d9c0d36b 100644 --- a/audio/drivers/nullaudio.c +++ b/audio/drivers/nullaudio.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -54,7 +55,7 @@ static bool null_audio_alive(void *data) return true; } -static bool null_audio_start(void *data) +static bool null_audio_start(void *data, bool is_shutdown) { (void)data; return true; diff --git a/audio/drivers/openal.c b/audio/drivers/openal.c index 76bb3a9bc8..fc94f78e29 100644 --- a/audio/drivers/openal.c +++ b/audio/drivers/openal.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -234,7 +235,7 @@ static void al_set_nonblock_state(void *data, bool state) al->nonblock = state; } -static bool al_start(void *data) +static bool al_start(void *data, bool is_shutdown) { al_t *al = (al_t*)data; if (al) diff --git a/audio/drivers/opensl.c b/audio/drivers/opensl.c index 51c3acd1eb..7fe162ef57 100644 --- a/audio/drivers/opensl.c +++ b/audio/drivers/opensl.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -221,7 +221,7 @@ static void sl_set_nonblock_state(void *data, bool state) sl->nonblock = state; } -static bool sl_start(void *data) +static bool sl_start(void *data, bool is_shutdown) { sl_t *sl = (sl_t*)data; sl->is_paused = (SLPlayItf_SetPlayState(sl->player, SL_PLAYSTATE_PLAYING) diff --git a/audio/drivers/oss.c b/audio/drivers/oss.c index 263289379a..c7b84bc8bf 100644 --- a/audio/drivers/oss.c +++ b/audio/drivers/oss.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -124,7 +125,7 @@ static bool oss_stop(void *data) return true; } -static bool oss_start(void *data) +static bool oss_start(void *data, bool is_shutdown) { (void)data; oss_is_paused = false; diff --git a/audio/drivers/ps3_audio.c b/audio/drivers/ps3_audio.c index 2fb0c0cc07..38358babf5 100644 --- a/audio/drivers/ps3_audio.c +++ b/audio/drivers/ps3_audio.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -177,7 +177,7 @@ static bool ps3_audio_stop(void *data) return true; } -static bool ps3_audio_start(void *data) +static bool ps3_audio_start(void *data, bool is_shutdown) { ps3_audio_t *aud = data; if (!aud->started) diff --git a/audio/drivers/psp_audio.c b/audio/drivers/psp_audio.c index d3fa1f27d3..0181c9614a 100644 --- a/audio/drivers/psp_audio.c +++ b/audio/drivers/psp_audio.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2016 - Ali Bouhlel + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Ali Bouhlel * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -18,6 +18,7 @@ #include #include #include +#include #ifdef VITA #include @@ -284,7 +285,7 @@ static bool psp_audio_stop(void *data) return true; } -static bool psp_audio_start(void *data) +static bool psp_audio_start(void *data, bool is_shutdown) { SceKernelThreadInfo info; psp_audio_t* psp = (psp_audio_t*)data; diff --git a/audio/drivers/pulse.c b/audio/drivers/pulse.c index eafd913ad1..61e47fd08f 100644 --- a/audio/drivers/pulse.c +++ b/audio/drivers/pulse.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -290,7 +291,7 @@ static bool pulse_alive(void *data) return !pa->is_paused; } -static bool pulse_start(void *data) +static bool pulse_start(void *data, bool is_shutdown) { bool ret; pa_t *pa = (pa_t*)data; diff --git a/audio/drivers/roar.c b/audio/drivers/roar.c index 90647fd889..374287ae10 100644 --- a/audio/drivers/roar.c +++ b/audio/drivers/roar.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -108,7 +109,7 @@ static void ra_set_nonblock_state(void *data, bool state) roar->nonblocking = state; } -static bool ra_start(void *data) +static bool ra_start(void *data, bool is_shutdown) { roar_t *roar = (roar_t*)data; if (roar) diff --git a/audio/drivers/rsound.c b/audio/drivers/rsound.c index 229536004b..258f42aa2a 100644 --- a/audio/drivers/rsound.c +++ b/audio/drivers/rsound.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -176,7 +177,7 @@ static bool rs_alive(void *data) return false; } -static bool rs_start(void *data) +static bool rs_start(void *data, bool is_shutdown) { rsd_t *rsd = (rsd_t*)data; if (rsd_start(rsd->rd) < 0) diff --git a/audio/drivers/rwebaudio.c b/audio/drivers/rwebaudio.c index 318cb166a9..5a90e69233 100644 --- a/audio/drivers/rwebaudio.c +++ b/audio/drivers/rwebaudio.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2015 - Michael Lelli + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -75,7 +76,7 @@ static bool rwebaudio_alive(void *data) return !rwebaudio_is_paused; } -static bool rwebaudio_start(void *data) +static bool rwebaudio_start(void *data, bool is_shutdown) { (void)data; rwebaudio_is_paused = false; diff --git a/audio/drivers/sdl_audio.c b/audio/drivers/sdl_audio.c index 72fc1a9434..0f36c15726 100644 --- a/audio/drivers/sdl_audio.c +++ b/audio/drivers/sdl_audio.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -202,7 +203,7 @@ static bool sdl_audio_alive(void *data) return !sdl->is_paused; } -static bool sdl_audio_start(void *data) +static bool sdl_audio_start(void *data, bool is_shutdown) { sdl_audio_t *sdl = (sdl_audio_t*)data; sdl->is_paused = false; diff --git a/audio/drivers/wiiu_audio.c b/audio/drivers/wiiu_audio.c index a547946905..6666158cc2 100644 --- a/audio/drivers/wiiu_audio.c +++ b/audio/drivers/wiiu_audio.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2016 - Ali Bouhlel - * Copyright (C) 2016 - FIX94 + * Copyright (C) 2014-2017 - Ali Bouhlel + * Copyright (C) 2016-2017 - FIX94 * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -34,7 +34,6 @@ #include "audio/audio_driver.h" #include "performance_counters.h" -#include "runloop.h" typedef struct { @@ -52,18 +51,21 @@ typedef struct #define AX_AUDIO_COUNT 3072 #define AX_AUDIO_SIZE (AX_AUDIO_COUNT << 1u) -#define AX_AUDIO_SAMPLE_COUNT 144 //3ms -#define AX_AUDIO_SAMPLE_MIN (AX_AUDIO_SAMPLE_COUNT * 3) //9ms -#define AX_AUDIO_SAMPLE_LOAD (AX_AUDIO_SAMPLE_COUNT * 10) //30ms +#define AX_AUDIO_SAMPLE_COUNT 144 /* 3ms */ +#define AX_AUDIO_SAMPLE_MIN (AX_AUDIO_SAMPLE_COUNT * 3) /* 9ms */ +#define AX_AUDIO_SAMPLE_LOAD (AX_AUDIO_SAMPLE_COUNT * 10)/* 30ms */ #define AX_AUDIO_MAX_FREE (AX_AUDIO_COUNT - (AX_AUDIO_SAMPLE_COUNT * 2)) #define AX_AUDIO_RATE 48000 -//#define ax_audio_ticks_to_samples(ticks) (((ticks) * 64) / 82875) -//#define ax_audio_samples_to_ticks(samples) (((samples) * 82875) / 64) + +#if 0 +#define ax_audio_ticks_to_samples(ticks) (((ticks) * 64) / 82875) +#define ax_audio_samples_to_ticks(samples) (((samples) * 82875) / 64) +#endif static volatile ax_audio_t *wiiu_cb_ax = NULL; void wiiu_ax_callback(void) { - //possibly called before unregister + /*possibly called before unregister */ if(wiiu_cb_ax == NULL) return; @@ -72,7 +74,7 @@ void wiiu_ax_callback(void) { if(OSUninterruptibleSpinLock_Acquire(&ax->spinlock)) { - //buffer underrun, stop playback to let it fill up + /* Buffer underrun, stop playback to let it fill up */ if(ax->written < AX_AUDIO_SAMPLE_MIN) AXSetMultiVoiceState(ax->mvoice, AX_VOICE_STATE_STOPPED); ax->written -= AX_AUDIO_SAMPLE_COUNT; @@ -180,17 +182,16 @@ static int ax_audio_limit(int in) return in; } -static bool ax_audio_start(void* data) +static bool ax_audio_start(void* data, bool is_shutdown) { ax_audio_t* ax = (ax_audio_t*)data; /* Prevents restarting audio when the menu * is toggled off on shutdown */ - - if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL)) + if (is_shutdown) return true; - //set back to playing on enough buffered data + /* Set back to playing on enough buffered data */ if(ax->written > AX_AUDIO_SAMPLE_LOAD) { AXSetMultiVoiceCurrentOffset(ax->mvoice, ax_audio_limit(ax->pos - ax->written)); @@ -211,7 +212,7 @@ static ssize_t ax_audio_write(void* data, const void* buf, size_t size) if(!size || (size & 0x3)) return 0; - //measure copy performance from here + /* Measure copy performance from here */ performance_counter_init(&ax_audio_write_perf, "ax_audio_write"); performance_counter_start(&ax_audio_write_perf); @@ -222,70 +223,80 @@ static ssize_t ax_audio_write(void* data, const void* buf, size_t size) if (ax->nonblocking) { - //not enough available for 3ms of data + /* Not enough available for 3ms of data */ if(countAvail < AX_AUDIO_SAMPLE_COUNT) count = 0; } else if(countAvail < count) { - //sync, wait for free memory + /* Sync, wait for free memory */ while(AXIsMultiVoiceRunning(ax->mvoice) && (countAvail < count)) { - OSYieldThread(); //gives threads with same priority time to run + OSYieldThread(); /* Gives threads with same priority time to run */ countAvail = (ax->written > AX_AUDIO_MAX_FREE ? 0 : (AX_AUDIO_MAX_FREE - ax->written)); } } - //over available space, do as much as possible + + /* Over available space, do as much as possible */ if(count > countAvail) count = countAvail; - //make sure we have input size + + /* make sure we have input size */ if(count > 0) { - //write in new data - size_t startPos = ax->pos; + /* write in new data */ + size_t startPos = ax->pos; int flushP2needed = 0; - int flushP2 = 0; + int flushP2 = 0; + for (i = 0; i < (count << 1); i += 2) { ax->buffer_l[ax->pos] = src[i]; ax->buffer_r[ax->pos] = src[i + 1]; - ax->pos = ax_audio_limit(ax->pos + 1); - //wrapped around, make sure to store cache + ax->pos = ax_audio_limit(ax->pos + 1); + + /* wrapped around, make sure to store cache */ if(ax->pos == 0) { flushP2needed = 1; - flushP2 = ((count << 1) - i); + flushP2 = ((count << 1) - i); DCStoreRangeNoSync(ax->buffer_l+startPos, (AX_AUDIO_COUNT-startPos) << 1); DCStoreRangeNoSync(ax->buffer_r+startPos, (AX_AUDIO_COUNT-startPos) << 1); } } - //standard cache store case + + /* standard cache store case */ if(!flushP2needed) { DCStoreRangeNoSync(ax->buffer_l+startPos, count << 1); DCStoreRange(ax->buffer_r+startPos, count << 1); - } //store the rest after wrap + } + /* store the rest after wrap */ else if(flushP2 > 0) { DCStoreRangeNoSync(ax->buffer_l, flushP2); DCStoreRange(ax->buffer_r, flushP2); } - //add in new audio data + + /* add in new audio data */ if(OSUninterruptibleSpinLock_Acquire(&ax->spinlock)) { ax->written += count; OSUninterruptibleSpinLock_Release(&ax->spinlock); } } - //possibly buffer underrun + + /* Possibly buffer underrun + * + * checks if it can be started + */ if(!AXIsMultiVoiceRunning(ax->mvoice)) - { - //checks if it can be started - ax_audio_start(ax); - } - //done copying new data + ax_audio_start(ax, false); + + /* Done copying new data */ performance_counter_stop(&ax_audio_write_perf); - //return what was actually copied + + /* return what was actually copied */ return (count << 2); } @@ -338,6 +349,6 @@ audio_driver_t audio_ax = "AX", NULL, NULL, -// ax_audio_write_avail, -// ax_audio_buffer_size +/* ax_audio_write_avail, */ +/* ax_audio_buffer_size */ }; diff --git a/audio/drivers/xaudio.cpp b/audio/drivers/xaudio.cpp index 36de2720ed..42f6ce5944 100644 --- a/audio/drivers/xaudio.cpp +++ b/audio/drivers/xaudio.cpp @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -29,6 +29,11 @@ #include #include +#if defined(_MSC_VER) && (_WIN32_WINNT <= _WIN32_WINNT_WIN2K) +/* needed for CoInitializeEx */ +#define _WIN32_DCOM +#endif + #include "xaudio.h" #include "../audio_driver.h" @@ -311,7 +316,7 @@ static void xa_set_nonblock_state(void *data, bool state) xa->nonblock = state; } -static bool xa_start(void *data) +static bool xa_start(void *data, bool is_shutdown) { xa_t *xa = (xa_t*)data; xa->is_paused = false; diff --git a/audio/drivers/xaudio.h b/audio/drivers/xaudio.h index fe30ac3efb..aa3bd59bcc 100644 --- a/audio/drivers/xaudio.h +++ b/audio/drivers/xaudio.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2010-2014 - OV2 * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/audio/drivers/xenon360_audio.c b/audio/drivers/xenon360_audio.c index 2563f3b091..b72e01fc4d 100644 --- a/audio/drivers/xenon360_audio.c +++ b/audio/drivers/xenon360_audio.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -112,7 +112,7 @@ static void xenon360_audio_set_nonblock_state(void *data, bool state) xa->nonblock = state; } -static bool xenon360_audio_start(void *data) +static bool xenon360_audio_start(void *data, bool is_shutdown) { xenon_audio_t *xa = data; xa->is_paused = false; diff --git a/audio/drivers_resampler/cc_resampler.c b/audio/drivers_resampler/cc_resampler.c index b156ac28f4..9bcfa74b5b 100644 --- a/audio/drivers_resampler/cc_resampler.c +++ b/audio/drivers_resampler/cc_resampler.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2016 - Ali Bouhlel ( aliaspider@gmail.com ) + * Copyright (C) 2014-2017 - Ali Bouhlel ( aliaspider@gmail.com ) * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/audio/drivers_resampler/cc_resampler_neon.S b/audio/drivers_resampler/cc_resampler_neon.S index 14d7ff13c4..5ab2816044 100644 --- a/audio/drivers_resampler/cc_resampler_neon.S +++ b/audio/drivers_resampler/cc_resampler_neon.S @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2015 - Ali Bouhlel ( aliaspider@gmail.com ) + * Copyright (C) 2014-2017 - Ali Bouhlel ( aliaspider@gmail.com ) * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/audio/librsound.c b/audio/librsound.c index 6934152413..3898bd73b3 100644 --- a/audio/librsound.c +++ b/audio/librsound.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/bootstrap/vita/sbrk.c b/bootstrap/vita/sbrk.c index ee47f8def9..051cae86b7 100644 --- a/bootstrap/vita/sbrk.c +++ b/bootstrap/vita/sbrk.c @@ -1,6 +1,9 @@ #include #include #include "../../defines/psp_defines.h" +#include +#include + static int _newlib_heap_memblock; static unsigned _newlib_heap_size; static char *_newlib_heap_base, *_newlib_heap_end, *_newlib_heap_cur; diff --git a/camera/camera_driver.c b/camera/camera_driver.c index 249e563908..4ce2ef7ca5 100644 --- a/camera/camera_driver.c +++ b/camera/camera_driver.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/camera/camera_driver.h b/camera/camera_driver.h index 32f763b610..c91433bdf0 100644 --- a/camera/camera_driver.h +++ b/camera/camera_driver.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/camera/drivers/android.c b/camera/drivers/android.c index 086c174e09..2ee7541e33 100644 --- a/camera/drivers/android.c +++ b/camera/drivers/android.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/camera/drivers/nullcamera.c b/camera/drivers/nullcamera.c index f989ed26f3..bb0cc82c5c 100644 --- a/camera/drivers/nullcamera.c +++ b/camera/drivers/nullcamera.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2015 - Michael Lelli + * Copyright (C) 2012-2015 - Michael Lelli + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/camera/drivers/rwebcam.c b/camera/drivers/rwebcam.c index 8e07fda6a4..c630f0f4c1 100644 --- a/camera/drivers/rwebcam.c +++ b/camera/drivers/rwebcam.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2012-2015 - Michael Lelli + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/camera/drivers/video4linux2.c b/camera/drivers/video4linux2.c index 93066d0e55..a73a47b588 100644 --- a/camera/drivers/video4linux2.c +++ b/camera/drivers/video4linux2.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/cheevos.c b/cheevos.c index 9c3e474fe2..d7eb8c5e4e 100644 --- a/cheevos.c +++ b/cheevos.c @@ -955,7 +955,7 @@ static size_t cheevos_highest_bit(size_t n) void cheevos_parse_guest_addr(cheevos_var_t *var, unsigned value) { - rarch_system_info_t *system; + rarch_system_info_t *system = NULL; runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); var->bank_id = -1; @@ -1510,7 +1510,7 @@ uint8_t *cheevos_get_memory(const cheevos_var_t *var) if (var->bank_id >= 0) { - rarch_system_info_t *system; + rarch_system_info_t *system = NULL; runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); if (system->mmaps.num_descriptors != 0) diff --git a/command.c b/command.c index c5ec6d3e7a..144042dcce 100644 --- a/command.c +++ b/command.c @@ -35,8 +35,10 @@ #endif #ifdef HAVE_COMMAND -#include -#include + #ifdef HAVE_NETWORKING + #include + #include + #endif #include #endif @@ -539,6 +541,7 @@ bool command_network_send(const char *cmd_) } +#ifdef HAVE_COMMAND static void command_network_poll(command_t *handle) { fd_set fds; @@ -577,6 +580,7 @@ static void command_network_poll(command_t *handle) } } #endif +#endif #ifdef HAVE_STDIN_CMD static bool command_stdin_init(command_t *handle) @@ -798,8 +802,10 @@ bool command_poll(command_t *handle) memset(handle->state, 0, sizeof(handle->state)); #if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) +#ifdef HAVE_COMMAND command_network_poll(handle); #endif +#endif #ifdef HAVE_STDIN_CMD command_stdin_poll(handle); @@ -830,8 +836,10 @@ bool command_set(command_handle_t *handle) bool command_free(command_t *handle) { #if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) +#ifdef HAVE_COMMAND if (handle && handle->net_fd >= 0) socket_close(handle->net_fd); +#endif #endif free(handle); @@ -1395,9 +1403,11 @@ static bool command_event_init_core(enum rarch_core_type *data) if (!event_init_content()) return false; - if (!core_load()) + if (!core_load(settings->input.poll_type_behavior)) return false; + runloop_ctl(RUNLOOP_CTL_SET_FRAME_LIMIT, NULL); + return true; } @@ -1870,7 +1880,7 @@ bool command_event(enum event_command cmd, void *data) return command_event_resize_windowed_scale(); case CMD_EVENT_MENU_TOGGLE: #ifdef HAVE_MENU - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL); else rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL); @@ -1887,6 +1897,9 @@ bool command_event(enum event_command cmd, void *data) cheevos_set_cheats(); #endif core_reset(); +#ifdef HAVE_CHEEVOS + cheevos_reset_game(); +#endif break; case CMD_EVENT_SAVE_STATE: { @@ -1961,7 +1974,7 @@ bool command_event(enum event_command cmd, void *data) command_event(CMD_EVENT_GAME_FOCUS_TOGGLE, (void*)(intptr_t)-1); #ifdef HAVE_MENU menu_display_set_framebuffer_dirty_flag(); - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) command_event(CMD_EVENT_VIDEO_SET_BLOCKING_STATE, NULL); #endif break; @@ -2005,7 +2018,7 @@ bool command_event(enum event_command cmd, void *data) #endif { if (settings->rewind_enable) - state_manager_event_init(); + state_manager_event_init(settings->rewind_buffer_size); } } break; @@ -2047,7 +2060,7 @@ bool command_event(enum event_command cmd, void *data) if (audio_driver_alive()) return false; - if (settings && !settings->audio.mute_enable && !audio_driver_start()) + if (settings && !settings->audio.mute_enable && !audio_driver_start(runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))) { RARCH_ERR("%s\n", msg_hash_to_str(MSG_FAILED_TO_START_AUDIO_DRIVER)); @@ -2259,7 +2272,7 @@ bool command_event(enum event_command cmd, void *data) { int flags = DRIVER_AUDIO_MASK; driver_ctl(RARCH_DRIVER_CTL_UNINIT, &flags); - driver_ctl(RARCH_DRIVER_CTL_INIT, &flags); + drivers_init(flags); } break; case CMD_EVENT_RESET_CONTEXT: @@ -2278,7 +2291,7 @@ bool command_event(enum event_command cmd, void *data) memcpy(hwr, &hwr_copy, sizeof(*hwr)); video_driver_set_context_negotiation_interface(iface); - driver_ctl(RARCH_DRIVER_CTL_INIT, &flags); + drivers_init(flags); } break; case CMD_EVENT_SHUTDOWN: @@ -2374,7 +2387,7 @@ bool command_event(enum event_command cmd, void *data) #ifdef HAVE_MENU settings_t *settings = config_get_ptr(); - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) { if (settings->menu.pause_libretro) command_event(CMD_EVENT_AUDIO_STOP, NULL); @@ -2417,9 +2430,11 @@ bool command_event(enum event_command cmd, void *data) break; case CMD_EVENT_NETPLAY_INIT: { - char *hostname = (char *) data; + char *hostname = (char *) data; settings_t *settings = config_get_ptr(); + command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); + if (!init_netplay( NULL, hostname ? hostname : settings->netplay.server, settings->netplay.port)) @@ -2432,7 +2447,9 @@ bool command_event(enum event_command cmd, void *data) case CMD_EVENT_NETPLAY_INIT_DIRECT: { settings_t *settings = config_get_ptr(); + command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); + if (!init_netplay( data, NULL, settings->netplay.port)) { @@ -2441,6 +2458,25 @@ bool command_event(enum event_command cmd, void *data) } } break; + case CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED: + { + /* buf is expected to be address:port, there must be a better way + to do this but for now I'll just use a string list */ + char *buf = (char *)data; + static struct string_list *hostname = NULL; + + hostname = string_split(buf, ":"); + + command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); + + if (!init_netplay_deferred( + hostname->elems[0].data, atoi(hostname->elems[1].data))) + { + command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); + return false; + } + } + break; case CMD_EVENT_NETPLAY_FLIP_PLAYERS: netplay_driver_ctl(RARCH_NETPLAY_CTL_FLIP_PLAYERS, NULL); break; @@ -2453,6 +2489,7 @@ bool command_event(enum event_command cmd, void *data) case CMD_EVENT_NETWORK_INIT: case CMD_EVENT_NETPLAY_INIT: case CMD_EVENT_NETPLAY_INIT_DIRECT: + case CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED: case CMD_EVENT_NETPLAY_FLIP_PLAYERS: case CMD_EVENT_NETPLAY_GAME_WATCH: return false; diff --git a/command.h b/command.h index 19d8009c86..f15b108388 100644 --- a/command.h +++ b/command.h @@ -171,6 +171,8 @@ enum event_command CMD_EVENT_NETPLAY_INIT, /* Initializes netplay system with a direct host specified. */ CMD_EVENT_NETPLAY_INIT_DIRECT, + /* Initializes netplay system with a direct host specified after loading content. */ + CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, /* Deinitializes netplay system. */ CMD_EVENT_NETPLAY_DEINIT, /* Flip netplay players. */ diff --git a/config.def.h b/config.def.h index dc5b14d610..8483c0b356 100644 --- a/config.def.h +++ b/config.def.h @@ -51,6 +51,9 @@ enum video_driver_enum VIDEO_EXYNOS, VIDEO_SUNXI, VIDEO_DISPMANX, + VIDEO_CACA, + VIDEO_GDI, + VIDEO_VGA, VIDEO_NULL }; @@ -209,6 +212,10 @@ enum record_driver_enum #define VIDEO_DEFAULT_DRIVER VIDEO_SDL #elif defined(HAVE_SDL2) #define VIDEO_DEFAULT_DRIVER VIDEO_SDL2 +#elif defined(_WIN32) && !defined(_XBOX) +#define VIDEO_DEFAULT_DRIVER VIDEO_GDI +#elif defined(DJGPP) +#define VIDEO_DEFAULT_DRIVER VIDEO_VGA #elif defined(HAVE_DYLIB) && !defined(ANDROID) #define VIDEO_DEFAULT_DRIVER VIDEO_EXT #else diff --git a/configuration.c b/configuration.c index 00edc333da..ed64f08c65 100644 --- a/configuration.c +++ b/configuration.c @@ -310,6 +310,12 @@ const char *config_get_default_video(void) return "dispmanx"; case VIDEO_SUNXI: return "sunxi"; + case VIDEO_CACA: + return "caca"; + case VIDEO_GDI: + return "gdi"; + case VIDEO_VGA: + return "vga"; case VIDEO_NULL: break; } diff --git a/core.h b/core.h index f044fc7b64..48df7129cb 100644 --- a/core.h +++ b/core.h @@ -158,7 +158,7 @@ typedef struct retro_callbacks retro_input_poll_t poll_cb; } retro_callbacks_t; -bool core_load(void); +bool core_load(unsigned poll_type_behavior); bool core_unload(void); diff --git a/core_impl.c b/core_impl.c index 3dd5148d91..fd0b8d09a0 100644 --- a/core_impl.c +++ b/core_impl.c @@ -34,16 +34,12 @@ #include "network/netplay/netplay.h" #endif -#include "configuration.h" #include "dynamic.h" -#include "core.h" #include "msg_hash.h" #include "managers/state_manager.h" -#include "runloop.h" #include "verbosity.h" #include "gfx/video_driver.h" #include "audio/audio_driver.h" -#include "cheevos.h" static unsigned core_poll_type = POLL_TYPE_EARLY; static bool core_inited = false; @@ -376,9 +372,6 @@ bool core_get_system_av_info(struct retro_system_av_info *av_info) bool core_reset(void) { core.retro_reset(); -#ifdef HAVE_CHEEVOS - cheevos_reset_game(); -#endif return true; } @@ -442,11 +435,9 @@ bool core_run(void) return true; } -bool core_load(void) +bool core_load(unsigned poll_type_behavior) { - settings_t *settings = config_get_ptr(); - - core_poll_type = settings->input.poll_type_behavior; + core_poll_type = poll_type_behavior; if (!core_verify_api_version()) return false; @@ -454,7 +445,6 @@ bool core_load(void) return false; core_get_system_av_info(video_viewport_get_system_av_info()); - runloop_ctl(RUNLOOP_CTL_SET_FRAME_LIMIT, NULL); return true; } diff --git a/cores/dynamic_dummy.c b/cores/dynamic_dummy.c index 53efa0b90a..393855742f 100644 --- a/cores/dynamic_dummy.c +++ b/cores/dynamic_dummy.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2015 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/cores/internal_cores.h b/cores/internal_cores.h index 94fe4ef939..69c698d3f2 100644 --- a/cores/internal_cores.h +++ b/cores/internal_cores.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2015 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/database_info.c b/database_info.c index d61803befb..28120c528f 100644 --- a/database_info.c +++ b/database_info.c @@ -31,24 +31,6 @@ #include "msg_hash.h" #include "verbosity.h" -#define DB_QUERY_ENTRY 0x1c310956U -#define DB_QUERY_ENTRY_PUBLISHER 0x125e594dU -#define DB_QUERY_ENTRY_DEVELOPER 0xcbd89be5U -#define DB_QUERY_ENTRY_ORIGIN 0x4ebaa767U -#define DB_QUERY_ENTRY_FRANCHISE 0x77f9eff2U -#define DB_QUERY_ENTRY_RATING 0x68eba20fU -#define DB_QUERY_ENTRY_BBFC_RATING 0x0a8e67f0U -#define DB_QUERY_ENTRY_ELSPA_RATING 0x8bf6ab18U -#define DB_QUERY_ENTRY_PEGI_RATING 0x5fc77328U -#define DB_QUERY_ENTRY_CERO_RATING 0x24f6172cU -#define DB_QUERY_ENTRY_ENHANCEMENT_HW 0x9866bda3U -#define DB_QUERY_ENTRY_EDGE_MAGAZINE_RATING 0x1c7f8a43U -#define DB_QUERY_ENTRY_EDGE_MAGAZINE_ISSUE 0xaaeebde7U -#define DB_QUERY_ENTRY_FAMITSU_MAGAZINE_RATING 0xbf7ff5e7U -#define DB_QUERY_ENTRY_RELEASEDATE_MONTH 0x2b36ce66U -#define DB_QUERY_ENTRY_RELEASEDATE_YEAR 0x9c7c6e91U -#define DB_QUERY_ENTRY_MAX_USERS 0xbfcba816U - #define DB_CURSOR_ROM_NAME 0x16bbcf13U #define DB_CURSOR_NAME 0x7c9b0c46U #define DB_CURSOR_DESCRIPTION 0x91b0c789U @@ -420,9 +402,9 @@ static int database_cursor_close(libretrodb_t *db, libretrodb_cursor_t *cur) database_info_handle_t *database_info_dir_init(const char *dir, enum database_type type) { + unsigned i; database_info_handle_t *db = (database_info_handle_t*) calloc(1, sizeof(*db)); - unsigned i = 0; if (!db) return NULL; diff --git a/defines/d3d_defines.h b/defines/d3d_defines.h index 96b9d365e0..12710387ee 100644 --- a/defines/d3d_defines.h +++ b/defines/d3d_defines.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/defines/gx_defines.h b/defines/gx_defines.h index 9d095eb117..e472b8231b 100644 --- a/defines/gx_defines.h +++ b/defines/gx_defines.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/defines/ps3_defines.h b/defines/ps3_defines.h index 8c93c0a6cd..ac8e6f920c 100644 --- a/defines/ps3_defines.h +++ b/defines/ps3_defines.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/defines/psp_defines.h b/defines/psp_defines.h index c716d4886a..c2b65e1da9 100644 --- a/defines/psp_defines.h +++ b/defines/psp_defines.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/defines/xdk_defines.h b/defines/xdk_defines.h index 33d838bd15..4af736bed0 100644 --- a/defines/xdk_defines.h +++ b/defines/xdk_defines.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/deps/libvita2d/shader/clear_f_gxp.c b/deps/libvita2d/shader/clear_f_gxp.c new file mode 100644 index 0000000000..1019171f73 --- /dev/null +++ b/deps/libvita2d/shader/clear_f_gxp.c @@ -0,0 +1,21 @@ +/* Generated by bin2c, do not edit manually */ + +/* Contents of file clear_f.gxp */ +const long int clear_f_gxp_size = 236; +const unsigned char clear_f_gxp[236] = { + 0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0xEC, 0x00, 0x00, 0x00, 0x42, 0xC5, 0x15, 0xBE, + 0xAA, 0xA6, 0x78, 0x8C, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xA8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x80, 0x19, 0xA0, + 0x7E, 0x0D, 0x84, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xFA, + 0x00, 0x00, 0x00, 0xC5, 0x22, 0x04, 0x80, 0x38, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0xE4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x75, 0x43, 0x6C, 0x65, 0x61, 0x72, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x00 +}; diff --git a/deps/libvita2d/shader/clear_v_gxp.c b/deps/libvita2d/shader/clear_v_gxp.c new file mode 100644 index 0000000000..4130fdd4a7 --- /dev/null +++ b/deps/libvita2d/shader/clear_v_gxp.c @@ -0,0 +1,23 @@ +/* Generated by bin2c, do not edit manually */ + +/* Contents of file clear_v.gxp */ +const long int clear_v_gxp_size = 264; +const unsigned char clear_v_gxp[264] = { + 0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0x06, 0x01, 0x00, 0x00, 0x31, 0x0F, 0x53, 0x68, + 0x27, 0x82, 0x90, 0xBD, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xC4, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x46, 0x52, 0x45, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x44, 0xFA, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xF8, 0x01, 0x00, 0x24, 0x9F, + 0x88, 0x1F, 0xC5, 0x08, 0x00, 0x0F, 0x00, 0x03, 0x21, 0x05, 0x80, 0x38, 0x00, 0x0F, 0x04, 0x03, + 0x59, 0x05, 0x80, 0x38, 0x00, 0x00, 0x20, 0xA0, 0x00, 0x50, 0x27, 0xFB, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x50, 0x6F, 0x73, + 0x69, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x00, 0x00 +}; diff --git a/deps/libvita2d/shader/color_f_gxp.c b/deps/libvita2d/shader/color_f_gxp.c new file mode 100644 index 0000000000..40cc096965 --- /dev/null +++ b/deps/libvita2d/shader/color_f_gxp.c @@ -0,0 +1,19 @@ +/* Generated by bin2c, do not edit manually */ + +/* Contents of file color_f.gxp */ +const long int color_f_gxp_size = 208; +const unsigned char color_f_gxp[208] = { + 0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x00, 0x41, 0x94, 0xBB, 0xB6, + 0x66, 0x1E, 0xDD, 0x20, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x04, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0F, 0xA0, 0xD0, 0x0E, + 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xFA, 0x02, 0x80, 0x19, 0xA0, 0x7E, 0x0D, 0x80, 0x40 +}; diff --git a/deps/libvita2d/shader/color_v_gxp.c b/deps/libvita2d/shader/color_v_gxp.c new file mode 100644 index 0000000000..443a87a40d --- /dev/null +++ b/deps/libvita2d/shader/color_v_gxp.c @@ -0,0 +1,28 @@ +/* Generated by bin2c, do not edit manually */ + +/* Contents of file color_v.gxp */ +const long int color_v_gxp_size = 340; +const unsigned char color_v_gxp[340] = { + 0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0x51, 0x01, 0x00, 0x00, 0xE2, 0xF2, 0xA7, 0xCC, + 0x01, 0x74, 0x8D, 0xD3, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xE4, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x9C, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x44, 0xFA, 0x80, 0x00, 0x08, 0x83, 0x21, 0x1D, 0x80, 0x38, 0x02, 0x80, 0x81, 0xAF, + 0x9C, 0x0D, 0xC0, 0x40, 0x0E, 0x86, 0xB9, 0xFF, 0xBC, 0x0D, 0xC0, 0x40, 0x04, 0x11, 0x49, 0xCF, + 0x80, 0x8F, 0xB1, 0x18, 0x02, 0x11, 0x45, 0xCF, 0x80, 0x8F, 0xB1, 0x18, 0x00, 0x11, 0x01, 0xC0, + 0x81, 0x81, 0xB1, 0x18, 0x01, 0xD1, 0x42, 0xC0, 0x81, 0x81, 0xB1, 0x18, 0x00, 0x00, 0x20, 0xA0, + 0x00, 0x50, 0x27, 0xFB, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x01, 0xE4, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x50, 0x6F, 0x73, + 0x69, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x61, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x00, 0x77, 0x76, 0x70, + 0x00, 0x00, 0x00, 0x00 +}; diff --git a/deps/libvita2d/shader/compiled/clear_f_gxp.o b/deps/libvita2d/shader/compiled/clear_f_gxp.o deleted file mode 100644 index bca3ed35fc..0000000000 Binary files a/deps/libvita2d/shader/compiled/clear_f_gxp.o and /dev/null differ diff --git a/deps/libvita2d/shader/compiled/clear_v_gxp.o b/deps/libvita2d/shader/compiled/clear_v_gxp.o deleted file mode 100644 index 18d0134a94..0000000000 Binary files a/deps/libvita2d/shader/compiled/clear_v_gxp.o and /dev/null differ diff --git a/deps/libvita2d/shader/compiled/color_f_gxp.o b/deps/libvita2d/shader/compiled/color_f_gxp.o deleted file mode 100644 index 99acc76b10..0000000000 Binary files a/deps/libvita2d/shader/compiled/color_f_gxp.o and /dev/null differ diff --git a/deps/libvita2d/shader/compiled/color_v_gxp.o b/deps/libvita2d/shader/compiled/color_v_gxp.o deleted file mode 100644 index 53279ff00f..0000000000 Binary files a/deps/libvita2d/shader/compiled/color_v_gxp.o and /dev/null differ diff --git a/deps/libvita2d/shader/compiled/texture_f_gxp.o b/deps/libvita2d/shader/compiled/texture_f_gxp.o deleted file mode 100644 index 8888b95ffb..0000000000 Binary files a/deps/libvita2d/shader/compiled/texture_f_gxp.o and /dev/null differ diff --git a/deps/libvita2d/shader/compiled/texture_tint_f_gxp.o b/deps/libvita2d/shader/compiled/texture_tint_f_gxp.o deleted file mode 100644 index 18fb7f18c0..0000000000 Binary files a/deps/libvita2d/shader/compiled/texture_tint_f_gxp.o and /dev/null differ diff --git a/deps/libvita2d/shader/compiled/texture_v_gxp.o b/deps/libvita2d/shader/compiled/texture_v_gxp.o deleted file mode 100644 index 71099b67a5..0000000000 Binary files a/deps/libvita2d/shader/compiled/texture_v_gxp.o and /dev/null differ diff --git a/deps/libvita2d/shader/tetxure_f_gxp.c b/deps/libvita2d/shader/tetxure_f_gxp.c new file mode 100644 index 0000000000..c024e14d4d --- /dev/null +++ b/deps/libvita2d/shader/tetxure_f_gxp.c @@ -0,0 +1,20 @@ +/* Generated by bin2c, do not edit manually */ + +/* Contents of file texture_f.gxp */ +const long int texture_f_gxp_size = 220; +const unsigned char texture_f_gxp[220] = { + 0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0xDC, 0x00, 0x00, 0x00, 0x4D, 0xD2, 0xB7, 0x2A, + 0xF5, 0x56, 0x28, 0x8B, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xA0, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x04, 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xF9, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xFA, 0x10, 0x00, 0x00, 0x00, 0x02, 0x04, 0x02, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x00 +}; diff --git a/deps/libvita2d/shader/tetxure_tint_f_gxp.c b/deps/libvita2d/shader/tetxure_tint_f_gxp.c new file mode 100644 index 0000000000..3d14207221 --- /dev/null +++ b/deps/libvita2d/shader/tetxure_tint_f_gxp.c @@ -0,0 +1,24 @@ +/* Generated by bin2c, do not edit manually */ + +/* Contents of file texture_tint_f.gxp */ +const long int texture_tint_f_gxp_size = 288; +const unsigned char texture_tint_f_gxp[288] = { + 0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0x1F, 0x01, 0x00, 0x00, 0xEA, 0xFC, 0xA0, 0xCB, + 0x79, 0x0C, 0xE6, 0xA5, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x04, 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xF9, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xFA, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xF8, + 0x02, 0x80, 0x99, 0xAF, 0xBC, 0x0D, 0xC0, 0x40, 0x3C, 0x00, 0x04, 0xCF, 0x84, 0x47, 0xA4, 0x08, + 0x00, 0xBC, 0x19, 0x20, 0x7E, 0x0D, 0x81, 0x40, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x01, 0xE4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1B, 0x00, 0x00, 0x00, 0x02, 0x04, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x75, 0x54, 0x69, 0x6E, 0x74, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x00, 0x74, 0x65, 0x78, 0x00, 0x00 +}; diff --git a/deps/libvita2d/shader/tetxure_v_gxp.c b/deps/libvita2d/shader/tetxure_v_gxp.c new file mode 100644 index 0000000000..d9fd24ee60 --- /dev/null +++ b/deps/libvita2d/shader/tetxure_v_gxp.c @@ -0,0 +1,28 @@ +/* Generated by bin2c, do not edit manually */ + +/* Contents of file texture_v.gxp */ +const long int texture_v_gxp_size = 340; +const unsigned char texture_v_gxp[340] = { + 0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, 0x34, 0x73, 0xC9, 0xAD, + 0xE1, 0xC5, 0xBA, 0x45, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xE4, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x9C, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x06, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xB0, 0x7E, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x44, 0xFA, 0x80, 0x00, 0x08, 0x83, 0x21, 0x0D, 0x80, 0x38, 0x02, 0x80, 0x81, 0xAF, + 0x9C, 0x0D, 0xC0, 0x40, 0x0E, 0x86, 0xB9, 0xFF, 0xBC, 0x0D, 0xC0, 0x40, 0x04, 0x11, 0x49, 0xCF, + 0x80, 0x8F, 0xB1, 0x18, 0x02, 0x11, 0x45, 0xCF, 0x80, 0x8F, 0xB1, 0x18, 0x00, 0x11, 0x01, 0xC0, + 0x81, 0x81, 0xB1, 0x18, 0x01, 0xD1, 0x42, 0xC0, 0x81, 0x81, 0xB1, 0x18, 0x00, 0x00, 0x20, 0xA0, + 0x00, 0x50, 0x27, 0xFB, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x01, 0xE4, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x50, 0x6F, 0x73, + 0x69, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x61, 0x54, 0x65, 0x78, 0x63, 0x6F, 0x6F, 0x72, 0x64, 0x00, + 0x77, 0x76, 0x70, 0x00 +}; diff --git a/deps/libvita2d/shader/texture_f_gxp.c b/deps/libvita2d/shader/texture_f_gxp.c new file mode 100644 index 0000000000..c024e14d4d --- /dev/null +++ b/deps/libvita2d/shader/texture_f_gxp.c @@ -0,0 +1,20 @@ +/* Generated by bin2c, do not edit manually */ + +/* Contents of file texture_f.gxp */ +const long int texture_f_gxp_size = 220; +const unsigned char texture_f_gxp[220] = { + 0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0xDC, 0x00, 0x00, 0x00, 0x4D, 0xD2, 0xB7, 0x2A, + 0xF5, 0x56, 0x28, 0x8B, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xA0, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x04, 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xF9, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xFA, 0x10, 0x00, 0x00, 0x00, 0x02, 0x04, 0x02, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x00 +}; diff --git a/deps/libvita2d/shader/texture_tint_f_gxp.c b/deps/libvita2d/shader/texture_tint_f_gxp.c new file mode 100644 index 0000000000..3d14207221 --- /dev/null +++ b/deps/libvita2d/shader/texture_tint_f_gxp.c @@ -0,0 +1,24 @@ +/* Generated by bin2c, do not edit manually */ + +/* Contents of file texture_tint_f.gxp */ +const long int texture_tint_f_gxp_size = 288; +const unsigned char texture_tint_f_gxp[288] = { + 0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0x1F, 0x01, 0x00, 0x00, 0xEA, 0xFC, 0xA0, 0xCB, + 0x79, 0x0C, 0xE6, 0xA5, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x04, 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xF9, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xFA, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xF8, + 0x02, 0x80, 0x99, 0xAF, 0xBC, 0x0D, 0xC0, 0x40, 0x3C, 0x00, 0x04, 0xCF, 0x84, 0x47, 0xA4, 0x08, + 0x00, 0xBC, 0x19, 0x20, 0x7E, 0x0D, 0x81, 0x40, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x01, 0xE4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1B, 0x00, 0x00, 0x00, 0x02, 0x04, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x75, 0x54, 0x69, 0x6E, 0x74, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x00, 0x74, 0x65, 0x78, 0x00, 0x00 +}; diff --git a/deps/libvita2d/shader/texture_v_gxp.c b/deps/libvita2d/shader/texture_v_gxp.c new file mode 100644 index 0000000000..d9fd24ee60 --- /dev/null +++ b/deps/libvita2d/shader/texture_v_gxp.c @@ -0,0 +1,28 @@ +/* Generated by bin2c, do not edit manually */ + +/* Contents of file texture_v.gxp */ +const long int texture_v_gxp_size = 340; +const unsigned char texture_v_gxp[340] = { + 0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, 0x34, 0x73, 0xC9, 0xAD, + 0xE1, 0xC5, 0xBA, 0x45, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xE4, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x9C, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x06, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xB0, 0x7E, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x44, 0xFA, 0x80, 0x00, 0x08, 0x83, 0x21, 0x0D, 0x80, 0x38, 0x02, 0x80, 0x81, 0xAF, + 0x9C, 0x0D, 0xC0, 0x40, 0x0E, 0x86, 0xB9, 0xFF, 0xBC, 0x0D, 0xC0, 0x40, 0x04, 0x11, 0x49, 0xCF, + 0x80, 0x8F, 0xB1, 0x18, 0x02, 0x11, 0x45, 0xCF, 0x80, 0x8F, 0xB1, 0x18, 0x00, 0x11, 0x01, 0xC0, + 0x81, 0x81, 0xB1, 0x18, 0x01, 0xD1, 0x42, 0xC0, 0x81, 0x81, 0xB1, 0x18, 0x00, 0x00, 0x20, 0xA0, + 0x00, 0x50, 0x27, 0xFB, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x01, 0xE4, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x50, 0x6F, 0x73, + 0x69, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x61, 0x54, 0x65, 0x78, 0x63, 0x6F, 0x6F, 0x72, 0x64, 0x00, + 0x77, 0x76, 0x70, 0x00 +}; diff --git a/deps/libvita2d/source/vita2d.c b/deps/libvita2d/source/vita2d.c index aeb2605cdb..2192a2a374 100644 --- a/deps/libvita2d/source/vita2d.c +++ b/deps/libvita2d/source/vita2d.c @@ -34,25 +34,25 @@ typedef struct vita2d_display_data { /* Extern */ -extern const SceGxmProgram clear_v_gxp_start; -extern const SceGxmProgram clear_f_gxp_start; -extern const SceGxmProgram color_v_gxp_start; -extern const SceGxmProgram color_f_gxp_start; -extern const SceGxmProgram texture_v_gxp_start; -extern const SceGxmProgram texture_f_gxp_start; -extern const SceGxmProgram texture_tint_f_gxp_start; +extern const SceGxmProgram clear_v_gxp; +extern const SceGxmProgram clear_f_gxp; +extern const SceGxmProgram color_v_gxp; +extern const SceGxmProgram color_f_gxp; +extern const SceGxmProgram texture_v_gxp; +extern const SceGxmProgram texture_f_gxp; +extern const SceGxmProgram texture_tint_f_gxp; /* Static variables */ static int pgf_module_was_loaded = 0; -static const SceGxmProgram *const clearVertexProgramGxp = &clear_v_gxp_start; -static const SceGxmProgram *const clearFragmentProgramGxp = &clear_f_gxp_start; -static const SceGxmProgram *const colorVertexProgramGxp = &color_v_gxp_start; -static const SceGxmProgram *const colorFragmentProgramGxp = &color_f_gxp_start; -static const SceGxmProgram *const textureVertexProgramGxp = &texture_v_gxp_start; -static const SceGxmProgram *const textureFragmentProgramGxp = &texture_f_gxp_start; -static const SceGxmProgram *const textureTintFragmentProgramGxp = &texture_tint_f_gxp_start; +static const SceGxmProgram *const clearVertexProgramGxp = &clear_v_gxp; +static const SceGxmProgram *const clearFragmentProgramGxp = &clear_f_gxp; +static const SceGxmProgram *const colorVertexProgramGxp = &color_v_gxp; +static const SceGxmProgram *const colorFragmentProgramGxp = &color_f_gxp; +static const SceGxmProgram *const textureVertexProgramGxp = &texture_v_gxp; +static const SceGxmProgram *const textureFragmentProgramGxp = &texture_f_gxp; +static const SceGxmProgram *const textureTintFragmentProgramGxp = &texture_tint_f_gxp; static int vita2d_initialized = 0; static float clear_color[4] = {0.0f, 0.0f, 0.0f, 1.0f}; diff --git a/diff.diff b/diff.diff new file mode 100644 index 0000000000..b40470ffea --- /dev/null +++ b/diff.diff @@ -0,0 +1,166 @@ +diff --git a/gfx/drivers_context/wgl_ctx.cpp b/gfx/drivers_context/wgl_ctx.cpp +index fc6132d..6c81bcb 100644 +--- a/gfx/drivers_context/wgl_ctx.cpp ++++ b/gfx/drivers_context/wgl_ctx.cpp +@@ -81,6 +81,20 @@ + #endif + + #if defined(HAVE_OPENGL) ++typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC)(HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); ++typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC)(HDC hdc, INT32 *numerator, INT32 *denominator); ++typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC)(HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); ++typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC)(HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); ++typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC)(HDC hdc, INT64 traget_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); ++typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC)(HDC hdc); ++ ++static PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB; ++static PFNWGLGETSYNCVALUESOMLPROC wglGetSyncValuesOML; ++static PFNWGLGETMSCRATEOMLPROC wglGetMscRateOML; ++static PFNWGLSWAPBUFFERSMSCOMLPROC wglSwapBuffersMscOML; ++static PFNWGLWAITFORMSCOMLPROC wglWaitForMscOML; ++static PFNWGLWAITFORSBCOMLPROC wglWaitForSbcOML; ++ + typedef HGLRC (APIENTRY *wglCreateContextAttribsProc)(HDC, HGLRC, const int*); + static wglCreateContextAttribsProc pcreate_context; + #endif +@@ -91,6 +105,13 @@ static HGLRC win32_hw_hrc; + static HDC win32_hdc; + static bool win32_use_hw_ctx = false; + static bool win32_core_hw_context_enable = false; ++static unsigned g_wgl_swap_mode = 0; ++ ++static int g_wgl_divisor = 0; ++static int g_wgl_remainder = 0; ++static int64_t g_wgl_ust = 0; ++static int64_t g_wgl_msc = 0; ++static int64_t g_wgl_sbc = 0; + + #ifdef HAVE_VULKAN + static gfx_ctx_vulkan_data_t win32_vk; +@@ -103,6 +124,44 @@ static enum gfx_ctx_api win32_api = GFX_CTX_NONE; + + static dylib_t dll_handle = NULL; /* Handle to OpenGL32.dll */ + ++static unsigned strclen(const unsigned char *s, unsigned char c) ++{ ++ unsigned i = 0; ++ while (s + i != NULL && s[i] != '\0' && s[i] != c) ++ i++; ++ return i; ++} ++ ++static bool strsame(const unsigned char *a, const unsigned char *b, unsigned n) ++{ ++ unsigned i = 0; ++ while (i < n && a + i != NULL && b + i != NULL && a[i] == b[i]) ++ i++; ++ return i == n; ++} ++ ++static bool wgl_has_extension(HDC hdc, const char *ext) ++{ ++ char *end; ++ int len = strlen(ext); ++ char *p = (char*)wglGetExtensionsStringARB(hdc); ++ ++ if (p == 0) ++ return false; ++ ++ end = p + strlen(p); ++ ++ while (p < end) ++ { ++ int n = strclen((const unsigned char*)p, ' '); ++ if (len == n && strsame((const unsigned char*)ext, (const unsigned char*)p, n)) ++ return true; ++ p += n+1; ++ } ++ ++ return false; ++} ++ + static void setup_pixel_format(HDC hdc) + { + PIXELFORMATDESCRIPTOR pfd = {0}; +@@ -282,9 +341,7 @@ static void gfx_ctx_wgl_swap_interval(void *data, unsigned interval) + case GFX_CTX_OPENGL_API: + #ifdef HAVE_OPENGL + win32_interval = interval; +- if (!win32_hrc) +- return; +- if (!p_swap_interval) ++ if (!win32_hrc || !p_swap_interval) + return; + + RARCH_LOG("[WGL]: wglSwapInterval(%u)\n", win32_interval); +@@ -339,7 +396,19 @@ static void gfx_ctx_wgl_swap_buffers(void *data, video_frame_info_t video_info) + { + case GFX_CTX_OPENGL_API: + #ifdef HAVE_OPENGL +- SwapBuffers(win32_hdc); ++ if (g_wgl_swap_mode) ++ { ++ if (win32_interval) ++ { ++ wglWaitForMscOML(win32_hdc, g_wgl_msc + win32_interval, ++ 0, 0, &g_wgl_ust, &g_wgl_msc, &g_wgl_sbc); ++ wglSwapBuffersMscOML(win32_hdc, 0, 0, 0); ++ } ++ else ++ wglSwapBuffersMscOML(win32_hdc, 0, g_wgl_divisor, g_wgl_remainder); ++ } ++ else ++ SwapBuffers(win32_hdc); + #endif + break; + +@@ -439,11 +508,35 @@ static void *gfx_ctx_wgl_init(video_frame_info_t video_info, void *video_driver) + win32_monitor_init(); + + wndclass.lpfnWndProc = WndProcGL; ++ g_wgl_swap_mode = 0; + if (!win32_window_init(&wndclass, true, NULL)) + return NULL; + + switch (win32_api) + { ++ case GFX_CTX_OPENGL_API: ++ RARCH_LOG("Testing if extension WGL_OML_sync_control is available...\n"); ++ wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB"); ++ ++ if (wgl_has_extension(win32_hdc, "WGL_OML_sync_control")) ++ { ++ RARCH_LOG("WGL_OML_sync_control supported, using better swap control method...\n"); ++ ++ g_wgl_swap_mode = 1; ++ wglGetSyncValuesOML = (PFNWGLGETSYNCVALUESOMLPROC) ++ wglGetProcAddress("wglGetSyncValuesOML"); ++ wglGetMscRateOML = (PFNWGLGETMSCRATEOMLPROC) ++ wglGetProcAddress("wglGetMscRateOML"); ++ wglSwapBuffersMscOML = (PFNWGLSWAPBUFFERSMSCOMLPROC) ++ wglGetProcAddress("wglSwapBuffersMscOML"); ++ wglWaitForMscOML = (PFNWGLWAITFORMSCOMLPROC) ++ wglGetProcAddress("wglWaitForMscOML"); ++ wglWaitForSbcOML = (PFNWGLWAITFORSBCOMLPROC) ++ wglGetProcAddress("wglWaitForSbcOML"); ++ ++ wglGetSyncValuesOML(win32_hdc, &g_wgl_ust, &g_wgl_msc, &g_wgl_sbc); ++ } ++ break; + case GFX_CTX_VULKAN_API: + #ifdef HAVE_VULKAN + if (!vulkan_context_init(&win32_vk, VULKAN_WSI_WIN32)) +@@ -522,6 +615,13 @@ static void gfx_ctx_wgl_destroy(void *data) + win32_major = 0; + win32_minor = 0; + p_swap_interval = NULL; ++ ++ g_wgl_swap_mode = 0; ++ g_wgl_divisor = 0; ++ g_wgl_remainder = 0; ++ g_wgl_ust = 0; ++ g_wgl_msc = 0; ++ g_wgl_sbc = 0; + } + + static bool gfx_ctx_wgl_set_video_mode(void *data, diff --git a/dist-scripts/wiiu-cores.sh b/dist-scripts/wiiu-cores.sh index e3a5d53fc2..b1a384e555 100755 --- a/dist-scripts/wiiu-cores.sh +++ b/dist-scripts/wiiu-cores.sh @@ -117,7 +117,6 @@ for f in `ls -v *_${platform}.${EXT}`; do fi fi rm -rf ${name}_meta.xml - rm -rf $name.png done diff --git a/driver.c b/driver.c index 5de24cb3de..f22b3b929f 100644 --- a/driver.c +++ b/driver.c @@ -225,7 +225,7 @@ static void driver_adjust_system_rates(void) if (runloop_ctl(RUNLOOP_CTL_IS_NONBLOCK_FORCED, NULL)) command_event(CMD_EVENT_VIDEO_SET_NONBLOCKING_STATE, NULL); else - driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL); + driver_set_nonblock_state(); } /** @@ -236,7 +236,7 @@ static void driver_adjust_system_rates(void) * If nonblock state is false, sets * blocking state for both audio and video drivers instead. **/ -static void driver_set_nonblock_state(void) +void driver_set_nonblock_state(void) { bool enable = input_driver_is_nonblock_state(); @@ -287,13 +287,13 @@ static bool driver_update_system_av_info(const struct retro_system_av_info *info } /** - * init_drivers: + * drivers_init: * @flags : Bitmask of drivers to initialize. * * Initializes drivers. * @flags determines which drivers get initialized. **/ -static void init_drivers(int flags) +void drivers_init(int flags) { if (flags & DRIVER_VIDEO_MASK) video_driver_unset_own_driver(); @@ -360,7 +360,7 @@ static void init_drivers(int flags) { /* Keep non-throttled state as good as possible. */ if (input_driver_is_nonblock_state()) - driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL); + driver_set_nonblock_state(); } } @@ -453,19 +453,6 @@ bool driver_ctl(enum driver_ctl_state state, void *data) int flags = DRIVERS_CMD_ALL; return driver_ctl(RARCH_DRIVER_CTL_UNINIT, &flags); } - case RARCH_DRIVER_CTL_INIT: - { - int *flags = (int*)data; - if (!flags) - return false; - init_drivers(*flags); - } - break; - case RARCH_DRIVER_CTL_INIT_ALL: - { - int flags = DRIVERS_CMD_ALL; - return driver_ctl(RARCH_DRIVER_CTL_INIT, &flags); - } case RARCH_DRIVER_CTL_INIT_PRE: audio_driver_find_driver(); video_driver_find_driver(); @@ -485,9 +472,6 @@ bool driver_ctl(enum driver_ctl_state state, void *data) driver_adjust_system_rates(); } break; - case RARCH_DRIVER_CTL_SET_NONBLOCK_STATE: - driver_set_nonblock_state(); - break; case RARCH_DRIVER_CTL_UPDATE_SYSTEM_AV_INFO: { const struct retro_system_av_info **info = (const struct retro_system_av_info**)data; diff --git a/driver.h b/driver.h index 475564058b..ca423969f0 100644 --- a/driver.h +++ b/driver.h @@ -72,13 +72,6 @@ enum driver_ctl_state RARCH_DRIVER_CTL_UNINIT_ALL, - /* Initializes drivers. - * @data is a bitmask which determines - * which drivers get initialized. */ - RARCH_DRIVER_CTL_INIT, - - RARCH_DRIVER_CTL_INIT_ALL, - /* Attempts to find a default driver for * all driver types. * @@ -91,12 +84,6 @@ enum driver_ctl_state * calls audio_monitor_set_refresh_rate(). */ RARCH_DRIVER_CTL_SET_REFRESH_RATE, - /* Sets audio and video drivers to nonblock state. - * - * If nonblock state is false, sets blocking state for both - * audio and video drivers instead. */ - RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, - /* Update the system Audio/Video information. * Will reinitialize audio/video drivers. * Used by RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO. */ @@ -122,6 +109,14 @@ typedef struct driver_ctx_info bool driver_ctl(enum driver_ctl_state state, void *data); +/* Sets audio and video drivers to nonblock state. + * + * If nonblock state is false, sets blocking state for both + * audio and video drivers instead. */ +void driver_set_nonblock_state(void); + +void drivers_init(int flags); + RETRO_END_DECLS #endif diff --git a/dynamic.c b/dynamic.c index 86a09c91d8..48b9b4874b 100644 --- a/dynamic.c +++ b/dynamic.c @@ -252,6 +252,7 @@ static bool load_dynamic_core(void) RARCH_ERR("Error(s): %s\n", dylib_error()); runloop_msg_queue_push(msg_hash_to_str(MSG_FAILED_TO_OPEN_LIBRETRO_CORE), 1, 180, true); + retroarch_fail(1, "load_dynamic_core()"); return false; } diff --git a/file_path_special.c b/file_path_special.c index 2957c0d444..fb96d87d21 100644 --- a/file_path_special.c +++ b/file_path_special.c @@ -285,7 +285,7 @@ void fill_pathname_application_path(char *s, size_t len) #endif #ifdef HAVE_XMB -const char *xmb_theme_ident(void); +const char* xmb_theme_ident(void); #endif void fill_pathname_application_special(char *s, size_t len, enum application_special_type type) diff --git a/file_path_special.h b/file_path_special.h index 521866143a..9a119dad7d 100644 --- a/file_path_special.h +++ b/file_path_special.h @@ -53,6 +53,7 @@ enum file_path_enum FILE_PATH_LAKKA_URL, FILE_PATH_CORE_THUMBNAILS_URL, FILE_PATH_INDEX_DIRS_URL, + FILE_PATH_NETPLAY_ROOM_LIST_URL, FILE_PATH_INDEX_URL, FILE_PATH_INDEX_EXTENDED_URL, FILE_PATH_CGP_EXTENSION, diff --git a/file_path_str.c b/file_path_str.c index fea26786c2..77009bcf46 100644 --- a/file_path_str.c +++ b/file_path_str.c @@ -101,6 +101,8 @@ const char *file_path_str(enum file_path_enum enum_idx) return ".index-dirs"; case FILE_PATH_INDEX_EXTENDED_URL: return ".index-extended"; + case FILE_PATH_NETPLAY_ROOM_LIST_URL: + return "registry.lpl"; case FILE_PATH_CORE_THUMBNAILS_URL: return "http://thumbnailpacks.libretro.com"; case FILE_PATH_LAKKA_URL: diff --git a/frontend/drivers/platform_bsd.c b/frontend/drivers/platform_bsd.c index 5653659327..6b7484677f 100644 --- a/frontend/drivers/platform_bsd.c +++ b/frontend/drivers/platform_bsd.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Jason Fetters * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -14,13 +14,13 @@ * If not, see . */ -#include "../frontend_driver.h" - #include #include #include #include +#include "../frontend_driver.h" + static volatile sig_atomic_t bsd_sighandler_quit; static void frontend_bsd_sighandler(int sig) diff --git a/frontend/drivers/platform_ctr.c b/frontend/drivers/platform_ctr.c index ed804786a9..59370f8edf 100644 --- a/frontend/drivers/platform_ctr.c +++ b/frontend/drivers/platform_ctr.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2016 - Ali Bouhlel + * Copyright (C) 2014-2017 - Ali Bouhlel + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -32,7 +33,6 @@ #endif #include "../frontend_driver.h" -#include "../../configuration.h" #include "../../verbosity.h" #include "../../defaults.h" #include "../../paths.h" diff --git a/frontend/drivers/platform_darwin.m b/frontend/drivers/platform_darwin.m index 02b5476c99..c52a421b20 100644 --- a/frontend/drivers/platform_darwin.m +++ b/frontend/drivers/platform_darwin.m @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2014 - Jason Fetters * Copyright (C) 2014-2015 - Jay McCarthy * diff --git a/frontend/drivers/platform_emscripten.c b/frontend/drivers/platform_emscripten.c index acc567dd57..5431c141fc 100644 --- a/frontend/drivers/platform_emscripten.c +++ b/frontend/drivers/platform_emscripten.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/frontend/drivers/platform_gx.c b/frontend/drivers/platform_gx.c index 4576bb1af9..6e0c7ce862 100644 --- a/frontend/drivers/platform_gx.c +++ b/frontend/drivers/platform_gx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2015 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/frontend/drivers/platform_linux.c b/frontend/drivers/platform_linux.c index 96ed71e0d2..5ff5b70730 100644 --- a/frontend/drivers/platform_linux.c +++ b/frontend/drivers/platform_linux.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Jason Fetters * Copyright (C) 2012-2015 - Michael Lelli * @@ -54,7 +54,6 @@ #include "../frontend.h" #include "../frontend_driver.h" -#include "../../configuration.h" #include "../../defaults.h" #include "../../retroarch.h" #include "../../verbosity.h" diff --git a/frontend/drivers/platform_linux.h b/frontend/drivers/platform_linux.h index 887d10bc9c..97378719fd 100644 --- a/frontend/drivers/platform_linux.h +++ b/frontend/drivers/platform_linux.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/frontend/drivers/platform_null.c b/frontend/drivers/platform_null.c index 9f1b4b8730..d43f782817 100644 --- a/frontend/drivers/platform_null.c +++ b/frontend/drivers/platform_null.c @@ -1,7 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2012-2015 - Jason Fetters + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/frontend/drivers/platform_ps3.c b/frontend/drivers/platform_ps3.c index 8e318b1e41..b246b9286b 100644 --- a/frontend/drivers/platform_ps3.c +++ b/frontend/drivers/platform_ps3.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/frontend/drivers/platform_psp.c b/frontend/drivers/platform_psp.c index 9321651336..2c4f1b1f17 100644 --- a/frontend/drivers/platform_psp.c +++ b/frontend/drivers/platform_psp.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -23,7 +23,6 @@ #endif #ifdef VITA -#include #include #include #include @@ -39,16 +38,23 @@ #include #endif +#include #include #include #ifndef IS_SALAMANDER #include #endif +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + #include "../frontend_driver.h" #include "../../defaults.h" #include "../../file_path_special.h" #include "../../defines/psp_defines.h" +#include "../../retroarch.h" +#include "../../paths.h" #include "../../verbosity.h" #if defined(HAVE_KERNEL_PRX) || defined(IS_SALAMANDER) @@ -57,9 +63,7 @@ #endif #endif -#ifdef VITA -PSP2_MODULE_INFO(0, 0, "RetroArch"); -#else +#ifndef VITA PSP_MODULE_INFO("RetroArch", 0, 1, 1); PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER|THREAD_ATTR_VFPU); #ifdef BIG_STACK diff --git a/frontend/drivers/platform_qnx.c b/frontend/drivers/platform_qnx.c index 56b0b2ca4d..a12bd0d18c 100644 --- a/frontend/drivers/platform_qnx.c +++ b/frontend/drivers/platform_qnx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/frontend/drivers/platform_wii.c b/frontend/drivers/platform_wii.c index a7a3e4444c..c50a2902a9 100644 --- a/frontend/drivers/platform_wii.c +++ b/frontend/drivers/platform_wii.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/frontend/drivers/platform_wiiu.c b/frontend/drivers/platform_wiiu.c index fcfc4e68ca..887c21c52d 100644 --- a/frontend/drivers/platform_wiiu.c +++ b/frontend/drivers/platform_wiiu.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2014-2016 - Ali Bouhlel + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -25,7 +26,6 @@ #include "../frontend_driver.h" #include "../frontend.h" -#include "../../configuration.h" #include "../../verbosity.h" #include "../../defaults.h" #include "../../paths.h" @@ -49,6 +49,7 @@ #include #include #include +#include #include #include @@ -279,6 +280,9 @@ int main(int argc, char **argv) devoptab_list[STD_ERR] = &dotab_stdout; #endif VPADInit(); + WPADEnableURCC(true); + WPADEnableWiiRemote(true); + KPADInit(); verbosity_enable(); DEBUG_VAR(argc); diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index b7da98da6d..a4136b16ec 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -311,24 +311,40 @@ static void frontend_win32_environment_get(int *argc, char *argv[], static uint64_t frontend_win32_get_mem_total(void) { + /* OSes below 2000 don't have the Ex version, and non-Ex cannot work with >4GB RAM */ +#if _WIN32_WINNT > 0x0400 MEMORYSTATUSEX mem_info; mem_info.dwLength = sizeof(MEMORYSTATUSEX); GlobalMemoryStatusEx(&mem_info); return mem_info.ullTotalPhys; +#else + MEMORYSTATUS mem_info; + mem_info.dwLength = sizeof(MEMORYSTATUS); + GlobalMemoryStatus(&mem_info); + return mem_info.dwTotalPhys; +#endif } static uint64_t frontend_win32_get_mem_used(void) { + /* OSes below 2000 don't have the Ex version, and non-Ex cannot work with >4GB RAM */ +#if _WIN32_WINNT > 0x0400 MEMORYSTATUSEX mem_info; mem_info.dwLength = sizeof(MEMORYSTATUSEX); GlobalMemoryStatusEx(&mem_info); return ((frontend_win32_get_mem_total() - mem_info.ullAvailPhys)); +#else + MEMORYSTATUS mem_info; + mem_info.dwLength = sizeof(MEMORYSTATUS); + GlobalMemoryStatus(&mem_info); + return ((frontend_win32_get_mem_total() - mem_info.dwAvailPhys)); +#endif } static void frontend_win32_attach_console(void) { #ifdef _WIN32 -#if(_WIN32_WINNT >= 0x0500) +#ifdef _WIN32_WINNT_WINXP if (!AttachConsole(ATTACH_PARENT_PROCESS)) { AllocConsole(); @@ -343,7 +359,7 @@ static void frontend_win32_attach_console(void) static void frontend_win32_detach_console(void) { #if defined(_WIN32) && !defined(_XBOX) -#if(_WIN32_WINNT >= 0x0500) +#ifdef _WIN32_WINNT_WINXP if (!AttachConsole(ATTACH_PARENT_PROCESS)) { HWND wnd = GetConsoleWindow(); diff --git a/frontend/drivers/platform_xdk.cpp b/frontend/drivers/platform_xdk.cpp index 8d996136b3..02896f6c00 100644 --- a/frontend/drivers/platform_xdk.cpp +++ b/frontend/drivers/platform_xdk.cpp @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -1028,9 +1028,10 @@ static HRESULT xbox_io_mount(const char* szDrive, char* szDevice) STRING DeviceName, LinkName; char szDestinationDrive[PATH_MAX_LENGTH]; - snprintf(szDestinationDrive, sizeof(szDestinationDrive), PATH_MAX_LENGTH, "\\??\\%s", szDrive); + snprintf(szDestinationDrive, sizeof(szDestinationDrive), + "\\??\\%s", szDrive); RtlInitAnsiString(&DeviceName, szDevice); - RtlInitAnsiString(&LinkName, (CHAR)szDestinationDrive); + RtlInitAnsiString(&LinkName, (PCHAR)szDestinationDrive); ObDeleteSymbolicLink(&LinkName); return (HRESULT)ObCreateSymbolicLink(&LinkName, &DeviceName); } diff --git a/frontend/drivers/platform_xenon.c b/frontend/drivers/platform_xenon.c index 795c47f9d1..b1e84bf443 100644 --- a/frontend/drivers/platform_xenon.c +++ b/frontend/drivers/platform_xenon.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/frontend/frontend.c b/frontend/frontend.c index 7c00d6c71a..12d9a95b08 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/frontend/frontend.h b/frontend/frontend.h index 3d53174255..fed99639ce 100644 --- a/frontend/frontend.h +++ b/frontend/frontend.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/frontend/frontend_driver.c b/frontend/frontend_driver.c index 30ea21f2e0..88475d3f7d 100644 --- a/frontend/frontend_driver.c +++ b/frontend/frontend_driver.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/frontend/frontend_driver.h b/frontend/frontend_driver.h index e5a723e8c4..776fa17de6 100644 --- a/frontend/frontend_driver.h +++ b/frontend/frontend_driver.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/frontend/frontend_salamander.c b/frontend/frontend_salamander.c index 280e193271..5a9a13a20e 100644 --- a/frontend/frontend_salamander.c +++ b/frontend/frontend_salamander.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/common/caca_common.h b/gfx/common/caca_common.h index ead5ceb5e2..6c4ea3adeb 100644 --- a/gfx/common/caca_common.h +++ b/gfx/common/caca_common.h @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * copyright (c) 2011-2015 - Daniel De Matteis - * copyright (c) 2016 - Brad Parker + * copyright (c) 2011-2017 - Daniel De Matteis + * copyright (c) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/common/ctr_common.h b/gfx/common/ctr_common.h index a5b2cbf375..daf001c3b3 100644 --- a/gfx/common/ctr_common.h +++ b/gfx/common/ctr_common.h @@ -1,3 +1,18 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2014-2017 - Ali Bouahl + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + #ifndef CTR_COMMON_H__ #define CTR_COMMON_H__ diff --git a/gfx/common/d3d_common.cpp b/gfx/common/d3d_common.cpp index be772007ec..5323c9dd16 100644 --- a/gfx/common/d3d_common.cpp +++ b/gfx/common/d3d_common.cpp @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/common/d3d_common.h b/gfx/common/d3d_common.h index a06e3c0c1d..9ce7c1566d 100644 --- a/gfx/common/d3d_common.h +++ b/gfx/common/d3d_common.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/common/drm_common.c b/gfx/common/drm_common.c index 1cdb2c0f50..b1d11ec999 100644 --- a/gfx/common/drm_common.c +++ b/gfx/common/drm_common.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (c) 2011-2016 - Daniel De Matteis + * Copyright (c) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -64,11 +64,11 @@ bool drm_get_resources(int fd) return true; } -bool drm_get_connector(int fd, unsigned video_monitor_index) +bool drm_get_connector(int fd, video_frame_info_t *video_info) { unsigned i; unsigned monitor_index = 0; - unsigned monitor = MAX(video_monitor_index, 1); + unsigned monitor = MAX(video_info->monitor_index, 1); /* Enumerate all connectors. */ diff --git a/gfx/common/drm_common.h b/gfx/common/drm_common.h index 4f2842968e..e66e1c1704 100644 --- a/gfx/common/drm_common.h +++ b/gfx/common/drm_common.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (c) 2011-2016 - Daniel De Matteis + * Copyright (c) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -27,6 +27,8 @@ #include #include +#include "../video_driver.h" + RETRO_BEGIN_DECLS extern uint32_t g_connector_id; @@ -51,7 +53,7 @@ void drm_setup(int fd); void drm_free(void); -bool drm_get_connector(int fd, unsigned video_monitor_index); +bool drm_get_connector(int fd, video_frame_info_t *video_info); static INLINE bool drm_wait_flip(int timeout) { diff --git a/gfx/common/egl_common.c b/gfx/common/egl_common.c index 949f6a6162..366d52e494 100644 --- a/gfx/common/egl_common.c +++ b/gfx/common/egl_common.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (c) 2011-2016 - Daniel De Matteis + * Copyright (c) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/common/egl_common.h b/gfx/common/egl_common.h index 060d9a26bb..6df02a5f39 100644 --- a/gfx/common/egl_common.h +++ b/gfx/common/egl_common.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (c) 2011-2016 - Daniel De Matteis + * Copyright (c) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/common/gdi_common.h b/gfx/common/gdi_common.h new file mode 100644 index 0000000000..5abf72d35f --- /dev/null +++ b/gfx/common/gdi_common.h @@ -0,0 +1,26 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * copyright (c) 2011-2017 - Daniel De Matteis + * copyright (c) 2016-2017 - Brad Parker + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef __GDI_COMMON_H +#define __GDI_COMMON_H + +typedef struct gdi +{ + WNDCLASSEX wndclass; +} gdi_t; + +#endif diff --git a/gfx/common/gl_common.c b/gfx/common/gl_common.c index 9328ad5986..92240681db 100644 --- a/gfx/common/gl_common.c +++ b/gfx/common/gl_common.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/common/gl_common.h b/gfx/common/gl_common.h index 2e13d95e2d..e4e1c06fb9 100644 --- a/gfx/common/gl_common.h +++ b/gfx/common/gl_common.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * copyright (c) 2011-2015 - Daniel De Matteis + * copyright (c) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/common/vga_common.h b/gfx/common/vga_common.h new file mode 100644 index 0000000000..ad5608c719 --- /dev/null +++ b/gfx/common/vga_common.h @@ -0,0 +1,29 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * copyright (c) 2011-2015 - Daniel De Matteis + * copyright (c) 2016 - Brad Parker + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef __VGA_COMMON_H +#define __VGA_COMMON_H + +#define VGA_WIDTH 320 +#define VGA_HEIGHT 200 + +typedef struct vga +{ + bool color; +} vga_t; + +#endif diff --git a/gfx/common/vita2d_common.h b/gfx/common/vita2d_common.h index 30a9e2f8ea..010f3fca10 100644 --- a/gfx/common/vita2d_common.h +++ b/gfx/common/vita2d_common.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -21,9 +21,11 @@ #include #include +#include #include "../../defines/psp_defines.h" #include "../../driver.h" +#include "../video_driver.h" #include "../video_coord_array.h" typedef struct vita_menu_frame diff --git a/gfx/common/vksym.h b/gfx/common/vksym.h index f83cc1cef5..02717d7d3f 100644 --- a/gfx/common/vksym.h +++ b/gfx/common/vksym.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2016 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2016-2017 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/common/vulkan_common.c b/gfx/common/vulkan_common.c index d50c48bf64..6aebc3e1e0 100644 --- a/gfx/common/vulkan_common.c +++ b/gfx/common/vulkan_common.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2016 - Hans-Kristian Arntzen + * Copyright (C) 2016-2017 - Hans-Kristian Arntzen * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/common/vulkan_common.h b/gfx/common/vulkan_common.h index 9e1602d10a..f183020ca2 100644 --- a/gfx/common/vulkan_common.h +++ b/gfx/common/vulkan_common.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2016 - Hans-Kristian Arntzen + * Copyright (C) 2016-2017 - Hans-Kristian Arntzen * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/common/win32_common.cpp b/gfx/common/win32_common.cpp index 2179dd7d17..21d578d48f 100644 --- a/gfx/common/win32_common.cpp +++ b/gfx/common/win32_common.cpp @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -43,6 +43,11 @@ #include "../../retroarch.h" #include "../video_thread_wrapper.h" #include + +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + #ifndef _MSC_VER extern "C" { #endif @@ -55,10 +60,13 @@ LRESULT win32_menu_loop(HWND owner, WPARAM wparam); } #endif +#ifdef HAVE_D3D9 extern "C" bool dinput_handle_message(void *dinput, UINT message, WPARAM wParam, LPARAM lParam); +extern void *dinput_gdi; extern void *dinput_wgl; extern void *dinput; +#endif unsigned g_resize_width = 0; unsigned g_resize_height = 0; @@ -106,7 +114,9 @@ typedef enum _POWER_REQUEST_TYPE #define POWER_REQUEST_CONTEXT_DETAILED_STRING 2 #endif +#ifdef _WIN32_WINNT_WIN7 typedef REASON_CONTEXT POWER_REQUEST_CONTEXT, *PPOWER_REQUEST_CONTEXT, *LPPOWER_REQUEST_CONTEXT; +#endif #ifndef MAX_MONITORS #define MAX_MONITORS 9 @@ -118,10 +128,10 @@ static unsigned win32_monitor_count = 0; extern "C" { - bool doubleclick_on_titlebar_pressed(void) - { - return doubleclick_on_titlebar; - } + bool doubleclick_on_titlebar_pressed(void) + { + return doubleclick_on_titlebar; + } void unset_doubleclick_on_titlebar(void) { @@ -277,8 +287,8 @@ static int win32_drag_query_file(HWND hwnd, WPARAM wparam) core_info_get_list(&core_info_list); - if (!core_info_list) - return 0; + if (!core_info_list) + return 0; core_info_list_get_supported_cores(core_info_list, (const char*)szFilename, &core_info, &list_size); @@ -407,7 +417,7 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message, } *quit = true; break; - case WM_COMMAND: + case WM_COMMAND: { settings_t *settings = config_get_ptr(); if (settings->ui.menubar_enable) @@ -420,6 +430,7 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message, extern void ui_window_win32_set_droppable(void *data, bool droppable); +#ifdef HAVE_D3D9 LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { @@ -464,7 +475,9 @@ LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message, return 0; return DefWindowProc(hwnd, message, wparam, lparam); } +#endif +#if defined(HAVE_OPENGL) || defined(HAVE_VULKAN) LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { @@ -504,8 +517,94 @@ LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message, return 0; } +#ifdef HAVE_D3D9 if (dinput_wgl && dinput_handle_message(dinput_wgl, message, wparam, lparam)) return 0; +#endif + return DefWindowProc(hwnd, message, wparam, lparam); +} +#endif + +LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message, + WPARAM wparam, LPARAM lparam) +{ + LRESULT ret; + bool quit = false; + + if (message == WM_NCLBUTTONDBLCLK) + doubleclick_on_titlebar = true; + + switch (message) + { + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hdc = BeginPaint(hwnd, &ps); + +#ifdef HAVE_MENU + if (menu_driver_is_alive() && !gdi_has_menu_frame()) + { + RECT rect; + GetClientRect(hwnd, &rect); + + TRIVERTEX vertex[2]; + vertex[0].x = rect.left; + vertex[0].y = rect.top; + vertex[0].Red = 1 << 8; + vertex[0].Green = 81 << 8; + vertex[0].Blue = 127 << 8; + vertex[0].Alpha = 0; + + vertex[1].x = rect.right; + vertex[1].y = rect.bottom; + vertex[1].Red = 0; + vertex[1].Green = 1 << 8; + vertex[1].Blue = 33 << 8; + vertex[1].Alpha = 0; + + GRADIENT_RECT gRect; + gRect.LowerRight = 0; + gRect.UpperLeft = 1; + + GradientFill(hdc, vertex, 2, &gRect, 1, GRADIENT_FILL_RECT_V); + } +#endif + + EndPaint(hwnd, &ps); + break; + } + case WM_DROPFILES: + case WM_SYSCOMMAND: + case WM_CHAR: + case WM_KEYDOWN: + case WM_KEYUP: + case WM_SYSKEYUP: + case WM_SYSKEYDOWN: + case WM_CLOSE: + case WM_DESTROY: + case WM_QUIT: + case WM_SIZE: + case WM_COMMAND: + ret = WndProcCommon(&quit, hwnd, message, wparam, lparam); + if (quit) + return ret; + break; + case WM_CREATE: + { + ui_window_win32_t win32_window; + win32_window.hwnd = hwnd; + + create_gdi_context(hwnd, &g_quit); + + ui_window_win32_set_droppable(&win32_window, true); + } + return 0; + } + +#ifdef HAVE_D3D9 + if (dinput_gdi && dinput_handle_message(dinput_gdi, message, wparam, lparam)) + return 0; +#endif return DefWindowProc(hwnd, message, wparam, lparam); } @@ -532,7 +631,7 @@ bool win32_window_create(void *data, unsigned style, #endif bool win32_get_metrics(void *data, - enum display_metric_types type, float *value) + enum display_metric_types type, float *value) { #ifdef _XBOX return false; @@ -647,6 +746,7 @@ bool win32_suppress_screensaver(void *data, bool enable) if (major*100+minor >= 601) { +#ifdef _WIN32_WINNT_WIN7 /* Windows 7, 8, 10 codepath */ typedef HANDLE (WINAPI * PowerCreateRequestPtr)(REASON_CONTEXT *context); typedef BOOL (WINAPI * PowerSetRequestPtr)(HANDLE PowerRequest, @@ -671,6 +771,7 @@ bool win32_suppress_screensaver(void *data, bool enable) powerSetRequest( Request, PowerRequestDisplayRequired); return true; } +#endif } else { @@ -686,8 +787,8 @@ bool win32_suppress_screensaver(void *data, bool enable) /* FIXME: It should not be necessary to add the W after MONITORINFOEX, but linking fails without it. */ void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use, - unsigned *width, unsigned *height, bool fullscreen, bool windowed_full, - RECT *rect, RECT *mon_rect, DWORD *style) + unsigned *width, unsigned *height, bool fullscreen, bool windowed_full, + RECT *rect, RECT *mon_rect, DWORD *style) { #ifndef _XBOX settings_t *settings = config_get_ptr(); @@ -714,7 +815,7 @@ void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use, if (!win32_monitor_set_fullscreen(*width, *height, refresh, current_mon->szDevice)) - {} + {} /* Display settings might have changed, get new coordinates. */ GetMonitorInfo(*hm_to_use, (MONITORINFOEX*)current_mon); @@ -780,6 +881,7 @@ bool win32_set_video_mode(void *data, RECT rect = {0}; HMONITOR hm_to_use = NULL; settings_t *settings = config_get_ptr(); + int res = 0; win32_monitor_info(¤t_mon, &hm_to_use, &mon_id); @@ -797,11 +899,20 @@ bool win32_set_video_mode(void *data, win32_set_window(&width, &height, fullscreen, windowed_full, &rect); - /* Wait until context is created (or failed to do so ...) */ - while (!g_inited && !g_quit && GetMessage(&msg, main_window.hwnd, 0, 0)) + /* Wait until context is created (or failed to do so ...). + * Please don't remove the (res = ) as GetMessage can return -1. */ + while (!g_inited && !g_quit && (res = GetMessage(&msg, main_window.hwnd, 0, 0)) != 0) { - TranslateMessage(&msg); - DispatchMessage(&msg); + if (res == -1) + { + RARCH_ERR("GetMessage error code %d\n", GetLastError()); + break; + } + else + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } } if (g_quit) diff --git a/gfx/common/win32_common.h b/gfx/common/win32_common.h index 6e41231600..d0a2baa31e 100644 --- a/gfx/common/win32_common.h +++ b/gfx/common/win32_common.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -52,6 +52,16 @@ void win32_monitor_info(void *data, void *hm_data, unsigned *mon_id); void create_graphics_context(HWND hwnd, bool *quit); +void create_gdi_context(HWND hwnd, bool *quit); + +#ifdef __cplusplus +extern "C" { +#endif +bool gdi_has_menu_frame(void); +#ifdef __cplusplus +} +#endif + bool win32_shader_dlg_init(void); void shader_dlg_show(HWND parent_hwnd); void shader_dlg_params_reload(void); @@ -84,7 +94,13 @@ bool win32_get_metrics(void *data, void win32_show_cursor(bool state); +#ifdef __cplusplus +extern "C" { +#endif HWND win32_get_window(void); +#ifdef __cplusplus +} +#endif bool win32_has_focus(void); @@ -95,7 +111,6 @@ void win32_set_window(unsigned *width, unsigned *height, bool fullscreen, bool windowed_full, void *rect_data); #ifndef _XBOX -/* FIXME: It should not be necessary to add the W after MONITORINFOEX, but linking fails without it. */ void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use, unsigned *width, unsigned *height, bool fullscreen, bool windowed_full, RECT *rect, RECT *mon_rect, DWORD *style); @@ -105,11 +120,18 @@ void win32_window_reset(void); void win32_destroy_window(void); +#ifdef HAVE_D3D9 LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); +#endif +#if defined(HAVE_OPENGL) || defined(HAVE_VULKAN) LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); +#endif + +LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message, + WPARAM wparam, LPARAM lparam); #ifdef _XBOX BOOL IsIconic(HWND hwnd); diff --git a/gfx/common/x11_common.c b/gfx/common/x11_common.c index fb5e5d25b1..5d664464d4 100644 --- a/gfx/common/x11_common.c +++ b/gfx/common/x11_common.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -31,7 +31,6 @@ #include "../../frontend/frontend_driver.h" #include "../../input/common/input_x11_common.h" #include "../../verbosity.h" -#include "../../runloop.h" #ifdef HAVE_DBUS #include @@ -323,7 +322,7 @@ void x11_suspend_screensaver(Window wnd, bool enable) x11_suspend_screensaver_xdg_screensaver(wnd, enable); } -static bool get_video_mode(video_frame_info_t video_info, +static bool get_video_mode(video_frame_info_t *video_info, Display *dpy, unsigned width, unsigned height, XF86VidModeModeInfo *mode, XF86VidModeModeInfo *desktop_mode) { @@ -345,7 +344,7 @@ static bool get_video_mode(video_frame_info_t video_info, /* If we use black frame insertion, we fake a 60 Hz monitor * for 120 Hz one, etc, so try to match that. */ - refresh_mod = video_info.black_frame_insertion ? 0.5f : 1.0f; + refresh_mod = video_info->black_frame_insertion ? 0.5f : 1.0f; for (i = 0; i < num_modes; i++) { @@ -361,7 +360,7 @@ static bool get_video_mode(video_frame_info_t video_info, continue; refresh = refresh_mod * m->dotclock * 1000.0f / (m->htotal * m->vtotal); - diff = fabsf(refresh - video_info.refresh_rate); + diff = fabsf(refresh - video_info->refresh_rate); if (!ret || diff < minimum_fps_diff) { @@ -375,7 +374,7 @@ static bool get_video_mode(video_frame_info_t video_info, return ret; } -bool x11_enter_fullscreen(video_frame_info_t video_info, +bool x11_enter_fullscreen(video_frame_info_t *video_info, Display *dpy, unsigned width, unsigned height, XF86VidModeModeInfo *desktop_mode) { @@ -634,7 +633,8 @@ bool x11_alive(void *data) } void x11_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) + bool *resize, unsigned *width, unsigned *height, + bool is_shutdown) { unsigned new_width = *width; unsigned new_height = *height; @@ -715,18 +715,16 @@ bool x11_connect(void) return true; } -void x11_update_window_title(void *data, video_frame_info_t video_info) +void x11_update_title(void *data, video_frame_info_t *video_info) { - char buf[128]; - char buf_fps[128]; + char title[128]; - buf[0] = buf_fps[0] = '\0'; + title[0] = '\0'; - if (video_monitor_get_fps(video_info, - buf, sizeof(buf), buf_fps, sizeof(buf_fps))) - XStoreName(g_x11_dpy, g_x11_win, buf); - if (video_info.fps_show) - runloop_msg_queue_push(buf_fps, 1, 1, false); + video_driver_get_window_title(title, sizeof(title)); + + if (title[0]) + XStoreName(g_x11_dpy, g_x11_win, title); } bool x11_input_ctx_new(bool true_full) diff --git a/gfx/common/x11_common.h b/gfx/common/x11_common.h index b08db07e0f..206acd6ea6 100644 --- a/gfx/common/x11_common.h +++ b/gfx/common/x11_common.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -45,7 +45,7 @@ void x11_save_last_used_monitor(Window win); void x11_show_mouse(Display *dpy, Window win, bool state); void x11_windowed_fullscreen(Display *dpy, Window win); void x11_suspend_screensaver(Window win, bool enable); -bool x11_enter_fullscreen(video_frame_info_t video_info, +bool x11_enter_fullscreen(video_frame_info_t *video_info, Display *dpy, unsigned width, unsigned height, XF86VidModeModeInfo *desktop_mode); @@ -72,7 +72,7 @@ bool x11_get_metrics(void *data, enum display_metric_types type, float *value); void x11_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count); + bool *resize, unsigned *width, unsigned *height, bool is_shutdown); void x11_get_video_size(void *data, unsigned *width, unsigned *height); @@ -84,7 +84,7 @@ bool x11_alive(void *data); bool x11_connect(void); -void x11_update_window_title(void *data, video_frame_info_t video_info); +void x11_update_title(void *data, video_frame_info_t *video_info); bool x11_input_ctx_new(bool true_full); diff --git a/gfx/drivers/caca_gfx.c b/gfx/drivers/caca_gfx.c index c56ca64b52..0e4885133d 100644 --- a/gfx/drivers/caca_gfx.c +++ b/gfx/drivers/caca_gfx.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -15,13 +15,20 @@ * If not, see . */ -#include #include +#include + +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + +#include "../common/caca_common.h" + +#include "../font_driver.h" + #include "../../driver.h" #include "../../verbosity.h" -#include "../../menu/menu_driver.h" -#include "../common/caca_common.h" static caca_canvas_t *caca_cv = NULL; static caca_dither_t *caca_dither = NULL; @@ -33,7 +40,7 @@ static unsigned caca_menu_pitch = 0; static unsigned caca_video_width = 0; static unsigned caca_video_height = 0; static unsigned caca_video_pitch = 0; -static bool caca_rgb32 = 0; +static bool caca_rgb32 = false; static void caca_gfx_free(void *data); @@ -94,7 +101,7 @@ static void *caca_gfx_init(const video_info_t *video, static bool caca_gfx_frame(void *data, const void *frame, unsigned frame_width, unsigned frame_height, uint64_t frame_count, - unsigned pitch, const char *msg, video_frame_info_t video_info) + unsigned pitch, const char *msg, video_frame_info_t *video_info) { size_t len = 0; void *buffer = NULL; @@ -113,7 +120,7 @@ static bool caca_gfx_frame(void *data, const void *frame, if (!frame || !frame_width || !frame_height) return true; - if ( caca_video_width != frame_width || + if ( caca_video_width != frame_width || caca_video_height != frame_height || caca_video_pitch != pitch) { @@ -130,26 +137,29 @@ static bool caca_gfx_frame(void *data, const void *frame, if (!caca_cv) return true; - if (caca_menu_frame) + if (caca_menu_frame && video_info->menu_is_alive) frame_to_copy = caca_menu_frame; width = caca_get_canvas_width(caca_cv); height = caca_get_canvas_height(caca_cv); - if ( frame_to_copy == frame && - frame_width == 4 && - frame_height == 4 && + if ( frame_to_copy == frame && + frame_width == 4 && + frame_height == 4 && (frame_width < width && frame_height < height)) draw = false; + if (video_info->menu_is_alive) + draw = false; + caca_clear_canvas(caca_cv); #ifdef HAVE_MENU - menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL); + menu_driver_frame(video_info); #endif if (msg) - font_driver_render_msg(NULL, msg, NULL); + font_driver_render_msg(video_info, NULL, msg, NULL); if (draw) { @@ -251,7 +261,7 @@ static void caca_gfx_viewport_info(void *data, (void)vp; } -static bool caca_gfx_read_viewport(void *data, uint8_t *buffer) +static bool caca_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; @@ -274,9 +284,9 @@ static void caca_set_texture_frame(void *data, caca_menu_frame = NULL; } - if ( !caca_menu_frame || - caca_menu_width != width || - caca_menu_height != height || + if ( !caca_menu_frame || + caca_menu_width != width || + caca_menu_height != height || caca_menu_pitch != pitch) if (pitch && height) caca_menu_frame = (unsigned char*)malloc(pitch * height); @@ -286,9 +296,11 @@ static void caca_set_texture_frame(void *data, } static void caca_set_osd_msg(void *data, const char *msg, - const struct font_params *params, void *font) + const void *params, void *font) { - font_driver_render_msg(font, msg, params); + video_frame_info_t video_info; + video_driver_build_info(&video_info); + font_driver_render_msg(&video_info, font, msg, params); } static const video_poke_interface_t caca_poke_interface = { diff --git a/gfx/drivers/ctr_gfx.c b/gfx/drivers/ctr_gfx.c index 44f36f98f5..76158f9f81 100644 --- a/gfx/drivers/ctr_gfx.c +++ b/gfx/drivers/ctr_gfx.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2016 - Ali Bouhlel + * Copyright (C) 2014-2017 - Ali Bouhlel * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -26,11 +26,14 @@ #include "../../config.h" #endif +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + +#include "../font_driver.h" #include "../../ctr/gpu_old.h" #include "ctr_gu.h" -#include "../../menu/menu_driver.h" - #include "../../configuration.h" #include "../../command.h" #include "../../driver.h" @@ -362,7 +365,9 @@ static void* ctr_init(const video_info_t* video, ctr->menu.texture_width, ctr->menu.texture_height); memset(ctr->texture_linear, 0x00, ctr->texture_width * ctr->texture_height * (ctr->rgb32? 4:2)); -// memset(ctr->menu.texture_swizzled , 0x00, ctr->menu.texture_width * ctr->menu.texture_height * 2); +#if 0 + memset(ctr->menu.texture_swizzled , 0x00, ctr->menu.texture_width * ctr->menu.texture_height * 2); +#endif ctr->dvlb = DVLB_ParseFile((u32*)ctr_sprite_shbin, ctr_sprite_shbin_size); ctrGuSetVshGsh(&ctr->shader, ctr->dvlb, 2, 2); @@ -377,9 +382,13 @@ static void* ctr_init(const video_info_t* video, GPU_SetStencilTest(false, GPU_ALWAYS, 0x00, 0xFF, 0x00); GPU_SetStencilOp(GPU_STENCIL_KEEP, GPU_STENCIL_KEEP, GPU_STENCIL_KEEP); GPU_SetBlendingColor(0, 0, 0, 0); -// GPU_SetDepthTestAndWriteMask(true, GPU_GREATER, GPU_WRITE_ALL); +#if 0 + GPU_SetDepthTestAndWriteMask(true, GPU_GREATER, GPU_WRITE_ALL); +#endif GPU_SetDepthTestAndWriteMask(false, GPU_ALWAYS, GPU_WRITE_COLOR); - // GPU_SetDepthTestAndWriteMask(true, GPU_ALWAYS, GPU_WRITE_ALL); +#if 0 + GPU_SetDepthTestAndWriteMask(true, GPU_ALWAYS, GPU_WRITE_ALL); +#endif GPUCMD_AddMaskedWrite(GPUREG_EARLYDEPTH_TEST1, 0x1, 0); GPUCMD_AddWrite(GPUREG_EARLYDEPTH_TEST2, 0); @@ -443,10 +452,14 @@ static void* ctr_init(const video_info_t* video, return ctr; } +#if 0 +#define CTR_INSPECT_MEMORY_USAGE +#endif + static bool ctr_frame(void* data, const void* frame, unsigned width, unsigned height, uint64_t frame_count, - unsigned pitch, const char* msg, video_frame_info_t info) + unsigned pitch, const char* msg, video_frame_info_t *video_info) { uint32_t diff; static uint64_t currentTick,lastTick; @@ -517,12 +530,16 @@ static bool ctr_frame(void* data, const void* frame, #ifndef HAVE_THREADS if(task_queue_ctl(TASK_QUEUE_CTL_FIND, &ctr_tasks_finder_data)) { -// ctr->vsync_event_pending = true; +#if 0 + ctr->vsync_event_pending = true; +#endif while(ctr->vsync_event_pending) { task_queue_ctl(TASK_QUEUE_CTL_CHECK, NULL); svcSleepThread(0); -// aptMainLoop(); +#if 0 + aptMainLoop(); +#endif } } #endif @@ -540,7 +557,6 @@ static bool ctr_frame(void* data, const void* frame, frames = 0; } -//#define CTR_INSPECT_MEMORY_USAGE #ifdef CTR_INSPECT_MEMORY_USAGE uint32_t ctr_get_stack_usage(void); @@ -560,12 +576,14 @@ static bool ctr_frame(void* data, const void* frame, if(query_addr == 0x1F000000) query_addr = 0x30000000; } -// static u32* dummy_pointer; -// if(total_frames == 500) -// dummy_pointer = malloc(0x2000000); -// if(total_frames == 1000) -// free(dummy_pointer); +#if 0 + static u32* dummy_pointer; + if(total_frames == 500) + dummy_pointer = malloc(0x2000000); + if(total_frames == 1000) + free(dummy_pointer); +#endif printf("========================================"); printf("0x%08X 0x%08X 0x%08X\n", __heap_size, gpuCmdBufOffset, (__linear_heap_size - linearSpaceFree())); @@ -618,10 +636,12 @@ static bool ctr_frame(void* data, const void* frame, && (pitch > 0x40)) { /* can copy the buffer directly with the GPU */ -// GSPGPU_FlushDataCache(frame, pitch * height); +#if 0 + GSPGPU_FlushDataCache(frame, pitch * height); +#endif ctrGuSetCommandList_First(true,(void*)frame, pitch * height,0,0,0,0); ctrGuCopyImage(true, frame, pitch / (ctr->rgb32? 4: 2), height, ctr->rgb32 ? CTRGU_RGBA8: CTRGU_RGB565, false, - ctr->texture_swizzled, ctr->texture_width, ctr->rgb32 ? CTRGU_RGBA8: CTRGU_RGB565, true); + ctr->texture_swizzled, ctr->texture_width, ctr->rgb32 ? CTRGU_RGBA8: CTRGU_RGB565, true); } else { @@ -659,7 +679,7 @@ static bool ctr_frame(void* data, const void* frame, ctr_check_3D_slider(ctr); -// /* ARGB --> RGBA */ + /* ARGB --> RGBA */ if (ctr->rgb32) { GPU_SetTexEnv(0, @@ -750,17 +770,17 @@ static bool ctr_frame(void* data, const void* frame, } ctr->msg_rendering_enabled = true; - menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL); + menu_driver_frame(video_info); ctr->msg_rendering_enabled = false; } if (msg) - font_driver_render_msg(NULL, msg, NULL); - -// font_driver_render_msg(NULL, "TEST: 123 ABC àüî", NULL); - + font_driver_render_msg(video_info, NULL, msg, NULL); +#if 0 + font_driver_render_msg(video_info, NULL, "TEST: 123 ABC àüî", NULL); +#endif GPU_FinishDrawing(); GPUCMD_Finalize(); @@ -781,7 +801,7 @@ static bool ctr_frame(void* data, const void* frame, gfxTopRightFramebuffers[ctr->current_buffer_top], 240,CTRGU_RGB8, CTRGU_MULTISAMPLE_NONE); - // Swap buffers : + /* Swap buffers : */ extern GSPGPU_FramebufferInfo topFramebufferInfo; extern u8* gfxSharedMemory; extern u8 gfxThreadID; @@ -873,7 +893,9 @@ static void ctr_free(void* data) linearFree(ctr->empty_framebuffer); linearFree(ctr->vertex_cache.buffer); linearFree(ctr); - // gfxExit(); +#if 0 + gfxExit(); +#endif } static void ctr_set_texture_frame(void* data, const void* frame, bool rgb32, unsigned width, unsigned height, float alpha) @@ -1092,14 +1114,16 @@ static void ctr_unload_texture(void *data, uintptr_t handle) } static void ctr_set_osd_msg(void *data, const char *msg, - const struct font_params *params, void *font) + const void *params, void *font) { + video_frame_info_t video_info; ctr_video_t* ctr = (ctr_video_t*)data; - if (ctr && ctr->msg_rendering_enabled) - font_driver_render_msg(font, msg, params); -} + video_driver_build_info(&video_info); + if (ctr && ctr->msg_rendering_enabled) + font_driver_render_msg(&video_info, font, msg, params); +} static const video_poke_interface_t ctr_poke_interface = { ctr_load_texture, @@ -1130,7 +1154,7 @@ static void ctr_get_poke_interface(void* data, *iface = &ctr_poke_interface; } -static bool ctr_read_viewport(void* data, uint8_t* buffer) +static bool ctr_read_viewport(void* data, uint8_t* buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/ctr_gu.h b/gfx/drivers/ctr_gu.h index 67ee83b3b9..01f6dd1d49 100644 --- a/gfx/drivers/ctr_gu.h +++ b/gfx/drivers/ctr_gu.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2016 - Ali Bouhlel + * Copyright (C) 2014-2017 - Ali Bouhlel * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers/d3d.cpp b/gfx/drivers/d3d.cpp index 9503a0cdf3..03f1af93d0 100644 --- a/gfx/drivers/d3d.cpp +++ b/gfx/drivers/d3d.cpp @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2014 - OV2 * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -47,11 +47,12 @@ #include "../../menu/menu_driver.h" #endif +#include "../font_driver.h" + #include "../../core.h" #include "../../performance_counters.h" #include "../../defines/d3d_defines.h" -#include "../../runloop.h" #include "../../verbosity.h" #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL) @@ -259,18 +260,18 @@ static bool d3d_init_multipass(d3d_video_t *d3d) } memset(&d3d->shader, 0, sizeof(d3d->shader)); - +#ifdef HAVE_SHADERPIPELINE if (!video_shader_read_conf_cgp(conf, &d3d->shader)) { config_file_free(conf); RARCH_ERR("Failed to parse CGP file.\n"); return false; } - +#endif config_file_free(conf); - +#ifdef HAVE_SHADERPIPELINE video_shader_resolve_relative(&d3d->shader, d3d->shader_path.c_str()); - +#endif RARCH_LOG("[D3D9 Meta-Cg] Found %u shaders.\n", d3d->shader.passes); for (i = 0; i < d3d->shader.passes; i++) @@ -332,14 +333,16 @@ static void d3d_viewport_info(void *data, struct video_viewport *vp) d3d->renderchain_driver->viewport_info(d3d, vp); } -static void d3d_overlay_render(d3d_video_t *d3d, overlay_t *overlay) +static void d3d_overlay_render(d3d_video_t *d3d, video_frame_info_t *video_info, + overlay_t *overlay) { struct video_viewport vp; - unsigned width, height; void *verts; unsigned i; float vert[4][9]; float overlay_width, overlay_height; + unsigned width = video_info->width; + unsigned height = video_info->height; if (!d3d || !overlay || !overlay->tex) return; @@ -429,8 +432,6 @@ static void d3d_overlay_render(d3d_video_t *d3d, overlay_t *overlay) { D3DVIEWPORT vp_full; - video_driver_get_size(&width, &height); - vp_full.X = 0; vp_full.Y = 0; vp_full.Width = width; @@ -881,7 +882,7 @@ static bool d3d_alive(void *data) mode.width = temp_width; mode.height = temp_height; - video_context_driver_set_resize(&mode); + video_context_driver_set_resize(mode); d3d_restore(d3d); } @@ -950,14 +951,17 @@ static void d3d_apply_state_changes(void *data) } static void d3d_set_osd_msg(void *data, const char *msg, - const struct font_params *params, void *font) + const void *params, void *font) { + video_frame_info_t video_info; d3d_video_t *d3d = (d3d_video_t*)data; + video_driver_build_info(&video_info); + if (d3d->renderchain_driver->set_font_rect && params) d3d->renderchain_driver->set_font_rect(d3d, params); - font_driver_render_msg(NULL, msg, params); + font_driver_render_msg(&video_info, NULL, msg, params); } /* Delay constructor due to lack of exceptions. */ @@ -1368,21 +1372,21 @@ static void d3d_get_overlay_interface(void *data, static bool d3d_frame(void *data, const void *frame, unsigned frame_width, unsigned frame_height, uint64_t frame_count, unsigned pitch, - const char *msg, video_frame_info_t video_info) + const char *msg, video_frame_info_t *video_info) { - unsigned width, height; - static struct retro_perf_counter d3d_frame = {0}; + static struct + retro_perf_counter d3d_frame = {0}; unsigned i = 0; d3d_video_t *d3d = (d3d_video_t*)data; HWND window = win32_get_window(); + unsigned width = video_info->width; + unsigned height = video_info->height; (void)i; if (!frame) return true; - video_driver_get_size(&width, &height); - performance_counter_init(&d3d_frame, "d3d_frame"); performance_counter_start(&d3d_frame); @@ -1412,18 +1416,18 @@ static bool d3d_frame(void *data, const void *frame, /* render_chain() only clears out viewport, * clear out everything. */ D3DVIEWPORT screen_vp; - screen_vp.X = 0; - screen_vp.Y = 0; - screen_vp.MinZ = 0; - screen_vp.MaxZ = 1; - screen_vp.Width = width; + screen_vp.X = 0; + screen_vp.Y = 0; + screen_vp.MinZ = 0; + screen_vp.MaxZ = 1; + screen_vp.Width = width; screen_vp.Height = height; d3d_set_viewports(d3d->dev, &screen_vp); d3d_clear(d3d->dev, 0, 0, D3DCLEAR_TARGET, 0, 1, 0); /* Insert black frame first, so we * can screenshot, etc. */ - if (video_info.black_frame_insertion) + if (video_info->black_frame_insertion) { if (!d3d_swap(d3d, d3d->dev) || d3d->needs_restore) return true; @@ -1442,14 +1446,14 @@ static bool d3d_frame(void *data, const void *frame, if (msg) { struct font_params font_parms = {0}; - font_driver_render_msg(NULL, msg, &font_parms); + font_driver_render_msg(video_info, NULL, msg, &font_parms); } #ifdef HAVE_MENU if (d3d->menu && d3d->menu->enabled) { - d3d_overlay_render(d3d, d3d->menu); - menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL); + d3d_overlay_render(d3d, video_info, d3d->menu); + menu_driver_frame(video_info); } #endif @@ -1457,7 +1461,7 @@ static bool d3d_frame(void *data, const void *frame, if (d3d->overlays_enabled) { for (i = 0; i < d3d->overlays.size(); i++) - d3d_overlay_render(d3d, &d3d->overlays[i]); + d3d_overlay_render(d3d, video_info, &d3d->overlays[i]); } #endif @@ -1470,7 +1474,7 @@ static bool d3d_frame(void *data, const void *frame, return true; } -static bool d3d_read_viewport(void *data, uint8_t *buffer) +static bool d3d_read_viewport(void *data, uint8_t *buffer, bool is_idle) { d3d_video_t *d3d = (d3d_video_t*)data; diff --git a/gfx/drivers/d3d.h b/gfx/drivers/d3d.h index 240c8a313b..89251adab4 100644 --- a/gfx/drivers/d3d.h +++ b/gfx/drivers/d3d.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers/d3d_renderchains/render_chain_cg.cpp b/gfx/drivers/d3d_renderchains/render_chain_cg.cpp index 76b56a8444..7c25bcbf5c 100644 --- a/gfx/drivers/d3d_renderchains/render_chain_cg.cpp +++ b/gfx/drivers/d3d_renderchains/render_chain_cg.cpp @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -38,7 +38,6 @@ #include "../../video_driver.h" #include "../../../performance_counters.h" #include "../../../configuration.h" -#include "../../../runloop.h" #include "../../../verbosity.h" #define cg_d3d9_set_param_1f(param, x) if (param) cgD3D9SetUniform(param, x) diff --git a/gfx/drivers/d3d_renderchains/render_chain_driver.c b/gfx/drivers/d3d_renderchains/render_chain_driver.c index 5ff5f8140a..9d15efdc92 100644 --- a/gfx/drivers/d3d_renderchains/render_chain_driver.c +++ b/gfx/drivers/d3d_renderchains/render_chain_driver.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers/d3d_renderchains/render_chain_driver.h b/gfx/drivers/d3d_renderchains/render_chain_driver.h index 8a94a542aa..9bf7bd733b 100644 --- a/gfx/drivers/d3d_renderchains/render_chain_driver.h +++ b/gfx/drivers/d3d_renderchains/render_chain_driver.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers/d3d_renderchains/render_chain_null.c b/gfx/drivers/d3d_renderchains/render_chain_null.c index dee984b9bd..0acbe82e8c 100644 --- a/gfx/drivers/d3d_renderchains/render_chain_null.c +++ b/gfx/drivers/d3d_renderchains/render_chain_null.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers/d3d_renderchains/render_chain_xdk.cpp b/gfx/drivers/d3d_renderchains/render_chain_xdk.cpp index cea5814bc1..394a0bbf2c 100644 --- a/gfx/drivers/d3d_renderchains/render_chain_xdk.cpp +++ b/gfx/drivers/d3d_renderchains/render_chain_xdk.cpp @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -59,7 +59,7 @@ static void renderchain_set_mvp(void *data, unsigned vp_width, mvp.data = d3d; mvp.matrix = NULL; - video_shadser_driver_set_mvp(mvp); + video_shader_driver_set_mvp(mvp); #elif defined(HAVE_D3D8) D3DXMATRIX p_out, p_rotate, mat; D3DXMatrixOrthoOffCenterLH(&mat, 0, vp_width, vp_height, 0, 0.0f, 1.0f); diff --git a/gfx/drivers/dispmanx_gfx.c b/gfx/drivers/dispmanx_gfx.c index b521206acb..5ae4614fc1 100644 --- a/gfx/drivers/dispmanx_gfx.c +++ b/gfx/drivers/dispmanx_gfx.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2015 - Manuel Alfayate + * Copyright (C) 2015-2017 - Manuel Alfayate + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -21,10 +22,14 @@ #include "../../config.h" #endif -#include "../../configuration.h" +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + +#include "../font_driver.h" + #include "../../driver.h" #include "../../retroarch.h" -#include "../../runloop.h" #include "../video_context_driver.h" #include "../font_driver.h" @@ -326,7 +331,7 @@ static void dispmanx_surface_update(void *data, const void *frame, * so we dump and issue flip, and then we can wait for free pages, but we don't * want to wait for free pages at the beggining of the update or we will be * adding lag! */ - + struct dispmanx_video *_dispvars = data; settings_t *settings = config_get_ptr(); @@ -447,7 +452,7 @@ static void *dispmanx_gfx_init(const video_info_t *video, static bool dispmanx_gfx_frame(void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, unsigned pitch, const char *msg, - video_frame_info_t video_info) + video_frame_info_t *video_info) { struct dispmanx_video *_dispvars = data; float aspect = video_driver_get_aspect_ratio(); @@ -455,14 +460,14 @@ static bool dispmanx_gfx_frame(void *data, const void *frame, unsigned width, if (!frame) return true; - if (width != _dispvars->core_width || height != _dispvars->core_height || _dispvars->aspect_ratio != aspect) + if ( (width != _dispvars->core_width) || + (height != _dispvars->core_height) || + (_dispvars->aspect_ratio != aspect)) { /* Sanity check. */ if (width == 0 || height == 0) return true; - settings_t *settings = config_get_ptr(); - _dispvars->core_width = width; _dispvars->core_height = height; _dispvars->core_pitch = pitch; @@ -481,22 +486,19 @@ static bool dispmanx_gfx_frame(void *data, const void *frame, unsigned width, _dispvars->rgb32 ? VC_IMAGE_XRGB8888 : VC_IMAGE_RGB565, 255, _dispvars->aspect_ratio, - settings->video.max_swapchain_images, + video_info->max_swapchain_images, 0, &_dispvars->main_surface); - + /* We need to recreate the menu surface too, if it exists already, so we * free it and let dispmanx_set_texture_frame() recreate it as it detects it's NULL.*/ - if (_dispvars->menu_active && _dispvars->menu_surface) { + if (_dispvars->menu_active && _dispvars->menu_surface) dispmanx_surface_free(_dispvars, &_dispvars->menu_surface); - } } - if (video_info.fps_show) - { - char buf[128]; - video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0); - } +#ifdef HAVE_MENU + menu_driver_frame(video_info); +#endif /* Update main surface: locate free page, blit and flip. */ dispmanx_surface_update(_dispvars, frame, _dispvars->main_surface); @@ -615,7 +617,7 @@ static void dispmanx_gfx_set_rotation(void *data, unsigned rotation) (void)rotation; } -static bool dispmanx_gfx_read_viewport(void *data, uint8_t *buffer) +static bool dispmanx_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/drm_gfx.c b/gfx/drivers/drm_gfx.c index 9e21463134..0b861d8cee 100644 --- a/gfx/drivers/drm_gfx.c +++ b/gfx/drivers/drm_gfx.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. - * Plain DRM diver: Copyright (C) 2016 - Manuel Alfayate + * Copyright (C) 2015-2017 - Manuel Alfayate + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -11,8 +12,11 @@ * * You should have received a copy of the GNU General Public License along with RetroArch. * If not, see . + * */ + /* Plain DRM diver */ + #include #include #include @@ -28,10 +32,13 @@ #include "../../config.h" #endif +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + #include "../font_driver.h" #include "../video_context_driver.h" #include "../../retroarch.h" -#include "../../runloop.h" #include "drm_pixformats.h" @@ -744,11 +751,12 @@ static void *drm_gfx_init(const video_info_t *video, static bool drm_gfx_frame(void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, unsigned pitch, const char *msg, - video_frame_info_t video_info) + video_frame_info_t *video_info) { struct drm_video *_drmvars = data; - if (width != _drmvars->core_width || height != _drmvars->core_height) + if ( ( width != _drmvars->core_width) || + (height != _drmvars->core_height)) { /* Sanity check. */ if (width == 0 || height == 0) @@ -778,13 +786,9 @@ static bool drm_gfx_frame(void *data, const void *frame, unsigned width, drm_plane_setup(_drmvars->main_surface); } - if (_drmvars->menu_active) - { - char buf[128]; - buf[0] = '\0'; - - video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0); - } +#ifdef HAVE_MENU + menu_driver_frame(video_info); +#endif /* Update main surface: locate free page, blit and flip. */ drm_surface_update(_drmvars, frame, _drmvars->main_surface); @@ -935,7 +939,7 @@ static void drm_gfx_set_rotation(void *data, unsigned rotation) (void)rotation; } -static bool drm_gfx_read_viewport(void *data, uint8_t *buffer) +static bool drm_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/exynos_gfx.c b/gfx/drivers/exynos_gfx.c index 68f5132eba..7cb08690cb 100644 --- a/gfx/drivers/exynos_gfx.c +++ b/gfx/drivers/exynos_gfx.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2015 - Tobias Jakobi + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -35,11 +36,14 @@ #include "../../config.h" #endif +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + #include "../common/drm_common.h" #include "../font_driver.h" #include "../../configuration.h" #include "../../retroarch.h" -#include "../../runloop.h" /* TODO: Honor these properties: vsync, menu rotation, menu alpha, aspect ratio change */ @@ -1159,7 +1163,6 @@ static int exynos_render_msg(struct exynos_video *vid, return exynos_blend_font(pdata); } - static void *exynos_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { @@ -1273,7 +1276,7 @@ static void exynos_gfx_free(void *data) static bool exynos_gfx_frame(void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, unsigned pitch, const char *msg, - video_frame_info_t video_info) + video_frame_info_t *video_info) { struct exynos_video *vid = data; struct exynos_page *page = NULL; @@ -1304,18 +1307,6 @@ static bool exynos_gfx_frame(void *data, const void *frame, unsigned width, goto fail; } - if (video_info.fps_show) - { - char buffer[128]; - char buffer_fps[128]; - - buffer[0] = buffer_fps[0] = '\0'; - - video_monitor_get_fps(video_info, buffer, sizeof(buffer), - video_info.fps_show ? buffer_fps : NULL, sizeof(buffer_fps)); - runloop_msg_queue_push(buffer_fps, 1, 1, false); - } - /* If at this point the dimension parameters are still zero, setup some * * fake blit parameters so that menu and font rendering work properly. */ if (vid->width == 0 || vid->height == 0) @@ -1328,6 +1319,9 @@ static bool exynos_gfx_frame(void *data, const void *frame, unsigned width, { if (exynos_blend_menu(vid->data, vid->menu_rotation) != 0) goto fail; +#ifdef HAVE_MENU + menu_driver_frame(video_info); +#endif } if (msg) @@ -1526,7 +1520,7 @@ static bool exynos_gfx_set_shader(void *data, return false; } -static bool exynos_gfx_read_viewport(void *data, uint8_t *buffer) +static bool exynos_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/gdi_gfx.c b/gfx/drivers/gdi_gfx.c new file mode 100644 index 0000000000..8daeff9a62 --- /dev/null +++ b/gfx/drivers/gdi_gfx.c @@ -0,0 +1,506 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include + +#ifdef HAVE_CONFIG_H +#include "../../config.h" +#endif + +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + +#include "../font_driver.h" + +#include "../../driver.h" +#include "../../configuration.h" +#include "../../verbosity.h" +#include "../common/gdi_common.h" + +#if defined(_WIN32) && !defined(_XBOX) +#include "../common/win32_common.h" +#endif + +static unsigned char *gdi_menu_frame = NULL; +static unsigned gdi_menu_width = 0; +static unsigned gdi_menu_height = 0; +static unsigned gdi_menu_pitch = 0; +static unsigned gdi_video_width = 0; +static unsigned gdi_video_height = 0; +static unsigned gdi_video_pitch = 0; +static unsigned gdi_video_bits = 0; +static unsigned gdi_menu_bits = 0; +static bool gdi_rgb32 = false; +static bool gdi_menu_rgb32 = false; + +static void gdi_gfx_create(void) +{ +} + +static void *gdi_gfx_init(const video_info_t *video, + const input_driver_t **input, void **input_data) +{ + unsigned full_x, full_y; + gfx_ctx_input_t inp; + gfx_ctx_mode_t mode; + const gfx_ctx_driver_t *ctx_driver = NULL; + unsigned win_width = 0, win_height = 0; + unsigned temp_width = 0, temp_height = 0; + settings_t *settings = config_get_ptr(); + gdi_t *gdi = (gdi_t*)calloc(1, sizeof(*gdi)); + + *input = NULL; + *input_data = NULL; + + gdi_video_width = video->width; + gdi_video_height = video->height; + gdi_rgb32 = video->rgb32; + + gdi_video_bits = video->rgb32 ? 32 : 16; + + if (video->rgb32) + gdi_video_pitch = video->width * 4; + else + gdi_video_pitch = video->width * 2; + + gdi_gfx_create(); + + ctx_driver = video_context_driver_init_first(gdi, + settings->video.context_driver, + GFX_CTX_GDI_API, 1, 0, false); + if (!ctx_driver) + goto error; + + video_context_driver_set((const gfx_ctx_driver_t*)ctx_driver); + + RARCH_LOG("Found GDI context: %s\n", ctx_driver->ident); + + video_context_driver_get_video_size(&mode); + + full_x = mode.width; + full_y = mode.height; + mode.width = 0; + mode.height = 0; + + RARCH_LOG("Detecting screen resolution %ux%u.\n", full_x, full_y); + + win_width = video->width; + win_height = video->height; + + if (video->fullscreen && (win_width == 0) && (win_height == 0)) + { + win_width = full_x; + win_height = full_y; + } + + mode.width = win_width; + mode.height = win_height; + mode.fullscreen = video->fullscreen; + + if (!video_context_driver_set_video_mode(&mode)) + goto error; + + mode.width = 0; + mode.height = 0; + + video_context_driver_get_video_size(&mode); + + temp_width = mode.width; + temp_height = mode.height; + mode.width = 0; + mode.height = 0; + + /* Get real known video size, which might have been altered by context. */ + + if (temp_width != 0 && temp_height != 0) + video_driver_set_size(&temp_width, &temp_height); + + video_driver_get_size(&temp_width, &temp_height); + + RARCH_LOG("GDI: Using resolution %ux%u\n", temp_width, temp_height); + + inp.input = input; + inp.input_data = input_data; + + video_context_driver_input_driver(&inp); + + if (settings->video.font_enable) + font_driver_init_osd(NULL, false, FONT_DRIVER_RENDER_GDI); + + RARCH_LOG("[GDI]: Init complete.\n"); + + return gdi; + +error: + video_context_driver_destroy(); + if (gdi) + free(gdi); + return NULL; +} + +static bool gdi_gfx_frame(void *data, const void *frame, + unsigned frame_width, unsigned frame_height, uint64_t frame_count, + unsigned pitch, const char *msg, video_frame_info_t *video_info) +{ + gfx_ctx_mode_t mode; + RECT rect; + const void *frame_to_copy = frame; + unsigned width = 0; + unsigned height = 0; + unsigned bits = gdi_video_bits; + bool draw = true; + gdi_t *gdi = (gdi_t*)data; + HWND hwnd = win32_get_window(); + + if (!frame || !frame_width || !frame_height) + return true; + +#ifdef HAVE_MENU + menu_driver_frame(video_info); +#endif + + if (gdi_video_width != frame_width || gdi_video_height != frame_height || gdi_video_pitch != pitch) + { + if (frame_width > 4 && frame_height > 4) + { + gdi_video_width = frame_width; + gdi_video_height = frame_height; + gdi_video_pitch = pitch; + } + } + + if (gdi_menu_frame && video_info->menu_is_alive) + { + frame_to_copy = gdi_menu_frame; + width = gdi_menu_width; + height = gdi_menu_height; + pitch = gdi_menu_pitch; + bits = gdi_menu_bits; + } + else + { + width = gdi_video_width; + height = gdi_video_height; + pitch = gdi_video_pitch; + + if (frame_width == 4 && frame_height == 4 && (frame_width < width && frame_height < height)) + draw = false; + + if (video_info->menu_is_alive) + draw = false; + } + + GetClientRect(hwnd, &rect); + video_context_driver_get_video_size(&mode); + + if (draw) + { + HDC winDC = GetDC(hwnd); + HDC memDC = CreateCompatibleDC(winDC); + HBITMAP bmp = CreateCompatibleBitmap(winDC, width, height); + BITMAPINFO *info = (BITMAPINFO*)calloc(1, sizeof(*info) + (3 * sizeof(RGBQUAD))); + HBITMAP bmp_old = (HBITMAP)SelectObject(memDC, bmp); + + info->bmiHeader.biBitCount = bits; + info->bmiHeader.biWidth = pitch / (bits / 8); + info->bmiHeader.biHeight = -height; + info->bmiHeader.biPlanes = 1; + info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER) + (3 * sizeof(RGBQUAD)); + info->bmiHeader.biSizeImage = 0; + + if (bits == 16) + { + unsigned *masks = (unsigned*)info->bmiColors; + + info->bmiHeader.biCompression = BI_BITFIELDS; + + /* map RGB565 color bits, default is 555 */ + masks[0] = 0xF800; + masks[1] = 0x07E0; + masks[2] = 0x001F; + } + else + info->bmiHeader.biCompression = BI_RGB; + + StretchDIBits(memDC, 0, 0, width, height, 0, 0, width, height, + frame_to_copy, info, DIB_RGB_COLORS, SRCCOPY); + + StretchBlt(winDC, + 0, 0, + mode.width, mode.height, + memDC, 0, 0, width, height, SRCCOPY); + + SelectObject(memDC, bmp_old); + + DeleteObject(bmp); + DeleteDC(memDC); + ReleaseDC(hwnd, winDC); + + free(info); + } + + if (msg) + font_driver_render_msg(video_info, NULL, msg, NULL); + + InvalidateRect(hwnd, NULL, false); + + video_context_driver_update_window_title(video_info); + + return true; +} + +static void gdi_gfx_set_nonblock_state(void *data, bool toggle) +{ + (void)data; + (void)toggle; +} + +static bool gdi_gfx_alive(void *data) +{ + gfx_ctx_size_t size_data; + unsigned temp_width = 0; + unsigned temp_height = 0; + bool quit = false; + bool resize = false; + + /* Needed because some context drivers don't track their sizes */ + video_driver_get_size(&temp_width, &temp_height); + + size_data.quit = &quit; + size_data.resize = &resize; + size_data.width = &temp_width; + size_data.height = &temp_height; + + video_context_driver_check_window(&size_data); + + if (temp_width != 0 && temp_height != 0) + video_driver_set_size(&temp_width, &temp_height); + + return true; +} + +static bool gdi_gfx_focus(void *data) +{ + (void)data; + return true; +} + +static bool gdi_gfx_suppress_screensaver(void *data, bool enable) +{ + (void)data; + (void)enable; + return false; +} + +static bool gdi_gfx_has_windowed(void *data) +{ + (void)data; + return true; +} + +static void gdi_gfx_free(void *data) +{ + gdi_t *gdi = (gdi_t*)data; + + if (gdi_menu_frame) + { + free(gdi_menu_frame); + gdi_menu_frame = NULL; + } + + if (!gdi) + return; + + font_driver_free_osd(); + video_context_driver_free(); + free(gdi); +} + +static bool gdi_gfx_set_shader(void *data, + enum rarch_shader_type type, const char *path) +{ + (void)data; + (void)type; + (void)path; + + return false; +} + +static void gdi_gfx_set_rotation(void *data, + unsigned rotation) +{ + (void)data; + (void)rotation; +} + +static void gdi_gfx_viewport_info(void *data, + struct video_viewport *vp) +{ + (void)data; + (void)vp; +} + +static bool gdi_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) +{ + (void)data; + (void)buffer; + + return true; +} + +static void gdi_set_texture_frame(void *data, + const void *frame, bool rgb32, unsigned width, unsigned height, + float alpha) +{ + unsigned pitch = width * 2; + + if (rgb32) + pitch = width * 4; + + if (gdi_menu_frame) + { + free(gdi_menu_frame); + gdi_menu_frame = NULL; + } + + if (!gdi_menu_frame || gdi_menu_width != width || gdi_menu_height != height || gdi_menu_pitch != pitch) + if (pitch && height) + gdi_menu_frame = (unsigned char*)malloc(pitch * height); + + if (gdi_menu_frame && frame && pitch && height) + { + memcpy(gdi_menu_frame, frame, pitch * height); + gdi_menu_width = width; + gdi_menu_height = height; + gdi_menu_pitch = pitch; + gdi_menu_bits = rgb32 ? 32 : 16; + } +} + +static void gdi_set_osd_msg(void *data, const char *msg, + const void *params, void *font) +{ + video_frame_info_t video_info; + video_driver_build_info(&video_info); + font_driver_render_msg(&video_info, font, msg, params); +} + +static void gdi_get_video_output_size(void *data, + unsigned *width, unsigned *height) +{ + gfx_ctx_size_t size_data; + size_data.width = width; + size_data.height = height; + video_context_driver_get_video_output_size(&size_data); +} + +static void gdi_get_video_output_prev(void *data) +{ + video_context_driver_get_video_output_prev(); +} + +static void gdi_get_video_output_next(void *data) +{ + video_context_driver_get_video_output_next(); +} + +static void gdi_set_video_mode(void *data, unsigned width, unsigned height, + bool fullscreen) +{ + gfx_ctx_mode_t mode; + + mode.width = width; + mode.height = height; + mode.fullscreen = fullscreen; + + video_context_driver_set_video_mode(&mode); +} + +static const video_poke_interface_t gdi_poke_interface = { + NULL, + NULL, + gdi_set_video_mode, + NULL, + gdi_get_video_output_size, + gdi_get_video_output_prev, + gdi_get_video_output_next, +#ifdef HAVE_FBO + NULL, +#else + NULL, +#endif + NULL, + NULL, + NULL, +#if defined(HAVE_MENU) + gdi_set_texture_frame, + NULL, + gdi_set_osd_msg, + NULL, +#else + NULL, + NULL, + NULL, + NULL, +#endif + + NULL, +#ifdef HAVE_MENU + NULL, +#endif +}; + +static void gdi_gfx_get_poke_interface(void *data, + const video_poke_interface_t **iface) +{ + (void)data; + *iface = &gdi_poke_interface; +} + +static void gdi_gfx_set_viewport(void *data, unsigned viewport_width, + unsigned viewport_height, bool force_full, bool allow_rotate) +{ +} + +bool gdi_has_menu_frame(void) +{ + return (gdi_menu_frame != NULL); +} + +video_driver_t video_gdi = { + gdi_gfx_init, + gdi_gfx_frame, + gdi_gfx_set_nonblock_state, + gdi_gfx_alive, + gdi_gfx_focus, + gdi_gfx_suppress_screensaver, + gdi_gfx_has_windowed, + gdi_gfx_set_shader, + gdi_gfx_free, + "gdi", + gdi_gfx_set_viewport, + gdi_gfx_set_rotation, + gdi_gfx_viewport_info, + gdi_gfx_read_viewport, + NULL, /* read_frame_raw */ + +#ifdef HAVE_OVERLAY + NULL, /* overlay_interface */ +#endif + gdi_gfx_get_poke_interface, +}; diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 160427cba2..31a3c97729 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -47,7 +47,6 @@ #include "../../performance_counters.h" #include "../../retroarch.h" -#include "../../runloop.h" #include "../../verbosity.h" #include "../common/gl_common.h" @@ -212,18 +211,18 @@ static void gl_overlay_tex_geom(void *data, tex[7] = y + h; } -static void gl_render_overlay(gl_t *gl) +static void gl_render_overlay(gl_t *gl, video_frame_info_t *video_info) { video_shader_ctx_mvp_t mvp; video_shader_ctx_coords_t coords; video_shader_ctx_info_t shader_info; - unsigned i, width, height; + unsigned i; + unsigned width = video_info->width; + unsigned height = video_info->height; if (!gl || !gl->overlay_enable) return; - video_driver_get_size(&width, &height); - glEnable(GL_BLEND); if (gl->overlay_full_screen) @@ -299,32 +298,30 @@ static void gl_set_viewport_wrapper(void *data, unsigned viewport_width, video_driver_build_info(&video_info); - gl_set_viewport(data, video_info, + gl_set_viewport(data, &video_info, viewport_width, viewport_height, force_full, allow_rotate); } -void gl_set_viewport(void *data, video_frame_info_t video_info, +void gl_set_viewport(void *data, video_frame_info_t *video_info, unsigned viewport_width, unsigned viewport_height, bool force_full, bool allow_rotate) { gfx_ctx_aspect_t aspect_data; - unsigned width, height; - int x = 0; - int y = 0; - float device_aspect = (float)viewport_width / viewport_height; + int x = 0; + int y = 0; + float device_aspect = (float)viewport_width / viewport_height; struct video_ortho ortho = {0, 1, 0, 1, -1, 1}; - gl_t *gl = (gl_t*)data; + gl_t *gl = (gl_t*)data; + unsigned height = video_info->height; - video_driver_get_size(&width, &height); - - aspect_data.aspect = &device_aspect; - aspect_data.width = viewport_width; - aspect_data.height = viewport_height; + aspect_data.aspect = &device_aspect; + aspect_data.width = viewport_width; + aspect_data.height = viewport_height; video_context_driver_translate_aspect(&aspect_data); - if (video_info.scale_integer && !force_full) + if (video_info->scale_integer && !force_full) { video_viewport_get_scaled_integer(&gl->vp, viewport_width, viewport_height, @@ -337,7 +334,7 @@ void gl_set_viewport(void *data, video_frame_info_t video_info, float desired_aspect = video_driver_get_aspect_ratio(); #if defined(HAVE_MENU) - if (video_info.aspect_ratio_idx == ASPECT_RATIO_CUSTOM) + if (video_info->aspect_ratio_idx == ASPECT_RATIO_CUSTOM) { const struct video_viewport *custom = video_viewport_get_custom(); @@ -685,7 +682,9 @@ static void gl_init_textures(gl_t *gl, const video_info_t *video) glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); } -static INLINE void gl_copy_frame(gl_t *gl, const void *frame, +static INLINE void gl_copy_frame(gl_t *gl, + video_frame_info_t *video_info, + const void *frame, unsigned width, unsigned height, unsigned pitch) { static struct retro_perf_counter copy_frame = {0}; @@ -739,13 +738,11 @@ static INLINE void gl_copy_frame(gl_t *gl, const void *frame, else #endif { - bool use_rgba = video_driver_supports_rgba(); - glPixelStorei(GL_UNPACK_ALIGNMENT, video_pixel_get_alignment(width * gl->base_size)); /* Fallback for GLES devices without GL_BGRA_EXT. */ - if (gl->base_size == 4 && use_rgba) + if (gl->base_size == 4 && video_info->use_rgba) { video_frame_convert_argb8888_to_abgr8888( &gl->scaler, @@ -959,9 +956,11 @@ static void gl_set_texture_enable(void *data, bool state, bool full_screen) } static void gl_set_osd_msg(void *data, const char *msg, - const struct font_params *params, void *font) + const void *params, void *font) { - font_driver_render_msg(font, msg, params); + video_frame_info_t video_info; + video_driver_build_info(&video_info); + font_driver_render_msg(&video_info, font, msg, params); } static void gl_show_mouse(void *data, bool state) @@ -1013,13 +1012,14 @@ static void gl_pbo_async_readback(gl_t *gl) } #endif -static INLINE void gl_draw_texture(gl_t *gl) +static INLINE void gl_draw_texture(gl_t *gl, video_frame_info_t *video_info) { video_shader_ctx_mvp_t mvp; video_shader_ctx_coords_t coords; video_shader_ctx_info_t shader_info; - unsigned width, height; GLfloat color[16]; + unsigned width = video_info->width; + unsigned height = video_info->height; color[ 0] = 1.0f; color[ 1] = 1.0f; @@ -1041,8 +1041,6 @@ static INLINE void gl_draw_texture(gl_t *gl) if (!gl->menu_texture) return; - video_driver_get_size(&width, &height); - gl->coords.vertex = vertexes_flipped; gl->coords.tex_coord = tex_coords; gl->coords.color = color; @@ -1090,16 +1088,18 @@ static bool gl_frame(void *data, const void *frame, unsigned frame_width, unsigned frame_height, uint64_t frame_count, unsigned pitch, const char *msg, - video_frame_info_t video_info) + video_frame_info_t *video_info) { video_shader_ctx_mvp_t mvp; video_shader_ctx_coords_t coords; video_shader_ctx_params_t params; - unsigned width, height; struct video_tex_info feedback_info; video_shader_ctx_info_t shader_info; - static struct retro_perf_counter frame_run = {0}; + static struct + retro_perf_counter frame_run = {0}; gl_t *gl = (gl_t*)data; + unsigned width = video_info->width; + unsigned height = video_info->height; performance_counter_init(&frame_run, "frame_run"); performance_counter_start(&frame_run); @@ -1107,8 +1107,6 @@ static bool gl_frame(void *data, const void *frame, if (!gl) return false; - video_driver_get_size(&width, &height); - context_bind_hw_render(false); #ifndef HAVE_OPENGLES @@ -1146,7 +1144,7 @@ static bool gl_frame(void *data, const void *frame, mode.width = width; mode.height = height; - video_context_driver_set_resize(&mode); + video_context_driver_set_resize(mode); #ifdef HAVE_FBO if (gl->fbo_inited) @@ -1168,14 +1166,14 @@ static bool gl_frame(void *data, const void *frame, glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); /* Can be NULL for frame dupe / NULL render. */ - if (frame) + if (frame) { #ifdef HAVE_FBO if (!gl->hw_render_fbo_init) #endif { gl_update_input_size(gl, frame_width, frame_height, pitch, true); - gl_copy_frame(gl, frame, frame_width, frame_height, pitch); + gl_copy_frame(gl, video_info, frame, frame_width, frame_height, pitch); } /* No point regenerating mipmaps @@ -1279,18 +1277,18 @@ static bool gl_frame(void *data, const void *frame, #if defined(HAVE_MENU) if (gl->menu_texture_enable) { - menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL); + menu_driver_frame(video_info); if (gl->menu_texture_enable) - gl_draw_texture(gl); + gl_draw_texture(gl, video_info); } #endif if (msg) - font_driver_render_msg(NULL, msg, NULL); + font_driver_render_msg(video_info, NULL, msg, NULL); #ifdef HAVE_OVERLAY - gl_render_overlay(gl); + gl_render_overlay(gl, video_info); #endif video_context_driver_update_window_title(video_info); @@ -1339,10 +1337,10 @@ static bool gl_frame(void *data, const void *frame, /* Disable BFI during fast forward, slow-motion, * and pause to prevent flicker. */ if ( - video_info.black_frame_insertion + video_info->black_frame_insertion && !input_driver_is_nonblock_state() - && !runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, NULL) - && !runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL)) + && !video_info->runloop_is_slowmotion + && !video_info->runloop_is_paused) { video_context_driver_swap_buffers(video_info); glClear(GL_COLOR_BUFFER_BIT); @@ -1351,7 +1349,7 @@ static bool gl_frame(void *data, const void *frame, video_context_driver_swap_buffers(video_info); #ifdef HAVE_GL_SYNC - if (video_info.hard_sync && gl->have_sync) + if (video_info->hard_sync && gl->have_sync) { static struct retro_perf_counter gl_fence = {0}; @@ -1361,7 +1359,7 @@ static bool gl_frame(void *data, const void *frame, gl->fences[gl->fence_count++] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); - while (gl->fence_count > video_info.hard_sync_frames) + while (gl->fence_count > video_info->hard_sync_frames) { glClientWaitSync(gl->fences[0], GL_SYNC_FLUSH_COMMANDS_BIT, 1000000000); @@ -2330,7 +2328,8 @@ static bool gl_set_shader(void *data, gl_set_shader_viewport(gl, 1); context_bind_hw_render(true); #if defined(_WIN32) && !defined(_XBOX) - shader_dlg_params_reload(); + /* Shader dialog is disabled for now, until video_threaded issues are fixed. + shader_dlg_params_reload();*/ #endif #endif @@ -2360,7 +2359,7 @@ static void gl_viewport_info(void *data, struct video_viewport *vp) vp->y = top_dist; } -static bool gl_read_viewport(void *data, uint8_t *buffer) +static bool gl_read_viewport(void *data, uint8_t *buffer, bool is_idle) { #ifndef NO_GL_READ_PIXELS static struct retro_perf_counter read_viewport = {0}; @@ -2443,7 +2442,7 @@ static bool gl_read_viewport(void *data, uint8_t *buffer) goto error; } - if (!runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL)) + if (!is_idle) video_driver_cached_frame(); video_frame_convert_rgba_to_bgr( diff --git a/gfx/drivers/gl_renderchains/render_chain_gl.h b/gfx/drivers/gl_renderchains/render_chain_gl.h index 24886dec0b..1cced1e409 100644 --- a/gfx/drivers/gl_renderchains/render_chain_gl.h +++ b/gfx/drivers/gl_renderchains/render_chain_gl.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -49,14 +49,14 @@ void gl_load_texture_data( const void *frame, unsigned base_size); void gl_renderchain_render(gl_t *gl, - video_frame_info_t video_info, + video_frame_info_t *video_info, uint64_t frame_count, const struct video_tex_info *tex_info, const struct video_tex_info *feedback_info); void gl_renderchain_init(gl_t *gl, unsigned fbo_width, unsigned fbo_height); -void gl_set_viewport(void *data, video_frame_info_t video_info, +void gl_set_viewport(void *data, video_frame_info_t *video_info, unsigned viewport_width, unsigned viewport_height, bool force_full, bool allow_rotate); @@ -70,7 +70,7 @@ void gl_renderchain_recompute_pass_sizes(gl_t *gl, unsigned width, unsigned height, unsigned vp_width, unsigned vp_height); -void gl_renderchain_start_render(gl_t *gl, video_frame_info_t video_info); +void gl_renderchain_start_render(gl_t *gl, video_frame_info_t *video_info); void gl_check_fbo_dimensions(gl_t *gl); diff --git a/gfx/drivers/gl_renderchains/render_chain_gl_legacy.c b/gfx/drivers/gl_renderchains/render_chain_gl_legacy.c index 55d687d812..a09dfdd9f3 100644 --- a/gfx/drivers/gl_renderchains/render_chain_gl_legacy.c +++ b/gfx/drivers/gl_renderchains/render_chain_gl_legacy.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -239,7 +239,7 @@ void gl_check_fbo_dimensions(gl_t *gl) } } void gl_renderchain_render(gl_t *gl, - video_frame_info_t video_info, + video_frame_info_t *video_info, uint64_t frame_count, const struct video_tex_info *tex_info, const struct video_tex_info *feedback_info) @@ -249,7 +249,6 @@ void gl_renderchain_render(gl_t *gl, video_shader_ctx_coords_t coords; video_shader_ctx_params_t params; video_shader_ctx_info_t shader_info; - unsigned width, height; const struct video_fbo_rect *prev_rect; struct video_tex_info *fbo_info; struct video_tex_info fbo_tex_info[GFX_MAX_SHADERS]; @@ -257,8 +256,8 @@ void gl_renderchain_render(gl_t *gl, GLfloat xamt, yamt; unsigned fbo_tex_info_cnt = 0; GLfloat fbo_tex_coords[8] = {0.0f}; - - video_driver_get_size(&width, &height); + unsigned width = video_info->width; + unsigned height = video_info->height; /* Render the rest of our passes. */ gl->coords.tex_coord = fbo_tex_coords; @@ -667,7 +666,7 @@ void gl_renderchain_recompute_pass_sizes(gl_t *gl, } } -void gl_renderchain_start_render(gl_t *gl, video_frame_info_t video_info) +void gl_renderchain_start_render(gl_t *gl, video_frame_info_t *video_info) { glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); glBindFramebuffer(RARCH_GL_FRAMEBUFFER, gl->fbo[0]); diff --git a/gfx/drivers/gl_shaders/pipeline_bokeh.glsl.frag.h b/gfx/drivers/gl_shaders/pipeline_bokeh.glsl.frag.h index 9a4e027e0e..4bba0f339c 100644 --- a/gfx/drivers/gl_shaders/pipeline_bokeh.glsl.frag.h +++ b/gfx/drivers/gl_shaders/pipeline_bokeh.glsl.frag.h @@ -6,7 +6,7 @@ static const char* stock_fragment_xmb_bokeh = GLSL( void main(void) { - float tim = time * 2.4; + float speed = time * 4.0; vec2 uv = -1.0 + 2.0 * gl_FragCoord.xy / OutputSize.xy; uv.x *= OutputSize.x / OutputSize.y; vec3 color = vec3(0.0); @@ -17,11 +17,11 @@ static const char* stock_fragment_xmb_bokeh = GLSL( float siz = pow(sin(float(i) * 651.74 + 5.0) * 0.5 + 0.5, 4.0); float pox = sin(float(i) * 321.55 + 4.1) * OutputSize.x / OutputSize.y; float rad = 0.1 + 0.5 * siz + sin(pha + siz) / 4.0; - vec2 pos = vec2(pox + sin(time / 15. + pha + siz), - 1.0 - rad + (2.0 + 2.0 * rad) * fract(pha + 0.3 * (time / 7.) * (0.2 + 0.8 * siz))); + vec2 pos = vec2(pox + sin(speed / 15. + pha + siz), - 1.0 - rad + (2.0 + 2.0 * rad) * fract(pha + 0.3 * (speed / 7.) * (0.2 + 0.8 * siz))); float dis = length(uv - pos); if(dis < rad) { - vec3 col = mix(vec3(0.194 * sin(time / 6.0) + 0.3, 0.2, 0.3 * pha), vec3(1.1 * sin(time / 9.0) + 0.3, 0.2 * pha, 0.4), 0.5 + 0.5 * sin(float(i))); + vec3 col = mix(vec3(0.194 * sin(speed / 6.0) + 0.3, 0.2, 0.3 * pha), vec3(1.1 * sin(speed / 9.0) + 0.3, 0.2 * pha, 0.4), 0.5 + 0.5 * sin(float(i))); color += col.zyx * (1.0 - smoothstep(rad * 0.15, rad, dis)); } } diff --git a/gfx/drivers/gl_symlinks.h b/gfx/drivers/gl_symlinks.h index 97ab6910bf..3af2df78c4 100644 --- a/gfx/drivers/gl_symlinks.h +++ b/gfx/drivers/gl_symlinks.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/gfx/drivers/gx_gfx.c b/gfx/drivers/gx_gfx.c index d2ed4cb640..fc0b9f6012 100644 --- a/gfx/drivers/gx_gfx.c +++ b/gfx/drivers/gx_gfx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -27,17 +27,21 @@ #include "../../config.h" #endif +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#include "../../menu/menu_display.h" +#endif + #ifdef HW_RVL #include "../../memory/wii/mem2_manager.h" #endif +#include "../font_driver.h" + #include "../drivers_font_renderer/bitmap.h" #include "../../defines/gx_defines.h" #include "../../configuration.h" #include "../../driver.h" -#include "../../runloop.h" -#include "../../menu/menu_driver.h" -#include "../../menu/menu_display.h" extern syssram* __SYS_LockSram(void); extern u32 __SYS_UnlockSram(u32 write); @@ -1175,7 +1179,7 @@ static void gx_viewport_info(void *data, struct video_viewport *vp) *vp = gx->vp; } -static bool gx_read_viewport(void *data, uint8_t *buffer) +static bool gx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; @@ -1438,15 +1442,14 @@ static bool gx_frame(void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, unsigned pitch, const char *msg, - video_frame_info_t video_info) + video_frame_info_t *video_info) { - char fps_txt[128]; char fps_text_buf[128]; static struct retro_perf_counter gx_frame = {0}; gx_video_t *gx = (gx_video_t*)data; u8 clear_efb = GX_FALSE; - fps_txt[0] = fps_text_buf[0] = '\0'; + fps_text_buf[0] = '\0'; performance_counter_init(&gx_frame, "gx_frame"); performance_counter_start(&gx_frame); @@ -1500,12 +1503,9 @@ static bool gx_frame(void *data, const void *frame, if (gx->menu_texture_enable && gx->menu_data) { - size_t fb_pitch; - unsigned fb_width, fb_height; - - fb_width = menu_display_get_width(); - fb_height = menu_display_get_height(); - fb_pitch = menu_display_get_framebuffer_pitch(); + unsigned fb_width = menu_display_get_width(); + unsigned fb_height = menu_display_get_height(); + size_t fb_pitch = menu_display_get_framebuffer_pitch(); convert_texture16( gx->menu_data, @@ -1518,6 +1518,10 @@ static bool gx_frame(void *data, const void *frame, fb_width * fb_pitch); } +#ifdef HAVE_MENU + menu_driver_frame(video_info); +#endif + GX_InvalidateTexAll(); GX_SetCurrentMtx(GX_PNMTX0); @@ -1538,10 +1542,7 @@ static bool gx_frame(void *data, const void *frame, GX_DrawDone(); - video_monitor_get_fps(video_info, fps_txt, sizeof(fps_txt), - fps_text_buf, sizeof(fps_text_buf)); - - if (video_info.fps_show) + if (video_info->fps_show) { char mem1_txt[128]; char mem2_txt[128]; diff --git a/gfx/drivers/nullgfx.c b/gfx/drivers/nullgfx.c index 2a9adebf50..b3d66d428b 100644 --- a/gfx/drivers/nullgfx.c +++ b/gfx/drivers/nullgfx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -14,8 +14,9 @@ * If not, see . */ +#include "../video_driver.h" + #include "../../driver.h" -#include "../../configuration.h" #include "../../verbosity.h" static void *null_gfx_init(const video_info_t *video, @@ -32,7 +33,7 @@ static void *null_gfx_init(const video_info_t *video, static bool null_gfx_frame(void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, - unsigned pitch, const char *msg, video_frame_info_t video_info) + unsigned pitch, const char *msg, video_frame_info_t *video_info) { (void)data; (void)frame; @@ -104,7 +105,7 @@ static void null_gfx_viewport_info(void *data, (void)vp; } -static bool null_gfx_read_viewport(void *data, uint8_t *buffer) +static bool null_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/omap_gfx.c b/gfx/drivers/omap_gfx.c index af46ff7687..f9b6679357 100644 --- a/gfx/drivers/omap_gfx.c +++ b/gfx/drivers/omap_gfx.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2013-2014 - Tobias Jakobi * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -25,12 +26,16 @@ #include #include +#include +#include + #ifdef HAVE_CONFIG_H #include "../../config.h" #endif -#include -#include +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif #include #include @@ -38,15 +43,14 @@ #include #include +#include "../font_driver.h" + #include "../../configuration.h" #include "../../driver.h" #include "../../retroarch.h" -#include "../../runloop.h" #include "../video_context_driver.h" -#include "../font_driver.h" - typedef struct omapfb_page { unsigned yoffset; @@ -985,7 +989,7 @@ fail: static bool omap_gfx_frame(void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, unsigned pitch, const char *msg, - video_frame_info_t video_info) + video_frame_info_t *video_info) { omap_video_t *vid = (omap_video_t*)data; @@ -1008,10 +1012,16 @@ static bool omap_gfx_frame(void *data, const void *frame, unsigned width, omapfb_prepare(vid->omap); omapfb_blit_frame(vid->omap, frame, vid->height, pitch); + +#ifdef HAVE_MENU + menu_driver_frame(video_info); +#endif + if (vid->menu.active) omapfb_blit_frame(vid->omap, vid->menu.frame, vid->menu.scaler.out_height, vid->menu.scaler.out_stride); + if (msg) omap_render_msg(vid, msg); @@ -1086,7 +1096,7 @@ static void omap_gfx_set_rotation(void *data, unsigned rotation) (void)rotation; } -static bool omap_gfx_read_viewport(void *data, uint8_t *buffer) +static bool omap_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/psp1_gfx.c b/gfx/drivers/psp1_gfx.c index 47887c0d05..49f28e5330 100644 --- a/gfx/drivers/psp1_gfx.c +++ b/gfx/drivers/psp1_gfx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2015 - Ali Bouhlel - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2014-2017 - Ali Bouhlel + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -28,8 +28,13 @@ #include "../../config.h" #endif +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + +#include "../font_driver.h" + #include "../../defines/psp_defines.h" -#include "../../runloop.h" #ifndef SCEGU_SCR_WIDTH #define SCEGU_SCR_WIDTH 480 @@ -467,7 +472,7 @@ static void *psp_init(const video_info_t *video, static bool psp_frame(void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, - unsigned pitch, const char *msg, video_frame_info_t video_info) + unsigned pitch, const char *msg, video_frame_info_t *video_info) { #ifdef DISPLAY_FPS uint32_t diff; @@ -476,8 +481,6 @@ static bool psp_frame(void *data, const void *frame, static float fps = 0.0; #endif static struct retro_perf_counter psp_frame_run = {0}; - static char fps_txt[128] = {0}; - static char fps_text_buf[128] = {0}; psp1_video_t *psp = (psp1_video_t*)data; if (!width || !height) @@ -495,14 +498,10 @@ static bool psp_frame(void *data, const void *frame, pspDebugScreenSetXY(0,0); - video_monitor_get_fps(video_info, fps_txt, sizeof(fps_txt), - video_info.fps_show ? fps_text_buf : NULL, - video_info.fps_show ? sizeof(fps_text_buf) : 0); - - if (video_info.fps_show) + if (video_info->fps_show) { - pspDebugScreenSetXY(68 - strlen(fps_text_buf) - 1,0); - pspDebugScreenPuts(fps_text_buf); + pspDebugScreenSetXY(68 - strlen(video_info->fps_text) - 1,0); + pspDebugScreenPuts(video_info->fps_text); pspDebugScreenSetXY(0,1); } @@ -567,6 +566,10 @@ static bool psp_frame(void *data, const void *frame, performance_counter_stop(&psp_frame_run); +#ifdef HAVE_MENU + menu_driver_frame(video_info); +#endif + if(psp->menu.active) { sceGuSendList(GU_TAIL, psp->menu.dList, &(psp->menu.context_storage)); @@ -867,7 +870,7 @@ static void psp_get_poke_interface(void *data, *iface = &psp_poke_interface; } -static bool psp_read_viewport(void *data, uint8_t *buffer) +static bool psp_read_viewport(void *data, uint8_t *buffer, bool is_idle) { void* src_buffer; int i, j, src_bufferwidth, src_pixelformat, src_x, src_y, src_x_max, src_y_max; diff --git a/gfx/drivers/psp1_gfx.h b/gfx/drivers/psp1_gfx.h index 9fb02e512f..4d2021379c 100644 --- a/gfx/drivers/psp1_gfx.h +++ b/gfx/drivers/psp1_gfx.h @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2014-2017 - Ali Bouhlel + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers/sdl2_gfx.c b/gfx/drivers/sdl2_gfx.c index 6d216d8986..222c74d976 100644 --- a/gfx/drivers/sdl2_gfx.c +++ b/gfx/drivers/sdl2_gfx.c @@ -1,6 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2015 - Higor Euripedes + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2011-2017 - Higor Euripedes * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -35,13 +36,13 @@ #include "SDL.h" #include "SDL_syswm.h" +#include "../font_driver.h" + #include "../../configuration.h" #include "../../retroarch.h" -#include "../../runloop.h" #include "../../performance_counters.h" #include "../../verbosity.h" #include "../video_context_driver.h" -#include "../font_driver.h" typedef struct sdl2_tex { @@ -498,17 +499,15 @@ static void check_window(sdl2_video_t *vid) static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, - unsigned pitch, const char *msg, video_frame_info_t video_info) + unsigned pitch, const char *msg, video_frame_info_t *video_info) { - char buf[128]; sdl2_video_t *vid = (sdl2_video_t*)data; - - buf[0] = '\0'; + char title[128]; if (vid->should_resize) sdl_refresh_viewport(vid); - if (frame) + if (frame && video_info->libretro_running) { static struct retro_perf_counter sdl_copy_frame = {0}; @@ -525,7 +524,7 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width, SDL_RenderCopyEx(vid->renderer, vid->frame.tex, NULL, NULL, vid->rotation, NULL, SDL_FLIP_NONE); #ifdef HAVE_MENU - menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL); + menu_driver_frame(video_info); #endif if (vid->menu.active) @@ -536,8 +535,12 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width, SDL_RenderPresent(vid->renderer); - if (video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0)) - SDL_SetWindowTitle(vid->window, buf); + title[0] = '\0'; + + video_driver_get_window_title(title, sizeof(title)); + + if (title[0]) + SDL_SetWindowTitle(vid->window, title); return true; } @@ -623,7 +626,7 @@ static void sdl2_gfx_viewport_info(void *data, struct video_viewport *vp) *vp = vid->vp; } -static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer) +static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { SDL_Surface *surf = NULL, *bgr24 = NULL; sdl2_video_t *vid = (sdl2_video_t*)data; @@ -632,7 +635,7 @@ static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer) performance_counter_init(&sdl2_gfx_read_viewport, "sdl2_gfx_read_viewport"); performance_counter_start(&sdl2_gfx_read_viewport); - if (!runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL)) + if (!is_idle) video_driver_cached_frame(); surf = SDL_GetWindowSurface(vid->window); @@ -723,7 +726,7 @@ static void sdl2_poke_texture_enable(void *data, bool enable, bool full_screen) } static void sdl2_poke_set_osd_msg(void *data, const char *msg, - const struct font_params *params, void *font) + const void *params, void *font) { sdl2_video_t *vid = (sdl2_video_t*)data; sdl2_render_msg(vid, msg); diff --git a/gfx/drivers/sdl_gfx.c b/gfx/drivers/sdl_gfx.c index 45bdf8f1d6..805c15a4e5 100644 --- a/gfx/drivers/sdl_gfx.c +++ b/gfx/drivers/sdl_gfx.c @@ -1,6 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2015 - Higor Euripedes + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2011-2017 - Higor Euripedes * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -27,6 +28,10 @@ #include "../../config.h" #endif +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + #ifdef HAVE_X11 #include "../common/x11_common.h" #endif @@ -34,12 +39,13 @@ #include "SDL.h" #include "SDL_syswm.h" +#include "../font_driver.h" +#include "../video_driver.h" + #include "../../configuration.h" -#include "../../runloop.h" #include "../../performance_counters.h" #include "../video_context_driver.h" -#include "../font_driver.h" typedef struct sdl_menu_frame { @@ -331,16 +337,18 @@ static void sdl_gfx_check_window(sdl_video_t *vid) static bool sdl_gfx_frame(void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, - unsigned pitch, const char *msg, video_frame_info_t video_info) + unsigned pitch, const char *msg, video_frame_info_t *video_info) { - char buf[128]; static struct retro_perf_counter sdl_scale = {0}; sdl_video_t *vid = (sdl_video_t*)data; + char title[128]; if (!frame) return true; - buf[0] = '\0'; + title[0] = '\0'; + + video_driver_get_window_title(title, sizeof(title)); if (SDL_MUSTLOCK(vid->screen)) SDL_LockSurface(vid->screen); @@ -361,6 +369,10 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width, pitch); performance_counter_stop(&sdl_scale); +#ifdef HAVE_MENU + menu_driver_frame(video_info); +#endif + if (vid->menu.active) SDL_BlitSurface(vid->menu.frame, NULL, vid->screen, NULL); @@ -370,8 +382,8 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width, if (SDL_MUSTLOCK(vid->screen)) SDL_UnlockSurface(vid->screen); - if (video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0)) - SDL_WM_SetCaption(buf, NULL); + if (title[0]) + SDL_WM_SetCaption(title, NULL); SDL_Flip(vid->screen); @@ -563,7 +575,7 @@ static void sdl_gfx_set_rotation(void *data, unsigned rotation) (void)rotation; } -static bool sdl_gfx_read_viewport(void *data, uint8_t *buffer) +static bool sdl_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/sunxi_gfx.c b/gfx/drivers/sunxi_gfx.c index 7b426e484a..0d6e4d5a61 100644 --- a/gfx/drivers/sunxi_gfx.c +++ b/gfx/drivers/sunxi_gfx.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2015 - Manuel Alfayate + * Copyright (C) 2015-2017 - Manuel Alfayate + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -28,10 +29,14 @@ #include "../../config.h" #endif -#include "../../retroarch.h" -#include "../../runloop.h" +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + #include "../font_driver.h" +#include "../../retroarch.h" + #define NUMPAGES 2 /* Lowlevel SunxiG2D functions block */ @@ -763,7 +768,7 @@ static void sunxi_setup_scale (void *data, static bool sunxi_gfx_frame(void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, unsigned pitch, const char *msg, - video_frame_info_t video_info) + video_frame_info_t *video_info) { struct sunxi_video *_dispvars = (struct sunxi_video*)data; @@ -779,13 +784,12 @@ static bool sunxi_gfx_frame(void *data, const void *frame, unsigned width, sunxi_setup_scale(_dispvars, width, height, pitch); } +#ifdef HAVE_MENU + menu_driver_frame(video_info); +#endif + if (_dispvars->menu_active) { - char buf[128]; - - buf[0] = '\0'; - - video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0); ioctl(_dispvars->sunxi_disp->fd_fb, FBIO_WAITFORVSYNC, 0); return true; } @@ -923,9 +927,11 @@ static void sunxi_set_texture_frame(void *data, const void *frame, bool rgb32, static void sunxi_set_aspect_ratio (void *data, unsigned aspect_ratio_idx) { struct sunxi_video *_dispvars = (struct sunxi_video*)data; - /* Here we obtain the new aspect ratio. */ - float new_aspect = aspectratio_lut[aspect_ratio_idx].value; - if (new_aspect != _dispvars->aspect_ratio) { + float new_aspect = aspectratio_lut[aspect_ratio_idx].value; + + if (new_aspect != _dispvars->aspect_ratio) + { + /* Here we set the new aspect ratio. */ _dispvars->aspect_ratio = new_aspect; sunxi_setup_scale(_dispvars, _dispvars->src_width, _dispvars->src_height, _dispvars->src_pitch); } diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index 91451518d1..6608c5da88 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -31,14 +32,17 @@ #include "../../config.h" #endif +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + +#include "../font_driver.h" #include "../video_context_driver.h" + #include "../../retroarch.h" -#include "../../runloop.h" #include "../../driver.h" #include "../../performance_counters.h" -#include "../font_driver.h" #include "../../content.h" -#include "../../runloop.h" #include "../../verbosity.h" #include "../../configuration.h" @@ -281,10 +285,10 @@ static void vg_free(void *data) free(vg); } -static void vg_calculate_quad(vg_t *vg) +static void vg_calculate_quad(vg_t *vg, video_frame_info_t *video_info) { - unsigned width, height; - video_driver_get_size(&width, &height); + unsigned width = video_info->width; + unsigned height = video_info->height; /* set viewport for aspect ratio, taken from the OpenGL driver. */ if (vg->keep_aspect) @@ -378,25 +382,24 @@ static void vg_copy_frame(void *data, const void *frame, static bool vg_frame(void *data, const void *frame, unsigned frame_width, unsigned frame_height, uint64_t frame_count, unsigned pitch, const char *msg, - video_frame_info_t video_info) + video_frame_info_t *video_info) { - unsigned width, height; vg_t *vg = (vg_t*)data; static struct retro_perf_counter vg_fr = {0}; static struct retro_perf_counter vg_image = {0}; + unsigned width = video_info->width; + unsigned height = video_info->height; performance_counter_init(&vg_fr, "vg_fr"); performance_counter_start(&vg_fr); - video_driver_get_size(&width, &height); - if ( frame_width != vg->mRenderWidth || frame_height != vg->mRenderHeight || vg->should_resize) { vg->mRenderWidth = frame_width; vg->mRenderHeight = frame_height; - vg_calculate_quad(vg); + vg_calculate_quad(vg, video_info); matrix_3x3_quad_to_quad( vg->x1, vg->y1, vg->x2, vg->y1, vg->x2, vg->y2, vg->x1, vg->y2, /* needs to be flipped, Khronos loves their bottom-left origin */ @@ -417,6 +420,10 @@ static bool vg_frame(void *data, const void *frame, vg_copy_frame(vg, frame, frame_width, frame_height, pitch); performance_counter_stop(&vg_image); +#ifdef HAVE_MENU + menu_driver_frame(video_info); +#endif + vgDrawImage(vg->mImage); #if 0 @@ -493,7 +500,7 @@ static void vg_viewport_info(void *data, (void)vp; } -static bool vg_read_viewport(void *data, uint8_t *buffer) +static bool vg_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/vga_gfx.c b/gfx/drivers/vga_gfx.c new file mode 100644 index 0000000000..edcc496410 --- /dev/null +++ b/gfx/drivers/vga_gfx.c @@ -0,0 +1,415 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2016 - Brad Parker + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include +#include +#include + +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + +#include "../common/vga_common.h" + +#include "../font_driver.h" + +#include "../../driver.h" +#include "../../verbosity.h" + +static unsigned char *vga_menu_frame = NULL; +static unsigned vga_menu_width = 0; +static unsigned vga_menu_height = 0; +static unsigned vga_menu_pitch = 0; +static unsigned vga_menu_bits = 0; +static unsigned vga_video_width = 0; +static unsigned vga_video_height = 0; +static unsigned vga_video_pitch = 0; +static unsigned vga_video_bits = 0; +static bool vga_rgb32 = false; + +static void vga_set_mode_13h() +{ + __dpmi_regs r; + + r.x.ax = 0x13; + __dpmi_int(0x10, &r); +} + +static void vga_return_to_text_mode() +{ + __dpmi_regs r; + + r.x.ax = 3; + __dpmi_int(0x10, &r); +} + +static void vga_upload_palette() +{ + unsigned i; + unsigned char r = 0; + unsigned char g = 0; + unsigned char b = 0; + + outp(0x03c8, 0); + + /* RGB332 */ + for (i = 0; i < 256; i++) + { + if (i > 0 && i % 64 == 0) + { + r = 0; + g = 0; + b++; + } + else if (i > 0 && i % 8 == 0) + { + r = 0; + g++; + } + + outp(0x03c9, r * (63.0f / 7.0f)); + outp(0x03c9, g * (63.0f / 7.0f)); + outp(0x03c9, b * (63.0f / 3.0f)); + + r++; + } +} + +static void vga_vsync() +{ + /* wait until any previous retrace has ended */ + do + { + } + while (inportb(0x3da) & 8); + + /* wait until a new retrace has just begun */ + do + { + } + while (!(inportb(0x3da) & 8)); +} + +static void vga_gfx_create(void) +{ + vga_set_mode_13h(); + vga_upload_palette(); +} + +static void *vga_gfx_init(const video_info_t *video, + const input_driver_t **input, void **input_data) +{ + vga_t *vga = (vga_t*)calloc(1, sizeof(*vga)); + + *input = NULL; + *input_data = NULL; + + vga_video_width = video->width; + vga_video_height = video->height; + vga_rgb32 = video->rgb32; + + if (video->rgb32) + vga_video_pitch = video->width * 4; + else + vga_video_pitch = video->width * 2; + + vga_gfx_create(); + + if (video->font_enable) + font_driver_init_osd(NULL, false, FONT_DRIVER_RENDER_VGA); + + return vga; +} + +static bool vga_gfx_frame(void *data, const void *frame, + unsigned frame_width, unsigned frame_height, uint64_t frame_count, + unsigned pitch, const char *msg, video_frame_info_t *video_info) +{ + size_t len = 0; + void *buffer = NULL; + unsigned width, height, bits; + const void *frame_to_copy = frame; + bool draw = true; + + (void)data; + (void)frame; + (void)frame_width; + (void)frame_height; + (void)pitch; + (void)msg; + (void)bits; + + if (!frame || !frame_width || !frame_height) + return true; + +#ifdef HAVE_MENU + menu_driver_frame(video_info); +#endif + + if ( vga_video_width != frame_width || + vga_video_height != frame_height || + vga_video_pitch != pitch) + { + if (frame_width > 4 && frame_height > 4) + { + vga_video_width = frame_width; + vga_video_height = frame_height; + vga_video_pitch = pitch; + } + } + + if (vga_menu_frame && video_info->menu_is_alive) + { + frame_to_copy = vga_menu_frame; + width = vga_menu_width; + height = vga_menu_height; + pitch = vga_menu_pitch; + bits = vga_menu_bits; + } + else + { + width = vga_video_width; + height = vga_video_height; + pitch = vga_video_pitch; + + if (frame_width == 4 && frame_height == 4 && (frame_width < width && frame_height < height)) + draw = false; + + if (video_info->menu_is_alive) + draw = false; + } + + if (draw) + { + vga_vsync(); + dosmemput(frame_to_copy, MIN(320,width)*MIN(200,height), 0xA0000); + } + + if (msg) + font_driver_render_msg(video_info, NULL, msg, NULL); + + video_context_driver_update_window_title(video_info); + + return true; +} + +static void vga_gfx_set_nonblock_state(void *data, bool toggle) +{ + (void)data; + (void)toggle; +} + +static bool vga_gfx_alive(void *data) +{ + (void)data; + video_driver_set_size(&vga_video_width, &vga_video_height); + return true; +} + +static bool vga_gfx_focus(void *data) +{ + (void)data; + return true; +} + +static bool vga_gfx_suppress_screensaver(void *data, bool enable) +{ + (void)data; + (void)enable; + return false; +} + +static bool vga_gfx_has_windowed(void *data) +{ + (void)data; + return true; +} + +static void vga_gfx_free(void *data) +{ + (void)data; + + if (vga_menu_frame) + { + free(vga_menu_frame); + vga_menu_frame = NULL; + } + + vga_return_to_text_mode(); +} + +static bool vga_gfx_set_shader(void *data, + enum rarch_shader_type type, const char *path) +{ + (void)data; + (void)type; + (void)path; + + return false; +} + +static void vga_gfx_set_rotation(void *data, + unsigned rotation) +{ + (void)data; + (void)rotation; +} + +static void vga_gfx_viewport_info(void *data, + struct video_viewport *vp) +{ + (void)data; + (void)vp; +} + +static bool vga_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) +{ + (void)data; + (void)buffer; + + return true; +} + +static void vga_set_texture_frame(void *data, + const void *frame, bool rgb32, unsigned width, unsigned height, + float alpha) +{ + unsigned pitch = width * 2; + + if (rgb32) + pitch = width * 4; + + if (vga_menu_frame) + { + free(vga_menu_frame); + vga_menu_frame = NULL; + } + + if ( !vga_menu_frame || + vga_menu_width != width || + vga_menu_height != height || + vga_menu_pitch != pitch) + if (pitch && height) + vga_menu_frame = (unsigned char*)malloc(VGA_WIDTH * VGA_HEIGHT); + + if (vga_menu_frame && frame && pitch && height) + { + unsigned x, y; + + if (rgb32) + { + } + else + { + unsigned short *video_frame = (unsigned short*)frame; + + for(y = 0; y < VGA_HEIGHT; y++) + { + for(x = 0; x < VGA_WIDTH; x++) + { + unsigned short pixel = video_frame[width * y + x]; + unsigned r = (7.0f / 15.0f) * ((pixel & 0xF0) >> 4); + unsigned g = (7.0f / 15.0f) * ((pixel & 0xF00) >> 8); + unsigned b = (3.0f / 15.0f) * ((pixel & 0xF000) >> 12); + vga_menu_frame[VGA_WIDTH * y + x] = (b << 6) | (g << 3) | r; + } + } + } + + vga_menu_width = width; + vga_menu_height = height; + vga_menu_pitch = pitch; + vga_menu_bits = rgb32 ? 32 : 16; + } +} + +static void vga_set_osd_msg(void *data, const char *msg, + const void *params, void *font) +{ + video_frame_info_t video_info; + video_driver_build_info(&video_info); + font_driver_render_msg(&video_info, font, msg, params); +} + +static const video_poke_interface_t vga_poke_interface = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, +#ifdef HAVE_FBO + NULL, +#else + NULL, +#endif + NULL, + NULL, + NULL, +#if defined(HAVE_MENU) + vga_set_texture_frame, + NULL, + vga_set_osd_msg, + NULL, +#else + NULL, + NULL, + NULL, + NULL, +#endif + + NULL, +#ifdef HAVE_MENU + NULL, +#endif +}; + +static void vga_gfx_get_poke_interface(void *data, + const video_poke_interface_t **iface) +{ + (void)data; + *iface = &vga_poke_interface; +} + +void vga_gfx_set_viewport(void *data, unsigned viewport_width, + unsigned viewport_height, bool force_full, bool allow_rotate) +{ +} + +video_driver_t video_vga = { + vga_gfx_init, + vga_gfx_frame, + vga_gfx_set_nonblock_state, + vga_gfx_alive, + vga_gfx_focus, + vga_gfx_suppress_screensaver, + vga_gfx_has_windowed, + vga_gfx_set_shader, + vga_gfx_free, + "vga", + vga_gfx_set_viewport, + vga_gfx_set_rotation, + vga_gfx_viewport_info, + vga_gfx_read_viewport, + NULL, /* read_frame_raw */ + +#ifdef HAVE_OVERLAY + NULL, /* overlay_interface */ +#endif + vga_gfx_get_poke_interface, +}; diff --git a/gfx/drivers/vita2d_gfx.c b/gfx/drivers/vita2d_gfx.c index d647b542ce..07ba4550c5 100644 --- a/gfx/drivers/vita2d_gfx.c +++ b/gfx/drivers/vita2d_gfx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2015-2016 - Sergi Granell (xerpi) - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2015-2017 - Sergi Granell (xerpi) + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -18,6 +18,7 @@ #include #include +#include #ifdef HAVE_CONFIG_H #include "../../config.h" @@ -27,11 +28,16 @@ #include "../../menu/menu_driver.h" #endif -#include "../../defines/psp_defines.h" +#include "../font_driver.h" + #include "../common/vita2d_common.h" #include "../../driver.h" -#include "../../runloop.h" #include "../video_coord_array.h" +#include "../video_context_driver.h" +#include "../../verbosity.h" +#include "../../configuration.h" + +#include "../../defines/psp_defines.h" extern void *memcpy_neon(void *dst, const void *src, size_t n); @@ -127,54 +133,55 @@ static void vita2d_gfx_update_viewport(vita_video_t* vita); static bool vita2d_gfx_frame(void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, - unsigned pitch, const char *msg, video_frame_info_t video_info) + unsigned pitch, const char *msg, video_frame_info_t *video_info) { void *tex_p; vita_video_t *vita = (vita_video_t *)data; - + if (frame) { - if(!(vita->texture&&vita2d_texture_get_datap(vita->texture)==frame)){ - unsigned i; - unsigned int stride; + if(!(vita->texture&&vita2d_texture_get_datap(vita->texture)==frame)) + { + unsigned i; + unsigned int stride; - if ((width != vita->width || height != vita->height) && vita->texture) - { - vita2d_free_texture(vita->texture); - vita->texture = NULL; - } + if ((width != vita->width || height != vita->height) && vita->texture) + { + vita2d_free_texture(vita->texture); + vita->texture = NULL; + } - if (!vita->texture) - { - RARCH_LOG("Creating texture: %ix%i\n", width, height); - vita->width = width; - vita->height = height; - vita->texture = vita2d_create_empty_texture_format(width, height, vita->format); - vita2d_texture_set_filters(vita->texture,vita->tex_filter,vita->tex_filter); - } - tex_p = vita2d_texture_get_datap(vita->texture); - stride = vita2d_texture_get_stride(vita->texture); + if (!vita->texture) + { + RARCH_LOG("Creating texture: %ix%i\n", width, height); + vita->width = width; + vita->height = height; + vita->texture = vita2d_create_empty_texture_format(width, height, vita->format); + vita2d_texture_set_filters(vita->texture,vita->tex_filter,vita->tex_filter); + } + tex_p = vita2d_texture_get_datap(vita->texture); + stride = vita2d_texture_get_stride(vita->texture); - if (vita->format == SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1RGB) - { - stride /= 4; - pitch /= 4; - uint32_t *tex32 = tex_p; - const uint32_t *frame32 = frame; + if (vita->format == SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1RGB) + { + stride /= 4; + pitch /= 4; + uint32_t *tex32 = tex_p; + const uint32_t *frame32 = frame; - for (i = 0; i < height; i++) - memcpy_neon(&tex32[i*stride],&frame32[i*pitch],pitch*sizeof(uint32_t)); - } - else - { - stride /= 2; - pitch /= 2; - uint16_t *tex16 = tex_p; - const uint16_t *frame16 = frame; + for (i = 0; i < height; i++) + memcpy_neon(&tex32[i*stride],&frame32[i*pitch],pitch*sizeof(uint32_t)); + } + else + { + stride /= 2; + pitch /= 2; + uint16_t *tex16 = tex_p; + const uint16_t *frame16 = frame; - for (i = 0; i < height; i++) - memcpy_neon(&tex16[i*stride],&frame16[i*pitch],width*sizeof(uint16_t)); - } + for (i = 0; i < height; i++) + memcpy_neon(&tex16[i*stride],&frame16[i*pitch],width*sizeof(uint16_t)); + } } } @@ -182,9 +189,9 @@ static bool vita2d_gfx_frame(void *data, const void *frame, vita2d_gfx_update_viewport(vita); vita2d_start_drawing(); - + vita2d_draw_rectangle(0,0,PSP_FB_WIDTH,PSP_FB_HEIGHT,vita2d_get_clear_color()); - + if (vita->texture) { if (vita->fullscreen) @@ -199,21 +206,9 @@ static bool vita2d_gfx_frame(void *data, const void *frame, float scalex = vita->vp.width / (float)vita->width; float scaley = vita->vp.height / (float)vita->height; vita2d_draw_texture_scale_rotate(vita->texture,vita->vp.x, - vita->vp.y, scalex, scaley, rad); + vita->vp.y, scalex, scaley, rad); } } - - if (video_info.fps_show) - { - char buffer[128]; - char buffer_fps[128]; - - buffer[0] = buffer_fps[0] = '\0'; - - video_monitor_get_fps(video_info, buffer, sizeof(buffer), - video_info.fps_show ? buffer_fps : NULL, sizeof(buffer_fps)); - runloop_msg_queue_push(buffer_fps, 1, 1, false); - } #ifdef HAVE_OVERLAY if (vita->overlay_enable) @@ -222,43 +217,41 @@ static bool vita2d_gfx_frame(void *data, const void *frame, if (vita->menu.active) { - menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL); - - if(vita->menu.texture){ - if (vita->fullscreen) - vita2d_draw_texture_scale(vita->menu.texture, - 0, 0, - PSP_FB_WIDTH / (float)vita->menu.width, - PSP_FB_HEIGHT / (float)vita->menu.height); - else - { - if (vita->menu.width > vita->menu.height) - { - float scale = PSP_FB_HEIGHT / (float)vita->menu.height; - float w = vita->menu.width * scale; - vita2d_draw_texture_scale(vita->menu.texture, - PSP_FB_WIDTH / 2.0f - w/2.0f, 0.0f, - scale, scale); - } - else - { - float scale = PSP_FB_WIDTH / (float)vita->menu.width; - float h = vita->menu.height * scale; - vita2d_draw_texture_scale(vita->menu.texture, - 0.0f, PSP_FB_HEIGHT / 2.0f - h/2.0f, - scale, scale); - } - } - } - +#ifdef HAVE_MENU + menu_driver_frame(video_info); +#endif - + if(vita->menu.texture){ + if (vita->fullscreen) + vita2d_draw_texture_scale(vita->menu.texture, + 0, 0, + PSP_FB_WIDTH / (float)vita->menu.width, + PSP_FB_HEIGHT / (float)vita->menu.height); + else + { + if (vita->menu.width > vita->menu.height) + { + float scale = PSP_FB_HEIGHT / (float)vita->menu.height; + float w = vita->menu.width * scale; + vita2d_draw_texture_scale(vita->menu.texture, + PSP_FB_WIDTH / 2.0f - w/2.0f, 0.0f, + scale, scale); + } + else + { + float scale = PSP_FB_WIDTH / (float)vita->menu.width; + float h = vita->menu.height * scale; + vita2d_draw_texture_scale(vita->menu.texture, + 0.0f, PSP_FB_HEIGHT / 2.0f - h/2.0f, + scale, scale); + } + } + } } - - + if(!string_is_empty(msg)) - font_driver_render_msg(NULL, msg, NULL); - + font_driver_render_msg(video_info, NULL, msg, NULL); + vita2d_end_drawing(); vita2d_swap_buffers(); @@ -567,7 +560,7 @@ static void vita2d_gfx_viewport_info(void *data, *vp = vita->vp; } -static bool vita2d_gfx_read_viewport(void *data, uint8_t *buffer) +static bool vita2d_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; @@ -732,10 +725,11 @@ static void vita_unload_texture(void *data, uintptr_t handle) } static void vita_set_osd_msg(void *data, const char *msg, - const struct font_params *params, void *font) + const void *params, void *font) { - (void)data; - font_driver_render_msg(font, msg, params); + video_frame_info_t video_info; + video_driver_build_info(&video_info); + font_driver_render_msg(&video_info, font, msg, params); } static bool vita_get_current_sw_framebuffer(void *data, diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 4f5cfd04c4..bf11f453a7 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2016 - Hans-Kristian Arntzen + * Copyright (C) 2016-2017 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -34,6 +35,8 @@ #include "../../menu/menu_driver.h" #endif +#include "../font_driver.h" + #include "../common/vulkan_common.h" #include "../../driver.h" @@ -42,10 +45,8 @@ #include "../../performance_counters.h" #include "../../retroarch.h" -#include "../../runloop.h" #include "../../verbosity.h" -#include "../font_driver.h" #include "../video_context_driver.h" #include "../video_coord_array.h" @@ -54,7 +55,7 @@ static void vulkan_set_viewport(void *data, unsigned viewport_width, #ifdef HAVE_OVERLAY static void vulkan_overlay_free(vk_t *vk); -static void vulkan_render_overlay(vk_t *vk); +static void vulkan_render_overlay(vk_t *vk, video_frame_info_t *video_info); #endif static void vulkan_viewport_info(void *data, struct video_viewport *vp); @@ -1463,7 +1464,7 @@ static void vulkan_readback(vk_t *vk) VK_PIPELINE_STAGE_HOST_BIT); } -static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t video_info) +static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t *video_info) { VkCommandBufferBeginInfo begin_info = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO }; @@ -1520,12 +1521,12 @@ static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t video_info) static bool vulkan_frame(void *data, const void *frame, unsigned frame_width, unsigned frame_height, uint64_t frame_count, - unsigned pitch, const char *msg, video_frame_info_t video_info) + unsigned pitch, const char *msg, video_frame_info_t *video_info) { - struct vk_per_frame *chain; - unsigned width, height; + VkSemaphore signal_semaphores[2]; VkClearValue clear_value; vk_t *vk = (vk_t*)data; + struct vk_per_frame *chain = NULL; static struct retro_perf_counter frame_run = {0}; static struct retro_perf_counter begin_cmd = {0}; static struct retro_perf_counter build_cmd = {0}; @@ -1534,7 +1535,8 @@ static bool vulkan_frame(void *data, const void *frame, static struct retro_perf_counter swapbuffers = {0}; static struct retro_perf_counter queue_submit = {0}; bool waits_for_semaphores = false; - VkSemaphore signal_semaphores[2]; + unsigned width = video_info->width; + unsigned height = video_info->height; VkCommandBufferBeginInfo begin_info = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO }; @@ -1554,8 +1556,6 @@ static bool vulkan_frame(void *data, const void *frame, performance_counter_init(&end_cmd, "end_command"); performance_counter_start(&frame_run); - video_driver_get_size(&width, &height); - /* Bookkeeping on start of frame. */ chain = &vk->swapchain[frame_index]; vk->chain = chain; @@ -1738,7 +1738,7 @@ static bool vulkan_frame(void *data, const void *frame, #if defined(HAVE_MENU) if (vk->menu.enable) { - menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL); + menu_driver_frame(video_info); if (vk->menu.textures[vk->menu.last_index].image != VK_NULL_HANDLE) { @@ -1775,11 +1775,11 @@ static bool vulkan_frame(void *data, const void *frame, #endif if (msg) - font_driver_render_msg(NULL, msg, NULL); + font_driver_render_msg(video_info, NULL, msg, NULL); #ifdef HAVE_OVERLAY if (vk->overlay.enable) - vulkan_render_overlay(vk); + vulkan_render_overlay(vk, video_info); #endif performance_counter_stop(&build_cmd); @@ -1922,7 +1922,7 @@ static bool vulkan_frame(void *data, const void *frame, gfx_ctx_mode_t mode; mode.width = width; mode.height = height; - video_context_driver_set_resize(&mode); + video_context_driver_set_resize(mode); vk->should_resize = false; } @@ -1931,10 +1931,10 @@ static bool vulkan_frame(void *data, const void *frame, /* Disable BFI during fast forward, slow-motion, * and pause to prevent flicker. */ if ( - video_info.black_frame_insertion + video_info->black_frame_insertion && !input_driver_is_nonblock_state() - && !runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, NULL) - && !runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL)) + && !video_info->runloop_is_slowmotion + && !video_info->runloop_is_paused) { vulkan_inject_black_frame(vk, video_info); } @@ -2141,10 +2141,11 @@ static void vulkan_set_texture_enable(void *data, bool state, bool full_screen) } static void vulkan_set_osd_msg(void *data, const char *msg, - const struct font_params *params, void *font) + const void *params, void *font) { - (void)data; - font_driver_render_msg(font, msg, params); + video_frame_info_t video_info; + video_driver_build_info(&video_info); + font_driver_render_msg(&video_info, font, msg, params); } #endif @@ -2260,7 +2261,7 @@ static void vulkan_viewport_info(void *data, struct video_viewport *vp) vp->full_height = height; } -static bool vulkan_read_viewport(void *data, uint8_t *buffer) +static bool vulkan_read_viewport(void *data, uint8_t *buffer, bool is_idle) { struct vk_texture *staging = NULL; vk_t *vk = (vk_t*)data; @@ -2303,7 +2304,8 @@ static bool vulkan_read_viewport(void *data, uint8_t *buffer) * with conversion. */ vk->readback.pending = true; - if (!runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL)) + + if (!is_idle) video_driver_cached_frame(); vkQueueWaitIdle(vk->context->queue); @@ -2394,17 +2396,17 @@ static void vulkan_overlay_set_alpha(void *data, } } -static void vulkan_render_overlay(vk_t *vk) +static void vulkan_render_overlay(vk_t *vk, video_frame_info_t *video_info) { - unsigned width, height; unsigned i; struct video_viewport vp; + unsigned width = video_info->width; + unsigned height = video_info->height; if (!vk) return; - video_driver_get_size(&width, &height); - vp = vk->vp; + vp = vk->vp; vulkan_set_viewport(vk, width, height, vk->overlay.full_screen, false); for (i = 0; i < vk->overlay.count; i++) diff --git a/gfx/drivers/wiiu_gfx.c b/gfx/drivers/wiiu_gfx.c index 2055b2d7ff..9ee8ed829c 100644 --- a/gfx/drivers/wiiu_gfx.c +++ b/gfx/drivers/wiiu_gfx.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2016 - Ali Bouhlel + * Copyright (C) 2014-2017 - Ali Bouhlel + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -13,14 +14,23 @@ * If not, see . */ +#include +#include +#include + #include "../../driver.h" #include "../../configuration.h" #include "../../verbosity.h" #include "performance_counters.h" -#include -#include -#include +#ifdef HAVE_CONFIG_H +#include "../../config.h" +#endif + +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + #include "gx2.h" #include "system/memory.h" #include "system/wiiu.h" @@ -28,6 +38,8 @@ #include "wiiu_dbg.h" +#include "../font_driver.h" + #define _X 0x00 #define _Y 0x01 #define _Z 0x02 @@ -127,16 +139,16 @@ static wiiu_set_position(position_t* position, GX2ColorBuffer* draw_buffer, floa GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, position, 4 * sizeof(*position)); } -static void wiiu_set_tex_coords(tex_coord_t* tex_coord, GX2Texture* texture, float u0, float v0, float u1, float v1) +static void wiiu_set_tex_coords(tex_coord_t* tex_coord, GX2Texture* texture, float u0, float v0, float u1, float v1, unsigned rotation) { - tex_coord[0].u = u0 / texture->surface.width; - tex_coord[0].v = (v1 / texture->surface.height); - tex_coord[1].u = u1 / texture->surface.width; - tex_coord[1].v = (v1 / texture->surface.height); - tex_coord[2].u = u1 / texture->surface.width; - tex_coord[2].v = (v0 / texture->surface.height); - tex_coord[3].u = u0 / texture->surface.width; - tex_coord[3].v = (v0 / texture->surface.height); + tex_coord[((0 + rotation) % 4)].u = u0 / texture->surface.width; + tex_coord[((0 + rotation) % 4)].v = (v1 / texture->surface.height); + tex_coord[((1 + rotation) % 4)].u = u1 / texture->surface.width; + tex_coord[((1 + rotation) % 4)].v = (v1 / texture->surface.height); + tex_coord[((2 + rotation) % 4)].u = u1 / texture->surface.width; + tex_coord[((2 + rotation) % 4)].v = (v0 / texture->surface.height); + tex_coord[((3 + rotation) % 4)].u = u0 / texture->surface.width; + tex_coord[((3 + rotation) % 4)].v = (v0 / texture->surface.height); GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, tex_coord, 4 * sizeof(*tex_coord)); } @@ -396,7 +408,7 @@ static void* wiiu_gfx_init(const video_info_t* video, wiiu->tex_coord = MEM2_alloc(4 * sizeof(*wiiu->tex_coord), GX2_VERTEX_BUFFER_ALIGNMENT); wiiu_set_tex_coords(wiiu->tex_coord, &wiiu->texture, 0, 0, - wiiu->texture.surface.width, wiiu->texture.surface.height); + wiiu->texture.surface.width, wiiu->texture.surface.height, wiiu->rotation); GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->position), sizeof(*wiiu->position), wiiu->position); GX2SetAttribBuffer(1, 4 * sizeof(*wiiu->tex_coord), sizeof(*wiiu->tex_coord), wiiu->tex_coord); @@ -407,7 +419,7 @@ static void* wiiu_gfx_init(const video_info_t* video, wiiu->menu.tex_coord = MEM2_alloc(4 * sizeof(*wiiu->menu.tex_coord), GX2_VERTEX_BUFFER_ALIGNMENT); wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0, - wiiu->menu.texture.surface.width, wiiu->menu.texture.surface.height); + wiiu->menu.texture.surface.width, wiiu->menu.texture.surface.height, 0); /* init frame texture */ memset(&wiiu->texture, 0, sizeof(GX2Texture)); @@ -550,7 +562,7 @@ static void wiiu_gfx_free(void* data) static bool wiiu_gfx_frame(void* data, const void* frame, unsigned width, unsigned height, uint64_t frame_count, - unsigned pitch, const char* msg, video_frame_info_t video_info) + unsigned pitch, const char* msg, video_frame_info_t *video_info) { (void)msg; int i; @@ -656,7 +668,7 @@ static bool wiiu_gfx_frame(void* data, const void* frame, GX2Invalidate(GX2_INVALIDATE_MODE_CPU_TEXTURE, wiiu->texture.surface.image, wiiu->texture.surface.imageSize); - wiiu_set_tex_coords(wiiu->tex_coord, &wiiu->texture, 0, 0, width, height); + wiiu_set_tex_coords(wiiu->tex_coord, &wiiu->texture, 0, 0, width, height, wiiu->rotation); } GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->position), sizeof(*wiiu->position), wiiu->position); @@ -668,6 +680,10 @@ static bool wiiu_gfx_frame(void* data, const void* frame, GX2DrawEx(GX2_PRIMITIVE_MODE_QUADS, 4, 0, 1); +#ifdef HAVE_MENU + menu_driver_frame(video_info); +#endif + if (wiiu->menu.enable) { GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->menu.position), sizeof(*wiiu->menu.position), wiiu->menu.position); @@ -752,7 +768,7 @@ static void wiiu_gfx_viewport_info(void* data, *vp = wiiu->vp; } -static bool wiiu_gfx_read_viewport(void* data, uint8_t* buffer) +static bool wiiu_gfx_read_viewport(void* data, uint8_t* buffer, bool is_idle) { (void)data; (void)buffer; @@ -761,7 +777,7 @@ static bool wiiu_gfx_read_viewport(void* data, uint8_t* buffer) } static uintptr_t wiiu_gfx_load_texture(void* video_data, void* data, - bool threaded, enum texture_filter_type filter_type) + bool threaded, enum texture_filter_type filter_type) { return 0; } @@ -821,8 +837,8 @@ static void wiiu_gfx_set_texture_frame(void* data, const void* frame, bool rgb32 GX2Invalidate(GX2_INVALIDATE_MODE_CPU_TEXTURE, wiiu->menu.texture.surface.image, wiiu->menu.texture.surface.imageSize); - wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0, width, height); -// wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0, wiiu->menu.texture.surface.width, wiiu->menu.texture.surface.height); + wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0, width, height, 0); +// wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0, wiiu->menu.texture.surface.width, wiiu->menu.texture.surface.height, 0); } static void wiiu_gfx_set_texture_enable(void* data, bool state, bool full_screen) diff --git a/gfx/drivers/xenon360_gfx.c b/gfx/drivers/xenon360_gfx.c index eeb99f5c1b..809cf5e664 100644 --- a/gfx/drivers/xenon360_gfx.c +++ b/gfx/drivers/xenon360_gfx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -26,8 +26,9 @@ #include "../../config.h" #endif +#include "../font_driver.h" + #include "../../driver.h" -#include "../../runloop.h" #define XE_W 512 #define XE_H 512 @@ -137,7 +138,7 @@ static void *xenon360_gfx_init(const video_info_t *video, const input_driver_t * edram_init(gl->gl_device); - // enable filtering for now + /* enable filtering for now */ float x = -1.0f; float y = 1.0f; @@ -150,21 +151,21 @@ static void *xenon360_gfx_init(const video_info_t *video, const input_driver_t * ScreenUv[UV_TOP] = ScreenUv[UV_TOP] * 2; ScreenUv[UV_LEFT] = ScreenUv[UV_LEFT] * 2; - // top left + /* top left */ Rect[0].x = x; Rect[0].y = y; Rect[0].u = ScreenUv[UV_BOTTOM]; Rect[0].v = ScreenUv[UV_RIGHT]; Rect[0].color = 0; - // bottom left + /* bottom left */ Rect[1].x = x; Rect[1].y = y - h; Rect[1].u = ScreenUv[UV_BOTTOM]; Rect[1].v = ScreenUv[UV_LEFT]; Rect[1].color = 0; - // top right + /* top right */ Rect[2].x = x + w; Rect[2].y = y; Rect[2].u = ScreenUv[UV_TOP]; @@ -192,7 +193,7 @@ static void *xenon360_gfx_init(const video_info_t *video, const input_driver_t * } static bool xenon360_gfx_frame(void *data, const void *frame, unsigned width, unsigned height, - uint64_t frame_count, unsigned pitch, const char *msg, video_frame_info_t video_info) + uint64_t frame_count, unsigned pitch, const char *msg, video_frame_info_t *video_info) { gl_t *vid = data; @@ -201,39 +202,44 @@ static bool xenon360_gfx_frame(void *data, const void *frame, unsigned width, un DrawVerticeFormats * Rect = Xe_VB_Lock(vid->gl_device, vid->vb, 0, 3 * sizeof(DrawVerticeFormats), XE_LOCK_WRITE); - // bottom left + /* bottom left */ Rect[1].v = ScreenUv[UV_LEFT]; Rect[2].u = ScreenUv[UV_TOP]; Xe_VB_Unlock(vid->gl_device, vid->vb); - // Refresh texture cache - uint16_t *dst = Xe_Surface_LockRect(vid->gl_device, vid->g_pTexture, 0, 0, 0, 0, XE_LOCK_WRITE); + /* Refresh texture cache */ + uint16_t *dst = Xe_Surface_LockRect(vid->gl_device, vid->g_pTexture, 0, 0, 0, 0, XE_LOCK_WRITE); const uint16_t *src = frame; - unsigned stride_in = pitch >>1; + unsigned stride_in = pitch >>1; unsigned stride_out = vid->g_pTexture->wpitch >> 1; - unsigned copy_size =width << 1; + unsigned copy_size = width << 1; + for (unsigned y = 0; y < height; y++, dst += stride_out, src += stride_in) memcpy(dst, src, copy_size); Xe_Surface_Unlock(vid->gl_device, vid->g_pTexture); - // Reset states + /* Reset states */ Xe_InvalidateState(vid->gl_device); Xe_SetClearColor(vid->gl_device, 0); - // Select stream + /* Select stream */ Xe_SetTexture(vid->gl_device, 0, vid->g_pTexture); Xe_SetCullMode(vid->gl_device, XE_CULL_NONE); Xe_SetStreamSource(vid->gl_device, 0, vid->vb, 0, sizeof(DrawVerticeFormats)); - // Select shaders + /* Select shaders */ Xe_SetShader(vid->gl_device, SHADER_TYPE_PIXEL, vid->g_pPixelTexturedShader, 0); Xe_SetShader(vid->gl_device, SHADER_TYPE_VERTEX, vid->g_pVertexShader, 0); - // Draw +#ifdef HAVE_MENU + menu_driver_frame(video_info); +#endif + + /* Draw */ Xe_DrawPrimitive(vid->gl_device, XE_PRIMTYPE_TRIANGLELIST, 0, 1); - // Resolve + /* Resolve */ Xe_Resolve(vid->gl_device); Xe_Sync(vid->gl_device); @@ -293,7 +299,7 @@ static void xenon360_gfx_viewport_info(void *data, struct video_viewport *vp) (void)vp; } -static bool xenon360_gfx_read_viewport(void *data, uint8_t *buffer) +static bool xenon360_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/xshm_gfx.c b/gfx/drivers/xshm_gfx.c index 8bb8ec9478..b283121211 100644 --- a/gfx/drivers/xshm_gfx.c +++ b/gfx/drivers/xshm_gfx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2016-2016 - Alfred Agrell + * Copyright (C) 2016-2017 - Alfred Agrell + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -32,6 +32,8 @@ #include "../../menu/menu_driver.h" #endif +#include "../font_driver.h" + #include "../common/x11_common.h" typedef struct xshm @@ -94,7 +96,7 @@ static void *xshm_gfx_init(const video_info_t *video, static bool xshm_gfx_frame(void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, - unsigned pitch, const char *msg, video_frame_info_t video_info) + unsigned pitch, const char *msg, video_frame_info_t *video_info) { xshm_t* xshm = (xshm_t*)data; int y; @@ -104,6 +106,10 @@ static bool xshm_gfx_frame(void *data, const void *frame, unsigned width, memcpy((uint8_t*)xshm->shmInfo.shmaddr + sizeof(uint32_t)*xshm->width*y, (uint8_t*)frame + pitch*y, pitch); } + +#ifdef HAVE_MENU + menu_driver_frame(video_info); +#endif XShmPutImage(xshm->display, xshm->wndw, xshm->gc, xshm->image, 0, 0, 0, 0, xshm->width, xshm->height, False); @@ -152,7 +158,7 @@ static void xshm_gfx_viewport_info(void *data, struct video_viewport *vp) } -static bool xshm_gfx_read_viewport(void *data, uint8_t *buffer) +static bool xshm_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { return false; } diff --git a/gfx/drivers/xvideo.c b/gfx/drivers/xvideo.c index d8fce331ba..772165fa01 100644 --- a/gfx/drivers/xvideo.c +++ b/gfx/drivers/xvideo.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -30,10 +30,19 @@ #include +#ifdef HAVE_CONFIG_H +#include "../../config.h" +#endif + +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + +#include "../font_driver.h" + #include "../../configuration.h" #include "../../frontend/frontend_driver.h" #include "../../verbosity.h" -#include "../font_driver.h" #include "../common/x11_common.h" @@ -414,6 +423,7 @@ static void *xv_init(const video_info_t *video, XWindowAttributes target; video_frame_info_t video_info; char buf[128] = {0}; + char title[128] = {0}; XSetWindowAttributes attributes = {0}; XVisualInfo visualtemplate = {0}; unsigned width = 0; @@ -530,8 +540,10 @@ static void *xv_init(const video_info_t *video, video_driver_build_info(&video_info); - if (video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0)) - XStoreName(g_x11_dpy, g_x11_win, buf); + video_driver_get_window_title(title, sizeof(title)); + + if (title[0]) + XStoreName(g_x11_dpy, g_x11_win, title); x11_set_window_attr(g_x11_dpy, g_x11_win); @@ -784,7 +796,7 @@ static void xv_render_msg(xv_t *xv, const char *msg, static bool xv_frame(void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, - unsigned pitch, const char *msg, video_frame_info_t video_info) + unsigned pitch, const char *msg, video_frame_info_t *video_info) { XWindowAttributes target; xv_t *xv = (xv_t*)data; @@ -802,6 +814,10 @@ static bool xv_frame(void *data, const void *frame, unsigned width, xv->vp.full_width = target.width; xv->vp.full_height = target.height; +#ifdef HAVE_MENU + menu_driver_frame(video_info); +#endif + if (msg) xv_render_msg(xv, msg, width << 1, height << 1); @@ -811,7 +827,7 @@ static bool xv_frame(void *data, const void *frame, unsigned width, true); XSync(g_x11_dpy, False); - x11_update_window_title(NULL, video_info); + x11_update_title(NULL, video_info); return true; } @@ -876,7 +892,7 @@ static void xv_set_rotation(void *data, unsigned rotation) (void)rotation; } -static bool xv_read_viewport(void *data, uint8_t *buffer) +static bool xv_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers_context/android_ctx.c b/gfx/drivers_context/android_ctx.c index 5c84cf1d7c..13e6e66ca7 100644 --- a/gfx/drivers_context/android_ctx.c +++ b/gfx/drivers_context/android_ctx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -38,9 +38,6 @@ #include "../../frontend/drivers/platform_linux.h" -#include "../../configuration.h" -#include "../../runloop.h" - static enum gfx_ctx_api android_api = GFX_CTX_NONE; /* forward declaration */ @@ -101,7 +98,7 @@ static void android_gfx_ctx_destroy(void *data) free(data); } -static void *android_gfx_ctx_init(video_frame_info_t video_info, void *video_driver) +static void *android_gfx_ctx_init(video_frame_info_t *video_info, void *video_driver) { #ifdef HAVE_OPENGLES EGLint n, major, minor; @@ -231,13 +228,13 @@ static void android_gfx_ctx_get_video_size(void *data, } static void android_gfx_ctx_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) + bool *resize, unsigned *width, unsigned *height, + bool is_shutdown) { - unsigned new_width, new_height; + unsigned new_width = 0; + unsigned new_height = 0; android_ctx_data_t *and = (android_ctx_data_t*)data; - (void)frame_count; - *quit = false; switch (android_api) @@ -273,7 +270,7 @@ static void android_gfx_ctx_check_window(void *data, bool *quit, } /* Check if we are exiting. */ - if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL)) + if (is_shutdown) *quit = true; } @@ -314,21 +311,8 @@ static bool android_gfx_ctx_set_resize(void *data, return false; } -static void android_gfx_ctx_update_window_title(void *data, video_frame_info_t video_info) -{ - char buf[128]; - char buf_fps[128]; - - buf[0] = buf_fps[0] = '\0'; - - video_monitor_get_fps(video_info, buf, sizeof(buf), - buf_fps, sizeof(buf_fps)); - if (video_info.fps_show) - runloop_msg_queue_push(buf_fps, 1, 1, false); -} - static bool android_gfx_ctx_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -366,10 +350,10 @@ static bool android_gfx_ctx_set_video_mode(void *data, } static void android_gfx_ctx_input_driver(void *data, + const char *joypad_name, const input_driver_t **input, void **input_data) { - settings_t *settings = config_get_ptr(); - void *androidinput = input_android.init(settings->input.joypad_driver); + void *androidinput = input_android.init(joypad_name); *input = androidinput ? &input_android : NULL; *input_data = androidinput; @@ -436,12 +420,6 @@ static bool android_gfx_ctx_suppress_screensaver(void *data, bool enable) return false; } -static bool android_gfx_ctx_has_windowed(void *data) -{ - (void)data; - return false; -} - static void dpi_get_density(char *s, size_t len) { system_property_get("getprop", "ro.sf.lcd_density", s); @@ -493,7 +471,7 @@ dpi_fallback: return true; } -static void android_gfx_ctx_swap_buffers(void *data, video_frame_info_t video_info) +static void android_gfx_ctx_swap_buffers(void *data, video_frame_info_t *video_info) { android_ctx_data_t *and = (android_ctx_data_t*)data; @@ -618,12 +596,12 @@ const gfx_ctx_driver_t gfx_ctx_android = { NULL, /* get_video_output_next */ android_gfx_ctx_get_metrics, NULL, - android_gfx_ctx_update_window_title, + NULL, /* update_title */ android_gfx_ctx_check_window, android_gfx_ctx_set_resize, android_gfx_ctx_has_focus, android_gfx_ctx_suppress_screensaver, - android_gfx_ctx_has_windowed, + NULL, /* has_windowed */ android_gfx_ctx_swap_buffers, android_gfx_ctx_input_driver, android_gfx_ctx_get_proc_address, diff --git a/gfx/drivers_context/cgl_ctx.c b/gfx/drivers_context/cgl_ctx.c index 60f1dfe2b1..74ab9c3f64 100644 --- a/gfx/drivers_context/cgl_ctx.c +++ b/gfx/drivers_context/cgl_ctx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -29,7 +29,6 @@ #include #include -#include "../../runloop.h" #include "../video_context_driver.h" typedef int CGSConnectionID; @@ -78,11 +77,10 @@ static void gfx_ctx_cgl_get_video_size(void *data, unsigned *width, unsigned *he } static void gfx_ctx_cgl_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) + bool *resize, unsigned *width, unsigned *height, bool is_shutdown) { - unsigned new_width, new_height; - - (void)frame_count; + unsigned new_width = 0; + unsigned new_height = 0; *quit = false; @@ -95,37 +93,15 @@ static void gfx_ctx_cgl_check_window(void *data, bool *quit, } } -static void gfx_ctx_cgl_swap_buffers(void *data, video_frame_info_t video_info) +static void gfx_ctx_cgl_swap_buffers(void *data, video_frame_info_t *video_info) { gfx_ctx_cgl_data_t *cgl = (gfx_ctx_cgl_data_t*)data; CGLFlushDrawable(cgl->glCtx); } -static bool gfx_ctx_cgl_set_resize(void *data, unsigned width, unsigned height) -{ - (void)data; - (void)width; - (void)height; - return false; -} - -static void gfx_ctx_cgl_update_window_title(void *data, video_frame_info_t video_info) -{ - char buf[128]; - char buf_fps[128]; - - buf[0] = buf_fps[0] = '\0'; - - video_monitor_get_fps(video_info, buf, sizeof(buf), - buf_fps, sizeof(buf_fps)); - if (video_info.fps_show) - runloop_msg_queue_push(buf_fps, 1, 1, false); -} - - static bool gfx_ctx_cgl_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -154,7 +130,9 @@ static void gfx_ctx_cgl_destroy(void *data) free(cgl); } -static void gfx_ctx_cgl_input_driver(void *data, const input_driver_t **input, void **input_data) +static void gfx_ctx_cgl_input_driver(void *data, + const char *name, + const input_driver_t **input, void **input_data) { (void)data; (void)input; @@ -193,12 +171,6 @@ static bool gfx_ctx_cgl_suppress_screensaver(void *data, bool enable) return false; } -static bool gfx_ctx_cgl_has_windowed(void *data) -{ - (void)data; - return false; -} - static bool gfx_ctx_cgl_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor) { @@ -303,7 +275,7 @@ static CGSSurfaceID attach_gl_context_to_window(CGLContextObj glCtx, return sid; } -static void *gfx_ctx_cgl_init(video_frame_info_t video_info, void *video_driver) +static void *gfx_ctx_cgl_init(video_frame_info_t *video_info, void *video_driver) { CGError err; gfx_ctx_cgl_data_t *cgl = (gfx_ctx_cgl_data_t*)calloc(1, sizeof(gfx_ctx_cgl_data_t)); @@ -362,12 +334,12 @@ const gfx_ctx_driver_t gfx_ctx_cgl = { NULL, /* get_video_output_next */ NULL, /* get_metrics */ NULL, - gfx_ctx_cgl_update_window_title, + NULL, /* update_title */ gfx_ctx_cgl_check_window, - gfx_ctx_cgl_set_resize, + NULL, /* set_resize */ gfx_ctx_cgl_has_focus, gfx_ctx_cgl_suppress_screensaver, - gfx_ctx_cgl_has_windowed, + NULL, /* has_windowed */ gfx_ctx_cgl_swap_buffers, gfx_ctx_cgl_input_driver, gfx_ctx_cgl_get_proc_address, diff --git a/gfx/drivers_context/cocoa_gl_ctx.m b/gfx/drivers_context/cocoa_gl_ctx.m index cf18281938..081aee1c06 100644 --- a/gfx/drivers_context/cocoa_gl_ctx.m +++ b/gfx/drivers_context/cocoa_gl_ctx.m @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -41,7 +41,6 @@ #import "../../ui/drivers/cocoa/cocoa_common.h" #include "../video_context_driver.h" #include "../../configuration.h" -#include "../../runloop.h" #include "../../verbosity.h" #if defined(HAVE_COCOATOUCH) @@ -213,7 +212,7 @@ void cocoagl_gfx_ctx_update(void) #endif } -static void *cocoagl_gfx_ctx_init(video_frame_info_t video_info, void *video_driver) +static void *cocoagl_gfx_ctx_init(video_frame_info_t *video_info, void *video_driver) { (void)video_driver; @@ -330,7 +329,7 @@ static void cocoagl_gfx_ctx_show_mouse(void *data, bool state) } static bool cocoagl_gfx_ctx_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { #if defined(HAVE_COCOA) @@ -416,28 +415,27 @@ static void cocoagl_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned *height = CGRectGetHeight(size) * screenscale; } -static void cocoagl_gfx_ctx_update_window_title(void *data, video_frame_info_t video_info) +#if defined(HAVE_COCOA) +static void cocoagl_gfx_ctx_update_title(void *data, video_frame_info_t *video_info) { -#if defined(HAVE_COCOA) ui_window_cocoa_t view; - const ui_window_t *window = NULL; -#endif - static char buf_fps[128] = {0}; - static char buf[128] = {0}; - - video_monitor_get_fps(video_info, buf, sizeof(buf), - buf_fps, sizeof(buf_fps)); - -#if defined(HAVE_COCOA) - window = ui_companion_driver_get_window_ptr(); + const ui_window_t *window = ui_companion_driver_get_window_ptr(); + view.data = (CocoaView*)nsview_get_ptr(); - if (window && *buf) - window->set_title(&view, buf); -#endif - if (video_info.fps_show) - runloop_msg_queue_push(buf_fps, 1, 1, false); + if (window) + { + char title[128]; + + title[0] = '\0'; + + video_driver_get_window_title(title, sizeof(title)); + + if (title[0]) + window->set_title(&view, title); + } } +#endif static bool cocoagl_gfx_ctx_get_metrics(void *data, enum display_metric_types type, float *value) @@ -526,18 +524,14 @@ static bool cocoagl_gfx_ctx_suppress_screensaver(void *data, bool enable) return false; } +#if !defined(HAVE_COCOATOUCH) static bool cocoagl_gfx_ctx_has_windowed(void *data) { - (void)data; - -#if defined(HAVE_COCOATOUCH) - return false; -#else return true; -#endif } +#endif -static void cocoagl_gfx_ctx_swap_buffers(void *data, video_frame_info_t video_info) +static void cocoagl_gfx_ctx_swap_buffers(void *data, video_frame_info_t *video_info) { if (!(--g_fast_forward_skips < 0)) return; @@ -564,10 +558,9 @@ CFStringRef)BOXSTRING(symbol_name) } static void cocoagl_gfx_ctx_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) + bool *resize, unsigned *width, unsigned *height, bool is_shutdown) { unsigned new_width, new_height; - (void)frame_count; *quit = false; @@ -580,18 +573,11 @@ static void cocoagl_gfx_ctx_check_window(void *data, bool *quit, } } -static bool cocoagl_gfx_ctx_set_resize(void *data, unsigned width, unsigned height) +static void cocoagl_gfx_ctx_input_driver(void *data, + const char *name, + const input_driver_t **input, void **input_data) { - (void)data; - (void)width; - (void)height; - return false; -} - -static void cocoagl_gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data) -{ - (void)data; - *input = NULL; + *input = NULL; *input_data = NULL; } @@ -630,12 +616,20 @@ const gfx_ctx_driver_t gfx_ctx_cocoagl = { NULL, /* get_video_output_next */ cocoagl_gfx_ctx_get_metrics, NULL, - cocoagl_gfx_ctx_update_window_title, +#if defined(HAVE_COCOA) + cocoagl_gfx_ctx_update_title, +#else + NULL, /* update_title */ +#endif cocoagl_gfx_ctx_check_window, - cocoagl_gfx_ctx_set_resize, + NULL, /* set_resize */ cocoagl_gfx_ctx_has_focus, cocoagl_gfx_ctx_suppress_screensaver, +#if defined(HAVE_COCOATOUCH) + NULL, +#else cocoagl_gfx_ctx_has_windowed, +#endif cocoagl_gfx_ctx_swap_buffers, cocoagl_gfx_ctx_input_driver, cocoagl_gfx_ctx_get_proc_address, diff --git a/gfx/drivers_context/d3d_ctx.cpp b/gfx/drivers_context/d3d_ctx.cpp index ab1d5b4682..9c1214618f 100644 --- a/gfx/drivers_context/d3d_ctx.cpp +++ b/gfx/drivers_context/d3d_ctx.cpp @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2014 - OV2 * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -29,8 +29,6 @@ #include "../drivers/d3d.h" #include "../common/win32_common.h" -#include "../../configuration.h" -#include "../../runloop.h" #include "../../verbosity.h" #include "../../ui/ui_companion_driver.h" @@ -77,7 +75,7 @@ static bool gfx_ctx_d3d_set_resize(void *data, unsigned new_width, unsigned new_ return true; } -static void gfx_ctx_d3d_swap_buffers(void *data, video_frame_info_t video_info) +static void gfx_ctx_d3d_swap_buffers(void *data, video_frame_info_t *video_info) { d3d_video_t *d3d = (d3d_video_t*)data; LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev; @@ -85,25 +83,11 @@ static void gfx_ctx_d3d_swap_buffers(void *data, video_frame_info_t video_info) d3d_swap(d3d, d3dr); } -static void gfx_ctx_d3d_update_title(void *data, video_frame_info_t video_info) +static void gfx_ctx_d3d_update_title(void *data, video_frame_info_t *video_info) { - char buf[128]; - char buffer_fps[128]; - const ui_window_t *window = ui_companion_driver_get_window_ptr(); - - buf[0] = buffer_fps[0] = '\0'; - - if (window && video_monitor_get_fps(video_info, buf, sizeof(buf), - buffer_fps, sizeof(buffer_fps))) - { -#ifndef _XBOX - window->set_title(&main_window, buf); -#endif - } - - if (video_info.fps_show) - { #ifdef _XBOX + if (video_info->fps_show) + { MEMORYSTATUS stat; char mem[128]; @@ -112,10 +96,24 @@ static void gfx_ctx_d3d_update_title(void *data, video_frame_info_t video_info) GlobalMemoryStatus(&stat); snprintf(mem, sizeof(mem), "|| MEM: %.2f/%.2fMB", stat.dwAvailPhys/(1024.0f*1024.0f), stat.dwTotalPhys/(1024.0f*1024.0f)); - strlcat(buffer_fps, mem, sizeof(buffer_fps)); -#endif - runloop_msg_queue_push(buffer_fps, 1, 1, false); + strlcat(video_info->fps_text, mem, sizeof(video_info->fps_text)); } +#else + const ui_window_t *window = ui_companion_driver_get_window_ptr(); + + if (window) + { + char title[128]; + + title[0] = '\0'; + + video_driver_get_window_title(title, sizeof(title)); + + if (title[0]) + window->set_title(&main_window, title); + } +#endif + } static void gfx_ctx_d3d_show_mouse(void *data, bool state) @@ -127,7 +125,7 @@ static void gfx_ctx_d3d_show_mouse(void *data, bool state) static void gfx_ctx_d3d_check_window(void *data, bool *quit, bool *resize, unsigned *width, - unsigned *height, unsigned frame_count) + unsigned *height, bool is_shutdown) { win32_check_window(quit, resize, width, height); } @@ -142,16 +140,14 @@ static bool gfx_ctx_d3d_suppress_screensaver(void *data, bool enable) return win32_suppress_screensaver(data, enable); } +#ifndef _XBOX static bool gfx_ctx_d3d_has_windowed(void *data) { (void)data; -#ifdef _XBOX - return false; -#else return true; -#endif } +#endif static bool gfx_ctx_d3d_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor) @@ -169,7 +165,7 @@ static bool gfx_ctx_d3d_bind_api(void *data, #endif } -static void *gfx_ctx_d3d_init(video_frame_info_t video_info, void *video_driver) +static void *gfx_ctx_d3d_init(video_frame_info_t *video_info, void *video_driver) { win32_monitor_init(); @@ -182,15 +178,15 @@ static void gfx_ctx_d3d_destroy(void *data) } static void gfx_ctx_d3d_input_driver(void *data, + const char *name, const input_driver_t **input, void **input_data) { - settings_t *settings = config_get_ptr(); #ifdef _XBOX - void *xinput = input_xinput.init(settings->input.joypad_driver); + void *xinput = input_xinput.init(name); *input = xinput ? (const input_driver_t*)&input_xinput : NULL; *input_data = xinput; #else - dinput = input_dinput.init(settings->input.joypad_driver); + dinput = input_dinput.init(name); *input = dinput ? &input_dinput : NULL; *input_data = dinput; #endif @@ -198,7 +194,7 @@ static void gfx_ctx_d3d_input_driver(void *data, } static bool gfx_ctx_d3d_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -348,7 +344,11 @@ const gfx_ctx_driver_t gfx_ctx_d3d = { gfx_ctx_d3d_set_resize, gfx_ctx_d3d_has_focus, gfx_ctx_d3d_suppress_screensaver, +#ifdef _XBOX + NULL, +#else gfx_ctx_d3d_has_windowed, +#endif gfx_ctx_d3d_swap_buffers, gfx_ctx_d3d_input_driver, NULL, diff --git a/gfx/drivers_context/drm_ctx.c b/gfx/drivers_context/drm_ctx.c index d2a4b3c282..01e835068a 100644 --- a/gfx/drivers_context/drm_ctx.c +++ b/gfx/drivers_context/drm_ctx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -36,7 +37,6 @@ #include #include "../../verbosity.h" -#include "../../runloop.h" #include "../../frontend/frontend_driver.h" #include "../common/drm_common.h" @@ -138,10 +138,9 @@ static void gfx_ctx_drm_swap_interval(void *data, unsigned interval) } static void gfx_ctx_drm_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) + bool *resize, unsigned *width, unsigned *height, bool is_shutdown) { (void)data; - (void)frame_count; (void)width; (void)height; @@ -225,7 +224,7 @@ static bool gfx_ctx_drm_queue_flip(void) return false; } -static void gfx_ctx_drm_swap_buffers(void *data, video_frame_info_t video_info) +static void gfx_ctx_drm_swap_buffers(void *data, video_frame_info_t *video_info) { gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data; @@ -253,37 +252,13 @@ static void gfx_ctx_drm_swap_buffers(void *data, video_frame_info_t video_info) waiting_for_flip = gfx_ctx_drm_queue_flip(); /* Triple-buffered page flips */ - if (video_info.max_swapchain_images >= 3 && + if (video_info->max_swapchain_images >= 3 && gbm_surface_has_free_buffers(g_gbm_surface)) return; gfx_ctx_drm_wait_flip(true); } -static bool gfx_ctx_drm_set_resize(void *data, - unsigned width, unsigned height) -{ - (void)data; - (void)width; - (void)height; - - return false; -} - -static void gfx_ctx_drm_update_window_title(void *data, video_frame_info_t video_info) -{ - char buf[128]; - char buf_fps[128]; - - buf[0] = buf_fps[0] = '\0'; - - video_monitor_get_fps(video_info, buf, sizeof(buf), - buf_fps, sizeof(buf_fps)); - - if (video_info.fps_show) - runloop_msg_queue_push( buf_fps, 1, 1, false); -} - static void gfx_ctx_drm_get_video_size(void *data, unsigned *width, unsigned *height) { @@ -356,7 +331,7 @@ static void gfx_ctx_drm_destroy_resources(gfx_ctx_drm_data_t *drm) g_next_bo = NULL; } -static void *gfx_ctx_drm_init(video_frame_info_t video_info, void *video_driver) +static void *gfx_ctx_drm_init(video_frame_info_t *video_info, void *video_driver) { int fd, i; unsigned monitor_index; @@ -393,7 +368,7 @@ nextgpu: if (!drm_get_resources(fd)) goto nextgpu; - if (!drm_get_connector(video_info.monitor_index, fd)) + if (!drm_get_connector(fd, video_info)) goto nextgpu; if (!drm_get_encoder(fd)) @@ -617,7 +592,7 @@ error: #endif static bool gfx_ctx_drm_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -634,7 +609,7 @@ static bool gfx_ctx_drm_set_video_mode(void *data, /* If we use black frame insertion, * we fake a 60 Hz monitor for 120 Hz one, * etc, so try to match that. */ - refresh_mod = video_info.black_frame_insertion + refresh_mod = video_info->black_frame_insertion ? 0.5f : 1.0f; /* Find desired video mode, and use that. @@ -660,7 +635,7 @@ static bool gfx_ctx_drm_set_video_mode(void *data, continue; diff = fabsf(refresh_mod * g_drm_connector->modes[i].vrefresh - - video_info.refresh_rate); + - video_info->refresh_rate); if (!g_drm_mode || diff < minimum_fps_diff) { @@ -746,10 +721,10 @@ static void gfx_ctx_drm_destroy(void *data) } static void gfx_ctx_drm_input_driver(void *data, + const char *name, const input_driver_t **input, void **input_data) { - (void)data; - *input = NULL; + *input = NULL; *input_data = NULL; } @@ -765,12 +740,6 @@ static bool gfx_ctx_drm_suppress_screensaver(void *data, bool enable) return false; } -static bool gfx_ctx_drm_has_windowed(void *data) -{ - (void)data; - return false; -} - static bool gfx_ctx_drm_bind_api(void *video_driver, enum gfx_ctx_api api, unsigned major, unsigned minor) { @@ -889,12 +858,12 @@ const gfx_ctx_driver_t gfx_ctx_drm = { NULL, /* get_video_output_next */ NULL, /* get_metrics */ NULL, - gfx_ctx_drm_update_window_title, + NULL, /* update_window_title */ gfx_ctx_drm_check_window, - gfx_ctx_drm_set_resize, + NULL, /* set_resize */ gfx_ctx_drm_has_focus, gfx_ctx_drm_suppress_screensaver, - gfx_ctx_drm_has_windowed, + NULL, /* has_windowed */ gfx_ctx_drm_swap_buffers, gfx_ctx_drm_input_driver, gfx_ctx_drm_get_proc_address, diff --git a/gfx/drivers_context/emscriptenegl_ctx.c b/gfx/drivers_context/emscriptenegl_ctx.c index 4a9d9735cd..6d6c50cf86 100644 --- a/gfx/drivers_context/emscriptenegl_ctx.c +++ b/gfx/drivers_context/emscriptenegl_ctx.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -24,7 +25,6 @@ #include "../../config.h" #endif -#include "../../runloop.h" #include "../video_context_driver.h" #ifdef HAVE_EGL @@ -52,7 +52,7 @@ static void gfx_ctx_emscripten_swap_interval(void *data, unsigned interval) } static void gfx_ctx_emscripten_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) + bool *resize, unsigned *width, unsigned *height, bool is_shutdown) { int input_width; int input_height; @@ -60,7 +60,6 @@ static void gfx_ctx_emscripten_check_window(void *data, bool *quit, emscripten_ctx_data_t *emscripten = (emscripten_ctx_data_t*)data; (void)data; - (void)frame_count; emscripten_get_canvas_size(&input_width, &input_height, &is_fullscreen); *width = (unsigned)input_width; @@ -75,34 +74,12 @@ static void gfx_ctx_emscripten_check_window(void *data, bool *quit, *quit = false; } -static void gfx_ctx_emscripten_swap_buffers(void *data, video_frame_info_t video_info) +static void gfx_ctx_emscripten_swap_buffers(void *data, video_frame_info_t *video_info) { (void)data; /* no-op in emscripten, no way to force swap/wait for VSync in browsers */ } -static bool gfx_ctx_emscripten_set_resize(void *data, - unsigned width, unsigned height) -{ - (void)data; - (void)width; - (void)height; - return false; -} - -static void gfx_ctx_emscripten_update_window_title(void *data, video_frame_info_t video_info) -{ - char buf[128]; - char buf_fps[128]; - - buf[0] = buf_fps[0] = '\0'; - - video_monitor_get_fps(video_info, buf, sizeof(buf), - buf_fps, sizeof(buf_fps)); - if (video_info.fps_show) - runloop_msg_queue_push(buf_fps, 1, 1, false); -} - static void gfx_ctx_emscripten_get_video_size(void *data, unsigned *width, unsigned *height) { @@ -121,7 +98,7 @@ static void gfx_ctx_emscripten_destroy(void *data) free(data); } -static void *gfx_ctx_emscripten_init(video_frame_info_t video_info, void *video_driver) +static void *gfx_ctx_emscripten_init(video_frame_info_t *video_info, void *video_driver) { #ifdef HAVE_EGL unsigned width, height; @@ -189,7 +166,7 @@ error: } static bool gfx_ctx_emscripten_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -222,23 +199,22 @@ static bool gfx_ctx_emscripten_bind_api(void *data, static void gfx_ctx_emscripten_input_driver(void *data, + const char *name, const input_driver_t **input, void **input_data) { - (void)data; + void *rwebinput = NULL; - *input = NULL; - *input_data = NULL; + *input = NULL; + *input_data = NULL; #ifndef HAVE_SDL2 - { - void *rwebinput = input_rwebinput.init(); + rwebinput = input_rwebinput.init(); - if (!rwebinput) - return; + if (!rwebinput) + return; - *input = &input_rwebinput; - *input_data = rwebinput; - } + *input = &input_rwebinput; + *input_data = rwebinput; #endif } @@ -331,9 +307,9 @@ const gfx_ctx_driver_t gfx_ctx_emscripten = { NULL, /* get_video_output_next */ NULL, /* get_metrics */ gfx_ctx_emscripten_translate_aspect, - gfx_ctx_emscripten_update_window_title, + NULL, /* update_title */ gfx_ctx_emscripten_check_window, - gfx_ctx_emscripten_set_resize, + NULL, /* set_resize */ gfx_ctx_emscripten_has_focus, gfx_ctx_emscripten_suppress_screensaver, gfx_ctx_emscripten_has_windowed, diff --git a/gfx/drivers_context/gdi_ctx.cpp b/gfx/drivers_context/gdi_ctx.cpp new file mode 100644 index 0000000000..9e9b770262 --- /dev/null +++ b/gfx/drivers_context/gdi_ctx.cpp @@ -0,0 +1,335 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +/* Win32/GDI context. */ + +/* necessary for mingw32 multimon defines: */ +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0500 //_WIN32_WINNT_WIN2K +#endif + +#include +#include + +#include +#include + +#ifdef HAVE_CONFIG_H +#include "../../config.h" +#endif + +#include "../../configuration.h" +#include "../../dynamic.h" +#include "../../verbosity.h" +#include "../video_context_driver.h" + +#include "../common/win32_common.h" + +static HDC win32_gdi_hdc; + +static unsigned win32_gdi_major = 0; +static unsigned win32_gdi_minor = 0; +static unsigned win32_gdi_interval = 0; +static enum gfx_ctx_api win32_gdi_api = GFX_CTX_NONE; + +void *dinput_gdi; + +static void setup_gdi_pixel_format(HDC hdc) +{ + PIXELFORMATDESCRIPTOR pfd = {0}; + pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); + pfd.nVersion = 1; + pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER; + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.cColorBits = 32; + pfd.cDepthBits = 0; + pfd.cStencilBits = 0; + pfd.iLayerType = PFD_MAIN_PLANE; + + SetPixelFormat(hdc, ChoosePixelFormat(hdc, &pfd), &pfd); +} + +static void gfx_ctx_gdi_check_window(void *data, bool *quit, + bool *resize, unsigned *width, unsigned *height, bool is_shutdown) +{ + win32_check_window(quit, resize, width, height); +} + +static bool gfx_ctx_gdi_set_resize(void *data, + unsigned width, unsigned height) +{ + (void)data; + (void)width; + (void)height; + + switch (win32_gdi_api) + { + case GFX_CTX_NONE: + default: + break; + } + + return false; +} + +static void gfx_ctx_gdi_update_window_title(void *data, video_frame_info_t *video_info) +{ + const ui_window_t *window = ui_companion_driver_get_window_ptr(); + char title[128]; + + title[0] = '\0'; + + video_driver_get_window_title(title, sizeof(title)); + + if (window && title[0]) + window->set_title(&main_window, title); +} + +static void gfx_ctx_gdi_get_video_size(void *data, + unsigned *width, unsigned *height) +{ + (void)data; + HWND window = win32_get_window(); + + if (!window) + { + RECT mon_rect; + MONITORINFOEX current_mon; + unsigned mon_id = 0; + HMONITOR hm_to_use = NULL; + + win32_monitor_info(¤t_mon, &hm_to_use, &mon_id); + mon_rect = current_mon.rcMonitor; + *width = mon_rect.right - mon_rect.left; + *height = mon_rect.bottom - mon_rect.top; + } + else + { + *width = g_resize_width; + *height = g_resize_height; + } +} + +static void *gfx_ctx_gdi_init(video_frame_info_t *video_info, void *video_driver) +{ + WNDCLASSEX wndclass = {0}; + + (void)video_driver; + + if (g_inited) + return NULL; + + win32_window_reset(); + win32_monitor_init(); + + wndclass.lpfnWndProc = WndProcGDI; + if (!win32_window_init(&wndclass, true, NULL)) + return NULL; + + switch (win32_gdi_api) + { + case GFX_CTX_NONE: + default: + break; + } + + return (void*)"gdi"; +} + +static void gfx_ctx_gdi_destroy(void *data) +{ + HWND window = win32_get_window(); + + (void)data; + + switch (win32_gdi_api) + { + case GFX_CTX_NONE: + default: + break; + } + + if (window && win32_gdi_hdc) + { + ReleaseDC(window, win32_gdi_hdc); + win32_gdi_hdc = NULL; + } + + if (window) + { + win32_monitor_from_window(); + win32_destroy_window(); + } + + if (g_restore_desktop) + { + win32_monitor_get_info(); + g_restore_desktop = false; + } + + g_inited = false; + win32_gdi_major = 0; + win32_gdi_minor = 0; +} + +static bool gfx_ctx_gdi_set_video_mode(void *data, + video_frame_info_t *video_info, + unsigned width, unsigned height, + bool fullscreen) +{ + if (!win32_set_video_mode(NULL, width, height, fullscreen)) + { + RARCH_ERR("[GDI]: win32_set_video_mode failed.\n"); + goto error; + } + + switch (win32_gdi_api) + { + case GFX_CTX_NONE: + default: + break; + } + + return true; + +error: + gfx_ctx_gdi_destroy(data); + return false; +} + + +static void gfx_ctx_gdi_input_driver(void *data, + const char *joypad_name, + const input_driver_t **input, void **input_data) +{ + (void)data; + + dinput_gdi = input_dinput.init(joypad_name); + + *input = dinput_gdi ? &input_dinput : NULL; + *input_data = dinput_gdi; +} + +static bool gfx_ctx_gdi_has_focus(void *data) +{ + return win32_has_focus(); +} + +static bool gfx_ctx_gdi_suppress_screensaver(void *data, bool enable) +{ + return win32_suppress_screensaver(data, enable); +} + +static bool gfx_ctx_gdi_has_windowed(void *data) +{ + (void)data; + + return true; +} + +static bool gfx_ctx_gdi_get_metrics(void *data, + enum display_metric_types type, float *value) +{ + return win32_get_metrics(data, type, value); +} + +static bool gfx_ctx_gdi_bind_api(void *data, + enum gfx_ctx_api api, unsigned major, unsigned minor) +{ + (void)data; + + win32_gdi_major = major; + win32_gdi_minor = minor; + win32_gdi_api = api; + + return true; +} + +static void gfx_ctx_gdi_show_mouse(void *data, bool state) +{ + (void)data; + win32_show_cursor(state); +} + +static void gfx_ctx_gdi_swap_interval(void *data, unsigned interval) +{ + (void)data; + (void)interval; +} + +static void gfx_ctx_gdi_set_flags(void *data, uint32_t flags) +{ + (void)data; + (void)flags; +} + +static uint32_t gfx_ctx_gdi_get_flags(void *data) +{ + uint32_t flags = 0; + BIT32_SET(flags, GFX_CTX_FLAGS_NONE); + return flags; +} + +static void gfx_ctx_gdi_swap_buffers(void *data, video_frame_info_t *video_info) +{ + (void)data; + + SwapBuffers(win32_gdi_hdc); +} + +void create_gdi_context(HWND hwnd, bool *quit) +{ + (void)quit; + win32_gdi_hdc = GetDC(hwnd); + + setup_gdi_pixel_format(win32_gdi_hdc); + + g_inited = true; +} + +const gfx_ctx_driver_t gfx_ctx_gdi = { + gfx_ctx_gdi_init, + gfx_ctx_gdi_destroy, + gfx_ctx_gdi_bind_api, + gfx_ctx_gdi_swap_interval, + gfx_ctx_gdi_set_video_mode, + gfx_ctx_gdi_get_video_size, + NULL, /* get_video_output_size */ + NULL, /* get_video_output_prev */ + NULL, /* get_video_output_next */ + gfx_ctx_gdi_get_metrics, + NULL, + gfx_ctx_gdi_update_window_title, + gfx_ctx_gdi_check_window, + gfx_ctx_gdi_set_resize, + gfx_ctx_gdi_has_focus, + gfx_ctx_gdi_suppress_screensaver, + gfx_ctx_gdi_has_windowed, + gfx_ctx_gdi_swap_buffers, + gfx_ctx_gdi_input_driver, + NULL, + NULL, + NULL, + gfx_ctx_gdi_show_mouse, + "gdi", + gfx_ctx_gdi_get_flags, + gfx_ctx_gdi_set_flags, + NULL, + NULL, + NULL +}; + diff --git a/gfx/drivers_context/gfx_null_ctx.c b/gfx/drivers_context/gfx_null_ctx.c index 36078d774a..ff51ea6de4 100644 --- a/gfx/drivers_context/gfx_null_ctx.c +++ b/gfx/drivers_context/gfx_null_ctx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -25,9 +25,8 @@ static void gfx_ctx_null_swap_interval(void *data, unsigned interval) } static void gfx_ctx_null_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) + bool *resize, unsigned *width, unsigned *height, bool is_shutdown) { - (void)frame_count; (void)data; (void)quit; (void)width; @@ -35,25 +34,11 @@ static void gfx_ctx_null_check_window(void *data, bool *quit, (void)resize; } -static void gfx_ctx_null_swap_buffers(void *data, video_frame_info_t video_info) +static void gfx_ctx_null_swap_buffers(void *data, video_frame_info_t *video_info) { (void)data; } -static bool gfx_ctx_null_set_resize(void *data, unsigned width, unsigned height) -{ - (void)data; - (void)width; - (void)height; - return false; -} - -static void gfx_ctx_null_update_window_title(void *data, video_frame_info_t video_info) -{ - (void)data; - (void)video_info; -} - static void gfx_ctx_null_get_video_size(void *data, unsigned *width, unsigned *height) { (void)data; @@ -62,7 +47,7 @@ static void gfx_ctx_null_get_video_size(void *data, unsigned *width, unsigned *h } static bool gfx_ctx_null_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -79,7 +64,9 @@ static void gfx_ctx_null_destroy(void *data) (void)data; } -static void gfx_ctx_null_input_driver(void *data, const input_driver_t **input, void **input_data) +static void gfx_ctx_null_input_driver(void *data, + const char *name, + const input_driver_t **input, void **input_data) { (void)data; (void)input; @@ -99,12 +86,6 @@ static bool gfx_ctx_null_suppress_screensaver(void *data, bool enable) return false; } -static bool gfx_ctx_null_has_windowed(void *data) -{ - (void)data; - return true; -} - static bool gfx_ctx_null_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor) { (void)data; @@ -127,7 +108,7 @@ static void gfx_ctx_null_bind_hw_render(void *data, bool enable) (void)enable; } -static void *gfx_ctx_null_init(video_frame_info_t video_info, void *video_driver) +static void *gfx_ctx_null_init(video_frame_info_t *video_info, void *video_driver) { (void)video_driver; @@ -159,12 +140,12 @@ const gfx_ctx_driver_t gfx_ctx_null = { NULL, /* get_video_output_next */ NULL, /* get_metrics */ NULL, - gfx_ctx_null_update_window_title, + NULL, /* update_title */ gfx_ctx_null_check_window, - gfx_ctx_null_set_resize, + NULL, /* set_resize */ gfx_ctx_null_has_focus, gfx_ctx_null_suppress_screensaver, - gfx_ctx_null_has_windowed, + NULL, /* has_windowed */ gfx_ctx_null_swap_buffers, gfx_ctx_null_input_driver, NULL, diff --git a/gfx/drivers_context/khr_display_ctx.c b/gfx/drivers_context/khr_display_ctx.c index ced55e6b33..d5d72c59c7 100644 --- a/gfx/drivers_context/khr_display_ctx.c +++ b/gfx/drivers_context/khr_display_ctx.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2016 - Hans-Kristian Arntzen + * Copyright (C) 2016-2017 - Hans-Kristian Arntzen * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -17,7 +17,6 @@ #include "../../config.h" #endif -#include "../../runloop.h" #include "../../frontend/frontend_driver.h" #include "../common/vulkan_common.h" @@ -52,7 +51,7 @@ static void gfx_ctx_khr_display_get_video_size(void *data, *height = khr->height; } -static void *gfx_ctx_khr_display_init(video_frame_info_t video_info, void *video_driver) +static void *gfx_ctx_khr_display_init(video_frame_info_t *video_info, void *video_driver) { khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)calloc(1, sizeof(*khr)); if (!khr) @@ -74,10 +73,9 @@ error: } static void gfx_ctx_khr_display_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) + bool *resize, unsigned *width, unsigned *height, bool is_shutdown) { khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data; - (void)frame_count; *resize = khr->vk.need_new_swapchain; @@ -88,7 +86,7 @@ static void gfx_ctx_khr_display_check_window(void *data, bool *quit, *resize = true; } - if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL) || (bool)frontend_driver_get_signal_handler_state()) + if (is_shutdown || (bool)frontend_driver_get_signal_handler_state()) *quit = true; } @@ -110,21 +108,8 @@ static bool gfx_ctx_khr_display_set_resize(void *data, return false; } -static void gfx_ctx_khr_display_update_window_title(void *data, video_frame_info_t video_info) -{ - char buf[128]; - char buf_fps[128]; - - buf[0] = buf_fps[0] = '\0'; - - video_monitor_get_fps(video_info, buf, sizeof(buf), - buf_fps, sizeof(buf_fps)); - if (video_info.fps_show) - runloop_msg_queue_push(buf_fps, 1, 1, false); -} - static bool gfx_ctx_khr_display_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -155,10 +140,10 @@ error: } static void gfx_ctx_khr_display_input_driver(void *data, + const char *name, const input_driver_t **input, void **input_data) { - (void)data; - *input = NULL; + *input = NULL; *input_data = NULL; } @@ -184,12 +169,6 @@ static bool gfx_ctx_khr_display_suppress_screensaver(void *data, bool enable) return false; } -static bool gfx_ctx_khr_display_has_windowed(void *data) -{ - (void)data; - return false; -} - static void gfx_ctx_khr_display_set_swap_interval(void *data, unsigned swap_interval) { khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data; @@ -201,7 +180,7 @@ static void gfx_ctx_khr_display_set_swap_interval(void *data, unsigned swap_inte } } -static void gfx_ctx_khr_display_swap_buffers(void *data, video_frame_info_t video_info) +static void gfx_ctx_khr_display_swap_buffers(void *data, video_frame_info_t *video_info) { khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data; vulkan_present(&khr->vk, khr->vk.context.current_swapchain_index); @@ -243,12 +222,12 @@ const gfx_ctx_driver_t gfx_ctx_khr_display = { NULL, /* get_video_output_next */ NULL, /* get_metrics */ NULL, - gfx_ctx_khr_display_update_window_title, + NULL, /* update_title */ gfx_ctx_khr_display_check_window, gfx_ctx_khr_display_set_resize, gfx_ctx_khr_display_has_focus, gfx_ctx_khr_display_suppress_screensaver, - gfx_ctx_khr_display_has_windowed, + NULL, /* has_windowed */ gfx_ctx_khr_display_swap_buffers, gfx_ctx_khr_display_input_driver, gfx_ctx_khr_display_get_proc_address, diff --git a/gfx/drivers_context/mali_fbdev_ctx.c b/gfx/drivers_context/mali_fbdev_ctx.c index 475ba08255..1b7110d836 100644 --- a/gfx/drivers_context/mali_fbdev_ctx.c +++ b/gfx/drivers_context/mali_fbdev_ctx.c @@ -37,7 +37,6 @@ #endif #include "../../frontend/frontend_driver.h" -#include "../../runloop.h" typedef struct { @@ -87,7 +86,7 @@ static void gfx_ctx_mali_fbdev_get_video_size(void *data, *height = mali->height; } -static void *gfx_ctx_mali_fbdev_init(video_frame_info_t video_info, void *video_driver) +static void *gfx_ctx_mali_fbdev_init(video_frame_info_t *video_info, void *video_driver) { #ifdef HAVE_EGL EGLint n; @@ -131,12 +130,10 @@ error: } static void gfx_ctx_mali_fbdev_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) + bool *resize, unsigned *width, unsigned *height, bool is_shutdown) { unsigned new_width, new_height; - (void)frame_count; - gfx_ctx_mali_fbdev_get_video_size(data, &new_width, &new_height); if (new_width != *width || new_height != *height) @@ -149,30 +146,8 @@ static void gfx_ctx_mali_fbdev_check_window(void *data, bool *quit, *quit = (bool)frontend_driver_get_signal_handler_state(); } -static bool gfx_ctx_mali_fbdev_set_resize(void *data, - unsigned width, unsigned height) -{ - (void)data; - (void)width; - (void)height; - return false; -} - -static void gfx_ctx_mali_fbdev_update_window_title(void *data, video_frame_info_t video_info) -{ - char buf[128]; - char buf_fps[128]; - - buf[0] = buf_fps[0] = '\0'; - - video_monitor_get_fps(video_info, buf, sizeof(buf), - buf_fps, sizeof(buf_fps)); - if (video_info.fps_show) - runloop_msg_queue_push(buf_fps, 1, 1, false); -} - static bool gfx_ctx_mali_fbdev_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -226,10 +201,10 @@ error: } static void gfx_ctx_mali_fbdev_input_driver(void *data, + const char *name, const input_driver_t **input, void **input_data) { - (void)data; - *input = NULL; + *input = NULL; *input_data = NULL; } @@ -254,12 +229,6 @@ static bool gfx_ctx_mali_fbdev_suppress_screensaver(void *data, bool enable) return false; } -static bool gfx_ctx_mali_fbdev_has_windowed(void *data) -{ - (void)data; - return false; -} - static void gfx_ctx_mali_fbdev_set_swap_interval(void *data, unsigned swap_interval) { mali_ctx_data_t *mali = (mali_ctx_data_t*)data; @@ -269,7 +238,7 @@ static void gfx_ctx_mali_fbdev_set_swap_interval(void *data, unsigned swap_inter #endif } -static void gfx_ctx_mali_fbdev_swap_buffers(void *data, video_frame_info_t video_info) +static void gfx_ctx_mali_fbdev_swap_buffers(void *data, video_frame_info_t *video_info) { mali_ctx_data_t *mali = (mali_ctx_data_t*)data; @@ -319,12 +288,12 @@ const gfx_ctx_driver_t gfx_ctx_mali_fbdev = { NULL, /* get_video_output_next */ NULL, /* get_metrics */ NULL, - gfx_ctx_mali_fbdev_update_window_title, + NULL, /* update_title */ gfx_ctx_mali_fbdev_check_window, - gfx_ctx_mali_fbdev_set_resize, + NULL, /* set_resize */ gfx_ctx_mali_fbdev_has_focus, gfx_ctx_mali_fbdev_suppress_screensaver, - gfx_ctx_mali_fbdev_has_windowed, + NULL, /* has_windowed */ gfx_ctx_mali_fbdev_swap_buffers, gfx_ctx_mali_fbdev_input_driver, gfx_ctx_mali_fbdev_get_proc_address, diff --git a/gfx/drivers_context/opendingux_fbdev_ctx.c b/gfx/drivers_context/opendingux_fbdev_ctx.c index 141b3ad54f..3af8154f97 100644 --- a/gfx/drivers_context/opendingux_fbdev_ctx.c +++ b/gfx/drivers_context/opendingux_fbdev_ctx.c @@ -29,7 +29,6 @@ #endif #include "../../frontend/frontend_driver.h" -#include "../../runloop.h" typedef struct { @@ -56,7 +55,7 @@ static void gfx_ctx_opendingux_destroy(void *data) } } -static void *gfx_ctx_opendingux_init(video_frame_info_t video_info, void *video_driver) +static void *gfx_ctx_opendingux_init(video_frame_info_t *video_info, void *video_driver) { #ifdef HAVE_EGL EGLint n; @@ -113,7 +112,7 @@ static void gfx_ctx_opendingux_get_video_size(void *data, } static void gfx_ctx_opendingux_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) + bool *resize, unsigned *width, unsigned *height, bool is_shutdown) { unsigned new_width, new_height; opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data; @@ -132,30 +131,8 @@ static void gfx_ctx_opendingux_check_window(void *data, bool *quit, *quit = (bool)frontend_driver_get_signal_handler_state(); } -static bool gfx_ctx_opendingux_set_resize(void *data, - unsigned width, unsigned height) -{ - (void)data; - (void)width; - (void)height; - return false; -} - -static void gfx_ctx_opendingux_update_window_title(void *data, video_frame_info_t video_info) -{ - char buf[128]; - char buf_fps[128]; - - buf[0] = buf_fps[0] = '\0'; - - video_monitor_get_fps(video_info, buf, sizeof(buf), - buf_fps, sizeof(buf_fps)); - if (video_info.fps_show) - runloop_msg_queue_push(buf_fps, 1, 1, false); -} - static bool gfx_ctx_opendingux_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -199,10 +176,10 @@ error: } static void gfx_ctx_opendingux_input_driver(void *data, + const char *name, const input_driver_t **input, void **input_data) { - (void)data; - *input = NULL; + *input = NULL; *input_data = NULL; } @@ -226,13 +203,7 @@ static bool gfx_ctx_opendingux_suppress_screensaver(void *data, bool enable) return false; } -static bool gfx_ctx_opendingux_has_windowed(void *data) -{ - (void)data; - return false; -} - -static void gfx_ctx_opendingux_swap_buffers(void *data, video_frame_info_t video_info) +static void gfx_ctx_opendingux_swap_buffers(void *data, video_frame_info_t *video_info) { opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data; @@ -292,12 +263,12 @@ const gfx_ctx_driver_t gfx_ctx_opendingux_fbdev = { NULL, /* get_video_output_next */ NULL, /* get_metrics */ NULL, - gfx_ctx_opendingux_update_window_title, + NULL, /* update_title */ gfx_ctx_opendingux_check_window, - gfx_ctx_opendingux_set_resize, + NULL, /* set_resize */ gfx_ctx_opendingux_has_focus, gfx_ctx_opendingux_suppress_screensaver, - gfx_ctx_opendingux_has_windowed, + NULL, /* has_windowed */ gfx_ctx_opendingux_swap_buffers, gfx_ctx_opendingux_input_driver, gfx_ctx_opendingux_get_proc_address, diff --git a/gfx/drivers_context/osmesa_ctx.c b/gfx/drivers_context/osmesa_ctx.c index 24caa0ab61..00055a7249 100644 --- a/gfx/drivers_context/osmesa_ctx.c +++ b/gfx/drivers_context/osmesa_ctx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Higor Euripedes + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -29,7 +30,7 @@ #include -#include "../../runloop.h" +#include "../../configuration.h" #include "../common/gl_common.h" #if (OSMESA_MAJOR_VERSION * 1000 + OSMESA_MINOR_VERSION) >= 11002 @@ -54,7 +55,6 @@ typedef struct gfx_osmesa_ctx_data int height; int pixsize; - int frame_count; OSMesaContext ctx; int socket; int client; @@ -140,7 +140,7 @@ static void osmesa_fifo_write(gfx_ctx_osmesa_data_t *osmesa) } } -static void *osmesa_ctx_init(video_frame_info_t video_info, void *video_driver) +static void *osmesa_ctx_init(video_frame_info_t *video_info, void *video_driver) { #ifdef HAVE_OSMESA_CREATE_CONTEXT_ATTRIBS const int attribs[] = { @@ -238,7 +238,7 @@ static void osmesa_ctx_swap_interval(void *data, unsigned interval) } static bool osmesa_ctx_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -306,24 +306,9 @@ static void osmesa_ctx_get_video_size(void *data, *height = osmesa->height; } -static void osmesa_ctx_update_window_title(void *data, video_frame_info_t video_info) -{ - static char buf[128] = {0}; - static char buf_fps[128] = {0}; - gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data; - - if (!osmesa) - return; - - video_monitor_get_fps(video_info, buf, - sizeof(buf), buf_fps, sizeof(buf_fps)); - - if (video_info.fps_show) - runloop_msg_queue_push(buf_fps, 1, 1, false); -} - -static void osmesa_ctx_check_window(void *data, bool *quit, bool *resize,unsigned *width, - unsigned *height, unsigned frame_count) +static void osmesa_ctx_check_window(void *data, bool *quit, + bool *resize,unsigned *width, + unsigned *height, bool is_shutdown) { gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data; @@ -331,15 +316,6 @@ static void osmesa_ctx_check_window(void *data, bool *quit, bool *resize,unsigne *height = osmesa->height; *resize = false; *quit = false; - osmesa->frame_count = frame_count; -} - -static bool osmesa_ctx_set_resize(void *data, unsigned width, unsigned height) -{ - (void)data; - (void)width; - (void)height; - return false; } static bool osmesa_ctx_has_focus(void *data) @@ -361,7 +337,7 @@ static bool osmesa_ctx_has_windowed(void *data) return true; } -static void osmesa_ctx_swap_buffers(void *data, video_frame_info_t video_info) +static void osmesa_ctx_swap_buffers(void *data, video_frame_info_t *video_info) { gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data; osmesa_fifo_accept(osmesa); @@ -372,9 +348,10 @@ static void osmesa_ctx_swap_buffers(void *data, video_frame_info_t video_info) #endif } -static void osmesa_ctx_input_driver(void *data, const input_driver_t **input, void **input_data) +static void osmesa_ctx_input_driver(void *data, + const char *name, + const input_driver_t **input, void **input_data) { - (void)data; *input = NULL; *input_data = NULL; } @@ -416,9 +393,9 @@ const gfx_ctx_driver_t gfx_ctx_osmesa = NULL, /* get_video_output_next */ NULL, /* get_metrics */ NULL, /* translate_aspect */ - osmesa_ctx_update_window_title, + NULL, /* update_title */ osmesa_ctx_check_window, - osmesa_ctx_set_resize, + NULL, /* set_resize */ osmesa_ctx_has_focus, osmesa_ctx_suppress_screensaver, osmesa_ctx_has_windowed, diff --git a/gfx/drivers_context/ps3_ctx.c b/gfx/drivers_context/ps3_ctx.c index 5a63a57054..fb3af25cdb 100644 --- a/gfx/drivers_context/ps3_ctx.c +++ b/gfx/drivers_context/ps3_ctx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -31,7 +31,6 @@ #endif #include "../../configuration.h" -#include "../../runloop.h" #include "../../defines/ps3_defines.h" #include "../common/gl_common.h" #include "../video_context_driver.h" @@ -149,12 +148,13 @@ static void gfx_ctx_ps3_set_swap_interval(void *data, unsigned interval) } static void gfx_ctx_ps3_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) + bool *resize, unsigned *width, unsigned *height, + bool is_shutdown) { gl_t *gl = data; - *quit = false; - *resize = false; + *quit = false; + *resize = false; if (gl->should_resize) *resize = true; @@ -173,13 +173,7 @@ static bool gfx_ctx_ps3_suppress_screensaver(void *data, bool enable) return false; } -static bool gfx_ctx_ps3_has_windowed(void *data) -{ - (void)data; - return false; -} - -static void gfx_ctx_ps3_swap_buffers(void *data, video_frame_info_t video_info) +static void gfx_ctx_ps3_swap_buffers(void *data, video_frame_info_t *video_info) { (void)data; #ifdef HAVE_LIBDBGFONT @@ -193,27 +187,6 @@ static void gfx_ctx_ps3_swap_buffers(void *data, video_frame_info_t video_info) #endif } -static bool gfx_ctx_ps3_set_resize(void *data, - unsigned width, unsigned height) -{ - return false; -} - -static void gfx_ctx_ps3_update_window_title(void *data, video_frame_info_t video_info) -{ - char buf[128]; - char buf_fps[128]; - - buf[0] = buf_fps[0] = '\0'; - - (void)data; - - video_monitor_get_fps(video_info, buf, sizeof(buf), - buf_fps, sizeof(buf_fps)); - if (video_info.fps_show) - runloop_msg_queue_push(buf_fps, 1, 1, false); -} - static void gfx_ctx_ps3_get_video_size(void *data, unsigned *width, unsigned *height) { @@ -225,7 +198,7 @@ static void gfx_ctx_ps3_get_video_size(void *data, #endif } -static void *gfx_ctx_ps3_init(video_frame_info_t video_info, void *video_driver) +static void *gfx_ctx_ps3_init(video_frame_info_t *video_info, void *video_driver) { #ifdef HAVE_PSGL PSGLdeviceParameters params; @@ -302,15 +275,10 @@ static void *gfx_ctx_ps3_init(video_frame_info_t video_info, void *video_driver) } static bool gfx_ctx_ps3_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { - global_t *global = global_get_ptr(); - - if (!global) - return false; - return true; } @@ -339,10 +307,10 @@ static void gfx_ctx_ps3_destroy(void *data) } static void gfx_ctx_ps3_input_driver(void *data, + const char *joypad_name, const input_driver_t **input, void **input_data) { - settings_t *settings = config_get_ptr(); - void *ps3input = input_ps3.init(settings->input.joypad_driver); + void *ps3input = input_ps3.init(joypad_name); *input = ps3input ? &input_ps3 : NULL; *input_data = ps3input; @@ -438,12 +406,12 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = { gfx_ctx_ps3_get_video_output_next, NULL, /* get_metrics */ NULL, - gfx_ctx_ps3_update_window_title, + NULL, /* update_title */ gfx_ctx_ps3_check_window, - gfx_ctx_ps3_set_resize, + NULL, /* set_resize */ gfx_ctx_ps3_has_focus, gfx_ctx_ps3_suppress_screensaver, - gfx_ctx_ps3_has_windowed, + NULL, /* has_windowed */ gfx_ctx_ps3_swap_buffers, gfx_ctx_ps3_input_driver, NULL, diff --git a/gfx/drivers_context/qnx_ctx.c b/gfx/drivers_context/qnx_ctx.c index 6e3060a904..3ac5c734fb 100644 --- a/gfx/drivers_context/qnx_ctx.c +++ b/gfx/drivers_context/qnx_ctx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -45,7 +45,6 @@ #endif #include "../../configuration.h" -#include "../../runloop.h" #define WINDOW_BUFFERS 2 @@ -72,7 +71,7 @@ static void gfx_ctx_qnx_destroy(void *data) free(data); } -static void *gfx_ctx_qnx_init(video_frame_info_t video_info, void *video_driver) +static void *gfx_ctx_qnx_init(video_frame_info_t *video_info, void *video_driver) { EGLint n; EGLint major, minor; @@ -284,14 +283,12 @@ static void gfx_ctx_qnx_get_video_size(void *data, } static void gfx_ctx_qnx_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) + bool *resize, unsigned *width, unsigned *height, + bool is_shutdown) { unsigned new_width, new_height; qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data; - (void)data; - (void)frame_count; - *quit = false; #ifdef HAVE_EGL @@ -306,34 +303,12 @@ static void gfx_ctx_qnx_check_window(void *data, bool *quit, } /* Check if we are exiting. */ - if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL)) + if (is_shutdown) *quit = true; } -static bool gfx_ctx_qnx_set_resize(void *data, - unsigned width, unsigned height) -{ - (void)data; - (void)width; - (void)height; - return false; -} - -static void gfx_ctx_qnx_update_window_title(void *data, video_frame_info_t video_info) -{ - char buf[128]; - char buf_fps[128]; - - buf[0] = buf_fps[0] = '\0'; - - video_monitor_get_fps(buf, sizeof(buf), - buf_fps, sizeof(buf_fps)); - if (video_info.fps_show) - runloop_msg_queue_push(buf_fps, 1, 1, false); -} - static bool gfx_ctx_qnx_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -346,10 +321,10 @@ static bool gfx_ctx_qnx_set_video_mode(void *data, static void gfx_ctx_qnx_input_driver(void *data, + const char *joypad_name, const input_driver_t **input, void **input_data) { - settings_t *settings = config_get_ptr(); - void *qnxinput = input_qnx.init(settings->input.joypad_driver); + void *qnxinput = input_qnx.init(joypad_name); *input = qnxinput ? &input_qnx : NULL; *input_data = qnxinput; @@ -375,12 +350,6 @@ static bool gfx_ctx_qnx_suppress_screensaver(void *data, bool enable) return false; } -static bool gfx_ctx_qnx_has_windowed(void *data) -{ - (void)data; - return false; -} - static int dpi_get_density(qnx_ctx_data_t *qnx) { int screen_dpi[2]; @@ -444,7 +413,7 @@ static void gfx_ctx_qnx_set_swap_interval(void *data, unsigned swap_interval) #endif } -static void gfx_ctx_qnx_swap_buffers(void *data, video_frame_info_t video_info) +static void gfx_ctx_qnx_swap_buffers(void *data, video_frame_info_t *video_info) { qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data; @@ -493,12 +462,12 @@ const gfx_ctx_driver_t gfx_ctx_qnx = { NULL, /* get_video_output_next */ gfx_ctx_qnx__get_metrics, NULL, - gfx_ctx_qnx_update_window_title, + NULL, /* update_title */ gfx_ctx_qnx_check_window, - gfx_ctx_qnx_set_resize, + NULL, /* set_resize */ gfx_ctx_qnx_has_focus, gfx_ctx_qnx_suppress_screensaver, - gfx_ctx_qnx_has_windowed, + NULL, /* has_windowed */ gfx_ctx_qnx_swap_buffers, gfx_ctx_qnx_input_driver, gfx_ctx_qnx_get_proc_address, diff --git a/gfx/drivers_context/sdl_gl_ctx.c b/gfx/drivers_context/sdl_gl_ctx.c index 2fa338cc1b..ae0e05c1fb 100644 --- a/gfx/drivers_context/sdl_gl_ctx.c +++ b/gfx/drivers_context/sdl_gl_ctx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -25,7 +25,6 @@ #endif #include "../../configuration.h" -#include "../../runloop.h" #include "../common/gl_common.h" static enum gfx_ctx_api sdl_api = GFX_CTX_OPENGL_API; @@ -42,7 +41,6 @@ typedef struct gfx_ctx_sdl_data bool g_full; bool g_resized; - int g_frame_count; #ifdef HAVE_SDL2 SDL_Window *g_win; SDL_GLContext g_ctx; @@ -73,7 +71,7 @@ static void sdl_ctx_destroy_resources(gfx_ctx_sdl_data_t *sdl) SDL_QuitSubSystem(SDL_INIT_VIDEO); } -static void *sdl_ctx_init(video_frame_info_t video_info, void *video_driver) +static void *sdl_ctx_init(video_frame_info_t *video_info, void *video_driver) { gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*) calloc(1, sizeof(gfx_ctx_sdl_data_t)); @@ -163,7 +161,7 @@ static void sdl_ctx_swap_interval(void *data, unsigned interval) } static bool sdl_ctx_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -177,7 +175,7 @@ static bool sdl_ctx_set_video_mode(void *data, if (fullscreen) { - if (video_info.windowed_fullscreen) + if (video_info->windowed_fullscreen) fsflag = SDL_WINDOW_FULLSCREEN_DESKTOP; else fsflag = SDL_WINDOW_FULLSCREEN; @@ -192,7 +190,7 @@ static bool sdl_ctx_set_video_mode(void *data, } else { - unsigned display = video_info.monitor_index; + unsigned display = video_info->monitor_index; sdl->g_win = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED_DISPLAY(display), SDL_WINDOWPOS_UNDEFINED_DISPLAY(display), @@ -268,31 +266,29 @@ static void sdl_ctx_get_video_size(void *data, } } -static void sdl_ctx_update_window_title(void *data, video_frame_info_t video_info) +static void sdl_ctx_update_title(void *data, video_frame_info_t *video_info) { - char buf[128]; - char buf_fps[128]; + char title[128]; - buf[0] = buf_fps[0] = '\0'; + title[0] = '\0'; + + video_driver_get_window_title(title, sizeof(title)); - if (video_monitor_get_fps(video_info, buf, sizeof(buf), - buf_fps, sizeof(buf_fps))) - { #ifdef HAVE_SDL2 - gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data; - if (sdl) - SDL_SetWindowTitle(sdl->g_win, buf); -#else - SDL_WM_SetCaption(buf, NULL); -#endif - } + gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data; - if (video_info.fps_show) - runloop_msg_queue_push(buf_fps, 1, 1, false); + if (sdl && title[0]) + SDL_SetWindowTitle(sdl->g_win, title); +#else + if (title[0]) + SDL_WM_SetCaption(title, NULL); +#endif } -static void sdl_ctx_check_window(void *data, bool *quit, bool *resize,unsigned *width, - unsigned *height, unsigned frame_count) +static void sdl_ctx_check_window(void *data, bool *quit, + bool *resize,unsigned *width, + unsigned *height, + bool is_shutdown) { SDL_Event event; gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data; @@ -340,16 +336,6 @@ static void sdl_ctx_check_window(void *data, bool *quit, bool *resize,unsigned * *resize = true; sdl->g_resized = false; } - - sdl->g_frame_count = frame_count; -} - -static bool sdl_ctx_set_resize(void *data, unsigned width, unsigned height) -{ - (void)data; - (void)width; - (void)height; - return false; } static bool sdl_ctx_has_focus(void *data) @@ -379,7 +365,7 @@ static bool sdl_ctx_has_windowed(void *data) return true; } -static void sdl_ctx_swap_buffers(void *data, video_frame_info_t video_info) +static void sdl_ctx_swap_buffers(void *data, video_frame_info_t *video_info) { #ifdef HAVE_SDL2 gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data; @@ -391,10 +377,11 @@ static void sdl_ctx_swap_buffers(void *data, video_frame_info_t video_info) (void)data; } -static void sdl_ctx_input_driver(void *data, const input_driver_t **input, void **input_data) +static void sdl_ctx_input_driver(void *data, + const char *name, + const input_driver_t **input, void **input_data) { - (void)data; - *input = NULL; + *input = NULL; *input_data = NULL; } @@ -434,9 +421,9 @@ const gfx_ctx_driver_t gfx_ctx_sdl_gl = NULL, /* get_video_output_next */ NULL, /* get_metrics */ NULL, /* translate_aspect */ - sdl_ctx_update_window_title, + sdl_ctx_update_title, sdl_ctx_check_window, - sdl_ctx_set_resize, + NULL, /* set_resize */ sdl_ctx_has_focus, sdl_ctx_suppress_screensaver, sdl_ctx_has_windowed, diff --git a/gfx/drivers_context/vc_egl_ctx.c b/gfx/drivers_context/vc_egl_ctx.c index d5f9b3f8a3..a9fa66f247 100644 --- a/gfx/drivers_context/vc_egl_ctx.c +++ b/gfx/drivers_context/vc_egl_ctx.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -31,7 +32,6 @@ #include #include "../../configuration.h" -#include "../../runloop.h" #include "../video_context_driver.h" #include "../../frontend/frontend_driver.h" @@ -86,10 +86,10 @@ static INLINE bool gfx_ctx_vc_egl_query_extension(vc_ctx_data_t *vc, const char } static void gfx_ctx_vc_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) + bool *resize, unsigned *width, unsigned *height, + bool is_shutdown) { (void)data; - (void)frame_count; (void)width; (void)height; @@ -97,27 +97,6 @@ static void gfx_ctx_vc_check_window(void *data, bool *quit, *quit = (bool)frontend_driver_get_signal_handler_state(); } -static bool gfx_ctx_vc_set_resize(void *data, unsigned width, unsigned height) -{ - (void)data; - (void)width; - (void)height; - return false; -} - -static void gfx_ctx_vc_update_window_title(void *data, video_frame_info_t video_info) -{ - char buf[128]; - char buf_fps[128]; - - buf[0] = buf_fps[0] = '\0'; - - video_monitor_get_fps(video_info, buf, sizeof(buf), - buf_fps, sizeof(buf_fps)); - if (video_info.fps_show) - runloop_msg_queue_push(buf_fps, 1, 1, false); -} - static void gfx_ctx_vc_get_video_size(void *data, unsigned *width, unsigned *height) { @@ -157,7 +136,7 @@ static void gfx_ctx_vc_get_video_size(void *data, static void gfx_ctx_vc_destroy(void *data); -static void *gfx_ctx_vc_init(video_frame_info_t video_info, void *video_driver) +static void *gfx_ctx_vc_init(video_frame_info_t *video_info, void *video_driver) { VC_DISPMANX_ALPHA_T alpha; EGLint n, major, minor; @@ -319,7 +298,7 @@ static void gfx_ctx_vc_set_swap_interval(void *data, unsigned swap_interval) } static bool gfx_ctx_vc_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -451,10 +430,10 @@ static void gfx_ctx_vc_destroy(void *data) } static void gfx_ctx_vc_input_driver(void *data, + const char *name, const input_driver_t **input, void **input_data) { - (void)data; - *input = NULL; + *input = NULL; *input_data = NULL; } @@ -471,12 +450,6 @@ static bool gfx_ctx_vc_suppress_screensaver(void *data, bool enable) return false; } -static bool gfx_ctx_vc_has_windowed(void *data) -{ - (void)data; - return false; -} - static float gfx_ctx_vc_translate_aspect(void *data, unsigned width, unsigned height) { @@ -608,7 +581,7 @@ error: return false; } -static void gfx_ctx_vc_swap_buffers(void *data, video_frame_info_t video_info) +static void gfx_ctx_vc_swap_buffers(void *data, video_frame_info_t *video_info) { vc_ctx_data_t *vc = (vc_ctx_data_t*)data; @@ -659,12 +632,12 @@ const gfx_ctx_driver_t gfx_ctx_videocore = { NULL, /* get_video_output_next */ NULL, /* get_metrics */ gfx_ctx_vc_translate_aspect, - gfx_ctx_vc_update_window_title, + NULL, /* update_title */ gfx_ctx_vc_check_window, - gfx_ctx_vc_set_resize, + NULL, /* set_resize */ gfx_ctx_vc_has_focus, gfx_ctx_vc_suppress_screensaver, - gfx_ctx_vc_has_windowed, + NULL, /* has_windowed */ gfx_ctx_vc_swap_buffers, gfx_ctx_vc_input_driver, gfx_ctx_vc_get_proc_address, diff --git a/gfx/drivers_context/vivante_fbdev_ctx.c b/gfx/drivers_context/vivante_fbdev_ctx.c index e85009b642..88a9edb0e7 100644 --- a/gfx/drivers_context/vivante_fbdev_ctx.c +++ b/gfx/drivers_context/vivante_fbdev_ctx.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011 2017 - Daniel De Matteis * Copyright (C) 2014 2015 - Jean-Andre Santoni * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -29,7 +30,6 @@ #endif #include "../../frontend/frontend_driver.h" -#include "../../runloop.h" typedef struct { @@ -58,7 +58,7 @@ static void gfx_ctx_vivante_destroy(void *data) } -static void *gfx_ctx_vivante_init(video_frame_info_t video_info, void *video_driver) +static void *gfx_ctx_vivante_init(video_frame_info_t *video_info, void *video_driver) { #ifdef HAVE_EGL EGLint n; @@ -117,7 +117,8 @@ static void gfx_ctx_vivante_get_video_size(void *data, } static void gfx_ctx_vivante_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) + bool *resize, unsigned *width, unsigned *height, + bool is_shutdown) { unsigned new_width, new_height; vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data; @@ -136,30 +137,8 @@ static void gfx_ctx_vivante_check_window(void *data, bool *quit, *quit = (bool)frontend_driver_get_signal_handler_state(); } -static bool gfx_ctx_vivante_set_resize(void *data, - unsigned width, unsigned height) -{ - (void)data; - (void)width; - (void)height; - return false; -} - -static void gfx_ctx_vivante_update_window_title(void *data, video_frame_info_t video_info) -{ - char buf[128]; - char buf_fps[128]; - - buf[0] = buf_fps[0] = '\0'; - - video_monitor_get_fps(video_info, buf, sizeof(buf), - buf_fps, sizeof(buf_fps)); - if (video_info.fps_show) - runloop_msg_queue_push(buf_fps, 1, 1, false); -} - static bool gfx_ctx_vivante_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -204,10 +183,10 @@ error: } static void gfx_ctx_vivante_input_driver(void *data, + const char *name, const input_driver_t **input, void **input_data) { - (void)data; - *input = NULL; + *input = NULL; *input_data = NULL; } @@ -231,12 +210,6 @@ static bool gfx_ctx_vivante_suppress_screensaver(void *data, bool enable) return false; } -static bool gfx_ctx_vivante_has_windowed(void *data) -{ - (void)data; - return false; -} - static void gfx_ctx_vivante_set_swap_interval(void *data, unsigned swap_interval) { vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data; @@ -246,7 +219,7 @@ static void gfx_ctx_vivante_set_swap_interval(void *data, unsigned swap_interval #endif } -static void gfx_ctx_vivante_swap_buffers(void *data, video_frame_info_t video_info) +static void gfx_ctx_vivante_swap_buffers(void *data, video_frame_info_t *video_info) { vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data; @@ -297,12 +270,12 @@ const gfx_ctx_driver_t gfx_ctx_vivante_fbdev = { NULL, /* get_video_output_next */ NULL, /* get_metrics */ NULL, - gfx_ctx_vivante_update_window_title, + NULL, /* update_title */ gfx_ctx_vivante_check_window, - gfx_ctx_vivante_set_resize, + NULL, /* set_resize */ gfx_ctx_vivante_has_focus, gfx_ctx_vivante_suppress_screensaver, - gfx_ctx_vivante_has_windowed, + NULL, /* has_windowed */ gfx_ctx_vivante_swap_buffers, gfx_ctx_vivante_input_driver, gfx_ctx_vivante_get_proc_address, diff --git a/gfx/drivers_context/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index 9ec79438e5..acbf0e3001 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -42,9 +42,7 @@ #include "../common/gl_common.h" #endif -#include "../../configuration.h" #include "../../frontend/frontend_driver.h" -#include "../../runloop.h" #include "../../input/input_keyboard.h" #include "../../input/input_keymaps.h" #include "../../input/input_joypad_driver.h" @@ -645,13 +643,11 @@ static void flush_wayland_fd(gfx_ctx_wayland_data_t *wl) static void gfx_ctx_wl_check_window(void *data, bool *quit, bool *resize, unsigned *width, unsigned *height, - unsigned frame_count) + bool is_shutdown) { unsigned new_width, new_height; gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; - (void)frame_count; - flush_wayland_fd(wl); new_width = *width; @@ -720,20 +716,17 @@ static bool gfx_ctx_wl_set_resize(void *data, unsigned width, unsigned height) return true; } -static void gfx_ctx_wl_update_window_title(void *data, video_frame_info_t video_info) +static void gfx_ctx_wl_update_title(void *data, video_frame_info_t *video_info) { - char buf[128]; - char buf_fps[128]; gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; + char title[128]; - buf[0] = buf_fps[0] = '\0'; + title[0] = '\0'; - if (video_monitor_get_fps(video_info, buf, sizeof(buf), - buf_fps, sizeof(buf_fps))) - wl_shell_surface_set_title(wl->shell_surf, buf); + video_driver_get_window_title(title, sizeof(title)); - if (video_info.fps_show) - runloop_msg_queue_push(buf_fps, 1, 1, false); + if (wl && title[0]) + wl_shell_surface_set_title(wl->shell_surf, title); } @@ -780,7 +773,7 @@ static bool gfx_ctx_wl_get_metrics(void *data, EGL_DEPTH_SIZE, 0 #endif -static void *gfx_ctx_wl_init(video_frame_info_t video_info, void *video_driver) +static void *gfx_ctx_wl_init(video_frame_info_t *video_info, void *video_driver) { #ifdef HAVE_OPENGL static const EGLint egl_attribs_gl[] = { @@ -1076,7 +1069,7 @@ static void gfx_ctx_wl_set_swap_interval(void *data, unsigned swap_interval) } static bool gfx_ctx_wl_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -1365,13 +1358,18 @@ static void input_wl_free(void *data) wl->joypad->destroy(); } -static bool input_wl_init(void *data) +static bool input_wl_init(void *data, const char *joypad_name) { gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; - settings_t *settings = config_get_ptr(); - wl->joypad = input_joypad_init_driver(settings->input.joypad_driver, wl); + + if (!wl) + return false; + + wl->joypad = input_joypad_init_driver(joypad_name, wl); + if (!wl->joypad) return false; + input_keymaps_init_keyboard_lut(rarch_key_map_linux); return true; } @@ -1455,10 +1453,11 @@ static const input_driver_t input_wayland = { }; static void gfx_ctx_wl_input_driver(void *data, + const char *joypad_name, const input_driver_t **input, void **input_data) { /* Input is heavily tied to the window stuff on Wayland, so just implement the input driver here. */ - if (!input_wl_init(data)) + if (!input_wl_init(data, joypad_name)) { *input = NULL; *input_data = NULL; @@ -1552,7 +1551,7 @@ static void *gfx_ctx_wl_get_context_data(void *data) } #endif -static void gfx_ctx_wl_swap_buffers(void *data, video_frame_info_t video_info) +static void gfx_ctx_wl_swap_buffers(void *data, video_frame_info_t *video_info) { gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; @@ -1671,7 +1670,7 @@ const gfx_ctx_driver_t gfx_ctx_wayland = { NULL, /* get_video_output_next */ gfx_ctx_wl_get_metrics, NULL, - gfx_ctx_wl_update_window_title, + gfx_ctx_wl_update_title, gfx_ctx_wl_check_window, gfx_ctx_wl_set_resize, gfx_ctx_wl_has_focus, diff --git a/gfx/drivers_context/wgl_ctx.cpp b/gfx/drivers_context/wgl_ctx.cpp index fc6132dbe2..9d082947f1 100644 --- a/gfx/drivers_context/wgl_ctx.cpp +++ b/gfx/drivers_context/wgl_ctx.cpp @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -41,7 +41,6 @@ #include "../../configuration.h" #include "../../dynamic.h" -#include "../../runloop.h" #include "../video_context_driver.h" #include "../common/win32_common.h" @@ -312,7 +311,8 @@ static void gfx_ctx_wgl_swap_interval(void *data, unsigned interval) } static void gfx_ctx_wgl_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) + bool *resize, unsigned *width, unsigned *height, + bool is_shutdown) { win32_check_window(quit, resize, width, height); @@ -331,7 +331,7 @@ static void gfx_ctx_wgl_check_window(void *data, bool *quit, } } -static void gfx_ctx_wgl_swap_buffers(void *data, video_frame_info_t video_info) +static void gfx_ctx_wgl_swap_buffers(void *data, video_frame_info_t *video_info) { (void)data; @@ -386,19 +386,21 @@ static bool gfx_ctx_wgl_set_resize(void *data, return false; } -static void gfx_ctx_wgl_update_window_title(void *data, video_frame_info_t video_info) +static void gfx_ctx_wgl_update_title(void *data, video_frame_info_t *video_info) { - char buf[128]; - char buf_fps[128]; const ui_window_t *window = ui_companion_driver_get_window_ptr(); - buf[0] = buf_fps[0] = '\0'; + if (window) + { + char title[128]; - if (window && video_monitor_get_fps(video_info, buf, sizeof(buf), - buf_fps, sizeof(buf_fps))) - window->set_title(&main_window, buf); - if (video_info.fps_show) - runloop_msg_queue_push(buf_fps, 1, 1, false); + title[0] = '\0'; + + video_driver_get_window_title(title, sizeof(title)); + + if (title[0]) + window->set_title(&main_window, title); + } } static void gfx_ctx_wgl_get_video_size(void *data, @@ -426,7 +428,7 @@ static void gfx_ctx_wgl_get_video_size(void *data, } } -static void *gfx_ctx_wgl_init(video_frame_info_t video_info, void *video_driver) +static void *gfx_ctx_wgl_init(video_frame_info_t *video_info, void *video_driver) { WNDCLASSEX wndclass = {0}; @@ -525,7 +527,7 @@ static void gfx_ctx_wgl_destroy(void *data) } static bool gfx_ctx_wgl_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -559,10 +561,10 @@ error: static void gfx_ctx_wgl_input_driver(void *data, + const char *joypad_name, const input_driver_t **input, void **input_data) { - settings_t *settings = config_get_ptr(); - dinput_wgl = input_dinput.init(settings->input.joypad_driver); + dinput_wgl = input_dinput.init(joypad_name); *input = dinput_wgl ? &input_dinput : NULL; *input_data = dinput_wgl; @@ -687,7 +689,7 @@ const gfx_ctx_driver_t gfx_ctx_wgl = { NULL, /* get_video_output_next */ gfx_ctx_wgl_get_metrics, NULL, - gfx_ctx_wgl_update_window_title, + gfx_ctx_wgl_update_title, gfx_ctx_wgl_check_window, gfx_ctx_wgl_set_resize, gfx_ctx_wgl_has_focus, diff --git a/gfx/drivers_context/x_ctx.c b/gfx/drivers_context/x_ctx.c index 08d53d4d45..93c7a9d30d 100644 --- a/gfx/drivers_context/x_ctx.c +++ b/gfx/drivers_context/x_ctx.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -36,8 +36,6 @@ #endif -#include "../../configuration.h" - #include "../../frontend/frontend_driver.h" #include "../common/gl_common.h" #include "../common/x11_common.h" @@ -47,21 +45,28 @@ #endif #ifdef HAVE_OPENGL -static int (*g_pglSwapInterval)(int); -static int (*g_pglSwapIntervalSGI)(int); -static void (*g_pglSwapIntervalEXT)(Display*, GLXDrawable, int); -static Bool (*glXGetSyncValuesOML)(Display *dpy, GLXDrawable drawable, - int64_t *ust, int64_t *msc, int64_t *sbc); -static Bool (*glXGetMscRateOML)(Display *dpy, GLXDrawable drawable, int32_t *numerator, - int32_t *denominator); -static int64_t (*glXSwapBuffersMscOML)(Display *dpy, GLXDrawable drawable, - int64_t target_msc, int64_t divisor, - int64_t remainder); -static Bool (*glXWaitForMscOML)(Display *dpy, GLXDrawable drawable, int64_t target_msc, - int64_t divisor, int64_t remainder, int64_t *ust, - int64_t *msc, int64_t *sbc); -static Bool (*glXWaitForSbcOML)(Display *dpy, GLXDrawable drawable, int64_t target_sbc, - int64_t *ust, int64_t *msc, int64_t *sbc); +static int (*g_pglSwapInterval)(int); +static int (*g_pglSwapIntervalSGI)(int); +static void (*g_pglSwapIntervalEXT)(Display*, GLXDrawable, int); +typedef Bool (*GLXGETSYNCVALUESOMLPROC)(Display *dpy, GLXDrawable drawable, + int64_t *ust, int64_t *msc, int64_t *sbc); +typedef Bool (*GLXGETMSCRATEOMLPROC)(Display *dpy, GLXDrawable drawable, int32_t *numerator, + int32_t *denominator); +typedef int64_t (*GLXSWAPBUFFERSMSCOMLPROC)(Display *dpy, GLXDrawable drawable, + int64_t target_msc, int64_t divisor, + int64_t remainder); +typedef Bool (*GLXWAITFORMSCOMLPROC)(Display *dpy, GLXDrawable drawable, int64_t target_msc, + int64_t divisor, int64_t remainder, int64_t *ust, + int64_t *msc, int64_t *sbc); +typedef Bool (*GLXWAITFORSBCOMLPROC)(Display *dpy, GLXDrawable drawable, int64_t target_sbc, + int64_t *ust, int64_t *msc, int64_t *sbc); + +static GLXGETSYNCVALUESOMLPROC glXGetSyncValuesOML; +static GLXGETMSCRATEOMLPROC glXGetMscRateOML; +static GLXSWAPBUFFERSMSCOMLPROC glXSwapBuffersMscOML; +static GLXWAITFORMSCOMLPROC glXWaitForMscOML; +static GLXWAITFORSBCOMLPROC glXWaitForSbcOML; + #endif typedef struct gfx_ctx_x_data @@ -95,16 +100,15 @@ typedef struct gfx_ctx_x_data #endif } gfx_ctx_x_data_t; -static bool x_enable_msaa = false; -static unsigned g_major = 0; -static unsigned g_minor = 0; -static enum gfx_ctx_api x_api = GFX_CTX_NONE; +static bool x_enable_msaa = false; +static unsigned g_major = 0; +static unsigned g_minor = 0; +static enum gfx_ctx_api x_api = GFX_CTX_NONE; + +static gfx_ctx_x_data_t *current_context_data = NULL; #ifdef HAVE_OPENGL static PFNGLXCREATECONTEXTATTRIBSARBPROC glx_create_context_attribs; -#endif - -static gfx_ctx_x_data_t *current_context_data = NULL; static int GLXExtensionSupported(Display *dpy, const char *extension) { @@ -129,6 +133,7 @@ static int GLXExtensionSupported(Display *dpy, const char *extension) return 0; } +#endif static int x_nul_handler(Display *dpy, XErrorEvent *event) { @@ -297,7 +302,7 @@ static void gfx_ctx_x_swap_interval(void *data, unsigned interval) } } -static void gfx_ctx_x_swap_buffers(void *data, video_frame_info_t video_info) +static void gfx_ctx_x_swap_buffers(void *data, video_frame_info_t *video_info) { gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data; @@ -342,9 +347,11 @@ static void gfx_ctx_x_swap_buffers(void *data, video_frame_info_t video_info) } static void gfx_ctx_x_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height, unsigned frame_count) + bool *resize, unsigned *width, unsigned *height, + bool is_shutdown) { - x11_check_window(data, quit, resize, width, height, frame_count); + x11_check_window(data, quit, resize, width, height, + is_shutdown); switch (x_api) { @@ -396,7 +403,7 @@ static bool gfx_ctx_x_set_resize(void *data, return false; } -static void *gfx_ctx_x_init(video_frame_info_t video_info, void *data) +static void *gfx_ctx_x_init(video_frame_info_t *video_info, void *data) { int nelements = 0; int major = 0; @@ -510,11 +517,11 @@ static void *gfx_ctx_x_init(video_frame_info_t video_info, void *data) x->swap_mode = 1; - glXGetSyncValuesOML = (void *)glXGetProcAddress((unsigned char *)"glXGetSyncValuesOML"); - glXGetMscRateOML = (void *)glXGetProcAddress((unsigned char *)"glXGetMscRateOML"); - glXSwapBuffersMscOML = (void *)glXGetProcAddress((unsigned char *)"glXSwapBuffersMscOML"); - glXWaitForMscOML = (void *)glXGetProcAddress((unsigned char *)"glXWaitForMscOML"); - glXWaitForSbcOML = (void *)glXGetProcAddress((unsigned char *)"glXWaitForSbcOML"); + glXGetSyncValuesOML = (GLXGETSYNCVALUESOMLPROC)glXGetProcAddress((unsigned char *)"glXGetSyncValuesOML"); + glXGetMscRateOML = (GLXGETMSCRATEOMLPROC)glXGetProcAddress((unsigned char *)"glXGetMscRateOML"); + glXSwapBuffersMscOML = (GLXSWAPBUFFERSMSCOMLPROC)glXGetProcAddress((unsigned char *)"glXSwapBuffersMscOML"); + glXWaitForMscOML = (GLXWAITFORMSCOMLPROC)glXGetProcAddress((unsigned char *)"glXWaitForMscOML"); + glXWaitForSbcOML = (GLXWAITFORSBCOMLPROC)glXGetProcAddress((unsigned char *)"glXWaitForSbcOML"); glXGetSyncValuesOML(g_x11_dpy, g_x11_win, &x->ust, &x->msc, &x->sbc); @@ -540,7 +547,7 @@ error: } static bool gfx_ctx_x_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -560,7 +567,7 @@ static bool gfx_ctx_x_set_video_mode(void *data, if (!x) return false; - windowed_full = video_info.windowed_fullscreen; + windowed_full = video_info->windowed_fullscreen; true_full = false; switch (x_api) @@ -608,8 +615,8 @@ static bool gfx_ctx_x_set_video_mode(void *data, RARCH_ERR("[GLX]: Entering true fullscreen failed. Will attempt windowed mode.\n"); } - if (video_info.monitor_index) - g_x11_screen = video_info.monitor_index - 1; + if (video_info->monitor_index) + g_x11_screen = video_info->monitor_index - 1; #ifdef HAVE_XINERAMA if (fullscreen || g_x11_screen != 0) @@ -655,9 +662,8 @@ static bool gfx_ctx_x_set_video_mode(void *data, break; } - x11_set_window_attr(g_x11_dpy, g_x11_win); - x11_update_window_title(NULL, video_info); + x11_update_title(NULL, video_info); if (fullscreen) x11_show_mouse(g_x11_dpy, g_x11_win, false); @@ -783,8 +789,10 @@ static bool gfx_ctx_x_set_video_mode(void *data, #ifdef HAVE_VULKAN { bool quit, resize; + bool shutdown = false; unsigned width = 0, height = 0; - x11_check_window(x, &quit, &resize, &width, &height, 0); + x11_check_window(x, &quit, &resize, &width, &height, + shutdown); /* Use XCB surface since it's the most supported WSI. * We can obtain the XCB connection directly from X11. */ @@ -877,12 +885,10 @@ error: } static void gfx_ctx_x_input_driver(void *data, + const char *joypad_name, const input_driver_t **input, void **input_data) { - settings_t *settings = config_get_ptr(); - void *xinput = input_x.init(settings->input.joypad_driver); - - (void)data; + void *xinput = input_x.init(joypad_name); *input = xinput ? &input_x : NULL; *input_data = xinput; @@ -1078,7 +1084,7 @@ const gfx_ctx_driver_t gfx_ctx_x = { NULL, /* get_video_output_next */ x11_get_metrics, NULL, - x11_update_window_title, + x11_update_title, gfx_ctx_x_check_window, gfx_ctx_x_set_resize, x11_has_focus, diff --git a/gfx/drivers_context/xegl_ctx.c b/gfx/drivers_context/xegl_ctx.c index d89ea1f721..2d54b26de0 100644 --- a/gfx/drivers_context/xegl_ctx.c +++ b/gfx/drivers_context/xegl_ctx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen -* Copyright (C) 2011-2016 - Daniel De Matteis +* Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -23,7 +23,6 @@ #include "../../config.h" #endif -#include "../../configuration.h" #include "../../frontend/frontend_driver.h" #include "../common/egl_common.h" @@ -92,16 +91,7 @@ EGL_BLUE_SIZE, 1, \ EGL_ALPHA_SIZE, 0, \ EGL_DEPTH_SIZE, 0 -static bool gfx_ctx_xegl_set_resize(void *data, - unsigned width, unsigned height) -{ - (void)data; - (void)width; - (void)height; - return false; -} - -static void *gfx_ctx_xegl_init(video_frame_info_t video_info, void *video_driver) +static void *gfx_ctx_xegl_init(video_frame_info_t *video_info, void *video_driver) { #ifdef HAVE_EGL static const EGLint egl_attribs_gl[] = { @@ -258,7 +248,7 @@ static EGLint *xegl_fill_attribs(xegl_ctx_data_t *xegl, EGLint *attr) static void gfx_ctx_xegl_set_swap_interval(void *data, unsigned swap_interval); static bool gfx_ctx_xegl_set_video_mode(void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) { @@ -299,7 +289,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data, ButtonPressMask | ButtonReleaseMask | KeyReleaseMask; swa.override_redirect = fullscreen ? True : False; - if (fullscreen && !video_info.windowed_fullscreen) + if (fullscreen && !video_info->windowed_fullscreen) { if (x11_enter_fullscreen(video_info, g_x11_dpy, width, height, &xegl->desktop_mode)) { @@ -310,8 +300,8 @@ static bool gfx_ctx_xegl_set_video_mode(void *data, RARCH_ERR("[X/EGL]: Entering true fullscreen failed. Will attempt windowed mode.\n"); } - if (video_info.monitor_index) - g_x11_screen = video_info.monitor_index - 1; + if (video_info->monitor_index) + g_x11_screen = video_info->monitor_index - 1; #ifdef HAVE_XINERAMA if (fullscreen || g_x11_screen != 0) @@ -353,7 +343,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data, goto error; x11_set_window_attr(g_x11_dpy, g_x11_win); - x11_update_window_title(NULL, video_info); + x11_update_title(NULL, video_info); if (fullscreen) x11_show_mouse(g_x11_dpy, g_x11_win, false); @@ -424,12 +414,10 @@ error: static void gfx_ctx_xegl_input_driver(void *data, - const input_driver_t **input, void **input_data) + const char *joypad_name, + const input_driver_t **input, void **input_data) { - settings_t *settings = config_get_ptr(); - void *xinput = input_x.init(settings->input.joypad_driver); - - (void)data; + void *xinput = input_x.init(joypad_name); *input = xinput ? &input_x : NULL; *input_data = xinput; @@ -493,7 +481,7 @@ static void gfx_ctx_xegl_show_mouse(void *data, bool state) x11_show_mouse(g_x11_dpy, g_x11_win, state); } -static void gfx_ctx_xegl_swap_buffers(void *data, video_frame_info_t video_info) +static void gfx_ctx_xegl_swap_buffers(void *data, video_frame_info_t *video_info) { xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data; @@ -594,9 +582,9 @@ const gfx_ctx_driver_t gfx_ctx_x_egl = NULL, /* get_video_output_next */ x11_get_metrics, NULL, - x11_update_window_title, + x11_update_title, x11_check_window, - gfx_ctx_xegl_set_resize, + NULL, /* set_resize */ x11_has_focus, gfx_ctx_xegl_suppress_screensaver, gfx_ctx_xegl_has_windowed, diff --git a/gfx/drivers_font/caca_font.c b/gfx/drivers_font/caca_font.c index 034608a4f5..349bd7ab1a 100644 --- a/gfx/drivers_font/caca_font.c +++ b/gfx/drivers_font/caca_font.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -24,7 +24,6 @@ #endif #include "../font_driver.h" -#include "../../configuration.h" #include "../../verbosity.h" #include "../common/caca_common.h" @@ -59,6 +58,7 @@ static void *caca_init_font(void *data, static void caca_render_free_font(void *data) { + } static int caca_get_message_width(void *data, const char *msg, @@ -73,12 +73,14 @@ static const struct font_glyph *caca_font_get_glyph( return NULL; } -static void caca_render_msg(void *data, const char *msg, +static void caca_render_msg(video_frame_info_t *video_info, + void *data, const char *msg, const void *userdata) { - float x, y; + float x, y, scale; unsigned width, height; unsigned newX, newY; + unsigned align; caca_raster_t *font = (caca_raster_t*)data; const struct font_params *params = (const struct font_params*)userdata; @@ -89,13 +91,15 @@ static void caca_render_msg(void *data, const char *msg, { x = params->x; y = params->y; + scale = params->scale; + align = params->text_align; } else { - settings_t *settings = config_get_ptr(); - - x = settings->video.msg_pos_x; - y = settings->video.msg_pos_y; + x = video_info->font_msg_pos_x; + y = video_info->font_msg_pos_y; + scale = 1.0f; + align = TEXT_ALIGN_LEFT; } if (!font->caca || !font->caca->caca_cv || !font->caca->caca_display || @@ -104,19 +108,29 @@ static void caca_render_msg(void *data, const char *msg, width = caca_get_canvas_width(*font->caca->caca_cv); height = caca_get_canvas_height(*font->caca->caca_cv); + newY = height - (y * height * scale); - newX = x * width; - newY = height - (y * height); - - if (strlen(msg) + newX > width) - newX -= strlen(msg) + newX - width; + switch (align) + { + case TEXT_ALIGN_RIGHT: + newX = (x * width * scale) - strlen(msg); + break; + case TEXT_ALIGN_CENTER: + newX = (x * width * scale) - (strlen(msg) / 2); + break; + case TEXT_ALIGN_LEFT: + default: + newX = x * width * scale; + break; + } caca_put_str(*font->caca->caca_cv, newX, newY, msg); caca_refresh_display(*font->caca->caca_display); } -static void caca_font_flush_block(void* data) +static void caca_font_flush_block(unsigned width, unsigned height, + void* data) { (void)data; } diff --git a/gfx/drivers_font/ctr_font.c b/gfx/drivers_font/ctr_font.c index ce4c4e48f4..4c483679f4 100644 --- a/gfx/drivers_font/ctr_font.c +++ b/gfx/drivers_font/ctr_font.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -27,13 +27,15 @@ #include "../drivers/ctr_gu.h" #include "../../ctr/gpu_old.h" -#include "../../configuration.h" #include "../../verbosity.h" /* FIXME: this is just a workaround to avoid * using ctrGuCopyImage, since it seems to cause * a freeze/blackscreen when used here. */ -//#define FONT_TEXTURE_IN_VRAM + +#if 0 +#define FONT_TEXTURE_IN_VRAM +#endif typedef struct { @@ -109,6 +111,7 @@ static void ctr_font_free_font(void* data) #else linearFree(font->texture.data); #endif + free(font); } static int ctr_font_get_message_width(void* data, const char* msg, @@ -147,33 +150,31 @@ static int ctr_font_get_message_width(void* data, const char* msg, } static void ctr_font_render_line( - ctr_font_t* font, const char* msg, unsigned msg_len, - float scale, const unsigned int color, float pos_x, - float pos_y, unsigned text_align) + video_frame_info_t *video_info, + ctr_font_t* font, const char* msg, unsigned msg_len, + float scale, const unsigned int color, float pos_x, + float pos_y, unsigned text_align) { - int x, y, delta_x, delta_y; - unsigned width, height; unsigned i; + ctr_vertex_t* v = NULL; ctr_video_t* ctr = (ctr_video_t*)video_driver_get_ptr(false); - ctr_vertex_t* v; - video_driver_get_size(&width, &height); - - x = roundf(pos_x * width); - y = roundf((1.0f - pos_y) * height); - delta_x = 0; - delta_y = 0; - + unsigned width = video_info->width; + unsigned height = video_info->height; + int x = roundf(pos_x * width); + int y = roundf((1.0f - pos_y) * height); + int delta_x = 0; + int delta_y = 0; switch (text_align) { - case TEXT_ALIGN_RIGHT: - x -= ctr_font_get_message_width(font, msg, msg_len, scale); - break; + case TEXT_ALIGN_RIGHT: + x -= ctr_font_get_message_width(font, msg, msg_len, scale); + break; - case TEXT_ALIGN_CENTER: - x -= ctr_font_get_message_width(font, msg, msg_len, scale) / 2; - break; + case TEXT_ALIGN_CENTER: + x -= ctr_font_get_message_width(font, msg, msg_len, scale) / 2; + break; } if ((ctr->vertex_cache.size - (ctr->vertex_cache.current - ctr->vertex_cache.buffer)) < msg_len) @@ -226,7 +227,8 @@ static void ctr_font_render_line( return; ctrGuSetVertexShaderFloatUniform(0, (float*)&font->scale_vector, 1); - GSPGPU_FlushDataCache(ctr->vertex_cache.current, (v - ctr->vertex_cache.current) * sizeof(ctr_vertex_t)); + GSPGPU_FlushDataCache(ctr->vertex_cache.current, + (v - ctr->vertex_cache.current) * sizeof(ctr_vertex_t)); ctrGuSetAttributeBuffers(2, VIRT_TO_PHYS(ctr->vertex_cache.current), CTRGU_ATTRIBFMT(GPU_SHORT, 4) << 0 | @@ -240,18 +242,25 @@ static void ctr_font_render_line( GPU_TEVOPERANDS(GPU_TEVOP_RGB_SRC_R, GPU_TEVOP_RGB_SRC_ALPHA, 0), GPU_MODULATE, GPU_MODULATE, color); -// printf("%s\n", msg); -// DEBUG_VAR(color); -// GPU_SetTexEnv(0, GPU_TEXTURE0, GPU_TEXTURE0, 0, GPU_TEVOPERANDS(GPU_TEVOP_RGB_SRC_R, 0, 0), GPU_REPLACE, GPU_REPLACE, 0); - ctrGuSetTexture(GPU_TEXUNIT0, VIRT_TO_PHYS(font->texture.data), font->texture.width, font->texture.height, - GPU_TEXTURE_MAG_FILTER(GPU_NEAREST) | GPU_TEXTURE_MIN_FILTER(GPU_NEAREST) | - GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_EDGE) | GPU_TEXTURE_WRAP_T(GPU_CLAMP_TO_EDGE), - GPU_L8); + +#if 0 + printf("%s\n", msg); + DEBUG_VAR(color); + GPU_SetTexEnv(0, GPU_TEXTURE0, GPU_TEXTURE0, 0, + GPU_TEVOPERANDS(GPU_TEVOP_RGB_SRC_R, 0, 0), GPU_REPLACE, GPU_REPLACE, 0); +#endif + + ctrGuSetTexture(GPU_TEXUNIT0, VIRT_TO_PHYS(font->texture.data), + font->texture.width, font->texture.height, + GPU_TEXTURE_MAG_FILTER(GPU_NEAREST) | GPU_TEXTURE_MIN_FILTER(GPU_NEAREST) | + GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_EDGE) | GPU_TEXTURE_WRAP_T(GPU_CLAMP_TO_EDGE), + GPU_L8); GPU_SetViewport(NULL, - VIRT_TO_PHYS(ctr->drawbuffers.top.left), - 0, 0, CTR_TOP_FRAMEBUFFER_HEIGHT, - ctr->video_mode == CTR_VIDEO_MODE_800x240 ? CTR_TOP_FRAMEBUFFER_WIDTH * 2 : CTR_TOP_FRAMEBUFFER_WIDTH); + VIRT_TO_PHYS(ctr->drawbuffers.top.left), + 0, 0, CTR_TOP_FRAMEBUFFER_HEIGHT, + ctr->video_mode == CTR_VIDEO_MODE_800x240 + ? CTR_TOP_FRAMEBUFFER_WIDTH * 2 : CTR_TOP_FRAMEBUFFER_WIDTH); GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, v - ctr->vertex_cache.current); @@ -264,36 +273,40 @@ static void ctr_font_render_line( GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, v - ctr->vertex_cache.current); } - - - -// v = font->vertices; -// v->x0 = 0; -// v->y0 = 0; -// v->u0 = 0; -// v->v0 = 0; -// v->x1 = font->texture.width; -// v->y1 = font->texture.height; -// v->u1 = font->texture.width; -// v->v1 = font->texture.height; -// GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, 1); +#if 0 + v = font->vertices; + v->x0 = 0; + v->y0 = 0; + v->u0 = 0; + v->v0 = 0; + v->x1 = font->texture.width; + v->y1 = font->texture.height; + v->u1 = font->texture.width; + v->v1 = font->texture.height; + GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, 1); +#endif GPU_SetTexEnv(0, GPU_TEXTURE0, GPU_TEXTURE0, 0, 0, GPU_REPLACE, GPU_REPLACE, 0); - // DEBUG_VAR(v - font->vertices); - // v = font->vertices; - // printf("OSDMSG: %s\n", msg); - // printf("vertex : (%i,%i,%i,%i) - (%i,%i,%i,%i)\n", - // v->x0, v->y0, v->x1, v->y1, - // v->u0, v->v0, v->u1, v->v1); -// printf("%s\n", msg); +#if 0 + DEBUG_VAR(v - font->vertices); + v = font->vertices; + printf("OSDMSG: %s\n", msg); + printf("vertex : (%i,%i,%i,%i) - (%i,%i,%i,%i)\n", + v->x0, v->y0, v->x1, v->y1, + v->u0, v->v0, v->u1, v->v1); + + printf("%s\n", msg); +#endif + ctr->vertex_cache.current = v; } static void ctr_font_render_message( - ctr_font_t* font, const char* msg, float scale, - const unsigned int color, float pos_x, float pos_y, - unsigned text_align) + video_frame_info_t *video_info, + ctr_font_t* font, const char* msg, float scale, + const unsigned int color, float pos_x, float pos_y, + unsigned text_align) { int lines = 0; float line_height; @@ -304,7 +317,7 @@ static void ctr_font_render_message( /* If the font height is not supported just draw as usual */ if (!font->font_driver->get_line_height) { - ctr_font_render_line(font, msg, strlen(msg), + ctr_font_render_line(video_info, font, msg, strlen(msg), scale, color, pos_x, pos_y, text_align); return; } @@ -319,7 +332,7 @@ static void ctr_font_render_message( if (delim) { unsigned msg_len = delim - msg; - ctr_font_render_line(font, msg, msg_len, + ctr_font_render_line(video_info, font, msg, msg_len, scale, color, pos_x, pos_y - (float)lines * line_height, text_align); msg += msg_len + 1; @@ -328,7 +341,7 @@ static void ctr_font_render_message( else { unsigned msg_len = strlen(msg); - ctr_font_render_line(font, msg, msg_len, + ctr_font_render_line(video_info, font, msg, msg_len, scale, color, pos_x, pos_y - (float)lines * line_height, text_align); break; @@ -336,23 +349,24 @@ static void ctr_font_render_message( } } -static void ctr_font_render_msg(void* data, const char* msg, - const void* userdata) +static void ctr_font_render_msg( + video_frame_info_t *video_info, + void* data, const char* msg, + const void* userdata) { float x, y, scale, drop_mod, drop_alpha; - unsigned width, height; int drop_x, drop_y; unsigned max_glyphs; enum text_alignment text_align; unsigned color, color_dark, r, g, b, alpha, r_dark, g_dark, b_dark, alpha_dark; ctr_font_t * font = (ctr_font_t*)data; const struct font_params* params = (const struct font_params*)userdata; + unsigned width = video_info->width; + unsigned height = video_info->height; if (!font || !msg || !*msg) return; - video_driver_get_size(&width, &height); - if (params) { x = params->x; @@ -371,16 +385,14 @@ static void ctr_font_render_msg(void* data, const char* msg, } else { - settings_t* settings = config_get_ptr(); - - x = settings->video.msg_pos_x; - y = settings->video.msg_pos_y; + x = video_info->font_msg_pos_x; + y = video_info->font_msg_pos_y; scale = 1.0f; text_align = TEXT_ALIGN_LEFT; - r = (settings->video.msg_color_r * 255); - g = (settings->video.msg_color_g * 255); - b = (settings->video.msg_color_b * 255); + r = (video_info->font_msg_color_r * 255); + g = (video_info->font_msg_color_g * 255); + b = (video_info->font_msg_color_b * 255); alpha = 255; color = COLOR_ABGR(r, g, b, alpha); @@ -403,12 +415,12 @@ static void ctr_font_render_msg(void* data, const char* msg, alpha_dark = alpha * drop_alpha; color_dark = COLOR_ABGR(r_dark, g_dark, b_dark, alpha_dark); - ctr_font_render_message(font, msg, scale, color_dark, + ctr_font_render_message(video_info, font, msg, scale, color_dark, x + scale * drop_x / width, y + scale * drop_y / height, text_align); } - ctr_font_render_message(font, msg, scale, + ctr_font_render_message(video_info, font, msg, scale, color, x, y, text_align); } @@ -426,7 +438,7 @@ static const struct font_glyph* ctr_font_get_glyph( return font->font_driver->get_glyph((void*)font->font_driver, code); } -static void ctr_font_flush_block(void* data) +static void ctr_font_flush_block(unsigned width, unsigned height, void* data) { (void)data; } diff --git a/gfx/drivers_font/d3d_w32_font.cpp b/gfx/drivers_font/d3d_w32_font.cpp index d8ba99055d..dca48280d1 100644 --- a/gfx/drivers_font/d3d_w32_font.cpp +++ b/gfx/drivers_font/d3d_w32_font.cpp @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -46,7 +46,7 @@ static void *d3dfonts_w32_init_font(void *video_data, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_PITCH, -#ifdef _MSC_VER /* MSVC needs w_char* */ +#if defined(_MSC_VER) /* MSVC needs w_char* */ L"Verdana" /* Hardcode FTL */ #else "Verdana" @@ -88,9 +88,12 @@ static void d3dfonts_w32_free_font(void *data) if (d3dfonts->font) d3dfonts->font->Release(); d3dfonts->font = NULL; + + free(d3dfonts); + d3dfonts = NULL; } -static void d3dfonts_w32_render_msg(void *data, const char *msg, +static void d3dfonts_w32_render_msg(video_frame_info_t *video_info, void *data, const char *msg, const void *userdata) { const struct font_params *params = (const struct font_params*)userdata; diff --git a/gfx/drivers_font/gdi_font.c b/gfx/drivers_font/gdi_font.c new file mode 100644 index 0000000000..ef02b452a4 --- /dev/null +++ b/gfx/drivers_font/gdi_font.c @@ -0,0 +1,163 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include "../../config.h" +#endif + +#include "../font_driver.h" +#include "../video_driver.h" +#include "../../configuration.h" +#include "../../verbosity.h" +#include "../common/gdi_common.h" +#include "../common/win32_common.h" + +#include +#include + +typedef struct +{ + const font_renderer_driver_t *gdi_font_driver; + void *gdi_font_data; + gdi_t *gdi; +} gdi_raster_t; + +static void *gdi_init_font(void *data, + const char *font_path, float font_size) +{ + gdi_raster_t *font = (gdi_raster_t*)calloc(1, sizeof(*font)); + + if (!font) + return NULL; + + font->gdi = (gdi_t*)data; + + font_size = 1; + + if (!font_renderer_create_default((const void**)&font->gdi_font_driver, + &font->gdi_font_data, font_path, font_size)) + { + RARCH_WARN("Couldn't initialize font renderer.\n"); + return NULL; + } + + return font; +} + +static void gdi_render_free_font(void *data) +{ + +} + +static int gdi_get_message_width(void *data, const char *msg, + unsigned msg_len, float scale) +{ + return 0; +} + +static const struct font_glyph *gdi_font_get_glyph( + void *data, uint32_t code) +{ + return NULL; +} + +static void gdi_render_msg( + video_frame_info_t *video_info, + void *data, const char *msg, + const void *userdata) +{ + HDC hdc; + float x, y, scale; + gdi_raster_t *font = (gdi_raster_t*)data; + unsigned newX, newY, len; + unsigned align; + const struct font_params *params = (const struct font_params*)userdata; + HWND hwnd = win32_get_window(); + unsigned width = video_info->width; + unsigned height = video_info->height; + + if (!font || string_is_empty(msg)) + return; + + if (params) + { + x = params->x; + y = params->y; + scale = params->scale; + align = params->text_align; + } + else + { + x = video_info->font_msg_pos_x; + y = video_info->font_msg_pos_y; + scale = 1.0f; + align = TEXT_ALIGN_LEFT; + } + + if (!font->gdi) + return; + + len = utf8len(msg); + + switch (align) + { + case TEXT_ALIGN_LEFT: + newX = x * width * scale; + break; + case TEXT_ALIGN_RIGHT: + newX = (x * width * scale) - len; + break; + case TEXT_ALIGN_CENTER: + newX = (x * width * scale) - (len / 2); + break; + default: + break; + } + + newY = height - (y * height * scale); + hdc = GetDC(hwnd); + + SetBkMode(hdc, TRANSPARENT); + SetTextColor(hdc, RGB(255,255,255)); + TextOut(hdc, newX, newY, msg, len); + ReleaseDC(hwnd, hdc); +} + +static void gdi_font_flush_block(unsigned width, unsigned height, void* data) +{ + (void)data; +} + +static void gdi_font_bind_block(void* data, void* userdata) +{ + (void)data; +} + +font_renderer_t gdi_font = { + gdi_init_font, + gdi_render_free_font, + gdi_render_msg, + "gdi font", + gdi_font_get_glyph, /* get_glyph */ + gdi_font_bind_block, /* bind_block */ + gdi_font_flush_block, /* flush */ + gdi_get_message_width /* get_message_width */ +}; diff --git a/gfx/drivers_font/gl_raster_font.c b/gfx/drivers_font/gl_raster_font.c index 707585ad0c..d20c33b470 100644 --- a/gfx/drivers_font/gl_raster_font.c +++ b/gfx/drivers_font/gl_raster_font.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -25,8 +25,6 @@ #include "../video_shader_driver.h" #include "../video_context_driver.h" -#include "../../configuration.h" - /* TODO: Move viewport side effects to the caller: it's a source of bugs. */ #define gl_raster_font_emit(c, vx, vy) do { \ @@ -57,6 +55,8 @@ typedef struct video_font_raster_block_t *block; } gl_raster_t; +static void gl_raster_font_free_font(void *data); + static bool gl_raster_font_upload_atlas(gl_raster_t *font) { unsigned i, j; @@ -142,21 +142,6 @@ static bool gl_raster_font_upload_atlas(gl_raster_t *font) return true; } -static void gl_raster_font_free_font(void *data) -{ - gl_raster_t *font = (gl_raster_t*)data; - if (!font) - return; - - if (font->font_driver && font->font_data) - font->font_driver->free(font->font_data); - - if (video_driver_is_threaded()) - video_context_driver_make_current(true); - - glDeleteTextures(1, &font->tex); -} - static void *gl_raster_font_init_font(void *data, const char *font_path, float font_size) { @@ -169,7 +154,11 @@ static void *gl_raster_font_init_font(void *data, if (!font_renderer_create_default((const void**)&font->font_driver, &font->font_data, font_path, font_size)) - goto error; + { + RARCH_WARN("Couldn't initialize font renderer.\n"); + free(font); + return NULL; + } if (video_driver_is_threaded()) video_context_driver_make_current(false); @@ -195,13 +184,28 @@ static void *gl_raster_font_init_font(void *data, return font; error: - RARCH_WARN("Couldn't initialize font renderer.\n"); gl_raster_font_free_font(font); - free(font); + font = NULL; return NULL; } +static void gl_raster_font_free_font(void *data) +{ + gl_raster_t *font = (gl_raster_t*)data; + if (!font) + return; + + if (font->font_driver && font->font_data) + font->font_driver->free(font->font_data); + + if (video_driver_is_threaded()) + video_context_driver_make_current(true); + + glDeleteTextures(1, &font->tex); + + free(font); +} static int gl_get_message_width(void *data, const char *msg, unsigned msg_len, float scale) @@ -384,13 +388,11 @@ static void gl_raster_font_render_message( } } -static void gl_raster_font_setup_viewport(gl_raster_t *font, bool full_screen) +static void gl_raster_font_setup_viewport(unsigned width, unsigned height, + gl_raster_t *font, bool full_screen) { - unsigned width, height; video_shader_ctx_info_t shader_info; - video_driver_get_size(&width, &height); - video_driver_set_viewport(width, height, full_screen, false); glEnable(GL_BLEND); @@ -406,19 +408,18 @@ static void gl_raster_font_setup_viewport(gl_raster_t *font, bool full_screen) video_shader_driver_use(shader_info); } -static void gl_raster_font_restore_viewport(gl_t *gl, bool full_screen) +static void gl_raster_font_restore_viewport(unsigned width, unsigned height, + gl_t *gl, bool full_screen) { - unsigned width, height; - - video_driver_get_size(&width, &height); - glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); glDisable(GL_BLEND); video_driver_set_viewport(width, height, full_screen, true); } -static void gl_raster_font_render_msg(void *data, const char *msg, +static void gl_raster_font_render_msg( + video_frame_info_t *video_info, + void *data, const char *msg, const void *userdata) { GLfloat x, y, scale, drop_mod, drop_alpha; @@ -428,6 +429,8 @@ static void gl_raster_font_render_msg(void *data, const char *msg, bool full_screen = false ; gl_t *gl = NULL; gl_raster_t *font = (gl_raster_t*)data; + unsigned width = video_info->width; + unsigned height = video_info->height; const struct font_params *params = (const struct font_params*)userdata; if (!font || string_is_empty(msg)) @@ -461,16 +464,15 @@ static void gl_raster_font_render_msg(void *data, const char *msg, } else { - settings_t *settings = config_get_ptr(); - x = settings->video.msg_pos_x; - y = settings->video.msg_pos_y; + x = video_info->font_msg_pos_x; + y = video_info->font_msg_pos_y; scale = 1.0f; full_screen = true; text_align = TEXT_ALIGN_LEFT; - color[0] = settings->video.msg_color_r; - color[1] = settings->video.msg_color_g; - color[2] = settings->video.msg_color_b; + color[0] = video_info->font_msg_color_r; + color[1] = video_info->font_msg_color_g; + color[2] = video_info->font_msg_color_b; color[3] = 1.0f; drop_x = -2; @@ -482,7 +484,7 @@ static void gl_raster_font_render_msg(void *data, const char *msg, if (font && font->block) font->block->fullscreen = full_screen; else - gl_raster_font_setup_viewport(font, full_screen); + gl_raster_font_setup_viewport(width, height, font, full_screen); if (drop_x || drop_y) { @@ -501,7 +503,7 @@ static void gl_raster_font_render_msg(void *data, const char *msg, gl_raster_font_render_message(font, msg, scale, color, x, y, text_align); if (!font->block) - gl_raster_font_restore_viewport(gl, false); + gl_raster_font_restore_viewport(width, height, gl, false); } static const struct font_glyph *gl_raster_font_get_glyph( @@ -516,7 +518,8 @@ static const struct font_glyph *gl_raster_font_get_glyph( return font->font_driver->get_glyph((void*)font->font_driver, code); } -static void gl_raster_font_flush_block(void *data) +static void gl_raster_font_flush_block(unsigned width, unsigned height, + void *data) { gl_raster_t *font = (gl_raster_t*)data; video_font_raster_block_t *block = font ? font->block : NULL; @@ -524,9 +527,9 @@ static void gl_raster_font_flush_block(void *data) if (!font || !block || !block->carr.coords.vertices) return; - gl_raster_font_setup_viewport(font, block->fullscreen); + gl_raster_font_setup_viewport(width, height, font, block->fullscreen); gl_raster_font_draw_vertices(font, (video_coords_t*)&block->carr.coords); - gl_raster_font_restore_viewport(font->gl, block->fullscreen); + gl_raster_font_restore_viewport(width, height, font->gl, block->fullscreen); } static void gl_raster_font_bind_block(void *data, void *userdata) diff --git a/gfx/drivers_font/ps_libdbgfont.c b/gfx/drivers_font/ps_libdbgfont.c index cf437ac82e..cef0d400b7 100644 --- a/gfx/drivers_font/ps_libdbgfont.c +++ b/gfx/drivers_font/ps_libdbgfont.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -63,7 +63,9 @@ static void libdbg_font_free_font(void *data) DbgFontExit(); } -static void libdbg_font_render_msg(void *data, const char *msg, +static void libdbg_font_render_msg( + video_frame_info_t *video_info, + void *data, const char *msg, const void *userdata) { float x, y, scale; @@ -81,8 +83,7 @@ static void libdbg_font_render_msg(void *data, const char *msg, } else { - settings_t *settings = config_get_ptr(); - x = settings->video.msg_pos_x; + x = video_info->font_msg_pos_x; y = 0.90f; scale = 1.04f; color = SILVER; diff --git a/gfx/drivers_font/vga_font.c b/gfx/drivers_font/vga_font.c new file mode 100644 index 0000000000..024c2ed49c --- /dev/null +++ b/gfx/drivers_font/vga_font.c @@ -0,0 +1,150 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2016 - Brad Parker + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include +#include + +#ifdef HAVE_CONFIG_H +#include "../../config.h" +#endif + +#include "../font_driver.h" +#include "../../verbosity.h" +#include "../common/vga_common.h" + +typedef struct +{ + const font_renderer_driver_t *vga_font_driver; + void *vga_font_data; + vga_t *vga; +} vga_raster_t; + +static void *vga_init_font(void *data, + const char *font_path, float font_size) +{ + vga_raster_t *font = (vga_raster_t*)calloc(1, sizeof(*font)); + + if (!font) + return NULL; + + font->vga = (vga_t*)data; + + font_size = 1; + + if (!font_renderer_create_default((const void**)&font->vga_font_driver, + &font->vga_font_data, font_path, font_size)) + { + RARCH_WARN("Couldn't initialize font renderer.\n"); + return NULL; + } + + return font; +} + +static void vga_render_free_font(void *data) +{ + +} + +static int vga_get_message_width(void *data, const char *msg, + unsigned msg_len, float scale) +{ + return 0; +} + +static const struct font_glyph *vga_font_get_glyph( + void *data, uint32_t code) +{ + return NULL; +} + +static void vga_render_msg(video_frame_info_t *video_info, + void *data, const char *msg, + const void *userdata) +{ + float x, y, scale; + unsigned width, height; + unsigned newX, newY; + unsigned align; + vga_raster_t *font = (vga_raster_t*)data; + const struct font_params *params = (const struct font_params*)userdata; + + (void)newX; + (void)newY; + + if (!font || string_is_empty(msg)) + return; + + if (params) + { + x = params->x; + y = params->y; + scale = params->scale; + align = params->text_align; + } + else + { + x = video_info->font_msg_pos_x; + y = video_info->font_msg_pos_y; + scale = 1.0f; + align = TEXT_ALIGN_LEFT; + } + + if (!font->vga) + return; + + width = VGA_WIDTH; + height = VGA_HEIGHT; + newY = height - (y * height * scale); + + switch (align) + { + case TEXT_ALIGN_LEFT: + newX = x * width * scale; + break; + case TEXT_ALIGN_RIGHT: + newX = (x * width * scale) - strlen(msg); + break; + case TEXT_ALIGN_CENTER: + newX = (x * width * scale) - (strlen(msg) / 2); + break; + default: + break; + } +} + +static void vga_font_flush_block(unsigned width, unsigned height, + void* data) +{ + (void)data; +} + +static void vga_font_bind_block(void* data, void* userdata) +{ + (void)data; +} + +font_renderer_t vga_font = { + vga_init_font, + vga_render_free_font, + vga_render_msg, + "vga font", + vga_font_get_glyph, /* get_glyph */ + vga_font_bind_block, /* bind_block */ + vga_font_flush_block, /* flush */ + vga_get_message_width /* get_message_width */ +}; diff --git a/gfx/drivers_font/vita2d_font.c b/gfx/drivers_font/vita2d_font.c index 2cffc9dbf0..1b8af4cda2 100644 --- a/gfx/drivers_font/vita2d_font.c +++ b/gfx/drivers_font/vita2d_font.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -18,9 +18,11 @@ #include +#include "../common/vita2d_common.h" + #include "../font_driver.h" -#include "../../configuration.h" +#include "../../verbosity.h" typedef struct { @@ -98,6 +100,8 @@ static void vita2d_font_free_font(void *data) vita2d_wait_rendering_done(); #endif vita2d_free_texture(font->texture); + + free(font); } static int vita2d_font_get_message_width(void *data, const char *msg, @@ -135,20 +139,18 @@ static int vita2d_font_get_message_width(void *data, const char *msg, } static void vita2d_font_render_line( + video_frame_info_t *video_info, vita_font_t *font, const char *msg, unsigned msg_len, float scale, const unsigned int color, float pos_x, float pos_y, unsigned text_align) { - int x, y, delta_x, delta_y; - unsigned width, height; unsigned i; - - video_driver_get_size(&width, &height); - - x = roundf(pos_x * width); - y = roundf((1.0f - pos_y) * height); - delta_x = 0; - delta_y = 0; + unsigned width = video_info->width; + unsigned height = video_info->height; + int x = roundf(pos_x * width); + int y = roundf((1.0f - pos_y) * height); + int delta_x = 0; + int delta_y = 0; switch (text_align) { @@ -217,6 +219,7 @@ static void vita2d_font_render_line( } static void vita2d_font_render_message( + video_frame_info_t *video_info, vita_font_t *font, const char *msg, float scale, const unsigned int color, float pos_x, float pos_y, unsigned text_align) @@ -230,7 +233,7 @@ static void vita2d_font_render_message( /* If the font height is not supported just draw as usual */ if (!font->font_driver->get_line_height) { - vita2d_font_render_line(font, msg, strlen(msg), + vita2d_font_render_line(video_info, font, msg, strlen(msg), scale, color, pos_x, pos_y, text_align); return; } @@ -243,7 +246,7 @@ static void vita2d_font_render_message( const char *delim = strchr(msg, '\n'); unsigned msg_len = (delim) ? (delim - msg) : strlen(msg); - vita2d_font_render_line(font, msg, msg_len, + vita2d_font_render_line(video_info, font, msg, msg_len, scale, color, pos_x, pos_y - (float)lines * line_height, text_align); @@ -256,23 +259,24 @@ static void vita2d_font_render_message( } } -static void vita2d_font_render_msg(void *data, const char *msg, +static void vita2d_font_render_msg( + video_frame_info_t *video_info, + void *data, const char *msg, const void *userdata) { float x, y, scale, drop_mod, drop_alpha; - unsigned width, height; int drop_x, drop_y; unsigned max_glyphs; enum text_alignment text_align; unsigned color, color_dark, r, g, b, alpha, r_dark, g_dark, b_dark, alpha_dark; vita_font_t *font = (vita_font_t *)data; const struct font_params *params = (const struct font_params*)userdata; + unsigned width = video_info->width; + unsigned height = video_info->height; if (!font || !msg || !*msg) return; - video_driver_get_size(&width, &height); - if (params) { x = params->x; @@ -291,16 +295,14 @@ static void vita2d_font_render_msg(void *data, const char *msg, } else { - settings_t *settings = config_get_ptr(); - - x = settings->video.msg_pos_x; - y = settings->video.msg_pos_y; + x = video_info->font_msg_pos_x; + y = video_info->font_msg_pos_y; scale = 1.0f; text_align = TEXT_ALIGN_LEFT; - r = (settings->video.msg_color_r * 255); - g = (settings->video.msg_color_g * 255); - b = (settings->video.msg_color_b * 255); + r = (video_info->font_msg_color_r * 255); + g = (video_info->font_msg_color_g * 255); + b = (video_info->font_msg_color_b * 255); alpha = 255; color = RGBA8(r,g,b,alpha); @@ -323,12 +325,12 @@ static void vita2d_font_render_msg(void *data, const char *msg, alpha_dark = alpha * drop_alpha; color_dark = RGBA8(r_dark,g_dark,b_dark,alpha_dark); - vita2d_font_render_message(font, msg, scale, color_dark, + vita2d_font_render_message(video_info, font, msg, scale, color_dark, x + scale * drop_x / width, y + scale * drop_y / height, text_align); } - vita2d_font_render_message(font, msg, scale, + vita2d_font_render_message(video_info, font, msg, scale, color, x, y, text_align); } @@ -342,7 +344,8 @@ static const struct font_glyph *vita2d_font_get_glyph( return font->font_driver->get_glyph((void*)font->font_driver, code); } -static void vita2d_font_flush_block(void *data) +static void vita2d_font_flush_block(unsigned width, unsigned height, + void *data) { (void)data; } diff --git a/gfx/drivers_font/vulkan_raster_font.c b/gfx/drivers_font/vulkan_raster_font.c index 8f0b66b147..5e7fcd93cd 100644 --- a/gfx/drivers_font/vulkan_raster_font.c +++ b/gfx/drivers_font/vulkan_raster_font.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2016 - Hans-Kristian Arntzen + * Copyright (C) 2016-2017 - Hans-Kristian Arntzen * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -21,8 +21,6 @@ #include "../font_driver.h" -#include "../../configuration.h" - typedef struct { vk_t *vk; @@ -85,6 +83,8 @@ static void vulkan_raster_font_free_font(void *data) vkQueueWaitIdle(font->vk->context->queue); vulkan_destroy_texture( font->vk->context->device, &font->texture); + + free(font); } static int vulkan_get_message_width(void *data, const char *msg, @@ -234,10 +234,9 @@ static void vulkan_raster_font_render_message( } static void vulkan_raster_font_setup_viewport( + unsigned width, unsigned height, vulkan_raster_t *font, bool full_screen) { - unsigned width, height; - video_driver_get_size(&width, &height); video_driver_set_viewport(width, height, full_screen, false); } @@ -256,7 +255,9 @@ static void vulkan_raster_font_flush(vulkan_raster_t *font) vulkan_draw_triangles(font->vk, &call); } -static void vulkan_raster_font_render_msg(void *data, const char *msg, +static void vulkan_raster_font_render_msg( + video_frame_info_t *video_info, + void *data, const char *msg, const void *userdata) { float color[4], color_dark[4]; @@ -267,6 +268,8 @@ static void vulkan_raster_font_render_msg(void *data, const char *msg, float x, y, scale, drop_mod, drop_alpha; vk_t *vk = NULL; vulkan_raster_t *font = (vulkan_raster_t*)data; + unsigned width = video_info->width; + unsigned height = video_info->height; const struct font_params *params = (const struct font_params*)userdata; if (!font || !msg || !*msg) @@ -297,17 +300,15 @@ static void vulkan_raster_font_render_msg(void *data, const char *msg, } else { - settings_t *settings = config_get_ptr(); - - x = settings->video.msg_pos_x; - y = settings->video.msg_pos_y; + x = video_info->font_msg_pos_x; + y = video_info->font_msg_pos_y; scale = 1.0f; full_screen = true; text_align = TEXT_ALIGN_LEFT; - color[0] = settings->video.msg_color_r; - color[1] = settings->video.msg_color_g; - color[2] = settings->video.msg_color_b; + color[0] = video_info->font_msg_color_r; + color[1] = video_info->font_msg_color_g; + color[2] = video_info->font_msg_color_b; color[3] = 1.0f; drop_x = -2; @@ -316,7 +317,7 @@ static void vulkan_raster_font_render_msg(void *data, const char *msg, drop_alpha = 1.0f; } - vulkan_raster_font_setup_viewport(font, full_screen); + vulkan_raster_font_setup_viewport(width, height, font, full_screen); max_glyphs = strlen(msg); if (drop_x || drop_y) @@ -358,7 +359,8 @@ static const struct font_glyph *vulkan_raster_font_get_glyph( return font->font_driver->get_glyph((void*)font->font_driver, code); } -static void vulkan_raster_font_flush_block(void *data) +static void vulkan_raster_font_flush_block(unsigned width, unsigned height, + void *data) { (void)data; } diff --git a/gfx/drivers_font/xdk1_xfonts.c b/gfx/drivers_font/xdk1_xfonts.c index 644738877c..47bf9b757d 100644 --- a/gfx/drivers_font/xdk1_xfonts.c +++ b/gfx/drivers_font/xdk1_xfonts.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -55,9 +55,17 @@ static void *xfonts_init_font(void *video_data, static void xfonts_free_font(void *data) { + xfonts_t *font = (xfonts_t*)data; + + if (font) + free(font); + + font = NULL; } -static void xfonts_render_msg(void *data, const char *msg, +static void xfonts_render_msg( + video_frame_info_t *video_info, + void *data, const char *msg, const void *userdata) { wchar_t str[PATH_MAX_LENGTH]; @@ -72,10 +80,8 @@ static void xfonts_render_msg(void *data, const char *msg, } else { - settings_t *settings = config_get_ptr(); - - x = settings->video.msg_pos_x; - y = settings->video.msg_pos_y; + x = video_info->font_msg_pos_x; + y = video_info->font_msg_pos_y; } xfonts->d3d->dev->GetBackBuffer(-1, D3DBACKBUFFER_TYPE_MONO, &xfonts->surf); diff --git a/gfx/drivers_font/xdk360_fonts.cpp b/gfx/drivers_font/xdk360_fonts.cpp index 5f8d128cd5..54c319c037 100644 --- a/gfx/drivers_font/xdk360_fonts.cpp +++ b/gfx/drivers_font/xdk360_fonts.cpp @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -18,7 +18,7 @@ #include -#include "../d3d/d3d.h" +#include "../drivers/d3d.h" #include "../font_driver.h" #include "../drivers/d3d_shaders/font.hlsl.d3d9.h" @@ -58,18 +58,18 @@ enum class PackedResource { protected: - BYTE* m_pSysMemData; /* Allocated memory for resource headers etc. */ + BYTE* m_pSysMemData; // Alloc'ed memory for resource headers etc. DWORD m_dwSysMemDataSize; - BYTE* m_pVidMemData; /* Allocated memory for resource data, etc. */ + BYTE* m_pVidMemData; // Alloc'ed memory for resource data, etc. DWORD m_dwVidMemDataSize; - XBRESOURCE* m_pResourceTags; /* Tags to associate names with the resources */ - DWORD m_dwNumResourceTags; /* Number of resource tags */ - BOOL m_bInitialized; /* Resource is fully initialized */ + XBRESOURCE* m_pResourceTags; // Tags to associate names with the resources + DWORD m_dwNumResourceTags; // Number of resource tags + BOOL m_bInitialized; // Resource is fully initialized public: - /* Loads the resources out of the specified bundle */ + // Loads the resources out of the specified bundle #if defined(_XBOX1) HRESULT Create( const char *strFilename, DWORD dwNumResourceTags = 0L, XBRESOURCE* pResourceTags = NULL ); @@ -82,21 +82,20 @@ class PackedResource BOOL Initialized() const; #ifdef _XBOX360 - /* Retrieves the resource tags */ + // Retrieves the resource tags void GetResourceTags( DWORD* pdwNumResourceTags, XBRESOURCE** ppResourceTags ); #endif - /* Helper function to make sure a resource is registered */ + // Helper function to make sure a resource is registered LPDIRECT3DRESOURCE RegisterResource( LPDIRECT3DRESOURCE pResource ) const { #ifdef _XBOX1 - /* Register the resource, if it has not yet been registered. We mark - * a resource as registered by upping it's reference count. */ + // Register the resource, if it has not yet been registered. We mark + // a resource as registered by upping it's reference count. if( pResource && ( pResource->Common & D3DCOMMON_REFCOUNT_MASK ) == 1 ) { - - /* Special case CPU-copy push buffers (which live in system memory) */ - if( ( pResource->Common & D3DCOMMON_TYPE_PUSHBUFFER ) && + // Special case CPU-copy push buffers (which live in system memory) + if( ( pResource->Common & D3DCOMMON_TYPE_PUSHBUFFER ) && ( pResource->Common & D3DPUSHBUFFER_RUN_USING_CPU_COPY ) ) pResource->Data += (DWORD)m_pSysMemData; else @@ -108,46 +107,32 @@ class PackedResource return pResource; } - /* Functions to retrieve resources by their offset */ + // Functions to retrieve resources by their offset void *GetData( DWORD dwOffset ) const - { - return &m_pSysMemData[dwOffset]; - } + { return &m_pSysMemData[dwOffset]; } LPDIRECT3DRESOURCE GetResource( DWORD dwOffset ) const - { - return RegisterResource( (LPDIRECT3DRESOURCE)GetData(dwOffset) ); - } + { return RegisterResource( (LPDIRECT3DRESOURCE)GetData(dwOffset) ); } LPDIRECT3DTEXTURE GetTexture( DWORD dwOffset ) const - { - return (LPDIRECT3DTEXTURE)GetResource( dwOffset ); - } + { return (LPDIRECT3DTEXTURE)GetResource( dwOffset ); } LPDIRECT3DVERTEXBUFFER GetVertexBuffer( DWORD dwOffset ) const - { - return (LPDIRECT3DVERTEXBUFFER)GetResource( dwOffset ); - } + { return (LPDIRECT3DVERTEXBUFFER)GetResource( dwOffset ); } - /* Functions to retrieve resources by their name */ + // Functions to retrieve resources by their name void *GetData( const char* strName ) const; LPDIRECT3DRESOURCE GetResource( const char* strName ) const - { - return RegisterResource( (LPDIRECT3DRESOURCE)GetData(strName)); - } + { return RegisterResource( (LPDIRECT3DRESOURCE)GetData( strName ) ); } LPDIRECT3DTEXTURE GetTexture( const char* strName ) const - { - return (LPDIRECT3DTEXTURE)GetResource( strName ); - } + { return (LPDIRECT3DTEXTURE)GetResource( strName ); } LPDIRECT3DVERTEXBUFFER GetVertexBuffer( const char* strName ) const - { - return (LPDIRECT3DVERTEXBUFFER)GetResource( strName ); - } + { return (LPDIRECT3DVERTEXBUFFER)GetResource( strName ); } - /* Constructor/destructor */ + // Constructor/destructor PackedResource(); ~PackedResource(); }; @@ -158,13 +143,13 @@ class PackedResource PackedResource::PackedResource() { - m_pSysMemData = NULL; - m_dwSysMemDataSize = 0L; - m_pVidMemData = NULL; - m_dwVidMemDataSize = 0L; - m_pResourceTags = NULL; + m_pSysMemData = NULL; + m_dwSysMemDataSize = 0L; + m_pVidMemData = NULL; + m_dwVidMemDataSize = 0L; + m_pResourceTags = NULL; m_dwNumResourceTags = 0L; - m_bInitialized = FALSE; + m_bInitialized = FALSE; } @@ -250,8 +235,8 @@ HRESULT PackedResource::Create(const char *strFilename) XPR_HEADER xprh; bool retval; #ifdef _XBOX1 - char strResourcePath[512]; BOOL bHasResourceOffsetsTable = FALSE; + char strResourcePath[512]; if (FAILED(FindMediaFile(strResourcePath, strFilename, sizeof(strResourcePath)))) return E_FAIL; @@ -285,7 +270,7 @@ HRESULT PackedResource::Create(const char *strFilename) return E_FAIL; } - /* Compute memory requirements */ + // Compute memory requirements #if defined(_XBOX1) m_dwSysMemDataSize = xprh.dwHeaderSize - sizeof(XPR_HEADER); m_dwVidMemDataSize = xprh.dwTotalSize - xprh.dwHeaderSize; @@ -294,7 +279,7 @@ HRESULT PackedResource::Create(const char *strFilename) m_dwVidMemDataSize = xprh.dwDataSize; #endif - /* Allocate memory */ + // Allocate memory m_pSysMemData = (BYTE*)malloc(m_dwSysMemDataSize); if (m_pSysMemData == NULL) { @@ -319,7 +304,7 @@ HRESULT PackedResource::Create(const char *strFilename) return E_FAIL; } - /* Read in the data from the file */ + // Read in the data from the file if( !ReadFile( hFile, m_pSysMemData, m_dwSysMemDataSize, &dwNumBytesRead, NULL) || !ReadFile( hFile, m_pVidMemData, m_dwVidMemDataSize, &dwNumBytesRead, NULL)) { @@ -327,7 +312,7 @@ HRESULT PackedResource::Create(const char *strFilename) return E_FAIL; } - /* Done with the file */ + // Done with the file CloseHandle( hFile); #ifdef _XBOX1 @@ -386,17 +371,16 @@ void PackedResource::GetResourceTags(DWORD* pdwNumResourceTags, void PackedResource::Destroy() { free(m_pSysMemData); + m_pSysMemData = NULL; + m_dwSysMemDataSize = 0L; - if (m_pVidMemData) + if (m_pVidMemData != NULL) FreeContiguousMemory(m_pVidMemData); - m_pSysMemData = NULL; - m_dwSysMemDataSize = 0L; + m_pVidMemData = NULL; + m_dwVidMemDataSize = 0L; - m_pVidMemData = NULL; - m_dwVidMemDataSize = 0L; - - m_pResourceTags = NULL; + m_pResourceTags = NULL; m_dwNumResourceTags = 0L; m_bInitialized = FALSE; @@ -546,6 +530,8 @@ static void *xdk360_init_font(void *video_data, if (!font) return NULL; + (void)font_size; + font->d3d = (d3d_video_t*)video_data; font->m_pFontTexture = NULL; @@ -613,10 +599,10 @@ static void xdk360_free_font(void *data) return; /* Destroy the font */ - font->m_pFontTexture = NULL; - font->m_dwNumGlyphs = 0L; - font->m_Glyphs = NULL; - font->m_cMaxGlyph = 0; + font->m_pFontTexture = NULL; + font->m_dwNumGlyphs = 0L; + font->m_Glyphs = NULL; + font->m_cMaxGlyph = 0; font->m_TranslatorTable = NULL; if (font->s_FontLocals.m_pFontPixelShader) @@ -626,12 +612,15 @@ static void xdk360_free_font(void *data) if (font->s_FontLocals.m_pFontVertexDecl) font->s_FontLocals.m_pFontVertexDecl->Release(); - font->s_FontLocals.m_pFontPixelShader = NULL; + font->s_FontLocals.m_pFontPixelShader = NULL; font->s_FontLocals.m_pFontVertexShader = NULL; - font->s_FontLocals.m_pFontVertexDecl = NULL; + font->s_FontLocals.m_pFontVertexDecl = NULL; if (m_xprResource.Initialized()) m_xprResource.Destroy(); + + free(font); + font = NULL; } static void xdk360_render_msg_post(xdk360_video_font_t * font) @@ -655,7 +644,7 @@ static void xdk360_render_msg_pre(xdk360_video_font_t * font) d3dr->GetRenderState( D3DRS_VIEWPORTENABLE, (DWORD*)&font->m_dwSavedState ); /* Set the texture scaling factor as a vertex shader constant. */ - D3DTexture_GetLevelDesc(font->m_pFontTexture, 0, &TextureDesc); /* Get the description */ + D3DTexture_GetLevelDesc(font->m_pFontTexture, 0, &TextureDesc); // Get the description /* Set render state. */ d3d_set_texture(d3dr, 0, font->m_pFontTexture); @@ -696,11 +685,11 @@ static void xdk360_draw_text(xdk360_video_font_t *font, * the vColor array. */ d3dr->SetVertexShaderConstantF(1, vColor, 1); - m_fCursorX = floorf(x); - m_fCursorY = floorf(y); + m_fCursorX = floorf(x); + m_fCursorY = floorf(y); /* Adjust for padding. */ - y -= font->m_fFontTopPadding; + y -= font->m_fFontTopPadding; /* Begin drawing the vertices * Declared as volatile to force writing in ascending @@ -710,7 +699,7 @@ static void xdk360_draw_text(xdk360_video_font_t *font, * memory. */ - dwNumChars = wcslen(strText); + dwNumChars = wcslen(strText); d3dr->BeginVertices(D3DPT_QUADLIST, 4 * dwNumChars, sizeof(XMFLOAT4), (void**)&pVertex); @@ -721,8 +710,8 @@ static void xdk360_draw_text(xdk360_video_font_t *font, #ifdef MSB_FIRST uint32_t tu1, tu2, tv1, tv2; #endif - const GLYPH_ATTR *pGlyph = NULL; - wchar_t letter = *strText++; /* Get the current letter in the string */ + const GLYPH_ATTR *pGlyph; + wchar_t letter = *strText++; /* Get the current letter in the string */ /* Handle the newline character. */ if (letter == L'\n') @@ -743,16 +732,16 @@ static void xdk360_draw_text(xdk360_video_font_t *font, fWidth = FONT_SCALE(font->d3d) * (float)pGlyph->wWidth; fHeight = FONT_SCALE(font->d3d) * font->m_fFontHeight; - m_fCursorX += fOffset; + m_fCursorX += fOffset; /* Add the vertices to draw this glyph. */ #ifdef MSB_FIRST /* Convert shorts to 32 bit longs for in register merging */ - tu1 = pGlyph->tu1; - tv1 = pGlyph->tv1; - tu2 = pGlyph->tu2; - tv2 = pGlyph->tv2; + tu1 = pGlyph->tu1; + tv1 = pGlyph->tv1; + tu2 = pGlyph->tu2; + tv2 = pGlyph->tv2; #endif /* NOTE: The vertexes are 2 floats for the screen coordinates, @@ -771,27 +760,27 @@ static void xdk360_draw_text(xdk360_video_font_t *font, /* Setup the vertex/screen coordinates */ - pVertex[0] = m_fCursorX; - pVertex[1] = m_fCursorY; - pVertex[3] = 0; - pVertex[4] = m_fCursorX + fWidth; - pVertex[5] = m_fCursorY; - pVertex[7] = 0; - pVertex[8] = m_fCursorX + fWidth; - pVertex[9] = m_fCursorY + fHeight; - pVertex[11] = 0; - pVertex[12] = m_fCursorX; - pVertex[13] = m_fCursorY + fHeight; + pVertex[0] = m_fCursorX; + pVertex[1] = m_fCursorY; + pVertex[3] = 0; + pVertex[4] = m_fCursorX + fWidth; + pVertex[5] = m_fCursorY; + pVertex[7] = 0; + pVertex[8] = m_fCursorX + fWidth; + pVertex[9] = m_fCursorY + fHeight; + pVertex[11] = 0; + pVertex[12] = m_fCursorX; + pVertex[13] = m_fCursorY + fHeight; #ifdef MSB_FIRST - ((volatile uint32_t *)pVertex)[2] = (tu1 << 16) | tv1; /* Merged using big endian rules */ - ((volatile uint32_t *)pVertex)[6] = (tu2 << 16) | tv1; /* Merged using big endian rules */ - ((volatile uint32_t*)pVertex)[10] = (tu2 << 16) | tv2; /* Merged using big endian rules */ - ((volatile uint32_t*)pVertex)[14] = (tu1 << 16) | tv2; /* Merged using big endian rules */ + ((volatile uint32_t *)pVertex)[2] = (tu1 << 16) | tv1; // Merged using big endian rules + ((volatile uint32_t *)pVertex)[6] = (tu2 << 16) | tv1; // Merged using big endian rules + ((volatile uint32_t*)pVertex)[10] = (tu2 << 16) | tv2; // Merged using big endian rules + ((volatile uint32_t*)pVertex)[14] = (tu1 << 16) | tv2; // Merged using big endian rules #endif - pVertex[15] = 0; + pVertex[15] = 0; + pVertex += 16; - pVertex += 16; - m_fCursorX += fAdvance; + m_fCursorX += fAdvance; dwNumChars--; } @@ -814,7 +803,9 @@ static void xdk360_draw_text(xdk360_video_font_t *font, d3dr->EndVertices(); } -static void xdk360_render_msg(void *data, const char *str_msg, +static void xdk360_render_msg( + video_frame_info_t *video_info, + void *data, const char *str_msg, const void *userdata) { float x, y; diff --git a/gfx/drivers_font_renderer/bitmap.h b/gfx/drivers_font_renderer/bitmap.h index a76ba2fbfc..5a5a4ba82b 100644 --- a/gfx/drivers_font_renderer/bitmap.h +++ b/gfx/drivers_font_renderer/bitmap.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers_font_renderer/bitmapfont.c b/gfx/drivers_font_renderer/bitmapfont.c index ee48fbc468..b6d289ec03 100644 --- a/gfx/drivers_font_renderer/bitmapfont.c +++ b/gfx/drivers_font_renderer/bitmapfont.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers_font_renderer/coretext.c b/gfx/drivers_font_renderer/coretext.c index c39618db5d..bd94b54a9c 100644 --- a/gfx/drivers_font_renderer/coretext.c +++ b/gfx/drivers_font_renderer/coretext.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2014-2015 - Jay McCarthy - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers_font_renderer/freetype.c b/gfx/drivers_font_renderer/freetype.c index a77f8ccde6..cb7c37ce47 100644 --- a/gfx/drivers_font_renderer/freetype.c +++ b/gfx/drivers_font_renderer/freetype.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers_font_renderer/stb.c b/gfx/drivers_font_renderer/stb.c index 4fb4e9cfaf..424e195859 100644 --- a/gfx/drivers_font_renderer/stb.c +++ b/gfx/drivers_font_renderer/stb.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2015-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers_font_renderer/stb_unicode.c b/gfx/drivers_font_renderer/stb_unicode.c index e4e1720a3c..40a7b5dd3b 100644 --- a/gfx/drivers_font_renderer/stb_unicode.c +++ b/gfx/drivers_font_renderer/stb_unicode.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2015-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers_shader/glslang_util.cpp b/gfx/drivers_shader/glslang_util.cpp index 9d013351da..7ba584c327 100644 --- a/gfx/drivers_shader/glslang_util.cpp +++ b/gfx/drivers_shader/glslang_util.cpp @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2016 - Hans-Kristian Arntzen + * Copyright (C) 2010-2017 - Hans-Kristian Arntzen * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers_shader/glslang_util.hpp b/gfx/drivers_shader/glslang_util.hpp index 263eefce5f..a9a42f1ee8 100644 --- a/gfx/drivers_shader/glslang_util.hpp +++ b/gfx/drivers_shader/glslang_util.hpp @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2016 - Hans-Kristian Arntzen + * Copyright (C) 2010-2017 - Hans-Kristian Arntzen * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers_shader/shader_gl_cg.c b/gfx/drivers_shader/shader_gl_cg.c index 6aee775f21..349b77936c 100644 --- a/gfx/drivers_shader/shader_gl_cg.c +++ b/gfx/drivers_shader/shader_gl_cg.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -48,9 +48,7 @@ #include "../video_shader_driver.h" #include "../video_shader_parse.h" -#include "../video_state_tracker.h" #include "../../core.h" -#include "../../dynamic.h" #include "../../managers/state_manager.h" #define SEMANTIC_TEXCOORD 0x92ee91cdU diff --git a/gfx/drivers_shader/shader_glsl.c b/gfx/drivers_shader/shader_glsl.c index cec9055b99..b49189c7d3 100644 --- a/gfx/drivers_shader/shader_glsl.c +++ b/gfx/drivers_shader/shader_glsl.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -33,8 +34,6 @@ #endif #include "shader_glsl.h" -#include "../video_state_tracker.h" -#include "../../dynamic.h" #include "../../managers/state_manager.h" #include "../../core.h" @@ -1367,12 +1366,16 @@ static bool gl_glsl_set_mvp(void *data, void *shader_data, const math_matrix_4x4 goto fallback; loc = glsl->uniforms[glsl->active_idx].mvp; - if (loc >= 0) { - if (current_idx != glsl->active_idx || mat->data != current_mat_data_pointer[glsl->active_idx] || *mat->data != current_mat_data[glsl->active_idx]) { + if (loc >= 0) + { + if ( (current_idx != glsl->active_idx) || + (mat->data != current_mat_data_pointer[glsl->active_idx]) || + (*mat->data != current_mat_data[glsl->active_idx])) + { glUniformMatrix4fv(loc, 1, GL_FALSE, mat->data); - current_idx = glsl->active_idx; + current_idx = glsl->active_idx; current_mat_data_pointer[glsl->active_idx] = (float*)mat->data; - current_mat_data[glsl->active_idx] = *mat->data; + current_mat_data[glsl->active_idx] = *mat->data; } } return true; diff --git a/gfx/drivers_shader/shader_glsl.h b/gfx/drivers_shader/shader_glsl.h index 0af251e5d8..9b04095cd7 100644 --- a/gfx/drivers_shader/shader_glsl.h +++ b/gfx/drivers_shader/shader_glsl.h @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers_shader/shader_hlsl.c b/gfx/drivers_shader/shader_hlsl.c index 6f8e471bb9..4bd0549ab9 100644 --- a/gfx/drivers_shader/shader_hlsl.c +++ b/gfx/drivers_shader/shader_hlsl.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -23,7 +23,7 @@ #include "shader_hlsl.h" #include "../video_shader_parse.h" -#include "../d3d/d3d.h" +#include "../drivers/d3d.h" #include "../../managers/state_manager.h" #include "../drivers/d3d_shaders/opaque.hlsl.d3d9.h" @@ -63,8 +63,8 @@ struct hlsl_shader_data void hlsl_set_proj_matrix(void *data, XMMATRIX rotation_value) { hlsl_shader_data_t *hlsl = (hlsl_shader_data_t*)data; - if (hlsl_data) - hlsl_data->prg[hlsl_data->active_idx].mvp_val = rotation_value; + if (hlsl) + hlsl->prg[hlsl->active_idx].mvp_val = rotation_value; } static void hlsl_set_uniform_parameter( @@ -126,12 +126,12 @@ static void hlsl_set_params(void *data, void *shader_data, const void *_feedback_info, const void *_fbo_info, unsigned fbo_info_cnt) { - d3d_video_t *d3d = (d3d_video_t*)data; - LPDIRECT3DDEVICE d3d_device_ptr = (LPDIRECT3DDEVICE)d3d->dev; - const struct video_tex_info *info = (const struct video_tex_info*)_info; + d3d_video_t *d3d = (d3d_video_t*)data; + LPDIRECT3DDEVICE d3d_device_ptr = (LPDIRECT3DDEVICE)d3d->dev; + const struct video_tex_info *info = (const struct video_tex_info*)_info; const struct video_tex_info *prev_info = (const struct video_tex_info*)_prev_info; - const struct video_tex_info *fbo_info = (const struct video_tex_info*)_fbo_info; - hlsl_shader_data_t *hlsl = (hlsl_shader_data_t*)shader_data; + const struct video_tex_info *fbo_info = (const struct video_tex_info*)_fbo_info; + hlsl_shader_data_t *hlsl = (hlsl_shader_data_t*)shader_data; if (!hlsl) return; @@ -165,15 +165,15 @@ static bool hlsl_compile_program( void *program_data, struct shader_program_info *program_info) { - hlsl_shader_data_t *hlsl = (hlsl_shader_data_t*)data; - d3d_video_t *d3d = (d3d_video_t*)hlsl->d3d; - struct shader_program_hlsl_data *program = (struct shader_program_hlsl_data*)program_data; - LPDIRECT3DDEVICE d3d_device_ptr = (LPDIRECT3DDEVICE)d3d->dev; HRESULT ret, ret_fp, ret_vp; - ID3DXBuffer *listing_f = NULL; - ID3DXBuffer *listing_v = NULL; - ID3DXBuffer *code_f = NULL; - ID3DXBuffer *code_v = NULL; + hlsl_shader_data_t *hlsl = (hlsl_shader_data_t*)data; + d3d_video_t *d3d = (d3d_video_t*)hlsl->d3d; + struct shader_program_hlsl_data *program = (struct shader_program_hlsl_data*)program_data; + LPDIRECT3DDEVICE d3d_device_ptr = (LPDIRECT3DDEVICE)d3d->dev; + ID3DXBuffer *listing_f = NULL; + ID3DXBuffer *listing_v = NULL; + ID3DXBuffer *code_f = NULL; + ID3DXBuffer *code_v = NULL; if (!program) program = &hlsl->prg[idx]; @@ -274,7 +274,7 @@ static bool hlsl_load_shader(hlsl_shader_data_t *hlsl, hlsl->d3d = (d3d_video_t*)data; - if (!hlsl_compile_program(hlsl, data, i + 1, &hlsl->prg[i + 1], &program_info)) + if (!hlsl_compile_program(hlsl, i + 1, &hlsl->prg[i + 1], &program_info)) return false; return true; @@ -304,7 +304,7 @@ static bool hlsl_load_plain(hlsl_shader_data_t *hlsl, void *data, const char *pa path, sizeof(hlsl->cg_shader->pass[0].source.path)); hlsl->d3d = (d3d_video_t*)data; - if (!hlsl_compile_program(hlsl, data, 1, &hlsl->prg[1], &progarm_info)) + if (!hlsl_compile_program(hlsl, 1, &hlsl->prg[1], &program_info)) return false; } else @@ -454,9 +454,7 @@ static void hlsl_use(void *data, void *shader_data, unsigned idx, bool set_activ if (hlsl_data && hlsl_data->prg[idx].vprg && hlsl_data->prg[idx].fprg) { if (set_active) - { hlsl_data->active_idx = idx; - } d3d_set_vertex_shader(d3dr, idx, hlsl_data->prg[idx].vprg); #ifdef _XBOX @@ -534,6 +532,7 @@ const shader_backend_t hlsl_backend = { hlsl_deinit, hlsl_set_params, hlsl_set_uniform_parameter, + NULL, /* compile_program */ hlsl_use, hlsl_num, hlsl_filter_type, diff --git a/gfx/drivers_shader/shader_hlsl.h b/gfx/drivers_shader/shader_hlsl.h index d1ab13a73c..a18e6d75ac 100644 --- a/gfx/drivers_shader/shader_hlsl.h +++ b/gfx/drivers_shader/shader_hlsl.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers_shader/shader_null.c b/gfx/drivers_shader/shader_null.c index 0d20a3c6ab..7b1a123126 100644 --- a/gfx/drivers_shader/shader_null.c +++ b/gfx/drivers_shader/shader_null.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -32,8 +32,6 @@ #endif #include "../video_shader_driver.h" -#include "../video_state_tracker.h" -#include "../../dynamic.h" typedef struct null_shader_data { diff --git a/gfx/drivers_shader/shader_vulkan.cpp b/gfx/drivers_shader/shader_vulkan.cpp index 50a80223bf..50bcdf412e 100644 --- a/gfx/drivers_shader/shader_vulkan.cpp +++ b/gfx/drivers_shader/shader_vulkan.cpp @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2016 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -2902,7 +2903,8 @@ vulkan_filter_chain_t *vulkan_filter_chain_create_from_preset( } auto itr = find_if(shader->parameters, shader->parameters + shader->num_parameters, - [&](const video_shader_parameter ¶m) { + [&](const video_shader_parameter ¶m) + { return meta_param.id == param.id; }); diff --git a/gfx/drivers_shader/shader_vulkan.h b/gfx/drivers_shader/shader_vulkan.h index 12bf7123aa..16ec5c1cb4 100644 --- a/gfx/drivers_shader/shader_vulkan.h +++ b/gfx/drivers_shader/shader_vulkan.h @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2016 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers_shader/slang_preprocess.cpp b/gfx/drivers_shader/slang_preprocess.cpp index f596521a50..a3c8061df0 100644 --- a/gfx/drivers_shader/slang_preprocess.cpp +++ b/gfx/drivers_shader/slang_preprocess.cpp @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2016 - Hans-Kristian Arntzen + * Copyright (C) 2010-2017 - Hans-Kristian Arntzen * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers_shader/slang_preprocess.h b/gfx/drivers_shader/slang_preprocess.h index 5721e5148a..37fd2ec91b 100644 --- a/gfx/drivers_shader/slang_preprocess.h +++ b/gfx/drivers_shader/slang_preprocess.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2016 - Hans-Kristian Arntzen + * Copyright (C) 2010-2017 - Hans-Kristian Arntzen * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers_shader/slang_reflection.cpp b/gfx/drivers_shader/slang_reflection.cpp index bf8f228a00..cbe2d21ed4 100644 --- a/gfx/drivers_shader/slang_reflection.cpp +++ b/gfx/drivers_shader/slang_reflection.cpp @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2016 - Hans-Kristian Arntzen + * Copyright (C) 2010-2017 - Hans-Kristian Arntzen * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers_shader/slang_reflection.hpp b/gfx/drivers_shader/slang_reflection.hpp index b2a9157286..a9799e3c51 100644 --- a/gfx/drivers_shader/slang_reflection.hpp +++ b/gfx/drivers_shader/slang_reflection.hpp @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2016 - Hans-Kristian Arntzen + * Copyright (C) 2010-2017 - Hans-Kristian Arntzen * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers_tracker/video_state_python.c b/gfx/drivers_tracker/video_state_python.c index 3a62a911bb..dc86caa010 100644 --- a/gfx/drivers_tracker/video_state_python.c +++ b/gfx/drivers_tracker/video_state_python.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/drivers_tracker/video_state_python.h b/gfx/drivers_tracker/video_state_python.h index 8fca2d5d0c..4abdb929f2 100644 --- a/gfx/drivers_tracker/video_state_python.h +++ b/gfx/drivers_tracker/video_state_python.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/font_driver.c b/gfx/font_driver.c index 717800bd6a..a6342a7a7f 100644 --- a/gfx/font_driver.c +++ b/gfx/font_driver.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -14,10 +14,6 @@ * If not, see . */ -#include - -#include - #include "font_driver.h" #include "video_thread_wrapper.h" @@ -28,6 +24,8 @@ #include "../config.h" #endif +#include + static const font_renderer_driver_t *font_backends[] = { #ifdef HAVE_FREETYPE &freetype_font_renderer, @@ -180,6 +178,64 @@ static bool caca_font_init_first( } #endif +#ifdef DJGPP +static const font_renderer_t *vga_font_backends[] = { + &vga_font, + NULL, +}; + +static bool vga_font_init_first( + const void **font_driver, void **font_handle, + void *video_data, const char *font_path, float font_size) +{ + unsigned i; + + for (i = 0; vga_font_backends[i]; i++) + { + void *data = vga_font_backends[i]->init( + video_data, font_path, font_size); + + if (!data) + continue; + + *font_driver = vga_font_backends[i]; + *font_handle = data; + return true; + } + + return false; +} +#endif + +#if defined(_WIN32) && !defined(_XBOX) +static const font_renderer_t *gdi_font_backends[] = { + &gdi_font, + NULL, +}; + +static bool gdi_font_init_first( + const void **font_driver, void **font_handle, + void *video_data, const char *font_path, float font_size) +{ + unsigned i; + + for (i = 0; gdi_font_backends[i]; i++) + { + void *data = gdi_font_backends[i]->init( + video_data, font_path, font_size); + + if (!data) + continue; + + *font_driver = gdi_font_backends[i]; + *font_handle = data; + return true; + } + + return false; +} +#endif + #ifdef HAVE_VULKAN static const font_renderer_t *vulkan_font_backends[] = { &vulkan_raster_font, @@ -194,8 +250,7 @@ static bool vulkan_font_init_first( for (i = 0; vulkan_font_backends[i]; i++) { - void *data = vulkan_font_backends[i]->init( - video_data, font_path, font_size); + void *data = vulkan_font_backends[i]->init(video_data, font_path, font_size); if (!data) continue; @@ -304,6 +359,16 @@ static bool font_init_first( case FONT_DRIVER_RENDER_CACA: return caca_font_init_first(font_driver, font_handle, video_data, font_path, font_size); +#endif +#if defined(_WIN32) && !defined(_XBOX) + case FONT_DRIVER_RENDER_GDI: + return gdi_font_init_first(font_driver, font_handle, + video_data, font_path, font_size); +#endif +#ifdef DJGPP + case FONT_DRIVER_RENDER_VGA: + return vga_font_init_first(font_driver, font_handle, + video_data, font_path, font_size); #endif case FONT_DRIVER_RENDER_DONT_CARE: /* TODO/FIXME - lookup graphics driver's 'API' */ @@ -315,12 +380,14 @@ static bool font_init_first( return false; } -void font_driver_render_msg(void *font_data, - const char *msg, const struct font_params *params) +void font_driver_render_msg( + video_frame_info_t *video_info, + void *font_data, + const char *msg, const void *params) { font_data_t *font = (font_data_t*)(font_data ? font_data : video_font_driver); if (font && font->renderer && font->renderer->render_msg) - font->renderer->render_msg(font->renderer_data, msg, params); + font->renderer->render_msg(video_info, font->renderer_data, msg, params); } void font_driver_bind_block(void *font_data, void *block) @@ -331,11 +398,11 @@ void font_driver_bind_block(void *font_data, void *block) font->renderer->bind_block(font->renderer_data, block); } -void font_driver_flush(void *font_data) +void font_driver_flush(unsigned width, unsigned height, void *font_data) { font_data_t *font = (font_data_t*)(font_data ? font_data : video_font_driver); if (font && font->renderer && font->renderer->flush) - font->renderer->flush(font->renderer_data); + font->renderer->flush(width, height, font->renderer_data); } int font_driver_get_message_width(void *font_data, @@ -356,9 +423,6 @@ void font_driver_free(void *font_data) if (font->renderer && font->renderer->free) font->renderer->free(font->renderer_data); - if (font->renderer_data) - free(font->renderer_data); - font->renderer = NULL; font->renderer_data = NULL; @@ -370,9 +434,9 @@ font_data_t *font_driver_init_first( void *video_data, const char *font_path, float font_size, bool threading_hint, enum font_driver_render_api api) { - const void *font_driver = NULL; - void *font_handle = NULL; - bool ok = false; + const void *font_driver; + void *font_handle; + bool ok = false; #ifdef HAVE_THREADS if (threading_hint @@ -401,15 +465,12 @@ font_data_t *font_driver_init_first( void font_driver_init_osd(void *video_data, bool threading_hint, enum font_driver_render_api api) { settings_t *settings = config_get_ptr(); - const char *path = settings->path.font; - if (video_font_driver) return; video_font_driver = font_driver_init_first(video_data, - (!string_is_empty(path)) ? path : NULL, - settings->video.font_size, - threading_hint, api); + *settings->path.font ? settings->path.font : NULL, + settings->video.font_size, threading_hint, api); if (!video_font_driver) RARCH_ERR("[font]: Failed to initialize OSD font.\n"); diff --git a/gfx/font_driver.h b/gfx/font_driver.h index 6d3e374780..86c6365176 100644 --- a/gfx/font_driver.h +++ b/gfx/font_driver.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -22,6 +22,8 @@ #include #include +#include "video_driver.h" + RETRO_BEGIN_DECLS enum font_driver_render_api @@ -32,7 +34,9 @@ enum font_driver_render_api FONT_DRIVER_RENDER_VITA2D, FONT_DRIVER_RENDER_CTR, FONT_DRIVER_RENDER_VULKAN_API, - FONT_DRIVER_RENDER_CACA + FONT_DRIVER_RENDER_CACA, + FONT_DRIVER_RENDER_GDI, + FONT_DRIVER_RENDER_VGA }; enum text_alignment @@ -99,13 +103,15 @@ typedef struct font_renderer { void *(*init)(void *data, const char *font_path, float font_size); void (*free)(void *data); - void (*render_msg)(void *data, const char *msg, + void (*render_msg)( + video_frame_info_t *video_info, + void *data, const char *msg, const void *params); const char *ident; const struct font_glyph *(*get_glyph)(void *data, uint32_t code); void (*bind_block)(void *data, void *block); - void (*flush)(void *data); + void (*flush)(unsigned width, unsigned height, void *data); int (*get_message_width)(void *data, const char *msg, unsigned msg_len_full, float scale); } font_renderer_t; @@ -139,13 +145,14 @@ typedef struct int font_renderer_create_default(const void **driver, void **handle, const char *font_path, unsigned font_size); -void font_driver_render_msg(void *font_data, const char *msg, const struct font_params *params); +void font_driver_render_msg(video_frame_info_t *video_info, + void *font_data, const char *msg, const void *params); void font_driver_bind_block(void *font_data, void *block); int font_driver_get_message_width(void *font_data, const char *msg, unsigned len, float scale); -void font_driver_flush(void *font_data); +void font_driver_flush(unsigned width, unsigned height, void *font_data); void font_driver_free(void *font_data); @@ -164,6 +171,8 @@ extern font_renderer_t vita2d_vita_font; extern font_renderer_t ctr_font; extern font_renderer_t vulkan_raster_font; extern font_renderer_t caca_font; +extern font_renderer_t gdi_font; +extern font_renderer_t vga_font; extern font_renderer_driver_t stb_font_renderer; extern font_renderer_driver_t stb_unicode_font_renderer; diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index a3acb683a9..1d4eef161b 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -27,6 +27,7 @@ #endif #include "../configuration.h" +#include "../runloop.h" #include "../verbosity.h" static const gfx_ctx_driver_t *gfx_ctx_drivers[] = { @@ -88,6 +89,9 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = { #endif #if defined(HAVE_VULKAN) && defined(HAVE_VULKAN_DISPLAY) &gfx_ctx_khr_display, +#endif +#if defined(_WIN32) && !defined(_XBOX) + &gfx_ctx_gdi, #endif &gfx_ctx_null, NULL @@ -188,7 +192,7 @@ static const gfx_ctx_driver_t *video_context_driver_init( video_driver_build_info(&video_info); - ctx_data = ctx->init(video_info, data); + ctx_data = ctx->init(&video_info, data); if (!ctx_data) return NULL; @@ -275,11 +279,13 @@ bool video_context_driver_check_window(gfx_ctx_size_t *size_data) && current_video_context && current_video_context->check_window) { + bool is_shutdown = runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL); current_video_context->check_window(video_context_data, size_data->quit, size_data->resize, size_data->width, - size_data->height, ((unsigned int)*video_driver_get_frame_count_ptr())); + size_data->height, + is_shutdown); return true; } @@ -412,10 +418,14 @@ bool video_context_driver_get_metrics(gfx_ctx_metrics_t *metrics) bool video_context_driver_input_driver(gfx_ctx_input_t *inp) { + settings_t *settings = config_get_ptr(); + const char *joypad_name = settings ? settings->input.joypad_driver : NULL; + if (!current_video_context || !current_video_context->input_driver) return false; current_video_context->input_driver( - video_context_data, inp->input, inp->input_data); + video_context_data, joypad_name, + inp->input, inp->input_data); return true; } @@ -449,22 +459,12 @@ bool video_context_driver_set_video_mode(gfx_ctx_mode_t *mode_info) video_driver_build_info(&video_info); if (!current_video_context->set_video_mode( - video_context_data, video_info, mode_info->width, + video_context_data, &video_info, mode_info->width, mode_info->height, mode_info->fullscreen)) return false; return true; } -bool video_context_driver_set_resize(gfx_ctx_mode_t *mode_info) -{ - if (!current_video_context) - return false; - if (!current_video_context->set_resize( - video_context_data, mode_info->width, mode_info->height)) - return false; - return true; -} - bool video_context_driver_get_video_size(gfx_ctx_mode_t *mode_info) { if (!current_video_context || !current_video_context->get_video_size) diff --git a/gfx/video_context_driver.h b/gfx/video_context_driver.h index 27d07c2f2b..6bc9b30d4d 100644 --- a/gfx/video_context_driver.h +++ b/gfx/video_context_driver.h @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -37,7 +37,8 @@ enum gfx_ctx_api GFX_CTX_DIRECT3D8_API, GFX_CTX_DIRECT3D9_API, GFX_CTX_OPENVG_API, - GFX_CTX_VULKAN_API + GFX_CTX_VULKAN_API, + GFX_CTX_GDI_API }; enum display_metric_types @@ -66,7 +67,7 @@ typedef struct gfx_ctx_driver * to hold a pointer to it as the context never outlives the video driver. * * The context driver is responsible for it's own data.*/ - void* (*init)(video_frame_info_t video_info, void *video_driver); + void* (*init)(video_frame_info_t *video_info, void *video_driver); void (*destroy)(void *data); /* Which API to bind to. */ @@ -77,7 +78,7 @@ typedef struct gfx_ctx_driver void (*swap_interval)(void *data, unsigned); /* Sets video mode. Creates a window, etc. */ - bool (*set_video_mode)(void*, video_frame_info_t video_info, unsigned, unsigned, bool); + bool (*set_video_mode)(void*, video_frame_info_t *video_info, unsigned, unsigned, bool); /* Gets current window size. * If not initialized yet, it returns current screen size. */ @@ -100,12 +101,12 @@ typedef struct gfx_ctx_driver float (*translate_aspect)(void*, unsigned, unsigned); /* Asks driver to update window title (FPS, etc). */ - void (*update_window_title)(void*, video_frame_info_t video_info); + void (*update_window_title)(void*, video_frame_info_t *video_info); /* Queries for resize and quit events. * Also processes events. */ void (*check_window)(void*, bool*, bool*, - unsigned*, unsigned*, unsigned); + unsigned*, unsigned*, bool); /* Acknowledge a resize event. This is needed for some APIs. * Most backends will ignore this. */ @@ -122,11 +123,11 @@ typedef struct gfx_ctx_driver /* Swaps buffers. VBlank sync depends on * earlier calls to swap_interval. */ - void (*swap_buffers)(void*, video_frame_info_t video_info); + void (*swap_buffers)(void*, video_frame_info_t *video_info); /* Most video backends will want to use a certain input driver. * Checks for it here. */ - void (*input_driver)(void*, const input_driver_t**, void**); + void (*input_driver)(void*, const char *, const input_driver_t**, void**); /* Wraps whatever gl_proc_address() there is. * Does not take opaque, to avoid lots of ugly wrapper code. */ @@ -249,6 +250,7 @@ extern const gfx_ctx_driver_t gfx_ctx_cocoagl; extern const gfx_ctx_driver_t gfx_ctx_emscripten; extern const gfx_ctx_driver_t gfx_ctx_opendingux_fbdev; extern const gfx_ctx_driver_t gfx_ctx_khr_display; +extern const gfx_ctx_driver_t gfx_ctx_gdi; extern const gfx_ctx_driver_t gfx_ctx_null; /** @@ -300,6 +302,10 @@ void video_context_driver_destroy(void); #define video_context_driver_focus() ((video_context_data && current_video_context->has_focus && current_video_context->has_focus(video_context_data)) ? true : false) +#define video_context_driver_set_resize(mode_info) \ + if (current_video_context && current_video_context->set_resize) \ + current_video_context->set_resize(video_context_data, mode_info.width, mode_info.height) + bool video_context_driver_get_video_output_size(gfx_ctx_size_t *size_data); bool video_context_driver_swap_interval(unsigned *interval); @@ -312,8 +318,6 @@ bool video_context_driver_get_ident(gfx_ctx_ident_t *ident); bool video_context_driver_set_video_mode(gfx_ctx_mode_t *mode_info); -bool video_context_driver_set_resize(gfx_ctx_mode_t *mode_info); - bool video_context_driver_get_video_size(gfx_ctx_mode_t *mode_info); bool video_context_driver_get_context_data(void *data); @@ -332,7 +336,7 @@ bool video_context_driver_translate_aspect(gfx_ctx_aspect_t *aspect); bool video_context_driver_input_driver(gfx_ctx_input_t *inp); -#define video_context_driver_has_windowed() ((video_context_data && current_video_context->has_windowed(video_context_data)) ? true : false) +#define video_context_driver_has_windowed() ((video_context_data && current_video_context->has_windowed && current_video_context->has_windowed(video_context_data)) ? true : false) void video_context_driver_free(void); diff --git a/gfx/video_coord_array.c b/gfx/video_coord_array.c index 5d73f97df5..7369cfa279 100644 --- a/gfx/video_coord_array.c +++ b/gfx/video_coord_array.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_coord_array.h b/gfx/video_coord_array.h index 1c4db3fcbf..9a3ec1e1db 100644 --- a/gfx/video_coord_array.h +++ b/gfx/video_coord_array.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * copyright (c) 2011-2016 - Daniel De Matteis + * copyright (c) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_defines.h b/gfx/video_defines.h index b7f1b6a9a6..6e88843043 100644 --- a/gfx/video_defines.h +++ b/gfx/video_defines.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 0ebd227f01..fec0da21f9 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -39,6 +39,7 @@ #endif #ifdef HAVE_MENU +#include "../menu/menu_driver.h" #include "../menu/menu_setting.h" #endif @@ -65,6 +66,46 @@ #define FPS_UPDATE_INTERVAL 256 +#ifdef HAVE_THREADS +#define video_driver_lock() \ + if (display_lock) \ + slock_lock(display_lock) + +#define video_driver_unlock() \ + if (display_lock) \ + slock_unlock(display_lock) + +#define video_driver_context_lock() \ + if (context_lock) \ + slock_lock(context_lock) + +#define video_driver_context_unlock() \ + if (context_lock) \ + slock_unlock(context_lock) + +#define video_driver_lock_free() \ + slock_free(display_lock); \ + slock_free(context_lock); \ + display_lock = NULL; \ + context_lock = NULL + +#define video_driver_threaded_lock() \ + if (video_driver_is_threaded()) \ + video_driver_lock() + +#define video_driver_threaded_unlock() \ + if (video_driver_is_threaded()) \ + video_driver_unlock() +#else +#define video_driver_lock() ((void)0) +#define video_driver_unlock() ((void)0) +#define video_driver_lock_free() ((void)0) +#define video_driver_threaded_lock() ((void)0) +#define video_driver_threaded_unlock() ((void)0) +#define video_driver_context_lock() ((void)0) +#define video_driver_context_unlock() ((void)0) +#endif + typedef struct video_pixel_scaler { struct scaler_ctx *scaler; @@ -97,6 +138,8 @@ static unsigned video_driver_height = 0; static enum rarch_display_type video_driver_display_type = RARCH_DISPLAY_NONE; static char video_driver_title_buf[64] = {0}; +static char video_driver_window_title[128] = {0}; +static bool video_driver_window_title_update = true; static retro_time_t video_driver_frame_time_samples[MEASURE_FRAME_TIME_SAMPLES_COUNT]; static uint64_t video_driver_frame_time_count = 0; @@ -112,18 +155,18 @@ static const video_poke_interface_t *video_driver_poke = NULL; * being passed to video driver. */ static video_pixel_scaler_t *video_driver_scaler_ptr = NULL; -/* Graphics driver requires RGBA byte order data (ABGR on little-endian) - * for 32-bit. - * This takes effect for overlay and shader cores that wants to load - * data into graphics driver. Kinda hackish to place it here, it is only - * used for GLES. - * TODO: Refactor this better. */ static struct retro_hw_render_callback hw_render; static const struct retro_hw_render_context_negotiation_interface * hw_render_context_negotiation = NULL; +/* Graphics driver requires RGBA byte order data (ABGR on little-endian) + * for 32-bit. + * This takes effect for overlay and shader cores that wants to load + * data into graphics driver. Kinda hackish to place it here, it is only + * used for GLES. + * TODO: Refactor this better. */ static bool video_driver_use_rgba = false; static bool video_driver_data_own = false; static bool video_driver_active = false; @@ -141,6 +184,7 @@ static uint8_t *video_driver_record_gpu_buffer = NULL; #ifdef HAVE_THREADS static slock_t *display_lock = NULL; +static slock_t *context_lock = NULL; #endif struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END] = { @@ -227,8 +271,14 @@ static const video_driver_t *video_drivers[] = { #ifdef HAVE_XSHM &video_xshm, #endif +#if defined(_WIN32) && !defined(_XBOX) + &video_gdi, +#endif #ifdef HAVE_CACA &video_caca, +#endif +#ifdef DJGPP + &video_vga, #endif &video_null, NULL, @@ -753,7 +803,7 @@ static bool init_video(void) if (!video_init_thread((const video_driver_t**)¤t_video, &video_driver_data, input_get_double_ptr(), input_driver_get_data_ptr(), - current_video, &video)) + current_video, video)) { RARCH_ERR("Cannot open threaded video driver ... Exiting ...\n"); goto error; @@ -854,11 +904,10 @@ bool video_driver_get_video_output_size(unsigned *width, unsigned *height) return true; } -void video_driver_set_osd_msg(const char *msg, - const struct font_params *params, void *font) +void video_driver_set_osd_msg(const char *msg, const void *data, void *font) { if (video_driver_poke && video_driver_poke->set_osd_msg) - video_driver_poke->set_osd_msg(video_driver_data, msg, params, font); + video_driver_poke->set_osd_msg(video_driver_data, msg, data, font); } void video_driver_set_texture_enable(bool enable, bool fullscreen) @@ -927,18 +976,22 @@ void video_driver_cached_frame_get(const void **data, unsigned *width, void video_driver_get_size(unsigned *width, unsigned *height) { + video_driver_threaded_lock(); if (width) *width = video_driver_width; if (height) *height = video_driver_height; + video_driver_threaded_unlock(); } void video_driver_set_size(unsigned *width, unsigned *height) { + video_driver_threaded_lock(); if (width) video_driver_width = *width; if (height) video_driver_height = *height; + video_driver_threaded_unlock(); } /** @@ -1013,84 +1066,6 @@ bool video_monitor_fps_statistics(double *refresh_rate, } -/** - * video_monitor_get_fps: - * @buf : string suitable for Window title - * @size : size of buffer. - * @buf_fps : string of raw FPS only (optional). - * @size_fps : size of raw FPS buffer. - * - * Get the amount of frames per seconds. - * - * Returns: true if framerate per seconds could be obtained, - * otherwise false. - * - **/ -bool video_monitor_get_fps( - video_frame_info_t video_info, - char *buf, size_t size, - char *buf_fps, size_t size_fps) -{ - static retro_time_t curr_time; - static retro_time_t fps_time; - retro_time_t new_time = cpu_features_get_time_usec(); - - *buf = '\0'; - - if (video_driver_frame_count) - { - static float last_fps; - bool ret = false; - unsigned write_index = video_driver_frame_time_count++ & - (MEASURE_FRAME_TIME_SAMPLES_COUNT - 1); - - video_driver_frame_time_samples[write_index] = new_time - fps_time; - fps_time = new_time; - - if ((video_driver_frame_count % FPS_UPDATE_INTERVAL) == 0) - { - char frames_text[64]; - - last_fps = TIME_TO_FPS(curr_time, new_time, FPS_UPDATE_INTERVAL); - curr_time = new_time; - - fill_pathname_noext(buf, - video_driver_title_buf, - " || ", - size); - - if (video_info.fps_show) - { - char fps_text[64]; - snprintf(fps_text, sizeof(fps_text), " FPS: %6.1f || ", last_fps); - strlcat(buf, fps_text, size); - } - - strlcat(buf, "Frames: ", size); - - snprintf(frames_text, sizeof(frames_text), STRING_REP_UINT64, - (unsigned long long)video_driver_frame_count); - - strlcat(buf, frames_text, size); - ret = true; - } - - if (buf_fps && video_info.fps_show) - snprintf(buf_fps, size_fps, "FPS: %6.1f || %s: " STRING_REP_UINT64, - last_fps, - msg_hash_to_str(MSG_FRAMES), - (unsigned long long)video_driver_frame_count); - - return ret; - } - - curr_time = fps_time = new_time; - strlcpy(buf, video_driver_title_buf, size); - if (buf_fps) - strlcpy(buf_fps, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), size_fps); - - return true; -} float video_driver_get_aspect_ratio(void) { @@ -1104,7 +1079,7 @@ void video_driver_set_aspect_ratio_value(float value) static bool video_driver_frame_filter( const void *data, - video_frame_info_t video_info, + video_frame_info_t *video_info, unsigned width, unsigned height, size_t pitch, unsigned *output_width, unsigned *output_height, @@ -1125,9 +1100,10 @@ static bool video_driver_frame_filter( data, width, height, pitch); performance_counter_stop(&softfilter_process); - if (video_info.post_filter_record && recording_data) + if (video_info->post_filter_record && recording_data) recording_dump_frame(video_driver_state_buffer, - *output_width, *output_height, *output_pitch); + *output_width, *output_height, *output_pitch, + video_info->runloop_is_idle); return true; } @@ -1317,26 +1293,6 @@ void video_driver_menu_settings(void **list_data, void *list_info_data, #endif } - -#ifdef HAVE_THREADS -#define video_driver_lock() \ - if (display_lock) \ - slock_lock(display_lock) - -#define video_driver_unlock() \ - if (display_lock) \ - slock_unlock(display_lock) - -#define video_driver_lock_free() \ - slock_free(display_lock); \ - display_lock = NULL - -#else -#define video_driver_lock() ((void)0) -#define video_driver_unlock() ((void)0) -#define video_driver_lock_free() ((void)0) -#endif - static void video_driver_lock_new(void) { video_driver_lock_free(); @@ -1344,6 +1300,10 @@ static void video_driver_lock_new(void) if (!display_lock) display_lock = slock_new(); retro_assert(display_lock); + + if (!context_lock) + context_lock = slock_new(); + retro_assert(context_lock); #endif } @@ -1482,10 +1442,14 @@ void video_driver_set_viewport_core(void) /* Fallback to 1:1 pixel ratio if none provided */ if (geom->aspect_ratio > 0.0f) + { aspectratio_lut[ASPECT_RATIO_CORE].value = geom->aspect_ratio; + } else + { aspectratio_lut[ASPECT_RATIO_CORE].value = (float)geom->base_width / geom->base_height; + } } void video_driver_reset_custom_viewport(void) @@ -1648,7 +1612,8 @@ bool video_driver_find_driver(void) else { unsigned d; - RARCH_ERR("Couldn't find any video driver named \"%s\"\n", settings->video.driver); + RARCH_ERR("Couldn't find any video driver named \"%s\"\n", + settings->video.driver); RARCH_LOG_OUTPUT("Available video drivers are:\n"); for (d = 0; video_driver_find_handle(d); d++) RARCH_LOG_OUTPUT("\t%s\n", video_driver_find_ident(d)); @@ -1670,18 +1635,22 @@ void video_driver_apply_state_changes(void) video_driver_poke->apply_state_changes(video_driver_data); } -bool video_driver_read_viewport(uint8_t *buffer) +bool video_driver_read_viewport(uint8_t *buffer, bool is_idle) { if ( current_video->read_viewport - && current_video->read_viewport(video_driver_data, buffer)) + && current_video->read_viewport(video_driver_data, buffer, is_idle)) return true; return false; } -uint64_t *video_driver_get_frame_count_ptr(void) +uint64_t video_driver_get_frame_count(void) { - return &video_driver_frame_count; + uint64_t frame_count; + video_driver_threaded_lock(); + frame_count = video_driver_frame_count; + video_driver_threaded_unlock(); + return frame_count; } bool video_driver_frame_filter_alive(void) @@ -1765,7 +1734,7 @@ void video_driver_reinit(void) video_driver_get_hw_context(); if (hwr->cache_context) - video_driver_cache_context = true; + video_driver_cache_context = true; else video_driver_cache_context = false; @@ -1791,15 +1760,26 @@ bool video_driver_owns_driver(void) bool video_driver_is_hw_context(void) { - return hw_render.context_type != RETRO_HW_CONTEXT_NONE; + bool is_hw_context = false; + + video_driver_context_lock(); + is_hw_context = (hw_render.context_type != RETRO_HW_CONTEXT_NONE); + video_driver_context_unlock(); + + return is_hw_context; } void video_driver_deinit_hw_context(void) { + video_driver_context_lock(); + if (hw_render.context_destroy) hw_render.context_destroy(); memset(&hw_render, 0, sizeof(hw_render)); + + video_driver_context_unlock(); + hw_render_context_negotiation = NULL; } @@ -1964,7 +1944,7 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp, * geometry for the "normal" case. */ struct retro_system_av_info *av_info = video_viewport_get_system_av_info(); - unsigned base_height = 0; + unsigned base_height = 0; if (av_info) base_height = av_info->geometry.base_height; @@ -2033,6 +2013,89 @@ unsigned video_pixel_get_alignment(unsigned pitch) return 8; } +/** + * video_monitor_get_fps: + * + * Get the amount of frames per seconds. + **/ +static void video_monitor_get_fps(video_frame_info_t *video_info) +{ + static retro_time_t curr_time; + static retro_time_t fps_time; + static float last_fps; + unsigned write_index = 0; + retro_time_t new_time = cpu_features_get_time_usec(); + + if (!video_info->frame_count) + { + curr_time = fps_time = new_time; + strlcpy(video_driver_window_title, + video_driver_title_buf, + sizeof(video_driver_window_title)); + + if (video_info->fps_show) + strlcpy(video_info->fps_text, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), + sizeof(video_info->fps_text)); + + video_driver_window_title_update = true; + return; + } + + write_index = + video_driver_frame_time_count++ & + (MEASURE_FRAME_TIME_SAMPLES_COUNT - 1); + video_driver_frame_time_samples[write_index] = new_time - fps_time; + fps_time = new_time; + + if ((video_info->frame_count % FPS_UPDATE_INTERVAL) == 0) + { + char frames_text[64]; + + fill_pathname_noext(video_driver_window_title, + video_driver_title_buf, + " || ", + sizeof(video_driver_window_title)); + + if (video_info->fps_show) + { + last_fps = TIME_TO_FPS(curr_time, new_time, FPS_UPDATE_INTERVAL); + snprintf(video_info->fps_text, + sizeof(video_info->fps_text), + " FPS: %6.1f || ", last_fps); + strlcat(video_driver_window_title, + video_info->fps_text, + sizeof(video_driver_window_title)); + } + + curr_time = new_time; + + strlcat(video_driver_window_title, + "Frames: ", + sizeof(video_driver_window_title)); + + snprintf(frames_text, + sizeof(frames_text), + STRING_REP_UINT64, + (unsigned long long)video_info->frame_count); + + strlcat(video_driver_window_title, + frames_text, + sizeof(video_driver_window_title)); + + video_driver_window_title_update = true; + } + + if (video_info->fps_show) + snprintf( + video_info->fps_text, + sizeof(video_info->fps_text), + "FPS: %6.1f || %s: " STRING_REP_UINT64, + last_fps, + msg_hash_to_str(MSG_FRAMES), + (unsigned long long)video_info->frame_count); +} + /** * video_driver_frame: * @data : pointer to data of the video frame. @@ -2050,7 +2113,7 @@ void video_driver_frame(const void *data, unsigned width, static struct retro_perf_counter video_frame_conv = {0}; unsigned output_width = 0; unsigned output_height = 0; - unsigned output_pitch = 0; + unsigned output_pitch = 0; const char *msg = NULL; if (!video_driver_active) @@ -2073,10 +2136,21 @@ void video_driver_frame(const void *data, unsigned width, performance_counter_stop(&video_frame_conv); - video_driver_cached_frame_set(data, width, height, pitch); + if (data) + frame_cache_data = data; + frame_cache_width = width; + frame_cache_height = height; + frame_cache_pitch = pitch; video_driver_build_info(&video_info); + video_driver_threaded_lock(); + video_info.frame_count = video_driver_frame_count; + video_driver_frame_count++; + video_driver_threaded_unlock(); + + video_monitor_get_fps(&video_info); + /* Slightly messy code, * but we really need to do processing before blocking on VSync * for best possible scheduling. @@ -2089,10 +2163,10 @@ void video_driver_frame(const void *data, unsigned width, || video_driver_record_gpu_buffer ) && recording_data ) - recording_dump_frame(data, width, height, pitch); + recording_dump_frame(data, width, height, pitch, video_info.runloop_is_idle); if (data && video_driver_state_filter && - video_driver_frame_filter(data, video_info, width, height, pitch, + video_driver_frame_filter(data, &video_info, width, height, pitch, &output_width, &output_height, &output_pitch)) { data = video_driver_state_buffer; @@ -2103,17 +2177,19 @@ void video_driver_frame(const void *data, unsigned width, video_driver_msg[0] = '\0'; - if (runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_PULL, &msg) - && video_info.font_enable && msg) + if ( video_info.font_enable + && runloop_msg_queue_pull((const char**)&msg) + && msg) strlcpy(video_driver_msg, msg, sizeof(video_driver_msg)); if (!current_video || !current_video->frame( video_driver_data, data, width, height, - video_driver_frame_count, - pitch, video_driver_msg, video_info)) + video_info.frame_count, + pitch, video_driver_msg, &video_info)) video_driver_active = false; - video_driver_frame_count++; + if (video_info.fps_show) + runloop_msg_queue_push(video_info.fps_text, 1, 1, false); } void video_driver_display_type_set(enum rarch_display_type type) @@ -2172,7 +2248,12 @@ bool video_driver_texture_unload(uintptr_t *id) void video_driver_build_info(video_frame_info_t *video_info) { - settings_t *settings = config_get_ptr(); + bool is_paused = false; + bool is_idle = false; + bool is_slowmotion = false; + settings_t *settings = NULL; + video_driver_threaded_lock(); + settings = config_get_ptr(); video_info->refresh_rate = settings->video.refresh_rate; video_info->black_frame_insertion = settings->video.black_frame_insertion; @@ -2184,9 +2265,63 @@ void video_driver_build_info(video_frame_info_t *video_info) video_info->post_filter_record = settings->video.post_filter_record; video_info->max_swapchain_images = settings->video.max_swapchain_images; video_info->windowed_fullscreen = settings->video.windowed_fullscreen; + video_info->fullscreen = settings->video.fullscreen; video_info->monitor_index = settings->video.monitor_index; video_info->shared_context = settings->video.shared_context; video_info->font_enable = settings->video.font_enable; + video_info->font_msg_pos_x = settings->video.msg_pos_x; + video_info->font_msg_pos_y = settings->video.msg_pos_y; + video_info->font_msg_color_r = settings->video.msg_color_r; + video_info->font_msg_color_g = settings->video.msg_color_g; + video_info->font_msg_color_b = settings->video.msg_color_b; + + video_info->frame_count = 0; + video_info->fps_text[0] = '\0'; + + video_info->width = video_driver_width; + video_info->height = video_driver_height; + + video_info->use_rgba = video_driver_use_rgba; + + video_info->libretro_running = false; +#ifdef HAVE_MENU + video_info->menu_is_alive = menu_driver_is_alive(); + video_info->menu_footer_opacity = settings->menu.footer.opacity; + video_info->menu_header_opacity = settings->menu.header.opacity; + video_info->materialui_color_theme = settings->menu.materialui.menu_color_theme; + video_info->menu_shader_pipeline = settings->menu.xmb.shader_pipeline; + video_info->xmb_theme = settings->menu.xmb.theme; + video_info->xmb_color_theme = settings->menu.xmb.menu_color_theme; + video_info->timedate_enable = settings->menu.timedate_enable; + video_info->battery_level_enable = settings->menu.battery_level_enable; + video_info->xmb_shadows_enable = settings->menu.xmb.shadows_enable; + video_info->xmb_alpha_factor = settings->menu.xmb.alpha_factor; + video_info->menu_wallpaper_opacity = settings->menu.wallpaper.opacity; + + if (!settings->menu.pause_libretro) + video_info->libretro_running = (rarch_ctl(RARCH_CTL_IS_INITED, NULL) + && !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)); +#else + video_info->menu_is_alive = false; + video_info->menu_footer_opacity = 0.0f; + video_info->menu_header_opacity = 0.0f; + video_info->materialui_color_theme = 0; + video_info->menu_shader_pipeline = 0; + video_info->xmb_color_theme = 0; + video_info->xmb_theme = 0; + video_info->timedate_enable = false; + video_info->battery_level_enable = false; + video_info->xmb_shadows_enable = false; + video_info->xmb_alpha_factor = 0.0f; + video_info->menu_wallpaper_opacity = 0.0f; +#endif + + runloop_get_status(&is_paused, &is_idle, &is_slowmotion); + + video_info->runloop_is_paused = is_paused; + video_info->runloop_is_idle = is_idle; + video_info->runloop_is_slowmotion = is_slowmotion; + video_driver_threaded_unlock(); } /** @@ -2225,20 +2360,29 @@ bool video_driver_translate_coord_viewport( if (scaled_screen_y < -0x7fff || scaled_screen_y > 0x7fff) scaled_screen_y = -0x8000; /* OOB */ - mouse_x -= vp->x; - mouse_y -= vp->y; + mouse_x -= vp->x; + mouse_y -= vp->y; - scaled_x = (2 * mouse_x * 0x7fff) / norm_full_vp_width - 0x7fff; - scaled_y = (2 * mouse_y * 0x7fff) / norm_full_vp_height - 0x7fff; + scaled_x = (2 * mouse_x * 0x7fff) / norm_full_vp_width - 0x7fff; + scaled_y = (2 * mouse_y * 0x7fff) / norm_full_vp_height - 0x7fff; if (scaled_x < -0x7fff || scaled_x > 0x7fff) - scaled_x = -0x8000; /* OOB */ + scaled_x = -0x8000; /* OOB */ if (scaled_y < -0x7fff || scaled_y > 0x7fff) - scaled_y = -0x8000; /* OOB */ + scaled_y = -0x8000; /* OOB */ - *res_x = scaled_x; - *res_y = scaled_y; - *res_screen_x = scaled_screen_x; - *res_screen_y = scaled_screen_y; + *res_x = scaled_x; + *res_y = scaled_y; + *res_screen_x = scaled_screen_x; + *res_screen_y = scaled_screen_y; return true; } + +void video_driver_get_window_title(char *buf, unsigned len) +{ + if (buf && video_driver_window_title_update) + { + strlcpy(buf, video_driver_window_title, len); + video_driver_window_title_update = false; + } +} diff --git a/gfx/video_driver.h b/gfx/video_driver.h index e6f83c1a21..505d733ffa 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -32,7 +32,6 @@ #include "../input/input_overlay.h" #endif -#include "font_driver.h" #include "video_defines.h" #include "video_filter.h" #include "video_shader_parse.h" @@ -87,6 +86,7 @@ typedef struct video_info typedef struct video_frame_info { + float menu_wallpaper_opacity; float refresh_rate; bool shared_context; bool black_frame_insertion; @@ -98,8 +98,41 @@ typedef struct video_frame_info bool post_filter_record; unsigned max_swapchain_images; bool windowed_fullscreen; + bool fullscreen; unsigned monitor_index; bool font_enable; + char fps_text[128]; + uint64_t frame_count; + + unsigned width; + unsigned height; + + float font_msg_pos_x; + float font_msg_pos_y; + float font_msg_color_r; + float font_msg_color_g; + float font_msg_color_b; + bool use_rgba; + bool libretro_running; + + float menu_header_opacity; + float menu_footer_opacity; + + bool xmb_shadows_enable; + float xmb_alpha_factor; + unsigned xmb_theme; + unsigned xmb_color_theme; + unsigned menu_shader_pipeline; + + unsigned materialui_color_theme; + + bool battery_level_enable; + bool timedate_enable; + bool runloop_is_slowmotion; + bool runloop_is_idle; + bool runloop_is_paused; + + bool menu_is_alive; } video_frame_info_t; /* Optionally implemented interface to poke more @@ -135,7 +168,7 @@ typedef struct video_poke_interface /* Enable or disable rendering. */ void (*set_texture_enable)(void *data, bool enable, bool full_screen); void (*set_osd_msg)(void *data, const char *msg, - const struct font_params *params, void *font); + const void *params, void *font); void (*show_mouse)(void *data, bool state); void (*grab_mouse_toggle)(void *data); @@ -162,7 +195,7 @@ typedef struct video_viewport typedef bool (*video_driver_frame_t)(void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, - unsigned pitch, const char *msg, video_frame_info_t video_info); + unsigned pitch, const char *msg, video_frame_info_t *video_info); typedef struct video_driver { @@ -209,7 +242,7 @@ typedef struct video_driver void (*viewport_info)(void *data, struct video_viewport *vp); /* Reads out in BGR byte order (24bpp). */ - bool (*read_viewport)(void *data, uint8_t *buffer); + bool (*read_viewport)(void *data, uint8_t *buffer, bool is_idle); /* Returns a pointer to a newly allocated buffer that can * (and must) be passed to free() by the caller, containing a @@ -241,7 +274,7 @@ extern struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END]; #if defined(RARCH_CONSOLE) || defined(RARCH_MOBILE) #define video_driver_has_windowed() (false) #else -#define video_driver_has_windowed() (current_video->has_windowed(video_driver_data)) +#define video_driver_has_windowed() (current_video->has_windowed && current_video->has_windowed(video_driver_data)) #endif #define video_driver_cached_frame_has_valid_framebuffer() (frame_cache_data ? (frame_cache_data == RETRO_HW_FRAME_BUFFER_VALID) : false) @@ -272,9 +305,9 @@ void video_driver_hide_mouse(void); void video_driver_set_nonblock_state(bool toggle); bool video_driver_find_driver(void); void video_driver_apply_state_changes(void); -bool video_driver_read_viewport(uint8_t *buffer); +bool video_driver_read_viewport(uint8_t *buffer, bool is_idle); bool video_driver_cached_frame(void); -uint64_t *video_driver_get_frame_count_ptr(void); +uint64_t video_driver_get_frame_count(void); bool video_driver_frame_filter_alive(void); bool video_driver_frame_filter_is_32bit(void); void video_driver_default_settings(void); @@ -369,7 +402,7 @@ bool video_driver_get_video_output_size( unsigned *width, unsigned *height); void video_driver_set_osd_msg(const char *msg, - const struct font_params *params, void *font); + const void *params, void *font); void video_driver_set_texture_enable(bool enable, bool full_screen); @@ -461,25 +494,6 @@ void video_monitor_set_refresh_rate(float hz); bool video_monitor_fps_statistics(double *refresh_rate, double *deviation, unsigned *sample_points); -/** - * video_monitor_get_fps: - * @video_info : information about the video frame - * @buf : string suitable for Window title - * @size : size of buffer. - * @buf_fps : string of raw FPS only (optional). - * @size_fps : size of raw FPS buffer. - * - * Get the amount of frames per seconds. - * - * Returns: true if framerate per seconds could be obtained, - * otherwise false. - * - **/ -bool video_monitor_get_fps( - video_frame_info_t video_info, - char *buf, size_t size, - char *buf_fps, size_t size_fps); - unsigned video_pixel_get_alignment(unsigned pitch); const video_poke_interface_t *video_driver_get_poke(void); @@ -542,6 +556,8 @@ void video_driver_build_info(video_frame_info_t *video_info); void video_driver_reinit(void); +void video_driver_get_window_title(char *buf, unsigned len); + extern video_driver_t video_gl; extern video_driver_t video_vulkan; extern video_driver_t video_psp1; @@ -563,6 +579,8 @@ extern video_driver_t video_sunxi; extern video_driver_t video_drm; extern video_driver_t video_xshm; extern video_driver_t video_caca; +extern video_driver_t video_gdi; +extern video_driver_t video_vga; extern video_driver_t video_null; extern const void *frame_cache_data; diff --git a/gfx/video_filter.c b/gfx/video_filter.c index 8d6c1df756..5886025f5a 100644 --- a/gfx/video_filter.c +++ b/gfx/video_filter.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_filter.h b/gfx/video_filter.h index 5921657b78..d11c9eb993 100644 --- a/gfx/video_filter.h +++ b/gfx/video_filter.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_filters/2xbr.c b/gfx/video_filters/2xbr.c index dda4c3b204..249672723a 100644 --- a/gfx/video_filters/2xbr.c +++ b/gfx/video_filters/2xbr.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2014 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_filters/2xsai.c b/gfx/video_filters/2xsai.c index 07de2faadd..52716838f1 100644 --- a/gfx/video_filters/2xsai.c +++ b/gfx/video_filters/2xsai.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2014 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_filters/blargg_ntsc_snes.c b/gfx/video_filters/blargg_ntsc_snes.c index b9ce865255..ec008cfe29 100644 --- a/gfx/video_filters/blargg_ntsc_snes.c +++ b/gfx/video_filters/blargg_ntsc_snes.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2014 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_filters/darken.c b/gfx/video_filters/darken.c index a9d3e29b8a..0a9fc1a0d0 100644 --- a/gfx/video_filters/darken.c +++ b/gfx/video_filters/darken.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2014 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_filters/epx.c b/gfx/video_filters/epx.c index 26be6cbed5..f3a7c986e4 100644 --- a/gfx/video_filters/epx.c +++ b/gfx/video_filters/epx.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2014 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -122,7 +122,7 @@ static void epx_generic_rgb565 (unsigned width, unsigned height, dP1 = (uint32_t *) dst; dP2 = (uint32_t *) (dst + dst_stride); - // left edge + /* left edge */ colorX = *sP; colorC = *++sP; @@ -145,8 +145,6 @@ static void epx_generic_rgb565 (unsigned width, unsigned height, dP1++; dP2++; - // - for (w = width - 2; w; w--) { colorA = colorX; @@ -172,7 +170,7 @@ static void epx_generic_rgb565 (unsigned width, unsigned height, dP2++; } - // right edge + /* right edge */ colorA = colorX; colorX = colorC; diff --git a/gfx/video_filters/lq2x.c b/gfx/video_filters/lq2x.c index 6123bff5fc..043dc6761a 100644 --- a/gfx/video_filters/lq2x.c +++ b/gfx/video_filters/lq2x.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2014 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_filters/phosphor2x.c b/gfx/video_filters/phosphor2x.c index 92d4a3dc82..7cc3d8d8d1 100644 --- a/gfx/video_filters/phosphor2x.c +++ b/gfx/video_filters/phosphor2x.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2014 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_filters/scale2x.c b/gfx/video_filters/scale2x.c index 9bd69b8724..733f9c8f80 100644 --- a/gfx/video_filters/scale2x.c +++ b/gfx/video_filters/scale2x.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2014 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -14,7 +14,7 @@ * If not, see . */ -// Compile: gcc -o scale2x.so -shared scale2x.c -std=c99 -O3 -Wall -pedantic -fPIC +/* Compile: gcc -o scale2x.so -shared scale2x.c -std=c99 -O3 -Wall -pedantic -fPIC */ #include "softfilter.h" #include diff --git a/gfx/video_filters/softfilter.h b/gfx/video_filters/softfilter.h index b2c3b9a2be..937e3fba8d 100644 --- a/gfx/video_filters/softfilter.h +++ b/gfx/video_filters/softfilter.h @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_filters/super2xsai.c b/gfx/video_filters/super2xsai.c index 2546cef57c..70e670640d 100644 --- a/gfx/video_filters/super2xsai.c +++ b/gfx/video_filters/super2xsai.c @@ -14,7 +14,7 @@ * If not, see . */ -// Compile: gcc -o supertwoxsai.so -shared supertwoxsai.c -std=c99 -O3 -Wall -pedantic -fPIC +/* Compile: gcc -o supertwoxsai.so -shared supertwoxsai.c -std=c99 -O3 -Wall -pedantic -fPIC */ #include "softfilter.h" #include diff --git a/gfx/video_filters/supereagle.c b/gfx/video_filters/supereagle.c index 8c243d486a..d1af9b1597 100644 --- a/gfx/video_filters/supereagle.c +++ b/gfx/video_filters/supereagle.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2014 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -14,7 +14,7 @@ * If not, see . */ -// Compile: gcc -o supereagle.so -shared supereagle.c -std=c99 -O3 -Wall -pedantic -fPIC +/* Compile: gcc -o supereagle.so -shared supereagle.c -std=c99 -O3 -Wall -pedantic -fPIC */ #include "softfilter.h" #include @@ -308,7 +308,7 @@ static void supereagle_generic_packets(void *data, thr->width = width; thr->height = y_end - y_start; - // Workers need to know if they can access pixels outside their given buffer. + /* Workers need to know if they can access pixels outside their given buffer. */ thr->first = y_start; thr->last = y_end == height; diff --git a/gfx/video_shader_driver.c b/gfx/video_shader_driver.c index 528d5b37c0..f666aae568 100644 --- a/gfx/video_shader_driver.c +++ b/gfx/video_shader_driver.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_shader_driver.h b/gfx/video_shader_driver.h index 5207777911..ab344056b5 100644 --- a/gfx/video_shader_driver.h +++ b/gfx/video_shader_driver.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_shader_parse.c b/gfx/video_shader_parse.c index df50a2d75e..b1a8329bcd 100644 --- a/gfx/video_shader_parse.c +++ b/gfx/video_shader_parse.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_shader_parse.h b/gfx/video_shader_parse.h index 116a1d415c..79579fb7d8 100644 --- a/gfx/video_shader_parse.h +++ b/gfx/video_shader_parse.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_state_tracker.c b/gfx/video_state_tracker.c index b1bf54d5bb..4a6694d892 100644 --- a/gfx/video_state_tracker.c +++ b/gfx/video_state_tracker.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -28,8 +28,9 @@ #endif #include "video_state_tracker.h" + #include "../input/input_config.h" -#include "../configuration.h" + #include "../verbosity.h" struct state_tracker_internal diff --git a/gfx/video_state_tracker.h b/gfx/video_state_tracker.h index 17a512f1e2..471f3d287e 100644 --- a/gfx/video_state_tracker.h +++ b/gfx/video_state_tracker.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/gfx/video_thread_wrapper.c b/gfx/video_thread_wrapper.c index 63720d0579..ce76aa5fb5 100644 --- a/gfx/video_thread_wrapper.c +++ b/gfx/video_thread_wrapper.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -187,6 +187,7 @@ struct thread_video bool suppress_screensaver; bool has_windowed; bool nonblock; + bool is_idle; retro_time_t last_time; unsigned hit_count; @@ -393,7 +394,7 @@ static bool video_thread_handle_packet( if (thr->driver->read_viewport) ret = thr->driver->read_viewport(thr->driver_data, - (uint8_t*)pkt.data.v); + (uint8_t*)pkt.data.v, thr->is_idle); pkt.data.b = ret; thr->frame.within_thread = false; @@ -619,7 +620,7 @@ static void video_thread_loop(void *data) thr->frame.buffer, thr->frame.width, thr->frame.height, thr->frame.count, thr->frame.pitch, *thr->frame.msg ? thr->frame.msg : NULL, - video_info); + &video_info); } slock_unlock(thr->frame.lock); @@ -706,7 +707,7 @@ static bool video_thread_has_windowed(void *data) static bool video_thread_frame(void *data, const void *frame_, unsigned width, unsigned height, uint64_t frame_count, - unsigned pitch, const char *msg, video_frame_info_t video_info) + unsigned pitch, const char *msg, video_frame_info_t *video_info) { unsigned copy_stride; static struct retro_perf_counter thr_frame = {0}; @@ -741,7 +742,7 @@ static bool video_thread_frame(void *data, const void *frame_, { retro_time_t target_frame_time = (retro_time_t) - roundf(1000000 / video_info.refresh_rate); + roundf(1000000 / video_info->refresh_rate); retro_time_t target = thr->last_time + target_frame_time; /* Ideally, use absolute time, but that is only a good idea on POSIX. */ @@ -809,7 +810,8 @@ static void video_thread_set_nonblock_state(void *data, bool state) thr->nonblock = state; } -static bool video_thread_init(thread_video_t *thr, const video_info_t *info, +static bool video_thread_init(thread_video_t *thr, + const video_info_t info, const input_driver_t **input, void **input_data) { size_t max_size; @@ -822,15 +824,15 @@ static bool video_thread_init(thread_video_t *thr, const video_info_t *info, thr->cond_thread = scond_new(); thr->input = input; thr->input_data = input_data; - thr->info = *info; + thr->info = info; thr->alive = true; thr->focus = true; thr->has_windowed = true; thr->suppress_screensaver = true; - max_size = info->input_scale * RARCH_SCALE_BASE; + max_size = info.input_scale * RARCH_SCALE_BASE; max_size *= max_size; - max_size *= info->rgb32 ? sizeof(uint32_t) : sizeof(uint16_t); + max_size *= info.rgb32 ? sizeof(uint32_t) : sizeof(uint16_t); thr->frame.buffer = (uint8_t*)malloc(max_size); if (!thr->frame.buffer) @@ -915,7 +917,7 @@ static void video_thread_viewport_info(void *data, struct video_viewport *vp) slock_unlock(thr->lock); } -static bool video_thread_read_viewport(void *data, uint8_t *buffer) +static bool video_thread_read_viewport(void *data, uint8_t *buffer, bool is_idle) { thread_video_t *thr = (thread_video_t*)data; thread_packet_t pkt = { CMD_READ_VIEWPORT }; @@ -923,7 +925,8 @@ static bool video_thread_read_viewport(void *data, uint8_t *buffer) if (!thr) return false; - pkt.data.v = buffer; + pkt.data.v = buffer; + thr->is_idle = is_idle; video_thread_send_and_wait_user_to_thread(thr, &pkt); @@ -1192,7 +1195,7 @@ static void thread_set_texture_enable(void *data, bool state, bool full_screen) } static void thread_set_osd_msg(void *data, const char *msg, - const struct font_params *params, void *font) + const void *params, void *font) { thread_video_t *thr = (thread_video_t*)data; @@ -1355,7 +1358,7 @@ static void video_thread_set_callbacks( **/ bool video_init_thread(const video_driver_t **out_driver, void **out_data, const input_driver_t **input, void **input_data, - const video_driver_t *drv, const video_info_t *info) + const video_driver_t *drv, const video_info_t info) { thread_video_t *thr = (thread_video_t*)calloc(1, sizeof(*thr)); if (!thr) diff --git a/gfx/video_thread_wrapper.h b/gfx/video_thread_wrapper.h index 9cfad4160c..5368edabd7 100644 --- a/gfx/video_thread_wrapper.h +++ b/gfx/video_thread_wrapper.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -23,6 +23,7 @@ #include #include "video_driver.h" +#include "font_driver.h" RETRO_BEGIN_DECLS @@ -53,7 +54,7 @@ typedef struct thread_video thread_video_t; bool video_init_thread( const video_driver_t **out_driver, void **out_data, const input_driver_t **input, void **input_data, - const video_driver_t *driver, const video_info_t *info); + const video_driver_t *driver, const video_info_t info); /** * video_thread_get_ptr: diff --git a/griffin/griffin.c b/griffin/griffin.c index 041d9b92c9..da7724432d 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen -* Copyright (C) 2011-2016 - Daniel De Matteis +* Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -221,7 +221,6 @@ VIDEO CONTEXT #endif - /*============================================================ VIDEO SHADERS ============================================================ */ @@ -358,6 +357,10 @@ VIDEO DRIVER #endif #include "../gfx/drivers/nullgfx.c" +#if defined(_WIN32) && !defined(_XBOX) +#include "../gfx/drivers/gdi_gfx.c" +#endif + /*============================================================ FONTS ============================================================ */ @@ -402,6 +405,13 @@ FONTS #include "../gfx/drivers_font/caca_font.c" #endif +#if defined(DJGPP) +#include "../gfx/drivers_font/vga_font.c" +#endif + +#if defined(_WIN32) && !defined(_XBOX) +#include "../gfx/drivers_font/gdi_font.c" +#endif #if defined(HAVE_VULKAN) #include "../gfx/drivers_font/vulkan_raster_font.c" @@ -900,6 +910,7 @@ NETPLAY #include "../tasks/task_http.c" #include "../tasks/task_netplay_lan_scan.c" #include "../tasks/task_wifi.c" +#include "../tasks/task_netplay_find_content.c" #endif /*============================================================ @@ -994,6 +1005,14 @@ MENU #include "../menu/drivers_display/menu_display_caca.c" #endif +#ifdef DJGPP +#include "../menu/drivers_display/menu_display_vga.c" +#endif + +#if defined(_WIN32) && !defined(_XBOX) +#include "../menu/drivers_display/menu_display_gdi.c" +#endif + #endif @@ -1001,7 +1020,7 @@ MENU #include "../menu/drivers/rgui.c" #endif -#if defined(HAVE_OPENGL) || defined(HAVE_VITA2D) || defined(_3DS) +#if defined(HAVE_OPENGL) || defined(HAVE_VITA2D) || defined(_3DS) || defined(_MSC_VER) #ifdef HAVE_XMB #include "../menu/drivers/xmb.c" #endif diff --git a/griffin/griffin_cpp.cpp b/griffin/griffin_cpp.cpp index 0207179676..439ed47b8d 100644 --- a/griffin/griffin_cpp.cpp +++ b/griffin/griffin_cpp.cpp @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. -* Copyright (C) 2011-2016 - Daniel De Matteis +* Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -115,6 +115,10 @@ UI COMMON CONTEXT #include "../gfx/drivers_context/wgl_ctx.cpp" #endif +#if defined(_WIN32) && !defined(_XBOX) +#include "../gfx/drivers_context/gdi_ctx.cpp" +#endif + #if defined(HAVE_FFMPEG) #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES3) #include "../cores/libretro-ffmpeg/fft/fft.cpp" diff --git a/griffin/griffin_objc.m b/griffin/griffin_objc.m index 31960ffa45..02ed545433 100644 --- a/griffin/griffin_objc.m +++ b/griffin/griffin_objc.m @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. -* Copyright (C) 2011-2016 - Daniel De Matteis +* Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/common/epoll_common.c b/input/common/epoll_common.c index 60a977f764..5bdd83d0c8 100644 --- a/input/common/epoll_common.c +++ b/input/common/epoll_common.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - pinumbernumber - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/common/epoll_common.h b/input/common/epoll_common.h index 1150d9982a..ae0b3c087a 100644 --- a/input/common/epoll_common.h +++ b/input/common/epoll_common.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/common/input_x11_common.c b/input/common/input_x11_common.c index 1e028ad8bb..d9598496e0 100644 --- a/input/common/input_x11_common.c +++ b/input/common/input_x11_common.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/common/input_x11_common.h b/input/common/input_x11_common.h index 3482181f56..4d325e4525 100644 --- a/input/common/input_x11_common.h +++ b/input/common/input_x11_common.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/common/linux_common.c b/input/common/linux_common.c index 9466e1c26a..1736a9c30e 100644 --- a/input/common/linux_common.c +++ b/input/common/linux_common.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/common/linux_common.h b/input/common/linux_common.h index 37555569b1..b924b7246d 100644 --- a/input/common/linux_common.h +++ b/input/common/linux_common.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/common/udev_common.c b/input/common/udev_common.c index d256f3916d..0ef22244c4 100644 --- a/input/common/udev_common.c +++ b/input/common/udev_common.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/common/udev_common.h b/input/common/udev_common.h index c9ea19c191..33cdec1b27 100644 --- a/input/common/udev_common.h +++ b/input/common/udev_common.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/connect/connect_nesusb.c b/input/connect/connect_nesusb.c index b5f304c4ec..3cfadcdca2 100644 --- a/input/connect/connect_nesusb.c +++ b/input/connect/connect_nesusb.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/connect/connect_ps2adapter.c b/input/connect/connect_ps2adapter.c index 8403e670e6..280b801938 100644 --- a/input/connect/connect_ps2adapter.c +++ b/input/connect/connect_ps2adapter.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/connect/connect_ps3.c b/input/connect/connect_ps3.c index 5037057d60..37ca54b8d2 100644 --- a/input/connect/connect_ps3.c +++ b/input/connect/connect_ps3.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/connect/connect_ps4.c b/input/connect/connect_ps4.c index 41da1057da..198107842f 100644 --- a/input/connect/connect_ps4.c +++ b/input/connect/connect_ps4.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/connect/connect_snesusb.c b/input/connect/connect_snesusb.c index ae909932e7..d5cc9e2811 100644 --- a/input/connect/connect_snesusb.c +++ b/input/connect/connect_snesusb.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/connect/connect_wii.c b/input/connect/connect_wii.c index f017c497f5..cb3243618c 100644 --- a/input/connect/connect_wii.c +++ b/input/connect/connect_wii.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/connect/connect_wiiugca.c b/input/connect/connect_wiiugca.c index 941c2f7deb..8f1368fdd7 100644 --- a/input/connect/connect_wiiugca.c +++ b/input/connect/connect_wiiugca.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/connect/connect_wiiupro.c b/input/connect/connect_wiiupro.c index 1fddf231f9..05d36c240f 100644 --- a/input/connect/connect_wiiupro.c +++ b/input/connect/connect_wiiupro.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/connect/joypad_connection.c b/input/connect/joypad_connection.c index ecefcd2551..7fab3c894b 100644 --- a/input/connect/joypad_connection.c +++ b/input/connect/joypad_connection.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/connect/joypad_connection.h b/input/connect/joypad_connection.h index 1b5c70d768..eac080b70e 100644 --- a/input/connect/joypad_connection.h +++ b/input/connect/joypad_connection.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -63,10 +63,10 @@ joypad_connection_t *pad_connection_init(unsigned pads); void pad_connection_destroy(joypad_connection_t *joyconn); void pad_connection_pad_deinit(joypad_connection_t *joyconn, - unsigned idx); + uint32_t idx); void pad_connection_packet(joypad_connection_t *joyconn, - unsigned idx, uint8_t* data, uint32_t length); + uint32_t idx, uint8_t* data, uint32_t length); uint64_t pad_connection_get_buttons(joypad_connection_t *joyconn, unsigned idx); diff --git a/input/drivers/android_input.c b/input/drivers/android_input.c index 5d2ece5300..d93e53daf4 100644 --- a/input/drivers/android_input.c +++ b/input/drivers/android_input.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * Copyright (C) 2013-2014 - Steven Crowe * diff --git a/input/drivers/cocoa_input.c b/input/drivers/cocoa_input.c index 74c16575b3..08177b664e 100644 --- a/input/drivers/cocoa_input.c +++ b/input/drivers/cocoa_input.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2013-2014 - Jason Fetters * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/input/drivers/cocoa_input.h b/input/drivers/cocoa_input.h index a3be90e30d..33194837f5 100644 --- a/input/drivers/cocoa_input.h +++ b/input/drivers/cocoa_input.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2013-2014 - Jason Fetters * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/input/drivers/ctr_input.c b/input/drivers/ctr_input.c index e0348ea329..da6b2a0c2e 100644 --- a/input/drivers/ctr_input.c +++ b/input/drivers/ctr_input.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2015 - Ali Bouhlel + * Copyright (C) 2014-2017 - Ali Bouhlel + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers/dinput.c b/input/drivers/dinput.c index ac58ce1d4f..2c0f9a755e 100644 --- a/input/drivers/dinput.c +++ b/input/drivers/dinput.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers/gx_input.c b/input/drivers/gx_input.c index 10b0914b2a..984b32b4a7 100644 --- a/input/drivers/gx_input.c +++ b/input/drivers/gx_input.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/input/drivers/linuxraw_input.c b/input/drivers/linuxraw_input.c index cdc29e8c6d..0a7553b07a 100644 --- a/input/drivers/linuxraw_input.c +++ b/input/drivers/linuxraw_input.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/input/drivers/nullinput.c b/input/drivers/nullinput.c index 41bd88e6f3..78498f88dc 100644 --- a/input/drivers/nullinput.c +++ b/input/drivers/nullinput.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers/ps3_input.c b/input/drivers/ps3_input.c index a8593e5ded..78f5862439 100644 --- a/input/drivers/ps3_input.c +++ b/input/drivers/ps3_input.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers/psp_input.c b/input/drivers/psp_input.c index f6e0bef4d3..8000d1b3c9 100644 --- a/input/drivers/psp_input.c +++ b/input/drivers/psp_input.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -33,6 +33,7 @@ #include #include +#include #ifdef HAVE_KERNEL_PRX #include "../../bootstrap/psp1/kernel_functions.h" diff --git a/input/drivers/qnx_input.c b/input/drivers/qnx_input.c index 20277b5517..eb3dc2bb9f 100644 --- a/input/drivers/qnx_input.c +++ b/input/drivers/qnx_input.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2013-2014 - CatalystG * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -590,16 +590,17 @@ static void qnx_handle_navigator_event( switch (bps_event_get_code(event)) { case NAVIGATOR_SYSKEY_PRESS: - switch(navigator_event_get_syskey_key(event)) { - case NAVIGATOR_SYSKEY_BACK: - input_keyboard_event(true, RETROK_BACKSPACE, 0, 0, RETRO_DEVICE_KEYBOARD); - input_keyboard_event(false, RETROK_BACKSPACE, 0, 0, RETRO_DEVICE_KEYBOARD); - break; - case NAVIGATOR_SYSKEY_SEND: - case NAVIGATOR_SYSKEY_END: - break; - default: - break; + switch(navigator_event_get_syskey_key(event)) + { + case NAVIGATOR_SYSKEY_BACK: + input_keyboard_event(true, RETROK_BACKSPACE, 0, 0, RETRO_DEVICE_KEYBOARD); + input_keyboard_event(false, RETROK_BACKSPACE, 0, 0, RETRO_DEVICE_KEYBOARD); + break; + case NAVIGATOR_SYSKEY_SEND: + case NAVIGATOR_SYSKEY_END: + break; + default: + break; } break; case NAVIGATOR_SWIPE_DOWN: @@ -612,21 +613,19 @@ static void qnx_handle_navigator_event( case NAVIGATOR_WINDOW_INVISIBLE: while(true) { + unsigned event_code; + /* Block until we get a resume or exit event. */ bps_get_event(&event_pause, -1); - unsigned event_code = bps_event_get_code(event_pause); + event_code = bps_event_get_code(event_pause); if(event_code == NAVIGATOR_WINDOW_STATE) { if(navigator_event_get_window_state(event_pause) == NAVIGATOR_WINDOW_FULLSCREEN) - { break; - } } else if(event_code == NAVIGATOR_EXIT) - { goto shutdown; - } } break; case NAVIGATOR_WINDOW_FULLSCREEN: diff --git a/input/drivers/rwebinput_input.c b/input/drivers/rwebinput_input.c index 635bdf87df..c66979bb04 100644 --- a/input/drivers/rwebinput_input.c +++ b/input/drivers/rwebinput_input.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2015 - Michael Lelli + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers/sdl_input.c b/input/drivers/sdl_input.c index 324b91dfdd..2d470149db 100644 --- a/input/drivers/sdl_input.c +++ b/input/drivers/sdl_input.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2014-2015 - Higor Euripedes * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/input/drivers/udev_input.c b/input/drivers/udev_input.c index 8f02e6ab0d..afd43b00ff 100644 --- a/input/drivers/udev_input.c +++ b/input/drivers/udev_input.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2015 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers/wiiu_input.c b/input/drivers/wiiu_input.c index 35013bd6ef..56bbf8bbaf 100644 --- a/input/drivers/wiiu_input.c +++ b/input/drivers/wiiu_input.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2015 - Ali Bouhlel + * Copyright (C) 2014-2017 - Ali Bouhlel + * Copyright (C) 2014-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -30,7 +31,7 @@ #include "wiiu_dbg.h" -#define MAX_PADS 1 +#define MAX_PADS 5 typedef struct wiiu_input { @@ -56,7 +57,7 @@ static int16_t wiiu_input_state(void *data, { wiiu_input_t *wiiu = (wiiu_input_t*)data; - if(!wiiu || (port > 0) || !binds || !binds[port]) + if(!wiiu || !(port < MAX_PADS) || !binds || !binds[port]) return 0; switch (device) diff --git a/input/drivers/x11_input.c b/input/drivers/x11_input.c index c90a032c22..5b3dcc7c59 100644 --- a/input/drivers/x11_input.c +++ b/input/drivers/x11_input.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2015 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers/xdk_xinput_input.c b/input/drivers/xdk_xinput_input.c index 7d096c6244..3213003858 100644 --- a/input/drivers/xdk_xinput_input.c +++ b/input/drivers/xdk_xinput_input.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers/xenon360_input.c b/input/drivers/xenon360_input.c index 12a9dd2883..99fe132f46 100644 --- a/input/drivers/xenon360_input.c +++ b/input/drivers/xenon360_input.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_hid/btstack_hid.c b/input/drivers_hid/btstack_hid.c index 7ccab02f02..bdb53abc8f 100644 --- a/input/drivers_hid/btstack_hid.c +++ b/input/drivers_hid/btstack_hid.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_hid/iohidmanager_hid.c b/input/drivers_hid/iohidmanager_hid.c index 356c026457..1edde743c5 100644 --- a/input/drivers_hid/iohidmanager_hid.c +++ b/input/drivers_hid/iohidmanager_hid.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -31,12 +31,20 @@ #include "../../tasks/tasks_internal.h" #include "../../verbosity.h" +typedef struct apple_input_rec +{ + IOHIDElementCookie cookie; + uint32_t id; + struct apple_input_rec *next; +} apple_input_rec_t; + typedef struct apple_hid { IOHIDManagerRef ptr; joypad_connection_t *slots; uint32_t buttons[MAX_USERS]; int16_t axes[MAX_USERS][6]; + int8_t hats[MAX_USERS][2]; /* MacOS only supports 1 hat AFAICT */ } iohidmanager_hid_t; struct iohidmanager_hid_adapter @@ -44,9 +52,55 @@ struct iohidmanager_hid_adapter uint32_t slot; IOHIDDeviceRef handle; char name[PATH_MAX_LENGTH]; + apple_input_rec_t *axes; + apple_input_rec_t *hats; + apple_input_rec_t *buttons; uint8_t data[2048]; }; +CFComparisonResult iohidmanager_sort_elements(const void *val1, const void *val2, void *context) +{ + uint32_t page1 = IOHIDElementGetUsagePage((IOHIDElementRef)val1); + uint32_t page2 = IOHIDElementGetUsagePage((IOHIDElementRef)val2); + uint32_t use1 = IOHIDElementGetUsage((IOHIDElementRef)val1); + uint32_t use2 = IOHIDElementGetUsage((IOHIDElementRef)val2); + uint32_t cookie1 = IOHIDElementGetCookie((IOHIDElementRef)val1); + uint32_t cookie2 = IOHIDElementGetCookie((IOHIDElementRef)val2); + + if(page1 != page2) + { + return page1 > page2; + } + + if(use1 != use2) + { + return use1 > use2; + } + + return cookie1 > cookie2; +} + +static bool iohidmanager_check_for_id(apple_input_rec_t *rec, uint32_t id) +{ + while(rec) + { + if(rec->id == id) + return true; + rec = rec->next; + } + return false; +} + +static void iohidmanager_append_record(apple_input_rec_t *rec, apple_input_rec_t *new) +{ + apple_input_rec_t *tmp = rec; + while(tmp->next) + { + tmp = tmp->next; + } + tmp->next = new; +} + static bool iohidmanager_hid_joypad_query(void *data, unsigned pad) { return pad < MAX_USERS; @@ -75,10 +129,29 @@ static bool iohidmanager_hid_joypad_button(void *data, uint64_t buttons = iohidmanager_hid_joypad_get_buttons(data, port); iohidmanager_hid_t *hid = (iohidmanager_hid_t*)data; + unsigned h = GET_HAT(joykey); + unsigned hat_dir = GET_HAT_DIR(joykey); /* Check hat. */ - if (GET_HAT_DIR(joykey)) - return false; + if (hat_dir) + { + if(h >= 1) + return false; + + switch(hat_dir) + { + case HAT_LEFT_MASK: + return hid->hats[port][0] < 0; + case HAT_RIGHT_MASK: + return hid->hats[port][0] > 0; + case HAT_UP_MASK: + return hid->hats[port][1] < 0; + case HAT_DOWN_MASK: + return hid->hats[port][1] > 0; + } + + return 0; + } /* Check the button. */ if ((port < MAX_USERS) && (joykey < 32)) @@ -166,6 +239,8 @@ static void iohidmanager_hid_device_input_callback(void *data, IOReturn result, uint32_t type = IOHIDElementGetType(element); uint32_t page = IOHIDElementGetUsagePage(element); uint32_t use = IOHIDElementGetUsage(element); + uint32_t cookie = IOHIDElementGetCookie(element); + apple_input_rec_t *tmp = NULL; if (type != kIOHIDElementTypeInput_Misc) if (type != kIOHIDElementTypeInput_Button) @@ -184,32 +259,86 @@ static void iohidmanager_hid_device_input_callback(void *data, IOReturn result, switch (use) { case kHIDUsage_GD_Hatswitch: - break; + { + tmp = adapter->hats; + + while(tmp && tmp->cookie != cookie) + tmp = tmp->next; + + if(tmp->cookie == cookie) + { + CFIndex range = IOHIDElementGetLogicalMax(element) - IOHIDElementGetLogicalMin(element); + CFIndex val = IOHIDValueGetIntegerValue(value); + + if(range == 3) + val *= 2; + + switch(val) + { + case 0: + /* pos = up */ + hid->hats[adapter->slot][0] = 0; + hid->hats[adapter->slot][1] = -1; + break; + case 1: + /* pos = up+right */ + hid->hats[adapter->slot][0] = 1; + hid->hats[adapter->slot][1] = -1; + break; + case 2: + /* pos = right */ + hid->hats[adapter->slot][0] = 1; + hid->hats[adapter->slot][1] = 0; + break; + case 3: + /* pos = down+right */ + hid->hats[adapter->slot][0] = 1; + hid->hats[adapter->slot][1] = 1; + break; + case 4: + /* pos = down */ + hid->hats[adapter->slot][0] = 0; + hid->hats[adapter->slot][1] = 1; + break; + case 5: + /* pos = down+left */ + hid->hats[adapter->slot][0] = -1; + hid->hats[adapter->slot][1] = 1; + break; + case 6: + /* pos = left */ + hid->hats[adapter->slot][0] = -1; + hid->hats[adapter->slot][1] = 0; + break; + case 7: + /* pos = up_left */ + hid->hats[adapter->slot][0] = -1; + hid->hats[adapter->slot][1] = -1; + break; + default: + /* pos = centered */ + hid->hats[adapter->slot][0] = 0; + hid->hats[adapter->slot][1] = 0; + break; + } + } + } + break; default: { - int i; - static const uint32_t axis_use_ids[6] = - { 48, 49, 51, 52, 50, 53 }; + tmp = adapter->axes; - /* +0/-0 => Left Stick Horizontal => 48 - * +1/-1 => Left Stick Vertical => 49 - * +2/-2 => Right Stick Horizontal => 51 - * +3/-3 => Right Stick Vertical => 52 - * +4/-4 => Left Trigger (if exists) => 50 - * +5/-5 => Right Trigger (if exists) => 53 - */ + while(tmp && tmp->cookie != cookie) + tmp = tmp->next; - for (i = 0; i < 6; i ++) + if(tmp->cookie == cookie) { CFIndex min = IOHIDElementGetPhysicalMin(element); CFIndex state = IOHIDValueGetIntegerValue(value) - min; CFIndex max = IOHIDElementGetPhysicalMax(element) - min; float val = (float)state / (float)max; - if (use != axis_use_ids[i]) - continue; - - hid->axes[adapter->slot][i] = + hid->axes[adapter->slot][tmp->id] = ((val * 2.0f) - 1.0f) * 32767.0f; } } @@ -223,13 +352,20 @@ static void iohidmanager_hid_device_input_callback(void *data, IOReturn result, { case kIOHIDElementTypeInput_Button: { - CFIndex state = IOHIDValueGetIntegerValue(value); - unsigned id = use - 1; + tmp = adapter->buttons; - if (state) - BIT64_SET(hid->buttons[adapter->slot], id); - else - BIT64_CLEAR(hid->buttons[adapter->slot], id); + while(tmp && tmp->cookie != cookie) + tmp = tmp->next; + + if(tmp->cookie == cookie) + { + CFIndex state = IOHIDValueGetIntegerValue(value); + + if (state) + BIT64_SET(hid->buttons[adapter->slot], tmp->id); + else + BIT64_CLEAR(hid->buttons[adapter->slot], tmp->id); + } } break; } @@ -256,7 +392,28 @@ static void iohidmanager_hid_device_remove(void *data, } if (adapter) + { + apple_input_rec_t* tmp = NULL; + while(adapter->hats != NULL) + { + tmp = adapter->hats; + adapter->hats = adapter->hats->next; + free(tmp); + } + while(adapter->axes != NULL) + { + tmp = adapter->axes; + adapter->axes = adapter->axes->next; + free(tmp); + } + while(adapter->buttons != NULL) + { + tmp = adapter->buttons; + adapter->buttons = adapter->buttons->next; + free(tmp); + } free(adapter); + } } static int32_t iohidmanager_hid_device_get_int_property( @@ -316,8 +473,13 @@ static void iohidmanager_hid_device_add_autodetect(unsigned idx, static void iohidmanager_hid_device_add(void *data, IOReturn result, void* sender, IOHIDDeviceRef device) { + int i; IOReturn ret; uint16_t dev_vid, dev_pid; + bool found_axis[6] = + { false, false, false, false, false, false }; + apple_input_rec_t *tmpButtons = NULL; + apple_input_rec_t *tmpAxes = NULL; iohidmanager_hid_t *hid = (iohidmanager_hid_t*) hid_driver_get_data(); struct iohidmanager_hid_adapter *adapter = (struct iohidmanager_hid_adapter*) @@ -367,13 +529,202 @@ static void iohidmanager_hid_device_add(void *data, IOReturn result, if (string_is_empty(adapter->name)) goto error; + /* scan for buttons, axis, hats */ + CFArrayRef elements_raw = IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone); + int count = (int)CFArrayGetCount(elements_raw); + CFMutableArrayRef elements = CFArrayCreateMutableCopy(kCFAllocatorDefault,(CFIndex)count,elements_raw); + CFRange range = CFRangeMake(0,count); + CFArraySortValues(elements,range,iohidmanager_sort_elements,NULL); + + for(i=0; iid = 0; + hat->cookie = cookie; + hat->next = NULL; + adapter->hats = hat; + } + break; + default: + { + uint32_t i = 0; + static const uint32_t axis_use_ids[6] = + { 48, 49, 51, 52, 50, 53 }; + + while(axis_use_ids[i] != use) + i++; + + if (i < 6) + { + + apple_input_rec_t *axis = (apple_input_rec_t *)malloc(sizeof(apple_input_rec_t)); + axis->id = i; + axis->cookie = cookie; + axis->next = NULL; + + if(iohidmanager_check_for_id(adapter->axes,i)) + { + /* axis ID already exists, save to tmp for appending later */ + if(tmpAxes) + iohidmanager_append_record(tmpAxes,axis); + else + tmpAxes = axis; + } + else + { + found_axis[axis->id] = true; + if(adapter->axes) + iohidmanager_append_record(adapter->axes,axis); + else + adapter->axes = axis; + } + } + } + break; + } + break; + } + break; + case kHIDPage_Button: + switch (type) + { + case kIOHIDElementTypeCollection: + case kIOHIDElementTypeFeature: + case kIOHIDElementTypeInput_ScanCodes: + case kIOHIDElementTypeInput_Misc: + case kIOHIDElementTypeInput_Axis: + case kIOHIDElementTypeOutput: + /* TODO/FIXME */ + break; + case kIOHIDElementTypeInput_Button: + { + apple_input_rec_t *btn = (apple_input_rec_t *)malloc(sizeof(apple_input_rec_t)); + btn->id = use - 1; + btn->cookie = cookie; + btn->next = NULL; + + if(iohidmanager_check_for_id(adapter->buttons,btn->id)) + { + if(tmpButtons) + iohidmanager_append_record(tmpButtons,btn); + else + tmpButtons = btn; + } + else + { + if(adapter->buttons) + iohidmanager_append_record(adapter->buttons,btn); + else + adapter->buttons = btn; + } + } + break; + } + break; + } + } + + /* take care of buttons/axes with duplicate 'use' values */ + for(i=0; i<6; i++) + { + if(found_axis[i] == false && tmpAxes) + { + apple_input_rec_t *next = tmpAxes->next; + tmpAxes->id = i; + tmpAxes->next = NULL; + iohidmanager_append_record(adapter->axes, tmpAxes); + tmpAxes = next; + } + } + + apple_input_rec_t *tmp = adapter->buttons; + while(tmp->next) + { + tmp = tmp->next; + } + + while(tmpButtons) + { + apple_input_rec_t *next = tmpButtons->next; + + tmpButtons->id = tmp->id + 1; + tmpButtons->next = NULL; + tmp->next = tmpButtons; + + tmp = tmp->next; + tmpButtons = next; + } + + iohidmanager_hid_device_add_autodetect(adapter->slot, adapter->name, iohidmanager_hid.ident, dev_vid, dev_pid); return; error: - free(adapter); + { + apple_input_rec_t *tmp = NULL; + while(adapter->hats != NULL) + { + tmp = adapter->hats; + adapter->hats = adapter->hats->next; + free(tmp); + } + while(adapter->axes != NULL) + { + tmp = adapter->axes; + adapter->axes = adapter->axes->next; + free(tmp); + } + while(adapter->buttons != NULL) + { + tmp = adapter->buttons; + adapter->buttons = adapter->buttons->next; + free(tmp); + } + while(tmpAxes != NULL) + { + tmp = tmpAxes; + tmpAxes = tmpAxes->next; + free(tmp); + } + while(tmpButtons != NULL) + { + tmp = tmpButtons; + tmpButtons = tmpButtons->next; + free(tmp); + } + free(adapter); + } } static void iohidmanager_hid_append_matching_dictionary( diff --git a/input/drivers_hid/libusb_hid.c b/input/drivers_hid/libusb_hid.c index c6a4fbb544..9e6253e15d 100644 --- a/input/drivers_hid/libusb_hid.c +++ b/input/drivers_hid/libusb_hid.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_hid/null_hid.c b/input/drivers_hid/null_hid.c index 30ed12d762..17357cfa8c 100644 --- a/input/drivers_hid/null_hid.c +++ b/input/drivers_hid/null_hid.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_hid/wiiusb_hid.c b/input/drivers_hid/wiiusb_hid.c index 50f82bdbf4..a15b63c795 100644 --- a/input/drivers_hid/wiiusb_hid.c +++ b/input/drivers_hid/wiiusb_hid.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2015-2016 - Sergi Granell (xerpi) + * Copyright (C) 2015-2017 - Sergi Granell (xerpi) + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_joypad/android_joypad.c b/input/drivers_joypad/android_joypad.c index b3af92c0a3..55e4b15f84 100644 --- a/input/drivers_joypad/android_joypad.c +++ b/input/drivers_joypad/android_joypad.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * Copyright (C) 2013-2014 - Steven Crowe * diff --git a/input/drivers_joypad/ctr_joypad.c b/input/drivers_joypad/ctr_joypad.c index fa7232e62e..a1022a6b2f 100644 --- a/input/drivers_joypad/ctr_joypad.c +++ b/input/drivers_joypad/ctr_joypad.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2015 - Ali Bouhlel + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Ali Bouhlel * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_joypad/dinput_joypad.c b/input/drivers_joypad/dinput_joypad.c index 2d042703c9..22c7b8458e 100644 --- a/input/drivers_joypad/dinput_joypad.c +++ b/input/drivers_joypad/dinput_joypad.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_joypad/gx_joypad.c b/input/drivers_joypad/gx_joypad.c index 1edc19ab31..b67ccf32ba 100644 --- a/input/drivers_joypad/gx_joypad.c +++ b/input/drivers_joypad/gx_joypad.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/input/drivers_joypad/hid_joypad.c b/input/drivers_joypad/hid_joypad.c index 5273de9098..f374d9a684 100644 --- a/input/drivers_joypad/hid_joypad.c +++ b/input/drivers_joypad/hid_joypad.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_joypad/linuxraw_joypad.c b/input/drivers_joypad/linuxraw_joypad.c index b19e5bf575..2a754ce1e1 100644 --- a/input/drivers_joypad/linuxraw_joypad.c +++ b/input/drivers_joypad/linuxraw_joypad.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_joypad/mfi_joypad.m b/input/drivers_joypad/mfi_joypad.m index 7349507812..a2df184c5b 100644 --- a/input/drivers_joypad/mfi_joypad.m +++ b/input/drivers_joypad/mfi_joypad.m @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -114,12 +114,13 @@ static void apple_gamecontroller_joypad_poll(void) static void apple_gamecontroller_joypad_register(GCGamepad *gamepad) { - gamepad.valueChangedHandler = ^(GCGamepad *updateGamepad, GCControllerElement *element) { + gamepad.valueChangedHandler = ^(GCGamepad *updateGamepad, GCControllerElement *element) + { apple_gamecontroller_joypad_poll_internal(updateGamepad.controller); }; - gamepad.controller.controllerPausedHandler = ^(GCController *controller) { - + gamepad.controller.controllerPausedHandler = ^(GCController *controller) + { uint32_t slot = (uint32_t)controller.playerIndex; mfi_buttons[slot] |= (1 << RETRO_DEVICE_ID_JOYPAD_START); @@ -187,13 +188,15 @@ bool apple_gamecontroller_joypad_init(void *data) [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidConnectNotification object:nil queue:[NSOperationQueue mainQueue] - usingBlock:^(NSNotification *note) { + usingBlock:^(NSNotification *note) + { apple_gamecontroller_joypad_connect([note object]); }]; [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidDisconnectNotification object:nil queue:[NSOperationQueue mainQueue] - usingBlock:^(NSNotification *note) { + usingBlock:^(NSNotification *note) + { apple_gamecontroller_joypad_disconnect([note object]); } ]; #endif diff --git a/input/drivers_joypad/null_joypad.c b/input/drivers_joypad/null_joypad.c index 601db984f1..d67a80b543 100644 --- a/input/drivers_joypad/null_joypad.c +++ b/input/drivers_joypad/null_joypad.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2013-2014 - CatalystG * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/input/drivers_joypad/parport_joypad.c b/input/drivers_joypad/parport_joypad.c index fd5ef1c2e8..17c8c4d658 100644 --- a/input/drivers_joypad/parport_joypad.c +++ b/input/drivers_joypad/parport_joypad.c @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2014-2015 - Mike Robinson + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_joypad/ps3_joypad.c b/input/drivers_joypad/ps3_joypad.c index f351ea3371..35fc7dadc9 100644 --- a/input/drivers_joypad/ps3_joypad.c +++ b/input/drivers_joypad/ps3_joypad.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -181,7 +181,7 @@ static void ps3_joypad_poll(void) *state_cur |= (state_tmp.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_TRIANGLE) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_X) : 0; *state_cur |= (state_tmp.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_SQUARE) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_Y) : 0; - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) { int value = 0; if (cellSysutilGetSystemParamInt(CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN, &value) == 0) diff --git a/input/drivers_joypad/psp_joypad.c b/input/drivers_joypad/psp_joypad.c index c904b0b020..757c536b98 100644 --- a/input/drivers_joypad/psp_joypad.c +++ b/input/drivers_joypad/psp_joypad.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -15,13 +15,23 @@ */ #include +#include + +#include "../input_config.h" #include "../../tasks/tasks_internal.h" #include "../../configuration.h" +#include "../../defines/psp_defines.h" + +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + #if defined(VITA) #include +#include #include #define PSP_MAX_PADS 4 static int psp2_model; @@ -57,7 +67,8 @@ static const char *psp_joypad_name(unsigned pad) if (psp2_model != SCE_KERNEL_MODEL_VITATV) return "Vita Controller"; - switch (curr_ctrl_info.port[pad + 1]) { + switch (curr_ctrl_info.port[pad + 1]) + { case SCE_CTRL_TYPE_DS3: return "DS3 Controller"; case SCE_CTRL_TYPE_DS4: @@ -92,7 +103,8 @@ static bool psp_joypad_init(void *data) #if defined(VITA) psp2_model = sceKernelGetModelForCDialog(); - if (psp2_model != SCE_KERNEL_MODEL_VITATV) { + if (psp2_model != SCE_KERNEL_MODEL_VITATV) + { sceTouchSetSamplingState(SCE_TOUCH_PORT_BACK, SCE_TOUCH_SAMPLING_STATE_START); sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START); players_count = 1; @@ -178,16 +190,19 @@ static void psp_joypad_poll(void) #endif #ifdef VITA - if (psp2_model != SCE_KERNEL_MODEL_VITATV) { + if (psp2_model != SCE_KERNEL_MODEL_VITATV) players_count = 1; - } else { + else + { sceCtrlGetControllerPortInfo(&curr_ctrl_info); - for (player = 0; player < players_count; player++) { + for (player = 0; player < players_count; player++) + { if (old_ctrl_info.port[player + 1] == curr_ctrl_info.port[player + 1]) continue; if (old_ctrl_info.port[player + 1] != SCE_CTRL_TYPE_UNPAIRED && - curr_ctrl_info.port[player + 1] == SCE_CTRL_TYPE_UNPAIRED) { + curr_ctrl_info.port[player + 1] == SCE_CTRL_TYPE_UNPAIRED) + { memset(&actuators[player], 0, sizeof(SceCtrlActuator)); input_autoconfigure_disconnect(player, psp_joypad.ident); } @@ -235,7 +250,7 @@ static void psp_joypad_poll(void) #endif #if defined(VITA) if (psp2_model == SCE_KERNEL_MODEL_VITA - && !menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) + && !menu_driver_is_alive() && settings->input.backtouch_enable) { unsigned i; @@ -311,7 +326,8 @@ static bool psp_joypad_rumble(unsigned pad, switch (effect) { case RETRO_RUMBLE_WEAK: - switch (curr_ctrl_info.port[pad + 1]) { + switch (curr_ctrl_info.port[pad + 1]) + { case SCE_CTRL_TYPE_DS3: actuators[pad].small = strength > 1 ? 1 : 0; break; @@ -323,7 +339,8 @@ static bool psp_joypad_rumble(unsigned pad, } break; case RETRO_RUMBLE_STRONG: - switch (curr_ctrl_info.port[pad + 1]) { + switch (curr_ctrl_info.port[pad + 1]) + { case SCE_CTRL_TYPE_DS3: actuators[pad].large = strength > 1 ? LERP(strength, 0xffff, 0xbf) + 0x40 : 0; break; diff --git a/input/drivers_joypad/qnx_joypad.c b/input/drivers_joypad/qnx_joypad.c index 4833a8a80b..53df4dcc29 100644 --- a/input/drivers_joypad/qnx_joypad.c +++ b/input/drivers_joypad/qnx_joypad.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2013-2014 - CatalystG * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/input/drivers_joypad/sdl_joypad.c b/input/drivers_joypad/sdl_joypad.c index 90ac5c0b14..793f796bf2 100644 --- a/input/drivers_joypad/sdl_joypad.c +++ b/input/drivers_joypad/sdl_joypad.c @@ -1,6 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2014-2015 - Higor Euripedes + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Higor Euripedes * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_joypad/udev_joypad.c b/input/drivers_joypad/udev_joypad.c index 1b80dc5549..8bd72ec420 100644 --- a/input/drivers_joypad/udev_joypad.c +++ b/input/drivers_joypad/udev_joypad.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2015 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_joypad/wiiu_joypad.c b/input/drivers_joypad/wiiu_joypad.c index e74e293818..83703b35a6 100644 --- a/input/drivers_joypad/wiiu_joypad.c +++ b/input/drivers_joypad/wiiu_joypad.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2015 - Ali Bouhlel + * Copyright (C) 2014-2017 - Ali Bouhlel + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -19,6 +19,7 @@ #endif #include +#include #include "../input_config.h" #include "../input_driver.h" @@ -32,28 +33,61 @@ #include "wiiu_dbg.h" #ifndef MAX_PADS -#define MAX_PADS 1 +#define MAX_PADS 5 #endif -static uint64_t pad_state; -static int16_t analog_state[1][2][2]; +#define WIIUINPUT_TYPE_WIIMOTE 0x00 +#define WIIUINPUT_TYPE_NUNCHUK 0x01 +#define WIIUINPUT_TYPE_CLASSIC_CONTROLLER 0x02 +#define WIIUINPUT_TYPE_PRO_CONTROLLER 0x1F +#define WIIUINPUT_TYPE_NONE 0xFD + +static uint64_t pad_state[MAX_PADS]; +static u8 pad_type[MAX_PADS - 1] = {WIIUINPUT_TYPE_NONE, WIIUINPUT_TYPE_NONE, WIIUINPUT_TYPE_NONE, WIIUINPUT_TYPE_NONE}; +static int16_t analog_state[MAX_PADS][2][2]; extern uint64_t lifecycle_state; static bool wiiu_pad_inited = false; -static const char *wiiu_joypad_name(unsigned pad) + + +static const char* wiiu_joypad_name(unsigned pad) { - return "WIIU Controller"; + if (pad == 0) + return "WIIU Gamepad"; + + if (pad < MAX_PADS) + { + switch (pad_type[pad - 1]) + { + case WIIUINPUT_TYPE_NONE: + return "N/A"; + + case WIIUINPUT_TYPE_PRO_CONTROLLER: + return "WIIU Pro Controller"; + + case WIIUINPUT_TYPE_WIIMOTE: + return "Wiimote Controller"; + + case WIIUINPUT_TYPE_NUNCHUK: + return "Nunchuk Controller"; + + case WIIUINPUT_TYPE_CLASSIC_CONTROLLER: + return "Classic Controller"; + } + } + + return "unknown"; } static void wiiu_joypad_autodetect_add(unsigned autoconf_pad) { if (!input_autoconfigure_connect( - wiiu_joypad_name(autoconf_pad), - NULL, - wiiu_joypad.ident, - autoconf_pad, - 0, - 0 + wiiu_joypad_name(autoconf_pad), + NULL, + wiiu_joypad.ident, + autoconf_pad, + 0, + 0 )) input_config_set_device_name(autoconf_pad, wiiu_joypad_name(autoconf_pad)); } @@ -63,12 +97,12 @@ static bool wiiu_joypad_button(unsigned port_num, uint16_t key) if (port_num >= MAX_PADS) return false; - return (pad_state & (UINT64_C(1) << key)); + return (pad_state[port_num] & (UINT64_C(1) << key)); } static uint64_t wiiu_joypad_get_buttons(unsigned port_num) { - return pad_state; + return pad_state[port_num]; } static int16_t wiiu_joypad_axis(unsigned port_num, uint32_t joyaxis) @@ -94,18 +128,21 @@ static int16_t wiiu_joypad_axis(unsigned port_num, uint32_t joyaxis) switch (axis) { - case 0: - val = analog_state[port_num][0][0]; - break; - case 1: - val = analog_state[port_num][0][1]; - break; - case 2: - val = analog_state[port_num][1][0]; - break; - case 3: - val = analog_state[port_num][1][1]; - break; + case 0: + val = analog_state[port_num][0][0]; + break; + + case 1: + val = analog_state[port_num][0][1]; + break; + + case 2: + val = analog_state[port_num][1][0]; + break; + + case 3: + val = analog_state[port_num][1][1]; + break; } if (is_neg && val > 0) @@ -118,51 +155,82 @@ static int16_t wiiu_joypad_axis(unsigned port_num, uint32_t joyaxis) static void wiiu_joypad_poll(void) { + int c; VPADStatus vpad; VPADReadError vpadError; + VPADRead(0, &vpad, 1, &vpadError); - if(vpadError) - return; + if (!vpadError) + { + pad_state[0] = vpad.hold & ~0x7F800000; /* clear out emulated analog sticks */ + analog_state[0][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_X] = vpad.leftStick.x * 0x7FF0; + analog_state[0][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_Y] = vpad.leftStick.y * 0x7FF0; + analog_state[0][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_X] = vpad.rightStick.x * 0x7FF0; + analog_state[0][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_Y] = vpad.rightStick.y * 0x7FF0; - pad_state = 0; - pad_state |= (vpad.hold & VPAD_BUTTON_LEFT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_LEFT) : 0; - pad_state |= (vpad.hold & VPAD_BUTTON_DOWN) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_DOWN) : 0; - pad_state |= (vpad.hold & VPAD_BUTTON_RIGHT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_RIGHT) : 0; - pad_state |= (vpad.hold & VPAD_BUTTON_UP) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_UP) : 0; - pad_state |= (vpad.hold & VPAD_BUTTON_PLUS) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_START) : 0; - pad_state |= (vpad.hold & VPAD_BUTTON_MINUS) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_SELECT) : 0; - pad_state |= (vpad.hold & VPAD_BUTTON_X) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_X) : 0; - pad_state |= (vpad.hold & VPAD_BUTTON_Y) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_Y) : 0; - pad_state |= (vpad.hold & VPAD_BUTTON_B) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_B) : 0; - pad_state |= (vpad.hold & VPAD_BUTTON_A) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_A) : 0; - pad_state |= (vpad.hold & VPAD_BUTTON_R) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_R) : 0; - pad_state |= (vpad.hold & VPAD_BUTTON_L) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_L) : 0; - pad_state |= (vpad.hold & VPAD_BUTTON_ZR) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_R2) : 0; - pad_state |= (vpad.hold & VPAD_BUTTON_ZL) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_L2) : 0; - pad_state |= (vpad.hold & VPAD_BUTTON_STICK_R) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_R3) : 0; - pad_state |= (vpad.hold & VPAD_BUTTON_STICK_L) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_L3) : 0; + BIT64_CLEAR(lifecycle_state, RARCH_MENU_TOGGLE); - analog_state[0][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_X] = vpad.leftStick.x * 0x7FF0; - analog_state[0][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_Y] = -vpad.leftStick.y * 0x7FF0; - analog_state[0][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_X] = vpad.rightStick.x * 0x7FF0; - analog_state[0][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_Y] = -vpad.rightStick.y * 0x7FF0; + if ((vpad.tpNormal.touched) && (vpad.tpNormal.x > 200) && (vpad.tpNormal.validity) == 0) + BIT64_SET(lifecycle_state, RARCH_MENU_TOGGLE); - BIT64_CLEAR(lifecycle_state, RARCH_MENU_TOGGLE); + /* panic button */ + if ((vpad.hold & (VPAD_BUTTON_R | VPAD_BUTTON_L | VPAD_BUTTON_STICK_R | VPAD_BUTTON_STICK_L)) + == (VPAD_BUTTON_R | VPAD_BUTTON_L | VPAD_BUTTON_STICK_R | VPAD_BUTTON_STICK_L)) + command_event(CMD_EVENT_QUIT, NULL); + } - if(((vpad.tpNormal.touched) && (vpad.tpNormal.x > 200) && (vpad.tpNormal.validity) == 0) || - (vpad.trigger & VPAD_BUTTON_HOME)) - BIT64_SET(lifecycle_state, RARCH_MENU_TOGGLE); + for (c = 0; c < 4; c++) + { + KPADData kpad; - /* panic button */ - if((vpad.hold & VPAD_BUTTON_R) && - (vpad.hold & VPAD_BUTTON_L) && - (vpad.hold & VPAD_BUTTON_STICK_R) && - (vpad.hold & VPAD_BUTTON_STICK_L)) - command_event(CMD_EVENT_QUIT, NULL); + if (!KPADRead(c, &kpad, 1)) + continue; + + if (pad_type[c] != kpad.device_type) + { + pad_type[c] = kpad.device_type; + wiiu_joypad_autodetect_add(c + 1); + } + + switch (kpad.device_type) + { + case WIIUINPUT_TYPE_WIIMOTE: + pad_state[c + 1] = kpad.btns_h; + analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_X] = 0; + analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_Y] = 0; + analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_X] = 0; + analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_Y] = 0; + break; + + case WIIUINPUT_TYPE_NUNCHUK: + pad_state[c + 1] = kpad.btns_h; + analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_X] = kpad.nunchuck.stick_x * 0x7FF0; + analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_Y] = kpad.nunchuck.stick_y * 0x7FF0; + analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_X] = 0; + analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_Y] = 0; + break; + + case WIIUINPUT_TYPE_PRO_CONTROLLER: + pad_state[c + 1] = kpad.classic.btns_h & ~0x3FC0000; /* clear out emulated analog sticks */ + analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_X] = kpad.classic.lstick_x * 0x7FF0; + analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_Y] = kpad.classic.lstick_y * 0x7FF0; + analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_X] = kpad.classic.rstick_x * 0x7FF0; + analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_Y] = kpad.classic.rstick_y * 0x7FF0; + break; + + case WIIUINPUT_TYPE_CLASSIC_CONTROLLER: + pad_state[c + 1] = kpad.classic.btns_h & ~0xFF0000; /* clear out emulated analog sticks */ + analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_X] = kpad.classic.lstick_x * 0x7FF0; + analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_Y] = kpad.classic.lstick_y * 0x7FF0; + analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_X] = kpad.classic.rstick_x * 0x7FF0; + analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_Y] = kpad.classic.rstick_y * 0x7FF0; + break; + } + } } -static bool wiiu_joypad_init(void *data) +static bool wiiu_joypad_init(void* data) { wiiu_joypad_autodetect_add(0); wiiu_joypad_poll(); @@ -174,7 +242,7 @@ static bool wiiu_joypad_init(void *data) static bool wiiu_joypad_query_pad(unsigned pad) { - return pad < MAX_USERS && wiiu_pad_inited; + return pad < MAX_PADS && wiiu_pad_inited; } static void wiiu_joypad_destroy(void) @@ -182,7 +250,8 @@ static void wiiu_joypad_destroy(void) wiiu_pad_inited = false; } -input_device_driver_t wiiu_joypad = { +input_device_driver_t wiiu_joypad = +{ wiiu_joypad_init, wiiu_joypad_query_pad, wiiu_joypad_destroy, diff --git a/input/drivers_joypad/xdk_joypad.c b/input/drivers_joypad/xdk_joypad.c index 9e60b8c4d7..08b46b0884 100644 --- a/input/drivers_joypad/xdk_joypad.c +++ b/input/drivers_joypad/xdk_joypad.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_joypad/xinput_joypad.c b/input/drivers_joypad/xinput_joypad.c index 7e01a20ef8..6e38f82f2b 100644 --- a/input/drivers_joypad/xinput_joypad.c +++ b/input/drivers_joypad/xinput_joypad.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2015 - pinumbernumber - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_keyboard/keyboard_event_android.c b/input/drivers_keyboard/keyboard_event_android.c index ab98d2a964..0a39d89988 100644 --- a/input/drivers_keyboard/keyboard_event_android.c +++ b/input/drivers_keyboard/keyboard_event_android.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_keyboard/keyboard_event_android.h b/input/drivers_keyboard/keyboard_event_android.h index d2f0e38c51..d80fb2f606 100644 --- a/input/drivers_keyboard/keyboard_event_android.h +++ b/input/drivers_keyboard/keyboard_event_android.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_keyboard/keyboard_event_apple.c b/input/drivers_keyboard/keyboard_event_apple.c index 689591ca74..3537b07477 100644 --- a/input/drivers_keyboard/keyboard_event_apple.c +++ b/input/drivers_keyboard/keyboard_event_apple.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2013-2014 - Jason Fetters * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/input/drivers_keyboard/keyboard_event_udev.c b/input/drivers_keyboard/keyboard_event_udev.c index b027ef4f9c..99a885fa9c 100644 --- a/input/drivers_keyboard/keyboard_event_udev.c +++ b/input/drivers_keyboard/keyboard_event_udev.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_keyboard/keyboard_event_udev.h b/input/drivers_keyboard/keyboard_event_udev.h index 578b9c9b9c..7dff10eaf9 100644 --- a/input/drivers_keyboard/keyboard_event_udev.h +++ b/input/drivers_keyboard/keyboard_event_udev.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_keyboard/keyboard_event_win32.cpp b/input/drivers_keyboard/keyboard_event_win32.cpp index a40852110f..936607cba9 100644 --- a/input/drivers_keyboard/keyboard_event_win32.cpp +++ b/input/drivers_keyboard/keyboard_event_win32.cpp @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_keyboard/keyboard_event_x11.c b/input/drivers_keyboard/keyboard_event_x11.c index 6729019650..00b4f6056c 100644 --- a/input/drivers_keyboard/keyboard_event_x11.c +++ b/input/drivers_keyboard/keyboard_event_x11.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/drivers_keyboard/keyboard_event_xkb.c b/input/drivers_keyboard/keyboard_event_xkb.c index 35cf15eab9..264dedf078 100644 --- a/input/drivers_keyboard/keyboard_event_xkb.c +++ b/input/drivers_keyboard/keyboard_event_xkb.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -16,6 +16,7 @@ /* We need libxkbcommon to translate raw evdev events to characters * which can be passed to keyboard callback in a sensible way. */ + #include #include diff --git a/input/input_autodetect_builtin.c b/input/input_autodetect_builtin.c index 78bfd2fc35..579aad425b 100644 --- a/input/input_autodetect_builtin.c +++ b/input/input_autodetect_builtin.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2016 - Ali Bouhlel + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Ali Bouhlel * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -27,7 +27,9 @@ #endif #define DECL_BTN(btn, bind) "input_" #btn "_btn = " #bind "\n" +#define DECL_BTN_EX(btn, bind, name) "input_" #btn "_btn = " #bind "\ninput_" #btn "_btn_label = \"" name "\"\n" #define DECL_AXIS(axis, bind) "input_" #axis "_axis = " #bind "\n" +#define DECL_AXIS_EX(axis, bind, name) "input_" #axis "_axis = " #bind "\ninput_" #axis "_axis_label = \"" name "\"\n" #define DECL_MENU(btn) "input_menu_toggle_btn = " #btn "\n" #define DECL_AUTOCONF_DEVICE(device, driver, binds) "input_device = \"" #device "\" \ninput_driver = \"" #driver "\" \n" binds @@ -193,29 +195,122 @@ DECL_AXIS(r_x_minus, -2) \ DECL_AXIS(r_y_plus, -3) \ DECL_AXIS(r_y_minus, +3) -#define WIIUINPUT_DEFAULT_BINDS \ -DECL_BTN(a, 8) \ -DECL_BTN(b, 0) \ -DECL_BTN(x, 9) \ -DECL_BTN(y, 1) \ -DECL_BTN(start, 3) \ -DECL_BTN(select, 2) \ -DECL_BTN(up, 4) \ -DECL_BTN(down, 5) \ -DECL_BTN(left, 6) \ -DECL_BTN(right, 7) \ -DECL_BTN(l, 10) \ -DECL_BTN(r, 11) \ -DECL_BTN(l2, 12) \ -DECL_BTN(r2, 13) \ -DECL_AXIS(l_x_plus, +0) \ -DECL_AXIS(l_x_minus, -0) \ -DECL_AXIS(l_y_plus, +1) \ -DECL_AXIS(l_y_minus, -1) \ -DECL_AXIS(r_x_plus, +2) \ -DECL_AXIS(r_x_minus, -2) \ -DECL_AXIS(r_y_plus, -3) \ -DECL_AXIS(r_y_minus, +3) +#ifdef WIIU + +#define WIIUINPUT_GAMEPAD_DEFAULT_BINDS \ +DECL_BTN_EX(menu_toggle, 1, "Home") \ +DECL_BTN_EX(select, 2, "-") \ +DECL_BTN_EX(start, 3, "+") \ +DECL_BTN_EX(r, 4, "R") \ +DECL_BTN_EX(l, 5, "L") \ +DECL_BTN_EX(r2, 6, "ZR") \ +DECL_BTN_EX(l2, 7, "ZL") \ +DECL_BTN_EX(down, 8, "D-Pad Down") \ +DECL_BTN_EX(up, 9, "D-Pad Up") \ +DECL_BTN_EX(right, 10, "D-Pad Right") \ +DECL_BTN_EX(left, 11, "D-Pad Left") \ +DECL_BTN_EX(y, 12, "Y") \ +DECL_BTN_EX(x, 13, "X") \ +DECL_BTN_EX(b, 14, "B") \ +DECL_BTN_EX(a, 15, "A") \ +DECL_BTN_EX(r3, 17, "Right Thumb") \ +DECL_BTN_EX(l3, 18, "Left Thumb") \ +DECL_AXIS_EX(l_x_plus, +0, "L-Stick right") \ +DECL_AXIS_EX(l_x_minus, -0, "L-Stick left") \ +DECL_AXIS_EX(l_y_minus, +1, "L-Stick up") \ +DECL_AXIS_EX(l_y_plus, -1, "L-Stick down") \ +DECL_AXIS_EX(r_x_plus, +2, "R-Stick right") \ +DECL_AXIS_EX(r_x_minus, -2, "R-Stick left") \ +DECL_AXIS_EX(r_y_minus, +3, "R-Stick up") \ +DECL_AXIS_EX(r_y_plus, -3, "R-Stick down") + +#define WIIUINPUT_PRO_CONTROLLER_DEFAULT_BINDS \ +DECL_BTN_EX(up, 0, "D-Pad Up") \ +DECL_BTN_EX(left, 1, "D-Pad Left") \ +DECL_BTN_EX(r2, 2, "ZR") \ +DECL_BTN_EX(x, 3, "X") \ +DECL_BTN_EX(a, 4, "A") \ +DECL_BTN_EX(y, 5, "Y") \ +DECL_BTN_EX(b, 6, "B") \ +DECL_BTN_EX(l2, 7, "ZL") \ +DECL_BTN_EX(r, 9, "R") \ +DECL_BTN_EX(start, 10, "+") \ +DECL_BTN_EX(menu_toggle, 11, "Home") \ +DECL_BTN_EX(select, 12, "-") \ +DECL_BTN_EX(l, 13, "L") \ +DECL_BTN_EX(down, 14, "D-Pad Down") \ +DECL_BTN_EX(right, 15, "D-Pad Right") \ +DECL_BTN_EX(r3, 16, "Right Thumb") \ +DECL_BTN_EX(l3, 17, "Left Thumb") \ +DECL_AXIS_EX(l_x_plus, +0, "L-Stick right") \ +DECL_AXIS_EX(l_x_minus, -0, "L-Stick left") \ +DECL_AXIS_EX(l_y_minus, +1, "L-Stick up") \ +DECL_AXIS_EX(l_y_plus, -1, "L-Stick down") \ +DECL_AXIS_EX(r_x_plus, +2, "R-Stick right") \ +DECL_AXIS_EX(r_x_minus, -2, "R-Stick left") \ +DECL_AXIS_EX(r_y_minus, +3, "R-Stick up") \ +DECL_AXIS_EX(r_y_plus, -3, "R-Stick down") + +#define WIIUINPUT_CLASSIC_CONTROLLER_DEFAULT_BINDS \ +DECL_BTN_EX(up, 0, "D-Pad Up") \ +DECL_BTN_EX(left, 1, "D-Pad Left") \ +DECL_BTN_EX(r2, 2, "ZR") \ +DECL_BTN_EX(x, 3, "X") \ +DECL_BTN_EX(a, 4, "A") \ +DECL_BTN_EX(y, 5, "Y") \ +DECL_BTN_EX(b, 6, "B") \ +DECL_BTN_EX(l2, 7, "ZL") \ +DECL_BTN_EX(r, 9, "R") \ +DECL_BTN_EX(start, 10, "+") \ +DECL_BTN_EX(menu_toggle, 11, "Home") \ +DECL_BTN_EX(select, 12, "-") \ +DECL_BTN_EX(l, 13, "L") \ +DECL_BTN_EX(down, 14, "D-Pad Down") \ +DECL_BTN_EX(right, 15, "D-Pad Right") \ +DECL_AXIS_EX(l_x_plus, +0, "L-Stick right") \ +DECL_AXIS_EX(l_x_minus, -0, "L-Stick left") \ +DECL_AXIS_EX(l_y_minus, +1, "L-Stick up") \ +DECL_AXIS_EX(l_y_plus, -1, "L-Stick down") \ +DECL_AXIS_EX(r_x_plus, +2, "R-Stick right") \ +DECL_AXIS_EX(r_x_minus, -2, "R-Stick left") \ +DECL_AXIS_EX(r_y_minus, +3, "R-Stick up") \ +DECL_AXIS_EX(r_y_plus, -3, "R-Stick down") + +#define WIIUINPUT_WIIMOTE_DEFAULT_BINDS \ +DECL_BTN_EX(down, 0, "D-Pad Left") \ +DECL_BTN_EX(up, 1, "D-Pad Right") \ +DECL_BTN_EX(right, 2, "D-Pad Down") \ +DECL_BTN_EX(left, 3, "D-Pad Up") \ +DECL_BTN_EX(start, 4, "+") \ +DECL_BTN_EX(a, 8, "2") \ +DECL_BTN_EX(b, 9, "1") \ +DECL_BTN_EX(x, 10, "B") \ +DECL_BTN_EX(y, 11, "A") \ +DECL_BTN_EX(select, 12, "-") \ +DECL_BTN_EX(l, 13, "Z") \ +DECL_BTN_EX(r, 14, "C") \ +DECL_BTN_EX(menu_toggle, 15, "Home") + +#define WIIUINPUT_NUNCHUK_DEFAULT_BINDS \ +DECL_BTN_EX(left, 0, "D-Pad Left") \ +DECL_BTN_EX(right, 1, "D-Pad Right") \ +DECL_BTN_EX(down, 2, "D-Pad Down") \ +DECL_BTN_EX(up, 3, "D-Pad Up") \ +DECL_BTN_EX(start, 4, "+") \ +DECL_BTN_EX(y, 8, "2") \ +DECL_BTN_EX(x, 9, "1") \ +DECL_BTN_EX(b, 10, "B") \ +DECL_BTN_EX(a, 11, "A") \ +DECL_BTN_EX(select, 12, "-") \ +DECL_BTN_EX(l, 13, "Z") \ +DECL_BTN_EX(r, 14, "C") \ +DECL_BTN_EX(menu_toggle, 15, "Home") \ +DECL_AXIS_EX(l_x_plus, +0, "Stick Right") \ +DECL_AXIS_EX(l_x_minus, -0, "Stick Left") \ +DECL_AXIS_EX(l_y_minus, +1, "Stick Up") \ +DECL_AXIS_EX(l_y_plus, -1, "Stick Down") \ + +#endif #define GXINPUT_GAMECUBE_DEFAULT_BINDS \ DECL_BTN(a, 0) \ @@ -417,7 +512,11 @@ const char* const input_builtin_autoconfs[] = #endif #endif #ifdef WIIU - DECL_AUTOCONF_DEVICE("WIIU Controller", "wiiu", WIIUINPUT_DEFAULT_BINDS), + DECL_AUTOCONF_DEVICE("WIIU Gamepad", "wiiu", WIIUINPUT_GAMEPAD_DEFAULT_BINDS), + DECL_AUTOCONF_DEVICE("WIIU Pro Controller", "wiiu", WIIUINPUT_PRO_CONTROLLER_DEFAULT_BINDS), + DECL_AUTOCONF_DEVICE("Wiimote Controller", "wiiu", WIIUINPUT_WIIMOTE_DEFAULT_BINDS), + DECL_AUTOCONF_DEVICE("Nunchuk Controller", "wiiu", WIIUINPUT_NUNCHUK_DEFAULT_BINDS), + DECL_AUTOCONF_DEVICE("Classic Controller", "wiiu", WIIUINPUT_CLASSIC_CONTROLLER_DEFAULT_BINDS), #endif #ifdef __CELLOS_LV2__ DECL_AUTOCONF_DEVICE("SixAxis Controller", "ps3", PS3INPUT_DEFAULT_BINDS), diff --git a/input/input_config.c b/input/input_config.c index 093c37debd..5c3fc2632d 100644 --- a/input/input_config.c +++ b/input/input_config.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -486,11 +486,21 @@ const char *input_config_get_device_name(unsigned port) void input_config_set_device_name(unsigned port, const char *name) { - settings_t *settings = config_get_ptr(); if (!string_is_empty(name)) + { + settings_t *settings = config_get_ptr(); strlcpy(settings->input.device_names[port], name, sizeof(settings->input.device_names[port])); + } +} + +void input_config_set_device(unsigned port, unsigned id) +{ + settings_t *settings = config_get_ptr(); + + if (settings) + settings->input.libretro_device[port] = id; } bool input_config_get_bind_idx(unsigned port, unsigned *joy_idx_real) @@ -517,3 +527,4 @@ const struct retro_keybind *input_config_get_bind_auto(unsigned port, unsigned i return &settings->input.autoconf_binds[joy_idx][id]; return NULL; } + diff --git a/input/input_config.h b/input/input_config.h index f21997e9fd..10c78b50af 100644 --- a/input/input_config.h +++ b/input/input_config.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -69,6 +69,8 @@ void input_config_parse_joy_axis(void *data, const char *prefix, void input_config_set_device_name(unsigned port, const char *name); +void input_config_set_device(unsigned port, unsigned id); + const char *input_config_get_device_name(unsigned port); const struct retro_keybind *input_config_get_bind_auto(unsigned port, unsigned id); diff --git a/input/input_defines.h b/input/input_defines.h index c626512773..4c89905a75 100644 --- a/input/input_defines.h +++ b/input/input_defines.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/input_driver.c b/input/input_driver.c index 562770edb3..4997651cb2 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -265,7 +265,6 @@ static const struct retro_keybind *libretro_input_binds[MAX_USERS]; void input_poll(void) { size_t i; - rarch_joypad_info_t joypad_info; settings_t *settings = config_get_ptr(); unsigned max_users = settings->input.max_users; @@ -279,44 +278,44 @@ void input_poll(void) input_driver_turbo_btns.frame_enable[i] = 0; } - joypad_info.axis_threshold = settings->input.axis_threshold; - if (!input_driver_block_libretro_input) { + rarch_joypad_info_t joypad_info; + joypad_info.axis_threshold = settings->input.axis_threshold; + for (i = 0; i < max_users; i++) { - bool bind_valid = libretro_input_binds[i][RARCH_TURBO_ENABLE].valid; - - if (bind_valid) + if (libretro_input_binds[i][RARCH_TURBO_ENABLE].valid) { - joypad_info.joy_idx = i; - joypad_info.auto_binds = settings->input.autoconf_binds[i]; + joypad_info.joy_idx = settings->input.joypad_map[i]; + joypad_info.auto_binds = settings->input.autoconf_binds[joypad_info.joy_idx]; input_driver_turbo_btns.frame_enable[i] = current_input->input_state( current_input_data, joypad_info, libretro_input_binds, i, RETRO_DEVICE_JOYPAD, 0, RARCH_TURBO_ENABLE); } } - } #ifdef HAVE_OVERLAY - if (overlay_ptr && input_overlay_is_alive(overlay_ptr)) - input_poll_overlay( - overlay_ptr, - settings->input.overlay_opacity, - settings->input.analog_dpad_mode[0], - settings->input.axis_threshold); + if (overlay_ptr && input_overlay_is_alive(overlay_ptr)) + input_poll_overlay( + overlay_ptr, + settings->input.overlay_opacity, + settings->input.analog_dpad_mode[0], + settings->input.axis_threshold); #endif #ifdef HAVE_COMMAND - if (input_driver_command) - command_poll(input_driver_command); + if (input_driver_command) + command_poll(input_driver_command); #endif #ifdef HAVE_NETWORKGAMEPAD - if (input_driver_remote) - input_remote_poll(input_driver_remote); + if (input_driver_remote) + input_remote_poll(input_driver_remote, + settings->input.max_users); #endif + } } /** @@ -334,57 +333,57 @@ void input_poll(void) int16_t input_state(unsigned port, unsigned device, unsigned idx, unsigned id) { - rarch_joypad_info_t joypad_info; int16_t res = 0; - settings_t *settings = config_get_ptr(); device &= RETRO_DEVICE_MASK; - joypad_info.axis_threshold = settings->input.axis_threshold; - if (bsv_movie_ctl(BSV_MOVIE_CTL_PLAYBACK_ON, NULL)) { - int16_t ret; - if (bsv_movie_ctl(BSV_MOVIE_CTL_GET_INPUT, &ret)) - return ret; + int16_t bsv_result; + if (bsv_movie_get_input(&bsv_result)) + return bsv_result; bsv_movie_ctl(BSV_MOVIE_CTL_SET_END, NULL); } - if (settings->input.remap_binds_enable) - { - switch (device) - { - case RETRO_DEVICE_JOYPAD: - if (id < RARCH_FIRST_CUSTOM_BIND) - id = settings->input.remap_ids[port][id]; - break; - case RETRO_DEVICE_ANALOG: - if (idx < 2 && id < 2) - { - unsigned new_id = RARCH_FIRST_CUSTOM_BIND + (idx * 2 + id); - - new_id = settings->input.remap_ids[port][new_id]; - idx = (new_id & 2) >> 1; - id = new_id & 1; - } - break; - } - } - - if (!input_driver_flushing_input + if ( !input_driver_flushing_input && !input_driver_block_libretro_input) { + settings_t *settings = config_get_ptr(); + + if (settings->input.remap_binds_enable) + { + switch (device) + { + case RETRO_DEVICE_JOYPAD: + if (id < RARCH_FIRST_CUSTOM_BIND) + id = settings->input.remap_ids[port][id]; + break; + case RETRO_DEVICE_ANALOG: + if (idx < 2 && id < 2) + { + unsigned new_id = RARCH_FIRST_CUSTOM_BIND + (idx * 2 + id); + + new_id = settings->input.remap_ids[port][new_id]; + idx = (new_id & 2) >> 1; + id = new_id & 1; + } + break; + } + } + if (((id < RARCH_FIRST_META_KEY) || (device == RETRO_DEVICE_KEYBOARD))) { bool bind_valid = libretro_input_binds[port] && libretro_input_binds[port][id].valid; - if (device == RETRO_DEVICE_KEYBOARD) - bind_valid = true; - if (bind_valid) + if (bind_valid || device == RETRO_DEVICE_KEYBOARD) { - joypad_info.joy_idx = port; - joypad_info.auto_binds = settings->input.autoconf_binds[port]; + rarch_joypad_info_t joypad_info; + + joypad_info.axis_threshold = settings->input.axis_threshold; + joypad_info.joy_idx = settings->input.joypad_map[port]; + joypad_info.auto_binds = settings->input.autoconf_binds[joypad_info.joy_idx]; + res = current_input->input_state( current_input_data, joypad_info, libretro_input_binds, port, device, idx, id); } @@ -398,31 +397,31 @@ int16_t input_state(unsigned port, unsigned device, #ifdef HAVE_NETWORKGAMEPAD input_remote_state(&res, port, device, idx, id); #endif - } - /* Don't allow turbo for D-pad. */ - if (device == RETRO_DEVICE_JOYPAD && (id < RETRO_DEVICE_ID_JOYPAD_UP || - id > RETRO_DEVICE_ID_JOYPAD_RIGHT)) - { - /* - * Apply turbo button if activated. - * - * If turbo button is held, all buttons pressed except - * for D-pad will go into a turbo mode. Until the button is - * released again, the input state will be modulated by a - * periodic pulse defined by the configured duty cycle. - */ - if (res && input_driver_turbo_btns.frame_enable[port]) - input_driver_turbo_btns.enable[port] |= (1 << id); - else if (!res) - input_driver_turbo_btns.enable[port] &= ~(1 << id); - - if (input_driver_turbo_btns.enable[port] & (1 << id)) + /* Don't allow turbo for D-pad. */ + if (device == RETRO_DEVICE_JOYPAD && (id < RETRO_DEVICE_ID_JOYPAD_UP || + id > RETRO_DEVICE_ID_JOYPAD_RIGHT)) { - /* if turbo button is enabled for this key ID */ - res = res && ((input_driver_turbo_btns.count - % settings->input.turbo_period) - < settings->input.turbo_duty_cycle); + /* + * Apply turbo button if activated. + * + * If turbo button is held, all buttons pressed except + * for D-pad will go into a turbo mode. Until the button is + * released again, the input state will be modulated by a + * periodic pulse defined by the configured duty cycle. + */ + if (res && input_driver_turbo_btns.frame_enable[port]) + input_driver_turbo_btns.enable[port] |= (1 << id); + else if (!res) + input_driver_turbo_btns.enable[port] &= ~(1 << id); + + if (input_driver_turbo_btns.enable[port] & (1 << id)) + { + /* if turbo button is enabled for this key ID */ + res = res && ((input_driver_turbo_btns.count + % settings->input.turbo_period) + < settings->input.turbo_duty_cycle); + } } } @@ -476,22 +475,16 @@ static const unsigned buttons[] = { void state_tracker_update_input(uint16_t *input1, uint16_t *input2) { unsigned i; - rarch_joypad_info_t joypad_info; const struct retro_keybind *binds[MAX_USERS]; settings_t *settings = config_get_ptr(); unsigned max_users = settings->input.max_users; - /* Only bind for up to two players for now. */ - for (i = 0; i < max_users; i++) - binds[i] = settings->input.binds[i]; - - joypad_info.axis_threshold = settings->input.axis_threshold; - for (i = 0; i < max_users; i++) { struct retro_keybind *general_binds = settings->input.binds[i]; struct retro_keybind *auto_binds = settings->input.autoconf_binds[i]; enum analog_dpad_mode dpad_mode = (enum analog_dpad_mode)settings->input.analog_dpad_mode[i]; + binds[i] = settings->input.binds[i]; if (dpad_mode == ANALOG_DPAD_NONE) continue; @@ -502,22 +495,25 @@ void state_tracker_update_input(uint16_t *input1, uint16_t *input2) if (!input_driver_block_libretro_input) { + rarch_joypad_info_t joypad_info; + joypad_info.axis_threshold = settings->input.axis_threshold; + for (i = 4; i < 16; i++) { unsigned id = buttons[i - 4]; if (binds[0][id].valid) { - joypad_info.joy_idx = 0; - joypad_info.auto_binds = settings->input.autoconf_binds[0]; + joypad_info.joy_idx = settings->input.joypad_map[0]; + joypad_info.auto_binds = settings->input.autoconf_binds[joypad_info.joy_idx]; *input1 |= (current_input->input_state(current_input_data, joypad_info, binds, 0, RETRO_DEVICE_JOYPAD, 0, id) ? 1 : 0) << i; } if (binds[1][id].valid) { - joypad_info.joy_idx = 1; - joypad_info.auto_binds = settings->input.autoconf_binds[1]; + joypad_info.joy_idx = settings->input.joypad_map[1]; + joypad_info.auto_binds = settings->input.autoconf_binds[joypad_info.joy_idx]; *input2 |= (current_input->input_state(current_input_data, joypad_info, binds, 1, RETRO_DEVICE_JOYPAD, 0, id) ? 1 : 0) << i; @@ -559,8 +555,8 @@ static INLINE bool input_menu_keys_pressed_internal( const input_device_driver_t *sec = current_input->get_sec_joypad_driver ? current_input->get_sec_joypad_driver(current_input_data) : NULL; - joypad_info.joy_idx = port; - joypad_info.auto_binds = settings->input.autoconf_binds[port]; + joypad_info.joy_idx = settings->input.joypad_map[port]; + joypad_info.auto_binds = settings->input.autoconf_binds[joypad_info.joy_idx]; joypad_info.axis_threshold = settings->input.axis_threshold; if (sec && input_joypad_pressed(sec, @@ -710,8 +706,8 @@ uint64_t input_menu_keys_pressed( if (check_input_driver_block_hotkey(binds_norm, binds_auto)) { - joypad_info.joy_idx = 0; - joypad_info.auto_binds = settings->input.autoconf_binds[0]; + joypad_info.joy_idx = settings->input.joypad_map[0]; + joypad_info.auto_binds = settings->input.autoconf_binds[joypad_info.joy_idx]; if (settings->input.binds[0][RARCH_ENABLE_HOTKEY].valid && current_input->input_state(current_input_data, joypad_info, @@ -826,8 +822,8 @@ static INLINE bool input_keys_pressed_internal( { bool bind_valid = binds[i].valid; - joypad_info.joy_idx = 0; - joypad_info.auto_binds = settings->input.autoconf_binds[0]; + joypad_info.joy_idx = settings->input.joypad_map[0]; + joypad_info.auto_binds = settings->input.autoconf_binds[joypad_info.joy_idx]; if (bind_valid && current_input->input_state(current_input_data, joypad_info, &binds, @@ -912,8 +908,8 @@ uint64_t input_keys_pressed( if (check_input_driver_block_hotkey(binds_norm, binds_auto)) { - joypad_info.joy_idx = 0; - joypad_info.auto_binds = settings->input.autoconf_binds[0]; + joypad_info.joy_idx = settings->input.joypad_map[0]; + joypad_info.auto_binds = settings->input.autoconf_binds[joypad_info.joy_idx]; if ( enable_hotkey_valid && current_input->input_state( current_input_data, joypad_info, &binds, 0, @@ -930,8 +926,8 @@ uint64_t input_keys_pressed( if (check_input_driver_block_hotkey( focus_normal, focus_binds_auto) && game_focus_toggle_valid) { - joypad_info.joy_idx = 0; - joypad_info.auto_binds = settings->input.autoconf_binds[0]; + joypad_info.joy_idx = settings->input.joypad_map[0]; + joypad_info.auto_binds = settings->input.autoconf_binds[joypad_info.joy_idx]; if (current_input->input_state(current_input_data, joypad_info, &binds, 0, RETRO_DEVICE_JOYPAD, 0, RARCH_GAME_FOCUS_TOGGLE)) input_driver_block_hotkey = false; @@ -1184,7 +1180,12 @@ void input_driver_deinit_remote(void) { #ifdef HAVE_NETWORKGAMEPAD if (input_driver_remote) - input_remote_free(input_driver_remote); + { + settings_t *settings = config_get_ptr(); + + input_remote_free(input_driver_remote, + settings->input.max_users); + } input_driver_remote = NULL; #endif } @@ -1198,7 +1199,8 @@ bool input_driver_init_remote(void) return false; input_driver_remote = input_remote_new( - settings->network_remote_base_port); + settings->network_remote_base_port, + settings->input.max_users); if (input_driver_remote) return true; diff --git a/input/input_driver.h b/input/input_driver.h index cf8ba67963..959d0296a4 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/input_hid_driver.c b/input/input_hid_driver.c index af83be29ee..55a4202423 100644 --- a/input/input_hid_driver.c +++ b/input/input_hid_driver.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/input_hid_driver.h b/input/input_hid_driver.h index ef844a1bd0..c6cd4b9d0a 100644 --- a/input/input_hid_driver.h +++ b/input/input_hid_driver.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/input_joypad_driver.c b/input/input_joypad_driver.c index eaf4f45692..b868f7e01d 100644 --- a/input/input_joypad_driver.c +++ b/input/input_joypad_driver.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/input_joypad_driver.h b/input/input_joypad_driver.h index d6b2d2f381..fb897426ea 100644 --- a/input/input_joypad_driver.h +++ b/input/input_joypad_driver.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/input_keyboard.c b/input/input_keyboard.c index a5d31cb827..9031fc0faa 100644 --- a/input/input_keyboard.c +++ b/input/input_keyboard.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/input_keyboard.h b/input/input_keyboard.h index e99bef87cc..b2d973940b 100644 --- a/input/input_keyboard.h +++ b/input/input_keyboard.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/input_keymaps.c b/input/input_keymaps.c index 3c4cb5a3e0..a6317b254f 100644 --- a/input/input_keymaps.c +++ b/input/input_keymaps.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/input_keymaps.h b/input/input_keymaps.h index f27dc73b86..4e7b5dab32 100644 --- a/input/input_keymaps.h +++ b/input/input_keymaps.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/input_overlay.c b/input/input_overlay.c index 52dca6908f..3a04b2738c 100644 --- a/input/input_overlay.c +++ b/input/input_overlay.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -487,7 +487,7 @@ void input_overlay_loaded(void *task_data, void *user_data, const char *err) #ifdef HAVE_MENU /* We can't display when the menu is up */ - if (data->hide_in_menu && menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (data->hide_in_menu && menu_driver_is_alive()) { if (data->overlay_enable) goto abort_load; diff --git a/input/input_overlay.h b/input/input_overlay.h index 9eac1af6ce..93f3c83e91 100644 --- a/input/input_overlay.h +++ b/input/input_overlay.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/input_remapping.c b/input/input_remapping.c index 357b6b636d..f3da621e69 100644 --- a/input/input_remapping.c +++ b/input/input_remapping.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/input_remapping.h b/input/input_remapping.h index df04889fa1..3c988ad2c5 100644 --- a/input/input_remapping.h +++ b/input/input_remapping.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/input/input_remote.c b/input/input_remote.c index 5523e24dd3..beb4c237e8 100644 --- a/input/input_remote.c +++ b/input/input_remote.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -120,7 +120,7 @@ error: } #endif -input_remote_t *input_remote_new(uint16_t port) +input_remote_t *input_remote_new(uint16_t port, unsigned max_users) { unsigned user; #if defined(HAVE_NETWORKING) && defined(HAVE_NETWORKGAMEPAD) @@ -135,7 +135,7 @@ input_remote_t *input_remote_new(uint16_t port) (void)port; #if defined(HAVE_NETWORKING) && defined(HAVE_NETWORKGAMEPAD) - for(user = 0; user < settings->input.max_users; user ++) + for(user = 0; user < max_users; user ++) { handle->net_fd[user] = -1; if(settings->network_remote_enable_user[user]) @@ -148,18 +148,17 @@ input_remote_t *input_remote_new(uint16_t port) #if defined(HAVE_NETWORKING) && defined(HAVE_NETWORKGAMEPAD) error: - input_remote_free(handle); + input_remote_free(handle, max_users); return NULL; #endif } -void input_remote_free(input_remote_t *handle) +void input_remote_free(input_remote_t *handle, unsigned max_users) { unsigned user; #if defined(HAVE_NETWORKING) && defined(HAVE_NETWORKGAMEPAD) - settings_t *settings = config_get_ptr(); - for(user = 0; user < settings->input.max_users; user ++) + for(user = 0; user < max_users; user ++) socket_close(handle->net_fd[user]); #endif @@ -229,13 +228,13 @@ bool input_remote_key_pressed(int key, unsigned port) return (ol_state->buttons[port] & (UINT64_C(1) << key)); } -void input_remote_poll(input_remote_t *handle) +void input_remote_poll(input_remote_t *handle, unsigned max_users) { unsigned user; settings_t *settings = config_get_ptr(); input_remote_state_t *ol_state = input_remote_get_state_ptr(); - for(user = 0; user < settings->input.max_users; user++) + for(user = 0; user < max_users; user++) { if (settings->network_remote_enable_user[user]) { diff --git a/input/input_remote.h b/input/input_remote.h index 605cde065b..861cea9149 100644 --- a/input/input_remote.h +++ b/input/input_remote.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -30,11 +30,11 @@ RETRO_BEGIN_DECLS typedef struct input_remote input_remote_t; -input_remote_t *input_remote_new(uint16_t port); +input_remote_t *input_remote_new(uint16_t port, unsigned max_users); -void input_remote_free(input_remote_t *handle); +void input_remote_free(input_remote_t *handle, unsigned max_users); -void input_remote_poll(input_remote_t *handle); +void input_remote_poll(input_remote_t *handle, unsigned max_users); bool input_remote_key_pressed(int key, unsigned port); diff --git a/intl/msg_hash_chs.c b/intl/msg_hash_chs.c index 5afbaa8a9e..cdc0cee8ce 100644 --- a/intl/msg_hash_chs.c +++ b/intl/msg_hash_chs.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -26,6 +26,7 @@ #if defined(_MSC_VER) && !defined(_XBOX) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") +#pragma warning( disable : 4566 ) #endif int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) diff --git a/intl/msg_hash_de.c b/intl/msg_hash_de.c index 10517b0dae..81e039f3ee 100644 --- a/intl/msg_hash_de.c +++ b/intl/msg_hash_de.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -117,6 +117,28 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len) "im Hauptmenü angezeigt." ); break; + case MENU_ENUM_LABEL_LOAD_CONTENT_LIST: + snprintf(s, len, + "Lade Inhalt. \n" + "Suche nach Inhalt. \n" + " \n" + "Um Inhalte zu laden brauchst du\n" + "einen 'Core'. \n" + " \n" + "Um einzustellen wo das Verzeichnis beginnt, \n" + "setze das \n" + "'%s'. \n" + "Falls diese nicht gesetzt ist, startet \n" + "die Suche beim obersten Verzeichnis.\n" + " \n" + "Beim Durchsuchen werden Inhalte gefiltert. \n" + "Nur Inhalte mit der Dateiendung, welche \n" + "mit den ausgewählten Core funktionieren \n" + "werden angezeigt. \n" + "Dieser Core wird dann auch für den Inhalt verwendet.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RGUI_BROWSER_DIRECTORY) + ); + break; case MENU_ENUM_LABEL_VIDEO_DRIVER: snprintf(s, len, "Momentaner Grafiktreiber."); @@ -308,6 +330,14 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len) "Die Zurückspulfunktion muss eingeschaltet \n" "sein."); break; + case MENU_ENUM_LABEL_RGUI_BROWSER_DIRECTORY: + snprintf(s, len, + "%s. \n" + " \n" + "Setzt das Startverzeichnis des Dateibrowsers.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RGUI_BROWSER_DIRECTORY) + ); + break; case MENU_ENUM_LABEL_EXIT_EMULATOR: snprintf(s, len, "Taste zum Beenden von RetroArch." @@ -401,6 +431,87 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len) case MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_LIST_HARDCORE: snprintf(s, len, "Erfolgsliste (Hardcore)"); break; + case MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING_DESC: + { + /* Work around C89 limitations */ + char u[501]; + const char * t = + "RetroArch verwendet eine einzigartige\n" + "Art der Synchronisation von Audio/Video.\n" + "Diese wird durch die Bildwiederholrate\n" + "des Monitors kalibriert.\n" + "\n" + "Falls du irgenwelches Knistern oder Risse\n" + "feststellst, kannst du folgende Möglichkeiten:\n" + "\n"; + snprintf(u, sizeof(u), + "a) Gehe zu '%s' -> '%s' und aktiviere\n" + "'%s'. Die Bildwiederholungsrate spielt\n" + "in diesem Modus keine Rolle. \n" + "Die Bildwiederholungsrate wird höher sein,\n" + "allerdings läuft das Video weniger flüssig.\n" + "b) Gehe zu '%s' -> '%s' und beachte\n" + "'%s'. Lass es bis 2048 Frames laufen und\n" + "bestätige mit 'OK'.\n", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_THREADED), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO) + ); + strlcpy(s, t, len); + strlcat(s, u, len); + } + break; + case MENU_ENUM_LABEL_VALUE_HELP_CHANGE_VIRTUAL_GAMEPAD_DESC: + snprintf(s, len, + "Du kannst das virtuelle Gamepad-Overlay\n" + "unter '%s' -> '%s' ändern." + " \n" + "Darin kannst du die Grösse, die Transparenz\n" + "und vieles mehr anpassen.\n" + " \n" + "WICHTIG: Standartmässig, ist das virtuelle\n" + "Gamepad-Overlay im Menü nicht ersichtlich.\n" + "Wenn du dies ändern möchtest,\n" + "kannst du '%s' auf Nein stellen.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OVERLAY_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU) + ); + break; + case MENU_ENUM_LABEL_VALUE_HELP_SCANNING_CONTENT_DESC: + snprintf(s, len, + "Um Inhalte zu suchen, gehe zu '%s' und\n" + "wähle entweder '%s' oder '%s'.\n" + " \n" + "Die Dateien werden mit Einträgen in der\n" + "Datenbank verglichen.\n" + "Wenn es einen Treffer gibt, wird der Inhalt\n" + "zur Sammlung hinzugefügt.\n" + " \n" + "Danach kannst du einfach den Inhalt unter\n" + "'%s' -> '%s' laden,\n" + "anstatt jedesmal die Datei neu zu suchen.\n" + " \n" + "WICHTIG: Inhalte für einige Cores sind zum\n" + "Teil noch nicht scannbar.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ADD_CONTENT_LIST), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_FILE), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_COLLECTION_LIST) + ); + break; + case MENU_ENUM_LABEL_VALUE_MENU_ENUM_CONTROLS_PROLOG: + snprintf(s, len, + "Du kannst folgende Steuerelemente mit\n" + "deinem Controller oder deiner Tastatur verwenden\n" + "um durch das Menü zu navigieren: \n" + " \n" + ); + break; case MENU_ENUM_LABEL_VALUE_PARENT_DIRECTORY: snprintf(s, len, "Übergeordnetes Verzeichnis"); break; @@ -419,6 +530,37 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len) case MENU_ENUM_LABEL_VALUE_UPDATE_LAKKA: snprintf(s, len, "Lakka aktualisieren"); break; + case MENU_ENUM_LABEL_VALUE_WHAT_IS_A_CORE_DESC: + snprintf(s, len, + "RetroArch alleine macht nichts. \n" + " \n" + "Damit es etwas tut, musst du \n" + "ein Programm darin laden. \n" + "\n" + "Wir nennen so ein Programm 'Libretro core', \n" + "oder 'core' als Abkürzung. \n" + " \n" + "Um einen Core zu laden, wählen Sie einen \n" + "unter '%s' aus.\n" + " \n" +#ifdef HAVE_NETWORKING + "Du erhälst Cores durch verschiedene Wege: \n" + "* Herunterladen unter\n" + "'%s' -> '%s'.\n" + "* Manuelles hinzufügen nach\n" + "'%s'.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_LIST), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_UPDATER_LIST), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH) +#else + "Du erhälst Cores wenn du diese \n" + "manuell hinzufügst unter\n" + "'%s'.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH) +#endif + ); + break; case MSG_UNKNOWN: default: /* TODO/FIXME - translate */ diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index bfe26dcc79..b9a3b40f9e 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -17,13 +17,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_BLOCK_FRAMES, MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_DEVICE, "Soundkarte") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_DRIVER, - "Audio-Treiber") + "Audiotreiber") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_DSP_PLUGIN, "Audio-DSP-Plugin") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE, "Aktiviere Audio") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_FILTER_DIR, - "Audio-Filter-Verzeichnis") + "Audiofilterverzeichnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_LATENCY, "Audiolatenz (ms)") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_MAX_TIMING_SKEW, @@ -31,19 +31,19 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_MAX_TIMING_SKEW, MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_MUTE, "Stumm") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_OUTPUT_RATE, - "Audio-Frequenzrate (kHz)") + "Audiofrequenzrate (kHz)") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_RATE_CONTROL_DELTA, "Audio Rate Control Delta") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_DRIVER, "Audio-Resampler-Treiber") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_SETTINGS, - "Audio-Einstellungen") + "Audioeinstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_SYNC, "Synchronisiere Audio") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_VOLUME, "Lautstärke (dB)") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOSAVE_INTERVAL, - "Autospeicherungsintervall") + "Automatischespeicherungsintervall") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTO_OVERRIDES_ENABLE, "Override-Dateien automatisch laden") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTO_REMAPS_ENABLE, @@ -53,39 +53,49 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_BLOCK_SRAM_OVERWRITE, MSG_HASH(MENU_ENUM_LABEL_VALUE_BUILDBOT_ASSETS_URL, "Buildbot-Assets-URL") MSG_HASH(MENU_ENUM_LABEL_VALUE_CACHE_DIRECTORY, /* FIXME/UPDATE */ - "Entpack-Verzeichnis") + "Entpackverzeichnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_CAMERA_ALLOW, "Erlaube Kamera-Zugriff") MSG_HASH(MENU_ENUM_LABEL_VALUE_CAMERA_DRIVER, - "Kamera-Treiber") + "Kameratreiber") MSG_HASH(MENU_ENUM_LABEL_VALUE_CHEAT, "Cheat") MSG_HASH(MENU_ENUM_LABEL_VALUE_CHEAT_APPLY_CHANGES, "Änderungen übernehmen") MSG_HASH(MENU_ENUM_LABEL_VALUE_CHEAT_DATABASE_PATH, - "Cheat-Datei-Verzeichnis") + "Cheat-Dateiverzeichnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_CHEAT_FILE_LOAD, "Cheat-Datei laden") MSG_HASH(MENU_ENUM_LABEL_VALUE_CHEAT_FILE_SAVE_AS, "Speichere Cheat-Datei unter...") MSG_HASH(MENU_ENUM_LABEL_VALUE_CHEAT_NUM_PASSES, "Cheat-Durchgänge") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CHECK_FOR_MISSING_FIRMWARE, + "Überprüfe Firmware vor dem Laden.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CHEEVOS_ENABLE, + "Aktiviere Errungenschaften") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CHEEVOS_HARDCORE_MODE_ENABLE, + "Hardcore-Modus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CHEEVOS_TEST_UNOFFICIAL, + "Teste unoffizielle Errungenschaften") MSG_HASH(MENU_ENUM_LABEL_VALUE_CLOSE_CONTENT, "Schließen") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONFIGURATIONS, "Konfigurationsdatei laden") /* FIXME/UPDATE */ MSG_HASH(MENU_ENUM_LABEL_VALUE_CONFIGURATION_SETTINGS, - "Konfigurations-Einstellungen") + "Konfigurationseinstellungen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CONFIGURATIONS_LIST, + "Konfigurationen") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONFIG_SAVE_ON_EXIT, "Speichere Konfiguration beim Beenden") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_COLLECTION_LIST, - "Content (Sammlung) laden") /* FIXME/TODO - rewrite */ + "Inhalt laden") /* FIXME/TODO - rewrite */ MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_DATABASE_DIRECTORY, - "Content-Datenbankverzeichnis") + "Inhaltsdatenbankverzeichnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_HISTORY_SIZE, "Länge der Verlaufsliste") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SETTINGS, - "Content-Einstellungen") /* FIXME */ + "Inhaltseinstellungen") /* FIXME */ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_ASSETS_DIRECTORY, "Core-Assets-Verzeichnis") /* FIXME/UPDATE */ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_CHEAT_OPTIONS, @@ -133,23 +143,23 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE, MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_UPDATER_BUILDBOT_URL, "Buildbot-Cores-URL") MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_UPDATER_LIST, - "Core-Updater") + "Aktualisiere Core") MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_UPDATER_SETTINGS, - "Core-Updater-Einstellungen") /* UPDATE/FIXME */ + "Core-Aktualisierungseinstellungen") /* UPDATE/FIXME */ MSG_HASH(MENU_ENUM_LABEL_VALUE_CURSOR_DIRECTORY, "Cursor-Verzeichnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_CURSOR_MANAGER, - "Cursormanager") + "Zeiger-Manager") MSG_HASH(MENU_ENUM_LABEL_VALUE_CUSTOM_RATIO, "Benutzerdefiniertes Verhältnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_MANAGER, - "Datenbankmanager") + "Datenbank-Manager") MSG_HASH(MENU_ENUM_LABEL_VALUE_DELETE_ENTRY, "Von der Playlist löschen") MSG_HASH(MENU_ENUM_LABEL_VALUE_FAVORITES, -"Lesezeichen") + "Lesezeichen") MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT, - "") + "") MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, "") MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, @@ -157,7 +167,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_NOT_FOUND, "Ordner nicht gefunden.") MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_SETTINGS, - "Verzeichnis-Einstellungen") + "Verzeichniseinstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISABLED, "Deaktiviert") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_CYCLE_TRAY_STATUS, @@ -170,18 +180,22 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_OPTIONS, /* UPDATE/FIXME */ "Datenträger-Optionen") MSG_HASH(MENU_ENUM_LABEL_VALUE_DONT_CARE, "Mir egal") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE, + "Core herunterladen...") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE_CONTENT, + "Inhalt Downloader") MSG_HASH(MENU_ENUM_LABEL_VALUE_DPI_OVERRIDE_ENABLE, "Aktiviere DPI-Override") MSG_HASH(MENU_ENUM_LABEL_VALUE_DPI_OVERRIDE_VALUE, "DPI-Override") MSG_HASH(MENU_ENUM_LABEL_VALUE_DRIVER_SETTINGS, - "Treiber-Einstellungen") + "Treibereinstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_DUMMY_ON_CORE_SHUTDOWN, "Dummy bei Core-Abschaltung") MSG_HASH(MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPER, "Dynamischer Hintergrund") MSG_HASH(MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPERS_DIRECTORY, - "Dynamische-Bildschirmhintergründe-Verzeichnis") + "Dynamischehintergrundbilderverzeichnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_ENTRY_HOVER_COLOR, "Hover-Farbe für Menü-Einträge") MSG_HASH(MENU_ENUM_LABEL_VALUE_ENTRY_NORMAL_COLOR, @@ -191,13 +205,27 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_FALSE, MSG_HASH(MENU_ENUM_LABEL_VALUE_FASTFORWARD_RATIO, "Maximale Ausführungsgeschwindigkeit") MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_SHOW, - "Zeige Framerate") + "Zeige Bildwiederholrate") MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE, "Begrenze maximale Ausführungsgeschwindigkeit") MSG_HASH(MENU_ENUM_LABEL_VALUE_FRONTEND_COUNTERS, "Frontendzähler") MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP, "Hilfe") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING, + "Audio/Video Fehlerbehebung") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_CHANGE_VIRTUAL_GAMEPAD, + "Ändere das Virtual Gamepad Overlay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_CONTROLS, + "Grundlegende Menüsteuerung") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_LIST, + "Hilfe") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_LOADING_CONTENT, + "Inhalte laden") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_SCANNING_CONTENT, + "Nach Inhalten suchen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_WHAT_IS_A_CORE, + "Was ist ein Core?") MSG_HASH(MENU_ENUM_LABEL_VALUE_HISTORY_LIST_ENABLE, "Aktiviere Verlaufsliste") MSG_HASH(MENU_ENUM_LABEL_VALUE_HISTORY_TAB, @@ -208,34 +236,176 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_IMAGES_TAB, "Bilder") MSG_HASH(MENU_ENUM_LABEL_VALUE_INFORMATION_LIST, "Informationen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ADC_TYPE, + "Analog-zu-Digital-Typ") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ALL_USERS_CONTROL_MENU, - "Jeder nutze kann Menü Steuern") + "Jeder Nutzer kann das Menü steuern") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X, + "Linker Analogstick X") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X_MINUS, + "Linker Analogstick X- (links)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X_PLUS, + "Linker Analogstick X+ (Rechts)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y, + "Linker Analogstick Y") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y_MINUS, + "Linker Analogstick Y- (hoch)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y_PLUS, + "Linker Analogstick Y+ (runter)") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_AUTODETECT_ENABLE, "Automatische Konfiguration aktivieren") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_AXIS_THRESHOLD, "Schwellwert der Eingabe-Achsen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_BIND_ALL, + "Binde alle") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_BIND_DEFAULT_ALL, + "Binde alle Standard") /* @TODO: What is this */ +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_BIND_TIMEOUT, + "Bindeunterbrechung") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_DESCRIPTOR_HIDE_UNBOUND, "Verstecke nicht zugewiesene Core-Eingabe-Beschriftungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_DESCRIPTOR_LABEL_SHOW, /* TODO/FIXME */ "Zeige Core-Eingabe-Beschriftungen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_INDEX, + "Geräteindex") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_TYPE, + "Gerätetyp") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_DRIVER, - "Eingabe-Treiber") + "Eingabetreiber") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_DUTY_CYCLE, "Auslastungsgrad") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_A, + "A-Knopf (rechts)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_B, + "B-Knopf (unten)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_DOWN, + "Steuerkreuz unten") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_L, + "L-Knopf (Schultertaste)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_L2, + "L2-Knopf (Abzug)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_L3, + "L3-Knopf (Daumen)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_LEFT, + "Steuerkreuz links") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_R, + "R-Knopf (Schultertaste)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_R2, + "R2-Knopf (Abzug)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_R3, + "R3-Knopf (Daumen)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_RIGHT, + "Steuerkreuz rechts") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_SELECT, + "Select-Knopf") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_START, + "Startknopf") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_UP, + "Steuerkreuz oben") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_X, + "X-Knopf (oben)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_Y, + "Y-Knopf (links)") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MAX_USERS, - "Maximale Benutzerzahl") + "Maximale Benutzeranzahl") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, + "Gamepad-Menükombination") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_INDEX_MINUS, + "Cheat-Index -") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_INDEX_PLUS, + "Cheat-Index +") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_TOGGLE, + "Cheat ein/aus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_EJECT_TOGGLE, + "Disk ein-/auswerfen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_NEXT, + "Nächste Disk") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_PREV, + "Vorherige Disk") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_ENABLE_HOTKEY, + "Hotkeys ein/aus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_FAST_FORWARD_HOLD_KEY, + "Zeitraffer") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_FAST_FORWARD_KEY, + "Zeitraffer ein/aus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_FRAMEADVANCE, + "Bildervorlauf") /* @TODO: I don't know what this is */ +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_FULLSCREEN_TOGGLE_KEY, + "Vollbild ein/aus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_GAME_FOCUS_TOGGLE, + "Spielfokus ein/aus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_GRAB_MOUSE_TOGGLE, + "Maus greiffen ein/aus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_LOAD_STATE_KEY, + "Lade Speicherstand") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_MENU_TOGGLE, + "Menü ein/aus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_MOVIE_RECORD_TOGGLE, + "Videoaufzeichnung ein/aus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_MUTE, + "Stumm ein/aus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_FLIP, + "Netplay wechsle Benutzer") /* @TODO What does flip mean in this context? */ +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_GAME_WATCH, + "Netplay Zuschauermodus ein/aus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_OSK, + "Bildschirmtastatus ein/aus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_OVERLAY_NEXT, + "Nächstes Overlay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_PAUSE_TOGGLE, + "Pause ein/aus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, + "RetroArch beenden") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_RESET, + "Spiel zurücksetzen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_REWIND, + "Zurückspulen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SAVE_STATE_KEY, + "Erstelle Speicherstand") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SCREENSHOT, + "Erstelle Bildschirmfoto") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_NEXT, + "Nächster Shader") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_PREV, + "Verheriger Shader") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SLOWMOTION, + "Zeitlupe") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_MINUS, + "Speicherstandplatz -") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_PLUS, + "Speicherstandplatz +") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_DOWN, + "Lautstärke -") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_UP, + "Lautstärke +") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OSK_OVERLAY_ENABLE, "Zeige Tastatur-Overlay") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_ENABLE, "Aktiviere Overlay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU, + "Overlay im Menü nicht anzeigen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR, + "Eingabeabfrageverhalten") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_EARLY, + "Früh") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_LATE, + "Spät") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_NORMAL, + "Normal") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_REMAPPING_DIRECTORY, /* UPDATE/FIXME */ - "Eingabebelegungs-Verzeichnis") + "Eingabebelegungsverzeichnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_REMAP_BINDS_ENABLE, "Bind-Remapping aktivieren") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_SAVE_AUTOCONFIG, + "Speichere Autokonfigurationen") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_SETTINGS, - "Eingabe-Einstellungen") + "Eingabeeinstellungen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_TURBO_ENABLE, + "Turbo aktivieren") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_TURBO_PERIOD, "Turbo-Dauer") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, + "Einheitliche Menüsteuerung") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_USER_BINDS, "Spieler %u Tastenbelegung") MSG_HASH(MENU_ENUM_LABEL_VALUE_JOYPAD_AUTOCONFIG_DIR, @@ -281,15 +451,15 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LINEAR, MSG_HASH(MENU_ENUM_LABEL_VALUE_LOAD_ARCHIVE, "Archiv laden") MSG_HASH(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_HISTORY, - "Content laden (Verlauf)") /* FIXME/UPDATE */ + "Inhalt laden (Verlauf)") /* FIXME/UPDATE */ MSG_HASH(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST, - "Content laden") + "Inhalt laden") MSG_HASH(MENU_ENUM_LABEL_VALUE_LOAD_STATE, "Savestate laden") MSG_HASH(MENU_ENUM_LABEL_VALUE_LOCATION_ALLOW, "Erlaube Standort-Lokalisierung") MSG_HASH(MENU_ENUM_LABEL_VALUE_LOCATION_DRIVER, - "Standort-Treiber") + "Standorttreiber") MSG_HASH(MENU_ENUM_LABEL_VALUE_LOGGING_SETTINGS, "Logging-Einstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_LOG_VERBOSITY, @@ -297,25 +467,33 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LOG_VERBOSITY, MSG_HASH(MENU_ENUM_LABEL_VALUE_MAIN_MENU, "Hauptmenü") MSG_HASH(MENU_ENUM_LABEL_VALUE_MANAGEMENT, - "Datenbank-Einstellungen") + "Datenbankeinstellungen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME, + "Menüfarbschema") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_DRIVER, - "Menü-Treiber") + "Menütreiber") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_ENUM_THROTTLE_FRAMERATE, + "Drossle Menübildwiederholrate") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS, - "Menü-Dateibrowser-Einstellungen") + "Menü-Dateibrowsereinstellungen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_INPUT_SWAP_OK_CANCEL, + "Wechsle Ok & Zurück Tasten im Menü") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_LINEAR_FILTER, + "Linearer Filter") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SETTINGS, - "Menü-Einstellungen") + "Menüeinstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER, "Menühintergrund") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER_OPACITY, - "Background opacity") + "Hintergrundtransparenz") MSG_HASH(MENU_ENUM_LABEL_VALUE_MISSING, "Fehlt") MSG_HASH(MENU_ENUM_LABEL_VALUE_MORE, "...") MSG_HASH(MENU_ENUM_LABEL_VALUE_MOUSE_ENABLE, - "Maus-Unterstützung") + "Mausunterstützung") MSG_HASH(MENU_ENUM_LABEL_VALUE_MULTIMEDIA_SETTINGS, - "Multimedia-Einstellungen") + "Multimediaeinstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_MUSIC_TAB, "Musik") MSG_HASH(MENU_ENUM_LABEL_VALUE_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE, @@ -326,46 +504,54 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NEAREST, "Nächster") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY, "Netplay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_CHECK_FRAMES, /* TODO: What actually does this? The translation might be odd. */ + "Netplay Bildübetragungsrate prüfen") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_CLIENT_SWAP_INPUT, /* TODO, Original string changed */ "Tausche Netplay-Eingabe") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DELAY_FRAMES, "Verzögere Netplay-Frames") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISCONNECT, - "Disconnect") + "Verbindung trennen") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE, "Aktiviere Netplay") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, - "Connect to Netplay host") + "Verbinde zu einem Netplay Host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, - "Start hosting") + "Starte Host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, /* TODO, Original string changed */ "IP-Addresse für Netplay") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS, - "Scan local network") + "Durchsuche lokales Netzwerk") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_MODE, "Aktiviere Netplay-Client") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_NICKNAME, "Benutzername") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_PASSWORD, + "Server Passwort") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SETTINGS, "Netplay settings") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SPECTATE_PASSWORD, + "Server Passwort für Zuschauer") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SPECTATOR_MODE_ENABLE, "Aktiviere Netplay-Zuschauermodus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_STATELESS_MODE, /* TODO: What is this actually? */ + "Zustandsloser Netplay-Modus") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_TCP_UDP_PORT, "TCP/UDP-Port für Netplay") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_NAT_TRAVERSAL, "Netplay NAT Traversal") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_CMD_ENABLE, - "Netzwerk-Befehle") + "Netzwerkbefehle") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_CMD_PORT, - "Port für Netzwerk-Befehle") + "Port für Netzwerkbefehle") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_INFORMATION, - "Network Information") + "Netzwerkinformationen") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_REMOTE_ENABLE, "Network Gamepad") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_REMOTE_PORT, "Network Remote Base Port") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_SETTINGS, - "Netzwerk-Einstellungen") + "Netzwerkeinstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_NO, "Nein") MSG_HASH(MENU_ENUM_LABEL_VALUE_NONE, @@ -391,7 +577,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_ITEMS, "Keine Einträge.") MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_NETPLAY_HOSTS_FOUND, - "No netplay hosts found.") + "Kein Netplay Host gefunden.") MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_NETWORKS_FOUND, "No networks found.") MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_PERFORMANCE_COUNTERS, @@ -399,7 +585,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_PERFORMANCE_COUNTERS, MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_PLAYLISTS, "No playlists.") MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_PLAYLIST_ENTRIES_AVAILABLE, - "Keine Wiedergabelisten-Eintrage verfügbar.") + "Keine Einträge verfügbar.") MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_SETTINGS_FOUND, "Keine Einstellungen gefunden.") MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_SHADER_PARAMETERS, @@ -412,12 +598,16 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER, "Online-Aktualisierung") MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_DISPLAY_SETTINGS, "OSD-Einstellungen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_OVERLAY_SETTINGS, + "Bildschirm-Overlay") MSG_HASH(MENU_ENUM_LABEL_VALUE_OPEN_ARCHIVE, "Öffne Archiv") /* TODO/FIXME */ MSG_HASH(MENU_ENUM_LABEL_VALUE_OPTIONAL, "Optional") MSG_HASH(MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_DIRECTORY, "OSK-Overlay-Verzeichnis") +MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_AUTOLOAD_PREFERRED, + "Automatisch bevorzuges Overlay laden") MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_DIRECTORY, "Overlay-Verzeichnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_OPACITY, @@ -430,16 +620,20 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_SETTINGS, "Overlay-Einstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_PAL60_ENABLE, "Verwende PAL60-Modus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_PARENT_DIRECTORY, + "Übergeordnetes Verzeichnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_PAUSE_LIBRETRO, - "Pausiere, wenn das Menü aktiv ist") + "Pausiere wenn das Menü aktiv ist") MSG_HASH(MENU_ENUM_LABEL_VALUE_PAUSE_NONACTIVE, "Nicht im Hintergrund laufen") MSG_HASH(MENU_ENUM_LABEL_VALUE_PERFCNT_ENABLE, "Leistungsindikatoren") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, - "Wiedergabelisten-Verzeichnis") + "Wiedergabelistenverzeichnis") +MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_REMOVE, + "Löschen von Einträgen erlauben") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, - "Wiedergabelisten-Einstellungen") + "Wiedergabelisteneinstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "Touch-Unterstützung") MSG_HASH(MENU_ENUM_LABEL_VALUE_PORT, @@ -447,7 +641,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PORT, MSG_HASH(MENU_ENUM_LABEL_VALUE_PRESENT, "Vorhanden") MSG_HASH(MENU_ENUM_LABEL_VALUE_PRIVACY_SETTINGS, - "Privatsphäre-Einstellungen") + "Privatsphäreeinstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, "RetroArch beenden") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_CRC32, @@ -473,7 +667,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_RELEASE_YEAR, MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_SHA1, "SHA1") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, - "Starte Content") + "Starte Inhalt") MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, "Neustart") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, @@ -481,11 +675,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, "Aufnahme-Ausgabeverzeichnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_SETTINGS, - "Aufnahme-Einstellungen") + "Aufnahmeeinstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORD_CONFIG, "Aufnahme-Konfiguration") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORD_DRIVER, - "Aufnahme-Treiber") + "Aufnahmetreiber") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORD_ENABLE, "Aktiviere Aufnahmefunktion") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORD_PATH, /* FIXME/UPDATE */ @@ -508,6 +702,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RESUME, "Fortsetzen") MSG_HASH(MENU_ENUM_LABEL_VALUE_RESUME_CONTENT, "Fortsetzen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RETRO_ACHIEVEMENTS_SETTINGS, + "Errungenschaften") MSG_HASH(MENU_ENUM_LABEL_VALUE_RETROKEYBOARD, "RetroKeyboard") MSG_HASH(MENU_ENUM_LABEL_VALUE_RETROPAD, @@ -517,11 +713,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_ENABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_GRANULARITY, "Genauigkeit des Zurückspulens (Rewind)") MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_SETTINGS, - "Zurückspul-Einstellungen") + "Zurückspuleinstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_RGUI_BROWSER_DIRECTORY, - "Browser-Directory") + "Dateibrowserverzeichnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_RGUI_CONFIG_DIRECTORY, - "Konfigurations-Verzeichnis") + "Konfigurationsverzeichnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_RGUI_SHOW_START_SCREEN, "Zeige Startbildschirm") MSG_HASH(MENU_ENUM_LABEL_VALUE_RIGHT_ANALOG, @@ -529,21 +725,25 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RIGHT_ANALOG, MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN, "Starten") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVEFILE_DIRECTORY, - "Spielstand-Verzeichnis") + "Spielstandverzeichnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_INDEX, - "Automatische Indexierung von Save States") + "Automatische Indexierung von Savestates") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_LOAD, - "Automatisches Laden von Save States") + "Automatisches Laden von Savestates") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_SAVE, - "Automatische Save States") + "Automatische Savestates") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_DIRECTORY, "Savestate-Verzeichnis") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_THUMBNAIL_ENABLE, + "Savestate Miniaturansichten") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG, + "Aktuelle Konfigurationen speichern") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_NEW_CONFIG, - "Konfiguration speichern") + "Neue Konfigurationen speichern") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_STATE, "Savestate speichern") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVING_SETTINGS, - "Spielstand-Einstellungen") + "Spielstandeinstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY, "Verzeichnis Durchsuchen") MSG_HASH(MENU_ENUM_LABEL_VALUE_SCAN_FILE, @@ -551,7 +751,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SCAN_FILE, MSG_HASH(MENU_ENUM_LABEL_VALUE_SCAN_THIS_DIRECTORY, "<- Durchsuchen ->") MSG_HASH(MENU_ENUM_LABEL_VALUE_SCREENSHOT_DIRECTORY, - "Bildschirmfoto-Verzeichnis") + "Bildschirmfotoverzeichnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_SCREEN_RESOLUTION, "Bildschirmauflösung") MSG_HASH(MENU_ENUM_LABEL_VALUE_SECONDS, @@ -571,15 +771,19 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SHOW_HIDDEN_FILES, MSG_HASH(MENU_ENUM_LABEL_VALUE_SLOWMOTION_RATIO, "Zeitlupen-Verhältnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_SORT_SAVEFILES_ENABLE, - "Sortiere Speicherdaten per Ordner") + "Sortiere Speicherdateien per Ordner") MSG_HASH(MENU_ENUM_LABEL_VALUE_SORT_SAVESTATES_ENABLE, - "Sortiere Save States per Ordner") + "Sortiere Savestates per Ordner") MSG_HASH(MENU_ENUM_LABEL_VALUE_STATUS, "Status") +MSG_HASH(MENU_ENUM_LABEL_VALUE_START_NET_RETROPAD, + "Starte Remote-RetroPad") +MSG_HASH(MENU_ENUM_LABEL_VALUE_START_VIDEO_PROCESSOR, + "Starte Videoprozessor") MSG_HASH(MENU_ENUM_LABEL_VALUE_STDIN_CMD_ENABLE, "stdin-Befehle") MSG_HASH(MENU_ENUM_LABEL_VALUE_SUSPEND_SCREENSAVER_ENABLE, - "Bildschirmschoner aussetzen") + "Bildschirmschoner ausschalten") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_BGM_ENABLE, "Aktiviere System-BGM") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_DIRECTORY, @@ -709,7 +913,19 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ZLIB_SUPPORT, MSG_HASH(MENU_ENUM_LABEL_VALUE_TAKE_SCREENSHOT, "Bildschirmfoto") MSG_HASH(MENU_ENUM_LABEL_VALUE_THREADED_DATA_RUNLOOP_ENABLE, - "Threaded Data Runloop") + "Threaded Datenschlaufe") +MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_BOXARTS, + "Boxart") +MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_SCREENSHOTS, + "Bildschirmfoto") +MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_TITLE_SCREENS, + "Titelbildschrim") +MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAILS, + "Miniaturansichten") +MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAILS_DIRECTORY, + "Miniaturansichtenverzeichnis") +MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAILS_UPDATER_LIST, + "Aktualisiere Miniaturansichten") MSG_HASH(MENU_ENUM_LABEL_VALUE_TIMEDATE_ENABLE, "Zeige Uhrzeit / Datum") MSG_HASH(MENU_ENUM_LABEL_VALUE_TITLE_COLOR, @@ -732,20 +948,24 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CG_SHADERS, "Aktualisiere CG-Shader") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CHEATS, "Aktualisiere Cheats") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CORE_INFO_FILES, + "Aktualisiere Core Info Dateien") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_DATABASES, "Aktualisiere Datenbanken") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_GLSL_SHADERS, "Aktualisiere GLSL-Shader") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_OVERLAYS, "Aktualisiere Overlays") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATER_SETTINGS, + "Aktualisierungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_USER, "Benutzer") MSG_HASH(MENU_ENUM_LABEL_VALUE_USER_INTERFACE_SETTINGS, - "Benutzeroberflächen-Einstellungen") + "Benutzeroberflächeneinstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_USER_LANGUAGE, "Sprache") MSG_HASH(MENU_ENUM_LABEL_VALUE_USER_SETTINGS, - "Benutzer-Einstellungen") + "Benutzereinstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_USE_BUILTIN_PLAYER, "Verwende integrierten Player") /* FIXME/UPDATE */ MSG_HASH(MENU_ENUM_LABEL_VALUE_USE_THIS_DIRECTORY, @@ -755,9 +975,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ALLOW_ROTATE, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_AUTO, "Automatisches Bildseitenverhältnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_INDEX, - "Bildseitenverhältnis") + "Video-Seitenverhältnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_BLACK_FRAME_INSERTION, - "Setze schwarze Frames ein") + "Setze schwarzes Bild zwischen Frames ein") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_CROP_OVERSCAN, "Bildränder (Overscan) zuschneiden (Neustart erforderlich)") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_DISABLE_COMPOSITION, @@ -783,7 +1003,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_SRGB_DISABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FRAME_DELAY, "Bildverzögerung") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN, - "Verwende Vollbildmodus") + "Vollbildmodus") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_GAMMA, "Gamma") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_GPU_RECORD, @@ -794,12 +1014,14 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC, "Synchronisiere GPU und CPU") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC_FRAMES, "Synchronisiere Frames fest mit GPU") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MAX_SWAPCHAIN_IMAGES, + "Maximale Anzahl der Wechselkettenbilder") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_X, "X-Position der OSD-Nachrichten") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_Y, "Y-Position der OSD-Nachrichten") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MONITOR_INDEX, - "Monitor-Index") + "Monitorindex") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_POST_FILTER_RECORD, "Aktiviere Aufnahme von Post-Filtern") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE, @@ -813,7 +1035,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SCALE, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SCALE_INTEGER, "Ganzzahlige Bildskalierung") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS, - "Video-Einstellungen") + "Videoeinstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_DIR, "Grafikshader-Verzeichnis") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_NUM_PASSES, @@ -852,40 +1074,217 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VI_WIDTH, "Kalibriere VI-Bildbreite") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VSYNC, "Vertikale Synchronisation (VSync)") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_HEIGHT, + "Fensterhöhe") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_WIDTH, + "Fensterbreite") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOWED_FULLSCREEN, "Unechter Vollbild-Modus (Windowed Fullscreen)") MSG_HASH(MENU_ENUM_LABEL_VALUE_WIFI_DRIVER, - "Wlan-Treiber") + "WLAN-Treiber") MSG_HASH(MENU_ENUM_LABEL_VALUE_WIFI_SETTINGS, - "Wlan") + "WLAN") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ALPHA_FACTOR, + "Menüalphafaktor") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_FONT, + "Menüschriftart") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_RIBBON_ENABLE, + "Menü-Shaderpipeline") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SCALE_FACTOR, + "Menüskalierungsfaktor") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHADOWS_ENABLE, - "Icon Schatten") + "Bild Schatten") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_ADD, + "Zeige Inhalte importieren Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_HISTORY, - "Zeige Verlauf") + "Zeige Verlauf Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_IMAGES, - "Zeige Bilder") + "Zeige Bilder Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, - "Zeige Musik") + "Zeige Musik Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, - "Zeige Einstellungen") + "Zeige Einstellungen Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, - "Zeige Videos") + "Zeige Videos Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_THEME, + "Menüdesign") MSG_HASH(MENU_ENUM_LABEL_VALUE_YES, "Ja") -MSG_HASH(MENU_ENUM_SUBLABEL_PAUSE_NONACTIVE, - "Pause gameplay when window focus is lost.") -MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_DISABLE_COMPOSITION, - "Enable or disable composition (Windows only).") -MSG_HASH(MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE, - "Enable or disable recent playlist for games, images, music, and videos.") +MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_ENABLE, + "Aktiviert den Audioausgang.") +MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_LATENCY, + "Gewünschte Audiolatenz in Millisekunden. Je nach Audiotreiber kann die gewünschte Latenz nicht erzielt werden.") +MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MAX_TIMING_SKEW, + "Die maximale Änderung der Audioeingangsleistung. " + "Wenn du PAL Cores auf NTSC Monitoren spielen willst, kannst du diesen Wert erhöhen um bessere Timings zu erreichen, " + "als Nebeneffekt kann es zu unechten Tonhöhen kommen.") +MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MUTE, + "Audio Stummschalten.") +MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_RATE_CONTROL_DELTA, + "Hilft Fehler bei der Audio- und Videosynchronisierung auszubügeln. " + "Wenn deaktiviert, ist eine brauchbare Synchronisation nahezu unmöglich.") +MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_SETTINGS, + "Einstellungen zur Audioausgabe.") +MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_SYNC, + "Synchronisiert Audio. Empfohlen.") +MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_VOLUME, + "Lautstärkeverstärkung in dB.") +MSG_HASH(MENU_ENUM_SUBLABEL_CHECK_FOR_MISSING_FIRMWARE, + "Überprüfe benötigte Firmware bevor versucht wird einen Core zu laden.") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_ENABLE, + "Aktiviert Errungenschaften. " + "Für weitere Informationen, besuche http://retroachievements.org") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_HARDCORE_MODE_ENABLE, + "Deaktiviert Savestates, Cheats, Zurückspulen, Zeitraffer, Pause, und Zeitlupe für alle Spiele.") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_TEST_UNOFFICIAL, + "Aktiviere unoffizielle Errungenschaften und/oder Beta-Features zu Testzwecken.") +MSG_HASH(MENU_ENUM_SUBLABEL_CONFIG_SAVE_ON_EXIT, + "Speichert Änderungen in die Konfigurationsdatei beim Beenden.") +MSG_HASH(MENU_ENUM_SUBLABEL_CONFIGURATION_SETTINGS, + "Ändere die Standardeinstellungen für Konfigurationsdateien.") +MSG_HASH(MENU_ENUM_SUBLABEL_CONFIGURATIONS_LIST, + "Verwalte und erstelle Konfigurationsdateien.") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, - "Limit the number of entries in recent playlist for games, images, music, and videos.") -MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, - "Unified Menu Controls") + "Limitiert die Anzahl der Einträge in der Verlaufsliste.") +MSG_HASH(MENU_ENUM_SUBLABEL_CORE_SETTINGS, + "Ändere die Einstellungen der Cores.") +MSG_HASH(MENU_ENUM_SUBLABEL_DIRECTORY_SETTINGS, + "Ändere das Standardverzeichis für dieses System.") +MSG_HASH(MENU_ENUM_SUBLABEL_DRIVER_SETTINGS, + "Ändere Treiber für dieses System.") +MSG_HASH(MENU_ENUM_SUBLABEL_DUMMY_ON_CORE_SHUTDOWN, + "Einige Cores haben ein Herunterfahren-Feature. " + "Wenn aktive, wird der Core davon abgehalten RetroArch herunterzufahren. " + "Stattdessen lädt es einen Dummy-Core.") +MSG_HASH(MENU_ENUM_SUBLABEL_FRAME_THROTTLE_SETTINGS, + "Ändere die Einstellungen für Rückspulen, Zeitraffer, und Zeitlupe.") /* This does not sound like a correct sentence. Suggestions are appreciated. */ +MSG_HASH(MENU_ENUM_SUBLABEL_FPS_SHOW, + "Zeigt die aktuelle Bildwiederholrate auf dem Bildschirm an.") +MSG_HASH(MENU_ENUM_SUBLABEL_HELP_LIST, + "Erfahre mehr derüber wie Retroarch funktioniert.") +MSG_HASH(MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE, + "Aktiviere Wiedergabeliste für kürzlich geöffnete Medien.") +MSG_HASH(MENU_ENUM_SUBLABEL_INFORMATION_LIST_LIST, + "Zeigt Informationen über Core, Netzwerk, und des Systems an. Anzeigen-Manager für Datenbank und Zeiger.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_ALL_USERS_CONTROL_MENU, + "Ermöglicht jedem Spieler das Menü zu benutzen. Wenn deaktiviert, kann nur Spieler 1 das Menü benutzen.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_AXIS_THRESHOLD, + "Wie weit ein Analog-Stick bewegt werden muss bis er reagiert.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_BIND_TIMEOUT, + "Anzahl Sekunden bis der nächste Bind abgehandelt wird.") /* @TODO: What is a Bind? */ +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_DUTY_CYCLE, + "Anzahl Bilder wie lange ein Durchlauf während dem Turbomodus dauert.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS, + "Einstellungen der Hotkeys.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_MAX_USERS, + "Maximale Anzahl Benutzer welche von RetroArch unterstützt werden.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, + "Gamepad-Tastenkombination um ins Menü zu gelangen.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_POLL_TYPE_BEHAVIOR, + "Hat Einwirkungen auf die Art wie Eingabeabfragen in RetroArch abgehandelt werden. " + "Werte 'Früh' und 'Spät' kann die Latenz verringern, je nach Konfiguration.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_SETTINGS, + "Einstellungen für Joypads, Tastaturen und Mäuse.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_TURBO_PERIOD, + "Anzahl Bilder wie lange der Turbomodus anhält.") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_UNIFIED_MENU_CONTROLS, - "Use the same controls for both the menu and the game. Applies to the keyboard.") + "Verwende die selbe Steuerung für Menü und Spiele. Betrifft nur Tastatur.") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_USER_BINDS, + "Bedienungseinstellungen dieses Spielers.") +MSG_HASH(MENU_ENUM_SUBLABEL_LOG_VERBOSITY, + "Aktiviere Logging im Terminal.") +MSG_HASH(MENU_ENUM_SUBLABEL_LOGGING_SETTINGS, + "Ändere die Logging-Einstellungen.") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SETTINGS, + "Stellt die Einstellungen für das Aussehen des Menübildschirms ein.") +MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY, + "Hoste eine Netplay Session oder trete einer bei.") +MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_LAN_SCAN_SETTINGS, + "Suche und verbinde mit Netplay Hosts in deinem lokalen Netzwerk.") +MSG_HASH(MENU_ENUM_SUBLABEL_NETWORK_SETTINGS, + "Ändere die Netzwerkeinstellungen.") +MSG_HASH(MENU_ENUM_SUBLABEL_ONLINE_UPDATER, + "Lade Add-Ons, Komponenten und Inhalte für RetroArch herunter.") +MSG_HASH(MENU_ENUM_SUBLABEL_ONSCREEN_DISPLAY_SETTINGS, + "Ändere die Einstellungen des Display-Overlays, Bildschirmtastatur und Bildschirmbenachrichtigung.") /* There is no Translation for display overlay. */ +MSG_HASH(MENU_ENUM_SUBLABEL_PAUSE_NONACTIVE, + "Spiel pausieren wenn das Fenster den Fokus verliert.") +MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_SETTINGS, + "Ändere die Einstellungen der Wiedergabelisten.") +MSG_HASH(MENU_ENUM_SUBLABEL_PRIVACY_SETTINGS, + "Ändere deine Privatsphäreneinstellungen.") +MSG_HASH(MENU_ENUM_SUBLABEL_RETRO_ACHIEVEMENTS_SETTINGS, + "Ändere die Einstellungen der Errungenschaften.") +MSG_HASH(MENU_ENUM_SUBLABEL_SAVING_SETTINGS, + "Ändere die Einstellungen der Spielstände.") +MSG_HASH(MENU_ENUM_SUBLABEL_SHOW_HIDDEN_FILES, + "Zeigt versteckte Dateien und Ordner im Dateimanager an.") +MSG_HASH(MENU_ENUM_SUBLABEL_SUSPEND_SCREENSAVER_ENABLE, + "Haltet dein System davon ab den Bildschirmschoner zu aktivieren.") +MSG_HASH(MENU_ENUM_SUBLABEL_USER_INTERFACE_SETTINGS, + "Ändere die Einstellungen der Benutzeroberfläche.") +MSG_HASH(MENU_ENUM_SUBLABEL_USER_LANGUAGE, + "Ändere die Sprache der Oberfläche.") +MSG_HASH(MENU_ENUM_SUBLABEL_USER_SETTINGS, + "Ändere das Konto, Benutzername, und die Sprache.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_ALLOW_ROTATE, + "Erlaubt Cores die Rotation zu setzen. Wenn deaktiviert, Rotationsanfragen werden ignoriert. Nützlich für Geräte bei denen man die Rotation manuell wählt.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_BLACK_FRAME_INSERTION, + "Zeigt ein schwarzes Bild zwischen Frames an. Nützlich für 120 Hz Monitore welche 60 Hz mit weniger 'ghosting' möchten.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_DISABLE_COMPOSITION, + "Deaktiviere Desktop-Komposition. (Nur bei Windows)") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FONT_ENABLE, - "Show onscreen messages.") + "Zeige Bildschirmbenachrichtigungen an.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FRAME_DELAY, + "Reduziert Latenz, kann aber zu Anzeigefehlern führen. Fügt einen Unterbruch bei V-Sync hinzu (in ms).") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC, + "Hartsynchronisierung des CPU und der GPU. Reduziert Latenz, braucht aber mehr Leistung.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC_FRAMES, + "Anzahl Bilder welche die CPU der GPU voraus sein darf wenn die 'Hartsynchronisierung' verwendet wird.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MAX_SWAPCHAIN_IMAGES, + "Zwingt den Videotreiber explizit einen bestimmten Puffer zu verwenden.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MONITOR_INDEX, + "Wählt den Monitor aus welcher RetroArch anzeigen soll.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE, + "Vertikale Bildwiederholrate des Monitors. " + "Wird verwendet um die passende Audioinputrate zu berechnen. " + "WICHTIG: Diese Option wird ignoriert wenn du 'Threaded Video' aktiviert hast.") /* TODO: Any way to inject the reference in the .h file? */ +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_AUTO, + "Die genau geschätzte Bildwiederholrate des Monitors in Hz.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SETTINGS, + "Einstellungen zur Videoausgabe.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, + "Gibt hardware-gerendered Cores einen eigenen privaten Kontext. Vermeided den Hardware-State anzunehmen zwischen den Frames.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_THREADED, + "Verbessert die Leistung, führt aber zu grösserer Latenz und Videoproblemen. " + "Verwende dies nur wenn du sonst die gewünschte Leistung erbringst.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VSYNC, + "Synchronisiert den Video-Output der Grafikkarte zu der Bildwiederholrate des Monitors. Empfohlen.") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SCALE, + "Setzt die Fenstergrösse relativ zu der Core-Fenstergrösse. " + "Alternativ kannst du die Fenstergrösse weiter unten setzten für eine konstante Grösse.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK, + "Zurück") +MSG_HASH(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_CONFIRM, + "Bestätigen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_INFO, + "Info") +MSG_HASH(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_DOWN, + "Runter Scrollen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_UP, + "Hoch Scrollen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_START, + "Starten") +MSG_HASH(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_KEYBOARD, + "Tastatur ein/aus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_MENU, + "Menü ein/aus") +MSG_HASH(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_QUIT, + "Beenden") +MSG_HASH(MENU_ENUM_LABEL_VALUE_BATTERY_LEVEL_ENABLE, + "Batteriestand anzeigen") +MSG_HASH(MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS, + "Lade inhaltsspezifische Core-Optionen automatisch") MSG_HASH( MENU_ENUM_LABEL_VALUE_BROWSE_URL_LIST, "Browse URL" diff --git a/intl/msg_hash_eo.c b/intl/msg_hash_eo.c index dd5641ff20..b7d67fcdda 100644 --- a/intl/msg_hash_eo.c +++ b/intl/msg_hash_eo.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/intl/msg_hash_es.c b/intl/msg_hash_es.c index 24af507256..a24795218e 100644 --- a/intl/msg_hash_es.c +++ b/intl/msg_hash_es.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/intl/msg_hash_fr.c b/intl/msg_hash_fr.c index 82e2d48249..48a67565e1 100644 --- a/intl/msg_hash_fr.c +++ b/intl/msg_hash_fr.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2016 - Jean-André Santoni + * Copyright (C) 2014-2017 - Jean-André Santoni * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/intl/msg_hash_it.c b/intl/msg_hash_it.c index f9be4687a0..afd9e40e3d 100644 --- a/intl/msg_hash_it.c +++ b/intl/msg_hash_it.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/intl/msg_hash_ja.c b/intl/msg_hash_ja.c index 430de9b0b7..e482fc82bf 100644 --- a/intl/msg_hash_ja.c +++ b/intl/msg_hash_ja.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 40541cdcec..76b3dda148 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -484,6 +484,8 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_CONTENT_HISTORY_SIZE, "履歴リストのサイズ" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_REMOVE, + "エントリー削除を許す") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SETTINGS, "クイックメニュー" ) @@ -1318,7 +1320,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_STATUS, MSG_HASH(MENU_ENUM_LABEL_VALUE_STDIN_CMD_ENABLE, "stdinコマンド") MSG_HASH(MENU_ENUM_LABEL_VALUE_SUPPORTED_CORES, - "対応するコア") + "提案するコア") MSG_HASH(MENU_ENUM_LABEL_VALUE_SUSPEND_SCREENSAVER_ENABLE, "スクリーンセーバーをサスペンド") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_BGM_ENABLE, @@ -1538,7 +1540,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ALLOW_ROTATE, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_AUTO, "自動アスペクト比") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_INDEX, - "アスペクト比のインデックス") + "アスペクト比") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_BLACK_FRAME_INSERTION, "黒いフレームを挿入") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_CROP_OVERSCAN, @@ -1590,7 +1592,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_POST_FILTER_RECORD, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE, "リフレッシュレート") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO, - "モニタの予想フレームレート") + "画面の予想フレームレート") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ROTATION, "回転") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SCALE, @@ -1798,7 +1800,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SCALE, MSG_HASH(MENU_ENUM_SUBLABEL_USER_LANGUAGE, "インタフェースの言語を変更する。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_BLACK_FRAME_INSERTION, - "フレームの間で黒フレームを挿入する。60Hzコンテンツを120Hzモニターでやることを役に立つ。") + "フレームの間で黒フレームを挿入する。60Hzコンテンツを120Hz画面でやることを役に立つ。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FRAME_DELAY, "遅延が減るけどビデオ途切れの危険率が増す。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC_FRAMES, @@ -1806,9 +1808,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC_FRAMES, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MAX_SWAPCHAIN_IMAGES, "指定するバッファーモードをビデオドライバに伝える。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MONITOR_INDEX, - "希望するモニターを選択する。") + "希望する画面を選択する。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_AUTO, - "モニターの正確な推定のモニターリフレッシュレート") + "画面の正確な推定のリフレッシュレート") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SETTINGS, "ビデオ出力の設定を変える。") MSG_HASH(MENU_ENUM_SUBLABEL_WIFI_SETTINGS, @@ -2370,15 +2372,15 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED, "コンテンツをロードする後にネットプレイは開始します。") MSG_HASH( MENU_ENUM_LABEL_VALUE_BROWSE_URL_LIST, - "Browse URL" + "URLを参照" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_BROWSE_URL, - "URL Path" + "URLのパス" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_BROWSE_START, - "Start" + "スタート" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_BOKEH, - "Bokeh") + "ボケ") diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index b223e9fa33..412e0148e3 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -14,6 +14,8 @@ MSG_HASH(MENU_ENUM_LABEL_CONFIGURATIONS_LIST, "configurations_list") MSG_HASH(MENU_ENUM_LABEL_ADD_TAB, "add_tab") +MSG_HASH(MENU_ENUM_LABEL_NETPLAY_TAB, + "netplay_tab") MSG_HASH(MENU_ENUM_LABEL_ARCHIVE_MODE, "archive_mode") MSG_HASH(MENU_ENUM_LABEL_ASSETS_DIRECTORY, @@ -155,6 +157,8 @@ MSG_HASH(MENU_ENUM_LABEL_CONFIG_SAVE_ON_EXIT, "config_save_on_exit") MSG_HASH(MENU_ENUM_LABEL_CONNECT_WIFI, "connect_wifi") +MSG_HASH(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM, + "connect_room") MSG_HASH(MENU_ENUM_LABEL_CONTENT_ACTIONS, "content_actions") MSG_HASH(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST, @@ -837,6 +841,8 @@ MSG_HASH(MENU_ENUM_LABEL_SCAN_DIRECTORY, "scan_directory") MSG_HASH(MENU_ENUM_LABEL_SCAN_FILE, "scan_file") +MSG_HASH(MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS, + "refresh_rooms") MSG_HASH(MENU_ENUM_LABEL_SCAN_THIS_DIRECTORY, "scan_this_directory") MSG_HASH(MENU_ENUM_LABEL_SCREENSHOT_DIRECTORY, diff --git a/intl/msg_hash_nl.c b/intl/msg_hash_nl.c index 133056b57d..d350ea8414 100644 --- a/intl/msg_hash_nl.c +++ b/intl/msg_hash_nl.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/intl/msg_hash_pl.c b/intl/msg_hash_pl.c index ec477cd01c..5e9d530c0f 100644 --- a/intl/msg_hash_pl.c +++ b/intl/msg_hash_pl.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -20,6 +20,7 @@ #if defined(_MSC_VER) && !defined(_XBOX) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") +#pragma warning( disable: 4566 ) #endif int menu_hash_get_help_pl_enum(enum msg_hash_enums msg, char *s, size_t len) diff --git a/intl/msg_hash_pt.c b/intl/msg_hash_pt.c index 0c9b603df2..715cdc1cb8 100644 --- a/intl/msg_hash_pt.c +++ b/intl/msg_hash_pt.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/intl/msg_hash_ru.c b/intl/msg_hash_ru.c index d167ca995b..6bfec695cc 100644 --- a/intl/msg_hash_ru.c +++ b/intl/msg_hash_ru.c @@ -1,6 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2015 - Daniel De Matteis - * + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/intl/msg_hash_us.c b/intl/msg_hash_us.c index e26c88cd67..8692e4c18d 100644 --- a/intl/msg_hash_us.c +++ b/intl/msg_hash_us.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -24,1917 +24,1896 @@ #include "../configuration.h" #include "../verbosity.h" -int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len) -{ - uint32_t driver_hash = 0; - settings_t *settings = config_get_ptr(); +int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len) { + uint32_t driver_hash = 0; + settings_t *settings = config_get_ptr(); - if (msg <= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_END && - msg >= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN) - { - unsigned idx = msg - MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN; + if (msg <= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_END && + msg >= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN) { + unsigned idx = msg - MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN; - switch (idx) - { - case RARCH_FAST_FORWARD_KEY: - snprintf(s, len, - "Toggles between fast-forwarding and \n" - "normal speed." - ); - break; - case RARCH_FAST_FORWARD_HOLD_KEY: - snprintf(s, len, - "Hold for fast-forward. \n" - " \n" - "Releasing button disables fast-forward." - ); - break; - case RARCH_PAUSE_TOGGLE: - snprintf(s, len, - "Toggle between paused and non-paused state."); - break; - case RARCH_FRAMEADVANCE: - snprintf(s, len, - "Frame advance when content is paused."); - break; - case RARCH_SHADER_NEXT: - snprintf(s, len, - "Applies next shader in directory."); - break; - case RARCH_SHADER_PREV: - snprintf(s, len, - "Applies previous shader in directory."); - break; - case RARCH_CHEAT_INDEX_PLUS: - case RARCH_CHEAT_INDEX_MINUS: - case RARCH_CHEAT_TOGGLE: - snprintf(s, len, - "Cheats."); - break; - case RARCH_RESET: - snprintf(s, len, - "Reset the content."); - break; - case RARCH_SCREENSHOT: - snprintf(s, len, - "Take screenshot."); - break; - case RARCH_MUTE: - snprintf(s, len, - "Mute/unmute audio."); - break; - case RARCH_OSK: - snprintf(s, len, - "Toggles onscreen keyboard."); - break; - case RARCH_NETPLAY_FLIP: - snprintf(s, len, - "Netplay flip users."); - break; - case RARCH_NETPLAY_GAME_WATCH: - snprintf(s, len, - "Netplay toggle play/spectate mode."); - break; - case RARCH_SLOWMOTION: - snprintf(s, len, - "Hold for slowmotion."); - break; - case RARCH_ENABLE_HOTKEY: - snprintf(s, len, - "Enable other hotkeys. \n" - " \n" - "If this hotkey is bound to either\n" - "a keyboard, joybutton or joyaxis, \n" - "all other hotkeys will be enabled only \n" - "if this one is held at the same time. \n" - " \n" - "This is useful for RETRO_KEYBOARD centric \n" - "implementations which query a large area of \n" - "the keyboard, where it is not desirable that \n" - "hotkeys get in the way. \n" - " \n" - "Alternatively, all hotkeys for keyboard \n" - "could be disabled by the user."); - break; - case RARCH_VOLUME_UP: - snprintf(s, len, - "Increases audio volume."); - break; - case RARCH_VOLUME_DOWN: - snprintf(s, len, - "Decreases audio volume."); - break; - case RARCH_OVERLAY_NEXT: - snprintf(s, len, - "Switches to next overlay. Wraps around."); - break; - case RARCH_DISK_EJECT_TOGGLE: - snprintf(s, len, - "Toggles eject for disks. \n" - " \n" - "Used for multiple-disk content. "); - break; - case RARCH_DISK_NEXT: - case RARCH_DISK_PREV: - snprintf(s, len, - "Cycles through disk images. Use after ejecting. \n" - " \n" - "Complete by toggling eject again."); - break; - case RARCH_GRAB_MOUSE_TOGGLE: - snprintf(s, len, - "Toggles mouse grab. \n" - " \n" - "When mouse is grabbed, RetroArch hides the \n" - "mouse, and keeps the mouse pointer inside \n" - "the window to allow relative mouse input to \n" - "work better."); - break; - case RARCH_GAME_FOCUS_TOGGLE: - snprintf(s, len, - "Toggles game focus.\n" - " \n" - "When a game has focus, RetroArch will both disable \n" - "hotkeys and keep/warp the mouse pointer inside the window."); - break; - case RARCH_MENU_TOGGLE: - snprintf(s, len, "Toggles menu."); - break; - case RARCH_LOAD_STATE_KEY: - snprintf(s, len, - "Loads state."); - break; - case RARCH_FULLSCREEN_TOGGLE_KEY: - snprintf(s, len, - "Toggles fullscreen."); - break; - case RARCH_QUIT_KEY: - snprintf(s, len, - "Key to exit RetroArch cleanly. \n" - " \n" - "Killing it in any hard way (SIGKILL, etc.) will \n" - "terminate RetroArch without saving RAM, etc." + switch (idx) { + case RARCH_FAST_FORWARD_KEY: + snprintf(s, len, + "Toggles between fast-forwarding and \n" + "normal speed." + ); + break; + case RARCH_FAST_FORWARD_HOLD_KEY: + snprintf(s, len, + "Hold for fast-forward. \n" + " \n" + "Releasing button disables fast-forward." + ); + break; + case RARCH_PAUSE_TOGGLE: + snprintf(s, len, + "Toggle between paused and non-paused state."); + break; + case RARCH_FRAMEADVANCE: + snprintf(s, len, + "Frame advance when content is paused."); + break; + case RARCH_SHADER_NEXT: + snprintf(s, len, + "Applies next shader in directory."); + break; + case RARCH_SHADER_PREV: + snprintf(s, len, + "Applies previous shader in directory."); + break; + case RARCH_CHEAT_INDEX_PLUS: + case RARCH_CHEAT_INDEX_MINUS: + case RARCH_CHEAT_TOGGLE: + snprintf(s, len, + "Cheats."); + break; + case RARCH_RESET: + snprintf(s, len, + "Reset the content."); + break; + case RARCH_SCREENSHOT: + snprintf(s, len, + "Take screenshot."); + break; + case RARCH_MUTE: + snprintf(s, len, + "Mute/unmute audio."); + break; + case RARCH_OSK: + snprintf(s, len, + "Toggles onscreen keyboard."); + break; + case RARCH_NETPLAY_FLIP: + snprintf(s, len, + "Netplay flip users."); + break; + case RARCH_NETPLAY_GAME_WATCH: + snprintf(s, len, + "Netplay toggle play/spectate mode."); + break; + case RARCH_SLOWMOTION: + snprintf(s, len, + "Hold for slowmotion."); + break; + case RARCH_ENABLE_HOTKEY: + snprintf(s, len, + "Enable other hotkeys. \n" + " \n" + "If this hotkey is bound to either\n" + "a keyboard, joybutton or joyaxis, \n" + "all other hotkeys will be enabled only \n" + "if this one is held at the same time. \n" + " \n" + "This is useful for RETRO_KEYBOARD centric \n" + "implementations which query a large area of \n" + "the keyboard, where it is not desirable that \n" + "hotkeys get in the way. \n" + " \n" + "Alternatively, all hotkeys for keyboard \n" + "could be disabled by the user."); + break; + case RARCH_VOLUME_UP: + snprintf(s, len, + "Increases audio volume."); + break; + case RARCH_VOLUME_DOWN: + snprintf(s, len, + "Decreases audio volume."); + break; + case RARCH_OVERLAY_NEXT: + snprintf(s, len, + "Switches to next overlay. Wraps around."); + break; + case RARCH_DISK_EJECT_TOGGLE: + snprintf(s, len, + "Toggles eject for disks. \n" + " \n" + "Used for multiple-disk content. "); + break; + case RARCH_DISK_NEXT: + case RARCH_DISK_PREV: + snprintf(s, len, + "Cycles through disk images. Use after ejecting. \n" + " \n" + "Complete by toggling eject again."); + break; + case RARCH_GRAB_MOUSE_TOGGLE: + snprintf(s, len, + "Toggles mouse grab. \n" + " \n" + "When mouse is grabbed, RetroArch hides the \n" + "mouse, and keeps the mouse pointer inside \n" + "the window to allow relative mouse input to \n" + "work better."); + break; + case RARCH_GAME_FOCUS_TOGGLE: + snprintf(s, len, + "Toggles game focus.\n" + " \n" + "When a game has focus, RetroArch will both disable \n" + "hotkeys and keep/warp the mouse pointer inside the window."); + break; + case RARCH_MENU_TOGGLE: + snprintf(s, len, "Toggles menu."); + break; + case RARCH_LOAD_STATE_KEY: + snprintf(s, len, + "Loads state."); + break; + case RARCH_FULLSCREEN_TOGGLE_KEY: + snprintf(s, len, + "Toggles fullscreen."); + break; + case RARCH_QUIT_KEY: + snprintf(s, len, + "Key to exit RetroArch cleanly. \n" + " \n" + "Killing it in any hard way (SIGKILL, etc.) will \n" + "terminate RetroArch without saving RAM, etc." #ifdef __unix__ - "\nOn Unix-likes, SIGINT/SIGTERM allows a clean \n" - "deinitialization." + "\nOn Unix-likes, SIGINT/SIGTERM allows a clean \n" + "deinitialization." #endif - ""); - break; - case RARCH_STATE_SLOT_PLUS: - case RARCH_STATE_SLOT_MINUS: - snprintf(s, len, - "State slots. \n" - " \n" - "With slot set to 0, save state name is \n" - "*.state (or whatever defined on commandline). \n" - " \n" - "When slot is not 0, path will be , \n" - "where is slot number."); - break; - case RARCH_SAVE_STATE_KEY: - snprintf(s, len, - "Saves state."); - break; - case RARCH_REWIND: - snprintf(s, len, - "Hold button down to rewind. \n" - " \n" - "Rewinding must be enabled."); - break; - case RARCH_MOVIE_RECORD_TOGGLE: - snprintf(s, len, - "Toggle between recording and not."); - break; - default: - if (string_is_empty(s)) - strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); - break; - } + ""); + break; + case RARCH_STATE_SLOT_PLUS: + case RARCH_STATE_SLOT_MINUS: + snprintf(s, len, + "State slots. \n" + " \n" + "With slot set to 0, save state name is \n" + "*.state (or whatever defined on commandline). \n" + " \n" + "When slot is not 0, path will be , \n" + "where is slot number."); + break; + case RARCH_SAVE_STATE_KEY: + snprintf(s, len, + "Saves state."); + break; + case RARCH_REWIND: + snprintf(s, len, + "Hold button down to rewind. \n" + " \n" + "Rewinding must be enabled."); + break; + case RARCH_MOVIE_RECORD_TOGGLE: + snprintf(s, len, + "Toggle between recording and not."); + break; + default: + if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); + break; + } - return 0; - } + return 0; + } - switch (msg) - { - case MENU_ENUM_LABEL_ACCOUNTS_RETRO_ACHIEVEMENTS: - snprintf(s, len, "Login details for your \n" - "Retro Achievements account. \n" - " \n" - "Visit retroachievements.org and sign up \n" - "for a free account. \n" - " \n" - "After you are done registering, you need \n" - "to input the username and password into \n" - "RetroArch."); - break; - case MENU_ENUM_LABEL_CHEEVOS_USERNAME: - snprintf(s, len, "Username for your Retro Achievements account."); - break; - case MENU_ENUM_LABEL_CHEEVOS_PASSWORD: - snprintf(s, len, "Password for your Retro Achievements account."); - break; - case MENU_ENUM_LABEL_USER_LANGUAGE: - snprintf(s, len, "Localizes the menu and all onscreen messages \n" - "according to the language you have selected \n" - "here. \n" - " \n" - "Requires a restart for the changes \n" - "to take effect. \n" - " \n" - "Note: not all languages might be currently \n" - "implemented. \n" - " \n" - "In case a language is not implemented, \n" - "we fallback to English."); - break; - case MENU_ENUM_LABEL_VIDEO_FONT_PATH: - snprintf(s, len, "Change the font that is used \n" - "for the Onscreen Display text."); - break; - case MENU_ENUM_LABEL_GAME_SPECIFIC_OPTIONS: - snprintf(s, len, "Automatically load content-specific core options."); - break; - case MENU_ENUM_LABEL_AUTO_OVERRIDES_ENABLE: - snprintf(s, len, "Automatically load override configurations."); - break; - case MENU_ENUM_LABEL_AUTO_REMAPS_ENABLE: - snprintf(s, len, "Automatically load input remapping files."); - break; - case MENU_ENUM_LABEL_SORT_SAVESTATES_ENABLE: - snprintf(s, len, "Sort save states in folders \n" - "named after the libretro core used."); - break; - case MENU_ENUM_LABEL_SORT_SAVEFILES_ENABLE: - snprintf(s, len, "Sort save files in folders \n" - "named after the libretro core used."); - break; - case MENU_ENUM_LABEL_RESUME_CONTENT: - snprintf(s, len, "Exits from the menu and returns back \n" - "to the content."); - break; - case MENU_ENUM_LABEL_RESTART_CONTENT: - snprintf(s, len, "Restarts the content from the beginning."); - break; - case MENU_ENUM_LABEL_CLOSE_CONTENT: - snprintf(s, len, "Closes the content and unloads it from \n" - "memory."); - break; - case MENU_ENUM_LABEL_UNDO_LOAD_STATE: - snprintf(s, len, "If a state was loaded, content will \n" - "go back to the state prior to loading."); - break; - case MENU_ENUM_LABEL_UNDO_SAVE_STATE: - snprintf(s, len, "If a state was overwritten, it will \n" - "roll back to the previous save state."); - break; - case MENU_ENUM_LABEL_TAKE_SCREENSHOT: - snprintf(s, len, "Create a screenshot. \n" - " \n" - "The screenshot will be stored inside the \n" - "Screenshot Directory."); - break; - case MENU_ENUM_LABEL_RUN: - snprintf(s, len, "Start the content."); - break; - case MENU_ENUM_LABEL_INFORMATION: - snprintf(s, len, "Show additional metadata information \n" - "about the content."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_CONFIG: - snprintf(s, len, "Configuration file."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_COMPRESSED_ARCHIVE: - snprintf(s, len, "Compressed archive file."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_RECORD_CONFIG: - snprintf(s, len, "Recording configuration file."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_CURSOR: - snprintf(s, len, "Database cursor file."); - break; - case MENU_ENUM_LABEL_FILE_CONFIG: - snprintf(s, len, "Configuration file."); - break; - case MENU_ENUM_LABEL_SCAN_THIS_DIRECTORY: - snprintf(s, len, - "Select this to scan the current directory \n" - "for content."); - break; - case MENU_ENUM_LABEL_USE_THIS_DIRECTORY: - snprintf(s, len, - "Select this to set this as the directory."); - break; - case MENU_ENUM_LABEL_CONTENT_DATABASE_DIRECTORY: - snprintf(s, len, - "Content Database Directory. \n" - " \n" - "Path to content database \n" - "directory."); - break; - case MENU_ENUM_LABEL_THUMBNAILS_DIRECTORY: - snprintf(s, len, - "Thumbnails Directory. \n" - " \n" - "To store thumbnail files."); - break; - case MENU_ENUM_LABEL_LIBRETRO_INFO_PATH: - snprintf(s, len, - "Core Info Directory. \n" - " \n" - "A directory for where to search \n" - "for libretro core information."); - break; - case MENU_ENUM_LABEL_PLAYLIST_DIRECTORY: - snprintf(s, len, - "Playlist Directory. \n" - " \n" - "Save all playlist files to this \n" - "directory."); - break; - case MENU_ENUM_LABEL_DUMMY_ON_CORE_SHUTDOWN: - snprintf(s, len, - "Some cores might have \n" - "a shutdown feature. \n" - " \n" - "If this option is left disabled, \n" - "selecting the shutdown procedure \n" - "would trigger RetroArch being shut \n" - "down. \n" - " \n" - "Enabling this option will load a \n" - "dummy core instead so that we remain \n" - "inside the menu and RetroArch won't \n" - "shutdown."); - break; - case MENU_ENUM_LABEL_CHECK_FOR_MISSING_FIRMWARE: - snprintf(s, len, - "Some cores might need \n" - "firmware or bios files. \n" - " \n" - "If this option is disabled, \n" - "it will try to load even if such \n" - "firmware is missing. \n" - "down. \n"); - break; - case MENU_ENUM_LABEL_PARENT_DIRECTORY: - snprintf(s, len, - "Go back to the parent directory."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_SHADER_PRESET: - snprintf(s, len, - "Shader preset file."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_SHADER: - snprintf(s, len, - "Shader file."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_REMAP: - snprintf(s, len, - "Remap controls file."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_CHEAT: - snprintf(s, len, - "Cheat file."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_OVERLAY: - snprintf(s, len, - "Overlay file."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_RDB: - snprintf(s, len, - "Database file."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_FONT: - snprintf(s, len, - "TrueType font file."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_PLAIN_FILE: - snprintf(s, len, - "Plain file."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_MOVIE_OPEN: - snprintf(s, len, - "Video. \n" - " \n" - "Select it to open this file with the \n" - "video player."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_MUSIC_OPEN: - snprintf(s, len, - "Music. \n" - " \n" - "Select it to open this file with the \n" - "music player."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_IMAGE: - snprintf(s, len, - "Image file."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_IMAGE_OPEN_WITH_VIEWER: - snprintf(s, len, - "Image. \n" - " \n" - "Select it to open this file with the \n" - "image viewer."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION: - snprintf(s, len, - "Libretro core. \n" - " \n" - "Selecting this will associate this core \n" - "to the game."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_CORE: - snprintf(s, len, - "Libretro core. \n" - " \n" - "Select this file to have RetroArch load this core."); - break; - case MENU_ENUM_LABEL_FILE_BROWSER_DIRECTORY: - snprintf(s, len, - "Directory. \n" - " \n" - "Select it to open this directory."); - break; - case MENU_ENUM_LABEL_CACHE_DIRECTORY: - snprintf(s, len, - "Cache Directory. \n" - " \n" - "Content decompressed by RetroArch will be \n" - "temporarily extracted to this directory."); - break; - case MENU_ENUM_LABEL_HISTORY_LIST_ENABLE: - snprintf(s, len, - "If enabled, every content loaded \n" - "in RetroArch will be automatically \n" - "added to the recent history list."); - break; - case MENU_ENUM_LABEL_RGUI_BROWSER_DIRECTORY: - snprintf(s, len, - "File Browser Directory. \n" - " \n" - "Sets start directory for menu file browser."); - break; - case MENU_ENUM_LABEL_INPUT_POLL_TYPE_BEHAVIOR: - snprintf(s, len, - "Influence how input polling is done inside \n" - "RetroArch. \n" - " \n" - "Early - Input polling is performed before \n" - "the frame is processed. \n" - "Normal - Input polling is performed when \n" - "polling is requested. \n" - "Late - Input polling is performed on \n" - "first input state request per frame.\n" - " \n" - "Setting it to 'Early' or 'Late' can result \n" - "in less latency, \n" - "depending on your configuration.\n\n" - "When netplay is enabled, the default polling \n" - "behavior (Normal) will be used, \n" - "regardless of the value set here." - ); - break; - case MENU_ENUM_LABEL_INPUT_DESCRIPTOR_HIDE_UNBOUND: - snprintf(s, len, - "Hide input descriptors that were not set \n" - "by the core."); - break; - case MENU_ENUM_LABEL_VIDEO_REFRESH_RATE: - snprintf(s, len, - "Video refresh rate of your monitor. \n" - "Used to calculate a suitable audio input rate."); - break; - case MENU_ENUM_LABEL_VIDEO_FORCE_SRGB_DISABLE: - snprintf(s, len, - "Forcibly disable sRGB FBO support. Some Intel \n" - "OpenGL drivers on Windows have video problems \n" - "with sRGB FBO support enabled."); - break; - case MENU_ENUM_LABEL_AUDIO_ENABLE: - snprintf(s, len, - "Enable audio output."); - break; - case MENU_ENUM_LABEL_AUDIO_SYNC: - snprintf(s, len, - "Synchronize audio (recommended)."); - break; - case MENU_ENUM_LABEL_AUDIO_LATENCY: - snprintf(s, len, - "Desired audio latency in milliseconds. \n" - "Might not be honored if the audio driver \n" - "can't provide given latency."); - break; - case MENU_ENUM_LABEL_VIDEO_ALLOW_ROTATE: - snprintf(s, len, - "Allow cores to set rotation. If false, \n" - "rotation requests are honored, but ignored.\n\n" - "Used for setups where one manually rotates \n" - "the monitor."); - break; - case MENU_ENUM_LABEL_INPUT_DESCRIPTOR_LABEL_SHOW: - snprintf(s, len, - "Show the input descriptors set by the core \n" - "instead of the default ones."); - break; - case MENU_ENUM_LABEL_CONTENT_HISTORY_SIZE: - snprintf(s, len, - "Number of entries that will be kept in \n" - "content history playlist."); - break; - case MENU_ENUM_LABEL_VIDEO_WINDOWED_FULLSCREEN: - snprintf(s, len, - "To use windowed mode or not when going \n" - "fullscreen."); - break; - case MENU_ENUM_LABEL_VIDEO_FONT_SIZE: - snprintf(s, len, - "Font size for on-screen messages."); - break; - case MENU_ENUM_LABEL_SAVESTATE_AUTO_INDEX: - snprintf(s, len, - "Automatically increment slot index on each save, \n" - "generating multiple savestate files. \n" - "When the content is loaded, state slot will be \n" - "set to the highest existing value (last savestate)."); - break; - case MENU_ENUM_LABEL_FPS_SHOW: - snprintf(s, len, - "Enables displaying the current frames \n" - "per second."); - break; - case MENU_ENUM_LABEL_VIDEO_FONT_ENABLE: - snprintf(s, len, - "Show and/or hide onscreen messages."); - break; - case MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_X: - case MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_Y: - snprintf(s, len, - "Offset for where messages will be placed \n" - "onscreen. Values are in range [0.0, 1.0]."); - break; - case MENU_ENUM_LABEL_INPUT_OVERLAY_ENABLE: - snprintf(s, len, - "Enable or disable the current overlay."); - break; - case MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_IN_MENU: - snprintf(s, len, - "Hide the current overlay from appearing \n" - "inside the menu."); - break; - case MENU_ENUM_LABEL_OVERLAY_PRESET: - snprintf(s, len, - "Path to input overlay."); - break; - case MENU_ENUM_LABEL_OVERLAY_OPACITY: - snprintf(s, len, - "Overlay opacity."); - break; - case MENU_ENUM_LABEL_INPUT_BIND_TIMEOUT: - snprintf(s, len, - "Input bind timer timeout (in seconds). \n" - "Amount of seconds to wait until proceeding \n" - "to the next bind."); - break; - case MENU_ENUM_LABEL_OVERLAY_SCALE: - snprintf(s, len, - "Overlay scale."); - break; - case MENU_ENUM_LABEL_AUDIO_OUTPUT_RATE: - snprintf(s, len, - "Audio output samplerate."); - break; - case MENU_ENUM_LABEL_VIDEO_SHARED_CONTEXT: - snprintf(s, len, - "Set to true if hardware-rendered cores \n" - "should get their private context. \n" - "Avoids having to assume hardware state changes \n" - "inbetween frames." - ); - break; - case MENU_ENUM_LABEL_CORE_LIST: - snprintf(s, len, - "Load Core. \n" - " \n" - "Browse for a libretro core \n" - "implementation. Where the browser \n" - "starts depends on your Core Directory \n" - "path. If blank, it will start in root. \n" - " \n" - "If Core Directory is a directory, the menu \n" - "will use that as top folder. If Core \n" - "Directory is a full path, it will start \n" - "in the folder where the file is."); - break; - case MENU_ENUM_LABEL_VALUE_MENU_ENUM_CONTROLS_PROLOG: - snprintf(s, len, - "You can use the following controls below \n" - "on either your gamepad or keyboard in order\n" - "to control the menu: \n" - " \n" - ); - break; - case MENU_ENUM_LABEL_WELCOME_TO_RETROARCH: - snprintf(s, len, - "Welcome to RetroArch\n" - ); - break; - case MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING_DESC: - { + switch (msg) { + case MENU_ENUM_LABEL_ACCOUNTS_RETRO_ACHIEVEMENTS: + snprintf(s, len, "Login details for your \n" + "Retro Achievements account. \n" + " \n" + "Visit retroachievements.org and sign up \n" + "for a free account. \n" + " \n" + "After you are done registering, you need \n" + "to input the username and password into \n" + "RetroArch."); + break; + case MENU_ENUM_LABEL_CHEEVOS_USERNAME: + snprintf(s, len, "Username for your Retro Achievements account."); + break; + case MENU_ENUM_LABEL_CHEEVOS_PASSWORD: + snprintf(s, len, "Password for your Retro Achievements account."); + break; + case MENU_ENUM_LABEL_USER_LANGUAGE: + snprintf(s, len, "Localizes the menu and all onscreen messages \n" + "according to the language you have selected \n" + "here. \n" + " \n" + "Requires a restart for the changes \n" + "to take effect. \n" + " \n" + "Note: not all languages might be currently \n" + "implemented. \n" + " \n" + "In case a language is not implemented, \n" + "we fallback to English."); + break; + case MENU_ENUM_LABEL_VIDEO_FONT_PATH: + snprintf(s, len, "Change the font that is used \n" + "for the Onscreen Display text."); + break; + case MENU_ENUM_LABEL_GAME_SPECIFIC_OPTIONS: + snprintf(s, len, "Automatically load content-specific core options."); + break; + case MENU_ENUM_LABEL_AUTO_OVERRIDES_ENABLE: + snprintf(s, len, "Automatically load override configurations."); + break; + case MENU_ENUM_LABEL_AUTO_REMAPS_ENABLE: + snprintf(s, len, "Automatically load input remapping files."); + break; + case MENU_ENUM_LABEL_SORT_SAVESTATES_ENABLE: + snprintf(s, len, "Sort save states in folders \n" + "named after the libretro core used."); + break; + case MENU_ENUM_LABEL_SORT_SAVEFILES_ENABLE: + snprintf(s, len, "Sort save files in folders \n" + "named after the libretro core used."); + break; + case MENU_ENUM_LABEL_RESUME_CONTENT: + snprintf(s, len, "Exits from the menu and returns back \n" + "to the content."); + break; + case MENU_ENUM_LABEL_RESTART_CONTENT: + snprintf(s, len, "Restarts the content from the beginning."); + break; + case MENU_ENUM_LABEL_CLOSE_CONTENT: + snprintf(s, len, "Closes the content and unloads it from \n" + "memory."); + break; + case MENU_ENUM_LABEL_UNDO_LOAD_STATE: + snprintf(s, len, "If a state was loaded, content will \n" + "go back to the state prior to loading."); + break; + case MENU_ENUM_LABEL_UNDO_SAVE_STATE: + snprintf(s, len, "If a state was overwritten, it will \n" + "roll back to the previous save state."); + break; + case MENU_ENUM_LABEL_TAKE_SCREENSHOT: + snprintf(s, len, "Create a screenshot. \n" + " \n" + "The screenshot will be stored inside the \n" + "Screenshot Directory."); + break; + case MENU_ENUM_LABEL_RUN: + snprintf(s, len, "Start the content."); + break; + case MENU_ENUM_LABEL_INFORMATION: + snprintf(s, len, "Show additional metadata information \n" + "about the content."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_CONFIG: + snprintf(s, len, "Configuration file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_COMPRESSED_ARCHIVE: + snprintf(s, len, "Compressed archive file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_RECORD_CONFIG: + snprintf(s, len, "Recording configuration file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_CURSOR: + snprintf(s, len, "Database cursor file."); + break; + case MENU_ENUM_LABEL_FILE_CONFIG: + snprintf(s, len, "Configuration file."); + break; + case MENU_ENUM_LABEL_SCAN_THIS_DIRECTORY: + snprintf(s, len, + "Select this to scan the current directory \n" + "for content."); + break; + case MENU_ENUM_LABEL_USE_THIS_DIRECTORY: + snprintf(s, len, + "Select this to set this as the directory."); + break; + case MENU_ENUM_LABEL_CONTENT_DATABASE_DIRECTORY: + snprintf(s, len, + "Content Database Directory. \n" + " \n" + "Path to content database \n" + "directory."); + break; + case MENU_ENUM_LABEL_THUMBNAILS_DIRECTORY: + snprintf(s, len, + "Thumbnails Directory. \n" + " \n" + "To store thumbnail files."); + break; + case MENU_ENUM_LABEL_LIBRETRO_INFO_PATH: + snprintf(s, len, + "Core Info Directory. \n" + " \n" + "A directory for where to search \n" + "for libretro core information."); + break; + case MENU_ENUM_LABEL_PLAYLIST_DIRECTORY: + snprintf(s, len, + "Playlist Directory. \n" + " \n" + "Save all playlist files to this \n" + "directory."); + break; + case MENU_ENUM_LABEL_DUMMY_ON_CORE_SHUTDOWN: + snprintf(s, len, + "Some cores might have \n" + "a shutdown feature. \n" + " \n" + "If this option is left disabled, \n" + "selecting the shutdown procedure \n" + "would trigger RetroArch being shut \n" + "down. \n" + " \n" + "Enabling this option will load a \n" + "dummy core instead so that we remain \n" + "inside the menu and RetroArch won't \n" + "shutdown."); + break; + case MENU_ENUM_LABEL_CHECK_FOR_MISSING_FIRMWARE: + snprintf(s, len, + "Some cores might need \n" + "firmware or bios files. \n" + " \n" + "If this option is disabled, \n" + "it will try to load even if such \n" + "firmware is missing. \n" + "down. \n"); + break; + case MENU_ENUM_LABEL_PARENT_DIRECTORY: + snprintf(s, len, + "Go back to the parent directory."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_SHADER_PRESET: + snprintf(s, len, + "Shader preset file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_SHADER: + snprintf(s, len, + "Shader file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_REMAP: + snprintf(s, len, + "Remap controls file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_CHEAT: + snprintf(s, len, + "Cheat file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_OVERLAY: + snprintf(s, len, + "Overlay file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_RDB: + snprintf(s, len, + "Database file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_FONT: + snprintf(s, len, + "TrueType font file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_PLAIN_FILE: + snprintf(s, len, + "Plain file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_MOVIE_OPEN: + snprintf(s, len, + "Video. \n" + " \n" + "Select it to open this file with the \n" + "video player."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_MUSIC_OPEN: + snprintf(s, len, + "Music. \n" + " \n" + "Select it to open this file with the \n" + "music player."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_IMAGE: + snprintf(s, len, + "Image file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_IMAGE_OPEN_WITH_VIEWER: + snprintf(s, len, + "Image. \n" + " \n" + "Select it to open this file with the \n" + "image viewer."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION: + snprintf(s, len, + "Libretro core. \n" + " \n" + "Selecting this will associate this core \n" + "to the game."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_CORE: + snprintf(s, len, + "Libretro core. \n" + " \n" + "Select this file to have RetroArch load this core."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_DIRECTORY: + snprintf(s, len, + "Directory. \n" + " \n" + "Select it to open this directory."); + break; + case MENU_ENUM_LABEL_CACHE_DIRECTORY: + snprintf(s, len, + "Cache Directory. \n" + " \n" + "Content decompressed by RetroArch will be \n" + "temporarily extracted to this directory."); + break; + case MENU_ENUM_LABEL_HISTORY_LIST_ENABLE: + snprintf(s, len, + "If enabled, every content loaded \n" + "in RetroArch will be automatically \n" + "added to the recent history list."); + break; + case MENU_ENUM_LABEL_RGUI_BROWSER_DIRECTORY: + snprintf(s, len, + "File Browser Directory. \n" + " \n" + "Sets start directory for menu file browser."); + break; + case MENU_ENUM_LABEL_INPUT_POLL_TYPE_BEHAVIOR: + snprintf(s, len, + "Influence how input polling is done inside \n" + "RetroArch. \n" + " \n" + "Early - Input polling is performed before \n" + "the frame is processed. \n" + "Normal - Input polling is performed when \n" + "polling is requested. \n" + "Late - Input polling is performed on \n" + "first input state request per frame.\n" + " \n" + "Setting it to 'Early' or 'Late' can result \n" + "in less latency, \n" + "depending on your configuration.\n\n" + "When netplay is enabled, the default polling \n" + "behavior (Normal) will be used, \n" + "regardless of the value set here." + ); + break; + case MENU_ENUM_LABEL_INPUT_DESCRIPTOR_HIDE_UNBOUND: + snprintf(s, len, + "Hide input descriptors that were not set \n" + "by the core."); + break; + case MENU_ENUM_LABEL_VIDEO_REFRESH_RATE: + snprintf(s, len, + "Video refresh rate of your monitor. \n" + "Used to calculate a suitable audio input rate."); + break; + case MENU_ENUM_LABEL_VIDEO_FORCE_SRGB_DISABLE: + snprintf(s, len, + "Forcibly disable sRGB FBO support. Some Intel \n" + "OpenGL drivers on Windows have video problems \n" + "with sRGB FBO support enabled."); + break; + case MENU_ENUM_LABEL_AUDIO_ENABLE: + snprintf(s, len, + "Enable audio output."); + break; + case MENU_ENUM_LABEL_AUDIO_SYNC: + snprintf(s, len, + "Synchronize audio (recommended)."); + break; + case MENU_ENUM_LABEL_AUDIO_LATENCY: + snprintf(s, len, + "Desired audio latency in milliseconds. \n" + "Might not be honored if the audio driver \n" + "can't provide given latency."); + break; + case MENU_ENUM_LABEL_VIDEO_ALLOW_ROTATE: + snprintf(s, len, + "Allow cores to set rotation. If false, \n" + "rotation requests are honored, but ignored.\n\n" + "Used for setups where one manually rotates \n" + "the monitor."); + break; + case MENU_ENUM_LABEL_INPUT_DESCRIPTOR_LABEL_SHOW: + snprintf(s, len, + "Show the input descriptors set by the core \n" + "instead of the default ones."); + break; + case MENU_ENUM_LABEL_CONTENT_HISTORY_SIZE: + snprintf(s, len, + "Number of entries that will be kept in \n" + "content history playlist."); + break; + case MENU_ENUM_LABEL_VIDEO_WINDOWED_FULLSCREEN: + snprintf(s, len, + "To use windowed mode or not when going \n" + "fullscreen."); + break; + case MENU_ENUM_LABEL_VIDEO_FONT_SIZE: + snprintf(s, len, + "Font size for on-screen messages."); + break; + case MENU_ENUM_LABEL_SAVESTATE_AUTO_INDEX: + snprintf(s, len, + "Automatically increment slot index on each save, \n" + "generating multiple savestate files. \n" + "When the content is loaded, state slot will be \n" + "set to the highest existing value (last savestate)."); + break; + case MENU_ENUM_LABEL_FPS_SHOW: + snprintf(s, len, + "Enables displaying the current frames \n" + "per second."); + break; + case MENU_ENUM_LABEL_VIDEO_FONT_ENABLE: + snprintf(s, len, + "Show and/or hide onscreen messages."); + break; + case MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_X: + case MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_Y: + snprintf(s, len, + "Offset for where messages will be placed \n" + "onscreen. Values are in range [0.0, 1.0]."); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_ENABLE: + snprintf(s, len, + "Enable or disable the current overlay."); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_IN_MENU: + snprintf(s, len, + "Hide the current overlay from appearing \n" + "inside the menu."); + break; + case MENU_ENUM_LABEL_OVERLAY_PRESET: + snprintf(s, len, + "Path to input overlay."); + break; + case MENU_ENUM_LABEL_OVERLAY_OPACITY: + snprintf(s, len, + "Overlay opacity."); + break; + case MENU_ENUM_LABEL_INPUT_BIND_TIMEOUT: + snprintf(s, len, + "Input bind timer timeout (in seconds). \n" + "Amount of seconds to wait until proceeding \n" + "to the next bind."); + break; + case MENU_ENUM_LABEL_OVERLAY_SCALE: + snprintf(s, len, + "Overlay scale."); + break; + case MENU_ENUM_LABEL_AUDIO_OUTPUT_RATE: + snprintf(s, len, + "Audio output samplerate."); + break; + case MENU_ENUM_LABEL_VIDEO_SHARED_CONTEXT: + snprintf(s, len, + "Set to true if hardware-rendered cores \n" + "should get their private context. \n" + "Avoids having to assume hardware state changes \n" + "inbetween frames." + ); + break; + case MENU_ENUM_LABEL_CORE_LIST: + snprintf(s, len, + "Load Core. \n" + " \n" + "Browse for a libretro core \n" + "implementation. Where the browser \n" + "starts depends on your Core Directory \n" + "path. If blank, it will start in root. \n" + " \n" + "If Core Directory is a directory, the menu \n" + "will use that as top folder. If Core \n" + "Directory is a full path, it will start \n" + "in the folder where the file is."); + break; + case MENU_ENUM_LABEL_VALUE_MENU_ENUM_CONTROLS_PROLOG: + snprintf(s, len, + "You can use the following controls below \n" + "on either your gamepad or keyboard in order\n" + "to control the menu: \n" + " \n" + ); + break; + case MENU_ENUM_LABEL_WELCOME_TO_RETROARCH: + snprintf(s, len, + "Welcome to RetroArch\n" + ); + break; + case MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING_DESC: { /* Work around C89 limitations */ char u[501]; - const char * t = - "RetroArch relies on an unique form of\n" - "audio/video synchronization where it needs to be\n" - "calibrated against the refresh rate of your\n" - "display for best performance results.\n" - " \n" - "If you experience any audio crackling or video\n" - "tearing, usually it means that you need to\n" - "calibrate the settings. Some choices below:\n" - " \n"; + const char *t = + "RetroArch relies on an unique form of\n" + "audio/video synchronization where it needs to be\n" + "calibrated against the refresh rate of your\n" + "display for best performance results.\n" + " \n" + "If you experience any audio crackling or video\n" + "tearing, usually it means that you need to\n" + "calibrate the settings. Some choices below:\n" + " \n"; snprintf(u, sizeof(u), /* can't inline this due to the printf arguments */ - "a) Go to '%s' -> '%s', and enable\n" - "'Threaded Video'. Refresh rate will not matter\n" - "in this mode, framerate will be higher,\n" - "but video might be less smooth.\n" - "b) Go to '%s' -> '%s', and look at\n" - "'%s'. Let it run for\n" - "2048 frames, then press 'OK'.", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO)); + "a) Go to '%s' -> '%s', and enable\n" + "'Threaded Video'. Refresh rate will not matter\n" + "in this mode, framerate will be higher,\n" + "but video might be less smooth.\n" + "b) Go to '%s' -> '%s', and look at\n" + "'%s'. Let it run for\n" + "2048 frames, then press 'OK'.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO)); strlcpy(s, t, len); strlcat(s, u, len); - } - break; - case MENU_ENUM_LABEL_VALUE_HELP_SCANNING_CONTENT_DESC: - snprintf(s, len, - "To scan for content, go to '%s' and\n" - "select either '%s' or %s'.\n" - " \n" - "Files will be compared to database entries.\n" - "If there is a match, it will add an entry\n" - "to a collection.\n" - " \n" - "You can then easily access this content by\n" - "going to '%s' ->\n" - "'%s'\n" - "instead of having to go through the\n" - "filebrowser everytime.\n" - " \n" - "NOTE: Content for some cores might still not be\n" - "scannable." - , - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ADD_CONTENT_LIST), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_FILE), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_COLLECTION_LIST) - ); - break; - case MENU_ENUM_LABEL_VALUE_EXTRACTING_PLEASE_WAIT: - snprintf(s, len, - "Welcome to RetroArch\n" - "\n" - "Extracting assets, please wait.\n" - "This might take a while...\n" - ); - break; - case MENU_ENUM_LABEL_INPUT_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->input.driver); + } + break; + case MENU_ENUM_LABEL_VALUE_HELP_SCANNING_CONTENT_DESC: + snprintf(s, len, + "To scan for content, go to '%s' and\n" + "select either '%s' or %s'.\n" + " \n" + "Files will be compared to database entries.\n" + "If there is a match, it will add an entry\n" + "to a collection.\n" + " \n" + "You can then easily access this content by\n" + "going to '%s' ->\n" + "'%s'\n" + "instead of having to go through the\n" + "filebrowser everytime.\n" + " \n" + "NOTE: Content for some cores might still not be\n" + "scannable.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ADD_CONTENT_LIST), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_FILE), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_COLLECTION_LIST) + ); + break; + case MENU_ENUM_LABEL_VALUE_EXTRACTING_PLEASE_WAIT: + snprintf(s, len, + "Welcome to RetroArch\n" + "\n" + "Extracting assets, please wait.\n" + "This might take a while...\n" + ); + break; + case MENU_ENUM_LABEL_INPUT_DRIVER: + if (settings) + driver_hash = msg_hash_calculate(settings->input.driver); - switch (driver_hash) - { - case MENU_LABEL_INPUT_DRIVER_UDEV: - snprintf(s, len, - "udev Input driver. \n" - " \n" - "This driver can run without X. \n" - " \n" - "It uses the recent evdev joypad API \n" - "for joystick support. It supports \n" - "hotplugging and force feedback (if \n" - "supported by device). \n" - " \n" - "The driver reads evdev events for keyboard \n" - "support. It also supports keyboard callback, \n" - "mice and touchpads. \n" - " \n" - "By default in most distros, /dev/input nodes \n" - "are root-only (mode 600). You can set up a udev \n" - "rule which makes these accessible to non-root." - ); - break; - case MENU_LABEL_INPUT_DRIVER_LINUXRAW: - snprintf(s, len, - "linuxraw Input driver. \n" - " \n" - "This driver requires an active TTY. Keyboard \n" - "events are read directly from the TTY which \n" - "makes it simpler, but not as flexible as udev. \n" "Mice, etc, are not supported at all. \n" - " \n" - "This driver uses the older joystick API \n" - "(/dev/input/js*)."); - break; - default: - snprintf(s, len, - "Input driver.\n" - " \n" - "Depending on video driver, it might \n" - "force a different input driver."); - break; - } - break; - case MENU_ENUM_LABEL_LOAD_CONTENT_LIST: - snprintf(s, len, - "Load Content. \n" - "Browse for content. \n" - " \n" - "To load content, you need a \n" - "'Core' to use, and a content file. \n" - " \n" - "To control where the menu starts \n" - "to browse for content, set \n" - "'File Browser Directory'. \n" - "If not set, it will start in root. \n" - " \n" - "The browser will filter out \n" - "extensions for the last core set \n" - "in 'Load Core', and use that core \n" - "when content is loaded." - ); - break; - case MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY: - snprintf(s, len, - "Loading content from history. \n" - " \n" - "As content is loaded, content and libretro \n" - "core combinations are saved to history. \n" - " \n" - "The history is saved to a file in the same \n" - "directory as the RetroArch config file. If \n" - "no config file was loaded in startup, history \n" - "will not be saved or loaded, and will not exist \n" - "in the main menu." - ); - break; - case MENU_ENUM_LABEL_VIDEO_DRIVER: - snprintf(s, len, - "Current Video driver."); + switch (driver_hash) { + case MENU_LABEL_INPUT_DRIVER_UDEV: + snprintf(s, len, + "udev Input driver. \n" + " \n" + "This driver can run without X. \n" + " \n" + "It uses the recent evdev joypad API \n" + "for joystick support. It supports \n" + "hotplugging and force feedback (if \n" + "supported by device). \n" + " \n" + "The driver reads evdev events for keyboard \n" + "support. It also supports keyboard callback, \n" + "mice and touchpads. \n" + " \n" + "By default in most distros, /dev/input nodes \n" + "are root-only (mode 600). You can set up a udev \n" + "rule which makes these accessible to non-root." + ); + break; + case MENU_LABEL_INPUT_DRIVER_LINUXRAW: + snprintf(s, len, + "linuxraw Input driver. \n" + " \n" + "This driver requires an active TTY. Keyboard \n" + "events are read directly from the TTY which \n" + "makes it simpler, but not as flexible as udev. \n" "Mice, etc, are not supported at all. \n" + " \n" + "This driver uses the older joystick API \n" + "(/dev/input/js*)."); + break; + default: + snprintf(s, len, + "Input driver.\n" + " \n" + "Depending on video driver, it might \n" + "force a different input driver."); + break; + } + break; + case MENU_ENUM_LABEL_LOAD_CONTENT_LIST: + snprintf(s, len, + "Load Content. \n" + "Browse for content. \n" + " \n" + "To load content, you need a \n" + "'Core' to use, and a content file. \n" + " \n" + "To control where the menu starts \n" + "to browse for content, set \n" + "'File Browser Directory'. \n" + "If not set, it will start in root. \n" + " \n" + "The browser will filter out \n" + "extensions for the last core set \n" + "in 'Load Core', and use that core \n" + "when content is loaded." + ); + break; + case MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY: + snprintf(s, len, + "Loading content from history. \n" + " \n" + "As content is loaded, content and libretro \n" + "core combinations are saved to history. \n" + " \n" + "The history is saved to a file in the same \n" + "directory as the RetroArch config file. If \n" + "no config file was loaded in startup, history \n" + "will not be saved or loaded, and will not exist \n" + "in the main menu." + ); + break; + case MENU_ENUM_LABEL_VIDEO_DRIVER: + snprintf(s, len, + "Current Video driver."); - if (string_is_equal(settings->video.driver, "gl")) - { + if (string_is_equal(settings->video.driver, "gl")) { + snprintf(s, len, + "OpenGL Video driver. \n" + " \n" + "This driver allows libretro GL cores to \n" + "be used in addition to software-rendered \n" + "core implementations.\n" + " \n" + "Performance for software-rendered and \n" + "libretro GL core implementations is \n" + "dependent on your graphics card's \n" + "underlying GL driver)."); + } else if (string_is_equal(settings->video.driver, "sdl2")) { + snprintf(s, len, + "SDL 2 Video driver.\n" + " \n" + "This is an SDL 2 software-rendered video \n" + "driver.\n" + " \n" + "Performance for software-rendered libretro \n" + "core implementations is dependent \n" + "on your platform SDL implementation."); + } else if (string_is_equal(settings->video.driver, "sdl1")) { + snprintf(s, len, + "SDL Video driver.\n" + " \n" + "This is an SDL 1.2 software-rendered video \n" + "driver.\n" + " \n" + "Performance is considered to be suboptimal. \n" + "Consider using it only as a last resort."); + } else if (string_is_equal(settings->video.driver, "d3d")) { + snprintf(s, len, + "Direct3D Video driver. \n" + " \n" + "Performance for software-rendered cores \n" + "is dependent on your graphic card's \n" + "underlying D3D driver)."); + } else if (string_is_equal(settings->video.driver, "exynos")) { + snprintf(s, len, + "Exynos-G2D Video Driver. \n" + " \n" + "This is a low-level Exynos video driver. \n" + "Uses the G2D block in Samsung Exynos SoC \n" + "for blit operations. \n" + " \n" + "Performance for software rendered cores \n" + "should be optimal."); + } else if (string_is_equal(settings->video.driver, "drm")) { + snprintf(s, len, + "Plain DRM Video Driver. \n" + " \n" + "This is a low-level video driver using. \n" + "libdrm for hardware scaling using \n" + "GPU overlays."); + } else if (string_is_equal(settings->video.driver, "sunxi")) { + snprintf(s, len, + "Sunxi-G2D Video Driver. \n" + " \n" + "This is a low-level Sunxi video driver. \n" + "Uses the G2D block in Allwinner SoCs."); + } + break; + case MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN: snprintf(s, len, - "OpenGL Video driver. \n" - " \n" - "This driver allows libretro GL cores to \n" - "be used in addition to software-rendered \n" - "core implementations.\n" - " \n" - "Performance for software-rendered and \n" - "libretro GL core implementations is \n" - "dependent on your graphics card's \n" - "underlying GL driver)."); - } - else if (string_is_equal(settings->video.driver, "sdl2")) - { - snprintf(s, len, - "SDL 2 Video driver.\n" - " \n" - "This is an SDL 2 software-rendered video \n" - "driver.\n" - " \n" - "Performance for software-rendered libretro \n" - "core implementations is dependent \n" - "on your platform SDL implementation."); - } - else if (string_is_equal(settings->video.driver, "sdl1")) - { - snprintf(s, len, - "SDL Video driver.\n" - " \n" - "This is an SDL 1.2 software-rendered video \n" - "driver.\n" - " \n" - "Performance is considered to be suboptimal. \n" - "Consider using it only as a last resort."); - } - else if (string_is_equal(settings->video.driver, "d3d")) - { - snprintf(s, len, - "Direct3D Video driver. \n" - " \n" - "Performance for software-rendered cores \n" - "is dependent on your graphic card's \n" - "underlying D3D driver)."); - } - else if (string_is_equal(settings->video.driver, "exynos")) - { - snprintf(s, len, - "Exynos-G2D Video Driver. \n" - " \n" - "This is a low-level Exynos video driver. \n" - "Uses the G2D block in Samsung Exynos SoC \n" - "for blit operations. \n" - " \n" - "Performance for software rendered cores \n" - "should be optimal."); - } - else if (string_is_equal(settings->video.driver, "drm")) - { - snprintf(s, len, - "Plain DRM Video Driver. \n" - " \n" - "This is a low-level video driver using. \n" - "libdrm for hardware scaling using \n" - "GPU overlays."); - } - else if (string_is_equal(settings->video.driver, "sunxi")) - { - snprintf(s, len, - "Sunxi-G2D Video Driver. \n" - " \n" - "This is a low-level Sunxi video driver. \n" - "Uses the G2D block in Allwinner SoCs."); - } - break; - case MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN: - snprintf(s, len, - "Audio DSP plugin.\n" - " Processes audio before it's sent to \n" - "the driver." - ); - break; - case MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER: - if (settings) - driver_hash = msg_hash_calculate(settings->audio.resampler); + "Audio DSP plugin.\n" + " Processes audio before it's sent to \n" + "the driver." + ); + break; + case MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER: + if (settings) + driver_hash = msg_hash_calculate(settings->audio.resampler); - switch (driver_hash) - { - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_SINC: - snprintf(s, len, - "Windowed SINC implementation."); - break; - case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_CC: - snprintf(s, len, - "Convoluted Cosine implementation."); - break; - default: - if (string_is_empty(s)) - strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); - break; - } - break; - case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET: - snprintf(s, len, - "Load Shader Preset. \n" - " \n" - " Load a shader preset directly. \n" - "The menu shader menu is updated accordingly. \n" - " \n" - "If the CGP uses scaling methods which are not \n" - "simple, (i.e. source scaling, same scaling \n" - "factor for X/Y), the scaling factor displayed \n" - "in the menu might not be correct." - ); - break; - case MENU_ENUM_LABEL_VIDEO_SHADER_SCALE_PASS: - snprintf(s, len, - "Scale for this pass. \n" - " \n" - "The scale factor accumulates, i.e. 2x \n" - "for first pass and 2x for second pass \n" - "will give you a 4x total scale. \n" - " \n" - "If there is a scale factor for last \n" - "pass, the result is stretched to \n" - "screen with the filter specified in \n" - "'Default Filter'. \n" - " \n" - "If 'Don't Care' is set, either 1x \n" - "scale or stretch to fullscreen will \n" - "be used depending if it's not the last \n" - "pass or not." - ); - break; - case MENU_ENUM_LABEL_VIDEO_SHADER_NUM_PASSES: - snprintf(s, len, - "Shader Passes. \n" - " \n" - "RetroArch allows you to mix and match various \n" - "shaders with arbitrary shader passes, with \n" - "custom hardware filters and scale factors. \n" - " \n" - "This option specifies the number of shader \n" - "passes to use. If you set this to 0, and use \n" - "Apply Shader Changes, you use a 'blank' shader. \n" - " \n" - "The Default Filter option will affect the \n" - "stretching filter."); - break; - case MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS: - snprintf(s, len, - "Shader Parameters. \n" - " \n" - "Modifies current shader directly. Will not be \n" - "saved to CGP/GLSLP preset file."); - break; - case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_PARAMETERS: - snprintf(s, len, - "Shader Preset Parameters. \n" - " \n" - "Modifies shader preset currently in menu." - ); - break; - case MENU_ENUM_LABEL_VIDEO_SHADER_PASS: - snprintf(s, len, - "Path to shader. \n" - " \n" - "All shaders must be of the same \n" - "type (i.e. CG, GLSL or HLSL). \n" - " \n" - "Set Shader Directory to set where \n" - "the browser starts to look for \n" - "shaders." - ); - break; - case MENU_ENUM_LABEL_CONFIGURATION_SETTINGS: - snprintf(s, len, - "Determines how configuration files \n" - "are loaded and prioritized."); - break; - case MENU_ENUM_LABEL_CONFIG_SAVE_ON_EXIT: - snprintf(s, len, - "Saves config to disk on exit.\n" - "Useful for menu as settings can be\n" - "modified. Overwrites the config.\n" - " \n" - "#include's and comments are not \n" - "preserved. \n" - " \n" - "By design, the config file is \n" - "considered immutable as it is \n" - "likely maintained by the user, \n" - "and should not be overwritten \n" - "behind the user's back." + switch (driver_hash) { + case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_SINC: + snprintf(s, len, + "Windowed SINC implementation."); + break; + case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_CC: + snprintf(s, len, + "Convoluted Cosine implementation."); + break; + default: + if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); + break; + } + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET: + snprintf(s, len, + "Load Shader Preset. \n" + " \n" + " Load a shader preset directly. \n" + "The menu shader menu is updated accordingly. \n" + " \n" + "If the CGP uses scaling methods which are not \n" + "simple, (i.e. source scaling, same scaling \n" + "factor for X/Y), the scaling factor displayed \n" + "in the menu might not be correct." + ); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_SCALE_PASS: + snprintf(s, len, + "Scale for this pass. \n" + " \n" + "The scale factor accumulates, i.e. 2x \n" + "for first pass and 2x for second pass \n" + "will give you a 4x total scale. \n" + " \n" + "If there is a scale factor for last \n" + "pass, the result is stretched to \n" + "screen with the filter specified in \n" + "'Default Filter'. \n" + " \n" + "If 'Don't Care' is set, either 1x \n" + "scale or stretch to fullscreen will \n" + "be used depending if it's not the last \n" + "pass or not." + ); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_NUM_PASSES: + snprintf(s, len, + "Shader Passes. \n" + " \n" + "RetroArch allows you to mix and match various \n" + "shaders with arbitrary shader passes, with \n" + "custom hardware filters and scale factors. \n" + " \n" + "This option specifies the number of shader \n" + "passes to use. If you set this to 0, and use \n" + "Apply Shader Changes, you use a 'blank' shader. \n" + " \n" + "The Default Filter option will affect the \n" + "stretching filter."); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS: + snprintf(s, len, + "Shader Parameters. \n" + " \n" + "Modifies current shader directly. Will not be \n" + "saved to CGP/GLSLP preset file."); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_PARAMETERS: + snprintf(s, len, + "Shader Preset Parameters. \n" + " \n" + "Modifies shader preset currently in menu." + ); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_PASS: + snprintf(s, len, + "Path to shader. \n" + " \n" + "All shaders must be of the same \n" + "type (i.e. CG, GLSL or HLSL). \n" + " \n" + "Set Shader Directory to set where \n" + "the browser starts to look for \n" + "shaders." + ); + break; + case MENU_ENUM_LABEL_CONFIGURATION_SETTINGS: + snprintf(s, len, + "Determines how configuration files \n" + "are loaded and prioritized."); + break; + case MENU_ENUM_LABEL_CONFIG_SAVE_ON_EXIT: + snprintf(s, len, + "Saves config to disk on exit.\n" + "Useful for menu as settings can be\n" + "modified. Overwrites the config.\n" + " \n" + "#include's and comments are not \n" + "preserved. \n" + " \n" + "By design, the config file is \n" + "considered immutable as it is \n" + "likely maintained by the user, \n" + "and should not be overwritten \n" + "behind the user's back." #if defined(RARCH_CONSOLE) || defined(RARCH_MOBILE) - "\nThis is not not the case on \n" - "consoles however, where \n" - "looking at the config file \n" - "manually isn't really an option." + "\nThis is not not the case on \n" + "consoles however, where \n" + "looking at the config file \n" + "manually isn't really an option." #endif - ); - break; - case MENU_ENUM_LABEL_CONFIRM_ON_EXIT: - snprintf(s, len, "Are you sure you want to quit?"); - break; - case MENU_ENUM_LABEL_SHOW_HIDDEN_FILES: - snprintf(s, len, "Show hidden files\n" - "and folders."); - break; - case MENU_ENUM_LABEL_VIDEO_SHADER_FILTER_PASS: - snprintf(s, len, - "Hardware filter for this pass. \n" - " \n" - "If 'Don't Care' is set, 'Default \n" - "Filter' will be used." - ); - break; - case MENU_ENUM_LABEL_AUTOSAVE_INTERVAL: - snprintf(s, len, - "Autosaves the non-volatile SRAM \n" - "at a regular interval.\n" - " \n" - "This is disabled by default unless set \n" - "otherwise. The interval is measured in \n" - "seconds. \n" - " \n" - "A value of 0 disables autosave."); - break; - case MENU_ENUM_LABEL_INPUT_BIND_DEVICE_TYPE: - snprintf(s, len, - "Input Device Type. \n" - " \n" - "Picks which device type to use. This is \n" - "relevant for the libretro core itself." - ); - break; - case MENU_ENUM_LABEL_LIBRETRO_LOG_LEVEL: - snprintf(s, len, - "Sets log level for libretro cores \n" - "(GET_LOG_INTERFACE). \n" - " \n" - " If a log level issued by a libretro \n" - " core is below libretro_log level, it \n" - " is ignored.\n" - " \n" - " DEBUG logs are always ignored unless \n" - " verbose mode is activated (--verbose).\n" - " \n" - " DEBUG = 0\n" - " INFO = 1\n" - " WARN = 2\n" - " ERROR = 3" - ); - break; - case MENU_ENUM_LABEL_STATE_SLOT_INCREASE: - case MENU_ENUM_LABEL_STATE_SLOT_DECREASE: - snprintf(s, len, - "State slots.\n" - " \n" - " With slot set to 0, save state name is *.state \n" - " (or whatever defined on commandline).\n" - "When slot is != 0, path will be (path)(d), \n" - "where (d) is slot number."); - break; - case MENU_ENUM_LABEL_SHADER_APPLY_CHANGES: - snprintf(s, len, - "Apply Shader Changes. \n" - " \n" - "After changing shader settings, use this to \n" - "apply changes. \n" - " \n" - "Changing shader settings is a somewhat \n" - "expensive operation so it has to be \n" - "done explicitly. \n" - " \n" - "When you apply shaders, the menu shader \n" - "settings are saved to a temporary file (either \n" - "menu.cgp or menu.glslp) and loaded. The file \n" - "persists after RetroArch exits. The file is \n" - "saved to Shader Directory." - ); - break; - case MENU_ENUM_LABEL_MENU_TOGGLE: - snprintf(s, len, - "Toggles menu."); - break; - case MENU_ENUM_LABEL_GRAB_MOUSE_TOGGLE: - snprintf(s, len, - "Toggles mouse grab.\n" - " \n" - "When mouse is grabbed, RetroArch hides the \n" - "mouse, and keeps the mouse pointer inside \n" - "the window to allow relative mouse input to \n" - "work better."); - break; - case MENU_ENUM_LABEL_GAME_FOCUS_TOGGLE: - snprintf(s, len, - "Toggles game focus.\n" - " \n" - "When a game has focus, RetroArch will both disable \n" - "hotkeys and keep/warp the mouse pointer inside the window."); - break; - case MENU_ENUM_LABEL_DISK_NEXT: - snprintf(s, len, - "Cycles through disk images. Use after \n" - "ejecting. \n" - " \n" - " Complete by toggling eject again."); - break; - case MENU_ENUM_LABEL_VIDEO_FILTER: + ); + break; + case MENU_ENUM_LABEL_CONFIRM_ON_EXIT: + snprintf(s, len, "Are you sure you want to quit?"); + break; + case MENU_ENUM_LABEL_SHOW_HIDDEN_FILES: + snprintf(s, len, "Show hidden files\n" + "and folders."); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_FILTER_PASS: + snprintf(s, len, + "Hardware filter for this pass. \n" + " \n" + "If 'Don't Care' is set, 'Default \n" + "Filter' will be used." + ); + break; + case MENU_ENUM_LABEL_AUTOSAVE_INTERVAL: + snprintf(s, len, + "Autosaves the non-volatile SRAM \n" + "at a regular interval.\n" + " \n" + "This is disabled by default unless set \n" + "otherwise. The interval is measured in \n" + "seconds. \n" + " \n" + "A value of 0 disables autosave."); + break; + case MENU_ENUM_LABEL_INPUT_BIND_DEVICE_TYPE: + snprintf(s, len, + "Input Device Type. \n" + " \n" + "Picks which device type to use. This is \n" + "relevant for the libretro core itself." + ); + break; + case MENU_ENUM_LABEL_LIBRETRO_LOG_LEVEL: + snprintf(s, len, + "Sets log level for libretro cores \n" + "(GET_LOG_INTERFACE). \n" + " \n" + " If a log level issued by a libretro \n" + " core is below libretro_log level, it \n" + " is ignored.\n" + " \n" + " DEBUG logs are always ignored unless \n" + " verbose mode is activated (--verbose).\n" + " \n" + " DEBUG = 0\n" + " INFO = 1\n" + " WARN = 2\n" + " ERROR = 3" + ); + break; + case MENU_ENUM_LABEL_STATE_SLOT_INCREASE: + case MENU_ENUM_LABEL_STATE_SLOT_DECREASE: + snprintf(s, len, + "State slots.\n" + " \n" + " With slot set to 0, save state name is *.state \n" + " (or whatever defined on commandline).\n" + "When slot is != 0, path will be (path)(d), \n" + "where (d) is slot number."); + break; + case MENU_ENUM_LABEL_SHADER_APPLY_CHANGES: + snprintf(s, len, + "Apply Shader Changes. \n" + " \n" + "After changing shader settings, use this to \n" + "apply changes. \n" + " \n" + "Changing shader settings is a somewhat \n" + "expensive operation so it has to be \n" + "done explicitly. \n" + " \n" + "When you apply shaders, the menu shader \n" + "settings are saved to a temporary file (either \n" + "menu.cgp or menu.glslp) and loaded. The file \n" + "persists after RetroArch exits. The file is \n" + "saved to Shader Directory." + ); + break; + case MENU_ENUM_LABEL_MENU_TOGGLE: + snprintf(s, len, + "Toggles menu."); + break; + case MENU_ENUM_LABEL_GRAB_MOUSE_TOGGLE: + snprintf(s, len, + "Toggles mouse grab.\n" + " \n" + "When mouse is grabbed, RetroArch hides the \n" + "mouse, and keeps the mouse pointer inside \n" + "the window to allow relative mouse input to \n" + "work better."); + break; + case MENU_ENUM_LABEL_GAME_FOCUS_TOGGLE: + snprintf(s, len, + "Toggles game focus.\n" + " \n" + "When a game has focus, RetroArch will both disable \n" + "hotkeys and keep/warp the mouse pointer inside the window."); + break; + case MENU_ENUM_LABEL_DISK_NEXT: + snprintf(s, len, + "Cycles through disk images. Use after \n" + "ejecting. \n" + " \n" + " Complete by toggling eject again."); + break; + case MENU_ENUM_LABEL_VIDEO_FILTER: #ifdef HAVE_FILTERS_BUILTIN - snprintf(s, len, - "CPU-based video filter."); + snprintf(s, len, + "CPU-based video filter."); #else - snprintf(s, len, - "CPU-based video filter.\n" - " \n" - "Path to a dynamic library."); + snprintf(s, len, + "CPU-based video filter.\n" + " \n" + "Path to a dynamic library."); #endif - break; - case MENU_ENUM_LABEL_AUDIO_DEVICE: - snprintf(s, len, - "Override the default audio device \n" - "the audio driver uses.\n" - "This is driver dependent. E.g.\n" + break; + case MENU_ENUM_LABEL_AUDIO_DEVICE: + snprintf(s, len, + "Override the default audio device \n" + "the audio driver uses.\n" + "This is driver dependent. E.g.\n" #ifdef HAVE_ALSA - " \n" - "ALSA wants a PCM device." + " \n" + "ALSA wants a PCM device." #endif #ifdef HAVE_OSS - " \n" - "OSS wants a path (e.g. /dev/dsp)." + " \n" + "OSS wants a path (e.g. /dev/dsp)." #endif #ifdef HAVE_JACK - " \n" - "JACK wants portnames (e.g. system:playback1\n" - ",system:playback_2)." + " \n" + "JACK wants portnames (e.g. system:playback1\n" + ",system:playback_2)." #endif #ifdef HAVE_RSOUND - " \n" - "RSound wants an IP address to an RSound \n" - "server." + " \n" + "RSound wants an IP address to an RSound \n" + "server." #endif - ); - break; - case MENU_ENUM_LABEL_DISK_EJECT_TOGGLE: - snprintf(s, len, - "Toggles eject for disks.\n" - " \n" - "Used for multiple-disk content."); - break; - case MENU_ENUM_LABEL_ENABLE_HOTKEY: - snprintf(s, len, - "Enable other hotkeys.\n" - " \n" - " If this hotkey is bound to either keyboard, \n" - "joybutton or joyaxis, all other hotkeys will \n" - "be disabled unless this hotkey is also held \n" - "at the same time. \n" - " \n" - "This is useful for RETRO_KEYBOARD centric \n" - "implementations which query a large area of \n" - "the keyboard, where it is not desirable that \n" - "hotkeys get in the way."); - break; - case MENU_ENUM_LABEL_REWIND_ENABLE: - snprintf(s, len, - "Enable rewinding.\n" - " \n" - "This will take a performance hit, \n" - "so it is disabled by default."); - break; - case MENU_ENUM_LABEL_LIBRETRO_DIR_PATH: - snprintf(s, len, - "Core Directory. \n" - " \n" - "A directory for where to search for \n" - "libretro core implementations."); - break; - case MENU_ENUM_LABEL_VIDEO_REFRESH_RATE_AUTO: - snprintf(s, len, - "Refresh Rate Auto.\n" - " \n" - "The accurate refresh rate of our monitor (Hz).\n" - "This is used to calculate audio input rate with \n" - "the formula: \n" - " \n" - "audio_input_rate = game input rate * display \n" - "refresh rate / game refresh rate\n" - " \n" - "If the implementation does not report any \n" - "values, NTSC defaults will be assumed for \n" - "compatibility.\n" - " \n" - "This value should stay close to 60Hz to avoid \n" - "large pitch changes. If your monitor does \n" - "not run at 60Hz, or something close to it, \n" - "disable VSync, and leave this at its default."); - break; - case MENU_ENUM_LABEL_VIDEO_ROTATION: - snprintf(s, len, - "Forces a certain rotation \n" - "of the screen.\n" - " \n" - "The rotation is added to rotations which\n" - "the libretro core sets (see Video Allow\n" - "Rotate)."); - break; - case MENU_ENUM_LABEL_VIDEO_SCALE: - snprintf(s, len, - "Fullscreen resolution.\n" - " \n" - "Resolution of 0 uses the \n" - "resolution of the environment.\n"); - break; - case MENU_ENUM_LABEL_FASTFORWARD_RATIO: - snprintf(s, len, - "Fastforward ratio." - " \n" - "The maximum rate at which content will\n" - "be run when using fast forward.\n" - " \n" - " (E.g. 5.0 for 60 fps content => 300 fps \n" - "cap).\n" - " \n" - "RetroArch will go to sleep to ensure that \n" - "the maximum rate will not be exceeded.\n" - "Do not rely on this cap to be perfectly \n" - "accurate."); - break; - case MENU_ENUM_LABEL_VIDEO_MONITOR_INDEX: - snprintf(s, len, - "Which monitor to prefer.\n" - " \n" - "0 (default) means no particular monitor \n" - "is preferred, 1 and up (1 being first \n" - "monitor), suggests RetroArch to use that \n" - "particular monitor."); - break; - case MENU_ENUM_LABEL_VIDEO_CROP_OVERSCAN: - snprintf(s, len, - "Forces cropping of overscanned \n" - "frames.\n" - " \n" - "Exact behavior of this option is \n" - "core-implementation specific."); - break; - case MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER: - snprintf(s, len, - "Only scales video in integer \n" - "steps.\n" - " \n" - "The base size depends on system-reported \n" - "geometry and aspect ratio.\n" - " \n" - "If Force Aspect is not set, X/Y will be \n" - "integer scaled independently."); - break; - case MENU_ENUM_LABEL_AUDIO_VOLUME: - snprintf(s, len, - "Audio volume, expressed in dB.\n" - " \n" - " 0 dB is normal volume. No gain will be applied.\n" - "Gain can be controlled in runtime with Input\n" - "Volume Up / Input Volume Down."); - break; - case MENU_ENUM_LABEL_AUDIO_RATE_CONTROL_DELTA: - snprintf(s, len, - "Audio rate control.\n" - " \n" - "Setting this to 0 disables rate control.\n" - "Any other value controls audio rate control \n" - "delta.\n" - " \n" - "Defines how much input rate can be adjusted \n" - "dynamically.\n" - " \n" - " Input rate is defined as: \n" - " input rate * (1.0 +/- (rate control delta))"); - break; - case MENU_ENUM_LABEL_AUDIO_MAX_TIMING_SKEW: - snprintf(s, len, - "Maximum audio timing skew.\n" - " \n" - "Defines the maximum change in input rate.\n" - "You may want to increase this to enable\n" - "very large changes in timing, for example\n" - "running PAL cores on NTSC displays, at the\n" - "cost of inaccurate audio pitch.\n" - " \n" - " Input rate is defined as: \n" - " input rate * (1.0 +/- (max timing skew))"); - break; - case MENU_ENUM_LABEL_OVERLAY_NEXT: - snprintf(s, len, - "Toggles to next overlay.\n" - " \n" - "Wraps around."); - break; - case MENU_ENUM_LABEL_LOG_VERBOSITY: - snprintf(s, len, - "Enable or disable verbosity level \n" - "of frontend."); - break; - case MENU_ENUM_LABEL_VOLUME_UP: - snprintf(s, len, - "Increases audio volume."); - break; - case MENU_ENUM_LABEL_VOLUME_DOWN: - snprintf(s, len, - "Decreases audio volume."); - break; - case MENU_ENUM_LABEL_VIDEO_DISABLE_COMPOSITION: - snprintf(s, len, - "Forcibly disable composition.\n" - "Only valid on Windows Vista/7 for now."); - break; - case MENU_ENUM_LABEL_PERFCNT_ENABLE: - snprintf(s, len, - "Enable or disable frontend \n" - "performance counters."); - break; - case MENU_ENUM_LABEL_SYSTEM_DIRECTORY: - snprintf(s, len, - "System Directory. \n" - " \n" - "Sets the 'system' directory.\n" - "Cores can query for this\n" - "directory to load BIOSes, \n" - "system-specific configs, etc."); - break; - case MENU_ENUM_LABEL_SAVESTATE_AUTO_SAVE: - case MENU_ENUM_LABEL_SAVESTATE_AUTO_LOAD: - snprintf(s, len, - "Automatically saves a savestate at the \n" - "end of RetroArch's lifetime.\n" - " \n" - "RetroArch will automatically load any savestate\n" - "with this path on startup if 'Auto Load State\n" - "is enabled."); - break; - case MENU_ENUM_LABEL_VIDEO_THREADED: - snprintf(s, len, - "Use threaded video driver.\n" - " \n" - "Using this might improve performance at the \n" - "possible cost of latency and more video \n" - "stuttering."); - break; - case MENU_ENUM_LABEL_VIDEO_VSYNC: - snprintf(s, len, - "Video V-Sync.\n"); - break; - case MENU_ENUM_LABEL_VIDEO_HARD_SYNC: - snprintf(s, len, - "Attempts to hard-synchronize \n" - "CPU and GPU.\n" - " \n" - "Can reduce latency at the cost of \n" - "performance."); - break; - case MENU_ENUM_LABEL_REWIND_GRANULARITY: - snprintf(s, len, - "Rewind granularity.\n" - " \n" - " When rewinding defined number of \n" - "frames, you can rewind several frames \n" - "at a time, increasing the rewinding \n" - "speed."); - break; - case MENU_ENUM_LABEL_SCREENSHOT: - snprintf(s, len, - "Take screenshot."); - break; - case MENU_ENUM_LABEL_VIDEO_FRAME_DELAY: - snprintf(s, len, - "Sets how many milliseconds to delay\n" - "after VSync before running the core.\n" - "\n" - "Can reduce latency at the cost of\n" - "higher risk of stuttering.\n" - " \n" - "Maximum is 15."); - break; - case MENU_ENUM_LABEL_VIDEO_HARD_SYNC_FRAMES: - snprintf(s, len, - "Sets how many frames CPU can \n" - "run ahead of GPU when using 'GPU \n" - "Hard Sync'.\n" - " \n" - "Maximum is 3.\n" - " \n" - " 0: Syncs to GPU immediately.\n" - " 1: Syncs to previous frame.\n" - " 2: Etc ..."); - break; - case MENU_ENUM_LABEL_VIDEO_BLACK_FRAME_INSERTION: - snprintf(s, len, - "Inserts a black frame inbetween \n" - "frames.\n" - " \n" - "Useful for 120 Hz monitors who want to \n" - "play 60 Hz material with eliminated \n" - "ghosting.\n" - " \n" - "Video refresh rate should still be \n" - "configured as if it is a 60 Hz monitor \n" - "(divide refresh rate by 2)."); - break; - case MENU_ENUM_LABEL_RGUI_SHOW_START_SCREEN: - snprintf(s, len, - "Show startup screen in menu.\n" - "Is automatically set to false when seen\n" - "for the first time.\n" - " \n" - "This is only updated in config if\n" - "'Save Configuration on Exit' is enabled.\n"); - break; - case MENU_ENUM_LABEL_CORE_SPECIFIC_CONFIG: - snprintf(s, len, - "Load up a specific config file \n" - "based on the core being used.\n"); - break; - case MENU_ENUM_LABEL_VIDEO_FULLSCREEN: - snprintf(s, len, "Toggles fullscreen."); - break; - case MENU_ENUM_LABEL_BLOCK_SRAM_OVERWRITE: - snprintf(s, len, - "Block SRAM from being overwritten \n" - "when loading save states.\n" - " \n" - "Might potentially lead to buggy games."); - break; - case MENU_ENUM_LABEL_PAUSE_NONACTIVE: - snprintf(s, len, - "Pause gameplay when window focus \n" - "is lost."); - break; - case MENU_ENUM_LABEL_VIDEO_GPU_SCREENSHOT: - snprintf(s, len, - "Screenshots output of GPU shaded \n" - "material if available."); - break; - case MENU_ENUM_LABEL_SCREENSHOT_DIRECTORY: - snprintf(s, len, - "Screenshot Directory. \n" - " \n" - "Directory to dump screenshots to." - ); - break; - case MENU_ENUM_LABEL_VIDEO_SWAP_INTERVAL: - snprintf(s, len, - "VSync Swap Interval.\n" - " \n" - "Uses a custom swap interval for VSync. Set this \n" - "to effectively halve monitor refresh rate."); - break; - case MENU_ENUM_LABEL_SAVEFILE_DIRECTORY: - snprintf(s, len, - "Savefile Directory. \n" - " \n" - "Save all save files (*.srm) to this \n" - "directory. This includes related files like \n" - ".bsv, .rt, .psrm, etc...\n" - " \n" - "This will be overridden by explicit command line\n" - "options."); - break; - case MENU_ENUM_LABEL_SAVESTATE_DIRECTORY: - snprintf(s, len, - "Savestate Directory. \n" - " \n" - "Save all save states (*.state) to this \n" - "directory.\n" - " \n" - "This will be overridden by explicit command line\n" - "options."); - break; - case MENU_ENUM_LABEL_ASSETS_DIRECTORY: - snprintf(s, len, - "Assets Directory. \n" - " \n" - " This location is queried by default when \n" - "menu interfaces try to look for loadable \n" - "assets, etc."); - break; - case MENU_ENUM_LABEL_DYNAMIC_WALLPAPERS_DIRECTORY: - snprintf(s, len, - "Dynamic Wallpapers Directory. \n" - " \n" - " The place to store backgrounds that will \n" - "be loaded dynamically by the menu depending \n" - "on context."); - break; - case MENU_ENUM_LABEL_SLOWMOTION_RATIO: - snprintf(s, len, - "Slowmotion ratio." - " \n" - "When slowmotion, content will slow\n" - "down by factor."); - break; - case MENU_ENUM_LABEL_INPUT_AXIS_THRESHOLD: - snprintf(s, len, - "Defines axis threshold.\n" - " \n" - "How far an axis must be tilted to result\n" - "in a button press.\n" - " Possible values are [0.0, 1.0]."); - break; - case MENU_ENUM_LABEL_INPUT_TURBO_PERIOD: - snprintf(s, len, - "Turbo period.\n" - " \n" - "Describes the period of which turbo-enabled\n" - "buttons toggle.\n" - " \n" - "Numbers are described in frames." - ); - break; - case MENU_ENUM_LABEL_INPUT_DUTY_CYCLE: - snprintf(s, len, - "Duty cycle.\n" - " \n" - "Describes how long the period of a turbo-enabled\n" - "should be.\n" - " \n" - "Numbers are described in frames." - ); - break; - case MENU_ENUM_LABEL_INPUT_TOUCH_ENABLE: - snprintf(s, len, "Enable touch support."); - break; - case MENU_ENUM_LABEL_INPUT_PREFER_FRONT_TOUCH: - snprintf(s, len, "Use front instead of back touch."); - break; - case MENU_ENUM_LABEL_MOUSE_ENABLE: - snprintf(s, len, "Enable mouse input inside the menu."); - break; - case MENU_ENUM_LABEL_POINTER_ENABLE: - snprintf(s, len, "Enable touch input inside the menu."); - break; - case MENU_ENUM_LABEL_MENU_WALLPAPER: - snprintf(s, len, "Path to an image to set as the background."); - break; - case MENU_ENUM_LABEL_NAVIGATION_WRAPAROUND: - snprintf(s, len, - "Wrap-around to beginning and/or end \n" - "if boundary of list is reached \n" - "horizontally and/or vertically."); - break; - case MENU_ENUM_LABEL_PAUSE_LIBRETRO: - snprintf(s, len, - "If disabled, the game will keep \n" - "running in the background when we are in the \n" - "menu."); - break; - case MENU_ENUM_LABEL_SUSPEND_SCREENSAVER_ENABLE: - snprintf(s, len, - "Suspends the screensaver. Is a hint that \n" - "does not necessarily have to be \n" - "honored by the video driver."); - break; - case MENU_ENUM_LABEL_NETPLAY_MODE: - snprintf(s, len, - "Netplay client mode for the current user. \n" - "Will be 'Server' mode if disabled."); - break; - case MENU_ENUM_LABEL_NETPLAY_DELAY_FRAMES: - snprintf(s, len, - "The amount of delay frames to use for netplay. \n" - " \n" - "Increasing this value will increase \n" - "performance, but introduce more latency."); - break; - case MENU_ENUM_LABEL_NETPLAY_STATELESS_MODE: - snprintf(s, len, - "Whether to run netplay in a mode not requiring\n" - "save states. \n" - " \n" - "If set to true, a very fast network is required,\n" - "but no rewinding is performed, so there will be\n" - "no netplay jitter.\n"); - break; - case MENU_ENUM_LABEL_NETPLAY_CHECK_FRAMES: - snprintf(s, len, - "The frequency in frames with which netplay \n" - "will verify that the host and client are in \n" - "sync. \n" - " \n" - "With most cores, this value will have no \n" - "visible effect and can be ignored. With \n" - "nondeterminstic cores, this value determines \n" - "how often the netplay peers will be brought \n" - "into sync. With buggy cores, setting this \n" - "to any non-zero value will cause severe \n" - "performance issues. Set to zero to perform \n" - "no checks. This value is only used on the \n" - "netplay host. \n"); - break; - case MENU_ENUM_LABEL_NETPLAY_NAT_TRAVERSAL: - snprintf(s, len, - "When hosting, attempt to listen for\n" - "connections from the public internet, using\n" - "UPnP or similar technologies to escape LANs. \n"); - break; - case MENU_ENUM_LABEL_VIDEO_MAX_SWAPCHAIN_IMAGES: - snprintf(s, len, - "Maximum amount of swapchain images. This \n" - "can tell the video driver to use a specific \n" - "video buffering mode. \n" - " \n" - "Single buffering - 1\n" - "Double buffering - 2\n" - "Triple buffering - 3\n" - " \n" - "Setting the right buffering mode can have \n" - "a big impact on latency."); - break; - case MENU_ENUM_LABEL_VIDEO_SMOOTH: - snprintf(s, len, - "Smoothens picture with bilinear filtering. \n" - "Should be disabled if using shaders."); - break; - case MENU_ENUM_LABEL_TIMEDATE_ENABLE: - snprintf(s, len, - "Shows current date and/or time inside menu."); - break; - case MENU_ENUM_LABEL_BATTERY_LEVEL_ENABLE: - snprintf(s, len, - "Shows current battery level inside menu."); - break; - case MENU_ENUM_LABEL_CORE_ENABLE: - snprintf(s, len, - "Shows current core inside menu."); - break; - case MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST: - snprintf(s, len, - "Enables Netplay in host (server) mode."); - break; - case MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT: - snprintf(s, len, - "Enables Netplay in client mode."); - break; - case MENU_ENUM_LABEL_NETPLAY_DISCONNECT: - snprintf(s, len, - "Disconnects an active Netplay connection."); - break; - case MENU_ENUM_LABEL_NETPLAY_LAN_SCAN_SETTINGS: - snprintf(s, len, - "Search for and connect to netplay hosts on the local network."); - break; - case MENU_ENUM_LABEL_NETPLAY_SETTINGS: - snprintf(s, len, - "Setting related to Netplay."); - break; - case MENU_ENUM_LABEL_DYNAMIC_WALLPAPER: - snprintf(s, len, - "Dynamically load a new background \n" - "depending on context."); - break; - case MENU_ENUM_LABEL_CORE_UPDATER_BUILDBOT_URL: - snprintf(s, len, - "URL to core updater directory on the \n" - "Libretro buildbot."); - break; - case MENU_ENUM_LABEL_BUILDBOT_ASSETS_URL: - snprintf(s, len, - "URL to assets updater directory on the \n" - "Libretro buildbot."); - break; - case MENU_ENUM_LABEL_INPUT_REMAP_BINDS_ENABLE: - snprintf(s, len, - "if enabled, overrides the input binds \n" - "with the remapped binds set for the \n" - "current core."); - break; - case MENU_ENUM_LABEL_OVERLAY_DIRECTORY: - snprintf(s, len, - "Overlay Directory. \n" - " \n" - "Defines a directory where overlays are \n" - "kept for easy access."); - break; - case MENU_ENUM_LABEL_INPUT_MAX_USERS: - snprintf(s, len, - "Maximum amount of users supported by \n" - "RetroArch."); - break; - case MENU_ENUM_LABEL_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE: - snprintf(s, len, - "After downloading, automatically extract \n" - "archives that the downloads are contained \n" - "inside."); - break; - case MENU_ENUM_LABEL_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE: - snprintf(s, len, - "Filter files being shown by \n" - "supported extensions."); - break; - case MENU_ENUM_LABEL_NETPLAY_NICKNAME: - snprintf(s, len, - "The username of the person running RetroArch. \n" - "This will be used for playing online games."); - break; - case MENU_ENUM_LABEL_NETPLAY_CLIENT_SWAP_INPUT: - snprintf(s, len, - "When being client over netplay, use \n" - "keybinds for player 1."); - break; - case MENU_ENUM_LABEL_NETPLAY_TCP_UDP_PORT: - snprintf(s, len, - "The port of the host IP address. \n" - "Can be either a TCP or UDP port."); - break; - case MENU_ENUM_LABEL_NETPLAY_SPECTATOR_MODE_ENABLE: - snprintf(s, len, - "Enable or disable spectator mode for \n" - "the user during netplay."); - break; - case MENU_ENUM_LABEL_NETPLAY_IP_ADDRESS: - snprintf(s, len, - "The address of the host to connect to."); - break; - case MENU_ENUM_LABEL_NETPLAY_PASSWORD: - snprintf(s, len, - "The password for connecting to the netplay \n" - "host. Used only in host mode."); - break; - case MENU_ENUM_LABEL_NETPLAY_SPECTATE_PASSWORD: - snprintf(s, len, - "The password for connecting to the netplay \n" - "host with only spectator privileges. Used \n" - "only in host mode."); - break; - case MENU_ENUM_LABEL_STDIN_CMD_ENABLE: - snprintf(s, len, - "Enable stdin command interface."); - break; - case MENU_ENUM_LABEL_UI_COMPANION_START_ON_BOOT: - snprintf(s, len, - "Start User Interface companion driver \n" - "on boot (if available)."); - break; - case MENU_ENUM_LABEL_MENU_DRIVER: - snprintf(s, len, "Menu driver to use."); - break; - case MENU_ENUM_LABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO: - snprintf(s, len, - "Gamepad button combination to toggle menu. \n" - " \n" - "0 - None \n" - "1 - Press L + R + Y + D-Pad Down \n" - "simultaneously. \n" - "2 - Press L3 + R3 simultaneously. \n" - "3 - Press Start + Select simultaneously."); - break; - case MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU: - snprintf(s, len, "Allows any user to control the menu. \n" - " \n" - "When disabled, only user 1 can control the menu."); - break; - case MENU_ENUM_LABEL_INPUT_AUTODETECT_ENABLE: - snprintf(s, len, - "Enable input auto-detection.\n" - " \n" - "Will attempt to auto-configure \n" - "joypads, Plug-and-Play style."); - break; - case MENU_ENUM_LABEL_CAMERA_ALLOW: - snprintf(s, len, - "Allow or disallow camera access by \n" - "cores."); - break; - case MENU_ENUM_LABEL_LOCATION_ALLOW: - snprintf(s, len, - "Allow or disallow location services \n" - "access by cores."); - break; - case MENU_ENUM_LABEL_TURBO: - snprintf(s, len, - "Turbo enable.\n" - " \n" - "Holding the turbo while pressing another \n" - "button will let the button enter a turbo \n" - "mode where the button state is modulated \n" - "with a periodic signal. \n" - " \n" - "The modulation stops when the button \n" - "itself (not turbo button) is released."); - break; - case MENU_ENUM_LABEL_OSK_ENABLE: - snprintf(s, len, - "Enable/disable on-screen keyboard."); - break; - case MENU_ENUM_LABEL_AUDIO_MUTE: - snprintf(s, len, - "Mute/unmute audio."); - break; - case MENU_ENUM_LABEL_REWIND: - snprintf(s, len, - "Hold button down to rewind.\n" - " \n" - "Rewind must be enabled."); - break; - case MENU_ENUM_LABEL_EXIT_EMULATOR: - snprintf(s, len, - "Key to exit RetroArch cleanly." + ); + break; + case MENU_ENUM_LABEL_DISK_EJECT_TOGGLE: + snprintf(s, len, + "Toggles eject for disks.\n" + " \n" + "Used for multiple-disk content."); + break; + case MENU_ENUM_LABEL_ENABLE_HOTKEY: + snprintf(s, len, + "Enable other hotkeys.\n" + " \n" + " If this hotkey is bound to either keyboard, \n" + "joybutton or joyaxis, all other hotkeys will \n" + "be disabled unless this hotkey is also held \n" + "at the same time. \n" + " \n" + "This is useful for RETRO_KEYBOARD centric \n" + "implementations which query a large area of \n" + "the keyboard, where it is not desirable that \n" + "hotkeys get in the way."); + break; + case MENU_ENUM_LABEL_REWIND_ENABLE: + snprintf(s, len, + "Enable rewinding.\n" + " \n" + "This will take a performance hit, \n" + "so it is disabled by default."); + break; + case MENU_ENUM_LABEL_LIBRETRO_DIR_PATH: + snprintf(s, len, + "Core Directory. \n" + " \n" + "A directory for where to search for \n" + "libretro core implementations."); + break; + case MENU_ENUM_LABEL_VIDEO_REFRESH_RATE_AUTO: + snprintf(s, len, + "Refresh Rate Auto.\n" + " \n" + "The accurate refresh rate of our monitor (Hz).\n" + "This is used to calculate audio input rate with \n" + "the formula: \n" + " \n" + "audio_input_rate = game input rate * display \n" + "refresh rate / game refresh rate\n" + " \n" + "If the implementation does not report any \n" + "values, NTSC defaults will be assumed for \n" + "compatibility.\n" + " \n" + "This value should stay close to 60Hz to avoid \n" + "large pitch changes. If your monitor does \n" + "not run at 60Hz, or something close to it, \n" + "disable VSync, and leave this at its default."); + break; + case MENU_ENUM_LABEL_VIDEO_ROTATION: + snprintf(s, len, + "Forces a certain rotation \n" + "of the screen.\n" + " \n" + "The rotation is added to rotations which\n" + "the libretro core sets (see Video Allow\n" + "Rotate)."); + break; + case MENU_ENUM_LABEL_VIDEO_SCALE: + snprintf(s, len, + "Fullscreen resolution.\n" + " \n" + "Resolution of 0 uses the \n" + "resolution of the environment.\n"); + break; + case MENU_ENUM_LABEL_FASTFORWARD_RATIO: + snprintf(s, len, + "Fastforward ratio." + " \n" + "The maximum rate at which content will\n" + "be run when using fast forward.\n" + " \n" + " (E.g. 5.0 for 60 fps content => 300 fps \n" + "cap).\n" + " \n" + "RetroArch will go to sleep to ensure that \n" + "the maximum rate will not be exceeded.\n" + "Do not rely on this cap to be perfectly \n" + "accurate."); + break; + case MENU_ENUM_LABEL_VIDEO_MONITOR_INDEX: + snprintf(s, len, + "Which monitor to prefer.\n" + " \n" + "0 (default) means no particular monitor \n" + "is preferred, 1 and up (1 being first \n" + "monitor), suggests RetroArch to use that \n" + "particular monitor."); + break; + case MENU_ENUM_LABEL_VIDEO_CROP_OVERSCAN: + snprintf(s, len, + "Forces cropping of overscanned \n" + "frames.\n" + " \n" + "Exact behavior of this option is \n" + "core-implementation specific."); + break; + case MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER: + snprintf(s, len, + "Only scales video in integer \n" + "steps.\n" + " \n" + "The base size depends on system-reported \n" + "geometry and aspect ratio.\n" + " \n" + "If Force Aspect is not set, X/Y will be \n" + "integer scaled independently."); + break; + case MENU_ENUM_LABEL_AUDIO_VOLUME: + snprintf(s, len, + "Audio volume, expressed in dB.\n" + " \n" + " 0 dB is normal volume. No gain will be applied.\n" + "Gain can be controlled in runtime with Input\n" + "Volume Up / Input Volume Down."); + break; + case MENU_ENUM_LABEL_AUDIO_RATE_CONTROL_DELTA: + snprintf(s, len, + "Audio rate control.\n" + " \n" + "Setting this to 0 disables rate control.\n" + "Any other value controls audio rate control \n" + "delta.\n" + " \n" + "Defines how much input rate can be adjusted \n" + "dynamically.\n" + " \n" + " Input rate is defined as: \n" + " input rate * (1.0 +/- (rate control delta))"); + break; + case MENU_ENUM_LABEL_AUDIO_MAX_TIMING_SKEW: + snprintf(s, len, + "Maximum audio timing skew.\n" + " \n" + "Defines the maximum change in input rate.\n" + "You may want to increase this to enable\n" + "very large changes in timing, for example\n" + "running PAL cores on NTSC displays, at the\n" + "cost of inaccurate audio pitch.\n" + " \n" + " Input rate is defined as: \n" + " input rate * (1.0 +/- (max timing skew))"); + break; + case MENU_ENUM_LABEL_OVERLAY_NEXT: + snprintf(s, len, + "Toggles to next overlay.\n" + " \n" + "Wraps around."); + break; + case MENU_ENUM_LABEL_LOG_VERBOSITY: + snprintf(s, len, + "Enable or disable verbosity level \n" + "of frontend."); + break; + case MENU_ENUM_LABEL_VOLUME_UP: + snprintf(s, len, + "Increases audio volume."); + break; + case MENU_ENUM_LABEL_VOLUME_DOWN: + snprintf(s, len, + "Decreases audio volume."); + break; + case MENU_ENUM_LABEL_VIDEO_DISABLE_COMPOSITION: + snprintf(s, len, + "Forcibly disable composition.\n" + "Only valid on Windows Vista/7 for now."); + break; + case MENU_ENUM_LABEL_PERFCNT_ENABLE: + snprintf(s, len, + "Enable or disable frontend \n" + "performance counters."); + break; + case MENU_ENUM_LABEL_SYSTEM_DIRECTORY: + snprintf(s, len, + "System Directory. \n" + " \n" + "Sets the 'system' directory.\n" + "Cores can query for this\n" + "directory to load BIOSes, \n" + "system-specific configs, etc."); + break; + case MENU_ENUM_LABEL_SAVESTATE_AUTO_SAVE: + case MENU_ENUM_LABEL_SAVESTATE_AUTO_LOAD: + snprintf(s, len, + "Automatically saves a savestate at the \n" + "end of RetroArch's lifetime.\n" + " \n" + "RetroArch will automatically load any savestate\n" + "with this path on startup if 'Auto Load State\n" + "is enabled."); + break; + case MENU_ENUM_LABEL_VIDEO_THREADED: + snprintf(s, len, + "Use threaded video driver.\n" + " \n" + "Using this might improve performance at the \n" + "possible cost of latency and more video \n" + "stuttering."); + break; + case MENU_ENUM_LABEL_VIDEO_VSYNC: + snprintf(s, len, + "Video V-Sync.\n"); + break; + case MENU_ENUM_LABEL_VIDEO_HARD_SYNC: + snprintf(s, len, + "Attempts to hard-synchronize \n" + "CPU and GPU.\n" + " \n" + "Can reduce latency at the cost of \n" + "performance."); + break; + case MENU_ENUM_LABEL_REWIND_GRANULARITY: + snprintf(s, len, + "Rewind granularity.\n" + " \n" + " When rewinding defined number of \n" + "frames, you can rewind several frames \n" + "at a time, increasing the rewinding \n" + "speed."); + break; + case MENU_ENUM_LABEL_SCREENSHOT: + snprintf(s, len, + "Take screenshot."); + break; + case MENU_ENUM_LABEL_VIDEO_FRAME_DELAY: + snprintf(s, len, + "Sets how many milliseconds to delay\n" + "after VSync before running the core.\n" + "\n" + "Can reduce latency at the cost of\n" + "higher risk of stuttering.\n" + " \n" + "Maximum is 15."); + break; + case MENU_ENUM_LABEL_VIDEO_HARD_SYNC_FRAMES: + snprintf(s, len, + "Sets how many frames CPU can \n" + "run ahead of GPU when using 'GPU \n" + "Hard Sync'.\n" + " \n" + "Maximum is 3.\n" + " \n" + " 0: Syncs to GPU immediately.\n" + " 1: Syncs to previous frame.\n" + " 2: Etc ..."); + break; + case MENU_ENUM_LABEL_VIDEO_BLACK_FRAME_INSERTION: + snprintf(s, len, + "Inserts a black frame inbetween \n" + "frames.\n" + " \n" + "Useful for 120 Hz monitors who want to \n" + "play 60 Hz material with eliminated \n" + "ghosting.\n" + " \n" + "Video refresh rate should still be \n" + "configured as if it is a 60 Hz monitor \n" + "(divide refresh rate by 2)."); + break; + case MENU_ENUM_LABEL_RGUI_SHOW_START_SCREEN: + snprintf(s, len, + "Show startup screen in menu.\n" + "Is automatically set to false when seen\n" + "for the first time.\n" + " \n" + "This is only updated in config if\n" + "'Save Configuration on Exit' is enabled.\n"); + break; + case MENU_ENUM_LABEL_CORE_SPECIFIC_CONFIG: + snprintf(s, len, + "Load up a specific config file \n" + "based on the core being used.\n"); + break; + case MENU_ENUM_LABEL_VIDEO_FULLSCREEN: + snprintf(s, len, "Toggles fullscreen."); + break; + case MENU_ENUM_LABEL_BLOCK_SRAM_OVERWRITE: + snprintf(s, len, + "Block SRAM from being overwritten \n" + "when loading save states.\n" + " \n" + "Might potentially lead to buggy games."); + break; + case MENU_ENUM_LABEL_PAUSE_NONACTIVE: + snprintf(s, len, + "Pause gameplay when window focus \n" + "is lost."); + break; + case MENU_ENUM_LABEL_VIDEO_GPU_SCREENSHOT: + snprintf(s, len, + "Screenshots output of GPU shaded \n" + "material if available."); + break; + case MENU_ENUM_LABEL_SCREENSHOT_DIRECTORY: + snprintf(s, len, + "Screenshot Directory. \n" + " \n" + "Directory to dump screenshots to." + ); + break; + case MENU_ENUM_LABEL_VIDEO_SWAP_INTERVAL: + snprintf(s, len, + "VSync Swap Interval.\n" + " \n" + "Uses a custom swap interval for VSync. Set this \n" + "to effectively halve monitor refresh rate."); + break; + case MENU_ENUM_LABEL_SAVEFILE_DIRECTORY: + snprintf(s, len, + "Savefile Directory. \n" + " \n" + "Save all save files (*.srm) to this \n" + "directory. This includes related files like \n" + ".bsv, .rt, .psrm, etc...\n" + " \n" + "This will be overridden by explicit command line\n" + "options."); + break; + case MENU_ENUM_LABEL_SAVESTATE_DIRECTORY: + snprintf(s, len, + "Savestate Directory. \n" + " \n" + "Save all save states (*.state) to this \n" + "directory.\n" + " \n" + "This will be overridden by explicit command line\n" + "options."); + break; + case MENU_ENUM_LABEL_ASSETS_DIRECTORY: + snprintf(s, len, + "Assets Directory. \n" + " \n" + " This location is queried by default when \n" + "menu interfaces try to look for loadable \n" + "assets, etc."); + break; + case MENU_ENUM_LABEL_DYNAMIC_WALLPAPERS_DIRECTORY: + snprintf(s, len, + "Dynamic Wallpapers Directory. \n" + " \n" + " The place to store backgrounds that will \n" + "be loaded dynamically by the menu depending \n" + "on context."); + break; + case MENU_ENUM_LABEL_SLOWMOTION_RATIO: + snprintf(s, len, + "Slowmotion ratio." + " \n" + "When slowmotion, content will slow\n" + "down by factor."); + break; + case MENU_ENUM_LABEL_INPUT_AXIS_THRESHOLD: + snprintf(s, len, + "Defines axis threshold.\n" + " \n" + "How far an axis must be tilted to result\n" + "in a button press.\n" + " Possible values are [0.0, 1.0]."); + break; + case MENU_ENUM_LABEL_INPUT_TURBO_PERIOD: + snprintf(s, len, + "Turbo period.\n" + " \n" + "Describes the period of which turbo-enabled\n" + "buttons toggle.\n" + " \n" + "Numbers are described in frames." + ); + break; + case MENU_ENUM_LABEL_INPUT_DUTY_CYCLE: + snprintf(s, len, + "Duty cycle.\n" + " \n" + "Describes how long the period of a turbo-enabled\n" + "should be.\n" + " \n" + "Numbers are described in frames." + ); + break; + case MENU_ENUM_LABEL_INPUT_TOUCH_ENABLE: + snprintf(s, len, "Enable touch support."); + break; + case MENU_ENUM_LABEL_INPUT_PREFER_FRONT_TOUCH: + snprintf(s, len, "Use front instead of back touch."); + break; + case MENU_ENUM_LABEL_MOUSE_ENABLE: + snprintf(s, len, "Enable mouse input inside the menu."); + break; + case MENU_ENUM_LABEL_POINTER_ENABLE: + snprintf(s, len, "Enable touch input inside the menu."); + break; + case MENU_ENUM_LABEL_MENU_WALLPAPER: + snprintf(s, len, "Path to an image to set as the background."); + break; + case MENU_ENUM_LABEL_NAVIGATION_WRAPAROUND: + snprintf(s, len, + "Wrap-around to beginning and/or end \n" + "if boundary of list is reached \n" + "horizontally and/or vertically."); + break; + case MENU_ENUM_LABEL_PAUSE_LIBRETRO: + snprintf(s, len, + "If disabled, the game will keep \n" + "running in the background when we are in the \n" + "menu."); + break; + case MENU_ENUM_LABEL_SUSPEND_SCREENSAVER_ENABLE: + snprintf(s, len, + "Suspends the screensaver. Is a hint that \n" + "does not necessarily have to be \n" + "honored by the video driver."); + break; + case MENU_ENUM_LABEL_NETPLAY_MODE: + snprintf(s, len, + "Netplay client mode for the current user. \n" + "Will be 'Server' mode if disabled."); + break; + case MENU_ENUM_LABEL_NETPLAY_DELAY_FRAMES: + snprintf(s, len, + "The amount of delay frames to use for netplay. \n" + " \n" + "Increasing this value will increase \n" + "performance, but introduce more latency."); + break; + case MENU_ENUM_LABEL_NETPLAY_STATELESS_MODE: + snprintf(s, len, + "Whether to run netplay in a mode not requiring\n" + "save states. \n" + " \n" + "If set to true, a very fast network is required,\n" + "but no rewinding is performed, so there will be\n" + "no netplay jitter.\n"); + break; + case MENU_ENUM_LABEL_NETPLAY_CHECK_FRAMES: + snprintf(s, len, + "The frequency in frames with which netplay \n" + "will verify that the host and client are in \n" + "sync. \n" + " \n" + "With most cores, this value will have no \n" + "visible effect and can be ignored. With \n" + "nondeterminstic cores, this value determines \n" + "how often the netplay peers will be brought \n" + "into sync. With buggy cores, setting this \n" + "to any non-zero value will cause severe \n" + "performance issues. Set to zero to perform \n" + "no checks. This value is only used on the \n" + "netplay host. \n"); + break; + case MENU_ENUM_LABEL_NETPLAY_NAT_TRAVERSAL: + snprintf(s, len, + "When hosting, attempt to listen for\n" + "connections from the public internet, using\n" + "UPnP or similar technologies to escape LANs. \n"); + break; + case MENU_ENUM_LABEL_VIDEO_MAX_SWAPCHAIN_IMAGES: + snprintf(s, len, + "Maximum amount of swapchain images. This \n" + "can tell the video driver to use a specific \n" + "video buffering mode. \n" + " \n" + "Single buffering - 1\n" + "Double buffering - 2\n" + "Triple buffering - 3\n" + " \n" + "Setting the right buffering mode can have \n" + "a big impact on latency."); + break; + case MENU_ENUM_LABEL_VIDEO_SMOOTH: + snprintf(s, len, + "Smoothens picture with bilinear filtering. \n" + "Should be disabled if using shaders."); + break; + case MENU_ENUM_LABEL_TIMEDATE_ENABLE: + snprintf(s, len, + "Shows current date and/or time inside menu."); + break; + case MENU_ENUM_LABEL_BATTERY_LEVEL_ENABLE: + snprintf(s, len, + "Shows current battery level inside menu."); + break; + case MENU_ENUM_LABEL_CORE_ENABLE: + snprintf(s, len, + "Shows current core inside menu."); + break; + case MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST: + snprintf(s, len, + "Enables Netplay in host (server) mode."); + break; + case MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT: + snprintf(s, len, + "Enables Netplay in client mode."); + break; + case MENU_ENUM_LABEL_NETPLAY_DISCONNECT: + snprintf(s, len, + "Disconnects an active Netplay connection."); + break; + case MENU_ENUM_LABEL_NETPLAY_LAN_SCAN_SETTINGS: + snprintf(s, len, + "Search for and connect to netplay hosts on the local network."); + break; + case MENU_ENUM_LABEL_NETPLAY_SETTINGS: + snprintf(s, len, + "Setting related to Netplay."); + break; + case MENU_ENUM_LABEL_DYNAMIC_WALLPAPER: + snprintf(s, len, + "Dynamically load a new background \n" + "depending on context."); + break; + case MENU_ENUM_LABEL_CORE_UPDATER_BUILDBOT_URL: + snprintf(s, len, + "URL to core updater directory on the \n" + "Libretro buildbot."); + break; + case MENU_ENUM_LABEL_BUILDBOT_ASSETS_URL: + snprintf(s, len, + "URL to assets updater directory on the \n" + "Libretro buildbot."); + break; + case MENU_ENUM_LABEL_INPUT_REMAP_BINDS_ENABLE: + snprintf(s, len, + "if enabled, overrides the input binds \n" + "with the remapped binds set for the \n" + "current core."); + break; + case MENU_ENUM_LABEL_OVERLAY_DIRECTORY: + snprintf(s, len, + "Overlay Directory. \n" + " \n" + "Defines a directory where overlays are \n" + "kept for easy access."); + break; + case MENU_ENUM_LABEL_INPUT_MAX_USERS: + snprintf(s, len, + "Maximum amount of users supported by \n" + "RetroArch."); + break; + case MENU_ENUM_LABEL_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE: + snprintf(s, len, + "After downloading, automatically extract \n" + "archives that the downloads are contained \n" + "inside."); + break; + case MENU_ENUM_LABEL_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE: + snprintf(s, len, + "Filter files being shown by \n" + "supported extensions."); + break; + case MENU_ENUM_LABEL_NETPLAY_NICKNAME: + snprintf(s, len, + "The username of the person running RetroArch. \n" + "This will be used for playing online games."); + break; + case MENU_ENUM_LABEL_NETPLAY_CLIENT_SWAP_INPUT: + snprintf(s, len, + "When being client over netplay, use \n" + "keybinds for player 1."); + break; + case MENU_ENUM_LABEL_NETPLAY_TCP_UDP_PORT: + snprintf(s, len, + "The port of the host IP address. \n" + "Can be either a TCP or UDP port."); + break; + case MENU_ENUM_LABEL_NETPLAY_SPECTATOR_MODE_ENABLE: + snprintf(s, len, + "Enable or disable spectator mode for \n" + "the user during netplay."); + break; + case MENU_ENUM_LABEL_NETPLAY_IP_ADDRESS: + snprintf(s, len, + "The address of the host to connect to."); + break; + case MENU_ENUM_LABEL_NETPLAY_PASSWORD: + snprintf(s, len, + "The password for connecting to the netplay \n" + "host. Used only in host mode."); + break; + case MENU_ENUM_LABEL_NETPLAY_SPECTATE_PASSWORD: + snprintf(s, len, + "The password for connecting to the netplay \n" + "host with only spectator privileges. Used \n" + "only in host mode."); + break; + case MENU_ENUM_LABEL_STDIN_CMD_ENABLE: + snprintf(s, len, + "Enable stdin command interface."); + break; + case MENU_ENUM_LABEL_UI_COMPANION_START_ON_BOOT: + snprintf(s, len, + "Start User Interface companion driver \n" + "on boot (if available)."); + break; + case MENU_ENUM_LABEL_MENU_DRIVER: + snprintf(s, len, "Menu driver to use."); + break; + case MENU_ENUM_LABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO: + snprintf(s, len, + "Gamepad button combination to toggle menu. \n" + " \n" + "0 - None \n" + "1 - Press L + R + Y + D-Pad Down \n" + "simultaneously. \n" + "2 - Press L3 + R3 simultaneously. \n" + "3 - Press Start + Select simultaneously."); + break; + case MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU: + snprintf(s, len, "Allows any user to control the menu. \n" + " \n" + "When disabled, only user 1 can control the menu."); + break; + case MENU_ENUM_LABEL_INPUT_AUTODETECT_ENABLE: + snprintf(s, len, + "Enable input auto-detection.\n" + " \n" + "Will attempt to auto-configure \n" + "joypads, Plug-and-Play style."); + break; + case MENU_ENUM_LABEL_CAMERA_ALLOW: + snprintf(s, len, + "Allow or disallow camera access by \n" + "cores."); + break; + case MENU_ENUM_LABEL_LOCATION_ALLOW: + snprintf(s, len, + "Allow or disallow location services \n" + "access by cores."); + break; + case MENU_ENUM_LABEL_TURBO: + snprintf(s, len, + "Turbo enable.\n" + " \n" + "Holding the turbo while pressing another \n" + "button will let the button enter a turbo \n" + "mode where the button state is modulated \n" + "with a periodic signal. \n" + " \n" + "The modulation stops when the button \n" + "itself (not turbo button) is released."); + break; + case MENU_ENUM_LABEL_OSK_ENABLE: + snprintf(s, len, + "Enable/disable on-screen keyboard."); + break; + case MENU_ENUM_LABEL_AUDIO_MUTE: + snprintf(s, len, + "Mute/unmute audio."); + break; + case MENU_ENUM_LABEL_REWIND: + snprintf(s, len, + "Hold button down to rewind.\n" + " \n" + "Rewind must be enabled."); + break; + case MENU_ENUM_LABEL_EXIT_EMULATOR: + snprintf(s, len, + "Key to exit RetroArch cleanly." #if !defined(RARCH_MOBILE) && !defined(RARCH_CONSOLE) - "\nKilling it in any hard way (SIGKILL, \n" - "etc) will terminate without saving\n" - "RAM, etc. On Unix-likes,\n" - "SIGINT/SIGTERM allows\n" - "a clean deinitialization." + "\nKilling it in any hard way (SIGKILL, \n" + "etc) will terminate without saving\n" + "RAM, etc. On Unix-likes,\n" + "SIGINT/SIGTERM allows\n" + "a clean deinitialization." #endif - ); - break; - case MENU_ENUM_LABEL_LOAD_STATE: - snprintf(s, len, - "Loads state."); - break; - case MENU_ENUM_LABEL_SAVE_STATE: - snprintf(s, len, - "Saves state."); - break; - case MENU_ENUM_LABEL_NETPLAY_FLIP_PLAYERS: - snprintf(s, len, - "Netplay flip users."); - break; - case MENU_ENUM_LABEL_NETPLAY_GAME_WATCH: - snprintf(s, len, - "Netplay toggle play/spectate mode."); - break; - case MENU_ENUM_LABEL_CHEAT_INDEX_PLUS: - snprintf(s, len, - "Increment cheat index.\n"); - break; - case MENU_ENUM_LABEL_CHEAT_INDEX_MINUS: - snprintf(s, len, - "Decrement cheat index.\n"); - break; - case MENU_ENUM_LABEL_SHADER_PREV: - snprintf(s, len, - "Applies previous shader in directory."); - break; - case MENU_ENUM_LABEL_SHADER_NEXT: - snprintf(s, len, - "Applies next shader in directory."); - break; - case MENU_ENUM_LABEL_RESET: - snprintf(s, len, - "Reset the content.\n"); - break; - case MENU_ENUM_LABEL_PAUSE_TOGGLE: - snprintf(s, len, - "Toggle between paused and non-paused state."); - break; - case MENU_ENUM_LABEL_CHEAT_TOGGLE: - snprintf(s, len, - "Toggle cheat index.\n"); - break; - case MENU_ENUM_LABEL_HOLD_FAST_FORWARD: - snprintf(s, len, - "Hold for fast-forward. Releasing button \n" - "disables fast-forward."); - break; - case MENU_ENUM_LABEL_SLOWMOTION: - snprintf(s, len, - "Hold for slowmotion."); - break; - case MENU_ENUM_LABEL_FRAME_ADVANCE: - snprintf(s, len, - "Frame advance when content is paused."); - break; - case MENU_ENUM_LABEL_MOVIE_RECORD_TOGGLE: - snprintf(s, len, - "Toggle between recording and not."); - break; - case MENU_ENUM_LABEL_L_X_PLUS: - case MENU_ENUM_LABEL_L_X_MINUS: - case MENU_ENUM_LABEL_L_Y_PLUS: - case MENU_ENUM_LABEL_L_Y_MINUS: - case MENU_ENUM_LABEL_R_X_PLUS: - case MENU_ENUM_LABEL_R_X_MINUS: - case MENU_ENUM_LABEL_R_Y_PLUS: - case MENU_ENUM_LABEL_R_Y_MINUS: - snprintf(s, len, - "Axis for analog stick (DualShock-esque).\n" - " \n" - "Bound as usual, however, if a real analog \n" - "axis is bound, it can be read as a true analog.\n" - " \n" - "Positive X axis is right. \n" - "Positive Y axis is down."); - break; - case MENU_ENUM_LABEL_VALUE_WHAT_IS_A_CORE_DESC: - snprintf(s, len, - "RetroArch by itself does nothing. \n" - " \n" - "To make it do things, you need to \n" - "load a program into it. \n" - "\n" - "We call such a program 'Libretro core', \n" - "or 'core' in short. \n" - " \n" - "To load a core, select one from\n" - "'Load Core'.\n" - " \n" + ); + break; + case MENU_ENUM_LABEL_LOAD_STATE: + snprintf(s, len, + "Loads state."); + break; + case MENU_ENUM_LABEL_SAVE_STATE: + snprintf(s, len, + "Saves state."); + break; + case MENU_ENUM_LABEL_NETPLAY_FLIP_PLAYERS: + snprintf(s, len, + "Netplay flip users."); + break; + case MENU_ENUM_LABEL_NETPLAY_GAME_WATCH: + snprintf(s, len, + "Netplay toggle play/spectate mode."); + break; + case MENU_ENUM_LABEL_CHEAT_INDEX_PLUS: + snprintf(s, len, + "Increment cheat index.\n"); + break; + case MENU_ENUM_LABEL_CHEAT_INDEX_MINUS: + snprintf(s, len, + "Decrement cheat index.\n"); + break; + case MENU_ENUM_LABEL_SHADER_PREV: + snprintf(s, len, + "Applies previous shader in directory."); + break; + case MENU_ENUM_LABEL_SHADER_NEXT: + snprintf(s, len, + "Applies next shader in directory."); + break; + case MENU_ENUM_LABEL_RESET: + snprintf(s, len, + "Reset the content.\n"); + break; + case MENU_ENUM_LABEL_PAUSE_TOGGLE: + snprintf(s, len, + "Toggle between paused and non-paused state."); + break; + case MENU_ENUM_LABEL_CHEAT_TOGGLE: + snprintf(s, len, + "Toggle cheat index.\n"); + break; + case MENU_ENUM_LABEL_HOLD_FAST_FORWARD: + snprintf(s, len, + "Hold for fast-forward. Releasing button \n" + "disables fast-forward."); + break; + case MENU_ENUM_LABEL_SLOWMOTION: + snprintf(s, len, + "Hold for slowmotion."); + break; + case MENU_ENUM_LABEL_FRAME_ADVANCE: + snprintf(s, len, + "Frame advance when content is paused."); + break; + case MENU_ENUM_LABEL_MOVIE_RECORD_TOGGLE: + snprintf(s, len, + "Toggle between recording and not."); + break; + case MENU_ENUM_LABEL_L_X_PLUS: + case MENU_ENUM_LABEL_L_X_MINUS: + case MENU_ENUM_LABEL_L_Y_PLUS: + case MENU_ENUM_LABEL_L_Y_MINUS: + case MENU_ENUM_LABEL_R_X_PLUS: + case MENU_ENUM_LABEL_R_X_MINUS: + case MENU_ENUM_LABEL_R_Y_PLUS: + case MENU_ENUM_LABEL_R_Y_MINUS: + snprintf(s, len, + "Axis for analog stick (DualShock-esque).\n" + " \n" + "Bound as usual, however, if a real analog \n" + "axis is bound, it can be read as a true analog.\n" + " \n" + "Positive X axis is right. \n" + "Positive Y axis is down."); + break; + case MENU_ENUM_LABEL_VALUE_WHAT_IS_A_CORE_DESC: + snprintf(s, len, + "RetroArch by itself does nothing. \n" + " \n" + "To make it do things, you need to \n" + "load a program into it. \n" + "\n" + "We call such a program 'Libretro core', \n" + "or 'core' in short. \n" + " \n" + "To load a core, select one from\n" + "'Load Core'.\n" + " \n" #ifdef HAVE_NETWORKING - "You can obtain cores in several ways: \n" - "* Download them by going to\n" - "'%s' -> '%s'.\n" - "* Manually move them over to\n" - "'%s'.", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_UPDATER_LIST), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH) + "You can obtain cores in several ways: \n" + "* Download them by going to\n" + "'%s' -> '%s'.\n" + "* Manually move them over to\n" + "'%s'.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_UPDATER_LIST), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH) #else - "You can obtain cores by\n" - "manually moving them over to\n" - "'%s'.", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH) + "You can obtain cores by\n" + "manually moving them over to\n" + "'%s'.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH) #endif - ); - break; - case MENU_ENUM_LABEL_VALUE_HELP_CHANGE_VIRTUAL_GAMEPAD_DESC: - snprintf(s, len, - "You can change the virtual gamepad overlay\n" - "by going to '%s' -> '%s'." - " \n" - "From there you can change the overlay,\n" - "change the size and opacity of the buttons, etc.\n" - " \n" - "NOTE: By default, virtual gamepad overlays are\n" - "hidden when in the menu.\n" - "If you'd like to change this behavior,\n" - "you can set '%s' to false.", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OVERLAY_SETTINGS), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU) - ); - break; - default: - if (string_is_empty(s)) - strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); - return -1; - } + ); + break; + case MENU_ENUM_LABEL_VALUE_HELP_CHANGE_VIRTUAL_GAMEPAD_DESC: + snprintf(s, len, + "You can change the virtual gamepad overlay\n" + "by going to '%s' -> '%s'." + " \n" + "From there you can change the overlay,\n" + "change the size and opacity of the buttons, etc.\n" + " \n" + "NOTE: By default, virtual gamepad overlays are\n" + "hidden when in the menu.\n" + "If you'd like to change this behavior,\n" + "you can set '%s' to false.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OVERLAY_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU) + ); + break; + default: + if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); + return -1; + } - return 0; + return 0; } #ifdef HAVE_MENU @@ -1951,7 +1930,7 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg) switch (msg) { - #include "msg_hash_lbl.h" +#include "msg_hash_lbl.h" default: #if 0 RARCH_LOG("Unimplemented: [%d]\n", msg); @@ -1963,27 +1942,25 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg) } #endif -const char *msg_hash_to_str_us(enum msg_hash_enums msg) -{ +const char *msg_hash_to_str_us(enum msg_hash_enums msg) { #ifdef HAVE_MENU - const char *ret = menu_hash_to_str_us_label_enum(msg); + const char *ret = menu_hash_to_str_us_label_enum(msg); - if (ret && !string_is_equal(ret, "null")) - return ret; + if (ret && !string_is_equal(ret, "null")) + return ret; #endif - switch (msg) - { - #include "msg_hash_us.h" - default: + switch (msg) { +#include "msg_hash_us.h" + default: #if 0 - RARCH_LOG("Unimplemented: [%d]\n", msg); - { - RARCH_LOG("[%d] : %s\n", msg - 1, msg_hash_to_str(((enum msg_hash_enums)(msg - 1)))); - } + RARCH_LOG("Unimplemented: [%d]\n", msg); + { + RARCH_LOG("[%d] : %s\n", msg - 1, msg_hash_to_str(((enum msg_hash_enums)(msg - 1)))); + } #endif - break; - } + break; + } - return "null"; + return "null"; } diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 4301bdd150..22931e8b0f 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -199,6 +199,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ADD_TAB, "Import content" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_TAB, + "Netplay Rooms" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_ARCHIVE_MODE, "Archive File Association Action" @@ -967,13 +971,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_CLIENT_SWAP_INPUT, MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DELAY_FRAMES, "Netplay Delay Frames") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISCONNECT, - "Disconnect") + "Disconnect from netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE, "Netplay Enable") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, - "Connect to Netplay host") + "Connect to netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, - "Start hosting") + "Start netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, "Server Address") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS, @@ -2365,6 +2369,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SCALE, "Scale") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED, "Netplay will start when content is loaded.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LOAD_CONTENT_MANUALLY, + "Couldn't find a suitable core or content file, load manually.") MSG_HASH( MENU_ENUM_LABEL_VALUE_BROWSE_URL_LIST, "Browse URL" diff --git a/intl/msg_hash_vn.c b/intl/msg_hash_vn.c index c8c1a03690..d4642c9fb5 100644 --- a/intl/msg_hash_vn.c +++ b/intl/msg_hash_vn.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/libretro-common/algorithms/mismatch.c b/libretro-common/algorithms/mismatch.c index b7997023ff..2f733bf618 100644 --- a/libretro-common/algorithms/mismatch.c +++ b/libretro-common/algorithms/mismatch.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (mismatch.c). diff --git a/libretro-common/audio/conversion/float_to_s16.c b/libretro-common/audio/conversion/float_to_s16.c index d47ecb3283..2eeefa4848 100644 --- a/libretro-common/audio/conversion/float_to_s16.c +++ b/libretro-common/audio/conversion/float_to_s16.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (float_to_s16.c). diff --git a/libretro-common/audio/conversion/float_to_s16_neon.S b/libretro-common/audio/conversion/float_to_s16_neon.S index 88aae1afd8..aa9e565671 100644 --- a/libretro-common/audio/conversion/float_to_s16_neon.S +++ b/libretro-common/audio/conversion/float_to_s16_neon.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (float_to_s16_neon.S). diff --git a/libretro-common/audio/conversion/float_to_s16_neon.c b/libretro-common/audio/conversion/float_to_s16_neon.c index 4b9be62329..342f4978e1 100644 --- a/libretro-common/audio/conversion/float_to_s16_neon.c +++ b/libretro-common/audio/conversion/float_to_s16_neon.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (float_to_s16_neon.S). diff --git a/libretro-common/audio/conversion/s16_to_float.c b/libretro-common/audio/conversion/s16_to_float.c index 70ec6476da..afaff6d8b7 100644 --- a/libretro-common/audio/conversion/s16_to_float.c +++ b/libretro-common/audio/conversion/s16_to_float.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (s16_to_float.c). diff --git a/libretro-common/audio/conversion/s16_to_float_neon.S b/libretro-common/audio/conversion/s16_to_float_neon.S index 93f6592f34..b744924400 100644 --- a/libretro-common/audio/conversion/s16_to_float_neon.S +++ b/libretro-common/audio/conversion/s16_to_float_neon.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (s16_to_float_neon.S). diff --git a/libretro-common/audio/conversion/s16_to_float_neon.c b/libretro-common/audio/conversion/s16_to_float_neon.c index e6b24c00c3..464e40fbc9 100644 --- a/libretro-common/audio/conversion/s16_to_float_neon.c +++ b/libretro-common/audio/conversion/s16_to_float_neon.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (s16_to_float_neon.S). diff --git a/libretro-common/audio/dsp_filter.c b/libretro-common/audio/dsp_filter.c index 14f45a84af..56b85b8f0a 100644 --- a/libretro-common/audio/dsp_filter.c +++ b/libretro-common/audio/dsp_filter.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (dsp_filter.c). diff --git a/libretro-common/audio/dsp_filters/chorus.c b/libretro-common/audio/dsp_filters/chorus.c index b849f32ba0..d48c346fb0 100644 --- a/libretro-common/audio/dsp_filters/chorus.c +++ b/libretro-common/audio/dsp_filters/chorus.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (chorus.c). diff --git a/libretro-common/audio/dsp_filters/echo.c b/libretro-common/audio/dsp_filters/echo.c index 6b3b05a79f..4b0c6cccfc 100644 --- a/libretro-common/audio/dsp_filters/echo.c +++ b/libretro-common/audio/dsp_filters/echo.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (echo.c). diff --git a/libretro-common/audio/dsp_filters/eq.c b/libretro-common/audio/dsp_filters/eq.c index f22b09e175..4033aa6512 100644 --- a/libretro-common/audio/dsp_filters/eq.c +++ b/libretro-common/audio/dsp_filters/eq.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (eq.c). diff --git a/libretro-common/audio/dsp_filters/fft/fft.c b/libretro-common/audio/dsp_filters/fft/fft.c index 890ff8301d..cc6b958161 100644 --- a/libretro-common/audio/dsp_filters/fft/fft.c +++ b/libretro-common/audio/dsp_filters/fft/fft.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (fft.c). diff --git a/libretro-common/audio/dsp_filters/fft/fft.h b/libretro-common/audio/dsp_filters/fft/fft.h index e9f974de78..8a16c6cb83 100644 --- a/libretro-common/audio/dsp_filters/fft/fft.h +++ b/libretro-common/audio/dsp_filters/fft/fft.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (fft.h). diff --git a/libretro-common/audio/dsp_filters/iir.c b/libretro-common/audio/dsp_filters/iir.c index 8ae53c5fe9..015b275900 100644 --- a/libretro-common/audio/dsp_filters/iir.c +++ b/libretro-common/audio/dsp_filters/iir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (iir.c). diff --git a/libretro-common/audio/dsp_filters/panning.c b/libretro-common/audio/dsp_filters/panning.c index a832570500..52935bb88e 100644 --- a/libretro-common/audio/dsp_filters/panning.c +++ b/libretro-common/audio/dsp_filters/panning.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (panning.c). diff --git a/libretro-common/audio/dsp_filters/phaser.c b/libretro-common/audio/dsp_filters/phaser.c index c2a470b67b..7c165e1cdf 100644 --- a/libretro-common/audio/dsp_filters/phaser.c +++ b/libretro-common/audio/dsp_filters/phaser.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (phaser.c). diff --git a/libretro-common/audio/dsp_filters/reverb.c b/libretro-common/audio/dsp_filters/reverb.c index 1c4e5176b7..e81d85980d 100644 --- a/libretro-common/audio/dsp_filters/reverb.c +++ b/libretro-common/audio/dsp_filters/reverb.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (reverb.c). diff --git a/libretro-common/audio/dsp_filters/wahwah.c b/libretro-common/audio/dsp_filters/wahwah.c index 0fb0b83112..f4e8133520 100644 --- a/libretro-common/audio/dsp_filters/wahwah.c +++ b/libretro-common/audio/dsp_filters/wahwah.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (wahwah.c). diff --git a/libretro-common/audio/resampler/audio_resampler.c b/libretro-common/audio/resampler/audio_resampler.c index cb424691a3..e3baa7f70f 100644 --- a/libretro-common/audio/resampler/audio_resampler.c +++ b/libretro-common/audio/resampler/audio_resampler.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (audio_resampler.c). diff --git a/libretro-common/audio/resampler/drivers/nearest_resampler.c b/libretro-common/audio/resampler/drivers/nearest_resampler.c index 52fae25bf9..c5244851a6 100644 --- a/libretro-common/audio/resampler/drivers/nearest_resampler.c +++ b/libretro-common/audio/resampler/drivers/nearest_resampler.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (nearest_resampler.c). diff --git a/libretro-common/audio/resampler/drivers/null_resampler.c b/libretro-common/audio/resampler/drivers/null_resampler.c index cf41281b6b..e5fe5982a4 100644 --- a/libretro-common/audio/resampler/drivers/null_resampler.c +++ b/libretro-common/audio/resampler/drivers/null_resampler.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (null_resampler.c). diff --git a/libretro-common/audio/resampler/drivers/sinc_resampler.c b/libretro-common/audio/resampler/drivers/sinc_resampler.c index 113554bff1..2237dfc5ce 100644 --- a/libretro-common/audio/resampler/drivers/sinc_resampler.c +++ b/libretro-common/audio/resampler/drivers/sinc_resampler.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (sinc_resampler.c). diff --git a/libretro-common/audio/resampler/drivers/sinc_resampler_neon.S b/libretro-common/audio/resampler/drivers/sinc_resampler_neon.S index b2fefcce43..033104e064 100644 --- a/libretro-common/audio/resampler/drivers/sinc_resampler_neon.S +++ b/libretro-common/audio/resampler/drivers/sinc_resampler_neon.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (sinc_resampler_neon.S). diff --git a/libretro-common/compat/compat_fnmatch.c b/libretro-common/compat/compat_fnmatch.c index a379420c46..110f451ec8 100644 --- a/libretro-common/compat/compat_fnmatch.c +++ b/libretro-common/compat/compat_fnmatch.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (compat_fnmatch.c). diff --git a/libretro-common/compat/compat_getopt.c b/libretro-common/compat/compat_getopt.c index c7b1c66919..c32c85865b 100644 --- a/libretro-common/compat/compat_getopt.c +++ b/libretro-common/compat/compat_getopt.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (compat_getopt.c). diff --git a/libretro-common/compat/compat_posix_string.c b/libretro-common/compat/compat_posix_string.c index 98cc688c79..71b9f8e832 100644 --- a/libretro-common/compat/compat_posix_string.c +++ b/libretro-common/compat/compat_posix_string.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (compat_posix_string.c). diff --git a/libretro-common/compat/compat_snprintf.c b/libretro-common/compat/compat_snprintf.c index 336d2b8e7a..17b453e3c0 100644 --- a/libretro-common/compat/compat_snprintf.c +++ b/libretro-common/compat/compat_snprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (compat_snprintf.c). diff --git a/libretro-common/compat/compat_strcasestr.c b/libretro-common/compat/compat_strcasestr.c index 44bd8b2183..163c50fedb 100644 --- a/libretro-common/compat/compat_strcasestr.c +++ b/libretro-common/compat/compat_strcasestr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (compat_strcasestr.c). diff --git a/libretro-common/compat/compat_strl.c b/libretro-common/compat/compat_strl.c index d3e4c7a63b..188fd72477 100644 --- a/libretro-common/compat/compat_strl.c +++ b/libretro-common/compat/compat_strl.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (compat_strl.c). diff --git a/libretro-common/dynamic/dylib.c b/libretro-common/dynamic/dylib.c index 611c9f8771..ab10226032 100644 --- a/libretro-common/dynamic/dylib.c +++ b/libretro-common/dynamic/dylib.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (dylib.c). diff --git a/libretro-common/encodings/encoding_crc32.c b/libretro-common/encodings/encoding_crc32.c index 8a13cce4a2..aa10d1a241 100644 --- a/libretro-common/encodings/encoding_crc32.c +++ b/libretro-common/encodings/encoding_crc32.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (encoding_crc32.c). diff --git a/libretro-common/encodings/encoding_utf.c b/libretro-common/encodings/encoding_utf.c index 0c339e7418..76fca8dfb8 100644 --- a/libretro-common/encodings/encoding_utf.c +++ b/libretro-common/encodings/encoding_utf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (encoding_utf.c). diff --git a/libretro-common/features/features_cpu.c b/libretro-common/features/features_cpu.c index ddaa01f9ce..fee5635add 100644 --- a/libretro-common/features/features_cpu.c +++ b/libretro-common/features/features_cpu.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (features_cpu.c). @@ -44,7 +44,7 @@ #endif #elif defined(_XBOX360) #include -#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(ANDROID) || defined(__QNX__) +#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(ANDROID) || defined(__QNX__) || defined(DJGPP) /* POSIX_MONOTONIC_CLOCK is not being defined in Android headers despite support being present. */ #include #endif @@ -215,7 +215,7 @@ retro_time_t cpu_features_get_time_usec(void) return tv.tv_sec * INT64_C(1000000) + (tv.tv_nsec + 500) / 1000; #elif defined(EMSCRIPTEN) return emscripten_get_now() * 1000; -#elif defined(__mips__) +#elif defined(__mips__) || defined(DJGPP) struct timeval tv; gettimeofday(&tv,NULL); return (1000000 * tv.tv_sec + tv.tv_usec); diff --git a/libretro-common/file/archive_file.c b/libretro-common/file/archive_file.c index b6a952537b..bdc1c40b89 100644 --- a/libretro-common/file/archive_file.c +++ b/libretro-common/file/archive_file.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (archive_file.c). diff --git a/libretro-common/file/archive_file_7z.c b/libretro-common/file/archive_file_7z.c index 4a578a0b23..da0876ab74 100644 --- a/libretro-common/file/archive_file_7z.c +++ b/libretro-common/file/archive_file_7z.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (archive_file_sevenzip.c). diff --git a/libretro-common/file/archive_file_zlib.c b/libretro-common/file/archive_file_zlib.c index c52c641637..b0d56af2ba 100644 --- a/libretro-common/file/archive_file_zlib.c +++ b/libretro-common/file/archive_file_zlib.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (archive_file_zlib.c). diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index bb2d7f8cac..2b1714e981 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (config_file.c). diff --git a/libretro-common/file/config_file_userdata.c b/libretro-common/file/config_file_userdata.c index b1ff8138e2..48c41a5f3d 100644 --- a/libretro-common/file/config_file_userdata.c +++ b/libretro-common/file/config_file_userdata.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (config_file_userdata.c). diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index c02ddf545d..61ac4b3182 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (file_path.c). diff --git a/libretro-common/file/nbio/nbio_stdio.c b/libretro-common/file/nbio/nbio_stdio.c index 6e2a2f6f34..826d7a496d 100644 --- a/libretro-common/file/nbio/nbio_stdio.c +++ b/libretro-common/file/nbio/nbio_stdio.c @@ -23,7 +23,9 @@ static const char * modes[]={ "rb", "wb", "r+b", "rb", "wb", "r+b" }; struct nbio_t* nbio_open(const char * filename, unsigned mode) { + void *buf = NULL; struct nbio_t* handle = NULL; + size_t len = 0; FILE* f = fopen(filename, modes[mode]); if (!f) return NULL; @@ -34,7 +36,6 @@ struct nbio_t* nbio_open(const char * filename, unsigned mode) goto error; handle->f = f; - handle->len = 0; switch (mode) { @@ -43,16 +44,20 @@ struct nbio_t* nbio_open(const char * filename, unsigned mode) break; default: fseek(handle->f, 0, SEEK_END); - handle->len = ftell(handle->f); + len = ftell(handle->f); break; } handle->mode = mode; - handle->data = malloc(handle->len); - if (handle->len && !handle->data) + if (len) + buf = malloc(len); + + if (!buf) goto error; + handle->data = buf; + handle->len = len; handle->progress = handle->len; handle->op = -2; @@ -60,13 +65,7 @@ struct nbio_t* nbio_open(const char * filename, unsigned mode) error: if (handle) - { - if (handle->data) - free(handle->data); - handle->data = NULL; free(handle); - } - handle = NULL; fclose(f); return NULL; } diff --git a/libretro-common/file/retro_dirent.c b/libretro-common/file/retro_dirent.c index f9d188c96c..66830a0bd7 100644 --- a/libretro-common/file/retro_dirent.c +++ b/libretro-common/file/retro_dirent.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (retro_dirent.c). diff --git a/libretro-common/file/retro_stat.c b/libretro-common/file/retro_stat.c index d865f68e82..372cbde020 100644 --- a/libretro-common/file/retro_stat.c +++ b/libretro-common/file/retro_stat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (retro_stat.c). @@ -30,6 +30,7 @@ #ifdef _MSC_VER #define setmode _setmode #endif +#include #ifdef _XBOX #include #define INVALID_FILE_ATTRIBUTES -1 @@ -101,12 +102,12 @@ static bool path_stat(const char *path, enum stat_mode mode, int32_t *size) if (cellFsStat(path, &buf) < 0) return false; #elif defined(_WIN32) - WIN32_FILE_ATTRIBUTE_DATA file_info; - GET_FILEEX_INFO_LEVELS fInfoLevelId = GetFileExInfoStandard; + DWORD file_info = GetFileAttributes(path); + struct _stat buf; - DWORD ret = GetFileAttributesEx(path, fInfoLevelId, &file_info); + _stat(path, &buf); - if (ret == 0) + if (file_info == INVALID_FILE_ATTRIBUTES) return false; #else struct stat buf; @@ -114,13 +115,8 @@ static bool path_stat(const char *path, enum stat_mode mode, int32_t *size) return false; #endif -#if defined(_WIN32) - if (size) - *size = file_info.nFileSizeLow; -#else if (size) *size = buf.st_size; -#endif switch (mode) { @@ -130,7 +126,7 @@ static bool path_stat(const char *path, enum stat_mode mode, int32_t *size) #elif defined(__CELLOS_LV2__) return ((buf.st_mode & S_IFMT) == S_IFDIR); #elif defined(_WIN32) - return (file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); + return (file_info & FILE_ATTRIBUTE_DIRECTORY); #else return S_ISDIR(buf.st_mode); #endif diff --git a/libretro-common/formats/bmp/rbmp.c b/libretro-common/formats/bmp/rbmp.c index cecb5462c7..f667e68c4f 100644 --- a/libretro-common/formats/bmp/rbmp.c +++ b/libretro-common/formats/bmp/rbmp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rbmp.c). diff --git a/libretro-common/formats/bmp/rbmp_encode.c b/libretro-common/formats/bmp/rbmp_encode.c index 0bf59f1018..014deb7c8c 100644 --- a/libretro-common/formats/bmp/rbmp_encode.c +++ b/libretro-common/formats/bmp/rbmp_encode.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rbmp_encode.c). diff --git a/libretro-common/formats/image_texture.c b/libretro-common/formats/image_texture.c index 46f6143698..0f24004010 100644 --- a/libretro-common/formats/image_texture.c +++ b/libretro-common/formats/image_texture.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (image_texture.c). diff --git a/libretro-common/formats/image_transfer.c b/libretro-common/formats/image_transfer.c index afd3a99fd2..1bb80b122f 100644 --- a/libretro-common/formats/image_transfer.c +++ b/libretro-common/formats/image_transfer.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (image_transfer.c). diff --git a/libretro-common/formats/jpeg/rjpeg.c b/libretro-common/formats/jpeg/rjpeg.c index fb44b49318..827f0bf691 100644 --- a/libretro-common/formats/jpeg/rjpeg.c +++ b/libretro-common/formats/jpeg/rjpeg.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rjpeg.c). diff --git a/libretro-common/formats/json/jsonsax.c b/libretro-common/formats/json/jsonsax.c index 0c184cf249..1a7ac93555 100644 --- a/libretro-common/formats/json/jsonsax.c +++ b/libretro-common/formats/json/jsonsax.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (jsonsax.c). diff --git a/libretro-common/formats/png/rpng.c b/libretro-common/formats/png/rpng.c index 2ad8c9017d..ab3472485e 100644 --- a/libretro-common/formats/png/rpng.c +++ b/libretro-common/formats/png/rpng.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rpng.c). diff --git a/libretro-common/formats/png/rpng_encode.c b/libretro-common/formats/png/rpng_encode.c index f580ed2646..1f91f4cd80 100644 --- a/libretro-common/formats/png/rpng_encode.c +++ b/libretro-common/formats/png/rpng_encode.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rpng_encode.c). diff --git a/libretro-common/formats/png/rpng_internal.h b/libretro-common/formats/png/rpng_internal.h index fa7ebf57dc..440bd3d587 100644 --- a/libretro-common/formats/png/rpng_internal.h +++ b/libretro-common/formats/png/rpng_internal.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rpng_internal.h). diff --git a/libretro-common/formats/tga/rtga.c b/libretro-common/formats/tga/rtga.c index b684aa0ae1..200b85c651 100644 --- a/libretro-common/formats/tga/rtga.c +++ b/libretro-common/formats/tga/rtga.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rtga.c). @@ -66,7 +66,8 @@ static INLINE uint8_t rtga__get8(rtga__context *s) static void rtga__skip(rtga__context *s, int n) { - if (n < 0) { + if (n < 0) + { s->img_buffer = s->img_buffer_end; return; } diff --git a/libretro-common/formats/wav/rwav.c b/libretro-common/formats/wav/rwav.c index 9ca9fb2c6b..80bb31ad4b 100644 --- a/libretro-common/formats/wav/rwav.c +++ b/libretro-common/formats/wav/rwav.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rwav.c). diff --git a/libretro-common/formats/xml/rxml.c b/libretro-common/formats/xml/rxml.c index 7b933acf7f..1150e8e1b9 100644 --- a/libretro-common/formats/xml/rxml.c +++ b/libretro-common/formats/xml/rxml.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rxml.c). diff --git a/libretro-common/formats/xml/test/rxml_test.c b/libretro-common/formats/xml/test/rxml_test.c index 2c0d26541f..8fac40ce55 100644 --- a/libretro-common/formats/xml/test/rxml_test.c +++ b/libretro-common/formats/xml/test/rxml_test.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rxml_test.c). diff --git a/libretro-common/gfx/gl_capabilities.c b/libretro-common/gfx/gl_capabilities.c index 2eb0b2febd..570d164a29 100644 --- a/libretro-common/gfx/gl_capabilities.c +++ b/libretro-common/gfx/gl_capabilities.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (gl_capabilities.c). @@ -311,6 +311,8 @@ bool gl_check_capability(enum gl_capability_enum enum_idx) if (major >= 3) return true; #else + if (strstr(vendor, "ATI Technologies")) + return false; if (gl_query_extension("ARB_texture_storage")) return true; #endif diff --git a/libretro-common/gfx/math/matrix_3x3.c b/libretro-common/gfx/math/matrix_3x3.c index a4bb723034..a13b260ba9 100644 --- a/libretro-common/gfx/math/matrix_3x3.c +++ b/libretro-common/gfx/math/matrix_3x3.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (matrix_3x3.c). diff --git a/libretro-common/gfx/math/matrix_4x4.c b/libretro-common/gfx/math/matrix_4x4.c index 7cf1122727..c399f75d0f 100644 --- a/libretro-common/gfx/math/matrix_4x4.c +++ b/libretro-common/gfx/math/matrix_4x4.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (matrix_4x4.c). diff --git a/libretro-common/gfx/math/vector_2.c b/libretro-common/gfx/math/vector_2.c index b7745e456e..5c5f7c1883 100644 --- a/libretro-common/gfx/math/vector_2.c +++ b/libretro-common/gfx/math/vector_2.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (vector_2.c). diff --git a/libretro-common/gfx/math/vector_3.c b/libretro-common/gfx/math/vector_3.c index 4f76dde269..b30a3c3512 100644 --- a/libretro-common/gfx/math/vector_3.c +++ b/libretro-common/gfx/math/vector_3.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (vector_3.c). diff --git a/libretro-common/gfx/math/vector_4.c b/libretro-common/gfx/math/vector_4.c index 0c2d4d5fcf..0ae98ad0f1 100644 --- a/libretro-common/gfx/math/vector_4.c +++ b/libretro-common/gfx/math/vector_4.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (vector_4.c). diff --git a/libretro-common/gfx/scaler/pixconv.c b/libretro-common/gfx/scaler/pixconv.c index 78ff6afa0d..09cf34cefb 100644 --- a/libretro-common/gfx/scaler/pixconv.c +++ b/libretro-common/gfx/scaler/pixconv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (pixconv.c). diff --git a/libretro-common/gfx/scaler/scaler.c b/libretro-common/gfx/scaler/scaler.c index 5e41ac7ddb..7e8921abdc 100644 --- a/libretro-common/gfx/scaler/scaler.c +++ b/libretro-common/gfx/scaler/scaler.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (scaler.c). diff --git a/libretro-common/gfx/scaler/scaler_filter.c b/libretro-common/gfx/scaler/scaler_filter.c index a4996977b5..e06ca64d79 100644 --- a/libretro-common/gfx/scaler/scaler_filter.c +++ b/libretro-common/gfx/scaler/scaler_filter.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (scaler_filter.c). diff --git a/libretro-common/gfx/scaler/scaler_int.c b/libretro-common/gfx/scaler/scaler_int.c index c82ad3a6b4..2b189c6dd1 100644 --- a/libretro-common/gfx/scaler/scaler_int.c +++ b/libretro-common/gfx/scaler/scaler_int.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (scaler_int.c). diff --git a/libretro-common/glsm/glsm.c b/libretro-common/glsm/glsm.c index e5c36b1375..8fc8e13ed0 100644 --- a/libretro-common/glsm/glsm.c +++ b/libretro-common/glsm/glsm.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this libretro SDK code part (glsm). diff --git a/libretro-common/glsym/glsym_gl.c b/libretro-common/glsym/glsym_gl.c index f72e976486..5aa92fdca2 100644 --- a/libretro-common/glsym/glsym_gl.c +++ b/libretro-common/glsym/glsym_gl.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this libretro SDK code part (glsym). diff --git a/libretro-common/glsym/rglgen.c b/libretro-common/glsym/rglgen.c index 29403c9d00..0ea1fdc99c 100644 --- a/libretro-common/glsym/rglgen.c +++ b/libretro-common/glsym/rglgen.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this libretro SDK code part (glsym). diff --git a/libretro-common/hash/rhash.c b/libretro-common/hash/rhash.c index 1c22efeef9..4282670f80 100644 --- a/libretro-common/hash/rhash.c +++ b/libretro-common/hash/rhash.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rhash.c). diff --git a/libretro-common/include/algorithms/mismatch.h b/libretro-common/include/algorithms/mismatch.h index 1c87bf5bea..bfcde4af19 100644 --- a/libretro-common/include/algorithms/mismatch.h +++ b/libretro-common/include/algorithms/mismatch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (mismatch.h). diff --git a/libretro-common/include/audio/audio_resampler.h b/libretro-common/include/audio/audio_resampler.h index abdf6eb1a3..4704eeff9d 100644 --- a/libretro-common/include/audio/audio_resampler.h +++ b/libretro-common/include/audio/audio_resampler.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (audio_resampler.h). diff --git a/libretro-common/include/audio/conversion/float_to_s16.h b/libretro-common/include/audio/conversion/float_to_s16.h index 0867233fcf..381db8e376 100644 --- a/libretro-common/include/audio/conversion/float_to_s16.h +++ b/libretro-common/include/audio/conversion/float_to_s16.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (float_to_s16.h). diff --git a/libretro-common/include/audio/conversion/s16_to_float.h b/libretro-common/include/audio/conversion/s16_to_float.h index 46620e518a..6407a63d29 100644 --- a/libretro-common/include/audio/conversion/s16_to_float.h +++ b/libretro-common/include/audio/conversion/s16_to_float.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (s16_to_float.h). diff --git a/libretro-common/include/audio/dsp_filter.h b/libretro-common/include/audio/dsp_filter.h index 7740c3e141..2055235f6f 100644 --- a/libretro-common/include/audio/dsp_filter.h +++ b/libretro-common/include/audio/dsp_filter.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (dsp_filter.h). diff --git a/libretro-common/include/boolean.h b/libretro-common/include/boolean.h index 4d53907ed3..2c18ef76f6 100644 --- a/libretro-common/include/boolean.h +++ b/libretro-common/include/boolean.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (boolean.h). diff --git a/libretro-common/include/clamping.h b/libretro-common/include/clamping.h index c8ec43ba09..7919332b95 100644 --- a/libretro-common/include/clamping.h +++ b/libretro-common/include/clamping.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (clamping.h). diff --git a/libretro-common/include/compat/apple_compat.h b/libretro-common/include/compat/apple_compat.h index 423dc30952..f656546302 100644 --- a/libretro-common/include/compat/apple_compat.h +++ b/libretro-common/include/compat/apple_compat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (apple_compat.h). diff --git a/libretro-common/include/compat/fnmatch.h b/libretro-common/include/compat/fnmatch.h index ac36b43ca2..3f3c0254bc 100644 --- a/libretro-common/include/compat/fnmatch.h +++ b/libretro-common/include/compat/fnmatch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (fnmatch.h). diff --git a/libretro-common/include/compat/getopt.h b/libretro-common/include/compat/getopt.h index 22e3d937f5..fd5300aa38 100644 --- a/libretro-common/include/compat/getopt.h +++ b/libretro-common/include/compat/getopt.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (getopt.h). diff --git a/libretro-common/include/compat/intrinsics.h b/libretro-common/include/compat/intrinsics.h index 0601dffadc..d4aa3c1d30 100644 --- a/libretro-common/include/compat/intrinsics.h +++ b/libretro-common/include/compat/intrinsics.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (intrinsics.h). @@ -30,7 +30,7 @@ #include #include -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(_XBOX) #if (_MSC_VER > 1310) #include #endif diff --git a/libretro-common/include/compat/msvc.h b/libretro-common/include/compat/msvc.h index e767bef7f8..76bc2e468f 100644 --- a/libretro-common/include/compat/msvc.h +++ b/libretro-common/include/compat/msvc.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (msvc.h). diff --git a/libretro-common/include/compat/posix_string.h b/libretro-common/include/compat/posix_string.h index 2731231e2a..380e1a121f 100644 --- a/libretro-common/include/compat/posix_string.h +++ b/libretro-common/include/compat/posix_string.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (posix_string.h). diff --git a/libretro-common/include/compat/strcasestr.h b/libretro-common/include/compat/strcasestr.h index 253ea39320..a8676a5bd6 100644 --- a/libretro-common/include/compat/strcasestr.h +++ b/libretro-common/include/compat/strcasestr.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (strcasestr.h). diff --git a/libretro-common/include/compat/strl.h b/libretro-common/include/compat/strl.h index 50d31aa64e..a68005ac2f 100644 --- a/libretro-common/include/compat/strl.h +++ b/libretro-common/include/compat/strl.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (strl.h). diff --git a/libretro-common/include/dynamic/dylib.h b/libretro-common/include/dynamic/dylib.h index 7313e9a547..b8ee171cf3 100644 --- a/libretro-common/include/dynamic/dylib.h +++ b/libretro-common/include/dynamic/dylib.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (dylib.h). diff --git a/libretro-common/include/encodings/crc32.h b/libretro-common/include/encodings/crc32.h index b7dc00f95d..1d670e7b80 100644 --- a/libretro-common/include/encodings/crc32.h +++ b/libretro-common/include/encodings/crc32.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (crc32.h). diff --git a/libretro-common/include/encodings/utf.h b/libretro-common/include/encodings/utf.h index aabe113e2c..0c65039429 100644 --- a/libretro-common/include/encodings/utf.h +++ b/libretro-common/include/encodings/utf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (utf.h). diff --git a/libretro-common/include/fastcpy.h b/libretro-common/include/fastcpy.h index b5dfce3c94..13b94d97bd 100644 --- a/libretro-common/include/fastcpy.h +++ b/libretro-common/include/fastcpy.h @@ -1,66 +1,94 @@ -//in the future asm and new c++ features can be added to speed up copying +/* Copyright (C) 2010-2017 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (fastcpy.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* in the future ASM and new c++ features can be added to speed up copying */ #include #include #include -static INLINE void* memcpy16(void* dst,void* src,size_t size){ +static INLINE void* memcpy16(void* dst,void* src,size_t size) +{ return memcpy(dst,src,size * 2); } -static INLINE void* memcpy32(void* dst,void* src,size_t size){ +static INLINE void* memcpy32(void* dst,void* src,size_t size) +{ return memcpy(dst,src,size * 4); } -static INLINE void* memcpy64(void* dst,void* src,size_t size){ +static INLINE void* memcpy64(void* dst,void* src,size_t size) +{ return memcpy(dst,src,size * 8); } #ifdef USECPPSTDFILL #include -static INLINE void* memset16(void* dst,uint16_t val,size_t size){ +static INLINE void* memset16(void* dst,uint16_t val,size_t size) +{ uint16_t* typedptr = (uint16_t*)dst; std::fill(typedptr, typedptr + size, val); return dst; } -static INLINE void* memset32(void* dst,uint32_t val,size_t size){ +static INLINE void* memset32(void* dst,uint32_t val,size_t size) +{ uint32_t* typedptr = (uint32_t*)dst; std::fill(typedptr, typedptr + size, val); return dst; } -static INLINE void* memset64(void* dst,uint64_t val,size_t size){ +static INLINE void* memset64(void* dst,uint64_t val,size_t size) +{ uint64_t* typedptr = (uint64_t*)dst; std::fill(typedptr, typedptr + size, val); return dst; } #else -static INLINE void* memset16(void* dst,uint16_t val,size_t size){ +static INLINE void* memset16(void* dst,uint16_t val,size_t size) +{ + size_t i; uint16_t* typedptr = (uint16_t*)dst; - size_t i; - for(i = 0;i < size;i++){ + for(i = 0;i < size;i++) typedptr[i] = val; - } return dst; } -static INLINE void* memset32(void* dst,uint32_t val,size_t size){ +static INLINE void* memset32(void* dst,uint32_t val,size_t size) +{ + size_t i; uint32_t* typedptr = (uint32_t*)dst; - size_t i; - for(i = 0;i < size;i++){ + for(i = 0;i < size;i++) typedptr[i] = val; - } return dst; } -static INLINE void* memset64(void* dst,uint64_t val,size_t size){ - uint64_t* typedptr = (uint64_t*)dst; +static INLINE void* memset64(void* dst,uint64_t val,size_t size) +{ size_t i; - for(i = 0;i < size;i++){ + uint64_t* typedptr = (uint64_t*)dst; + for(i = 0;i < size;i++) typedptr[i] = val; - } return dst; } #endif diff --git a/libretro-common/include/features/features_cpu.h b/libretro-common/include/features/features_cpu.h index 8a0a046de7..fd8f5f62b6 100644 --- a/libretro-common/include/features/features_cpu.h +++ b/libretro-common/include/features/features_cpu.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (features_cpu.h). diff --git a/libretro-common/include/file/archive_file.h b/libretro-common/include/file/archive_file.h index 407bc3cfc7..e15448e6cd 100644 --- a/libretro-common/include/file/archive_file.h +++ b/libretro-common/include/file/archive_file.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (archive_file.h). diff --git a/libretro-common/include/file/config_file.h b/libretro-common/include/file/config_file.h index b13686cd95..3e26acf0b2 100644 --- a/libretro-common/include/file/config_file.h +++ b/libretro-common/include/file/config_file.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (config_file.h). diff --git a/libretro-common/include/file/config_file_userdata.h b/libretro-common/include/file/config_file_userdata.h index 19d2277192..cb1208da3d 100644 --- a/libretro-common/include/file/config_file_userdata.h +++ b/libretro-common/include/file/config_file_userdata.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (config_file_userdata.h). diff --git a/libretro-common/include/file/file_path.h b/libretro-common/include/file/file_path.h index 04fc695894..1a56242e77 100644 --- a/libretro-common/include/file/file_path.h +++ b/libretro-common/include/file/file_path.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (file_path.h). diff --git a/libretro-common/include/file/nbio.h b/libretro-common/include/file/nbio.h index 9a645386e8..59039190a6 100644 --- a/libretro-common/include/file/nbio.h +++ b/libretro-common/include/file/nbio.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (nbio.h). diff --git a/libretro-common/include/filters.h b/libretro-common/include/filters.h index 6ca3a5e29d..b021aeddbf 100644 --- a/libretro-common/include/filters.h +++ b/libretro-common/include/filters.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (filters.h). diff --git a/libretro-common/include/formats/image.h b/libretro-common/include/formats/image.h index 9db2c6f899..bba886642d 100644 --- a/libretro-common/include/formats/image.h +++ b/libretro-common/include/formats/image.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (image.h). diff --git a/libretro-common/include/formats/jsonsax.h b/libretro-common/include/formats/jsonsax.h index 01d8a12276..4170b24ab5 100644 --- a/libretro-common/include/formats/jsonsax.h +++ b/libretro-common/include/formats/jsonsax.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (jsonsax.h). diff --git a/libretro-common/include/formats/rbmp.h b/libretro-common/include/formats/rbmp.h index bc0702758f..622d8c94d7 100644 --- a/libretro-common/include/formats/rbmp.h +++ b/libretro-common/include/formats/rbmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rbmp.h). diff --git a/libretro-common/include/formats/rjpeg.h b/libretro-common/include/formats/rjpeg.h index 27050ea418..a999516df0 100644 --- a/libretro-common/include/formats/rjpeg.h +++ b/libretro-common/include/formats/rjpeg.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rjpeg.h). diff --git a/libretro-common/include/formats/rpng.h b/libretro-common/include/formats/rpng.h index 08b1a693d7..b16a8307fa 100644 --- a/libretro-common/include/formats/rpng.h +++ b/libretro-common/include/formats/rpng.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rpng.h). diff --git a/libretro-common/include/formats/rtga.h b/libretro-common/include/formats/rtga.h index bb6d97a294..a66f4a0ab6 100644 --- a/libretro-common/include/formats/rtga.h +++ b/libretro-common/include/formats/rtga.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rtga.h). diff --git a/libretro-common/include/formats/rwav.h b/libretro-common/include/formats/rwav.h index 21f197f742..2000059b5d 100644 --- a/libretro-common/include/formats/rwav.h +++ b/libretro-common/include/formats/rwav.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rwav.h). diff --git a/libretro-common/include/formats/rxml.h b/libretro-common/include/formats/rxml.h index c3f3335c19..88d25bc138 100644 --- a/libretro-common/include/formats/rxml.h +++ b/libretro-common/include/formats/rxml.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rxml.h). diff --git a/libretro-common/include/gfx/gl_capabilities.h b/libretro-common/include/gfx/gl_capabilities.h index cf89c4a935..ded3b64522 100644 --- a/libretro-common/include/gfx/gl_capabilities.h +++ b/libretro-common/include/gfx/gl_capabilities.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (gl_capabilities.h). diff --git a/libretro-common/include/gfx/math/matrix_3x3.h b/libretro-common/include/gfx/math/matrix_3x3.h index 216b171930..597dd2c6c2 100644 --- a/libretro-common/include/gfx/math/matrix_3x3.h +++ b/libretro-common/include/gfx/math/matrix_3x3.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (matrix_3x3.h). diff --git a/libretro-common/include/gfx/math/matrix_4x4.h b/libretro-common/include/gfx/math/matrix_4x4.h index 7216ff3461..31f1338818 100644 --- a/libretro-common/include/gfx/math/matrix_4x4.h +++ b/libretro-common/include/gfx/math/matrix_4x4.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (matrix_4x4.h). diff --git a/libretro-common/include/gfx/math/vector_2.h b/libretro-common/include/gfx/math/vector_2.h index 8847700870..e5af8d68d8 100644 --- a/libretro-common/include/gfx/math/vector_2.h +++ b/libretro-common/include/gfx/math/vector_2.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (vector_2.h). diff --git a/libretro-common/include/gfx/math/vector_3.h b/libretro-common/include/gfx/math/vector_3.h index 5e2d03b5a7..f9e67cc279 100644 --- a/libretro-common/include/gfx/math/vector_3.h +++ b/libretro-common/include/gfx/math/vector_3.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (vector_3.h). diff --git a/libretro-common/include/gfx/math/vector_4.h b/libretro-common/include/gfx/math/vector_4.h index 494d8dcebd..3eae577168 100644 --- a/libretro-common/include/gfx/math/vector_4.h +++ b/libretro-common/include/gfx/math/vector_4.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (vector_4.h). diff --git a/libretro-common/include/gfx/scaler/filter.h b/libretro-common/include/gfx/scaler/filter.h index 11aa020201..ba5ae93907 100644 --- a/libretro-common/include/gfx/scaler/filter.h +++ b/libretro-common/include/gfx/scaler/filter.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (filter.h). diff --git a/libretro-common/include/gfx/scaler/pixconv.h b/libretro-common/include/gfx/scaler/pixconv.h index 46a72f5887..f9f74d9324 100644 --- a/libretro-common/include/gfx/scaler/pixconv.h +++ b/libretro-common/include/gfx/scaler/pixconv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (pixconv.h). diff --git a/libretro-common/include/gfx/scaler/scaler.h b/libretro-common/include/gfx/scaler/scaler.h index 64a52e4479..1c1c2b467d 100644 --- a/libretro-common/include/gfx/scaler/scaler.h +++ b/libretro-common/include/gfx/scaler/scaler.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (scaler.h). diff --git a/libretro-common/include/gfx/scaler/scaler_int.h b/libretro-common/include/gfx/scaler/scaler_int.h index eb6b01c8ab..a5ed7dd084 100644 --- a/libretro-common/include/gfx/scaler/scaler_int.h +++ b/libretro-common/include/gfx/scaler/scaler_int.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (scaler_int.h). diff --git a/libretro-common/include/gfx/video_frame.h b/libretro-common/include/gfx/video_frame.h index ddae40547c..70f275940d 100644 --- a/libretro-common/include/gfx/video_frame.h +++ b/libretro-common/include/gfx/video_frame.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (video_frame.h). diff --git a/libretro-common/include/glsm/glsm.h b/libretro-common/include/glsm/glsm.h index 285ffe4b10..8e30acdc04 100644 --- a/libretro-common/include/glsm/glsm.h +++ b/libretro-common/include/glsm/glsm.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this libretro SDK code part (glsm.h). diff --git a/libretro-common/include/glsm/glsmsym.h b/libretro-common/include/glsm/glsmsym.h index bfb7dd9db2..7b12246a88 100644 --- a/libretro-common/include/glsm/glsmsym.h +++ b/libretro-common/include/glsm/glsmsym.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this libretro SDK code part (glsmsym.h). diff --git a/libretro-common/include/glsym/glsym.h b/libretro-common/include/glsym/glsym.h index 4dd7bfd0a2..c1c13e2a56 100644 --- a/libretro-common/include/glsym/glsym.h +++ b/libretro-common/include/glsym/glsym.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this libretro SDK code part (glsym). diff --git a/libretro-common/include/glsym/glsym_gl.h b/libretro-common/include/glsym/glsym_gl.h index a3150f08d5..9720c2e1cf 100644 --- a/libretro-common/include/glsym/glsym_gl.h +++ b/libretro-common/include/glsym/glsym_gl.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this libretro SDK code part (glsym). diff --git a/libretro-common/include/glsym/rglgen.h b/libretro-common/include/glsym/rglgen.h index bf127f8570..54dcb62a84 100644 --- a/libretro-common/include/glsym/rglgen.h +++ b/libretro-common/include/glsym/rglgen.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this libretro SDK code part (glsym). diff --git a/libretro-common/include/glsym/rglgen_headers.h b/libretro-common/include/glsym/rglgen_headers.h index 479d77c61e..06d8530b27 100644 --- a/libretro-common/include/glsym/rglgen_headers.h +++ b/libretro-common/include/glsym/rglgen_headers.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this libretro SDK code part (glsym). diff --git a/libretro-common/include/libco.h b/libretro-common/include/libco.h index 9925d7e378..1599cb2ca0 100644 --- a/libretro-common/include/libco.h +++ b/libretro-common/include/libco.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (libco.h). diff --git a/libretro-common/include/libretro.h b/libretro-common/include/libretro.h index 020752d702..89947ebe44 100644 --- a/libretro-common/include/libretro.h +++ b/libretro-common/include/libretro.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this libretro API header (libretro.h). diff --git a/libretro-common/include/libretro_dspfilter.h b/libretro-common/include/libretro_dspfilter.h index 4433339488..1b9929c573 100644 --- a/libretro-common/include/libretro_dspfilter.h +++ b/libretro-common/include/libretro_dspfilter.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this libretro API header (libretro_dspfilter.h). diff --git a/libretro-common/include/libretro_vulkan.h b/libretro-common/include/libretro_vulkan.h index 7fb36ec106..f683a0f0b1 100644 --- a/libretro-common/include/libretro_vulkan.h +++ b/libretro-common/include/libretro_vulkan.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------------- * The following license statement only applies to this libretro API header (libretro_vulkan.h) diff --git a/libretro-common/include/lists/dir_list.h b/libretro-common/include/lists/dir_list.h index a4d0d263ff..027078238f 100644 --- a/libretro-common/include/lists/dir_list.h +++ b/libretro-common/include/lists/dir_list.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (dir_list.h). diff --git a/libretro-common/include/lists/file_list.h b/libretro-common/include/lists/file_list.h index ad616f0e01..95b0eb5d2c 100644 --- a/libretro-common/include/lists/file_list.h +++ b/libretro-common/include/lists/file_list.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (file_list.h). diff --git a/libretro-common/include/lists/string_list.h b/libretro-common/include/lists/string_list.h index 386ceab9ad..c15cd0eca7 100644 --- a/libretro-common/include/lists/string_list.h +++ b/libretro-common/include/lists/string_list.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (string_list.h). diff --git a/libretro-common/include/math/complex.h b/libretro-common/include/math/complex.h index 39a5df415a..79173932d1 100644 --- a/libretro-common/include/math/complex.h +++ b/libretro-common/include/math/complex.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (complex.h). diff --git a/libretro-common/include/math/float_minmax.h b/libretro-common/include/math/float_minmax.h index f89cdc5bd5..d917ef8ef6 100644 --- a/libretro-common/include/math/float_minmax.h +++ b/libretro-common/include/math/float_minmax.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (float_minmax.h). @@ -39,7 +39,7 @@ static INLINE float float_min(float a, float b) #ifdef __SSE2__ _mm_store_ss( &a, _mm_min_ss(_mm_set_ss(a),_mm_set_ss(b)) ); return a; -#elif defined(__STDC_C99__) || defined(__STDC_C11__) +#elif !defined(DJGPP) && (defined(__STDC_C99__) || defined(__STDC_C11__)) return fminf(a, b); #else return MIN(a, b); @@ -51,7 +51,7 @@ static INLINE float float_max(float a, float b) #ifdef __SSE2__ _mm_store_ss( &a, _mm_max_ss(_mm_set_ss(a),_mm_set_ss(b)) ); return a; -#elif defined(__STDC_C99__) || defined(__STDC_C11__) +#elif !defined(DJGPP) && (defined(__STDC_C99__) || defined(__STDC_C11__)) return fmaxf(a, b); #else return MAX(a, b); diff --git a/libretro-common/include/math/fxp.h b/libretro-common/include/math/fxp.h index f6717754fc..56b036cd72 100644 --- a/libretro-common/include/math/fxp.h +++ b/libretro-common/include/math/fxp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (fxp.h). diff --git a/libretro-common/include/memalign.h b/libretro-common/include/memalign.h index 6d217437eb..ca809f80c3 100644 --- a/libretro-common/include/memalign.h +++ b/libretro-common/include/memalign.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (memalign.h). diff --git a/libretro-common/include/memmap.h b/libretro-common/include/memmap.h index bc7d9fbef5..5dc1a89330 100644 --- a/libretro-common/include/memmap.h +++ b/libretro-common/include/memmap.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (memmap.h). diff --git a/libretro-common/include/net/net_compat.h b/libretro-common/include/net/net_compat.h index 76c9c51df2..71f3109a5b 100644 --- a/libretro-common/include/net/net_compat.h +++ b/libretro-common/include/net/net_compat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (net_compat.h). @@ -101,6 +101,8 @@ struct hostent char *h_addr; }; +struct SceNetInAddr inet_aton(const char *ip_addr); + #else #include #include diff --git a/libretro-common/include/net/net_http.h b/libretro-common/include/net/net_http.h index bac244e94b..1ec56bbc3c 100644 --- a/libretro-common/include/net/net_http.h +++ b/libretro-common/include/net/net_http.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (net_http.h). diff --git a/libretro-common/include/net/net_http_parse.h b/libretro-common/include/net/net_http_parse.h index a9c65d4d5b..4fc4845cd0 100644 --- a/libretro-common/include/net/net_http_parse.h +++ b/libretro-common/include/net/net_http_parse.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (net_http.h). diff --git a/libretro-common/include/net/net_ifinfo.h b/libretro-common/include/net/net_ifinfo.h index 982226f895..00158f6833 100644 --- a/libretro-common/include/net/net_ifinfo.h +++ b/libretro-common/include/net/net_ifinfo.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (net_ifinfo.h). diff --git a/libretro-common/include/net/net_natt.h b/libretro-common/include/net/net_natt.h index 9ef0eb8fba..d3b2c43560 100644 --- a/libretro-common/include/net/net_natt.h +++ b/libretro-common/include/net/net_natt.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (net_natt.h). diff --git a/libretro-common/include/net/net_socket.h b/libretro-common/include/net/net_socket.h index 3196e128c9..58ad050d74 100644 --- a/libretro-common/include/net/net_socket.h +++ b/libretro-common/include/net/net_socket.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (net_socket.h). diff --git a/libretro-common/include/queues/fifo_queue.h b/libretro-common/include/queues/fifo_queue.h index bbb5c0bbef..1b0aab541b 100644 --- a/libretro-common/include/queues/fifo_queue.h +++ b/libretro-common/include/queues/fifo_queue.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (fifo_queue.h). diff --git a/libretro-common/include/queues/message_queue.h b/libretro-common/include/queues/message_queue.h index 6dadb8961e..2339e93578 100644 --- a/libretro-common/include/queues/message_queue.h +++ b/libretro-common/include/queues/message_queue.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (message_queue.h). diff --git a/libretro-common/include/queues/task_queue.h b/libretro-common/include/queues/task_queue.h index 36369e9fcf..332af4760d 100644 --- a/libretro-common/include/queues/task_queue.h +++ b/libretro-common/include/queues/task_queue.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (task_queue.h). diff --git a/libretro-common/include/retro_assert.h b/libretro-common/include/retro_assert.h index 5870c3e97b..3ef0300ec6 100644 --- a/libretro-common/include/retro_assert.h +++ b/libretro-common/include/retro_assert.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (retro_assert.h). diff --git a/libretro-common/include/retro_common.h b/libretro-common/include/retro_common.h index 6e9e6bf432..33857234ee 100644 --- a/libretro-common/include/retro_common.h +++ b/libretro-common/include/retro_common.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (retro_common.h). diff --git a/libretro-common/include/retro_common_api.h b/libretro-common/include/retro_common_api.h index 2bded88555..c32501967e 100644 --- a/libretro-common/include/retro_common_api.h +++ b/libretro-common/include/retro_common_api.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (retro_common_api.h). diff --git a/libretro-common/include/retro_dirent.h b/libretro-common/include/retro_dirent.h index 6270287a00..ab02998af3 100644 --- a/libretro-common/include/retro_dirent.h +++ b/libretro-common/include/retro_dirent.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (retro_dirent.h). diff --git a/libretro-common/include/retro_endianness.h b/libretro-common/include/retro_endianness.h index 74f29821cd..ee9dba1b87 100644 --- a/libretro-common/include/retro_endianness.h +++ b/libretro-common/include/retro_endianness.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (retro_endianness.h). diff --git a/libretro-common/include/retro_environment.h b/libretro-common/include/retro_environment.h index fa08ddc5e7..12ee429de8 100644 --- a/libretro-common/include/retro_environment.h +++ b/libretro-common/include/retro_environment.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (retro_environment.h). diff --git a/libretro-common/include/retro_inline.h b/libretro-common/include/retro_inline.h index bdc763ca93..ffdaa4a3ab 100644 --- a/libretro-common/include/retro_inline.h +++ b/libretro-common/include/retro_inline.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (retro_inline.h). diff --git a/libretro-common/include/retro_miscellaneous.h b/libretro-common/include/retro_miscellaneous.h index 83d004b8a0..52421063f3 100644 --- a/libretro-common/include/retro_miscellaneous.h +++ b/libretro-common/include/retro_miscellaneous.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (retro_miscellaneous.h). @@ -83,6 +83,26 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) #define RARCH_SCALE_BASE 256 +#ifdef DJGPP +#define timespec timeval +#define tv_nsec tv_usec +#include + +extern int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); + +static int nanosleepDOS(const struct timespec *rqtp, struct timespec *rmtp) +{ + usleep(1000000 * rqtp->tv_sec + rqtp->tv_nsec / 1000); + + if (rmtp) + rmtp->tv_sec = rmtp->tv_nsec=0; + + return 0; +} + +#define nanosleep nanosleepDOS +#endif + /** * retro_sleep: * @msec : amount in milliseconds to sleep diff --git a/libretro-common/include/retro_stat.h b/libretro-common/include/retro_stat.h index a6d53abfb7..b5b24a47c1 100644 --- a/libretro-common/include/retro_stat.h +++ b/libretro-common/include/retro_stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (retro_stat.h). diff --git a/libretro-common/include/rhash.h b/libretro-common/include/rhash.h index a962a22106..7cca800c94 100644 --- a/libretro-common/include/rhash.h +++ b/libretro-common/include/rhash.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rhash.h). diff --git a/libretro-common/include/rthreads/rsemaphore.h b/libretro-common/include/rthreads/rsemaphore.h index 8df8187833..a2e964fb67 100644 --- a/libretro-common/include/rthreads/rsemaphore.h +++ b/libretro-common/include/rthreads/rsemaphore.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rsemaphore.h). diff --git a/libretro-common/include/rthreads/rthreads.h b/libretro-common/include/rthreads/rthreads.h index 9af41fd301..6a33f9e3e5 100644 --- a/libretro-common/include/rthreads/rthreads.h +++ b/libretro-common/include/rthreads/rthreads.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rthreads.h). diff --git a/libretro-common/include/streams/file_stream.h b/libretro-common/include/streams/file_stream.h index 3e896e2f1a..d13290d4d3 100644 --- a/libretro-common/include/streams/file_stream.h +++ b/libretro-common/include/streams/file_stream.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (file_stream.h). diff --git a/libretro-common/include/streams/interface_stream.h b/libretro-common/include/streams/interface_stream.h index e58fddd590..57fa4a495a 100644 --- a/libretro-common/include/streams/interface_stream.h +++ b/libretro-common/include/streams/interface_stream.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (interface_stream.h). diff --git a/libretro-common/include/streams/memory_stream.h b/libretro-common/include/streams/memory_stream.h index 5f196ea62b..9a2aa819fd 100644 --- a/libretro-common/include/streams/memory_stream.h +++ b/libretro-common/include/streams/memory_stream.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (memory_stream.h). diff --git a/libretro-common/include/streams/trans_stream.h b/libretro-common/include/streams/trans_stream.h index 6cb7420f19..45cd522bd6 100644 --- a/libretro-common/include/streams/trans_stream.h +++ b/libretro-common/include/streams/trans_stream.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (trans_stream.h). diff --git a/libretro-common/include/string/stdstring.h b/libretro-common/include/string/stdstring.h index 8faf2ba25c..7dbb543d2d 100644 --- a/libretro-common/include/string/stdstring.h +++ b/libretro-common/include/string/stdstring.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (stdstring.h). @@ -56,6 +56,8 @@ char *string_trim_whitespace_right(char *const s); /* Remove leading and trailing whitespaces */ char *string_trim_whitespace(char *const s); +char* word_wrap(char* buffer, char* string, int line_width); + RETRO_END_DECLS #endif diff --git a/libretro-common/lists/dir_list.c b/libretro-common/lists/dir_list.c index e27e5d4c54..a2efd966d0 100644 --- a/libretro-common/lists/dir_list.c +++ b/libretro-common/lists/dir_list.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (dir_list.c). diff --git a/libretro-common/lists/file_list.c b/libretro-common/lists/file_list.c index a0bace3657..4de1f999e0 100644 --- a/libretro-common/lists/file_list.c +++ b/libretro-common/lists/file_list.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (file_list.c). diff --git a/libretro-common/lists/string_list.c b/libretro-common/lists/string_list.c index 93368c4201..bbf64f5649 100644 --- a/libretro-common/lists/string_list.c +++ b/libretro-common/lists/string_list.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (string_list.c). diff --git a/libretro-common/memmap/memalign.c b/libretro-common/memmap/memalign.c index a89a87830d..56d0c94669 100644 --- a/libretro-common/memmap/memalign.c +++ b/libretro-common/memmap/memalign.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (memalign.c). diff --git a/libretro-common/memmap/memmap.c b/libretro-common/memmap/memmap.c index c2d1a174af..a2b56d7070 100644 --- a/libretro-common/memmap/memmap.c +++ b/libretro-common/memmap/memmap.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2015 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (memmap.c). diff --git a/libretro-common/net/net_compat.c b/libretro-common/net/net_compat.c index 0976068f0b..68c0f62f96 100644 --- a/libretro-common/net/net_compat.c +++ b/libretro-common/net/net_compat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (net_compat.c). diff --git a/libretro-common/net/net_http.c b/libretro-common/net/net_http.c index 51ce3ce541..90a087d74a 100644 --- a/libretro-common/net/net_http.c +++ b/libretro-common/net/net_http.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (net_http.c). diff --git a/libretro-common/net/net_http_parse.c b/libretro-common/net/net_http_parse.c index 66ac7d927b..1c3131b9e8 100644 --- a/libretro-common/net/net_http_parse.c +++ b/libretro-common/net/net_http_parse.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (net_http_parse.c). diff --git a/libretro-common/net/net_ifinfo.c b/libretro-common/net/net_ifinfo.c index 5432f5a73d..41bf90a3e4 100644 --- a/libretro-common/net/net_ifinfo.c +++ b/libretro-common/net/net_ifinfo.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (net_ifinfo.c). @@ -71,10 +71,10 @@ bool net_ifinfo_new(net_ifinfo_t *list) { unsigned k = 0; #if defined(_WIN32) && !defined(_XBOX) + PIP_ADAPTER_ADDRESSES adapter_addresses = NULL, aa = NULL; + PIP_ADAPTER_UNICAST_ADDRESS ua = NULL; +#ifdef _WIN32_WINNT_WINXP DWORD size; - PIP_ADAPTER_ADDRESSES adapter_addresses, aa; - PIP_ADAPTER_UNICAST_ADDRESS ua; - DWORD rv = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, NULL, NULL, &size); adapter_addresses = (PIP_ADAPTER_ADDRESSES)malloc(size); @@ -85,7 +85,7 @@ bool net_ifinfo_new(net_ifinfo_t *list) if (rv != ERROR_SUCCESS) goto error; - +#endif for (aa = adapter_addresses; aa != NULL; aa = aa->Next) { char name[PATH_MAX_LENGTH]; diff --git a/libretro-common/net/net_natt.c b/libretro-common/net/net_natt.c index dc21275e7a..01e6cc94f7 100644 --- a/libretro-common/net/net_natt.c +++ b/libretro-common/net/net_natt.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2016 The RetroArch team +/* Copyright (C) 2016-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (net_natt.c). diff --git a/libretro-common/net/net_socket.c b/libretro-common/net/net_socket.c index 6d0cfdf700..796dda4188 100644 --- a/libretro-common/net/net_socket.c +++ b/libretro-common/net/net_socket.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (net_socket.c). @@ -142,6 +142,7 @@ int socket_select(int nfds, fd_set *readfs, fd_set *writefds, #if defined(__CELLOS_LV2__) return socketselect(nfds, readfs, writefds, errorfds, timeout); #elif defined(VITA) + extern int retro_epoll_fd; SceNetEpollEvent ev = {0}; ev.events = SCE_NET_EPOLLIN | SCE_NET_EPOLLHUP; diff --git a/libretro-common/queues/fifo_queue.c b/libretro-common/queues/fifo_queue.c index e763cb69cf..df132af09b 100644 --- a/libretro-common/queues/fifo_queue.c +++ b/libretro-common/queues/fifo_queue.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (fifo_queue.c). diff --git a/libretro-common/queues/message_queue.c b/libretro-common/queues/message_queue.c index 9ea7e4ce11..5c5c9cf72a 100644 --- a/libretro-common/queues/message_queue.c +++ b/libretro-common/queues/message_queue.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (message_queue.c). diff --git a/libretro-common/queues/task_queue.c b/libretro-common/queues/task_queue.c index 9e28c2588d..3ff959ce78 100644 --- a/libretro-common/queues/task_queue.c +++ b/libretro-common/queues/task_queue.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (task_queue.c). diff --git a/libretro-common/rthreads/gx_pthread.h b/libretro-common/rthreads/gx_pthread.h index b8f9d86944..8cb4616231 100644 --- a/libretro-common/rthreads/gx_pthread.h +++ b/libretro-common/rthreads/gx_pthread.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (gx_pthread.h). diff --git a/libretro-common/rthreads/psp_pthread.h b/libretro-common/rthreads/psp_pthread.h index 32b3d4d005..007aa5cb11 100644 --- a/libretro-common/rthreads/psp_pthread.h +++ b/libretro-common/rthreads/psp_pthread.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (psp_pthread.h). diff --git a/libretro-common/rthreads/rsemaphore.c b/libretro-common/rthreads/rsemaphore.c index 9627769a5b..8050e40f15 100644 --- a/libretro-common/rthreads/rsemaphore.c +++ b/libretro-common/rthreads/rsemaphore.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rsemaphore.c). diff --git a/libretro-common/rthreads/rthreads.c b/libretro-common/rthreads/rthreads.c index 1744705642..95e32a2c5e 100644 --- a/libretro-common/rthreads/rthreads.c +++ b/libretro-common/rthreads/rthreads.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rthreads.c). @@ -37,6 +37,9 @@ #include #else #define WIN32_LEAN_AND_MEAN +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0500 /*_WIN32_WINNT_WIN2K */ +#endif #include #endif #elif defined(GEKKO) diff --git a/libretro-common/rthreads/xenon_sdl_threads.c b/libretro-common/rthreads/xenon_sdl_threads.c index a99af1fb0a..0097673528 100644 --- a/libretro-common/rthreads/xenon_sdl_threads.c +++ b/libretro-common/rthreads/xenon_sdl_threads.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (xenon_sdl_threads.c). @@ -20,7 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -// libSDLxenon doesn't implement this yet :[. Implement it very stupidly for now. ;) +/* libSDLxenon doesn't implement this yet :[. Implement it very stupidly for now. ;) */ #include "SDL_thread.h" #include "SDL_mutex.h" diff --git a/libretro-common/samples/formats/png/rpng_test.c b/libretro-common/samples/formats/png/rpng_test.c index 7da75d108b..148544b8ae 100644 --- a/libretro-common/samples/formats/png/rpng_test.c +++ b/libretro-common/samples/formats/png/rpng_test.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rpng_test.c). diff --git a/libretro-common/samples/net/net_http_test.c b/libretro-common/samples/net/net_http_test.c index e6940a5373..92d1cdec0d 100644 --- a/libretro-common/samples/net/net_http_test.c +++ b/libretro-common/samples/net/net_http_test.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (net_http_test.c). diff --git a/libretro-common/samples/net/net_ifinfo_test.c b/libretro-common/samples/net/net_ifinfo_test.c index 1b825b3093..63da41472f 100644 --- a/libretro-common/samples/net/net_ifinfo_test.c +++ b/libretro-common/samples/net/net_ifinfo_test.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (net_ifinfo_test.c). diff --git a/libretro-common/streams/file_stream.c b/libretro-common/streams/file_stream.c index b3ad1dcac9..da871d5eaa 100644 --- a/libretro-common/streams/file_stream.c +++ b/libretro-common/streams/file_stream.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (file_stream.c). diff --git a/libretro-common/streams/interface_stream.c b/libretro-common/streams/interface_stream.c index a1f4b159e0..61708b1dc0 100644 --- a/libretro-common/streams/interface_stream.c +++ b/libretro-common/streams/interface_stream.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (interface_stream.c). diff --git a/libretro-common/streams/memory_stream.c b/libretro-common/streams/memory_stream.c index 6bffa3b726..31f0457895 100644 --- a/libretro-common/streams/memory_stream.c +++ b/libretro-common/streams/memory_stream.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (memory_stream.c). @@ -41,7 +41,7 @@ struct memstream static void memstream_update_pos(memstream_t *stream) { - if (stream->ptr > stream->max_ptr) + if (stream && stream->ptr > stream->max_ptr) stream->max_ptr = stream->ptr; } diff --git a/libretro-common/streams/trans_stream.c b/libretro-common/streams/trans_stream.c index d6acfa5e00..10eea457a7 100644 --- a/libretro-common/streams/trans_stream.c +++ b/libretro-common/streams/trans_stream.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (trans_stream.c). diff --git a/libretro-common/streams/trans_stream_pipe.c b/libretro-common/streams/trans_stream_pipe.c index 34ac61e4c8..f30d5df390 100644 --- a/libretro-common/streams/trans_stream_pipe.c +++ b/libretro-common/streams/trans_stream_pipe.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (trans_stream_pipe.c). diff --git a/libretro-common/streams/trans_stream_zlib.c b/libretro-common/streams/trans_stream_zlib.c index dfa9cacba3..81e3612625 100644 --- a/libretro-common/streams/trans_stream_zlib.c +++ b/libretro-common/streams/trans_stream_zlib.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (trans_stream_zlib.c). @@ -60,6 +60,8 @@ static void zlib_deflate_stream_free(void *data) static void zlib_inflate_stream_free(void *data) { struct zlib_trans_stream *z = (struct zlib_trans_stream *) data; + if (!z) + return; if (z->inited) inflateEnd(&z->z); free(z); @@ -90,8 +92,13 @@ static bool zlib_inflate_define(void *data, const char *prop, uint32_t val) static void zlib_deflate_set_in(void *data, const uint8_t *in, uint32_t in_size) { struct zlib_trans_stream *z = (struct zlib_trans_stream *) data; - z->z.next_in = (uint8_t *) in; - z->z.avail_in = in_size; + + if (!z) + return; + + z->z.next_in = (uint8_t *) in; + z->z.avail_in = in_size; + if (!z->inited) { deflateInit(&z->z, z->ex); @@ -102,8 +109,12 @@ static void zlib_deflate_set_in(void *data, const uint8_t *in, uint32_t in_size) static void zlib_inflate_set_in(void *data, const uint8_t *in, uint32_t in_size) { struct zlib_trans_stream *z = (struct zlib_trans_stream *) data; - z->z.next_in = (uint8_t *) in; - z->z.avail_in = in_size; + + if (!z) + return; + + z->z.next_in = (uint8_t *) in; + z->z.avail_in = in_size; if (!z->inited) { inflateInit2(&z->z, z->ex); @@ -114,8 +125,12 @@ static void zlib_inflate_set_in(void *data, const uint8_t *in, uint32_t in_size) static void zlib_set_out(void *data, uint8_t *out, uint32_t out_size) { struct zlib_trans_stream *z = (struct zlib_trans_stream *) data; - z->z.next_out = out; - z->z.avail_out = out_size; + + if (!z) + return; + + z->z.next_out = out; + z->z.avail_out = out_size; } static bool zlib_deflate_trans( diff --git a/libretro-common/string/stdstring.c b/libretro-common/string/stdstring.c index e0c630afdd..7cd05e8b14 100644 --- a/libretro-common/string/stdstring.c +++ b/libretro-common/string/stdstring.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (stdstring.c). @@ -164,3 +164,55 @@ char *string_trim_whitespace(char *const s) return s; } + +char* word_wrap(char* buffer, char* string, int line_width) +{ + unsigned i = 0; + int k, counter; + + while(i < strlen(string)) + { + /* copy string until the end of the line is reached */ + for (counter = 1; counter <= line_width; counter++) + { + /* check if end of string reached */ + if (i == strlen(string)) + { + buffer[i] = 0; + return buffer; + } + + buffer[i] = string[i]; + + /* check for newlines embedded in the original input + * and reset the index */ + if (buffer[i] == '\n') + counter = 1; + i++; + } + /* check for whitespace */ + if (string[i] == ' ') + { + buffer[i] = '\n'; + i++; + } + else + { + /* check for nearest whitespace back in string */ + for (k = i; k > 0; k--) + { + if (string[k] == ' ') + { + buffer[k] = '\n'; + /* set string index back to character after this one */ + i = k + 1; + break; + } + } + } + } + + buffer[i] = 0; + + return buffer; +} diff --git a/libretro-common/utils/md5.c b/libretro-common/utils/md5.c index 3208f1d65b..34b3a7e3a1 100644 --- a/libretro-common/utils/md5.c +++ b/libretro-common/utils/md5.c @@ -217,24 +217,27 @@ void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size) used = saved_lo & 0x3f; - if (used) { - available = 64 - used; + if (used) + { + available = 64 - used; - if (size < available) { - memcpy(&ctx->buffer[used], data, size); - return; - } + if (size < available) + { + memcpy(&ctx->buffer[used], data, size); + return; + } - memcpy(&ctx->buffer[used], data, available); - data = (const unsigned char *)data + available; - size -= available; - MD5_body(ctx, ctx->buffer, 64); - } + memcpy(&ctx->buffer[used], data, available); + data = (const unsigned char *)data + available; + size -= available; + MD5_body(ctx, ctx->buffer, 64); + } - if (size >= 64) { - data = MD5_body(ctx, data, size & ~(unsigned long)0x3f); - size &= 0x3f; - } + if (size >= 64) + { + data = MD5_body(ctx, data, size & ~(unsigned long)0x3f); + size &= 0x3f; + } memcpy(ctx->buffer, data, size); } @@ -249,12 +252,13 @@ void MD5_Final(unsigned char *result, MD5_CTX *ctx) available = 64 - used; - if (available < 8) { - memset(&ctx->buffer[used], 0, available); - MD5_body(ctx, ctx->buffer, 64); - used = 0; - available = 64; - } + if (available < 8) + { + memset(&ctx->buffer[used], 0, available); + MD5_body(ctx, ctx->buffer, 64); + used = 0; + available = 64; + } memset(&ctx->buffer[used], 0, available - 8); diff --git a/libretro-db/bintree.c b/libretro-db/bintree.c index 8902325c6b..b080aa4f55 100644 --- a/libretro-db/bintree.c +++ b/libretro-db/bintree.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (bintree.c). diff --git a/libretro-db/bintree.h b/libretro-db/bintree.h index 2b6e00d788..586714ac47 100644 --- a/libretro-db/bintree.h +++ b/libretro-db/bintree.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (bintree.h). diff --git a/libretro-db/c_converter.c b/libretro-db/c_converter.c index 7876e0d10d..7d09ba8867 100644 --- a/libretro-db/c_converter.c +++ b/libretro-db/c_converter.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (c_converter.c). diff --git a/libretro-db/libretrodb.c b/libretro-db/libretrodb.c index 8db5917d13..c39663db2f 100644 --- a/libretro-db/libretrodb.c +++ b/libretro-db/libretrodb.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (libretrodb.c). @@ -464,8 +464,8 @@ int libretrodb_create_index(libretrodb_t *db, struct node_iter_ctx nictx; struct rmsgpack_dom_value key; libretrodb_index_t idx; - uint64_t idx_header_offset; struct rmsgpack_dom_value item; + uint64_t idx_header_offset = 0; libretrodb_cursor_t cur = {0}; struct rmsgpack_dom_value *field = NULL; void *buff = NULL; @@ -474,15 +474,14 @@ int libretrodb_create_index(libretrodb_t *db, uint64_t item_loc = libretrodb_tell(db); bintree_t *tree = bintree_new(node_compare, &field_size); + item.type = RDT_NULL; + if (!tree || (libretrodb_cursor_open(db, &cur, NULL) != 0)) goto clean; - key.type = RDT_STRING; - key.val.string.len = strlen(field_name); - - /* We know we aren't going to change it */ - key.val.string.buff = (char *) field_name; - item.type = RDT_NULL; + key.type = RDT_STRING; + key.val.string.len = strlen(field_name); + key.val.string.buff = (char *) field_name; /* We know we aren't going to change it */ while (libretrodb_cursor_read_item(&cur, &item) == 0) { @@ -522,9 +521,7 @@ int libretrodb_create_index(libretrodb_t *db, buff = malloc(field_size + sizeof(uint64_t)); if (!buff) - { goto clean; - } memcpy(buff, field->val.binary.buff, field_size); @@ -539,7 +536,7 @@ int libretrodb_create_index(libretrodb_t *db, printf("\n"); goto clean; } - buff = NULL; + buff = NULL; rmsgpack_dom_value_free(&item); item_loc = libretrodb_tell(db); } @@ -552,10 +549,10 @@ int libretrodb_create_index(libretrodb_t *db, idx.name[49] = '\0'; idx.key_size = field_size; - idx.next = db->count * (field_size + sizeof(uint64_t)); + idx.next = db->count * (field_size + sizeof(uint64_t)); libretrodb_write_index_header(db->fd, &idx); - nictx.db = db; + nictx.db = db; nictx.idx = &idx; bintree_iterate(tree, node_iter, &nictx); diff --git a/libretro-db/libretrodb.h b/libretro-db/libretrodb.h index 8bc442211a..5b8775e33a 100644 --- a/libretro-db/libretrodb.h +++ b/libretro-db/libretrodb.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (libretrodb.h). diff --git a/libretro-db/libretrodb_tool.c b/libretro-db/libretrodb_tool.c index e8b5ed5f69..8dcd88abe7 100644 --- a/libretro-db/libretrodb_tool.c +++ b/libretro-db/libretrodb_tool.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (libretrodb_tool.c). diff --git a/libretro-db/query.c b/libretro-db/query.c index 27dccd5ff4..675f111c06 100644 --- a/libretro-db/query.c +++ b/libretro-db/query.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (query.c). diff --git a/libretro-db/query.h b/libretro-db/query.h index 9a583bc280..5a457a0cac 100644 --- a/libretro-db/query.h +++ b/libretro-db/query.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (query.h). diff --git a/libretro-db/rmsgpack.c b/libretro-db/rmsgpack.c index dfac0c448a..816fb4aee5 100644 --- a/libretro-db/rmsgpack.c +++ b/libretro-db/rmsgpack.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rmsgpack.c). diff --git a/libretro-db/rmsgpack.h b/libretro-db/rmsgpack.h index 2cb803fe1a..a3ffdcaffe 100644 --- a/libretro-db/rmsgpack.h +++ b/libretro-db/rmsgpack.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rmsgpack.h). diff --git a/libretro-db/rmsgpack_dom.c b/libretro-db/rmsgpack_dom.c index b1add50697..0cff0464ab 100644 --- a/libretro-db/rmsgpack_dom.c +++ b/libretro-db/rmsgpack_dom.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rmsgpack_dom.c). diff --git a/libretro-db/rmsgpack_dom.h b/libretro-db/rmsgpack_dom.h index 580a077d20..5a8d7c16d4 100644 --- a/libretro-db/rmsgpack_dom.h +++ b/libretro-db/rmsgpack_dom.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rmsgpack_dom.h). diff --git a/libretro-db/rmsgpack_test.c b/libretro-db/rmsgpack_test.c index 112f170d40..2e7f7d0d3a 100644 --- a/libretro-db/rmsgpack_test.c +++ b/libretro-db/rmsgpack_test.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team +/* Copyright (C) 2010-2017 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (rmsgpack_test.c). diff --git a/location/drivers/android.c b/location/drivers/android.c index 9c9fdd5b93..e50b98e2d0 100644 --- a/location/drivers/android.c +++ b/location/drivers/android.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/location/drivers/nulllocation.c b/location/drivers/nulllocation.c index a6a236f101..b2f2f0a9ad 100644 --- a/location/drivers/nulllocation.c +++ b/location/drivers/nulllocation.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/location/location_driver.c b/location/location_driver.c index 88baefea74..db4ab79348 100644 --- a/location/location_driver.c +++ b/location/location_driver.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/location/location_driver.h b/location/location_driver.h index fe14d5f738..b38782f3c2 100644 --- a/location/location_driver.h +++ b/location/location_driver.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2015 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/managers/cheat_manager.c b/managers/cheat_manager.c index 4c5aa92f6f..5740449e00 100644 --- a/managers/cheat_manager.c +++ b/managers/cheat_manager.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -23,6 +23,7 @@ #include #include #include +#include #ifdef HAVE_CONFIG_H #include "../config.h" @@ -33,7 +34,8 @@ #endif #include "cheat_manager.h" -#include "../configuration.h" + +#include "../msg_hash.h" #include "../runloop.h" #include "../dynamic.h" #include "../core.h" @@ -127,20 +129,18 @@ void cheat_manager_set_code(unsigned i, const char *str) * * Returns: true (1) if successful, otherwise false (0). **/ -bool cheat_manager_save(const char *path) +bool cheat_manager_save(const char *path, const char *cheat_database) { bool ret; unsigned i; char buf[PATH_MAX_LENGTH]; char cheats_file[PATH_MAX_LENGTH]; config_file_t *conf = NULL; - settings_t *settings = config_get_ptr(); cheat_manager_t *handle = cheat_manager_state; buf[0] = cheats_file[0] = '\0'; - fill_pathname_join(buf, settings->path.cheat_database, - path, sizeof(buf)); + fill_pathname_join(buf, cheat_database, path, sizeof(buf)); fill_pathname_noext(cheats_file, buf, ".cht", sizeof(cheats_file)); diff --git a/managers/cheat_manager.h b/managers/cheat_manager.h index 61ec66c5f9..a6e77816f2 100644 --- a/managers/cheat_manager.h +++ b/managers/cheat_manager.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -36,7 +36,7 @@ bool cheat_manager_load(const char *path); * * Returns: true (1) if successful, otherwise false (0). **/ -bool cheat_manager_save(const char *path); +bool cheat_manager_save(const char *path, const char *cheat_database); bool cheat_manager_realloc(unsigned new_size); diff --git a/managers/core_option_manager.c b/managers/core_option_manager.c index 4c7b418418..40027dabcc 100644 --- a/managers/core_option_manager.c +++ b/managers/core_option_manager.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -164,7 +164,7 @@ core_option_manager_t *core_option_manager_new(const char *conf_path, if (!opt) return NULL; - if (*conf_path) + if (!string_is_empty(conf_path)) opt->conf = config_file_new(conf_path); if (!opt->conf) opt->conf = config_file_new(NULL); diff --git a/managers/core_option_manager.h b/managers/core_option_manager.h index 46929df1f8..f9594500dd 100644 --- a/managers/core_option_manager.h +++ b/managers/core_option_manager.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -21,7 +21,7 @@ #include #include -#include "lists/string_list.h" +#include RETRO_BEGIN_DECLS diff --git a/managers/state_manager.c b/managers/state_manager.c index 48a06fce99..cd98f932fb 100644 --- a/managers/state_manager.c +++ b/managers/state_manager.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2015 - Alfred Agrell + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Alfred Agrell * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -23,7 +23,6 @@ #include #include "state_manager.h" -#include "../configuration.h" #include "../msg_hash.h" #include "../movie.h" #include "../core.h" @@ -383,6 +382,7 @@ static bool state_manager_pop(state_manager_t *state, const void **data) return true; } + *data = state->thisblock; if (state->head == state->tail) return false; @@ -396,7 +396,6 @@ static bool state_manager_pop(state_manager_t *state, const void **data) state->maxcompsize, out, state->blocksize); state->entries--; - *data = state->thisblock; return true; } @@ -504,12 +503,11 @@ static void state_manager_capacity(state_manager_t *state, } #endif -void state_manager_event_init(void) +void state_manager_event_init(unsigned rewind_buffer_size) { retro_ctx_serialize_info_t serial_info; retro_ctx_size_info_t info; void *state = NULL; - settings_t *settings = config_get_ptr(); if (rewind_state.state) return; @@ -533,10 +531,10 @@ void state_manager_event_init(void) RARCH_LOG("%s: %u MB\n", msg_hash_to_str(MSG_REWIND_INIT), - (unsigned)(settings->rewind_buffer_size / 1000000)); + (unsigned)(rewind_buffer_size / 1000000)); rewind_state.state = state_manager_new(rewind_state.size, - settings->rewind_buffer_size); + rewind_buffer_size); if (!rewind_state.state) RARCH_WARN("%s.\n", msg_hash_to_str(MSG_REWIND_INIT_FAILED)); @@ -579,7 +577,8 @@ void state_manager_event_deinit(void) * * Checks if rewind toggle/hold was being pressed and/or held. **/ -void state_manager_check_rewind(bool pressed) +void state_manager_check_rewind(bool pressed, + unsigned rewind_granularity, bool is_paused) { static bool first = true; @@ -612,8 +611,7 @@ void state_manager_check_rewind(bool pressed) runloop_msg_queue_push( msg_hash_to_str(MSG_REWINDING), 0, - runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL) - ? 1 : 30, true); + is_paused ? 1 : 30, true); serial_info.data_const = buf; serial_info.size = rewind_state.size; @@ -624,17 +622,22 @@ void state_manager_check_rewind(bool pressed) bsv_movie_ctl(BSV_MOVIE_CTL_FRAME_REWIND, NULL); } else + { + retro_ctx_serialize_info_t serial_info; + serial_info.data_const = buf; + serial_info.size = rewind_state.size; + core_unserialize(&serial_info); runloop_msg_queue_push( msg_hash_to_str(MSG_REWIND_REACHED_END), 0, 30, true); + } } else { static unsigned cnt = 0; - settings_t *settings = config_get_ptr(); - cnt = (cnt + 1) % (settings->rewind_granularity ? - settings->rewind_granularity : 1); /* Avoid possible SIGFPE. */ + cnt = (cnt + 1) % (rewind_granularity ? + rewind_granularity : 1); /* Avoid possible SIGFPE. */ if ((cnt == 0) || bsv_movie_ctl(BSV_MOVIE_CTL_IS_INITED, NULL)) { diff --git a/managers/state_manager.h b/managers/state_manager.h index 934d6d0b50..c980dad906 100644 --- a/managers/state_manager.h +++ b/managers/state_manager.h @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2015 - Alfred Agrell + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Alfred Agrell * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -32,7 +32,7 @@ bool state_manager_frame_is_reversed(void); void state_manager_event_deinit(void); -void state_manager_event_init(void); +void state_manager_event_init(unsigned rewind_buffer_size); /** * check_rewind: @@ -40,7 +40,7 @@ void state_manager_event_init(void); * * Checks if rewind toggle/hold was being pressed and/or held. **/ -void state_manager_check_rewind(bool pressed); +void state_manager_check_rewind(bool pressed, unsigned rewind_granularity, bool is_paused); RETRO_END_DECLS diff --git a/media/rarch.rc b/media/rarch.rc index 57758d4aec..5bad253138 100644 --- a/media/rarch.rc +++ b/media/rarch.rc @@ -69,7 +69,8 @@ IDR_MENU MENU MENUITEM "10x", ID_M_WINDOW_SCALE_10X } MENUITEM "Toggle Exclusive Full Screen", ID_M_FULL_SCREEN - MENUITEM "Shader Parameters", ID_M_SHADER_PARAMETERS + // Shader dialog is disabled for now, until video_threaded issues are fixed. + //MENUITEM "Shader Parameters", ID_M_SHADER_PARAMETERS } } diff --git a/media/rarch_ja.rc b/media/rarch_ja.rc index d479e651ad..45f5423ba5 100644 --- a/media/rarch_ja.rc +++ b/media/rarch_ja.rc @@ -65,7 +65,8 @@ IDR_MENU MENU MENUITEM "10x", ID_M_WINDOW_SCALE_10X } MENUITEM "rIȃtXN[؂ւ", ID_M_FULL_SCREEN - MENUITEM "VF[_[̃p[^", ID_M_SHADER_PARAMETERS + // Shader dialog is disabled for now, until video_threaded issues are fixed. + //MENUITEM "VF[_[̃p[^", ID_M_SHADER_PARAMETERS } } diff --git a/menu/cbs/menu_cbs_cancel.c b/menu/cbs/menu_cbs_cancel.c index 39d55c7f4c..f38d5e7a73 100644 --- a/menu/cbs/menu_cbs_cancel.c +++ b/menu/cbs/menu_cbs_cancel.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/cbs/menu_cbs_contentlist_switch.c b/menu/cbs/menu_cbs_contentlist_switch.c index 47c3cfb5f5..eace71ee93 100644 --- a/menu/cbs/menu_cbs_contentlist_switch.c +++ b/menu/cbs/menu_cbs_contentlist_switch.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index feec5a0721..47067720b1 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/cbs/menu_cbs_down.c b/menu/cbs/menu_cbs_down.c index 03a6df332f..f2a4a26f51 100644 --- a/menu/cbs/menu_cbs_down.c +++ b/menu/cbs/menu_cbs_down.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 6c7b67e807..8b19634b7a 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/cbs/menu_cbs_info.c b/menu/cbs/menu_cbs_info.c index a92f34a906..4ba6df94e7 100644 --- a/menu/cbs/menu_cbs_info.c +++ b/menu/cbs/menu_cbs_info.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/cbs/menu_cbs_label.c b/menu/cbs/menu_cbs_label.c index 64ab226e78..5544e21ea7 100644 --- a/menu/cbs/menu_cbs_label.c +++ b/menu/cbs/menu_cbs_label.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 3a139c101b..57f2b9bf6b 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2015 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -487,6 +487,7 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs, string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) || + string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_IMAGES_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_TAB)) || @@ -586,6 +587,7 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs, if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) || + string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_IMAGES_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_TAB)) || @@ -625,6 +627,7 @@ int menu_cbs_init_bind_left(menu_file_list_cbs_t *cbs, if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) || + string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_IMAGES_TAB)) || diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index cda27b8068..723a970153 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -97,12 +97,13 @@ unsigned rpl_entry_selection_ptr = 0; unsigned rdb_entry_start_game_selection_ptr = 0; size_t hack_shader_pass = 0; -#ifdef HAVE_NETWORKING /* HACK - we have to find some way to pass state inbetween * function pointer callback functions that don't necessarily * call each other. */ -char *core_buf; -size_t core_len; +char *core_buf = NULL; +size_t core_len = 0; + +#ifdef HAVE_NETWORKING #ifdef HAVE_LAKKA static char lakka_project[128]; @@ -1371,8 +1372,6 @@ static int action_ok_playlist_entry_collection(const char *path, core_info_ctx_find_t core_info; char new_display_name[PATH_MAX_LENGTH]; const char *entry_path = NULL; - const char *entry_crc32 = NULL; - const char *db_name = NULL; const char *path_base = path_basename(menu->db_playlist_file); bool found_associated_core = @@ -1389,6 +1388,8 @@ static int action_ok_playlist_entry_collection(const char *path, if (!found_associated_core) { + /* TODO: figure out if this should refer to the inner or outer entry_path */ + /* TODO: make sure there's only one entry_path in this function */ int ret = action_ok_file_load_with_detect_core_collection(entry_path, label, type, selection_ptr, entry_idx); if (playlist_initialized) @@ -1398,19 +1399,16 @@ static int action_ok_playlist_entry_collection(const char *path, menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &tmp_playlist); - playlist_get_index(tmp_playlist, selection_ptr, - &entry_path, &entry_label, NULL, NULL, &entry_crc32, &db_name); - strlcpy(new_display_name, core_info.inf->display_name, sizeof(new_display_name)); playlist_update(tmp_playlist, selection_ptr, - entry_path, - entry_label, + NULL, + NULL, new_core_path, new_display_name, - entry_crc32, - db_name); + NULL, + NULL); playlist_write_file(tmp_playlist); } else @@ -1431,7 +1429,7 @@ static int action_ok_playlist_entry_collection(const char *path, playlist_info.idx, &path, NULL, NULL, NULL, NULL, NULL); return generic_action_ok_file_load(new_core_path, path, - action_type, content_enum_idx); + action_type, content_enum_idx); } static int action_ok_playlist_entry(const char *path, @@ -1442,7 +1440,6 @@ static int action_ok_playlist_entry(const char *path, size_t selection_ptr = 0; playlist_t *playlist = g_defaults.content_history; const char *entry_path = NULL; - const char *entry_label = NULL; const char *core_path = NULL; const char *core_name = NULL; playlist_t *tmp_playlist = NULL; @@ -1456,7 +1453,7 @@ static int action_ok_playlist_entry(const char *path, selection_ptr = entry_idx; playlist_get_index(playlist, selection_ptr, - &entry_path, &entry_label, &core_path, &core_name, NULL, NULL); + &entry_path, NULL, &core_path, &core_name, NULL, NULL); if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT)) && string_is_equal(core_name, file_path_str(FILE_PATH_DETECT))) @@ -1465,9 +1462,7 @@ static int action_ok_playlist_entry(const char *path, char new_core_path[PATH_MAX_LENGTH]; char new_display_name[PATH_MAX_LENGTH]; const char *entry_path = NULL; - const char *entry_crc32 = NULL; - const char *db_name = NULL; - const char *path_base = + const char *path_base = path_basename(menu->db_playlist_file); bool found_associated_core = false; @@ -1484,24 +1479,23 @@ static int action_ok_playlist_entry(const char *path, found_associated_core = false; if (!found_associated_core) - return action_ok_file_load_with_detect_core(entry_path, + /* TODO: figure out if this should refer to the inner or outer entry_path */ + /* TODO: make sure there's only one entry_path in this function */ + return action_ok_file_load_with_detect_core(entry_path, label, type, selection_ptr, entry_idx); menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &tmp_playlist); - playlist_get_index(tmp_playlist, selection_ptr, - &entry_path, &entry_label, NULL, NULL, &entry_crc32, &db_name); - strlcpy(new_display_name, core_info.inf->display_name, sizeof(new_display_name)); playlist_update(tmp_playlist, selection_ptr, - entry_path, - entry_label, + NULL, + NULL, new_core_path, new_display_name, - entry_crc32, - db_name); + NULL, + NULL); playlist_write_file(tmp_playlist); } @@ -1530,7 +1524,6 @@ static int action_ok_playlist_entry_start_content(const char *path, bool playlist_initialized = false; playlist_t *playlist = NULL; const char *entry_path = NULL; - const char *entry_label = NULL; const char *core_path = NULL; const char *core_name = NULL; playlist_t *tmp_playlist = NULL; @@ -1557,7 +1550,7 @@ static int action_ok_playlist_entry_start_content(const char *path, selection_ptr = rdb_entry_start_game_selection_ptr; playlist_get_index(playlist, selection_ptr, - &entry_path, &entry_label, &core_path, &core_name, NULL, NULL); + &entry_path, NULL, &core_path, &core_name, NULL, NULL); if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT)) && string_is_equal(core_name, file_path_str(FILE_PATH_DETECT))) @@ -1566,8 +1559,6 @@ static int action_ok_playlist_entry_start_content(const char *path, char new_core_path[PATH_MAX_LENGTH]; char new_display_name[PATH_MAX_LENGTH]; const char *entry_path = NULL; - const char *entry_crc32 = NULL; - const char *db_name = NULL; const char *path_base = path_basename(menu->db_playlist_file); bool found_associated_core = false; @@ -1586,7 +1577,9 @@ static int action_ok_playlist_entry_start_content(const char *path, if (!found_associated_core) { - int ret = action_ok_file_load_with_detect_core(entry_path, + /* TODO: figure out if this should refer to the inner or outer entry_path */ + /* TODO: make sure there's only one entry_path in this function */ + int ret = action_ok_file_load_with_detect_core(entry_path, label, type, selection_ptr, entry_idx); if (playlist_initialized) playlist_free(tmp_playlist); @@ -1595,19 +1588,16 @@ static int action_ok_playlist_entry_start_content(const char *path, menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &tmp_playlist); - playlist_get_index(tmp_playlist, selection_ptr, - &entry_path, &entry_label, NULL, NULL, &entry_crc32, &db_name); - strlcpy(new_display_name, core_info.inf->display_name, sizeof(new_display_name)); playlist_update(tmp_playlist, selection_ptr, - entry_path, - entry_label, + NULL, + NULL, new_core_path, new_display_name, - entry_crc32, - db_name); + NULL, + NULL); playlist_write_file(tmp_playlist); } @@ -1904,6 +1894,7 @@ static void menu_input_st_string_cb_cheat_file_save_as( if (str && *str) { rarch_setting_t *setting = NULL; + settings_t *settings = config_get_ptr(); const char *label = menu_input_dialog_get_label_buffer(); if (!string_is_empty(label)) @@ -1915,7 +1906,7 @@ static void menu_input_st_string_cb_cheat_file_save_as( menu_setting_generic(setting, false); } else if (!string_is_empty(label)) - cheat_manager_save(str); + cheat_manager_save(str, settings->path.cheat_database); } menu_input_dialog_end(); @@ -2036,10 +2027,6 @@ static int action_ok_core_deferred_set(const char *path, { size_t selection; char core_display_name[PATH_MAX_LENGTH]; - const char *entry_path = NULL; - const char *entry_label = NULL; - const char *entry_crc32 = NULL; - const char *db_name = NULL; playlist_t *playlist = NULL; core_display_name[0] = '\0'; @@ -2055,14 +2042,11 @@ static int action_ok_core_deferred_set(const char *path, idx = rdb_entry_start_game_selection_ptr; - playlist_get_index(playlist, idx, - &entry_path, &entry_label, NULL, NULL, &entry_crc32, &db_name); - playlist_update(playlist, idx, - entry_path, entry_label, - path , core_display_name, - entry_crc32, - db_name); + NULL, NULL, + path, core_display_name, + NULL, + NULL); playlist_write_file(playlist); @@ -2077,10 +2061,6 @@ static int action_ok_core_deferred_set_current_core(const char *path, { size_t selection; char core_display_name[PATH_MAX_LENGTH]; - const char *entry_path = NULL; - const char *entry_label = NULL; - const char *entry_crc32 = NULL; - const char *db_name = NULL; playlist_t *playlist = NULL; core_display_name[0] = '\0'; @@ -2096,14 +2076,11 @@ static int action_ok_core_deferred_set_current_core(const char *path, idx = rdb_entry_start_game_selection_ptr; - playlist_get_index(playlist, idx, - &entry_path, &entry_label, NULL, NULL, &entry_crc32, &db_name); - playlist_update(playlist, idx, - entry_path, entry_label, - path , core_display_name, - entry_crc32, - db_name); + NULL, NULL, + path, core_display_name, + NULL, + NULL); playlist_write_file(playlist); @@ -3140,6 +3117,40 @@ static int action_ok_netplay_lan_scan_list(const char *path, entry_idx, ACTION_OK_DL_NETPLAY_LAN_SCAN_SETTINGS_LIST); } +static int action_ok_netplay_connect_room(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ +#ifdef HAVE_NETWORKING + char tmp_hostname[512]; + + tmp_hostname[0] = '\0'; + + if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL)) + command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); + netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL); + + snprintf(tmp_hostname, + sizeof(tmp_hostname), + "%s:%d", + netplay_room_list[idx - 1].address, + netplay_room_list[idx - 1].port); + + RARCH_LOG("Connecting to: %s with game: %s/%08x\n", + netplay_room_list[idx - 1].address, + netplay_room_list[idx - 1].gamename, + netplay_room_list[idx - 1].gamecrc); + + task_push_netplay_crc_scan(netplay_room_list[idx - 1].gamecrc, + netplay_room_list[idx - 1].gamename, + tmp_hostname, netplay_room_list[idx - 1].corename); + +#else + return -1; + +#endif + return 0; +} + static int action_ok_lakka_services(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -3196,8 +3207,8 @@ static int action_ok_netplay_lan_scan(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { #ifdef HAVE_NETWORKING - struct netplay_host_list *hosts; - struct netplay_host *host; + struct netplay_host_list *hosts = NULL; + struct netplay_host *host = NULL; /* Figure out what host we're connecting to */ if (!netplay_discovery_driver_ctl(RARCH_NETPLAY_DISCOVERY_CTL_LAN_GET_RESPONSES, &hosts)) @@ -3287,6 +3298,8 @@ static int action_ok_push_content_list(const char *path, entry_idx, ACTION_OK_DL_CONTENT_LIST); } + + static int action_ok_push_scan_file(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -3294,6 +3307,149 @@ static int action_ok_push_scan_file(const char *path, return action_ok_push_content_list(path, label, type, idx, entry_idx); } +#ifdef HAVE_NETWORKING +static void netplay_refresh_rooms_cb(void *task_data, void *user_data, const char *err) +{ + char buf[PATH_MAX_LENGTH]; + + http_transfer_data_t *data = (http_transfer_data_t*)task_data; + + buf[0] = '\0'; + + if (!data || err) + goto finish; + + if (data) + { + if (data->data) + memcpy(buf, data->data, data->len * sizeof(char)); + buf[data->len] = '\0'; + } + +finish: + if (!err && !strstr(buf, file_path_str(FILE_PATH_NETPLAY_ROOM_LIST_URL))) + { + if (string_is_empty(buf)) + { + netplay_room_count = 0; + RARCH_LOG("Room list empty\n"); + } + else + { + int i, j = 0; + char s[PATH_MAX_LENGTH]; + static struct string_list *room_data = NULL; + file_list_t *file_list = menu_entries_get_selection_buf_ptr(0); + + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, file_list); + + room_data = string_split(buf, "\n"); + + if (netplay_room_list) + free(netplay_room_list); + + netplay_room_count = room_data->size / 8; + netplay_room_list = (struct netplay_room*) + malloc(sizeof(struct netplay_room) * netplay_room_count); + +#if 0 + for (int i = 0; i < room_data->size; i++) + { + strlcpy(tmp, + room_data->elems[i].data, sizeof(tmp)); + RARCH_LOG("tmp %s\n", tmp); + + } +#endif + menu_entries_append_enum(file_list, + "Refresh Room List", + msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS), + MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS, + MENU_SETTING_ACTION, 0, 0); + + RARCH_LOG ("Found %d rooms\n", netplay_room_count); + for (i = 0; i < netplay_room_count; i++) + { + strlcpy(netplay_room_list[i].nickname, + room_data->elems[j + 0].data, + sizeof(netplay_room_list[i].nickname)); + strlcpy(netplay_room_list[i].address, + room_data->elems[j + 1].data, + sizeof(netplay_room_list[i].address)); + strlcpy(netplay_room_list[i].corename, + room_data->elems[j + 3].data, + sizeof(netplay_room_list[i].corename)); + strlcpy(netplay_room_list[i].coreversion, + room_data->elems[j + 4].data, + sizeof(netplay_room_list[i].coreversion)); + strlcpy(netplay_room_list[i].gamename, + room_data->elems[j + 5].data, + sizeof(netplay_room_list[i].coreversion)); + + netplay_room_list[i].port = atoi(room_data->elems[j + 2].data); + netplay_room_list[i].gamecrc = atoi(room_data->elems[j + 6].data); + netplay_room_list[i].timestamp = atoi(room_data->elems[j + 7].data); + +/* Uncomment this to debug mismatched room parameters*/ +#if 0 + RARCH_LOG("Room Data: %d\n" + "Nickname: %s\n" + "Address: %s\n" + "Port: %d\n" + "Core: %s\n" + "Core Version: %s\n" + "Game: %s\n" + "Game CRC: %08x\n" + "Timestamp: %d\n", room_data->elems[j + 6].data, + netplay_room_list[i].nickname, + netplay_room_list[i].address, + netplay_room_list[i].port, + netplay_room_list[i].corename, + netplay_room_list[i].coreversion, + netplay_room_list[i].gamename, + netplay_room_list[i].gamecrc, + netplay_room_list[i].timestamp); +#endif + j+=8; + + snprintf(s, sizeof(s), "Nickname: %s", + netplay_room_list[i].nickname); + + menu_entries_append_enum(file_list, + s, + msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM), + MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM, + MENU_WIFI, 0, 0); + + } + } + } + + if (err) + RARCH_ERR("%s: %s\n", msg_hash_to_str(MSG_DOWNLOAD_FAILED), err); + + if (data) + { + if (data->data) + free(data->data); + free(data); + } + + if (user_data) + free(user_data); + +} + +static int action_ok_push_netplay_refresh_rooms(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + char url [2048] = "http://lobby.libretro.com/raw/"; + task_push_http_transfer(url, true, NULL, netplay_refresh_rooms_cb, NULL); + return 0; +} +#endif + + static int action_ok_scan_directory_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -3804,7 +3960,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, first_char = atoi(&str[0]); - if (first_char != (i+1)) + if (first_char != ((i+1))) continue; BIND_ACTION_OK(cbs, action_ok_push_user_binds_list); @@ -4017,6 +4173,11 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_SCAN_FILE: BIND_ACTION_OK(cbs, action_ok_push_scan_file); break; +#ifdef HAVE_NETWORKING + case MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS: + BIND_ACTION_OK(cbs, action_ok_push_netplay_refresh_rooms); + break; +#endif case MENU_ENUM_LABEL_FAVORITES: BIND_ACTION_OK(cbs, action_ok_push_content_list); break; @@ -4121,6 +4282,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_NETPLAY_LAN_SCAN_SETTINGS: BIND_ACTION_OK(cbs, action_ok_netplay_lan_scan_list); break; + case MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM: + BIND_ACTION_OK(cbs, action_ok_netplay_connect_room); + break; case MENU_ENUM_LABEL_LAKKA_SERVICES: BIND_ACTION_OK(cbs, action_ok_lakka_services); break; diff --git a/menu/cbs/menu_cbs_refresh.c b/menu/cbs/menu_cbs_refresh.c index 0ee968c3da..e57fd25a34 100644 --- a/menu/cbs/menu_cbs_refresh.c +++ b/menu/cbs/menu_cbs_refresh.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 92f2d02912..fa8494ea14 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -474,6 +474,7 @@ static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs, if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) || + string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_IMAGES_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_TAB)) || @@ -594,6 +595,7 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs, if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) || + string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_IMAGES_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_TAB)) || @@ -632,6 +634,7 @@ int menu_cbs_init_bind_right(menu_file_list_cbs_t *cbs, if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) || + string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_IMAGES_TAB)) || diff --git a/menu/cbs/menu_cbs_scan.c b/menu/cbs/menu_cbs_scan.c index 12b89cefd6..90e82faf1a 100644 --- a/menu/cbs/menu_cbs_scan.c +++ b/menu/cbs/menu_cbs_scan.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -54,6 +54,7 @@ int action_scan_file(const char *path, const char *menu_label = NULL; const char *menu_path = NULL; menu_handle_t *menu = NULL; + settings_t *settings = config_get_ptr(); fullpath[0] = '\0'; @@ -64,7 +65,10 @@ int action_scan_file(const char *path, fill_pathname_join(fullpath, menu_path, path, sizeof(fullpath)); - task_push_dbscan(fullpath, false, handle_dbscan_finished); + task_push_dbscan( + settings->directory.playlist, + settings->path.content_database, + fullpath, false, handle_dbscan_finished); return 0; } @@ -77,6 +81,7 @@ int action_scan_directory(const char *path, const char *menu_label = NULL; const char *menu_path = NULL; menu_handle_t *menu = NULL; + settings_t *settings = config_get_ptr(); fullpath[0] = '\0'; @@ -90,7 +95,10 @@ int action_scan_directory(const char *path, if (path) fill_pathname_join(fullpath, fullpath, path, sizeof(fullpath)); - task_push_dbscan(fullpath, true, handle_dbscan_finished); + task_push_dbscan( + settings->directory.playlist, + settings->path.content_database, + fullpath, true, handle_dbscan_finished); return 0; } diff --git a/menu/cbs/menu_cbs_select.c b/menu/cbs/menu_cbs_select.c index a3fd587761..a6fd4b8ce5 100644 --- a/menu/cbs/menu_cbs_select.c +++ b/menu/cbs/menu_cbs_select.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/cbs/menu_cbs_start.c b/menu/cbs/menu_cbs_start.c index c517d94716..0cb658ed75 100644 --- a/menu/cbs/menu_cbs_start.c +++ b/menu/cbs/menu_cbs_start.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 4544e51cfe..c065abce9c 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -21,6 +21,7 @@ #ifdef HAVE_CHEEVOS #include "../../cheevos.h" #endif +#include "../../verbosity.h" #ifndef BIND_ACTION_SUBLABEL #define BIND_ACTION_SUBLABEL(cbs, name) \ @@ -28,6 +29,11 @@ cbs->action_sublabel_ident = #name; #endif +#ifdef HAVE_NETWORKING +#include "../../network/netplay/netplay.h" +#include "../../network/netplay/netplay_discovery.h" +#endif + #define default_sublabel_macro(func_name, lbl) \ static int (func_name)(file_list_t *list, unsigned type, unsigned i, const char *label, const char *path, char *s, size_t len) \ { \ @@ -117,6 +123,8 @@ default_sublabel_macro(action_bind_sublabel_content_history_size, MENU_ default_sublabel_macro(action_bind_sublabel_menu_input_unified_controls, MENU_ENUM_SUBLABEL_INPUT_UNIFIED_MENU_CONTROLS) default_sublabel_macro(action_bind_sublabel_onscreen_notifications_enable, MENU_ENUM_SUBLABEL_VIDEO_FONT_ENABLE) +/* MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM*/ + static int action_bind_sublabel_cheevos_entry( file_list_t *list, unsigned type, unsigned i, @@ -136,6 +144,26 @@ static int action_bind_sublabel_cheevos_entry( return 0; } +#ifdef HAVE_NETWORKING +static int action_bind_sublabel_netplay_room( + file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len) +{ + if (i < 1) + return 0; + + snprintf(s,len, "%s (%s)\n%s (%08x)", + netplay_room_list[i - 1].corename, netplay_room_list[i - 1].coreversion, + netplay_room_list[i - 1].gamename, netplay_room_list[i - 1].gamecrc); +#if 0 + strlcpy(s, netplay_room_list[i - 1].corename, len); +#endif + return 0; +} +#endif + static int action_bind_sublabel_generic( file_list_t *list, unsigned type, unsigned i, @@ -233,6 +261,11 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cheevos_entry); break; +#ifdef HAVE_NETWORKING + case MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_netplay_room); + break; +#endif case MENU_ENUM_LABEL_CHEEVOS_ENABLE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cheevos_enable); break; diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index 89710e9c5c..9cfc7df7ac 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -257,6 +257,8 @@ static int action_get_title_group_settings(const char *path, const char *label, strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLISTS_TAB), len); else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB))) strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ADD_TAB), len); + else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB))) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_TAB), len); else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU))) strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_HORIZONTAL_MENU), len); else diff --git a/menu/cbs/menu_cbs_up.c b/menu/cbs/menu_cbs_up.c index b6523d2a2c..01cd0ae5af 100644 --- a/menu/cbs/menu_cbs_up.c +++ b/menu/cbs/menu_cbs_up.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 87d7b63f37..9455f84d5d 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2016 - Jean-André Santoni - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -60,6 +60,12 @@ #include "../../file_path_special.h" +typedef struct +{ + float line_height; + float y; +} mui_node_t; + enum { MUI_TEXTURE_POINTER = 0, @@ -92,6 +98,7 @@ typedef struct mui_handle unsigned icon_size; unsigned margin; unsigned glyph_width; + unsigned glyph_width2; char box_message[1024]; bool mouse_show; @@ -263,26 +270,28 @@ static void mui_draw_tab(mui_handle_t *mui, &tab_color[0]); } -static void mui_render_keyboard(mui_handle_t *mui, const char *grid[], unsigned id) +static void mui_render_keyboard(mui_handle_t *mui, + video_frame_info_t *video_info, + const char *grid[], unsigned id) { int ptr_width, ptr_height; - unsigned i, width, height; - float dark[16]= { + unsigned i; + unsigned width = video_info->width; + unsigned height = video_info->height; + float dark[16] = { 0.00, 0.00, 0.00, 0.85, 0.00, 0.00, 0.00, 0.85, 0.00, 0.00, 0.00, 0.85, 0.00, 0.00, 0.00, 0.85, }; - float white[16]= { + float white[16] = { 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, }; - video_driver_get_size(&width, &height); - menu_display_draw_quad(0, height/2.0, width, height/2.0, width, height, &dark[0]); @@ -320,17 +329,16 @@ static void mui_render_keyboard(mui_handle_t *mui, const char *grid[], unsigned } /* Returns the OSK key at a given position */ -static int mui_osk_ptr_at_pos(void *data, int x, int y) +static int mui_osk_ptr_at_pos(void *data, int x, int y, + unsigned width, unsigned height) { + unsigned i; int ptr_width, ptr_height; - unsigned i, width, height; - mui_handle_t *mui = (mui_handle_t*)data; + if (!mui) return -1; - video_driver_get_size(&width, &height); - ptr_width = width / 11; ptr_height = height / 10; @@ -357,7 +365,7 @@ static void mui_draw_tab_begin(mui_handle_t *mui, { float scale_factor = menu_display_get_dpi(); - mui->tabs_height = scale_factor / 3; + mui->tabs_height = scale_factor / 3; /* tabs background */ menu_display_draw_quad(0, height - mui->tabs_height, width, @@ -388,41 +396,49 @@ static void mui_draw_tab_end(mui_handle_t *mui, &active_tab_marker_color[0]); } +static float mui_content_height(void) +{ + unsigned i; + file_list_t *list = menu_entries_get_selection_buf_ptr(0); + float sum = 0; + + for (i = 0; i < menu_entries_get_end(); i++) + { + mui_node_t *node = (mui_node_t*) + menu_entries_get_userdata_at_offset(list, i); + sum += node->line_height; + } + return sum; +} + static void mui_draw_scrollbar(mui_handle_t *mui, unsigned width, unsigned height, float *coord_color) { - unsigned header_height; - float content_height, total_height, - scrollbar_height, scrollbar_margin, y; - - if (!mui) - return; - - header_height = menu_display_get_header_height(); - - content_height = menu_entries_get_end() * mui->line_height; - total_height = height - header_height - mui->tabs_height; - scrollbar_margin = mui->scrollbar_width; - scrollbar_height = total_height / (content_height / total_height); - y = total_height * mui->scroll_y / content_height; + unsigned header_height = menu_display_get_header_height(); + float content_height = mui_content_height(); + float total_height = height - header_height - mui->tabs_height; + float scrollbar_margin = mui->scrollbar_width; + float scrollbar_height = total_height / (content_height / total_height); + float y = total_height * mui->scroll_y / content_height; /* apply a margin on the top and bottom of the scrollbar for aestetic */ - scrollbar_height -= scrollbar_margin * 2; - y += scrollbar_margin; + scrollbar_height -= scrollbar_margin * 2; + y += scrollbar_margin; - if (content_height >= total_height) - { - /* if the scrollbar is extremely short, display it as a square */ - if (scrollbar_height <= mui->scrollbar_width) - scrollbar_height = mui->scrollbar_width; + if (content_height < total_height) + return; - menu_display_draw_quad( width - mui->scrollbar_width - scrollbar_margin, - header_height + y, - mui->scrollbar_width, - scrollbar_height, - width, height, - coord_color); - } + /* if the scrollbar is extremely short, display it as a square */ + if (scrollbar_height <= mui->scrollbar_width) + scrollbar_height = mui->scrollbar_width; + + menu_display_draw_quad( + width - mui->scrollbar_width - scrollbar_margin, + header_height + y, + mui->scrollbar_width, + scrollbar_height, + width, height, + coord_color); } static void mui_get_message(void *data, const char *message) @@ -436,10 +452,13 @@ static void mui_get_message(void *data, const char *message) } static void mui_render_messagebox(mui_handle_t *mui, + video_frame_info_t *video_info, const char *message, float *body_bg_color, uint32_t font_color) { - unsigned i, width, height, y_position; + unsigned i, y_position; int x, y, line_height, longest = 0, longest_width = 0; + unsigned width = video_info->width; + unsigned height = video_info->height; struct string_list *list = (struct string_list*) string_split(message, "\n"); @@ -448,8 +467,6 @@ static void mui_render_messagebox(mui_handle_t *mui, if (list->elems == 0) goto end; - video_driver_get_size(&width, &height); - line_height = mui->font->size * 1.2; y_position = height / 2; @@ -494,31 +511,76 @@ static void mui_render_messagebox(mui_handle_t *mui, } if (menu_input_dialog_get_display_kb()) - mui_render_keyboard(mui, menu_event_get_osk_grid(), menu_event_get_osk_ptr()); + mui_render_keyboard(mui, + video_info, + menu_event_get_osk_grid(), menu_event_get_osk_ptr()); end: string_list_free(list); } +static unsigned mui_count_lines(const char *str) +{ + unsigned c = 0; + unsigned lines = 1; + + for (c = 0; str[c]; c++) + lines += (str[c] == '\n'); + return lines; +} + +static void mui_compute_entries_box(mui_handle_t* mui, int width) +{ + size_t usable_width = width - (mui->margin * 2); + file_list_t *list = menu_entries_get_selection_buf_ptr(0); + float sum = 0; + unsigned i = 0; + + for (; i < menu_entries_get_end(); i++) + { + char sublabel_str[255]; + float scale_factor; + unsigned lines = 0; + mui_node_t *node = (mui_node_t*) + menu_entries_get_userdata_at_offset(list, i); + + sublabel_str[0] = '\0'; + + if (menu_entry_get_sublabel(i, sublabel_str, sizeof(sublabel_str))) + { + word_wrap(sublabel_str, sublabel_str, (int)(usable_width / mui->glyph_width2)); + lines = mui_count_lines(sublabel_str); + } + + scale_factor = menu_display_get_dpi(); + node->line_height = (scale_factor / 3) + (lines * mui->font->size); + node->y = sum; + sum += node->line_height; + } +} + static void mui_render(void *data) { - size_t i = 0; menu_animation_ctx_delta_t delta; float delta_time; unsigned bottom, width, height, header_height; + size_t i = 0; mui_handle_t *mui = (mui_handle_t*)data; settings_t *settings = config_get_ptr(); + file_list_t *list = menu_entries_get_selection_buf_ptr(0); if (!mui) return; video_driver_get_size(&width, &height); + mui_compute_entries_box(mui, width); + menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time); delta.current = delta_time; - if (menu_animation_ctl(MENU_ANIMATION_CTL_IDEAL_DELTA_TIME_GET, &delta)) + if (menu_animation_get_ideal_delta_time(&delta)) menu_animation_update(delta.ideal); menu_display_set_width(width); @@ -530,12 +592,20 @@ static void mui_render(void *data) int16_t pointer_y = menu_input_pointer_state(MENU_POINTER_Y_AXIS); float old_accel_val = 0.0f; float new_accel_val = 0.0f; - unsigned new_pointer_val = - (pointer_y - mui->line_height + mui->scroll_y - 16) - / mui->line_height; + + size_t ii = 0; + for (ii = 0; ii < menu_entries_get_size(); ii++) + { + mui_node_t *node = (mui_node_t*) + menu_entries_get_userdata_at_offset(list, ii); + + if (pointer_y > (-mui->scroll_y + header_height + node->y) + && pointer_y < (-mui->scroll_y + header_height + node->y + node->line_height) + ) + menu_input_ctl(MENU_INPUT_CTL_POINTER_PTR, &ii); + } menu_input_ctl(MENU_INPUT_CTL_POINTER_ACCEL_READ, &old_accel_val); - menu_input_ctl(MENU_INPUT_CTL_POINTER_PTR, &new_pointer_val); mui->scroll_y -= old_accel_val / 60.0; @@ -548,33 +618,38 @@ static void mui_render(void *data) { int16_t mouse_y = menu_input_mouse_state(MENU_MOUSE_Y_AXIS); - unsigned new_pointer_val = - (mouse_y - mui->line_height + mui->scroll_y - 16) - / mui->line_height; + size_t ii = 0; + for (ii = 0; ii < menu_entries_get_size(); ii++) + { + mui_node_t *node = (mui_node_t*) + menu_entries_get_userdata_at_offset(list, ii); - menu_input_ctl(MENU_INPUT_CTL_MOUSE_PTR, &new_pointer_val); + if (mouse_y > (-mui->scroll_y + header_height + node->y) + && mouse_y < (-mui->scroll_y + header_height + node->y + node->line_height) + ) + menu_input_ctl(MENU_INPUT_CTL_MOUSE_PTR, &ii); + } } if (mui->scroll_y < 0) mui->scroll_y = 0; - bottom = menu_entries_get_end() * mui->line_height - - height + header_height + mui->tabs_height; + bottom = mui_content_height() - height + header_height + mui->tabs_height; if (mui->scroll_y > bottom) mui->scroll_y = bottom; - if (menu_entries_get_end() * mui->line_height + if (mui_content_height() < height - header_height - mui->tabs_height) mui->scroll_y = 0; - if (menu_entries_get_end() < height / mui->line_height) { } + /*if (menu_entries_get_end() < height / mui->line_height) { } else - i = mui->scroll_y / mui->line_height; + i = mui->scroll_y / mui->line_height;*/ menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &i); } -static void mui_render_label_value(mui_handle_t *mui, +static void mui_render_label_value(mui_handle_t *mui, mui_node_t *node, int i, int y, unsigned width, unsigned height, uint64_t index, uint32_t color, bool selected, const char *label, const char *value, float *label_color) @@ -592,7 +667,6 @@ static void mui_render_label_value(mui_handle_t *mui, char sublabel_str[255]; char value_str[255]; uint32_t sublabel_color; - float label_offset = 0; bool switch_is_on = true; int value_len = utf8len(value); int ticker_limit = 0; @@ -618,27 +692,27 @@ static void mui_render_label_value(mui_handle_t *mui, ticker.str = label; ticker.selected = selected; - menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker); + menu_animation_ticker(&ticker); ticker.s = value_str; ticker.len = value_len; ticker.str = value; - menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker); + menu_animation_ticker(&ticker); - label_offset = mui->font->size / 3; if (menu_entry_get_sublabel(i, sublabel_str, sizeof(sublabel_str))) { - label_offset = -mui->font->size / 3; + word_wrap(sublabel_str, sublabel_str, (int)(usable_width / mui->glyph_width2)); + menu_display_draw_text(mui->font2, sublabel_str, mui->margin, - y + mui->line_height / 2 + mui->font->size / 1, + y + (menu_display_get_dpi() / 4) + mui->font->size, width, height, sublabel_color, TEXT_ALIGN_LEFT, 1.0f, false, 0); } menu_display_draw_text(mui->font, label_str, mui->margin, - y + mui->line_height / 2 + label_offset, + y + (menu_display_get_dpi() / 5), width, height, color, TEXT_ALIGN_LEFT, 1.0f, false, 0); if (string_is_equal(value, msg_hash_to_str(MENU_ENUM_LABEL_DISABLED)) || @@ -708,7 +782,7 @@ static void mui_render_label_value(mui_handle_t *mui, if (do_draw_text) menu_display_draw_text(mui->font, value_str, width - mui->margin, - y + mui->line_height / 2 + mui->font->size / 3, + y + (menu_display_get_dpi() / 5), width, height, color, TEXT_ALIGN_RIGHT, 1.0f, false, 0); if (texture_switch) @@ -716,7 +790,7 @@ static void mui_render_label_value(mui_handle_t *mui, mui->icon_size, texture_switch, width - mui->margin - mui->icon_size, - y, + y + (menu_display_get_dpi() / 6) - mui->icon_size/2, width, height, 0, @@ -725,46 +799,47 @@ static void mui_render_label_value(mui_handle_t *mui, ); } -static void mui_render_menu_list(mui_handle_t *mui, +static void mui_render_menu_list( + video_frame_info_t *video_info, + mui_handle_t *mui, unsigned width, unsigned height, uint32_t font_normal_color, uint32_t font_hover_color, float *menu_list_color) { - unsigned header_height; - uint64_t *frame_count; + float sum = 0; size_t i = 0; - size_t end = menu_entries_get_end(); - frame_count = video_driver_get_frame_count_ptr(); - - if (!menu_display_get_update_pending()) - return; - - header_height = menu_display_get_header_height(); + file_list_t *list = NULL; + uint64_t frame_count = video_info->frame_count; + unsigned header_height = menu_display_get_header_height(); mui->raster_block.carr.coords.vertices = 0; mui->raster_block2.carr.coords.vertices = 0; menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i); - for (; i < end; i++) + list = menu_entries_get_selection_buf_ptr(0); + + for (; i < menu_entries_get_end(); i++) { int y; size_t selection; char rich_label[255]; char entry_value[255]; bool entry_selected = false; + mui_node_t *node = (mui_node_t*) + menu_entries_get_userdata_at_offset(list, i); rich_label[0] = entry_value[0] = '\0'; if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection)) continue; - y = header_height - mui->scroll_y + (mui->line_height * i); + y = header_height - mui->scroll_y + sum; - if ((y - (int)mui->line_height) > (int)height - || ((y + (int)mui->line_height) < 0)) - continue; + /*if ((y - (int)node->line_height) > (int)height + || ((y + (int)node->line_height) < 0)) + continue;*/ menu_entry_get_value(i, NULL, entry_value, sizeof(entry_value)); menu_entry_get_rich_label(i, rich_label, sizeof(rich_label)); @@ -773,17 +848,20 @@ static void mui_render_menu_list(mui_handle_t *mui, mui_render_label_value( mui, + node, i, y, width, height, - *frame_count / 20, + frame_count / 20, font_hover_color, entry_selected, rich_label, entry_value, menu_list_color ); + + sum += node->line_height; } } @@ -841,7 +919,8 @@ static int mui_get_core_title(char *s, size_t len) return 0; } -static void mui_draw_bg(menu_display_ctx_draw_t *draw) +static void mui_draw_bg(menu_display_ctx_draw_t *draw, + video_frame_info_t *video_info) { menu_display_blend_begin(); @@ -850,12 +929,12 @@ static void mui_draw_bg(menu_display_ctx_draw_t *draw) draw->pipeline.id = 0; draw->pipeline.active = false; - menu_display_draw_bg(draw, false); + menu_display_draw_bg(draw, video_info, false); menu_display_draw(draw); menu_display_blend_end(); } -static void mui_frame(void *data) +static void mui_frame(void *data, video_frame_info_t *video_info) { float black_bg[16] = { 0, 0, 0, 0.75, @@ -943,18 +1022,19 @@ static void mui_frame(void *data) float color_nv_accent[16] = {0}; float footer_bg_color_real[16] = {0}; float header_bg_color_real[16] = {0}; - unsigned width = 0; - unsigned height = 0; + file_list_t *list = NULL; + mui_node_t *node = NULL; + unsigned width = video_info->width; + unsigned height = video_info->height; unsigned ticker_limit = 0; unsigned i = 0; unsigned header_height = 0; size_t selection = 0; size_t title_margin = 0; mui_handle_t *mui = (mui_handle_t*)data; - uint64_t *frame_count = video_driver_get_frame_count_ptr(); - settings_t *settings = config_get_ptr(); + uint64_t frame_count = video_info->frame_count; bool background_rendered = false; - bool libretro_running = menu_display_libretro_running(); + bool libretro_running = video_info->libretro_running; /* Default is blue theme */ float *header_bg_color = NULL; @@ -973,7 +1053,7 @@ static void mui_frame(void *data) msg[0] = title[0] = title_buf[0] = title_msg[0] = '\0'; - switch (settings->menu.materialui.menu_color_theme) + switch (video_info->materialui_color_theme) { case MATERIALUI_THEME_BLUE: hex32_to_rgba_normalized(0x2196F3, blue_500, 1.00); @@ -1122,12 +1202,10 @@ static void mui_frame(void *data) break; } - menu_display_set_alpha(header_bg_color_real, settings->menu.header.opacity); - menu_display_set_alpha(footer_bg_color_real, settings->menu.footer.opacity); + menu_display_set_alpha(header_bg_color_real, video_info->menu_header_opacity); + menu_display_set_alpha(footer_bg_color_real, video_info->menu_footer_opacity); - video_driver_get_size(&width, &height); - - menu_display_set_viewport(); + menu_display_set_viewport(video_info->width, video_info->height); header_height = menu_display_get_header_height(); if (libretro_running) @@ -1143,10 +1221,7 @@ static void mui_frame(void *data) draw.vertex_count = 4; draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP; - if (!menu_display_libretro_running() && draw.texture) - draw.color = &white_bg[0]; - - mui_draw_bg(&draw); + mui_draw_bg(&draw, video_info); } else { @@ -1169,10 +1244,10 @@ static void mui_frame(void *data) draw.vertex_count = 4; draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP; - if (!menu_display_libretro_running() && draw.texture) - draw.color = &white_bg[0]; + if (draw.texture) + draw.color = &white_bg[0]; - mui_draw_bg(&draw); + mui_draw_bg(&draw, video_info); /* Restore opacity of transposed white background */ menu_display_set_alpha(white_transp_bg, 0.90); @@ -1190,11 +1265,15 @@ static void mui_frame(void *data) menu_display_set_alpha(blue_50, 1.0); /* highlighted entry */ + list = menu_entries_get_selection_buf_ptr(0); + node = (mui_node_t*)menu_entries_get_userdata_at_offset( + list, selection); + menu_display_draw_quad( 0, - header_height - mui->scroll_y + mui->line_height *selection, + header_height - mui->scroll_y + node->y, width, - mui->line_height, + node->line_height, width, height, &highlighted_entry_color[0] @@ -1203,17 +1282,19 @@ static void mui_frame(void *data) menu_display_font_bind_block(mui->font, &mui->raster_block); menu_display_font_bind_block(mui->font2, &mui->raster_block2); - mui_render_menu_list( - mui, - width, - height, - font_normal_color, - font_hover_color, - &active_tab_marker_color[0] - ); + if (menu_display_get_update_pending()) + mui_render_menu_list( + video_info, + mui, + width, + height, + font_normal_color, + font_hover_color, + &active_tab_marker_color[0] + ); - menu_display_font_flush_block(mui->font); - menu_display_font_flush_block(mui->font2); + menu_display_font_flush_block(video_info->width, video_info->height, mui->font); + menu_display_font_flush_block(video_info->width, video_info->height, mui->font2); menu_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL); /* header */ @@ -1270,11 +1351,11 @@ static void mui_frame(void *data) ticker.s = title_buf; ticker.len = ticker_limit; - ticker.idx = *frame_count / 100; + ticker.idx = frame_count / 100; ticker.str = title; ticker.selected = true; - menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker); + menu_animation_ticker(&ticker); /* Title */ if (mui_get_core_title(title_msg, sizeof(title_msg)) == 0) @@ -1293,11 +1374,11 @@ static void mui_frame(void *data) ticker.s = title_buf_msg_tmp; ticker.len = ticker_limit; - ticker.idx = *frame_count / 20; + ticker.idx = frame_count / 20; ticker.str = title_buf_msg; ticker.selected = true; - menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker); + menu_animation_ticker(&ticker); strlcpy(title_buf, title_buf_msg_tmp, sizeof(title_buf)); } @@ -1316,13 +1397,13 @@ static void mui_frame(void *data) menu_display_draw_quad(0, 0, width, height, width, height, &black_bg[0]); snprintf(msg, sizeof(msg), "%s\n%s", label, str); - mui_render_messagebox(mui, msg, &body_bg_color[0], font_hover_color); + mui_render_messagebox(mui, video_info, msg, &body_bg_color[0], font_hover_color); } if (!string_is_empty(mui->box_message)) { menu_display_draw_quad(0, 0, width, height, width, height, &black_bg[0]); - mui_render_messagebox(mui, mui->box_message, &body_bg_color[0], font_hover_color); + mui_render_messagebox(mui, video_info, mui->box_message, &body_bg_color[0], font_hover_color); mui->box_message[0] = '\0'; } @@ -1337,7 +1418,7 @@ static void mui_frame(void *data) height); menu_display_restore_clear_color(); - menu_display_unset_viewport(); + menu_display_unset_viewport(video_info->width, video_info->height); } static void mui_layout(mui_handle_t *mui) @@ -1363,7 +1444,7 @@ static void mui_layout(mui_handle_t *mui) mui->shadow_height = scale_factor / 36; mui->scrollbar_width = scale_factor / 36; mui->tabs_height = scale_factor / 3; - mui->line_height = scale_factor / 2.5; + mui->line_height = scale_factor / 3; mui->margin = scale_factor / 9; mui->icon_size = scale_factor / 3; @@ -1371,6 +1452,7 @@ static void mui_layout(mui_handle_t *mui) /* we assume the average glyph aspect ratio is close to 3:4 */ mui->glyph_width = new_font_size * 3/4; + mui->glyph_width2 = new_font_size2 * 3/4; mui->font = menu_display_font(APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_FONT, new_font_size); @@ -1386,6 +1468,15 @@ static void mui_layout(mui_handle_t *mui) if (m_width) mui->glyph_width = m_width; } + + if (mui->font2) /* calculate a more realistic ticker_limit */ + { + unsigned m_width2 = + font_driver_get_message_width(mui->font2, "t", 1, 1); + + if (m_width2) + mui->glyph_width2 = m_width2; + } } static void *mui_init(void **userdata) @@ -1489,7 +1580,7 @@ static float mui_get_scroll(mui_handle_t *mui) video_driver_get_size(&width, &height); if (mui->line_height) - half = (height / mui->line_height) / 2; + half = (height / mui->line_height) / 3; if (selection < half) return 0; @@ -1513,7 +1604,8 @@ static void mui_navigation_set(void *data, bool scroll) entry.tag = -1; entry.cb = NULL; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); } static void mui_list_set_selection(void *data, file_list_t *list) @@ -1561,7 +1653,6 @@ static void mui_context_reset(void *data) if (!mui || !settings) return; - mui_layout(mui); mui_context_bg_destroy(mui); menu_display_allocate_white_texture(); @@ -1862,6 +1953,70 @@ static int mui_pointer_tap(void *userdata, return 0; } +static void mui_list_insert(void *userdata, + file_list_t *list, + const char *path, + const char *fullpath, + const char *unused, + size_t list_size) +{ + size_t selection; + float scale_factor; + int i = list_size; + mui_node_t *node = NULL; + mui_handle_t *mui = (mui_handle_t*)userdata; + + if (!mui || !list) + return; + if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection)) + return; + + node = (mui_node_t*)menu_entries_get_userdata_at_offset(list, i); + + if (!node) + node = (mui_node_t*)calloc(1, sizeof(mui_node_t)); + + if (!node) + { + RARCH_ERR("GLUI node could not be allocated.\n"); + return; + } + + scale_factor = menu_display_get_dpi(); + + node->line_height = scale_factor / 3; + node->y = 0; + + file_list_set_userdata(list, i, node); +} + +static void mui_list_clear(file_list_t *list) +{ + size_t i; + size_t size = list->size; + + for (i = 0; i < size; ++i) + { + menu_animation_ctx_subject_t subject; + float *subjects[2]; + mui_node_t *node = (mui_node_t*) + menu_entries_get_userdata_at_offset(list, i); + + if (!node) + continue; + + subjects[0] = &node->line_height; + subjects[1] = &node->y; + + subject.count = 2; + subject.data = subjects; + + menu_animation_ctl(MENU_ANIMATION_CTL_KILL_BY_SUBJECT, &subject); + + file_list_free_userdata(list, i); + } +} + menu_ctx_driver_t menu_ctx_mui = { NULL, mui_get_message, @@ -1882,10 +2037,10 @@ menu_ctx_driver_t menu_ctx_mui = { mui_navigation_alphabet, mui_navigation_alphabet, generic_menu_init_list, + mui_list_insert, NULL, NULL, - NULL, - NULL, + mui_list_clear, mui_list_cache, mui_list_push, mui_list_get_selection, diff --git a/menu/drivers/menu_generic.c b/menu/drivers/menu_generic.c index 40c8710cc5..59abd7b172 100644 --- a/menu/drivers/menu_generic.c +++ b/menu/drivers/menu_generic.c @@ -1,8 +1,8 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/drivers/menu_generic.h b/menu/drivers/menu_generic.h index da10b25071..d943c4b65c 100644 --- a/menu/drivers/menu_generic.h +++ b/menu/drivers/menu_generic.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/menu/drivers/nuklear.c b/menu/drivers/nuklear.c index 78b37184c5..42769e4d58 100644 --- a/menu/drivers/nuklear.c +++ b/menu/drivers/nuklear.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2015 - Jean-André Santoni - * Copyright (C) 2016 - Andrés Suárez + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017 - Andrés Suárez * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -145,6 +145,9 @@ static void xmb_init_ribbon(nk_menu_handle_t * xmb) static void *nk_menu_init(void **userdata) { +#if 1 + unsigned i; +#endif settings_t *settings = config_get_ptr(); nk_menu_handle_t *nk = NULL; menu_handle_t *menu = (menu_handle_t*) @@ -169,16 +172,18 @@ static void *nk_menu_init(void **userdata) "nuklear", sizeof(nk->assets_directory)); nk_menu_init_device(nk); - /* for demo puposes only, opens all windows */ + /* for demo purposes only, opens all windows */ #if 1 - for (int i=0; i < NK_WND_LAST; i++) + for (i = 0; i < NK_WND_LAST; i++) nk->window[i].open = true; #else nk->window[NK_WND_MAIN].open = true; #endif xmb_init_ribbon(nk); + return menu; error: + if (menu) free(menu); return NULL; @@ -250,6 +255,7 @@ static void nk_menu_get_message(void *data, const char *message) static void nk_draw_bg( nk_menu_handle_t *nk, + video_frame_info_t *video_info, unsigned width, unsigned height, float alpha, @@ -273,7 +279,7 @@ static void nk_draw_bg( draw.pipeline.id = 0; menu_display_blend_begin(); - menu_display_set_viewport(); + menu_display_set_viewport(video_info->width, video_info->height); draw.pipeline.id = VIDEO_SHADER_MENU_5; draw.pipeline.active = false; @@ -302,18 +308,24 @@ static void nk_menu_main(nk_menu_handle_t *nk) } -static void nk_menu_frame(void *data) +static void nk_menu_frame(void *data, video_frame_info_t *video_info) { - float white_bg[16]= { + unsigned ticker_limit, i; + float coord_black[16], coord_white[16]; + nk_menu_handle_t *nk = (nk_menu_handle_t*)data; + settings_t *settings = config_get_ptr(); + unsigned width = video_info->width; + unsigned height = video_info->height; + bool libretro_running = video_info->libretro_running; + float white_bg[16] = { 0.98, 0.98, 0.98, 1, 0.98, 0.98, 0.98, 1, 0.98, 0.98, 0.98, 1, 0.98, 0.98, 0.98, 1, }; - float coord_black[16], coord_white[16]; - for (int i = 0; i < 16; i++) + for (i = 0; i < 16; i++) { coord_black[i] = 0; coord_white[i] = 1.0f; @@ -322,18 +334,10 @@ static void nk_menu_frame(void *data) menu_display_set_alpha(coord_black, 0.75); menu_display_set_alpha(coord_white, 0.75); - unsigned width, height, ticker_limit, i; - nk_menu_handle_t *nk = (nk_menu_handle_t*)data; - settings_t *settings = config_get_ptr(); - - bool libretro_running = menu_display_libretro_running(); - if (!nk) return; - video_driver_get_size(&width, &height); - - menu_display_set_viewport(); + menu_display_set_viewport(video_info->width, video_info->height); nk_input_begin(&nk->ctx); nk_menu_input_gamepad(nk); @@ -350,7 +354,7 @@ static void nk_menu_frame(void *data) nk_input_end(&nk->ctx); nk_menu_main(nk); - nk_draw_bg(nk, width, height, 0.5, nk->textures.bg, coord_black, coord_white); + nk_draw_bg(nk, video_info, width, height, 0.5, nk->textures.bg, coord_black, coord_white); nk_common_device_draw(&device, &nk->ctx, width, height, NK_ANTI_ALIASING_ON); menu_display_draw_cursor( @@ -363,7 +367,7 @@ static void nk_menu_frame(void *data) height); menu_display_restore_clear_color(); - menu_display_unset_viewport(); + menu_display_unset_viewport(video_info->width, video_info->height); } static void nk_menu_free(void *data) diff --git a/menu/drivers/nuklear/nk_common.c b/menu/drivers/nuklear/nk_common.c index 0a3a7fd92c..187046ff0b 100644 --- a/menu/drivers/nuklear/nk_common.c +++ b/menu/drivers/nuklear/nk_common.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2015 - Jean-Andr� Santoni - * Copyright (C) 2016 - Andr�s Su�rez + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-Andr� Santoni + * Copyright (C) 2016-2017 - Andr�s Su�rez * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/drivers/nuklear/nk_common.h b/menu/drivers/nuklear/nk_common.h index e241cf33ab..60ec992469 100644 --- a/menu/drivers/nuklear/nk_common.h +++ b/menu/drivers/nuklear/nk_common.h @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2015 - Jean-André Santoni - * Copyright (C) 2016 - Andrés Suárez + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017 - Andrés Suárez * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/drivers/nuklear/nk_menu.c b/menu/drivers/nuklear/nk_menu.c index 501906d8df..4f2949901a 100644 --- a/menu/drivers/nuklear/nk_menu.c +++ b/menu/drivers/nuklear/nk_menu.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2015 - Jean-André Santoni - * Copyright (C) 2016 - Andrés Suárez + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017 - Andrés Suárez * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -163,4 +163,4 @@ void nk_common_set_style(struct nk_context *ctx, enum theme theme) } else { nk_style_default(ctx); } -} \ No newline at end of file +} diff --git a/menu/drivers/nuklear/nk_menu.h b/menu/drivers/nuklear/nk_menu.h index ad5f67f5b2..6957887c1a 100644 --- a/menu/drivers/nuklear/nk_menu.h +++ b/menu/drivers/nuklear/nk_menu.h @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2015 - Jean-André Santoni - * Copyright (C) 2016 - Andrés Suárez + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017- Andrés Suárez * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/drivers/nuklear/nk_wnd_file_picker.c b/menu/drivers/nuklear/nk_wnd_file_picker.c index e634644de7..6652eb84d7 100644 --- a/menu/drivers/nuklear/nk_wnd_file_picker.c +++ b/menu/drivers/nuklear/nk_wnd_file_picker.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2015 - Jean-André Santoni - * Copyright (C) 2016 - Andrés Suárez + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017- Andrés Suárez * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/drivers/nuklear/nk_wnd_main.c b/menu/drivers/nuklear/nk_wnd_main.c index feabb14c94..78de2462c1 100644 --- a/menu/drivers/nuklear/nk_wnd_main.c +++ b/menu/drivers/nuklear/nk_wnd_main.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2015 - Jean-André Santoni - * Copyright (C) 2016 - Andrés Suárez + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017 - Andrés Suárez * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/drivers/nuklear/nk_wnd_settings.c b/menu/drivers/nuklear/nk_wnd_settings.c index d89265d72e..c033672304 100644 --- a/menu/drivers/nuklear/nk_wnd_settings.c +++ b/menu/drivers/nuklear/nk_wnd_settings.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2015 - Jean-André Santoni - * Copyright (C) 2016 - Andrés Suárez + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017 - Andrés Suárez * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/drivers/nuklear/nk_wnd_shader_parameters.c b/menu/drivers/nuklear/nk_wnd_shader_parameters.c index 76a7ad8232..40330c7135 100644 --- a/menu/drivers/nuklear/nk_wnd_shader_parameters.c +++ b/menu/drivers/nuklear/nk_wnd_shader_parameters.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2015 - Jean-André Santoni - * Copyright (C) 2016 - Andrés Suárez + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017 - Andrés Suárez * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/drivers/null.c b/menu/drivers/null.c index e74ccc1af0..d2f6fc3f9a 100644 --- a/menu/drivers/null.c +++ b/menu/drivers/null.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 863bf8a5ad..9ddfeaea23 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -1,8 +1,8 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2015 - Michael Lelli - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -62,6 +62,7 @@ typedef struct unsigned last_height; float scroll_y; bool mouse_show; + unsigned int frame_count; } rgui_t; static uint16_t *rgui_framebuf_data = NULL; @@ -381,6 +382,12 @@ static void rgui_blit_cursor(void) rgui_color_rect(fb_pitch, fb_width, fb_height, x - 5, y, 11, 1, 0xFFFF); } +static void rgui_frame(void *data, video_frame_info_t *video_info) +{ + rgui_t *rgui = (rgui_t*)data; + rgui->frame_count = video_info->frame_count; +} + static void rgui_render(void *data) { menu_animation_ctx_ticker_t ticker; @@ -394,11 +401,9 @@ static void rgui_render(void *data) char title_msg[64]; char msg[255]; bool msg_force = false; - uint64_t *frame_count = NULL; settings_t *settings = config_get_ptr(); rgui_t *rgui = (rgui_t*)data; - - frame_count = video_driver_get_frame_count_ptr(); + uint64_t frame_count = rgui ? rgui->frame_count : 0; msg[0] = title[0] = title_buf[0] = title_msg[0] = '\0'; @@ -410,7 +415,7 @@ static void rgui_render(void *data) msg_force = menu_display_get_msg_force(); if (menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL) - && menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) && !msg_force) + && menu_driver_is_alive() && !msg_force) return; if (runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL)) @@ -503,11 +508,11 @@ static void rgui_render(void *data) ticker.s = title_buf; ticker.len = RGUI_TERM_WIDTH(fb_width) - 10; - ticker.idx = *frame_count / RGUI_TERM_START_X(fb_width); + ticker.idx = frame_count / RGUI_TERM_START_X(fb_width); ticker.str = title; ticker.selected = true; - menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker); + menu_animation_ticker(&ticker); hover_color = HOVER_COLOR(settings); normal_color = NORMAL_COLOR(settings); @@ -595,17 +600,17 @@ static void rgui_render(void *data) ticker.s = entry_title_buf; ticker.len = RGUI_TERM_WIDTH(fb_width) - (entry_spacing + 1 + 2); - ticker.idx = *frame_count / RGUI_TERM_START_X(fb_width); + ticker.idx = frame_count / RGUI_TERM_START_X(fb_width); ticker.str = entry_path; ticker.selected = entry_selected; - menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker); + menu_animation_ticker(&ticker); ticker.s = type_str_buf; ticker.len = entry_spacing; ticker.str = entry_value; - menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker); + menu_animation_ticker(&ticker); snprintf(message, sizeof(message), "%c %-*.*s %-*s", entry_selected ? '>' : ' ', @@ -874,7 +879,7 @@ menu_ctx_driver_t menu_ctx_rgui = { rgui_set_message, generic_menu_iterate, rgui_render, - NULL, + rgui_frame, rgui_init, rgui_free, NULL, diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 2a436e6fbd..ac7809966f 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2016 - Jean-André Santoni - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -96,6 +96,9 @@ enum XMB_TEXTURE_MUSICS, XMB_TEXTURE_MOVIES, #endif +#ifdef HAVE_NETWORKING + XMB_TEXTURE_NETPLAY, +#endif #ifdef HAVE_IMAGEVIEWER XMB_TEXTURE_IMAGES, #endif @@ -151,10 +154,15 @@ enum #ifdef HAVE_IMAGEVIEWER XMB_SYSTEM_TAB_IMAGES, #endif - XMB_SYSTEM_TAB_ADD + XMB_SYSTEM_TAB_ADD, +#ifdef HAVE_NETWORKING + XMB_SYSTEM_TAB_NETPLAY +#endif }; -#ifdef HAVE_LIBRETRODB +#ifdef HAVE_NETWORKING +#define XMB_SYSTEM_TAB_END XMB_SYSTEM_TAB_NETPLAY +#elif defined(HAVE_LIBRETRODB) #define XMB_SYSTEM_TAB_END XMB_SYSTEM_TAB_ADD #elif defined(HAVE_IMAGEVIEWER) #define XMB_SYSTEM_TAB_END XMB_SYSTEM_TAB_IMAGES @@ -164,6 +172,7 @@ enum #define XMB_SYSTEM_TAB_END XMB_SYSTEM_TAB_HISTORY #endif + typedef struct xmb_handle { file_list_t *menu_stack_old; @@ -300,6 +309,7 @@ typedef struct xmb_handle xmb_node_t settings_tab_node; xmb_node_t history_tab_node; xmb_node_t add_tab_node; + xmb_node_t netplay_tab_node; font_data_t *font; font_data_t *font2; @@ -376,7 +386,7 @@ float gradient_dark[16] = { 0.0, 0.0, 0.0, 1.00, }; -const char *xmb_theme_ident(void) +const char* xmb_theme_ident(void) { settings_t *settings = config_get_ptr(); switch (settings->menu.xmb.theme) @@ -421,11 +431,9 @@ static const char *xmb_thumbnails_ident(void) return msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF); } -static float *xmb_gradient_ident(void) +static float *xmb_gradient_ident(video_frame_info_t *video_info) { - settings_t *settings = config_get_ptr(); - - switch (settings->menu.xmb.menu_color_theme) + switch (video_info->xmb_color_theme) { case XMB_THEME_DARK_PURPLE: return &gradient_dark_purple[0]; @@ -706,11 +714,15 @@ static void xmb_messagebox(void *data, const char *message) strlcpy(xmb->box_message, message, sizeof(xmb->box_message)); } -static void xmb_render_keyboard(xmb_handle_t *xmb, const char *grid[], unsigned id) +static void xmb_render_keyboard(xmb_handle_t *xmb, + video_frame_info_t *video_info, + const char *grid[], unsigned id) { + unsigned i; int ptr_width, ptr_height; - unsigned i, width, height; - float dark[16]= { + unsigned width = video_info->width; + unsigned height = video_info->height; + float dark[16] = { 0.00, 0.00, 0.00, 0.85, 0.00, 0.00, 0.00, 0.85, 0.00, 0.00, 0.00, 0.85, @@ -724,8 +736,6 @@ static void xmb_render_keyboard(xmb_handle_t *xmb, const char *grid[], unsigned 1.00, 1.00, 1.00, 1.00, }; - video_driver_get_size(&width, &height); - menu_display_draw_quad(0, height/2.0, width, height/2.0, width, height, &dark[0]); @@ -765,18 +775,16 @@ static void xmb_render_keyboard(xmb_handle_t *xmb, const char *grid[], unsigned } /* Returns the OSK key at a given position */ -static int xmb_osk_ptr_at_pos(void *data, int x, int y) +static int xmb_osk_ptr_at_pos(void *data, int x, int y, unsigned width, unsigned height) { + unsigned i; int ptr_width, ptr_height; - unsigned i, width, height; - xmb_handle_t *xmb = (xmb_handle_t*)data; + if (!xmb) return -1; - video_driver_get_size(&width, &height); - - ptr_width = width / 11; + ptr_width = width / 11; ptr_height = height / 10; if (ptr_width >= ptr_height) @@ -798,19 +806,14 @@ static int xmb_osk_ptr_at_pos(void *data, int x, int y) static void xmb_render_messagebox_internal( menu_display_frame_info_t menu_disp_info, + video_frame_info_t *video_info, xmb_handle_t *xmb, const char *message) { - int x, y, longest = 0, longest_width = 0; unsigned i, y_position; - unsigned width, height; - struct string_list *list = NULL; - - if (!xmb) - return; - - video_driver_get_size(&width, &height); - - list = string_split(message, "\n"); + int x, y, longest = 0, longest_width = 0; + unsigned width = video_info->width; + unsigned height = video_info->height; + struct string_list *list = string_split(message, "\n"); if (!list) return; @@ -856,6 +859,7 @@ static void xmb_render_messagebox_internal( if (menu_input_dialog_get_display_kb()) xmb_render_keyboard(xmb, + video_info, menu_event_get_osk_grid(), menu_event_get_osk_ptr()); @@ -890,7 +894,7 @@ static void xmb_update_thumbnail_path(void *data, unsigned i) menu_entry_get(&entry, 0, i, NULL, true); - if (entry.type == FILE_TYPE_IMAGEVIEWER) + if (entry.type == FILE_TYPE_IMAGEVIEWER || entry.type == FILE_TYPE_IMAGE) { file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); xmb_node_t *node = (xmb_node_t*) @@ -907,7 +911,7 @@ static void xmb_update_thumbnail_path(void *data, unsigned i) return; } } - else if (xmb_list_get_selection(xmb) == 0) + else if (xmb_list_get_selection(xmb) <= XMB_SYSTEM_TAB_SETTINGS) { xmb->thumbnail_file_path[0] = '\0'; xmb->thumbnail = 0; @@ -1048,7 +1052,7 @@ static void xmb_update_savestate_thumbnail_image(void *data) static void xmb_selection_pointer_changed( xmb_handle_t *xmb, bool allow_animations) { - unsigned i, end, height, depth; + unsigned i, end, height; menu_animation_ctx_tag_t tag; size_t selection, num = 0; int threshold = 0; @@ -1088,13 +1092,14 @@ static void xmb_selection_pointer_changed( if (i == selection) { - ia = xmb->items.active.alpha; - iz = xmb->items.active.zoom; + unsigned depth = xmb_list_get_size(xmb, MENU_LIST_PLAIN); + + ia = xmb->items.active.alpha; + iz = xmb->items.active.zoom; - depth = xmb_list_get_size(xmb, MENU_LIST_PLAIN); if (!string_is_equal(xmb_thumbnails_ident(), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)) - && (depth == 1 || xmb->categories.selection_ptr == 0)) + && (depth == 1 || xmb_list_get_selection(xmb) <= XMB_SYSTEM_TAB_SETTINGS)) { xmb_update_thumbnail_path(xmb, i); xmb_update_thumbnail_image(xmb); @@ -1122,21 +1127,25 @@ static void xmb_selection_pointer_changed( entry.tag = tag.id; entry.cb = NULL; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); entry.subject = &node->label_alpha; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); entry.target_value = iz; entry.subject = &node->zoom; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); entry.target_value = iy; entry.subject = &node->y; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); } } } @@ -1186,17 +1195,20 @@ static void xmb_list_open_old(xmb_handle_t *xmb, entry.tag = -1; entry.cb = NULL; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); entry.target_value = 0; entry.subject = &node->label_alpha; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); entry.target_value = xmb->icon.size * dir * -2; entry.subject = &node->x; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); } } } @@ -1256,23 +1268,26 @@ static void xmb_list_open_new(xmb_handle_t *xmb, entry.tag = -1; entry.cb = NULL; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); entry.subject = &node->label_alpha; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); entry.target_value = 0; entry.subject = &node->x; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); } } xmb->old_depth = xmb->depth; menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &skip); - if (xmb_list_get_selection(xmb) == 0) + if (xmb_list_get_selection(xmb) <= XMB_SYSTEM_TAB_SETTINGS) xmb_update_thumbnail_path(xmb, 0); } @@ -1319,16 +1334,19 @@ static void xmb_push_animations(xmb_node_t *node, float ia, float ix) entry.tag = -1; entry.cb = NULL; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); entry.subject = &node->label_alpha; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); entry.target_value = ix; entry.subject = &node->x; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); } static void xmb_list_switch_old(xmb_handle_t *xmb, @@ -1466,6 +1484,10 @@ static xmb_node_t* xmb_get_node(xmb_handle_t *xmb, unsigned i) return &xmb->history_tab_node; case XMB_SYSTEM_TAB_ADD: return &xmb->add_tab_node; +#ifdef HAVE_NETWORKING + case XMB_SYSTEM_TAB_NETPLAY: + return &xmb->netplay_tab_node; +#endif default: if (i > xmb->system_tab_end) return xmb_get_userdata_from_horizontal_list( @@ -1504,12 +1526,14 @@ static void xmb_list_switch_horizontal_list(xmb_handle_t *xmb) entry.tag = -1; entry.cb = NULL; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); entry.target_value = iz; entry.subject = &node->zoom; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); } } @@ -1537,7 +1561,8 @@ static void xmb_list_switch(xmb_handle_t *xmb) entry.tag = -1; entry.cb = NULL; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); dir = -1; if (xmb->categories.selection_ptr > xmb->categories.selection_ptr_old) @@ -1583,7 +1608,8 @@ static void xmb_list_open_horizontal_list(xmb_handle_t *xmb) entry.tag = -1; entry.cb = NULL; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); } } @@ -1856,20 +1882,24 @@ static void xmb_list_open(xmb_handle_t *xmb) switch (xmb->depth) { case 1: - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); entry.target_value = 0; entry.subject = &xmb->textures.arrow.alpha; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); break; case 2: - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); entry.target_value = 1; entry.subject = &xmb->textures.arrow.alpha; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); break; } @@ -2041,58 +2071,8 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, return xmb->textures.list[XMB_TEXTURE_SUBSETTING]; } -char* word_wrap(char* buffer, char* string, int line_width) { - unsigned i = 0; - int k, counter; - - while(i < strlen(string)) - { - /* copy string until the end of the line is reached */ - for (counter = 1; counter <= line_width; counter++) - { - /* check if end of string reached */ - if (i == strlen(string)) - { - buffer[i] = 0; - return buffer; - } - - buffer[i] = string[i]; - - /* check for newlines embedded in the original input - * and reset the index */ - if (buffer[i] == '\n') - counter = 1; - i++; - } - /* check for whitespace */ - if (string[i] == ' ') - { - buffer[i] = '\n'; - i++; - } - else - { - /* check for nearest whitespace back in string */ - for (k = i; k > 0; k--) - { - if (string[k] == ' ') - { - buffer[k] = '\n'; - /* set string index back to character after this one */ - i = k + 1; - break; - } - } - } - } - - buffer[i] = 0; - - return buffer; -} - static void xmb_draw_items( + video_frame_info_t *video_info, menu_display_frame_info_t menu_disp_info, xmb_handle_t *xmb, file_list_t *list, file_list_t *stack, @@ -2102,10 +2082,9 @@ static void xmb_draw_items( size_t i; math_matrix_4x4 mymat; menu_display_ctx_rotate_draw_t rotate_draw; - uint64_t *frame_count = NULL; xmb_node_t *core_node = NULL; size_t end = 0; - frame_count = video_driver_get_frame_count_ptr(); + uint64_t frame_count = video_info->frame_count; if (!list || !list->size) return; @@ -2259,11 +2238,11 @@ static void xmb_draw_items( ticker.s = name; ticker.len = ticker_limit; - ticker.idx = *frame_count / 20; + ticker.idx = frame_count / 20; ticker.str = ticker_str; ticker.selected = (i == current); - menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker); + menu_animation_ticker(&ticker); label_offset = xmb->margins.label.top; if (i == current && width > 320 && height > 240 @@ -2290,11 +2269,11 @@ static void xmb_draw_items( ticker.s = value; ticker.len = 35; - ticker.idx = *frame_count / 20; + ticker.idx = frame_count / 20; ticker.str = entry_value; ticker.selected = (i == current); - menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker); + menu_animation_ticker(&ticker); if (do_draw_text) xmb_draw_text(menu_disp_info, xmb, value, @@ -2387,7 +2366,7 @@ static void xmb_render(void *data) delta.current = delta_time; - if (menu_animation_ctl(MENU_ANIMATION_CTL_IDEAL_DELTA_TIME_GET, &delta)) + if (menu_animation_get_ideal_delta_time(&delta)) menu_animation_update(delta.ideal); if (settings->menu.pointer.enable || settings->menu.mouse.enable) @@ -2431,17 +2410,18 @@ static void xmb_render(void *data) menu_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL); } -static bool xmb_shader_pipeline_active(settings_t *settings) +static bool xmb_shader_pipeline_active(video_frame_info_t *video_info) { if (!string_is_equal(menu_driver_ident(), "xmb")) return false; - if (settings->menu.xmb.shader_pipeline == XMB_SHADER_PIPELINE_WALLPAPER) + if (video_info->menu_shader_pipeline == XMB_SHADER_PIPELINE_WALLPAPER) return false; return true; } static void xmb_draw_bg( xmb_handle_t *xmb, + video_frame_info_t *video_info, unsigned width, unsigned height, float alpha, @@ -2450,13 +2430,12 @@ static void xmb_draw_bg( float *coord_white) { menu_display_ctx_draw_t draw; - settings_t *settings = config_get_ptr(); #if 0 RARCH_LOG("DRAW BG %d %d \n",width,height); #endif - bool running = menu_display_libretro_running(); + bool running = video_info->libretro_running; draw.x = 0; draw.y = 0; @@ -2469,28 +2448,28 @@ static void xmb_draw_bg( draw.vertex_count = 4; draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP; draw.pipeline.id = 0; - draw.pipeline.active = xmb_shader_pipeline_active(settings); + draw.pipeline.active = xmb_shader_pipeline_active(video_info); menu_display_blend_begin(); - menu_display_set_viewport(); + menu_display_set_viewport(video_info->width, video_info->height); #ifdef HAVE_SHADERPIPELINE - if (settings->menu.xmb.shader_pipeline > XMB_SHADER_PIPELINE_WALLPAPER + if (video_info->menu_shader_pipeline > XMB_SHADER_PIPELINE_WALLPAPER && - (settings->menu.xmb.menu_color_theme != XMB_THEME_WALLPAPER)) + (video_info->xmb_color_theme != XMB_THEME_WALLPAPER)) { - draw.color = xmb_gradient_ident(); + draw.color = xmb_gradient_ident(video_info); if (running) menu_display_set_alpha(draw.color, coord_black[3]); else menu_display_set_alpha(draw.color, coord_white[3]); - menu_display_draw_gradient(&draw); + menu_display_draw_gradient(&draw, video_info); draw.pipeline.id = VIDEO_SHADER_MENU_2; - switch (settings->menu.xmb.shader_pipeline) + switch (video_info->menu_shader_pipeline) { case XMB_SHADER_PIPELINE_RIBBON: draw.pipeline.id = VIDEO_SHADER_MENU; @@ -2515,16 +2494,16 @@ static void xmb_draw_bg( { uintptr_t texture = draw.texture; - if (settings->menu.xmb.menu_color_theme != XMB_THEME_WALLPAPER) - draw.color = xmb_gradient_ident(); + if (video_info->xmb_color_theme != XMB_THEME_WALLPAPER) + draw.color = xmb_gradient_ident(video_info); if (running) menu_display_set_alpha(draw.color, coord_black[3]); else menu_display_set_alpha(draw.color, coord_white[3]); - if (settings->menu.xmb.menu_color_theme != XMB_THEME_WALLPAPER) - menu_display_draw_gradient(&draw); + if (video_info->xmb_color_theme != XMB_THEME_WALLPAPER) + menu_display_draw_gradient(&draw, video_info); { bool add_opacity = false; @@ -2534,10 +2513,10 @@ static void xmb_draw_bg( if (!running && draw.texture) draw.color = &coord_white[0]; - if (settings->menu.xmb.menu_color_theme == XMB_THEME_WALLPAPER) + if (video_info->xmb_color_theme == XMB_THEME_WALLPAPER) add_opacity = true; - menu_display_draw_bg(&draw, add_opacity); + menu_display_draw_bg(&draw, video_info, add_opacity); } } @@ -2582,35 +2561,34 @@ static void xmb_draw_dark_layer( menu_display_blend_end(); } -static void xmb_frame(void *data) +static void xmb_frame(void *data, video_frame_info_t *video_info) { size_t selection; size_t percent_width = 0; math_matrix_4x4 mymat; - unsigned i, width, height; + unsigned i; float item_color[16], coord_black[16], coord_white[16]; menu_display_ctx_rotate_draw_t rotate_draw; char msg[1024]; char title_msg[255]; char title_truncated[255]; menu_display_frame_info_t menu_disp_info; + unsigned width = video_info->width; + unsigned height = video_info->height; bool render_background = false; file_list_t *selection_buf = NULL; file_list_t *menu_stack = NULL; - settings_t *settings = config_get_ptr(); xmb_handle_t *xmb = (xmb_handle_t*)data; if (!xmb) return; - menu_disp_info.shadows_enable = settings->menu.xmb.shadows_enable; + menu_disp_info.shadows_enable = video_info->xmb_shadows_enable; msg[0] = '\0'; title_msg[0] = '\0'; title_truncated[0] = '\0'; - video_driver_get_size(&width, &height); - menu_display_font_bind_block(xmb->font, &xmb->raster_block); menu_display_font_bind_block(xmb->font2, &xmb->raster_block2); @@ -2625,11 +2603,12 @@ static void xmb_frame(void *data) } menu_display_set_alpha(coord_black, MIN( - (float)settings->menu.xmb.alpha_factor/100, xmb->alpha)); + (float)video_info->xmb_alpha_factor/100, xmb->alpha)); menu_display_set_alpha(coord_white, xmb->alpha); xmb_draw_bg( xmb, + video_info, width, height, xmb->alpha, @@ -2668,7 +2647,7 @@ static void xmb_frame(void *data) /* Clock image */ menu_display_set_alpha(coord_white, MIN(xmb->alpha, 1.00f)); - if (settings->menu.battery_level_enable) + if (video_info->battery_level_enable) { char msg[12]; static retro_time_t last_time = 0; @@ -2721,34 +2700,34 @@ static void xmb_frame(void *data) } } - if (settings->menu.timedate_enable && coord_white[3] != 0) - { - int x_pos = 0; - - if (percent_width) - x_pos = percent_width + (xmb->icon.size / 2.5); - - xmb_draw_icon( - menu_disp_info, - xmb->icon.size, - &mymat, - xmb->textures.list[XMB_TEXTURE_CLOCK], - width - xmb->icon.size - x_pos, - xmb->icon.size,width, - height, - 1, - 0, - 1, - &coord_white[0], - xmb->shadow_offset); - } - - if (settings->menu.timedate_enable) + if (video_info->timedate_enable) { menu_display_ctx_datetime_t datetime; char timedate[255]; int x_pos = 0; + if (coord_white[3] != 0) + { + int x_pos = 0; + + if (percent_width) + x_pos = percent_width + (xmb->icon.size / 2.5); + + xmb_draw_icon( + menu_disp_info, + xmb->icon.size, + &mymat, + xmb->textures.list[XMB_TEXTURE_CLOCK], + width - xmb->icon.size - x_pos, + xmb->icon.size,width, + height, + 1, + 0, + 1, + &coord_white[0], + xmb->shadow_offset); + } + timedate[0] = '\0'; datetime.s = timedate; @@ -2842,7 +2821,9 @@ static void xmb_frame(void *data) menu_display_blend_end(); /* Vertical icons */ - xmb_draw_items(menu_disp_info, + xmb_draw_items( + video_info, + menu_disp_info, xmb, xmb->selection_buf_old, xmb->menu_stack_old, @@ -2857,6 +2838,7 @@ static void xmb_frame(void *data) menu_stack = menu_entries_get_menu_stack_ptr(0); xmb_draw_items( + video_info, menu_disp_info, xmb, selection_buf, @@ -2867,8 +2849,8 @@ static void xmb_frame(void *data) width, height); - menu_display_font_flush_block(xmb->font); - menu_display_font_flush_block(xmb->font2); + menu_display_font_flush_block(video_info->width, video_info->height, xmb->font); + menu_display_font_flush_block(video_info->width, video_info->height, xmb->font2); if (xmb->savestate_thumbnail) xmb_draw_thumbnail(menu_disp_info, @@ -2911,7 +2893,7 @@ static void xmb_frame(void *data) { xmb_draw_dark_layer(xmb, width, height); - xmb_render_messagebox_internal(menu_disp_info, xmb, msg); + xmb_render_messagebox_internal(menu_disp_info, video_info, xmb, msg); } /* Cursor image */ @@ -2928,7 +2910,7 @@ static void xmb_frame(void *data) height); } - menu_display_unset_viewport(); + menu_display_unset_viewport(video_info->width, video_info->height); } static void xmb_layout_ps3(xmb_handle_t *xmb, int width) @@ -3249,6 +3231,9 @@ static void *xmb_init(void **userdata) if (settings->menu.xmb.show_add) xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_ADD; #endif +#ifdef HAVE_NETWORKING + xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_NETPLAY; +#endif menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL); @@ -3464,6 +3449,10 @@ static const char *xmb_texture_path(unsigned id) return "off.png"; case XMB_TEXTURE_ADD: return "add.png"; +#ifdef HAVE_NETWORKING + case XMB_TEXTURE_NETPLAY: + return "wifi.png"; +#endif case XMB_TEXTURE_KEY: return "key.png"; case XMB_TEXTURE_KEY_HOVER: @@ -3514,6 +3503,12 @@ static void xmb_context_reset_textures( xmb->add_tab_node.icon = xmb->textures.list[XMB_TEXTURE_ADD]; xmb->add_tab_node.alpha = xmb->categories.active.alpha; xmb->add_tab_node.zoom = xmb->categories.active.zoom; + +#ifdef HAVE_NETWORKING + xmb->netplay_tab_node.icon = xmb->textures.list[XMB_TEXTURE_NETPLAY]; + xmb->netplay_tab_node.alpha = xmb->categories.active.alpha; + xmb->netplay_tab_node.zoom = xmb->categories.active.zoom; +#endif } static void xmb_context_reset_background(const char *iconpath) @@ -3826,6 +3821,14 @@ static void xmb_list_cache(void *data, enum menu_list_type type, unsigned action menu_stack->list[stack_size - 1].type = MENU_ADD_TAB; break; +#ifdef HAVE_NETWORKING + case XMB_SYSTEM_TAB_NETPLAY: + menu_stack->list[stack_size - 1].label = + strdup(msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)); + menu_stack->list[stack_size - 1].type = + MENU_NETPLAY_TAB; + break; +#endif default: menu_stack->list[stack_size - 1].label = strdup(msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU)); @@ -3885,7 +3888,8 @@ static void xmb_toggle(void *userdata, bool menu_on) entry.tag = -1; entry.cb = NULL; - menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry); + if (entry.subject) + menu_animation_push(&entry); tmp = !menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL); diff --git a/menu/drivers/xui.cpp b/menu/drivers/xui.cpp index c688ab193a..0d733de233 100644 --- a/menu/drivers/xui.cpp +++ b/menu/drivers/xui.cpp @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2015- - Swizzy * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -38,12 +38,15 @@ #include "../menu_navigation.h" #include "../menu_setting.h" #include "../menu_display.h" +#include "../widgets/menu_input_dialog.h" +#include "../../gfx/video_driver.h" #include "../../gfx/video_context_driver.h" +#include "../../configuration.h" #include "../../runloop.h" -#include "../../gfx/d3d/d3d.h" +#include "../../gfx/drivers/d3d.h" #define XUI_CONTROL_NAVIGATE_OK (XUI_CONTROL_NAVIGATE_RIGHT + 1) @@ -63,7 +66,7 @@ HXUIOBJ m_background; HXUIOBJ m_back; HXUIOBJ root_menu; HXUIOBJ current_menu; -static msg_queue_t *xui_msg_queue; +static msg_queue_t *xui_msg_queue = NULL; class CRetroArch : public CXuiModule { @@ -160,7 +163,7 @@ HRESULT CRetroArchMain::OnInit(XUIMessageInit * pInitData, BOOL& bHandled) if (XuiHandleIsValid(m_menutitlebottom)) { - char str[PATH_MAX_LENGTH] = {0}; + char str[PATH_MAX_LENGTH] = {0}; if (menu_entries_get_core_title(str, sizeof(str)) == 0) { @@ -292,7 +295,7 @@ static void* xui_init(void **userdata) video_info.rgb32 = false; d3d_make_d3dpp(d3d, &video_info, &d3dpp); - + hr = app.InitShared(d3d->dev, &d3dpp, (PFN_XUITEXTURELOADER)XuiTextureLoader); @@ -341,7 +344,7 @@ static void* xui_init(void **userdata) } video_driver_set_texture_frame(NULL, - true, 0, 0, 1.0f); + true, 0, 0, 1.0f); xui_msg_queue = msg_queue_new(16); @@ -371,7 +374,7 @@ static void xui_render_message(const char *msg) if (!d3d) return; - + list = string_split(msg, "\n"); if (!list) @@ -399,7 +402,7 @@ end: string_list_free(list); } -static void xui_frame(void *data) +static void xui_frame(void *data, video_frame_info_t *video_info) { XUIMessage msg; XUIMessageRender msgRender; @@ -408,7 +411,7 @@ static void xui_frame(void *data) const char *message = NULL; D3DVIEWPORT vp_full = {0}; d3d_video_t *d3d = (d3d_video_t*)video_driver_get_ptr(false); - + if (!d3d) return; @@ -417,7 +420,7 @@ static void xui_frame(void *data) if (!d3dr) return; - menu_display_set_viewport(); + menu_display_set_viewport(video_info->width, video_info->height); app.RunFrame(); XuiTimersRun(); @@ -445,7 +448,7 @@ static void xui_frame(void *data) XuiRenderEnd( app.GetDC() ); - menu_display_unset_viewport(); + menu_display_unset_viewport(video_info->width, video_info->height); } static void blit_line(int x, int y, const char *message, bool green) @@ -455,9 +458,9 @@ static void blit_line(int x, int y, const char *message, bool green) static void xui_render_background(void) { if (menu_display_libretro_running()) - XuiElementSetShow(m_background, FALSE); - else - XuiElementSetShow(m_background, TRUE); + XuiElementSetShow(m_background, FALSE); + else + XuiElementSetShow(m_background, TRUE); } static void xui_render_messagebox(void *data, const char *message) @@ -525,47 +528,47 @@ static void xui_set_list_text(int index, const wchar_t* leftText, static void xui_render(void *data) { - size_t end, i, selection; - char title[PATH_MAX_LENGTH] = {0}; - const char *dir = NULL; + size_t end, i, selection; + char title[PATH_MAX_LENGTH] = {0}; + const char *dir = NULL; const char *label = NULL; - unsigned menu_type = 0; + unsigned menu_type = 0; uint64_t *frame_count = video_driver_get_frame_count_ptr(); unsigned fb_width = menu_display_get_width(); bool msg_force = menu_display_get_msg_force(); if ( menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL) - && menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) + && menu_driver_is_alive() && !msg_force ) - return; + return; menu_display_unset_framebuffer_dirty_flag(); menu_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL); - xui_render_background(); + xui_render_background(); - if (XuiHandleIsValid(m_menutitle)) - { + if (XuiHandleIsValid(m_menutitle)) + { menu_entries_get_title(title, sizeof(title)); - mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t)); - XuiTextElementSetText(m_menutitle, strw_buffer); - menu_animation_ticker_str(title, RXUI_TERM_WIDTH(fb_width) - 3, + mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t)); + XuiTextElementSetText(m_menutitle, strw_buffer); + menu_animation_ticker_str(title, RXUI_TERM_WIDTH(fb_width) - 3, (unsigned int)*frame_count / 15, title, true); - } + } - if (XuiHandleIsValid(m_menutitle)) - { + if (XuiHandleIsValid(m_menutitle)) + { if (menu_entries_get_core_title(title, sizeof(title)) == 0) { mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t)); XuiTextElementSetText(m_menutitlebottom, strw_buffer); } - } + } - end = menu_entries_get_end(); - for (i = 0; i < end; i++) + end = menu_entries_get_end(); + for (i = 0; i < end; i++) { char entry_path[PATH_MAX_LENGTH] = {0}; char entry_value[PATH_MAX_LENGTH] = {0}; @@ -583,20 +586,21 @@ static void xui_render(void *data) if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection)) return; - XuiListSetCurSelVisible(m_menulist, selection); + XuiListSetCurSelVisible(m_menulist, selection); if (menu_input_dialog_get_display_kb()) - { - char msg[1024] = {0}; + { + char msg[1024] = {0}; const char *str = menu_input_dialog_get_buffer(); const char *label = menu_input_dialog_get_label_buffer(); snprintf(msg, sizeof(msg), "%s\n%s", label, str); - xui_render_messagebox(msg); - } + xui_render_messagebox(NULL, msg); + } } -static void xui_populate_entries(const char *path, +static void xui_populate_entries(void *data, + const char *path, const char *label, unsigned i) { size_t selection; @@ -645,7 +649,8 @@ static void xui_list_insert(void *data, XuiListSetText(m_menulist, list_size, buf); } -static void xui_list_free(file_list_t *list, size_t idx, +static void xui_list_free( + file_list_t *list, size_t idx, size_t list_size) { int x = XuiListGetItemCount( m_menulist ); @@ -671,7 +676,7 @@ static void xui_list_set_selection(void *data, file_list_t *list) file_list_get_directory_ptr(list)); } -static int xui_environ(enum menu_environ_cb type, void *data) +static int xui_environ(enum menu_environ_cb type, void *data, void *userdata) { switch (type) { @@ -691,10 +696,10 @@ menu_ctx_driver_t menu_ctx_xui = { xui_frame, xui_init, xui_free, - NULL, - NULL, + NULL, /* context_reset */ + NULL, /* context_destroy */ xui_populate_entries, - NULL, + NULL, /* toggle */ xui_navigation_clear, xui_navigation_set_visible, xui_navigation_set_visible, @@ -704,19 +709,23 @@ menu_ctx_driver_t menu_ctx_xui = { xui_navigation_alphabet, generic_menu_init_list, xui_list_insert, + NULL, /* list_prepend */ xui_list_free, xui_list_clear, - NULL, - NULL, - NULL, - NULL, - NULL, + NULL, /* list_cache */ + NULL, /* list_push */ + NULL, /* list_get_selection */ + NULL, /* list_get_size */ + NULL, /* list_get_entry */ xui_list_set_selection, - NULL, - NULL, + NULL, /* bind_init */ + NULL, /* load_image */ "xui", xui_environ, - NULL, - NULL, - NULL + NULL, /* pointer_tap */ + NULL, /* update_thumbnail_path */ + NULL, /* update_thumbnail_image */ + NULL, /* osk_ptr_at_pos */ + NULL, /* update_savestate_thumbnail_path */ + NULL /* update_savestate_thumbnail_image */ }; diff --git a/menu/drivers/zarch.c b/menu/drivers/zarch.c index 55b346c57e..f627b53db9 100644 --- a/menu/drivers/zarch.c +++ b/menu/drivers/zarch.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Higor Euripedes - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2015 - Jean-André Santoni + * Copyright (C) 2011-2017 - Higor Euripedes + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -311,19 +311,19 @@ static bool zarch_zui_button(zui_t *zui, int x1, int y1, const char *label) + zarch_zui_strwidth(zui->font, label, 1.0) + 24, y1 + 64, label); } -static bool zarch_zui_list_item(zui_t *zui, struct zui_tabbed *tab, int x1, int y1, +static bool zarch_zui_list_item(video_frame_info_t *video_info, + zui_t *zui, struct zui_tabbed *tab, int x1, int y1, const char *label, unsigned item_id, const char *entry, bool selected) { menu_animation_ctx_ticker_t ticker; unsigned ticker_size; char title_buf[PATH_MAX_LENGTH]; - uint64_t *frame_count = NULL; unsigned id = zarch_zui_hash(zui, label); int x2 = x1 + zui->width - 290 - 40; int y2 = y1 + 50; bool active = zarch_zui_check_button_up(zui, id, x1, y1, x2, y2); const float *bg = zui_bg_panel; - frame_count = video_driver_get_frame_count_ptr(); + uint64_t frame_count = video_info->frame_count; title_buf[0] = '\0'; @@ -346,11 +346,11 @@ static bool zarch_zui_list_item(zui_t *zui, struct zui_tabbed *tab, int x1, int ticker.s = title_buf; ticker.len = ticker_size; - ticker.idx = *frame_count / 50; + ticker.idx = frame_count / 50; ticker.str = label; ticker.selected = (bg == zui_bg_hilite || bg == zui_bg_pad_hilite); - menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker); + menu_animation_ticker(&ticker); menu_display_push_quad(zui->width, zui->height, bg, x1, y1, x2, y2); zarch_zui_draw_text(zui, ZUI_FG_NORMAL, 12, y1 + 35, title_buf); @@ -500,7 +500,9 @@ static bool zarch_zui_gamepad_input(zui_t *zui, return false; } -static int zarch_zui_render_lay_root_recent(zui_t *zui, struct zui_tabbed *tabbed) +static int zarch_zui_render_lay_root_recent( + video_frame_info_t *video_info, + zui_t *zui, struct zui_tabbed *tabbed) { if (zarch_zui_tab(zui, tabbed, "Recent", 0)) { @@ -524,7 +526,9 @@ static int zarch_zui_render_lay_root_recent(zui_t *zui, struct zui_tabbed *tabbe menu_entry_get_rich_label(i, rich_label, sizeof(rich_label)); menu_entry_get_value(i, NULL, entry_value,sizeof(entry_value)); - if (zarch_zui_list_item(zui, tabbed, 0, + if (zarch_zui_list_item( + video_info, + zui, tabbed, 0, tabbed->tabline_size + j * ZUI_ITEM_SIZE_PX, rich_label, i, entry_value, gamepad_index == (signed)i)) { @@ -563,7 +567,9 @@ static void zarch_zui_render_lay_root_load_set_new_path(zui_t *zui, zui->load_dlist = NULL; } -static int zarch_zui_render_lay_root_load(zui_t *zui, +static int zarch_zui_render_lay_root_load( + video_frame_info_t *video_info, + zui_t *zui, struct zui_tabbed *tabbed) { char parent_dir[PATH_MAX_LENGTH]; @@ -605,7 +611,9 @@ static int zarch_zui_render_lay_root_load(zui_t *zui, fill_pathname_parent_dir(parent_dir, zui->load_cwd, sizeof(parent_dir)); if (!string_is_empty(parent_dir) && - zarch_zui_list_item(zui, tabbed, 0, + zarch_zui_list_item( + video_info, + zui, tabbed, 0, tabbed->tabline_size + 73, " ..", 0, NULL, false /* TODO/FIXME */)) { zarch_zui_render_lay_root_load_set_new_path(zui, parent_dir); @@ -651,7 +659,9 @@ static int zarch_zui_render_lay_root_load(zui_t *zui, if (path_is_directory(path)) strncat(label, "/", sizeof(label)-1); - if (zarch_zui_list_item(zui, tabbed, 0, + if (zarch_zui_list_item( + video_info, + zui, tabbed, 0, tabbed->tabline_size + 73 + j * ZUI_ITEM_SIZE_PX, label, i, NULL, gamepad_index == (signed)(i-skip))) { @@ -709,7 +719,8 @@ static int zarch_zui_render_lay_root_downloads( return 0; } -static int zarch_zui_render_lay_root(zui_t *zui) +static int zarch_zui_render_lay_root(video_frame_info_t *video_info, + zui_t *zui) { char item[PATH_MAX_LENGTH]; static struct zui_tabbed tabbed = {~0U}; @@ -719,9 +730,9 @@ static int zarch_zui_render_lay_root(zui_t *zui) tabbed.width = zui->width - 290 - 40; zui->next_selection_set = false; - if (zarch_zui_render_lay_root_recent(zui, &tabbed)) + if (zarch_zui_render_lay_root_recent(video_info, zui, &tabbed)) return 0; - if (zarch_zui_render_lay_root_load (zui, &tabbed)) + if (zarch_zui_render_lay_root_load(video_info, zui, &tabbed)) return 0; if (zarch_zui_render_lay_root_collections(zui, &tabbed)) return 0; @@ -792,7 +803,8 @@ static void zarch_zui_draw_cursor(float x, float y) { } -static int zarch_zui_render_pick_core(zui_t *zui) +static int zarch_zui_render_pick_core(video_frame_info_t *video_info, + zui_t *zui) { static struct zui_tabbed tabbed = {~0U}; unsigned i, j = 0; @@ -814,7 +826,9 @@ static int zarch_zui_render_pick_core(zui_t *zui) if (!zui->pick_supported) { - zarch_zui_list_item(zui, &tabbed, 0, ZUI_ITEM_SIZE_PX, + zarch_zui_list_item( + video_info, + zui, &tabbed, 0, ZUI_ITEM_SIZE_PX, "Content unsupported", 0, NULL, false /* TODO/FIXME */); return 1; } @@ -828,7 +842,9 @@ static int zarch_zui_render_pick_core(zui_t *zui) if (j > 10) break; - if (zarch_zui_list_item(zui, &tabbed, 0, ZUI_ITEM_SIZE_PX + j * ZUI_ITEM_SIZE_PX, + if (zarch_zui_list_item( + video_info, + zui, &tabbed, 0, ZUI_ITEM_SIZE_PX + j * ZUI_ITEM_SIZE_PX, zui->pick_cores[i].display_name, i, NULL, false)) { int ret = zarch_zui_load_content(zui, i); @@ -846,7 +862,7 @@ static int zarch_zui_render_pick_core(zui_t *zui) return 0; } -static void zarch_frame(void *data) +static void zarch_frame(void *data, video_frame_info_t *video_info) { unsigned i; float coord_color[16]; @@ -862,7 +878,7 @@ static void zarch_frame(void *data) video_driver_get_size(&zui->width, &zui->height); - menu_display_set_viewport(); + menu_display_set_viewport(video_info->width, video_info->height); for (i = 0; i < 16; i++) { @@ -899,7 +915,7 @@ static void zarch_frame(void *data) case LAY_HOME: if (zarch_zui_render_sidebar(zui)) return; - if (zarch_zui_render_lay_root(zui)) + if (zarch_zui_render_lay_root(video_info, zui)) return; break; case LAY_SETTINGS: @@ -908,7 +924,7 @@ static void zarch_frame(void *data) case LAY_PICK_CORE: if (zarch_zui_render_sidebar(zui)) return; - if (zarch_zui_render_pick_core(zui)) + if (zarch_zui_render_pick_core(video_info, zui)) return; break; } @@ -954,20 +970,21 @@ static void zarch_frame(void *data) draw.vertex_count = 4; draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP; - if (!menu_display_libretro_running() && draw.texture) - draw.color = &coord_color2[0]; + if (!video_info->libretro_running && draw.texture) + draw.color = &coord_color2[0]; menu_display_blend_begin(); draw.x = 0; draw.y = 0; - menu_display_draw_bg(&draw, false); + menu_display_draw_bg(&draw, video_info, false); menu_display_draw(&draw); menu_display_blend_end(); zui->rendering = false; - menu_display_font_flush_block((font_data_t*)zui->font); - menu_display_unset_viewport(); + menu_display_font_flush_block(video_info->width, video_info->height, + (font_data_t*)zui->font); + menu_display_unset_viewport(video_info->width, video_info->height); } static void *zarch_init(void **userdata) diff --git a/menu/drivers_display/menu_display_caca.c b/menu/drivers_display/menu_display_caca.c index 1fbca75a6b..0e040a2763 100644 --- a/menu/drivers_display/menu_display_caca.c +++ b/menu/drivers_display/menu_display_caca.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/drivers_display/menu_display_ctr.c b/menu/drivers_display/menu_display_ctr.c index 843ca4e86e..84922807d2 100644 --- a/menu/drivers_display/menu_display_ctr.c +++ b/menu/drivers_display/menu_display_ctr.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/drivers_display/menu_display_d3d.cpp b/menu/drivers_display/menu_display_d3d.cpp index 9a4bbed7d8..373963ea4c 100644 --- a/menu/drivers_display/menu_display_d3d.cpp +++ b/menu/drivers_display/menu_display_d3d.cpp @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/drivers_display/menu_display_gdi.c b/menu/drivers_display/menu_display_gdi.c new file mode 100644 index 0000000000..4e3f468b27 --- /dev/null +++ b/menu/drivers_display/menu_display_gdi.c @@ -0,0 +1,119 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include + +#include +#include + +#include "../../config.def.h" +#include "../../gfx/font_driver.h" +#include "../../gfx/video_context_driver.h" + +#include "../menu_display.h" + +#if defined(_WIN32) && !defined(_XBOX) +#include "../../gfx/common/win32_common.h" +#endif + +static void *menu_display_gdi_get_default_mvp(void) +{ + return NULL; +} + +static void menu_display_gdi_blend_begin(void) +{ +} + +static void menu_display_gdi_blend_end(void) +{ +} + +static void menu_display_gdi_draw(void *data) +{ + (void)data; +} + +static void menu_display_gdi_draw_pipeline(void *data) +{ + (void)data; +} + +static void menu_display_gdi_viewport(void *data) +{ + (void)data; +} + +static void menu_display_gdi_restore_clear_color(void) +{ + /*HBRUSH brush = CreateSolidBrush(GetSysColor(COLOR_WINDOW)); + RECT rect; + HWND hwnd = win32_get_window(); + HDC hdc = GetDC(hwnd); + + GetClientRect(hwnd, &rect); + + FillRect(hdc, &rect, brush); + + DeleteObject(brush); + + ReleaseDC(hwnd, hdc);*/ +} + +static void menu_display_gdi_clear_color(menu_display_ctx_clearcolor_t *clearcolor) +{ + (void)clearcolor; + + menu_display_gdi_restore_clear_color(); +} + +static bool menu_display_gdi_font_init_first( + void **font_handle, void *video_data, + const char *font_path, float font_size) +{ + font_data_t **handle = (font_data_t**)font_handle; + *handle = font_driver_init_first(video_data, + font_path, font_size, true, FONT_DRIVER_RENDER_GDI); + return *handle; +} + +static const float *menu_display_gdi_get_default_vertices(void) +{ + static float dummy[16] = {0.0f}; + return &dummy[0]; +} + +static const float *menu_display_gdi_get_default_tex_coords(void) +{ + static float dummy[16] = {0.0f}; + return &dummy[0]; +} + +menu_display_ctx_driver_t menu_display_ctx_gdi = { + menu_display_gdi_draw, + menu_display_gdi_draw_pipeline, + menu_display_gdi_viewport, + menu_display_gdi_blend_begin, + menu_display_gdi_blend_end, + menu_display_gdi_restore_clear_color, + menu_display_gdi_clear_color, + menu_display_gdi_get_default_mvp, + menu_display_gdi_get_default_vertices, + menu_display_gdi_get_default_tex_coords, + menu_display_gdi_font_init_first, + MENU_VIDEO_DRIVER_GDI, + "menu_display_gdi", +}; diff --git a/menu/drivers_display/menu_display_gl.c b/menu/drivers_display/menu_display_gl.c index 997bc6f5f9..3dc579230a 100644 --- a/menu/drivers_display/menu_display_gl.c +++ b/menu/drivers_display/menu_display_gl.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/drivers_display/menu_display_null.c b/menu/drivers_display/menu_display_null.c index a15c9c735b..f3120560fc 100644 --- a/menu/drivers_display/menu_display_null.c +++ b/menu/drivers_display/menu_display_null.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/drivers_display/menu_display_vga.c b/menu/drivers_display/menu_display_vga.c new file mode 100644 index 0000000000..cf99b8d3b4 --- /dev/null +++ b/menu/drivers_display/menu_display_vga.c @@ -0,0 +1,101 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2016 - Brad Parker + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include + +#include +#include + +#include "../../config.def.h" +#include "../../gfx/font_driver.h" +#include "../../gfx/video_context_driver.h" + +#include "../menu_display.h" + +static void *menu_display_vga_get_default_mvp(void) +{ + return NULL; +} + +static void menu_display_vga_blend_begin(void) +{ +} + +static void menu_display_vga_blend_end(void) +{ +} + +static void menu_display_vga_draw(void *data) +{ + (void)data; +} + +static void menu_display_vga_draw_pipeline(void *data) +{ + (void)data; +} + +static void menu_display_vga_viewport(void *data) +{ + (void)data; +} + +static void menu_display_vga_restore_clear_color(void) +{ +} + +static void menu_display_vga_clear_color(menu_display_ctx_clearcolor_t *clearcolor) +{ + (void)clearcolor; +} + +static bool menu_display_vga_font_init_first( + void **font_handle, void *video_data, + const char *font_path, float font_size) +{ + font_data_t **handle = (font_data_t**)font_handle; + *handle = font_driver_init_first(video_data, + font_path, font_size, true, FONT_DRIVER_RENDER_VGA); + return *handle; +} + +static const float *menu_display_vga_get_default_vertices(void) +{ + static float dummy[16] = {0.0f}; + return &dummy[0]; +} + +static const float *menu_display_vga_get_default_tex_coords(void) +{ + static float dummy[16] = {0.0f}; + return &dummy[0]; +} + +menu_display_ctx_driver_t menu_display_ctx_vga = { + menu_display_vga_draw, + menu_display_vga_draw_pipeline, + menu_display_vga_viewport, + menu_display_vga_blend_begin, + menu_display_vga_blend_end, + menu_display_vga_restore_clear_color, + menu_display_vga_clear_color, + menu_display_vga_get_default_mvp, + menu_display_vga_get_default_vertices, + menu_display_vga_get_default_tex_coords, + menu_display_vga_font_init_first, + MENU_VIDEO_DRIVER_VGA, + "menu_display_vga", +}; diff --git a/menu/drivers_display/menu_display_vita2d.c b/menu/drivers_display/menu_display_vita2d.c index 56b61ac7a3..f4f707b053 100644 --- a/menu/drivers_display/menu_display_vita2d.c +++ b/menu/drivers_display/menu_display_vita2d.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/drivers_display/menu_display_vulkan.c b/menu/drivers_display/menu_display_vulkan.c index 4ff563f005..3e99dc454f 100644 --- a/menu/drivers_display/menu_display_vulkan.c +++ b/menu/drivers_display/menu_display_vulkan.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2016 - Hans-Kristian Arntzen - * Copyright (C) 2011-2015 - Daniel De Matteis + * Copyright (C) 2016-2017 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -66,6 +66,7 @@ static unsigned to_display_pipeline( return ((type == MENU_DISPLAY_PRIM_TRIANGLESTRIP) << 1) | (blend << 0); } +#ifdef HAVE_SHADERPIPELINE static unsigned to_menu_pipeline( enum menu_display_prim_type type, unsigned pipeline) { @@ -79,6 +80,7 @@ static unsigned to_menu_pipeline( return 0; } } +#endif static void menu_display_vk_viewport(void *data) { diff --git a/menu/menu_animation.c b/menu/menu_animation.c index 70636f12d2..66c688b89b 100644 --- a/menu/menu_animation.c +++ b/menu/menu_animation.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2016 - Jean-André Santoni - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -289,24 +289,15 @@ static float easing_out_in_bounce(float t, float b, float c, float d) static void menu_animation_ticker_generic(uint64_t idx, size_t max_width, size_t *offset, size_t *width) { - int ticker_period, phase, phase_left_stop; - int phase_left_moving, phase_right_stop; - int left_offset, right_offset; + int ticker_period = 2 * (*width - max_width) + 4; + int phase = idx % ticker_period; - *offset = 0; + int phase_left_stop = 2; + int phase_left_moving = phase_left_stop + (*width - max_width); + int phase_right_stop = phase_left_moving + 2; - if (*width <= max_width) - return; - - ticker_period = 2 * (*width - max_width) + 4; - phase = idx % ticker_period; - - phase_left_stop = 2; - phase_left_moving = phase_left_stop + (*width - max_width); - phase_right_stop = phase_left_moving + 2; - - left_offset = phase - phase_left_stop; - right_offset = (*width - max_width) - (phase - phase_right_stop); + int left_offset = phase - phase_left_stop; + int right_offset = (*width - max_width) - (phase - phase_right_stop); if (phase < phase_left_stop) *offset = 0; @@ -320,153 +311,129 @@ static void menu_animation_ticker_generic(uint64_t idx, *width = max_width; } -static void menu_animation_push_internal(menu_animation_t *anim, - const struct tween *t) -{ - struct tween *target = NULL; - - if (anim->first_dead < anim->size && !anim->list[anim->first_dead].alive) - target = &anim->list[anim->first_dead++]; - else - { - if (anim->size >= anim->capacity) - { - anim->capacity++; - anim->list = (struct tween*)realloc(anim->list, - anim->capacity * sizeof(struct tween)); - } - - target = &anim->list[anim->size++]; - } - - *target = *t; -} - -static bool menu_animation_push(menu_animation_t *anim, menu_animation_ctx_entry_t *entry) +bool menu_animation_push(menu_animation_ctx_entry_t *entry) { struct tween t; + struct tween *target = NULL; - if (!entry || !entry->subject) - return false; - - t.alive = true; - t.duration = entry->duration; - t.running_since = 0; - t.initial_value = *entry->subject; - t.target_value = entry->target_value; - t.subject = entry->subject; - t.tag = entry->tag; - t.cb = entry->cb; - t.easing = NULL; + t.alive = true; + t.duration = entry->duration; + t.running_since = 0; + t.initial_value = *entry->subject; + t.target_value = entry->target_value; + t.subject = entry->subject; + t.tag = entry->tag; + t.cb = entry->cb; + t.easing = NULL; switch (entry->easing_enum) { case EASING_LINEAR: - t.easing = &easing_linear; + t.easing = &easing_linear; break; /* Quad */ case EASING_IN_QUAD: - t.easing = &easing_in_quad; + t.easing = &easing_in_quad; break; case EASING_OUT_QUAD: - t.easing = &easing_out_quad; + t.easing = &easing_out_quad; break; case EASING_IN_OUT_QUAD: - t.easing = &easing_in_out_quad; + t.easing = &easing_in_out_quad; break; case EASING_OUT_IN_QUAD: - t.easing = &easing_out_in_quad; + t.easing = &easing_out_in_quad; break; /* Cubic */ case EASING_IN_CUBIC: - t.easing = &easing_in_cubic; + t.easing = &easing_in_cubic; break; case EASING_OUT_CUBIC: - t.easing = &easing_out_cubic; + t.easing = &easing_out_cubic; break; case EASING_IN_OUT_CUBIC: - t.easing = &easing_in_out_cubic; + t.easing = &easing_in_out_cubic; break; case EASING_OUT_IN_CUBIC: - t.easing = &easing_out_in_cubic; + t.easing = &easing_out_in_cubic; break; /* Quart */ case EASING_IN_QUART: - t.easing = &easing_in_quart; + t.easing = &easing_in_quart; break; case EASING_OUT_QUART: - t.easing = &easing_out_quart; + t.easing = &easing_out_quart; break; case EASING_IN_OUT_QUART: - t.easing = &easing_in_out_quart; + t.easing = &easing_in_out_quart; break; case EASING_OUT_IN_QUART: - t.easing = &easing_out_in_quart; + t.easing = &easing_out_in_quart; break; /* Quint */ case EASING_IN_QUINT: - t.easing = &easing_in_quint; + t.easing = &easing_in_quint; break; case EASING_OUT_QUINT: - t.easing = &easing_out_quint; + t.easing = &easing_out_quint; break; case EASING_IN_OUT_QUINT: - t.easing = &easing_in_out_quint; + t.easing = &easing_in_out_quint; break; case EASING_OUT_IN_QUINT: - t.easing = &easing_out_in_quint; + t.easing = &easing_out_in_quint; break; /* Sine */ case EASING_IN_SINE: - t.easing = &easing_in_sine; + t.easing = &easing_in_sine; break; case EASING_OUT_SINE: - t.easing = &easing_out_sine; + t.easing = &easing_out_sine; break; case EASING_IN_OUT_SINE: - t.easing = &easing_in_out_sine; + t.easing = &easing_in_out_sine; break; case EASING_OUT_IN_SINE: - t.easing = &easing_out_in_sine; + t.easing = &easing_out_in_sine; break; /* Expo */ case EASING_IN_EXPO: - t.easing = &easing_in_expo; + t.easing = &easing_in_expo; break; case EASING_OUT_EXPO: - t.easing = &easing_out_expo; + t.easing = &easing_out_expo; break; case EASING_IN_OUT_EXPO: - t.easing = &easing_in_out_expo; + t.easing = &easing_in_out_expo; break; case EASING_OUT_IN_EXPO: - t.easing = &easing_out_in_expo; + t.easing = &easing_out_in_expo; break; /* Circ */ case EASING_IN_CIRC: - t.easing = &easing_in_circ; + t.easing = &easing_in_circ; break; case EASING_OUT_CIRC: - t.easing = &easing_out_circ; + t.easing = &easing_out_circ; break; case EASING_IN_OUT_CIRC: - t.easing = &easing_in_out_circ; + t.easing = &easing_in_out_circ; break; case EASING_OUT_IN_CIRC: - t.easing = &easing_out_in_circ; + t.easing = &easing_out_in_circ; break; /* Bounce */ case EASING_IN_BOUNCE: - t.easing = &easing_in_bounce; + t.easing = &easing_in_bounce; break; case EASING_OUT_BOUNCE: - t.easing = &easing_out_bounce; + t.easing = &easing_out_bounce; break; case EASING_IN_OUT_BOUNCE: - t.easing = &easing_in_out_bounce; + t.easing = &easing_in_out_bounce; break; case EASING_OUT_IN_BOUNCE: - t.easing = &easing_out_in_bounce; + t.easing = &easing_out_in_bounce; break; default: break; @@ -476,7 +443,21 @@ static bool menu_animation_push(menu_animation_t *anim, menu_animation_ctx_entry if (!t.easing || t.duration == 0 || t.initial_value == t.target_value) return false; - menu_animation_push_internal(anim, &t); + if (anim.first_dead < anim.size && !anim.list[anim.first_dead].alive) + target = &anim.list[anim.first_dead++]; + else + { + if (anim.size >= anim.capacity) + { + anim.capacity++; + anim.list = (struct tween*)realloc(anim.list, + anim.capacity * sizeof(struct tween)); + } + + target = &anim.list[anim.size++]; + } + + *target = t; return true; } @@ -528,6 +509,80 @@ bool menu_animation_update(float delta_time) return true; } +bool menu_animation_ticker(const menu_animation_ctx_ticker_t *ticker) +{ + size_t str_len = utf8len(ticker->str); + size_t offset = 0; + + if ((size_t)str_len <= ticker->len) + { + utf8cpy(ticker->s, + PATH_MAX_LENGTH, + ticker->str, + ticker->len); + return true; + } + + if (!ticker->selected) + { + utf8cpy(ticker->s, PATH_MAX_LENGTH, ticker->str, ticker->len - 3); + strlcat(ticker->s, "...", PATH_MAX_LENGTH); + return true; + } + + if (str_len > ticker->len) + menu_animation_ticker_generic( + ticker->idx, + ticker->len, + &offset, + &str_len); + + utf8cpy( + ticker->s, + PATH_MAX_LENGTH, + utf8skip(ticker->str, offset), + str_len); + + animation_is_active = true; + + return true; +} + +bool menu_animation_get_ideal_delta_time(menu_animation_ctx_delta_t *delta) +{ + if (!delta) + return false; + delta->ideal = delta->current / IDEAL_DELTA_TIME; + return true; +} + +void menu_animation_update_time(bool timedate_enable) +{ + static retro_time_t + last_clock_update = 0; + + cur_time = cpu_features_get_time_usec(); + delta_time = cur_time - old_time; + + if (delta_time >= IDEAL_DELTA_TIME* 4) + delta_time = IDEAL_DELTA_TIME * 4; + if (delta_time <= IDEAL_DELTA_TIME / 4) + delta_time = IDEAL_DELTA_TIME / 4; + old_time = cur_time; + + if (((cur_time - last_clock_update) > 1000000) + && timedate_enable) + { + animation_is_active = true; + last_clock_update = cur_time; + } +} + +bool menu_animation_is_active(void) +{ + return animation_is_active; +} + bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data) { switch (state) @@ -550,8 +605,6 @@ bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data) old_time = 0; delta_time = 0.0f; break; - case MENU_ANIMATION_CTL_IS_ACTIVE: - return animation_is_active; case MENU_ANIMATION_CTL_CLEAR_ACTIVE: animation_is_active = false; break; @@ -566,28 +619,6 @@ bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data) *ptr = delta_time; } break; - case MENU_ANIMATION_CTL_UPDATE_TIME: - { - static retro_time_t last_clock_update = 0; - settings_t *settings = config_get_ptr(); - - cur_time = cpu_features_get_time_usec(); - delta_time = cur_time - old_time; - - if (delta_time >= IDEAL_DELTA_TIME* 4) - delta_time = IDEAL_DELTA_TIME * 4; - if (delta_time <= IDEAL_DELTA_TIME / 4) - delta_time = IDEAL_DELTA_TIME / 4; - old_time = cur_time; - - if (((cur_time - last_clock_update) > 1000000) - && settings->menu.timedate_enable) - { - animation_is_active = true; - last_clock_update = cur_time; - } - } - break; case MENU_ANIMATION_CTL_KILL_BY_TAG: { unsigned i; @@ -638,55 +669,6 @@ bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data) } } break; - case MENU_ANIMATION_CTL_TICKER: - { - menu_animation_ctx_ticker_t *ticker = (menu_animation_ctx_ticker_t*) - data; - size_t str_len = utf8len(ticker->str); - size_t offset = 0; - - if ((size_t)str_len <= ticker->len) - { - utf8cpy(ticker->s, - PATH_MAX_LENGTH, - ticker->str, - ticker->len); - return true; - } - - if (!ticker->selected) - { - utf8cpy(ticker->s, PATH_MAX_LENGTH, ticker->str, ticker->len - 3); - strlcat(ticker->s, "...", PATH_MAX_LENGTH); - return true; - } - - menu_animation_ticker_generic( - ticker->idx, - ticker->len, - &offset, - &str_len); - - utf8cpy( - ticker->s, - PATH_MAX_LENGTH, - utf8skip(ticker->str, offset), - str_len); - - animation_is_active = true; - } - break; - case MENU_ANIMATION_CTL_IDEAL_DELTA_TIME_GET: - { - menu_animation_ctx_delta_t *delta = - (menu_animation_ctx_delta_t*)data; - if (!delta) - return false; - delta->ideal = delta->current / IDEAL_DELTA_TIME; - } - break; - case MENU_ANIMATION_CTL_PUSH: - return menu_animation_push(&anim, (menu_animation_ctx_entry_t *)data); case MENU_ANIMATION_CTL_NONE: default: break; diff --git a/menu/menu_animation.h b/menu/menu_animation.h index 631e569f8e..49d154d305 100644 --- a/menu/menu_animation.h +++ b/menu/menu_animation.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2016 - Jean-André Santoni - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -31,17 +31,12 @@ typedef void (*tween_cb) (void); enum menu_animation_ctl_state { MENU_ANIMATION_CTL_NONE = 0, - MENU_ANIMATION_CTL_IS_ACTIVE, MENU_ANIMATION_CTL_DEINIT, MENU_ANIMATION_CTL_CLEAR_ACTIVE, MENU_ANIMATION_CTL_SET_ACTIVE, MENU_ANIMATION_CTL_DELTA_TIME, - MENU_ANIMATION_CTL_UPDATE_TIME, MENU_ANIMATION_CTL_KILL_BY_TAG, - MENU_ANIMATION_CTL_KILL_BY_SUBJECT, - MENU_ANIMATION_CTL_TICKER, - MENU_ANIMATION_CTL_PUSH, - MENU_ANIMATION_CTL_IDEAL_DELTA_TIME_GET + MENU_ANIMATION_CTL_KILL_BY_SUBJECT }; enum menu_animation_easing_type @@ -128,6 +123,16 @@ typedef struct menu_animation_ctx_ticker bool menu_animation_update(float delta_time); +bool menu_animation_get_ideal_delta_time(menu_animation_ctx_delta_t *delta); + +bool menu_animation_ticker(const menu_animation_ctx_ticker_t *ticker); + +void menu_animation_update_time(bool timedate_enable); + +bool menu_animation_is_active(void); + +bool menu_animation_push(menu_animation_ctx_entry_t *entry); + bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data); RETRO_END_DECLS diff --git a/menu/menu_cbs.c b/menu/menu_cbs.c index 1546145a43..d8a833fb9a 100644 --- a/menu/menu_cbs.c +++ b/menu/menu_cbs.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index 3933ab9e15..930bd07679 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/menu_content.c b/menu/menu_content.c index d62d491a77..3ba808399a 100644 --- a/menu/menu_content.c +++ b/menu/menu_content.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/menu_content.h b/menu/menu_content.h index 81bab9c674..55485b9144 100644 --- a/menu/menu_content.h +++ b/menu/menu_content.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/menu_display.c b/menu/menu_display.c index d2eaf151e0..89a675466e 100644 --- a/menu/menu_display.c +++ b/menu/menu_display.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2016 - Jean-André Santoni - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -82,6 +82,12 @@ static menu_display_ctx_driver_t *menu_display_ctx_drivers[] = { #endif #ifdef HAVE_CACA &menu_display_ctx_caca, +#endif +#if defined(_WIN32) && !defined(_XBOX) + &menu_display_ctx_gdi, +#endif +#ifdef DJGPP + &menu_display_ctx_vga, #endif &menu_display_ctx_null, NULL, @@ -140,6 +146,14 @@ static bool menu_display_check_compatibility( if (string_is_equal(video_driver, "caca")) return true; break; + case MENU_VIDEO_DRIVER_GDI: + if (string_is_equal(video_driver, "gdi")) + return true; + break; + case MENU_VIDEO_DRIVER_VGA: + if (string_is_equal(video_driver, "vga")) + return true; + break; } return false; @@ -233,9 +247,10 @@ void menu_display_font_bind_block(font_data_t *font, void *block) font_driver_bind_block(font, block); } -bool menu_display_font_flush_block(font_data_t *font) +bool menu_display_font_flush_block(unsigned width, unsigned height, + font_data_t *font) { - font_driver_flush(font); + font_driver_flush(width, height, font); font_driver_bind_block(font, NULL); return true; } @@ -383,24 +398,20 @@ void menu_display_set_font_data_init(bool state) bool menu_display_get_update_pending(void) { - if (menu_animation_ctl(MENU_ANIMATION_CTL_IS_ACTIVE, NULL)) + if (menu_animation_is_active()) return true; if (menu_display_get_framebuffer_dirty_flag()) return true; return false; } -void menu_display_set_viewport(void) +void menu_display_set_viewport(unsigned width, unsigned height) { - unsigned width, height; - video_driver_get_size(&width, &height); video_driver_set_viewport(width, height, true, false); } -void menu_display_unset_viewport(void) +void menu_display_unset_viewport(unsigned width, unsigned height) { - unsigned width, height; - video_driver_get_size(&width, &height); video_driver_set_viewport(width, height, false, true); } @@ -491,7 +502,8 @@ void menu_display_draw_pipeline(menu_display_ctx_draw_t *draw) menu_disp->draw_pipeline(draw); } -void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity_to_wallpaper) +void menu_display_draw_bg(menu_display_ctx_draw_t *draw, + video_frame_info_t *video_info, bool add_opacity_to_wallpaper) { static struct video_coords coords; const float *new_vertex = NULL; @@ -515,14 +527,11 @@ void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity_to_wal draw->coords = &coords; - if (!menu_display_libretro_running() && !draw->pipeline.active) + if (!video_info->libretro_running && !draw->pipeline.active) add_opacity_to_wallpaper = true; if (add_opacity_to_wallpaper) - { - settings_t *settings = config_get_ptr(); - menu_display_set_alpha(draw->color, settings->menu.wallpaper.opacity); - } + menu_display_set_alpha(draw->color, video_info->menu_wallpaper_opacity); if (!draw->texture) draw->texture = menu_display_white_texture; @@ -530,13 +539,14 @@ void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity_to_wal draw->matrix_data = (math_matrix_4x4*)menu_disp->get_default_mvp(); } -void menu_display_draw_gradient(menu_display_ctx_draw_t *draw) +void menu_display_draw_gradient(menu_display_ctx_draw_t *draw, + video_frame_info_t *video_info) { draw->texture = 0; draw->x = 0; draw->y = 0; - menu_display_draw_bg(draw, false); + menu_display_draw_bg(draw, video_info, false); menu_display_draw(draw); } diff --git a/menu/menu_display.h b/menu/menu_display.h index d58c00df12..e2d43afde5 100644 --- a/menu/menu_display.h +++ b/menu/menu_display.h @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2016 - Jean-André Santoni - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -26,6 +26,7 @@ #include #include "../file_path_special.h" +#include "../gfx/font_driver.h" #include "../gfx/video_context_driver.h" #include "../gfx/video_coord_array.h" @@ -95,7 +96,9 @@ enum menu_display_driver_type MENU_VIDEO_DRIVER_DIRECT3D, MENU_VIDEO_DRIVER_VITA2D, MENU_VIDEO_DRIVER_CTR, - MENU_VIDEO_DRIVER_CACA + MENU_VIDEO_DRIVER_CACA, + MENU_VIDEO_DRIVER_GDI, + MENU_VIDEO_DRIVER_VGA }; typedef struct menu_display_ctx_clearcolor @@ -198,7 +201,7 @@ void menu_display_blend_end(void); void menu_display_font_free(font_data_t *font); font_data_t *menu_display_font_main_init(menu_display_ctx_font_t *font); void menu_display_font_bind_block(font_data_t *font, void *block); -bool menu_display_font_flush_block(font_data_t *font); +bool menu_display_font_flush_block(unsigned width, unsigned height, font_data_t *font); void menu_display_framebuffer_deinit(void); @@ -226,8 +229,8 @@ void menu_display_set_msg_force(bool state); bool menu_display_get_font_data_init(void); void menu_display_set_font_data_init(bool state); bool menu_display_get_update_pending(void); -void menu_display_set_viewport(void); -void menu_display_unset_viewport(void); +void menu_display_set_viewport(unsigned width, unsigned height); +void menu_display_unset_viewport(unsigned width, unsigned height); bool menu_display_get_framebuffer_dirty_flag(void); void menu_display_set_framebuffer_dirty_flag(void); void menu_display_unset_framebuffer_dirty_flag(void); @@ -238,8 +241,13 @@ void menu_display_clear_color(menu_display_ctx_clearcolor_t *color); void menu_display_draw(menu_display_ctx_draw_t *draw); void menu_display_draw_pipeline(menu_display_ctx_draw_t *draw); -void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity); -void menu_display_draw_gradient(menu_display_ctx_draw_t *draw); +void menu_display_draw_bg( + menu_display_ctx_draw_t *draw, + video_frame_info_t *video_info, + bool add_opacity); +void menu_display_draw_gradient( + menu_display_ctx_draw_t *draw, + video_frame_info_t *video_info); void menu_display_draw_quad(int x, int y, unsigned w, unsigned h, unsigned width, unsigned height, float *color); @@ -294,6 +302,8 @@ extern menu_display_ctx_driver_t menu_display_ctx_d3d; extern menu_display_ctx_driver_t menu_display_ctx_vita2d; extern menu_display_ctx_driver_t menu_display_ctx_ctr; extern menu_display_ctx_driver_t menu_display_ctx_caca; +extern menu_display_ctx_driver_t menu_display_ctx_gdi; +extern menu_display_ctx_driver_t menu_display_ctx_vga; extern menu_display_ctx_driver_t menu_display_ctx_null; RETRO_END_DECLS diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 06a6cda92f..27392939bc 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2016 - Jean-André Santoni - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -244,11 +244,6 @@ static int menu_displaylist_parse_netplay( MENU_ENUM_LABEL_NETPLAY_DISCONNECT, MENU_SETTING_ACTION, 0, 0); - menu_entries_append_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_SETTINGS), - msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_SETTINGS), - MENU_ENUM_LABEL_NETWORK_SETTINGS, MENU_SETTING_GROUP, 0, 0); - menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS), msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_LAN_SCAN_SETTINGS), @@ -318,7 +313,6 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info) unsigned i; char tmp[PATH_MAX_LENGTH]; core_info_t *core_info = NULL; - settings_t *settings = config_get_ptr(); tmp[0] = '\0'; @@ -440,6 +434,7 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info) if (core_info->firmware_count > 0) { core_info_ctx_firmware_t firmware_info; + settings_t *settings = config_get_ptr(); firmware_info.path = core_info->path; firmware_info.directory.system = settings->directory.system; @@ -1436,10 +1431,8 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, char fill_buf[PATH_MAX_LENGTH]; char path_copy[PATH_MAX_LENGTH]; const char *core_name = NULL; - const char *db_name = NULL; const char *path = NULL; const char *label = NULL; - const char *crc32 = NULL; fill_buf[0] = path_copy[0] = '\0'; @@ -1448,7 +1441,7 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, path = path_copy; playlist_get_index(playlist, i, - &path, &label, NULL, &core_name, &crc32, &db_name); + &path, &label, NULL, &core_name, NULL, NULL); if (core_name) strlcpy(fill_buf, core_name, sizeof(fill_buf)); @@ -1717,14 +1710,10 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info) char tmp[PATH_MAX_LENGTH]; char crc_str[20]; database_info_t *db_info_entry = &db_info->list[i]; - settings_t *settings = config_get_ptr(); - bool show_advanced_settings = false; + bool show_advanced_settings = settings->menu.show_advanced_settings; crc_str[0] = tmp[0] = '\0'; - if (settings) - show_advanced_settings = settings->menu.show_advanced_settings; - snprintf(crc_str, sizeof(crc_str), "%08X", db_info_entry->crc32); if (playlist) @@ -2699,6 +2688,11 @@ static int menu_displaylist_parse_load_content_settings( MENU_ENUM_LABEL_CORE_INPUT_REMAPPING_OPTIONS, MENU_SETTING_ACTION, 0, 0); +#ifdef HAVE_NETWORKING + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_NETPLAY, + PARSE_ACTION, false); +#endif menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_CHEAT_OPTIONS), @@ -2932,6 +2926,7 @@ static int menu_displaylist_parse_add_content_list( static int menu_displaylist_parse_scan_directory_list( menu_displaylist_info_t *info) { + #ifdef HAVE_LIBRETRODB menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY), @@ -2949,6 +2944,40 @@ static int menu_displaylist_parse_scan_directory_list( return 0; } +static int menu_displaylist_parse_netplay_room_list( + menu_displaylist_info_t *info) +{ + +#ifdef HAVE_NETWORKING + menu_entries_append_enum(info->list, + "Refresh Room List", + msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS), + MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS, + MENU_SETTING_ACTION, 0, 0); + + if (netplay_room_count > 0) + { + unsigned i; + for (i = 0; i < netplay_room_count; i++) + { + char s[PATH_MAX_LENGTH]; + + s[0] = '\0'; + + snprintf(s, sizeof(s), + "Nickname: %s", netplay_room_list[i].nickname); + menu_entries_append_enum(info->list, + s, + msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM), + MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM, + MENU_WIFI, 0, 0); + } + } +#endif + + return 0; +} + static int menu_displaylist_parse_options( menu_displaylist_info_t *info) { @@ -3783,6 +3812,12 @@ static bool menu_displaylist_push_internal( return false; return true; } + else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB))) + { + if (!menu_displaylist_ctl(DISPLAYLIST_NETPLAY_ROOM_LIST, info)) + return false; + return true; + } else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU))) { if (!menu_displaylist_ctl(DISPLAYLIST_HORIZONTAL, info)) @@ -3911,6 +3946,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) case DISPLAYLIST_ADD_CONTENT_LIST: case DISPLAYLIST_CONFIGURATIONS_LIST: case DISPLAYLIST_SCAN_DIRECTORY_LIST: + case DISPLAYLIST_NETPLAY_ROOM_LIST: case DISPLAYLIST_LOAD_CONTENT_LIST: case DISPLAYLIST_USER_BINDS_LIST: case DISPLAYLIST_ACCOUNTS_LIST: @@ -5314,6 +5350,12 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) case DISPLAYLIST_SCAN_DIRECTORY_LIST: ret = menu_displaylist_parse_scan_directory_list(info); + info->need_push = true; + info->need_refresh = true; + break; + case DISPLAYLIST_NETPLAY_ROOM_LIST: + ret = menu_displaylist_parse_netplay_room_list(info); + info->need_push = true; info->need_refresh = true; break; @@ -5746,10 +5788,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) info->need_push = true; { - unsigned cores_names_len; - size_t cores_names_size; - unsigned cores_paths_len; - size_t cores_paths_size; + unsigned cores_names_len = 0; + unsigned cores_paths_len = 0; + size_t cores_paths_size = 0; + size_t cores_names_size = 0; struct string_list *cores_names = string_list_new_special(STRING_LIST_SUPPORTED_CORES_NAMES, (void*)menu->deferred_path, @@ -5881,10 +5923,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) info->need_push = true; { - unsigned cores_names_len; - size_t cores_names_size; - unsigned cores_paths_len; - size_t cores_paths_size; + unsigned cores_names_len = 0; + unsigned cores_paths_len = 0; + size_t cores_paths_size = 0; + size_t cores_names_size = 0; struct string_list *cores_names = string_list_new_special(STRING_LIST_SUPPORTED_CORES_NAMES, (void*)menu->deferred_path, diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 5e63c5f768..043ff81356 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -151,6 +151,7 @@ enum menu_displaylist_ctl_state DISPLAYLIST_ADD_CONTENT_LIST, DISPLAYLIST_CONFIGURATIONS_LIST, DISPLAYLIST_SCAN_DIRECTORY_LIST, + DISPLAYLIST_NETPLAY_ROOM_LIST, DISPLAYLIST_ARCHIVE_ACTION, DISPLAYLIST_ARCHIVE_ACTION_DETECT_CORE, DISPLAYLIST_CORE_CONTENT, diff --git a/menu/menu_driver.c b/menu/menu_driver.c index bbc6d4d29d..5575af35e7 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -252,7 +252,7 @@ static void menu_driver_toggle(bool on) runloop_ctl(RUNLOOP_CTL_FRONTEND_KEY_EVENT_GET, &frontend_key_event); runloop_ctl(RUNLOOP_CTL_KEY_EVENT_GET, &key_event); - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_alive) { bool refresh = false; menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); @@ -279,7 +279,7 @@ static void menu_driver_toggle(bool on) else { if (!runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL)) - driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL); + driver_set_nonblock_state(); if (settings && settings->menu.pause_libretro) command_event(CMD_EVENT_AUDIO_START, NULL); @@ -302,6 +302,12 @@ const char *menu_driver_ident(void) return menu_driver_ctx->ident; } +void menu_driver_frame(video_frame_info_t *video_info) +{ + if (menu_driver_alive && menu_driver_ctx->frame) + menu_driver_ctx->frame(menu_userdata, video_info); +} + /** * menu_update_libretro_info: * @@ -321,6 +327,57 @@ static void menu_update_libretro_info(void) command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL); } +bool menu_driver_render(bool is_idle) +{ + if (!menu_driver_data) + return false; + + if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_FRAMEBUFFER) + != BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_MESSAGEBOX)) + BIT64_SET(menu_driver_data->state, MENU_STATE_RENDER_FRAMEBUFFER); + + if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_FRAMEBUFFER)) + menu_display_set_framebuffer_dirty_flag(); + + if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_MESSAGEBOX) + && !string_is_empty(menu_driver_data->menu_state.msg)) + { + if (menu_driver_ctx->render_messagebox) + menu_driver_ctx->render_messagebox(menu_userdata, + menu_driver_data->menu_state.msg); + + if (ui_companion_is_on_foreground()) + { + const ui_companion_driver_t *ui = ui_companion_get_ptr(); + if (ui->render_messagebox) + ui->render_messagebox(menu_driver_data->menu_state.msg); + } + } + + if (BIT64_GET(menu_driver_data->state, MENU_STATE_BLIT)) + { + settings_t *settings = config_get_ptr(); + menu_animation_update_time(settings->menu.timedate_enable); + + if (menu_driver_ctx->render) + menu_driver_ctx->render(menu_userdata); + } + + if (menu_driver_alive && !is_idle) + menu_display_libretro(); + + menu_driver_ctl(RARCH_MENU_CTL_SET_TEXTURE, NULL); + + menu_driver_data->state = 0; + + return true; +} + +bool menu_driver_is_alive(void) +{ + return menu_driver_alive; +} + bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) { switch (state) @@ -436,59 +493,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) memset(&menu_driver_system, 0, sizeof(struct retro_system_info)); } break; - case RARCH_MENU_CTL_RENDER_MESSAGEBOX: - if (menu_driver_ctx->render_messagebox) - menu_driver_ctx->render_messagebox(menu_userdata, - menu_driver_data->menu_state.msg); - break; - case RARCH_MENU_CTL_BLIT_RENDER: - if (menu_driver_ctx->render) - menu_driver_ctx->render(menu_userdata); - break; - case RARCH_MENU_CTL_RENDER: - if (!menu_driver_data) - return false; - - if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_FRAMEBUFFER) - != BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_MESSAGEBOX)) - BIT64_SET(menu_driver_data->state, MENU_STATE_RENDER_FRAMEBUFFER); - - if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_FRAMEBUFFER)) - menu_display_set_framebuffer_dirty_flag(); - - if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_MESSAGEBOX) - && !string_is_empty(menu_driver_data->menu_state.msg)) - { - menu_driver_ctl(RARCH_MENU_CTL_RENDER_MESSAGEBOX, NULL); - - if (ui_companion_is_on_foreground()) - { - const ui_companion_driver_t *ui = ui_companion_get_ptr(); - if (ui->render_messagebox) - ui->render_messagebox(menu_driver_data->menu_state.msg); - } - } - - if (BIT64_GET(menu_driver_data->state, MENU_STATE_BLIT)) - { - menu_animation_ctl(MENU_ANIMATION_CTL_UPDATE_TIME, NULL); - menu_driver_ctl(RARCH_MENU_CTL_BLIT_RENDER, NULL); - } - - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) - && !runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL)) - menu_display_libretro(); - - menu_driver_ctl(RARCH_MENU_CTL_SET_TEXTURE, NULL); - - menu_driver_data->state = 0; - break; - case RARCH_MENU_CTL_FRAME: - if (!menu_driver_alive) - return false; - if (menu_driver_ctx->frame) - menu_driver_ctx->frame(menu_userdata); - break; case RARCH_MENU_CTL_SET_PREVENT_POPULATE: menu_driver_prevent_populate = true; break; @@ -505,8 +509,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) case RARCH_MENU_CTL_UNSET_TOGGLE: menu_driver_toggle(false); break; - case RARCH_MENU_CTL_IS_ALIVE: - return menu_driver_alive; case RARCH_MENU_CTL_SET_OWN_DRIVER: menu_driver_data_own = true; break; @@ -882,14 +884,17 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) break; case RARCH_MENU_CTL_OSK_PTR_AT_POS: { + unsigned width = 0; + unsigned height = 0; menu_ctx_pointer_t *point = (menu_ctx_pointer_t*)data; if (!menu_driver_ctx || !menu_driver_ctx->osk_ptr_at_pos) { point->retcode = 0; return false; } + video_driver_get_size(&width, &height); point->retcode = menu_driver_ctx->osk_ptr_at_pos(menu_userdata, - point->x, point->y); + point->x, point->y, width, height); } break; case RARCH_MENU_CTL_BIND_INIT: diff --git a/menu/menu_driver.h b/menu/menu_driver.h index e097fd6a06..f67f3fc8d8 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -50,6 +50,7 @@ RETRO_BEGIN_DECLS #define MENU_SETTINGS_CORE_OPTION_START 0x10000 #define MENU_SETTINGS_PLAYLIST_ASSOCIATION_START 0x20000 #define MENU_SETTINGS_CHEEVOS_START 0x40000 +#define MENU_SETTINGS_NETPLAY_ROOMS_START 0x80000 enum menu_image_type { @@ -96,10 +97,6 @@ enum rarch_menu_ctl_state RARCH_MENU_CTL_SET_PENDING_SHUTDOWN, RARCH_MENU_CTL_DEINIT, RARCH_MENU_CTL_INIT, - RARCH_MENU_CTL_BLIT_RENDER, - RARCH_MENU_CTL_RENDER, - RARCH_MENU_CTL_RENDER_MESSAGEBOX, - RARCH_MENU_CTL_FRAME, RARCH_MENU_CTL_SET_PREVENT_POPULATE, RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, RARCH_MENU_CTL_IS_PREVENT_POPULATE, @@ -107,7 +104,6 @@ enum rarch_menu_ctl_state RARCH_MENU_CTL_IS_TOGGLE, RARCH_MENU_CTL_SET_TOGGLE, RARCH_MENU_CTL_UNSET_TOGGLE, - RARCH_MENU_CTL_IS_ALIVE, RARCH_MENU_CTL_DESTROY, RARCH_MENU_CTL_IS_SET_TEXTURE, RARCH_MENU_CTL_SET_OWN_DRIVER, @@ -158,6 +154,7 @@ enum menu_settings_type MENU_MUSIC_TAB, MENU_VIDEO_TAB, MENU_IMAGES_TAB, + MENU_NETPLAY_TAB, MENU_ADD_TAB, MENU_PLAYLISTS_TAB, MENU_SETTING_NO_ITEM, @@ -238,7 +235,7 @@ typedef struct menu_ctx_driver void (*render_messagebox)(void *data, const char *msg); int (*iterate)(void *data, void *userdata, enum menu_action action); void (*render)(void *data); - void (*frame)(void *data); + void (*frame)(void *data, video_frame_info_t *video_info); void* (*init)(void**); void (*free)(void*); void (*context_reset)(void *data); @@ -277,7 +274,7 @@ typedef struct menu_ctx_driver menu_entry_t *entry, unsigned action); void (*update_thumbnail_path)(void *data, unsigned i); void (*update_thumbnail_image)(void *data); - int (*osk_ptr_at_pos)(void *data, int x, int y); + int (*osk_ptr_at_pos)(void *data, int x, int y, unsigned width, unsigned height); void (*update_savestate_thumbnail_path)(void *data, unsigned i); void (*update_savestate_thumbnail_image)(void *data); } menu_ctx_driver_t; @@ -384,12 +381,18 @@ extern unsigned int rdb_entry_start_game_selection_ptr; const char *menu_driver_ident(void); +bool menu_driver_render(bool is_idle); + bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data); bool menu_driver_is_binding_state(void); void menu_driver_set_binding_state(bool on); +void menu_driver_frame(video_frame_info_t *video_info); + +bool menu_driver_is_alive(void); + extern menu_ctx_driver_t menu_ctx_xui; extern menu_ctx_driver_t menu_ctx_rgui; extern menu_ctx_driver_t menu_ctx_mui; diff --git a/menu/menu_entries.c b/menu/menu_entries.c index 75807a01e9..2f052e9b7f 100644 --- a/menu/menu_entries.c +++ b/menu/menu_entries.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2014-2015 - Jay McCarthy - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/menu_entries.h b/menu/menu_entries.h index f3015c2297..bb58b5f5b7 100644 --- a/menu/menu_entries.h +++ b/menu/menu_entries.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/menu_event.c b/menu/menu_event.c index cf14f68423..7546b7bc53 100644 --- a/menu/menu_event.c +++ b/menu/menu_event.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2016 - Jean-André Santoni + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -102,7 +102,7 @@ void menu_event_kb_set(bool down, enum retro_key key) unsigned i; for (i = 0; i < RETROK_LAST; i++) - menu_event_kb_set_internal(i, (menu_event_kb_is_set(i) & 1) << 1); + menu_event_kb_set_internal(i, (menu_event_kb_is_set((enum retro_key)i) & 1) << 1); } else menu_event_kb_set_internal(key, ((menu_event_kb_is_set(key) & 1) << 1) | down); @@ -182,7 +182,7 @@ unsigned menu_event(uint64_t input, uint64_t trigger_input) delta.current = delta_time; - if (menu_animation_ctl(MENU_ANIMATION_CTL_IDEAL_DELTA_TIME_GET, &delta)) + if (menu_animation_get_ideal_delta_time(&delta)) delay_count += delta.ideal; if (menu_input_dialog_get_display_kb()) diff --git a/menu/menu_event.h b/menu/menu_event.h index 300e945258..1ae9041f63 100644 --- a/menu/menu_event.h +++ b/menu/menu_event.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/menu_input.c b/menu/menu_input.c index 8880854fdb..f771cf9afb 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/menu_input.h b/menu/menu_input.h index 90e30e3c3b..cec5559b77 100644 --- a/menu/menu_input.h +++ b/menu/menu_input.h @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/menu_navigation.c b/menu/menu_navigation.c index 6c1aec3c4e..9d04848516 100644 --- a/menu/menu_navigation.c +++ b/menu/menu_navigation.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/menu_navigation.h b/menu/menu_navigation.h index f81ced5e38..4ef22d355b 100644 --- a/menu/menu_navigation.h +++ b/menu/menu_navigation.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/menu_setting.c b/menu/menu_setting.c index bacc866d20..64145779f1 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -1,8 +1,8 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2016 - Jean-André Santoni - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -1022,7 +1022,6 @@ static int setting_action_start_libretro_device_type(void *data) unsigned devices[128], types = 0, port = 0; const struct retro_controller_info *desc = NULL; rarch_system_info_t *system = NULL; - settings_t *settings = config_get_ptr(); rarch_setting_t *setting = (rarch_setting_t*)data; if (setting_generic_action_start_default(setting) != 0) @@ -1062,7 +1061,7 @@ static int setting_action_start_libretro_device_type(void *data) current_device = RETRO_DEVICE_JOYPAD; - settings->input.libretro_device[port] = current_device; + input_config_set_device(port, current_device); pad.port = port; pad.device = current_device; @@ -1176,7 +1175,7 @@ static int setting_action_left_libretro_device_type( current_device = devices [(current_idx + types - 1) % types]; - settings->input.libretro_device[port] = current_device; + input_config_set_device(port, current_device); pad.port = port; pad.device = current_device; @@ -1243,7 +1242,7 @@ static int setting_action_right_libretro_device_type( current_device = devices [(current_idx + 1) % types]; - settings->input.libretro_device[port] = current_device; + input_config_set_device(port, current_device); pad.port = port; pad.device = current_device; diff --git a/menu/menu_setting.h b/menu/menu_setting.h index 9da1cb9dc5..1079b185d9 100644 --- a/menu/menu_setting.h +++ b/menu/menu_setting.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/menu_shader.c b/menu/menu_shader.c index aa299e49b6..21c4b35432 100644 --- a/menu/menu_shader.c +++ b/menu/menu_shader.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -309,7 +309,6 @@ bool menu_shader_manager_save_preset( config_file_t *conf = NULL; bool ret = false; struct video_shader *shader = menu_shader_get(); - settings_t *settings = config_get_ptr(); buffer[0] = config_directory[0] = '\0'; preset_path[0] = '\0'; @@ -385,9 +384,10 @@ bool menu_shader_manager_save_preset( if (!fullpath) { - dirs[0] = settings->directory.video_shader; - dirs[1] = settings->directory.menu_config; - dirs[2] = config_directory; + settings_t *settings = config_get_ptr(); + dirs[0] = settings->directory.video_shader; + dirs[1] = settings->directory.menu_config; + dirs[2] = config_directory; } conf = (config_file_t*)config_file_new(NULL); diff --git a/menu/menu_shader.h b/menu/menu_shader.h index 7c0963387e..1c14e69b49 100644 --- a/menu/menu_shader.h +++ b/menu/menu_shader.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/widgets/menu_dialog.c b/menu/widgets/menu_dialog.c index 86f757fe6b..d2a1f26fa0 100644 --- a/menu/widgets/menu_dialog.c +++ b/menu/widgets/menu_dialog.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/widgets/menu_dialog.h b/menu/widgets/menu_dialog.h index 560ed72589..b692fe3138 100644 --- a/menu/widgets/menu_dialog.h +++ b/menu/widgets/menu_dialog.h @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index 1fe68b8f01..aa0116ba8f 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2014-2015 - Jay McCarthy * * RetroArch is free software: you can redistribute it and/or modify it under the terms diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index d37fa7e457..01e6180a1f 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/widgets/menu_filebrowser.c b/menu/widgets/menu_filebrowser.c index 056b956875..bd20f21f54 100644 --- a/menu/widgets/menu_filebrowser.c +++ b/menu/widgets/menu_filebrowser.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/widgets/menu_filebrowser.h b/menu/widgets/menu_filebrowser.h index 4ccd45f2c7..9fc950bbdd 100644 --- a/menu/widgets/menu_filebrowser.h +++ b/menu/widgets/menu_filebrowser.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/widgets/menu_input_bind_dialog.c b/menu/widgets/menu_input_bind_dialog.c index c80206d09b..e5d8fadddf 100644 --- a/menu/widgets/menu_input_bind_dialog.c +++ b/menu/widgets/menu_input_bind_dialog.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -382,15 +382,8 @@ bool menu_input_key_bind_set_min_max(menu_input_ctx_bind_limits_t *lim) bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind) { struct menu_bind_state binds; - /* single binds can have latching issues, - * single_bind_delay = 0 (single bind not yet bound) - * single_bind_delay = 1 (latching procedure) - * single_bind_delay = 2 (second iteration, will quit iteration loop) - */ - static unsigned single_bind_delay = 0; - bool trigger_found = false; - bool timed_out = false; - settings_t *settings = config_get_ptr(); + bool timed_out = false; + settings_t *settings = config_get_ptr(); rarch_timer_tick(&menu_input_binds.timer); @@ -407,27 +400,12 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind) timed_out = true; } - if (single_bind_delay > 0) - { - snprintf(bind->s, bind->len, "Confirming key %s ...", - input_config_bind_map_get_desc( - menu_input_binds.begin - MENU_SETTINGS_BIND_BEGIN) - ); - single_bind_delay++; - } - else - snprintf(bind->s, bind->len, - "[%s]\npress keyboard or joypad\n(timeout %d %s)", - input_config_bind_map_get_desc( - menu_input_binds.begin - MENU_SETTINGS_BIND_BEGIN), - rarch_timer_get_timeout(&menu_input_binds.timer), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SECONDS)); - - if (single_bind_delay == 2) - { - single_bind_delay = 0; - return true; - } + snprintf(bind->s, bind->len, + "[%s]\npress keyboard or joypad\n(timeout %d %s)", + input_config_bind_map_get_desc( + menu_input_binds.begin - MENU_SETTINGS_BIND_BEGIN), + rarch_timer_get_timeout(&menu_input_binds.timer), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SECONDS)); /* binds.begin is updated in keyboard_press callback. */ if (menu_input_binds.begin > menu_input_binds.last) @@ -439,13 +417,6 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind) if (timed_out) input_keyboard_ctl(RARCH_INPUT_KEYBOARD_CTL_CANCEL_WAIT_KEYS, NULL); - /* If this is a single bind, add another delay of one second */ - if (!timed_out && (binds.begin == binds.last)) - { - single_bind_delay = 1; - return false; - } - return true; } @@ -454,23 +425,14 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind) input_driver_keyboard_mapping_set_block(true); menu_input_key_bind_poll_bind_state(&binds, menu_bind_port, timed_out); - if (single_bind_delay == 0) - trigger_found = menu_input_key_bind_poll_find_trigger(&menu_input_binds, &binds); - - if ((binds.skip && !menu_input_binds.skip) || trigger_found) + if ((binds.skip && !menu_input_binds.skip) || + menu_input_key_bind_poll_find_trigger(&menu_input_binds, &binds)) { input_driver_keyboard_mapping_set_block(false); /* Avoid new binds triggering things right away. */ input_driver_set_flushing_input(); - /* If this is a single bind, add a latching delay */ - if (binds.begin == binds.last) - { - single_bind_delay = 1; - return false; - } - binds.begin++; if (binds.begin > binds.last) diff --git a/menu/widgets/menu_input_bind_dialog.h b/menu/widgets/menu_input_bind_dialog.h index 58c08fcb16..36ff6cce7d 100644 --- a/menu/widgets/menu_input_bind_dialog.h +++ b/menu/widgets/menu_input_bind_dialog.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/widgets/menu_input_dialog.c b/menu/widgets/menu_input_dialog.c index b6e232c458..12041438d5 100644 --- a/menu/widgets/menu_input_dialog.c +++ b/menu/widgets/menu_input_dialog.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/widgets/menu_input_dialog.h b/menu/widgets/menu_input_dialog.h index be28d1d10e..a1e5c31e10 100644 --- a/menu/widgets/menu_input_dialog.h +++ b/menu/widgets/menu_input_dialog.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/widgets/menu_list.c b/menu/widgets/menu_list.c index f207bb0342..7d7c37c996 100644 --- a/menu/widgets/menu_list.c +++ b/menu/widgets/menu_list.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/widgets/menu_list.h b/menu/widgets/menu_list.h index e44f2ec591..16468598c3 100644 --- a/menu/widgets/menu_list.h +++ b/menu/widgets/menu_list.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/widgets/menu_osk.c b/menu/widgets/menu_osk.c index db9c8c1488..1de8c7d522 100644 --- a/menu/widgets/menu_osk.c +++ b/menu/widgets/menu_osk.c @@ -1,5 +1,5 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/menu/widgets/menu_osk.h b/menu/widgets/menu_osk.h index 5869969110..9694bcf4c2 100644 --- a/menu/widgets/menu_osk.h +++ b/menu/widgets/menu_osk.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/movie.c b/movie.c index 87005f38b7..dc87fa4d38 100644 --- a/movie.c +++ b/movie.c @@ -110,14 +110,16 @@ static bool init_playback(bsv_movie_t *handle, const char *path) if (state_size) { - retro_ctx_serialize_info_t serial_info; retro_ctx_size_info_t info; + retro_ctx_serialize_info_t serial_info; + uint8_t *buf = (uint8_t*)malloc(state_size); - handle->state = (uint8_t*)malloc(state_size); - handle->state_size = state_size; - if (!handle->state) + if (!buf) return false; + handle->state = buf; + handle->state_size = state_size; + if (fread(handle->state, 1, state_size, handle->file) != state_size) { RARCH_ERR("%s\n", msg_hash_to_str(MSG_COULD_NOT_READ_STATE_FROM_MOVIE)); @@ -239,15 +241,16 @@ error: } /* Used for rewinding while playback/record. */ -static void bsv_movie_set_frame_start(bsv_movie_t *handle) +void bsv_movie_set_frame_start(void) { - if (!handle) - return; - handle->frame_pos[handle->frame_ptr] = ftell(handle->file); + bsv_movie_t *handle = bsv_movie_state.movie; + if (handle) + handle->frame_pos[handle->frame_ptr] = ftell(handle->file); } -static void bsv_movie_set_frame_end(bsv_movie_t *handle) +void bsv_movie_set_frame_end(void) { + bsv_movie_t *handle = bsv_movie_state.movie; if (!handle) return; @@ -353,6 +356,17 @@ static void bsv_movie_init_state(void) } } +bool bsv_movie_get_input(int16_t *bsv_data) +{ + bsv_movie_t *handle = bsv_movie_state.movie; + if (fread(bsv_data, sizeof(int16_t), 1, handle->file) != 1) + return false; + + *bsv_data = swap_if_big16(*bsv_data); + + return true; +} + bool bsv_movie_ctl(enum bsv_ctl_state state, void *data) { switch (state) @@ -379,8 +393,6 @@ bool bsv_movie_ctl(enum bsv_ctl_state state, void *data) case BSV_MOVIE_CTL_UNSET_START_PLAYBACK: bsv_movie_state.movie_start_playback = false; break; - case BSV_MOVIE_CTL_END: - return bsv_movie_state.movie_end; case BSV_MOVIE_CTL_SET_END_EOF: bsv_movie_state.eof_exit = true; break; @@ -403,25 +415,9 @@ bool bsv_movie_ctl(enum bsv_ctl_state state, void *data) case BSV_MOVIE_CTL_INIT: bsv_movie_init_state(); break; - case BSV_MOVIE_CTL_SET_FRAME_START: - bsv_movie_set_frame_start(bsv_movie_state.movie); - break; - case BSV_MOVIE_CTL_SET_FRAME_END: - bsv_movie_set_frame_end(bsv_movie_state.movie); - break; case BSV_MOVIE_CTL_FRAME_REWIND: bsv_movie_frame_rewind(bsv_movie_state.movie); break; - case BSV_MOVIE_CTL_GET_INPUT: - { - int16_t *bsv_data = (int16_t*)data; - bsv_movie_t *handle = bsv_movie_state.movie; - if (fread(bsv_data, sizeof(int16_t), 1, handle->file) != 1) - return false; - - *bsv_data = swap_if_big16(*bsv_data); - } - break; case BSV_MOVIE_CTL_SET_INPUT: { int16_t *bsv_data = (int16_t*)data; @@ -468,7 +464,7 @@ bool bsv_movie_init_handle(const char *path, /* Checks if movie is being played back. */ static bool runloop_check_movie_playback(void) { - if (!bsv_movie_ctl(BSV_MOVIE_CTL_END, NULL)) + if (!bsv_movie_state.movie_end) return false; runloop_msg_queue_push( diff --git a/movie.h b/movie.h index 533b0889ae..33d079f856 100644 --- a/movie.h +++ b/movie.h @@ -46,9 +46,6 @@ enum bsv_ctl_state BSV_MOVIE_CTL_IS_INITED, BSV_MOVIE_CTL_PLAYBACK_ON, BSV_MOVIE_CTL_PLAYBACK_OFF, - /* Playback. */ - BSV_MOVIE_CTL_GET_INPUT, - /* Recording. */ BSV_MOVIE_CTL_SET_INPUT, BSV_MOVIE_CTL_SET_START_RECORDING, BSV_MOVIE_CTL_UNSET_START_RECORDING, @@ -57,14 +54,11 @@ enum bsv_ctl_state BSV_MOVIE_CTL_UNSET_START_PLAYBACK, BSV_MOVIE_CTL_START_PLAYBACK, BSV_MOVIE_CTL_UNSET_PLAYBACK, - BSV_MOVIE_CTL_SET_FRAME_START, - BSV_MOVIE_CTL_SET_FRAME_END, BSV_MOVIE_CTL_FRAME_REWIND, BSV_MOVIE_CTL_DEINIT, BSV_MOVIE_CTL_INIT, BSV_MOVIE_CTL_END_EOF, BSV_MOVIE_CTL_SET_END_EOF, - BSV_MOVIE_CTL_END, BSV_MOVIE_CTL_SET_END, BSV_MOVIE_CTL_UNSET_END }; @@ -75,6 +69,12 @@ void bsv_movie_set_path(const char *path); void bsv_movie_set_start_path(const char *path); +void bsv_movie_set_frame_start(void); + +void bsv_movie_set_frame_end(void); + +bool bsv_movie_get_input(int16_t *bsv_data); + bool bsv_movie_ctl(enum bsv_ctl_state state, void *data); bool bsv_movie_check(void); diff --git a/msg_hash.h b/msg_hash.h index 863c19246d..cf490bcc57 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -746,6 +746,7 @@ enum msg_hash_enums MENU_LABEL(NETPLAY_LAN_SCAN_SETTINGS), MENU_ENUM_LABEL_CONNECT_WIFI, + MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM, MENU_ENUM_LABEL_CONNECT_NETPLAY_LAN, MENU_LABEL(MENU_ENUM_LINEAR_FILTER), @@ -867,6 +868,7 @@ enum msg_hash_enums MENU_LABEL(SCAN_THIS_DIRECTORY), MENU_LABEL(SCAN_DIRECTORY), MENU_LABEL(SCAN_FILE), + MENU_LABEL(NETPLAY_REFRESH_ROOMS), MENU_LABEL(ADD_CONTENT_LIST), MENU_LABEL(CONFIGURATIONS_LIST), @@ -1146,6 +1148,7 @@ enum msg_hash_enums MENU_LABEL(SETTINGS_TAB), MENU_LABEL(HISTORY_TAB), MENU_LABEL(ADD_TAB), + MENU_LABEL(NETPLAY_TAB), MENU_LABEL(PLAYLISTS_TAB), MENU_LABEL(MAIN_MENU), MENU_LABEL(INPUT_SETTINGS), @@ -1547,6 +1550,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_FILTER, MENU_ENUM_LABEL_VALUE_SCALE, MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED, + MENU_ENUM_LABEL_VALUE_NETPLAY_LOAD_CONTENT_MANUALLY, MSG_LAST }; diff --git a/network/httpserver/httpserver.c b/network/httpserver/httpserver.c index 05efe15552..6a7ade8dc2 100644 --- a/network/httpserver/httpserver.c +++ b/network/httpserver/httpserver.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2015-2016 - Andre Leiradella + * Copyright (C) 2015-2017 - Andre Leiradella * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/network/httpserver/httpserver.h b/network/httpserver/httpserver.h index 301d0d67eb..7ab608648b 100644 --- a/network/httpserver/httpserver.h +++ b/network/httpserver/httpserver.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2015-2016 - Andre Leiradella + * Copyright (C) 2015-2017 - Andre Leiradella * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/network/net_http_special.c b/network/net_http_special.c index f3aae2e6f3..567095f0f0 100644 --- a/network/net_http_special.c +++ b/network/net_http_special.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2015-2016 - Andre Leiradella - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2015-2017 - Andre Leiradella + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/network/net_http_special.h b/network/net_http_special.h index 6fa1af0fa8..24f7d87e47 100644 --- a/network/net_http_special.h +++ b/network/net_http_special.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2015-2016 - Andre Leiradella + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2015-2017 - Andre Leiradella * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/network/net_logger.c b/network/net_logger.c index 4050f623e3..35f4d08724 100644 --- a/network/net_logger.c +++ b/network/net_logger.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/network/netplay/netplay.h b/network/netplay/netplay.h index c7e27def05..e6fd5f6488 100644 --- a/network/netplay/netplay.h +++ b/network/netplay/netplay.h @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Gregor Richards + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Gregor Richards * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -57,6 +57,8 @@ void audio_sample_net(int16_t left, int16_t right); size_t audio_sample_batch_net(const int16_t *data, size_t frames); +bool init_netplay_deferred(const char* server, unsigned port); + /** * init_netplay * @direct_host : Host to connect to directly, if applicable (client only) diff --git a/network/netplay/netplay_buf.c b/network/netplay/netplay_buf.c index a08413f110..900c9ef904 100644 --- a/network/netplay/netplay_buf.c +++ b/network/netplay/netplay_buf.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2016 - Gregor Richards + * Copyright (C) 2016-2017 - Gregor Richards * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -186,14 +186,14 @@ bool netplay_send_flush(struct socket_buffer *sbuf, int sockfd, bool block) /* Usual case: Everything's in order */ if (block) { - if (!socket_send_all_blocking(sockfd, sbuf->data + sbuf->start, buf_used(sbuf), false)) + if (!socket_send_all_blocking(sockfd, sbuf->data + sbuf->start, buf_used(sbuf), true)) return false; sbuf->start = sbuf->end = 0; } else { - sent = socket_send_all_nonblocking(sockfd, sbuf->data + sbuf->start, buf_used(sbuf), false); + sent = socket_send_all_nonblocking(sockfd, sbuf->data + sbuf->start, buf_used(sbuf), true); if (sent < 0) return false; sbuf->start += sent; @@ -209,7 +209,7 @@ bool netplay_send_flush(struct socket_buffer *sbuf, int sockfd, bool block) /* Unusual case: Buffer overlaps break */ if (block) { - if (!socket_send_all_blocking(sockfd, sbuf->data + sbuf->start, sbuf->bufsz - sbuf->start, false)) + if (!socket_send_all_blocking(sockfd, sbuf->data + sbuf->start, sbuf->bufsz - sbuf->start, true)) return false; sbuf->start = 0; return netplay_send_flush(sbuf, sockfd, true); @@ -217,7 +217,7 @@ bool netplay_send_flush(struct socket_buffer *sbuf, int sockfd, bool block) } else { - sent = socket_send_all_nonblocking(sockfd, sbuf->data + sbuf->start, sbuf->bufsz - sbuf->start, false); + sent = socket_send_all_nonblocking(sockfd, sbuf->data + sbuf->start, sbuf->bufsz - sbuf->start, true); if (sent < 0) return false; sbuf->start += sent; diff --git a/network/netplay/netplay_delta.c b/network/netplay/netplay_delta.c index 894478107b..eabeb70f5f 100644 --- a/network/netplay/netplay_delta.c +++ b/network/netplay/netplay_delta.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Gregor Richards + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Gregor Richards * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/network/netplay/netplay_discovery.c b/network/netplay/netplay_discovery.c index c6244503ee..a6c3429d27 100644 --- a/network/netplay/netplay_discovery.c +++ b/network/netplay/netplay_discovery.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2016 - Gregor Richards + * Copyright (C) 2016-2017 - Gregor Richards * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -63,8 +63,12 @@ struct ad_packet bool netplay_lan_ad_client(void); /* LAN discovery sockets */ -static int lan_ad_server_fd = -1; -static int lan_ad_client_fd = -1; +static int lan_ad_server_fd = -1; +static int lan_ad_client_fd = -1; + +int netplay_room_count = 0; + +struct netplay_room *netplay_room_list = NULL; /* Packet buffer for advertisement and responses */ static struct ad_packet ad_packet_buffer; diff --git a/network/netplay/netplay_discovery.h b/network/netplay/netplay_discovery.h index f0b7358c78..e3254c94a3 100644 --- a/network/netplay/netplay_discovery.h +++ b/network/netplay/netplay_discovery.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2016 - Gregor Richards + * Copyright (C) 2016-2017 - Gregor Richards * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -18,6 +18,7 @@ #define __RARCH_NETPLAY_DISCOVERY_H #include +#include #define NETPLAY_HOST_STR_LEN 32 @@ -29,21 +30,41 @@ enum rarch_netplay_discovery_ctl_state RARCH_NETPLAY_DISCOVERY_CTL_LAN_CLEAR_RESPONSES }; -struct netplay_host { - struct sockaddr addr; - socklen_t addrlen; +struct netplay_host +{ + struct sockaddr addr; + socklen_t addrlen; - char nick[NETPLAY_HOST_STR_LEN]; - char core[NETPLAY_HOST_STR_LEN]; - char core_version[NETPLAY_HOST_STR_LEN]; - char content[NETPLAY_HOST_STR_LEN]; + char nick[NETPLAY_HOST_STR_LEN]; + char core[NETPLAY_HOST_STR_LEN]; + char core_version[NETPLAY_HOST_STR_LEN]; + char content[NETPLAY_HOST_STR_LEN]; }; -struct netplay_host_list { - struct netplay_host *hosts; - size_t size; +struct netplay_host_list +{ + struct netplay_host *hosts; + size_t size; }; +/* data is ordered like this on the server, I left it in this ordered + for reference */ +struct netplay_room +{ + char nickname [PATH_MAX_LENGTH]; + char address [PATH_MAX_LENGTH]; + int port; + char corename [PATH_MAX_LENGTH]; + char coreversion [PATH_MAX_LENGTH]; + char gamename [PATH_MAX_LENGTH]; + int gamecrc; + int timestamp; +}; + +extern struct netplay_room *netplay_room_list; + +extern int netplay_room_count; + /** Initialize Netplay discovery */ bool init_netplay_discovery(void); diff --git a/network/netplay/netplay_frontend.c b/network/netplay/netplay_frontend.c index 89c5ab5535..61316177ac 100644 --- a/network/netplay/netplay_frontend.c +++ b/network/netplay/netplay_frontend.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Gregor Richards + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Gregor Richards * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -21,6 +21,7 @@ #include #include #include +#include #include "netplay_private.h" @@ -28,6 +29,11 @@ #include "../../input/input_driver.h" #include "../../runloop.h" +#include "../../tasks/tasks_internal.h" +#include +#include "../../file_path_special.h" +#include "paths.h" + /* Only used before init_netplay */ static bool netplay_enabled = false; static bool netplay_is_client = false; @@ -38,6 +44,11 @@ static netplay_t *netplay_data = NULL; /* Used to avoid recursive netplay calls */ static bool in_netplay = false; +/* Used for deferred netplay initialization */ +static bool netplay_client_deferred = false; +static char server_address_deferred[512] = ""; +static unsigned server_port_deferred = 0; + /** * netplay_is_alive: * @netplay : pointer to netplay object @@ -151,6 +162,20 @@ static bool get_self_input_state(netplay_t *netplay) return true; } +bool init_netplay_deferred(const char* server, unsigned port) +{ + if (!string_is_empty(server) && port != 0) + { + strlcpy(server_address_deferred, server, sizeof(server_address_deferred)); + server_port_deferred = port; + netplay_client_deferred = true; + } + else + netplay_client_deferred = false; + return netplay_client_deferred; +} + + /** * netplay_poll: * @netplay : pointer to netplay object @@ -177,7 +202,9 @@ static bool netplay_poll(void) /* Read Netplay input, block if we're configured to stall for input every * frame */ + netplay_update_unread_ptr(netplay_data); if (netplay_data->stateless_mode && + netplay_data->connected_players && netplay_data->unread_frame_count <= netplay_data->self_frame_count) res = netplay_poll_net_input(netplay_data, true); else @@ -388,6 +415,38 @@ static int16_t netplay_input_state(netplay_t *netplay, } } +static int reannounce = 0; + +static void netplay_announce_cb(void *task_data, void *user_data, const char *error) +{ + RARCH_LOG("Announcing netplay game... \n"); + return; +} + +static void netplay_announce() +{ + char buf [2048]; + char url [2048] = "http://lobby.libretro.com/raw/?"; + rarch_system_info_t *system = NULL; + settings_t *settings = config_get_ptr(); + uint32_t *content_crc_ptr = NULL; + + content_get_crc(&content_crc_ptr); + + runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); + + buf[0] = '\0'; + + snprintf(buf, sizeof(buf), "%susername=%s&corename=%s&coreversion=%s&" + "gamename=%s&gamecrc=%d&port=%d", + url, settings->username, system->info.library_name, + system->info.library_version, + path_basename(path_get(RARCH_PATH_BASENAME)),*content_crc_ptr, + settings->netplay.port); + + task_push_http_transfer(buf, true, NULL, netplay_announce_cb, NULL); +} + int16_t input_state_net(unsigned port, unsigned device, unsigned idx, unsigned id) { @@ -517,7 +576,9 @@ static void netplay_frontend_paused(netplay_t *netplay, bool paused) bool netplay_pre_frame(netplay_t *netplay) { bool sync_stalled; - + reannounce ++; + if (netplay->is_server && (reannounce % 3600 == 0)) + netplay_announce(); retro_assert(netplay); /* FIXME: This is an ugly way to learn we're not paused anymore */ @@ -881,12 +942,14 @@ bool init_netplay(void *direct_host, const char *server, unsigned port) runloop_msg_queue_push( msg_hash_to_str(MSG_WAITING_FOR_CLIENT), 0, 180, false); + + netplay_announce(); } netplay_data = (netplay_t*)netplay_new( netplay_is_client ? direct_host : NULL, - netplay_is_client ? server : NULL, - port ? port : RARCH_DEFAULT_PORT, + netplay_is_client ? (!netplay_client_deferred ? server : server_address_deferred) : NULL, + port ? ( !netplay_client_deferred ? port : server_port_deferred) : RARCH_DEFAULT_PORT, settings->netplay.stateless_mode, settings->netplay.check_frames, &cbs, settings->netplay.nat_traversal, settings->username, quirks); @@ -902,6 +965,8 @@ bool init_netplay(void *direct_host, const char *server, unsigned port) return false; } + + /** * netplay_driver_ctl * diff --git a/network/netplay/netplay_handshake.c b/network/netplay/netplay_handshake.c index cc714db5da..3731dc220d 100644 --- a/network/netplay/netplay_handshake.c +++ b/network/netplay/netplay_handshake.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Gregor Richards + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Gregor Richards * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -25,6 +25,7 @@ #include "netplay_private.h" +#include "../../autosave.h" #include "../../configuration.h" #include "../../content.h" #include "../../retroarch.h" @@ -508,8 +509,10 @@ bool netplay_handshake_sync(netplay_t *netplay, struct netplay_connection *conne int matchct; bool nick_matched; + autosave_lock(); mem_info.id = RETRO_MEMORY_SAVE_RAM; core_get_memory(&mem_info); + autosave_unlock(); /* Send basic sync info */ cmd[0] = htonl(NETPLAY_CMD_SYNC); @@ -578,11 +581,16 @@ bool netplay_handshake_sync(netplay_t *netplay, struct netplay_connection *conne return false; /* And finally, the SRAM */ + autosave_lock(); if (!netplay_send(&connection->send_packet_buffer, connection->fd, mem_info.data, mem_info.size) || !netplay_send_flush(&connection->send_packet_buffer, connection->fd, false)) + { + autosave_unlock(); return false; + } + autosave_unlock(); /* Now we're ready! */ connection->mode = NETPLAY_CONNECTION_SPECTATING; @@ -824,6 +832,15 @@ error: RARCH_ERR("%s\n", dmsg); runloop_msg_queue_push(dmsg, 1, 180, false); } + + if (!netplay->is_server) + { + /* Counter-intuitively, we still want to send our info. This is simply so + * that the server knows why we disconnected. */ + if (!netplay_handshake_info(netplay, connection)) + return false; + } + return false; } /** @@ -938,6 +955,7 @@ bool netplay_handshake_pre_sync(netplay_t *netplay, } /* Now check the SRAM */ + autosave_lock(); mem_info.id = RETRO_MEMORY_SAVE_RAM; core_get_memory(&mem_info); @@ -951,6 +969,7 @@ bool netplay_handshake_pre_sync(netplay_t *netplay, { RARCH_ERR("%s\n", msg_hash_to_str(MSG_FAILED_TO_RECEIVE_SRAM_DATA_FROM_HOST)); + autosave_unlock(); return false; } @@ -965,6 +984,7 @@ bool netplay_handshake_pre_sync(netplay_t *netplay, { RARCH_ERR("%s\n", msg_hash_to_str(MSG_FAILED_TO_RECEIVE_SRAM_DATA_FROM_HOST)); + autosave_unlock(); return false; } if (remote_sram_size > sizeof(uint32_t)) @@ -974,6 +994,7 @@ bool netplay_handshake_pre_sync(netplay_t *netplay, } } + autosave_unlock(); /* We're ready! */ *had_input = true; diff --git a/network/netplay/netplay_init.c b/network/netplay/netplay_init.c index e13a0b5a6f..e34d52c1f5 100644 --- a/network/netplay/netplay_init.c +++ b/network/netplay/netplay_init.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Gregor Richards + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Gregor Richards * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -349,7 +349,8 @@ bool netplay_wait_and_init_serialization(netplay_t *netplay) return true; /* Wait a maximum of 60 frames */ - for (frame = 0; frame < 60; frame++) { + for (frame = 0; frame < 60; frame++) + { if (netplay_try_init_serialization(netplay)) return true; diff --git a/network/netplay/netplay_io.c b/network/netplay/netplay_io.c index 39dc167a56..0fbb748fdd 100644 --- a/network/netplay/netplay_io.c +++ b/network/netplay/netplay_io.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Gregor Richards + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Gregor Richards * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/network/netplay/netplay_private.h b/network/netplay/netplay_private.h index b60a414e85..02a7377d98 100644 --- a/network/netplay/netplay_private.h +++ b/network/netplay/netplay_private.h @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Gregor Richards + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Gregor Richards * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/network/netplay/netplay_sync.c b/network/netplay/netplay_sync.c index ac98b9c491..9735f12133 100644 --- a/network/netplay/netplay_sync.c +++ b/network/netplay/netplay_sync.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Gregor Richards + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Gregor Richards * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -372,7 +372,7 @@ void netplay_sync_post_frame(netplay_t *netplay, bool stalled) { netplay->catch_up = false; input_driver_unset_nonblock_state(); - driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL); + driver_set_nonblock_state(); } return; } @@ -524,7 +524,7 @@ void netplay_sync_post_frame(netplay_t *netplay, bool stalled) { netplay->catch_up = false; input_driver_unset_nonblock_state(); - driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL); + driver_set_nonblock_state(); } } @@ -535,7 +535,7 @@ void netplay_sync_post_frame(netplay_t *netplay, bool stalled) /* Are we falling behind? */ netplay->catch_up = true; input_driver_set_nonblock_state(); - driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL); + driver_set_nonblock_state(); } else if (netplay->self_frame_count + 2 < hi_frame_count) diff --git a/patch.c b/patch.c index ce2f7c5d86..6dcb54929b 100644 --- a/patch.c +++ b/patch.c @@ -31,9 +31,7 @@ #include #include "msg_hash.h" -#include "patch.h" #include "retroarch.h" -#include "runloop.h" #include "verbosity.h" enum bps_mode @@ -553,40 +551,30 @@ error: return false; } -static bool try_bps_patch(uint8_t **buf, ssize_t *size) +static bool try_bps_patch(bool allow_bps, const char *name_bps, + uint8_t **buf, ssize_t *size) { - global_t *global = global_get_ptr(); - bool allow_bps = !rarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL) && !rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL); - - if (!allow_bps || string_is_empty(global->name.bps)) - return false; - - return apply_patch_content(buf, size, "BPS", global->name.bps, - bps_apply_patch); + if (allow_bps && !string_is_empty(name_bps)) + return apply_patch_content(buf, size, "BPS", name_bps, + bps_apply_patch); + return false; } -static bool try_ups_patch(uint8_t **buf, ssize_t *size) +static bool try_ups_patch(bool allow_ups, const char *name_ups, + uint8_t **buf, ssize_t *size) { - global_t *global = global_get_ptr(); - bool allow_ups = !rarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL) && !rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL); - - if (!allow_ups || string_is_empty(global->name.ups)) - return false; - - return apply_patch_content(buf, size, "UPS", global->name.ups, - ups_apply_patch); + if (allow_ups && !string_is_empty(name_ups)) + return apply_patch_content(buf, size, "UPS", name_ups, + ups_apply_patch); + return false; } -static bool try_ips_patch(uint8_t **buf, ssize_t *size) +static bool try_ips_patch(bool allow_ips, + const char *name_ips, uint8_t **buf, ssize_t *size) { - global_t *global = global_get_ptr(); - bool allow_ips = !rarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL) && !rarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL); - - if (!allow_ips || string_is_empty(global->name.ips)) - return false; - - return apply_patch_content(buf, size, "IPS", global->name.ips, - ips_apply_patch); + if (allow_ips && !string_is_empty(name_ips)) + return apply_patch_content(buf, size, "IPS", name_ips, ips_apply_patch); + return false; } /** @@ -597,8 +585,17 @@ static bool try_ips_patch(uint8_t **buf, ssize_t *size) * Apply patch to the content file in-memory. * **/ -void patch_content(uint8_t **buf, ssize_t *size) +void patch_content( + const char *name_ips, + const char *name_bps, + const char *name_ups, + uint8_t **buf, + ssize_t *size) { + bool allow_ups = !rarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL) && !rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL); + bool allow_ips = !rarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL) && !rarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL); + bool allow_bps = !rarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL) && !rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL); + if ( (unsigned)rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL) + (unsigned)rarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL) + (unsigned)rarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL) > 1) @@ -608,9 +605,9 @@ void patch_content(uint8_t **buf, ssize_t *size) return; } - if ( !try_ips_patch(buf, size) - && !try_bps_patch(buf, size) - && !try_ups_patch(buf, size)) + if ( !try_ips_patch(allow_ips, name_ips, buf, size) + && !try_bps_patch(allow_bps, name_bps, buf, size) + && !try_ups_patch(allow_ups, name_ups, buf, size)) { RARCH_LOG("%s\n", msg_hash_to_str(MSG_DID_NOT_FIND_A_VALID_CONTENT_PATCH)); diff --git a/patch.h b/patch.h index 9311b555ac..33993d8468 100644 --- a/patch.h +++ b/patch.h @@ -36,7 +36,11 @@ RETRO_BEGIN_DECLS * Apply patch to the content file in-memory. * **/ -void patch_content(uint8_t **buf, ssize_t *size); +void patch_content( + const char *name_ips, + const char *name_bps, + const char *name_ups, + uint8_t **buf, ssize_t *size); RETRO_END_DECLS diff --git a/pkg/msvc/RetroArch-Xbox1/RetroArch-Xbox1.vcproj b/pkg/msvc/RetroArch-Xbox1/RetroArch-Xbox1.vcproj index 6f114b9c99..b664a981f7 100644 --- a/pkg/msvc/RetroArch-Xbox1/RetroArch-Xbox1.vcproj +++ b/pkg/msvc/RetroArch-Xbox1/RetroArch-Xbox1.vcproj @@ -22,7 +22,7 @@ Optimization="3" OptimizeForProcessor="2" AdditionalIncludeDirectories=""$(SolutionDir)\..\..\libretro-common\include";"$(SolutionDir)\..\..\libretro-common\include\compat\msvc";"$(SolutionDir)\msvc-71";"$(SolutionDir)\..\..\deps\zlib"" - PreprocessorDefinitions="_DEBUG;_XBOX;_XBOX1;HAVE_RGUI;HAVE_MENU;RARCH_CONSOLE;HAVE_XINPUT_XBOX1;__STDC_CONSTANT_MACROS;HAVE_ZLIB;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_RARCH_EXEC;HAVE_DSOUND;HAVE_CC_RESAMPLER;HAVE_D3D;HAVE_D3D8;RARCH_INTERNAL;WANT_ZLIB;SINC_LOWER_QUALITY;HAVE_THREADS;HAVE_FILTERS_BUILTIN" + PreprocessorDefinitions="_DEBUG;_XBOX;_XBOX1;HAVE_RGUI;HAVE_MENU;RARCH_CONSOLE;HAVE_XINPUT_XBOX1;__STDC_CONSTANT_MACROS;HAVE_ZLIB;HAVE_GRIFFIN;HAVE_RARCH_EXEC;HAVE_DSOUND;HAVE_CC_RESAMPLER;HAVE_D3D;HAVE_D3D8;RARCH_INTERNAL;WANT_ZLIB;SINC_LOWER_QUALITY;HAVE_THREADS;HAVE_FILTERS_BUILTIN" MinimalRebuild="TRUE" BasicRuntimeChecks="0" RuntimeLibrary="1" diff --git a/pkg/msvc/RetroArch-msvc2005.sln b/pkg/msvc/RetroArch-msvc2005.sln new file mode 100644 index 0000000000..e1e948b204 --- /dev/null +++ b/pkg/msvc/RetroArch-msvc2005.sln @@ -0,0 +1,25 @@ +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual C++ Express 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RetroArch-msvc2005", "msvc-2005\RetroArch-msvc2005.vcproj", "{1FEFA874-F6A6-4CE6-9DB4-3B291A364CE5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug NoAccel|Win32 = Debug NoAccel|Win32 + Debug|Win32 = Debug|Win32 + Release NoAccel|Win32 = Release NoAccel|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1FEFA874-F6A6-4CE6-9DB4-3B291A364CE5}.Debug NoAccel|Win32.ActiveCfg = Debug NoAccel|Win32 + {1FEFA874-F6A6-4CE6-9DB4-3B291A364CE5}.Debug NoAccel|Win32.Build.0 = Debug NoAccel|Win32 + {1FEFA874-F6A6-4CE6-9DB4-3B291A364CE5}.Debug|Win32.ActiveCfg = Debug|Win32 + {1FEFA874-F6A6-4CE6-9DB4-3B291A364CE5}.Debug|Win32.Build.0 = Debug|Win32 + {1FEFA874-F6A6-4CE6-9DB4-3B291A364CE5}.Release NoAccel|Win32.ActiveCfg = Release NoAccel|Win32 + {1FEFA874-F6A6-4CE6-9DB4-3B291A364CE5}.Release NoAccel|Win32.Build.0 = Release NoAccel|Win32 + {1FEFA874-F6A6-4CE6-9DB4-3B291A364CE5}.Release|Win32.ActiveCfg = Release|Win32 + {1FEFA874-F6A6-4CE6-9DB4-3B291A364CE5}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/pkg/msvc/RetroArch-msvc2010.sln b/pkg/msvc/RetroArch-msvc2010.sln index f72b91f832..8e5df75e23 100644 --- a/pkg/msvc/RetroArch-msvc2010.sln +++ b/pkg/msvc/RetroArch-msvc2010.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +# Visual C++ Express 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RetroArch-msvc2010", "msvc-2010\RetroArch-msvc2010.vcxproj", "{27FF7CE1-4059-4AA1-8062-FD529560FA54}" EndProject Global @@ -17,20 +17,16 @@ Global GlobalSection(ProjectConfigurationPlatforms) = postSolution {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Debug Cg|Win32.ActiveCfg = Debug Cg|Win32 {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Debug Cg|Win32.Build.0 = Debug Cg|Win32 - {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Debug Cg|x64.ActiveCfg = Debug Cg|x64 - {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Debug Cg|x64.Build.0 = Debug Cg|x64 + {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Debug Cg|x64.ActiveCfg = Debug Cg|Win32 {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Debug|Win32.ActiveCfg = Debug|Win32 {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Debug|Win32.Build.0 = Debug|Win32 - {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Debug|x64.ActiveCfg = Debug|x64 - {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Debug|x64.Build.0 = Debug|x64 + {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Debug|x64.ActiveCfg = Debug|Win32 {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Release Cg|Win32.ActiveCfg = Release Cg|Win32 {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Release Cg|Win32.Build.0 = Release Cg|Win32 - {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Release Cg|x64.ActiveCfg = Release Cg|x64 - {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Release Cg|x64.Build.0 = Release Cg|x64 + {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Release Cg|x64.ActiveCfg = Release Cg|Win32 {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Release|Win32.ActiveCfg = Release|Win32 {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Release|Win32.Build.0 = Release|Win32 - {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Release|x64.ActiveCfg = Release|x64 - {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Release|x64.Build.0 = Release|x64 + {27FF7CE1-4059-4AA1-8062-FD529560FA54}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/pkg/msvc/msvc-2005/RetroArch-msvc2005.vcproj b/pkg/msvc/msvc-2005/RetroArch-msvc2005.vcproj new file mode 100644 index 0000000000..159f0092a5 --- /dev/null +++ b/pkg/msvc/msvc-2005/RetroArch-msvc2005.vcproj @@ -0,0 +1,399 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkg/msvc/msvc-2010/RetroArch-msvc2010.vcxproj b/pkg/msvc/msvc-2010/RetroArch-msvc2010.vcxproj index 77486ca2c9..9cf3332eed 100644 --- a/pkg/msvc/msvc-2010/RetroArch-msvc2010.vcxproj +++ b/pkg/msvc/msvc-2010/RetroArch-msvc2010.vcxproj @@ -1,4 +1,4 @@ - + @@ -192,7 +192,7 @@ Console true - winmm.lib;Dinput8.lib;dxguid.lib;Iphlpapi.lib;%(AdditionalDependencies) + msimg32.lib;winmm.lib;Dinput8.lib;dxguid.lib;Iphlpapi.lib;%(AdditionalDependencies) @@ -211,7 +211,7 @@ Console true - winmm.lib;Dinput8.lib;dxguid.lib;Iphlpapi.lib;%(AdditionalDependencies) + msimg32.lib;winmm.lib;Dinput8.lib;dxguid.lib;Iphlpapi.lib;%(AdditionalDependencies) $(CG_LIB_PATH) @@ -231,7 +231,7 @@ Console true - winmm.lib;Dinput8.lib;dxguid.lib;Iphlpapi.lib;%(AdditionalDependencies) + msimg32.lib;winmm.lib;Dinput8.lib;dxguid.lib;Iphlpapi.lib;%(AdditionalDependencies) @@ -250,7 +250,7 @@ Console true - winmm.lib;Dinput8.lib;dxguid.lib;Iphlpapi.lib;%(AdditionalDependencies) + msimg32.lib;winmm.lib;Dinput8.lib;dxguid.lib;Iphlpapi.lib;%(AdditionalDependencies) $(CG_LIB64_PATH) @@ -275,7 +275,7 @@ true true true - winmm.lib;Dinput8.lib;dxguid.lib;Iphlpapi.lib;%(AdditionalDependencies) + msimg32.lib;winmm.lib;Dinput8.lib;dxguid.lib;Iphlpapi.lib;%(AdditionalDependencies) @@ -299,7 +299,7 @@ true true true - winmm.lib;Dinput8.lib;dxguid.lib;Iphlpapi.lib;%(AdditionalDependencies) + msimg32.lib;winmm.lib;Dinput8.lib;dxguid.lib;Iphlpapi.lib;%(AdditionalDependencies) $(CG_LIB_PATH) @@ -324,7 +324,7 @@ true true true - winmm.lib;Dinput8.lib;dxguid.lib;Iphlpapi.lib;%(AdditionalDependencies) + msimg32.lib;winmm.lib;Dinput8.lib;dxguid.lib;Iphlpapi.lib;%(AdditionalDependencies) @@ -348,7 +348,7 @@ true true true - winmm.lib;Dinput8.lib;dxguid.lib;Iphlpapi.lib;%(AdditionalDependencies) + msimg32.lib;winmm.lib;Dinput8.lib;dxguid.lib;Iphlpapi.lib;%(AdditionalDependencies) $(CG_LIB64_PATH) diff --git a/qb/config.libs.sh b/qb/config.libs.sh index b09ab7c8b1..f02696e57b 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -27,6 +27,9 @@ elif [ "$OS" = 'Win32' ]; then SOCKETLIB=-lws2_32 SOCKETHEADER="#include " DYLIB= +elif [ "$OS" = 'Cygwin' ]; then + echo "Error: Cygwin is not a supported platform. See https://bot.libretro.com/docs/compilation/windows/" + exit 1 fi add_define_make DYLIB_LIB "$DYLIB" @@ -149,6 +152,11 @@ else add_define_make MAN_DIR "${PREFIX}/share/man" fi +if [ "$OS" = 'DOS' ]; then + HAVE_SHADERPIPELINE=no + HAVE_LANGEXTRA=no +fi + if [ "$OS" = 'Win32' ]; then HAVE_THREADS=yes HAVE_THREAD_STORAGE=yes @@ -448,13 +456,23 @@ if [ "$HAVE_MATERIALUI" != 'no' ] || [ "$HAVE_XMB" != 'no' ] || [ "$HAVE_ZARCH" if [ "$HAVE_RGUI" = 'no' ]; then HAVE_MATERIALUI=no HAVE_XMB=no - HAVE_ZARCH=no + HAVE_ZARCH=no echo "Notice: RGUI not available, MaterialUI, XMB and ZARCH will also be disabled." elif [ "$HAVE_OPENGL" = 'no' ] && [ "$HAVE_OPENGLES" = 'no' ] && [ "$HAVE_VULKAN" = 'no' ]; then - HAVE_MATERIALUI=no - HAVE_XMB=no - HAVE_ZARCH=no - echo "Notice: Hardware rendering context not available, XMB, MaterialUI and ZARCH will also be disabled." + if [ "$OS" = 'Win32' ]; then + HAVE_SHADERPIPELINE=no + HAVE_VULKAN=no + echo "Notice: Hardware rendering context not available." + else + if [ "$HAVE_CACA" = 'yes' ]; then + echo "Notice: Hardware rendering context not available." + else + HAVE_MATERIALUI=no + HAVE_XMB=no + HAVE_ZARCH=no + echo "Notice: Hardware rendering context not available, XMB, MaterialUI and ZARCH will also be disabled." + fi + fi fi fi diff --git a/qb/qb.params.sh b/qb/qb.params.sh index 3964fe26fb..4b822298a8 100644 --- a/qb/qb.params.sh +++ b/qb/qb.params.sh @@ -72,6 +72,7 @@ parse_input() # Parse stuff :V --disable-*) opt_exists "${1##--disable-}" "$1" eval "HAVE_$opt=no" + eval "HAVE_NO_$opt=yes" ;; --with-*) arg="${1##--with-}" diff --git a/qb/qb.system.sh b/qb/qb.system.sh index 63d465e44d..0589126905 100644 --- a/qb/qb.system.sh +++ b/qb/qb.system.sh @@ -2,6 +2,7 @@ if [ -n "$CROSS_COMPILE" ]; then case "$CROSS_COMPILE" in *'-mingw32'*) OS='Win32';; + *'-msdosdjgpp'*) OS='DOS';; *);; esac fi diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index 3f0d9418bd..778466dde4 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -14,13 +14,10 @@ * If not, see . */ - - #include #include #include - #include #include diff --git a/record/drivers/record_null.c b/record/drivers/record_null.c index 06c6634cd8..33bd367a33 100644 --- a/record/drivers/record_null.c +++ b/record/drivers/record_null.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/record/record_driver.c b/record/record_driver.c index 8dbfffb8fa..fc68b0cf87 100644 --- a/record/record_driver.c +++ b/record/record_driver.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -183,7 +183,7 @@ bool record_driver_init_first(const record_driver_t **backend, void **data, } void recording_dump_frame(const void *data, unsigned width, - unsigned height, size_t pitch) + unsigned height, size_t pitch, bool is_idle) { struct ffemu_video_data ffemu_data = {0}; @@ -205,7 +205,7 @@ void recording_dump_frame(const void *data, unsigned width, msg_hash_to_str(MSG_VIEWPORT_SIZE_CALCULATION_FAILED)); command_event(CMD_EVENT_GPU_RECORD_DEINIT, NULL); - recording_dump_frame(data, width, height, pitch); + recording_dump_frame(data, width, height, pitch, is_idle); return; } @@ -229,7 +229,7 @@ void recording_dump_frame(const void *data, unsigned width, /* Big bottleneck. * Since we might need to do read-backs asynchronously, * it might take 3-4 times before this returns true. */ - if (!video_driver_read_viewport(gpu_buf)) + if (!video_driver_read_viewport(gpu_buf, is_idle)) return; ffemu_data.pitch = recording_gpu_width * 3; @@ -347,7 +347,7 @@ bool recording_init(void) FFEMU_PIX_ARGB8888 : FFEMU_PIX_RGB565; params.config = NULL; - if (*global->record.config) + if (!string_is_empty(global->record.config)) params.config = global->record.config; if (video_driver_supports_recording()) diff --git a/record/record_driver.h b/record/record_driver.h index d70c4b5181..7fefc072b9 100644 --- a/record/record_driver.h +++ b/record/record_driver.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -145,7 +145,7 @@ bool record_driver_init_first(const record_driver_t **backend, void **data, const struct ffemu_params *params); void recording_dump_frame(const void *data, unsigned width, - unsigned height, size_t pitch); + unsigned height, size_t pitch, bool is_idle); bool recording_deinit(void); diff --git a/retroarch.c b/retroarch.c index 2fe95be733..4c4da02cfb 100644 --- a/retroarch.c +++ b/retroarch.c @@ -67,6 +67,7 @@ #include "core_info.h" #include "dynamic.h" #include "driver.h" +#include "input/input_config.h" #include "msg_hash.h" #include "movie.h" #include "dirs.h" @@ -401,7 +402,6 @@ static void retroarch_parse_input(int argc, char *argv[]) { const char *optstring = NULL; bool explicit_menu = false; - settings_t *settings = config_get_ptr(); global_t *global = global_get_ptr(); const struct option opts[] = { @@ -545,7 +545,8 @@ static void retroarch_parse_input(int argc, char *argv[]) retroarch_fail(1, "retroarch_parse_input()"); } new_port = port -1; - settings->input.libretro_device[new_port] = id; + + input_config_set_device(new_port, id); retroarch_override_setting_set( RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE, &new_port); @@ -564,7 +565,7 @@ static void retroarch_parse_input(int argc, char *argv[]) } new_port = port - 1; - settings->input.libretro_device[new_port] = RETRO_DEVICE_ANALOG; + input_config_set_device(new_port, RETRO_DEVICE_ANALOG); retroarch_override_setting_set( RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE, &new_port); } @@ -606,7 +607,7 @@ static void retroarch_parse_input(int argc, char *argv[]) retroarch_fail(1, "retroarch_parse_input()"); } new_port = port - 1; - settings->input.libretro_device[port - 1] = RETRO_DEVICE_NONE; + input_config_set_device(port - 1, RETRO_DEVICE_NONE); retroarch_override_setting_set( RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE, &new_port); } @@ -631,6 +632,8 @@ static void retroarch_parse_input(int argc, char *argv[]) case 'L': if (path_is_directory(optarg)) { + settings_t *settings = config_get_ptr(); + path_clear(RARCH_PATH_CORE); strlcpy(settings->directory.libretro, optarg, sizeof(settings->directory.libretro)); @@ -698,39 +701,53 @@ static void retroarch_parse_input(int argc, char *argv[]) break; case 'C': - retroarch_override_setting_set( - RARCH_OVERRIDE_SETTING_NETPLAY_MODE, NULL); - retroarch_override_setting_set( - RARCH_OVERRIDE_SETTING_NETPLAY_IP_ADDRESS, NULL); - netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL); - strlcpy(settings->netplay.server, optarg, - sizeof(settings->netplay.server)); + { + settings_t *settings = config_get_ptr(); + retroarch_override_setting_set( + RARCH_OVERRIDE_SETTING_NETPLAY_MODE, NULL); + retroarch_override_setting_set( + RARCH_OVERRIDE_SETTING_NETPLAY_IP_ADDRESS, NULL); + netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL); + strlcpy(settings->netplay.server, optarg, + sizeof(settings->netplay.server)); + } break; case RA_OPT_STATELESS: - settings->netplay.stateless_mode = true; - retroarch_override_setting_set( - RARCH_OVERRIDE_SETTING_NETPLAY_STATELESS_MODE, NULL); + { + settings_t *settings = config_get_ptr(); + settings->netplay.stateless_mode = true; + retroarch_override_setting_set( + RARCH_OVERRIDE_SETTING_NETPLAY_STATELESS_MODE, NULL); + } break; case RA_OPT_CHECK_FRAMES: - retroarch_override_setting_set( - RARCH_OVERRIDE_SETTING_NETPLAY_CHECK_FRAMES, NULL); - settings->netplay.check_frames = strtoul(optarg, NULL, 0); + { + settings_t *settings = config_get_ptr(); + retroarch_override_setting_set( + RARCH_OVERRIDE_SETTING_NETPLAY_CHECK_FRAMES, NULL); + settings->netplay.check_frames = strtoul(optarg, NULL, 0); + } break; case RA_OPT_PORT: - retroarch_override_setting_set( - RARCH_OVERRIDE_SETTING_NETPLAY_IP_PORT, NULL); - settings->netplay.port = strtoul(optarg, NULL, 0); + { + settings_t *settings = config_get_ptr(); + retroarch_override_setting_set( + RARCH_OVERRIDE_SETTING_NETPLAY_IP_PORT, NULL); + settings->netplay.port = strtoul(optarg, NULL, 0); + } break; #if defined(HAVE_NETWORK_CMD) case RA_OPT_COMMAND: +#ifdef HAVE_COMMAND if (command_network_send((const char*)optarg)) exit(0); else retroarch_fail(1, "network_cmd_send()"); +#endif break; #endif @@ -770,9 +787,12 @@ static void retroarch_parse_input(int argc, char *argv[]) break; case RA_OPT_NICK: - rarch_ctl(RARCH_CTL_USERNAME_SET, NULL); - strlcpy(settings->username, optarg, - sizeof(settings->username)); + { + settings_t *settings = config_get_ptr(); + rarch_ctl(RARCH_CTL_USERNAME_SET, NULL); + strlcpy(settings->username, optarg, + sizeof(settings->username)); + } break; case RA_OPT_APPENDCONFIG: @@ -897,6 +917,8 @@ bool retroarch_validate_game_options(char *s, size_t len, bool mkdir) const char *game_name = NULL; rarch_system_info_t *system = NULL; + config_directory[0] = core_path[0] = '\0'; + runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); if (system) @@ -907,9 +929,8 @@ bool retroarch_validate_game_options(char *s, size_t len, bool mkdir) if (string_is_empty(core_name) || string_is_empty(game_name)) return false; - config_directory[0] = core_path[0] = '\0'; - - fill_pathname_application_special(config_directory, sizeof(config_directory), + fill_pathname_application_special(config_directory, + sizeof(config_directory), APPLICATION_SPECIAL_DIRECTORY_CONFIG); /* Concatenate strings into full paths for game_path */ @@ -1059,7 +1080,7 @@ bool retroarch_main_init(int argc, char *argv[]) { #ifdef HAVE_MENU /* Check if menu was active prior to core initialization */ - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) { /* Attempt initializing dummy core */ current_core_type = CORE_TYPE_DUMMY; @@ -1074,7 +1095,7 @@ bool retroarch_main_init(int argc, char *argv[]) } } - driver_ctl(RARCH_DRIVER_CTL_INIT_ALL, NULL); + drivers_init(DRIVERS_CMD_ALL); command_event(CMD_EVENT_COMMAND_INIT, NULL); command_event(CMD_EVENT_REMOTE_INIT, NULL); command_event(CMD_EVENT_REWIND_INIT, NULL); @@ -1107,7 +1128,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data) static bool rarch_bps_pref = false; static bool rarch_ips_pref = false; static bool rarch_patch_blocked = false; - settings_t *settings = config_get_ptr(); #ifdef HAVE_THREAD_STORAGE static sthread_tls_t rarch_tls; const void *MAGIC_POINTER = (void*)0xB16B00B5; @@ -1237,7 +1257,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data) { unsigned i; for (i = 0; i < MAX_USERS; i++) - settings->input.libretro_device[i] = RETRO_DEVICE_JOYPAD; + input_config_set_device(i, RETRO_DEVICE_JOYPAD); } runloop_ctl(RUNLOOP_CTL_HTTPSERVER_INIT, NULL); runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_INIT, NULL); @@ -1304,8 +1324,11 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data) menu_driver_ctl(RARCH_MENU_CTL_SET_TOGGLE, NULL); #endif #ifdef HAVE_OVERLAY - if (settings->input.overlay_hide_in_menu) - command_event(CMD_EVENT_OVERLAY_DEINIT, NULL); + { + settings_t *settings = config_get_ptr(); + if (settings->input.overlay_hide_in_menu) + command_event(CMD_EVENT_OVERLAY_DEINIT, NULL); + } #endif break; case RARCH_CTL_MENU_RUNNING_FINISHED: @@ -1314,8 +1337,11 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data) #endif video_driver_set_texture_enable(false, false); #ifdef HAVE_OVERLAY - if (settings && settings->input.overlay_hide_in_menu) - command_event(CMD_EVENT_OVERLAY_INIT, NULL); + { + settings_t *settings = config_get_ptr(); + if (settings && settings->input.overlay_hide_in_menu) + command_event(CMD_EVENT_OVERLAY_INIT, NULL); + } #endif break; case RARCH_CTL_IS_MAIN_THREAD: diff --git a/runloop.c b/runloop.c index 307313a1b4..5a8eaa4dc0 100644 --- a/runloop.c +++ b/runloop.c @@ -204,6 +204,27 @@ static bool rarch_game_specific_options(char **output) return true; } +void runloop_get_status(bool *is_paused, bool *is_idle, + bool *is_slowmotion) +{ + *is_paused = runloop_paused; + *is_idle = runloop_idle; + *is_slowmotion = runloop_slowmotion; +} + +bool runloop_msg_queue_pull(const char **ret) +{ + if (!ret) + return false; +#ifdef HAVE_THREADS + slock_lock(_runloop_msg_queue_lock); +#endif + *ret = msg_queue_pull(runloop_msg_queue); +#ifdef HAVE_THREADS + slock_unlock(_runloop_msg_queue_lock); +#endif + return true; +} bool runloop_ctl(enum runloop_ctl_state state, void *data) { @@ -430,8 +451,6 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) runloop_idle = *ptr; } break; - case RUNLOOP_CTL_IS_SLOWMOTION: - return runloop_slowmotion; case RUNLOOP_CTL_SET_SLOWMOTION: { bool *ptr = (bool*)data; @@ -450,20 +469,6 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) break; case RUNLOOP_CTL_IS_PAUSED: return runloop_paused; - case RUNLOOP_CTL_MSG_QUEUE_PULL: - { - const char **ret = (const char**)data; - if (!ret) - return false; -#ifdef HAVE_THREADS - slock_lock(_runloop_msg_queue_lock); -#endif - *ret = msg_queue_pull(runloop_msg_queue); -#ifdef HAVE_THREADS - slock_unlock(_runloop_msg_queue_lock); -#endif - } - break; case RUNLOOP_CTL_MSG_QUEUE_DEINIT: if (!runloop_msg_queue) return true; @@ -673,7 +678,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) * d) Video driver no longer alive. * e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better) */ -#define time_to_exit(quit_key_pressed) (runloop_shutdown_initiated || quit_key_pressed || !video_driver_is_alive() || bsv_movie_ctl(BSV_MOVIE_CTL_END_EOF, NULL) || (runloop_max_frames && (*(video_driver_get_frame_count_ptr()) >= runloop_max_frames)) || runloop_exec) +#define time_to_exit(quit_key_pressed) (runloop_shutdown_initiated || quit_key_pressed || !video_driver_is_alive() || bsv_movie_ctl(BSV_MOVIE_CTL_END_EOF, NULL) || (runloop_max_frames && (video_driver_get_frame_count() >= runloop_max_frames)) || runloop_exec) #define runloop_check_cheevos() (settings->cheevos.enable && cheevos_loaded && (!cheats_are_enabled && !cheats_were_enabled)) @@ -699,11 +704,7 @@ static enum runloop_state runloop_check_state( if (runloop_cmd_triggered(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY)) { - bool fullscreen_toggled = !runloop_paused; -#ifdef HAVE_MENU - fullscreen_toggled = fullscreen_toggled || - menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL); -#endif + bool fullscreen_toggled = !runloop_paused || menu_driver_is_alive(); if (fullscreen_toggled) command_event(CMD_EVENT_FULLSCREEN_TOGGLE, NULL); @@ -754,7 +755,7 @@ static enum runloop_state runloop_check_state( } #ifdef HAVE_MENU - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) { menu_ctx_iterate_t iter; core_poll(); @@ -771,7 +772,7 @@ static enum runloop_state runloop_check_state( rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL); if (focused || !runloop_idle) - menu_driver_ctl(RARCH_MENU_CTL_RENDER, NULL); + menu_driver_render(runloop_idle); if (!focused) return RUNLOOP_STATE_SLEEP; @@ -791,7 +792,7 @@ static enum runloop_state runloop_check_state( #ifdef HAVE_MENU if (menu_event_kb_is_set(RETROK_F1) == 1) { - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) { if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) @@ -805,7 +806,7 @@ static enum runloop_state runloop_check_state( runloop_cmd_triggered(trigger_input, RARCH_MENU_TOGGLE)) || rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) { - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) { if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) @@ -820,7 +821,7 @@ static enum runloop_state runloop_check_state( else menu_event_kb_set(false, RETROK_F1); - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) { if (!settings->menu.throttle_framerate && !settings->fastforward_ratio) return RUNLOOP_STATE_MENU_ITERATE; @@ -892,7 +893,7 @@ static enum runloop_state runloop_check_state( if (runloop_cmd_triggered(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY)) { command_event(CMD_EVENT_FULLSCREEN_TOGGLE, NULL); - if (!runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL)) + if (!runloop_idle) video_driver_cached_frame(); } @@ -910,7 +911,7 @@ static enum runloop_state runloop_check_state( input_driver_unset_nonblock_state(); else input_driver_set_nonblock_state(); - driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL); + driver_set_nonblock_state(); } else if ((runloop_cmd_pressed(old_input, RARCH_FAST_FORWARD_HOLD_KEY) != runloop_cmd_press(current_input, RARCH_FAST_FORWARD_HOLD_KEY))) @@ -919,7 +920,7 @@ static enum runloop_state runloop_check_state( input_driver_set_nonblock_state(); else input_driver_unset_nonblock_state(); - driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL); + driver_set_nonblock_state(); } /* Checks if the state increase/decrease keys have been pressed @@ -966,7 +967,8 @@ static enum runloop_state runloop_check_state( #ifdef HAVE_CHEEVOS if (!settings->cheevos.hardcore_mode_enable) #endif - state_manager_check_rewind(runloop_cmd_press(current_input, RARCH_REWIND)); + state_manager_check_rewind(runloop_cmd_press(current_input, RARCH_REWIND), + settings->rewind_granularity, runloop_paused); runloop_slowmotion = runloop_cmd_press(current_input, RARCH_SLOWMOTION); @@ -975,7 +977,7 @@ static enum runloop_state runloop_check_state( /* Checks if slowmotion toggle/hold was being pressed and/or held. */ if (settings->video.black_frame_insertion) { - if (!runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL)) + if (!runloop_idle) video_driver_cached_frame(); } @@ -1014,13 +1016,12 @@ static enum runloop_state runloop_check_state( return RUNLOOP_STATE_ITERATE; } -static void runloop_netplay_pause(void) -{ #ifdef HAVE_NETWORKING - /* FIXME: This is an ugly way to tell Netplay this... */ - netplay_driver_ctl(RARCH_NETPLAY_CTL_PAUSE, NULL); +/* FIXME: This is an ugly way to tell Netplay this... */ +#define runloop_netplay_pause() netplay_driver_ctl(RARCH_NETPLAY_CTL_PAUSE, NULL) +#else +#define runloop_netplay_pause() ((void)0) #endif -} /** * runloop_iterate: @@ -1039,10 +1040,15 @@ int runloop_iterate(unsigned *sleep_ms) static uint64_t last_input = 0; settings_t *settings = config_get_ptr(); uint64_t old_input = last_input; +#ifdef HAVE_MENU + bool menu_is_alive = menu_driver_is_alive(); +#else + bool menu_is_alive = false; +#endif uint64_t current_input = #ifdef HAVE_MENU - menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) ? + menu_is_alive ? input_menu_keys_pressed(old_input, &last_input, &trigger_input, runloop_paused) : #endif @@ -1107,8 +1113,7 @@ int runloop_iterate(unsigned *sleep_ms) autosave_lock(); - if (bsv_movie_ctl(BSV_MOVIE_CTL_IS_INITED, NULL)) - bsv_movie_ctl(BSV_MOVIE_CTL_SET_FRAME_START, NULL); + bsv_movie_set_frame_start(); camera_driver_ctl(RARCH_CAMERA_CTL_POLL, NULL); @@ -1150,8 +1155,7 @@ int runloop_iterate(unsigned *sleep_ms) input_pop_analog_dpad(auto_binds); } - if (bsv_movie_ctl(BSV_MOVIE_CTL_IS_INITED, NULL)) - bsv_movie_ctl(BSV_MOVIE_CTL_SET_FRAME_END, NULL); + bsv_movie_set_frame_end(); autosave_unlock(); diff --git a/runloop.h b/runloop.h index 6d5dbe9b2f..107ad14a1c 100644 --- a/runloop.h +++ b/runloop.h @@ -61,7 +61,6 @@ enum runloop_ctl_state RUNLOOP_CTL_SET_LIBRETRO_PATH, - RUNLOOP_CTL_IS_SLOWMOTION, RUNLOOP_CTL_SET_SLOWMOTION, RUNLOOP_CTL_IS_PAUSED, @@ -94,7 +93,6 @@ enum runloop_ctl_state /* Message queue */ RUNLOOP_CTL_MSG_QUEUE_INIT, RUNLOOP_CTL_MSG_QUEUE_DEINIT, - RUNLOOP_CTL_MSG_QUEUE_PULL, /* Core options */ RUNLOOP_CTL_HAS_CORE_OPTIONS, @@ -204,6 +202,10 @@ int runloop_iterate(unsigned *sleep_ms); void runloop_msg_queue_push(const char *msg, unsigned prio, unsigned duration, bool flush); +bool runloop_msg_queue_pull(const char **ret); + +void runloop_get_status(bool *is_paused, bool *is_idle, bool *is_slowmotion); + bool runloop_ctl(enum runloop_ctl_state state, void *data); RETRO_END_DECLS diff --git a/tasks/task_autodetect.c b/tasks/task_autodetect.c index c6749ac351..50459adb9b 100644 --- a/tasks/task_autodetect.c +++ b/tasks/task_autodetect.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/tasks/task_content.c b/tasks/task_content.c index b6e90634ad..81f9208cff 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -331,7 +331,15 @@ static bool load_content_into_memory(unsigned i, const char *path, void **buf, /* Attempt to apply a patch. */ if (!rarch_ctl(RARCH_CTL_IS_PATCH_BLOCKED, NULL)) - patch_content(&ret_buf, length); + { + global_t *global = global_get_ptr(); + if (global) + patch_content( + global->name.ips, + global->name.bps, + global->name.ups, + &ret_buf, length); + } content_get_crc(&content_crc_ptr); diff --git a/tasks/task_database.c b/tasks/task_database.c index a300e833ea..9ccb706877 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2016 - Jean-André Santoni - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -28,7 +28,6 @@ #include "../database_info.h" -#include "../configuration.h" #include "../file_path_special.h" #include "../list_special.h" #include "../msg_hash.h" @@ -700,10 +699,12 @@ task_finished: free(dbinfo); } -bool task_push_dbscan(const char *fullpath, +bool task_push_dbscan( + const char *playlist_directory, + const char *content_database, + const char *fullpath, bool directory, retro_task_callback_t cb) { - settings_t *settings = config_get_ptr(); retro_task_t *t = (retro_task_t*)calloc(1, sizeof(*t)); db_handle_t *db = (db_handle_t*)calloc(1, sizeof(db_handle_t)); @@ -714,11 +715,9 @@ bool task_push_dbscan(const char *fullpath, t->state = db; t->callback = cb; - strlcpy(db->playlist_directory, - settings->directory.playlist, + strlcpy(db->playlist_directory, playlist_directory, sizeof(db->playlist_directory)); - strlcpy(db->content_database_path, - settings->path.content_database, + strlcpy(db->content_database_path, content_database, sizeof(db->content_database_path)); if (directory) diff --git a/tasks/task_database_cue.c b/tasks/task_database_cue.c index d0aa73ad10..458dde2a40 100644 --- a/tasks/task_database_cue.c +++ b/tasks/task_database_cue.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2016 - Jean-André Santoni - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/tasks/task_decompress.c b/tasks/task_decompress.c index 85623f07f3..e0efb224fb 100644 --- a/tasks/task_decompress.c +++ b/tasks/task_decompress.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/tasks/task_file_transfer.c b/tasks/task_file_transfer.c index 51d75d39f0..f3ea334268 100644 --- a/tasks/task_file_transfer.c +++ b/tasks/task_file_transfer.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -69,63 +69,67 @@ void task_file_load_handler(retro_task_t *task) { nbio_handle_t *nbio = (nbio_handle_t*)task->state; - switch (nbio->status) + if (nbio) { - case NBIO_STATUS_INIT: - if (nbio && !string_is_empty(nbio->path)) - { - const char *fullpath = nbio->path; - struct nbio_t *handle = nbio_open(fullpath, NBIO_READ); - if (handle) + switch (nbio->status) + { + case NBIO_STATUS_INIT: + if (nbio && !string_is_empty(nbio->path)) { - nbio->handle = handle; - nbio->status = NBIO_STATUS_TRANSFER; + const char *fullpath = nbio->path; + struct nbio_t *handle = nbio_open(fullpath, NBIO_READ); - if (strstr(fullpath, file_path_str(FILE_PATH_PNG_EXTENSION))) - nbio->image_type = IMAGE_TYPE_PNG; - else if (strstr(fullpath, file_path_str(FILE_PATH_JPEG_EXTENSION)) - || strstr(fullpath, file_path_str(FILE_PATH_JPG_EXTENSION))) - nbio->image_type = IMAGE_TYPE_JPEG; - else if (strstr(fullpath, file_path_str(FILE_PATH_BMP_EXTENSION))) - nbio->image_type = IMAGE_TYPE_BMP; - else if (strstr(fullpath, file_path_str(FILE_PATH_TGA_EXTENSION))) - nbio->image_type = IMAGE_TYPE_TGA; + if (handle) + { + nbio->handle = handle; + nbio->status = NBIO_STATUS_TRANSFER; - nbio_begin_read(handle); - return; + if (strstr(fullpath, file_path_str(FILE_PATH_PNG_EXTENSION))) + nbio->image_type = IMAGE_TYPE_PNG; + else if (strstr(fullpath, file_path_str(FILE_PATH_JPEG_EXTENSION)) + || strstr(fullpath, file_path_str(FILE_PATH_JPG_EXTENSION))) + nbio->image_type = IMAGE_TYPE_JPEG; + else if (strstr(fullpath, file_path_str(FILE_PATH_BMP_EXTENSION))) + nbio->image_type = IMAGE_TYPE_BMP; + else if (strstr(fullpath, file_path_str(FILE_PATH_TGA_EXTENSION))) + nbio->image_type = IMAGE_TYPE_TGA; + + nbio_begin_read(handle); + return; + } + else + task_set_cancelled(task, true); } - else + break; + case NBIO_STATUS_TRANSFER_PARSE: + if (task_file_transfer_iterate_parse(nbio) == -1) task_set_cancelled(task, true); - } - break; - case NBIO_STATUS_TRANSFER_PARSE: - if (task_file_transfer_iterate_parse(nbio) == -1) - task_set_cancelled(task, true); - nbio->status = NBIO_STATUS_TRANSFER_PARSE_FREE; - break; - case NBIO_STATUS_TRANSFER: - if (task_file_transfer_iterate_transfer(nbio) == -1) - nbio->status = NBIO_STATUS_TRANSFER_PARSE; - break; - case NBIO_STATUS_TRANSFER_PARSE_FREE: - case NBIO_STATUS_POLL: - default: - break; - } + nbio->status = NBIO_STATUS_TRANSFER_PARSE_FREE; + break; + case NBIO_STATUS_TRANSFER: + if (task_file_transfer_iterate_transfer(nbio) == -1) + nbio->status = NBIO_STATUS_TRANSFER_PARSE; + break; + case NBIO_STATUS_TRANSFER_PARSE_FREE: + case NBIO_STATUS_POLL: + default: + break; + } - switch (nbio->image_type) - { - case IMAGE_TYPE_PNG: - case IMAGE_TYPE_JPEG: - case IMAGE_TYPE_TGA: - case IMAGE_TYPE_BMP: - if (!task_image_load_handler(task)) - task_set_finished(task, true); - break; - case 0: - if (nbio->is_finished) - task_set_finished(task, true); - break; + switch (nbio->image_type) + { + case IMAGE_TYPE_PNG: + case IMAGE_TYPE_JPEG: + case IMAGE_TYPE_TGA: + case IMAGE_TYPE_BMP: + if (!task_image_load_handler(task)) + task_set_finished(task, true); + break; + case 0: + if (nbio->is_finished) + task_set_finished(task, true); + break; + } } if (task_get_cancelled(task)) diff --git a/tasks/task_http.c b/tasks/task_http.c index 343172202a..9413e9718f 100644 --- a/tasks/task_http.c +++ b/tasks/task_http.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/tasks/task_image.c b/tasks/task_image.c index 96bcd4d23d..65f9d9d008 100644 --- a/tasks/task_image.c +++ b/tasks/task_image.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/tasks/task_netplay_find_content.c b/tasks/task_netplay_find_content.c new file mode 100644 index 0000000000..c84e03a0cf --- /dev/null +++ b/tasks/task_netplay_find_content.c @@ -0,0 +1,234 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2016 - Jean-André Santoni + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tasks_internal.h" +#include "../file_path_special.h" +#include "../verbosity.h" +#include "../configuration.h" +#include "../playlist.h" +#include "../command.h" +#include "../core_info.h" +#include "../../runloop.h" + +typedef struct +{ + struct string_list *lpl_list; + char crc[PATH_MAX_LENGTH]; + char path[PATH_MAX_LENGTH]; + char hostname[512]; + char corename[PATH_MAX_LENGTH]; + bool found; +} netplay_crc_handle_t; + +static void netplay_crc_scan_callback(void *task_data, + void *user_data, const char *error) +{ + int i; + netplay_crc_handle_t *state = (netplay_crc_handle_t*)task_data; + core_info_list_t *info = NULL; + content_ctx_info_t content_info = {0}; + + core_info_get_list(&info); + + if (!state) + return; + + for (i=0; i < info->count; i++) + { + if(string_is_equal(info->list[i].core_name, state->corename)) + break; + } + + if (!string_is_empty(info->list[i].path) && !string_is_empty(state->path)) + { + command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, state->hostname); + task_push_content_load_default( + info->list[i].path, state->path, + &content_info, + CORE_TYPE_PLAIN, + CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_MENU, + NULL, NULL); + } + else + { + /* TO-DO: Inform the user no compatible core or content was found */ + RARCH_LOG("Couldn't find a suitable %s\n", + string_is_empty(state->path) ? "content file" : "core"); + runloop_msg_queue_push( + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_LOAD_CONTENT_MANUALLY), + 1, 480, true); + } + + + free(state); +} + +static void task_netplay_crc_scan_handler(retro_task_t *task) +{ + size_t i, j; + netplay_crc_handle_t *state = (netplay_crc_handle_t*)task->state; + + task_set_progress(task, 0); + task_set_title(task, strdup("Looking for compatible content...")); + task_set_finished(task, false); + + if (!state->lpl_list) + { + task_set_progress(task, 100); + task_set_title(task, strdup("Playlist directory not found")); + task_set_finished(task, true); + free(state); + return; + } + + if (state->lpl_list->size == 0) + goto no_playlists; + + /* content with no CRC uses 00000000*/ + if (!string_is_equal(state->crc, "00000000|crc")) + { + printf("Using CRC matching\n"); + for (i = 0; i < state->lpl_list->size; i++) + { + playlist_t *playlist = NULL; + const char *lpl_path = state->lpl_list->elems[i].data; + + if (!strstr(lpl_path, file_path_str(FILE_PATH_LPL_EXTENSION))) + continue; + + playlist = playlist_init(lpl_path, 99999); + { + for (j = 0; j < playlist->size; j++) + { + if (string_is_equal(playlist->entries[j].crc32, state->crc)) + { + printf("CRC Match %s\n", state->crc); + strlcpy(state->path, playlist->entries[j].path, sizeof(state->path)); + state->found = true; + task_set_data(task, state); + task_set_progress(task, 100); + task_set_title(task, strdup("Compatible content found")); + task_set_finished(task, true); + string_list_free(state->lpl_list); + return; + } + task_set_progress(task, (int)(j/playlist->size*100.0)); + } + } + } + } + else + { + printf("Using filename matching\n"); + for (i = 0; i < state->lpl_list->size; i++) + { + playlist_t *playlist = NULL; + const char *lpl_path = state->lpl_list->elems[i].data; + + if (!strstr(lpl_path, file_path_str(FILE_PATH_LPL_EXTENSION))) + continue; + + playlist = playlist_init(lpl_path, 99999); + { + for (j = 0; j < playlist->size; j++) + { + /*printf("State: %s Entry: %s\n", state->path, playlist->entries[j].path);*/ + if (strstr(playlist->entries[j].path, state->path)) + { + printf("Filename Match %s\n", state->path); + strlcpy(state->path, playlist->entries[j].path, sizeof(state->path)); + state->found = true; + task_set_data(task, state); + task_set_progress(task, 100); + task_set_title(task, strdup("Compatible content found")); + task_set_finished(task, true); + string_list_free(state->lpl_list); + return; + } + + task_set_progress(task, (int)(j/playlist->size*100.0)); + } + } + } + } + +no_playlists: + string_list_free(state->lpl_list); + task_set_progress(task, 100); + task_set_title(task, strdup("Couldn't find compatible content")); + task_set_finished(task, true); + free(state); + return; +} + +bool task_push_netplay_crc_scan(uint32_t crc, char* name, + const char *hostname, const char *corename) +{ + settings_t *settings = config_get_ptr(); + retro_task_t *task = (retro_task_t *)calloc(1, sizeof(*task)); + netplay_crc_handle_t *state = (netplay_crc_handle_t*)calloc(1, sizeof(*state)); + + if (!task || !state) + goto error; + + state->crc[0] = '\0'; + snprintf(state->crc, sizeof(state->crc), "%08X|crc", crc); + state->path[0] = '\0'; + snprintf(state->path, sizeof(state->path), "%s", name); + + state->hostname[0] = '\0'; + snprintf(state->hostname, sizeof(state->hostname), "%s", hostname); + + state->corename[0] = '\0'; + snprintf(state->corename, sizeof(state->corename), "%s", corename); + + state->lpl_list = dir_list_new(settings->directory.playlist, + NULL, true, true, true, false); + + state->found = false; + + /* blocking means no other task can run while this one is running, + * which is the default */ + task->type = TASK_TYPE_BLOCKING; + task->state = state; + task->handler = task_netplay_crc_scan_handler; + task->callback = netplay_crc_scan_callback; + task->title = strdup("Looking for matching content..."); + + task_queue_ctl(TASK_QUEUE_CTL_PUSH, task); + + return true; + +error: + if (state) + free(state); + if (task) + free(task); + + return false; +} diff --git a/tasks/task_netplay_lan_scan.c b/tasks/task_netplay_lan_scan.c index 9d71b8e5a3..38c86c3789 100644 --- a/tasks/task_netplay_lan_scan.c +++ b/tasks/task_netplay_lan_scan.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2016 - Jean-André Santoni + * Copyright (C) 2016-2017 - Jean-André Santoni * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/tasks/task_overlay.c b/tasks/task_overlay.c index b7de165161..a24208b37d 100644 --- a/tasks/task_overlay.c +++ b/tasks/task_overlay.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/tasks/task_powerstate.c b/tasks/task_powerstate.c index ff9d9c1442..028e7f741f 100644 --- a/tasks/task_powerstate.c +++ b/tasks/task_powerstate.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/tasks/task_save.c b/tasks/task_save.c index ee8443c058..452ea44790 100644 --- a/tasks/task_save.c +++ b/tasks/task_save.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/tasks/task_screenshot.c b/tasks/task_screenshot.c index a5246d48e1..8687ab3b73 100644 --- a/tasks/task_screenshot.c +++ b/tasks/task_screenshot.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2016 - Brad Parker + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -76,6 +76,7 @@ typedef struct bool bgr24; bool silence; void *userbuf; + bool is_idle; bool is_paused; bool history_list_enable; } screenshot_task_state_t; @@ -189,7 +190,9 @@ static bool screenshot_dump( const void *frame, unsigned width, unsigned height, - int pitch, bool bgr24, void *userbuf, bool savestate, + int pitch, bool bgr24, + void *userbuf, bool savestate, + bool is_idle, bool is_paused) { char screenshot_path[PATH_MAX_LENGTH]; @@ -211,6 +214,7 @@ static bool screenshot_dump( screenshot_dir = screenshot_path; } + state->is_idle = is_idle; state->is_paused = is_paused; state->bgr24 = bgr24; state->height = height; @@ -263,7 +267,7 @@ static bool screenshot_dump( #if !defined(VITA) static bool take_screenshot_viewport(const char *name_base, bool savestate, - bool is_paused) + bool is_idle, bool is_paused) { struct video_viewport vp; uint8_t *buffer = NULL; @@ -286,13 +290,13 @@ static bool take_screenshot_viewport(const char *name_base, bool savestate, if (!buffer) return false; - if (!video_driver_read_viewport(buffer)) + if (!video_driver_read_viewport(buffer, is_idle)) goto error; /* Data read from viewport is in bottom-up order, suitable for BMP. */ if (!screenshot_dump(name_base, buffer, vp.width, vp.height, - vp.width * 3, true, buffer, savestate, is_paused)) + vp.width * 3, true, buffer, savestate, is_idle, is_paused)) goto error; return true; @@ -305,7 +309,7 @@ error: #endif static bool take_screenshot_raw(const char *name_base, void *userbuf, - bool savestate, bool is_paused) + bool savestate, bool is_idle, bool is_paused) { size_t pitch; unsigned width, height; @@ -318,7 +322,7 @@ static bool take_screenshot_raw(const char *name_base, void *userbuf, */ if (!screenshot_dump(name_base, (const uint8_t*)data + (height - 1) * pitch, - width, height, -pitch, false, userbuf, savestate, is_paused)) + width, height, -pitch, false, userbuf, savestate, is_idle, is_paused)) return false; return true; @@ -347,14 +351,14 @@ static bool take_screenshot_choice(const char *name_base, bool savestate, if (!is_idle) video_driver_cached_frame(); #if defined(VITA) - return take_screenshot_raw(name_base, NULL, savestate, is_paused); + return take_screenshot_raw(name_base, NULL, savestate, is_idle, is_paused); #else - return take_screenshot_viewport(name_base, savestate, is_paused); + return take_screenshot_viewport(name_base, savestate, is_idle, is_paused); #endif } if (!video_driver_cached_frame_has_valid_framebuffer()) - return take_screenshot_raw(name_base, NULL, savestate, is_paused); + return take_screenshot_raw(name_base, NULL, savestate, is_idle, is_paused); if (!video_driver_supports_read_frame_raw()) return false; @@ -371,7 +375,7 @@ static bool take_screenshot_choice(const char *name_base, bool savestate, if (frame_data) { video_driver_set_cached_frame_ptr(frame_data); - if (take_screenshot_raw(name_base, frame_data, savestate, is_paused)) + if (take_screenshot_raw(name_base, frame_data, savestate, is_idle, is_paused)) ret = true; } diff --git a/tasks/task_wifi.c b/tasks/task_wifi.c index a723bbe2d8..8fc081cbcb 100644 --- a/tasks/task_wifi.c +++ b/tasks/task_wifi.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2016 - Jean-André Santoni + * Copyright (C) 2016-2017 - Jean-André Santoni * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/tasks/tasks_internal.h b/tasks/tasks_internal.h index 0d50899867..61bedf861a 100644 --- a/tasks/tasks_internal.h +++ b/tasks/tasks_internal.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Higor Euripedes - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Higor Euripedes + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -98,13 +98,19 @@ bool task_push_wifi_scan(void); bool task_push_netplay_lan_scan(void); +bool task_push_netplay_crc_scan(uint32_t crc, char* name, + const char *hostname, const char *corename); + #endif bool task_push_image_load(const char *fullpath, retro_task_callback_t cb, void *userdata); #ifdef HAVE_LIBRETRODB -bool task_push_dbscan(const char *fullpath, +bool task_push_dbscan( + const char *playlist_directory, + const char *content_database, + const char *fullpath, bool directory, retro_task_callback_t cb); #endif diff --git a/ui/drivers/cocoa/cocoa_common.h b/ui/drivers/cocoa/cocoa_common.h index 07654189e5..09f1e5d57b 100644 --- a/ui/drivers/cocoa/cocoa_common.h +++ b/ui/drivers/cocoa/cocoa_common.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2015 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/cocoa/cocoa_common.m b/ui/drivers/cocoa/cocoa_common.m index 22db7d2f65..71d3205f65 100644 --- a/ui/drivers/cocoa/cocoa_common.m +++ b/ui/drivers/cocoa/cocoa_common.m @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2015 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/cocoa/cocoatouch_menu.m b/ui/drivers/cocoa/cocoatouch_menu.m index 6b2b931d6f..6302369858 100644 --- a/ui/drivers/cocoa/cocoatouch_menu.m +++ b/ui/drivers/cocoa/cocoatouch_menu.m @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2013-2014 - Jason Fetters + * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2014-2015 - Jay McCarthy * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -274,15 +275,14 @@ static void RunActionSheet(const char* title, const struct string_list* items, - (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { - if (buttonIndex == alertView.firstOtherButtonIndex) { - menu_entry_bind_key_set(self.i, RETROK_UNKNOWN); - } else if(buttonIndex == alertView.firstOtherButtonIndex + 1) { - menu_entry_bind_joykey_set(self.i, NO_BTN); - } else if(buttonIndex == alertView.firstOtherButtonIndex + 2) { - menu_entry_bind_joyaxis_set(self.i, AXIS_NONE); - } - - [self finishWithClickedButton:true]; + if (buttonIndex == alertView.firstOtherButtonIndex) + menu_entry_bind_key_set(self.i, RETROK_UNKNOWN); + else if(buttonIndex == alertView.firstOtherButtonIndex + 1) + menu_entry_bind_joykey_set(self.i, NO_BTN); + else if(buttonIndex == alertView.firstOtherButtonIndex + 2) + menu_entry_bind_joyaxis_set(self.i, AXIS_NONE); + + [self finishWithClickedButton:true]; } - (void)checkBind:(NSTimer*)send @@ -290,15 +290,14 @@ static void RunActionSheet(const char* title, const struct string_list* items, int32_t value = 0; int32_t idx = menu_entry_bind_index(self.i); - if ((value = cocoa_input_find_any_key())) { - menu_entry_bind_key_set(self.i, input_keymaps_translate_keysym_to_rk(value)); - } else if ((value = cocoa_input_find_any_button(idx)) >= 0) { - menu_entry_bind_joykey_set(self.i, value); - } else if ((value = cocoa_input_find_any_axis(idx))) { - menu_entry_bind_joyaxis_set(self.i, (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(abs(value) - 1)); - } else { + if ((value = cocoa_input_find_any_key())) + menu_entry_bind_key_set(self.i, input_keymaps_translate_keysym_to_rk(value)); + else if ((value = cocoa_input_find_any_button(idx)) >= 0) + menu_entry_bind_joykey_set(self.i, value); + else if ((value = cocoa_input_find_any_axis(idx))) + menu_entry_bind_joyaxis_set(self.i, (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(abs(value) - 1)); + else return; - } [self finishWithClickedButton:false]; } @@ -496,10 +495,9 @@ replacementString:(NSString *)string [super initialize:main idx:i]; self.formatter = [RANumberFormatter new]; - if (menu_entry_num_has_range(self.i)) { - [self.formatter setRangeFrom:BOXFLOAT(menu_entry_num_min(self.i)) - To:BOXFLOAT(menu_entry_num_max(self.i))]; - } + if (menu_entry_num_has_range(self.i)) + [self.formatter setRangeFrom:BOXFLOAT(menu_entry_num_min(self.i)) + To:BOXFLOAT(menu_entry_num_max(self.i))]; } @end diff --git a/ui/drivers/cocoa/ui_cocoa_application.m b/ui/drivers/cocoa/ui_cocoa_application.m index 979e490458..1feffc6c95 100644 --- a/ui/drivers/cocoa/ui_cocoa_application.m +++ b/ui/drivers/cocoa/ui_cocoa_application.m @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/cocoa/ui_cocoa_browser_window.m b/ui/drivers/cocoa/ui_cocoa_browser_window.m index 47a096f69b..1ed7446be6 100644 --- a/ui/drivers/cocoa/ui_cocoa_browser_window.m +++ b/ui/drivers/cocoa/ui_cocoa_browser_window.m @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/cocoa/ui_cocoa_msg_window.m b/ui/drivers/cocoa/ui_cocoa_msg_window.m index 78449181f5..3a9892c79f 100644 --- a/ui/drivers/cocoa/ui_cocoa_msg_window.m +++ b/ui/drivers/cocoa/ui_cocoa_msg_window.m @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/cocoa/ui_cocoa_window.m b/ui/drivers/cocoa/ui_cocoa_window.m index be3f743cab..881f60b657 100644 --- a/ui/drivers/cocoa/ui_cocoa_window.m +++ b/ui/drivers/cocoa/ui_cocoa_window.m @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/null/ui_null_application.c b/ui/drivers/null/ui_null_application.c index 1eec3f9059..ef2394f85e 100644 --- a/ui/drivers/null/ui_null_application.c +++ b/ui/drivers/null/ui_null_application.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/null/ui_null_browser_window.c b/ui/drivers/null/ui_null_browser_window.c index 9b0209a361..ab739a3c5f 100644 --- a/ui/drivers/null/ui_null_browser_window.c +++ b/ui/drivers/null/ui_null_browser_window.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/null/ui_null_msg_window.c b/ui/drivers/null/ui_null_msg_window.c index 20e91d3a46..c4de4b7175 100644 --- a/ui/drivers/null/ui_null_msg_window.c +++ b/ui/drivers/null/ui_null_msg_window.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/null/ui_null_window.c b/ui/drivers/null/ui_null_window.c index ec0b889d8e..4abdf028cb 100644 --- a/ui/drivers/null/ui_null_window.c +++ b/ui/drivers/null/ui_null_window.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/qt/ui_qt_application.cpp b/ui/drivers/qt/ui_qt_application.cpp index f5ae04cf68..c6c0d42c19 100644 --- a/ui/drivers/qt/ui_qt_application.cpp +++ b/ui/drivers/qt/ui_qt_application.cpp @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/qt/ui_qt_browser_window.cpp b/ui/drivers/qt/ui_qt_browser_window.cpp index 31ed1c7c1e..7272b07701 100644 --- a/ui/drivers/qt/ui_qt_browser_window.cpp +++ b/ui/drivers/qt/ui_qt_browser_window.cpp @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/qt/ui_qt_msg_window.cpp b/ui/drivers/qt/ui_qt_msg_window.cpp index a37a939b3b..3d4a3fb497 100644 --- a/ui/drivers/qt/ui_qt_msg_window.cpp +++ b/ui/drivers/qt/ui_qt_msg_window.cpp @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/qt/ui_qt_window.cpp b/ui/drivers/qt/ui_qt_window.cpp index c4cff0724e..aca4448c22 100644 --- a/ui/drivers/qt/ui_qt_window.cpp +++ b/ui/drivers/qt/ui_qt_window.cpp @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/qt/wimp/wimp.cpp b/ui/drivers/qt/wimp/wimp.cpp index 07df4f22bc..7c65bb14c1 100644 --- a/ui/drivers/qt/wimp/wimp.cpp +++ b/ui/drivers/qt/wimp/wimp.cpp @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2015 - Andres Suarez + * Copyright (C) 2011-2017 - Andres Suarez * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/qt/wimp/wimp.h b/ui/drivers/qt/wimp/wimp.h index f404e852eb..d01b80e112 100644 --- a/ui/drivers/qt/wimp/wimp.h +++ b/ui/drivers/qt/wimp/wimp.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2015 - Andres Suarez + * Copyright (C) 2011-2017 - Andres Suarez * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/qt/wimp/wimp_global.h b/ui/drivers/qt/wimp/wimp_global.h index 0974927311..be3afc6994 100644 --- a/ui/drivers/qt/wimp/wimp_global.h +++ b/ui/drivers/qt/wimp/wimp_global.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2015 - Andres Suarez + * Copyright (C) 2011-2017 - Andres Suarez * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/qt/wrapper/wrapper.cpp b/ui/drivers/qt/wrapper/wrapper.cpp index c3573e40a5..86a82d75af 100644 --- a/ui/drivers/qt/wrapper/wrapper.cpp +++ b/ui/drivers/qt/wrapper/wrapper.cpp @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2015 - Andres Suarez + * Copyright (C) 2011-2017 - Andres Suarez * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/qt/wrapper/wrapper.h b/ui/drivers/qt/wrapper/wrapper.h index dc8fffd756..9e28c5833a 100644 --- a/ui/drivers/qt/wrapper/wrapper.h +++ b/ui/drivers/qt/wrapper/wrapper.h @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2015 - Andres Suarez + * Copyright (C) 2011-2017 - Andres Suarez * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/ui_cocoa.h b/ui/drivers/ui_cocoa.h index 242e4a1151..274ba285cb 100644 --- a/ui/drivers/ui_cocoa.h +++ b/ui/drivers/ui_cocoa.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m index f22d355be4..966ec57065 100644 --- a/ui/drivers/ui_cocoa.m +++ b/ui/drivers/ui_cocoa.m @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2013-2014 - Jason Fetters + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -109,9 +109,10 @@ static void app_terminate(void) case NSFlagsChanged: { static uint32_t old_flags = 0; - uint32_t new_flags = event.modifierFlags; - bool down = (new_flags & old_flags) == old_flags; - old_flags = new_flags; + uint32_t new_flags = event.modifierFlags; + bool down = (new_flags & old_flags) == old_flags; + + old_flags = new_flags; apple_input_keyboard_event(down, event.keyCode, 0, event.modifierFlags, RETRO_DEVICE_KEYBOARD); @@ -148,27 +149,27 @@ static void app_terminate(void) case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown: - { - NSPoint pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil]; - apple = (cocoa_input_data_t*)input_driver_get_data(); - if (!apple || pos.y < 0) - return; - apple->mouse_buttons |= 1 << event.buttonNumber; - - apple->touch_count = 1; - } + { + NSPoint pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil]; + apple = (cocoa_input_data_t*)input_driver_get_data(); + if (!apple || pos.y < 0) + return; + apple->mouse_buttons |= 1 << event.buttonNumber; + + apple->touch_count = 1; + } break; case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp: - { - NSPoint pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil]; - apple = (cocoa_input_data_t*)input_driver_get_data(); - if (!apple || pos.y < 0) - return; - apple->mouse_buttons &= ~(1 << event.buttonNumber); - apple->touch_count = 0; - } + { + NSPoint pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil]; + apple = (cocoa_input_data_t*)input_driver_get_data(); + if (!apple || pos.y < 0) + return; + apple->mouse_buttons &= ~(1 << event.buttonNumber); + apple->touch_count = 0; + } break; } } diff --git a/ui/drivers/ui_cocoatouch.m b/ui/drivers/ui_cocoatouch.m index 5351e059cc..e502e62ea5 100644 --- a/ui/drivers/ui_cocoatouch.m +++ b/ui/drivers/ui_cocoatouch.m @@ -190,9 +190,8 @@ enum * but is bad for business with events. */ static double last_time_stamp; - if (last_time_stamp == event.timestamp) { - return [super handleKeyUIEvent:event]; - } + if (last_time_stamp == event.timestamp) + return [super handleKeyUIEvent:event]; last_time_stamp = event.timestamp; @@ -495,21 +494,25 @@ enum - (void)mainMenuPushPop: (bool)pushp { - if ( pushp ) { - self.menu_count++; - RAMenuBase* next_menu = [RAMainMenu new]; - next_menu.last_menu = self.mainmenu; - self.mainmenu = next_menu; - [self pushViewController:self.mainmenu animated:YES]; - } else { - if ( self.menu_count == 0 ) { - [self.mainmenu reloadData]; - } else { - self.menu_count--; + if ( pushp ) + { + self.menu_count++; + RAMenuBase* next_menu = [RAMainMenu new]; + next_menu.last_menu = self.mainmenu; + self.mainmenu = next_menu; + [self pushViewController:self.mainmenu animated:YES]; + } + else + { + if ( self.menu_count == 0 ) + [self.mainmenu reloadData]; + else + { + self.menu_count--; - [self popViewControllerAnimated:YES]; - self.mainmenu = self.mainmenu.last_menu; - } + [self popViewControllerAnimated:YES]; + self.mainmenu = self.mainmenu.last_menu; + } } } @@ -627,9 +630,8 @@ static void ui_companion_cocoatouch_notify_list_pushed(void *data, file_list_t *list, file_list_t *menu_list) { RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform; - bool pushp = false; - - size_t new_size = file_list_get_size( menu_list ); + bool pushp = false; + size_t new_size = file_list_get_size( menu_list ); /* FIXME workaround for the double call */ if ( old_size == 0 ) @@ -638,13 +640,13 @@ static void ui_companion_cocoatouch_notify_list_pushed(void *data, return; } - if ( old_size == new_size ) { + if ( old_size == new_size ) pushp = false; - } else if ( old_size < new_size ) { + else if ( old_size < new_size ) pushp = true; - } else if ( old_size > new_size ) { + else if ( old_size > new_size ) printf( "notify_list_pushed: old size should not be larger\n" ); - } + old_size = new_size; if (ap) diff --git a/ui/drivers/ui_null.c b/ui/drivers/ui_null.c index f43fcd29f7..833bb73887 100644 --- a/ui/drivers/ui_null.c +++ b/ui/drivers/ui_null.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/ui_qt.cpp b/ui/drivers/ui_qt.cpp index e074b1d2dd..cdbce779f6 100644 --- a/ui/drivers/ui_qt.cpp +++ b/ui/drivers/ui_qt.cpp @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/ui_win32.c b/ui/drivers/ui_win32.c index b11764bd19..49382b9de6 100644 --- a/ui/drivers/ui_win32.c +++ b/ui/drivers/ui_win32.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2015-2016 - Ali Bouhlel - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2015-2017 - Ali Bouhlel + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -41,6 +41,7 @@ #include #include #include +#include #include #include "../ui_companion_driver.h" @@ -115,32 +116,28 @@ typedef struct static shader_dlg_t g_shader_dlg = {{0}}; -static void shader_dlg_refresh_trackbar_label(int index) +static bool shader_dlg_refresh_trackbar_label(int index, + video_shader_ctx_t *shader_info) { - video_shader_ctx_t shader_info; char val_buffer[32] = {0}; - video_shader_driver_get_current_shader(&shader_info); - - if (floorf(shader_info.data->parameters[index].current) - == shader_info.data->parameters[index].current) + if (floorf(shader_info->data->parameters[index].current) + == shader_info->data->parameters[index].current) snprintf(val_buffer, sizeof(val_buffer), "%.0f", - shader_info.data->parameters[index].current); + shader_info->data->parameters[index].current); else snprintf(val_buffer, sizeof(val_buffer), "%.2f", - shader_info.data->parameters[index].current); + shader_info->data->parameters[index].current); SendMessage(g_shader_dlg.controls[index].trackbar.label_val, WM_SETTEXT, 0, (LPARAM)val_buffer); + return true; } static void shader_dlg_params_refresh(void) { int i; - video_shader_ctx_t shader_info; - - video_shader_driver_get_current_shader(&shader_info); for (i = 0; i < GFX_MAX_PARAMETERS; i++) { @@ -153,26 +150,37 @@ static void shader_dlg_params_refresh(void) { case SHADER_PARAM_CTRL_CHECKBOX: { - bool checked = + video_shader_ctx_t shader_info; + video_shader_driver_get_current_shader(&shader_info); + + bool checked = shader_info.data ? (shader_info.data->parameters[i].current == - shader_info.data->parameters[i].maximum); + shader_info.data->parameters[i].maximum) : false; SendMessage(control->checkbox.hwnd, BM_SETCHECK, checked, 0); } break; case SHADER_PARAM_CTRL_TRACKBAR: - shader_dlg_refresh_trackbar_label(i); + { + video_shader_ctx_t shader_info; + video_shader_driver_get_current_shader(&shader_info); + if (shader_info.data && !shader_dlg_refresh_trackbar_label(i, &shader_info)) + break; - SendMessage(control->trackbar.hwnd, - TBM_SETRANGEMIN, (WPARAM)TRUE, (LPARAM)0); - SendMessage(control->trackbar.hwnd, - TBM_SETRANGEMAX, (WPARAM)TRUE, - (LPARAM)((shader_info.data->parameters[i].maximum - - shader_info.data->parameters[i].minimum) - / shader_info.data->parameters[i].step)); - SendMessage(control->trackbar.hwnd, TBM_SETPOS, (WPARAM)TRUE, - (LPARAM)((shader_info.data->parameters[i].current - - shader_info.data->parameters[i].minimum) / - shader_info.data->parameters[i].step)); + if (shader_info.data) + { + SendMessage(control->trackbar.hwnd, + TBM_SETRANGEMIN, (WPARAM)TRUE, (LPARAM)0); + SendMessage(control->trackbar.hwnd, + TBM_SETRANGEMAX, (WPARAM)TRUE, + (LPARAM)((shader_info.data->parameters[i].maximum - + shader_info.data->parameters[i].minimum) + / shader_info.data->parameters[i].step)); + SendMessage(control->trackbar.hwnd, TBM_SETPOS, (WPARAM)TRUE, + (LPARAM)((shader_info.data->parameters[i].current - + shader_info.data->parameters[i].minimum) / + shader_info.data->parameters[i].step)); + } + } break; case SHADER_PARAM_CTRL_NONE: default: @@ -187,10 +195,9 @@ static void shader_dlg_params_clear(void) for (i = 0; i < GFX_MAX_PARAMETERS; i++) { - const ui_window_t *window = ui_companion_driver_get_window_ptr(); shader_param_ctrl_t*control = &g_shader_dlg.controls[i]; - if (control->type == SHADER_PARAM_CTRL_NONE) + if (!control || control->type == SHADER_PARAM_CTRL_NONE) break; switch (control->type) @@ -198,8 +205,11 @@ static void shader_dlg_params_clear(void) case SHADER_PARAM_CTRL_NONE: break; case SHADER_PARAM_CTRL_CHECKBOX: - if (window) - window->destroy(&control->checkbox); + { + const ui_window_t *window = ui_companion_driver_get_window_ptr(); + if (window) + window->destroy(&control->checkbox); + } break; case SHADER_PARAM_CTRL_TRACKBAR: DestroyWindow(control->trackbar.label_title); @@ -214,23 +224,24 @@ static void shader_dlg_params_clear(void) void shader_dlg_params_reload(void) { +#ifdef HAVE_SHADERPIPELINE HFONT hFont; RECT parent_rect; int i, pos_x, pos_y; video_shader_ctx_t shader_info; - const ui_window_t *window = ui_companion_driver_get_window_ptr(); - video_shader_driver_get_current_shader(&shader_info); - + const ui_window_t *window = NULL; + shader_dlg_params_clear(); - if (!shader_info.data) - return; - if (shader_info.data->num_parameters > GFX_MAX_PARAMETERS) + video_shader_driver_get_current_shader(&shader_info); + + if (!shader_info.data || shader_info.data->num_parameters > GFX_MAX_PARAMETERS) return; - hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); - pos_y = g_shader_dlg.parameters_start_y; - pos_x = SHADER_DLG_CTRL_X; + window = ui_companion_driver_get_window_ptr(); + hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); + pos_y = g_shader_dlg.parameters_start_y; + pos_x = SHADER_DLG_CTRL_X; for (i = 0; i < (int)shader_info.data->num_parameters; i++) { @@ -315,7 +326,7 @@ void shader_dlg_params_reload(void) (pos_x - SHADER_DLG_CTRL_X) + SHADER_DLG_WIDTH, (pos_x == SHADER_DLG_CTRL_X) ? pos_y + 30 : SHADER_DLG_MAX_HEIGHT, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); - +#endif } static void shader_dlg_update_on_top_state(void) @@ -354,15 +365,13 @@ void shader_dlg_show(HWND parent_hwnd) window->set_focused(&g_shader_dlg.window); } +#if defined(HAVE_OPENGL) || defined(HAVE_VULKAN) static LRESULT CALLBACK ShaderDlgWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { int i, pos; - video_shader_ctx_t shader_info; const ui_window_t *window = ui_companion_driver_get_window_ptr(); - video_shader_driver_get_current_shader(&shader_info); - switch (message) { case WM_CREATE: @@ -390,36 +399,50 @@ static LRESULT CALLBACK ShaderDlgWndProc(HWND hwnd, UINT message, if (g_shader_dlg.controls[i].type != SHADER_PARAM_CTRL_CHECKBOX) break; - if (SendMessage(g_shader_dlg.controls[i].checkbox.hwnd, - BM_GETCHECK, 0, 0) == BST_CHECKED) - shader_info.data->parameters[i].current = - shader_info.data->parameters[i].maximum; - else - shader_info.data->parameters[i].current = - shader_info.data->parameters[i].minimum; + { + video_shader_ctx_t shader_info; + video_shader_driver_get_current_shader(&shader_info); + if (SendMessage(g_shader_dlg.controls[i].checkbox.hwnd, + BM_GETCHECK, 0, 0) == BST_CHECKED) + shader_info.data->parameters[i].current = + shader_info.data->parameters[i].maximum; + else + shader_info.data->parameters[i].current = + shader_info.data->parameters[i].minimum; + } break; case WM_HSCROLL: - i = GetWindowLong((HWND)lparam, GWL_ID); + { + video_shader_ctx_t shader_info; + video_shader_driver_get_current_shader(&shader_info); + i = GetWindowLong((HWND)lparam, GWL_ID); - if (i >= GFX_MAX_PARAMETERS) - break; + if (i >= GFX_MAX_PARAMETERS) + break; - if (g_shader_dlg.controls[i].type != SHADER_PARAM_CTRL_TRACKBAR) - break; + if (g_shader_dlg.controls[i].type != SHADER_PARAM_CTRL_TRACKBAR) + break; - pos = (int)SendMessage(g_shader_dlg.controls[i].trackbar.hwnd, TBM_GETPOS, 0, 0); - shader_info.data->parameters[i].current = - shader_info.data->parameters[i].minimum + pos * shader_info.data->parameters[i].step; + pos = (int)SendMessage(g_shader_dlg.controls[i].trackbar.hwnd, TBM_GETPOS, 0, 0); - shader_dlg_refresh_trackbar_label(i); + { + + shader_info.data->parameters[i].current = + shader_info.data->parameters[i].minimum + pos * shader_info.data->parameters[i].step; + } + + if (shader_info.data) + shader_dlg_refresh_trackbar_label(i, &shader_info); + } break; } return DefWindowProc(hwnd, message, wparam, lparam); } +#endif bool win32_window_init(WNDCLASSEX *wndclass, bool fullscreen, const char *class_name) @@ -447,13 +470,15 @@ bool win32_window_init(WNDCLASSEX *wndclass, if (class_name != NULL) return true; + /* Shader dialog is disabled for now, until video_threaded issues are fixed. if (!win32_shader_dlg_init()) - RARCH_ERR("[WGL]: wgl_shader_dlg_init() failed.\n"); + RARCH_ERR("[WGL]: wgl_shader_dlg_init() failed.\n");*/ return true; } bool win32_shader_dlg_init(void) { +#if defined(HAVE_OPENGL) || defined(HAVE_VULKAN) static bool inited = false; int pos_y; HFONT hFont; @@ -501,7 +526,7 @@ bool win32_shader_dlg_init(void) pos_y += SHADER_DLG_SEPARATOR_HEIGHT + SHADER_DLG_CTRL_MARGIN; g_shader_dlg.parameters_start_y = pos_y; - +#endif return true; } @@ -530,7 +555,7 @@ static bool win32_browser( new_title[0] = '\0'; new_file[0] = '\0'; - if (title && *title) + if (!string_is_empty(title)) strlcpy(new_title, title, sizeof(new_title)); if (filename && *filename) @@ -589,7 +614,7 @@ LRESULT win32_menu_loop(HWND owner, WPARAM wparam) * This is needed for proper multi-byte string display until Unicode is fully supported. */ MultiByteToWideChar(CP_UTF8, 0, title, -1, title_wide, sizeof(title_wide) / sizeof(title_wide[0])); - wcstombs_s(&converted, title_cp, sizeof(title_cp), title_wide, sizeof(title_cp) - 1); + wcstombs(title_cp, title_wide, sizeof(title_cp) - 1); if (!win32_browser(owner, win32_file, extensions, title_cp, initial_dir)) diff --git a/ui/drivers/ui_win32.h b/ui/drivers/ui_win32.h index 07a242c199..d1a685fa71 100644 --- a/ui/drivers/ui_win32.h +++ b/ui/drivers/ui_win32.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/win32/ui_win32_application.c b/ui/drivers/win32/ui_win32_application.c index 44c9624323..be5c8eace7 100644 --- a/ui/drivers/win32/ui_win32_application.c +++ b/ui/drivers/win32/ui_win32_application.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/win32/ui_win32_browser_window.c b/ui/drivers/win32/ui_win32_browser_window.c index 9f59cb3e58..bde5f318a7 100644 --- a/ui/drivers/win32/ui_win32_browser_window.c +++ b/ui/drivers/win32/ui_win32_browser_window.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/win32/ui_win32_msg_window.c b/ui/drivers/win32/ui_win32_msg_window.c index 97a20b73a2..113a3d58eb 100644 --- a/ui/drivers/win32/ui_win32_msg_window.c +++ b/ui/drivers/win32/ui_win32_msg_window.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/drivers/win32/ui_win32_window.cpp b/ui/drivers/win32/ui_win32_window.cpp index d76866a0ba..afa19a8346 100644 --- a/ui/drivers/win32/ui_win32_window.cpp +++ b/ui/drivers/win32/ui_win32_window.cpp @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2015-2016 - Ali Bouhlel - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2015-2017 - Ali Bouhlel + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/ui_companion_driver.c b/ui/ui_companion_driver.c index 6762f63ae2..a5bb45d5be 100644 --- a/ui/ui_companion_driver.c +++ b/ui/ui_companion_driver.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/ui/ui_companion_driver.h b/ui/ui_companion_driver.h index 5cbd8e0af4..5bc4e152eb 100644 --- a/ui/ui_companion_driver.h +++ b/ui/ui_companion_driver.h @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/wifi/drivers/connmanctl.c b/wifi/drivers/connmanctl.c index 3f78ee3565..5af68d2f4d 100644 --- a/wifi/drivers/connmanctl.c +++ b/wifi/drivers/connmanctl.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2016 - Jean-André Santoni + * Copyright (C) 2014-2017 - Jean-André Santoni * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/wifi/drivers/nullwifi.c b/wifi/drivers/nullwifi.c index a2e960f8b5..362196bb01 100644 --- a/wifi/drivers/nullwifi.c +++ b/wifi/drivers/nullwifi.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2016 - Jean-André Santoni + * Copyright (C) 2014-2017 - Jean-André Santoni * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/wifi/wifi_driver.c b/wifi/wifi_driver.c index c80137502d..f27a9ddf7e 100644 --- a/wifi/wifi_driver.c +++ b/wifi/wifi_driver.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2016 - Jean-André Santoni + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/wifi/wifi_driver.h b/wifi/wifi_driver.h index 55646255e4..76b6587103 100644 --- a/wifi/wifi_driver.h +++ b/wifi/wifi_driver.h @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2014-2016 - Jean-André Santoni + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- diff --git a/wiiu/padscore.h b/wiiu/padscore.h new file mode 100644 index 0000000000..962dff02d4 --- /dev/null +++ b/wiiu/padscore.h @@ -0,0 +1,126 @@ +/**************************************************************************** + * Copyright (C) 2015 + * by Dimok + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. + * + * Permission is granted to anyone to use this software for any + * purpose, including commercial applications, and to alter it and + * redistribute it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you use + * this software in a product, an acknowledgment in the product + * documentation would be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and + * must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + ***************************************************************************/ +#ifndef __PAD_SCORE_FUNCTIONS_H_ +#define __PAD_SCORE_FUNCTIONS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define WPAD_BUTTON_LEFT 0x0001 +#define WPAD_BUTTON_RIGHT 0x0002 +#define WPAD_BUTTON_DOWN 0x0004 +#define WPAD_BUTTON_UP 0x0008 +#define WPAD_BUTTON_PLUS 0x0010 +#define WPAD_BUTTON_2 0x0100 +#define WPAD_BUTTON_1 0x0200 +#define WPAD_BUTTON_B 0x0400 +#define WPAD_BUTTON_A 0x0800 +#define WPAD_BUTTON_MINUS 0x1000 +#define WPAD_BUTTON_Z 0x2000 +#define WPAD_BUTTON_C 0x4000 +#define WPAD_BUTTON_HOME 0x8000 + +#define WPAD_CLASSIC_BUTTON_UP 0x0001 +#define WPAD_CLASSIC_BUTTON_LEFT 0x0002 +#define WPAD_CLASSIC_BUTTON_ZR 0x0004 +#define WPAD_CLASSIC_BUTTON_X 0x0008 +#define WPAD_CLASSIC_BUTTON_A 0x0010 +#define WPAD_CLASSIC_BUTTON_Y 0x0020 +#define WPAD_CLASSIC_BUTTON_B 0x0040 +#define WPAD_CLASSIC_BUTTON_ZL 0x0080 +#define WPAD_CLASSIC_BUTTON_R 0x0200 +#define WPAD_CLASSIC_BUTTON_PLUS 0x0400 +#define WPAD_CLASSIC_BUTTON_HOME 0x0800 +#define WPAD_CLASSIC_BUTTON_MINUS 0x1000 +#define WPAD_CLASSIC_BUTTON_L 0x2000 +#define WPAD_CLASSIC_BUTTON_DOWN 0x4000 +#define WPAD_CLASSIC_BUTTON_RIGHT 0x8000 + +#define WPAD_PRO_BUTTON_STICK_R 0x10000 +#define WPAD_PRO_BUTTON_STICK_L 0x20000 + +void InitPadScoreFunctionPointers(void); + + +typedef struct _KPADData +{ + u32 btns_h; + u32 btns_d; + u32 btns_r; + u32 unused_1[5]; + f32 pos_x; + f32 pos_y; + u32 unused_2[3]; + f32 angle_x; + f32 angle_y; + u32 unused_3[8]; + u8 device_type; + u8 wpad_error; + u8 pos_valid; + u8 unused_4[1]; + + union + { + struct + { + f32 stick_x; + f32 stick_y; + } nunchuck; + + struct + { + u32 btns_h; + u32 btns_d; + u32 btns_r; + f32 lstick_x; + f32 lstick_y; + f32 rstick_x; + f32 rstick_y; + f32 ltrigger; + f32 rtrigger; + } classic; + + u32 unused_6[20]; + }; + u32 unused_7[16]; +} KPADData; + +typedef void (* wpad_connect_callback_t)(s32 chan, s32 status); + +void KPADInit (void); +s32 WPADProbe (s32 chan, u32 * pad_type); +s32 WPADSetDataFormat(s32 chan, s32 format); +void WPADEnableURCC(s32 enable); +void WPADEnableWiiRemote(s32 enable); +void WPADRead(s32 chan, void * data); +s32 KPADRead(s32 chan, void * data, u32 size); + +#ifdef __cplusplus +} +#endif + +#endif // __PAD_SCORE_FUNCTIONS_H_ diff --git a/wiiu/system/imports.h b/wiiu/system/imports.h index 144d4518fb..b6f6a9d8b1 100644 --- a/wiiu/system/imports.h +++ b/wiiu/system/imports.h @@ -178,3 +178,17 @@ IMPORT(VPADRead); IMPORT(VPADInit); IMPORT_END(); + +/* padscore */ +IMPORT_BEGIN(padscore); + +IMPORT(KPADInit); +IMPORT(WPADProbe); +IMPORT(WPADSetDataFormat); +IMPORT(WPADEnableURCC); +IMPORT(WPADEnableWiiRemote); +IMPORT(WPADRead); +IMPORT(KPADRead); + +IMPORT_END(); +