Merge branch 'master' into orbis2

This commit is contained in:
Twinaphex 2019-01-08 20:18:08 +01:00 committed by GitHub
commit 40997473ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
810 changed files with 9989 additions and 8758 deletions

View File

@ -95,6 +95,7 @@ FIX94
Flame Sage (chris062689)
flyinghead
Francisco José García García (frangarcj)
Francisco Javier Trujillo Mata (fjtrujy)
GameDragon2k
Garrett Brown (garbear)
gblues
@ -142,6 +143,7 @@ JuanVCS
Justin Jacobs (dorkster)
Justin Weiss (justinweiss)
Ken Rossato (rossato)
Krzysztof Haładyn (krzys_h)
kurumushi
kwyxz
l3iggs

View File

@ -1,23 +1,45 @@
# 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: Add new menu toggle (hold start button for 2 seconds)
- 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.
- LOCALIZATION: Update Spanish 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.
- XMB/OZONE: Add more icons
# 1.7.5
- CAMERA: Fix Video4Linux2 driver that broke years ago.

View File

@ -16,26 +16,35 @@ include config.mk
TARGET = retroarch
OBJ :=
LIBS :=
DEF_FLAGS :=
DEFINES := -DHAVE_CONFIG_H -DRARCH_INTERNAL -D_FILE_OFFSET_BITS=64
DEFINES += -DGLOBAL_CONFIG_DIR='"$(GLOBAL_CONFIG_DIR)"'
OBJDIR_BASE := obj-unix
ifeq ($(DEBUG), 1)
OBJDIR := $(OBJDIR_BASE)/debug
CFLAGS ?= -O0 -g
CXXFLAGS ?= -O0 -g
DEFINES += -DDEBUG -D_DEBUG
else
OBJDIR := $(OBJDIR_BASE)/release
CFLAGS ?= -O3
CXXFLAGS ?= -O3
DEF_FLAGS += -ffast-math
endif
OBJ :=
LIBS :=
DEFINES := -DHAVE_CONFIG_H -DRARCH_INTERNAL -D_FILE_OFFSET_BITS=64
DEFINES += -DGLOBAL_CONFIG_DIR='"$(GLOBAL_CONFIG_DIR)"'
ifneq ($(findstring BSD,$(OS)),)
CFLAGS += -DBSD
DEF_FLAGS += -DBSD
LDFLAGS += -L/usr/local/lib
UDEV_CFLAGS += -I/usr/local/include/libepoll-shim
UDEV_LIBS += -lepoll-shim
endif
ifneq ($(findstring DOS,$(OS)),)
CFLAGS += -march=i386
DEF_FLAGS += -march=i386
LDFLAGS += -lemu
endif
@ -75,21 +84,19 @@ ifneq ($(V),1)
Q := @
endif
ifeq ($(DEBUG), 1)
OPTIMIZE_FLAG = -O0 -g
DEFINES += -DDEBUG -D_DEBUG
else
OPTIMIZE_FLAG = -O3 -ffast-math
ifeq ($(HAVE_DRMINGW), 1)
DEF_FLAGS += -DHAVE_DRMINGW
LDFLAGS += $(DRMINGW_LIBS)
endif
ifneq ($(findstring Win32,$(OS)),)
LDFLAGS += -mwindows
endif
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) -I. -Ideps -Ideps/stb
DEF_FLAGS += -Wall $(INCLUDE_DIRS) -I. -Ideps -Ideps/stb
APPEND_CFLAGS := $(CFLAGS)
CXXFLAGS += $(APPEND_CFLAGS) -std=c++11 -D__STDC_CONSTANT_MACROS
CFLAGS += $(DEF_FLAGS)
CXXFLAGS += $(DEF_FLAGS) -std=c++11 -D__STDC_CONSTANT_MACROS
OBJCFLAGS := $(CFLAGS) -D__STDC_CONSTANT_MACROS
ifeq ($(HAVE_CXX), 1)

View File

