diff --git a/AUTHORS.h b/AUTHORS.h index a7f3298fb4..4863d9b0fb 100644 --- a/AUTHORS.h +++ b/AUTHORS.h @@ -94,6 +94,7 @@ FIX94 Flame Sage (chris062689) flyinghead Francisco José García García (frangarcj) +Francisco Javier Trujillo Mata (fjtrujy) GameDragon2k Garrett Brown (garbear) gblues @@ -141,6 +142,7 @@ JuanVCS Justin Jacobs (dorkster) Justin Weiss (justinweiss) Ken Rossato (rossato) +Krzysztof Haładyn (krzys_h) kurumushi kwyxz l3iggs diff --git a/CHANGES.md b/CHANGES.md index ac79af4e4d..ec4fea28e4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,23 +1,42 @@ # 1.7.6 (future) +- ANDROID: Fix Xperia Play input binding +- CHEEVOS: Reset when hardcore mode is toggled +- CORE UPDATER: Allow sideloading cores from the menu - CPU FILTERS: Add Normal2x filter. - DATE: Add Date / Time style options. -- MIDI: Add a Linux ALSA driver for MIDI. +- DEBUGGING: Add an integrated crash handler for debug builds (see https://docs.libretro.com/tech/debugging) +- DISCORD: Register the application name properly. +- DISK CONTROL: Remember the last used folder / current active folder to make disk-swapping faster. +- INPUT/SDL: Flush the joypad events. Decreases cpu usage over time with the SDL joypad driver. - LOCALIZATION: Add Greek translation. - LOCALIZATION: Update German translation. - LOCALIZATION: Update Italian translation. -- LOCALIZATION: Update Simplified Chinese translation. - LOCALIZATION: Update Japanese translation. +- LOCALIZATION: Update Simplified Chinese translation. - MENU: Only show CRT SwitchRes if video display server is implemented (Windows/Linux for now) - MENU: User Interface -> Appearance -> 'Menu Font Green/Blue Color' settings now work properly. +- MIDI: Add a Linux ALSA driver for MIDI. +- NETPLAY: Force fast-save-states when netlay is enabled +- PS2: Initial PlayStation2 port. +- PS4: Initial PlayStation4 port. +- RECORDING: Implement recording options in the menu complete with quality profiles, streaming, and proper file naming - SCANNER: Fix GDI disc scanning. +- SHADERS: Fix auto shader preset loading on D3D10, D3D11, D3D12 +- SUBSYSTEM: Allow more than 10 subsystems +- SUBSYSTEM: Cores that use subsystem for complex scenarios can now load content without starting a regular content first +- SUBSYSTEM: Remember the last used folder to make loading subsystem type content faster - SWITCH/LIBNX: Improve touch scaling calculation. - SWITCH: Proper button labels. - VULKAN: Fix RGUI crashing at startup. - VULKAN: Fix secondary screens in overlays not working. - WAYLAND: Implement idle-inhibit support (needed for screensaver suspend). -- WINDOWS/WSA: Network Information info is blank until first network operation. -- WINDOWS: SSL/TLS connections now work properly. - WIIU: Initial netplay peer-to-peer support. Network information working. +- WINDOWS/WSA: Network Information info is blank until first network operation. +- WINDOWS: Fix an ancient bug that caused wrong mappings for keyboard arrows +- WINDOWS: Remember window size and position if so desired +- WINDOWS: SSL/TLS connections now work properly. +- UWP: Initial UWP port. +- XBONE: Initial Xbox One port. # 1.7.5 - CAMERA: Fix Video4Linux2 driver that broke years ago. diff --git a/Makefile b/Makefile index 7f4b717e69..5517dbb810 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,8 @@ DEFINES += -DGLOBAL_CONFIG_DIR='"$(GLOBAL_CONFIG_DIR)"' ifneq ($(findstring BSD,$(OS)),) CFLAGS += -DBSD LDFLAGS += -L/usr/local/lib + UDEV_CFLAGS += -I/usr/local/include/libepoll-shim + UDEV_LIBS += -lepoll-shim endif ifneq ($(findstring DOS,$(OS)),) @@ -82,6 +84,11 @@ else OPTIMIZE_FLAG = -O3 -ffast-math endif +ifeq ($(HAVE_DRMINGW), 1) + CFLAGS += -DHAVE_DRMINGW + LDFLAGS += $(DRMINGW_LIBS) +endif + ifneq ($(findstring Win32,$(OS)),) LDFLAGS += -mwindows endif @@ -243,12 +250,24 @@ install: $(TARGET) chmod 644 $(DESTDIR)$(MAN_DIR)/man6/retroarch.6 chmod 644 $(DESTDIR)$(MAN_DIR)/man6/retroarch-cg2glsl.6 chmod 644 $(DESTDIR)$(DATA_DIR)/pixmaps/retroarch.svg - @if test -d media/assets; then \ + @if test -d media/assets && test $(HAVE_ASSETS); then \ echo "Installing media assets..."; \ mkdir -p $(DESTDIR)$(ASSETS_DIR)/assets; \ - cp -r media/assets/xmb/ $(DESTDIR)$(ASSETS_DIR)/assets; \ - cp -r media/assets/glui/ $(DESTDIR)$(ASSETS_DIR)/assets; \ - cp -r media/assets/ozone/ $(DESTDIR)$(ASSETS_DIR)/assets; \ + if test $(HAVE_ZARCH) = 1; then \ + cp -r media/assets/zarch/ $(DESTDIR)$(ASSETS_DIR)/assets; \ + fi; \ + if test $(HAVE_MATERIALUI) = 1; then \ + cp -r media/assets/glui/ $(DESTDIR)$(ASSETS_DIR)/assets; \ + fi; \ + if test $(HAVE_NUKLEAR) = 1; then \ + cp -r media/assets/nuklear/ $(DESTDIR)$(ASSETS_DIR)/assets; \ + fi; \ + if test $(HAVE_XMB) = 1; then \ + cp -r media/assets/xmb/ $(DESTDIR)$(ASSETS_DIR)/assets; \ + fi; \ + if test $(HAVE_OZONE) = 1; then \ + cp -r media/assets/ozone/ $(DESTDIR)$(ASSETS_DIR)/assets; \ + fi; \ cp media/assets/COPYING $(DESTDIR)$(DOC_DIR)/COPYING.assets; \ echo "Asset copying done."; \ fi diff --git a/Makefile.common b/Makefile.common index 61cf64dbec..dfee55b807 100644 --- a/Makefile.common +++ b/Makefile.common @@ -657,25 +657,25 @@ endif # XMB and MaterialUI are always enabled if supported and not explicitly disabled ifeq ($(HW_CONTEXT_MENU_DRIVERS), 1) - #ifeq ($(HAVE_ZARCH),) - #HAVE_ZARCH = 1 - #endif + ifeq ($(HAVE_ZARCH),) + HAVE_ZARCH = 0 + endif ifeq ($(HAVE_MATERIALUI),) HAVE_MATERIALUI = 1 endif - #ifeq ($(HAVE_NUKLEAR),) - #HAVE_NUKLEAR = 1 - #endif + ifeq ($(HAVE_NUKLEAR),) + HAVE_NUKLEAR = 0 + endif ifeq ($(HAVE_XMB),) HAVE_XMB = 1 endif - #ifeq ($(HAVE_STRIPES),) - #HAVE_STRIPES = 1 - #endif + ifeq ($(HAVE_STRIPES),) + HAVE_STRIPES = 0 + endif ifeq ($(HAVE_OZONE),) HAVE_OZONE = 1 @@ -697,6 +697,7 @@ ifeq ($(HAVE_RGUI), 1) OBJ += menu/drivers/materialui.o DEFINES += -DHAVE_MATERIALUI HAVE_MENU_COMMON = 1 + HAVE_ASSETS = 1 endif ifeq ($(HAVE_NUKLEAR), 1) OBJ += menu/drivers/nuklear/nk_common.o @@ -704,10 +705,12 @@ ifeq ($(HAVE_RGUI), 1) OBJ += menu/drivers/nuklear/nk_wnd_debug.o OBJ += menu/drivers/nuklear.o DEFINES += -DHAVE_NUKLEAR + HAVE_ASSETS = 1 endif ifeq ($(HAVE_ZARCH), 1) OBJ += menu/drivers/zarch.o DEFINES += -DHAVE_ZARCH + HAVE_ASSETS = 1 endif endif @@ -715,6 +718,7 @@ ifeq ($(HAVE_XMB), 1) OBJ += menu/drivers/xmb.o DEFINES += -DHAVE_XMB HAVE_MENU_COMMON = 1 + HAVE_ASSETS = 1 endif ifeq ($(HAVE_OZONE), 1) @@ -726,6 +730,7 @@ ifeq ($(HAVE_OZONE), 1) OBJ += menu/drivers/ozone/ozone_sidebar.o DEFINES += -DHAVE_OZONE HAVE_MENU_COMMON = 1 + HAVE_ASSETS = 1 endif ifeq ($(HAVE_STRIPES), 1) @@ -864,6 +869,11 @@ ifeq ($(TARGET), retroarch_switch) frontend/drivers/platform_switch.o endif +ifeq ($(TARGET), retroarch_orbis) + OBJ += gfx/drivers_context/orbis_ctx.o \ + frontend/drivers/platform_orbis.o +endif + ifeq ($(HAVE_WAYLAND), 1) OBJ += gfx/drivers_context/wayland_ctx.o \ input/drivers/wayland_input.o \ diff --git a/Makefile.griffin b/Makefile.griffin index 03d6d22d8d..98ec4f48ca 100644 --- a/Makefile.griffin +++ b/Makefile.griffin @@ -158,8 +158,6 @@ else ifeq ($(libogc_platform), 1) endif endif - LIBS += -logc - ifeq ($(EXTERNAL_LIBOGC), 1) LIBS += -lfat endif @@ -176,6 +174,8 @@ else ifeq ($(libogc_platform), 1) endif endif + LIBS += -logc + CFLAGS += -DGEKKO -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int HAVE_RUNAHEAD := 1 @@ -431,7 +431,7 @@ else ifeq ($(platform), windows_msvc2005_x86) LD = link.exe PLATCFLAGS += -D_WIN32 -D_WIN32_WINNT=0x0410 -D__STDC_CONSTANT_MACROS -D_MBCS - LDFLAGS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib + LDFLAGS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib msimg32.lib PATH := $(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../../VC/bin"):$(PATH) PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../IDE") diff --git a/Makefile.orbis b/Makefile.orbis new file mode 100644 index 0000000000..be1e90ca10 --- /dev/null +++ b/Makefile.orbis @@ -0,0 +1,170 @@ +TARGET := retroarch_orbis +DEBUG ?= 0 +GRIFFIN_BUILD = 0 +WHOLE_ARCHIVE_LINK = 0 + +PS4_TITLE_ID := RETROARCH +PS4_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_MENU -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_FILTERS_BUILTIN := 1 + HAVE_LANGEXTRA := 0 + HAVE_RPNG := 1 + HAVE_RJPEG := 1 + HAVE_RBMP := 1 + HAVE_RTGA := 1 + HAVE_ZLIB := 0 + HAVE_OVERLAY := 1 + HAVE_7ZIP := 1 + HAVE_EGL := 1 + HAVE_OPENGLES := 1 + HAVE_NETWORKING := 0 + HAVE_SOCKET_LEGACY := 0 + HAVE_MENU := 1 + HAVE_MENU_COMMON := 1 + HAVE_RGUI := 0 + HAVE_MATERIALUI := 0 + HAVE_XMB := 1 + HAVE_ZARCH := 0 + HAVE_THREADS := 1 + HAVE_LIBRETRODB := 1 + HAVE_CC_RESAMPLER := 1 + HAVE_CHEEVOS := 1 + RARCH_CONSOLE := 1 + HAVE_STATIC_VIDEO_FILTERS = 1 + HAVE_STATIC_AUDIO_FILTERS = 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_orbis.o +endif + + +ifeq ($(strip $(PS4SDK)),) +$(error "Please set PS4SDK in your environment. export PS4SDK=ps4sdk") +endif + +export PATH := $(PATH):$(PS4SDK)/bin + +PREFIX := + +CC := $(PREFIX)clang +CXX := $(PREFIX)clang +AS := $(PREFIX)clang +AR := $(PREFIX)ar +OBJCOPY := $(PREFIX)objcopy +STRIP := $(PREFIX)strip +NM := $(PREFIX)nm +LD := $(CXX) + +INCDIRS := -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Ideps/stb +LIBDIRS := -L. + +ARCHFLAGS := -m64 -DORBIS +CFLAGS += $(ARCHFLAGS) -std=c11 -mcmodel=large -ffreestanding -nostdlib -nostdinc -fno-builtin -fno-stack-protector + +ifeq ($(DEBUG), 1) + CFLAGS += -O2 -g +else + CFLAGS += -O3 +endif + +ASFLAGS := $(ARCHFLAGS) -I$(PS4SDK)/include -target x86_64-scei-ps4-elf -fPIE +LDFLAGS := -O3 -Wall -m64 -nostartfiles -nostdlib -L$(PS4SDK)/lib -pie +ARFLAGS := rcs + +CRTFILE ?= $(PS4SDK)/crt0.s + +CFLAGS += -Wall -pedantic -Wno-zero-length-array -Wno-format-pedantic +CFLAGS += -D__PS4__ -I$(PS4SDK)/include -I $(PS4SDK)/include/sce +CFLAGS += -target x86_64-scei-ps4-elf -fPIE +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) + +PS4_LIBS := -lps4link -ldebugnet -lorbisFile -lelfloader -lorbisKeyboard -lorbis2d -lpng -lz -lorbisGl -lorbisPad -lorbisAudio -lmod -lorbisAudio -lmod -lorbisFileBrowser -lorbisXbmFont -lSceNet_stub -lScePigletv2VSH_stub -lSceSystemService_stub -lSceUserService_stub -lScePad_stub -lSceAudioOut_stub -lSceIme_stub -lSceSysmodule_stub \ + -lPs4_extension_kernel_call_standard -lPs4_extension_kernel_execute_dynlib_prepare_dlclose -lPs4_common_kernel -lPs4_common_user -lPs4_common_generic -lPs4LibCInternalAdaptive_stub -lPs4LibKernelAdaptive_stub -lSceLibcInternal_stub -lkernel_stub -lps4Kernel_stub -lPs4_base_stub_resolve_minimal -lPs4_base_kernel_dlsym_standard -lPs4_base_kernel_seek_elf_address_standard -lPs4_base_assembler_register_parameter_standard -lPs4_base_assembler_system_call_standard + + +LIBS := $(WHOLE_START) -lretro_orbis $(WHOLE_END) $(PS4_LIBS) + +TARGETS := $(TARGET).elf + +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_orbis.a + $(LD) $(CRTFILE) $(OBJ) $(LDFLAGS) $(LIBDIRS) $(LIBS) -o $@ + +clean: + rm -f $(OBJ) $(TARGET).elf + rm -f $(OBJ:.o=.depend) + +.PHONY: clean all +.PRECIOUS: %.depend + +-include $(OBJ:.o=.depend) \ No newline at end of file diff --git a/Makefile.ps2 b/Makefile.ps2 index cbd9a5c556..db8ca28523 100644 --- a/Makefile.ps2 +++ b/Makefile.ps2 @@ -1,11 +1,10 @@ BUILD_PRX = 0 -DEBUG = 1 +DEBUG = 0 HAVE_KERNEL_PRX = 0 HAVE_LOGGER = 0 HAVE_FILE_LOGGER = 0 HAVE_THREADS = 0 BIG_STACK = 0 -WHOLE_ARCHIVE_LINK = 0 PS2_IP = 192.168.1.150 #Configuration for IRX @@ -13,6 +12,7 @@ EE_BIN2O = bin2o IRX_DIR = $(PS2SDK)/iop/irx TARGET = retroarchps2.elf +TARGET_RELEASE = retroarchps2-release.elf ifeq ($(DEBUG), 1) OPTIMIZE_LV := -O0 -g @@ -21,30 +21,23 @@ else OPTIMIZE_LV := -O2 endif -ifeq ($(WHOLE_ARCHIVE_LINK), 1) - WHOLE_START := -Wl,--whole-archive - WHOLE_END := -Wl,--no-whole-archive -endif - -INCDIR = -I$(PS2SDK)/ports/include -I$(PS2DEV)/gsKit/include -I$(PS2SDK)/iop/include -I$(PS2SDK)/ee/include -I$(PS2SDK)/common/include +INCDIR = -I$(PS2DEV)/gsKit/include -I$(PS2SDK)/ports/include INCDIR += -Ips2 -Ips2/include -Ilibretro-common/include INCDIR += -Ideps -Ideps/stb -Ideps/libz -Ideps/7zip -Ideps/pthreads -Ideps/pthreads/platform/ps2 -Ideps/pthreads/platform/helper GPVAL = -G0 -CFLAGS = $(OPTIMIZE_LV) -ffast-math -fsingle-precision-constant +CFLAGS = $(OPTIMIZE_LV) -ffast-math -fsingle-precision-constant ASFLAGS = $(CFLAGS) RARCH_DEFINES += -DPS2 -DUSE_IOP_CTYPE_MACRO -D_MIPS_ARCH_R5900 -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DWANT_ZLIB RARCH_DEFINES += -DHAVE_GRIFFIN=1 -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_MENU -DHAVE_RGUI -DHAVE_FILTERS_BUILTIN -DHAVE_7ZIP -DHAVE_CC_RESAMPLER LIBDIR = -LDFLAGS = -L$(PS2SDK)/ports/lib -L$(PS2DEV)/gsKit/lib -L$(PS2SDK)/ee/lib -L. -#LIBS = $(WHOLE_START) -lretro_ps2 $(WHOLE_END) -lstdc++ -lm -lz -lgskit -ldmakit -lpng -laudsrv -lpad -lcdvd -lmad -lfileXio -lpatches -LIBS += $(WHOLE_START) -lretro_ps2 $(WHOLE_END) -LIBS += -lm -lg -lz -ldebug -lfileXio -laudsrv -lpatches -lpoweroff -ldma -lgskit -ldmakit -lpad -lsdl +LDFLAGS = -L$(PS2SDK)/ports/lib -L$(PS2DEV)/gsKit/lib -L$(PS2SDK)/ee/lib -L. -s +LIBS += -lretro_ps2 -lgskit -ldmakit -laudsrv -lpad -lmc -lhdd -lsdl -lfileXio -lpatches -lpoweroff #IRX modules # IRX modules - modules have to be in IRX_DIR -IRX = iomanX.irx fileXio.irx usbd.irx usbhdfsd.irx freesd.irx audsrv.irx poweroff.irx ps2dev9.irx ps2atad.irx ps2hdd.irx ps2fs.irx +IRX = iomanX.irx fileXio.irx mcman.irx mcserv.irx usbd.irx usbhdfsd.irx freesd.irx audsrv.irx poweroff.irx ps2dev9.irx ps2atad.irx ps2hdd.irx ps2fs.irx IRX_OBJ = $(IRX:.irx=.o) EE_OBJS += $(IRX_OBJ) @@ -95,6 +88,11 @@ run: debug: clean prepare all run +package: + ps2-packer $(EE_BIN) $(TARGET_RELEASE) + +release: clean all package + #Specific file name and output per IRX Module $(EE_IRX_OBJ): $(EE_BIN2O) $(EE_GPVAL) $(IRX_DIR)/$(@:.o=.irx) $@ $(@:.o=_irx) @@ -102,4 +100,8 @@ $(EE_IRX_OBJ): #Include preferences include $(PS2SDK)/samples/Makefile.pref include $(PS2SDK)/samples/Makefile.eeglobal - \ No newline at end of file + +#Linking with C++ +$(EE_BIN): $(EE_OBJS) $(PS2SDK)/ee/startup/crt0.o + $(EE_CXX) $(EE_NO_CRT) -T$(PS2SDK)/ee/startup/linkfile $(EE_CXXFLAGS) \ + -o $(EE_BIN) $(PS2SDK)/ee/startup/crt0.o $(CRTI_OBJ) $(CRTBEGIN_OBJ) $(EE_OBJS) $(CRTEND_OBJ) $(CRTN_OBJ) $(EE_LDFLAGS) $(EE_LIBS) diff --git a/Makefile.wii.salamander b/Makefile.wii.salamander index e39c30bdc8..dc5249f832 100644 --- a/Makefile.wii.salamander +++ b/Makefile.wii.salamander @@ -42,12 +42,13 @@ endif MACHDEP := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE) LDFLAGS := $(MACHDEP) -Wl,-Map,$(notdir $(ELF_TARGET)).map -LIBS := -lwiiuse -logc -lbte ifeq ($(EXTERNAL_LIBOGC), 1) -LIBS += -lfat +LIBS := -lfat endif +LIBS += -lwiiuse -logc -lbte + APP_BOOTER_DIR = wii/app_booter OBJ = frontend/frontend_salamander.o \ diff --git a/audio/audio_driver.c b/audio/audio_driver.c index 4baaf7b753..abe89485af 100644 --- a/audio/audio_driver.c +++ b/audio/audio_driver.c @@ -122,6 +122,9 @@ static const audio_driver_t *audio_drivers[] = { #if defined(PSP) || defined(VITA) &audio_psp, #endif +#if defined(PS2) + &audio_ps2, +#endif #ifdef _3DS &audio_ctr_csnd, &audio_ctr_dsp, diff --git a/audio/drivers/nullaudio.c b/audio/drivers/nullaudio.c index 39be26d4d0..c7dffc6f7e 100644 --- a/audio/drivers/nullaudio.c +++ b/audio/drivers/nullaudio.c @@ -21,7 +21,7 @@ static void *null_audio_init(const char *device, unsigned rate, unsigned latency unsigned block_frames, unsigned *new_rate) { - RARCH_ERR("Using the null audio driver. RetroArch will be silent."); + RARCH_ERR("Using the null audio driver. RetroArch will be silent.\n"); (void)device; (void)rate; diff --git a/audio/drivers/ps2_audio.c b/audio/drivers/ps2_audio.c new file mode 100644 index 0000000000..f47ef9fc9d --- /dev/null +++ b/audio/drivers/ps2_audio.c @@ -0,0 +1,297 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2014-2017 - Francisco Javier Trujillo Mata + * + * RetroArch is free software: 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 "../audio_driver.h" + +typedef struct ps2_audio +{ + fifo_buffer_t* buffer; + bool nonblocking; + volatile bool running; + int worker_thread; + int lock; + int cond_lock; + +} ps2_audio_t; + +static ps2_audio_t *backup_ps2; +static u8 audioThreadStack[4 * 1024] __attribute__ ((aligned(16))); + +#define AUDIO_OUT_BUFFER 2 * 1024 +#define AUDIO_BUFFER 64 * 1024 +#define AUDIO_CHANNELS 2 +#define AUDIO_BITS 16 +#define AUDIO_PRIORITY 0x7F /* LOWER VALUE GRATHER PRIORITY*/ + + +static void audioMainLoop(void *data) +{ + char out_tmp[AUDIO_OUT_BUFFER]; + ps2_audio_t* ps2 = backup_ps2; + + while (ps2->running) + { + size_t size; + + WaitSema(ps2->lock); + size = MIN(fifo_read_avail(ps2->buffer), sizeof(out_tmp)); + fifo_read(ps2->buffer, out_tmp, size); + iSignalSema(ps2->lock); + iSignalSema(ps2->cond_lock); + + audsrv_wait_audio(size); + audsrv_play_audio(out_tmp, size); + } + + audsrv_stop_audio(); + ExitDeleteThread(); +} + + +static void audioCreateThread(ps2_audio_t *ps2) +{ + int ret; + ee_thread_t thread; + + thread.func=&audioMainLoop; + thread.stack=audioThreadStack; + thread.stack_size=sizeof(audioThreadStack); + thread.gp_reg=&_gp; + thread.initial_priority=AUDIO_PRIORITY; + thread.attr=thread.option=0; + + /*Backup the PS2 content to be used in the thread */ + backup_ps2 = ps2; + + ps2->running = true; + ps2->worker_thread = CreateThread(&thread); + + if (ps2->worker_thread >= 0) + { + ret = StartThread(ps2->worker_thread, NULL); + if (ret < 0) + printf("sound_init: StartThread returned %d\n", ret); + } + else + printf("CreateThread failed: %d\n", ps2->worker_thread); +} + +static void audioStopNDeleteThread(ps2_audio_t *ps2) +{ + ps2->running = false; + if (ps2->worker_thread) + ps2->worker_thread = 0; +} + +static void audioConfigure(ps2_audio_t *ps2, unsigned rate) +{ + int err; + struct audsrv_fmt_t format; + + format.bits = AUDIO_BITS; + format.freq = rate; + format.channels = AUDIO_CHANNELS; + + err = audsrv_set_format(&format); + + if (err) + { + printf("set format returned %d\n", err); + printf("audsrv returned error string: %s\n", audsrv_get_error_string()); + } + + audsrv_set_volume(MAX_VOLUME); +} + +static void audioCreateSemas(ps2_audio_t *ps2) +{ + ee_sema_t lock_info; + ee_sema_t cond_lock_info; + + lock_info.max_count = 1; + lock_info.init_count = 1; + lock_info.option = 0; + ps2->lock = CreateSema(&lock_info); + + cond_lock_info.init_count = 1; + cond_lock_info.max_count = 1; + cond_lock_info.option = 0; + + ps2->cond_lock = CreateSema(&cond_lock_info); +} + +static void *ps2_audio_init(const char *device, + unsigned rate, unsigned latency, + unsigned block_frames, + unsigned *new_rate) +{ + ps2_audio_t *ps2 = (ps2_audio_t*)calloc(1, sizeof(ps2_audio_t)); + + if (!ps2) + return NULL; + + ps2->buffer = fifo_new(AUDIO_BUFFER); + audioConfigure(ps2, rate); + audioCreateSemas(ps2); + audioCreateThread(ps2); + + return ps2; +} + +static void ps2_audio_free(void *data) +{ + ps2_audio_t* ps2 = (ps2_audio_t*)data; + if(!ps2) + return; + + if(ps2->running) + { + audioStopNDeleteThread(ps2); + + if (ps2->lock) + { + iDeleteSema(ps2->lock); + ps2->lock = 0; + } + + if (ps2->cond_lock) + { + iDeleteSema(ps2->cond_lock); + ps2->cond_lock = 0; + } + + } + fifo_free(ps2->buffer); + free(ps2); +} + +static ssize_t ps2_audio_write(void *data, const void *buf, size_t size) +{ + ps2_audio_t* ps2 = (ps2_audio_t*)data; + + if (!ps2->running) + return -1; + + if (ps2->nonblocking) + { + if (fifo_write_avail(ps2->buffer) < size) + return 0; + } + + while (fifo_write_avail(ps2->buffer) < size) + WaitSema(ps2->cond_lock); + + WaitSema(ps2->lock); + fifo_write(ps2->buffer, buf, size); + iSignalSema(ps2->lock); + + return size; +} + +static bool ps2_audio_alive(void *data) +{ + bool alive = false; + + ps2_audio_t* ps2 = (ps2_audio_t*)data; + if (ps2) + alive = ps2->running; + + return alive; +} + +static bool ps2_audio_stop(void *data) +{ + bool stop = true; + ps2_audio_t* ps2 = (ps2_audio_t*)data; + + if (ps2) + { + audioStopNDeleteThread(ps2); + audsrv_stop_audio(); + } + + return stop; +} + +static bool ps2_audio_start(void *data, bool is_shutdown) +{ + bool start = true; + ps2_audio_t* ps2 = (ps2_audio_t*)data; + + if(ps2) + { + if (!ps2->running && !ps2->worker_thread) + audioCreateThread(ps2); + } + + return start; +} + +static void ps2_audio_set_nonblock_state(void *data, bool toggle) +{ + ps2_audio_t* ps2 = (ps2_audio_t*)data; + if (ps2) + ps2->nonblocking = toggle; +} + +static bool ps2_audio_use_float(void *data) +{ + return false; +} + +static size_t ps2_audio_write_avail(void *data) +{ + ps2_audio_t* ps2 = (ps2_audio_t*)data; + + if (ps2 && ps2->running) + { + size_t size; + WaitSema(ps2->lock); + size = AUDIO_BUFFER - fifo_read_avail(ps2->buffer); + iSignalSema(ps2->lock); + return size; + } + + return 0; +} + +static size_t ps2_audio_buffer_size(void *data) +{ + return AUDIO_BUFFER; +} + +audio_driver_t audio_ps2 = { + ps2_audio_init, + ps2_audio_write, + ps2_audio_stop, + ps2_audio_start, + ps2_audio_alive, + ps2_audio_set_nonblock_state, + ps2_audio_free, + ps2_audio_use_float, + "ps2", + NULL, + NULL, + ps2_audio_write_avail, + ps2_audio_buffer_size +}; diff --git a/audio/drivers/xaudio.c b/audio/drivers/xaudio.c index d344508b70..594d3124d4 100644 --- a/audio/drivers/xaudio.c +++ b/audio/drivers/xaudio.c @@ -201,9 +201,10 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels, { xaudio2_t *handle = NULL; WAVEFORMATEX wfx = {0}; - -#ifndef _XBOX - CoInitializeEx(0, COINIT_MULTITHREADED); +#if !defined(_XBOX) && !defined(__WINRT__) + HRESULT hr = CoInitialize(NULL); + if (FAILED(hr)) + return NULL; #endif #if defined(__cplusplus) && !defined(CINTERFACE) @@ -222,8 +223,13 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels, if (FAILED(XAudio2Create(&handle->pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR))) goto error; +#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/) + if (FAILED(IXAudio2_CreateMasteringVoice(handle->pXAudio2, &handle->pMasterVoice, channels, samplerate, 0, device, NULL, AudioCategory_GameEffects))) + goto error; +#else if (FAILED(IXAudio2_CreateMasteringVoice(handle->pXAudio2, &handle->pMasterVoice, channels, samplerate, 0, device, NULL))) goto error; +#endif xaudio2_set_wavefmt(&wfx, channels, samplerate); @@ -250,6 +256,9 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels, error: xaudio2_free(handle); +#if !defined(_XBOX) && !defined(__WINRT__) + CoUninitialize(); +#endif return NULL; } @@ -399,6 +408,10 @@ static void xa_free(void *data) if (xa->xa) xaudio2_free(xa->xa); free(xa); + +#if !defined(_XBOX) && !defined(__WINRT__) + CoUninitialize(); +#endif } static size_t xa_write_avail(void *data) diff --git a/audio/drivers/xaudio.h b/audio/drivers/xaudio.h index 788fe16789..a16581807f 100644 --- a/audio/drivers/xaudio.h +++ b/audio/drivers/xaudio.h @@ -1,7 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2017 - Daniel De Matteis - * Copyright (C) 2010-2014 - OV2 + * Copyright (C) 2018 - Krzysztof Haładyn * * RetroArch is free software: 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,350 +13,14 @@ * If not, see . */ -/* Kinda stripped down. Only contains the bare essentials used in RetroArch. */ - -#ifndef XAUDIO2_STRIPPED_H -#define XAUDIO2_STRIPPED_H - -#include -#include - -/* All structures defined in this file use tight field packing */ -#pragma pack(push, 1) - -#if defined(__cplusplus) && !defined(CINTERFACE) -#define X2DEFAULT(x) = (x) +#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/) +/* XAudio 2.7 it part of the old DirectX SDKs. XAudio 2.8+ is part of the + * Windows OS itself (starting from Windows 8). Since UWP lets you access + * only libraries that are built-in to the OS, the headers had to be + * upgraded to the newer version to get audio support working. */ +#include "xaudio29.h" #else -#define X2DEFAULT(x) +/* The old version still has to be there since XAudio 2.8 is not available + * on Windows 7 and earlier */ +#include "xaudio27.h" #endif - -#ifdef _XBOX -#include - -#ifndef __cplusplus -#define OPAQUE interface -#endif -#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - DEFINE_GUID(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) -#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - DEFINE_GUID(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) - -DEFINE_CLSID(XAudio2, 3eda9b49, 2085, 498b, 9b, b2, 39, a6, 77, 84, 93, de); -DEFINE_CLSID(XAudio2_Debug, 47199894, 7cc2, 444d, 98, 73, ce, d2, 56, 2c, c6, 0e); -DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb); - -#include /* Basic audio data types and constants */ - -#else - -#define WIN32_LEAN_AND_MEAN -#include -#include -#include -#include - -#ifndef __cplusplus -#undef OPAQUE -#define OPAQUE struct -#endif - -#define DEFINE_GUID_X(n, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - static const GUID n = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } -#define DEFINE_CLSID_X(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - DEFINE_GUID_X(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) -#define DEFINE_IID_X(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - DEFINE_GUID_X(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) - -#ifndef __cplusplus -#ifndef INTERFACE -#define INTERFACE void -#endif -#endif - -DEFINE_CLSID_X(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af); /* 2.7 */ -DEFINE_IID_X(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb); - -#endif - -#ifdef _XBOX -#define XAUDIO2_DEFAULT_FREQ_RATIO 2.0f -#else -#define XAUDIO2_DEFAULT_FREQ_RATIO 4.0f -#endif - -#define XAUDIO2_COMMIT_NOW 0 -#define XAUDIO2_DEFAULT_CHANNELS 0 -#define XAUDIO2_DEFAULT_SAMPLERATE 0 - -#define XAUDIO2_DEBUG_ENGINE 0x0001 -#define XAUDIO2_VOICE_NOSRC 0x0004 - -typedef enum XAUDIO2_DEVICE_ROLE -{ - NotDefaultDevice = 0x0, - DefaultConsoleDevice = 0x1, - DefaultMultimediaDevice = 0x2, - DefaultCommunicationsDevice = 0x4, - DefaultGameDevice = 0x8, - GlobalDefaultDevice = 0xf, - InvalidDeviceRole = ~GlobalDefaultDevice -} XAUDIO2_DEVICE_ROLE; - -#ifdef _XBOX -typedef enum XAUDIO2_XBOX_HWTHREAD_SPECIFIER -{ - XboxThread0 = 0x01, - XboxThread1 = 0x02, - XboxThread2 = 0x04, - XboxThread3 = 0x08, - XboxThread4 = 0x10, - XboxThread5 = 0x20, - XAUDIO2_ANY_PROCESSOR = XboxThread4, - XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR -} XAUDIO2_XBOX_HWTHREAD_SPECIFIER, XAUDIO2_PROCESSOR; -#else -typedef enum XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER -{ -#if defined(__STDC_C89__) - XAUDIO2_ANY_PROCESSOR = 0xffff, -#else - XAUDIO2_ANY_PROCESSOR = 0xffffffff, -#endif - XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR -} XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER, XAUDIO2_PROCESSOR; -#endif - -typedef enum XAUDIO2_FILTER_TYPE { - LowPassFilter, - BandPassFilter, - HighPassFilter -} XAUDIO2_FILTER_TYPE; - -typedef struct XAUDIO2_DEVICE_DETAILS -{ - WCHAR DeviceID[256]; - WCHAR DisplayName[256]; - XAUDIO2_DEVICE_ROLE Role; - WAVEFORMATEXTENSIBLE OutputFormat; -} XAUDIO2_DEVICE_DETAILS; - -/* Forward declarations. */ -#ifdef __cplusplus -struct XAUDIO2_VOICE_DETAILS; -struct XAUDIO2_VOICE_SENDS; -struct XAUDIO2_EFFECT_DESCRIPTOR; -struct XAUDIO2_EFFECT_CHAIN; -struct XAUDIO2_FILTER_PARAMETERS; -struct XAUDIO2_BUFFER_WMA; -struct XAUDIO2_VOICE_STATE; -struct XAUDIO2_PERFORMANCE_DATA; -struct XAUDIO2_DEBUG_CONFIGURATION; -struct IXAudio2EngineCallback; -struct IXAudio2SubmixVoice; -#else -typedef OPAQUE XAUDIO2_VOICE_DETAILS XAUDIO2_VOICE_DETAILS; -typedef OPAQUE XAUDIO2_VOICE_SENDS XAUDIO2_VOICE_SENDS; -typedef OPAQUE XAUDIO2_EFFECT_DESCRIPTOR XAUDIO2_EFFECT_DESCRIPTOR; -typedef OPAQUE XAUDIO2_EFFECT_CHAIN XAUDIO2_EFFECT_CHAIN; -typedef OPAQUE XAUDIO2_FILTER_PARAMETERS XAUDIO2_FILTER_PARAMETERS; -typedef OPAQUE XAUDIO2_BUFFER_WMA XAUDIO2_BUFFER_WMA; -typedef OPAQUE XAUDIO2_VOICE_STATE XAUDIO2_VOICE_STATE; -typedef OPAQUE XAUDIO2_PERFORMANCE_DATA XAUDIO2_PERFORMANCE_DATA; -typedef OPAQUE XAUDIO2_DEBUG_CONFIGURATION XAUDIO2_DEBUG_CONFIGURATION; -typedef OPAQUE IXAudio2EngineCallback IXAudio2EngineCallback; -typedef OPAQUE IXAudio2SubmixVoice IXAudio2SubmixVoice; -#endif - - -typedef struct XAUDIO2_BUFFER -{ - UINT32 Flags; - UINT32 AudioBytes; - const BYTE* pAudioData; - UINT32 PlayBegin; - UINT32 PlayLength; - UINT32 LoopBegin; - UINT32 LoopLength; - UINT32 LoopCount; - void *pContext; -} XAUDIO2_BUFFER; - -#undef INTERFACE -#define INTERFACE IXAudio2VoiceCallback - -DECLARE_INTERFACE(IXAudio2VoiceCallback) -{ - STDMETHOD_(void, OnVoiceProcessingPassStart) (THIS_ UINT32 BytesRequired) PURE; - STDMETHOD_(void, OnVoiceProcessingPassEnd) (THIS) PURE; - STDMETHOD_(void, OnStreamEnd) (THIS) PURE; - STDMETHOD_(void, OnBufferStart) (THIS_ void *pBufferContext) PURE; - STDMETHOD_(void, OnBufferEnd) (THIS_ void *pBufferContext) PURE; - STDMETHOD_(void, OnLoopEnd) (THIS_ void *pBufferContext) PURE; - STDMETHOD_(void, OnVoiceError) (THIS_ void *pBufferContext, HRESULT Error) PURE; -}; - -#undef INTERFACE -#define INTERFACE IXAudio2Voice - -DECLARE_INTERFACE(IXAudio2Voice) -{ -#define Declare_IXAudio2Voice_Methods() \ - STDMETHOD_(void, GetVoiceDetails) (THIS_ XAUDIO2_VOICE_DETAILS* pVoiceDetails) PURE; \ - STDMETHOD(SetOutputVoices) (THIS_ const XAUDIO2_VOICE_SENDS* pSendList) PURE; \ - STDMETHOD(SetEffectChain) (THIS_ const XAUDIO2_EFFECT_CHAIN* pEffectChain) PURE; \ - STDMETHOD(EnableEffect) (THIS_ UINT32 EffectIndex, \ - UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ - STDMETHOD(DisableEffect) (THIS_ UINT32 EffectIndex, \ - UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ - STDMETHOD_(void, GetEffectState) (THIS_ UINT32 EffectIndex, BOOL* pEnabled) PURE; \ - STDMETHOD(SetEffectParameters) (THIS_ UINT32 EffectIndex, \ - const void *pParameters, \ - UINT32 ParametersByteSize, \ - UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ - STDMETHOD(GetEffectParameters) (THIS_ UINT32 EffectIndex, void *pParameters, \ - UINT32 ParametersByteSize) PURE; \ - STDMETHOD(SetFilterParameters) (THIS_ const XAUDIO2_FILTER_PARAMETERS* pParameters, \ - UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ - STDMETHOD_(void, GetFilterParameters) (THIS_ XAUDIO2_FILTER_PARAMETERS* pParameters) PURE; \ - STDMETHOD_(void, SetOutputFilterParameters) (THIS_ IXAudio2Voice *voice, const XAUDIO2_FILTER_PARAMETERS* param, \ - UINT32 op X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ - STDMETHOD_(void, GetOutputFilterParameters) (THIS_ IXAudio2Voice *voice, XAUDIO2_FILTER_PARAMETERS* param) PURE; \ - STDMETHOD(SetVolume) (THIS_ float Volume, \ - UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ - STDMETHOD_(void, GetVolume) (THIS_ float* pVolume) PURE; \ - STDMETHOD(SetChannelVolumes) (THIS_ UINT32 Channels, const float* pVolumes, \ - UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ - STDMETHOD_(void, GetChannelVolumes) (THIS_ UINT32 Channels, float* pVolumes) PURE; \ - STDMETHOD(SetOutputMatrix) (THIS_ IXAudio2Voice* pDestinationVoice, \ - UINT32 SourceChannels, UINT32 DestinationChannels, \ - const float* pLevelMatrix, \ - UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ - STDMETHOD_(void, GetOutputMatrix) (THIS_ IXAudio2Voice* pDestinationVoice, \ - UINT32 SourceChannels, UINT32 DestinationChannels, \ - float* pLevelMatrix) PURE; \ - STDMETHOD_(void, DestroyVoice) (THIS) PURE - - Declare_IXAudio2Voice_Methods(); -}; - -#undef INTERFACE -#define INTERFACE IXAudio2MasteringVoice - -DECLARE_INTERFACE_(IXAudio2MasteringVoice, IXAudio2Voice) -{ - Declare_IXAudio2Voice_Methods(); -}; - -#undef INTERFACE -#define INTERFACE IXAudio2SourceVoice - -DECLARE_INTERFACE_(IXAudio2SourceVoice, IXAudio2Voice) -{ - Declare_IXAudio2Voice_Methods(); - STDMETHOD(Start) (THIS_ UINT32 Flags, UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; - STDMETHOD(Stop) (THIS_ UINT32 Flags, UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; - STDMETHOD(SubmitSourceBuffer) (THIS_ const XAUDIO2_BUFFER* pBuffer, const XAUDIO2_BUFFER_WMA* pBufferWMA X2DEFAULT(NULL)) PURE; - STDMETHOD(FlushSourceBuffers) (THIS) PURE; - STDMETHOD(Discontinuity) (THIS) PURE; - STDMETHOD(ExitLoop) (THIS_ UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; - STDMETHOD_(void, GetState) (THIS_ XAUDIO2_VOICE_STATE* pVoiceState) PURE; - STDMETHOD(SetFrequencyRatio) (THIS_ float Ratio, - UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; - STDMETHOD_(void, GetFrequencyRatio) (THIS_ float* pRatio) PURE; -}; - -#undef INTERFACE -#define INTERFACE IXAudio2 - -DECLARE_INTERFACE_(IXAudio2, IUnknown) -{ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvInterface) PURE; - STDMETHOD_(ULONG, AddRef) (THIS) PURE; - STDMETHOD_(ULONG, Release) (THIS) PURE; - STDMETHOD(GetDeviceCount) (THIS_ UINT32* pCount) PURE; - STDMETHOD(GetDeviceDetails) (THIS_ UINT32 Index, XAUDIO2_DEVICE_DETAILS* pDeviceDetails) PURE; - STDMETHOD(Initialize) (THIS_ UINT32 Flags X2DEFAULT(0), - XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR)) PURE; - STDMETHOD(RegisterForCallbacks) (IXAudio2EngineCallback* pCallback) PURE; - STDMETHOD_(void, UnregisterForCallbacks) (IXAudio2EngineCallback* pCallback) PURE; - STDMETHOD(CreateSourceVoice) (THIS_ IXAudio2SourceVoice** ppSourceVoice, - const WAVEFORMATEX* pSourceFormat, - UINT32 Flags X2DEFAULT(0), - float MaxFrequencyRatio X2DEFAULT(XAUDIO2_DEFAULT_FREQ_RATIO), - IXAudio2VoiceCallback* pCallback X2DEFAULT(NULL), - const XAUDIO2_VOICE_SENDS* pSendList X2DEFAULT(NULL), - const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE; - STDMETHOD(CreateSubmixVoice) (THIS_ IXAudio2SubmixVoice** ppSubmixVoice, - UINT32 InputChannels, UINT32 InputSampleRate, - UINT32 Flags X2DEFAULT(0), UINT32 ProcessingStage X2DEFAULT(0), - const XAUDIO2_VOICE_SENDS* pSendList X2DEFAULT(NULL), - const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE; - STDMETHOD(CreateMasteringVoice) (THIS_ IXAudio2MasteringVoice** ppMasteringVoice, - UINT32 InputChannels X2DEFAULT(XAUDIO2_DEFAULT_CHANNELS), - UINT32 InputSampleRate X2DEFAULT(XAUDIO2_DEFAULT_SAMPLERATE), - UINT32 Flags X2DEFAULT(0), UINT32 DeviceIndex X2DEFAULT(0), - const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE; - STDMETHOD(StartEngine) (THIS) PURE; - STDMETHOD_(void, StopEngine) (THIS) PURE; - STDMETHOD(CommitChanges) (THIS_ UINT32 OperationSet) PURE; - STDMETHOD_(void, GetPerformanceData) (THIS_ XAUDIO2_PERFORMANCE_DATA* pPerfData) PURE; - STDMETHOD_(void, SetDebugConfiguration) (THIS_ const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration, - void *pReserved X2DEFAULT(NULL)) PURE; -}; - -#if defined(__cplusplus) && !defined(CINTERFACE) -/* C++ hooks */ -#define IXAudio2_Initialize(handle,a,b) handle->Initialize(a, b) -#define IXAudio2SourceVoice_SubmitSourceBuffer(handle, a, b) handle->SubmitSourceBuffer(a, b) -#define IXAudio2SourceVoice_Stop(handle, a, b) handle->Stop(a, b) -#define IXAudio2SourceVoice_DestroyVoice(handle) handle->DestroyVoice() -#define IXAudio2MasteringVoice_DestroyVoice(handle) handle->DestroyVoice() -#define IXAudio2_Release(handle) handle->Release() -#define IXAudio2_CreateSourceVoice(handle, a, b, c, d, e, f, g) handle->CreateSourceVoice(a, b, c, d, e, f, g) -#define IXAudio2_CreateMasteringVoice(handle, a, b, c, d, e, f) handle->CreateMasteringVoice(a, b, c, d, e, f) -#define IXAudio2SourceVoice_Start(handle, a, b) handle->Start(a, b) -#else -/* C hooks */ -#define IXAudio2_Initialize(handle,a,b) (handle)->lpVtbl->Initialize(handle, a, b) -#define IXAudio2_Release(handle) (handle)->lpVtbl->Release(handle) -#define IXAudio2_CreateSourceVoice(handle,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) (handle)->lpVtbl->CreateSourceVoice(handle, ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) -#define IXAudio2_CreateMasteringVoice(handle,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain) (handle)->lpVtbl->CreateMasteringVoice(handle, ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain) -#define IXAudio2_GetDeviceCount(handle, puCount) (handle)->lpVtbl->GetDeviceCount(handle, puCount) -#define IXAudio2_GetDeviceDetails(handle, Index,pDeviceDetails) (handle)->lpVtbl->GetDeviceDetails(handle, Index, pDeviceDetails) -#define IXAudio2SourceVoice_Start(handle, Flags, OperationSet) (handle)->lpVtbl->Start(handle, Flags, OperationSet) -#define IXAudio2SourceVoice_Stop(handle, Flags, OperationSet) (handle)->lpVtbl->Stop(handle, Flags, OperationSet) -#define IXAudio2SourceVoice_SubmitSourceBuffer(handle, pBuffer, pBufferWMA) (handle)->lpVtbl->SubmitSourceBuffer(handle, pBuffer, pBufferWMA) -#define IXAudio2SourceVoice_DestroyVoice(handle) (handle)->lpVtbl->DestroyVoice(handle) -#define IXAudio2MasteringVoice_DestroyVoice(handle) (handle)->lpVtbl->DestroyVoice(handle) -#endif - -#ifdef _XBOX -STDAPI XAudio2Create(__deref_out IXAudio2** ppXAudio2, UINT32 Flags X2DEFAULT(0), - XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR)); -#else -static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32 flags, XAUDIO2_PROCESSOR proc) -{ - IXAudio2 *pXAudio2 = NULL; -#ifdef __cplusplus - HRESULT hr = CoCreateInstance(CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, IID_IXAudio2, (void**)&pXAudio2); -#else - HRESULT hr = CoCreateInstance(&CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, &IID_IXAudio2, (void**)&pXAudio2); -#endif - - if (SUCCEEDED(hr)) - { - hr = IXAudio2_Initialize(pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR); - if (SUCCEEDED(hr)) - *ppXAudio2 = pXAudio2; - else - IXAudio2_Release(pXAudio2); - } - return hr; -} -#endif - -/* Undo the #pragma pack(push, 1) directive at the top of this file */ -#pragma pack(pop) - -#endif - diff --git a/audio/drivers/xaudio27.h b/audio/drivers/xaudio27.h new file mode 100644 index 0000000000..788fe16789 --- /dev/null +++ b/audio/drivers/xaudio27.h @@ -0,0 +1,364 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * 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 + * 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 . + */ + +/* Kinda stripped down. Only contains the bare essentials used in RetroArch. */ + +#ifndef XAUDIO2_STRIPPED_H +#define XAUDIO2_STRIPPED_H + +#include +#include + +/* All structures defined in this file use tight field packing */ +#pragma pack(push, 1) + +#if defined(__cplusplus) && !defined(CINTERFACE) +#define X2DEFAULT(x) = (x) +#else +#define X2DEFAULT(x) +#endif + +#ifdef _XBOX +#include + +#ifndef __cplusplus +#define OPAQUE interface +#endif +#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + DEFINE_GUID(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) +#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + DEFINE_GUID(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) + +DEFINE_CLSID(XAudio2, 3eda9b49, 2085, 498b, 9b, b2, 39, a6, 77, 84, 93, de); +DEFINE_CLSID(XAudio2_Debug, 47199894, 7cc2, 444d, 98, 73, ce, d2, 56, 2c, c6, 0e); +DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb); + +#include /* Basic audio data types and constants */ + +#else + +#define WIN32_LEAN_AND_MEAN +#include +#include +#include +#include + +#ifndef __cplusplus +#undef OPAQUE +#define OPAQUE struct +#endif + +#define DEFINE_GUID_X(n, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + static const GUID n = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } +#define DEFINE_CLSID_X(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + DEFINE_GUID_X(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) +#define DEFINE_IID_X(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + DEFINE_GUID_X(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) + +#ifndef __cplusplus +#ifndef INTERFACE +#define INTERFACE void +#endif +#endif + +DEFINE_CLSID_X(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af); /* 2.7 */ +DEFINE_IID_X(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb); + +#endif + +#ifdef _XBOX +#define XAUDIO2_DEFAULT_FREQ_RATIO 2.0f +#else +#define XAUDIO2_DEFAULT_FREQ_RATIO 4.0f +#endif + +#define XAUDIO2_COMMIT_NOW 0 +#define XAUDIO2_DEFAULT_CHANNELS 0 +#define XAUDIO2_DEFAULT_SAMPLERATE 0 + +#define XAUDIO2_DEBUG_ENGINE 0x0001 +#define XAUDIO2_VOICE_NOSRC 0x0004 + +typedef enum XAUDIO2_DEVICE_ROLE +{ + NotDefaultDevice = 0x0, + DefaultConsoleDevice = 0x1, + DefaultMultimediaDevice = 0x2, + DefaultCommunicationsDevice = 0x4, + DefaultGameDevice = 0x8, + GlobalDefaultDevice = 0xf, + InvalidDeviceRole = ~GlobalDefaultDevice +} XAUDIO2_DEVICE_ROLE; + +#ifdef _XBOX +typedef enum XAUDIO2_XBOX_HWTHREAD_SPECIFIER +{ + XboxThread0 = 0x01, + XboxThread1 = 0x02, + XboxThread2 = 0x04, + XboxThread3 = 0x08, + XboxThread4 = 0x10, + XboxThread5 = 0x20, + XAUDIO2_ANY_PROCESSOR = XboxThread4, + XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR +} XAUDIO2_XBOX_HWTHREAD_SPECIFIER, XAUDIO2_PROCESSOR; +#else +typedef enum XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER +{ +#if defined(__STDC_C89__) + XAUDIO2_ANY_PROCESSOR = 0xffff, +#else + XAUDIO2_ANY_PROCESSOR = 0xffffffff, +#endif + XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR +} XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER, XAUDIO2_PROCESSOR; +#endif + +typedef enum XAUDIO2_FILTER_TYPE { + LowPassFilter, + BandPassFilter, + HighPassFilter +} XAUDIO2_FILTER_TYPE; + +typedef struct XAUDIO2_DEVICE_DETAILS +{ + WCHAR DeviceID[256]; + WCHAR DisplayName[256]; + XAUDIO2_DEVICE_ROLE Role; + WAVEFORMATEXTENSIBLE OutputFormat; +} XAUDIO2_DEVICE_DETAILS; + +/* Forward declarations. */ +#ifdef __cplusplus +struct XAUDIO2_VOICE_DETAILS; +struct XAUDIO2_VOICE_SENDS; +struct XAUDIO2_EFFECT_DESCRIPTOR; +struct XAUDIO2_EFFECT_CHAIN; +struct XAUDIO2_FILTER_PARAMETERS; +struct XAUDIO2_BUFFER_WMA; +struct XAUDIO2_VOICE_STATE; +struct XAUDIO2_PERFORMANCE_DATA; +struct XAUDIO2_DEBUG_CONFIGURATION; +struct IXAudio2EngineCallback; +struct IXAudio2SubmixVoice; +#else +typedef OPAQUE XAUDIO2_VOICE_DETAILS XAUDIO2_VOICE_DETAILS; +typedef OPAQUE XAUDIO2_VOICE_SENDS XAUDIO2_VOICE_SENDS; +typedef OPAQUE XAUDIO2_EFFECT_DESCRIPTOR XAUDIO2_EFFECT_DESCRIPTOR; +typedef OPAQUE XAUDIO2_EFFECT_CHAIN XAUDIO2_EFFECT_CHAIN; +typedef OPAQUE XAUDIO2_FILTER_PARAMETERS XAUDIO2_FILTER_PARAMETERS; +typedef OPAQUE XAUDIO2_BUFFER_WMA XAUDIO2_BUFFER_WMA; +typedef OPAQUE XAUDIO2_VOICE_STATE XAUDIO2_VOICE_STATE; +typedef OPAQUE XAUDIO2_PERFORMANCE_DATA XAUDIO2_PERFORMANCE_DATA; +typedef OPAQUE XAUDIO2_DEBUG_CONFIGURATION XAUDIO2_DEBUG_CONFIGURATION; +typedef OPAQUE IXAudio2EngineCallback IXAudio2EngineCallback; +typedef OPAQUE IXAudio2SubmixVoice IXAudio2SubmixVoice; +#endif + + +typedef struct XAUDIO2_BUFFER +{ + UINT32 Flags; + UINT32 AudioBytes; + const BYTE* pAudioData; + UINT32 PlayBegin; + UINT32 PlayLength; + UINT32 LoopBegin; + UINT32 LoopLength; + UINT32 LoopCount; + void *pContext; +} XAUDIO2_BUFFER; + +#undef INTERFACE +#define INTERFACE IXAudio2VoiceCallback + +DECLARE_INTERFACE(IXAudio2VoiceCallback) +{ + STDMETHOD_(void, OnVoiceProcessingPassStart) (THIS_ UINT32 BytesRequired) PURE; + STDMETHOD_(void, OnVoiceProcessingPassEnd) (THIS) PURE; + STDMETHOD_(void, OnStreamEnd) (THIS) PURE; + STDMETHOD_(void, OnBufferStart) (THIS_ void *pBufferContext) PURE; + STDMETHOD_(void, OnBufferEnd) (THIS_ void *pBufferContext) PURE; + STDMETHOD_(void, OnLoopEnd) (THIS_ void *pBufferContext) PURE; + STDMETHOD_(void, OnVoiceError) (THIS_ void *pBufferContext, HRESULT Error) PURE; +}; + +#undef INTERFACE +#define INTERFACE IXAudio2Voice + +DECLARE_INTERFACE(IXAudio2Voice) +{ +#define Declare_IXAudio2Voice_Methods() \ + STDMETHOD_(void, GetVoiceDetails) (THIS_ XAUDIO2_VOICE_DETAILS* pVoiceDetails) PURE; \ + STDMETHOD(SetOutputVoices) (THIS_ const XAUDIO2_VOICE_SENDS* pSendList) PURE; \ + STDMETHOD(SetEffectChain) (THIS_ const XAUDIO2_EFFECT_CHAIN* pEffectChain) PURE; \ + STDMETHOD(EnableEffect) (THIS_ UINT32 EffectIndex, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + STDMETHOD(DisableEffect) (THIS_ UINT32 EffectIndex, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + STDMETHOD_(void, GetEffectState) (THIS_ UINT32 EffectIndex, BOOL* pEnabled) PURE; \ + STDMETHOD(SetEffectParameters) (THIS_ UINT32 EffectIndex, \ + const void *pParameters, \ + UINT32 ParametersByteSize, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + STDMETHOD(GetEffectParameters) (THIS_ UINT32 EffectIndex, void *pParameters, \ + UINT32 ParametersByteSize) PURE; \ + STDMETHOD(SetFilterParameters) (THIS_ const XAUDIO2_FILTER_PARAMETERS* pParameters, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + STDMETHOD_(void, GetFilterParameters) (THIS_ XAUDIO2_FILTER_PARAMETERS* pParameters) PURE; \ + STDMETHOD_(void, SetOutputFilterParameters) (THIS_ IXAudio2Voice *voice, const XAUDIO2_FILTER_PARAMETERS* param, \ + UINT32 op X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + STDMETHOD_(void, GetOutputFilterParameters) (THIS_ IXAudio2Voice *voice, XAUDIO2_FILTER_PARAMETERS* param) PURE; \ + STDMETHOD(SetVolume) (THIS_ float Volume, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + STDMETHOD_(void, GetVolume) (THIS_ float* pVolume) PURE; \ + STDMETHOD(SetChannelVolumes) (THIS_ UINT32 Channels, const float* pVolumes, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + STDMETHOD_(void, GetChannelVolumes) (THIS_ UINT32 Channels, float* pVolumes) PURE; \ + STDMETHOD(SetOutputMatrix) (THIS_ IXAudio2Voice* pDestinationVoice, \ + UINT32 SourceChannels, UINT32 DestinationChannels, \ + const float* pLevelMatrix, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + STDMETHOD_(void, GetOutputMatrix) (THIS_ IXAudio2Voice* pDestinationVoice, \ + UINT32 SourceChannels, UINT32 DestinationChannels, \ + float* pLevelMatrix) PURE; \ + STDMETHOD_(void, DestroyVoice) (THIS) PURE + + Declare_IXAudio2Voice_Methods(); +}; + +#undef INTERFACE +#define INTERFACE IXAudio2MasteringVoice + +DECLARE_INTERFACE_(IXAudio2MasteringVoice, IXAudio2Voice) +{ + Declare_IXAudio2Voice_Methods(); +}; + +#undef INTERFACE +#define INTERFACE IXAudio2SourceVoice + +DECLARE_INTERFACE_(IXAudio2SourceVoice, IXAudio2Voice) +{ + Declare_IXAudio2Voice_Methods(); + STDMETHOD(Start) (THIS_ UINT32 Flags, UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; + STDMETHOD(Stop) (THIS_ UINT32 Flags, UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; + STDMETHOD(SubmitSourceBuffer) (THIS_ const XAUDIO2_BUFFER* pBuffer, const XAUDIO2_BUFFER_WMA* pBufferWMA X2DEFAULT(NULL)) PURE; + STDMETHOD(FlushSourceBuffers) (THIS) PURE; + STDMETHOD(Discontinuity) (THIS) PURE; + STDMETHOD(ExitLoop) (THIS_ UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; + STDMETHOD_(void, GetState) (THIS_ XAUDIO2_VOICE_STATE* pVoiceState) PURE; + STDMETHOD(SetFrequencyRatio) (THIS_ float Ratio, + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; + STDMETHOD_(void, GetFrequencyRatio) (THIS_ float* pRatio) PURE; +}; + +#undef INTERFACE +#define INTERFACE IXAudio2 + +DECLARE_INTERFACE_(IXAudio2, IUnknown) +{ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvInterface) PURE; + STDMETHOD_(ULONG, AddRef) (THIS) PURE; + STDMETHOD_(ULONG, Release) (THIS) PURE; + STDMETHOD(GetDeviceCount) (THIS_ UINT32* pCount) PURE; + STDMETHOD(GetDeviceDetails) (THIS_ UINT32 Index, XAUDIO2_DEVICE_DETAILS* pDeviceDetails) PURE; + STDMETHOD(Initialize) (THIS_ UINT32 Flags X2DEFAULT(0), + XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR)) PURE; + STDMETHOD(RegisterForCallbacks) (IXAudio2EngineCallback* pCallback) PURE; + STDMETHOD_(void, UnregisterForCallbacks) (IXAudio2EngineCallback* pCallback) PURE; + STDMETHOD(CreateSourceVoice) (THIS_ IXAudio2SourceVoice** ppSourceVoice, + const WAVEFORMATEX* pSourceFormat, + UINT32 Flags X2DEFAULT(0), + float MaxFrequencyRatio X2DEFAULT(XAUDIO2_DEFAULT_FREQ_RATIO), + IXAudio2VoiceCallback* pCallback X2DEFAULT(NULL), + const XAUDIO2_VOICE_SENDS* pSendList X2DEFAULT(NULL), + const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE; + STDMETHOD(CreateSubmixVoice) (THIS_ IXAudio2SubmixVoice** ppSubmixVoice, + UINT32 InputChannels, UINT32 InputSampleRate, + UINT32 Flags X2DEFAULT(0), UINT32 ProcessingStage X2DEFAULT(0), + const XAUDIO2_VOICE_SENDS* pSendList X2DEFAULT(NULL), + const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE; + STDMETHOD(CreateMasteringVoice) (THIS_ IXAudio2MasteringVoice** ppMasteringVoice, + UINT32 InputChannels X2DEFAULT(XAUDIO2_DEFAULT_CHANNELS), + UINT32 InputSampleRate X2DEFAULT(XAUDIO2_DEFAULT_SAMPLERATE), + UINT32 Flags X2DEFAULT(0), UINT32 DeviceIndex X2DEFAULT(0), + const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE; + STDMETHOD(StartEngine) (THIS) PURE; + STDMETHOD_(void, StopEngine) (THIS) PURE; + STDMETHOD(CommitChanges) (THIS_ UINT32 OperationSet) PURE; + STDMETHOD_(void, GetPerformanceData) (THIS_ XAUDIO2_PERFORMANCE_DATA* pPerfData) PURE; + STDMETHOD_(void, SetDebugConfiguration) (THIS_ const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration, + void *pReserved X2DEFAULT(NULL)) PURE; +}; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/* C++ hooks */ +#define IXAudio2_Initialize(handle,a,b) handle->Initialize(a, b) +#define IXAudio2SourceVoice_SubmitSourceBuffer(handle, a, b) handle->SubmitSourceBuffer(a, b) +#define IXAudio2SourceVoice_Stop(handle, a, b) handle->Stop(a, b) +#define IXAudio2SourceVoice_DestroyVoice(handle) handle->DestroyVoice() +#define IXAudio2MasteringVoice_DestroyVoice(handle) handle->DestroyVoice() +#define IXAudio2_Release(handle) handle->Release() +#define IXAudio2_CreateSourceVoice(handle, a, b, c, d, e, f, g) handle->CreateSourceVoice(a, b, c, d, e, f, g) +#define IXAudio2_CreateMasteringVoice(handle, a, b, c, d, e, f) handle->CreateMasteringVoice(a, b, c, d, e, f) +#define IXAudio2SourceVoice_Start(handle, a, b) handle->Start(a, b) +#else +/* C hooks */ +#define IXAudio2_Initialize(handle,a,b) (handle)->lpVtbl->Initialize(handle, a, b) +#define IXAudio2_Release(handle) (handle)->lpVtbl->Release(handle) +#define IXAudio2_CreateSourceVoice(handle,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) (handle)->lpVtbl->CreateSourceVoice(handle, ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) +#define IXAudio2_CreateMasteringVoice(handle,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain) (handle)->lpVtbl->CreateMasteringVoice(handle, ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain) +#define IXAudio2_GetDeviceCount(handle, puCount) (handle)->lpVtbl->GetDeviceCount(handle, puCount) +#define IXAudio2_GetDeviceDetails(handle, Index,pDeviceDetails) (handle)->lpVtbl->GetDeviceDetails(handle, Index, pDeviceDetails) +#define IXAudio2SourceVoice_Start(handle, Flags, OperationSet) (handle)->lpVtbl->Start(handle, Flags, OperationSet) +#define IXAudio2SourceVoice_Stop(handle, Flags, OperationSet) (handle)->lpVtbl->Stop(handle, Flags, OperationSet) +#define IXAudio2SourceVoice_SubmitSourceBuffer(handle, pBuffer, pBufferWMA) (handle)->lpVtbl->SubmitSourceBuffer(handle, pBuffer, pBufferWMA) +#define IXAudio2SourceVoice_DestroyVoice(handle) (handle)->lpVtbl->DestroyVoice(handle) +#define IXAudio2MasteringVoice_DestroyVoice(handle) (handle)->lpVtbl->DestroyVoice(handle) +#endif + +#ifdef _XBOX +STDAPI XAudio2Create(__deref_out IXAudio2** ppXAudio2, UINT32 Flags X2DEFAULT(0), + XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR)); +#else +static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32 flags, XAUDIO2_PROCESSOR proc) +{ + IXAudio2 *pXAudio2 = NULL; +#ifdef __cplusplus + HRESULT hr = CoCreateInstance(CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, IID_IXAudio2, (void**)&pXAudio2); +#else + HRESULT hr = CoCreateInstance(&CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, &IID_IXAudio2, (void**)&pXAudio2); +#endif + + if (SUCCEEDED(hr)) + { + hr = IXAudio2_Initialize(pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR); + if (SUCCEEDED(hr)) + *ppXAudio2 = pXAudio2; + else + IXAudio2_Release(pXAudio2); + } + return hr; +} +#endif + +/* Undo the #pragma pack(push, 1) directive at the top of this file */ +#pragma pack(pop) + +#endif + diff --git a/audio/drivers/xaudio29.h b/audio/drivers/xaudio29.h new file mode 100644 index 0000000000..46f5d616ca --- /dev/null +++ b/audio/drivers/xaudio29.h @@ -0,0 +1,1306 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2018 - Krzysztof Haładyn + * + * RetroArch is free software: 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 . + */ + + /************************************************************************** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: xaudio2.h + * Content: Declarations for the XAudio2 game audio API. + * + **************************************************************************/ + + /* Modified slightly to build without requiring the WinRT compiler since that is only available in C++ sources */ + +#ifdef _MSC_VER +#pragma once +#endif + +#ifndef __XAUDIO2_INCLUDED__ +#define __XAUDIO2_INCLUDED__ + +#include + +#include + +#if(_WIN32_WINNT < _WIN32_WINNT_WIN8) +#error "This version of XAudio2 is available only in Windows 8 or later. Use the XAudio2 headers and libraries from the DirectX SDK with applications that target Windows 7 and earlier versions." +#endif // (_WIN32_WINNT < _WIN32_WINNT_WIN8) + +#include + +#pragma region Application Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_TV_APP | WINAPI_PARTITION_TV_TITLE) + +// Current name of the DLL shipped in the same SDK as this header. +// The name reflects the current version +#if(_WIN32_WINNT >= _WIN32_WINNT_WIN10) +#define XAUDIO2_DLL_A "xaudio2_9.dll" +#define XAUDIO2_DLL_W L"xaudio2_9.dll" +#define XAUDIO2D_DLL_A "xaudio2_9d.dll" +#define XAUDIO2D_DLL_W L"xaudio2_9d.dll" +#else +#define XAUDIO2_DLL_A "xaudio2_8.dll" +#define XAUDIO2_DLL_W L"xaudio2_8.dll" +#define XAUDIO2D_DLL_A "xaudio2_8.dll" +#define XAUDIO2D_DLL_W L"xaudio2_8.dll" +#endif + +#ifdef UNICODE +#define XAUDIO2_DLL XAUDIO2_DLL_W +#define XAUDIO2D_DLL XAUDIO2D_DLL_W +#else +#define XAUDIO2_DLL XAUDIO2_DLL_A +#define XAUDIO2D_DLL XAUDIO2D_DLL_A +#endif + + +/************************************************************************** + * + * XAudio2 COM object class and interface IDs. + * + **************************************************************************/ + +#include + +#if defined(__cplusplus__) && defined(__WINRT__) + +#if(_WIN32_WINNT >= _WIN32_WINNT_WIN10) + // XAudio 2.9 +interface __declspec(uuid("2B02E3CF-2E0B-4ec3-BE45-1B2A3FE7210D")) IXAudio2; +#else + // XAudio 2.8 +interface __declspec(uuid("60d8dac8-5aa1-4e8e-b597-2f5e2883d484")) IXAudio2; +#endif + +#else + + /* Modified for C support */ +#define DEFINE_GUID_X(n, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + static const GUID n = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } +#define DEFINE_CLSID_X(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + DEFINE_GUID_X(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) +#define DEFINE_IID_X(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + DEFINE_GUID_X(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) + +#if(_WIN32_WINNT >= _WIN32_WINNT_WIN10) +DEFINE_IID_X(IXAudio2, 2B02E3CF, 2E0B, 4ec3, BE, 45, 1B, 2A, 3F, E7, 21, 0D); +#else +DEFINE_IID_X(IXAudio2, 60d8dac8, 5aa1, 4e8e, b5, 97, 2f, 5e, 28, 83, d4, 84); +#endif + +#endif + + +// Ignore the rest of this header if only the GUID definitions were requested +#ifndef GUID_DEFS_ONLY + +#include // Windows COM declarations +#include // Markers for documenting API semantics +#include // Basic data types and constants for audio work +#include // For AUDIO_STREAM_CATEGORY + +// All structures defined in this file use tight field packing +#pragma pack(push, 1) + + +/************************************************************************** + * + * XAudio2 constants, flags and error codes. + * + **************************************************************************/ + + // Numeric boundary values +#define XAUDIO2_MAX_BUFFER_BYTES 0x80000000 // Maximum bytes allowed in a source buffer +#define XAUDIO2_MAX_QUEUED_BUFFERS 64 // Maximum buffers allowed in a voice queue +#define XAUDIO2_MAX_BUFFERS_SYSTEM 2 // Maximum buffers allowed for system threads (Xbox 360 only) +#define XAUDIO2_MAX_AUDIO_CHANNELS 64 // Maximum channels in an audio stream +#define XAUDIO2_MIN_SAMPLE_RATE 1000 // Minimum audio sample rate supported +#define XAUDIO2_MAX_SAMPLE_RATE 200000 // Maximum audio sample rate supported +#define XAUDIO2_MAX_VOLUME_LEVEL 16777216.0f // Maximum acceptable volume level (2^24) +#define XAUDIO2_MIN_FREQ_RATIO (1/1024.0f) // Minimum SetFrequencyRatio argument +#define XAUDIO2_MAX_FREQ_RATIO 1024.0f // Maximum MaxFrequencyRatio argument +#define XAUDIO2_DEFAULT_FREQ_RATIO 2.0f // Default MaxFrequencyRatio argument +#define XAUDIO2_MAX_FILTER_ONEOVERQ 1.5f // Maximum XAUDIO2_FILTER_PARAMETERS.OneOverQ +#define XAUDIO2_MAX_FILTER_FREQUENCY 1.0f // Maximum XAUDIO2_FILTER_PARAMETERS.Frequency +#define XAUDIO2_MAX_LOOP_COUNT 254 // Maximum non-infinite XAUDIO2_BUFFER.LoopCount +#define XAUDIO2_MAX_INSTANCES 8 // Maximum simultaneous XAudio2 objects on Xbox 360 + +// For XMA voices on Xbox 360 there is an additional restriction on the MaxFrequencyRatio +// argument and the voice's sample rate: the product of these numbers cannot exceed 600000 +// for one-channel voices or 300000 for voices with more than one channel. +#define XAUDIO2_MAX_RATIO_TIMES_RATE_XMA_MONO 600000 +#define XAUDIO2_MAX_RATIO_TIMES_RATE_XMA_MULTICHANNEL 300000 + +// Numeric values with special meanings +#define XAUDIO2_COMMIT_NOW 0 // Used as an OperationSet argument +#define XAUDIO2_COMMIT_ALL 0 // Used in IXAudio2::CommitChanges +#define XAUDIO2_INVALID_OPSET (UINT32)(-1) // Not allowed for OperationSet arguments +#define XAUDIO2_NO_LOOP_REGION 0 // Used in XAUDIO2_BUFFER.LoopCount +#define XAUDIO2_LOOP_INFINITE 255 // Used in XAUDIO2_BUFFER.LoopCount +#define XAUDIO2_DEFAULT_CHANNELS 0 // Used in CreateMasteringVoice +#define XAUDIO2_DEFAULT_SAMPLERATE 0 // Used in CreateMasteringVoice + +// Flags +#define XAUDIO2_DEBUG_ENGINE 0x0001 // Used in XAudio2Create +#define XAUDIO2_VOICE_NOPITCH 0x0002 // Used in IXAudio2::CreateSourceVoice +#define XAUDIO2_VOICE_NOSRC 0x0004 // Used in IXAudio2::CreateSourceVoice +#define XAUDIO2_VOICE_USEFILTER 0x0008 // Used in IXAudio2::CreateSource/SubmixVoice +#define XAUDIO2_PLAY_TAILS 0x0020 // Used in IXAudio2SourceVoice::Stop +#define XAUDIO2_END_OF_STREAM 0x0040 // Used in XAUDIO2_BUFFER.Flags +#define XAUDIO2_SEND_USEFILTER 0x0080 // Used in XAUDIO2_SEND_DESCRIPTOR.Flags +#define XAUDIO2_VOICE_NOSAMPLESPLAYED 0x0100 // Used in IXAudio2SourceVoice::GetState +#define XAUDIO2_STOP_ENGINE_WHEN_IDLE 0x2000 // Used in XAudio2Create to force the engine to Stop when no source voices are Started, and Start when a voice is Started +#define XAUDIO2_1024_QUANTUM 0x8000 // Used in XAudio2Create to specify nondefault processing quantum of 21.33 ms (1024 samples at 48KHz) +#define XAUDIO2_NO_VIRTUAL_AUDIO_CLIENT 0x10000 // Used in CreateMasteringVoice to create a virtual audio client + +// Default parameters for the built-in filter +#define XAUDIO2_DEFAULT_FILTER_TYPE LowPassFilter +#define XAUDIO2_DEFAULT_FILTER_FREQUENCY XAUDIO2_MAX_FILTER_FREQUENCY +#define XAUDIO2_DEFAULT_FILTER_ONEOVERQ 1.0f + +// Internal XAudio2 constants +// The audio frame quantum can be calculated by reducing the fraction: +// SamplesPerAudioFrame / SamplesPerSecond +#define XAUDIO2_QUANTUM_NUMERATOR 1 // On Windows, XAudio2 processes audio +#define XAUDIO2_QUANTUM_DENOMINATOR 100 // in 10ms chunks (= 1/100 seconds) +#define XAUDIO2_QUANTUM_MS (1000.0f * XAUDIO2_QUANTUM_NUMERATOR / XAUDIO2_QUANTUM_DENOMINATOR) + +// XAudio2 error codes +#define FACILITY_XAUDIO2 0x896 +#define XAUDIO2_E_INVALID_CALL 0x88960001 // An API call or one of its arguments was illegal +#define XAUDIO2_E_XMA_DECODER_ERROR 0x88960002 // The XMA hardware suffered an unrecoverable error +#define XAUDIO2_E_XAPO_CREATION_FAILED 0x88960003 // XAudio2 failed to initialize an XAPO effect +#define XAUDIO2_E_DEVICE_INVALIDATED 0x88960004 // An audio device became unusable (unplugged, etc) + +/************************************************************************** + * + * Forward declarations for the XAudio2 interfaces. + * + **************************************************************************/ + +#ifdef __cplusplus +#define FWD_DECLARE(x) interface x +#else +#define FWD_DECLARE(x) typedef interface x x +#endif + +FWD_DECLARE(IXAudio2); +FWD_DECLARE(IXAudio2Voice); +FWD_DECLARE(IXAudio2SourceVoice); +FWD_DECLARE(IXAudio2SubmixVoice); +FWD_DECLARE(IXAudio2MasteringVoice); +FWD_DECLARE(IXAudio2EngineCallback); +FWD_DECLARE(IXAudio2VoiceCallback); + + +/************************************************************************** + * + * XAudio2 structures and enumerations. + * + **************************************************************************/ + + // Used in XAudio2Create, specifies which CPU(s) to use. +typedef UINT32 XAUDIO2_PROCESSOR; +#define Processor1 0x00000001 +#define Processor2 0x00000002 +#define Processor3 0x00000004 +#define Processor4 0x00000008 +#define Processor5 0x00000010 +#define Processor6 0x00000020 +#define Processor7 0x00000040 +#define Processor8 0x00000080 +#define Processor9 0x00000100 +#define Processor10 0x00000200 +#define Processor11 0x00000400 +#define Processor12 0x00000800 +#define Processor13 0x00001000 +#define Processor14 0x00002000 +#define Processor15 0x00004000 +#define Processor16 0x00008000 +#define Processor17 0x00010000 +#define Processor18 0x00020000 +#define Processor19 0x00040000 +#define Processor20 0x00080000 +#define Processor21 0x00100000 +#define Processor22 0x00200000 +#define Processor23 0x00400000 +#define Processor24 0x00800000 +#define Processor25 0x01000000 +#define Processor26 0x02000000 +#define Processor27 0x04000000 +#define Processor28 0x08000000 +#define Processor29 0x10000000 +#define Processor30 0x20000000 +#define Processor31 0x40000000 +#define Processor32 0x80000000 +#define XAUDIO2_ANY_PROCESSOR 0xffffffff +#define XAUDIO2_DEFAULT_PROCESSOR Processor1 + +// Returned by IXAudio2Voice::GetVoiceDetails +typedef struct XAUDIO2_VOICE_DETAILS +{ + UINT32 CreationFlags; // Flags the voice was created with. + UINT32 ActiveFlags; // Flags currently active. + UINT32 InputChannels; // Channels in the voice's input audio. + UINT32 InputSampleRate; // Sample rate of the voice's input audio. +} XAUDIO2_VOICE_DETAILS; + +// Used in XAUDIO2_VOICE_SENDS below +typedef struct XAUDIO2_SEND_DESCRIPTOR +{ + UINT32 Flags; // Either 0 or XAUDIO2_SEND_USEFILTER. + IXAudio2Voice* pOutputVoice; // This send's destination voice. +} XAUDIO2_SEND_DESCRIPTOR; + +// Used in the voice creation functions and in IXAudio2Voice::SetOutputVoices +typedef struct XAUDIO2_VOICE_SENDS +{ + UINT32 SendCount; // Number of sends from this voice. + XAUDIO2_SEND_DESCRIPTOR* pSends; // Array of SendCount send descriptors. +} XAUDIO2_VOICE_SENDS; + +// Used in XAUDIO2_EFFECT_CHAIN below +typedef struct XAUDIO2_EFFECT_DESCRIPTOR +{ + IUnknown* pEffect; // Pointer to the effect object's IUnknown interface. + BOOL InitialState; // TRUE if the effect should begin in the enabled state. + UINT32 OutputChannels; // How many output channels the effect should produce. +} XAUDIO2_EFFECT_DESCRIPTOR; + +// Used in the voice creation functions and in IXAudio2Voice::SetEffectChain +typedef struct XAUDIO2_EFFECT_CHAIN +{ + UINT32 EffectCount; // Number of effects in this voice's effect chain. + XAUDIO2_EFFECT_DESCRIPTOR* pEffectDescriptors; // Array of effect descriptors. +} XAUDIO2_EFFECT_CHAIN; + +// Used in XAUDIO2_FILTER_PARAMETERS below +typedef enum XAUDIO2_FILTER_TYPE +{ + LowPassFilter, // Attenuates frequencies above the cutoff frequency (state-variable filter). + BandPassFilter, // Attenuates frequencies outside a given range (state-variable filter). + HighPassFilter, // Attenuates frequencies below the cutoff frequency (state-variable filter). + NotchFilter, // Attenuates frequencies inside a given range (state-variable filter). + LowPassOnePoleFilter, // Attenuates frequencies above the cutoff frequency (one-pole filter, XAUDIO2_FILTER_PARAMETERS.OneOverQ has no effect) + HighPassOnePoleFilter // Attenuates frequencies below the cutoff frequency (one-pole filter, XAUDIO2_FILTER_PARAMETERS.OneOverQ has no effect) +} XAUDIO2_FILTER_TYPE; + +// Used in IXAudio2Voice::Set/GetFilterParameters and Set/GetOutputFilterParameters +typedef struct XAUDIO2_FILTER_PARAMETERS +{ + XAUDIO2_FILTER_TYPE Type; // Filter type. + float Frequency; // Filter coefficient. + // must be >= 0 and <= XAUDIO2_MAX_FILTER_FREQUENCY + // See XAudio2CutoffFrequencyToRadians() for state-variable filter types and + // XAudio2CutoffFrequencyToOnePoleCoefficient() for one-pole filter types. + float OneOverQ; // Reciprocal of the filter's quality factor Q; + // must be > 0 and <= XAUDIO2_MAX_FILTER_ONEOVERQ. + // Has no effect for one-pole filters. +} XAUDIO2_FILTER_PARAMETERS; + +// Used in IXAudio2SourceVoice::SubmitSourceBuffer +typedef struct XAUDIO2_BUFFER +{ + UINT32 Flags; // Either 0 or XAUDIO2_END_OF_STREAM. + UINT32 AudioBytes; // Size of the audio data buffer in bytes. + const BYTE* pAudioData; // Pointer to the audio data buffer. + UINT32 PlayBegin; // First sample in this buffer to be played. + UINT32 PlayLength; // Length of the region to be played in samples, + // or 0 to play the whole buffer. + UINT32 LoopBegin; // First sample of the region to be looped. + UINT32 LoopLength; // Length of the desired loop region in samples, + // or 0 to loop the entire buffer. + UINT32 LoopCount; // Number of times to repeat the loop region, + // or XAUDIO2_LOOP_INFINITE to loop forever. + void* pContext; // Context value to be passed back in callbacks. +} XAUDIO2_BUFFER; + +// Used in IXAudio2SourceVoice::SubmitSourceBuffer when submitting XWMA data. +// NOTE: If an XWMA sound is submitted in more than one buffer, each buffer's +// pDecodedPacketCumulativeBytes[PacketCount-1] value must be subtracted from +// all the entries in the next buffer's pDecodedPacketCumulativeBytes array. +// And whether a sound is submitted in more than one buffer or not, the final +// buffer of the sound should use the XAUDIO2_END_OF_STREAM flag, or else the +// client must call IXAudio2SourceVoice::Discontinuity after submitting it. +typedef struct XAUDIO2_BUFFER_WMA +{ + const UINT32* pDecodedPacketCumulativeBytes; // Decoded packet's cumulative size array. + // Each element is the number of bytes accumulated + // when the corresponding XWMA packet is decoded in + // order. The array must have PacketCount elements. + UINT32 PacketCount; // Number of XWMA packets submitted. Must be >= 1 and + // divide evenly into XAUDIO2_BUFFER.AudioBytes. +} XAUDIO2_BUFFER_WMA; + +// Returned by IXAudio2SourceVoice::GetState +typedef struct XAUDIO2_VOICE_STATE +{ + void* pCurrentBufferContext; // The pContext value provided in the XAUDIO2_BUFFER + // that is currently being processed, or NULL if + // there are no buffers in the queue. + UINT32 BuffersQueued; // Number of buffers currently queued on the voice + // (including the one that is being processed). + UINT64 SamplesPlayed; // Total number of samples produced by the voice since + // it began processing the current audio stream. + // If XAUDIO2_VOICE_NOSAMPLESPLAYED is specified + // in the call to IXAudio2SourceVoice::GetState, + // this member will not be calculated, saving CPU. +} XAUDIO2_VOICE_STATE; + +// Returned by IXAudio2::GetPerformanceData +typedef struct XAUDIO2_PERFORMANCE_DATA +{ + // CPU usage information + UINT64 AudioCyclesSinceLastQuery; // CPU cycles spent on audio processing since the + // last call to StartEngine or GetPerformanceData. + UINT64 TotalCyclesSinceLastQuery; // Total CPU cycles elapsed since the last call + // (only counts the CPU XAudio2 is running on). + UINT32 MinimumCyclesPerQuantum; // Fewest CPU cycles spent processing any one + // audio quantum since the last call. + UINT32 MaximumCyclesPerQuantum; // Most CPU cycles spent processing any one + // audio quantum since the last call. + + // Memory usage information + UINT32 MemoryUsageInBytes; // Total heap space currently in use. + + // Audio latency and glitching information + UINT32 CurrentLatencyInSamples; // Minimum delay from when a sample is read from a + // source buffer to when it reaches the speakers. + UINT32 GlitchesSinceEngineStarted; // Audio dropouts since the engine was started. + + // Data about XAudio2's current workload + UINT32 ActiveSourceVoiceCount; // Source voices currently playing. + UINT32 TotalSourceVoiceCount; // Source voices currently existing. + UINT32 ActiveSubmixVoiceCount; // Submix voices currently playing/existing. + + UINT32 ActiveResamplerCount; // Resample xAPOs currently active. + UINT32 ActiveMatrixMixCount; // MatrixMix xAPOs currently active. + + // Usage of the hardware XMA decoder (Xbox 360 only) + UINT32 ActiveXmaSourceVoices; // Number of source voices decoding XMA data. + UINT32 ActiveXmaStreams; // A voice can use more than one XMA stream. +} XAUDIO2_PERFORMANCE_DATA; + +// Used in IXAudio2::SetDebugConfiguration +typedef struct XAUDIO2_DEBUG_CONFIGURATION +{ + UINT32 TraceMask; // Bitmap of enabled debug message types. + UINT32 BreakMask; // Message types that will break into the debugger. + BOOL LogThreadID; // Whether to log the thread ID with each message. + BOOL LogFileline; // Whether to log the source file and line number. + BOOL LogFunctionName; // Whether to log the function name. + BOOL LogTiming; // Whether to log message timestamps. +} XAUDIO2_DEBUG_CONFIGURATION; + +// Values for the TraceMask and BreakMask bitmaps. Only ERRORS and WARNINGS +// are valid in BreakMask. WARNINGS implies ERRORS, DETAIL implies INFO, and +// FUNC_CALLS implies API_CALLS. By default, TraceMask is ERRORS and WARNINGS +// and all the other settings are zero. +#define XAUDIO2_LOG_ERRORS 0x0001 // For handled errors with serious effects. +#define XAUDIO2_LOG_WARNINGS 0x0002 // For handled errors that may be recoverable. +#define XAUDIO2_LOG_INFO 0x0004 // Informational chit-chat (e.g. state changes). +#define XAUDIO2_LOG_DETAIL 0x0008 // More detailed chit-chat. +#define XAUDIO2_LOG_API_CALLS 0x0010 // Public API function entries and exits. +#define XAUDIO2_LOG_FUNC_CALLS 0x0020 // Internal function entries and exits. +#define XAUDIO2_LOG_TIMING 0x0040 // Delays detected and other timing data. +#define XAUDIO2_LOG_LOCKS 0x0080 // Usage of critical sections and mutexes. +#define XAUDIO2_LOG_MEMORY 0x0100 // Memory heap usage information. +#define XAUDIO2_LOG_STREAMING 0x1000 // Audio streaming information. + + +/************************************************************************** + * + * IXAudio2: Top-level XAudio2 COM interface. + * + **************************************************************************/ + + // Use default arguments if compiling as C++ +#ifdef __cplusplus +#define X2DEFAULT(x) =x +#else +#define X2DEFAULT(x) +#endif + +#undef INTERFACE +#define INTERFACE IXAudio2 +DECLARE_INTERFACE_(IXAudio2, IUnknown) +{ + // NAME: IXAudio2::QueryInterface + // DESCRIPTION: Queries for a given COM interface on the XAudio2 object. + // Only IID_IUnknown and IID_IXAudio2 are supported. + // + // ARGUMENTS: + // riid - IID of the interface to be obtained. + // ppvInterface - Returns a pointer to the requested interface. + // + STDMETHOD(QueryInterface) (THIS_ REFIID riid, _Outptr_ void** ppvInterface) PURE; + + // NAME: IXAudio2::AddRef + // DESCRIPTION: Adds a reference to the XAudio2 object. + // + STDMETHOD_(ULONG, AddRef) (THIS) PURE; + + // NAME: IXAudio2::Release + // DESCRIPTION: Releases a reference to the XAudio2 object. + // + STDMETHOD_(ULONG, Release) (THIS) PURE; + + // NAME: IXAudio2::RegisterForCallbacks + // DESCRIPTION: Adds a new client to receive XAudio2's engine callbacks. + // + // ARGUMENTS: + // pCallback - Callback interface to be called during each processing pass. + // + STDMETHOD(RegisterForCallbacks) (_In_ IXAudio2EngineCallback* pCallback) PURE; + + // NAME: IXAudio2::UnregisterForCallbacks + // DESCRIPTION: Removes an existing receiver of XAudio2 engine callbacks. + // + // ARGUMENTS: + // pCallback - Previously registered callback interface to be removed. + // + STDMETHOD_(void, UnregisterForCallbacks) (_In_ IXAudio2EngineCallback* pCallback) PURE; + + // NAME: IXAudio2::CreateSourceVoice + // DESCRIPTION: Creates and configures a source voice. + // + // ARGUMENTS: + // ppSourceVoice - Returns the new object's IXAudio2SourceVoice interface. + // pSourceFormat - Format of the audio that will be fed to the voice. + // Flags - XAUDIO2_VOICE flags specifying the source voice's behavior. + // MaxFrequencyRatio - Maximum SetFrequencyRatio argument to be allowed. + // pCallback - Optional pointer to a client-provided callback interface. + // pSendList - Optional list of voices this voice should send audio to. + // pEffectChain - Optional list of effects to apply to the audio data. + // + STDMETHOD(CreateSourceVoice) (THIS_ _Outptr_ IXAudio2SourceVoice** ppSourceVoice, + _In_ const WAVEFORMATEX* pSourceFormat, + UINT32 Flags X2DEFAULT(0), + float MaxFrequencyRatio X2DEFAULT(XAUDIO2_DEFAULT_FREQ_RATIO), + _In_opt_ IXAudio2VoiceCallback* pCallback X2DEFAULT(NULL), + _In_opt_ const XAUDIO2_VOICE_SENDS* pSendList X2DEFAULT(NULL), + _In_opt_ const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE; + + // NAME: IXAudio2::CreateSubmixVoice + // DESCRIPTION: Creates and configures a submix voice. + // + // ARGUMENTS: + // ppSubmixVoice - Returns the new object's IXAudio2SubmixVoice interface. + // InputChannels - Number of channels in this voice's input audio data. + // InputSampleRate - Sample rate of this voice's input audio data. + // Flags - XAUDIO2_VOICE flags specifying the submix voice's behavior. + // ProcessingStage - Arbitrary number that determines the processing order. + // pSendList - Optional list of voices this voice should send audio to. + // pEffectChain - Optional list of effects to apply to the audio data. + // + STDMETHOD(CreateSubmixVoice) (THIS_ _Outptr_ IXAudio2SubmixVoice** ppSubmixVoice, + UINT32 InputChannels, UINT32 InputSampleRate, + UINT32 Flags X2DEFAULT(0), UINT32 ProcessingStage X2DEFAULT(0), + _In_opt_ const XAUDIO2_VOICE_SENDS* pSendList X2DEFAULT(NULL), + _In_opt_ const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE; + + + // NAME: IXAudio2::CreateMasteringVoice + // DESCRIPTION: Creates and configures a mastering voice. + // + // ARGUMENTS: + // ppMasteringVoice - Returns the new object's IXAudio2MasteringVoice interface. + // InputChannels - Number of channels in this voice's input audio data. + // InputSampleRate - Sample rate of this voice's input audio data. + // Flags - XAUDIO2_VOICE flags specifying the mastering voice's behavior. + // szDeviceId - Identifier of the device to receive the output audio. + // pEffectChain - Optional list of effects to apply to the audio data. + // StreamCategory - The audio stream category to use for this mastering voice + // + STDMETHOD(CreateMasteringVoice) (THIS_ _Outptr_ IXAudio2MasteringVoice** ppMasteringVoice, + UINT32 InputChannels X2DEFAULT(XAUDIO2_DEFAULT_CHANNELS), + UINT32 InputSampleRate X2DEFAULT(XAUDIO2_DEFAULT_SAMPLERATE), + UINT32 Flags X2DEFAULT(0), _In_opt_z_ LPCWSTR szDeviceId X2DEFAULT(NULL), + _In_opt_ const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL), + _In_ AUDIO_STREAM_CATEGORY StreamCategory X2DEFAULT(AudioCategory_GameEffects)) PURE; + + // NAME: IXAudio2::StartEngine + // DESCRIPTION: Creates and starts the audio processing thread. + // + STDMETHOD(StartEngine) (THIS) PURE; + + // NAME: IXAudio2::StopEngine + // DESCRIPTION: Stops and destroys the audio processing thread. + // + STDMETHOD_(void, StopEngine) (THIS) PURE; + + // NAME: IXAudio2::CommitChanges + // DESCRIPTION: Atomically applies a set of operations previously tagged + // with a given identifier. + // + // ARGUMENTS: + // OperationSet - Identifier of the set of operations to be applied. + // + STDMETHOD(CommitChanges) (THIS_ UINT32 OperationSet) PURE; + + // NAME: IXAudio2::GetPerformanceData + // DESCRIPTION: Returns current resource usage details: memory, CPU, etc. + // + // ARGUMENTS: + // pPerfData - Returns the performance data structure. + // + STDMETHOD_(void, GetPerformanceData) (THIS_ _Out_ XAUDIO2_PERFORMANCE_DATA* pPerfData) PURE; + + // NAME: IXAudio2::SetDebugConfiguration + // DESCRIPTION: Configures XAudio2's debug output (in debug builds only). + // + // ARGUMENTS: + // pDebugConfiguration - Structure describing the debug output behavior. + // pReserved - Optional parameter; must be NULL. + // + STDMETHOD_(void, SetDebugConfiguration) (THIS_ _In_opt_ const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration, + _Reserved_ void* pReserved X2DEFAULT(NULL)) PURE; +}; + + +/************************************************************************** + * + * IXAudio2Voice: Base voice management interface. + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2Voice +DECLARE_INTERFACE(IXAudio2Voice) +{ + // These methods are declared in a macro so that the same declarations + // can be used in the derived voice types (IXAudio2SourceVoice, etc). + +#define Declare_IXAudio2Voice_Methods() \ + \ + /* NAME: IXAudio2Voice::GetVoiceDetails + // DESCRIPTION: Returns the basic characteristics of this voice. + // + // ARGUMENTS: + // pVoiceDetails - Returns the voice's details. + */\ + STDMETHOD_(void, GetVoiceDetails) (THIS_ _Out_ XAUDIO2_VOICE_DETAILS* pVoiceDetails) PURE; \ + \ + /* NAME: IXAudio2Voice::SetOutputVoices + // DESCRIPTION: Replaces the set of submix/mastering voices that receive + // this voice's output. + // + // ARGUMENTS: + // pSendList - Optional list of voices this voice should send audio to. + */\ + STDMETHOD(SetOutputVoices) (THIS_ _In_opt_ const XAUDIO2_VOICE_SENDS* pSendList) PURE; \ + \ + /* NAME: IXAudio2Voice::SetEffectChain + // DESCRIPTION: Replaces this voice's current effect chain with a new one. + // + // ARGUMENTS: + // pEffectChain - Structure describing the new effect chain to be used. + */\ + STDMETHOD(SetEffectChain) (THIS_ _In_opt_ const XAUDIO2_EFFECT_CHAIN* pEffectChain) PURE; \ + \ + /* NAME: IXAudio2Voice::EnableEffect + // DESCRIPTION: Enables an effect in this voice's effect chain. + // + // ARGUMENTS: + // EffectIndex - Index of an effect within this voice's effect chain. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(EnableEffect) (THIS_ UINT32 EffectIndex, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + \ + /* NAME: IXAudio2Voice::DisableEffect + // DESCRIPTION: Disables an effect in this voice's effect chain. + // + // ARGUMENTS: + // EffectIndex - Index of an effect within this voice's effect chain. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(DisableEffect) (THIS_ UINT32 EffectIndex, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetEffectState + // DESCRIPTION: Returns the running state of an effect. + // + // ARGUMENTS: + // EffectIndex - Index of an effect within this voice's effect chain. + // pEnabled - Returns the enabled/disabled state of the given effect. + */\ + STDMETHOD_(void, GetEffectState) (THIS_ UINT32 EffectIndex, _Out_ BOOL* pEnabled) PURE; \ + \ + /* NAME: IXAudio2Voice::SetEffectParameters + // DESCRIPTION: Sets effect-specific parameters. + // + // REMARKS: Unlike IXAPOParameters::SetParameters, this method may + // be called from any thread. XAudio2 implements + // appropriate synchronization to copy the parameters to the + // realtime audio processing thread. + // + // ARGUMENTS: + // EffectIndex - Index of an effect within this voice's effect chain. + // pParameters - Pointer to an effect-specific parameters block. + // ParametersByteSize - Size of the pParameters array in bytes. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(SetEffectParameters) (THIS_ UINT32 EffectIndex, \ + _In_reads_bytes_(ParametersByteSize) const void* pParameters, \ + UINT32 ParametersByteSize, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetEffectParameters + // DESCRIPTION: Obtains the current effect-specific parameters. + // + // ARGUMENTS: + // EffectIndex - Index of an effect within this voice's effect chain. + // pParameters - Returns the current values of the effect-specific parameters. + // ParametersByteSize - Size of the pParameters array in bytes. + */\ + STDMETHOD(GetEffectParameters) (THIS_ UINT32 EffectIndex, \ + _Out_writes_bytes_(ParametersByteSize) void* pParameters, \ + UINT32 ParametersByteSize) PURE; \ + \ + /* NAME: IXAudio2Voice::SetFilterParameters + // DESCRIPTION: Sets this voice's filter parameters. + // + // ARGUMENTS: + // pParameters - Pointer to the filter's parameter structure. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(SetFilterParameters) (THIS_ _In_ const XAUDIO2_FILTER_PARAMETERS* pParameters, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetFilterParameters + // DESCRIPTION: Returns this voice's current filter parameters. + // + // ARGUMENTS: + // pParameters - Returns the filter parameters. + */\ + STDMETHOD_(void, GetFilterParameters) (THIS_ _Out_ XAUDIO2_FILTER_PARAMETERS* pParameters) PURE; \ + \ + /* NAME: IXAudio2Voice::SetOutputFilterParameters + // DESCRIPTION: Sets the filter parameters on one of this voice's sends. + // + // ARGUMENTS: + // pDestinationVoice - Destination voice of the send whose filter parameters will be set. + // pParameters - Pointer to the filter's parameter structure. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(SetOutputFilterParameters) (THIS_ _In_opt_ IXAudio2Voice* pDestinationVoice, \ + _In_ const XAUDIO2_FILTER_PARAMETERS* pParameters, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetOutputFilterParameters + // DESCRIPTION: Returns the filter parameters from one of this voice's sends. + // + // ARGUMENTS: + // pDestinationVoice - Destination voice of the send whose filter parameters will be read. + // pParameters - Returns the filter parameters. + */\ + STDMETHOD_(void, GetOutputFilterParameters) (THIS_ _In_opt_ IXAudio2Voice* pDestinationVoice, \ + _Out_ XAUDIO2_FILTER_PARAMETERS* pParameters) PURE; \ + \ + /* NAME: IXAudio2Voice::SetVolume + // DESCRIPTION: Sets this voice's overall volume level. + // + // ARGUMENTS: + // Volume - New overall volume level to be used, as an amplitude factor. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(SetVolume) (THIS_ float Volume, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetVolume + // DESCRIPTION: Obtains this voice's current overall volume level. + // + // ARGUMENTS: + // pVolume: Returns the voice's current overall volume level. + */\ + STDMETHOD_(void, GetVolume) (THIS_ _Out_ float* pVolume) PURE; \ + \ + /* NAME: IXAudio2Voice::SetChannelVolumes + // DESCRIPTION: Sets this voice's per-channel volume levels. + // + // ARGUMENTS: + // Channels - Used to confirm the voice's channel count. + // pVolumes - Array of per-channel volume levels to be used. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(SetChannelVolumes) (THIS_ UINT32 Channels, _In_reads_(Channels) const float* pVolumes, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetChannelVolumes + // DESCRIPTION: Returns this voice's current per-channel volume levels. + // + // ARGUMENTS: + // Channels - Used to confirm the voice's channel count. + // pVolumes - Returns an array of the current per-channel volume levels. + */\ + STDMETHOD_(void, GetChannelVolumes) (THIS_ UINT32 Channels, _Out_writes_(Channels) float* pVolumes) PURE; \ + \ + /* NAME: IXAudio2Voice::SetOutputMatrix + // DESCRIPTION: Sets the volume levels used to mix from each channel of this + // voice's output audio to each channel of a given destination + // voice's input audio. + // + // ARGUMENTS: + // pDestinationVoice - The destination voice whose mix matrix to change. + // SourceChannels - Used to confirm this voice's output channel count + // (the number of channels produced by the last effect in the chain). + // DestinationChannels - Confirms the destination voice's input channels. + // pLevelMatrix - Array of [SourceChannels * DestinationChannels] send + // levels. The level used to send from source channel S to destination + // channel D should be in pLevelMatrix[S + SourceChannels * D]. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(SetOutputMatrix) (THIS_ _In_opt_ IXAudio2Voice* pDestinationVoice, \ + UINT32 SourceChannels, UINT32 DestinationChannels, \ + _In_reads_(SourceChannels * DestinationChannels) const float* pLevelMatrix, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetOutputMatrix + // DESCRIPTION: Obtains the volume levels used to send each channel of this + // voice's output audio to each channel of a given destination + // voice's input audio. + // + // ARGUMENTS: + // pDestinationVoice - The destination voice whose mix matrix to obtain. + // SourceChannels - Used to confirm this voice's output channel count + // (the number of channels produced by the last effect in the chain). + // DestinationChannels - Confirms the destination voice's input channels. + // pLevelMatrix - Array of send levels, as above. + */\ + STDMETHOD_(void, GetOutputMatrix) (THIS_ _In_opt_ IXAudio2Voice* pDestinationVoice, \ + UINT32 SourceChannels, UINT32 DestinationChannels, \ + _Out_writes_(SourceChannels * DestinationChannels) float* pLevelMatrix) PURE; \ + \ + /* NAME: IXAudio2Voice::DestroyVoice + // DESCRIPTION: Destroys this voice, stopping it if necessary and removing + // it from the XAudio2 graph. + */\ + STDMETHOD_(void, DestroyVoice) (THIS) PURE + + Declare_IXAudio2Voice_Methods(); +}; + + +/************************************************************************** + * + * IXAudio2SourceVoice: Source voice management interface. + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2SourceVoice +DECLARE_INTERFACE_(IXAudio2SourceVoice, IXAudio2Voice) +{ + // Methods from IXAudio2Voice base interface + Declare_IXAudio2Voice_Methods(); + + // NAME: IXAudio2SourceVoice::Start + // DESCRIPTION: Makes this voice start consuming and processing audio. + // + // ARGUMENTS: + // Flags - Flags controlling how the voice should be started. + // OperationSet - Used to identify this call as part of a deferred batch. + // + STDMETHOD(Start) (THIS_ UINT32 Flags X2DEFAULT(0), UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; + + // NAME: IXAudio2SourceVoice::Stop + // DESCRIPTION: Makes this voice stop consuming audio. + // + // ARGUMENTS: + // Flags - Flags controlling how the voice should be stopped. + // OperationSet - Used to identify this call as part of a deferred batch. + // + STDMETHOD(Stop) (THIS_ UINT32 Flags X2DEFAULT(0), UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; + + // NAME: IXAudio2SourceVoice::SubmitSourceBuffer + // DESCRIPTION: Adds a new audio buffer to this voice's input queue. + // + // ARGUMENTS: + // pBuffer - Pointer to the buffer structure to be queued. + // pBufferWMA - Additional structure used only when submitting XWMA data. + // + STDMETHOD(SubmitSourceBuffer) (THIS_ _In_ const XAUDIO2_BUFFER* pBuffer, _In_opt_ const XAUDIO2_BUFFER_WMA* pBufferWMA X2DEFAULT(NULL)) PURE; + + // NAME: IXAudio2SourceVoice::FlushSourceBuffers + // DESCRIPTION: Removes all pending audio buffers from this voice's queue. + // + STDMETHOD(FlushSourceBuffers) (THIS) PURE; + + // NAME: IXAudio2SourceVoice::Discontinuity + // DESCRIPTION: Notifies the voice of an intentional break in the stream of + // audio buffers (e.g. the end of a sound), to prevent XAudio2 + // from interpreting an empty buffer queue as a glitch. + // + STDMETHOD(Discontinuity) (THIS) PURE; + + // NAME: IXAudio2SourceVoice::ExitLoop + // DESCRIPTION: Breaks out of the current loop when its end is reached. + // + // ARGUMENTS: + // OperationSet - Used to identify this call as part of a deferred batch. + // + STDMETHOD(ExitLoop) (THIS_ UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; + + // NAME: IXAudio2SourceVoice::GetState + // DESCRIPTION: Returns the number of buffers currently queued on this voice, + // the pContext value associated with the currently processing + // buffer (if any), and other voice state information. + // + // ARGUMENTS: + // pVoiceState - Returns the state information. + // Flags - Flags controlling what voice state is returned. + // + STDMETHOD_(void, GetState) (THIS_ _Out_ XAUDIO2_VOICE_STATE* pVoiceState, UINT32 Flags X2DEFAULT(0)) PURE; + + // NAME: IXAudio2SourceVoice::SetFrequencyRatio + // DESCRIPTION: Sets this voice's frequency adjustment, i.e. its pitch. + // + // ARGUMENTS: + // Ratio - Frequency change, expressed as source frequency / target frequency. + // OperationSet - Used to identify this call as part of a deferred batch. + // + STDMETHOD(SetFrequencyRatio) (THIS_ float Ratio, + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; + + // NAME: IXAudio2SourceVoice::GetFrequencyRatio + // DESCRIPTION: Returns this voice's current frequency adjustment ratio. + // + // ARGUMENTS: + // pRatio - Returns the frequency adjustment. + // + STDMETHOD_(void, GetFrequencyRatio) (THIS_ _Out_ float* pRatio) PURE; + + // NAME: IXAudio2SourceVoice::SetSourceSampleRate + // DESCRIPTION: Reconfigures this voice to treat its source data as being + // at a different sample rate than the original one specified + // in CreateSourceVoice's pSourceFormat argument. + // + // ARGUMENTS: + // UINT32 - The intended sample rate of further submitted source data. + // + STDMETHOD(SetSourceSampleRate) (THIS_ UINT32 NewSourceSampleRate) PURE; +}; + + +/************************************************************************** + * + * IXAudio2SubmixVoice: Submixing voice management interface. + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2SubmixVoice +DECLARE_INTERFACE_(IXAudio2SubmixVoice, IXAudio2Voice) +{ + // Methods from IXAudio2Voice base interface + Declare_IXAudio2Voice_Methods(); + + // There are currently no methods specific to submix voices. +}; + + +/************************************************************************** + * + * IXAudio2MasteringVoice: Mastering voice management interface. + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2MasteringVoice +DECLARE_INTERFACE_(IXAudio2MasteringVoice, IXAudio2Voice) +{ + // Methods from IXAudio2Voice base interface + Declare_IXAudio2Voice_Methods(); + + // NAME: IXAudio2MasteringVoice::GetChannelMask + // DESCRIPTION: Returns the channel mask for this voice + // + // ARGUMENTS: + // pChannelMask - returns the channel mask for this voice. This corresponds + // to the dwChannelMask member of WAVEFORMATEXTENSIBLE. + // + STDMETHOD(GetChannelMask) (THIS_ _Out_ DWORD* pChannelmask) PURE; +}; + + +/************************************************************************** + * + * IXAudio2EngineCallback: Client notification interface for engine events. + * + * REMARKS: Contains methods to notify the client when certain events happen + * in the XAudio2 engine. This interface should be implemented by + * the client. XAudio2 will call these methods via the interface + * pointer provided by the client when it calls + * IXAudio2::RegisterForCallbacks. + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2EngineCallback +DECLARE_INTERFACE(IXAudio2EngineCallback) +{ + // Called by XAudio2 just before an audio processing pass begins. + STDMETHOD_(void, OnProcessingPassStart) (THIS) PURE; + + // Called just after an audio processing pass ends. + STDMETHOD_(void, OnProcessingPassEnd) (THIS) PURE; + + // Called in the event of a critical system error which requires XAudio2 + // to be closed down and restarted. The error code is given in Error. + STDMETHOD_(void, OnCriticalError) (THIS_ HRESULT Error) PURE; +}; + + +/************************************************************************** + * + * IXAudio2VoiceCallback: Client notification interface for voice events. + * + * REMARKS: Contains methods to notify the client when certain events happen + * in an XAudio2 voice. This interface should be implemented by the + * client. XAudio2 will call these methods via an interface pointer + * provided by the client in the IXAudio2::CreateSourceVoice call. + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2VoiceCallback +DECLARE_INTERFACE(IXAudio2VoiceCallback) +{ + // Called just before this voice's processing pass begins. + STDMETHOD_(void, OnVoiceProcessingPassStart) (THIS_ UINT32 BytesRequired) PURE; + + // Called just after this voice's processing pass ends. + STDMETHOD_(void, OnVoiceProcessingPassEnd) (THIS) PURE; + + // Called when this voice has just finished playing a buffer stream + // (as marked with the XAUDIO2_END_OF_STREAM flag on the last buffer). + STDMETHOD_(void, OnStreamEnd) (THIS) PURE; + + // Called when this voice is about to start processing a new buffer. + STDMETHOD_(void, OnBufferStart) (THIS_ void* pBufferContext) PURE; + + // Called when this voice has just finished processing a buffer. + // The buffer can now be reused or destroyed. + STDMETHOD_(void, OnBufferEnd) (THIS_ void* pBufferContext) PURE; + + // Called when this voice has just reached the end position of a loop. + STDMETHOD_(void, OnLoopEnd) (THIS_ void* pBufferContext) PURE; + + // Called in the event of a critical error during voice processing, + // such as a failing xAPO or an error from the hardware XMA decoder. + // The voice may have to be destroyed and re-created to recover from + // the error. The callback arguments report which buffer was being + // processed when the error occurred, and its HRESULT code. + STDMETHOD_(void, OnVoiceError) (THIS_ void* pBufferContext, HRESULT Error) PURE; +}; + + +/************************************************************************** + * + * Macros to make it easier to use the XAudio2 COM interfaces in C code. + * + **************************************************************************/ + +#ifndef __cplusplus + + // IXAudio2 +#define IXAudio2_QueryInterface(This,riid,ppvInterface) ((This)->lpVtbl->QueryInterface(This,riid,ppvInterface)) +#define IXAudio2_AddRef(This) ((This)->lpVtbl->AddRef(This)) +#define IXAudio2_Release(This) ((This)->lpVtbl->Release(This)) +#define IXAudio2_CreateSourceVoice(This,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) ((This)->lpVtbl->CreateSourceVoice(This,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain)) +#define IXAudio2_CreateSubmixVoice(This,ppSubmixVoice,InputChannels,InputSampleRate,Flags,ProcessingStage,pSendList,pEffectChain) ((This)->lpVtbl->CreateSubmixVoice(This,ppSubmixVoice,InputChannels,InputSampleRate,Flags,ProcessingStage,pSendList,pEffectChain)) +#define IXAudio2_CreateMasteringVoice(This,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceId,pEffectChain,StreamCategory) ((This)->lpVtbl->CreateMasteringVoice(This,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceId,pEffectChain,StreamCategory)) +#define IXAudio2_StartEngine(This) ((This)->lpVtbl->StartEngine(This)) +#define IXAudio2_StopEngine(This) ((This)->lpVtbl->StopEngine(This)) +#define IXAudio2_CommitChanges(This,OperationSet) ((This)->lpVtbl->CommitChanges(This,OperationSet)) +#define IXAudio2_GetPerformanceData(This,pPerfData) ((This)->lpVtbl->GetPerformanceData(This,pPerfData)) +#define IXAudio2_SetDebugConfiguration(This,pDebugConfiguration,pReserved) ((This)->lpVtbl->SetDebugConfiguration(This,pDebugConfiguration,pReserved)) + +// IXAudio2Voice +#define IXAudio2Voice_GetVoiceDetails(This,pVoiceDetails) ((This)->lpVtbl->GetVoiceDetails(This,pVoiceDetails)) +#define IXAudio2Voice_SetOutputVoices(This,pSendList) ((This)->lpVtbl->SetOutputVoices(This,pSendList)) +#define IXAudio2Voice_SetEffectChain(This,pEffectChain) ((This)->lpVtbl->SetEffectChain(This,pEffectChain)) +#define IXAudio2Voice_EnableEffect(This,EffectIndex,OperationSet) ((This)->lpVtbl->EnableEffect(This,EffectIndex,OperationSet)) +#define IXAudio2Voice_DisableEffect(This,EffectIndex,OperationSet) ((This)->lpVtbl->DisableEffect(This,EffectIndex,OperationSet)) +#define IXAudio2Voice_GetEffectState(This,EffectIndex,pEnabled) ((This)->lpVtbl->GetEffectState(This,EffectIndex,pEnabled)) +#define IXAudio2Voice_SetEffectParameters(This,EffectIndex,pParameters,ParametersByteSize, OperationSet) ((This)->lpVtbl->SetEffectParameters(This,EffectIndex,pParameters,ParametersByteSize,OperationSet)) +#define IXAudio2Voice_GetEffectParameters(This,EffectIndex,pParameters,ParametersByteSize) ((This)->lpVtbl->GetEffectParameters(This,EffectIndex,pParameters,ParametersByteSize)) +#define IXAudio2Voice_SetFilterParameters(This,pParameters,OperationSet) ((This)->lpVtbl->SetFilterParameters(This,pParameters,OperationSet)) +#define IXAudio2Voice_GetFilterParameters(This,pParameters) ((This)->lpVtbl->GetFilterParameters(This,pParameters)) +#define IXAudio2Voice_SetOutputFilterParameters(This,pDestinationVoice,pParameters,OperationSet) ((This)->lpVtbl->SetOutputFilterParameters(This,pDestinationVoice,pParameters,OperationSet)) +#define IXAudio2Voice_GetOutputFilterParameters(This,pDestinationVoice,pParameters) ((This)->lpVtbl->GetOutputFilterParameters(This,pDestinationVoice,pParameters)) +#define IXAudio2Voice_SetVolume(This,Volume,OperationSet) ((This)->lpVtbl->SetVolume(This,Volume,OperationSet)) +#define IXAudio2Voice_GetVolume(This,pVolume) ((This)->lpVtbl->GetVolume(This,pVolume)) +#define IXAudio2Voice_SetChannelVolumes(This,Channels,pVolumes,OperationSet) ((This)->lpVtbl->SetChannelVolumes(This,Channels,pVolumes,OperationSet)) +#define IXAudio2Voice_GetChannelVolumes(This,Channels,pVolumes) ((This)->lpVtbl->GetChannelVolumes(This,Channels,pVolumes)) +#define IXAudio2Voice_SetOutputMatrix(This,pDestinationVoice,SourceChannels,DestinationChannels,pLevelMatrix,OperationSet) ((This)->lpVtbl->SetOutputMatrix(This,pDestinationVoice,SourceChannels,DestinationChannels,pLevelMatrix,OperationSet)) +#define IXAudio2Voice_GetOutputMatrix(This,pDestinationVoice,SourceChannels,DestinationChannels,pLevelMatrix) ((This)->lpVtbl->GetOutputMatrix(This,pDestinationVoice,SourceChannels,DestinationChannels,pLevelMatrix)) +#define IXAudio2Voice_DestroyVoice(This) ((This)->lpVtbl->DestroyVoice(This)) + +// IXAudio2SourceVoice +#define IXAudio2SourceVoice_GetVoiceDetails IXAudio2Voice_GetVoiceDetails +#define IXAudio2SourceVoice_SetOutputVoices IXAudio2Voice_SetOutputVoices +#define IXAudio2SourceVoice_SetEffectChain IXAudio2Voice_SetEffectChain +#define IXAudio2SourceVoice_EnableEffect IXAudio2Voice_EnableEffect +#define IXAudio2SourceVoice_DisableEffect IXAudio2Voice_DisableEffect +#define IXAudio2SourceVoice_GetEffectState IXAudio2Voice_GetEffectState +#define IXAudio2SourceVoice_SetEffectParameters IXAudio2Voice_SetEffectParameters +#define IXAudio2SourceVoice_GetEffectParameters IXAudio2Voice_GetEffectParameters +#define IXAudio2SourceVoice_SetFilterParameters IXAudio2Voice_SetFilterParameters +#define IXAudio2SourceVoice_GetFilterParameters IXAudio2Voice_GetFilterParameters +#define IXAudio2SourceVoice_SetOutputFilterParameters IXAudio2Voice_SetOutputFilterParameters +#define IXAudio2SourceVoice_GetOutputFilterParameters IXAudio2Voice_GetOutputFilterParameters +#define IXAudio2SourceVoice_SetVolume IXAudio2Voice_SetVolume +#define IXAudio2SourceVoice_GetVolume IXAudio2Voice_GetVolume +#define IXAudio2SourceVoice_SetChannelVolumes IXAudio2Voice_SetChannelVolumes +#define IXAudio2SourceVoice_GetChannelVolumes IXAudio2Voice_GetChannelVolumes +#define IXAudio2SourceVoice_SetOutputMatrix IXAudio2Voice_SetOutputMatrix +#define IXAudio2SourceVoice_GetOutputMatrix IXAudio2Voice_GetOutputMatrix +#define IXAudio2SourceVoice_DestroyVoice IXAudio2Voice_DestroyVoice +#define IXAudio2SourceVoice_Start(This,Flags,OperationSet) ((This)->lpVtbl->Start(This,Flags,OperationSet)) +#define IXAudio2SourceVoice_Stop(This,Flags,OperationSet) ((This)->lpVtbl->Stop(This,Flags,OperationSet)) +#define IXAudio2SourceVoice_SubmitSourceBuffer(This,pBuffer,pBufferWMA) ((This)->lpVtbl->SubmitSourceBuffer(This,pBuffer,pBufferWMA)) +#define IXAudio2SourceVoice_FlushSourceBuffers(This) ((This)->lpVtbl->FlushSourceBuffers(This)) +#define IXAudio2SourceVoice_Discontinuity(This) ((This)->lpVtbl->Discontinuity(This)) +#define IXAudio2SourceVoice_ExitLoop(This,OperationSet) ((This)->lpVtbl->ExitLoop(This,OperationSet)) +#define IXAudio2SourceVoice_GetState(This,pVoiceState,Flags) ((This)->lpVtbl->GetState(This,pVoiceState,Flags)) +#define IXAudio2SourceVoice_SetFrequencyRatio(This,Ratio,OperationSet) ((This)->lpVtbl->SetFrequencyRatio(This,Ratio,OperationSet)) +#define IXAudio2SourceVoice_GetFrequencyRatio(This,pRatio) ((This)->lpVtbl->GetFrequencyRatio(This,pRatio)) +#define IXAudio2SourceVoice_SetSourceSampleRate(This,NewSourceSampleRate) ((This)->lpVtbl->SetSourceSampleRate(This,NewSourceSampleRate)) + +// IXAudio2SubmixVoice +#define IXAudio2SubmixVoice_GetVoiceDetails IXAudio2Voice_GetVoiceDetails +#define IXAudio2SubmixVoice_SetOutputVoices IXAudio2Voice_SetOutputVoices +#define IXAudio2SubmixVoice_SetEffectChain IXAudio2Voice_SetEffectChain +#define IXAudio2SubmixVoice_EnableEffect IXAudio2Voice_EnableEffect +#define IXAudio2SubmixVoice_DisableEffect IXAudio2Voice_DisableEffect +#define IXAudio2SubmixVoice_GetEffectState IXAudio2Voice_GetEffectState +#define IXAudio2SubmixVoice_SetEffectParameters IXAudio2Voice_SetEffectParameters +#define IXAudio2SubmixVoice_GetEffectParameters IXAudio2Voice_GetEffectParameters +#define IXAudio2SubmixVoice_SetFilterParameters IXAudio2Voice_SetFilterParameters +#define IXAudio2SubmixVoice_GetFilterParameters IXAudio2Voice_GetFilterParameters +#define IXAudio2SubmixVoice_SetOutputFilterParameters IXAudio2Voice_SetOutputFilterParameters +#define IXAudio2SubmixVoice_GetOutputFilterParameters IXAudio2Voice_GetOutputFilterParameters +#define IXAudio2SubmixVoice_SetVolume IXAudio2Voice_SetVolume +#define IXAudio2SubmixVoice_GetVolume IXAudio2Voice_GetVolume +#define IXAudio2SubmixVoice_SetChannelVolumes IXAudio2Voice_SetChannelVolumes +#define IXAudio2SubmixVoice_GetChannelVolumes IXAudio2Voice_GetChannelVolumes +#define IXAudio2SubmixVoice_SetOutputMatrix IXAudio2Voice_SetOutputMatrix +#define IXAudio2SubmixVoice_GetOutputMatrix IXAudio2Voice_GetOutputMatrix +#define IXAudio2SubmixVoice_DestroyVoice IXAudio2Voice_DestroyVoice + +/* IXAudio2MasteringVoice */ +#define IXAudio2MasteringVoice_GetVoiceDetails IXAudio2Voice_GetVoiceDetails +#define IXAudio2MasteringVoice_SetOutputVoices IXAudio2Voice_SetOutputVoices +#define IXAudio2MasteringVoice_SetEffectChain IXAudio2Voice_SetEffectChain +#define IXAudio2MasteringVoice_EnableEffect IXAudio2Voice_EnableEffect +#define IXAudio2MasteringVoice_DisableEffect IXAudio2Voice_DisableEffect +#define IXAudio2MasteringVoice_GetEffectState IXAudio2Voice_GetEffectState +#define IXAudio2MasteringVoice_SetEffectParameters IXAudio2Voice_SetEffectParameters +#define IXAudio2MasteringVoice_GetEffectParameters IXAudio2Voice_GetEffectParameters +#define IXAudio2MasteringVoice_SetFilterParameters IXAudio2Voice_SetFilterParameters +#define IXAudio2MasteringVoice_GetFilterParameters IXAudio2Voice_GetFilterParameters +#define IXAudio2MasteringVoice_SetOutputFilterParameters IXAudio2Voice_SetOutputFilterParameters +#define IXAudio2MasteringVoice_GetOutputFilterParameters IXAudio2Voice_GetOutputFilterParameters +#define IXAudio2MasteringVoice_SetVolume IXAudio2Voice_SetVolume +#define IXAudio2MasteringVoice_GetVolume IXAudio2Voice_GetVolume +#define IXAudio2MasteringVoice_SetChannelVolumes IXAudio2Voice_SetChannelVolumes +#define IXAudio2MasteringVoice_GetChannelVolumes IXAudio2Voice_GetChannelVolumes +#define IXAudio2MasteringVoice_SetOutputMatrix IXAudio2Voice_SetOutputMatrix +#define IXAudio2MasteringVoice_GetOutputMatrix IXAudio2Voice_GetOutputMatrix +#define IXAudio2MasteringVoice_DestroyVoice IXAudio2Voice_DestroyVoice +#define IXAudio2MasteringVoice_GetChannelMask(This,pChannelMask) ((This)->lpVtbl->GetChannelMask(This,pChannelMask)) + +#endif /* #ifndef __cplusplus */ + + +/************************************************************************** + * + * Utility functions used to convert from pitch in semitones and volume + * in decibels to the frequency and amplitude ratio units used by XAudio2. + * These are only defined if the client #defines XAUDIO2_HELPER_FUNCTIONS + * prior to #including xaudio2.h. + * + **************************************************************************/ + +#ifdef XAUDIO2_HELPER_FUNCTIONS + +#define _USE_MATH_DEFINES /* Make math.h define M_PI */ +#include /* For powf, log10f, sinf and asinf */ + +/* Calculate the argument to SetVolume from a decibel value */ +static INLINE float XAudio2DecibelsToAmplitudeRatio(float Decibels) +{ + return powf(10.0f, Decibels / 20.0f); +} + +/* Recover a volume in decibels from an amplitude factor */ +static INLINE float XAudio2AmplitudeRatioToDecibels(float Volume) +{ + if (Volume == 0) + return -3.402823466e+38f; /* Smallest float value (-FLT_MAX) */ + return 20.0f * log10f(Volume); +} + +/* Calculate the argument to SetFrequencyRatio from a semitone value */ +static INLINE float XAudio2SemitonesToFrequencyRatio(float Semitones) +{ + /* FrequencyRatio = 2 ^ Octaves + * = 2 ^ (Semitones / 12) + */ + return powf(2.0f, Semitones / 12.0f); +} + +/* Recover a pitch in semitones from a frequency ratio */ +static INLINE float XAudio2FrequencyRatioToSemitones(float FrequencyRatio) +{ + /* Semitones = 12 * log2(FrequencyRatio) + * = 12 * log2(10) * log10(FrequencyRatio) + */ + return 39.86313713864835f * log10f(FrequencyRatio); +} + +/* Convert from filter cutoff frequencies expressed in Hertz to the radian + * frequency values used in XAUDIO2_FILTER_PARAMETERS.Frequency, state-variable + * filter types only. Use XAudio2CutoffFrequencyToOnePoleCoefficient() for one-pole filter types. + * Note that the highest CutoffFrequency supported is SampleRate/6. + * Higher values of CutoffFrequency will return XAUDIO2_MAX_FILTER_FREQUENCY. + */ +static INLINE float XAudio2CutoffFrequencyToRadians(float CutoffFrequency, UINT32 SampleRate) +{ + if ((UINT32)(CutoffFrequency * 6.0f) >= SampleRate) + return XAUDIO2_MAX_FILTER_FREQUENCY; + return 2.0f * sinf((float)M_PI * CutoffFrequency / SampleRate); +} + +/* Convert from radian frequencies back to absolute frequencies in Hertz */ +static INLINE float XAudio2RadiansToCutoffFrequency(float Radians, float SampleRate) +{ + return SampleRate * asinf(Radians / 2.0f) / (float)M_PI; +} + +/* Convert from filter cutoff frequencies expressed in Hertz to the filter + * coefficients used with XAUDIO2_FILTER_PARAMETERS.Frequency, + * LowPassOnePoleFilter and HighPassOnePoleFilter filter types only. + * Use XAudio2CutoffFrequencyToRadians() for state-variable filter types. + */ +static INLINE float XAudio2CutoffFrequencyToOnePoleCoefficient(float CutoffFrequency, UINT32 SampleRate) +{ + if ((UINT32)CutoffFrequency >= SampleRate) + return XAUDIO2_MAX_FILTER_FREQUENCY; + return (1.0f - powf(1.0f - 2.0f * CutoffFrequency / SampleRate, 2.0f)); +} + + +#endif // #ifdef XAUDIO2_HELPER_FUNCTIONS + + +/************************************************************************** + * + * XAudio2Create: Top-level function that creates an XAudio2 instance. + * + * ARGUMENTS: + * + * Flags - Flags specifying the XAudio2 object's behavior. + * + * XAudio2Processor - An XAUDIO2_PROCESSOR value that specifies the + * hardware threads (Xbox) or processors (Windows) that XAudio2 + * will use. Note that XAudio2 supports concurrent processing on + * multiple threads, using any combination of XAUDIO2_PROCESSOR + * flags. The values are platform-specific; platform-independent + * code can use XAUDIO2_DEFAULT_PROCESSOR to use the default on + * each platform. + * + **************************************************************************/ + +#ifdef __cplusplus__ + +#if (defined XAUDIO2_EXPORT) + /* We're building xaudio2.dll */ +#define XAUDIO2_STDAPI extern "C" __declspec(dllexport) HRESULT __stdcall +#else + /* We're an xaudio2 client */ +#define XAUDIO2_STDAPI extern "C" __declspec(dllimport) HRESULT __stdcall +#endif + +#else + + /* Modified for C support */ + +#if (defined XAUDIO2_EXPORT) + /* We're building xaudio2.dll */ +#define XAUDIO2_STDAPI __declspec(dllexport) HRESULT __stdcall +#else + /* We're an xaudio2 client */ +#define XAUDIO2_STDAPI __declspec(dllimport) HRESULT __stdcall +#endif + +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN10_RS5) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +XAUDIO2_STDAPI XAudio2CreateWithVersionInfo(_Outptr_ IXAudio2** ppXAudio2, + UINT32 Flags X2DEFAULT(0), + XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR), + DWORD ntddiVersion X2DEFAULT(NTDDI_VERSION)); + +static INLINE HRESULT XAudio2Create(_Outptr_ IXAudio2** ppXAudio2, + UINT32 Flags X2DEFAULT(0), + XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR)) +{ + /* When compiled for RS5 or later, try to invoke XAudio2CreateWithVersionInfo. + * Need to use LoadLibrary in case the app is running on an older OS. */ + typedef HRESULT(__stdcall *XAudio2CreateWithVersionInfoFunc)(_Outptr_ IXAudio2**, UINT32, XAUDIO2_PROCESSOR, DWORD); + typedef HRESULT(__stdcall *XAudio2CreateInfoFunc)(_Outptr_ IXAudio2**, UINT32, XAUDIO2_PROCESSOR); + + static HMODULE s_dllInstance = NULL; + static XAudio2CreateWithVersionInfoFunc s_pfnAudio2CreateWithVersion = NULL; + static XAudio2CreateInfoFunc s_pfnAudio2Create = NULL; + + if (s_dllInstance == NULL) + { + s_dllInstance = LoadLibraryEx(XAUDIO2_DLL, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); + if (s_dllInstance == NULL) + return HRESULT_FROM_WIN32(GetLastError()); + + s_pfnAudio2CreateWithVersion = (XAudio2CreateWithVersionInfoFunc)(void*)GetProcAddress(s_dllInstance, "XAudio2CreateWithVersionInfo"); + if (s_pfnAudio2CreateWithVersion == NULL) + { + s_pfnAudio2Create = (XAudio2CreateInfoFunc)(void*)GetProcAddress(s_dllInstance, "XAudio2Create"); + if (s_pfnAudio2Create == NULL) + return HRESULT_FROM_WIN32(GetLastError()); + } + } + + if (s_pfnAudio2CreateWithVersion != NULL) + return (*s_pfnAudio2CreateWithVersion)(ppXAudio2, Flags, XAudio2Processor, NTDDI_VERSION); + return (*s_pfnAudio2Create)(ppXAudio2, Flags, XAudio2Processor); +} +#else +/* RS4 or older, or not a desktop app */ +XAUDIO2_STDAPI XAudio2Create(_Outptr_ IXAudio2** ppXAudio2, UINT32 Flags X2DEFAULT(0), + XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR)); +#endif + +/* Undo the #pragma pack(push, 1) directive at the top of this file */ +#pragma pack(pop) + +#endif /* #ifndef GUID_DEFS_ONLY */ + +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_TV_APP | WINAPI_PARTITION_TV_TITLE) */ +#pragma endregion + +#endif /* #ifndef __XAUDIO2_INCLUDED__ */ diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index 18535b4232..916606adcc 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -3395,7 +3395,7 @@ found: *coro->settings->arrays.cheevos_password = '\0'; strncpy( coro->settings->arrays.cheevos_token, - cheevos_locals.token, sizeof(cheevos_locals.token) + cheevos_locals.token, sizeof(coro->settings->arrays.cheevos_token) ); CORO_RET(); } diff --git a/config.def.h b/config.def.h index b12a717149..b5a3a63b47 100644 --- a/config.def.h +++ b/config.def.h @@ -302,6 +302,7 @@ static bool quick_menu_show_save_content_dir_overrides = true; static bool kiosk_mode_enable = false; +static bool menu_horizontal_animation = true; static bool menu_show_online_updater = true; static bool menu_show_load_core = true; static bool menu_show_load_content = true; @@ -804,7 +805,23 @@ static char buildbot_server_url[] = "http://bot.libretro.com/nightly/apple/osx/x static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/apple/osx/ppc/latest/"; #endif #elif defined(_WIN32) && !defined(_XBOX) -#if _MSC_VER == 1600 +#if _MSC_VER >= 1910 +#ifndef __WINRT__ +#if defined(__x86_64__) || defined(_M_X64) +static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2017-desktop/x86_64/latest/"; +#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_IX86) || defined(_M_IA64) +static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2017-desktop/x86/latest/"; +#endif +#else +#if defined(__x86_64__) || defined(_M_X64) +static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2017-uwp/x86_64/latest/"; +#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_IX86) || defined(_M_IA64) +static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2017-uwp/x86/latest/"; +#elif defined(__arm__) || defined(_M_ARM) +static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2017-uwp/arm/latest/"; +#endif +#endif +#elif _MSC_VER == 1600 #if defined(__x86_64__) || defined(_M_X64) static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2010/x86_64/latest/"; #elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_IX86) || defined(_M_IA64) diff --git a/configuration.c b/configuration.c index 871a7cc7b6..d159e75c29 100644 --- a/configuration.c +++ b/configuration.c @@ -56,6 +56,10 @@ #include "record/record_driver.h" +#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#include "uwp/uwp_func.h" +#endif + static const char* invalid_filename_chars[] = { /* https://support.microsoft.com/en-us/help/905231/information-about-the-characters-that-you-cannot-use-in-site-names--fo */ "~", "#", "%", "&", "*", "{", "}", "\\", ":", "[", "]", "?", "/", "|", "\'", "\"", @@ -223,6 +227,7 @@ enum input_driver_enum INPUT_WII, INPUT_WIIU, INPUT_XINPUT, + INPUT_UWP, INPUT_UDEV, INPUT_LINUXRAW, INPUT_COCOA, @@ -319,6 +324,13 @@ static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_WII; static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_WIIU; #elif defined(XENON) static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_XENON360; +#elif defined(HAVE_D3D12) && false +/* FIXME: DX12 performance on Xbox is horrible for some reason, so use d3d11 as default */ +static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_D3D12; +#elif defined(HAVE_D3D11) +static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_D3D11; +#elif defined(HAVE_D3D10) +static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_D3D10; #elif defined(HAVE_D3D9) static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_D3D9; #elif defined(HAVE_D3D8) @@ -427,7 +439,9 @@ static enum midi_driver_enum MIDI_DEFAULT_DRIVER = MIDI_ALSA; static enum midi_driver_enum MIDI_DEFAULT_DRIVER = MIDI_NULL; #endif -#if defined(XENON) +#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +static enum input_driver_enum INPUT_DEFAULT_DRIVER = INPUT_UWP; +#elif defined(XENON) static enum input_driver_enum INPUT_DEFAULT_DRIVER = INPUT_XENON360; #elif defined(_XBOX360) || defined(_XBOX) || defined(HAVE_XINPUT2) || defined(HAVE_XINPUT_XBOX1) static enum input_driver_enum INPUT_DEFAULT_DRIVER = INPUT_XINPUT; @@ -857,6 +871,8 @@ const char *config_get_default_input(void) return "xenon360"; case INPUT_XINPUT: return "xinput"; + case INPUT_UWP: + return "uwp"; case INPUT_WII: return "gx"; case INPUT_WIIU: @@ -2221,8 +2237,13 @@ static config_file_t *open_default_config_file(void) (void)path_size; -#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) - fill_pathname_application_path(app_path, path_size); +#if defined(_WIN32) && !defined(_XBOX) +#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP + /* On UWP, the app install directory is not writable so use the writable LocalState dir instead */ + fill_pathname_home_dir(app_path, path_size); +#else + fill_pathname_application_dir(app_path, path_size); +#endif fill_pathname_resolve_relative(conf_path, app_path, file_path_str(FILE_PATH_MAIN_CONFIG), path_size); diff --git a/core_info.c b/core_info.c index d7ea70ed91..5a33e9f107 100644 --- a/core_info.c +++ b/core_info.c @@ -32,6 +32,10 @@ #include "core_info.h" #include "file_path_special.h" +#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#include "uwp/uwp_func.h" +#endif + static const char *core_info_tmp_path = NULL; static const struct string_list *core_info_tmp_list = NULL; static core_info_t *core_info_current = NULL; @@ -232,11 +236,31 @@ static core_info_list_t *core_info_list_new(const char *path, core_info_t *core_info = NULL; core_info_list_t *core_info_list = NULL; const char *path_basedir = libretro_info_dir; - struct string_list *contents = dir_list_new( - path, exts, - false, - show_hidden_files, - false, false); + struct string_list *contents = string_list_new(); + bool ok; + + ok = dir_list_append(contents, path, exts, + false, show_hidden_files, false, false); + +#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP + /* UWP: browse the optional packages for additional cores */ + struct string_list *core_packages = string_list_new(); + uwp_fill_installed_core_packages(core_packages); + for (i = 0; i < core_packages->size; i++) + { + dir_list_append(contents, core_packages->elems[i].data, exts, + false, show_hidden_files, false, false); + } + string_list_free(core_packages); +#else + /* Keep the old 'directory not found' behavior */ + if (!ok) + { + string_list_free(contents); + contents = NULL; + } +#endif + if (!contents) return NULL; @@ -430,12 +454,12 @@ static core_info_list_t *core_info_list_new(const char *path, core_info_list_resolve_all_firmware(core_info_list); } - dir_list_free(contents); + string_list_free(contents); return core_info_list; error: if (contents) - dir_list_free(contents); + string_list_free(contents); core_info_list_free(core_info_list); return NULL; } diff --git a/dist-scripts/dist-cores.sh b/dist-scripts/dist-cores.sh index bb0c8cb1c7..46bda5e8d8 100755 --- a/dist-scripts/dist-cores.sh +++ b/dist-scripts/dist-cores.sh @@ -18,6 +18,13 @@ cd .. LDFLAGS=-L. ./configure --disable-dynamic cd dist-scripts +elif [ $PLATFORM = "ps2" ] ; then +platform=ps2 +SALAMANDER=NO +EXT=a + +mkdir -p ../pkg/${platform}/cores/ + elif [ $PLATFORM = "psp1" ] ; then platform=psp1 SALAMANDER=yes @@ -230,7 +237,9 @@ for f in `ls -v *_${platform}.${EXT}`; do fi # Do manual executable step - if [ $PLATFORM = "dex-ps3" ] ; then + if [ $PLATFORM = "ps2" ] ; then + make -C ../ -f Makefile.${platform} package -j3 + elif [ $PLATFORM = "dex-ps3" ] ; then $MAKE_FSELF_NPDRM -c ../retroarch_${platform}.elf ../CORE.SELF elif [ $PLATFORM = "cex-ps3" ] ; then $SCETOOL_PATH $SCETOOL_FLAGS_CORE ../retroarch_${platform}.elf ../CORE.SELF @@ -253,6 +262,8 @@ for f in `ls -v *_${platform}.${EXT}`; do cp -fv ../../dist/info/"${name}_libretro.info" ../pkg/${platform}/SSNE10000/USRDIR/cores/info/"${name}_libretro.info" fi fi + elif [ $PLATFORM = "ps2" ] ; then + mv -f ../retroarchps2-release.elf ../pkg/${platform}/cores/retroarchps2_${name}.elf elif [ $PLATFORM = "psp1" ] ; then mv -f ../EBOOT.PBP ../pkg/${platform}/cores/${name}_libretro.PBP elif [ $PLATFORM = "vita" ] ; then @@ -288,6 +299,8 @@ for f in `ls -v *_${platform}.${EXT}`; do # Remove executable files if [ $platform = "ps3" ] ; then rm -f ../retroarch_${platform}.elf ../retroarch_${platform}.self ../CORE.SELF + elif [ $PLATFORM = "ps2" ] ; then + rm -f ../retroarchps2.elf elif [ $PLATFORM = "psp1" ] ; then rm -f ../retroarchpsp.elf elif [ $PLATFORM = "vita" ] ; then diff --git a/dynamic.c b/dynamic.c index 049aad7883..cbe706c79a 100644 --- a/dynamic.c +++ b/dynamic.c @@ -306,6 +306,9 @@ static void libretro_get_environment_info(void (*func)(retro_environment_t), static bool load_dynamic_core(void) { +#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP + /* Can't lookup symbols in itself on UWP */ +#else function_t sym = dylib_proc(NULL, "retro_init"); if (sym) @@ -319,6 +322,7 @@ static bool load_dynamic_core(void) RARCH_ERR("Proceeding could cause a crash. Aborting ...\n"); retroarch_fail(1, "init_libretro_sym()"); } +#endif if (string_is_empty(path_get(RARCH_PATH_CORE))) { @@ -1468,8 +1472,8 @@ bool rarch_environment_cb(unsigned cmd, void *data) { memcpy(hwr, cb, offsetof(struct retro_hw_render_callback, stencil)); - memset(hwr + offsetof(struct retro_hw_render_callback, stencil), - 0, sizeof(*cb) - offsetof(struct retro_hw_render_callback, stencil)); + memset((uint8_t*)hwr + offsetof(struct retro_hw_render_callback, stencil), + 0, sizeof(*cb) - offsetof(struct retro_hw_render_callback, stencil)); } else memcpy(hwr, cb, sizeof(*cb)); diff --git a/frontend/drivers/platform_gx.c b/frontend/drivers/platform_gx.c index f7462e0966..ff0c1e77d5 100644 --- a/frontend/drivers/platform_gx.c +++ b/frontend/drivers/platform_gx.c @@ -209,7 +209,21 @@ static void frontend_gx_get_environment_settings( chdir("carda:/retroarch"); #endif getcwd(g_defaults.dirs[DEFAULT_DIR_CORE], PATH_MAX_LENGTH); - +#if defined(HW_RVL) && !defined(IS_SALAMANDER) + /* When using external loaders(Wiiflow etc.), getcwd doesn't return the path correctly and + * as a result the cfg file is not found. */ + if (*argc > 2 && argv[1] != NULL && argv[2] != NULL) + { + if(gx_devices[GX_DEVICE_SD].mounted) + { + chdir("sd:/"); + } + else if(gx_devices[GX_DEVICE_USB].mounted) + { + chdir("usb:/"); + } + } +#endif last_slash = strrchr(g_defaults.dirs[DEFAULT_DIR_CORE], '/'); if (last_slash) *last_slash = 0; diff --git a/frontend/drivers/platform_orbis.c b/frontend/drivers/platform_orbis.c new file mode 100644 index 0000000000..217dca1c04 --- /dev/null +++ b/frontend/drivers/platform_orbis.c @@ -0,0 +1,353 @@ +/* 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- + * 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 +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#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 "../../retroarch.h" +#include "../../paths.h" +#include "../../verbosity.h" + +typedef struct OrbisGlobalConf +{ + Orbis2dConfig *conf; + OrbisPadConfig *confPad; + OrbisAudioConfig *confAudio; + OrbisKeyboardConfig *confKeyboard; + ps4LinkConfiguration *confLink; + int orbisLinkFlag; +}OrbisGlobalConf; + +OrbisGlobalConf *myConf; + +char eboot_path[512]; +char user_path[512]; + +static enum frontend_fork orbis_fork_mode = FRONTEND_FORK_NONE; + +#ifdef __cplusplus +extern "C" +#endif +int main(int argc, char *argv[]) +{ + int ret; + + sceSystemServiceHideSplashScreen(); + + + uintptr_t intptr=0; + sscanf(argv[1],"%p",&intptr); + myConf=(OrbisGlobalConf *)intptr; + ret=ps4LinkInitWithConf(myConf->confLink); + if(!ret) + { + ps4LinkFinish(); + return -1; + } + + return rarch_main(argc, argv, NULL); +} + +static void frontend_orbis_get_environment_settings(int *argc, char *argv[], + void *args, void *params_data) +{ + unsigned i; + struct rarch_main_wrap *params = NULL; + + (void)args; + +#ifndef IS_SALAMANDER +#if defined(HAVE_LOGGER) + logger_init(); +#elif defined(HAVE_FILE_LOGGER) + retro_main_log_file_init("host0:/temp/retroarch-log.txt"); +#endif +#endif + + strlcpy(eboot_path, "host0:/", sizeof(eboot_path)); + strlcpy(g_defaults.dirs[DEFAULT_DIR_PORT], eboot_path, sizeof(g_defaults.dirs[DEFAULT_DIR_PORT])); + strlcpy(user_path, "host0:/data/retroarch/", sizeof(user_path)); + + RARCH_LOG("port dir: [%s]\n", g_defaults.dirs[DEFAULT_DIR_PORT]); + + /* bundle data*/ + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], g_defaults.dirs[DEFAULT_DIR_PORT], + "", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], g_defaults.dirs[DEFAULT_DIR_PORT], + "info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO])); + /* user data*/ + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], user_path, + "assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], user_path, + "database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR], user_path, + "database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], user_path, + "cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], user_path, + "config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], user_path, + "downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST], user_path, + "playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP], user_path, + "remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM], user_path, + "savefiles", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE], user_path, + "savestates", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM], user_path, + "system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CACHE], user_path, + "temp", sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], user_path, + "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS], user_path, + "thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS])); + strlcpy(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY], + user_path, sizeof(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY])); + fill_pathname_join(g_defaults.path.config, user_path, + file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); + +#ifndef IS_SALAMANDER + params = (struct rarch_main_wrap*)params_data; + params->verbose = true; + + if (!string_is_empty(argv[1])) + { + static char path[PATH_MAX_LENGTH] = {0}; + struct rarch_main_wrap *args = + (struct rarch_main_wrap*)params_data; + + if (args) + { + strlcpy(path, argv[1], sizeof(path)); + + args->touched = true; + args->no_content = false; + args->verbose = false; + args->config_path = NULL; + args->sram_path = NULL; + args->state_path = NULL; + args->content_path = path; + args->libretro_path = NULL; + + RARCH_LOG("argv[0]: %s\n", argv[0]); + RARCH_LOG("argv[1]: %s\n", argv[1]); + RARCH_LOG("argv[2]: %s\n", argv[2]); + + RARCH_LOG("Auto-start game %s.\n", argv[1]); + } + } +#endif + + for (i = 0; i < DEFAULT_DIR_LAST; i++) + { + const char *dir_path = g_defaults.dirs[i]; + if (!string_is_empty(dir_path)) + path_mkdir(dir_path); + } +} + +static void frontend_orbis_deinit(void *data) +{ + (void)data; +#ifndef IS_SALAMANDER + verbosity_disable(); +#ifdef HAVE_FILE_LOGGER + command_event(CMD_EVENT_LOG_FILE_DEINIT, NULL); +#endif + +#endif + ps4LinkFinish(); +} + +static void frontend_orbis_shutdown(bool unused) +{ + (void)unused; + return; +} + + +static void frontend_orbis_init(void *data) +{ + +} + +static void frontend_orbis_exec(const char *path, bool should_load_game) +{ + char argp[512] = {0}; + int args = 0; + +#ifndef IS_SALAMANDER + if (should_load_game && !path_is_empty(RARCH_PATH_CONTENT)) + { + argp[args] = '\0'; + strlcat(argp + args, path_get(RARCH_PATH_CONTENT), sizeof(argp) - args); + args += strlen(argp + args) + 1; + } +#endif + + RARCH_LOG("Attempt to load executable: [%s].\n", path); + RARCH_LOG("Attempt to load executable: %d [%s].\n", args, argp); + //int ret = sceAppMgrLoadExec(path, args==0? NULL : (char * const*)((const char*[]){argp, 0}), NULL); + //RARCH_LOG("Attempt to load executable: [%d].\n", ret); + +} + +#ifndef IS_SALAMANDER +static bool frontend_orbis_set_fork(enum frontend_fork fork_mode) +{ + switch (fork_mode) + { + case FRONTEND_FORK_CORE: + RARCH_LOG("FRONTEND_FORK_CORE\n"); + orbis_fork_mode = fork_mode; + break; + case FRONTEND_FORK_CORE_WITH_ARGS: + RARCH_LOG("FRONTEND_FORK_CORE_WITH_ARGS\n"); + orbis_fork_mode = fork_mode; + break; + case FRONTEND_FORK_RESTART: + RARCH_LOG("FRONTEND_FORK_RESTART\n"); + /* NOTE: We don't implement Salamander, so just turn + * this into FRONTEND_FORK_CORE. */ + orbis_fork_mode = FRONTEND_FORK_CORE; + break; + case FRONTEND_FORK_NONE: + default: + return false; + } + + return true; +} +#endif + +static void frontend_orbis_exitspawn(char *s, size_t len) +{ + bool should_load_game = false; +#ifndef IS_SALAMANDER + if (orbis_fork_mode == FRONTEND_FORK_NONE) + return; + + switch (orbis_fork_mode) + { + case FRONTEND_FORK_CORE_WITH_ARGS: + should_load_game = true; + break; + case FRONTEND_FORK_NONE: + default: + break; + } +#endif + frontend_orbis_exec(s, should_load_game); +} + +static int frontend_orbis_get_rating(void) +{ + return 6; /* Go with a conservative figure for now. */ +} + +enum frontend_architecture frontend_orbis_get_architecture(void) +{ + return FRONTEND_ARCH_X86_64; +} + +static int frontend_orbis_parse_drive_list(void *data, bool load_content) +{ +#ifndef IS_SALAMANDER + file_list_t *list = (file_list_t*)data; + enum msg_hash_enums enum_idx = load_content ? + MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR : + MSG_UNKNOWN; + + menu_entries_append_enum(list, + "app0", + msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR), + enum_idx, + FILE_TYPE_DIRECTORY, 0, 0); +#endif + return 0; + +} + +frontend_ctx_driver_t frontend_ctx_orbis = { + frontend_orbis_get_environment_settings, + frontend_orbis_init, + frontend_orbis_deinit, + frontend_orbis_exitspawn, + NULL, /* process_args */ + frontend_orbis_exec, +#ifdef IS_SALAMANDER + NULL, +#else + frontend_orbis_set_fork, +#endif + frontend_orbis_shutdown, + NULL, /* get_name */ + NULL, /* get_os */ + frontend_orbis_get_rating, + NULL, /* load_content */ + frontend_orbis_get_architecture, + NULL, + frontend_orbis_parse_drive_list, + NULL, /* get_mem_total */ + NULL, /* get_mem_free */ + NULL, /* install_signal_handler */ + NULL, /* get_sighandler_state */ + NULL, /* set_sighandler_state */ + NULL, /* destroy_sighandler_state */ + NULL, /* attach_console */ + NULL, /* detach_console */ + NULL, /* watch_path_for_changes */ + NULL, /* check_for_path_changes */ + NULL, /* set_sustained_performance_mode */ + "orbis", +}; diff --git a/frontend/drivers/platform_ps2.c b/frontend/drivers/platform_ps2.c index 93d389d889..68fddc12bb 100644 --- a/frontend/drivers/platform_ps2.c +++ b/frontend/drivers/platform_ps2.c @@ -1,6 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2010-2018 - Francisco Javier Trujillo Mata - fjtrujy * * RetroArch is free software: 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,12 +20,11 @@ #include #include #include -#include -#include #include #include #include #include +#include enum BootDeviceIDs{ @@ -74,6 +72,12 @@ extern unsigned int usbd_irx_size; extern unsigned char usbhdfsd_irx_start[]; extern unsigned int usbhdfsd_irx_size; +extern unsigned char mcman_irx_start[]; +extern unsigned int mcman_irx_size; + +extern unsigned char mcserv_irx_start[]; +extern unsigned int mcserv_irx_size; + static unsigned char HDDModulesLoaded=0; char eboot_path[512]; @@ -81,30 +85,47 @@ char user_path[512]; static enum frontend_fork ps2_fork_mode = FRONTEND_FORK_NONE; -//Only paths residing on "basic" devices (devices that don't require mounting) -//can be specified here, since this system doesn't perform mounting based on the path. +/* Only paths residing on "basic" devices + * (devices that don't require mounting) + * can be specified here, since this system + * doesn't perform mounting based on the path. + */ #define DEFAULT_PATH "mass:" -static int getBootDeviceID(char *path) { - int result = BOOT_DEVICE_HOST; +static int getBootDeviceID(char *path) +{ + if (!strncmp(path, "mc0:", 4)) + return BOOT_DEVICE_MC0; + else if (!strncmp(path, "mc1:", 4)) + return BOOT_DEVICE_MC1; + else if (!strncmp(path, "cdrom0:", 7)) + return BOOT_DEVICE_CDROM; + else if (!strncmp(path, "mass:", 5) || !strncmp(path, "mass0:", 6)) + return BOOT_DEVICE_MASS; + else if (!strncmp(path, "hdd:", 4) || !strncmp(path, "hdd0:", 5)) + return BOOT_DEVICE_HDD; + else if (!strncmp(path, "host", 4) && ((path[4]>='0' && path[4]<='9') || path[4]==':')) + return BOOT_DEVICE_HOST; + else + return BOOT_DEVICE_UNKNOWN; - if(!strncmp(path, "mc0:", 4)) result=BOOT_DEVICE_MC0; - else if(!strncmp(path, "mc1:", 4)) result=BOOT_DEVICE_MC1; - else if(!strncmp(path, "cdrom0:", 7)) result=BOOT_DEVICE_CDROM; - else if(!strncmp(path, "mass:", 5) || !strncmp(path, "mass0:", 6)) result=BOOT_DEVICE_MASS; - else if(!strncmp(path, "hdd:", 4) || !strncmp(path, "hdd0:", 5)) result=BOOT_DEVICE_HDD; - else if(!strncmp(path, "host", 4) && ((path[4]>='0' && path[4]<='9') || path[4]==':')) result=BOOT_DEVICE_HOST; - else result=BOOT_DEVICE_UNKNOWN; - - return result; + return BOOT_DEVICE_HOST; } -//HACK! If booting from a USB device, keep trying to open this program again until it succeeds. This will ensure that the emulator will be able to load its files. -static void waitUntilDeviceIsReady(const char *path) { +/* HACK! If booting from a USB device, keep trying to + * open this program again until it succeeds. + * + * This will ensure that the emulator will be able to load its files. + */ + +static void waitUntilDeviceIsReady(const char *path) +{ FILE *file; - while((file=fopen(path, "rb"))==NULL){ - //Wait for a while first, or the IOP will get swamped by requests from the EE. + while((file=fopen(path, "rb"))==NULL) + { + /* Wait for a while first, or the IOP + * will get swamped by requests from the EE. */ nopdelay(); nopdelay(); nopdelay(); @@ -118,47 +139,54 @@ static void waitUntilDeviceIsReady(const char *path) { fclose(file); } -void setPWDOnPFS(const char *FullCWD_path) { - int i; - char *path; - - path=NULL; - for(i=strlen(FullCWD_path); i>=0; i--){ /* Try to seperate the CWD from the path to this ELF. */ - if(FullCWD_path[i]==':'){ - if((path=malloc(i+6+2))!=NULL){ - strcpy(path, "pfs0:/"); - strncat(path, FullCWD_path, i+1); - path[i+1+6]='\0'; - } - break; - } - else if((FullCWD_path[i]=='\\')||(FullCWD_path[i]=='/')){ - if((path=malloc(i+6+1))!=NULL){ - strcpy(path, "pfs0:/"); - strncat(path, FullCWD_path, i); - path[i+6]='\0'; - } - break; - } - } - - if(path!=NULL){ - chdir(path); - free(path); - } +void setPWDOnPFS(const char *FullCWD_path) +{ + int i; + char *path=NULL; + for (i=strlen(FullCWD_path); i>=0; i--) + { + /* Try to seperate the CWD from the path to this ELF. */ + if (FullCWD_path[i]==':') + { + if ((path=malloc(i+6+2))!=NULL) + { + strcpy(path, "pfs0:/"); + strncat(path, FullCWD_path, i+1); + path[i+1+6]='\0'; + } + break; + } + else if ((FullCWD_path[i]=='\\')||(FullCWD_path[i]=='/')) + { + if ((path=malloc(i+6+1))!=NULL) + { + strcpy(path, "pfs0:/"); + strncat(path, FullCWD_path, i); + path[i+6]='\0'; + } + break; + } + } + + if (path!=NULL) + { + chdir(path); + free(path); + } } -static const char *getMountParams(const char *command, char *BlockDevice) { - const char *MountPath; +static const char *getMountParams(const char *command, char *BlockDevice) +{ int BlockDeviceNameLen; + const char *MountPath=NULL; - MountPath=NULL; - if(strlen(command)>6 && (MountPath=strchr(&command[5], ':'))!=NULL){ + if (strlen(command)>6 && (MountPath=strchr(&command[5], ':'))!=NULL) + { BlockDeviceNameLen=(unsigned int)MountPath-(unsigned int)command; strncpy(BlockDevice, command, BlockDeviceNameLen); BlockDevice[BlockDeviceNameLen]='\0'; - - MountPath++; //This is the location of the mount path; + + MountPath++; /* This is the location of the mount path; */ } return MountPath; @@ -166,13 +194,6 @@ static const char *getMountParams(const char *command, char *BlockDevice) { static void create_path_names(void) { -#ifndef IS_SALAMANDER -#if defined(HAVE_LOGGER) - -#elif defined(HAVE_FILE_LOGGER) - retro_main_log_file_init("ux0:/temp/retroarch-log.txt"); // It really depend from where we are executing this -#endif -#endif fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], g_defaults.dirs[DEFAULT_DIR_PORT], "CORES", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE])); @@ -212,14 +233,16 @@ static void create_path_names(void) static void poweroffCallback(void *arg) { - //Close all files and unmount all partitions. - //close(fd); +#if 0 + /* Close all files and unmount all partitions. */ + close(fd); - //If you use PFS, close all files and unmount all partitions. - //fileXioDevctl("pfs:", PDIOC_CLOSEALL, NULL, 0, NULL, 0) + /* If you use PFS, close all files and unmount all partitions. */ + fileXioDevctl("pfs:", PDIOC_CLOSEALL, NULL, 0, NULL, 0) - //Shut down DEV9, if you used it. - //while(fileXioDevctl("dev9x:", DDIOC_OFF, NULL, 0, NULL, 0) < 0){}; + /* Shut down DEV9, if you used it. */ + while(fileXioDevctl("dev9x:", DDIOC_OFF, NULL, 0, NULL, 0) < 0){}; +#endif printf("Shutdown!"); poweroffShutdown(); @@ -232,37 +255,39 @@ static void frontend_ps2_get_environment_settings(int *argc, char *argv[], const char *mountPoint; int bootDeviceID; - //TODO: I DONT KNOW YET, WHY IT CRASHES IF UNCOMENT THIS PART getcwd(cwd, sizeof(cwd)); bootDeviceID=getBootDeviceID(cwd); - //Mount the HDD partition, if required. - if(bootDeviceID==BOOT_DEVICE_HDD){ - /* Try not to adjust this unless you know what you are doing. The tricky part i keeping the NULL character in the middle of that argument list separated from the number 4. */ - static const char PS2HDD_args[]="-o\0""2"; - static const char PS2FS_args[]="-o\0""8"; - if(!HDDModulesLoaded){ - SifExecModuleBuffer(poweroff_irx_start, poweroff_irx_size, 0, NULL, NULL); - SifExecModuleBuffer(ps2dev9_irx_start, ps2dev9_irx_size, 0, NULL, NULL); - SifExecModuleBuffer(ps2atad_irx_start, ps2atad_irx_size, 0, NULL, NULL); - SifExecModuleBuffer(ps2hdd_irx_start, ps2hdd_irx_size, sizeof(PS2HDD_args), PS2HDD_args, NULL); - SifExecModuleBuffer(ps2fs_irx_start, ps2fs_irx_size, sizeof(PS2FS_args), PS2FS_args, NULL); - HDDModulesLoaded=1; - } - - //Attempt to mount the partition. - if((mountPoint=getMountParams(cwd, blockDevice))!=NULL && !strncmp(mountPoint, "pfs:", 4)){ + /* Mount the HDD partition, if required. */ + if (bootDeviceID==BOOT_DEVICE_HDD) + { + /* Try not to adjust this unless you know what you are doing. The tricky part i keeping the NULL character in the middle of that argument list separated from the number 4. */ + static const char PS2HDD_args[]="-o\0""2"; + static const char PS2FS_args[]="-o\0""8"; + + if (!HDDModulesLoaded) + { + SifExecModuleBuffer(poweroff_irx_start, poweroff_irx_size, 0, NULL, NULL); + SifExecModuleBuffer(ps2dev9_irx_start, ps2dev9_irx_size, 0, NULL, NULL); + SifExecModuleBuffer(ps2atad_irx_start, ps2atad_irx_size, 0, NULL, NULL); + SifExecModuleBuffer(ps2hdd_irx_start, ps2hdd_irx_size, sizeof(PS2HDD_args), PS2HDD_args, NULL); + SifExecModuleBuffer(ps2fs_irx_start, ps2fs_irx_size, sizeof(PS2FS_args), PS2FS_args, NULL); + HDDModulesLoaded=1; + } + + /* Attempt to mount the partition. */ + if ((mountPoint=getMountParams(cwd, blockDevice))!=NULL && !strncmp(mountPoint, "pfs:", 4)) + { fileXioMount("pfs0:", blockDevice, FIO_MT_RDWR); - + setPWDOnPFS(&mountPoint[4]); } - } else if(bootDeviceID==BOOT_DEVICE_CDROM){ - chdir(DEFAULT_PATH); - } else if(bootDeviceID==BOOT_DEVICE_MASS){ - waitUntilDeviceIsReady(argv[0]); - } else if (bootDeviceID==BOOT_DEVICE_UNKNOWN) { - } + else if (bootDeviceID==BOOT_DEVICE_CDROM) + chdir(DEFAULT_PATH); + else if (bootDeviceID==BOOT_DEVICE_MASS) + waitUntilDeviceIsReady(argv[0]); + else if (bootDeviceID==BOOT_DEVICE_UNKNOWN) { } create_path_names(); @@ -308,30 +333,47 @@ static void frontend_ps2_init(void *data) { SifInitRpc(0); #if !defined(DEBUG) - while(!SifIopReset(NULL, 0)){}; // Comment this line if you don't wanna debug the output + /* Comment this line if you don't wanna debug the output */ + while(!SifIopReset(NULL, 0)){}; #endif while(!SifIopSync()){}; SifInitRpc(0); sbv_patch_enable_lmb(); + /* Controllers */ + SifLoadModule("rom0:SIO2MAN", 0, NULL); + SifLoadModule("rom0:PADMAN", 0, NULL); + + /* I/O Files */ SifExecModuleBuffer(iomanX_irx_start, iomanX_irx_size, 0, NULL, NULL); SifExecModuleBuffer(fileXio_irx_start, fileXio_irx_size, 0, NULL, NULL); + + /* Memory Card */ + SifExecModuleBuffer(mcman_irx_start, mcman_irx_size, 0, NULL, NULL); + SifExecModuleBuffer(mcserv_irx_start, mcserv_irx_size, 0, NULL, NULL); - SifLoadModule("rom0:SIO2MAN", 0, NULL); - SifLoadModule("rom0:MCMAN", 0, NULL); - SifLoadModule("rom0:MCSERV", 0, NULL); - SifLoadModule("rom0:PADMAN", 0, NULL); - + /* USB */ SifExecModuleBuffer(usbd_irx_start, usbd_irx_size, 0, NULL, NULL); SifExecModuleBuffer(usbhdfsd_irx_start, usbhdfsd_irx_size, 0, NULL, NULL); + + /* Audio */ SifExecModuleBuffer(freesd_irx_start, freesd_irx_size, 0, NULL, NULL); SifExecModuleBuffer(audsrv_irx_start, audsrv_irx_size, 0, NULL, NULL); - fileXioInit(); - audsrv_init(); - SDL_Init(SDL_INIT_TIMER); + + /* Initializes audsrv library */ + if (audsrv_init()) + { + RARCH_ERR("audsrv library not initalizated\n"); + } + + +#if defined(HAVE_FILE_LOGGER) + retro_main_log_file_init("retroarch.log"); + verbosity_enable(); +#endif } static void frontend_ps2_deinit(void *data) @@ -369,7 +411,9 @@ static void frontend_ps2_exec(const char *path, bool should_load_game) #endif RARCH_LOG("Attempt to load executable: [%s].\n", path); - // exitspawn_kernel(path, args, argp); // I don't know what this is doing +#if 0 + exitspawn_kernel(path, args, argp); /* I don't know what this is doing */ +#endif #endif } @@ -424,7 +468,7 @@ static void frontend_ps2_exitspawn(char *core_path, size_t core_path_size) static void frontend_ps2_shutdown(bool unused) { poweroffInit(); - //Set callback function + /* Set callback function */ poweroffSetCallback(&poweroffCallback, NULL); } @@ -467,7 +511,7 @@ static int frontend_ps2_parse_drive_list(void *data, bool load_content) enum_idx, FILE_TYPE_DIRECTORY, 0, 0); menu_entries_append_enum(list, - "host:/", + "host:", msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR), enum_idx, FILE_TYPE_DIRECTORY, 0, 0); diff --git a/frontend/drivers/platform_unix.c b/frontend/drivers/platform_unix.c index ddce3cc9c0..440b336050 100644 --- a/frontend/drivers/platform_unix.c +++ b/frontend/drivers/platform_unix.c @@ -1562,8 +1562,6 @@ static void frontend_unix_get_env(int *argc, { fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], app_dir, "assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS])); - fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CACHE], app_dir, - "tmp", sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER], app_dir, "shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], app_dir, @@ -1628,6 +1626,10 @@ static void frontend_unix_get_env(int *argc, internal_storage_app_path, "cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CACHE], + internal_storage_app_path, "temp", + sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE])); + if(!string_is_empty(screenshot_dir) && test_permissions(screenshot_dir)) { @@ -1686,6 +1688,10 @@ static void frontend_unix_get_env(int *argc, app_dir, "cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CACHE], + app_dir, "temp", + sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE])); + if( !string_is_empty(screenshot_dir) && test_permissions(screenshot_dir)) { @@ -1749,6 +1755,10 @@ static void frontend_unix_get_env(int *argc, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], internal_storage_path, "RetroArch/cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS])); + + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CACHE], + internal_storage_path, "temp", + sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE])); default: break; } diff --git a/frontend/drivers/platform_uwp.c b/frontend/drivers/platform_uwp.c new file mode 100644 index 0000000000..5d09858726 --- /dev/null +++ b/frontend/drivers/platform_uwp.c @@ -0,0 +1,419 @@ +/* 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 +#include + +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include "../../config.h" +#endif + +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + +#include "../frontend_driver.h" +#include "../../configuration.h" +#include "../../defaults.h" +#include "../../retroarch.h" +#include "../../verbosity.h" +#include "../../ui/drivers/ui_win32.h" + +#include "../../uwp/uwp_func.h" + +static void frontend_uwp_get_os(char *s, size_t len, int *major, int *minor) +{ + char buildStr[11] = {0}; + bool server = false; + const char *arch = ""; + +#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0500 + /* Windows 2000 and later */ + SYSTEM_INFO si = {{0}}; + OSVERSIONINFOEX vi = {0}; + vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + + GetSystemInfo(&si); + + /* Available from NT 3.5 and Win95 */ + GetVersionEx((OSVERSIONINFO*)&vi); + + server = vi.wProductType != VER_NT_WORKSTATION; + + switch (si.wProcessorArchitecture) + { + case PROCESSOR_ARCHITECTURE_AMD64: + arch = "x64"; + break; + case PROCESSOR_ARCHITECTURE_INTEL: + arch = "x86"; + break; + case PROCESSOR_ARCHITECTURE_ARM: + arch = "ARM"; + break; + default: + break; + } +#else + OSVERSIONINFO vi = {0}; + vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + + /* Available from NT 3.5 and Win95 */ + GetVersionEx(&vi); +#endif + + + if (major) + *major = vi.dwMajorVersion; + + if (minor) + *minor = vi.dwMinorVersion; + + if (vi.dwMajorVersion == 4 && vi.dwMinorVersion == 0) + snprintf(buildStr, sizeof(buildStr), "%lu", (DWORD)(LOWORD(vi.dwBuildNumber))); /* Windows 95 build number is in the low-order word only */ + else + snprintf(buildStr, sizeof(buildStr), "%lu", vi.dwBuildNumber); + + switch (vi.dwMajorVersion) + { + case 10: + if (server) + strlcpy(s, "Windows Server 2016", len); + else + strlcpy(s, "Windows 10", len); + break; + case 6: + switch (vi.dwMinorVersion) + { + case 3: + if (server) + strlcpy(s, "Windows Server 2012 R2", len); + else + strlcpy(s, "Windows 8.1", len); + break; + case 2: + if (server) + strlcpy(s, "Windows Server 2012", len); + else + strlcpy(s, "Windows 8", len); + break; + case 1: + if (server) + strlcpy(s, "Windows Server 2008 R2", len); + else + strlcpy(s, "Windows 7", len); + break; + case 0: + if (server) + strlcpy(s, "Windows Server 2008", len); + else + strlcpy(s, "Windows Vista", len); + break; + default: + break; + } + break; + case 5: + switch (vi.dwMinorVersion) + { + case 2: + if (server) + strlcpy(s, "Windows Server 2003", len); + else + { + /* Yes, XP Pro x64 is a higher version number than XP x86 */ + if (string_is_equal(arch, "x64")) + strlcpy(s, "Windows XP", len); + } + break; + case 1: + strlcpy(s, "Windows XP", len); + break; + case 0: + strlcpy(s, "Windows 2000", len); + break; + } + break; + case 4: + switch (vi.dwMinorVersion) + { + case 0: + if (vi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) + strlcpy(s, "Windows 95", len); + else if (vi.dwPlatformId == VER_PLATFORM_WIN32_NT) + strlcpy(s, "Windows NT 4.0", len); + else + strlcpy(s, "Unknown", len); + break; + case 90: + strlcpy(s, "Windows ME", len); + break; + case 10: + strlcpy(s, "Windows 98", len); + break; + } + break; + default: + snprintf(s, len, "Windows %i.%i", *major, *minor); + break; + } + + if (!string_is_empty(arch)) + { + strlcat(s, " ", len); + strlcat(s, arch, len); + } + + strlcat(s, " Build ", len); + strlcat(s, buildStr, len); + + if (!string_is_empty(vi.szCSDVersion)) + { + strlcat(s, " ", len); + strlcat(s, vi.szCSDVersion, len); + } + + if (!string_is_empty(uwp_device_family)) + { + strlcat(s, " ", len); + strlcat(s, uwp_device_family, len); + } +} + +static void frontend_uwp_init(void *data) +{ +} + +enum frontend_powerstate frontend_uwp_get_powerstate( + int *seconds, int *percent) +{ + SYSTEM_POWER_STATUS status; + enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE; + + if (!GetSystemPowerStatus(&status)) + return ret; + + if (status.BatteryFlag == 0xFF) + ret = FRONTEND_POWERSTATE_NONE; + if (status.BatteryFlag & (1 << 7)) + ret = FRONTEND_POWERSTATE_NO_SOURCE; + else if (status.BatteryFlag & (1 << 3)) + ret = FRONTEND_POWERSTATE_CHARGING; + else if (status.ACLineStatus == 1) + ret = FRONTEND_POWERSTATE_CHARGED; + else + ret = FRONTEND_POWERSTATE_ON_POWER_SOURCE; + + *percent = (int)status.BatteryLifePercent; + *seconds = (int)status.BatteryLifeTime; + +#ifdef _WIN32 + if (*percent == 255) + *percent = 0; +#endif + return ret; +} + +enum frontend_architecture frontend_uwp_get_architecture(void) +{ +#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0500 + /* Windows 2000 and later */ + SYSTEM_INFO si = {{0}}; + + GetSystemInfo(&si); + + switch (si.wProcessorArchitecture) + { + case PROCESSOR_ARCHITECTURE_AMD64: + return FRONTEND_ARCH_X86_64; + break; + case PROCESSOR_ARCHITECTURE_INTEL: + return FRONTEND_ARCH_X86; + break; + case PROCESSOR_ARCHITECTURE_ARM: + return FRONTEND_ARCH_ARM; + break; + default: + break; + } +#endif + + return FRONTEND_ARCH_NONE; +} + +static int frontend_uwp_parse_drive_list(void *data, bool load_content) +{ +#ifdef HAVE_MENU + file_list_t *list = (file_list_t*)data; + enum msg_hash_enums enum_idx = load_content ? + MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR : + MSG_UNKNOWN; + /* TODO (krzys_h): UWP storage sandboxing */ + char *home_dir = (char*)malloc( + PATH_MAX_LENGTH * sizeof(char)); + + fill_pathname_home_dir(home_dir, + PATH_MAX_LENGTH * sizeof(char)); + + menu_entries_append_enum(list, + home_dir, + msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR), + enum_idx, + FILE_TYPE_DIRECTORY, 0, 0); + + free(home_dir); +#endif + + return 0; +} + +static void frontend_uwp_environment_get(int *argc, char *argv[], + void *args, void *params_data) +{ + /* On UWP, we have to use the writable directory + * instead of the install directory. */ + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_ASSETS], + "~\\assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER], + "~\\filters\\audio", sizeof(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER], + "~\\filters\\video", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CHEATS], + "~\\cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_DATABASE], + "~\\database\\rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CURSOR], + "~\\database\\cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_PLAYLIST], + "~\\playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_RECORD_CONFIG], + "~\\config\\record", sizeof(g_defaults.dirs[DEFAULT_DIR_RECORD_CONFIG])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_RECORD_OUTPUT], + "~\\recordings", sizeof(g_defaults.dirs[DEFAULT_DIR_RECORD_OUTPUT])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], + "~\\config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_REMAP], + "~\\config\\remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_WALLPAPERS], + "~\\assets\\wallpapers", sizeof(g_defaults.dirs[DEFAULT_DIR_WALLPAPERS])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS], + "~\\thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_OVERLAY], + "~\\overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + /* This one is an exception: cores have to be loaded from + * the install directory, + * since this is the only place UWP apps can take .dlls from */ + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CORE], + ":\\cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], + "~\\info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG], + "~\\autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SHADER], + "~\\shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], + "~\\downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT], + "~\\screenshots", sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SRAM], + "~\\saves", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SAVESTATE], + "~\\states", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SYSTEM], + "~\\system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM])); + +#ifdef HAVE_MENU +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) + snprintf(g_defaults.settings.menu, + sizeof(g_defaults.settings.menu), "xmb"); +#endif +#endif +} + +static uint64_t frontend_uwp_get_mem_total(void) +{ + /* OSes below 2000 don't have the Ex version, + * and non-Ex cannot work with >4GB RAM */ +#if _WIN32_WINNT >= 0x0500 + 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_uwp_get_mem_used(void) +{ + /* OSes below 2000 don't have the Ex version, + * and non-Ex cannot work with >4GB RAM */ +#if _WIN32_WINNT >= 0x0500 + MEMORYSTATUSEX mem_info; + mem_info.dwLength = sizeof(MEMORYSTATUSEX); + GlobalMemoryStatusEx(&mem_info); + return ((frontend_uwp_get_mem_total() - mem_info.ullAvailPhys)); +#else + MEMORYSTATUS mem_info; + mem_info.dwLength = sizeof(MEMORYSTATUS); + GlobalMemoryStatus(&mem_info); + return ((frontend_uwp_get_mem_total() - mem_info.dwAvailPhys)); +#endif +} + +frontend_ctx_driver_t frontend_ctx_uwp = { + frontend_uwp_environment_get, + frontend_uwp_init, + NULL, /* deinit */ + NULL, /* exitspawn */ + NULL, /* process_args */ + NULL, /* exec */ + NULL, /* set_fork */ + NULL, /* shutdown */ + NULL, /* get_name */ + frontend_uwp_get_os, + NULL, /* get_rating */ + NULL, /* load_content */ + frontend_uwp_get_architecture, + frontend_uwp_get_powerstate, + frontend_uwp_parse_drive_list, + frontend_uwp_get_mem_total, + frontend_uwp_get_mem_used, + NULL, /* install_signal_handler */ + NULL, /* get_sighandler_state */ + NULL, /* set_sighandler_state */ + NULL, /* destroy_sighandler_state */ + NULL, /* attach_console */ + NULL, /* detach_console */ + NULL, /* watch_path_for_changes */ + NULL, /* check_for_path_changes */ + NULL, /* set_sustained_performance_mode */ + "uwp" +}; diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index 59905c9884..9b24ca39c5 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -43,6 +43,10 @@ #include "../../verbosity.h" #include "../../ui/drivers/ui_win32.h" +#ifndef SM_SERVERR2 +#define SM_SERVERR2 89 +#endif + /* We only load this library once, so we let it be * unloaded at application shutdown, since unloading * it early seems to cause issues on some systems. @@ -151,7 +155,6 @@ static void frontend_win32_get_os(char *s, size_t len, int *major, int *minor) char buildStr[11] = {0}; bool server = false; const char *arch = ""; - bool serverR2 = false; #if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0500 /* Windows 2000 and later */ @@ -165,7 +168,6 @@ static void frontend_win32_get_os(char *s, size_t len, int *major, int *minor) GetVersionEx((OSVERSIONINFO*)&vi); server = vi.wProductType != VER_NT_WORKSTATION; - serverR2 = GetSystemMetrics(SM_SERVERR2); switch (si.wProcessorArchitecture) { @@ -245,10 +247,11 @@ static void frontend_win32_get_os(char *s, size_t len, int *major, int *minor) { case 2: if (server) - if (serverR2) - strlcpy(s, "Windows Server 2003 R2", len); - else - strlcpy(s, "Windows Server 2003", len); + { + strlcpy(s, "Windows Server 2003", len); + if (GetSystemMetrics(SM_SERVERR2)) + strlcat(s, " R2", len); + } else { /* Yes, XP Pro x64 is a higher version number than XP x86 */ @@ -302,6 +305,7 @@ static void frontend_win32_get_os(char *s, size_t len, int *major, int *minor) strlcat(s, " ", len); strlcat(s, vi.szCSDVersion, len); } + } static void frontend_win32_init(void *data) @@ -385,13 +389,13 @@ enum frontend_architecture frontend_win32_get_architecture(void) static int frontend_win32_parse_drive_list(void *data, bool load_content) { #ifdef HAVE_MENU + file_list_t *list = (file_list_t*)data; + enum msg_hash_enums enum_idx = load_content ? + MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR : + MSG_UNKNOWN; size_t i = 0; unsigned drives = GetLogicalDrives(); char drive[] = " :\\"; - file_list_t *list = (file_list_t*)data; - enum msg_hash_enums enum_idx = load_content ? - MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR : - MSG_UNKNOWN; for (i = 0; i < 32; i++) { @@ -506,7 +510,6 @@ static void frontend_win32_attach_console(void) { #ifdef _WIN32 #ifdef _WIN32_WINNT_WINXP - /* msys will start the process with FILE_TYPE_PIPE connected. * cmd will start the process with FILE_TYPE_UNKNOWN connected * (since this is subsystem windows application @@ -547,7 +550,6 @@ static void frontend_win32_detach_console(void) { #if defined(_WIN32) && !defined(_XBOX) #ifdef _WIN32_WINNT_WINXP - if(console_needs_free) { /* we don't reconnect stdout/stderr to anything here, @@ -556,7 +558,6 @@ static void frontend_win32_detach_console(void) FreeConsole(); console_needs_free = false; } - #endif #endif } diff --git a/frontend/frontend.c b/frontend/frontend.c index b144761490..8f96af7b44 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -161,6 +161,7 @@ int rarch_main(int argc, char *argv[], void *data) } #ifndef HAVE_MAIN +#ifndef ORBIS #ifdef __cplusplus extern "C" #endif @@ -169,3 +170,4 @@ int main(int argc, char *argv[]) return rarch_main(argc, argv, NULL); } #endif +#endif diff --git a/frontend/frontend_driver.c b/frontend/frontend_driver.c index b8ff69a442..9a6881cf6c 100644 --- a/frontend/frontend_driver.c +++ b/frontend/frontend_driver.c @@ -29,6 +29,12 @@ #include "frontend_driver.h" +#ifndef __WINRT__ +#if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#define __WINRT__ +#endif +#endif + static frontend_ctx_driver_t *frontend_ctx_drivers[] = { #if defined(EMSCRIPTEN) &frontend_ctx_emscripten, @@ -65,9 +71,12 @@ static frontend_ctx_driver_t *frontend_ctx_drivers[] = { #if defined(SWITCH) && defined(HAVE_LIBNX) &frontend_ctx_switch, #endif -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) &frontend_ctx_win32, #endif +#if defined(__WINRT__) + &frontend_ctx_uwp, +#endif #ifdef XENON &frontend_ctx_xenon, #endif diff --git a/frontend/frontend_driver.h b/frontend/frontend_driver.h index f5de976563..dc25214a31 100644 --- a/frontend/frontend_driver.h +++ b/frontend/frontend_driver.h @@ -124,6 +124,7 @@ extern frontend_ctx_driver_t frontend_ctx_ps2; extern frontend_ctx_driver_t frontend_ctx_ctr; extern frontend_ctx_driver_t frontend_ctx_switch; extern frontend_ctx_driver_t frontend_ctx_win32; +extern frontend_ctx_driver_t frontend_ctx_uwp; extern frontend_ctx_driver_t frontend_ctx_xenon; extern frontend_ctx_driver_t frontend_ctx_emscripten; extern frontend_ctx_driver_t frontend_ctx_dos; diff --git a/gfx/common/d3d10_common.c b/gfx/common/d3d10_common.c index 1b145015f7..16a35b9c57 100644 --- a/gfx/common/d3d10_common.c +++ b/gfx/common/d3d10_common.c @@ -20,7 +20,7 @@ #include "d3d10_common.h" #include "d3dcompiler_common.h" -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) #include typedef HRESULT(WINAPI* PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN)( diff --git a/gfx/common/d3d11_common.c b/gfx/common/d3d11_common.c index 16b32151e1..249033f2e7 100644 --- a/gfx/common/d3d11_common.c +++ b/gfx/common/d3d11_common.c @@ -20,9 +20,42 @@ #include "d3d11_common.h" #include "d3dcompiler_common.h" -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) #include +HRESULT WINAPI D3D11CreateDevice( + IDXGIAdapter* pAdapter, + D3D_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + CONST D3D_FEATURE_LEVEL* pFeatureLevels, + UINT FeatureLevels, + UINT SDKVersion, + ID3D11Device** ppDevice, + D3D_FEATURE_LEVEL* pFeatureLevel, + ID3D11DeviceContext** ppImmediateContext) +{ + static dylib_t d3d11_dll; + static PFN_D3D11_CREATE_DEVICE fp; + + if (!d3d11_dll) + d3d11_dll = dylib_load("d3d11.dll"); + + if (!d3d11_dll) + return TYPE_E_CANTLOADLIBRARY; + + if (!fp) + fp = (PFN_D3D11_CREATE_DEVICE)dylib_proc( + d3d11_dll, "D3D11CreateDevice"); + + if (!fp) + return TYPE_E_DLLFUNCTIONNOTFOUND; + + return fp( + pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, + ppDevice, pFeatureLevel, ppImmediateContext); +} + HRESULT WINAPI D3D11CreateDeviceAndSwapChain( IDXGIAdapter* pAdapter, D3D_DRIVER_TYPE DriverType, diff --git a/gfx/common/d3d11_common.h b/gfx/common/d3d11_common.h index 69128cd07a..db6254e8c1 100644 --- a/gfx/common/d3d11_common.h +++ b/gfx/common/d3d11_common.h @@ -2159,6 +2159,7 @@ static INLINE HRESULT D3D11ValidateContextForDispatch(D3D11Debug debug, D3D11Dev { return debug->lpVtbl->ValidateContextForDispatch(debug, context); } +#ifndef __WINRT__ static INLINE BOOL D3D11SetUseRef(D3D11SwitchToRef switch_to_ref, BOOL use_ref) { return switch_to_ref->lpVtbl->SetUseRef(switch_to_ref, use_ref); @@ -2167,6 +2168,7 @@ static INLINE BOOL D3D11GetUseRef(D3D11SwitchToRef switch_to_ref) { return switch_to_ref->lpVtbl->GetUseRef(switch_to_ref); } +#endif static INLINE HRESULT D3D11SetShaderTrackingOptionsByType( D3D11TracingDevice tracing_device, UINT resource_type_flags, UINT options) { @@ -2188,6 +2190,7 @@ static INLINE void D3D11ClearStoredMessages(D3D11InfoQueue info_queue) { info_queue->lpVtbl->ClearStoredMessages(info_queue); } +#ifndef __WINRT__ static INLINE HRESULT D3D11GetMessageA( D3D11InfoQueue info_queue, UINT64 message_index, @@ -2196,6 +2199,7 @@ static INLINE HRESULT D3D11GetMessageA( { return info_queue->lpVtbl->GetMessageA(info_queue, message_index, message, message_byte_length); } +#endif static INLINE UINT64 D3D11GetNumMessagesAllowedByStorageFilter(D3D11InfoQueue info_queue) { return info_queue->lpVtbl->GetNumMessagesAllowedByStorageFilter(info_queue); diff --git a/gfx/common/d3d12_common.c b/gfx/common/d3d12_common.c index 1b8d9478c5..e328af6a1b 100644 --- a/gfx/common/d3d12_common.c +++ b/gfx/common/d3d12_common.c @@ -1,4 +1,4 @@ -/* RetroArch - A frontend for libretro. +/* RetroArch - A frontend for libretro. * Copyright (C) 2014-2018 - Ali Bouhlel * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -65,7 +65,7 @@ DEFINE_GUIDW(IID_ID3D12DebugCommandList, 0x09e0bf36, 0x54ac, 0x484f, 0x88, 0x47, /* clang-format on */ #endif -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) static dylib_t d3d12_dll; static const char* d3d12_dll_name = "d3d12.dll"; @@ -159,15 +159,24 @@ bool d3d12_init_base(d3d12_video_t* d3d12) D3D12EnableDebugLayer(d3d12->debugController); #endif +#ifdef __WINRT__ + DXGICreateFactory2(&d3d12->factory); +#else DXGICreateFactory(&d3d12->factory); +#endif { int i = 0; while (true) { +#ifdef __WINRT__ + if (FAILED(DXGIEnumAdapters2(d3d12->factory, i++, &d3d12->adapter))) + return false; +#else if (FAILED(DXGIEnumAdapters(d3d12->factory, i++, &d3d12->adapter))) return false; +#endif if (SUCCEEDED(D3D12CreateDevice_(d3d12->adapter, D3D_FEATURE_LEVEL_11_0, &d3d12->device))) break; @@ -207,17 +216,28 @@ bool d3d12_init_queue(d3d12_video_t* d3d12) } bool d3d12_init_swapchain(d3d12_video_t* d3d12, - int width, int height, HWND hwnd) + int width, int height, void* corewindow) { unsigned i; +#ifdef __WINRT__ + DXGI_SWAP_CHAIN_DESC1 desc; + memset(&desc, 0, sizeof(DXGI_SWAP_CHAIN_DESC1)); +#else DXGI_SWAP_CHAIN_DESC desc; - + HWND hwnd = (HWND)corewindow; memset(&desc, 0, sizeof(DXGI_SWAP_CHAIN_DESC)); +#endif desc.BufferCount = countof(d3d12->chain.renderTargets); +#ifdef __WINRT__ + desc.Width = width; + desc.Height = height; + desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; +#else desc.BufferDesc.Width = width; desc.BufferDesc.Height = height; desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; +#endif desc.SampleDesc.Count = 1; #if 0 desc.BufferDesc.RefreshRate.Numerator = 60; @@ -225,16 +245,25 @@ bool d3d12_init_swapchain(d3d12_video_t* d3d12, desc.SampleDesc.Quality = 0; #endif desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; +#ifdef HAVE_WINDOW desc.OutputWindow = hwnd; desc.Windowed = TRUE; +#endif #if 0 desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; #else desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; #endif - DXGICreateSwapChain(d3d12->factory, d3d12->queue.handle, &desc, &d3d12->chain.handle); +#ifdef __WINRT__ + DXGICreateSwapChainForCoreWindow(d3d12->factory, d3d12->queue.handle, corewindow, &desc, NULL, &d3d12->chain.handle); +#else + DXGICreateSwapChain(d3d12->factory, d3d12->queue.handle, &desc, &d3d12->chain.handle); +#endif + +#ifdef HAVE_WINDOW DXGIMakeWindowAssociation(d3d12->factory, hwnd, DXGI_MWA_NO_ALT_ENTER); +#endif d3d12->chain.frame_index = DXGIGetCurrentBackBufferIndex(d3d12->chain.handle); @@ -291,7 +320,7 @@ static D3D12_CPU_DESCRIPTOR_HANDLE d3d12_descriptor_heap_slot_alloc(d3d12_descri static void d3d12_descriptor_heap_slot_free(d3d12_descriptor_heap_t* heap, D3D12_CPU_DESCRIPTOR_HANDLE handle) { - int i; + unsigned i; if (!handle.ptr) return; @@ -303,7 +332,7 @@ d3d12_descriptor_heap_slot_free(d3d12_descriptor_heap_t* heap, D3D12_CPU_DESCRIP assert(heap->map[i]); heap->map[i] = false; - if (heap->start > i) + if (heap->start > (int)i) heap->start = i; } diff --git a/gfx/common/d3d12_common.h b/gfx/common/d3d12_common.h index 8bb2bca7d6..5d4e221a3d 100644 --- a/gfx/common/d3d12_common.h +++ b/gfx/common/d3d12_common.h @@ -1001,6 +1001,7 @@ static INLINE void D3D12ClearStoredMessages(D3D12InfoQueue info_queue) { info_queue->lpVtbl->ClearStoredMessages(info_queue); } +#ifndef __WINRT__ static INLINE HRESULT D3D12GetMessageA( D3D12InfoQueue info_queue, UINT64 message_index, @@ -1009,6 +1010,7 @@ static INLINE HRESULT D3D12GetMessageA( { return info_queue->lpVtbl->GetMessageA(info_queue, message_index, message, message_byte_length); } +#endif static INLINE UINT64 D3D12GetNumMessagesAllowedByStorageFilter(D3D12InfoQueue info_queue) { return info_queue->lpVtbl->GetNumMessagesAllowedByStorageFilter(info_queue); @@ -1341,7 +1343,11 @@ static_assert( typedef struct { unsigned cur_mon_id; +#ifdef __WINRT__ + DXGIFactory2 factory; +#else DXGIFactory factory; +#endif DXGIAdapter adapter; D3D12Device device; @@ -1499,7 +1505,7 @@ bool d3d12_init_pipeline( D3D12_GRAPHICS_PIPELINE_STATE_DESC* desc, D3D12PipelineState* out); -bool d3d12_init_swapchain(d3d12_video_t* d3d12, int width, int height, HWND hwnd); +bool d3d12_init_swapchain(d3d12_video_t* d3d12, int width, int height, void *corewindow); bool d3d12_init_queue(d3d12_video_t* d3d12); diff --git a/gfx/common/d3d_common.c b/gfx/common/d3d_common.c index c026c3c9f2..0685c6ea26 100644 --- a/gfx/common/d3d_common.c +++ b/gfx/common/d3d_common.c @@ -12,6 +12,7 @@ * You should have received a copy of the GNU General Public License along with RetroArch. * If not, see . */ +#include #include "../../configuration.h" #include "../../verbosity.h" @@ -88,8 +89,10 @@ void *d3d_matrix_multiply(void *_pout, for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) - pout->m[i][j] = pm1->m[i][0] * pm2->m[0][j] + pm1->m[i][1] * pm2->m[1][j] + - pm1->m[i][2] * pm2->m[2][j] + pm1->m[i][3] * pm2->m[3][j]; + pout->m[i][j] = pm1->m[i][0] * + pm2->m[0][j] + pm1->m[i][1] * pm2->m[1][j] + + pm1->m[i][2] * pm2->m[2][j] + + pm1->m[i][3] * pm2->m[3][j]; } return pout; } @@ -125,3 +128,43 @@ int32_t d3d_translate_filter(unsigned type) return (int32_t)D3D_TEXTURE_FILTER_POINT; } + +void d3d_input_driver(const char* input_name, const char* joypad_name, const input_driver_t** input, void** input_data) +{ +#if defined(__WINRT__) + /* Plain xinput is supported on UWP, but it + * supports joypad only (uwp driver was added later) */ + if (string_is_equal(input_name, "xinput")) + { + void *xinput = input_xinput.init(joypad_name); + *input = xinput ? (const input_driver_t*)&input_xinput : NULL; + *input_data = xinput; + } + else + { + void *uwp = input_uwp.init(joypad_name); + *input = uwp ? (const input_driver_t*)&input_uwp : NULL; + *input_data = uwp; + } +#elif defined(_XBOX) + void *xinput = input_xinput.init(joypad_name); + *input = xinput ? (const input_driver_t*)&input_xinput : NULL; + *input_data = xinput; +#else +#if _WIN32_WINNT >= 0x0501 + /* winraw only available since XP */ + if (string_is_equal(input_name, "raw")) + { + *input_data = input_winraw.init(joypad_name); + if (*input_data) + { + *input = &input_winraw; + return; + } + } +#endif + + *input_data = input_dinput.init(joypad_name); + *input = *input_data ? &input_dinput : NULL; +#endif +} diff --git a/gfx/common/d3d_common.h b/gfx/common/d3d_common.h index 69c9ae6526..c5b62496a2 100644 --- a/gfx/common/d3d_common.h +++ b/gfx/common/d3d_common.h @@ -20,10 +20,18 @@ #include "../../config.h" #endif -#ifndef _XBOX +#if !defined(__WINRT__) && !defined(_XBOX) + +#ifndef HAVE_WINDOW #define HAVE_WINDOW #endif +#ifndef HAVE_MONITOR +#define HAVE_MONITOR +#endif + +#endif + #include #include @@ -97,6 +105,9 @@ void *d3d_matrix_rotation_z(void *_pout, float angle); int32_t d3d_translate_filter(unsigned type); +void d3d_input_driver(const char* input_name, + const char* joypad_name, const input_driver_t** input, void** input_data); + RETRO_END_DECLS #endif diff --git a/gfx/common/d3dcompiler_common.c b/gfx/common/d3dcompiler_common.c index 6da87c1ba4..22d17704a3 100644 --- a/gfx/common/d3dcompiler_common.c +++ b/gfx/common/d3dcompiler_common.c @@ -25,7 +25,7 @@ #include "d3dcompiler_common.h" #include "../../verbosity.h" -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) #include static dylib_t d3dcompiler_dll; diff --git a/gfx/common/dxgi_common.c b/gfx/common/dxgi_common.c index 3d935f41d2..86f4a7b987 100644 --- a/gfx/common/dxgi_common.c +++ b/gfx/common/dxgi_common.c @@ -30,7 +30,7 @@ #include "../video_driver.h" #include "win32_common.h" -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) #include HRESULT WINAPI CreateDXGIFactory1(REFIID riid, void** ppFactory) @@ -309,6 +309,7 @@ void dxgi_update_title(video_frame_info_t* video_info) if (settings->bools.video_memory_show) { +#ifndef __WINRT__ MEMORYSTATUS stat; char mem[128]; @@ -319,6 +320,7 @@ void dxgi_update_title(video_frame_info_t* video_info) mem, sizeof(mem), " || MEM: %.2f/%.2fMB", stat.dwAvailPhys / (1024.0f * 1024.0f), stat.dwTotalPhys / (1024.0f * 1024.0f)); strlcat(video_info->fps_text, mem, sizeof(video_info->fps_text)); +#endif } if (window) @@ -329,32 +331,11 @@ void dxgi_update_title(video_frame_info_t* video_info) video_driver_get_window_title(title, sizeof(title)); +#ifndef __WINRT__ if (title[0]) window->set_title(&main_window, title); - } -} - -void dxgi_input_driver(const char* name, const input_driver_t** input, void** input_data) -{ -#ifndef __WINRT__ - settings_t* settings = config_get_ptr(); - -#if _WIN32_WINNT >= 0x0501 - /* winraw only available since XP */ - if (string_is_equal(settings->arrays.input_driver, "raw")) - { - *input_data = input_winraw.init(name); - if (*input_data) - { - *input = &input_winraw; - return; - } - } -#endif - - *input_data = input_dinput.init(name); - *input = *input_data ? &input_dinput : NULL; #endif + } } DXGI_FORMAT glslang_format_to_dxgi(glslang_format fmt) diff --git a/gfx/common/dxgi_common.h b/gfx/common/dxgi_common.h index 0323b5d839..485142b099 100644 --- a/gfx/common/dxgi_common.h +++ b/gfx/common/dxgi_common.h @@ -270,6 +270,9 @@ typedef IDXGISurface1* DXGISurface; typedef IDXGIOutput* DXGIOutput; typedef IDXGIDevice* DXGIDevice; typedef IDXGIFactory1* DXGIFactory; +#ifdef __WINRT__ +typedef IDXGIFactory2* DXGIFactory2; +#endif typedef IDXGIAdapter1* DXGIAdapter; typedef IDXGIDisplayControl* DXGIDisplayControl; typedef IDXGIOutputDuplication* DXGIOutputDuplication; @@ -414,6 +417,14 @@ static INLINE HRESULT DXGICreateSwapChain( return factory->lpVtbl->CreateSwapChain( factory, (IUnknown*)device, desc, (IDXGISwapChain**)swap_chain); } +#ifdef __WINRT__ +static INLINE HRESULT DXGICreateSwapChainForCoreWindow( + DXGIFactory2 factory, void* device, void* corewindow, DXGI_SWAP_CHAIN_DESC1* desc, DXGIOutput restrict_to, DXGISwapChain* swap_chain) +{ + return factory->lpVtbl->CreateSwapChainForCoreWindow( + factory, (IUnknown*)device, (IUnknown*)corewindow, desc, restrict_to, (IDXGISwapChain1**)swap_chain); +} +#endif static INLINE HRESULT DXGICreateSoftwareAdapter(DXGIFactory factory, HMODULE module, DXGIAdapter* adapter) { @@ -423,6 +434,12 @@ static INLINE HRESULT DXGIEnumAdapters(DXGIFactory factory, UINT id, DXGIAdapter { return factory->lpVtbl->EnumAdapters1(factory, id, adapter); } +#ifdef __WINRT__ +static INLINE HRESULT DXGIEnumAdapters2(DXGIFactory2 factory, UINT id, DXGIAdapter* adapter) +{ + return factory->lpVtbl->EnumAdapters1(factory, id, adapter); +} +#endif static INLINE BOOL DXGIIsCurrent(DXGIFactory factory) { return factory->lpVtbl->IsCurrent(factory); @@ -444,6 +461,7 @@ static INLINE HRESULT DXGIGetAdapterDesc1(DXGIAdapter adapter, DXGI_ADAPTER_DESC { return adapter->lpVtbl->GetDesc1(adapter, desc); } +#ifndef __WINRT__ static INLINE ULONG DXGIReleaseDisplayControl(DXGIDisplayControl display_control) { return display_control->lpVtbl->Release(display_control); @@ -612,6 +630,7 @@ static INLINE HRESULT DXGICheckPresentDurationSupport( swap_chain_media, desired_present_duration, closest_smaller_present_duration, closest_larger_present_duration); } +#endif static INLINE ULONG DXGIReleaseSwapChain(DXGISwapChain swap_chain) { return swap_chain->lpVtbl->Release(swap_chain); @@ -758,6 +777,12 @@ static INLINE HRESULT DXGICreateFactory(DXGIFactory* factory) { return CreateDXGIFactory1(uuidof(IDXGIFactory1), (void**)factory); } +#ifdef __WINRT__ +static INLINE HRESULT DXGICreateFactory2(DXGIFactory2* factory) +{ + return CreateDXGIFactory1(uuidof(IDXGIFactory2), (void**)factory); +} +#endif /* internal */ @@ -793,7 +818,6 @@ void dxgi_copy( void* dst_data); void dxgi_update_title(video_frame_info_t* video_info); -void dxgi_input_driver(const char* name, const input_driver_t** input, void** input_data); DXGI_FORMAT glslang_format_to_dxgi(glslang_format fmt); diff --git a/gfx/common/gl_common.c b/gfx/common/gl_common.c index 98a4c41c58..e2e8a09501 100644 --- a/gfx/common/gl_common.c +++ b/gfx/common/gl_common.c @@ -54,7 +54,7 @@ void gl_load_texture_image(GLenum target, GLenum type, const GLvoid * data) { -#ifndef HAVE_PSGL +#if !defined(HAVE_PSGL) && !defined(ORBIS) #ifdef HAVE_OPENGLES2 if (gl_check_capability(GL_CAPS_TEX_STORAGE_EXT) && internalFormat != GL_BGRA_EXT) { diff --git a/gfx/common/orbis_common.h b/gfx/common/orbis_common.h new file mode 100644 index 0000000000..2463fa2754 --- /dev/null +++ b/gfx/common/orbis_common.h @@ -0,0 +1,25 @@ +#ifndef ORBIS_COMMON_H__ +#define ORBIS_COMMON_H__ + +#ifdef HAVE_EGL +#include +#include "../common/egl_common.h" +#endif + +#define ATTR_ORBISGL_WIDTH 1920 +#define ATTR_ORBISGL_HEIGHT 1080 + +typedef struct +{ +#ifdef HAVE_EGL + egl_ctx_data_t egl; + ScePglConfig pgl_config; +#endif + + SceWindow native_window; + bool resize; + unsigned width, height; + float refresh_rate; +} orbis_ctx_data_t; + +#endif diff --git a/gfx/common/wayland/generate_wayland_protos.sh b/gfx/common/wayland/generate_wayland_protos.sh index 8c0cc7f155..0c50161ed3 100755 --- a/gfx/common/wayland/generate_wayland_protos.sh +++ b/gfx/common/wayland/generate_wayland_protos.sh @@ -3,6 +3,11 @@ WAYSCAN=/usr/bin/wayland-scanner WAYLAND_PROTOS=/usr/share/wayland-protocols OUTPUT=gfx/common/wayland +if [ ! -d $WAYLAND_PROTOS ]; then + WAYSCAN=/usr/local/bin/wayland-scanner + WAYLAND_PROTOS=/usr/local/share/wayland-protocols +fi + if [ ! -d $OUTPUT ]; then mkdir $OUTPUT fi diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index 79f3dd6b9e..567b524f31 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -591,8 +591,13 @@ static LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message, settings_t *settings = config_get_ptr(); if (settings && string_is_equal(settings->arrays.input_driver, "raw")) keysym = (unsigned)wparam; + else #endif - + { + /* extended keys will map to dinput if the high bit is set */ + if (input_get_ptr() == &input_dinput && (lparam >> 24 & 0x1)) + keysym |= 0x80; + } /* Key released? */ if (message == WM_KEYUP || message == WM_SYSKEYUP) keydown = false; diff --git a/gfx/display_servers/dispserv_win32.c b/gfx/display_servers/dispserv_win32.c index 6563441bd5..0a1a4513b0 100644 --- a/gfx/display_servers/dispserv_win32.c +++ b/gfx/display_servers/dispserv_win32.c @@ -82,6 +82,12 @@ static void* win32_display_server_init(void) return NULL; #ifdef HAS_TASKBAR_EXT + if (FAILED(CoInitialize(NULL))) + { + RARCH_ERR("COM initialization failed, ITaskbarList3 disabled\n"); + return dispserv; + } + #ifdef __cplusplus /* When compiling in C++ mode, GUIDs are references instead of pointers */ hr = CoCreateInstance(CLSID_TaskbarList, NULL, @@ -96,6 +102,7 @@ static void* win32_display_server_init(void) { g_taskbarList = NULL; RARCH_ERR("[dispserv]: CoCreateInstance of ITaskbarList3 failed.\n"); + CoUninitialize(); } #endif @@ -115,6 +122,7 @@ static void win32_display_server_destroy(void *data) { ITaskbarList3_Release(g_taskbarList); g_taskbarList = NULL; + CoUninitialize(); } #endif diff --git a/gfx/drivers/d3d10.c b/gfx/drivers/d3d10.c index b123cda661..d5c2b7458f 100644 --- a/gfx/drivers/d3d10.c +++ b/gfx/drivers/d3d10.c @@ -1,4 +1,4 @@ -/* RetroArch - A frontend for libretro. +/* RetroArch - A frontend for libretro. * Copyright (C) 2014-2018 - Ali Bouhlel * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -27,6 +27,7 @@ #include "../video_driver.h" #include "../font_driver.h" +#include "../common/d3d_common.h" #include "../common/win32_common.h" #include "../common/d3d10_common.h" #include "../common/dxgi_common.h" @@ -35,6 +36,10 @@ #include "../../menu/menu_driver.h" #endif +#ifdef __WINRT__ +#error "UWP does not support D3D10" +#endif + #ifdef HAVE_OVERLAY static void d3d10_free_overlays(d3d10_video_t* d3d10) { @@ -556,8 +561,12 @@ static void d3d10_gfx_free(void* data) Release(d3d10->device); } +#ifdef HAVE_MONITOR win32_monitor_from_window(); +#endif +#ifdef HAVE_WINDOW win32_destroy_window(); +#endif free(d3d10); } @@ -566,31 +575,41 @@ d3d10_gfx_init(const video_info_t* video, const input_driver_t** input, void** input_data) { unsigned i; +#ifdef HAVE_MONITOR MONITORINFOEX current_mon; HMONITOR hm_to_use; WNDCLASSEX wndclass = { 0 }; +#endif settings_t* settings = config_get_ptr(); d3d10_video_t* d3d10 = (d3d10_video_t*)calloc(1, sizeof(*d3d10)); if (!d3d10) return NULL; +#ifdef HAVE_WINDOW win32_window_reset(); +#endif +#ifdef HAVE_MONITOR win32_monitor_init(); wndclass.lpfnWndProc = WndProcD3D; +#ifdef HAVE_WINDOW win32_window_init(&wndclass, true, NULL); +#endif win32_monitor_info(¤t_mon, &hm_to_use, &d3d10->cur_mon_id); +#endif d3d10->vp.full_width = video->width; d3d10->vp.full_height = video->height; +#ifdef HAVE_MONITOR if (!d3d10->vp.full_width) d3d10->vp.full_width = current_mon.rcMonitor.right - current_mon.rcMonitor.left; if (!d3d10->vp.full_height) d3d10->vp.full_height = current_mon.rcMonitor.bottom - current_mon.rcMonitor.top; +#endif if (!win32_set_video_mode(d3d10, d3d10->vp.full_width, d3d10->vp.full_height, video->fullscreen)) @@ -598,7 +617,7 @@ d3d10_gfx_init(const video_info_t* video, RARCH_ERR("[D3D10]: win32_set_video_mode failed.\n"); goto error; } - dxgi_input_driver(settings->arrays.input_joypad_driver, input, input_data); + d3d_input_driver(settings->arrays.input_driver, settings->arrays.input_joypad_driver, input, input_data); { UINT flags = 0; @@ -611,7 +630,9 @@ d3d10_gfx_init(const video_info_t* video, desc.BufferDesc.RefreshRate.Numerator = 60; desc.BufferDesc.RefreshRate.Denominator = 1; desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; +#ifdef HAVE_WINDOW desc.OutputWindow = main_window.hwnd; +#endif desc.SampleDesc.Count = 1; desc.SampleDesc.Quality = 0; desc.Windowed = TRUE; @@ -1598,7 +1619,12 @@ static const video_poke_interface_t d3d10_poke_interface = { d3d10_gfx_load_texture, d3d10_gfx_unload_texture, NULL, /* set_video_mode */ +#ifndef __WINRT__ win32_get_refresh_rate, +#else + /* UWP does not expose this information easily */ + NULL, +#endif d3d10_set_filtering, NULL, /* get_video_output_size */ NULL, /* get_video_output_prev */ diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index 137ad02525..d740e32797 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -1,4 +1,4 @@ -/* RetroArch - A frontend for libretro. +/* RetroArch - A frontend for libretro. * Copyright (C) 2014-2018 - Ali Bouhlel * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -34,6 +34,7 @@ #include "../video_shader_parse.h" #include "../drivers_shader/slang_preprocess.h" +#include "../common/d3d_common.h" #include "../common/d3d11_common.h" #include "../common/dxgi_common.h" #include "../common/d3dcompiler_common.h" @@ -41,6 +42,10 @@ #include "../drivers_shader/slang_process.h" #endif +#ifdef __WINRT__ +#include "../../uwp/uwp_func.h" +#endif + static D3D11Device cached_device_d3d11; static D3D_FEATURE_LEVEL cached_supportedFeatureLevel; static D3D11DeviceContext cached_context; @@ -566,8 +571,12 @@ static void d3d11_gfx_free(void* data) Release(d3d11->device); } +#ifdef HAVE_MONITOR win32_monitor_from_window(); +#endif +#ifdef HAVE_WINDOW win32_destroy_window(); +#endif free(d3d11); } @@ -575,29 +584,39 @@ static void d3d11_gfx_free(void* data) d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** input_data) { unsigned i; +#ifdef HAVE_MONITOR MONITORINFOEX current_mon; HMONITOR hm_to_use; WNDCLASSEX wndclass = { 0 }; +#endif settings_t* settings = config_get_ptr(); d3d11_video_t* d3d11 = (d3d11_video_t*)calloc(1, sizeof(*d3d11)); if (!d3d11) return NULL; +#ifdef HAVE_WINDOW win32_window_reset(); +#endif +#ifdef HAVE_MONITOR win32_monitor_init(); wndclass.lpfnWndProc = WndProcD3D; +#ifdef HAVE_WINDOW win32_window_init(&wndclass, true, NULL); +#endif win32_monitor_info(¤t_mon, &hm_to_use, &d3d11->cur_mon_id); +#endif d3d11->vp.full_width = video->width; d3d11->vp.full_height = video->height; +#ifdef HAVE_MONITOR if (!d3d11->vp.full_width) d3d11->vp.full_width = current_mon.rcMonitor.right - current_mon.rcMonitor.left; if (!d3d11->vp.full_height) d3d11->vp.full_height = current_mon.rcMonitor.bottom - current_mon.rcMonitor.top; +#endif if (!win32_set_video_mode(d3d11, d3d11->vp.full_width, d3d11->vp.full_height, video->fullscreen)) { @@ -605,7 +624,7 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i goto error; } - dxgi_input_driver(settings->arrays.input_joypad_driver, input, input_data); + d3d_input_driver(settings->arrays.input_driver, settings->arrays.input_joypad_driver, input, input_data); { UINT flags = 0; @@ -617,26 +636,45 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_9_3 }; +#ifdef __WINRT__ + /* UWP requires the use of newer version of the factory which requires newer version of this struct */ + DXGI_SWAP_CHAIN_DESC1 desc = { 0 }; +#else DXGI_SWAP_CHAIN_DESC desc = { 0 }; +#endif UINT number_feature_levels = ARRAY_SIZE(requested_feature_levels); - desc.BufferCount = 1; +#ifdef __WINRT__ + /* UWP forces us to do double-buffering */ + desc.BufferCount = 2; + desc.Width = d3d11->vp.full_width; + desc.Height = d3d11->vp.full_height; + desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; +#else + desc.BufferCount = 1; desc.BufferDesc.Width = d3d11->vp.full_width; desc.BufferDesc.Height = d3d11->vp.full_height; desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; desc.BufferDesc.RefreshRate.Numerator = 60; desc.BufferDesc.RefreshRate.Denominator = 1; +#endif desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; +#ifdef HAVE_WINDOW desc.OutputWindow = main_window.hwnd; +#endif desc.SampleDesc.Count = 1; desc.SampleDesc.Quality = 0; #if 0 desc.Scaling = DXGI_SCALING_STRETCH; #endif +#ifdef HAVE_WINDOW desc.Windowed = TRUE; +#endif #if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) /* On phone, no swap effects are supported. */ desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; +#elif defined(__WINRT__) + desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; #else desc.SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL; #endif @@ -646,37 +684,47 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i #endif if(cached_device_d3d11 && cached_context) { - IDXGIFactory* dxgiFactory = NULL; - IDXGIDevice* dxgiDevice = NULL; - IDXGIAdapter* adapter = NULL; - d3d11->device = cached_device_d3d11; d3d11->context = cached_context; d3d11->supportedFeatureLevel = cached_supportedFeatureLevel; - - d3d11->device->lpVtbl->QueryInterface( - d3d11->device, uuidof(IDXGIDevice), (void**)&dxgiDevice); - dxgiDevice->lpVtbl->GetAdapter(dxgiDevice, &adapter); - adapter->lpVtbl->GetParent( - adapter, uuidof(IDXGIFactory1), (void**)&dxgiFactory); - dxgiFactory->lpVtbl->CreateSwapChain( - dxgiFactory, (IUnknown*)d3d11->device, - &desc, (IDXGISwapChain**)&d3d11->swapChain); - - dxgiFactory->lpVtbl->Release(dxgiFactory); - adapter->lpVtbl->Release(adapter); - dxgiDevice->lpVtbl->Release(dxgiDevice); } else { - if (FAILED(D3D11CreateDeviceAndSwapChain( + if (FAILED(D3D11CreateDevice( NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, flags, requested_feature_levels, number_feature_levels, - D3D11_SDK_VERSION, &desc, - (IDXGISwapChain**)&d3d11->swapChain, &d3d11->device, + D3D11_SDK_VERSION, &d3d11->device, &d3d11->supportedFeatureLevel, &d3d11->context))) goto error; } + + IDXGIDevice* dxgiDevice = NULL; + IDXGIAdapter* adapter = NULL; + + d3d11->device->lpVtbl->QueryInterface( + d3d11->device, uuidof(IDXGIDevice), (void**)&dxgiDevice); + dxgiDevice->lpVtbl->GetAdapter(dxgiDevice, &adapter); +#ifndef __WINRT__ + IDXGIFactory* dxgiFactory = NULL; + adapter->lpVtbl->GetParent( + adapter, uuidof(IDXGIFactory1), (void**)&dxgiFactory); + if (FAILED(dxgiFactory->lpVtbl->CreateSwapChain( + dxgiFactory, (IUnknown*)d3d11->device, + &desc, (IDXGISwapChain**)&d3d11->swapChain))) + goto error; +#else + IDXGIFactory2* dxgiFactory = NULL; + adapter->lpVtbl->GetParent( + adapter, uuidof(IDXGIFactory2), (void**)&dxgiFactory); + if (FAILED(dxgiFactory->lpVtbl->CreateSwapChainForCoreWindow( + dxgiFactory, (IUnknown*)d3d11->device, uwp_get_corewindow(), + &desc, NULL, (IDXGISwapChain1**)&d3d11->swapChain))) + goto error; +#endif + + dxgiFactory->lpVtbl->Release(dxgiFactory); + adapter->lpVtbl->Release(adapter); + dxgiDevice->lpVtbl->Release(dxgiDevice); } { @@ -1142,6 +1190,11 @@ static bool d3d11_gfx_frame( video_driver_set_size(&video_info->width, &video_info->height); } +#ifdef __WINRT__ + /* UWP requires double-buffering, so make sure we bind to the appropariate backbuffer */ + D3D11SetRenderTargets(context, 1, &d3d11->renderTargetView, NULL); +#endif + PERF_START(); #if 0 /* custom viewport doesn't call apply_state_changes, so we can't rely on this for now */ @@ -1622,7 +1675,12 @@ static const video_poke_interface_t d3d11_poke_interface = { d3d11_gfx_load_texture, d3d11_gfx_unload_texture, NULL, /* set_video_mode */ +#ifndef __WINRT__ win32_get_refresh_rate, +#else + /* UWP does not expose this information easily */ + NULL, +#endif d3d11_set_filtering, NULL, /* get_video_output_size */ NULL, /* get_video_output_prev */ diff --git a/gfx/drivers/d3d12.c b/gfx/drivers/d3d12.c index c4dab9fcc3..9921678ffb 100644 --- a/gfx/drivers/d3d12.c +++ b/gfx/drivers/d3d12.c @@ -1,4 +1,4 @@ -/* RetroArch - A frontend for libretro. +/* RetroArch - A frontend for libretro. * Copyright (C) 2014-2018 - Ali Bouhlel * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -22,6 +22,7 @@ #include "../video_driver.h" #include "../font_driver.h" +#include "../common/d3d_common.h" #include "../common/win32_common.h" #include "../common/dxgi_common.h" #include "../common/d3d12_common.h" @@ -864,8 +865,12 @@ static void d3d12_gfx_free(void* data) Release(d3d12->device); Release(d3d12->adapter); +#ifdef HAVE_MONITOR win32_monitor_from_window(); +#endif +#ifdef HAVE_WINDOW win32_destroy_window(); +#endif free(d3d12); } @@ -873,29 +878,39 @@ static void d3d12_gfx_free(void* data) static void* d3d12_gfx_init(const video_info_t* video, const input_driver_t** input, void** input_data) { +#ifdef HAVE_MONITOR MONITORINFOEX current_mon; HMONITOR hm_to_use; WNDCLASSEX wndclass = { 0 }; +#endif settings_t* settings = config_get_ptr(); d3d12_video_t* d3d12 = (d3d12_video_t*)calloc(1, sizeof(*d3d12)); if (!d3d12) return NULL; +#ifdef HAVE_WINDOW win32_window_reset(); +#endif +#ifdef HAVE_MONITOR win32_monitor_init(); wndclass.lpfnWndProc = WndProcD3D; +#ifdef HAVE_WINDOW win32_window_init(&wndclass, true, NULL); +#endif win32_monitor_info(¤t_mon, &hm_to_use, &d3d12->cur_mon_id); +#endif d3d12->vp.full_width = video->width; d3d12->vp.full_height = video->height; +#ifdef HAVE_MONITOR if (!d3d12->vp.full_width) d3d12->vp.full_width = current_mon.rcMonitor.right - current_mon.rcMonitor.left; if (!d3d12->vp.full_height) d3d12->vp.full_height = current_mon.rcMonitor.bottom - current_mon.rcMonitor.top; +#endif if (!win32_set_video_mode(d3d12, d3d12->vp.full_width, d3d12->vp.full_height, video->fullscreen)) { @@ -903,7 +918,7 @@ d3d12_gfx_init(const video_info_t* video, const input_driver_t** input, void** i goto error; } - dxgi_input_driver(settings->arrays.input_joypad_driver, input, input_data); + d3d_input_driver(settings->arrays.input_driver, settings->arrays.input_joypad_driver, input, input_data); if (!d3d12_init_base(d3d12)) goto error; @@ -917,8 +932,13 @@ d3d12_gfx_init(const video_info_t* video, const input_driver_t** input, void** i if (!d3d12_init_queue(d3d12)) goto error; +#ifdef __WINRT__ + if (!d3d12_init_swapchain(d3d12, d3d12->vp.full_width, d3d12->vp.full_height, uwp_get_corewindow())) + goto error; +#else if (!d3d12_init_swapchain(d3d12, d3d12->vp.full_width, d3d12->vp.full_height, main_window.hwnd)) goto error; +#endif d3d12_init_samplers(d3d12); d3d12_set_filtering(d3d12, 0, video->smooth); @@ -1764,7 +1784,12 @@ static const video_poke_interface_t d3d12_poke_interface = { d3d12_gfx_load_texture, d3d12_gfx_unload_texture, NULL, /* set_video_mode */ +#ifndef __WINRT__ win32_get_refresh_rate, +#else + /* UWP does not expose this information easily */ + NULL, +#endif d3d12_set_filtering, NULL, /* get_video_output_size */ NULL, /* get_video_output_prev */ diff --git a/gfx/drivers/d3d8.c b/gfx/drivers/d3d8.c index a5dcf1b2a1..5eb5080d08 100644 --- a/gfx/drivers/d3d8.c +++ b/gfx/drivers/d3d8.c @@ -47,9 +47,6 @@ #ifdef _XBOX #define D3D8_PRESENTATIONINTERVAL D3DRS_PRESENTATIONINTERVAL -#else -#define HAVE_MONITOR -#define HAVE_WINDOW #endif #ifdef HAVE_MENU @@ -61,6 +58,10 @@ #include "../../core.h" #include "../../verbosity.h" +#ifdef __WINRT__ +#error "UWP does not support D3D8" +#endif + static LPDIRECT3D8 g_pD3D8; #ifdef _XBOX @@ -1137,37 +1138,6 @@ static void d3d8_set_osd_msg(void *data, d3d8_end_scene(d3d->dev); } -static void d3d8_input_driver( - const input_driver_t **input, void **input_data) -{ - settings_t *settings = config_get_ptr(); - const char *name = settings ? - settings->arrays.input_joypad_driver : NULL; -#ifdef _XBOX - void *xinput = input_xinput.init(name); - *input = xinput ? (const input_driver_t*)&input_xinput : NULL; - *input_data = xinput; -#else -#if _WIN32_WINNT >= 0x0501 - /* winraw only available since XP */ - if (string_is_equal(settings->arrays.input_driver, "raw")) - { - *input_data = input_winraw.init(name); - if (*input_data) - { - *input = &input_winraw; - dinput = NULL; - return; - } - } -#endif - - dinput = input_dinput.init(name); - *input = dinput ? &input_dinput : NULL; - *input_data = dinput; -#endif -} - static bool d3d8_init_internal(d3d8_video_t *d3d, const video_info_t *info, const input_driver_t **input, void **input_data) @@ -1255,7 +1225,7 @@ static bool d3d8_init_internal(d3d8_video_t *d3d, if (!d3d8_initialize(d3d, &d3d->video_info)) return false; - d3d8_input_driver(input, input_data); + d3d_input_driver(settings->arrays.input_driver, settings->arrays.input_joypad_driver, input, input_data); RARCH_LOG("[D3D8]: Init complete.\n"); return true; @@ -1888,9 +1858,10 @@ static const video_poke_interface_t d3d_poke_interface = { d3d8_load_texture, d3d8_unload_texture, d3d8_set_video_mode, -#ifdef _XBOX +#if defined(_XBOX) || defined(__WINRT__) NULL, #else + /* UWP does not expose this information easily */ win32_get_refresh_rate, #endif NULL, diff --git a/gfx/drivers/d3d9.c b/gfx/drivers/d3d9.c index a383190b48..3638bb3622 100644 --- a/gfx/drivers/d3d9.c +++ b/gfx/drivers/d3d9.c @@ -1,4 +1,4 @@ -/* RetroArch - A frontend for libretro. +/* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2012-2014 - OV2 @@ -48,9 +48,6 @@ #ifdef _XBOX #define D3D9_PRESENTATIONINTERVAL D3DRS_PRESENTINTERVAL -#else -#define HAVE_MONITOR -#define HAVE_WINDOW #endif #define FS_PRESENTINTERVAL(pp) ((pp)->PresentationInterval) @@ -65,6 +62,10 @@ #include "../../verbosity.h" #include "../../retroarch.h" +#ifdef __WINRT__ +#error "UWP does not support D3D9" +#endif + static LPDIRECT3D9 g_pD3D9; void *dinput; @@ -1182,38 +1183,6 @@ static void d3d9_set_osd_msg(void *data, d3d9_end_scene(dev); } -static void d3d9_input_driver( - const input_driver_t **input, void **input_data) -{ - settings_t *settings = config_get_ptr(); - const char *name = settings ? - settings->arrays.input_joypad_driver : NULL; -#ifdef _XBOX - void *xinput = input_xinput.init(name); - *input = xinput ? (const input_driver_t*)&input_xinput : NULL; - *input_data = xinput; -#else - -#if _WIN32_WINNT >= 0x0501 - /* winraw only available since XP */ - if (string_is_equal(settings->arrays.input_driver, "raw")) - { - *input_data = input_winraw.init(name); - if (*input_data) - { - *input = &input_winraw; - dinput = NULL; - return; - } - } -#endif - - dinput = input_dinput.init(name); - *input = dinput ? &input_dinput : NULL; - *input_data = dinput; -#endif -} - static bool d3d9_init_internal(d3d9_video_t *d3d, const video_info_t *info, const input_driver_t **input, void **input_data) @@ -1325,7 +1294,8 @@ static bool d3d9_init_internal(d3d9_video_t *d3d, if (!d3d9_initialize(d3d, &d3d->video_info)) return false; - d3d9_input_driver(input, input_data); + d3d_input_driver(settings->arrays.input_joypad_driver, + settings->arrays.input_joypad_driver, input, input_data); RARCH_LOG("[D3D9]: Init complete.\n"); return true; @@ -2054,9 +2024,10 @@ static const video_poke_interface_t d3d9_poke_interface = { d3d9_load_texture, d3d9_unload_texture, d3d9_set_video_mode, -#ifdef _XBOX +#if defined(_XBOX) || defined(__WINRT__) NULL, #else + /* UWP does not expose this information easily */ win32_get_refresh_rate, #endif NULL, diff --git a/gfx/drivers/ps2_gfx.c b/gfx/drivers/ps2_gfx.c index cb921bbc68..6770afcc40 100644 --- a/gfx/drivers/ps2_gfx.c +++ b/gfx/drivers/ps2_gfx.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2018 - Francisco Javier Trujillo Mata + * Copyright (C) 2018 - Francisco Javier Trujillo Mata - fjtrujy * * RetroArch is free software: 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,6 @@ #include "../../driver.h" #include "../../verbosity.h" -#include #include #include #include @@ -26,6 +25,9 @@ #define GS_TEXT GS_SETREG_RGBAQ(0x80,0x80,0x80,0x80,0x00) // turn white GS Screen #define GS_BLACK GS_SETREG_RGBAQ(0x00,0x00,0x00,0x00,0x00) // turn white GS Screen +#define NTSC_WIDTH 640 +#define NTSC_HEIGHT 448 + typedef struct ps2_video { GSGLOBAL *gsGlobal; @@ -45,11 +47,17 @@ typedef struct ps2_video static GSGLOBAL *init_GSGlobal(void) { GSGLOBAL *gsGlobal = gsKit_init_global(); - gsGlobal->PSM = GS_PSM_CT16; - gsGlobal->PSMZ = GS_PSMZ_16S; + gsGlobal->Mode = GS_MODE_NTSC; + gsGlobal->Interlace = GS_INTERLACED; + gsGlobal->Field = GS_FIELD; + gsGlobal->Width = NTSC_WIDTH; + gsGlobal->Height = NTSC_HEIGHT; + + gsGlobal->PSM = GS_PSM_CT16; + gsGlobal->PSMZ = GS_PSMZ_16; gsGlobal->DoubleBuffering = GS_SETTING_OFF; gsGlobal->ZBuffering = GS_SETTING_OFF; - gsGlobal->PrimAlphaEnable = GS_SETTING_OFF; + gsGlobal->PrimAlphaEnable = GS_SETTING_OFF; dmaKit_init(D_CTRL_RELE_OFF,D_CTRL_MFD_OFF, D_CTRL_STS_UNSPEC, D_CTRL_STD_OFF, D_CTRL_RCYC_8, 1 << DMA_CHANNEL_GIF); @@ -66,10 +74,7 @@ static GSGLOBAL *init_GSGlobal(void) { } static GSTEXTURE * prepare_new_texture(void) { - GSTEXTURE *texture = malloc(sizeof *texture); - texture->Width = 0; - texture->Height = 0; - texture->Mem = NULL; + GSTEXTURE *texture = calloc(1, sizeof(*texture)); return texture; } @@ -102,7 +107,7 @@ static void color_correction16(uint16_t *buffer, uint32_t dimensions) uint16_t x16; for (i = 0; i < dimensions; i++) { x16 = buffer[i]; - buffer[i] = (x16 & 0x8000) | ((x16 << 10) & 0x7C00) | (x16 & 0x3E0) | ((x16 >> 10) & 0x1F); + buffer[i] = (x16 & 0x8000) | ((x16 << 10) & 0x7C00) | ((x16 >> 1) & 0x3E0) | ((x16 >> 11) & 0x1F); } } @@ -148,16 +153,9 @@ static void vram_alloc(GSGLOBAL *gsGlobal, GSTEXTURE *texture) { static void prim_texture(GSGLOBAL *gsGlobal, GSTEXTURE *texture, int zPosition, bool force_aspect) { float x1, y1, x2, y2; if (force_aspect) { - float delta = 1.0f; - float texture_aspect_ratio = texture->Width / texture->Height; - float gsGlobal_aspect_ratio = gsGlobal->Width / gsGlobal->Height; - if (texture_aspect_ratio < gsGlobal_aspect_ratio) { - //height - delta = gsGlobal->Height / texture->Height; - } else { - //width - delta = gsGlobal->Width / texture->Width; - } + float width_proportion = (float)gsGlobal->Width / (float)texture->Width; + float height_proportion = (float)gsGlobal->Height / (float)texture->Height; + float delta = MIN(width_proportion, height_proportion); float newWidth = texture->Width * delta; float newHeight = texture->Height * delta; diff --git a/gfx/drivers_context/orbis_ctx.c b/gfx/drivers_context/orbis_ctx.c new file mode 100644 index 0000000000..999e51ef53 --- /dev/null +++ b/gfx/drivers_context/orbis_ctx.c @@ -0,0 +1,302 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2018 - M4xw + * + * RetroArch is free software: 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 + + +#include "../common/orbis_common.h" +#include "../../frontend/frontend_driver.h" + +static enum gfx_ctx_api ctx_orbis_api = GFX_CTX_OPENGL_API; + +orbis_ctx_data_t *nx_ctx_ptr = NULL; + +extern bool platform_orbis_has_focus; + +void orbis_ctx_destroy(void *data) +{ + orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data; + + if (ctx_orbis) + { +#ifdef HAVE_EGL + egl_destroy(&ctx_orbis->egl); +#endif + ctx_orbis->resize = false; + free(ctx_orbis); + } +} + +static void orbis_ctx_get_video_size(void *data, + unsigned *width, unsigned *height) +{ + orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data; + + *width = ATTR_ORBISGL_WIDTH; + *height = ATTR_ORBISGL_HEIGHT; +} + +static void *orbis_ctx_init(video_frame_info_t *video_info, void *video_driver) +{ +#ifdef HAVE_EGL + int ret; + EGLint n; + EGLint major, minor; + static const EGLint attribs[] = { + EGL_BLUE_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_RED_SIZE, 8, + EGL_ALPHA_SIZE, 8, + EGL_NONE}; +#endif + + orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)calloc(1, sizeof(*ctx_orbis)); + + if (!ctx_orbis) + return NULL; + + nx_ctx_ptr = ctx_orbis; + +#ifdef HAVE_EGL + + memset(&ctx_orbis->pgl_config, 0, sizeof(ctx_orbis->pgl_config)); + { + ctx_orbis->pgl_config.size=sizeof(ctx_orbis->pgl_config); + ctx_orbis->pgl_config.flags=SCE_PGL_FLAGS_USE_COMPOSITE_EXT | SCE_PGL_FLAGS_USE_FLEXIBLE_MEMORY | 0x60; + ctx_orbis->pgl_config.processOrder=1; + ctx_orbis->pgl_config.systemSharedMemorySize=0x200000; + ctx_orbis->pgl_config.videoSharedMemorySize=0x2400000; + ctx_orbis->pgl_config.maxMappedFlexibleMemory=0xAA00000; + ctx_orbis->pgl_config.drawCommandBufferSize=0xC0000; + ctx_orbis->pgl_config.lcueResourceBufferSize=0x10000; + ctx_orbis->pgl_config.dbgPosCmd_0x40=ATTR_ORBISGL_WIDTH; + ctx_orbis->pgl_config.dbgPosCmd_0x44=ATTR_ORBISGL_HEIGHT; + ctx_orbis->pgl_config.dbgPosCmd_0x48=0; + ctx_orbis->pgl_config.dbgPosCmd_0x4C=0; + ctx_orbis->pgl_config.unk_0x5C=2; + } + ret = scePigletSetConfigurationVSH(&ctx_orbis->pgl_config); + if (!ret) + { + printf("[ORBISGL] scePigletSetConfigurationVSH failed 0x%08X.\n",ret); + goto error; + } + + if (!egl_init_context(&ctx_orbis->egl, EGL_NONE, EGL_DEFAULT_DISPLAY, + &major, &minor, &n, attribs, NULL)) + { + egl_report_error(); + printf("[ORBIS]: EGL error: %d.\n", eglGetError()); + goto error; + } +#endif + + return ctx_orbis; + +error: + orbis_ctx_destroy(video_driver); + return NULL; +} + +static void orbis_ctx_check_window(void *data, bool *quit, + bool *resize, unsigned *width, unsigned *height, bool is_shutdown) +{ + unsigned new_width, new_height; + + orbis_ctx_get_video_size(data, &new_width, &new_height); + + if (new_width != *width || new_height != *height) + { + *width = new_width; + *height = new_height; + *resize = true; + } + + *quit = (bool)false; +} + +static bool orbis_ctx_set_video_mode(void *data, + video_frame_info_t *video_info, + unsigned width, unsigned height, + bool fullscreen) +{ + /* Create an EGL rendering context */ + static const EGLint contextAttributeList[] = + { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE}; + + orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data; + + ctx_orbis->width = ATTR_ORBISGL_HEIGHT; + ctx_orbis->height = ATTR_ORBISGL_WIDTH; + + ctx_orbis->native_window.width = ctx_orbis->width; + ctx_orbis->native_window.height = ctx_orbis->height; + + ctx_orbis->refresh_rate = 60; + +#ifdef HAVE_EGL + if (!egl_create_context(&ctx_orbis->egl, contextAttributeList)) + { + egl_report_error(); + goto error; + } +#endif + +#ifdef HAVE_EGL + if (!egl_create_surface(&ctx_orbis->egl, &ctx_orbis->native_window)) + goto error; +#endif + + return true; + +error: + printf("[ctx_orbis]: EGL error: %d.\n", eglGetError()); + orbis_ctx_destroy(data); + + return false; +} + +static void orbis_ctx_input_driver(void *data, + const char *name, + const input_driver_t **input, void **input_data) +{ + *input = NULL; + *input_data = NULL; +} + +static enum gfx_ctx_api orbis_ctx_get_api(void *data) +{ + return ctx_orbis_api; +} + +static bool orbis_ctx_bind_api(void *data, + enum gfx_ctx_api api, unsigned major, unsigned minor) +{ + (void)data; + ctx_orbis_api = api; + + if (api == GFX_CTX_OPENGL_ES_API) + if (eglBindAPI(EGL_OPENGL_ES_API) != EGL_FALSE) + return true; + + return false; +} + +static bool orbis_ctx_has_focus(void *data) +{ + (void)data; + return true; +} + +static bool orbis_ctx_suppress_screensaver(void *data, bool enable) +{ + (void)data; + (void)enable; + return false; +} + +static void orbis_ctx_set_swap_interval(void *data, + int swap_interval) +{ + orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data; + +#ifdef HAVE_EGL + egl_set_swap_interval(&ctx_orbis->egl, swap_interval); +#endif +} + +static void orbis_ctx_swap_buffers(void *data, void *data2) +{ + orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data; + +#ifdef HAVE_EGL + egl_swap_buffers(&ctx_orbis->egl); +#endif +} + +static gfx_ctx_proc_t orbis_ctx_get_proc_address(const char *symbol) +{ +#ifdef HAVE_EGL + return egl_get_proc_address(symbol); +#endif +} + +static void orbis_ctx_bind_hw_render(void *data, bool enable) +{ + orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data; + +#ifdef HAVE_EGL + egl_bind_hw_render(&ctx_orbis->egl, enable); +#endif +} + +static uint32_t orbis_ctx_get_flags(void *data) +{ + uint32_t flags = 0; + BIT32_SET(flags, GFX_CTX_FLAGS_NONE); + + return flags; +} + +static void orbis_ctx_set_flags(void *data, uint32_t flags) +{ + (void)data; +} + +static float orbis_ctx_get_refresh_rate(void *data) +{ + orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data; + + return ctx_orbis->refresh_rate; +} + +const gfx_ctx_driver_t orbis_ctx = { + orbis_ctx_init, + orbis_ctx_destroy, + orbis_ctx_get_api, + orbis_ctx_bind_api, + orbis_ctx_set_swap_interval, + orbis_ctx_set_video_mode, + orbis_ctx_get_video_size, + orbis_ctx_get_refresh_rate, + NULL, /* get_video_output_size */ + NULL, /* get_video_output_prev */ + NULL, /* get_video_output_next */ + NULL, /* get_metrics */ + NULL, + NULL, /* update_title */ + orbis_ctx_check_window, + NULL, /* set_resize */ + orbis_ctx_has_focus, + orbis_ctx_suppress_screensaver, + NULL, /* has_windowed */ + orbis_ctx_swap_buffers, + orbis_ctx_input_driver, + orbis_ctx_get_proc_address, + NULL, + NULL, + NULL, + "orbis", + orbis_ctx_get_flags, + orbis_ctx_set_flags, + orbis_ctx_bind_hw_render, + NULL, + NULL}; diff --git a/gfx/drivers_context/switch_ctx.c b/gfx/drivers_context/switch_ctx.c index 6a8e075cd6..1bdfe71447 100644 --- a/gfx/drivers_context/switch_ctx.c +++ b/gfx/drivers_context/switch_ctx.c @@ -46,10 +46,20 @@ void switch_ctx_destroy(void *data) static void switch_ctx_get_video_size(void *data, unsigned *width, unsigned *height) { - switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data; + switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data; - *width = 1280; - *height = 720; + switch (appletGetOperationMode()) + { + default: + case AppletOperationMode_Handheld: + *width = 1280; + *height = 720; + break; + case AppletOperationMode_Docked: + *width = 1920; + *height = 1080; + break; + } } static void *switch_ctx_init(video_frame_info_t *video_info, void *video_driver) @@ -86,6 +96,10 @@ static void *switch_ctx_init(video_frame_info_t *video_info, void *video_driver) setenv("NV50_PROG_CHIPSET", "0x120", 1); #endif + // Needs to be here + gfxInitResolutionDefault(); // 1080p + gfxConfigureResolution(1920, 1080); + #ifdef HAVE_EGL if (!egl_init_context(&ctx_nx->egl, EGL_NONE, EGL_DEFAULT_DISPLAY, &major, &minor, &n, attribs, NULL)) @@ -114,7 +128,18 @@ static void switch_ctx_check_window(void *data, bool *quit, { *width = new_width; *height = new_height; + switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data; + + ctx_nx->width = *width; + ctx_nx->height = *height; + + ctx_nx->native_window.width = ctx_nx->width; + ctx_nx->native_window.height = ctx_nx->height; + ctx_nx->resize = true; + *resize = true; + printf("[NXGL]: Resizing to %dx%d\n", *width, *height); + gfxConfigureCrop(0, 1080 - ctx_nx->height, ctx_nx->width, 1080); } *quit = (bool)false; @@ -133,8 +158,7 @@ static bool switch_ctx_set_video_mode(void *data, switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data; - ctx_nx->width = 1280; - ctx_nx->height = 720; + switch_ctx_get_video_size(data, &ctx_nx->width, &ctx_nx->height); ctx_nx->native_window.width = ctx_nx->width; ctx_nx->native_window.height = ctx_nx->height; @@ -154,10 +178,12 @@ static bool switch_ctx_set_video_mode(void *data, goto error; #endif + gfxConfigureCrop(0, 1080 - ctx_nx->height, ctx_nx->width, 1080); + return true; error: - printf("[ctx_nx]: EGL error: %d.\n", eglGetError()); + printf("[NXGL]: EGL error: %d.\n", eglGetError()); switch_ctx_destroy(data); return false; diff --git a/gfx/drivers_context/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index 01a5e52133..4037cc349e 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -870,8 +870,8 @@ static void gfx_ctx_wl_get_video_size(void *data, { gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; - *width = wl->width; - *height = wl->height; + *width = wl->width * wl->buffer_scale; + *height = wl->height * wl->buffer_scale; } static void gfx_ctx_wl_destroy_resources(gfx_ctx_wayland_data_t *wl) @@ -1058,8 +1058,8 @@ static bool gfx_ctx_wl_set_resize(void *data, unsigned width, unsigned height) break; case GFX_CTX_VULKAN_API: #ifdef HAVE_VULKAN - wl->width = width; - wl->height = height; + wl->width = width / wl->buffer_scale; + wl->height = height / wl->buffer_scale; if (vulkan_create_swapchain(&wl->vk, width, height, wl->swap_interval)) { @@ -1618,7 +1618,7 @@ static bool gfx_ctx_wl_set_video_mode(void *data, #ifdef HAVE_VULKAN if (!vulkan_surface_create(&wl->vk, VULKAN_WSI_WAYLAND, wl->input.dpy, wl->surface, - wl->width, wl->height, wl->swap_interval)) + wl->width * wl->buffer_scale, wl->height * wl->buffer_scale, wl->swap_interval)) goto error; #endif break; diff --git a/gfx/font_driver.c b/gfx/font_driver.c index 07ce2dd93c..8eaf1d2447 100644 --- a/gfx/font_driver.c +++ b/gfx/font_driver.c @@ -278,7 +278,7 @@ static bool vga_font_init_first( } #endif -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) static const font_renderer_t *gdi_font_backends[] = { &gdi_font, NULL, @@ -666,7 +666,7 @@ static bool font_init_first( return switch_font_init_first(font_driver, font_handle, video_data, font_path, font_size, is_threaded); #endif -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) case FONT_DRIVER_RENDER_GDI: return gdi_font_init_first(font_driver, font_handle, video_data, font_path, font_size, is_threaded); diff --git a/gfx/video_display_server.c b/gfx/video_display_server.c index e4824a0a46..73dd8c92ca 100644 --- a/gfx/video_display_server.c +++ b/gfx/video_display_server.c @@ -39,7 +39,7 @@ void* video_display_server_init(void) switch (type) { case RARCH_DISPLAY_WIN32: -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) current_display_server = &dispserv_win32; #endif break; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 88ef1862ef..cfdf468d5d 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -274,14 +274,14 @@ static const video_driver_t *video_drivers[] = { #ifdef XENON &video_xenon360, #endif -#if defined(HAVE_D3D10) - &video_d3d10, +#if defined(HAVE_D3D12) + &video_d3d12, #endif #if defined(HAVE_D3D11) &video_d3d11, #endif -#if defined(HAVE_D3D12) - &video_d3d12, +#if defined(HAVE_D3D10) + &video_d3d10, #endif #if defined(HAVE_D3D9) &video_d3d9, @@ -340,7 +340,7 @@ static const video_driver_t *video_drivers[] = { #ifdef HAVE_XSHM &video_xshm, #endif -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) &video_gdi, #endif #ifdef DJGPP @@ -357,6 +357,9 @@ static const video_driver_t *video_drivers[] = { }; static const gfx_ctx_driver_t *gfx_ctx_drivers[] = { +#if defined(ORBIS) + &orbis_ctx, +#endif #if defined(HAVE_LIBNX) && defined(HAVE_OPENGL) &switch_ctx, #endif @@ -416,7 +419,7 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = { #if defined(HAVE_VULKAN) && defined(HAVE_VULKAN_DISPLAY) &gfx_ctx_khr_display, #endif -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) &gfx_ctx_gdi, #endif #ifdef HAVE_SIXEL diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 3a261ebdb8..ba380809c4 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -1299,6 +1299,7 @@ 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_sixel; extern const gfx_ctx_driver_t switch_ctx; +extern const gfx_ctx_driver_t orbis_ctx; extern const gfx_ctx_driver_t gfx_ctx_null; diff --git a/gfx/video_filters/snes_ntsc/snes_ntsc_impl.h b/gfx/video_filters/snes_ntsc/snes_ntsc_impl.h index fc9be63739..36d767d697 100644 --- a/gfx/video_filters/snes_ntsc/snes_ntsc_impl.h +++ b/gfx/video_filters/snes_ntsc/snes_ntsc_impl.h @@ -4,7 +4,7 @@ /* Common implementation of NTSC filters */ -#include +#include #include /* Copyright (C) 2006 Shay Green. This module is free software; you @@ -121,7 +121,7 @@ static void init_filters( init_t* impl, snes_ntsc_setup_t const* setup ) { int x = kernel_size * 3 / 2 - kernel_half + i; kernels [x] *= sum; - assert( kernels [x] == kernels [x] ); /* catch numerical instability */ + retro_assert( kernels [x] == kernels [x] ); /* catch numerical instability */ } } @@ -156,7 +156,7 @@ static void init_filters( init_t* impl, snes_ntsc_setup_t const* setup ) for ( x = i; x < kernel_size; x += 2 ) { kernels [x] *= sum; - assert( kernels [x] == kernels [x] ); /* catch numerical instability */ + retro_assert( kernels [x] == kernels [x] ); /* catch numerical instability */ } } } diff --git a/griffin/griffin.c b/griffin/griffin.c index 4589cafc12..6318513754 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -601,6 +601,9 @@ INPUT #elif defined(DJGPP) #include "../input/drivers/dos_input.c" #include "../input/drivers_joypad/dos_joypad.c" +#elif defined(__WINRT__) +#include "../input/drivers/xdk_xinput_input.c" +#include "../input/drivers/uwp_input.c" #endif #ifdef HAVE_WAYLAND @@ -770,7 +773,7 @@ AUDIO #elif defined(PSP) || defined(VITA) #include "../audio/drivers/psp_audio.c" #elif defined(PS2) -// #include "../audio/drivers/ps2_audio.c" +#include "../audio/drivers/ps2_audio.c" #elif defined(_3DS) #include "../audio/drivers/ctr_csnd_audio.c" #include "../audio/drivers/ctr_dsp_audio.c" @@ -951,6 +954,10 @@ FRONTEND #include "../frontend/drivers/platform_win32.c" #endif +#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#include "../frontend/drivers/platform_uwp.c" +#endif + #ifdef _XBOX #include "../frontend/drivers/platform_xdk.c" #endif @@ -966,6 +973,8 @@ FRONTEND #include "../frontend/drivers/platform_wiiu.c" #elif defined(PSP) || defined(VITA) #include "../frontend/drivers/platform_psp.c" +#elif defined(ORBIS) +#include "../frontend/drivers/platform_orbis.c" #elif defined(PS2) #include "../frontend/drivers/platform_ps2.c" #elif defined(_3DS) @@ -1259,7 +1268,7 @@ MENU #include "../menu/drivers_display/menu_display_vga.c" #endif -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) #include "../menu/drivers_display/menu_display_gdi.c" #endif diff --git a/input/drivers/dinput.c b/input/drivers/dinput.c index 4d3b7cace7..2d97f02495 100644 --- a/input/drivers/dinput.c +++ b/input/drivers/dinput.c @@ -98,6 +98,8 @@ void dinput_destroy_context(void) IDirectInput8_Release(g_dinput_ctx); g_dinput_ctx = NULL; + + CoUninitialize(); } bool dinput_init_context(void) @@ -105,7 +107,11 @@ bool dinput_init_context(void) if (g_dinput_ctx) return true; - CoInitialize(NULL); + if (FAILED(CoInitialize(NULL))) + { + RARCH_ERR("[DINPUT]: Failed to initialize the COM interface\n"); + return false; + } /* Who said we shouldn't have same call signature in a COM API? <_< */ #ifdef __cplusplus @@ -125,6 +131,7 @@ bool dinput_init_context(void) error: RARCH_ERR("[DINPUT]: Failed to initialize DirectInput.\n"); + CoUninitialize(); return false; } diff --git a/input/drivers/ps2_input.c b/input/drivers/ps2_input.c index 6942c700f9..733bd75b04 100644 --- a/input/drivers/ps2_input.c +++ b/input/drivers/ps2_input.c @@ -1,6 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2011-2018 - Francisco Javier Trujillo Mata - fjtrujy * * RetroArch is free software: 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/udev_input.c b/input/drivers/udev_input.c index f143a44a30..455c54a1b9 100644 --- a/input/drivers/udev_input.c +++ b/input/drivers/udev_input.c @@ -14,7 +14,8 @@ * If not, see . */ -/* TODO/FIXME - set this once the kqueue codepath is implemented and working properly */ +/* TODO/FIXME - set this once the kqueue codepath is implemented and working properly, + * also remove libepoll-shim from the Makefile when that happens. */ #if 1 #define HAVE_EPOLL #else @@ -46,7 +47,9 @@ #include #include +#ifdef __linux__ #include +#endif #include #include @@ -1204,7 +1207,9 @@ static void *udev_input_init(const char *joypad_driver) udev->joypad = input_joypad_init_driver(joypad_driver, udev); input_keymaps_init_keyboard_lut(rarch_key_map_linux); +#ifdef __linux__ linux_terminal_disable_input(); +#endif #ifndef HAVE_X11 RARCH_WARN("[udev]: Full-screen pointer won't be available.\n"); @@ -1299,7 +1304,11 @@ input_driver_t input_udev = { udev_input_get_capabilities, "udev", udev_input_grab_mouse, +#ifdef __linux__ linux_terminal_grab_stdin, +#else + NULL, +#endif udev_input_set_rumble, udev_input_get_joypad_driver, NULL, diff --git a/input/drivers/uwp_input.c b/input/drivers/uwp_input.c new file mode 100644 index 0000000000..4c2f53af19 --- /dev/null +++ b/input/drivers/uwp_input.c @@ -0,0 +1,174 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2018 - Krzysztof Haładyn + * + * RetroArch is free software: 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 +#include + +#include + +#include "../input_driver.h" + +// TODO: Add support for multiple mice and multiple touch + +typedef struct uwp_input +{ + bool blocked; + const input_device_driver_t *joypad; +} uwp_input_t; + +static void uwp_input_poll(void *data) +{ + uwp_input_t *uwp = (uwp_input_t*)data; + + if (uwp && uwp->joypad) + uwp->joypad->poll(); + + uwp_input_next_frame(); +} + +static int16_t uwp_input_state(void *data, + rarch_joypad_info_t joypad_info, + const struct retro_keybind **binds, + unsigned port, unsigned device, + unsigned index, unsigned id) +{ + uwp_input_t *uwp = (uwp_input_t*)data; + + switch (device) + { + case RETRO_DEVICE_JOYPAD: + return input_joypad_pressed(uwp->joypad, joypad_info, port, binds[port], id); + case RETRO_DEVICE_ANALOG: + if (binds[port]) + return input_joypad_analog(uwp->joypad, joypad_info, port, index, id, binds[port]); + break; + + case RETRO_DEVICE_KEYBOARD: + return (id < RETROK_LAST) && uwp_keyboard_pressed(id); + + case RETRO_DEVICE_MOUSE: + case RARCH_DEVICE_MOUSE_SCREEN: + return uwp_mouse_state(port, id, device == RARCH_DEVICE_MOUSE_SCREEN); + + case RETRO_DEVICE_POINTER: + case RARCH_DEVICE_POINTER_SCREEN: + return uwp_pointer_state(index, id, device == RARCH_DEVICE_POINTER_SCREEN); + } + + return 0; +} + +static void uwp_input_free_input(void *data) +{ + uwp_input_t *uwp = (uwp_input_t*)data; + + if (!uwp) + return; + + if (uwp->joypad) + uwp->joypad->destroy(); + + free(uwp); +} + +static void *uwp_input_init(const char *joypad_driver) +{ + uwp_input_t *uwp = (uwp_input_t*)calloc(1, sizeof(*uwp)); + if (!uwp) + return NULL; + + input_keymaps_init_keyboard_lut(rarch_key_map_uwp); + + uwp->joypad = input_joypad_init_driver(joypad_driver, uwp); + + return uwp; +} + +static uint64_t uwp_input_get_capabilities(void *data) +{ + uint64_t caps = 0; + + caps |= (1 << RETRO_DEVICE_JOYPAD); + caps |= (1 << RETRO_DEVICE_MOUSE); + caps |= (1 << RETRO_DEVICE_KEYBOARD); + caps |= (1 << RETRO_DEVICE_POINTER); + caps |= (1 << RETRO_DEVICE_ANALOG); + + return caps; +} + +static bool uwp_input_set_rumble(void *data, unsigned port, + enum retro_rumble_effect effect, uint16_t strength) +{ + struct uwp_input *uwp = (struct uwp_input*)data; + if (!uwp) + return false; + return input_joypad_set_rumble(uwp->joypad, port, effect, strength); +} + +static const input_device_driver_t *uwp_input_get_joypad_driver(void *data) +{ + uwp_input_t *uwp = (uwp_input_t*)data; + if (!uwp) + return NULL; + return uwp->joypad; +} + +static void uwp_input_grab_mouse(void *data, bool state) +{ + (void)data; + (void)state; +} + +static bool uwp_keyboard_mapping_is_blocked(void *data) +{ + uwp_input_t *uwp = (uwp_input_t*)data; + if (!uwp) + return false; + return uwp->blocked; +} + +static void uwp_keyboard_mapping_set_block(void *data, bool value) +{ + uwp_input_t *uwp = (uwp_input_t*)data; + if (!uwp) + return; + uwp->blocked = value; +} + +input_driver_t input_uwp = { + uwp_input_init, + uwp_input_poll, + uwp_input_state, + uwp_input_free_input, + NULL, + NULL, + uwp_input_get_capabilities, + "uwp", + uwp_input_grab_mouse, + NULL, + uwp_input_set_rumble, + uwp_input_get_joypad_driver, + NULL, + uwp_keyboard_mapping_is_blocked, + uwp_keyboard_mapping_set_block, +}; diff --git a/input/drivers_joypad/ps2_joypad.c b/input/drivers_joypad/ps2_joypad.c index 969c075ebe..35d05cf3e9 100644 --- a/input/drivers_joypad/ps2_joypad.c +++ b/input/drivers_joypad/ps2_joypad.c @@ -1,7 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2017 - Daniel De Matteis - * Copyright (C) 2013-2014 - CatalystG + * Copyright (C) 2011-2018 - Francisco Javier Trujillo Mata - fjtrujy * * RetroArch is free software: 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/sdl_joypad.c b/input/drivers_joypad/sdl_joypad.c index 05ccfad1a5..8a3c224ab6 100644 --- a/input/drivers_joypad/sdl_joypad.c +++ b/input/drivers_joypad/sdl_joypad.c @@ -399,6 +399,8 @@ static void sdl_joypad_poll(void) break; } } + + SDL_FlushEvents(SDL_JOYAXISMOTION, SDL_CONTROLLERDEVICEREMAPPED); #else SDL_JoystickUpdate(); #endif diff --git a/input/drivers_joypad/udev_joypad.c b/input/drivers_joypad/udev_joypad.c index 2841032dda..6146e1e552 100644 --- a/input/drivers_joypad/udev_joypad.c +++ b/input/drivers_joypad/udev_joypad.c @@ -25,7 +25,9 @@ #include #include #include +#ifdef __linux__ #include +#endif #include #include diff --git a/input/drivers_joypad/xinput_joypad.c b/input/drivers_joypad/xinput_joypad.c index a7b5e639a8..8bf4d26594 100644 --- a/input/drivers_joypad/xinput_joypad.c +++ b/input/drivers_joypad/xinput_joypad.c @@ -42,12 +42,20 @@ #ifdef HAVE_DINPUT #include "dinput_joypad.h" +#else +int g_xinput_pad_indexes[MAX_USERS]; +bool g_xinput_block_pads; +#endif + +#if defined(__WINRT__) +#include #endif /* Check if the definitions do not already exist. * Official and mingw xinput headers have different include guards. + * Windows 10 API version doesn't have an include guard at all and just uses #pragma once instead */ -#if ((!_XINPUT_H_) && (!__WINE_XINPUT_H)) +#if ((!_XINPUT_H_) && (!__WINE_XINPUT_H)) && !defined(__WINRT__) #define XINPUT_GAMEPAD_DPAD_UP 0x0001 #define XINPUT_GAMEPAD_DPAD_DOWN 0x0002 @@ -173,7 +181,7 @@ const char *xinput_joypad_name(unsigned pad) return XBOX_CONTROLLER_NAMES[xuser]; } -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) static bool load_xinput_dll(void) { const char *version = "1.4"; @@ -210,7 +218,7 @@ static bool xinput_joypad_init(void *data) unsigned i, j; XINPUT_STATE dummy_state; -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) if (!g_xinput_dll) if (!load_xinput_dll()) return false; @@ -219,6 +227,9 @@ static bool xinput_joypad_init(void *data) * First try to load ordinal 100 (XInputGetStateEx). */ g_XInputGetStateEx = (XInputGetStateEx_t)dylib_proc(g_xinput_dll, (const char*)100); +#elif defined(__WINRT__) + /* XInputGetStateEx is not available on WinRT */ + g_XInputGetStateEx = NULL; #else g_XInputGetStateEx = (XInputGetStateEx_t)XInputGetStateEx; #endif @@ -230,7 +241,7 @@ static bool xinput_joypad_init(void *data) * XInputGetState, at the cost of losing guide button support. */ g_xinput_guide_button_supported = false; -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) g_XInputGetStateEx = (XInputGetStateEx_t)dylib_proc(g_xinput_dll, "XInputGetState"); #else g_XInputGetStateEx = (XInputGetStateEx_t)XInputGetState; @@ -239,7 +250,7 @@ static bool xinput_joypad_init(void *data) if (!g_XInputGetStateEx) { RARCH_ERR("[XInput]: Failed to init: DLL is invalid or corrupt.\n"); -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) dylib_close(g_xinput_dll); #endif return false; /* DLL was loaded but did not contain the correct function. */ @@ -247,7 +258,7 @@ static bool xinput_joypad_init(void *data) RARCH_WARN("[XInput]: No guide button support.\n"); } -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) g_XInputSetState = (XInputSetState_t)dylib_proc(g_xinput_dll, "XInputSetState"); #else g_XInputSetState = (XInputSetState_t)XInputSetState; @@ -255,7 +266,7 @@ static bool xinput_joypad_init(void *data) if (!g_XInputSetState) { RARCH_ERR("[XInput]: Failed to init: DLL is invalid or corrupt.\n"); -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) dylib_close(g_xinput_dll); #endif return false; /* DLL was loaded but did not contain the correct function. */ @@ -277,7 +288,11 @@ static bool xinput_joypad_init(void *data) (!g_xinput_states[1].connected) && (!g_xinput_states[2].connected) && (!g_xinput_states[3].connected)) +#ifdef __WINRT__ + return true; +#else return false; +#endif RARCH_LOG("[XInput]: Pads connected: %d\n", g_xinput_states[0].connected + g_xinput_states[1].connected + g_xinput_states[2].connected + g_xinput_states[3].connected); @@ -347,7 +362,7 @@ static void xinput_joypad_destroy(void) for (i = 0; i < 4; ++i) memset(&g_xinput_states[i], 0, sizeof(xinput_joypad_state)); -#ifdef HAVE_DYNAMIC +#if defined(HAVE_DYNAMIC) && !defined(__WINRT__) dylib_close(g_xinput_dll); g_xinput_dll = NULL; @@ -499,6 +514,7 @@ static void xinput_joypad_poll(void) for (i = 0; i < 4; ++i) { +#ifdef HAVE_DINPUT if (g_xinput_states[i].connected) { if (g_XInputGetStateEx && g_XInputGetStateEx(i, @@ -506,6 +522,28 @@ static void xinput_joypad_poll(void) == ERROR_DEVICE_NOT_CONNECTED) g_xinput_states[i].connected = false; } +#else + /* Normally, dinput handles device insertion/removal for us, but + * since dinput is not available on UWP we have to do it ourselves */ + /* Also note that on UWP, the controllers are not available on startup + * and are instead 'plugged in' a moment later because Microsoft reasons */ + // TODO: This may be bad for performance? + bool new_connected = g_XInputGetStateEx && g_XInputGetStateEx(i, &(g_xinput_states[i].xstate)) != ERROR_DEVICE_NOT_CONNECTED; + if (new_connected != g_xinput_states[i].connected) + { + if (new_connected) + { + /* This is kinda ugly, but it's the same thing that dinput does */ + xinput_joypad_destroy(); + xinput_joypad_init(NULL); + return; + } + else + { + g_xinput_states[i].connected = new_connected; + } + } +#endif } #ifdef HAVE_DINPUT diff --git a/input/input_driver.c b/input/input_driver.c index 3d9d60f683..709fac324b 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -104,10 +104,13 @@ static const input_driver_t *input_drivers[] = { #ifdef HAVE_X11 &input_x, #endif +#ifdef __WINRT__ + &input_uwp, +#endif #ifdef XENON &input_xenon360, #endif -#if defined(HAVE_XINPUT2) || defined(HAVE_XINPUT_XBOX1) +#if defined(HAVE_XINPUT2) || defined(HAVE_XINPUT_XBOX1) || defined(__WINRT__) &input_xinput, #endif #ifdef GEKKO @@ -137,7 +140,7 @@ static const input_driver_t *input_drivers[] = { #ifdef DJGPP &input_dos, #endif -#if defined(_WIN32) && !defined(_XBOX) && _WIN32_WINNT >= 0x0501 +#if defined(_WIN32) && !defined(_XBOX) && _WIN32_WINNT >= 0x0501 && !defined(__WINRT__) /* winraw only available since XP */ &input_winraw, #endif diff --git a/input/input_driver.h b/input/input_driver.h index 1ac166478b..11fcc415b8 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -834,6 +834,7 @@ extern input_driver_t input_xenon360; extern input_driver_t input_gx; extern input_driver_t input_wiiu; extern input_driver_t input_xinput; +extern input_driver_t input_uwp; extern input_driver_t input_linuxraw; extern input_driver_t input_udev; extern input_driver_t input_cocoa; diff --git a/input/input_keymaps.c b/input/input_keymaps.c index ff3817ad92..522f77ae32 100644 --- a/input/input_keymaps.c +++ b/input/input_keymaps.c @@ -44,7 +44,7 @@ #include "SDL.h" #endif -#ifdef __linux__ +#if defined(__linux__) || defined(HAVE_WAYLAND) #include #include #endif @@ -848,7 +848,7 @@ const struct rarch_key_map rarch_key_map_x11[] = { }; #endif -#ifdef __linux__ +#if defined(__linux__) || defined(HAVE_WAYLAND) const struct rarch_key_map rarch_key_map_linux[] = { { KEY_BACKSPACE, RETROK_BACKSPACE }, { KEY_TAB, RETROK_TAB }, @@ -1423,7 +1423,7 @@ const struct rarch_key_map rarch_key_map_dos[] = { }; #endif -#if defined(_WIN32) && _WIN32_WINNT >= 0x0501 +#if defined(_WIN32) && _WIN32_WINNT >= 0x0501 && !defined(__WINRT__) const struct rarch_key_map rarch_key_map_winraw[] = { { VK_BACK, RETROK_BACKSPACE }, { VK_TAB, RETROK_TAB }, @@ -1539,6 +1539,11 @@ const struct rarch_key_map rarch_key_map_winraw[] = { }; #endif +#ifdef __WINRT__ +/* Refer to uwp_main.cpp - on WinRT these constants are defined as C++ enum classes + * so they can't be placed in a C source file */ +#endif + enum retro_key rarch_keysym_lut[RETROK_LAST]; /** diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 10841074c0..ef0fd5921a 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -7,8 +7,9 @@ MSG_HASH( "Unknown compiler" ) MSG_HASH( - MSG_NATIVE, - "Native") + MSG_NATIVE, + "Native" + ) MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, "Device disconnected from port" @@ -145,6 +146,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "Give hardware-rendered cores their own private context. Avoids having to assume hardware state changes inbetween frames." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "Adjusts menu screen appearance settings." @@ -888,8 +893,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_OVERLAY_NEXT, "Overlay next") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_PAUSE_TOGGLE, "Pause toggle") +#ifdef HAVE_LAKKA +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, + "Restart RetroArch") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, "Quit RetroArch") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_RESET, "Reset game") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_REWIND, @@ -2662,8 +2672,13 @@ MSG_HASH(MENU_ENUM_SUBLABEL_NETWORK_INFORMATION, "Show network interface(s) and associated IP addresses.") MSG_HASH(MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, "Show information specific to the device.") +#ifdef HAVE_LAKKA +MSG_HASH(MENU_ENUM_SUBLABEL_QUIT_RETROARCH, + "Restart the program.") +#else MSG_HASH(MENU_ENUM_SUBLABEL_QUIT_RETROARCH, "Quit the program.") +#endif MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, "Set the custom width size for the display window. Leaving it at 0 will attempt to scale the window as large as possible.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, @@ -3337,10 +3352,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_HELP, "Show Help") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_HELP, "Show/hide the 'Help' option.") +#ifdef HAVE_LAKKA +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, + "Show Restart RetroArch") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, + "Show/hide the 'Restart RetroArch' option.") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, "Show Quit RetroArch") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, "Show/hide the 'Quit RetroArch' option.") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT, "Show Reboot") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_REBOOT, diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 66a7eca707..97e543affc 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -35,8 +35,9 @@ MSG_HASH( "未知的编译器" ) MSG_HASH( - MSG_NATIVE, - "Native") + MSG_NATIVE, + "Native" + ) MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, "设备已从端口上断开" @@ -133,6 +134,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "Give hardware-rendered cores their own private context. Avoids having to assume hardware state changes inbetween frames." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "调整菜单屏幕相关的设置。" diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index 87b4a6ee68..05ff2c10f7 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -7,8 +7,9 @@ MSG_HASH( "未知的編譯器" ) MSG_HASH( - MSG_NATIVE, - "Native") + MSG_NATIVE, + "Native" + ) MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, "設備已從連接口上移開" @@ -105,6 +106,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "使用模擬器硬體渲染私人內容時可避免硬體在各frames時的狀態改變." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "調整選單顯示的相關設定。" @@ -985,6 +990,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS, /* TODO/FIXME - updat "選單文件瀏覽器") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_LINEAR_FILTER, "選單線性過濾") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_HORIZONTAL_ANIMATION, + "Horizontal Animation") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SETTINGS, "選單") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER, @@ -3145,10 +3152,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_HELP, "顯示 Help") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_HELP, "顯示/隱藏 the 'Help' option.") +#ifdef HAVE_LAKKA +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, + "顯示 Restart RetroArch") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, + "顯示/隱藏 the 'Restart RetroArch' option.") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, "顯示 Quit RetroArch") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, "顯示/隱藏 the 'Quit RetroArch' option.") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT, "顯示 Reboot") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_REBOOT, diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index 214f52dbf3..f690ec327d 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -35,8 +35,9 @@ MSG_HASH( "Unbekannter Compiler" ) MSG_HASH( - MSG_NATIVE, - "Native") + MSG_NATIVE, + "Native" + ) MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, "Gerät von Anschluss getrennt" @@ -133,6 +134,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "Gibt Hardware-gerenderten Cores einen eigenen privaten Kontext. Vermeidet, dass der Hardware-Status zwischen den Frames geschätzt werden muss." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "Legt die Einstellungen für das Aussehen des Menübildschirms fest." diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index a6c9cbb4e7..fae4ab9b95 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -146,6 +146,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "Give hardware-rendered cores their own private context. Avoids having to assume hardware state changes inbetween frames." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "Προσαρμόζει τις εμφανισιακές ρυθμίσεις της οθόνης του μενού." diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index b452179dea..f26d9f4c96 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -7,8 +7,9 @@ MSG_HASH( "Unknown compiler" ) MSG_HASH( - MSG_NATIVE, - "Native") + MSG_NATIVE, + "Native" + ) MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, "Device disconnected from port" @@ -45,6 +46,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "Give hardware-rendered cores their own private context. Avoids having to assume hardware state changes inbetween frames." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "Adjusts settings related to the appearance of the menu screen." @@ -745,8 +750,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_OVERLAY_NEXT, "Overlay next") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_PAUSE_TOGGLE, "Pause toggle") +#ifdef HAVE_LAKKA +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, + "Restart RetroArch") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, "Quit RetroArch") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_RESET, "Reset game") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_REWIND, @@ -1055,8 +1065,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PRESENT, "Present") MSG_HASH(MENU_ENUM_LABEL_VALUE_PRIVACY_SETTINGS, "Privacy") +#ifdef HAVE_LAKKA +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, + "Restart RetroArch") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, "Quit RetroArch") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ANALOG, "Analog supported") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_BBFC_RATING, @@ -2365,8 +2380,13 @@ MSG_HASH(MENU_ENUM_SUBLABEL_NETWORK_INFORMATION, "Show network interface(s) and associated IP addresses.") MSG_HASH(MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, "Show information specific to the device.") +#ifdef HAVE_LAKKA +MSG_HASH(MENU_ENUM_SUBLABEL_QUIT_RETROARCH, + "Restart the program.") +#else MSG_HASH(MENU_ENUM_SUBLABEL_QUIT_RETROARCH, "Quit the program.") +#endif MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, "Set the custom width size for the display window. Leaving it at 0 will attempt to scale the window as large as possible.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, @@ -3020,10 +3040,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_HELP, "Show Help") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_HELP, "Show/hide the 'Help' option.") +#ifdef HAVE_LAKKA +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, + "Show Restart RetroArch") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, + "Show/hide the 'Restart RetroArch' option.") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, "Show Quit RetroArch") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, "Show/hide the 'Quit RetroArch' option.") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT, "Show Reboot") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_REBOOT, diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index 5c6e193bd5..cbbb73f97e 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -7,7 +7,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE, "Acelera el procesador de video" ) - MSG_HASH( +MSG_HASH( MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL, "Brillo de pantalla" ) @@ -173,6 +173,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "Dar a los núcleos renderizados por hardware un contexto privado. Evita tener que asumir cambios en el estado del hardware entre cuadros" ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "Ajusta la apariencia del menú" @@ -673,6 +677,18 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_CORE_LIST, "Cargar núcleo" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SIDELOAD_CORE_LIST, + "Instalar or Restaurar un núcleo" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SIDELOAD_CORE_ERROR, + "Falló la instalación del núcleo" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SIDELOAD_CORE_SUCCESS, + "Núcleo instalado exitosamente" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CORE_OPTIONS, "Opciones" @@ -759,7 +775,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_DISK_CYCLE_TRAY_STATUS, - "Estado de la bandeja de discos" + "Abrir/Cerrar la bandeja de discos" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_DISK_IMAGE_APPEND, @@ -845,6 +861,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_FPS_SHOW, "Mostrar FPS" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MEMORY_SHOW, + "Incluir detalles de memoria" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE, "Limitar velocidad máxima de ejecución" @@ -1249,6 +1269,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_FRAMEADVANCE, "Avanzar frame" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_FPS_TOGGLE, + "Mostrar FPS" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_FULLSCREEN_TOGGLE_KEY, "Pantalla completa" @@ -1297,10 +1321,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_PAUSE_TOGGLE, "Pausar" ) +#ifdef HAVE_LAKKA +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, + "Reiniciar RetroArch" + ) +#else MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, "Cerrar RetroArch" ) +#endif MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_RESET, "Resetear juego" @@ -2049,10 +2080,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_MIDI_SETTINGS, "MIDI" ) +#ifdef HAVE_LAKKA +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, + "Reiniciar RetroArch" + ) +#else MSG_HASH( MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, "Cerrar RetroArch" ) +#endif MSG_HASH( MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ANALOG, "Soporte de analógico" @@ -2920,10 +2958,58 @@ MSG_HASH( MENU_ENUM_SUBLABEL_TIMEDATE_STYLE, "Cambia la forma en que se muestra la fecha y hora" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HMS, + "YYYY-MM-DD HH:MM:SS" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HM, + "YYYY-MM-DD HH:MM" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MDYYYY, + "MM-DD-YYYY HH:MM" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS, + "HH:MM:SS" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HM, + "HH:MM" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_DM_HM, + "DD/MM HH:MM" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MD_HM, + "MM/DD HH:MM" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_AM_PM, + "HH:MM:SS (AM/PM)" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TITLE_COLOR, "Color de títulos del menú" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BG_DARK_COLOR, + "Color oscuro del fondo del menú" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BG_LIGHT_COLOR, + "Color claro del fondo del menú" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BORDER_DARK_COLOR, + "Color oscuro del borde del menú" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BORDER_LIGHT_COLOR, + "Color claro del borde del menú" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TRUE, "Activado" @@ -3176,6 +3262,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_SCALE, "Escala en ventana" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_THREADS, + "Hilos de grabación (Threads)" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_SCALE_INTEGER, "Escalar usando enteros" @@ -3486,7 +3576,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_CHEEVOS_HARDCORE_MODE_ENABLE, - "Duplica puntos pero desactiva guardado rápido, trucos, rebobinar, y cámara lenta para todos los juegos" + "Duplica puntos pero desactiva guardado rápido, trucos, rebobinar, y cámara lenta." + "Cambiar esto reiniciará el juego." ) MSG_HASH( MENU_ENUM_SUBLABEL_CHEEVOS_LEADERBOARDS_ENABLE, @@ -3596,6 +3687,14 @@ MSG_HASH( MENU_ENUM_SUBLABEL_FPS_SHOW, "Muestra la velocidad de cuadros por segundo" ) +MSG_HASH( + MENU_ENUM_SUBLABEL_FRAMECOUNT_SHOW, + "Muestra el contador de frames" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MEMORY_SHOW, + "Muestra la cantidad de memoria usada/total" + ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS, "Opciones de teclas rápidas (hotkeys)" @@ -4838,6 +4937,14 @@ MSG_HASH( MENU_ENUM_SUBLABEL_CORE_LIST, "Seleccionar que núcleo usar" ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DOWNLOAD_CORE, + "Instalar un núcleo desde el Actualizador en línea" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SIDELOAD_CORE_LIST, + "Instalr o restaurar un núcleo desde la carpeta de descargas" + ) MSG_HASH( MENU_ENUM_SUBLABEL_LOAD_CONTENT_LIST, "Seleccionar que contenido iniciar" @@ -4850,10 +4957,17 @@ MSG_HASH( MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, "Mostrar información especifica del dispositivo" ) +#ifdef HAVE_LAKKA +MSG_HASH( + MENU_ENUM_SUBLABEL_QUIT_RETROARCH, + "Reiniciar el programa" + ) +#else MSG_HASH( MENU_ENUM_SUBLABEL_QUIT_RETROARCH, "Salir del programa" ) +#endif MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, "Establece el ancho de la ventana. Al dejarlo en 0 hará que intente ser lo mas grande posible" @@ -4862,6 +4976,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, "Establece el alto de la ventana. Al dejarlo en 0 hará que intente ser lo mas grande posible" ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SAVE_POSITION, + "Tomará precedencia sobre Escala en Ventana" + ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, "Establece el ancho en pantalla completa. Al dejarlo en 0 se usará la resolución del escritorio" @@ -6037,14 +6155,25 @@ MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SHOW_HELP, "Mostrar/ocultar la opción de 'Ayuda'" ) +#ifdef HAVE_LAKKA MSG_HASH( MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, - "Mostrar salir de RetroArch" + "Mostrar Reiniciar RetroArch" ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, - "Mostrar/ocultar la opción de 'Salir de RetroArch'" + "Mostrar/ocultar la opción de 'Reiniciar RetroArch'" ) +#else +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, + "Mostrar Cerrar RetroArch" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, + "Muestrar/Ocultar la opción de 'Cerrar RetroArch'" + ) +#endif MSG_HASH( MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT, "Mostrar reiniciar" @@ -6103,27 +6232,27 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_START_RECORDING, - "Show Start Recording" + "Mostrar Comenzar grabación" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_START_RECORDING, - "Show/hide the 'Start Recording' option." + "Mostrar/ocultar la opción de 'Comenzar grabación'" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_START_STREAMING, - "Show Start Streaming" + "Mostrar Comenzar Streamingg" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_START_STREAMING, - "Show/hide the 'Start Streaming' option." + "Mostrar/ocultar la opción de 'Comenzar Streaming'" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, - "Show Reset Core Association" + "Mostrar Restablecer asociación de núcleo" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, - "Show/hide the 'Reset Core Association' option." + "Mostrar/ocultar la opción de 'Restablecer asociación de núcleo'" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, @@ -7576,7 +7705,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_ADAPTIVE_VSYNC, - "V-Sync está activado hasta que el rendimiento sea inferior al necesario para mantener el refresco de pantalla. Puede minimizar los tirones cuando hay caidas de fps y es més eficiente energeticamente." + "V-Sync está activado hasta que el rendimiento sea inferior al necesario para mantener el refresco de pantalla.\n" + "Puede minimizar los tirones cuando hay caidas de fps y es més eficiente energeticamente." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCHRES_SETTINGS, @@ -7774,5 +7904,11 @@ MSG_HASH( MSG_MISSING_ASSETS, "ADVERTENCIA: Faltan recursos, use el Actualizador si está disponible" ) -MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, - "Remember Window Position and Size") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Recordar posición y tamaño de la ventana" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HOLD_START, + "Mantener Start (2 segundos)" + ) diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index 516718b0fc..ec9d2803c9 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -7,8 +7,9 @@ MSG_HASH( "Compilateur inconnu" ) MSG_HASH( - MSG_NATIVE, - "Native") + MSG_NATIVE, + "Native" + ) MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, "Périphérique déconnecté du port" @@ -105,6 +106,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "Donne aux cœurs bénéficiant de l'accélération graphique leur propre contexte. Évite d'avoir à supposer des changements d'état matériel entre deux images." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "Ajuster les réglages et l'apparence du menu." @@ -828,8 +833,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_OVERLAY_NEXT, "Overlay suivant") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_PAUSE_TOGGLE, "Pause") +#ifdef HAVE_LAKKA +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, + "Redémarrer RetroArch") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, "Quitter RetroArch") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_RESET, "Redémarrer le jeu") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_REWIND, @@ -984,6 +994,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS, "Réglages") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_LINEAR_FILTER, "Filtre linéaire pour le menu") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_HORIZONTAL_ANIMATION, + "Horizontal Animation") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SETTINGS, "Appearance") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER, @@ -1162,8 +1174,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PRESENT, "Présent") MSG_HASH(MENU_ENUM_LABEL_VALUE_PRIVACY_SETTINGS, "Confidentialité") +#ifdef HAVE_LAKKA +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, + "Redémarrer RetroArch") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, "Quitter RetroArch") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ANALOG, "Support de l'analogique") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_BBFC_RATING, @@ -3179,10 +3196,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_HELP, "Afficher l'aide") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_HELP, "Afficher/cacher l'option 'Afficher l'aide'.") +#ifdef HAVE_LAKKA +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, + "Afficher Redémarrer RetroArch") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, + "Afficher/cacher l'option 'Redémarrer RetroArch'.") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, "Afficher Quitter RetroArch") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, "Afficher/cacher l'option 'Quitter RetroArch'.") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT, "Afficher Redémarrer") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_REBOOT, diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index e7668d494b..6ab4cbd73c 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -7,8 +7,9 @@ MSG_HASH( "Compilatore sconosciuto" ) MSG_HASH( - MSG_NATIVE, - "Native") + MSG_NATIVE, + "Native" + ) MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, "Dispositivo disconnesso dalla porta" @@ -105,6 +106,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "Fornisce i core hardware nel proprio contesto privato. Evita di assumere cambiamenti di stato hardware tra i fotogrammi." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "Regola le impostazioni relative all'aspetto della schermata del menu." diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 0f3bfe42fb..5b1f980024 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -12,8 +12,9 @@ MSG_HASH( "不明なコンパイラ" ) MSG_HASH( - MSG_NATIVE, - "Native") + MSG_NATIVE, + "Native" + ) MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, "デバイスがポートから切断されました" @@ -150,6 +151,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "Give hardware-rendered cores their own private context. Avoids having to assume hardware state changes inbetween frames." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "メニューの外観に関係する設定を変更します。" @@ -3919,10 +3924,10 @@ MSG_HASH( "カスタムリフレッシュレートを使用") MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, - "Select the output port connected to the CRT display.") + "CRTディスプレイに接続されている出力ポートを選択します。") MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, - "Output Display ID") + "出力ディスプレイの識別番号") MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_RECORDING, "録画を開始" @@ -4015,45 +4020,45 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, "メニューの色テーマ") MSG_HASH( MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, - "Basic White" + "ベーシックホワイト" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, - "Basic Black" + "ベーシックブラック" ) MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, - "Select a different color theme." + "色テーマを選択します。" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, - "Lowest") + "最低") MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, - "Lower") + "低") MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, - "Normal") + "普通") MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, - "Higher") + "高") MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, - "Highest") + "最高") MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_MUSIC_AVAILABLE, - "No music available." + "音楽ファイルがありません。" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_VIDEOS_AVAILABLE, - "No videos available." + "動画ファイルがありません。" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_IMAGES_AVAILABLE, - "No images available." + "画像ファイルがありません。" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_FAVORITES_AVAILABLE, - "No favorites available." + "お気に入りがありません。" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, - "Remember Window Position and Size") + "ウィンドウの位置とサイズを記憶") diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index bea58f1c5c..4d6d3cc5f6 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -7,8 +7,9 @@ MSG_HASH( "알 수 없는 컴파일러" ) MSG_HASH( - MSG_NATIVE, - "Native") + MSG_NATIVE, + "Native" + ) MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, "장치가 포트에서 연결 해제 되었습니다" @@ -105,6 +106,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "하드웨어 렌더링된 코어에 고유의 컨텍스트를 부여. 프레임간 하드웨어 상태가 변경된 것으로 가정하지 않도록 함." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "화면 표시 설정을 조정합니다." @@ -970,6 +975,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS, "설정") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_LINEAR_FILTER, "메뉴 선형 필터") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_HORIZONTAL_ANIMATION, + "Horizontal Animation") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SETTINGS, "메뉴") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER, @@ -3140,10 +3147,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_HELP, "Show Help") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_HELP, "Show/hide the 'Help' option.") +#ifdef HAVE_LAKKA +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, + "Show Restart RetroArch") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, + "Show/hide the 'Restart RetroArch' option.") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, "Show Quit RetroArch") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, "Show/hide the 'Quit RetroArch' option.") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT, "Show Reboot") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_REBOOT, diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 1426e3b5f9..17677a9825 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -7,8 +7,9 @@ MSG_HASH( "Onbekende compiler" ) MSG_HASH( - MSG_NATIVE, - "Native") + MSG_NATIVE, + "Native" + ) MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, "Apparaat ontkoppeld van port" @@ -45,6 +46,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "Give hardware-rendered cores their own private context. Avoids having to assume hardware state changes inbetween frames." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "Adjusts settings related to the appearance of the menu screen." @@ -905,6 +910,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS, "Instellingen") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_LINEAR_FILTER, "Menu Linear Filter") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_HORIZONTAL_ANIMATION, + "Horizontal Animation") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SETTINGS, "Uiterlijk") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER, diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 86d03816a9..59853c16d0 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -7,8 +7,9 @@ MSG_HASH( "Nieznany kompilator" ) MSG_HASH( - MSG_NATIVE, - "Native") + MSG_NATIVE, + "Native" + ) MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, "Urządzenie zostało odłączone od portu" @@ -145,6 +146,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "Nadaj rdzeniom sprzętowym własny prywatny kontekst. Unikaj konieczności przejmowania zmian stanu sprzętu pomiędzy klatkami." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "Dostosuj ustawienia wyglądu ekranu menu." diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 3bb3c1a358..7c23ba87bf 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -173,6 +173,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "Dar aos núcleos renderizados por hardware seu próprio contexto privado. Evita ter que assumir mudanças de estado de hardware entre quadros." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "Ajusta as configurações de aparência da tela de menu." diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index 84b8e21efc..929abe53d6 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -7,8 +7,9 @@ MSG_HASH( "Compilador desconhecido" ) MSG_HASH( - MSG_NATIVE, - "Native") + MSG_NATIVE, + "Native" + ) MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, "Dispositivo desconectado da porta" @@ -105,6 +106,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "Dê aos núcleos renderizados por hardware o seu próprio contexto privado. Evita ter que assumir mudanças de estado de hardware entre frames." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "ajusta as definições de aparência no ecrã do menu." @@ -970,6 +975,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS, "Definições") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_LINEAR_FILTER, "Filtro linear do menu") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_HORIZONTAL_ANIMATION, + "Horizontal Animation") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SETTINGS, "Aparência") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER, diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 7fdb5e26d8..e531e1964e 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -12,8 +12,9 @@ MSG_HASH( "Неизвестный компилятор" ) MSG_HASH( - MSG_NATIVE, - "Native") + MSG_NATIVE, + "Native" + ) MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, "Устройство отключено от порта" @@ -110,6 +111,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "Предоставьте аппаратно-рендерированным ядрам собственный контекст. Избегайте принятия изменений состояния оборудования между кадрами." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "Настройка параметров, относящихся к внешнему виду экрана меню." @@ -993,6 +998,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS, "Настройки") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_LINEAR_FILTER, "Линейный фильтр меню") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_HORIZONTAL_ANIMATION, + "Horizontal Animation") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SETTINGS, "Меню") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 72cdb2f739..1de41ae3ed 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -59,7 +59,11 @@ MSG_HASH( ) MSG_HASH( MSG_PUBLIC_ADDRESS, - "Public address" + "Port Mapping Successful" + ) +MSG_HASH( + MSG_UPNP_FAILED, + "Port Mapping Failed" ) MSG_HASH( MSG_NO_ARGUMENTS_SUPPLIED_AND_NO_MENU_BUILTIN, @@ -173,6 +177,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "Give hardware-rendered cores their own private context. Avoids having to assume hardware state changes inbetween frames." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "Adjusts menu screen appearance settings." @@ -1317,10 +1325,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_PAUSE_TOGGLE, "Pause toggle" ) +#ifdef HAVE_LAKKA +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, + "Restart RetroArch" + ) +#else MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, "Quit RetroArch" ) +#endif MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_RESET, "Reset game" @@ -2069,10 +2084,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_MIDI_SETTINGS, "MIDI" ) +#ifdef HAVE_LAKKA +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, + "Restart RetroArch" + ) +#else MSG_HASH( MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, "Quit RetroArch" ) +#endif MSG_HASH( MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ANALOG, "Analog supported" @@ -3558,7 +3580,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_CHEEVOS_HARDCORE_MODE_ENABLE, - "Enable or disable savestates, cheats, rewind, pause, and slow-motion for all games." + "Enables hardcore mode, this will enable or disable savestates, cheats, rewind, pause, and slow-motion.\n" + "Toggling this setting at runtime will restart your game." ) MSG_HASH( MENU_ENUM_SUBLABEL_CHEEVOS_LEADERBOARDS_ENABLE, @@ -4918,6 +4941,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_CORE_LIST, "Select which core to use." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_START_CORE, + "Start core without content." + ) MSG_HASH( MENU_ENUM_SUBLABEL_DOWNLOAD_CORE, "Install a core from the online updater." @@ -4938,10 +4965,17 @@ MSG_HASH( MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, "Show information specific to the device." ) +#ifdef HAVE_LAKKA +MSG_HASH( + MENU_ENUM_SUBLABEL_QUIT_RETROARCH, + "Restart the program." + ) +#else MSG_HASH( MENU_ENUM_SUBLABEL_QUIT_RETROARCH, "Quit the program." ) +#endif MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, "Set the custom width for the display window." @@ -5646,7 +5680,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_XMB_THEME, - "Select a different theme for the icon. Changes will take effect after you restart the program." + "Select a different icon theme for RetroArch." ) MSG_HASH( MENU_ENUM_SUBLABEL_XMB_SHADOWS_ENABLE, @@ -6129,6 +6163,16 @@ MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SHOW_HELP, "Show/hide the 'Help' option." ) +#ifdef HAVE_LAKKA +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, + "Show Restart RetroArch" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, + "Show/hide the 'Restart RetroArch' option." + ) +#else MSG_HASH( MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, "Show Quit RetroArch" @@ -6137,6 +6181,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, "Show/hide the 'Quit RetroArch' option." ) +#endif MSG_HASH( MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT, "Show Reboot" @@ -7676,7 +7721,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_ADAPTIVE_VSYNC, - "V-Sync is enabled until performance falls below the target refresh rate. Can minimize stuttering when performance falls below realtime, and can be more energy efficient." + "V-Sync is enabled until performance falls below the target refresh rate.\n" + "This can minimize stuttering when performance falls below realtime, and can be more energy efficient." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCHRES_SETTINGS, @@ -7881,4 +7927,4 @@ MSG_HASH( MSG_HASH( MENU_ENUM_LABEL_VALUE_HOLD_START, "Hold Start (2 seconds)" - ) \ No newline at end of file + ) diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index c5872bc6c1..a7bb34ce4c 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -7,8 +7,9 @@ MSG_HASH( "Unknown compiler" ) MSG_HASH( - MSG_NATIVE, - "Native") + MSG_NATIVE, + "Native" + ) MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, "Device disconnected from port" @@ -105,6 +106,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, "Give hardware-rendered cores their own private context. Avoids having to assume hardware state changes inbetween frames." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, + "Enable horizontal animation for the menu. This will have a performance hit." + ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "Điều chỉnh thiết lập related to the appearance of the menu screen." @@ -828,8 +833,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_OVERLAY_NEXT, "Overlay next") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_PAUSE_TOGGLE, "Pause toggle") +#ifdef HAVE_LAKKA +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, + "Restart RetroArch") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, "Quit RetroArch") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_RESET, "Reset game") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_REWIND, @@ -986,6 +996,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS, "Settings") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_LINEAR_FILTER, "Menu Linear Filter") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_HORIZONTAL_ANIMATION, + "Horizontal Animation") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SETTINGS, "Appearance") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER, @@ -2530,8 +2542,13 @@ MSG_HASH(MENU_ENUM_SUBLABEL_NETWORK_INFORMATION, "Show network interface(s) and associated IP addresses.") MSG_HASH(MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, "Show information specific to the device.") +#ifdef HAVE_LAKKA +MSG_HASH(MENU_ENUM_SUBLABEL_QUIT_RETROARCH, + "Restart the program.") +#else MSG_HASH(MENU_ENUM_SUBLABEL_QUIT_RETROARCH, "Quit the program.") +#endif MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, "Set the custom width size for the display window. Leaving it at 0 will attempt to scale the window as large as possible.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, @@ -3177,10 +3194,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_HELP, "Show Help") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_HELP, "Show/hide the 'Help' option.") +#ifdef HAVE_LAKKA +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, + "Show Restart RetroArch") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, + "Show/hide the 'Restart RetroArch' option.") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, "Show Quit RetroArch") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, "Show/hide the 'Quit RetroArch' option.") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT, "Show Reboot") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_REBOOT, diff --git a/libretro-common/audio/audio_mixer.c b/libretro-common/audio/audio_mixer.c index a44ba38d6a..3b66d0b1f2 100644 --- a/libretro-common/audio/audio_mixer.c +++ b/libretro-common/audio/audio_mixer.c @@ -55,6 +55,8 @@ #ifdef HAVE_DR_MP3 #define DR_MP3_IMPLEMENTATION +#include +#define DRMP3_ASSERT(expression) retro_assert(expression) #include #endif diff --git a/libretro-common/dynamic/dylib.c b/libretro-common/dynamic/dylib.c index bc6be9fc40..1db756c734 100644 --- a/libretro-common/dynamic/dylib.c +++ b/libretro-common/dynamic/dylib.c @@ -74,17 +74,42 @@ static void set_dl_error(void) dylib_t dylib_load(const char *path) { #ifdef _WIN32 +#ifndef __WINRT__ int prevmode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); -#ifdef LEGACY_WIN32 +#endif +#ifdef __WINRT__ + /* On UWP, you can only load DLLs inside your install directory, using a special function that takes a relative path */ + + if (!path_is_absolute(path)) + RARCH_WARN("Relative path in dylib_load! This is likely an attempt to load a system library that will fail\n"); + + char *relative_path_abbrev = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + fill_pathname_abbreviate_special(relative_path_abbrev, path, PATH_MAX_LENGTH * sizeof(char)); + + char *relative_path = relative_path_abbrev; + if (relative_path[0] != ':' || !path_char_is_slash(relative_path[1])) + RARCH_WARN("Path to dylib_load is not inside app install directory! Loading will probably fail\n"); + else + relative_path += 2; + + RARCH_LOG("Loading library using a relative path: '%s'\n", relative_path); + + wchar_t *pathW = utf8_to_utf16_string_alloc(relative_path); + dylib_t lib = LoadPackagedLibrary(pathW, 0); + free(pathW); + + free(relative_path_abbrev); +#elif defined(LEGACY_WIN32) dylib_t lib = LoadLibrary(path); #else wchar_t *pathW = utf8_to_utf16_string_alloc(path); dylib_t lib = LoadLibraryW(pathW); - free(pathW); #endif +#ifndef __WINRT__ SetErrorMode(prevmode); +#endif if (!lib) { @@ -114,8 +139,20 @@ function_t dylib_proc(dylib_t lib, const char *proc) function_t sym; #ifdef _WIN32 - sym = (function_t)GetProcAddress(lib ? - (HMODULE)lib : GetModuleHandle(NULL), proc); + HMODULE mod = (HMODULE)lib; +#ifndef __WINRT__ + if (!mod) + mod = GetModuleHandle(NULL); +#else + /* GetModuleHandle is not available on UWP */ + if (!mod) + { + RARCH_WARN("FIXME: It's not possible to look up symbols in current executable on UWP!\n"); + DebugBreak(); + return NULL; + } +#endif + sym = (function_t)GetProcAddress(mod, proc); if (!sym) { set_dl_error(); diff --git a/libretro-common/features/features_cpu.c b/libretro-common/features/features_cpu.c index 1a04ce07c5..51234c1878 100644 --- a/libretro-common/features/features_cpu.c +++ b/libretro-common/features/features_cpu.c @@ -174,9 +174,9 @@ retro_perf_tick_t cpu_features_get_perf_counter(void) time_ticks = (retro_perf_tick_t)tv.tv_sec * 1000000000 + (retro_perf_tick_t)tv.tv_nsec; -#elif defined(__GNUC__) && defined(__i386__) || defined(__i486__) || defined(__i686__) +#elif defined(__GNUC__) && defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_X64) || defined(_M_AMD64) __asm__ volatile ("rdtsc" : "=A" (time_ticks)); -#elif defined(__GNUC__) && defined(__x86_64__) +#elif defined(__GNUC__) && defined(__x86_64__) || defined(_M_IX86) unsigned a, d; __asm__ volatile ("rdtsc" : "=a" (a), "=d" (d)); time_ticks = (retro_perf_tick_t)a | ((retro_perf_tick_t)d << 32); @@ -482,10 +482,14 @@ static void cpulist_read_from(CpuList* list, const char* filename) **/ unsigned cpu_features_get_core_amount(void) { -#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) +#if defined(_WIN32) && !defined(_XBOX) /* Win32 */ SYSTEM_INFO sysinfo; +#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP + GetNativeSystemInfo(&sysinfo); +#else GetSystemInfo(&sysinfo); +#endif return sysinfo.dwNumberOfProcessors; #elif defined(GEKKO) return 1; diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index 846fa2c6fc..fcf95de2e9 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -986,8 +986,10 @@ bool config_file_write(config_file_t *conf, const char *path) return false; /* TODO: this is only useful for a few platforms, find which and add ifdef */ +#if !defined(PS2) buf = calloc(1, 0x4000); setvbuf(file, (char*)buf, _IOFBF, 0x4000); +#endif config_file_dump(conf, file); diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index 1e910f4ec1..a69f49decb 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -96,6 +96,12 @@ #include /* stat() is defined here */ #endif +#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL) +#ifdef __WINRT__ +#include +#endif +#endif + /* Assume W-functions do not work below Win2K and Xbox platforms */ #if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500 || defined(_XBOX) @@ -1005,45 +1011,67 @@ void fill_pathname_expand_special(char *out_path, const char *in_path, size_t size) { #if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL) - if (*in_path == '~') + if (in_path[0] == '~') { - const char *home = getenv("HOME"); - if (home) + char *home_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + + home_dir[0] = '\0'; + + fill_pathname_home_dir(home_dir, + PATH_MAX_LENGTH * sizeof(char)); + + if (*home_dir) { - size_t src_size = strlcpy(out_path, home, size); + size_t src_size = strlcpy(out_path, home_dir, size); retro_assert(src_size < size); out_path += src_size; size -= src_size; - in_path++; + + if (!path_char_is_slash(out_path[-1])) + { + src_size = strlcpy(out_path, path_default_slash(), size); + retro_assert(src_size < size); + + out_path += src_size; + size -= src_size; + } + + in_path += 2; } + + free(home_dir); } - else if ((in_path[0] == ':') && - ( - (in_path[1] == '/') -#ifdef _WIN32 - || (in_path[1] == '\\') -#endif - ) - ) + else if (in_path[0] == ':') { - size_t src_size; char *application_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); application_dir[0] = '\0'; - fill_pathname_application_path(application_dir, + fill_pathname_application_dir(application_dir, PATH_MAX_LENGTH * sizeof(char)); - path_basedir_wrapper(application_dir); - src_size = strlcpy(out_path, application_dir, size); - retro_assert(src_size < size); + if (*application_dir) + { + size_t src_size = strlcpy(out_path, application_dir, size); + retro_assert(src_size < size); + + out_path += src_size; + size -= src_size; + + if (!path_char_is_slash(out_path[-1])) + { + src_size = strlcpy(out_path, path_default_slash(), size); + retro_assert(src_size < size); + + out_path += src_size; + size -= src_size; + } + + in_path += 2; + } free(application_dir); - - out_path += src_size; - size -= src_size; - in_path += 2; } #endif @@ -1058,7 +1086,7 @@ void fill_pathname_abbreviate_special(char *out_path, const char *candidates[3]; const char *notations[3]; char *application_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - const char *home = getenv("HOME"); + char *home_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); application_dir[0] = '\0'; @@ -1070,16 +1098,17 @@ void fill_pathname_abbreviate_special(char *out_path, /* ugly hack - use application_dir pointer * before filling it in. C89 reasons */ candidates[0] = application_dir; - candidates[1] = home; + candidates[1] = home_dir; candidates[2] = NULL; notations [0] = ":"; notations [1] = "~"; notations [2] = NULL; - fill_pathname_application_path(application_dir, + fill_pathname_application_dir(application_dir, + PATH_MAX_LENGTH * sizeof(char)); + fill_pathname_home_dir(home_dir, PATH_MAX_LENGTH * sizeof(char)); - path_basedir_wrapper(application_dir); for (i = 0; candidates[i]; i++) { @@ -1107,6 +1136,7 @@ void fill_pathname_abbreviate_special(char *out_path, } free(application_dir); + free(home_dir); #endif retro_assert(strlcpy(out_path, in_path, size) < size); @@ -1148,7 +1178,7 @@ void fill_pathname_application_path(char *s, size_t len) CFBundleRef bundle = CFBundleGetMainBundle(); #endif #ifdef _WIN32 - DWORD ret; + DWORD ret = 0; wchar_t wstr[PATH_MAX_LENGTH] = {0}; #endif #ifdef __HAIKU__ @@ -1160,11 +1190,11 @@ void fill_pathname_application_path(char *s, size_t len) if (!len) return; -#ifdef _WIN32 +#if defined(_WIN32) #ifdef LEGACY_WIN32 - ret = GetModuleFileNameA(GetModuleHandle(NULL), s, len); + ret = GetModuleFileNameA(NULL, s, len); #else - ret = GetModuleFileNameW(GetModuleHandle(NULL), wstr, ARRAY_SIZE(wstr)); + ret = GetModuleFileNameW(NULL, wstr, ARRAY_SIZE(wstr)); if (*wstr) { @@ -1233,4 +1263,27 @@ void fill_pathname_application_path(char *s, size_t len) } #endif } + +void fill_pathname_application_dir(char *s, size_t len) +{ +#ifdef __WINRT__ + strlcpy(s, uwp_dir_install, len); +#else + fill_pathname_application_path(s, len); + path_basedir_wrapper(s); +#endif +} + +void fill_pathname_home_dir(char *s, size_t len) +{ +#ifdef __WINRT__ + strlcpy(s, uwp_dir_data, len); +#else + const char *home = getenv("HOME"); + if (home) + strlcpy(s, home, len); + else + *s = 0; +#endif +} #endif diff --git a/libretro-common/file/nbio/nbio_intf.c b/libretro-common/file/nbio/nbio_intf.c index d6254ef08e..1ce6322bc9 100644 --- a/libretro-common/file/nbio/nbio_intf.c +++ b/libretro-common/file/nbio/nbio_intf.c @@ -38,7 +38,7 @@ extern nbio_intf_t nbio_stdio; static nbio_intf_t *internal_nbio = &nbio_linux; #elif defined(HAVE_MMAP) && defined(BSD) static nbio_intf_t *internal_nbio = &nbio_mmap_unix; -#elif defined(_WIN32) && !defined(_XBOX) +#elif defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) static nbio_intf_t *internal_nbio = &nbio_mmap_win32; #else static nbio_intf_t *internal_nbio = &nbio_stdio; diff --git a/libretro-common/formats/jpeg/rjpeg.c b/libretro-common/formats/jpeg/rjpeg.c index 65cb6c3966..e321b69b33 100644 --- a/libretro-common/formats/jpeg/rjpeg.c +++ b/libretro-common/formats/jpeg/rjpeg.c @@ -419,7 +419,7 @@ static INLINE int rjpeg__jpeg_huff_decode(rjpeg__jpeg *j, rjpeg__huffman *h) /* convert the huffman code to the symbol id */ c = ((j->code_buffer >> (32 - k)) & rjpeg__bmask[k]) + h->delta[k]; - assert((((j->code_buffer) >> (32 - h->size[c])) & rjpeg__bmask[h->size[c]]) == h->code[c]); + retro_assert((((j->code_buffer) >> (32 - h->size[c])) & rjpeg__bmask[h->size[c]]) == h->code[c]); /* convert the id to a symbol */ j->code_bits -= k; @@ -441,7 +441,7 @@ static INLINE int rjpeg__extend_receive(rjpeg__jpeg *j, int n) sgn = (int32_t)j->code_buffer >> 31; /* sign bit is always in MSB */ k = rjpeg_lrot(j->code_buffer, n); - assert(n >= 0 && n < (int) (sizeof(rjpeg__bmask)/sizeof(*rjpeg__bmask))); + retro_assert(n >= 0 && n < (int) (sizeof(rjpeg__bmask)/sizeof(*rjpeg__bmask))); j->code_buffer = k & ~rjpeg__bmask[n]; k &= rjpeg__bmask[n]; j->code_bits -= n; diff --git a/libretro-common/include/file/file_path.h b/libretro-common/include/file/file_path.h index 026b4f7933..b6b533a6b9 100644 --- a/libretro-common/include/file/file_path.h +++ b/libretro-common/include/file/file_path.h @@ -462,6 +462,8 @@ void fill_pathname_slash(char *path, size_t size); #if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL) void fill_pathname_application_path(char *buf, size_t size); +void fill_pathname_application_dir(char *buf, size_t size); +void fill_pathname_home_dir(char *buf, size_t size); #endif /** diff --git a/libretro-common/include/lists/dir_list.h b/libretro-common/include/lists/dir_list.h index 4babb02d39..d1d61d9be5 100644 --- a/libretro-common/include/lists/dir_list.h +++ b/libretro-common/include/lists/dir_list.h @@ -29,6 +29,23 @@ RETRO_BEGIN_DECLS +/** + * dir_list_append: + * @list : existing list to append to. + * @dir : directory path. + * @ext : allowed extensions of file directory entries to include. + * @include_dirs : include directories as part of the finished directory listing? + * @include_hidden : include hidden files and directories as part of the finished directory listing? + * @include_compressed : Only include files which match ext. Do not try to match compressed files, etc. + * @recursive : list directory contents recursively + * + * Create a directory listing, appending to an existing list + * + * Returns: true success, false in case of error. + **/ +bool dir_list_append(struct string_list *list, const char *dir, const char *ext, + bool include_dirs, bool include_hidden, bool include_compressed, bool recursive); + /** * dir_list_new: * @dir : directory path. diff --git a/libretro-common/include/retro_assert.h b/libretro-common/include/retro_assert.h index 9f3abdeafb..13db8cf8a5 100644 --- a/libretro-common/include/retro_assert.h +++ b/libretro-common/include/retro_assert.h @@ -26,6 +26,7 @@ #include #ifdef RARCH_INTERNAL +#include #define retro_assert(cond) do { \ if (!(cond)) { printf("Assertion failed at %s:%d.\n", __FILE__, __LINE__); abort(); } \ } while(0) diff --git a/libretro-common/include/retro_environment.h b/libretro-common/include/retro_environment.h index e220c1529b..4a68046b51 100644 --- a/libretro-common/include/retro_environment.h +++ b/libretro-common/include/retro_environment.h @@ -101,6 +101,14 @@ printf("This is C++, version %d.\n", __cplusplus); #define __WINRT__ 1 #endif +/* MSVC obviously has to have some non-standard constants... */ +#if _M_IX86_FP == 1 +#define __SSE__ 1 +#elif _M_IX86_FP == 2 || (defined(_M_AMD64) || defined(_M_X64)) +#define __SSE__ 1 +#define __SSE2__ 1 +#endif + #endif #endif diff --git a/libretro-common/include/retro_timers.h b/libretro-common/include/retro_timers.h index d11e67e7c2..884c078942 100644 --- a/libretro-common/include/retro_timers.h +++ b/libretro-common/include/retro_timers.h @@ -95,8 +95,8 @@ static INLINE void retro_sleep(unsigned msec) SDL_Delay(msec); #elif defined(_3DS) svcSleepThread(1000000 * (s64)msec); -#elif defined(__WINRT__) - /* TODO/FIXME */ +#elif defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP + SleepEx(msec, FALSE); #elif defined(_WIN32) Sleep(msec); #elif defined(XENON) diff --git a/libretro-common/lists/dir_list.c b/libretro-common/lists/dir_list.c index fc360f748b..10d73a50d5 100644 --- a/libretro-common/lists/dir_list.c +++ b/libretro-common/lists/dir_list.c @@ -230,6 +230,42 @@ error: return -1; } +/** + * dir_list_append: + * @list : existing list to append to. + * @dir : directory path. + * @ext : allowed extensions of file directory entries to include. + * @include_dirs : include directories as part of the finished directory listing? + * @include_hidden : include hidden files and directories as part of the finished directory listing? + * @include_compressed : Only include files which match ext. Do not try to match compressed files, etc. + * @recursive : list directory contents recursively + * + * Create a directory listing, appending to an existing list + * + * Returns: true success, false in case of error. + **/ +bool dir_list_append(struct string_list *list, + const char *dir, + const char *ext, bool include_dirs, + bool include_hidden, bool include_compressed, + bool recursive) +{ + struct string_list *ext_list = NULL; + + if (ext) + ext_list = string_split(ext, "|"); + + if(dir_list_read(dir, list, ext_list, include_dirs, + include_hidden, include_compressed, recursive) == -1) + { + string_list_free(ext_list); + return false; + } + + string_list_free(ext_list); + return true; +} + /** * dir_list_new: * @dir : directory path. @@ -249,24 +285,18 @@ struct string_list *dir_list_new(const char *dir, bool include_hidden, bool include_compressed, bool recursive) { - struct string_list *ext_list = NULL; struct string_list *list = NULL; if (!(list = string_list_new())) return NULL; - if (ext) - ext_list = string_split(ext, "|"); - - if(dir_list_read(dir, list, ext_list, include_dirs, - include_hidden, include_compressed, recursive) == -1) + if (!dir_list_append(list, dir, ext, include_dirs, + include_hidden, include_compressed, recursive)) { string_list_free(list); - string_list_free(ext_list); return NULL; } - string_list_free(ext_list); return list; } diff --git a/libretro-common/memmap/memalign.c b/libretro-common/memmap/memalign.c index 449d8471b8..6171e21783 100644 --- a/libretro-common/memmap/memalign.c +++ b/libretro-common/memmap/memalign.c @@ -54,9 +54,9 @@ void memalign_free(void *ptr) void *memalign_alloc_aligned(size_t size) { -#if defined(__x86_64__) || defined(__LP64) || defined(__IA64__) || defined(_M_X64) || defined(_WIN64) +#if defined(__x86_64__) || defined(__LP64) || defined(__IA64__) || defined(_M_X64) || defined(_M_X64) || defined(_WIN64) return memalign_alloc(64, size); -#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(GEKKO) +#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(GEKKO) || defined(_M_IX86) return memalign_alloc(32, size); #else return memalign_alloc(32, size); diff --git a/libretro-common/rthreads/rthreads.c b/libretro-common/rthreads/rthreads.c index 50251bc768..7c67d9465c 100644 --- a/libretro-common/rthreads/rthreads.c +++ b/libretro-common/rthreads/rthreads.c @@ -60,7 +60,7 @@ #include #endif -#if defined(VITA) || defined(BSD) +#if defined(VITA) || defined(BSD) || defined(ORBIS) #include #endif diff --git a/libretro-common/vfs/vfs_implementation.c b/libretro-common/vfs/vfs_implementation.c index 0213c06091..d97e89fbea 100644 --- a/libretro-common/vfs/vfs_implementation.c +++ b/libretro-common/vfs/vfs_implementation.c @@ -294,8 +294,10 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(const char *path, uns */ /* TODO: this is only useful for a few platforms, find which and add ifdef */ stream->fp = fp; +#if !defined(PS2) /* TODO: PS2 IMPROVEMENT */ stream->buf = (char*)calloc(1, 0x4000); setvbuf(stream->fp, stream->buf, _IOFBF, 0x4000); +#endif } else { diff --git a/managers/state_manager.c b/managers/state_manager.c index 26425e3ded..9b8f5515d0 100644 --- a/managers/state_manager.c +++ b/managers/state_manager.c @@ -50,7 +50,7 @@ #define UINT32_MAX 0xffffffffu #endif -#if defined(__x86_64__) || defined(__i386__) || defined(__i486__) || defined(__i686__) +#if defined(__x86_64__) || defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) #define CPU_X86 #endif diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index fe390d3f4a..2fcb431cf5 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -505,6 +505,8 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs, { switch (cbs->enum_idx) { + case MENU_ENUM_LABEL_SUBSYSTEM_ADD: + case MENU_ENUM_LABEL_SUBSYSTEM_LOAD: case MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM: BIND_ACTION_LEFT(cbs, action_left_mainmenu); break; diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index f1b3859530..f0f902a2c2 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -634,6 +634,8 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs, { switch (cbs->enum_idx) { + case MENU_ENUM_LABEL_SUBSYSTEM_ADD: + case MENU_ENUM_LABEL_SUBSYSTEM_LOAD: case MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM: BIND_ACTION_RIGHT(cbs, action_right_mainmenu); break; diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 7b4c258f89..207f325afb 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -43,6 +43,8 @@ #include "../../dynamic.h" #include "../../configuration.h" #include "../../managers/cheat_manager.h" +#include "../input/input_driver.h" +#include "../tasks/tasks_internal.h" #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) \ @@ -187,6 +189,7 @@ default_sublabel_macro(action_bind_sublabel_netplay_nickname, MENU_ default_sublabel_macro(action_bind_sublabel_cheevos_username, MENU_ENUM_SUBLABEL_CHEEVOS_USERNAME) default_sublabel_macro(action_bind_sublabel_cheevos_password, MENU_ENUM_SUBLABEL_CHEEVOS_PASSWORD) default_sublabel_macro(action_bind_sublabel_video_post_filter_record, MENU_ENUM_SUBLABEL_VIDEO_POST_FILTER_RECORD) +default_sublabel_macro(action_bind_sublabel_start_core, MENU_ENUM_SUBLABEL_START_CORE) default_sublabel_macro(action_bind_sublabel_core_list, MENU_ENUM_SUBLABEL_CORE_LIST) default_sublabel_macro(action_bind_sublabel_download_core, MENU_ENUM_SUBLABEL_DOWNLOAD_CORE) default_sublabel_macro(action_bind_sublabel_sideload_core_list, MENU_ENUM_SUBLABEL_SIDELOAD_CORE_LIST) @@ -384,6 +387,7 @@ default_sublabel_macro(action_bind_sublabel_ozone_menu_color_theme, default_sublabel_macro(action_bind_sublabel_menu_use_preferred_system_color_theme, MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME) default_sublabel_macro(action_bind_sublabel_menu_wallpaper_opacity, MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY) default_sublabel_macro(action_bind_sublabel_menu_framebuffer_opacity, MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY) +default_sublabel_macro(action_bind_sublabel_menu_horizontal_animation, MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION) default_sublabel_macro(action_bind_sublabel_menu_ribbon_enable, MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE) default_sublabel_macro(action_bind_sublabel_menu_font, MENU_ENUM_SUBLABEL_XMB_FONT) default_sublabel_macro(action_bind_sublabel_quick_menu_show_take_screenshot, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_TAKE_SCREENSHOT) @@ -499,6 +503,36 @@ default_sublabel_macro(action_bind_sublabel_switch_gpu_profile, MENU default_sublabel_macro(action_bind_sublabel_switch_backlight_control, MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL) #endif +static int action_bind_sublabel_systeminfo_controller_entry( + file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len) +{ + char tmp[4096]; + unsigned controller; + + for(controller = 0; controller < MAX_USERS; controller++) + { + if (input_is_autoconfigured(controller)) + { + snprintf(tmp, sizeof(tmp), "Port #%d device name: %s (#%d)", + controller, + input_config_get_device_name(controller), + input_autoconfigure_get_device_name_index(controller)); + + if (string_is_equal(path, tmp)) + break; + } + } + snprintf(tmp, sizeof(tmp), "Device display name: %s\nDevice config name: %s\nDevice identifiers: %d/%d", + input_config_get_device_display_name(controller) ? input_config_get_device_display_name(controller) : "N/A", + input_config_get_device_display_name(controller) ? input_config_get_device_config_name(controller) : "N/A", + input_config_get_vid(controller), input_config_get_pid(controller)); + strlcpy(s, tmp, len); + + return 0; +} static int action_bind_sublabel_cheevos_entry( file_list_t *list, unsigned type, unsigned i, @@ -1104,6 +1138,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_MENU_FRAMEBUFFER_OPACITY: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_framebuffer_opacity); break; + case MENU_ENUM_LABEL_MENU_HORIZONTAL_ANIMATION: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_horizontal_animation); + break; case MENU_ENUM_LABEL_MENU_WALLPAPER_OPACITY: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_wallpaper_opacity); break; @@ -1672,6 +1709,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_LOAD_CONTENT_SPECIAL: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_content_special); break; + case MENU_ENUM_LABEL_START_CORE: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_start_core); + break; case MENU_ENUM_LABEL_CORE_LIST: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_core_list); break; @@ -1859,6 +1899,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_CPU_CORES: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_systeminfo_cpu_cores); break; + case MENU_ENUM_LABEL_SYSTEM_INFO_CONTROLLER_ENTRY: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_systeminfo_controller_entry); + break; case MENU_ENUM_LABEL_VIDEO_BLACK_FRAME_INSERTION: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_black_frame_insertion); break; diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index cc6b7deede..9099662cd8 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -2057,6 +2057,12 @@ static int materialui_list_push(void *data, void *userdata, menu_displaylist_setting(&entry); } + if (system->load_no_content) + { + entry.enum_idx = MENU_ENUM_LABEL_START_CORE; + menu_displaylist_setting(&entry); + } + #ifndef HAVE_DYNAMIC if (frontend_driver_has_fork()) #endif @@ -2068,12 +2074,6 @@ static int materialui_list_push(void *data, void *userdata, } } - if (system->load_no_content) - { - entry.enum_idx = MENU_ENUM_LABEL_START_CORE; - menu_displaylist_setting(&entry); - } - if (settings->bools.menu_show_load_content) { entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_LIST; diff --git a/menu/drivers/ozone/ozone.c b/menu/drivers/ozone/ozone.c index 1ef225cfd5..fa9fd08a87 100644 --- a/menu/drivers/ozone/ozone.c +++ b/menu/drivers/ozone/ozone.c @@ -195,8 +195,8 @@ static void *ozone_init(void **userdata, bool video_is_threaded) setsysExit(); } else - fallback_color_theme = true; #endif + fallback_color_theme = true; } else fallback_color_theme = true; diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c old mode 100755 new mode 100644 index 8e212f474b..e3604a42f5 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -370,7 +370,6 @@ static float item_color[] = { 1, 1, 1, 1 }; - float gradient_dark_purple[16] = { 20/255.0, 13/255.0, 20/255.0, 1.0, 20/255.0, 13/255.0, 20/255.0, 1.0, @@ -2023,7 +2022,6 @@ static void xmb_context_reset_horizontal_list( continue; } - file_list_get_at_offset(xmb->horizontal_list, i, &path, NULL, NULL, NULL); @@ -2192,7 +2190,6 @@ static void xmb_list_open(xmb_handle_t *xmb) xmb_list_open_new(xmb, selection_buf, dir, selection); - entry.duration = XMB_DELAY; entry.target_value = xmb->icon_size * -(xmb->depth*2-2); entry.subject = &xmb->x; @@ -2314,7 +2311,6 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, case MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR: return xmb->textures.list[XMB_TEXTURE_RDB]; - /* Menu collection submenus*/ case MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST: return xmb->textures.list[XMB_TEXTURE_ZIP]; @@ -2965,7 +2961,6 @@ static int xmb_draw_item( TEXT_ALIGN_LEFT, width, height, xmb->font); - menu_display_set_alpha(color, MIN(node->alpha, xmb->alpha)); if ( @@ -2995,7 +2990,6 @@ static int xmb_draw_item( menu_display_rotate_z(&rotate_draw, video_info); - xmb_draw_icon(video_info, xmb->icon_size, &mymat_tmp, @@ -3795,13 +3789,13 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) } } - if (video_info->timedate_enable && !xmb->assets_missing) + if (video_info->timedate_enable) { menu_display_ctx_datetime_t datetime; char timedate[255]; int x_pos = 0; - if (coord_white[3] != 0) + if (coord_white[3] != 0 && !xmb->assets_missing) { int x_pos = 0; @@ -4162,7 +4156,6 @@ static void xmb_layout_ps3(xmb_handle_t *xmb, int width) xmb->font2_size = 24.0 * scale_factor; new_header_height = 128.0 * scale_factor; - xmb->thumbnail_width = 1024.0 * scale_factor; xmb->left_thumbnail_width = 1024.0 * scale_factor; xmb->savestate_thumbnail_width= 460.0 * scale_factor; @@ -4876,6 +4869,8 @@ static void xmb_context_reset_textures( settings_t *settings = config_get_ptr(); xmb->assets_missing = false; + menu_display_allocate_white_texture(); + for (i = 0; i < XMB_TEXTURE_LAST; i++) { if (!menu_display_reset_textures_list(xmb_texture_path(i), iconpath, &xmb->textures.list[i], TEXTURE_FILTER_MIPMAP_LINEAR)) @@ -4910,8 +4905,6 @@ static void xmb_context_reset_textures( } } - menu_display_allocate_white_texture(); - xmb->main_menu_node.icon = xmb->textures.list[XMB_TEXTURE_MAIN_MENU]; xmb->main_menu_node.alpha = xmb->categories_active_alpha; xmb->main_menu_node.zoom = xmb->categories_active_zoom; @@ -4957,7 +4950,7 @@ static void xmb_context_reset_textures( return; error: - xmb->assets_missing = true ; + xmb->assets_missing = true; RARCH_WARN("[XMB] Critical asset missing, no icons will be drawn\n"); return; } @@ -5347,7 +5340,6 @@ static void xmb_list_cache(void *data, enum menu_list_type type, unsigned action } } - static void xmb_context_destroy(void *data) { unsigned i; @@ -5547,7 +5539,6 @@ static int xmb_list_push(void *data, void *userdata, if (settings->bools.menu_show_load_content) { - entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_LIST; menu_displaylist_setting(&entry); /* Core fully loaded, use the subsystem data */ diff --git a/menu/drivers_display/menu_display_vulkan.c b/menu/drivers_display/menu_display_vulkan.c index e1e5ee4699..6bae63a2d6 100644 --- a/menu/drivers_display/menu_display_vulkan.c +++ b/menu/drivers_display/menu_display_vulkan.c @@ -1,4 +1,4 @@ -/* RetroArch - A frontend for libretro. +/* RetroArch - A frontend for libretro. * Copyright (C) 2016-2017 - Hans-Kristian Arntzen * Copyright (C) 2011-2017 - Daniel De Matteis * @@ -349,7 +349,6 @@ static bool menu_display_vk_font_init_first( static void menu_display_vk_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height) { - VkRect2D sci; vk_t *vk = video_info ? (vk_t*)video_info->userdata : NULL; vk->tracker.use_scissor = true; @@ -362,7 +361,6 @@ static void menu_display_vk_scissor_begin(video_frame_info_t *video_info, static void menu_display_vk_scissor_end(video_frame_info_t *video_info) { - VkRect2D sci; vk_t *vk = video_info ? (vk_t*)video_info->userdata : NULL; vk->tracker.use_scissor = false; vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT; diff --git a/menu/menu_animation.c b/menu/menu_animation.c index 4912a86bcc..d55bad6166 100644 --- a/menu/menu_animation.c +++ b/menu/menu_animation.c @@ -24,6 +24,9 @@ #include #define DG_DYNARR_IMPLEMENTATION +#include +#include +#define DG_DYNARR_ASSERT(cond, msg) (void)0 #include #undef DG_DYNARR_IMPLEMENTATION diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index cdf3fda1ce..8e2f2e8c16 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -359,12 +359,15 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info) } } +#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#else if (settings->bools.menu_show_core_updater) menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_DELETE), msg_hash_to_str(MENU_ENUM_LABEL_CORE_DELETE), MENU_ENUM_LABEL_CORE_DELETE, MENU_SETTING_ACTION_CORE_DELETE, 0, 0); +#endif return 0; } @@ -385,6 +388,7 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) #endif const char *tmp_string = NULL; const frontend_ctx_driver_t *frontend = frontend_get_ptr(); + settings_t *settings = config_get_ptr(); tmp[0] = feat_str[0] = '\0'; @@ -502,40 +506,39 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) MENU_ENUM_LABEL_CPU_CORES, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); } - for(controller = 0; controller < MAX_USERS; controller++) { - if (input_is_autoconfigured(controller)) - { + if (input_is_autoconfigured(controller)) + { snprintf(tmp, sizeof(tmp), "Port #%d device name: %s (#%d)", - controller, - input_config_get_device_name(controller), - input_autoconfigure_get_device_name_index(controller)); + controller, + input_config_get_device_name(controller), + input_autoconfigure_get_device_name_index(controller)); menu_entries_append_enum(info->list, tmp, "", - MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, - MENU_SETTINGS_CORE_INFO_NONE, 0, 0); - snprintf(tmp, sizeof(tmp), "Port #%d device display name: %s", - controller, - input_config_get_device_display_name(controller) ? - input_config_get_device_display_name(controller) : "N/A"); - menu_entries_append_enum(info->list, tmp, "", - MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, - MENU_SETTINGS_CORE_INFO_NONE, 0, 0); - snprintf(tmp, sizeof(tmp), "Port #%d device config name: %s", - controller, - input_config_get_device_display_name(controller) ? - input_config_get_device_config_name(controller) : "N/A"); - menu_entries_append_enum(info->list, tmp, "", - MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, - MENU_SETTINGS_CORE_INFO_NONE, 0, 0); - snprintf(tmp, sizeof(tmp), "Port #%d device VID/PID: %d/%d", - controller, - input_config_get_vid(controller), - input_config_get_pid(controller)); - menu_entries_append_enum(info->list, tmp, "", - MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, - MENU_SETTINGS_CORE_INFO_NONE, 0, 0); - } + MENU_ENUM_LABEL_SYSTEM_INFO_CONTROLLER_ENTRY, + MENU_SETTINGS_CORE_INFO_NONE, 0, 0); + if (string_is_equal(settings->arrays.menu_driver, "rgui")) + { + snprintf(tmp, sizeof(tmp), " Device display name: %s", + input_config_get_device_display_name(controller) ? + input_config_get_device_display_name(controller) : "N/A"); + menu_entries_append_enum(info->list, tmp, "", + MENU_ENUM_LABEL_SYSTEM_INFO_CONTROLLER_ENTRY, + MENU_SETTINGS_CORE_INFO_NONE, 0, 0); + snprintf(tmp, sizeof(tmp), " Device config name: %s", + input_config_get_device_display_name(controller) ? + input_config_get_device_config_name(controller) : "N/A"); + menu_entries_append_enum(info->list, tmp, "", + MENU_ENUM_LABEL_SYSTEM_INFO_CONTROLLER_ENTRY, + MENU_SETTINGS_CORE_INFO_NONE, 0, 0); + snprintf(tmp, sizeof(tmp), " Device VID/PID: %d/%d", + input_config_get_vid(controller), + input_config_get_pid(controller)); + menu_entries_append_enum(info->list, tmp, "", + MENU_ENUM_LABEL_SYSTEM_INFO_CONTROLLER_ENTRY, + MENU_SETTINGS_CORE_INFO_NONE, 0, 0); + } + } } if (frontend) @@ -2672,7 +2675,7 @@ static int menu_displaylist_parse_load_content_settings( { if (!recording_is_enabled()) { - if (settings->bools.quick_menu_show_start_recording) + if (settings->bools.quick_menu_show_start_recording && !settings->bools.kiosk_mode_enable) { menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_RECORDING), @@ -2680,7 +2683,7 @@ static int menu_displaylist_parse_load_content_settings( MENU_ENUM_LABEL_QUICK_MENU_START_RECORDING, MENU_SETTING_ACTION, 0, 0); } - if (settings->bools.quick_menu_show_start_streaming) + if (settings->bools.quick_menu_show_start_streaming && !settings->bools.kiosk_mode_enable) { menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_STREAMING), @@ -2893,7 +2896,7 @@ static int menu_displaylist_parse_horizontal_content_actions( MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST, FILE_TYPE_PLAYLIST_ENTRY, 0, 0); } - if (settings->bools.quick_menu_show_reset_core_association) + if (settings->bools.quick_menu_show_reset_core_association && !settings->bools.kiosk_mode_enable) { menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RESET_CORE_ASSOCIATION), @@ -3102,6 +3105,8 @@ static unsigned menu_displaylist_parse_options( MENU_SETTING_ACTION, 0, 0); count++; #elif defined(HAVE_NETWORKING) +#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#else if (settings->bools.menu_show_core_updater) { menu_entries_append_enum(info->list, @@ -3111,6 +3116,7 @@ static unsigned menu_displaylist_parse_options( MENU_SETTING_ACTION, 0, 0); count++; } +#endif menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_THUMBNAILS_UPDATER_LIST), @@ -3605,6 +3611,7 @@ static unsigned menu_displaylist_parse_cores( unsigned items_found = 0; settings_t *settings = config_get_ptr(); const char *path = info->path; + bool ok; if (string_is_empty(path)) { @@ -3615,9 +3622,29 @@ static unsigned menu_displaylist_parse_cores( return items_found; } - str_list = dir_list_new(path, info->exts, + str_list = string_list_new(); + ok = dir_list_append(str_list, path, info->exts, true, settings->bools.show_hidden_files, true, false); +#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP + /* UWP: browse the optional packages for additional cores */ + struct string_list *core_packages = string_list_new(); + uwp_fill_installed_core_packages(core_packages); + for (i = 0; i < core_packages->size; i++) + { + dir_list_append(str_list, core_packages->elems[i].data, info->exts, + true, settings->bools.show_hidden_files, true, false); + } + string_list_free(core_packages); +#else + /* Keep the old 'directory not found' behavior */ + if (!ok) + { + string_list_free(str_list); + str_list = NULL; + } +#endif + { char *out_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); @@ -4151,6 +4178,8 @@ bool menu_displaylist_process(menu_displaylist_info_t *info) file_list_sort_on_alt(info->list); #if defined(HAVE_NETWORKING) +#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#else if (settings->bools.menu_show_core_updater && !settings->bools.kiosk_mode_enable) { if (info->download_core) @@ -4168,6 +4197,7 @@ bool menu_displaylist_process(menu_displaylist_info_t *info) MENU_SETTING_ACTION, 0, 0); } } +#endif #endif if (info->push_builtin_cores) diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 5e193fca93..29657d93ae 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -148,7 +148,7 @@ static menu_display_ctx_driver_t *menu_display_ctx_drivers[] = { #ifdef WIIU &menu_display_ctx_wiiu, #endif -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) &menu_display_ctx_gdi, #endif #ifdef DJGPP @@ -1743,9 +1743,10 @@ static bool menu_init(menu_handle_t *menu_data) configuration_set_bool(settings, settings->bools.menu_show_start_screen, false); - +#if !defined(PS2) /* TODO: PS2 IMPROVEMENT */ if (settings->bools.config_save_on_exit) command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL); +#endif } if ( settings->bools.bundle_assets_extract_enable @@ -2665,7 +2666,7 @@ void hex32_to_rgba_normalized(uint32_t hex, float* rgba, float alpha) void menu_subsystem_populate(const struct retro_subsystem_info* subsystem, menu_displaylist_info_t *info) { - int i = 0; + unsigned i = 0; if (subsystem && subsystem_current_count > 0) { for (i = 0; i < subsystem_current_count; i++, subsystem++) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index c46ad63d68..5bf9a944d2 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -3021,12 +3021,10 @@ static void achievement_hardcore_mode_write_handler(rarch_setting_t *setting) if (!setting) return; - if (settings && settings->bools.cheevos_hardcore_mode_enable - && cheevos_state_loaded_flag - ) + if (settings && settings->bools.cheevos_enable && settings->bools.cheevos_hardcore_mode_enable) { - cheevos_hardcore_paused = true; - runloop_msg_queue_push(msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_DISABLED), 0, 180, true); + cheevos_toggle_hardcore_mode(); + command_event(CMD_EVENT_RESET, NULL); return; } } @@ -9289,7 +9287,7 @@ static bool setting_append_list( &group_info, &subgroup_info, parent_group, - general_write_handler, + achievement_hardcore_mode_write_handler, general_read_handler, SD_FLAG_NONE ); diff --git a/menu/widgets/menu_filebrowser.c b/menu/widgets/menu_filebrowser.c index 4999bcca5e..4175bcb9ba 100644 --- a/menu/widgets/menu_filebrowser.c +++ b/menu/widgets/menu_filebrowser.c @@ -305,7 +305,7 @@ void filebrowser_parse(menu_displaylist_info_t *info, unsigned type_data) } end: - if (info) + if (info && !path_is_compressed) menu_entries_prepend(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PARENT_DIRECTORY), path, diff --git a/msg_hash.h b/msg_hash.h index 5e5fc7055c..17a8a555bc 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -228,6 +228,7 @@ enum msg_hash_enums MSG_GOT_CONNECTION_FROM_NAME, MSG_CONNECTION_SLOT, MSG_PUBLIC_ADDRESS, + MSG_UPNP_FAILED, MSG_NO_SAVE_STATE_HAS_BEEN_OVERWRITTEN_YET, MSG_CANNOT_INFER_NEW_CONFIG_PATH, MSG_UNDID_LOAD_STATE, @@ -539,6 +540,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_CORE_OPTION_ENTRY, MENU_ENUM_LABEL_NETWORK_INFO_ENTRY, MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, + MENU_ENUM_LABEL_SYSTEM_INFO_CONTROLLER_ENTRY, MENU_ENUM_LABEL_CORE_INFO_ENTRY, MENU_ENUM_LABEL_PLAYLIST_ENTRY, diff --git a/network/netplay/netplay_io.c b/network/netplay/netplay_io.c index 33506e1430..c513a26519 100644 --- a/network/netplay/netplay_io.c +++ b/network/netplay/netplay_io.c @@ -54,7 +54,7 @@ static void print_state(netplay_t *netplay) } msg[sizeof(msg)-1] = '\0'; - RARCH_LOG("%s\n", msg); + RARCH_LOG("[netplay] %s\n", msg); #undef APPEND #undef M @@ -117,7 +117,7 @@ void netplay_hangup(netplay_t *netplay, struct netplay_connection *connection) dmsg = msg_hash_to_str(MSG_NETPLAY_CLIENT_HANGUP); netplay->is_connected = false; } - RARCH_LOG("%s\n", dmsg); + RARCH_LOG("[netplay] %s\n", dmsg); runloop_msg_queue_push(dmsg, 1, 180, false); socket_close(connection->fd); @@ -246,7 +246,7 @@ static bool send_input_frame(netplay_t *netplay, struct delta_frame *dframe, buffer[1] = htonl((bufused-2) * sizeof(uint32_t)); #ifdef DEBUG_NETPLAY_STEPS - RARCH_LOG("Sending input for client %u\n", (unsigned) client_num); + RARCH_LOG("[netplay] Sending input for client %u\n", (unsigned) client_num); print_state(netplay); #endif @@ -635,7 +635,7 @@ static void announce_play_spectate(netplay_t *netplay, if (msg[0]) { - RARCH_LOG("%s\n", msg); + RARCH_LOG("[netplay] %s\n", msg); runloop_msg_queue_push(msg, 1, 180, false); } } @@ -915,7 +915,7 @@ static bool netplay_get_cmd(netplay_t *netplay, cmd_size = ntohl(cmd_size); #ifdef DEBUG_NETPLAY_STEPS - RARCH_LOG("Received netplay command %X (%u) from %u\n", cmd, cmd_size, + RARCH_LOG("[netplay] Received netplay command %X (%u) from %u\n", cmd, cmd_size, (unsigned) (connection - netplay->connections)); #endif @@ -1063,7 +1063,7 @@ static bool netplay_get_cmd(netplay_t *netplay, } #ifdef DEBUG_NETPLAY_STEPS - RARCH_LOG("Received input from %u\n", client_num); + RARCH_LOG("[netplay] Received input from %u\n", client_num); print_state(netplay); #endif break; @@ -1102,7 +1102,7 @@ static bool netplay_get_cmd(netplay_t *netplay, netplay->server_ptr = NEXT_PTR(netplay->server_ptr); netplay->server_frame_count++; #ifdef DEBUG_NETPLAY_STEPS - RARCH_LOG("Received server noinput\n"); + RARCH_LOG("[netplay] Received server noinput\n"); print_state(netplay); #endif break; @@ -1339,7 +1339,7 @@ static bool netplay_get_cmd(netplay_t *netplay, announce_play_spectate(netplay, NULL, NETPLAY_CONNECTION_PLAYING, devices); #ifdef DEBUG_NETPLAY_STEPS - RARCH_LOG("Received mode change self->%X\n", devices); + RARCH_LOG("[netplay] Received mode change self->%X\n", devices); print_state(netplay); #endif @@ -1363,7 +1363,7 @@ static bool netplay_get_cmd(netplay_t *netplay, announce_play_spectate(netplay, NULL, NETPLAY_CONNECTION_SPECTATING, 0); #ifdef DEBUG_NETPLAY_STEPS - RARCH_LOG("Received mode change self->spectating\n"); + RARCH_LOG("[netplay] Received mode change self->spectating\n"); print_state(netplay); #endif @@ -1394,7 +1394,7 @@ static bool netplay_get_cmd(netplay_t *netplay, announce_play_spectate(netplay, nick, NETPLAY_CONNECTION_PLAYING, devices); #ifdef DEBUG_NETPLAY_STEPS - RARCH_LOG("Received mode change %u->%u\n", client_num, devices); + RARCH_LOG("[netplay] Received mode change %u->%u\n", client_num, devices); print_state(netplay); #endif @@ -1410,7 +1410,7 @@ static bool netplay_get_cmd(netplay_t *netplay, announce_play_spectate(netplay, nick, NETPLAY_CONNECTION_SPECTATING, 0); #ifdef DEBUG_NETPLAY_STEPS - RARCH_LOG("Received mode change %u->spectator\n", client_num); + RARCH_LOG("[netplay] Received mode change %u->spectator\n", client_num); print_state(netplay); #endif @@ -1468,7 +1468,7 @@ static bool netplay_get_cmd(netplay_t *netplay, if (dmsg) { - RARCH_LOG("%s\n", dmsg); + RARCH_LOG("[netplay] %s\n", dmsg); runloop_msg_queue_push(dmsg, 1, 180, false); } break; @@ -1728,7 +1728,7 @@ static bool netplay_get_cmd(netplay_t *netplay, netplay->other_frame_count = load_frame_count; #ifdef DEBUG_NETPLAY_STEPS - RARCH_LOG("Loading state at %u\n", load_frame_count); + RARCH_LOG("[netplay] Loading state at %u\n", load_frame_count); print_state(netplay); #endif @@ -1774,7 +1774,7 @@ static bool netplay_get_cmd(netplay_t *netplay, { snprintf(msg, sizeof(msg)-1, msg_hash_to_str(MSG_NETPLAY_PEER_PAUSED), nick); } - RARCH_LOG("%s\n", msg); + RARCH_LOG("[netplay] %s\n", msg); runloop_msg_queue_push(msg, 1, 180, false); break; } @@ -1901,7 +1901,7 @@ int netplay_poll_net_input(netplay_t *netplay, bool block) if (socket_select(max_fd, &fds, NULL, NULL, &tv) < 0) return -1; - RARCH_LOG("Network is stalling at frame %u, count %u of %d ...\n", + RARCH_LOG("[netplay] Network is stalling at frame %u, count %u of %d ...\n", netplay->run_frame_count, netplay->timeout_cnt, MAX_RETRIES); if (netplay->timeout_cnt >= MAX_RETRIES && !netplay->remote_paused) @@ -2011,13 +2011,19 @@ void netplay_announce_nat_traversal(netplay_t *netplay) } #endif else + { + snprintf(msg, sizeof(msg), "%s\n", + msg_hash_to_str(MSG_UPNP_FAILED)); + runloop_msg_queue_push(msg, 1, 180, false); + RARCH_LOG("[netplay] %s\n", msg); return; + } snprintf(msg, sizeof(msg), "%s: %s:%s\n", msg_hash_to_str(MSG_PUBLIC_ADDRESS), host, port); runloop_msg_queue_push(msg, 1, 180, false); - RARCH_LOG("%s\n", msg); + RARCH_LOG("[netplay] %s\n", msg); #endif } diff --git a/paths.c b/paths.c index 869d6b8e34..67a71840c2 100644 --- a/paths.c +++ b/paths.c @@ -724,6 +724,8 @@ enum rarch_content_type path_is_media_type(const char *path) /* hack, to detect livestreams so the ffmpeg core can be started */ if ( strstr(path, "udp://") || + strstr(path, "http://") || + strstr(path, "https://")|| strstr(path, "tcp://") || strstr(path, "rtmp://") || strstr(path, "rtp://") diff --git a/pkg/android/phoenix-gradle/.gitignore b/pkg/android/phoenix-gradle/.gitignore new file mode 100644 index 0000000000..5559a70cbb --- /dev/null +++ b/pkg/android/phoenix-gradle/.gitignore @@ -0,0 +1,135 @@ + +# Created by https://www.gitignore.io/api/androidstudio +# Edit at https://www.gitignore.io/?templates=androidstudio + +### AndroidStudio ### +# Covers files to be ignored for android development using Android Studio. + +# Built application files +*.apk +*.ap_ + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ + +# Gradle files +.gradle +.gradle/ +build/ + +# Signing files +.signing/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio +/*/build/ +/*/local.properties +/*/out +/*/*/build +/*/*/production +captures/ +.navigation/ +*.ipr +*~ +*.swp + +# Android Patch +gen-external-apklibs + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild + +# NDK +obj/ + +# IntelliJ IDEA +*.iml +*.iws +/out/ + +# User-specific configurations +.idea/caches/ +.idea/libraries/ +.idea/shelf/ +.idea/workspace.xml +.idea/tasks.xml +.idea/.name +.idea/compiler.xml +.idea/copyright/profiles_settings.xml +.idea/encodings.xml +.idea/misc.xml +.idea/modules.xml +.idea/scopes/scope_settings.xml +.idea/dictionaries +.idea/vcs.xml +.idea/jsLibraryMappings.xml +.idea/datasources.xml +.idea/dataSources.ids +.idea/sqlDataSources.xml +.idea/dynamic.xml +.idea/uiDesigner.xml +.idea/assetWizardSettings.xml + +# OS-specific files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +# Legacy Eclipse project files +.classpath +.project +.cproject +.settings/ + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.war +*.ear + +# virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) +hs_err_pid* + +## Plugin-specific files: + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Mongo Explorer plugin +.idea/mongoSettings.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +### AndroidStudio Patch ### + +!/gradle/wrapper/gradle-wrapper.jar + +# End of https://www.gitignore.io/api/androidstudio diff --git a/pkg/android/phoenix-gradle/README.md b/pkg/android/phoenix-gradle/README.md new file mode 100644 index 0000000000..faca8c28b4 --- /dev/null +++ b/pkg/android/phoenix-gradle/README.md @@ -0,0 +1,83 @@ +Phoenix Gradle Build +==================== + +Implements a Gradle build based on the existing phoenix sources. + +It is currently only useful for running and debugging the RetroArch frontend in Android Studio. +This is caused by the fact that this build can't support the same older API level that the old Ant +based build does. The minimum supported API level for this build is 16. Also this will not build the +mips variant cause support for this architecture has long been removed from the Android NDK. +The only file that had to be duplicated is the AndroidManifest.xml because the modern Android build +won't allow SDK versions defined in this file anymore. It's also easier to change the app name this way. + +To get this running follow these steps: + +* Install the Android SDK Platform 28 +* Install the latest Android NDK +* Import the project into Android Studio +* Make sure to select the appropriate build variant for your device (32 or 64 bit) + +Sideloading a core +------------------ + +The `CoreSideloadActivity` activity allows you to sideload and run a core (with content) from your computer through ADB. + +**Keep in mind that forcefully stopping the process will not save any configuration you did in RetroArch. If you want your config to be saved, use "Quit RetroArch" in the main menu.** + +Usage : + +``` +adb shell am force-stop +adb push /data/local/tmp +adb shell am start -n /com.retroarch.browser.debug.CoreSideloadActivity --es "LIBRETRO" "/data/local/tmp/" --es "ROM" "" +``` + +Where `` is the target RetroArch app package name : + - `com.retroarch` (RetroArch) + - `com.retroarch.aarch64` (RetroArch64) +`` is the path to the content to load (on your device) (optional) +and `` is the path to the core to sideload (on your computer). + +Alternatively you can set up Android Studio so that it prompts you for a core file to sideload on launching the app. +In the Run/Debug configuration dialog add another run configuration as outlined in the following screenshot +![Sideload run configuration](sideload_core_android_studio.png) +Specifically take note of the Launch Options section and make sure to add a new step to the "Before launch" section that prompts for the +core file to load. The tool configuration is shown on the right. If yu run this configuration a file chooser dialog will show +where you can select the core to load. Keep in mind the filename is hardcoded so every time you load a different core it will be +overwritten. You can create multiple configurations like this to work around this limitation. + + +Debugging a core +---------------- + +This has so far only been tested with a limited number of cores that use ndk-build. In theory this also works with CMake, but that's currently untested. + +Following is an example of what it takes to debug the dosbox-svn core in Android Studio. It is based on the sideload technique outlined above. + +**Note**: Make sure the filename of the core does not get changed. Set up your Run/Debug configuration accordingly (Launch flags and ADB arguments)! Otherwise debugging will not work. + +* Clone dosbox-svn next to your RetroArch repo +* Run `ndk-build NDK_DEBUG=1` in dosbox-svn/libretro/jni +* In Android Studio create a new Gradle module of type Android Library. You can delete everything but AndroidManifest.xml and build.gradle from the new directory. +* In the newly created build.gradle file add the following in the `defaultConfig {}` block: +``` +ndk { + moduleName "dosbox-svn" +} +``` +Also add the following in the `android {}` block: +``` +externalNativeBuild { + ndkBuild { + path file('../../../../../dosbox-svn/libretro/jni/Android.mk') + } +} +``` +* Let the offered Gradle Sync run. You should see the core sources pop up in Android Studio. +* Set a breakpoint in the core code. + * A good example to check if the setup is working is `retro_get_system_info` which is called on core load +* In the Run/Debug Configurations dialog in Android Studio under Debugger -> Symbol Directories make sure to have your core symbols loaded. You should have two directories there (as per your architecture and core): + * /path/to/phoenix-gradle/app/build/intermediates/ndkBuild/ra<32 or 64>/debug/obj/local/ + * /path/to/dosbox-svn/libretro/obj/local/ +* Start the app with the sideload debug config from Android Studio +* The breakpoint should trigger once the core gets loaded diff --git a/pkg/android/phoenix-gradle/app/build.gradle b/pkg/android/phoenix-gradle/app/build.gradle new file mode 100644 index 0000000000..a5d62c00ea --- /dev/null +++ b/pkg/android/phoenix-gradle/app/build.gradle @@ -0,0 +1,68 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 28 + buildToolsVersion "28.0.3" + + defaultConfig { + applicationId "com.retroarch" + minSdkVersion 16 + targetSdkVersion 28 + + ndk { + moduleName "retroarch-activity" + } + + externalNativeBuild { + ndkBuild { + arguments "-j${Runtime.runtime.availableProcessors()}" + } + } + } + + flavorDimensions "abi" + productFlavors { + ra32 { + dimension "abi" + ndk { + abiFilters 'armeabi-v7a', 'x86' + } + resValue "string", "app_name", "RetroArch" + } + ra64 { + dimension "abi" + ndk { + abiFilters 'arm64-v8a', 'x86_64' + } + applicationIdSuffix '.aarch64' + resValue "string", "app_name", "RetroArch (AArch64)" + } + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' + } + } + externalNativeBuild { + ndkBuild { + path file('../../phoenix/jni/Android.mk') + } + } + + sourceSets { + ra32 { + java.srcDirs = ['../../phoenix/src'] + res.srcDirs = ['../../phoenix/res', '../../phoenix/libs/googleplay/res'] + } + ra64 { + java.srcDirs = ['../../phoenix/src'] + res.srcDirs = ['../../phoenix64/res', '../../phoenix64/libs/googleplay/res'] + } + } +} + +dependencies { + implementation files('../../phoenix/libs/googleplay/libs/google-play-services.jar') +} diff --git a/pkg/android/phoenix-gradle/app/src/main/AndroidManifest.xml b/pkg/android/phoenix-gradle/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..18f81c4611 --- /dev/null +++ b/pkg/android/phoenix-gradle/app/src/main/AndroidManifest.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkg/android/phoenix-gradle/build.gradle b/pkg/android/phoenix-gradle/build.gradle new file mode 100644 index 0000000000..2b29ba2521 --- /dev/null +++ b/pkg/android/phoenix-gradle/build.gradle @@ -0,0 +1,17 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.2.1' + } +} + +allprojects { + repositories { + google() + jcenter() + } +} diff --git a/pkg/android/phoenix-gradle/gradle/wrapper/gradle-wrapper.jar b/pkg/android/phoenix-gradle/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..f6b961fd5a Binary files /dev/null and b/pkg/android/phoenix-gradle/gradle/wrapper/gradle-wrapper.jar differ diff --git a/pkg/android/phoenix-gradle/gradle/wrapper/gradle-wrapper.properties b/pkg/android/phoenix-gradle/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..ae45383b6d --- /dev/null +++ b/pkg/android/phoenix-gradle/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/pkg/android/phoenix-gradle/gradlew b/pkg/android/phoenix-gradle/gradlew new file mode 100644 index 0000000000..cccdd3d517 --- /dev/null +++ b/pkg/android/phoenix-gradle/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/pkg/android/phoenix-gradle/gradlew.bat b/pkg/android/phoenix-gradle/gradlew.bat new file mode 100644 index 0000000000..f9553162f1 --- /dev/null +++ b/pkg/android/phoenix-gradle/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/pkg/android/phoenix-gradle/settings.gradle b/pkg/android/phoenix-gradle/settings.gradle new file mode 100644 index 0000000000..e7b4def49c --- /dev/null +++ b/pkg/android/phoenix-gradle/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/pkg/android/phoenix-gradle/sideload_core_android_studio.png b/pkg/android/phoenix-gradle/sideload_core_android_studio.png new file mode 100644 index 0000000000..a683c21b93 Binary files /dev/null and b/pkg/android/phoenix-gradle/sideload_core_android_studio.png differ diff --git a/pkg/android/phoenix/AndroidManifest.xml b/pkg/android/phoenix/AndroidManifest.xml index a5202a74f4..c7b2531e27 100644 --- a/pkg/android/phoenix/AndroidManifest.xml +++ b/pkg/android/phoenix/AndroidManifest.xml @@ -39,5 +39,6 @@ + diff --git a/pkg/android/phoenix/src/com/retroarch/browser/debug/CoreSideloadActivity.java b/pkg/android/phoenix/src/com/retroarch/browser/debug/CoreSideloadActivity.java new file mode 100644 index 0000000000..76d255c43f --- /dev/null +++ b/pkg/android/phoenix/src/com/retroarch/browser/debug/CoreSideloadActivity.java @@ -0,0 +1,192 @@ +package com.retroarch.browser.debug; + +import android.app.Activity; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Build; +import android.os.Bundle; +import android.preference.PreferenceManager; +import android.provider.Settings; +import android.util.Log; +import android.widget.TextView; + +import com.retroarch.browser.mainmenu.MainMenuActivity; +import com.retroarch.browser.preferences.util.UserPreferences; +import com.retroarch.browser.retroactivity.RetroActivityFuture; +import com.retroarch.browser.retroactivity.RetroActivityPast; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +/** + * This activity allows developers to sideload and run a core + * from their PC through adb + * + * Usage : see Phoenix Gradle Build README.md + */ +public class CoreSideloadActivity extends Activity +{ + private static final String EXTRA_CORE = "LIBRETRO"; + private static final String EXTRA_CONTENT = "ROM"; + + private TextView textView; + private CoreSideloadWorkerTask workerThread; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // The most simple layout is no layout at all + textView = new TextView(this); + setContentView(textView); + + // Check that we have at least the core extra + if (!getIntent().hasExtra(EXTRA_CORE)) + { + textView.setText("Missing extra \"LIBRETRO\""); + return; + } + + // Start our worker thread + workerThread = new CoreSideloadWorkerTask(this, textView, getIntent().getStringExtra(EXTRA_CORE), getIntent().getStringExtra(EXTRA_CONTENT)); + workerThread.execute(); + } + + @Override + protected void onDestroy() { + if (workerThread != null) + { + workerThread.cancel(true); + workerThread = null; + } + super.onDestroy(); + } + + private static class CoreSideloadWorkerTask extends AsyncTask + { + private TextView progressTextView; + private String core; + private String content; + private Activity ctx; + private File destination; + + public CoreSideloadWorkerTask(Activity ctx, TextView progressTextView, String corePath, String contentPath) + { + this.progressTextView = progressTextView; + this.core = corePath; + this.ctx = ctx; + this.content = contentPath; + } + + @Override + protected void onPreExecute() { + super.onPreExecute(); + progressTextView.setText("Sideloading..."); + } + + @Override + protected String doInBackground(Void... voids) { + File coreFile = new File(core); + File corePath = new File(UserPreferences.getPreferences(ctx).getString("libretro_path", ctx.getApplicationInfo().dataDir + "/cores/")); + + // Check that both files exist + if (!coreFile.exists()) + return "Input file doesn't exist (" + core + ")"; + + if (!corePath.exists()) + return "Destination directory doesn't exist (" + corePath.getAbsolutePath() + ")"; + + destination = new File(corePath, coreFile.getName()); + + // Copy it + Log.d("sideload", "Copying " + coreFile.getAbsolutePath() + " to " + destination.getAbsolutePath()); + long copied = 0; + long max = coreFile.length(); + try + { + InputStream is = new FileInputStream(coreFile); + OutputStream os = new FileOutputStream(destination); + + byte[] buf = new byte[1024]; + int length; + + while ((length = is.read(buf)) > 0) + { + os.write(buf, 0, length); + + copied += length; + publishProgress((int)(copied / max * 100)); + } + + is.close(); + os.close(); + } + catch (IOException ex) + { + ex.printStackTrace(); + return ex.getMessage(); + } + + return null; + } + + @Override + protected void onProgressUpdate(Integer... values) { + super.onProgressUpdate(values); + + if (values.length > 0) + progressTextView.setText("Sideloading: " + values[0] + "%"); + } + + @Override + protected void onPostExecute(String s) { + super.onPostExecute(s); + + // Everything went as expected + if (s == null) + { + progressTextView.setText("Done!"); + + // Run RA with our newly sideloaded core (and content) + Intent retro; + + if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)) + { + retro = new Intent(ctx, RetroActivityFuture.class); + } + else + { + retro = new Intent(ctx, RetroActivityPast.class); + } + + final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx); + + retro.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + + Log.d("sideload", "Running RetroArch with core " + destination.getAbsolutePath()); + + MainMenuActivity.startRetroActivity( + retro, + content, + destination.getAbsolutePath(), + UserPreferences.getDefaultConfigPath(ctx), + Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD), + ctx.getApplicationInfo().dataDir, + ctx.getApplicationInfo().sourceDir); + + ctx.startActivity(retro); + ctx.finish(); + } + // An error occured + else + { + progressTextView.setText("Error: " + s); + } + } + } +} diff --git a/pkg/android/phoenix64/AndroidManifest.xml b/pkg/android/phoenix64/AndroidManifest.xml index a2a1ad7d22..03dcee9dc2 100644 --- a/pkg/android/phoenix64/AndroidManifest.xml +++ b/pkg/android/phoenix64/AndroidManifest.xml @@ -39,5 +39,6 @@ + diff --git a/pkg/msvc-uwp/.gitignore b/pkg/msvc-uwp/.gitignore new file mode 100644 index 0000000000..c7d7d6c4da --- /dev/null +++ b/pkg/msvc-uwp/.gitignore @@ -0,0 +1,3 @@ +AppPackages/ +*/BundleArtifacts/ +.vs/ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/LargeTile.scale-100.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/LargeTile.scale-100.png new file mode 100644 index 0000000000..f731463086 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/LargeTile.scale-100.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/LargeTile.scale-200.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/LargeTile.scale-200.png new file mode 100644 index 0000000000..80c1425605 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/LargeTile.scale-200.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/LargeTile.scale-400.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/LargeTile.scale-400.png new file mode 100644 index 0000000000..85140caac2 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/LargeTile.scale-400.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/SmallTile.scale-100.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/SmallTile.scale-100.png new file mode 100644 index 0000000000..ef1f5dc6a8 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/SmallTile.scale-100.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/SmallTile.scale-200.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/SmallTile.scale-200.png new file mode 100644 index 0000000000..ca2057c758 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/SmallTile.scale-200.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/SmallTile.scale-400.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/SmallTile.scale-400.png new file mode 100644 index 0000000000..398721a461 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/SmallTile.scale-400.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square150x150Logo.scale-100.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square150x150Logo.scale-100.png new file mode 100644 index 0000000000..3b3b57758c Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square150x150Logo.scale-100.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square150x150Logo.scale-200.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square150x150Logo.scale-200.png new file mode 100644 index 0000000000..22ebaab856 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square150x150Logo.scale-200.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square150x150Logo.scale-400.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square150x150Logo.scale-400.png new file mode 100644 index 0000000000..efe1abaff7 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square150x150Logo.scale-400.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.altform-unplated_targetsize-16.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.altform-unplated_targetsize-16.png new file mode 100644 index 0000000000..d5b34622f9 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.altform-unplated_targetsize-16.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.altform-unplated_targetsize-256.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.altform-unplated_targetsize-256.png new file mode 100644 index 0000000000..22c0960e8d Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.altform-unplated_targetsize-256.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.altform-unplated_targetsize-48.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.altform-unplated_targetsize-48.png new file mode 100644 index 0000000000..2a253ca049 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.altform-unplated_targetsize-48.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.scale-100.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.scale-100.png new file mode 100644 index 0000000000..8b7216b8d8 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.scale-100.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.scale-200.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000000..6fec1f0113 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.scale-200.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.scale-400.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.scale-400.png new file mode 100644 index 0000000000..5e2a9c1e20 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.scale-400.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.targetsize-16.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.targetsize-16.png new file mode 100644 index 0000000000..979d24169f Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.targetsize-16.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.targetsize-256.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.targetsize-256.png new file mode 100644 index 0000000000..1f953b2fc8 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.targetsize-256.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.targetsize-48.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.targetsize-48.png new file mode 100644 index 0000000000..82b200438a Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Square44x44Logo.targetsize-48.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/StoreLogo.scale-100.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/StoreLogo.scale-100.png new file mode 100644 index 0000000000..a065bc4725 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/StoreLogo.scale-100.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/StoreLogo.scale-200.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/StoreLogo.scale-200.png new file mode 100644 index 0000000000..2f37ce6d7d Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/StoreLogo.scale-200.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/StoreLogo.scale-400.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/StoreLogo.scale-400.png new file mode 100644 index 0000000000..bc17a33e34 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/StoreLogo.scale-400.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Wide310x150Logo.scale-100.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Wide310x150Logo.scale-100.png new file mode 100644 index 0000000000..6253947fdc Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Wide310x150Logo.scale-100.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Wide310x150Logo.scale-200.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Wide310x150Logo.scale-200.png new file mode 100644 index 0000000000..7053ee0bbf Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Wide310x150Logo.scale-200.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Wide310x150Logo.scale-400.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Wide310x150Logo.scale-400.png new file mode 100644 index 0000000000..a0661bc4aa Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Assets/Wide310x150Logo.scale-400.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Package.appxmanifest b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Package.appxmanifest new file mode 100644 index 0000000000..c4a89d6664 --- /dev/null +++ b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/Package.appxmanifest @@ -0,0 +1,23 @@ + + + + + + RetroArch: non-free cores + libretro + Assets\StoreLogo.png + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/RetroArch-msvc2017-UWP-cores-nonfree.vcxproj b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/RetroArch-msvc2017-UWP-cores-nonfree.vcxproj new file mode 100644 index 0000000000..07b6a388d8 --- /dev/null +++ b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/RetroArch-msvc2017-UWP-cores-nonfree.vcxproj @@ -0,0 +1,230 @@ + + + + {cc7b9a23-bd64-4eb9-9d8f-f5115fb8960f} + RetroArch_msvc2017_UWP_cores_nonfree + en-US + 14.0 + true + Windows Store + 10.0.17763.0 + 10.0.15063.0 + 10.0 + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + Application + true + v141 + + + Application + true + v141 + + + Application + true + v141 + + + Application + true + v141 + true + + + Application + false + true + v141 + true + + + Application + false + true + v141 + true + + + Application + false + true + v141 + true + + + Application + false + true + v141 + true + + + + + + + + + + + + + + + + + + + + + + + + + ..\msvc2017-UWP\RetroArch-msvc2017-UWP_TemporaryKey.pfx + False + False + Always + x86|x64|arm + 1 + OnApplicationRun + + + + /bigobj %(AdditionalOptions) + 4453;28204 + NotUsing + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + NotUsing + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + NotUsing + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + NotUsing + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + NotUsing + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + NotUsing + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + NotUsing + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + NotUsing + + + + + Designer + + + true + cores\%(Filename)%(Extension) + + + true + %(Filename)%(Extension) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/RetroArch-msvc2017-UWP-cores-nonfree.vcxproj.filters b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/RetroArch-msvc2017-UWP-cores-nonfree.vcxproj.filters new file mode 100644 index 0000000000..9834a81c26 --- /dev/null +++ b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/RetroArch-msvc2017-UWP-cores-nonfree.vcxproj.filters @@ -0,0 +1,100 @@ + + + + + 56304c12-6031-4556-a470-2c69aecd5919 + bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/input/drivers_joypad/ps2_joypad_copy.c b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/cores/ARM/.empty similarity index 100% rename from input/drivers_joypad/ps2_joypad_copy.c rename to pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/cores/ARM/.empty diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/cores/ARM/cores/.empty b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/cores/ARM/cores/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/cores/ARM64/.empty b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/cores/ARM64/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/cores/ARM64/cores/.empty b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/cores/ARM64/cores/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/cores/Win32/.empty b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/cores/Win32/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/cores/Win32/cores/.empty b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/cores/Win32/cores/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/cores/x64/.empty b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/cores/x64/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/cores/x64/cores/.empty b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/cores/x64/cores/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/dummy.cpp b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/dummy.cpp new file mode 100644 index 0000000000..935c25a93c --- /dev/null +++ b/pkg/msvc-uwp/RetroArch-msvc2017-UWP-cores-nonfree/dummy.cpp @@ -0,0 +1,5 @@ +[Platform::MTAThread] +int main(Platform::Array^) +{ + throw ref new Platform::NotImplementedException(); +} diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP.sln b/pkg/msvc-uwp/RetroArch-msvc2017-UWP.sln new file mode 100644 index 0000000000..7cd6c43dd7 --- /dev/null +++ b/pkg/msvc-uwp/RetroArch-msvc2017-UWP.sln @@ -0,0 +1,83 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.168 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RetroArch-msvc2017-UWP", "RetroArch-msvc2017-UWP\RetroArch-msvc2017-UWP.vcxproj", "{F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RetroArch-msvc2017-UWP-cores-nonfree", "RetroArch-msvc2017-UWP-cores-nonfree\RetroArch-msvc2017-UWP-cores-nonfree.vcxproj", "{CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|ARM.ActiveCfg = Debug|ARM + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|ARM.Build.0 = Debug|ARM + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|ARM.Deploy.0 = Debug|ARM + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|ARM64.Build.0 = Debug|ARM64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|x64.ActiveCfg = Debug|x64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|x64.Build.0 = Debug|x64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|x64.Deploy.0 = Debug|x64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|x86.ActiveCfg = Debug|Win32 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|x86.Build.0 = Debug|Win32 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Debug|x86.Deploy.0 = Debug|Win32 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|Any CPU.ActiveCfg = Release|Win32 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|ARM.ActiveCfg = Release|ARM + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|ARM.Build.0 = Release|ARM + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|ARM.Deploy.0 = Release|ARM + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|ARM64.ActiveCfg = Release|ARM64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|ARM64.Build.0 = Release|ARM64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|ARM64.Deploy.0 = Release|ARM64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|x64.ActiveCfg = Release|x64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|x64.Build.0 = Release|x64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|x64.Deploy.0 = Release|x64 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|x86.ActiveCfg = Release|Win32 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|x86.Build.0 = Release|Win32 + {F5E937B6-1BA0-4446-B94B-F3BBDEF908F4}.Release|x86.Deploy.0 = Release|Win32 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Debug|ARM.ActiveCfg = Debug|ARM + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Debug|ARM.Build.0 = Debug|ARM + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Debug|ARM.Deploy.0 = Debug|ARM + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Debug|ARM64.Build.0 = Debug|ARM64 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Debug|x64.ActiveCfg = Debug|x64 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Debug|x64.Build.0 = Debug|x64 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Debug|x64.Deploy.0 = Debug|x64 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Debug|x86.ActiveCfg = Debug|Win32 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Debug|x86.Build.0 = Debug|Win32 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Debug|x86.Deploy.0 = Debug|Win32 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Release|Any CPU.ActiveCfg = Release|Win32 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Release|ARM.ActiveCfg = Release|ARM + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Release|ARM.Build.0 = Release|ARM + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Release|ARM.Deploy.0 = Release|ARM + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Release|ARM64.ActiveCfg = Release|ARM64 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Release|ARM64.Build.0 = Release|ARM64 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Release|ARM64.Deploy.0 = Release|ARM64 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Release|x64.ActiveCfg = Release|x64 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Release|x64.Build.0 = Release|x64 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Release|x64.Deploy.0 = Release|x64 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Release|x86.ActiveCfg = Release|Win32 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Release|x86.Build.0 = Release|Win32 + {CC7B9A23-BD64-4EB9-9D8F-F5115FB8960F}.Release|x86.Deploy.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2A811B94-2232-4C4E-A88E-33B0CDF139A2} + EndGlobalSection +EndGlobal diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/LargeTile.scale-100.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/LargeTile.scale-100.png new file mode 100644 index 0000000000..f731463086 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/LargeTile.scale-100.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/LargeTile.scale-200.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/LargeTile.scale-200.png new file mode 100644 index 0000000000..80c1425605 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/LargeTile.scale-200.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/LargeTile.scale-400.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/LargeTile.scale-400.png new file mode 100644 index 0000000000..85140caac2 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/LargeTile.scale-400.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SmallTile.scale-100.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SmallTile.scale-100.png new file mode 100644 index 0000000000..ef1f5dc6a8 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SmallTile.scale-100.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SmallTile.scale-200.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SmallTile.scale-200.png new file mode 100644 index 0000000000..ca2057c758 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SmallTile.scale-200.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SmallTile.scale-400.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SmallTile.scale-400.png new file mode 100644 index 0000000000..398721a461 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SmallTile.scale-400.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SplashScreen.scale-100.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SplashScreen.scale-100.png new file mode 100644 index 0000000000..23acbe613d Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SplashScreen.scale-100.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SplashScreen.scale-200.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SplashScreen.scale-200.png new file mode 100644 index 0000000000..5fb2eb78fc Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SplashScreen.scale-200.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SplashScreen.scale-400.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SplashScreen.scale-400.png new file mode 100644 index 0000000000..62d2b0911b Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/SplashScreen.scale-400.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square150x150Logo.scale-100.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square150x150Logo.scale-100.png new file mode 100644 index 0000000000..3b3b57758c Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square150x150Logo.scale-100.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square150x150Logo.scale-200.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square150x150Logo.scale-200.png new file mode 100644 index 0000000000..22ebaab856 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square150x150Logo.scale-200.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square150x150Logo.scale-400.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square150x150Logo.scale-400.png new file mode 100644 index 0000000000..efe1abaff7 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square150x150Logo.scale-400.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.altform-unplated_targetsize-16.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.altform-unplated_targetsize-16.png new file mode 100644 index 0000000000..d5b34622f9 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.altform-unplated_targetsize-16.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.altform-unplated_targetsize-256.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.altform-unplated_targetsize-256.png new file mode 100644 index 0000000000..22c0960e8d Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.altform-unplated_targetsize-256.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.altform-unplated_targetsize-48.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.altform-unplated_targetsize-48.png new file mode 100644 index 0000000000..2a253ca049 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.altform-unplated_targetsize-48.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.scale-100.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.scale-100.png new file mode 100644 index 0000000000..8b7216b8d8 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.scale-100.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.scale-200.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000000..6fec1f0113 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.scale-200.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.scale-400.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.scale-400.png new file mode 100644 index 0000000000..5e2a9c1e20 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.scale-400.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.targetsize-16.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.targetsize-16.png new file mode 100644 index 0000000000..979d24169f Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.targetsize-16.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.targetsize-256.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.targetsize-256.png new file mode 100644 index 0000000000..1f953b2fc8 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.targetsize-256.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.targetsize-48.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.targetsize-48.png new file mode 100644 index 0000000000..82b200438a Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Square44x44Logo.targetsize-48.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/StoreLogo.scale-100.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/StoreLogo.scale-100.png new file mode 100644 index 0000000000..a065bc4725 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/StoreLogo.scale-100.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/StoreLogo.scale-200.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/StoreLogo.scale-200.png new file mode 100644 index 0000000000..2f37ce6d7d Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/StoreLogo.scale-200.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/StoreLogo.scale-400.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/StoreLogo.scale-400.png new file mode 100644 index 0000000000..bc17a33e34 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/StoreLogo.scale-400.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Wide310x150Logo.scale-100.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Wide310x150Logo.scale-100.png new file mode 100644 index 0000000000..6253947fdc Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Wide310x150Logo.scale-100.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Wide310x150Logo.scale-200.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Wide310x150Logo.scale-200.png new file mode 100644 index 0000000000..7053ee0bbf Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Wide310x150Logo.scale-200.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Wide310x150Logo.scale-400.png b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Wide310x150Logo.scale-400.png new file mode 100644 index 0000000000..a0661bc4aa Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Assets/Wide310x150Logo.scale-400.png differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Bundle.Mapping.txt b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Bundle.Mapping.txt new file mode 100644 index 0000000000..5e48e1ae47 --- /dev/null +++ b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Bundle.Mapping.txt @@ -0,0 +1,2 @@ +[ExternalPackages] +"..\AppPackages\RetroArch-UWP-cores-nonfree\RetroArch-UWP-cores-nonfree_1.0.0.0_Test\RetroArch-UWP-cores-nonfree_1.0.0.0_x86_x64_arm.appxbundle" diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Package.appxmanifest b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Package.appxmanifest new file mode 100644 index 0000000000..e1d4376bbd --- /dev/null +++ b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/Package.appxmanifest @@ -0,0 +1,29 @@ + + + + + + RetroArch + libretro + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/RetroArch-msvc2017-UWP.vcxproj b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/RetroArch-msvc2017-UWP.vcxproj new file mode 100644 index 0000000000..1f21ca7a6c --- /dev/null +++ b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/RetroArch-msvc2017-UWP.vcxproj @@ -0,0 +1,337 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + Debug + ARM64 + + + Release + ARM64 + + + + {f5e937b6-1ba0-4446-b94b-f3bbdef908f4} + DirectXApp + RetroArchUWP + en-US + 14.0 + true + Windows Store + 10.0 + 10.0.17763.0 + 10.0.15063.0 + true + + + + Application + true + v141 + + + Application + true + v141 + + + Application + true + v141 + true + + + Application + true + v141 + + + Application + false + true + v141 + true + + + Application + false + true + v141 + true + + + Application + false + true + v141 + true + + + Application + false + true + v141 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RetroArch-UWP_TemporaryKey.pfx + False + False + x86|x64|arm + 1 + OnApplicationRun + Always + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) + + + + + $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_GLSLANG;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D11;HAVE_D3D12;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;HAVE_OVERLAY;HAVE_RGUI;HAVE_MENU;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) + + + + + $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_GLSLANG;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D11;HAVE_D3D12;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm64; $(VCInstallDir)\lib\arm64 + /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) + + + + + $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_GLSLANG;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D11;HAVE_D3D12;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;HAVE_OVERLAY;HAVE_RGUI;HAVE_MENU;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm64; $(VCInstallDir)\lib\arm64 + /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) + + + + + $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_GLSLANG;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D11;HAVE_D3D12;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) + + + + + $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_GLSLANG;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D11;HAVE_D3D12;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;HAVE_OVERLAY;HAVE_RGUI;HAVE_MENU;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS + ProgramDatabase + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) + + + + + $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_GLSLANG;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D11;HAVE_D3D12;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) + + + + + $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_GLSLANG;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D11;HAVE_D3D12;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;HAVE_OVERLAY;HAVE_RGUI;HAVE_MENU;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS + ProgramDatabase + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) + + + + + $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + WIN32;HAVE_MAIN;HAVE_DYNAMIC;HAVE_XAUDIO2;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_GLSLANG;HAVE_SLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D11;HAVE_D3D12;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_XINPUT;HAVE_XINPUT2;HAVE_XAUDIO;HAVE_DIRECTX;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_STATIC_DUMMY;HAVE_STATIC_VIDEO_FILTERS;HAVE_STATIC_AUDIO_FILTERS + + + + + false + false + false + false + false + false + false + false + + + + + + + + + + Designer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + cores\%(Filename)%(Extension) + + + true + %(Filename)%(Extension) + + + + + + + + + + + + \ No newline at end of file diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/RetroArch-msvc2017-UWP.vcxproj.filters b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/RetroArch-msvc2017-UWP.vcxproj.filters new file mode 100644 index 0000000000..3fcb574ea4 --- /dev/null +++ b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/RetroArch-msvc2017-UWP.vcxproj.filters @@ -0,0 +1,130 @@ + + + + + {1246fa09-e114-4a52-88c2-657b2f13d9fb} + + + {32de9679-6494-4933-afa2-430fd975e506} + + + {c3155604-6d38-494a-bfe0-861cef871cb2} + + + + + + + + + + + + + uwp + + + uwp + + + + + griffin + + + griffin + + + uwp + + + griffin + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + \ No newline at end of file diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/RetroArch-msvc2017-UWP_TemporaryKey.pfx b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/RetroArch-msvc2017-UWP_TemporaryKey.pfx new file mode 100644 index 0000000000..ff20a54c34 Binary files /dev/null and b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/RetroArch-msvc2017-UWP_TemporaryKey.pfx differ diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/cores/ARM/.empty b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/cores/ARM/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/cores/ARM/cores/.empty b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/cores/ARM/cores/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/cores/ARM64/.empty b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/cores/ARM64/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/cores/ARM64/cores/.empty b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/cores/ARM64/cores/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/cores/Win32/.empty b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/cores/Win32/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/cores/Win32/cores/.empty b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/cores/Win32/cores/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/cores/x64/.empty b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/cores/x64/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pkg/msvc-uwp/RetroArch-msvc2017-UWP/cores/x64/cores/.empty b/pkg/msvc-uwp/RetroArch-msvc2017-UWP/cores/x64/cores/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ps2/compat_ctype.c b/ps2/compat_ctype.c index 0c5dba835d..4dbd400cea 100644 --- a/ps2/compat_ctype.c +++ b/ps2/compat_ctype.c @@ -1,3 +1,17 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2018 - Francisco Javier Trujillo Mata - fjtrujy + * + * RetroArch is free software: 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 @@ -425,3 +439,8 @@ int link(const char *oldpath, const char *newpath) { return fileXioSymlink(oldpath, newpath); } + +int unlink(const char *path) +{ + return fileXioRemove(path); +} diff --git a/ps2/include/compat_ctype.h b/ps2/include/compat_ctype.h index 1d80025c28..cd1b96f543 100644 --- a/ps2/include/compat_ctype.h +++ b/ps2/include/compat_ctype.h @@ -1,3 +1,17 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2018 - Francisco Javier Trujillo Mata - fjtrujy + * + * RetroArch is free software: 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 COMPAT_CTYPE_H #define COMPAT_CTYPE_H @@ -6,5 +20,6 @@ char *strtok_r(char *str, const char *delim, char **saveptr); unsigned long long strtoull(const char * __restrict nptr, char ** __restrict endptr, int base); int link(const char *oldpath, const char *newpath); +int unlink(const char *path); #endif diff --git a/ps2/include/inttypes.h b/ps2/include/inttypes.h index 3049fbdbba..8b37fcc33e 100644 --- a/ps2/include/inttypes.h +++ b/ps2/include/inttypes.h @@ -1,3 +1,17 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2018 - Francisco Javier Trujillo Mata - fjtrujy + * + * RetroArch is free software: 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 INTTYPES_H #define INTTYPES_H diff --git a/ps2/include/math.h b/ps2/include/math.h index bf0071edb1..fa0672624f 100644 --- a/ps2/include/math.h +++ b/ps2/include/math.h @@ -1,3 +1,17 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2018 - Francisco Javier Trujillo Mata - fjtrujy + * + * RetroArch is free software: 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 MATH_H #define MATH_H diff --git a/ps2/include/pte_types.h b/ps2/include/pte_types.h index 7e81156684..4da1ebac65 100644 --- a/ps2/include/pte_types.h +++ b/ps2/include/pte_types.h @@ -1,4 +1,16 @@ -/* pte_types.h */ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2018 - Francisco Javier Trujillo Mata - fjtrujy + * + * RetroArch is free software: 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 PTE_TYPES_H #define PTE_TYPES_H diff --git a/ps2/include/stdint.h b/ps2/include/stdint.h index 813efd21f8..e1db22e6da 100644 --- a/ps2/include/stdint.h +++ b/ps2/include/stdint.h @@ -1,3 +1,17 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2018 - Francisco Javier Trujillo Mata - fjtrujy + * + * RetroArch is free software: 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 STDINT_H #define STDINT_H @@ -27,4 +41,4 @@ typedef unsigned long uint64_t; #define UINT32_C(val) val##ui #define UINT64_C(val) val##ul -#endif //STDINT_H +#endif /* STDINT_H */ diff --git a/qb/config.libs.sh b/qb/config.libs.sh index 3156d9e7a2..9d2312797d 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -409,11 +409,18 @@ else check_val '' ZLIB '-lz' fi -if [ "$HAVE_MPV" != 'no' ]; then - check_pkgconf MPV libmpv +check_pkgconf MPV mpv +check_val '' MPV -lmpv + +if [ "$HAVE_THREADS" = 'no' ] && [ "$HAVE_FFMPEG" != 'no' ]; then + HAVE_FFMPEG='no' + die : 'Notice: Threads are not available, FFmpeg will also be disabled.' fi -if [ "$HAVE_THREADS" != 'no' ] && [ "$HAVE_FFMPEG" != 'no' ]; then +check_header DRMINGW exchndl.h +check_lib '' DRMINGW -lexchndl + +if [ "$HAVE_FFMPEG" != 'no' ]; then check_pkgconf AVCODEC libavcodec 54 check_pkgconf AVFORMAT libavformat 54 check_pkgconf AVDEVICE libavdevice @@ -438,7 +445,6 @@ if [ "$HAVE_THREADS" != 'no' ] && [ "$HAVE_FFMPEG" != 'no' ]; then die : 'Notice: FFmpeg built-in support disabled due to missing or unsuitable packages.' fi else - die : 'Notice: Not building with threading support. Will skip FFmpeg.' HAVE_FFMPEG='no' fi @@ -556,7 +562,7 @@ fi check_pkgconf PYTHON python3 -if [ "$HAVE_MATERIALUI" != 'no' ] || [ "$HAVE_XMB" != 'no' ] || [ "$HAVE_ZARCH" != 'no' ]; then +if [ "$HAVE_MATERIALUI" != 'no' ] || [ "$HAVE_XMB" != 'no' ] || [ "$HAVE_ZARCH" != 'no' ] || [ "$HAVE_OZONE" != 'no' ]; then if [ "$HAVE_RGUI" = 'no' ]; then HAVE_MATERIALUI=no HAVE_XMB=no diff --git a/qb/config.params.sh b/qb/config.params.sh index bf62a58029..0ed6fb676a 100644 --- a/qb/config.params.sh +++ b/qb/config.params.sh @@ -34,7 +34,7 @@ HAVE_THREADS=auto # Threading support HAVE_THREAD_STORAGE=auto # Thread Local Storage support HAVE_FFMPEG=auto # FFmpeg support C89_FFMPEG=no -HAVE_MPV=auto # MPV support +HAVE_MPV=no # MPV support HAVE_SSA=auto # SSA/ASS for FFmpeg subtitle support HAVE_DYLIB=auto # Dynamic loading support HAVE_NETWORKING=auto # Networking features (recommended) @@ -117,7 +117,7 @@ C89_QT=no HAVE_XSHM=no # XShm video driver support HAVE_CHEEVOS=yes # Retro Achievements C89_CHEEVOS=no -HAVE_LUA=yes # Lua support (for Retro Achievements) +HAVE_LUA=no # Lua support (for Retro Achievements) HAVE_DISCORD=yes # Discord Integration C89_DISCORD=no HAVE_SHADERPIPELINE=yes # Additional shader-based pipelines @@ -134,3 +134,4 @@ HAVE_LANGEXTRA=yes # Multi-language support HAVE_OSMESA=no # Off-screen Mesa rendering HAVE_VIDEOPROCESSOR=auto # Enable video processor core HAVE_VIDEOCORE=auto # Broadcom Videocore 4 support +HAVE_DRMINGW=no # DrMingw exception handler diff --git a/retroarch.c b/retroarch.c index 3e0dc5cb1a..5e92fec952 100644 --- a/retroarch.c +++ b/retroarch.c @@ -23,6 +23,9 @@ #define WIN32_LEAN_AND_MEAN #include #endif +#if defined(DEBUG) && defined(HAVE_DRMINGW) +#include "exchndl.h" +#endif #endif #include @@ -1255,7 +1258,7 @@ static void retroarch_validate_cpu_features(void) static void retroarch_main_init_media(void) { - settings_t *settings = config_get_ptr(); + settings_t *settings = config_get_ptr(); const char *fullpath = path_get(RARCH_PATH_CONTENT); bool builtin_imageviewer = false; bool builtin_mediaplayer = false; @@ -1316,6 +1319,10 @@ bool retroarch_main_init(int argc, char *argv[]) bool init_failed = false; global_t *global = global_get_ptr(); +#if defined(DEBUG) && defined(HAVE_DRMINGW) + char log_file_name[128]; +#endif + retroarch_init_state(); if (setjmp(error_sjlj_context) > 0) @@ -1334,7 +1341,6 @@ bool retroarch_main_init(int argc, char *argv[]) if (verbosity_is_enabled()) { char str[128]; - str[0] = '\0'; RARCH_LOG_OUTPUT("=== Build =======================================\n"); @@ -1348,6 +1354,14 @@ bool retroarch_main_init(int argc, char *argv[]) RARCH_LOG_OUTPUT("=================================================\n"); } +#if defined(DEBUG) && defined(HAVE_DRMINGW) + RARCH_LOG("Initializing Dr.MingW Exception handler\n"); + fill_str_dated_filename(log_file_name, "crash", + "log", sizeof(log_file_name)); + ExcHndlInit(); + ExcHndlSetLogFileNameA(log_file_name); +#endif + retroarch_validate_cpu_features(); rarch_ctl(RARCH_CTL_TASK_INIT, NULL); diff --git a/runahead/secondary_core.c b/runahead/secondary_core.c index 801d2e491e..02d708e736 100644 --- a/runahead/secondary_core.c +++ b/runahead/secondary_core.c @@ -18,6 +18,7 @@ #include "mem_util.h" #include "../core.h" +#include "../configuration.h" #include "../dynamic.h" #include "../paths.h" #include "../content.h" @@ -50,6 +51,7 @@ void clear_controller_port_map(void); static char *get_temp_directory_alloc(void) { + settings_t *settings = config_get_ptr(); char *path = NULL; #ifdef _WIN32 #ifdef LEGACY_WIN32 @@ -67,6 +69,8 @@ static char *get_temp_directory_alloc(void) path = utf16_to_utf8_string_alloc(wideStr); free(wideStr); #endif +#elif defined ANDROID + path = strcpy_alloc_force(settings->paths.directory_libretro); #else path = "/tmp"; if (getenv("TMPDIR")) diff --git a/tasks/task_content.c b/tasks/task_content.c index af23201538..60e08e11da 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -1899,6 +1899,7 @@ bool content_init(void) temporary_content = string_list_new(); content_ctx.check_firmware_before_loading = settings->bools.check_firmware_before_loading; + content_ctx.patch_is_blocked = rarch_ctl(RARCH_CTL_IS_PATCH_BLOCKED, NULL); content_ctx.is_ips_pref = rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL); content_ctx.is_bps_pref = rarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL); content_ctx.is_ups_pref = rarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL); @@ -1913,7 +1914,6 @@ bool content_init(void) content_ctx.block_extract = false; content_ctx.need_fullpath = false; content_ctx.set_supports_no_game_enable = false; - content_ctx.patch_is_blocked = false; content_ctx.subsystem.data = NULL; content_ctx.subsystem.size = 0; diff --git a/tasks/task_screenshot.c b/tasks/task_screenshot.c index 2ea95618ac..d84167bf00 100644 --- a/tasks/task_screenshot.c +++ b/tasks/task_screenshot.c @@ -195,10 +195,14 @@ static bool screenshot_dump( calloc(1, sizeof(*state)); const char *screenshot_dir = settings->paths.directory_screenshot; char shotname[256]; + struct retro_system_info system_info; shotname[0] = '\0'; screenshot_path[0] = '\0'; + if (!core_get_system_info(&system_info)) + return false; + /* If fullpath is true, name_base already contains a static path + filename to save the screenshot to. */ if (fullpath) strlcpy(state->filename, name_base, sizeof(state->filename)); @@ -232,8 +236,14 @@ static bool screenshot_dump( else { if (settings->bools.auto_screenshot_filename) - fill_str_dated_filename(shotname, path_basename(name_base), - IMG_EXT, sizeof(shotname)); + { + if (path_is_empty(RARCH_PATH_CONTENT)) + fill_str_dated_filename(shotname, system_info.library_name, + IMG_EXT, sizeof(shotname)); + else + fill_str_dated_filename(shotname, path_basename(name_base), + IMG_EXT, sizeof(shotname)); + } else snprintf(shotname, sizeof(shotname), "%s.png", path_basename(name_base)); diff --git a/ui/ui_companion_driver.c b/ui/ui_companion_driver.c index daeae6e1d3..204db1ebc8 100644 --- a/ui/ui_companion_driver.c +++ b/ui/ui_companion_driver.c @@ -27,7 +27,7 @@ #include "ui_companion_driver.h" static const ui_companion_driver_t *ui_companion_drivers[] = { -#if defined(_WIN32) && !defined(_XBOX) +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) &ui_companion_win32, #endif #if defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL) diff --git a/uwp/uwp_func.h b/uwp/uwp_func.h new file mode 100644 index 0000000000..ecab3b8a03 --- /dev/null +++ b/uwp/uwp_func.h @@ -0,0 +1,44 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2018 - Krzysztof Haładyn + * + * RetroArch is free software: 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 _UWP_FUNC_H +#define _UWP_FUNC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern char uwp_dir_install[PATH_MAX_LENGTH]; +extern char uwp_dir_data[PATH_MAX_LENGTH]; +extern char uwp_device_family[128]; + +void* uwp_get_corewindow(void); + +void uwp_input_next_frame(void); +bool uwp_keyboard_pressed(unsigned key); +int16_t uwp_mouse_state(unsigned port, unsigned id, bool screen); +int16_t uwp_pointer_state(unsigned idx, unsigned id, bool screen); + +void uwp_fill_installed_core_packages(struct string_list *list); + +extern const struct rarch_key_map rarch_key_map_uwp[]; + +#ifdef __cplusplus +} +#endif + +#endif _UWP_FUNC_H diff --git a/uwp/uwp_main.cpp b/uwp/uwp_main.cpp new file mode 100644 index 0000000000..bc1c9b5e13 --- /dev/null +++ b/uwp/uwp_main.cpp @@ -0,0 +1,630 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2018 - Krzysztof Haładyn + * + * RetroArch is free software: 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 "uwp_main.h" +#include +#include +#include "../retroarch.h" +#include "../frontend/frontend.h" +#include "../input/input_keymaps.h" +#include "../input/input_driver.h" +#include "../verbosity.h" +#include "../libretro-common/include/encodings/utf.h" +#include "../libretro-common/include/lists/string_list.h" +#include "uwp_func.h" + +#include +#include + +using namespace RetroArchUWP; + +using namespace concurrency; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Core; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::UI::Core; +using namespace Windows::UI::Input; +using namespace Windows::UI::ViewManagement; +using namespace Windows::Devices::Input; +using namespace Windows::System; +using namespace Windows::System::Profile; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::Graphics::Display; + +char uwp_dir_install[PATH_MAX_LENGTH]; +char uwp_dir_data[PATH_MAX_LENGTH]; +char uwp_device_family[128]; + +// Some keys are unavailable in the VirtualKey enum (wtf) but the old-style constants work +const struct rarch_key_map rarch_key_map_uwp[] = { + { (unsigned int)VirtualKey::Back, RETROK_BACKSPACE }, + { (unsigned int)VirtualKey::Tab, RETROK_TAB }, + { (unsigned int)VirtualKey::Clear, RETROK_CLEAR }, + { (unsigned int)VirtualKey::Enter, RETROK_RETURN }, + { (unsigned int)VirtualKey::Pause, RETROK_PAUSE }, + { (unsigned int)VirtualKey::Escape, RETROK_ESCAPE }, + { (unsigned int)VirtualKey::ModeChange, RETROK_MODE }, + { (unsigned int)VirtualKey::Space, RETROK_SPACE }, + { (unsigned int)VirtualKey::PageUp, RETROK_PAGEUP }, + { (unsigned int)VirtualKey::PageDown, RETROK_PAGEDOWN }, + { (unsigned int)VirtualKey::End, RETROK_END }, + { (unsigned int)VirtualKey::Home, RETROK_HOME }, + { (unsigned int)VirtualKey::Left, RETROK_LEFT }, + { (unsigned int)VirtualKey::Up, RETROK_UP }, + { (unsigned int)VirtualKey::Right, RETROK_RIGHT }, + { (unsigned int)VirtualKey::Down, RETROK_DOWN }, + { (unsigned int)VirtualKey::Print, RETROK_PRINT }, + { (unsigned int)VirtualKey::Insert, RETROK_INSERT }, + { (unsigned int)VirtualKey::Delete, RETROK_DELETE }, + { (unsigned int)VirtualKey::Help, RETROK_HELP }, + { (unsigned int)VirtualKey::Number0, RETROK_0 }, + { (unsigned int)VirtualKey::Number1, RETROK_1 }, + { (unsigned int)VirtualKey::Number2, RETROK_2 }, + { (unsigned int)VirtualKey::Number3, RETROK_3 }, + { (unsigned int)VirtualKey::Number4, RETROK_4 }, + { (unsigned int)VirtualKey::Number5, RETROK_5 }, + { (unsigned int)VirtualKey::Number6, RETROK_6 }, + { (unsigned int)VirtualKey::Number7, RETROK_7 }, + { (unsigned int)VirtualKey::Number8, RETROK_8 }, + { (unsigned int)VirtualKey::Number9, RETROK_9 }, + { (unsigned int)VirtualKey::A, RETROK_a }, + { (unsigned int)VirtualKey::B, RETROK_b }, + { (unsigned int)VirtualKey::C, RETROK_c }, + { (unsigned int)VirtualKey::D, RETROK_d }, + { (unsigned int)VirtualKey::E, RETROK_e }, + { (unsigned int)VirtualKey::F, RETROK_f }, + { (unsigned int)VirtualKey::G, RETROK_g }, + { (unsigned int)VirtualKey::H, RETROK_h }, + { (unsigned int)VirtualKey::I, RETROK_i }, + { (unsigned int)VirtualKey::J, RETROK_j }, + { (unsigned int)VirtualKey::K, RETROK_k }, + { (unsigned int)VirtualKey::L, RETROK_l }, + { (unsigned int)VirtualKey::M, RETROK_m }, + { (unsigned int)VirtualKey::N, RETROK_n }, + { (unsigned int)VirtualKey::O, RETROK_o }, + { (unsigned int)VirtualKey::P, RETROK_p }, + { (unsigned int)VirtualKey::Q, RETROK_q }, + { (unsigned int)VirtualKey::R, RETROK_r }, + { (unsigned int)VirtualKey::S, RETROK_s }, + { (unsigned int)VirtualKey::T, RETROK_t }, + { (unsigned int)VirtualKey::U, RETROK_u }, + { (unsigned int)VirtualKey::V, RETROK_v }, + { (unsigned int)VirtualKey::W, RETROK_w }, + { (unsigned int)VirtualKey::X, RETROK_x }, + { (unsigned int)VirtualKey::Y, RETROK_y }, + { (unsigned int)VirtualKey::Z, RETROK_z }, + { (unsigned int)VirtualKey::LeftWindows, RETROK_LSUPER }, + { (unsigned int)VirtualKey::RightWindows, RETROK_RSUPER }, + { (unsigned int)VirtualKey::Application, RETROK_MENU }, + { (unsigned int)VirtualKey::NumberPad0, RETROK_KP0 }, + { (unsigned int)VirtualKey::NumberPad1, RETROK_KP1 }, + { (unsigned int)VirtualKey::NumberPad2, RETROK_KP2 }, + { (unsigned int)VirtualKey::NumberPad3, RETROK_KP3 }, + { (unsigned int)VirtualKey::NumberPad4, RETROK_KP4 }, + { (unsigned int)VirtualKey::NumberPad5, RETROK_KP5 }, + { (unsigned int)VirtualKey::NumberPad6, RETROK_KP6 }, + { (unsigned int)VirtualKey::NumberPad7, RETROK_KP7 }, + { (unsigned int)VirtualKey::NumberPad8, RETROK_KP8 }, + { (unsigned int)VirtualKey::NumberPad9, RETROK_KP9 }, + { (unsigned int)VirtualKey::Multiply, RETROK_KP_MULTIPLY }, + { (unsigned int)VirtualKey::Add, RETROK_KP_PLUS }, + { (unsigned int)VirtualKey::Subtract, RETROK_KP_MINUS }, + { (unsigned int)VirtualKey::Decimal, RETROK_KP_PERIOD }, + { (unsigned int)VirtualKey::Divide, RETROK_KP_DIVIDE }, + { (unsigned int)VirtualKey::F1, RETROK_F1 }, + { (unsigned int)VirtualKey::F2, RETROK_F2 }, + { (unsigned int)VirtualKey::F3, RETROK_F3 }, + { (unsigned int)VirtualKey::F4, RETROK_F4 }, + { (unsigned int)VirtualKey::F5, RETROK_F5 }, + { (unsigned int)VirtualKey::F6, RETROK_F6 }, + { (unsigned int)VirtualKey::F7, RETROK_F7 }, + { (unsigned int)VirtualKey::F8, RETROK_F8 }, + { (unsigned int)VirtualKey::F9, RETROK_F9 }, + { (unsigned int)VirtualKey::F10, RETROK_F10 }, + { (unsigned int)VirtualKey::F11, RETROK_F11 }, + { (unsigned int)VirtualKey::F12, RETROK_F12 }, + { (unsigned int)VirtualKey::F13, RETROK_F13 }, + { (unsigned int)VirtualKey::F14, RETROK_F14 }, + { (unsigned int)VirtualKey::F15, RETROK_F15 }, + { (unsigned int)VirtualKey::NumberKeyLock, RETROK_NUMLOCK }, + { (unsigned int)VirtualKey::Scroll, RETROK_SCROLLOCK }, + { (unsigned int)VirtualKey::LeftShift, RETROK_LSHIFT }, + { (unsigned int)VirtualKey::RightShift, RETROK_RSHIFT }, + { (unsigned int)VirtualKey::LeftControl, RETROK_LCTRL }, + { (unsigned int)VirtualKey::RightControl, RETROK_RCTRL }, + { (unsigned int)VirtualKey::LeftMenu, RETROK_LALT }, + { (unsigned int)VirtualKey::RightMenu, RETROK_RALT }, + { VK_RETURN, RETROK_KP_ENTER }, + { (unsigned int)VirtualKey::CapitalLock, RETROK_CAPSLOCK }, + { VK_OEM_1, RETROK_SEMICOLON }, + { VK_OEM_PLUS, RETROK_EQUALS }, + { VK_OEM_COMMA, RETROK_COMMA }, + { VK_OEM_MINUS, RETROK_MINUS }, + { VK_OEM_PERIOD, RETROK_PERIOD }, + { VK_OEM_2, RETROK_SLASH }, + { VK_OEM_3, RETROK_BACKQUOTE }, + { VK_OEM_4, RETROK_LEFTBRACKET }, + { VK_OEM_5, RETROK_BACKSLASH }, + { VK_OEM_6, RETROK_RIGHTBRACKET }, + { VK_OEM_7, RETROK_QUOTE }, + { 0, RETROK_UNKNOWN } +}; + +struct uwp_input_state_t { + short mouse_screen_x; + short mouse_screen_y; + short mouse_rel_x; + short mouse_rel_y; + bool mouse_left; + bool mouse_right; + bool mouse_middle; + bool mouse_button4; + bool mouse_button5; + short mouse_wheel_left; + short mouse_wheel_up; + short touch_screen_x; + short touch_screen_y; + short touch_rel_x; + short touch_rel_y; + bool touch_touched; +}; + +struct uwp_input_state_t uwp_current_input, uwp_next_input; + +// The main function is only used to initialize our IFrameworkView class. +[Platform::MTAThread] +int main(Platform::Array^) +{ + Platform::String^ install_dir = Windows::ApplicationModel::Package::Current->InstalledLocation->Path + L"\\"; + wcstombs(uwp_dir_install, install_dir->Data(), PATH_MAX_LENGTH); + Platform::String^ data_dir = Windows::Storage::ApplicationData::Current->LocalFolder->Path + L"\\"; + wcstombs(uwp_dir_data, data_dir->Data(), PATH_MAX_LENGTH); + + wcstombs(uwp_device_family, AnalyticsInfo::VersionInfo->DeviceFamily->Data(), 128); + + RARCH_LOG("Data dir: %ls\n", data_dir->Data()); + RARCH_LOG("Install dir: %ls\n", install_dir->Data()); + + auto direct3DApplicationSource = ref new Direct3DApplicationSource(); + CoreApplication::Run(direct3DApplicationSource); + return 0; +} + +IFrameworkView^ Direct3DApplicationSource::CreateView() +{ + return ref new App(); +} + +App^ App::m_instance; + +App::App() : + m_initialized(false), + m_windowClosed(false), + m_windowVisible(true), + m_windowFocused(true), + m_windowResized(false) +{ + m_instance = this; +} + +// The first method called when the IFrameworkView is being created. +void App::Initialize(CoreApplicationView^ applicationView) +{ + // Register event handlers for app lifecycle. This example includes Activated, so that we + // can make the CoreWindow active and start rendering on the window. + applicationView->Activated += + ref new TypedEventHandler(this, &App::OnActivated); + + CoreApplication::Suspending += + ref new EventHandler(this, &App::OnSuspending); + + CoreApplication::Resuming += + ref new EventHandler(this, &App::OnResuming); +} + +// Called when the CoreWindow object is created (or re-created). +void App::SetWindow(CoreWindow^ window) +{ + window->SizeChanged += + ref new TypedEventHandler(this, &App::OnWindowSizeChanged); + + window->VisibilityChanged += + ref new TypedEventHandler(this, &App::OnVisibilityChanged); + + window->Activated += + ref new TypedEventHandler(this, &App::OnWindowActivated); + + window->Closed += + ref new TypedEventHandler(this, &App::OnWindowClosed); + + window->KeyDown += + ref new TypedEventHandler(this, &App::OnKey); + + window->KeyUp += + ref new TypedEventHandler(this, &App::OnKey); + + window->PointerPressed += + ref new TypedEventHandler(this, &App::OnPointer); + + window->PointerReleased += + ref new TypedEventHandler(this, &App::OnPointer); + + window->PointerMoved += + ref new TypedEventHandler(this, &App::OnPointer); + + window->PointerWheelChanged += + ref new TypedEventHandler(this, &App::OnPointer); + + DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView(); + + currentDisplayInformation->DpiChanged += + ref new TypedEventHandler(this, &App::OnDpiChanged); + + DisplayInformation::DisplayContentsInvalidated += + ref new TypedEventHandler(this, &App::OnDisplayContentsInvalidated); + + currentDisplayInformation->OrientationChanged += + ref new TypedEventHandler(this, &App::OnOrientationChanged); + + Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->BackRequested += + ref new EventHandler(this, &App::OnBackRequested); +} + +// Initializes scene resources, or loads a previously saved app state. +void App::Load(Platform::String^ entryPoint) +{ + int ret = rarch_main(NULL, NULL, NULL); + if (ret != 0) + { + RARCH_ERR("Init failed\n"); + CoreApplication::Exit(); + return; + } + m_initialized = true; + + auto catalog = Windows::ApplicationModel::PackageCatalog::OpenForCurrentPackage(); + + catalog->PackageInstalling += + ref new TypedEventHandler(this, &App::OnPackageInstalling); +} + +// This method is called after the window becomes active. +void App::Run() +{ + if (!m_initialized) + { + RARCH_WARN("Initialization failed, so not running\n"); + return; + } + + bool x = false; + while (true) + { + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); + + unsigned sleep_ms = 0; + int ret = runloop_iterate(&sleep_ms); + + if (ret == 1 && sleep_ms > 0) + retro_sleep(sleep_ms); + + task_queue_check(); + + if (!x) + { + /* HACK: I have no idea why is this necessary but it is required to get proper scaling on Xbox * + * Perhaps PreferredLaunchViewSize is broken and we need to wait until the app starts to call TryResizeView */ + m_windowResized = true; + x = true; + } + + if (ret == -1) + break; + } +} + +// Required for IFrameworkView. +// Terminate events do not cause Uninitialize to be called. It will be called if your IFrameworkView +// class is torn down while the app is in the foreground. +void App::Uninitialize() +{ + main_exit(NULL); +} + +// Application lifecycle event handlers. + +void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) +{ + // Run() won't start until the CoreWindow is activated. + CoreWindow::GetForCurrentThread()->Activate(); +} + +void App::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) +{ + // Save app state asynchronously after requesting a deferral. Holding a deferral + // indicates that the application is busy performing suspending operations. Be + // aware that a deferral may not be held indefinitely. After about five seconds, + // the app will be forced to exit. + SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral(); + + create_task([this, deferral]() + { + // TODO: Maybe creating a save state here would be a good idea? + + deferral->Complete(); + }); +} + +void App::OnResuming(Platform::Object^ sender, Platform::Object^ args) +{ + // Restore any data or state that was unloaded on suspend. By default, data + // and state are persisted when resuming from suspend. Note that this event + // does not occur if the app was previously terminated. +} + +void App::OnBackRequested(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ args) +{ + /* Prevent the B controller button on Xbox One from quitting the app */ + args->Handled = true; +} + +// Window event handlers. + +void App::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) +{ + m_windowResized = true; +} + +void App::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) +{ + m_windowVisible = args->Visible; +} + +void App::OnWindowActivated(CoreWindow^ sender, WindowActivatedEventArgs^ args) +{ + m_windowFocused = args->WindowActivationState != CoreWindowActivationState::Deactivated; +} + +void App::OnKey(CoreWindow^ sender, KeyEventArgs^ args) +{ + uint16_t mod = 0; + if ((sender->GetKeyState(VirtualKey::Shift) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked) + mod |= RETROKMOD_SHIFT; + if ((sender->GetKeyState(VirtualKey::Control) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked) + mod |= RETROKMOD_CTRL; + if ((sender->GetKeyState(VirtualKey::Menu) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked) + mod |= RETROKMOD_ALT; + if ((sender->GetKeyState(VirtualKey::CapitalLock) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked) + mod |= RETROKMOD_CAPSLOCK; + if ((sender->GetKeyState(VirtualKey::Scroll) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked) + mod |= RETROKMOD_SCROLLOCK; + if ((sender->GetKeyState(VirtualKey::LeftWindows) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked || + (sender->GetKeyState(VirtualKey::RightWindows) & CoreVirtualKeyStates::Locked) == CoreVirtualKeyStates::Locked) + mod |= RETROKMOD_META; + + unsigned keycode = input_keymaps_translate_keysym_to_rk((unsigned)args->VirtualKey); + + input_keyboard_event(!args->KeyStatus.IsKeyReleased, keycode, 0, mod, RETRO_DEVICE_KEYBOARD); +} + +void App::OnPointer(CoreWindow^ sender, PointerEventArgs^ args) +{ + if (args->CurrentPoint->PointerDevice->PointerDeviceType == PointerDeviceType::Mouse) + { + uwp_next_input.mouse_left = args->CurrentPoint->Properties->IsLeftButtonPressed; + uwp_next_input.mouse_middle = args->CurrentPoint->Properties->IsMiddleButtonPressed; + uwp_next_input.mouse_right = args->CurrentPoint->Properties->IsRightButtonPressed; + uwp_next_input.mouse_button4 = args->CurrentPoint->Properties->IsXButton1Pressed; + uwp_next_input.mouse_button5 = args->CurrentPoint->Properties->IsXButton2Pressed; + uwp_next_input.mouse_screen_x = args->CurrentPoint->Position.X; + uwp_next_input.mouse_screen_y = args->CurrentPoint->Position.Y; + uwp_next_input.mouse_rel_x = uwp_next_input.mouse_screen_x - uwp_current_input.mouse_screen_x; + uwp_next_input.mouse_rel_y = uwp_next_input.mouse_screen_y - uwp_current_input.mouse_screen_y; + if (args->CurrentPoint->Properties->IsHorizontalMouseWheel) + uwp_next_input.mouse_wheel_left += args->CurrentPoint->Properties->MouseWheelDelta; + else + uwp_next_input.mouse_wheel_up += args->CurrentPoint->Properties->MouseWheelDelta; + } + else + { + uwp_next_input.touch_touched = args->CurrentPoint->IsInContact; + uwp_next_input.touch_screen_x = args->CurrentPoint->Position.X; + uwp_next_input.touch_screen_y = args->CurrentPoint->Position.Y; + uwp_next_input.touch_rel_x = uwp_next_input.touch_screen_x - uwp_current_input.touch_screen_x; + uwp_next_input.touch_rel_y = uwp_next_input.touch_screen_y - uwp_current_input.touch_screen_y; + } +} + +void App::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) +{ + m_windowClosed = true; +} + +// DisplayInformation event handlers. + +void App::OnDpiChanged(DisplayInformation^ sender, Object^ args) +{ + m_windowResized = true; +} + +void App::OnOrientationChanged(DisplayInformation^ sender, Object^ args) +{ + m_windowResized = true; +} + +void App::OnDisplayContentsInvalidated(DisplayInformation^ sender, Object^ args) +{ + // Probably can be ignored? +} + +void App::OnPackageInstalling(PackageCatalog^ sender, PackageInstallingEventArgs^ args) +{ + /* TODO: This doesn't seem to work even though it's exactly the same as in sample app and it works there */ + if (args->IsComplete) + { + char msg[512]; + snprintf(msg, sizeof(msg), "Package \"%ls\" installed, a restart may be necessary", args->Package->DisplayName->Data()); + runloop_msg_queue_push(msg, 1, 5 * 60, false); + } +} + +// Taken from DirectX UWP samples - on Xbox, everything is scaled 200% so getting the DPI calculation correct is crucial +static inline float ConvertDipsToPixels(float dips, float dpi) +{ + static const float dipsPerInch = 96.0f; + return floorf(dips * dpi / dipsPerInch + 0.5f); +} + +// Implement UWP equivalents of various win32_* functions +extern "C" { + + bool win32_has_focus(void) + { + return App::GetInstance()->IsWindowFocused(); + } + + bool win32_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen) + { + if (App::GetInstance()->IsInitialized()) + { + if (fullscreen != ApplicationView::GetForCurrentView()->IsFullScreenMode) + { + if (fullscreen) + ApplicationView::GetForCurrentView()->TryEnterFullScreenMode(); + else + ApplicationView::GetForCurrentView()->ExitFullScreenMode(); + } + ApplicationView::GetForCurrentView()->TryResizeView(Size(width, height)); + } + else + { + /* In case the window is not activated yet, TryResizeView will fail and we have to set the initial parameters instead */ + /* Note that these are preserved after restarting the app and used for the UWP splash screen size (!), so they should be set only during init and not changed afterwards */ + ApplicationView::PreferredLaunchViewSize = Size(width, height); + ApplicationView::PreferredLaunchWindowingMode = fullscreen ? ApplicationViewWindowingMode::FullScreen : ApplicationViewWindowingMode::PreferredLaunchViewSize; + } + + /* Setting the window size may sometimes fail "because UWP" + * (i.e. we are on device with no windows, or Windows sandbox decides the window can't be that small) + * so in case resizing fails we just send a resized event back to RetroArch with old size + * (and report success because otherwise it bails out hard about failing to set video mode) + */ + App::GetInstance()->SetWindowResized(); + return true; + } + + void win32_show_cursor(bool state) + { + CoreWindow::GetForCurrentThread()->PointerCursor = state ? ref new CoreCursor(CoreCursorType::Arrow, 0) : nullptr; + } + + void win32_check_window(bool *quit, bool *resize, unsigned *width, unsigned *height) + { + *quit = App::GetInstance()->IsWindowClosed(); + *resize = App::GetInstance()->CheckWindowResized(); + if (*resize) + { + float dpi = DisplayInformation::GetForCurrentView()->LogicalDpi; + *width = ConvertDipsToPixels(CoreWindow::GetForCurrentThread()->Bounds.Width, dpi); + *height = ConvertDipsToPixels(CoreWindow::GetForCurrentThread()->Bounds.Height, dpi); + } + } + + void* uwp_get_corewindow(void) + { + return (void*)CoreWindow::GetForCurrentThread(); + } + + void uwp_fill_installed_core_packages(struct string_list *list) + { + for (auto package : Windows::ApplicationModel::Package::Current->Dependencies) + { + if (package->IsOptional) + { + string_list_elem_attr attr{}; + string_list_append(list, utf16_to_utf8_string_alloc((package->InstalledLocation->Path + L"\\cores")->Data()), attr); + } + } + } + + void uwp_input_next_frame(void) + { + uwp_current_input = uwp_next_input; + uwp_next_input.mouse_rel_x = 0; + uwp_next_input.mouse_rel_y = 0; + uwp_next_input.mouse_wheel_up %= WHEEL_DELTA; + uwp_next_input.mouse_wheel_left %= WHEEL_DELTA; + uwp_next_input.touch_rel_x = 0; + uwp_next_input.touch_rel_y = 0; + } + + bool uwp_keyboard_pressed(unsigned key) + { + unsigned sym = rarch_keysym_lut[(enum retro_key)key]; + return (CoreWindow::GetForCurrentThread()->GetKeyState((VirtualKey)sym) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down; + } + + int16_t uwp_mouse_state(unsigned port, unsigned id, bool screen) + { + int16_t state = 0; + + switch (id) + { + case RETRO_DEVICE_ID_MOUSE_X: + return screen ? uwp_current_input.mouse_screen_x : uwp_current_input.mouse_rel_x; + case RETRO_DEVICE_ID_MOUSE_Y: + return screen ? uwp_current_input.mouse_screen_y : uwp_current_input.mouse_rel_y; + case RETRO_DEVICE_ID_MOUSE_LEFT: + return uwp_current_input.mouse_left; + case RETRO_DEVICE_ID_MOUSE_RIGHT: + return uwp_current_input.mouse_right; + case RETRO_DEVICE_ID_MOUSE_WHEELUP: + return uwp_current_input.mouse_wheel_up > WHEEL_DELTA; + case RETRO_DEVICE_ID_MOUSE_WHEELDOWN: + return uwp_current_input.mouse_wheel_up < -WHEEL_DELTA; + case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP: + return uwp_current_input.mouse_wheel_left > WHEEL_DELTA; + case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN: + return uwp_current_input.mouse_wheel_left < -WHEEL_DELTA; + case RETRO_DEVICE_ID_MOUSE_MIDDLE: + return uwp_current_input.mouse_middle; + case RETRO_DEVICE_ID_MOUSE_BUTTON_4: + return uwp_current_input.mouse_button4; + case RETRO_DEVICE_ID_MOUSE_BUTTON_5: + return uwp_current_input.mouse_button5; + } + + return 0; + } + + // TODO: I don't have any touch-enabled Windows devices to test if this actually works + int16_t uwp_pointer_state(unsigned idx, unsigned id, bool screen) + { + switch (id) + { + case RETRO_DEVICE_ID_POINTER_X: + return screen ? uwp_current_input.touch_screen_x : uwp_current_input.touch_rel_x; + case RETRO_DEVICE_ID_POINTER_Y: + return screen ? uwp_current_input.touch_screen_y : uwp_current_input.touch_rel_y; + case RETRO_DEVICE_ID_POINTER_PRESSED: + return uwp_current_input.touch_touched; + default: + break; + } + + return 0; + } +} diff --git a/uwp/uwp_main.h b/uwp/uwp_main.h new file mode 100644 index 0000000000..a2f2595d45 --- /dev/null +++ b/uwp/uwp_main.h @@ -0,0 +1,81 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2018 - Krzysztof Haładyn + * + * RetroArch is free software: 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 . + */ + +#pragma once + +#include "uwp_main.h" + +namespace RetroArchUWP +{ + // Main entry point for our app. Connects the app with the Windows shell and handles application lifecycle events. + ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView + { + public: + App(); + + // IFrameworkView methods. + virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView); + virtual void SetWindow(Windows::UI::Core::CoreWindow^ window); + virtual void Load(Platform::String^ entryPoint); + virtual void Run(); + virtual void Uninitialize(); + + protected: + // Application lifecycle event handlers. + void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args); + void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args); + void OnResuming(Platform::Object^ sender, Platform::Object^ args); + + void OnBackRequested(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ args); + + // Window event handlers. + void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args); + void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); + void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args); + void OnWindowActivated(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowActivatedEventArgs^ args); + void OnKey(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); + void OnPointer(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); + + // DisplayInformation event handlers. + void OnDpiChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); + void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); + void OnDisplayContentsInvalidated(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); + + void OnPackageInstalling(Windows::ApplicationModel::PackageCatalog^ sender, Windows::ApplicationModel::PackageInstallingEventArgs^ args); + + public: + bool IsInitialized() { return m_initialized; } + bool IsWindowClosed() { return m_windowClosed; } + bool IsWindowVisible() { return m_windowVisible; } + bool IsWindowFocused() { return m_windowFocused; } + bool CheckWindowResized() { bool resized = m_windowResized; m_windowResized = false; return resized; } + void SetWindowResized() { m_windowResized = true; } + static App^ GetInstance() { return m_instance; } + + private: + bool m_initialized; + bool m_windowClosed; + bool m_windowVisible; + bool m_windowFocused; + bool m_windowResized; + static App^ m_instance; + }; +} + +ref class Direct3DApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource +{ +public: + virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView(); +}; diff --git a/verbosity.c b/verbosity.c index 42a79f4977..7489d2202e 100644 --- a/verbosity.c +++ b/verbosity.c @@ -37,6 +37,11 @@ #include #endif +#if _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#endif + #include #include #include @@ -118,9 +123,11 @@ void retro_main_log_file_init(const char *path) log_file_fp = (FILE*)fopen_utf8(path, "wb"); log_file_initialized = true; +#if !defined(PS2) /* TODO: PS2 IMPROVEMENT */ /* TODO: this is only useful for a few platforms, find which and add ifdef */ log_file_buf = calloc(1, 0x4000); setvbuf(log_file_fp, (char*)log_file_buf, _IOFBF, 0x4000); +#endif } void retro_main_log_file_deinit(void) @@ -191,7 +198,7 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap) #else { -#ifdef HAVE_QT +#if defined(HAVE_QT) || defined(__WINRT__) char buffer[1024]; #endif #ifdef HAVE_FILE_LOGGER @@ -200,7 +207,7 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap) FILE *fp = stderr; #endif -#ifdef HAVE_QT +#if defined(HAVE_QT) || defined(__WINRT__) buffer[0] = '\0'; vsnprintf(buffer, sizeof(buffer), fmt, ap); @@ -210,7 +217,13 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap) fflush(fp); } +#if defined(HAVE_QT) ui_companion_driver_log_msg(buffer); +#endif + +#if defined(__WINRT__) + OutputDebugStringA(buffer); +#endif #else #if defined(NXLINK) && !defined(HAVE_FILE_LOGGER) if (nxlink_connected)