@ -4,7 +4,7 @@ LIBRETRO_COMM_DIR := $(ROOT_DIR)/libretro-common
WANT_WGL = 0
ifeq ($(HAVE_STACK_USAGE), 1)
CFLAGS += -fstack-usage
DEF_FLAGS += -fstack-usage
endif
ifeq ($(HAVE_GL_CONTEXT),)
@ -31,11 +31,6 @@ ifeq ($(HAVE_VIDEO_PROCESSOR), 1)
DEFINES += -DHAVE_VIDEO_PROCESSOR
endif
ifeq ($(HAVE_MENU), 1)
DEFINES += -DHAVE_MENU
HAVE_MENU_COMMON = 1
endif
ifeq ($(HAVE_SOCKET_LEGACY), 1)
DEFINES += -DHAVE_SOCKET_LEGACY
endif
@ -65,13 +60,11 @@ ifeq ($(HAVE_PRESERVE_DYLIB),1)
endif
ifeq ($(GL_DEBUG), 1)
CFLAGS += -DGL_DEBUG
CXXFLAGS += -DGL_DEBUG
DEF_FLAGS += -DGL_DEBUG
endif
ifeq ($(VULKAN_DEBUG), 1)
CFLAGS += -DVULKAN_DEBUG
CXXFLAGS += -DVULKAN_DEBUG
DEF_FLAGS += -DVULKAN_DEBUG
endif
ifeq ($(HAVE_HARD_FLOAT), 1)
@ -83,23 +76,23 @@ ifeq ($(TDM_GCC),)
endif
ifeq ($(HAVE_FILE_LOGGER), 1)
CFLAGS += -DHAVE_FILE_LOGGER
DEF_FLAGS += -DHAVE_FILE_LOGGER
endif
ifeq ($(HAVE_SHADERPIPELINE), 1)
CFLAGS += -DHAVE_SHADERPIPELINE
DEF_FLAGS += -DHAVE_SHADERPIPELINE
endif
CFLAGS += -I$(LIBRETRO_COMM_DIR)/include -I$(DEPS_DIR)
DEF_FLAGS += -I$(LIBRETRO_COMM_DIR)/include -I$(DEPS_DIR)
# Switches
#
ifeq ($(HAVE_NETPLAYDISCOVERY), 1)
CFLAGS += -DHAVE_NETPLAYDISCOVERY
DEF_FLAGS += -DHAVE_NETPLAYDISCOVERY
endif
ifeq ($(HAVE_NETLOGGER), 1)
CFLAGS += -DHAVE_LOGGER
DEF_FLAGS += -DHAVE_LOGGER
DEFINES += -DHAVE_LOGGER
OBJ += network/net_logger.o
endif
@ -151,7 +144,7 @@ endif
# General object files
DEFINES += -DHAVE_DR_MP3
CFLAGS += -DHAVE_DR_MP3
DEF_FLAGS += -DHAVE_DR_MP3
OBJ += frontend/frontend.o \
frontend/frontend_driver.o \
@ -343,7 +336,7 @@ ifeq ($(HAVE_QT), 1)
ui/drivers/qt/ui_qt_browser_window.o \
ui/drivers/qt/ui_qt_load_core_window.o \
ui/drivers/qt/ui_qt_msg_window.o \
ui/drivers/qt/flowlayout.o \
ui/drivers/qt/gridview.o \
ui/drivers/qt/shaderparamsdialog.o \
ui/drivers/qt/coreoptionsdialog.o \
ui/drivers/qt/filedropwidget.o \
@ -358,7 +351,7 @@ ifeq ($(HAVE_QT), 1)
MOC_HEADERS += ui/drivers/ui_qt.h \
ui/drivers/qt/ui_qt_load_core_window.h \
ui/drivers/qt/flowlayout.h \
ui/drivers/qt/gridview.h \
ui/drivers/qt/shaderparamsdialog.h \
ui/drivers/qt/coreoptionsdialog.h \
ui/drivers/qt/filedropwidget.h \
@ -645,7 +638,7 @@ ifeq ($(HAVE_NEON),1)
$(LIBRETRO_COMM_DIR)/audio/conversion/float_to_s16_neon.o
endif
HW_CONTEXT_MENU_DRIVERS=$(HAVE_RGUI)
HW_CONTEXT_MENU_DRIVERS=$(HAVE_MENU)
ifeq ($(HW_CONTEXT_MENU_DRIVERS),0)
ifeq ($(HAVE_GL_CONTEXT),1)
@ -662,6 +655,10 @@ ifeq ($(HW_CONTEXT_MENU_DRIVERS), 1)
HAVE_ZARCH = 0
endif
ifeq ($(HAVE_RGUI),)
HAVE_RGUI = 1
endif
ifeq ($(HAVE_MATERIALUI),)
HAVE_MATERIALUI = 1
endif
@ -683,6 +680,7 @@ ifeq ($(HW_CONTEXT_MENU_DRIVERS), 1)
endif
else
HAVE_ZARCH ?= 0
HAVE_RGUI ?= 0
HAVE_MATERIALUI ?= 0
HAVE_NUKLEAR ?= 0
HAVE_XMB ?= 0
@ -690,53 +688,57 @@ else
HAVE_OZONE ?= 0
endif
ifeq ($(HAVE_RGUI), 1)
OBJ += menu/drivers/rgui.o
DEFINES += -DHAVE_MENU -DHAVE_RGUI
ifeq ($(HAVE_MENU), 1)
DEFINES += -DHAVE_MENU
HAVE_MENU_COMMON = 1
ifeq ($(HAVE_RGUI), 1)
OBJ += menu/drivers/rgui.o
DEFINES += -DHAVE_RGUI
endif
ifeq ($(HAVE_MATERIALUI), 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
OBJ += menu/drivers/nuklear/nk_menu.o
OBJ += menu/drivers/nuklear/nk_wnd_debug.o
OBJ += menu/drivers/nuklear.o
OBJ += menu/drivers/nuklear/nk_common.o \
menu/drivers/nuklear/nk_menu.o \
menu/drivers/nuklear/nk_wnd_debug.o \
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
ifeq ($(HAVE_XMB), 1)
OBJ += menu/drivers/xmb.o
DEFINES += -DHAVE_XMB
HAVE_MENU_COMMON = 1
HAVE_ASSETS = 1
endif
ifeq ($(HAVE_XMB), 1)
OBJ += menu/drivers/xmb.o
DEFINES += -DHAVE_XMB
HAVE_ASSETS = 1
endif
ifeq ($(HAVE_OZONE), 1)
OBJ += menu/drivers/ozone/ozone.o
OBJ += menu/drivers/ozone/ozone_entries.o
OBJ += menu/drivers/ozone/ozone_display.o
OBJ += menu/drivers/ozone/ozone_texture.o
OBJ += menu/drivers/ozone/ozone_theme.o
OBJ += menu/drivers/ozone/ozone_sidebar.o
DEFINES += -DHAVE_OZONE
HAVE_MENU_COMMON = 1
HAVE_ASSETS = 1
endif
ifeq ($(HAVE_OZONE), 1)
OBJ += menu/drivers/ozone/ozone.o \
menu/drivers/ozone/ozone_entries.o \
menu/drivers/ozone/ozone_display.o \
menu/drivers/ozone/ozone_texture.o \
menu/drivers/ozone/ozone_theme.o \
menu/drivers/ozone/ozone_sidebar.o
DEFINES += -DHAVE_OZONE
HAVE_ASSETS = 1
endif
ifeq ($(HAVE_STRIPES), 1)
OBJ += menu/drivers/stripes.o
DEFINES += -DHAVE_STRIPES
ifeq ($(HAVE_STRIPES), 1)
OBJ += menu/drivers/stripes.o
DEFINES += -DHAVE_STRIPES
endif
endif
ifeq ($(HAVE_LAKKA), 1)
@ -747,6 +749,8 @@ ifeq ($(HAVE_LAKKA_SWITCH), 1)
DEFINES += -DHAVE_LAKKA_SWITCH
endif
OBJ += menu/menu_shader.o
ifeq ($(HAVE_MENU_COMMON), 1)
OBJ += menu/menu_driver.o \
menu/menu_content.o \
@ -754,7 +758,6 @@ ifeq ($(HAVE_MENU_COMMON), 1)
menu/menu_entries.o \
menu/menu_setting.o \
menu/menu_networking.o \
menu/menu_shader.o \
menu/widgets/menu_filebrowser.o \
menu/widgets/menu_dialog.o \
menu/widgets/menu_input_dialog.o \
@ -781,9 +784,12 @@ ifeq ($(HAVE_MENU_COMMON), 1)
menu/cbs/menu_cbs_contentlist_switch.o \
menu/menu_displaylist.o \
menu/menu_animation.o \
menu/drivers_display/menu_display_null.o \
menu/drivers/menu_generic.o \
menu/drivers/null.o
ifeq ($(HAVE_MENU_COMMON),1)
OBJ += menu/drivers_display/menu_display_null.o
endif
endif
ifeq ($(HAVE_OVERLAY), 1)
@ -833,14 +839,14 @@ ifeq ($(HAVE_VITA2D), 1)
$(DEPS_DIR)/libvita2d/shader/texture_f_gxp.o \
$(DEPS_DIR)/libvita2d/shader/texture_tint_f_gxp.o
ifeq ($(HAVE_MENU),1)
ifeq ($(HAVE_MENU_COMMON),1)
OBJ += menu/drivers_display/menu_display_vita2d.o
endif
OBJ += gfx/drivers/vita2d_gfx.o \
gfx/drivers_font/vita2d_font.o
CFLAGS += -I$(DEPS_DIR)/libvita2d/include
DEF_FLAGS += -I$(DEPS_DIR)/libvita2d/include
endif
ifeq ($(TARGET), retroarch_3ds)
@ -941,7 +947,7 @@ endif
ifeq ($(HAVE_DBUS), 1)
LIBS += $(DBUS_LIBS)
CFLAGS += $(DBUS_CFLAGS)
DEF_FLAGS += $(DBUS_CFLAGS)
OBJ += gfx/common/dbus_common.o
endif
@ -1036,7 +1042,7 @@ endif
ifeq ($(HAVE_SIXEL), 1)
DEFINES += -DHAVE_SIXEL
CFLAGS += -I/usr/include/sixel
DEF_FLAGS += -I/usr/include/sixel
OBJ += gfx/drivers/sixel_gfx.o gfx/drivers_font/sixel_font.o \
gfx/drivers_context/sixel_ctx.o
LIBS += -lsixel
@ -1048,7 +1054,7 @@ endif
ifeq ($(HAVE_PLAIN_DRM), 1)
OBJ += gfx/drivers/drm_gfx.o
CFLAGS += -I/usr/include/libdrm
DEF_FLAGS += -I/usr/include/libdrm
LIBS += -ldrm
endif
@ -1117,8 +1123,11 @@ ifeq ($(HAVE_GL_CONTEXT), 1)
gfx/common/metal/MenuDisplay.o \
gfx/common/metal_common.o \
gfx/drivers/metal.o \
menu/drivers_display/menu_display_metal.o \
gfx/drivers_font/metal_raster_font.o
ifeq ($(HAVE_MENU_COMMON), 1)
OBJ += menu/drivers_display/menu_display_metal.o
endif
endif
ifeq ($(HAVE_MPV), 1)
@ -1300,16 +1309,20 @@ endif
ifeq ($(HAVE_D3D10), 1)
OBJ += gfx/drivers/d3d10.o \
gfx/common/d3d10_common.o \
gfx/drivers_font/d3d10_font.o \
menu/drivers_display/menu_display_d3d10.o
gfx/drivers_font/d3d10_font.o
ifeq ($(HAVE_MENU_COMMON), 1)
OBJ += menu/drivers_display/menu_display_d3d10.o
endif
DEFINES += -DHAVE_D3D10
endif
ifeq ($(HAVE_D3D11), 1)
OBJ += gfx/drivers/d3d11.o \
gfx/common/d3d11_common.o \
gfx/drivers_font/d3d11_font.o \
menu/drivers_display/menu_display_d3d11.o
gfx/drivers_font/d3d11_font.o
ifeq ($(HAVE_MENU_COMMON), 1)
OBJ += menu/drivers_display/menu_display_d3d11.o
endif
DEFINES += -DHAVE_D3D11
HAVE_SLANG = 1
HAVE_GLSLANG = 1
@ -1319,8 +1332,10 @@ endif
ifeq ($(HAVE_D3D12), 1)
OBJ += gfx/drivers/d3d12.o \
gfx/common/d3d12_common.o \
gfx/drivers_font/d3d12_font.o \
menu/drivers_display/menu_display_d3d12.o
gfx/drivers_font/d3d12_font.o
ifeq ($(HAVE_MENU_COMMON), 1)
OBJ += menu/drivers_display/menu_display_d3d12.o
endif
DEFINES += -DHAVE_D3D12
HAVE_SLANG = 1
HAVE_GLSLANG = 1
@ -1331,7 +1346,7 @@ ifneq ($(findstring 1, $(HAVE_D3D10) $(HAVE_D3D11) $(HAVE_D3D12)),)
INCLUDE_DIRS += -isystemgfx/include/dxsdk
OBJ += gfx/common/d3dcompiler_common.o \
gfx/common/dxgi_common.o
CFLAGS += -Wno-unknown-pragmas
DEF_FLAGS += -Wno-unknown-pragmas
endif
ifeq ($(HAVE_D3D8), 1)
@ -1447,7 +1462,7 @@ OBJ += $(LIBRETRO_COMM_DIR)/file/archive_file.o \
$(LIBRETRO_COMM_DIR)/streams/trans_stream_pipe.o
ifeq ($(HAVE_7ZIP),1)
CFLAGS += -I$(DEPS_DIR)/7zip
DEF_FLAGS += -I$(DEPS_DIR)/7zip
HAVE_COMPRESSION = 1
DEFINES += -DHAVE_7ZIP -D_7ZIP_ST
7ZOBJ = $(DEPS_DIR)/7zip/7zIn.o \
@ -1476,8 +1491,8 @@ endif
ifeq ($(HAVE_BUILTINFLAC),1)
HAVE_FLAC = 1
DEFINES += -DHAVE_DR_FLAC -I$(DEPS_DIR)
CFLAGS += -DHAVE_DR_FLAC
CFLAGS += -DHAVE_FLAC -I$(DEPS_DIR)/libFLAC/include
DEF_FLAGS += -DHAVE_DR_FLAC
DEF_FLAGS += -DHAVE_FLAC -I$(DEPS_DIR)/libFLAC/include
DEFINES += -DHAVE_STDINT_H -DHAVE_LROUND -DFLAC__HAS_OGG=0 \
-DFLAC_PACKAGE_VERSION="\"retroarch\""
FLACOBJ = $(DEPS_DIR)/libFLAC/bitmath.o \
@ -1535,7 +1550,7 @@ ifeq ($(HAVE_ZLIB), 1)
endif
ifeq ($(HAVE_CHD), 1)
CFLAGS += -I$(LIBRETRO_COMM_DIR)/formats/libchdr
DEF_FLAGS += -I$(LIBRETRO_COMM_DIR)/formats/libchdr
DEFINES += -DHAVE_CHD -DWANT_SUBCODE -DWANT_RAW_DATA_SECTOR
OBJ += $(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_bitstream.o \
$(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_cdrom.o \
@ -1587,6 +1602,12 @@ ifdef HAVE_COMPRESSION
DEFINES += -DHAVE_COMPRESSION
endif
# Easter Egg
ifeq ($(HAVE_EASTEREGG),1)
DEFINES += -DHAVE_EASTEREGG
OBJ += cores/libretro-gong/gong.o
endif
# Video4Linux 2
ifeq ($(HAVE_V4L2),1)
@ -1754,9 +1775,11 @@ ifneq ($(findstring Win32,$(OS)),)
OBJ += gfx/drivers/gdi_gfx.o \
gfx/drivers_context/gdi_ctx.o \
gfx/drivers_font/gdi_font.o \
gfx/display_servers/dispserv_win32.o \
menu/drivers_display/menu_display_gdi.o
gfx/display_servers/dispserv_win32.o
ifeq ($(HAVE_MENU_COMMON), 1)
OBJ += menu/drivers_display/menu_display_gdi.o
endif
LIBS += -lmsimg32 -lhid -lsetupapi
endif
@ -1827,7 +1850,7 @@ endif
ifeq ($(WANT_IOSUHAX), 1)
DEFINES += -I$(DEPS_DIR)/libiosuhax
CFLAGS += -I$(DEPS_DIR)/libiosuhax
DEF_FLAGS += -I$(DEPS_DIR)/libiosuhax
OBJ += $(DEPS_DIR)/libiosuhax/iosuhax.o \
$(DEPS_DIR)/libiosuhax/iosuhax_devoptab.o \
$(DEPS_DIR)/libiosuhax/iosuhax_disc_interface.o
@ -1835,7 +1858,7 @@ endif
ifeq ($(WANT_LIBFAT), 1)
DEFINES += -I$(DEPS_DIR)/libfat/include
CFLAGS += -I$(DEPS_DIR)/libfat/include
DEF_FLAGS += -I$(DEPS_DIR)/libfat/include
OBJ += $(DEPS_DIR)/libfat/cache.o \
$(DEPS_DIR)/libfat/directory.o \
$(DEPS_DIR)/libfat/disc.o \
@ -1869,7 +1892,7 @@ endif
# Help at https://modmyclassic.com/comp
ifeq ($(HAVE_CLASSIC), 1)
CFLAGS += -DHAVE_CLASSIC
DEF_FLAGS += -DHAVE_CLASSIC
endif
ifeq ($(HAVE_C_A7A7), 1)
@ -1881,12 +1904,11 @@ ifeq ($(HAVE_C_A7A7), 1)
-fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \
-fmerge-all-constants -fno-math-errno \
-marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
CFLAGS += $(C_A7A7_OPT)
CXXFLAGS += $(C_A7A7_OPT)
DEF_FLAGS += $(C_A7A7_OPT)
ifeq ($(shell echo `$(CC) -dumpversion` "< 4.9" | bc -l), 1)
CFLAGS += -march=armv7-a
DEF_FLAGS += -march=armv7-a
else
CFLAGS += -march=armv7ve
DEF_FLAGS += -march=armv7ve
# If gcc is 5.0 or later
ifeq ($(shell echo `$(CC) -dumpversion` ">= 5" | bc -l), 1)
LDFLAGS += -static-libgcc -static-libstdc++
@ -1895,6 +1917,6 @@ ifeq ($(HAVE_C_A7A7), 1)
endif
ifeq ($(HAVE_HAKCHI), 1)
CFLAGS += -DHAVE_HAKCHI
DEF_FLAGS += -DHAVE_HAKCHI
endif
##################################

View File

@ -62,6 +62,7 @@ else
HAVE_RPNG = 1
HAVE_RJPEG = 1
HAVE_RBMP = 1
HAVE_MENU = 1
HAVE_RGUI = 1
HAVE_ZLIB = 1
HAVE_7ZIP = 1
@ -80,6 +81,7 @@ else
#HAVE_BUILTINMBEDTLS = 1
include Makefile.common
CFLAGS += $(DEF_FLAGS)
BLACKLIST :=
BLACKLIST += input/input_overlay.o
BLACKLIST += tasks/task_overlay.o
@ -105,7 +107,6 @@ MAKEROM_ARGS_COMMON = -rsf $(APP_RSF) -exefslogo -elf $(TARGET).elf -icon $(TARG
INCDIRS := -I$(CTRULIB)/include
LIBDIRS := -L. -L$(CTRULIB)/lib
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft
CFLAGS += -mword-relocations \
@ -149,7 +150,6 @@ LDFLAGS += -specs=ctr/3dsx_custom.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
CFLAGS += -std=gnu99 -ffast-math
LIBS := $(WHOLE_START) -lretro_ctr $(WHOLE_END) -lm
ifeq ($(DEBUG), 1)
@ -158,7 +158,6 @@ else
LIBS += -lctru
endif
ifeq ($(BUILD_3DSX), 1)
TARGET_3DSX := $(TARGET).3dsx $(TARGET).smdh
endif
@ -268,7 +267,6 @@ $(TARGET).3ds: $(TARGET).elf $(TARGET).bnr $(TARGET).icn $(APP_RSF)
$(TARGET).cia: $(TARGET).elf $(TARGET).bnr $(TARGET).icn $(APP_RSF)
$(MAKEROM) -f cia -o $@ $(MAKEROM_ARGS_COMMON) -DAPP_ENCRYPTED=false
clean:
rm -f $(OBJ)
rm -f $(TARGET).3dsx
@ -283,4 +281,3 @@ clean:
.PHONY: clean

View File

@ -94,10 +94,8 @@ LDFLAGS += -specs=ctr/3dsx_custom.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
CFLAGS += -std=gnu99 -ffast-math
LIBS := -lctru -lm
ifeq ($(BUILD_3DSX), 1)
TARGET_3DSX := $(TARGET).3dsx $(TARGET).smdh
endif
@ -221,4 +219,3 @@ clean:
.PHONY: clean

View File

@ -16,6 +16,7 @@ HAVE_OPENGLES = 1
HAVE_RJPEG = 0
HAVE_RPNG = 1
HAVE_EMSCRIPTEN = 1
HAVE_MENU = 1
HAVE_RGUI = 1
HAVE_SDL = 0
HAVE_SDL2 = 0
@ -57,7 +58,7 @@ endif
include Makefile.common
CFLAGS += -Ideps/libz -Ideps -Ideps/stb
CFLAGS += $(DEF_FLAGS) -Ideps/libz -Ideps -Ideps/stb
libretro = libretro_emscripten.bc
ifneq ($(V), 1)

View File

@ -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
@ -430,8 +430,8 @@ else ifeq ($(platform), windows_msvc2005_x86)
CXX = cl.exe
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
PLATCFLAGS += -D_WIN32 -D_WIN32_WINNT=0x0410 -D__STDC_CONSTANT_MACROS -D_MBCS -DHAVE_EASTEREGG
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")
@ -479,7 +479,7 @@ else ifneq (,$(findstring windows_msvc2010,$(platform)))
LD = link.exe
PLATCFLAGS += -D_WIN32 -D__STDC_CONSTANT_MACROS -D_MBCS
PLATCFLAGS += -D__i686__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32
PLATCFLAGS += -D__i686__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32 -DHAVE_EASTEREGG
LDFLAGS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib iphlpapi.lib
PlatformSuffix = $(subst windows_msvc2010_,,$(platform))
@ -550,7 +550,7 @@ else ifneq (,$(findstring windows_msvc2012,$(platform)))
LD = link.exe
PLATCFLAGS += -D_WIN32 -D__STDC_CONSTANT_MACROS -D_MBCS
PLATCFLAGS += -D__i686__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32
PLATCFLAGS += -D__i686__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32 -DHAVE_EASTEREGG
LDFLAGS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib iphlpapi.lib
PlatformSuffix = $(subst windows_msvc2012_,,$(platform))
@ -625,7 +625,7 @@ else ifneq (,$(findstring windows_msvc2013,$(platform)))
LD = link.exe
PLATCFLAGS += -D_WIN32 -D__STDC_CONSTANT_MACROS -D_MBCS
PLATCFLAGS += -D__i686__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32
PLATCFLAGS += -D__i686__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32 -DHAVE_EASTEREGG
LDFLAGS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib iphlpapi.lib
PlatformSuffix = $(subst windows_msvc2013_,,$(platform))
@ -700,7 +700,7 @@ else ifneq (,$(findstring windows_msvc2015,$(platform)))
LD = link.exe
PLATCFLAGS += -D_WIN32 -D__STDC_CONSTANT_MACROS -D_MBCS
PLATCFLAGS += -D__i686__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32
PLATCFLAGS += -D__i686__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32 -DHAVE_EASTEREGG
LDFLAGS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib iphlpapi.lib
PlatformSuffix = $(subst windows_msvc2015_,,$(platform))
@ -1074,7 +1074,6 @@ overlays-checkout:
$(GIT) clone git://github.com/libretro/common-overlays.git $(OVERLAY_DIR); \
fi
clean:
rm -f $(EXT_TARGET)
rm -f $(EXT_INTER_TARGET)

View File

@ -41,6 +41,7 @@ HAVE_NETWORKING = 1
HAVE_NETPLAYDISCOVERY = 1
HAVE_STB_FONT = 1
HAVE_CHEEVOS = 1
HAVE_CHD = 1
# RetroArch libnx useful flags
HAVE_THREADS = 1

View File

@ -45,7 +45,6 @@ export CXX := $(PREFIX)g++
export AR := $(PREFIX)ar
export OBJCOPY := $(PREFIX)objcopy
ISVC=$(or $(VCBUILDHELPER_COMMAND),$(MSBUILDEXTENSIONSPATH32),$(MSBUILDEXTENSIONSPATH))
#---------------------------------------------------------------------------------
@ -131,7 +130,6 @@ INCLUDES := $(DEFINCS) \
MACHDEP := -DBIGENDIAN -DGEKKO -mcpu=750 -meabi -msdata=eabi -mhard-float -ffunction-sections -fdata-sections
ifeq ($(PLATFORM),wii)
MACHDEP += -DHW_RVL
endif
@ -159,7 +157,6 @@ VPATH := $(LWIPDIR) \
$(LIBWIIKEYB) \
$(STUBSDIR)
#---------------------------------------------------------------------------------
SOURCES_LWIP := $(LWIPDIR)/network.c \
$(LWIPDIR)/netio.c \
@ -264,7 +261,6 @@ SOURCES_OGC_ASM := $(OGCDIR)/cache_asm.S \
$(OGCDIR)/system_asm.S \
$(OGCDIR)/video_asm.S
ifneq ($(BUILD_LITE), 1)
SOURCES_OGC += $(OGCDIR)/dvd.c
endif

View File

@ -7,7 +7,6 @@ ARCH = amd64
BUILD_DIR = objs/msvc
CXX_BUILD = 0
WindowsSdkDir = C:\Program Files (x86)\Windows Kits\10\$(NOTHING)
WindowsSDKVersion := 10.0.14393.0\$(NOTHING)
VCINSTALLDIR := C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\$(NOTHING)
@ -30,6 +29,7 @@ HAVE_WINMM := 1
HAVE_RPNG := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_MENU := 1
HAVE_RGUI := 1
HAVE_XMB := 1
HAVE_MATERIALUI := 1
@ -59,7 +59,7 @@ HAVE_IMAGEVIEWER := 1
include Makefile.common
INCLUDE_DIRS := $(patsubst -isystem%,-I%,$(INCLUDE_DIRS))
CFLAGS := $(filter-out -Wno-unknown-pragmas,$(CFLAGS))
CFLAGS := $(filter-out -Wno-unknown-pragmas,$(DEF_FLAGS))
CXXFLAGS := $(filter-out -fpermissive -Wno-switch -Wno-sign-compare -fno-strict-aliasing -Wno-maybe-uninitialized -Wno-reorder -Wno-parentheses,$(CXXFLAGS))
LIBS := $(filter-out -lstdc++,$(LIBS))
@ -90,14 +90,12 @@ ifeq ($(ARCH),x86)
CROSS =
endif
INCLUDE := $(VCINSTALLDIR)include;$(VCINSTALLDIR)atlmfc\include;$(WindowsSdkDir)include\$(WindowsSDKVersion)ucrt;$(WindowsSdkDir)include\$(WindowsSDKVersion)shared;$(WindowsSdkDir)include\$(WindowsSDKVersion)um;
LIB := $(VCINSTALLDIR)LIB\$(CROSS);$(VCINSTALLDIR)atlmfc\lib\$(CROSS);$(WindowsSdkDir)lib\$(WindowsSDKVersion)ucrt\$(TARGET_ARCH2);$(WindowsSdkDir)lib\$(WindowsSDKVersion)um\$(TARGET_ARCH2);C:\Program Files (x86)\NVIDIA Corporation\Cg\lib.$(TARGET_ARCH2);C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Lib\$(TARGET_ARCH2);
LIBPATH := $(VCINSTALLDIR)LIB\$(CROSS);$(VCINSTALLDIR)atlmfc\lib\$(CROSS);
PATH := $(shell IFS=$$'\n'; cygpath "$(VCINSTALLDIR)bin\\$(CROSS)"):$(shell IFS=$$'\n'; cygpath "$(WindowsSdkDir)\bin\\$(ARCH2)"):$(PATH)
export INCLUDE := $(INCLUDE)
export LIB := $(LIB)
export LIBPATH := $(LIBPATH)
@ -144,7 +142,6 @@ RC = rc.exe
LIBS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib
LDFLAGS += -nologo -wx -nxcompat -machine:$(TARGET_ARCH2)
ifeq ($(DEBUG),1)
FLAGS += -GS -Gy -Od -RTC1 -D_SECURE_SCL=1 -Zi
FLAGS += -MDd
@ -155,7 +152,6 @@ else
FLAGS += -MD
endif
ifeq ($(DEBUG),1)
BUILD_DIR := $(BUILD_DIR)-debug
endif
@ -170,7 +166,6 @@ ifneq ($(V), 1)
Q := @
endif
ifeq ($(GRIFFIN_BUILD), 1)
OBJ := griffin/griffin.o griffin/griffin_cpp.o
DEFINES += -DHAVE_GRIFFIN -DUSE_MATH_DEFINES
@ -188,9 +183,6 @@ OBJ := $(patsubst %rarch.o,%rarch.res,$(OBJ))
OBJ := $(addprefix $(BUILD_DIR)/,$(OBJ))
OBJ := $(OBJ:.o=.obj)
LDFLAGS += -WX -SUBSYSTEM:WINDOWS -ENTRY:mainCRTStartup
DEFINES := $(patsubst -f%,,$(DEFINES))
@ -198,7 +190,6 @@ LDFLAGS := $(patsubst -l%,%.lib,$(LDFLAGS))
LIBS := $(filter-out -lm,$(LIBS))
LIBS := $(patsubst -l%,%.lib,$(LIBS))
#$(info INCLUDE_DIRS : $(INCLUDE_DIRS))
#$(info DEFINES : $(DEFINES))
#$(info CFLAGS : $(CFLAGS))

View File

@ -55,6 +55,7 @@ else
endif
include Makefile.common
CFLAGS += $(DEF_FLAGS)
BLACKLIST :=
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
@ -64,7 +65,6 @@ else
#OBJ += frontend/drivers/platform_orbis.o
endif
ifeq ($(strip $(PS4SDK)),)
$(error "Please set PS4SDK in your environment. export PS4SDK=<path to>ps4sdk")
endif
@ -123,7 +123,6 @@ CXXFLAGS := $(CFLAGS)
PS4_LIBS := -lps4link -ldebugnet -lorbisFile -lelfloader -lorbisKeyboard -lorbis2d -lpng -lz -lorbisGl -lorbisPad -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
@ -131,7 +130,6 @@ TARGETS := $(TARGET).elf
DEPFLAGS = -MT $@ -MMD -MP -MF $*.Tdepend
POSTCOMPILE = mv -f $*.Tdepend $*.depend
all: $(TARGETS)
%.o: %.cpp
@ -144,7 +142,6 @@ all: $(TARGETS)
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) $(DEPFLAGS)
$(POSTCOMPILE)
%.o: %.S
%.o: %.S %.depend
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
@ -167,4 +164,4 @@ clean:
.PHONY: clean all
.PRECIOUS: %.depend
-include $(OBJ:.o=.depend)
-include $(OBJ:.o=.depend)

View File

@ -1,11 +1,11 @@
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
MUTE_WARNINGS = 0
PS2_IP = 192.168.1.150
#Configuration for IRX
@ -13,38 +13,37 @@ EE_BIN2O = bin2o
IRX_DIR = $(PS2SDK)/iop/irx
TARGET = retroarchps2.elf
TARGET_RELEASE = retroarchps2-release.elf
ifeq ($(DEBUG), 1)
OPTIMIZE_LV := -O0 -g
RARCH_DEFINES += -DDEBUG
else
OPTIMIZE_LV := -O2
LDFLAGS := -s
endif
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_START := -Wl,--whole-archive
WHOLE_END := -Wl,--no-whole-archive
ifeq ($(MUTE_WARNINGS), 1)
DISABLE_WARNINGS := -Wno-sign-compare -Wno-unused -Wno-parentheses
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) $(DISABLE_WARNINGS) -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.
LIBS += -lretro_ps2 -lgskit -ldmakit -lgskit_toolkit -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)
@ -67,12 +66,13 @@ endif
CFLAGS += $(RARCH_DEFINES)
# Missing objecst on the PS2SDK
EE_OBJS += ps2/compat_ctype.o
EE_OBJS += ps2/compat_files/compat_ctype.o ps2/compat_files/time.o
#EE_OBJS = griffin/griffin.o bootstrap/ps2/kernel_functions.o
EE_OBJS += griffin/griffin.o
EE_CFLAGS = $(CFLAGS)
EE_CXXFLAGS = $(CFLAGS)
EE_LDFLAGS = $(LDFLAGS)
EE_LIBS = $(LIBS)
EE_ASFLAGS = $(ASFLAGS)
@ -95,6 +95,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 +107,8 @@ $(EE_IRX_OBJ):
#Include preferences
include $(PS2SDK)/samples/Makefile.pref
include $(PS2SDK)/samples/Makefile.eeglobal
#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)

View File

@ -49,7 +49,6 @@ endif
CFLAGS += $(RARCH_DEFINES)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = RetroArch PSP1

View File

@ -34,13 +34,13 @@ else
HAVE_DYNAMIC = 1
include Makefile.common
BLACKLIST :=
CFLAGS += $(DEF_FLAGS)
BLACKLIST :=
BLACKLIST += input/input_overlay.o
BLACKLIST += tasks/task_overlay.o
BLACKLIST += tasks/task_overlay.o
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
endif
ifeq ($(strip $(LIBTRANSISTOR_HOME)),)
$(error "Please set LIBTRANSISTOR_HOME in your environment. export LIBTRANSISTOR_HOME=<path/to/libtransistor/dist/>")
endif

View File

@ -55,6 +55,7 @@ else
endif
include Makefile.common
CFLAGS += $(DEF_FLAGS)
BLACKLIST :=
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
@ -64,7 +65,6 @@ else
OBJ += frontend/drivers/platform_psp.o
endif
ifeq ($(strip $(VITASDK)),)
$(error "Please set VITASDK in your environment. export VITASDK=<path to>vitasdk")
endif
@ -127,7 +127,6 @@ TARGETS := $(TARGET).vpk
DEPFLAGS = -MT $@ -MMD -MP -MF $*.Tdepend
POSTCOMPILE = mv -f $*.Tdepend $*.depend
all: $(TARGETS)
%.o: %.cpp
@ -140,7 +139,6 @@ all: $(TARGETS)
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) $(DEPFLAGS)
$(POSTCOMPILE)
%.o: %.S
%.o: %.S %.depend
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)

View File

@ -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 \

View File

@ -115,6 +115,7 @@ endif
HAVE_RPNG = 1
HAVE_RJPEG = 1
HAVE_RBMP = 1
HAVE_MENU = 1
HAVE_RGUI = 1
HAVE_ZLIB = 1
HAVE_7ZIP = 1
@ -241,7 +242,6 @@ ifneq ($(WANT_IOSUHAX), 1)
LIBS += -liosuhax
endif
RPX_OBJ = $(BUILD_DIR)/wiiu/system/stubs_rpl.o
HBL_ELF_OBJ = $(BUILD_DIR)/wiiu/system/dynamic.o $(BUILD_DIR)/wiiu/system/stubs_elf.o
@ -263,13 +263,11 @@ endif
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.depend
all: $(TARGETS)
%: $(BUILD_DIR)/%
cp $< $@
$(BUILD_DIR)/%.o: %.cpp %.depend
@$(if $(Q), echo CXX $<,)
@mkdir -p $(dir $@)

View File

@ -12,6 +12,7 @@ HAVE_NETPLAYDISCOVERY = 1
HAVE_STDIN_CMD = 1
HAVE_COMMAND = 1
HAVE_THREADS = 1
HAVE_MENU = 1
HAVE_RGUI = 1
HAVE_MATERIALUI = 1
HAVE_7ZIP = 1
@ -102,7 +103,6 @@ else
WINDRES = windres
endif
libretro ?= -lretro
ifeq ($(DYNAMIC), 1)
@ -123,7 +123,7 @@ else
CXXFLAGS += -O3 -ffast-math
endif
CFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I. -Ideps
CFLAGS += $(DEF_FLAGS) -Wall -Wno-unused-result -Wno-unused-variable -I. -Ideps
CXXFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I. -Ideps -std=c++98 -D__STDC_CONSTANT_MACROS
ifeq ($(CXX_BUILD), 1)
CFLAGS += -std=c++98 -xc++ -D__STDC_CONSTANT_MACROS

View File

@ -122,6 +122,9 @@ static const audio_driver_t *audio_drivers[] = {
#if defined(PSP) || defined(VITA) || defined(ORBIS)
&audio_psp,
#endif
#if defined(PS2)
&audio_ps2,
#endif
#ifdef _3DS
&audio_ctr_csnd,
&audio_ctr_dsp,
@ -394,7 +397,6 @@ static void audio_driver_mixer_init(unsigned out_rate)
audio_mixer_init(out_rate);
}
static bool audio_driver_init_internal(bool audio_cb_inited)
{
unsigned new_rate = 0;
@ -633,7 +635,6 @@ static void audio_driver_flush(const int16_t *data, size_t samples)
src_data.data_in = audio_driver_input_data;
src_data.input_frames = samples >> 1;
if (audio_driver_dsp)
{
struct retro_dsp_data dsp_data;
@ -1501,7 +1502,6 @@ error:
return false;
}
bool audio_driver_stop(void)
{
if (!current_audio || !current_audio->stop
@ -1591,7 +1591,6 @@ void audio_set_bool(enum audio_action action, bool val)
}
}
void audio_set_float(enum audio_action action, float val)
{
switch (action)

View File

@ -219,7 +219,6 @@ static int check_pcm_status(void *data, int channel_type)
return ret;
}
static ssize_t alsa_qsa_write(void *data, const void *buf, size_t size)
{
alsa_t *alsa = (alsa_t*)data;
@ -328,7 +327,6 @@ static void alsa_qsa_set_nonblock_state(void *data, bool state)
alsa->nonblock = state;
}
static bool alsa_qsa_use_float(void *data)
{
alsa_t *alsa = (alsa_t*)data;

View File

@ -15,7 +15,6 @@
*/
#include <stdlib.h>
#if TARGET_OS_IPHONE
#include <AudioToolbox/AudioToolbox.h>
#else

View File

@ -56,7 +56,6 @@ static void ctr_csnd_audio_update_playpos(ctr_csnd_audio_t* ctr)
ctr->cpu_ticks_last += samples_played * CTR_CSND_CPU_TICKS_PER_SAMPLE;
}
Result csndPlaySound_custom(int chn, u32 flags, float vol, float pan,
void* data0, void* data1, u32 size)
{
@ -289,7 +288,6 @@ static size_t ctr_csnd_audio_buffer_size(void *data)
return CTR_CSND_AUDIO_COUNT;
}
audio_driver_t audio_ctr_csnd = {
ctr_csnd_audio_init,
ctr_csnd_audio_write,

View File

@ -195,7 +195,6 @@ static size_t ctr_dsp_audio_buffer_size(void *data)
return CTR_DSP_AUDIO_COUNT;
}
audio_driver_t audio_ctr_dsp = {
ctr_dsp_audio_init,
ctr_dsp_audio_write,

View File

@ -51,7 +51,6 @@
#pragma comment(lib, "dxguid")
#endif
typedef struct dsound
{
LPDIRECTSOUND ds;
@ -174,7 +173,6 @@ static DWORD CALLBACK dsound_thread(PVOID data)
/* No space to write, or we don't have data in our fifo,
* but we can wait some time before it underruns ... */
/* We could opt for using the notification interface,
* but it is not guaranteed to work, so use high
* priority sleeping patterns.

View File

@ -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;

View File

@ -232,7 +232,6 @@ static bool sl_start(void *data, bool is_shutdown)
return sl->is_paused ? false : true;
}
static ssize_t sl_write(void *data, const void *buf_, size_t size)
{
sl_t *sl = (sl_t*)data;

293
audio/drivers/ps2_audio.c Normal file
View File

@ -0,0 +1,293 @@
/* 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 <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <kernel.h>
#include <audsrv.h>
#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)
{
ps2_audio_t* ps2 = (ps2_audio_t*)data;
bool start = true;
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
};

View File

@ -252,7 +252,6 @@ static bool psp_audio_alive(void *data)
return psp->running;
}
static bool psp_audio_stop(void *data)
{
psp_audio_t* psp = (psp_audio_t*)data;
@ -318,7 +317,6 @@ static size_t psp_buffer_size(void *data)
return AUDIO_BUFFER_SIZE /** sizeof(uint32_t)*/;
}
audio_driver_t audio_psp = {
psp_audio_init,
psp_audio_write,

View File

@ -80,7 +80,6 @@ static void mainLoop(void* data)
RARCH_LOG("[Audio]: start mainLoop cpu %u tid %u\n", svcGetCurrentProcessorNumber(), swa->thread.handle);
while (swa->running)
{
size_t buf_avail, avail, to_write;

View File

@ -296,7 +296,6 @@
#define SNDRV_PCM_MMAP_OFFSET_STATUS 0x80000000
#define SNDRV_PCM_MMAP_OFFSET_CONTROL 0x81000000
/** Audio sample format of a PCM.
* The first letter specifiers whether the sample is signed or unsigned.
* The letter 'S' means signed. The letter 'U' means unsigned.

View File

@ -30,16 +30,12 @@
#include <audioclient.h>
#ifdef _MSC_VER
/* IID_IAudioClient 1CB9AD4C-DBFA-4c32-B178-C2F568A703B2 */
static const GUID IID_IAudioClient = { 0x1CB9AD4C, 0xDBFA, 0xB178, 0xC2, 0xF5, 0x68, 0xA7, 0x03, 0xB2 };
/* IID_IAudioRenderClient F294ACFC-3146-4483-A7BF-ADDCA7C260E2 */
static const GUID IID_IAudioRenderClient = { 0xF294ACFC, 0x3146, 0x4483, 0xA7BF, 0xAD, 0xDC, 0xA7, 0xC2, 0x60, 0xE2 };
/* IID_IMMDeviceEnumerator A95664D2-9614-4F35-A746-DE8DB63617E6 */
static const GUID IID_IMMDeviceEnumerator = { 0xA95664D2, 0x9614, 0x4F35, 0xA746, 0xDE, 0x8D, 0xB6, 0x36, 0x17, 0xE6 };
/* CLSID_MMDeviceEnumerator BCDE0395-E52F-467C-8E3D-C4579291692E */
static const GUID CLSID_MMDeviceEnumerator = { 0xBCDE0395, 0xE52F, 0x467C, 0x8E3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E };
/* KSDATAFORMAT_SUBTYPE_IEEE_FLOAT 00000003-0000-0010-8000-00aa00389b71 */
static const GUID KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { 0x00000003, 0x0000, 0x0010, 0x8000, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 };
DEFINE_GUID(IID_IAudioClient, 0x1CB9AD4C, 0xDBFA, 0x4C32, 0xB1, 0x78, 0xC2, 0xF5, 0x68, 0xA7, 0x03, 0xB2);
DEFINE_GUID(IID_IAudioRenderClient, 0xF294ACFC, 0x3146, 0x4483, 0xA7, 0xBF, 0xAD, 0xDC, 0xA7, 0xC2, 0x60, 0xE2);
DEFINE_GUID(IID_IMMDeviceEnumerator, 0xA95664D2, 0x9614, 0x4F35, 0xA7, 0x46, 0xDE, 0x8D, 0xB6, 0x36, 0x17, 0xE6);
DEFINE_GUID(CLSID_MMDeviceEnumerator, 0xBCDE0395, 0xE52F, 0x467C, 0x8E, 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E);
#undef KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71);
#endif
#include <lists/string_list.h>

View File

@ -318,7 +318,6 @@ static size_t ax_audio_buffer_size(void* data)
return AX_AUDIO_COUNT;
}
audio_driver_t audio_ax =
{
ax_audio_init,

View File

@ -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)

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
/* Kinda stripped down. Only contains the bare essentials used in RetroArch. */
#ifndef XAUDIO2_STRIPPED_H
#define XAUDIO2_STRIPPED_H
#include <retro_inline.h>
#include <retro_environment.h>
/* 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 <xtl.h>
#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 <audiodefs.h> /* Basic audio data types and constants */
#else
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <basetyps.h>
#include <objbase.h>
#include <mmreg.h>
#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

363
audio/drivers/xaudio27.h Normal file
View File

@ -0,0 +1,363 @@
/* 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 <http://www.gnu.org/licenses/>.
*/
/* Kinda stripped down. Only contains the bare essentials used in RetroArch. */
#ifndef XAUDIO2_STRIPPED_H
#define XAUDIO2_STRIPPED_H
#include <retro_inline.h>
#include <retro_environment.h>
/* 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 <xtl.h>
#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 <audiodefs.h> /* Basic audio data types and constants */
#else
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <basetyps.h>
#include <objbase.h>
#include <mmreg.h>
#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

1306
audio/drivers/xaudio29.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -55,7 +55,6 @@ typedef struct rarch_CC_resampler
void (*process)(void *re, struct resampler_data *data);
} rarch_CC_resampler_t;
#ifdef _MIPS_ARCH_ALLEGREX
static void resampler_CC_process(void *re_, struct resampler_data *data)
{
@ -115,7 +114,6 @@ static void resampler_CC_process(void *re_, struct resampler_data *data)
"vadd.q c720, c720, c620 \n"
"vadd.s s730, s730, s730[1] \n"
"mfv %0, s730 \n"
@ -216,7 +214,6 @@ static void resampler_CC_downsample(void *re_, struct resampler_data *data)
vec_ww1 = _mm_mul_ps(vec_w1, vec_w1);
vec_ww2 = _mm_mul_ps(vec_w2, vec_w2);
vec_ww1 = _mm_mul_ps(vec_ww1, _mm_sub_ps(_mm_set_ps1(3.0),vec_ww1));
vec_ww2 = _mm_mul_ps(vec_ww2, _mm_sub_ps(_mm_set_ps1(3.0),vec_ww2));
@ -307,7 +304,6 @@ static void resampler_CC_upsample(void *re_, struct resampler_data *data)
vec_ww1 = _mm_mul_ps(vec_w1, vec_w1);
vec_ww2 = _mm_mul_ps(vec_w2, vec_w2);
vec_ww1 = _mm_mul_ps(vec_ww1,_mm_sub_ps(_mm_set_ps1(3.0),vec_ww1));
vec_ww2 = _mm_mul_ps(vec_ww2,_mm_sub_ps(_mm_set_ps1(3.0),vec_ww2));
@ -349,7 +345,6 @@ static void resampler_CC_upsample(void *re_, struct resampler_data *data)
data->output_frames = outp - (audio_frame_float_t*)data->data_out;
}
#elif defined (__ARM_NEON__) && !defined(DONT_WANT_ARM_OPTIMIZATIONS)
#define CC_RESAMPLER_IDENT "NEON"
@ -492,7 +487,6 @@ static void resampler_CC_process(void *re_, struct resampler_data *data)
re->process(re_, data);
}
static void *resampler_CC_init(const struct resampler_config *config,
double bandwidth_mod,
enum resampler_quality quality,

View File

@ -46,7 +46,6 @@
#define NETWORK_COMPAT_HEADERS 1
#endif
#ifdef NETWORK_COMPAT_HEADERS
#include <sys/socket.h>
#include <netdb.h>
@ -158,7 +157,6 @@ static int rsnd_poll(struct pollfd *fd, int numfd, int timeout);
static void rsnd_cb_thread(void *thread_data);
static void rsnd_thread(void *thread_data);
/* Determine whether we're running big- or little endian */
static INLINE int rsnd_is_little_endian(void)
{
@ -242,7 +240,6 @@ static int rsnd_connect_server( rsound_t *rd )
rd->conn_type = RSD_CONN_TCP;
rd->conn.socket = net_socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if ( rd->conn.socket < 0 )
goto error;
@ -312,7 +309,6 @@ static int rsnd_send_header_info(rsound_t *rd)
#define FRAMESIZE 34
#define FORMAT 42
uint32_t temp_rate = rd->rate;
uint16_t temp_channels = rd->channels;
@ -980,7 +976,6 @@ static int rsnd_close_ctl(rsound_t *rd)
return 0;
}
// Sends delay info request to server on the ctl socket. This code section isn't critical, and will work if it works.
// It will never block.
static int rsnd_send_info_query(rsound_t *rd)
@ -1296,7 +1291,6 @@ static int rsnd_reset(rsound_t *rd)
return 0;
}
int rsd_stop(rsound_t *rd)
{
retro_assert(rd != NULL);
@ -1403,7 +1397,6 @@ int rsd_exec(rsound_t *rsound)
return fd;
}
/* ioctl()-ish param setting :D */
int rsd_set_param(rsound_t *rd, enum rsd_settings option, void* param)
{
@ -1493,7 +1486,6 @@ void rsd_delay_wait(rsound_t *rd)
/* Latency of stream in ms */
int latency_ms = rsd_delay_ms(rd);
/* Should we sleep for a while to keep the latency low? */
if ( rd->max_latency < latency_ms )
{

View File

@ -46,7 +46,6 @@ void _init_vita_heap(void) {
_newlib_vm_memblock = 0;
}
// Create a mutex to use inside _sbrk_r
if (sceKernelCreateLwMutex((struct SceKernelLwMutexWork*)_newlib_sbrk_mutex, "sbrk mutex", 0, 0, 0) < 0) {
goto failure;

View File

@ -2622,8 +2622,6 @@ static int cheevos_iterate(coro_t *coro)
CORO_ENTER();
cheevos_locals.addrs_patched = false;
coro->settings = config_get_ptr();
@ -3395,7 +3393,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();
}

View File

@ -244,8 +244,6 @@ static const struct cmd_map map[] = {
};
#endif
bool command_set_shader(const char *arg)
{
char msg[256];
@ -273,7 +271,6 @@ bool command_set_shader(const char *arg)
#endif
}
#if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS)
#define SMY_CMD_STR "READ_CORE_RAM"
static bool command_read_ram(const char *arg)
@ -426,7 +423,6 @@ static bool command_network_init(command_t *handle, uint16_t port)
msg_hash_to_str(MSG_BRINGING_UP_COMMAND_INTERFACE_ON_PORT),
(unsigned short)port);
if (fd < 0)
goto error;
@ -1150,7 +1146,6 @@ static void command_event_init_cheats(void)
cheat_manager_alloc_if_empty() ;
cheat_manager_load_game_specific_cheats() ;
if (settings != NULL && settings->bools.apply_cheats_after_load)
cheat_manager_apply_cheats();
}
@ -1347,7 +1342,6 @@ static bool command_event_init_core(enum rarch_core_type *data)
if(settings->bools.auto_shaders_enable)
config_load_shader_preset();
/* reset video format to libretro's default */
video_driver_set_pixel_format(RETRO_PIXEL_FORMAT_0RGB1555);
@ -1370,7 +1364,6 @@ static bool command_event_init_core(enum rarch_core_type *data)
if (!core_load(settings->uints.input_poll_type_behavior))
return false;
rarch_ctl(RARCH_CTL_SET_FRAME_LIMIT, NULL);
return true;
}
@ -1634,7 +1627,6 @@ static void command_event_save_current_config(enum override_type type)
break;
}
if (!string_is_empty(msg))
runloop_msg_queue_push(msg, 1, 180, true);
}
@ -1834,9 +1826,6 @@ void command_playlist_update_write(
**/
bool command_event(enum event_command cmd, void *data)
{
#ifdef HAVE_DISCORD
static bool discord_inited = false;
#endif
bool boolean = false;
switch (cmd)
@ -2986,26 +2975,24 @@ TODO: Add a setting for these tweaks */
if (!settings->bools.discord_enable)
return false;
if (discord_inited)
if (discord_is_ready())
return true;
discord_init();
discord_inited = true;
}
#endif
break;
case CMD_EVENT_DISCORD_DEINIT:
#ifdef HAVE_DISCORD
if (!discord_inited)
if (!discord_is_ready())
return false;
discord_shutdown();
discord_inited = false;
#endif
break;
case CMD_EVENT_DISCORD_UPDATE:
#ifdef HAVE_DISCORD
if (!data || !discord_inited)
if (!data || !discord_is_ready())
return false;
{

View File

@ -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;
@ -400,6 +401,8 @@ static bool default_screenshots_in_content_dir = false;
#if defined(__CELLOS_LV2__) || defined(_XBOX1) || defined(_XBOX360)
static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_L3_R3;
#elif defined(PS2)
static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_HOLD_START;
#elif defined(VITA)
static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_L1_R1_START_SELECT;
#elif defined(SWITCH) || defined(ORBIS)
@ -804,7 +807,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)

View File

@ -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 */
"~", "#", "%", "&", "*", "{", "}", "\\", ":", "[", "]", "?", "/", "|", "\'", "\"",
@ -224,6 +228,7 @@ enum input_driver_enum
INPUT_WII,
INPUT_WIIU,
INPUT_XINPUT,
INPUT_UWP,
INPUT_UDEV,
INPUT_LINUXRAW,
INPUT_COCOA,
@ -321,6 +326,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)
@ -429,7 +441,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;
@ -867,6 +881,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:
@ -958,7 +974,6 @@ const char *config_get_default_joypad(void)
return "null";
}
/**
* config_get_default_camera:
*
@ -1391,11 +1406,11 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
#ifdef GEKKO
SETTING_BOOL("video_vfilter", &settings->bools.video_vfilter, true, video_vfilter, false);
#endif
#ifdef HAVE_MENU
SETTING_BOOL("menu_unified_controls", &settings->bools.menu_unified_controls, true, false, false);
#ifdef HAVE_THREADS
SETTING_BOOL("threaded_data_runloop_enable", &settings->bools.threaded_data_runloop_enable, true, threaded_data_runloop_enable, false);
#endif
#ifdef HAVE_MENU
SETTING_BOOL("menu_unified_controls", &settings->bools.menu_unified_controls, true, false, false);
SETTING_BOOL("menu_throttle_framerate", &settings->bools.menu_throttle_framerate, true, true, false);
SETTING_BOOL("menu_linear_filter", &settings->bools.menu_linear_filter, true, true, false);
SETTING_BOOL("menu_horizontal_animation", &settings->bools.menu_horizontal_animation, true, true, false);
@ -2233,8 +2248,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);
@ -2258,7 +2278,6 @@ static config_file_t *open_default_config_file(void)
/* Try to create a new config file. */
conf = config_file_new(NULL);
if (conf)
{
/* Since this is a clean config file, we can
@ -2266,7 +2285,7 @@ static config_file_t *open_default_config_file(void)
fill_pathname_resolve_relative(conf_path, app_path,
file_path_str(FILE_PATH_MAIN_CONFIG), path_size);
config_set_bool(conf, "config_save_on_exit", true);
saved = config_file_write(conf, conf_path);
saved = config_file_write(conf, conf_path, true);
}
if (!saved)
@ -2302,7 +2321,7 @@ static config_file_t *open_default_config_file(void)
if (conf)
{
config_set_bool(conf, "config_save_on_exit", true);
saved = config_file_write(conf, conf_path);
saved = config_file_write(conf, conf_path, true);
}
if (!saved)
@ -2377,7 +2396,7 @@ static config_file_t *open_default_config_file(void)
{
/* Since this is a clean config file, we can safely use config_save_on_exit. */
config_set_bool(conf, "config_save_on_exit", true);
saved = config_file_write(conf, conf_path);
saved = config_file_write(conf, conf_path, true);
}
if (!saved)
@ -2624,7 +2643,6 @@ static void config_get_hex_base(config_file_t *conf,
}
#endif
/**
* config_load:
* @path : path to be read from.
@ -2831,7 +2849,6 @@ static bool config_load_file(const char *path, bool set_defaults,
CONFIG_GET_INT_BASE(conf, settings, uints.led_map[i], buf);
}
/* Hexadecimal settings */
if (config_get_hex(conf, "video_message_color", &msg_color))
@ -3015,7 +3032,6 @@ static bool config_load_file(const char *path, bool set_defaults,
}
}
if (!string_is_empty(settings->paths.directory_screenshot))
{
if (string_is_equal(settings->paths.directory_screenshot, "default"))
@ -3082,7 +3098,6 @@ static bool config_load_file(const char *path, bool set_defaults,
if (settings->floats.fastforward_ratio < 0.0f)
configuration_set_float(settings, settings->floats.fastforward_ratio, 0.0f);
#ifdef HAVE_LAKKA
settings->bools.ssh_enable = filestream_exists(LAKKA_SSH_PATH);
settings->bools.samba_enable = filestream_exists(LAKKA_SAMBA_PATH);
@ -3178,7 +3193,6 @@ static bool config_load_file(const char *path, bool set_defaults,
ret = true;
end:
if (conf)
config_file_free(conf);
@ -3489,7 +3503,6 @@ bool config_load_remap(void)
malloc(PATH_MAX_LENGTH * sizeof(char));
remap_directory[0] = core_path[0] = game_path[0] = '\0';
strlcpy(remap_directory,
settings->paths.directory_input_remapping,
path_size);
@ -3556,7 +3569,6 @@ bool config_load_remap(void)
input_remapping_set_defaults(false);
}
/* Create a new config file from core_path */
new_conf = config_file_new(core_path);
@ -3782,8 +3794,6 @@ static void parse_config_file(void)
path_get(RARCH_PATH_CONFIG));
}
static void save_keybind_key(config_file_t *conf, const char *prefix,
const char *base, const struct retro_keybind *bind)
{
@ -4037,13 +4047,12 @@ static bool config_save_keybinds_file(const char *path)
for (i = 0; i < MAX_USERS; i++)
save_keybinds_user(conf, i);
ret = config_file_write(conf, path);
ret = config_file_write(conf, path, true);
config_file_free(conf);
return ret;
}
#endif
/**
* config_save_autoconf_profile:
* @path : Path that shall be written to.
@ -4146,7 +4155,7 @@ bool config_save_autoconf_profile(const char *path, unsigned user)
&input_config_binds[user][i], false, false);
}
ret = config_file_write(conf, autoconf_file);
ret = config_file_write(conf, autoconf_file, false);
config_file_free(conf);
free(buf);
@ -4161,7 +4170,6 @@ error:
return false;
}
/**
* config_save_file:
* @path : Path that shall be written to.
@ -4369,7 +4377,6 @@ bool config_save_file(const char *path)
settings->uints.menu_border_light_color);
#endif
video_driver_save_settings(conf);
#ifdef HAVE_LAKKA
@ -4396,7 +4403,7 @@ bool config_save_file(const char *path)
for (i = 0; i < MAX_USERS; i++)
save_keybinds_user(conf, i);
ret = config_file_write(conf, path);
ret = config_file_write(conf, path, true);
config_file_free(conf);
return ret;
@ -4642,7 +4649,6 @@ bool config_save_overrides(int override_type)
config_set_int(conf, cfg, overrides->uints.input_joypad_map[i]);
}
/* blacklist these since they are handled by remaps */
/* to-do: add setting to control blacklisting
if (settings->uints.input_libretro_device[i]
@ -4668,17 +4674,17 @@ bool config_save_overrides(int override_type)
case OVERRIDE_CORE:
/* Create a new config file from core_path */
RARCH_LOG ("[overrides] path %s\n", core_path);
ret = config_file_write(conf, core_path);
ret = config_file_write(conf, core_path, true);
break;
case OVERRIDE_GAME:
/* Create a new config file from core_path */
RARCH_LOG ("[overrides] path %s\n", game_path);
ret = config_file_write(conf, game_path);
ret = config_file_write(conf, game_path, true);
break;
case OVERRIDE_CONTENT_DIR:
/* Create a new config file from content_path */
RARCH_LOG ("[overrides] path %s\n", content_path);
ret = config_file_write(conf, content_path);
ret = config_file_write(conf, content_path, true);
break;
default:
break;

View File

@ -134,7 +134,6 @@ bool core_set_default_callbacks(struct retro_callbacks *cbs)
return true;
}
bool core_deinit(void *data)
{
struct retro_callbacks *cbs = (struct retro_callbacks*)data;
@ -402,7 +401,6 @@ bool core_unload(void)
return true;
}
bool core_unload_game(void)
{
video_driver_free_hw_context();

View File

@ -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;
}

View File

@ -24,7 +24,8 @@ enum rarch_core_type
CORE_TYPE_MPV,
CORE_TYPE_IMAGEVIEWER,
CORE_TYPE_NETRETROPAD,
CORE_TYPE_VIDEO_PROCESSOR
CORE_TYPE_VIDEO_PROCESSOR,
CORE_TYPE_GONG
};
#endif

View File

@ -224,4 +224,3 @@ void libretro_dummy_retro_cheat_set(unsigned idx,
(void)code;
}

View File

@ -360,6 +360,62 @@ size_t libretro_videoprocessor_retro_get_memory_size(unsigned id);
#endif
#ifdef HAVE_EASTEREGG
/* Internal gong core. */
void libretro_gong_retro_init(void);
void libretro_gong_retro_deinit(void);
unsigned libretro_gong_retro_api_version(void);
void libretro_gong_retro_get_system_info(struct retro_system_info *info);
void libretro_gong_retro_get_system_av_info(struct retro_system_av_info *info);
void libretro_gong_retro_set_environment(retro_environment_t cb);
void libretro_gong_retro_set_video_refresh(retro_video_refresh_t cb);
void libretro_gong_retro_set_audio_sample(retro_audio_sample_t cb);
void libretro_gong_retro_set_audio_sample_batch(retro_audio_sample_batch_t cb);
void libretro_gong_retro_set_input_poll(retro_input_poll_t cb);
void libretro_gong_retro_set_input_state(retro_input_state_t cb);
void libretro_gong_retro_set_controller_port_device(unsigned port, unsigned device);
void libretro_gong_retro_reset(void);
void libretro_gong_retro_run(void);
size_t libretro_gong_retro_serialize_size(void);
bool libretro_gong_retro_serialize(void *data, size_t size);
bool libretro_gong_retro_unserialize(const void *data, size_t size);
void libretro_gong_retro_cheat_reset(void);
void libretro_gong_retro_cheat_set(unsigned index, bool enabled, const char *code);
bool libretro_gong_retro_load_game(const struct retro_game_info *game);
bool libretro_gong_retro_load_game_special(unsigned game_type,
const struct retro_game_info *info, size_t num_info);
void libretro_gong_retro_unload_game(void);
unsigned libretro_gong_retro_get_region(void);
void *libretro_gong_retro_get_memory_data(unsigned id);
size_t libretro_gong_retro_get_memory_size(unsigned id);
#endif
RETRO_END_DECLS
#endif

View File

@ -195,7 +195,7 @@ CFLAGS += -D__LIBRETRO__
include Makefile.common
CFLAGS += $(DEFINES) $(INCFLAGS) $(GLFLAGS)
CFLAGS += $(DEFINES) $(INCFLAGS) $(GLFLAGS) $(DEF_FLAGS)
CFLAGS += -Wall $(fpic)
ifeq ($(DEBUG), 1)

View File

@ -16,7 +16,6 @@ AVUTIL_DIR := $(BASE_DIR)/libavutil
SWSCALE_DIR := $(BASE_DIR)/libswscale
SWRESAMPLE_DIR := $(BASE_DIR)/libswresample
INCFLAGS += -I$(BASE_DIR) -I$(CORE_DIR) -I$(LIBRETRO_COMM_DIR)/include -I$(LIBRETRO_COMM_DIR)/include/compat
LIBRETRO_SOURCE += $(CORE_DIR)/ffmpeg_core.c \

View File

@ -134,7 +134,6 @@ endif
LIBS += -lm
ifeq ($(HAVE_NEON),1)
DEFINES += -DHAVE_NEON=1
else
@ -163,7 +162,6 @@ CPUOPTS += -DARCH_BFIN=0
#We can reasonably assume MMX will be there on all x86 CPUs from 1997 and up at least
#SSE2 can be assumed from Pentium 4 and up - can be switched on or off with the switch HAVE_SSE2
ifeq ($(ARCH_X86),1)
CPUOPTS += -DHAVE_AMD3DNOW_INLINE=0
CPUOPTS += -DHAVE_AMD3DNOWEXT_EXTERNAL=0
@ -756,7 +754,6 @@ else
DEFINES += -DCONFIG_LIBSPEEX_ENCODER=0
endif
ifeq ($(HAVE_LIBOPUS),1)
DEFINES += -DCONFIG_LIBOPUS_ENCODER=1 \
-DCONFIG_OPUS_PARSER=1 \
@ -1265,7 +1262,6 @@ DEFINES += -DCONFIG_LIBOPUS_DECODER=0
DEFINES += -DCONFIG_OPUS_MUXER=0
endif
#libavutil
ifeq ($(INTERNAL_LIBAVUTIL),1)
DEFINES += -DHAVE_AV_CONFIG_H
@ -1336,7 +1332,6 @@ ifeq ($(ARCH_ARM),1)
LIBAVUTIL_SOURCE += $(filter-out $(AVUTIL_BLACKLIST),$(wildcard $(AVUTIL_DIR)/arm/*.c))
endif
ifeq ($(ARCH_PPC),1)
LIBAVUTIL_SOURCE += $(AVUTIL_DIR)/ppc/cpu.c \
$(AVUTIL_DIR)/ppc/float_dsp_init.c
@ -1468,7 +1463,6 @@ else
DEFINES += -DCONFIG_XVMC=0
endif
AVCODEC_BLACKLIST := \
$(AVCODEC_DIR)/arm/neontest.c \
$(AVCODEC_DIR)/vda.c \

View File

@ -693,7 +693,6 @@ void CORE_PREFIX(retro_run)(void)
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, frames[0].tex);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glVertexAttribPointer(vertex_loc, 2, GL_FLOAT, GL_FALSE,
4 * sizeof(GLfloat), (const GLvoid*)(0 * sizeof(GLfloat)));
@ -1664,7 +1663,6 @@ error:
return false;
}
unsigned CORE_PREFIX(retro_get_region)(void)
{
return RETRO_REGION_NTSC;

696
cores/libretro-gong/gong.c Normal file
View File

@ -0,0 +1,696 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2018 - 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 <http://www.gnu.org/licenses/>.
*/
/* Libretro port by Brad Parker,
Original source code by Dan Zaidan: https://danzaidan.itch.io/
Original license:
"You can do whatever you want with the code, but I am providing it as is without any warranty whatsoever."
*/
#include <stdlib.h>
#include <libretro.h>
#include <retro_math.h>
#include <retro_inline.h>
#ifdef RARCH_INTERNAL
#include "internal_cores.h"
#define GONG_CORE_PREFIX(s) libretro_gong_##s
#else
#define GONG_CORE_PREFIX(s) s
#endif
#define WIDTH 356
#define HEIGHT 200
#define FPS (60000.0f / 1000.0f)
static retro_log_printf_t GONG_CORE_PREFIX(log_cb);
static retro_video_refresh_t GONG_CORE_PREFIX(video_cb);
static retro_input_poll_t GONG_CORE_PREFIX(input_poll_cb);
static retro_input_state_t GONG_CORE_PREFIX(input_state_cb);
static retro_audio_sample_t GONG_CORE_PREFIX(audio_cb);
static retro_audio_sample_batch_t GONG_CORE_PREFIX(audio_batch_cb);
static retro_environment_t GONG_CORE_PREFIX(environ_cb);
static const char *GONG_CORE_PREFIX(valid_extensions) = "gong";
static float player1_py = 0.0f;
static float player1_dpy = 0.0f;
static float player2_py = 0.0f;
static float player2_dpy = 0.0f;
static float player2_speed = 0.0f;
static float ball_px = 0.0f;
static float ball_py = 0.0f;
static float ball_dpx = 0.0f;
static float ball_dpy = 0.0f;
static float ball_speed = 0.0f;
static bool is_initialized = 0;
static unsigned player1_score = 0;
static unsigned player2_score = 0;
static float current_play_points = 0.0f;
static unsigned char *video_buf = NULL;
enum
{
B_MOVE_UP,
B_MOVE_DOWN,
B_SPEED_UP,
B_COUNT /* This should always be in the bottom */
};
typedef struct
{
int half_transition_count;
bool ended_down;
} Game_Button_State;
typedef struct
{
Game_Button_State buttons[B_COUNT];
float last_dt;
} Game_Input;
static Game_Input g_input = {0};
typedef struct
{
/* Pixels are always 32-bit wide, memory order XX BB GG RR */
int width;
int height;
int pitch;
void *memory;
} Game_Offscreen_Buffer;
static Game_Offscreen_Buffer game_buffer = {0};
static void game_update_and_render(Game_Input *input, Game_Offscreen_Buffer *draw_buffer);
static const struct retro_controller_description pads[] = {
{ "Joypad", RETRO_DEVICE_JOYPAD },
{ NULL, 0 },
};
static const struct retro_controller_info ports[] = {
{ pads, 1 },
{ 0 },
};
struct retro_input_descriptor desc[] = {
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "D-Pad Up" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "D-Pad Down" },
{ 0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y, "Left Analog Y" },
{ 0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y, "Right Analog Y" },
{ 0 },
};
static INLINE bool pressed(Game_Button_State state)
{
return state.half_transition_count > 1 ||
(state.half_transition_count == 1 && state.ended_down);
}
static INLINE bool is_down(Game_Button_State state)
{
return state.ended_down;
}
void GONG_CORE_PREFIX(retro_get_system_info)(struct retro_system_info *info)
{
info->library_name = "gong";
info->library_version = "v1.0";
info->need_fullpath = false;
info->block_extract = false;
info->valid_extensions = GONG_CORE_PREFIX(valid_extensions);
}
void GONG_CORE_PREFIX(retro_get_system_av_info)(struct retro_system_av_info *info)
{
info->geometry.base_width = WIDTH;
info->geometry.base_height = HEIGHT;
info->geometry.max_width = WIDTH;
info->geometry.max_height = HEIGHT;
info->geometry.aspect_ratio = 16.0f / 9.0f;
info->timing.fps = FPS;
info->timing.sample_rate = 44100.0;
}
void GONG_CORE_PREFIX(retro_init)(void)
{
struct retro_log_callback log;
if (GONG_CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
GONG_CORE_PREFIX(log_cb) = log.log;
else
GONG_CORE_PREFIX(log_cb) = NULL;
video_buf = (unsigned char*)calloc(1, WIDTH * HEIGHT * sizeof(unsigned));
game_buffer.width = WIDTH;
game_buffer.height = HEIGHT;
game_buffer.pitch = WIDTH * sizeof(unsigned);
game_buffer.memory = video_buf;
g_input.last_dt = 1.0f / FPS;
}
void GONG_CORE_PREFIX(retro_deinit)(void)
{
if (video_buf)
free(video_buf);
video_buf = NULL;
game_buffer.memory = NULL;
}
void GONG_CORE_PREFIX(retro_set_environment)(retro_environment_t cb)
{
bool no_content = true;
static const struct retro_variable vars[] = {
{ NULL, NULL },
};
GONG_CORE_PREFIX(environ_cb) = cb;
cb(RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME, &no_content);
cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)vars);
cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports);
}
void GONG_CORE_PREFIX(retro_set_video_refresh)(retro_video_refresh_t cb)
{
GONG_CORE_PREFIX(video_cb) = cb;
}
void GONG_CORE_PREFIX(retro_set_audio_sample)(retro_audio_sample_t cb)
{
GONG_CORE_PREFIX(audio_cb) = cb;
}
void GONG_CORE_PREFIX(retro_set_audio_sample_batch)(retro_audio_sample_batch_t cb)
{
GONG_CORE_PREFIX(audio_batch_cb) = cb;
}
void GONG_CORE_PREFIX(retro_set_input_poll)(retro_input_poll_t cb)
{
GONG_CORE_PREFIX(input_poll_cb) = cb;
}
void GONG_CORE_PREFIX(retro_set_input_state)(retro_input_state_t cb)
{
GONG_CORE_PREFIX(input_state_cb) = cb;
}
void GONG_CORE_PREFIX(retro_set_controller_port_device)(unsigned a, unsigned b)
{
}
void GONG_CORE_PREFIX(retro_reset)(void)
{
player1_py = 0.0f;
player1_dpy = 0.0f;
player2_py = 0.0f;
player2_dpy = 0.0f;
player2_speed = 0.0f;
player1_score = 0;
player2_score = 0;
is_initialized = 0;
}
size_t GONG_CORE_PREFIX(retro_serialize_size)(void)
{
return 0;
}
bool GONG_CORE_PREFIX(retro_serialize)(void *data, size_t size)
{
(void)data;
(void)size;
return false;
}
bool GONG_CORE_PREFIX(retro_unserialize)(const void *data, size_t size)
{
(void)data;
(void)size;
return false;
}
void GONG_CORE_PREFIX(retro_cheat_reset)(void)
{
}
void GONG_CORE_PREFIX(retro_cheat_set)(unsigned a, bool b, const char * c)
{
}
bool GONG_CORE_PREFIX(retro_load_game)(const struct retro_game_info *info)
{
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_XRGB8888;
if (!GONG_CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
{
if (GONG_CORE_PREFIX(log_cb))
GONG_CORE_PREFIX(log_cb)(RETRO_LOG_INFO, "XRGB8888 is not supported.\n");
return false;
}
return true;
}
bool GONG_CORE_PREFIX(retro_load_game_special)(unsigned a, const struct retro_game_info *b, size_t c)
{
return false;
}
void GONG_CORE_PREFIX(retro_unload_game)(void)
{
}
unsigned GONG_CORE_PREFIX(retro_get_region)(void)
{
return RETRO_REGION_NTSC;
}
void* GONG_CORE_PREFIX(retro_get_memory_data)(unsigned id)
{
return NULL;
}
size_t GONG_CORE_PREFIX(retro_get_memory_size)(unsigned id)
{
return 0;
}
static void process_joypad(Game_Button_State *new_state, bool is_down)
{
if (new_state->ended_down != is_down)
{
new_state->ended_down = is_down;
new_state->half_transition_count += 1;
}
}
static bool is_key_up_or_down(int16_t input, int16_t not_input, int key)
{
if (input & (1 << key) || not_input & (1 << key))
return true;
return false;
}
void GONG_CORE_PREFIX(retro_run)(void)
{
uint16_t input = 0;
uint16_t not_input = 0;
static uint16_t previnput = 0;
uint16_t realinput = 0;
int i = 0;
int16_t analogYLeft1 = 0;
int16_t analogYRight1 = 0;
GONG_CORE_PREFIX(input_poll_cb)();
for (i = 0; i < 16; i++)
{
if (GONG_CORE_PREFIX(input_state_cb)(0, RETRO_DEVICE_JOYPAD, 0, i))
{
realinput |= 1 << i;
}
}
analogYLeft1 = GONG_CORE_PREFIX(input_state_cb)(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y) / 5000.0f;
analogYRight1 = GONG_CORE_PREFIX(input_state_cb)(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) / 5000.0f;
if (analogYLeft1 > 0)
realinput |= (1 << RETRO_DEVICE_ID_JOYPAD_DOWN);
else if (analogYRight1 > 0)
realinput |= (1 << RETRO_DEVICE_ID_JOYPAD_DOWN);
if (analogYLeft1 < 0)
realinput |= (1 << RETRO_DEVICE_ID_JOYPAD_UP);
else if (analogYRight1 < 0)
realinput |= (1 << RETRO_DEVICE_ID_JOYPAD_UP);
input = realinput & ~previnput;
not_input = previnput & ~realinput;
if (is_key_up_or_down(input, not_input, RETRO_DEVICE_ID_JOYPAD_UP))
process_joypad(&g_input.buttons[B_MOVE_UP], realinput & (1 << RETRO_DEVICE_ID_JOYPAD_UP));
else if (is_key_up_or_down(input, not_input, RETRO_DEVICE_ID_JOYPAD_DOWN))
process_joypad(&g_input.buttons[B_MOVE_DOWN], realinput & (1 << RETRO_DEVICE_ID_JOYPAD_DOWN));
else if (is_key_up_or_down(input, not_input, RETRO_DEVICE_ID_JOYPAD_DOWN))
process_joypad(&g_input.buttons[B_MOVE_DOWN], realinput & (1 << RETRO_DEVICE_ID_JOYPAD_DOWN));
if (is_key_up_or_down(input, not_input, RETRO_DEVICE_ID_JOYPAD_A))
process_joypad(&g_input.buttons[B_SPEED_UP], realinput & (1 << RETRO_DEVICE_ID_JOYPAD_A));
else if (is_key_up_or_down(input, not_input, RETRO_DEVICE_ID_JOYPAD_B))
process_joypad(&g_input.buttons[B_SPEED_UP], realinput & (1 << RETRO_DEVICE_ID_JOYPAD_B));
else if (is_key_up_or_down(input, not_input, RETRO_DEVICE_ID_JOYPAD_X))
process_joypad(&g_input.buttons[B_SPEED_UP], realinput & (1 << RETRO_DEVICE_ID_JOYPAD_X));
else if (is_key_up_or_down(input, not_input, RETRO_DEVICE_ID_JOYPAD_Y))
process_joypad(&g_input.buttons[B_SPEED_UP], realinput & (1 << RETRO_DEVICE_ID_JOYPAD_Y));
previnput = realinput;
game_update_and_render(&g_input, &game_buffer);
GONG_CORE_PREFIX(video_cb)(video_buf, WIDTH, HEIGHT, WIDTH * sizeof(uint32_t));
}
unsigned GONG_CORE_PREFIX(retro_api_version)(void)
{
return RETRO_API_VERSION;
}
static void draw_rect_in_pixels(Game_Offscreen_Buffer *buffer, unsigned color, int min_x, int min_y, int max_x, int max_y)
{
int y;
min_x = MAX(min_x, 0);
min_y = MAX(min_y, 0);
max_x = MIN(max_x, buffer->width);
max_y = MIN(max_y, buffer->height);
for (y = min_y; y < max_y; y++)
{
int x;
for (x = min_x; x < max_x; x++)
{
unsigned *pixel = (unsigned*)((unsigned char*)buffer->memory + ((buffer->width * (buffer->height - y - 1) + x) * sizeof(unsigned)));
*pixel++ = color;
}
}
}
static void clear(Game_Offscreen_Buffer *buffer, unsigned color)
{
draw_rect_in_pixels(buffer, color, 0, 0, buffer->width, buffer->height);
}
static void draw_rect(Game_Offscreen_Buffer *buffer, unsigned color, float x, float y, float half_size_x, float half_size_y)
{
/* @Hardcoded to always keep the playing field area on screen, no matter the aspect ratio */
float scale = .01f;
float relative_axis = (float)buffer->height;
int min_x, min_y, max_x, max_y;
if ((float)buffer->width / (float)buffer->height < 1.77f)
{
relative_axis = (float)buffer->width;
scale = .0056f;
}
half_size_x *= relative_axis * scale;
half_size_y *= relative_axis * scale;
x *= relative_axis * scale;
y *= relative_axis * scale;
x = x + buffer->width / 2;
y = y + buffer->height / 2;
min_x = (unsigned)(x - half_size_x);
min_y = (unsigned)(y - half_size_y);
max_x = (unsigned)(x + half_size_x);
max_y = (unsigned)(y + half_size_y);
draw_rect_in_pixels(buffer, color, min_x, min_y, max_x, max_y);
}
static void draw_number(Game_Offscreen_Buffer *buffer, unsigned number, unsigned color, float x, float y)
{
float at_x = x;
do {
unsigned alg = number % 10;
number /= 10;
switch (alg)
{
case 0:
{
draw_rect(buffer, color, at_x - 2.f, y, .5f, 4.f);
draw_rect(buffer, color, at_x + 2.f, y, .5f, 4.f);
draw_rect(buffer, color, at_x, y + 4.f, 2.5f, .5f);
draw_rect(buffer, color, at_x, y - 4.f, 2.5f, .5f);
break;
}
case 1:
{
draw_rect(buffer, color, at_x + 2.f, y, .5f, 4.5f);
break;
}
case 2:
{
draw_rect(buffer, color, at_x - 2.f, y - 2.f, .5f, 2.f);
draw_rect(buffer, color, at_x + 2.f, y + 2.f, .5f, 2.f);
draw_rect(buffer, color, at_x, y + 4.f, 2.5f, .5f);
draw_rect(buffer, color, at_x, y, 2.5f, .5f);
draw_rect(buffer, color, at_x, y - 4.f, 2.5f, .5f);
break;
}
case 3:
{
draw_rect(buffer, color, at_x + 2.f, y, .5f, 4.f);
draw_rect(buffer, color, at_x, y + 4.f, 2.5f, .5f);
draw_rect(buffer, color, at_x, y, 2.5f, .5f);
draw_rect(buffer, color, at_x, y - 4.f, 2.5f, .5f);
break;
};
case 4:
{
draw_rect(buffer, color, at_x, y, 2.5f, .5f);
draw_rect(buffer, color, at_x + 2.f, y, .5f, 4.5f);
draw_rect(buffer, color, at_x - 2.f, y+2.5f, .5f, 2.f);
break;
};
case 5:
{
draw_rect(buffer, color, at_x + 2.f, y-2.f, .5f, 2.f);
draw_rect(buffer, color, at_x - 2.f, y+2.f, .5f, 2.f);
draw_rect(buffer, color, at_x, y + 4.f, 2.5f, .5f);
draw_rect(buffer, color, at_x, y, 2.5f, .5f);
draw_rect(buffer, color, at_x, y - 4.f, 2.5f, .5f);
break;
};
case 6:
{
draw_rect(buffer, color, at_x + 2.f, y-2.f, .5f, 2.f);
draw_rect(buffer, color, at_x - 2.f, y, .5f, 4.f);
draw_rect(buffer, color, at_x, y + 4.f, 2.5f, .5f);
draw_rect(buffer, color, at_x, y, 2.5f, .5f);
draw_rect(buffer, color, at_x, y - 4.f, 2.5f, .5f);
break;
};
case 7:
{
draw_rect(buffer, color, at_x + 2.f, y, .5f, 4.5f);
draw_rect(buffer, color, at_x, y + 4.f, 2.5f, .5f);
break;
};
case 8:
{
draw_rect(buffer, color, at_x - 2.f, y, .5f, 4.f);
draw_rect(buffer, color, at_x + 2.f, y, .5f, 4.f);
draw_rect(buffer, color, at_x, y + 4.f, 2.5f, .5f);
draw_rect(buffer, color, at_x, y - 4.f, 2.5f, .5f);
draw_rect(buffer, color, at_x, y, 2.5f, .5f);
break;
};
case 9:
{
draw_rect(buffer, color, at_x - 2.f, y + 2.f, .5f, 2.f);
draw_rect(buffer, color, at_x + 2.f, y, .5f, 4.f);
draw_rect(buffer, color, at_x, y + 4.f, 2.5f, .5f);
draw_rect(buffer, color, at_x, y, 2.5f, .5f);
draw_rect(buffer, color, at_x, y - 4.f, 2.5f, .5f);
break;
};
default:
break;
}
at_x -= 7.f;
} while(number > 0);
}
static void game_update_and_render(Game_Input *input, Game_Offscreen_Buffer *draw_buffer)
{
const float initial_ball_speed = 80.f;
float playing_field_x = 85.f;
float playing_field_y = 48.f;
float player_size_x = 2.5f;
float player_size_y = 10.f;
if (!is_initialized)
{
is_initialized = 1;
ball_px = 0;
ball_py = 0;
ball_dpx = initial_ball_speed;
ball_dpy = 0;
current_play_points = 10.f;
player2_speed = 80.f;
}
{
float speed = 80.f;
player1_dpy = 0.f;
if (is_down(input->buttons[B_SPEED_UP]))
speed = 150.f;
if (is_down(input->buttons[B_MOVE_UP]))
{
if (player1_py < playing_field_y - player_size_y)
{
player1_dpy = speed;
}
if (player1_py < -playing_field_y + player_size_y)
{
player1_py = -playing_field_y + player_size_y;
player1_dpy = 0.f;
}
}
if (is_down(input->buttons[B_MOVE_DOWN]))
{
if (player1_py > -playing_field_y + player_size_y)
{
player1_dpy = -speed;
}
if (player1_py < -playing_field_y + player_size_y)
{
player1_py = -playing_field_y + player_size_y;
player1_dpy = 0.f;
}
}
player1_py += player1_dpy * input->last_dt;
}
{
player2_dpy = (ball_py - player2_py) * 100.f;
player2_dpy = MIN(player2_dpy, player2_speed);
player2_dpy = MAX(player2_dpy, -player2_speed);
player2_py += player2_dpy * input->last_dt;
if (player2_py < -playing_field_y + player_size_y)
{
player2_py = -playing_field_y + player_size_y;
player2_dpy = 0.f;
}
if (player2_py > playing_field_y - player_size_y)
{
player2_py = playing_field_y - player_size_y;
player2_dpy = 0.f;
}
}
ball_px += ball_dpx * input->last_dt;
if (ball_dpx > 0)
{
ball_dpx += 10.f * input->last_dt;
}
else
{
ball_dpx -= 10.f * input->last_dt;
}
ball_py += ball_dpy * input->last_dt;
if (ball_py > playing_field_y - 1.f)
{
ball_py = playing_field_y - 1.f;
ball_dpy *= -1.f;
}
else if (ball_py < -playing_field_y + 1)
{
ball_py = -playing_field_y + 1.f;
ball_dpy *= -1;
}
if (ball_px > 80.f - 2.5f - 1.f) /* @Hardcoded */
{
if ((ball_py >= (player2_py - 10.f)) && (ball_py <= (player2_py + 10.f)))
{
ball_dpx *= -1.f;
ball_px = 80.f - 2.5f - 1.f; /* @Hardcoded */
ball_dpy = (ball_py - player2_py) + player2_dpy;
++current_play_points;
}
else if (ball_px >= playing_field_x - 1)
{
ball_px = 0;
ball_py = 0;
ball_dpy = 0;
ball_dpx = -initial_ball_speed;
player2_score += (unsigned)current_play_points;
current_play_points = 10.f;
}
}
else if (ball_px < -80 + 2.5f + 1.f) /* @Hardcoded */
{
if ((ball_py >= (player1_py - 10.f)) && (ball_py <= (player1_py + 10.f)))
{
ball_dpx *= -1.f;
ball_px = -80 + 2.5f + 1.f; /* @Hardcoded */
ball_dpy = (ball_py - player1_py) + player1_dpy;
++current_play_points;
}
else if (ball_px <= -playing_field_x + 1)
{
ball_px = 0;
ball_py = 0;
ball_dpy = 0;
ball_dpx = initial_ball_speed;
player1_score += (unsigned)current_play_points;
current_play_points = 10.f;
player2_speed += current_play_points * 0.01f;
}
}
clear(draw_buffer, 0x021077);
draw_rect(draw_buffer, 0x000530, 0.f, 0.f, playing_field_x, playing_field_y);
draw_rect(draw_buffer, 0x00ffff, -80.f, player1_py, player_size_x, player_size_y);
draw_rect(draw_buffer, 0x00ffff, 80.f, player2_py, player_size_x, player_size_y);
draw_rect(draw_buffer, 0xffff00, ball_px, ball_py, 1.f, 1.f);
draw_number(draw_buffer, (unsigned)current_play_points, 0xaaaaaa, 0.f, 38.f);
draw_number(draw_buffer, player1_score, 0xff6611, 20.f, 38.f);
draw_number(draw_buffer, player2_score, 0xff6611, -20.f, 38.f);
}

View File

@ -0,0 +1 @@
#include "../internal_cores.h"

View File

@ -0,0 +1,5 @@
{
global: retro_*;
local: *;
};

View File

@ -275,7 +275,6 @@ static bool imageviewer_load(const char *path, int image_index)
process_new_image = true;
return true;
}
@ -293,7 +292,6 @@ bool IMAGE_CORE_PREFIX(retro_load_game)(const struct retro_game_info *info)
dir_list_sort(file_list, false);
free(dir);
if (!IMAGE_CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
{
if (IMAGE_CORE_PREFIX(log_cb))
@ -312,7 +310,6 @@ bool IMAGE_CORE_PREFIX(retro_load_game_special)(unsigned a, const struct retro_g
return false;
}
void IMAGE_CORE_PREFIX(retro_unload_game)(void)
{
imageviewer_free_image();
@ -335,7 +332,6 @@ size_t IMAGE_CORE_PREFIX(retro_get_memory_size)(unsigned id)
return 0;
}
void IMAGE_CORE_PREFIX(retro_run)(void)
{
bool first_image = false;

View File

@ -103,7 +103,6 @@ else
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined
endif
LDFLAGS += $(LIBM)
ifeq ($(platform), win)

View File

@ -276,7 +276,6 @@ void NETRETROPAD_CORE_PREFIX(retro_set_environment)(retro_environment_t cb)
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565;
cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)vars);
NETRETROPAD_CORE_PREFIX(environ_cb) = cb;
bool no_content = true;
cb(RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME, &no_content);
@ -379,7 +378,6 @@ void NETRETROPAD_CORE_PREFIX(retro_run)(void)
pixel += 65;
}
NETRETROPAD_CORE_PREFIX(video_cb)(frame_buf, 320, 240, 640);
retro_sleep(4);

View File

@ -102,7 +102,6 @@ static uint32_t *frame_prev2;
static uint32_t *frame_prev3;
static uint32_t *frame_curr;
// Frametime debug messages
struct timeval ft_prevtime = { 0 }, ft_prevtime2 = { 0 };
char *ft_info = NULL, *ft_info2 = NULL;
@ -660,7 +659,6 @@ void source_v4l2_normal(int width, int height) {
v4l2_frame_times(bufcp);
}
void source_v4l2_alternate_hack(int width, int height) {
struct v4l2_buffer bufcp;
struct v4l2_format fmt;

View File

@ -1,7 +1,6 @@
/* from https://github.com/smealum/ctrulib
* modified to allow reducing __linear_heap_size at runtime */
#include <3ds.h>
#include <stdlib.h>
#include <3ds/util/rbtree.h>
@ -245,7 +244,6 @@ extern "C" u32 ctr_get_linear_unused(void)
return __linear_heap + __linear_heap_size - sLinearPool_maxaddr;
}
extern "C" void ctr_linear_free_pages(u32 pages)
{
if(sLinearPool.last->base + sLinearPool.last->size != (u8*)__linear_heap + __linear_heap_size)

View File

@ -379,7 +379,6 @@ static void do_memchunkhax2(void)
APT_SetAppCpuTimeLimit(mch2.old_cpu_time_limit);
}
static void gspwn(u32 dst, u32 src, u32 size, u8* flush_buffer)
{
extern Handle gspEvents[GSPGPU_EVENT_MAX];

View File

@ -93,7 +93,6 @@ void __attribute__((weak)) __libctru_init(void (*retAddr)(void))
__system_allocateHeaps();
}
Result __sync_fini(void) __attribute__((weak));
extern char** __system_argv;
@ -299,7 +298,6 @@ void wait_for_input(void)
}
}
long sysconf(int name)
{
switch (name)

View File

@ -5,14 +5,12 @@
#include "mini-hb-menu/common.h"
extern const loaderFuncs_s loader_Ninjhax1;
extern const loaderFuncs_s loader_Ninjhax2;
extern const loaderFuncs_s loader_Rosalina;
static void (*launch_3dsx)(const char* path, argData_s* args, executableMetadata_s* em);
static int exec_3dsx_actual(const char* path, const char** args, bool appendPath){
struct stat sBuff;
argData_s newProgramArgs;

View File

@ -4,16 +4,13 @@
#include <sys/stat.h>
#include <3ds.h>
#define FILE_CHUNK_SIZE 4096
typedef struct{
u32 argc;
char args[0x300 - 0x4];
}ciaParam;
char argvHmac[0x20] = {0x1d, 0x78, 0xff, 0xb9, 0xc5, 0xbc, 0x78, 0xb7, 0xac, 0x29, 0x1d, 0x3e, 0x16, 0xd0, 0xcf, 0x53, 0xef, 0x12, 0x58, 0x83, 0xb6, 0x9e, 0x2f, 0x79, 0x47, 0xf9, 0x35, 0x61, 0xeb, 0x50, 0xd7, 0x67};

View File

@ -35,7 +35,6 @@ void GPU_SetFloatUniform(GPU_SHADER_TYPE type, u32 startreg, u32* data, u32 numr
GPUCMD_AddWrites(GPUREG_VSH_FLOATUNIFORM_DATA+regOffset, data, numreg*4);
}
//takes PAs as arguments
void GPU_SetViewport(u32* depthBuffer, u32* colorBuffer, u32 x, u32 y, u32 w, u32 h)
{
@ -307,7 +306,6 @@ void GPU_FinishDrawing()
GPUCMD_AddWrite(GPUREG_EARLYDEPTH_CLEAR, 0x00000001);
}
void GPU_Finalize(void)
{
GPUCMD_AddMaskedWrite(GPUREG_PRIMITIVE_CONFIG, 0x8, 0x00000000);

View File

@ -148,7 +148,6 @@ char *bin_to_hex_alloc(const uint8_t *data, size_t len)
return ret;
}
static int database_cursor_iterate(libretrodb_cursor_t *cur,
database_info_t *db_info)
{

View File

@ -129,20 +129,20 @@ public class DiscordRpc
FreeMem();
}
_presence.state = StrToPtr(state, 128);
_presence.details = StrToPtr(details, 128);
_presence.state = StrToPtr(state);
_presence.details = StrToPtr(details);
_presence.startTimestamp = startTimestamp;
_presence.endTimestamp = endTimestamp;
_presence.largeImageKey = StrToPtr(largeImageKey, 32);
_presence.largeImageText = StrToPtr(largeImageText, 128);
_presence.smallImageKey = StrToPtr(smallImageKey, 32);
_presence.smallImageText = StrToPtr(smallImageText, 128);
_presence.partyId = StrToPtr(partyId, 128);
_presence.largeImageKey = StrToPtr(largeImageKey);
_presence.largeImageText = StrToPtr(largeImageText);
_presence.smallImageKey = StrToPtr(smallImageKey);
_presence.smallImageText = StrToPtr(smallImageText);
_presence.partyId = StrToPtr(partyId);
_presence.partySize = partySize;
_presence.partyMax = partyMax;
_presence.matchSecret = StrToPtr(matchSecret, 128);
_presence.joinSecret = StrToPtr(joinSecret, 128);
_presence.spectateSecret = StrToPtr(spectateSecret, 128);
_presence.matchSecret = StrToPtr(matchSecret);
_presence.joinSecret = StrToPtr(joinSecret);
_presence.spectateSecret = StrToPtr(spectateSecret);
_presence.instance = instance;
return _presence;
@ -152,16 +152,18 @@ public class DiscordRpc
/// Returns a pointer to a representation of the given string with a size of maxbytes
/// </summary>
/// <param name="input">String to convert</param>
/// <param name="maxbytes">Max number of bytes to use</param>
/// <returns>Pointer to the UTF-8 representation of <see cref="input"/></returns>
private IntPtr StrToPtr(string input, int maxbytes)
private IntPtr StrToPtr(string input)
{
if (string.IsNullOrEmpty(input)) return IntPtr.Zero;
var convstr = StrClampBytes(input, maxbytes);
var convbytecnt = Encoding.UTF8.GetByteCount(convstr);
var buffer = Marshal.AllocHGlobal(convbytecnt);
var convbytecnt = Encoding.UTF8.GetByteCount(input);
var buffer = Marshal.AllocHGlobal(convbytecnt + 1);
for (int i = 0; i < convbytecnt + 1; i++)
{
Marshal.WriteByte(buffer, i , 0);
}
_buffers.Add(buffer);
Marshal.Copy(Encoding.UTF8.GetBytes(convstr), 0, buffer, convbytecnt);
Marshal.Copy(Encoding.UTF8.GetBytes(input), 0, buffer, convbytecnt);
return buffer;
}
@ -181,30 +183,6 @@ public class DiscordRpc
return Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(str));
}
/// <summary>
/// Clamp the string to the given byte length preserving null termination
/// </summary>
/// <param name="toclamp">string to clamp</param>
/// <param name="maxbytes">max bytes the resulting string should have (including null termination)</param>
/// <returns>null terminated string with a byte length less or equal to <see cref="maxbytes"/></returns>
private static string StrClampBytes(string toclamp, int maxbytes)
{
var str = StrToUtf8NullTerm(toclamp);
var strbytes = Encoding.UTF8.GetBytes(str);
if (strbytes.Length <= maxbytes)
{
return str;
}
var newstrbytes = new byte[] { };
Array.Copy(strbytes, 0, newstrbytes, 0, maxbytes - 1);
newstrbytes[newstrbytes.Length - 1] = 0;
newstrbytes[newstrbytes.Length - 2] = 0;
return Encoding.UTF8.GetString(newstrbytes);
}
/// <summary>
/// Free the allocated memory for conversion to <see cref="RichPresenceStruct"/>
/// </summary>

View File

@ -24,6 +24,16 @@ struct FDiscordUserData {
FString avatar;
};
/**
* Valid response codes for Respond function
*/
UENUM(BlueprintType)
enum class EDiscordJoinResponseCodes : uint8
{
DISCORD_REPLY_NO UMETA(DisplayName="No"),
DISCORD_REPLY_YES UMETA(DisplayName="Yes"),
DISCORD_REPLY_IGNORE UMETA(DisplayName="Ignore")
};
DECLARE_LOG_CATEGORY_EXTERN(Discord, Log, All);

View File

@ -33,9 +33,11 @@ extern "C" DISCORD_EXPORT void Discord_Register(const char* applicationId, const
char exePath[1024];
if (!command || !command[0]) {
if (readlink("/proc/self/exe", exePath, sizeof(exePath)) <= 0) {
ssize_t size = readlink("/proc/self/exe", exePath, sizeof(exePath));
if (size <= 0 || size >= (ssize_t)sizeof(exePath)) {
return;
}
exePath[size] = '\0';
command = exePath;
}

View File

@ -89,10 +89,11 @@ public:
keepRunning.store(true);
ioThread = std::thread([&]() {
const std::chrono::duration<int64_t, std::milli> maxWait{500LL};
Discord_UpdateConnection();
while (keepRunning.load()) {
Discord_UpdateConnection();
std::unique_lock<std::mutex> lock(waitForIOMutex);
waitForIOActivity.wait_for(lock, maxWait);
Discord_UpdateConnection();
}
});
}

1
dirs.c
View File

@ -25,7 +25,6 @@
#include "dirs.h"
#include "command.h"
#include "configuration.h"
#include "command.h"
#include "defaults.h"
#include "list_special.h"
#include "file_path_special.h"

View File

@ -37,25 +37,112 @@
#include "../cheevos/cheevos.h"
#endif
static int FrustrationLevel = 0;
#ifdef HAVE_MENU
#include "../../menu/widgets/menu_input_dialog.h"
#include "../../menu/menu_cbs.h"
#endif
#include <net/net_http.h>
#include "../network/net_http_special.h"
#include "../tasks/tasks_internal.h"
#include <streams/file_stream.h>
#include <file/file_path.h>
#include "../file_path_special.h"
static int64_t start_time = 0;
static int64_t pause_time = 0;
static int64_t ellapsed_time = 0;
static bool discord_ready = false;
static bool discord_avatar_ready = false;
static unsigned discord_status = 0;
struct netplay_room *room;
static char user_id[128];
static char user_name[128];
static char party_name[128];
static char user_avatar[PATH_MAX_LENGTH];
static char cdn_url[] = "https://cdn.discordapp.com/avatars";
DiscordRichPresence discord_presence;
char* discord_get_own_username(void)
{
return user_name;
}
char* discord_get_own_avatar(void)
{
return user_avatar;
}
bool discord_avatar_is_ready(void)
{
return discord_avatar_ready;
}
void discord_avatar_set_ready(bool ready)
{
discord_avatar_ready = ready;
}
bool discord_is_ready(void)
{
return discord_ready;
}
#ifdef HAVE_MENU
static bool discord_download_avatar(
const char* user_id, const char* avatar_id)
{
static char url[PATH_MAX_LENGTH];
static char url_encoded[PATH_MAX_LENGTH];
static char full_path[PATH_MAX_LENGTH];
static char buf[PATH_MAX_LENGTH];
file_transfer_t *transf = NULL;
fill_pathname_application_special(buf,
sizeof(buf),
APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_DISCORD_AVATARS);
fill_pathname_join(full_path, buf, avatar_id, sizeof(full_path));
strlcpy(user_avatar, avatar_id, sizeof(user_avatar));
if(filestream_exists(full_path))
return true;
snprintf(url, sizeof(url), "%s/%s/%s.png", cdn_url, user_id, avatar_id);
net_http_urlencode_full(url_encoded, url, sizeof(url_encoded));
snprintf(buf, sizeof(buf), "%s.png", avatar_id);
transf = (file_transfer_t*)calloc(1, sizeof(*transf));
transf->enum_idx = MENU_ENUM_LABEL_CB_DISCORD_AVATAR;
strlcpy(transf->path, buf, sizeof(transf->path));
RARCH_LOG("[Discord] downloading avatar from: %s\n", url_encoded);
task_push_http_transfer(url_encoded, true, NULL, cb_generic_download, transf);
return false;
}
#endif
static void handle_discord_ready(const DiscordUser* connectedUser)
{
strlcpy(user_name, connectedUser->username, sizeof(user_name));
strlcpy(party_name, connectedUser->username, sizeof(user_name));
strlcat(party_name, "|", sizeof(party_name));
strlcat(party_name, connectedUser->discriminator, sizeof(party_name));
RARCH_LOG("[Discord] connected to user: %s#%s - avatar id: %s\n",
connectedUser->username,
connectedUser->discriminator,
connectedUser->userId);
#ifdef HAVE_MENU
discord_download_avatar(connectedUser->userId, connectedUser->avatar);
#endif
}
static void handle_discord_disconnected(int errcode, const char* message)
@ -68,24 +155,72 @@ static void handle_discord_error(int errcode, const char* message)
RARCH_LOG("[Discord] error (%d: %s)\n", errcode, message);
}
static void handle_discord_join_cb(void *task_data, void *user_data, const char *err)
{
struct netplay_room *room;
char tmp_hostname[32];
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
if (!data || err)
goto finish;
data->data = (char*)realloc(data->data, data->len + 1);
data->data[data->len] = '\0';
netplay_rooms_parse(data->data);
room = netplay_room_get(0);
if (room)
{
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
deinit_netplay();
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL);
snprintf(tmp_hostname, sizeof(tmp_hostname), "%s|%d",
room->host_method == NETPLAY_HOST_METHOD_MITM ? room->mitm_address : room->address,
room->host_method == NETPLAY_HOST_METHOD_MITM ? room->mitm_port : room->port);
RARCH_LOG("[Discord] joining lobby at: %s\n", tmp_hostname);
task_push_netplay_crc_scan(room->gamecrc,
room->gamename, tmp_hostname, room->corename);
}
finish:
if (err)
RARCH_ERR("%s: %s\n", msg_hash_to_str(MSG_DOWNLOAD_FAILED), err);
if (data)
{
if (data->data)
free(data->data);
free(data);
}
if (user_data)
free(user_data);
}
static void handle_discord_join(const char* secret)
{
RARCH_LOG("[Discord] join (%s)\n", secret);
char url [2048] = "http://lobby.libretro.com/";
char tmp_hostname[32];
static struct string_list *list = NULL;
RARCH_LOG("[Discord] join secret: (%s)\n", secret);
list = string_split(secret, "|");
char tmp_hostname[32];
strlcat(url, list->elems[0].data, sizeof(url));
strlcat(url, "/", sizeof(url));
RARCH_LOG("[Discord] querying lobby id: %s at %s\n", list->elems[0].data, url);
snprintf(tmp_hostname,
sizeof(tmp_hostname),
"%s|%s", list->elems[0].data, list->elems[1].data);
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
deinit_netplay();
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL);
task_push_netplay_crc_scan(atoi(list->elems[3].data),
list->elems[2].data,
tmp_hostname, list->elems[4].data);
task_push_http_transfer(url, true, NULL, handle_discord_join_cb, NULL);
}
static void handle_discord_spectate(const char* secret)
@ -93,14 +228,54 @@ static void handle_discord_spectate(const char* secret)
RARCH_LOG("[Discord] spectate (%s)\n", secret);
}
static void handle_discord_join_response(void *ignore, const char *line)
{
/* To-Do: needs in-game widgets
if (strstr(line, "yes"))
Discord_Respond(user_id, DISCORD_REPLY_YES);
#ifdef HAVE_MENU
menu_input_dialog_end();
rarch_menu_running_finished();
#endif
*/
}
static void handle_discord_join_request(const DiscordUser* request)
{
int response = -1;
char yn[4];
RARCH_LOG("[Discord] join request from %s#%s - %s\n",
static char url[PATH_MAX_LENGTH];
static char url_encoded[PATH_MAX_LENGTH];
static char filename[PATH_MAX_LENGTH];
char buf[PATH_MAX_LENGTH];
#ifdef HAVE_MENU
menu_input_ctx_line_t line;
#endif
RARCH_LOG("[Discord] join request from %s#%s - %s %s\n",
request->username,
request->discriminator,
request->userId);
request->userId,
request->avatar);
#ifdef HAVE_MENU
discord_download_avatar(request->userId, request->avatar);
/* To-Do: needs in-game widgets
rarch_menu_running();
*/
memset(&line, 0, sizeof(line));
snprintf(buf, sizeof(buf), "%s %s?", msg_hash_to_str(MSG_DISCORD_CONNECTION_REQUEST), request->username);
line.label = buf;
line.label_setting = "no_setting";
line.cb = handle_discord_join_response;
/* To-Do: needs in-game widgets
To-Do: bespoke dialog, should show while in-game and have a hotkey to accept
To-Do: show avatar of the user connecting
if (!menu_input_dialog_start(&line))
return;
*/
#endif
}
void discord_update(enum discord_presence presence)
@ -121,8 +296,8 @@ void discord_update(enum discord_presence presence)
switch (presence)
{
case DISCORD_PRESENCE_MENU:
discord_presence.details = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISCORD_IN_MENU);
discord_presence.largeImageKey = "base";
discord_presence.details = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISCORD_IN_MENU);
discord_presence.largeImageKey = "base";
discord_presence.largeImageText = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE);
discord_presence.instance = 0;
break;
@ -137,9 +312,9 @@ void discord_update(enum discord_presence presence)
case DISCORD_PRESENCE_GAME:
if (core_info)
{
const char *system_id = core_info->system_id ? core_info->system_id : "core";
char *label = NULL;
const char *system_id = core_info->system_id
? core_info->system_id : "core";
char *label = NULL;
playlist_t *current_playlist = playlist_get_cached();
if (current_playlist)
@ -164,13 +339,13 @@ void discord_update(enum discord_presence presence)
pause_time = 0;
ellapsed_time = 0;
discord_presence.smallImageKey = "playing";
discord_presence.smallImageKey = "playing";
discord_presence.smallImageText = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PLAYING);
discord_presence.startTimestamp = start_time;
discord_presence.details = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME);
discord_presence.details = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME);
discord_presence.state = label;
discord_presence.instance = 0;
discord_presence.state = label;
discord_presence.instance = 0;
}
break;
case DISCORD_PRESENCE_NETPLAY_HOSTING:
@ -183,19 +358,18 @@ void discord_update(enum discord_presence presence)
room->host_method == NETPLAY_HOST_METHOD_MITM ? room->mitm_address : room->address,
room->host_method == NETPLAY_HOST_METHOD_MITM ? room->mitm_port : room->port);
char party_id[128];
snprintf(party_id, sizeof(party_id), "%d|%s", room->id, room->nickname);
char join_secret[128];
snprintf(join_secret, sizeof(join_secret), "%s|%d|%s|%u|%s",
room->host_method == NETPLAY_HOST_METHOD_MITM ? room->mitm_address : room->address,
room->host_method == NETPLAY_HOST_METHOD_MITM ? room->mitm_port : room->port,
room->gamename, room->gamecrc, room->corename);
RARCH_LOG("%s\n", join_secret);
discord_presence.joinSecret = strdup(join_secret);
discord_presence.spectateSecret = "SPECSPECSPEC";
discord_presence.partyId = party_id;
discord_presence.partyMax = 0;
discord_presence.partySize = 0;
{
char join_secret[128];
snprintf(join_secret, sizeof(join_secret), "%d|%s", room->id, room->nickname);
discord_presence.joinSecret = strdup(join_secret);
/* discord_presence.spectateSecret = "SPECSPECSPEC"; */
discord_presence.partyId = strdup(party_name);
discord_presence.partyMax = 0;
discord_presence.partySize = 0;
RARCH_LOG("[Discord] join secret: %s\n", join_secret);
RARCH_LOG("[Discord] party id: %s\n", party_name);
}
break;
case DISCORD_PRESENCE_NETPLAY_HOSTING_STOPPED:
case DISCORD_PRESENCE_NETPLAY_CLIENT:
@ -212,7 +386,9 @@ void discord_update(enum discord_presence presence)
void discord_init(void)
{
char command[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
DiscordEventHandlers handlers;
RARCH_LOG("[Discord] initializing ..\n");
@ -226,13 +402,13 @@ void discord_init(void)
handlers.spectateGame = handle_discord_spectate;
handlers.joinRequest = handle_discord_join_request;
/* To-Do: Add the arguments RetroArch was started with to the register URI*/
const char command[256] = "retroarch";
Discord_Initialize(settings->arrays.discord_app_id, &handlers, 0, NULL);
Discord_Register(settings->arrays.discord_app_id, NULL);
discord_ready = true;
strlcpy(command, get_retroarch_launch_arguments(), sizeof(command));
RARCH_LOG("[Discord] registering startup command: %s\n", command);
Discord_Register(settings->arrays.discord_app_id, command);
discord_ready = true;
}
void discord_shutdown(void)
@ -243,7 +419,7 @@ void discord_shutdown(void)
discord_ready = false;
}
void discord_run_callbacks()
void discord_run_callbacks(void)
{
Discord_RunCallbacks();
}
}

View File

@ -55,4 +55,14 @@ void discord_update(enum discord_presence presence);
void discord_run_callbacks();
bool discord_is_ready();
void discord_avatar_set_ready(bool ready);
bool discord_avatar_is_ready();
char* discord_get_own_username(void);
char* discord_get_own_avatar(void);
#endif /* __RARCH_DISCORD_H */

View File

@ -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

View File

@ -35,6 +35,7 @@
#include "wifi/wifi_driver.h"
#include "led/led_driver.h"
#include "midi/midi_driver.h"
#include "command.h"
#include "configuration.h"
#include "core_info.h"
#include "driver.h"
@ -385,6 +386,10 @@ void drivers_init(int flags)
if (flags & DRIVER_MENU_MASK)
menu_driver_init(video_is_threaded);
}
#else
/* Qt uses core info, even if the menu is disabled */
command_event(CMD_EVENT_CORE_INFO_INIT, NULL);
command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL);
#endif
if (flags & (DRIVER_VIDEO_MASK | DRIVER_AUDIO_MASK))
@ -403,7 +408,6 @@ void drivers_init(int flags)
midi_driver_init();
}
/**
* uninit_drivers:
* @flags : Bitmask of drivers to deinitialize.

View File

@ -108,6 +108,10 @@ static dylib_t lib_handle;
#define SYMBOL_VIDEOPROCESSOR(x) current_core->x = libretro_videoprocessor_##x
#endif
#ifdef HAVE_EASTEREGG
#define SYMBOL_GONG(x) current_core->x = libretro_gong_##x
#endif
static bool ignore_environment_cb = false;
static bool core_set_shared_context = false;
static bool *load_no_content_hook = NULL;
@ -173,7 +177,6 @@ void libretro_free_system_info(struct retro_system_info *info)
memset(info, 0, sizeof(*info));
}
static bool environ_cb_get_system_info(unsigned cmd, void *data)
{
rarch_system_info_t *system = runloop_get_system_info();
@ -236,7 +239,6 @@ static bool environ_cb_get_system_info(unsigned cmd, void *data)
subsystem_data[i].roms = subsystem_data_roms[i];
}
subsystem_current_count = size <= SUBSYSTEM_MAX_SUBSYSTEMS ? size : SUBSYSTEM_MAX_SUBSYSTEMS;
#if 0
RARCH_LOG("Subsystems: %d\n", subsystem_current_count);
@ -306,6 +308,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 +324,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)))
{
@ -773,6 +779,43 @@ bool init_libretro_sym_custom(enum rarch_core_type type, struct retro_core_t *cu
SYMBOL_VIDEOPROCESSOR(retro_get_region);
SYMBOL_VIDEOPROCESSOR(retro_get_memory_data);
SYMBOL_VIDEOPROCESSOR(retro_get_memory_size);
#endif
break;
case CORE_TYPE_GONG:
#ifdef HAVE_EASTEREGG
SYMBOL_GONG(retro_init);
SYMBOL_GONG(retro_deinit);
SYMBOL_GONG(retro_api_version);
SYMBOL_GONG(retro_get_system_info);
SYMBOL_GONG(retro_get_system_av_info);
SYMBOL_GONG(retro_set_environment);
SYMBOL_GONG(retro_set_video_refresh);
SYMBOL_GONG(retro_set_audio_sample);
SYMBOL_GONG(retro_set_audio_sample_batch);
SYMBOL_GONG(retro_set_input_poll);
SYMBOL_GONG(retro_set_input_state);
SYMBOL_GONG(retro_set_controller_port_device);
SYMBOL_GONG(retro_reset);
SYMBOL_GONG(retro_run);
SYMBOL_GONG(retro_serialize_size);
SYMBOL_GONG(retro_serialize);
SYMBOL_GONG(retro_unserialize);
SYMBOL_GONG(retro_cheat_reset);
SYMBOL_GONG(retro_cheat_set);
SYMBOL_GONG(retro_load_game);
SYMBOL_GONG(retro_load_game_special);
SYMBOL_GONG(retro_unload_game);
SYMBOL_GONG(retro_get_region);
SYMBOL_GONG(retro_get_memory_data);
SYMBOL_GONG(retro_get_memory_size);
#endif
break;
}
@ -1468,8 +1511,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));

View File

@ -338,6 +338,31 @@ void fill_pathname_application_special(char *s,
}
#endif
break;
case APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_DISCORD_AVATARS:
{
char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
char *s2 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
settings_t *settings = config_get_ptr();
s1[0] = s2[0] = '\0';
fill_pathname_join(s1,
settings->paths.directory_thumbnails,
"discord",
len);
fill_pathname_join(s2,
s1, "avatars",
PATH_MAX_LENGTH * sizeof(char)
);
fill_pathname_slash(s2,
PATH_MAX_LENGTH * sizeof(char)
);
strlcpy(s, s2, len);
free(s1);
free(s2);
}
break;
case APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_CHEEVOS_BADGES:
{
char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));

View File

@ -111,7 +111,8 @@ enum application_special_type
APPLICATION_SPECIAL_DIRECTORY_ASSETS_ZARCH,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_ZARCH_FONT,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_ZARCH_ICONS,
APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_CHEEVOS_BADGES
APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_CHEEVOS_BADGES,
APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_DISCORD_AVATARS
};
/**

View File

@ -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;

View File

@ -73,6 +73,28 @@ 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)
{
@ -212,7 +234,6 @@ static void frontend_orbis_shutdown(bool unused)
return;
}
static void frontend_orbis_init(void *data)
{

View File

@ -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,13 +20,11 @@
#include <loadfile.h>
#include <unistd.h>
#include <sbv_patches.h>
#include <fileXio_rpc.h>
#include <audsrv.h>
#include <sifrpc.h>
#include <iopcontrol.h>
#include <libpwroff.h>
#include <SDL/SDL.h>
#include <audsrv.h>
#include <libpad.h>
enum BootDeviceIDs{
BOOT_DEVICE_UNKNOWN = -1,
@ -74,6 +71,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 +84,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 +138,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 +193,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 +232,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 +254,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 +332,49 @@ 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();
/* Initializes audsrv library */
if (audsrv_init()) {
RARCH_ERR("audsrv library not initalizated\n");
}
SDL_Init(SDL_INIT_TIMER);
/* Initializes pad library
Must be init with 0 as parameter*/
if (padInit(0) != 1) {
RARCH_ERR("padInit 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)
@ -344,6 +387,10 @@ static void frontend_ps2_deinit(void *data)
#endif
#endif
padEnd();
audsrv_quit();
fileXioUmount("pfs0:");
fileXioExit();
@ -369,7 +416,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 +473,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 +516,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);

View File

@ -656,7 +656,6 @@ static void frontend_switch_shutdown(bool unused)
/* runloop_get_system_info isnt initialized that early.. */
extern void retro_get_system_info(struct retro_system_info *info);
static void frontend_switch_init(void *data)
{

View File

@ -1824,7 +1824,6 @@ static void frontend_unix_get_env(int *argc,
else if (strstr(device_model, "JSS15J"))
g_defaults.settings.video_refresh_rate = 59.65;
/* For gamepad-like/console devices:
*
* - Explicitly disable input overlay by default

View File

@ -104,7 +104,6 @@ struct android_app
* receive user input events. */
AInputQueue* inputQueue;
/* When non-NULL, this is the window surface that the app can draw in. */
ANativeWindow* window;
@ -165,7 +164,6 @@ struct android_app
jmethodID setSustainedPerformanceMode;
};
enum
{
LOOPER_ID_MAIN = 1,

View File

@ -0,0 +1,418 @@
/* 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 <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <retro_miscellaneous.h>
#include <windows.h>
#include <boolean.h>
#include <compat/strl.h>
#include <dynamic/dylib.h>
#include <lists/file_list.h>
#include <file/file_path.h>
#include <string/stdstring.h>
#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"
};

View File

@ -133,7 +133,6 @@ static void frontend_wiiu_init(void *data)
DEBUG_LINE();
}
static int frontend_wiiu_get_rating(void)
{
return 10;
@ -168,7 +167,6 @@ static int frontend_wiiu_parse_drive_list(void *data, bool load_content)
return 0;
}
static void frontend_wiiu_exec(const char *path, bool should_load_game)
{
@ -269,7 +267,6 @@ static void frontend_wiiu_exitspawn(char *s, size_t len)
frontend_wiiu_exec(s, should_load_game);
}
frontend_ctx_driver_t frontend_ctx_wiiu =
{
frontend_wiiu_get_environment_settings,

View File

@ -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)
{
@ -189,7 +191,6 @@ static void frontend_win32_get_os(char *s, size_t len, int *major, int *minor)
GetVersionEx(&vi);
#endif
if (major)
*major = vi.dwMajorVersion;
@ -245,10 +246,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 +304,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 +388,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 +509,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 +549,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 +557,6 @@ static void frontend_win32_detach_console(void)
FreeConsole();
console_needs_free = false;
}
#endif
#endif
}

View File

@ -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

View File

@ -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;

View File

@ -162,7 +162,7 @@ static void salamander_init(char *s, size_t len)
if (conf)
{
config_set_string(conf, "libretro_path", s);
config_file_write(conf, g_defaults.path.config);
config_file_write(conf, g_defaults.path.config, true);
config_file_free(conf);
}
}

View File

@ -138,5 +138,4 @@ static INLINE void ctr_set_scale_vector(ctr_scale_vector_t* vec,
vec->v = -1.0 / texture_height;
}
#endif // CTR_COMMON_H__

View File

@ -20,7 +20,7 @@
#include "d3d10_common.h"
#include "d3dcompiler_common.h"
#ifdef HAVE_DYNAMIC
#if defined(HAVE_DYNAMIC) && !defined(__WINRT__)
#include <dynamic/dylib.h>
typedef HRESULT(WINAPI* PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN)(

View File

@ -54,7 +54,6 @@ typedef ID3D10Debug* D3D10Debug;
typedef ID3D10SwitchToRef* D3D10SwitchToRef;
typedef ID3D10InfoQueue* D3D10InfoQueue;
#if !defined(__cplusplus) || defined(CINTERFACE)
static INLINE void D3D10SetResourceEvictionPriority(D3D10Resource resource, UINT eviction_priority)
{

View File

@ -20,9 +20,42 @@
#include "d3d11_common.h"
#include "d3dcompiler_common.h"
#ifdef HAVE_DYNAMIC
#if defined(HAVE_DYNAMIC) && !defined(__WINRT__)
#include <dynamic/dylib.h>
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,

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -75,7 +75,6 @@ typedef HRESULT (__stdcall
LPD3DXFONT* ppFont);
#endif
#ifdef HAVE_D3DX
static D3DXCreateFontIndirect_t D3DCreateFontIndirect;
static D3DCreateTextureFromFile_t D3DCreateTextureFromFile;

View File

@ -99,7 +99,6 @@ typedef HRESULT (__stdcall
LPD3DXFONT* ppFont);
#endif
#ifdef HAVE_D3DX
static D3D9XCreateFontIndirect_t D3D9CreateFontIndirect;
static D3D9CreateTextureFromFile_t D3D9CreateTextureFromFile;

Some files were not shown because too many files have changed in this diff Show More