mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
Merge branch 'master' into WiiSkipCrc
This commit is contained in:
commit
79b5a05aeb
1
.github/PULL_REQUEST_TEMPLATE.md
vendored
1
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -4,7 +4,6 @@
|
||||
2. If you are sending several unrelated fixes or features, use a branch and a separate pull request for each
|
||||
3. If possible try squashing everything in a single commit. This is particularly beneficial in the case of feature merges since it allows easy bisecting when a problem arises
|
||||
|
||||
|
||||
## Description
|
||||
|
||||
[Description of the pull request, detail any issues you are fixing or any features you are implementing]
|
||||
|
7
.gitignore
vendored
7
.gitignore
vendored
@ -11,6 +11,8 @@
|
||||
.tmp
|
||||
.tmp.c
|
||||
.tmp.cxx
|
||||
.moc.h
|
||||
.moc.cpp
|
||||
config.log
|
||||
/.project
|
||||
/.externalToolBuilders/
|
||||
@ -53,7 +55,6 @@ DerivedData
|
||||
apple/tmp
|
||||
apple/*.mobileprovision
|
||||
apple/RetroArch_iOS.xcodeproj/project.xcworkspace/*
|
||||
menu/driverspzarch.c
|
||||
/Cg/
|
||||
/GL/
|
||||
/SDL/
|
||||
@ -74,6 +75,8 @@ libretro-super
|
||||
run.sh
|
||||
convert_rumble.awk
|
||||
*~
|
||||
assets
|
||||
info
|
||||
|
||||
# Wii U
|
||||
*.depend
|
||||
@ -85,7 +88,6 @@ wiiu/wut/elf2rpl/elf2rpl
|
||||
/pkg/wiiu/rpx
|
||||
/wiiu-devel.properties
|
||||
|
||||
|
||||
# 3ds
|
||||
/.lst
|
||||
*.3dsx
|
||||
@ -119,7 +121,6 @@ wiiu/wut/elf2rpl/elf2rpl
|
||||
/media/libretrodb/
|
||||
|
||||
pkg/apple/iOS/build/
|
||||
pkg/apple/iOS/modules/
|
||||
pkg/apple/build/
|
||||
ui/drivers/qt/moc_*
|
||||
ui/drivers/moc_*
|
||||
|
56
.travis.yml
56
.travis.yml
@ -10,7 +10,9 @@ matrix:
|
||||
- g++-mingw-w64-i686
|
||||
- mingw-w64-i686-dev
|
||||
script:
|
||||
- CROSS_COMPILE=i686-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501" ./configure --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 && make HAVE_ZLIB=1 HAVE_BUILTINZLIB=1 HAVE_RPNG=1
|
||||
- ./configure --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 --enable-builtinzlib
|
||||
- make
|
||||
env: CROSS_COMPILE=i686-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501"
|
||||
- compiler: mingw-x64
|
||||
addons:
|
||||
apt:
|
||||
@ -18,41 +20,33 @@ matrix:
|
||||
- g++-mingw-w64-x86-64
|
||||
- mingw-w64-x86-64-dev
|
||||
script:
|
||||
- CROSS_COMPILE=x86_64-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501" ./configure --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 && make HAVE_ZLIB=1 HAVE_BUILTINZLIB=1 HAVE_RPNG=1
|
||||
- ./configure --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 --enable-builtinzlib
|
||||
- make
|
||||
env: CROSS_COMPILE=x86_64-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501"
|
||||
- compiler: gcc
|
||||
addons:
|
||||
# Install a more recent gcc than the default
|
||||
apt:
|
||||
packages:
|
||||
- g++-7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
before_install:
|
||||
- sudo apt-get install -y g++-8
|
||||
env: CC=gcc-8 CXX=g++-8
|
||||
- compiler: clang
|
||||
addons:
|
||||
# Install a more recent clang than the default
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
packages:
|
||||
- clang-3.8
|
||||
env: COMPILER_NAME=clang-3.8 CXX=clang++-3.8 CC=clang-3.8
|
||||
before_install:
|
||||
- sudo apt-get install -y libstdc++-7-dev
|
||||
- sudo apt-get install -y clang-6.0
|
||||
env: CC=clang-6.0 CXX=clang++-6.0
|
||||
- os: osx
|
||||
osx_image: xcode8
|
||||
script:
|
||||
- xcodebuild -target RetroArch -configuration Release -project pkg/apple/RetroArch.xcodeproj
|
||||
- os: osx
|
||||
osx_image: xcode9.3
|
||||
osx_image: xcode10.1
|
||||
script:
|
||||
- cd ~/
|
||||
- brew install --force-bottle qt5
|
||||
- git clone --depth=50 https://github.com/libretro/libretro-super
|
||||
- cd libretro-super/travis
|
||||
- ./build-retroarch-metal.sh
|
||||
- xcodebuild -target RetroArchQt -configuration Release -project pkg/apple/RetroArch_Metal.xcodeproj
|
||||
deploy:
|
||||
skip_cleanup: true
|
||||
provider: script
|
||||
script: cd ../retroarch; bash travis_metal_deploy.sh
|
||||
script: bash travis_metal_deploy.sh
|
||||
on:
|
||||
branch: master
|
||||
|
||||
@ -67,19 +61,13 @@ env:
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- curl
|
||||
- pkg-config
|
||||
- libglu1-mesa-dev
|
||||
- freeglut3-dev
|
||||
- mesa-common-dev
|
||||
- libsdl1.2-dev
|
||||
- libsdl-image1.2-dev
|
||||
- libsdl-mixer1.2-dev
|
||||
- libsdl-ttf2.0-dev
|
||||
- libsdl2-dev
|
||||
- libusb-1.0-0-dev
|
||||
- qt5-default
|
||||
- qt5-qmake
|
||||
- qtbase5-dev-tools
|
||||
- qtbase5-dev
|
||||
- qtdeclarative5-dev
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-6.0
|
||||
coverity_scan:
|
||||
project:
|
||||
name: "RetroArch"
|
||||
|
49
CHANGES.md
49
CHANGES.md
@ -1,13 +1,27 @@
|
||||
# 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
|
||||
# 1.7.7 (future)
|
||||
|
||||
# 1.7.6
|
||||
- ANDROID: Fix Xperia Play input binding.
|
||||
- CHEEVOS: Reset when hardcore mode is toggled.
|
||||
- CHEEVOS: Update the hashing methods to identify NES, SNES and Lynx games (more accurate and accepting headerless ROMs).
|
||||
- COMMON: Add new JSON playlist format.
|
||||
- COMMON: Fix playlist corruption when deleting items.
|
||||
- COMMON: Fix archive progress display calculation.
|
||||
- COMMON: Fix playlist entries appearing with previously used names.
|
||||
- COMMON: Fix screenshot filename with no core or content.
|
||||
- COMMON: Allow compiling without menu support.
|
||||
- CORE UPDATER: Allow sideloading cores from the menu.
|
||||
- CPU FILTERS: Add Normal2x filter.
|
||||
- CRT/LINUX: New Linux switching method partially implemented.
|
||||
- CRT/LINUX: Linux restore desktop resolution fixed.
|
||||
- CRT/LINUX: Monitor index switching and auto enumerate for output detection in Linux (still working on the windows method).
|
||||
- CRT/RASPBERRY PI: Initial support.
|
||||
- DATE: Add Date / Time style options.
|
||||
- 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: Fix arrow keys being incorrectly bound as numpad keys
|
||||
- INPUT/SDL: Flush the joypad events. Decreases cpu usage over time with the SDL joypad driver.
|
||||
- LOCALIZATION: Add Greek translation.
|
||||
- LOCALIZATION: Update German translation.
|
||||
@ -15,10 +29,24 @@
|
||||
- LOCALIZATION: Update Japanese translation.
|
||||
- LOCALIZATION: Update Simplified Chinese translation.
|
||||
- LOCALIZATION: Update Spanish translation.
|
||||
- MENU: New "ozone" menu driver.
|
||||
- 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.
|
||||
- MENU: Add option to enable in-menu sound effects.
|
||||
- MENU/D3D: Scissoring support (will be used for Ozone and menu widgets).
|
||||
- MENU/QT/WIMP: Allow building with MSVC2017.
|
||||
- MENU/QT/WIMP: Add detailed file browser table.
|
||||
- MENU/QT/WIMP: New grid view implementation that is faster and loads thumbnails on-demand.
|
||||
- MENU/QT/WIMP: Thumbnail drag and drop support.
|
||||
- MENU/RGUI: Overhaul custom theme interface + add wallpaper support.
|
||||
- MENU/RGUI: Thumbnail support and thumbnail downscaling.
|
||||
- MENU: Hide password values.
|
||||
- MENU/SOUNDS: Implement in-menu sound effects (not enabled by default for now, still experimental).
|
||||
- MIDI: Add a Linux ALSA driver for MIDI.
|
||||
- NETPLAY: Force fast-save-states when netlay is enabled
|
||||
- NETPLAY: Force fast-save-states when netplay is enabled.
|
||||
- NETPLAY: Allow quick joining subsystem lobbies.
|
||||
- OSX: Initial CoreAudio V3 audio driver (not yet used in release builds).
|
||||
- OSX: OpenGL 3.2 Core support for cores.
|
||||
- PS2: Initial PlayStation2 port.
|
||||
- PS4: Initial PlayStation4 port.
|
||||
- RECORDING: Implement recording options in the menu complete with quality profiles, streaming, and proper file naming
|
||||
@ -29,17 +57,24 @@
|
||||
- SUBSYSTEM: Remember the last used folder to make loading subsystem type content faster
|
||||
- SWITCH/LIBNX: Improve touch scaling calculation.
|
||||
- SWITCH: Proper button labels.
|
||||
- TVOS: Initial tvOS port.
|
||||
- VULKAN: Fix RGUI crashing at startup.
|
||||
- VULKAN/RGUI: Enable 'Menu Linear Filter' option.
|
||||
- VULKAN: Fix secondary screens in overlays not working.
|
||||
- WAYLAND: Implement idle-inhibit support (needed for screensaver suspend).
|
||||
- WAYLAND: Fix fullscreen toggle.
|
||||
- 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: 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.
|
||||
- WINDOWS: Fall back to GDI driver if no accelerated graphics driver is found.
|
||||
- UWP: Initial UWP port.
|
||||
- VFS: Update to version 3.
|
||||
- XBONE: Initial Xbox One port.
|
||||
- XMB/OZONE: Add more icons
|
||||
- XMB: Add Automatic Inverted theme
|
||||
- ???: Easter Egg
|
||||
|
||||
# 1.7.5
|
||||
- CAMERA: Fix Video4Linux2 driver that broke years ago.
|
||||
|
9
Makefile
9
Makefile
@ -19,6 +19,7 @@ TARGET = retroarch
|
||||
OBJ :=
|
||||
LIBS :=
|
||||
DEF_FLAGS :=
|
||||
ASFLAGS :=
|
||||
DEFINES := -DHAVE_CONFIG_H -DRARCH_INTERNAL -D_FILE_OFFSET_BITS=64
|
||||
DEFINES += -DGLOBAL_CONFIG_DIR='"$(GLOBAL_CONFIG_DIR)"'
|
||||
|
||||
@ -171,7 +172,7 @@ all: $(TARGET) config.mk
|
||||
$(MOC_SRC):
|
||||
@$(if $(Q), $(shell echo echo MOC $<),)
|
||||
$(eval MOC_TMP := $(patsubst %.h,%_moc.cpp,$@))
|
||||
$(Q)$(MOC) -o $(MOC_TMP) $<
|
||||
$(Q)QT_SELECT=$(QT_VERSION) $(MOC) -o $(MOC_TMP) $<
|
||||
|
||||
$(foreach x,$(join $(addsuffix :,$(MOC_SRC)),$(MOC_HEADERS)),$(eval $x))
|
||||
|
||||
@ -253,15 +254,9 @@ install: $(TARGET)
|
||||
@if test -d media/assets && test $(HAVE_ASSETS); then \
|
||||
echo "Installing media assets..."; \
|
||||
mkdir -p $(DESTDIR)$(ASSETS_DIR)/assets; \
|
||||
if test $(HAVE_ZARCH) = 1; then \
|
||||
cp -r media/assets/zarch/ $(DESTDIR)$(ASSETS_DIR)/assets; \
|
||||
fi; \
|
||||
if test $(HAVE_MATERIALUI) = 1; then \
|
||||
cp -r media/assets/glui/ $(DESTDIR)$(ASSETS_DIR)/assets; \
|
||||
fi; \
|
||||
if test $(HAVE_NUKLEAR) = 1; then \
|
||||
cp -r media/assets/nuklear/ $(DESTDIR)$(ASSETS_DIR)/assets; \
|
||||
fi; \
|
||||
if test $(HAVE_XMB) = 1; then \
|
||||
cp -r media/assets/xmb/ $(DESTDIR)$(ASSETS_DIR)/assets; \
|
||||
fi; \
|
||||
|
147
Makefile.common
147
Makefile.common
@ -27,10 +27,6 @@ ifeq ($(HAVE_LIBRETRODB),)
|
||||
HAVE_LIBRETRODB = 1
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_VIDEO_PROCESSOR), 1)
|
||||
DEFINES += -DHAVE_VIDEO_PROCESSOR
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SOCKET_LEGACY), 1)
|
||||
DEFINES += -DHAVE_SOCKET_LEGACY
|
||||
endif
|
||||
@ -67,8 +63,14 @@ ifeq ($(VULKAN_DEBUG), 1)
|
||||
DEF_FLAGS += -DVULKAN_DEBUG
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_HARD_FLOAT), 1)
|
||||
DEFINES += -mfloat-abi=hard
|
||||
ifeq ($(HAVE_FLOATHARD), 1)
|
||||
DEF_FLAGS += $(FLOATHARD_CFLAGS)
|
||||
ASFLAGS += $(FLOATHARD_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FLOATSOFTFP), 1)
|
||||
DEF_FLAGS += $(FLOATSOFTFP_CFLAGS)
|
||||
ASFLAGS += $(FLOATSOFTFP_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(TDM_GCC),)
|
||||
@ -233,7 +235,6 @@ OBJ += frontend/frontend.o \
|
||||
tasks/task_screenshot.o \
|
||||
tasks/task_powerstate.o \
|
||||
$(LIBRETRO_COMM_DIR)/gfx/scaler/scaler.o \
|
||||
gfx/drivers_shader/shader_null.o \
|
||||
gfx/video_shader_parse.o \
|
||||
$(LIBRETRO_COMM_DIR)/gfx/scaler/pixconv.o \
|
||||
$(LIBRETRO_COMM_DIR)/gfx/scaler/scaler_int.o \
|
||||
@ -343,7 +344,7 @@ ifeq ($(HAVE_QT), 1)
|
||||
ui/drivers/qt/coreinfodialog.o \
|
||||
ui/drivers/qt/playlistentrydialog.o \
|
||||
ui/drivers/qt/viewoptionsdialog.o \
|
||||
ui/drivers/qt/playlist.o \
|
||||
ui/drivers/qt/qt_playlist.o \
|
||||
ui/drivers/qt/updateretroarch.o \
|
||||
ui/drivers/qt/thumbnaildownload.o \
|
||||
ui/drivers/qt/thumbnailpackdownload.o \
|
||||
@ -374,6 +375,10 @@ ifeq ($(HAVE_SSA),1)
|
||||
LIBS += $(SSA_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SSE),1)
|
||||
DEF_FLAGS += $(SSE_LIBS)
|
||||
endif
|
||||
|
||||
# LibretroDB
|
||||
|
||||
ifeq ($(HAVE_LIBRETRODB), 1)
|
||||
@ -506,6 +511,15 @@ endif
|
||||
|
||||
ifeq ($(HAVE_COREAUDIO), 1)
|
||||
OBJ += audio/drivers/coreaudio.o
|
||||
HAVE_COREAUDIO_LIBS = 1
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_COREAUDIO3), 1)
|
||||
OBJ += audio/drivers/coreaudio3.o
|
||||
HAVE_COREAUDIO_LIBS = 1
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_COREAUDIO_LIBS), 1)
|
||||
LIBS += -framework CoreServices -framework CoreAudio -framework AudioUnit
|
||||
endif
|
||||
|
||||
@ -625,7 +639,10 @@ ifeq ($(HAVE_NEON),1)
|
||||
OBJ += $(LIBRETRO_COMM_DIR)/audio/resampler/drivers/sinc_resampler_neon.o \
|
||||
audio/drivers_resampler/cc_resampler_neon.o \
|
||||
memory/neon/memcpy-neon.o
|
||||
|
||||
DEFINES += -DHAVE_NEON
|
||||
ASFLAGS += $(NEON_ASFLAGS)
|
||||
DEF_FLAGS += $(NEON_CFLAGS)
|
||||
endif
|
||||
|
||||
OBJ += $(LIBRETRO_COMM_DIR)/audio/conversion/s16_to_float.o \
|
||||
@ -651,10 +668,6 @@ endif
|
||||
|
||||
# XMB and MaterialUI are always enabled if supported and not explicitly disabled
|
||||
ifeq ($(HW_CONTEXT_MENU_DRIVERS), 1)
|
||||
ifeq ($(HAVE_ZARCH),)
|
||||
HAVE_ZARCH = 0
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RGUI),)
|
||||
HAVE_RGUI = 1
|
||||
endif
|
||||
@ -663,10 +676,6 @@ ifeq ($(HW_CONTEXT_MENU_DRIVERS), 1)
|
||||
HAVE_MATERIALUI = 1
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_NUKLEAR),)
|
||||
HAVE_NUKLEAR = 0
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_XMB),)
|
||||
HAVE_XMB = 1
|
||||
endif
|
||||
@ -679,10 +688,8 @@ ifeq ($(HW_CONTEXT_MENU_DRIVERS), 1)
|
||||
HAVE_OZONE = 1
|
||||
endif
|
||||
else
|
||||
HAVE_ZARCH ?= 0
|
||||
HAVE_RGUI ?= 0
|
||||
HAVE_MATERIALUI ?= 0
|
||||
HAVE_NUKLEAR ?= 0
|
||||
HAVE_XMB ?= 0
|
||||
HAVE_STRIPES ?= 0
|
||||
HAVE_OZONE ?= 0
|
||||
@ -703,21 +710,6 @@ ifeq ($(HAVE_MENU), 1)
|
||||
HAVE_ASSETS = 1
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_NUKLEAR), 1)
|
||||
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
|
||||
|
||||
ifeq ($(HAVE_XMB), 1)
|
||||
OBJ += menu/drivers/xmb.o
|
||||
DEFINES += -DHAVE_XMB
|
||||
@ -1061,9 +1053,7 @@ endif
|
||||
ifeq ($(HAVE_GL_CONTEXT), 1)
|
||||
DEFINES += -DHAVE_OPENGL -DHAVE_GLSL
|
||||
OBJ += gfx/drivers/gl.o \
|
||||
gfx/drivers_renderchain/gl2_renderchain.o \
|
||||
$(LIBRETRO_COMM_DIR)/gfx/gl_capabilities.o \
|
||||
gfx/common/gl_common.o \
|
||||
gfx/drivers_font/gl_raster_font.o \
|
||||
$(LIBRETRO_COMM_DIR)/glsym/rglgen.o
|
||||
|
||||
@ -1160,7 +1150,6 @@ ifeq ($(HAVE_GL_CONTEXT), 1)
|
||||
endif
|
||||
|
||||
OBJ += gfx/drivers_shader/shader_glsl.o
|
||||
DEFINES += -DHAVE_GLSL
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_EGL), 1)
|
||||
@ -1170,26 +1159,19 @@ ifeq ($(HAVE_EGL), 1)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SDL2), 1)
|
||||
HAVE_SDL=0
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SDL), 1)
|
||||
OBJ += gfx/drivers/sdl_gfx.o \
|
||||
input/drivers/sdl_input.o \
|
||||
input/drivers_joypad/sdl_joypad.o \
|
||||
audio/drivers/sdl_audio.o
|
||||
|
||||
ifeq ($(HAVE_GL_CONTEXT), 1)
|
||||
OBJ += gfx/drivers_context/sdl_gl_ctx.o
|
||||
endif
|
||||
|
||||
DEFINES += $(SDL_CFLAGS) $(BSD_LOCAL_INC)
|
||||
HAVE_SDL_COMMON = 1
|
||||
OBJ += gfx/drivers/sdl2_gfx.o
|
||||
DEFINES += $(SDL2_CFLAGS)
|
||||
LIBS += $(SDL2_LIBS)
|
||||
else ifeq ($(HAVE_SDL), 1)
|
||||
HAVE_SDL_COMMON = 1
|
||||
OBJ += gfx/drivers/sdl_gfx.o
|
||||
DEFINES += $(SDL_CFLAGS)
|
||||
LIBS += $(SDL_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SDL2), 1)
|
||||
OBJ += gfx/drivers/sdl2_gfx.o \
|
||||
input/drivers/sdl_input.o \
|
||||
ifeq ($(HAVE_SDL_COMMON), 1)
|
||||
OBJ += input/drivers/sdl_input.o \
|
||||
input/drivers_joypad/sdl_joypad.o \
|
||||
audio/drivers/sdl_audio.o
|
||||
|
||||
@ -1197,9 +1179,7 @@ ifeq ($(HAVE_SDL2), 1)
|
||||
OBJ += gfx/drivers_context/sdl_gl_ctx.o
|
||||
endif
|
||||
|
||||
DEFINES += $(SDL2_CFLAGS) $(BSD_LOCAL_INC)
|
||||
LIBS += $(SDL2_LIBS)
|
||||
HAVE_SDL = 0
|
||||
DEFINES += $(BSD_LOCAL_INC)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_XSHM), 1)
|
||||
@ -1254,8 +1234,6 @@ endif
|
||||
ifeq ($(HAVE_DISPMANX), 1)
|
||||
OBJ += gfx/drivers/dispmanx_gfx.o
|
||||
HAVE_VIDEOCORE = 1
|
||||
LIBS += $(DISPMANX_LIBS)
|
||||
DEFINES += $(DISPMANX_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SUNXI), 1)
|
||||
@ -1547,8 +1525,6 @@ ifeq ($(HAVE_ZLIB), 1)
|
||||
else
|
||||
LIBS += $(ZLIB_LIBS)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_CHD), 1)
|
||||
DEF_FLAGS += -I$(LIBRETRO_COMM_DIR)/formats/libchdr
|
||||
DEFINES += -DHAVE_CHD -DWANT_SUBCODE -DWANT_RAW_DATA_SECTOR
|
||||
@ -1558,18 +1534,15 @@ ifeq ($(HAVE_CHD), 1)
|
||||
$(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_huffman.o \
|
||||
$(LIBRETRO_COMM_DIR)/streams/chd_stream.o
|
||||
|
||||
ifeq ($(HAVE_FLAC), 1)
|
||||
OBJ += $(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_zlib.o
|
||||
ifeq ($(HAVE_FLAC),1)
|
||||
OBJ += $(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_flac.o \
|
||||
$(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_flac_codec.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_7ZIP), 1)
|
||||
OBJ += $(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_lzma.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_ZLIB), 1)
|
||||
OBJ += $(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_zlib.o
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RTGA), 1)
|
||||
@ -1612,7 +1585,8 @@ endif
|
||||
|
||||
ifeq ($(HAVE_V4L2),1)
|
||||
OBJ += camera/drivers/video4linux2.o
|
||||
ifeq ($(HAVE_VIDEO_PROCESSOR),1)
|
||||
ifeq ($(HAVE_VIDEOPROCESSOR),1)
|
||||
DEFINES += -DHAVE_VIDEOPROCESSOR
|
||||
OBJ += cores/libretro-video-processor/video_processor_v4l2.o
|
||||
endif
|
||||
DEFINES += -DHAVE_V4L2
|
||||
@ -1665,14 +1639,30 @@ ifeq ($(HAVE_NETWORKING), 1)
|
||||
network/netplay/netplay_buf.o \
|
||||
network/netplay/netplay_room_parse.o
|
||||
|
||||
# Retro Achievements
|
||||
# RetroAchievements
|
||||
ifeq ($(HAVE_CHEEVOS), 1)
|
||||
DEFINES += -DHAVE_CHEEVOS
|
||||
|
||||
OBJ += cheevos/cheevos.o \
|
||||
cheevos/badges.o \
|
||||
cheevos/var.o \
|
||||
cheevos/cond.o
|
||||
ifeq ($(HAVE_NEW_CHEEVOS), 1)
|
||||
DEFINES += -DHAVE_NEW_CHEEVOS \
|
||||
-Ideps/rcheevos/include \
|
||||
-Ideps/lua/src
|
||||
OBJ += cheevos-new/cheevos.o \
|
||||
cheevos-new/badges.o \
|
||||
cheevos-new/fixup.o \
|
||||
cheevos-new/parser.o \
|
||||
cheevos-new/hash.o \
|
||||
deps/rcheevos/src/rcheevos/trigger.o \
|
||||
deps/rcheevos/src/rcheevos/condset.o \
|
||||
deps/rcheevos/src/rcheevos/condition.o \
|
||||
deps/rcheevos/src/rcheevos/operand.o \
|
||||
deps/rcheevos/src/rcheevos/term.o \
|
||||
deps/rcheevos/src/rcheevos/expression.o \
|
||||
deps/rcheevos/src/rcheevos/value.o \
|
||||
deps/rcheevos/src/rcheevos/lboard.o \
|
||||
deps/rcheevos/src/rcheevos/alloc.o \
|
||||
deps/rcheevos/src/rcheevos/format.o \
|
||||
deps/rcheevos/src/rurl/url.o
|
||||
|
||||
ifeq ($(HAVE_LUA), 1)
|
||||
DEFINES += -DHAVE_LUA \
|
||||
@ -1714,12 +1704,25 @@ ifeq ($(HAVE_NETWORKING), 1)
|
||||
else
|
||||
DEFINES += -DRC_DISABLE_LUA
|
||||
endif
|
||||
|
||||
# if not HAVE_NEW_CHEEVOS
|
||||
else
|
||||
OBJ += cheevos/cheevos.o \
|
||||
cheevos/badges.o \
|
||||
cheevos/var.o \
|
||||
cheevos/cond.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_DISCORD), 1)
|
||||
NEED_CXX_LINKER = 1
|
||||
DEFINES += -DHAVE_DISCORD
|
||||
DEFINES += -Ideps/discord-rpc/include/ -Ideps/discord-rpc/thirdparty/rapidjson-1.1.0/include/
|
||||
|
||||
ifneq ($(HAVE_THREADS), 1)
|
||||
DEFINES += -DDISCORD_DISABLE_IO_THREAD
|
||||
endif
|
||||
|
||||
OBJ += deps/discord-rpc/src/discord_rpc.o \
|
||||
deps/discord-rpc/src/rpc_connection.o \
|
||||
deps/discord-rpc/src/serialization.o \
|
||||
|
@ -68,7 +68,6 @@ else
|
||||
HAVE_7ZIP = 1
|
||||
HAVE_BUILTINZLIB = 1
|
||||
HAVE_LIBRETRODB = 1
|
||||
HAVE_ZARCH = 0
|
||||
HAVE_MATERIALUI = 1
|
||||
HAVE_XMB = 1
|
||||
HAVE_STATIC_VIDEO_FILTERS = 1
|
||||
@ -137,7 +136,6 @@ CFLAGS += -I. \
|
||||
-Ideps/libz \
|
||||
-Ideps/7zip \
|
||||
-Ideps/stb \
|
||||
-Ideps/rcheevos/include \
|
||||
-Ilibretro-common/include
|
||||
|
||||
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE
|
||||
@ -280,4 +278,3 @@ clean:
|
||||
rm -f ctr/3dsx_custom_crt0.o
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
|
@ -219,4 +219,3 @@ clean:
|
||||
rm -f ctr/3dsx_custom_crt0.o
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
|
@ -22,7 +22,7 @@ OBJ :=
|
||||
# For threading we need to overwrite some vars with global defines because devkitPro's includes
|
||||
# make it hard for us. This works for the pthread wrapper
|
||||
DEFINES_THREAD := -Dpthread_t=Thread -Dpthread_mutex_t=Mutex -Dpthread_mutexattr_t='void*' -Dpthread_attr_t=int -Dpthread_cond_t=CondVar -Dpthread_condattr_t='int' -D_SYS__PTHREADTYPES_H_
|
||||
DEFINES := -D__SWITCH__=1 -U__linux__ -U__linux -DGLM_FORCE_PURE=1 -DRARCH_CONSOLE -DRARCH_INTERNAL -DGLOBAL_CONFIG_DIR='"/switch"' $(DEFINES_THREAD)
|
||||
DEFINES := -D__SWITCH__=1 -U__linux__ -U__linux -DGLM_FORCE_PURE=1 -DRARCH_CONSOLE -DRARCH_INTERNAL -DGLOBAL_CONFIG_DIR='"/switch"' $(DEFINES_THREAD) -DHAVE_STB_VORBIS
|
||||
|
||||
HAVE_CC_RESAMPLER = 1
|
||||
HAVE_MENU_COMMON = 1
|
||||
@ -41,7 +41,8 @@ HAVE_NETWORKING = 1
|
||||
HAVE_NETPLAYDISCOVERY = 1
|
||||
HAVE_STB_FONT = 1
|
||||
HAVE_CHEEVOS = 1
|
||||
HAVE_CHD = 1
|
||||
HAVE_CHD = 0 # disabled due to static libretro-common and libchdr conflicts between different cores
|
||||
HAVE_STB_VORBIS = 1
|
||||
|
||||
# RetroArch libnx useful flags
|
||||
HAVE_THREADS = 1
|
||||
@ -55,18 +56,13 @@ HAVE_LANGEXTRA = 1
|
||||
ifeq ($(HAVE_OPENGL), 1)
|
||||
HAVE_EGL = 1
|
||||
HAVE_SHADERPIPELINE = 1
|
||||
|
||||
HAVE_RGUI = 1
|
||||
HAVE_MATERIALUI = 1
|
||||
|
||||
HAVE_XMB = 1
|
||||
HAVE_OZONE = 1
|
||||
|
||||
HAVE_OVERLAY = 1
|
||||
else
|
||||
HAVE_RGUI = 1
|
||||
|
||||
HAVE_ZARCH = 0
|
||||
HAVE_MATERIALUI = 0
|
||||
HAVE_XMB = 0
|
||||
HAVE_OZONE = 0
|
||||
|
@ -41,7 +41,6 @@ else
|
||||
HAVE_RGUI := 0
|
||||
HAVE_MATERIALUI := 0
|
||||
HAVE_XMB := 1
|
||||
HAVE_ZARCH := 0
|
||||
HAVE_THREADS := 1
|
||||
HAVE_LIBRETRODB := 1
|
||||
HAVE_CC_RESAMPLER := 1
|
||||
|
@ -52,4 +52,3 @@ clean:
|
||||
rm -f $(BINDIR)/retroarch-joyconfig
|
||||
rm -f $(PNDDIR)/readme.html
|
||||
rm -f retroarch
|
||||
|
||||
|
@ -128,4 +128,3 @@ clean:
|
||||
rm -f $(OBJ)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
|
@ -24,7 +24,6 @@ else
|
||||
HAVE_ZLIB = 1
|
||||
HAVE_BUILTINZLIB = 1
|
||||
HAVE_LIBRETRODB = 1
|
||||
HAVE_ZARCH = 0
|
||||
HAVE_MATERIALUI = 0 # enable later?
|
||||
HAVE_XMB = 0
|
||||
HAVE_STATIC_VIDEO_FILTERS = 1
|
||||
|
@ -122,7 +122,6 @@ endif
|
||||
HAVE_7ZIP = 1
|
||||
HAVE_BUILTINZLIB = 0
|
||||
HAVE_LIBRETRODB = 1
|
||||
HAVE_ZARCH = 0
|
||||
HAVE_MATERIALUI = 1
|
||||
HAVE_XMB = 1
|
||||
HAVE_STB_FONT = 1
|
||||
|
@ -172,4 +172,3 @@ clean:
|
||||
rm -f *.d
|
||||
|
||||
.PHONY: all install uninstall clean
|
||||
|
||||
|
88
audio/audio_defines.h
Normal file
88
audio/audio_defines.h
Normal file
@ -0,0 +1,88 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __AUDIO_DEFINES__H
|
||||
#define __AUDIO_DEFINES__H
|
||||
|
||||
#include <retro_common_api.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
#define AUDIO_CHUNK_SIZE_BLOCKING 512
|
||||
|
||||
/* So we don't get complete line-noise when fast-forwarding audio. */
|
||||
#define AUDIO_CHUNK_SIZE_NONBLOCKING 2048
|
||||
|
||||
#define AUDIO_MAX_RATIO 16
|
||||
|
||||
#define AUDIO_MIXER_MAX_STREAMS 16
|
||||
|
||||
#define AUDIO_MIXER_MAX_SYSTEM_STREAMS (AUDIO_MIXER_MAX_STREAMS + 4)
|
||||
|
||||
/* do not define more than (MAX_SYSTEM_STREAMS - MAX_STREAMS) */
|
||||
enum audio_mixer_system_slot
|
||||
{
|
||||
AUDIO_MIXER_SYSTEM_SLOT_OK = AUDIO_MIXER_MAX_STREAMS,
|
||||
AUDIO_MIXER_SYSTEM_SLOT_CANCEL,
|
||||
AUDIO_MIXER_SYSTEM_SLOT_NOTICE,
|
||||
AUDIO_MIXER_SYSTEM_SLOT_BGM
|
||||
};
|
||||
|
||||
enum audio_action
|
||||
{
|
||||
AUDIO_ACTION_NONE = 0,
|
||||
AUDIO_ACTION_RATE_CONTROL_DELTA,
|
||||
AUDIO_ACTION_MIXER_MUTE_ENABLE,
|
||||
AUDIO_ACTION_MUTE_ENABLE,
|
||||
AUDIO_ACTION_VOLUME_GAIN,
|
||||
AUDIO_ACTION_MIXER_VOLUME_GAIN,
|
||||
AUDIO_ACTION_MIXER
|
||||
};
|
||||
|
||||
enum audio_mixer_slot_selection_type
|
||||
{
|
||||
AUDIO_MIXER_SLOT_SELECTION_AUTOMATIC = 0,
|
||||
AUDIO_MIXER_SLOT_SELECTION_MANUAL
|
||||
};
|
||||
|
||||
enum audio_mixer_stream_type
|
||||
{
|
||||
AUDIO_STREAM_TYPE_NONE = 0,
|
||||
AUDIO_STREAM_TYPE_USER,
|
||||
AUDIO_STREAM_TYPE_SYSTEM
|
||||
};
|
||||
|
||||
enum audio_mixer_state
|
||||
{
|
||||
AUDIO_STREAM_STATE_NONE = 0,
|
||||
AUDIO_STREAM_STATE_STOPPED,
|
||||
AUDIO_STREAM_STATE_PLAYING,
|
||||
AUDIO_STREAM_STATE_PLAYING_LOOPED,
|
||||
AUDIO_STREAM_STATE_PLAYING_SEQUENTIAL
|
||||
};
|
||||
|
||||
typedef struct audio_statistics
|
||||
{
|
||||
float average_buffer_saturation;
|
||||
float std_deviation_percentage;
|
||||
float close_to_underrun;
|
||||
float close_to_blocking;
|
||||
unsigned samples;
|
||||
} audio_statistics_t;
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
@ -21,10 +21,12 @@
|
||||
#include <lists/string_list.h>
|
||||
#include <audio/conversion/float_to_s16.h>
|
||||
#include <audio/conversion/s16_to_float.h>
|
||||
#include <audio/audio_resampler.h>
|
||||
#include <audio/dsp_filter.h>
|
||||
#include <file/file_path.h>
|
||||
#include <lists/dir_list.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <streams/file_stream.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
@ -35,6 +37,8 @@
|
||||
#include "../gfx/video_driver.h"
|
||||
#include "../record/record_driver.h"
|
||||
#include "../frontend/frontend_driver.h"
|
||||
#include "../tasks/task_audio_mixer.h"
|
||||
#include "../tasks/tasks_internal.h"
|
||||
|
||||
#include "../command.h"
|
||||
#include "../driver.h"
|
||||
@ -42,9 +46,17 @@
|
||||
#include "../retroarch.h"
|
||||
#include "../verbosity.h"
|
||||
#include "../list_special.h"
|
||||
#include "../file_path_special.h"
|
||||
#include "../content.h"
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
#include <rthreads/rthreads.h>
|
||||
#endif
|
||||
|
||||
#define AUDIO_BUFFER_FREE_SAMPLES_COUNT (8 * 1024)
|
||||
|
||||
#define MENU_SOUND_FORMATS "ogg|mod|xm|s3m|mp3|flac"
|
||||
|
||||
/**
|
||||
* db_to_gain:
|
||||
* @db : Decibels.
|
||||
@ -77,6 +89,9 @@ static const audio_driver_t *audio_drivers[] = {
|
||||
#ifdef HAVE_COREAUDIO
|
||||
&audio_coreaudio,
|
||||
#endif
|
||||
#ifdef HAVE_COREAUDIO3
|
||||
&audio_coreaudio3,
|
||||
#endif
|
||||
#ifdef HAVE_AL
|
||||
&audio_openal,
|
||||
#endif
|
||||
@ -137,7 +152,7 @@ static const audio_driver_t *audio_drivers[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct audio_mixer_stream audio_mixer_streams[AUDIO_MIXER_MAX_STREAMS] = {{0}};
|
||||
static struct audio_mixer_stream audio_mixer_streams[AUDIO_MIXER_MAX_SYSTEM_STREAMS] = {{0}};
|
||||
|
||||
static size_t audio_driver_chunk_size = 0;
|
||||
static size_t audio_driver_chunk_nonblock_size = 0;
|
||||
@ -185,13 +200,36 @@ static const audio_driver_t *current_audio = NULL;
|
||||
static void *audio_driver_context_audio_data = NULL;
|
||||
|
||||
static bool audio_suspended = false;
|
||||
static bool audio_is_threaded = false;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
static slock_t* s_audio_driver_lock = NULL;
|
||||
#endif
|
||||
|
||||
static void audio_mixer_play_stop_sequential_cb(
|
||||
audio_mixer_sound_t *sound, unsigned reason);
|
||||
static void audio_mixer_play_stop_cb(
|
||||
audio_mixer_sound_t *sound, unsigned reason);
|
||||
static void audio_mixer_menu_stop_cb(
|
||||
audio_mixer_sound_t *sound, unsigned reason);
|
||||
|
||||
enum resampler_quality audio_driver_get_resampler_quality(void)
|
||||
#ifdef HAVE_THREADS
|
||||
#define audio_driver_lock() \
|
||||
if (s_audio_driver_lock) \
|
||||
slock_lock(s_audio_driver_lock)
|
||||
#else
|
||||
#define audio_driver_lock()
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
#define audio_driver_unlock() \
|
||||
if (s_audio_driver_lock) \
|
||||
slock_unlock(s_audio_driver_lock)
|
||||
#else
|
||||
#define audio_driver_unlock()
|
||||
#endif
|
||||
|
||||
static enum resampler_quality audio_driver_get_resampler_quality(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
@ -203,14 +241,14 @@ enum resampler_quality audio_driver_get_resampler_quality(void)
|
||||
|
||||
audio_mixer_stream_t *audio_driver_mixer_get_stream(unsigned i)
|
||||
{
|
||||
if (i > (AUDIO_MIXER_MAX_STREAMS-1))
|
||||
if (i > (AUDIO_MIXER_MAX_SYSTEM_STREAMS-1))
|
||||
return NULL;
|
||||
return &audio_mixer_streams[i];
|
||||
}
|
||||
|
||||
const char *audio_driver_mixer_get_stream_name(unsigned i)
|
||||
{
|
||||
if (i > (AUDIO_MIXER_MAX_STREAMS-1))
|
||||
if (i > (AUDIO_MIXER_MAX_SYSTEM_STREAMS-1))
|
||||
return "N/A";
|
||||
if (!string_is_empty(audio_mixer_streams[i].name))
|
||||
return audio_mixer_streams[i].name;
|
||||
@ -392,9 +430,9 @@ static bool audio_driver_deinit_internal(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void audio_driver_mixer_init(unsigned out_rate)
|
||||
static void audio_driver_mixer_init(unsigned audio_out_rate)
|
||||
{
|
||||
audio_mixer_init(out_rate);
|
||||
audio_mixer_init(audio_out_rate);
|
||||
}
|
||||
|
||||
static bool audio_driver_init_internal(bool audio_cb_inited)
|
||||
@ -447,6 +485,7 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
|
||||
#ifdef HAVE_THREADS
|
||||
if (audio_cb_inited)
|
||||
{
|
||||
audio_is_threaded = true;
|
||||
RARCH_LOG("[Audio]: Starting threaded audio driver ...\n");
|
||||
if (!audio_init_thread(
|
||||
¤t_audio,
|
||||
@ -465,6 +504,7 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
audio_is_threaded = false;
|
||||
audio_driver_context_audio_data =
|
||||
current_audio->init(*settings->arrays.audio_device ?
|
||||
settings->arrays.audio_device : NULL,
|
||||
@ -507,6 +547,15 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
|
||||
audio_source_ratio_original = audio_source_ratio_current =
|
||||
(double)settings->uints.audio_out_rate / audio_driver_input;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
if (s_audio_driver_lock)
|
||||
slock_free(s_audio_driver_lock);
|
||||
s_audio_driver_lock = slock_new();
|
||||
#endif
|
||||
|
||||
audio_resampler_lock_init();
|
||||
audio_resampler_lock();
|
||||
|
||||
if (!retro_resampler_realloc(
|
||||
&audio_driver_resampler_data,
|
||||
&audio_driver_resampler,
|
||||
@ -519,6 +568,8 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
|
||||
audio_driver_active = false;
|
||||
}
|
||||
|
||||
audio_resampler_unlock();
|
||||
|
||||
aud_inp_data = (float*)malloc(max_bufsamples * sizeof(float));
|
||||
retro_assert(aud_inp_data != NULL);
|
||||
|
||||
@ -589,9 +640,13 @@ void audio_driver_set_nonblocking_state(bool enable)
|
||||
audio_driver_context_audio_data,
|
||||
settings->bools.audio_sync ? enable : true);
|
||||
|
||||
audio_driver_lock();
|
||||
|
||||
audio_driver_chunk_size = enable ?
|
||||
audio_driver_chunk_nonblock_size :
|
||||
audio_driver_chunk_block_size;
|
||||
|
||||
audio_driver_unlock();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -609,6 +664,7 @@ static void audio_driver_flush(const int16_t *data, size_t samples)
|
||||
bool is_paused = false;
|
||||
bool is_idle = false;
|
||||
bool is_slowmotion = false;
|
||||
bool is_active = false;
|
||||
const void *output_data = NULL;
|
||||
unsigned output_frames = 0;
|
||||
float audio_volume_gain = !audio_driver_mute_enable ?
|
||||
@ -617,9 +673,13 @@ static void audio_driver_flush(const int16_t *data, size_t samples)
|
||||
src_data.data_out = NULL;
|
||||
src_data.output_frames = 0;
|
||||
|
||||
recording_driver_lock();
|
||||
|
||||
if (recording_data)
|
||||
recording_push_audio(data, samples);
|
||||
|
||||
recording_driver_unlock();
|
||||
|
||||
runloop_get_status(&is_paused, &is_idle, &is_slowmotion,
|
||||
&is_perfcnt_enable);
|
||||
|
||||
@ -629,9 +689,13 @@ static void audio_driver_flush(const int16_t *data, size_t samples)
|
||||
!audio_driver_output_samples_buf)
|
||||
return;
|
||||
|
||||
audio_driver_lock();
|
||||
|
||||
convert_s16_to_float(audio_driver_input_data, data, samples,
|
||||
audio_volume_gain);
|
||||
|
||||
audio_driver_unlock();
|
||||
|
||||
src_data.data_in = audio_driver_input_data;
|
||||
src_data.input_frames = samples >> 1;
|
||||
|
||||
@ -695,9 +759,15 @@ static void audio_driver_flush(const int16_t *data, size_t samples)
|
||||
src_data.ratio *= settings->floats.slowmotion_ratio;
|
||||
}
|
||||
|
||||
audio_driver_resampler->process(audio_driver_resampler_data, &src_data);
|
||||
audio_driver_lock();
|
||||
|
||||
if (audio_mixer_active)
|
||||
audio_resampler_lock();
|
||||
audio_driver_resampler->process(audio_driver_resampler_data, &src_data);
|
||||
audio_resampler_unlock();
|
||||
|
||||
is_active = audio_mixer_active;
|
||||
|
||||
if (is_active)
|
||||
{
|
||||
bool override = audio_driver_mixer_mute_enable ? true :
|
||||
(audio_driver_mixer_volume_gain != 1.0f) ? true : false;
|
||||
@ -707,6 +777,8 @@ static void audio_driver_flush(const int16_t *data, size_t samples)
|
||||
src_data.output_frames, mixer_gain, override);
|
||||
}
|
||||
|
||||
audio_driver_unlock();
|
||||
|
||||
output_data = audio_driver_output_samples_buf;
|
||||
output_frames = (unsigned)src_data.output_frames;
|
||||
|
||||
@ -721,9 +793,13 @@ static void audio_driver_flush(const int16_t *data, size_t samples)
|
||||
output_frames *= sizeof(int16_t);
|
||||
}
|
||||
|
||||
audio_driver_lock();
|
||||
|
||||
if (current_audio->write(audio_driver_context_audio_data,
|
||||
output_data, output_frames * 2) < 0)
|
||||
audio_driver_active = false;
|
||||
|
||||
audio_driver_unlock();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -735,14 +811,24 @@ static void audio_driver_flush(const int16_t *data, size_t samples)
|
||||
**/
|
||||
void audio_driver_sample(int16_t left, int16_t right)
|
||||
{
|
||||
audio_driver_lock();
|
||||
|
||||
if (audio_suspended)
|
||||
{
|
||||
audio_driver_unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
audio_driver_output_samples_conv_buf[audio_driver_data_ptr++] = left;
|
||||
audio_driver_output_samples_conv_buf[audio_driver_data_ptr++] = right;
|
||||
|
||||
if (audio_driver_data_ptr < audio_driver_chunk_size)
|
||||
{
|
||||
audio_driver_unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
audio_driver_unlock();
|
||||
|
||||
audio_driver_flush(audio_driver_output_samples_conv_buf,
|
||||
audio_driver_data_ptr);
|
||||
@ -753,8 +839,7 @@ void audio_driver_sample(int16_t left, int16_t right)
|
||||
void audio_driver_menu_sample(void)
|
||||
{
|
||||
static int16_t samples_buf[1024] = {0};
|
||||
struct retro_system_av_info
|
||||
*av_info = video_viewport_get_system_av_info();
|
||||
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
|
||||
const struct retro_system_timing *info =
|
||||
(const struct retro_system_timing*)&av_info->timing;
|
||||
unsigned sample_count = (info->sample_rate / info->fps) * 2;
|
||||
@ -966,10 +1051,13 @@ bool audio_driver_find_driver(void)
|
||||
|
||||
void audio_driver_deinit_resampler(void)
|
||||
{
|
||||
audio_resampler_lock();
|
||||
if (audio_driver_resampler && audio_driver_resampler_data)
|
||||
audio_driver_resampler->free(audio_driver_resampler_data);
|
||||
audio_driver_resampler = NULL;
|
||||
audio_driver_resampler_data = NULL;
|
||||
audio_resampler_unlock();
|
||||
audio_resampler_lock_free();
|
||||
}
|
||||
|
||||
bool audio_driver_free_devices_list(void)
|
||||
@ -1053,7 +1141,7 @@ static int audio_mixer_find_index(audio_mixer_sound_t *sound)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < AUDIO_MIXER_MAX_STREAMS; i++)
|
||||
for (i = 0; i < AUDIO_MIXER_MAX_SYSTEM_STREAMS; i++)
|
||||
{
|
||||
audio_mixer_sound_t *handle = audio_mixer_streams[i].handle;
|
||||
if (handle == sound)
|
||||
@ -1095,6 +1183,28 @@ static void audio_mixer_play_stop_cb(
|
||||
}
|
||||
}
|
||||
|
||||
static void audio_mixer_menu_stop_cb(
|
||||
audio_mixer_sound_t *sound, unsigned reason)
|
||||
{
|
||||
int idx = audio_mixer_find_index(sound);
|
||||
|
||||
switch (reason)
|
||||
{
|
||||
case AUDIO_MIXER_SOUND_FINISHED:
|
||||
if (idx >= 0)
|
||||
{
|
||||
unsigned i = (unsigned)idx;
|
||||
audio_mixer_streams[i].state = AUDIO_STREAM_STATE_STOPPED;
|
||||
audio_mixer_streams[i].volume = 0.0f;
|
||||
}
|
||||
break;
|
||||
case AUDIO_MIXER_SOUND_STOPPED:
|
||||
break;
|
||||
case AUDIO_MIXER_SOUND_REPEATED:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void audio_mixer_play_stop_sequential_cb(
|
||||
audio_mixer_sound_t *sound, unsigned reason)
|
||||
{
|
||||
@ -1112,6 +1222,11 @@ static void audio_mixer_play_stop_sequential_cb(
|
||||
if (!string_is_empty(audio_mixer_streams[i].name))
|
||||
free(audio_mixer_streams[i].name);
|
||||
|
||||
if (i < AUDIO_MIXER_MAX_STREAMS)
|
||||
audio_mixer_streams[i].stream_type = AUDIO_STREAM_TYPE_USER;
|
||||
else
|
||||
audio_mixer_streams[i].stream_type = AUDIO_STREAM_TYPE_SYSTEM;
|
||||
|
||||
audio_mixer_streams[i].name = NULL;
|
||||
audio_mixer_streams[i].state = AUDIO_STREAM_STATE_NONE;
|
||||
audio_mixer_streams[i].volume = 0.0f;
|
||||
@ -1122,7 +1237,7 @@ static void audio_mixer_play_stop_sequential_cb(
|
||||
|
||||
i++;
|
||||
|
||||
for (; i < AUDIO_MIXER_MAX_STREAMS; i++)
|
||||
for (; i < AUDIO_MIXER_MAX_SYSTEM_STREAMS; i++)
|
||||
{
|
||||
if (audio_mixer_streams[i].state == AUDIO_STREAM_STATE_STOPPED)
|
||||
{
|
||||
@ -1139,10 +1254,11 @@ static void audio_mixer_play_stop_sequential_cb(
|
||||
}
|
||||
}
|
||||
|
||||
bool audio_driver_mixer_get_free_stream_slot(unsigned *id)
|
||||
static bool audio_driver_mixer_get_free_stream_slot(unsigned *id, enum audio_mixer_stream_type type)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < AUDIO_MIXER_MAX_STREAMS; i++)
|
||||
unsigned i = (type == AUDIO_STREAM_TYPE_USER) ? 0 : AUDIO_MIXER_MAX_STREAMS;
|
||||
unsigned count = (type == AUDIO_STREAM_TYPE_USER) ? AUDIO_MIXER_MAX_STREAMS : AUDIO_MIXER_MAX_SYSTEM_STREAMS;
|
||||
for (; i < count; i++)
|
||||
{
|
||||
if (audio_mixer_streams[i].state == AUDIO_STREAM_STATE_NONE)
|
||||
{
|
||||
@ -1163,9 +1279,22 @@ bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params)
|
||||
bool looped = false;
|
||||
void *buf = NULL;
|
||||
|
||||
if (!audio_driver_mixer_get_free_stream_slot(&free_slot))
|
||||
if (params->stream_type == AUDIO_STREAM_TYPE_NONE)
|
||||
return false;
|
||||
|
||||
switch (params->slot_selection_type)
|
||||
{
|
||||
case AUDIO_MIXER_SLOT_SELECTION_MANUAL:
|
||||
free_slot = params->slot_selection_idx;
|
||||
break;
|
||||
case AUDIO_MIXER_SLOT_SELECTION_AUTOMATIC:
|
||||
default:
|
||||
if (!audio_driver_mixer_get_free_stream_slot(
|
||||
&free_slot, params->stream_type))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (params->state == AUDIO_STREAM_STATE_NONE)
|
||||
return false;
|
||||
|
||||
@ -1224,22 +1353,28 @@ bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params)
|
||||
break;
|
||||
}
|
||||
|
||||
audio_driver_lock();
|
||||
|
||||
audio_mixer_active = true;
|
||||
|
||||
audio_mixer_streams[free_slot].name = !string_is_empty(params->basename) ? strdup(params->basename) : NULL;
|
||||
audio_mixer_streams[free_slot].buf = buf;
|
||||
audio_mixer_streams[free_slot].handle = handle;
|
||||
audio_mixer_streams[free_slot].voice = voice;
|
||||
audio_mixer_streams[free_slot].stream_type = params->stream_type;
|
||||
audio_mixer_streams[free_slot].type = params->type;
|
||||
audio_mixer_streams[free_slot].state = params->state;
|
||||
audio_mixer_streams[free_slot].volume = params->volume;
|
||||
audio_mixer_streams[free_slot].stop_cb = stop_cb;
|
||||
|
||||
audio_driver_unlock();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
enum audio_mixer_state audio_driver_mixer_get_stream_state(unsigned i)
|
||||
{
|
||||
if (i >= AUDIO_MIXER_MAX_STREAMS)
|
||||
if (i >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
|
||||
return AUDIO_STREAM_STATE_NONE;
|
||||
|
||||
return audio_mixer_streams[i].state;
|
||||
@ -1249,7 +1384,7 @@ static void audio_driver_mixer_play_stream_internal(unsigned i, unsigned type)
|
||||
{
|
||||
bool set_state = false;
|
||||
|
||||
if (i >= AUDIO_MIXER_MAX_STREAMS)
|
||||
if (i >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
|
||||
return;
|
||||
|
||||
switch (audio_mixer_streams[i].state)
|
||||
@ -1271,12 +1406,128 @@ static void audio_driver_mixer_play_stream_internal(unsigned i, unsigned type)
|
||||
audio_mixer_streams[i].state = (enum audio_mixer_state)type;
|
||||
}
|
||||
|
||||
static void audio_driver_load_menu_bgm_callback(void *task_data, void *user_data, const char *error)
|
||||
{
|
||||
bool contentless = false;
|
||||
bool is_inited = false;
|
||||
|
||||
content_get_status(&contentless, &is_inited);
|
||||
|
||||
if (!is_inited)
|
||||
audio_driver_mixer_play_menu_sound_looped(AUDIO_MIXER_SYSTEM_SLOT_BGM);
|
||||
}
|
||||
|
||||
void audio_driver_load_menu_sounds(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
char *sounds_path = NULL;
|
||||
char *sounds_fallback_path = NULL;
|
||||
const char *path_ok = NULL;
|
||||
const char *path_cancel = NULL;
|
||||
const char *path_notice = NULL;
|
||||
const char *path_bgm = NULL;
|
||||
struct string_list *list = NULL;
|
||||
struct string_list *list_fallback = NULL;
|
||||
unsigned i = 0;
|
||||
|
||||
sounds_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
sounds_fallback_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
sounds_path[0] = sounds_fallback_path[0] = '\0';
|
||||
|
||||
fill_pathname_join(
|
||||
sounds_fallback_path,
|
||||
settings->paths.directory_assets,
|
||||
"sounds",
|
||||
PATH_MAX_LENGTH * sizeof(char)
|
||||
);
|
||||
|
||||
fill_pathname_application_special(sounds_path, PATH_MAX_LENGTH * sizeof(char), APPLICATION_SPECIAL_DIRECTORY_ASSETS_SOUNDS);
|
||||
|
||||
list = dir_list_new(sounds_path, MENU_SOUND_FORMATS, false, false, false, false);
|
||||
list_fallback = dir_list_new(sounds_fallback_path, MENU_SOUND_FORMATS, false, false, false, false);
|
||||
|
||||
if (!list)
|
||||
{
|
||||
list = list_fallback;
|
||||
list_fallback = NULL;
|
||||
}
|
||||
|
||||
if (!list || list->size == 0)
|
||||
goto end;
|
||||
|
||||
if (list_fallback && list_fallback->size > 0)
|
||||
{
|
||||
for (i = 0; i < list_fallback->size; i++)
|
||||
{
|
||||
if (list->size == 0 || !string_list_find_elem(list, list_fallback->elems[i].data))
|
||||
{
|
||||
union string_list_elem_attr attr = {0};
|
||||
string_list_append(list, list_fallback->elems[i].data, attr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
const char *path = list->elems[i].data;
|
||||
const char *ext = path_get_extension(path);
|
||||
char basename_noext[PATH_MAX_LENGTH];
|
||||
|
||||
basename_noext[0] = '\0';
|
||||
|
||||
fill_pathname_base_noext(basename_noext, path, sizeof(basename_noext));
|
||||
|
||||
if (audio_driver_mixer_extension_supported(ext))
|
||||
{
|
||||
if (string_is_equal_noncase(basename_noext, "ok"))
|
||||
path_ok = path;
|
||||
if (string_is_equal_noncase(basename_noext, "cancel"))
|
||||
path_cancel = path;
|
||||
if (string_is_equal_noncase(basename_noext, "notice"))
|
||||
path_notice = path;
|
||||
if (string_is_equal_noncase(basename_noext, "bgm"))
|
||||
path_bgm = path;
|
||||
}
|
||||
}
|
||||
|
||||
if (path_ok && settings->bools.audio_enable_menu_ok)
|
||||
task_push_audio_mixer_load(path_ok, NULL, NULL, true, AUDIO_MIXER_SLOT_SELECTION_MANUAL, AUDIO_MIXER_SYSTEM_SLOT_OK);
|
||||
if (path_cancel && settings->bools.audio_enable_menu_cancel)
|
||||
task_push_audio_mixer_load(path_cancel, NULL, NULL, true, AUDIO_MIXER_SLOT_SELECTION_MANUAL, AUDIO_MIXER_SYSTEM_SLOT_CANCEL);
|
||||
if (path_notice && settings->bools.audio_enable_menu_notice)
|
||||
task_push_audio_mixer_load(path_notice, NULL, NULL, true, AUDIO_MIXER_SLOT_SELECTION_MANUAL, AUDIO_MIXER_SYSTEM_SLOT_NOTICE);
|
||||
if (path_bgm && settings->bools.audio_enable_menu_bgm)
|
||||
task_push_audio_mixer_load(path_bgm, audio_driver_load_menu_bgm_callback, NULL, true, AUDIO_MIXER_SLOT_SELECTION_MANUAL, AUDIO_MIXER_SYSTEM_SLOT_BGM);
|
||||
|
||||
end:
|
||||
if (list)
|
||||
string_list_free(list);
|
||||
if (list_fallback)
|
||||
string_list_free(list_fallback);
|
||||
if (sounds_path)
|
||||
free(sounds_path);
|
||||
if (sounds_fallback_path)
|
||||
free(sounds_fallback_path);
|
||||
}
|
||||
|
||||
void audio_driver_mixer_play_stream(unsigned i)
|
||||
{
|
||||
audio_mixer_streams[i].stop_cb = audio_mixer_play_stop_cb;
|
||||
audio_driver_mixer_play_stream_internal(i, AUDIO_STREAM_STATE_PLAYING);
|
||||
}
|
||||
|
||||
void audio_driver_mixer_play_menu_sound_looped(unsigned i)
|
||||
{
|
||||
audio_mixer_streams[i].stop_cb = audio_mixer_menu_stop_cb;
|
||||
audio_driver_mixer_play_stream_internal(i, AUDIO_STREAM_STATE_PLAYING_LOOPED);
|
||||
}
|
||||
|
||||
void audio_driver_mixer_play_menu_sound(unsigned i)
|
||||
{
|
||||
audio_mixer_streams[i].stop_cb = audio_mixer_menu_stop_cb;
|
||||
audio_driver_mixer_play_stream_internal(i, AUDIO_STREAM_STATE_PLAYING);
|
||||
}
|
||||
|
||||
void audio_driver_mixer_play_stream_looped(unsigned i)
|
||||
{
|
||||
audio_mixer_streams[i].stop_cb = audio_mixer_play_stop_cb;
|
||||
@ -1291,7 +1542,7 @@ void audio_driver_mixer_play_stream_sequential(unsigned i)
|
||||
|
||||
float audio_driver_mixer_get_stream_volume(unsigned i)
|
||||
{
|
||||
if (i >= AUDIO_MIXER_MAX_STREAMS)
|
||||
if (i >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
|
||||
return 0.0f;
|
||||
|
||||
return audio_mixer_streams[i].volume;
|
||||
@ -1301,7 +1552,7 @@ void audio_driver_mixer_set_stream_volume(unsigned i, float vol)
|
||||
{
|
||||
audio_mixer_voice_t *voice = NULL;
|
||||
|
||||
if (i >= AUDIO_MIXER_MAX_STREAMS)
|
||||
if (i >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
|
||||
return;
|
||||
|
||||
audio_mixer_streams[i].volume = vol;
|
||||
@ -1316,7 +1567,7 @@ void audio_driver_mixer_stop_stream(unsigned i)
|
||||
{
|
||||
bool set_state = false;
|
||||
|
||||
if (i >= AUDIO_MIXER_MAX_STREAMS)
|
||||
if (i >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
|
||||
return;
|
||||
|
||||
switch (audio_mixer_streams[i].state)
|
||||
@ -1346,7 +1597,7 @@ void audio_driver_mixer_remove_stream(unsigned i)
|
||||
{
|
||||
bool destroy = false;
|
||||
|
||||
if (i >= AUDIO_MIXER_MAX_STREAMS)
|
||||
if (i >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
|
||||
return;
|
||||
|
||||
switch (audio_mixer_streams[i].state)
|
||||
@ -1388,7 +1639,7 @@ static void audio_driver_mixer_deinit(void)
|
||||
|
||||
audio_mixer_active = false;
|
||||
|
||||
for (i = 0; i < AUDIO_MIXER_MAX_STREAMS; i++)
|
||||
for (i = 0; i < AUDIO_MIXER_MAX_SYSTEM_STREAMS; i++)
|
||||
{
|
||||
audio_driver_mixer_stop_stream(i);
|
||||
audio_driver_mixer_remove_stream(i);
|
||||
@ -1401,6 +1652,11 @@ bool audio_driver_deinit(void)
|
||||
{
|
||||
audio_driver_mixer_deinit();
|
||||
audio_driver_free_devices_list();
|
||||
#ifdef HAVE_THREADS
|
||||
slock_free(s_audio_driver_lock);
|
||||
s_audio_driver_lock = NULL;
|
||||
#endif
|
||||
|
||||
if (!audio_driver_deinit_internal())
|
||||
return false;
|
||||
return true;
|
||||
|
@ -22,46 +22,21 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <audio/audio_mixer.h>
|
||||
#include <audio/audio_resampler.h>
|
||||
#include <retro_common_api.h>
|
||||
|
||||
#include <audio/audio_mixer.h>
|
||||
|
||||
#include "audio_defines.h"
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
#define AUDIO_CHUNK_SIZE_BLOCKING 512
|
||||
|
||||
/* So we don't get complete line-noise when fast-forwarding audio. */
|
||||
#define AUDIO_CHUNK_SIZE_NONBLOCKING 2048
|
||||
|
||||
#define AUDIO_MAX_RATIO 16
|
||||
|
||||
#define AUDIO_MIXER_MAX_STREAMS 16
|
||||
|
||||
enum audio_action
|
||||
{
|
||||
AUDIO_ACTION_NONE = 0,
|
||||
AUDIO_ACTION_RATE_CONTROL_DELTA,
|
||||
AUDIO_ACTION_MIXER_MUTE_ENABLE,
|
||||
AUDIO_ACTION_MUTE_ENABLE,
|
||||
AUDIO_ACTION_VOLUME_GAIN,
|
||||
AUDIO_ACTION_MIXER_VOLUME_GAIN,
|
||||
AUDIO_ACTION_MIXER
|
||||
};
|
||||
|
||||
enum audio_mixer_state
|
||||
{
|
||||
AUDIO_STREAM_STATE_NONE = 0,
|
||||
AUDIO_STREAM_STATE_STOPPED,
|
||||
AUDIO_STREAM_STATE_PLAYING,
|
||||
AUDIO_STREAM_STATE_PLAYING_LOOPED,
|
||||
AUDIO_STREAM_STATE_PLAYING_SEQUENTIAL
|
||||
};
|
||||
|
||||
typedef struct audio_mixer_stream
|
||||
{
|
||||
audio_mixer_sound_t *handle;
|
||||
audio_mixer_voice_t *voice;
|
||||
audio_mixer_stop_cb_t stop_cb;
|
||||
enum audio_mixer_stream_type stream_type;
|
||||
enum audio_mixer_type type;
|
||||
enum audio_mixer_state state;
|
||||
float volume;
|
||||
void *buf;
|
||||
@ -69,14 +44,19 @@ typedef struct audio_mixer_stream
|
||||
size_t bufsize;
|
||||
} audio_mixer_stream_t;
|
||||
|
||||
typedef struct audio_statistics
|
||||
typedef struct audio_mixer_stream_params
|
||||
{
|
||||
float average_buffer_saturation;
|
||||
float std_deviation_percentage;
|
||||
float close_to_underrun;
|
||||
float close_to_blocking;
|
||||
unsigned samples;
|
||||
} audio_statistics_t;
|
||||
float volume;
|
||||
enum audio_mixer_slot_selection_type slot_selection_type;
|
||||
unsigned slot_selection_idx;
|
||||
enum audio_mixer_stream_type stream_type;
|
||||
enum audio_mixer_type type;
|
||||
enum audio_mixer_state state;
|
||||
void *buf;
|
||||
char *basename;
|
||||
size_t bufsize;
|
||||
audio_mixer_stop_cb_t cb;
|
||||
} audio_mixer_stream_params_t;
|
||||
|
||||
typedef struct audio_driver
|
||||
{
|
||||
@ -160,17 +140,6 @@ typedef struct audio_driver
|
||||
size_t (*buffer_size)(void *data);
|
||||
} audio_driver_t;
|
||||
|
||||
typedef struct audio_mixer_stream_params
|
||||
{
|
||||
float volume;
|
||||
enum audio_mixer_type type;
|
||||
enum audio_mixer_state state;
|
||||
void *buf;
|
||||
char *basename;
|
||||
size_t bufsize;
|
||||
audio_mixer_stop_cb_t cb;
|
||||
} audio_mixer_stream_params_t;
|
||||
|
||||
void audio_driver_destroy_data(void);
|
||||
|
||||
void audio_driver_set_own_driver(void);
|
||||
@ -295,6 +264,10 @@ bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params);
|
||||
|
||||
void audio_driver_mixer_play_stream(unsigned i);
|
||||
|
||||
void audio_driver_mixer_play_menu_sound(unsigned i);
|
||||
|
||||
void audio_driver_mixer_play_menu_sound_looped(unsigned i);
|
||||
|
||||
void audio_driver_mixer_play_stream_sequential(unsigned i);
|
||||
|
||||
void audio_driver_mixer_play_stream_looped(unsigned i);
|
||||
@ -307,14 +280,14 @@ void audio_driver_mixer_set_stream_volume(unsigned i, float vol);
|
||||
|
||||
void audio_driver_mixer_remove_stream(unsigned i);
|
||||
|
||||
enum resampler_quality audio_driver_get_resampler_quality(void);
|
||||
|
||||
enum audio_mixer_state audio_driver_mixer_get_stream_state(unsigned i);
|
||||
|
||||
const char *audio_driver_mixer_get_stream_name(unsigned i);
|
||||
|
||||
bool compute_audio_buffer_statistics(audio_statistics_t *stats);
|
||||
|
||||
void audio_driver_load_menu_sounds(void);
|
||||
|
||||
extern audio_driver_t audio_rsound;
|
||||
extern audio_driver_t audio_audioio;
|
||||
extern audio_driver_t audio_oss;
|
||||
@ -331,6 +304,7 @@ extern audio_driver_t audio_pulse;
|
||||
extern audio_driver_t audio_dsound;
|
||||
extern audio_driver_t audio_wasapi;
|
||||
extern audio_driver_t audio_coreaudio;
|
||||
extern audio_driver_t audio_coreaudio3;
|
||||
extern audio_driver_t audio_xenon360;
|
||||
extern audio_driver_t audio_ps3;
|
||||
extern audio_driver_t audio_gx;
|
||||
|
@ -43,4 +43,3 @@ bool audio_init_thread(const audio_driver_t **out_driver, void **out_data,
|
||||
const audio_driver_t *driver);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -125,7 +125,9 @@ static OSStatus audio_write_cb(void *userdata,
|
||||
static void coreaudio_interrupt_listener(void *data, UInt32 interrupt_state)
|
||||
{
|
||||
(void)data;
|
||||
#if TARGET_OS_IOS
|
||||
g_interrupted = (interrupt_state == kAudioSessionBeginInterruption);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
static void choose_output_device(coreaudio_t *dev, const char* device)
|
||||
@ -218,7 +220,7 @@ static void *coreaudio_init(const char *device,
|
||||
dev->lock = slock_new();
|
||||
dev->cond = scond_new();
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#if TARGET_OS_IOS
|
||||
if (!session_initialized)
|
||||
{
|
||||
session_initialized = true;
|
||||
|
382
audio/drivers/coreaudio3.m
Normal file
382
audio/drivers/coreaudio3.m
Normal file
@ -0,0 +1,382 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2019 - Stuart Carnie
|
||||
*
|
||||
* RetroArch is free software: 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/>.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AudioToolbox/AudioToolbox.h>
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdatomic.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
|
||||
#pragma mark - ringbuffer
|
||||
|
||||
typedef struct ringbuffer
|
||||
{
|
||||
float *buffer;
|
||||
size_t cap;
|
||||
atomic_int len;
|
||||
size_t writePtr;
|
||||
size_t readPtr;
|
||||
} ringbuffer_t;
|
||||
|
||||
typedef ringbuffer_t * ringbuffer_h;
|
||||
|
||||
static inline size_t rb_len(ringbuffer_h r)
|
||||
{
|
||||
return atomic_load_explicit(&r->len, memory_order_relaxed);
|
||||
}
|
||||
|
||||
static inline size_t rb_cap(ringbuffer_h r)
|
||||
{
|
||||
return (r->readPtr + r->cap - r->writePtr) % r->cap;
|
||||
}
|
||||
|
||||
static inline size_t rb_avail(ringbuffer_h r)
|
||||
{
|
||||
return r->cap - rb_len(r);
|
||||
}
|
||||
|
||||
static inline void rb_advance_write(ringbuffer_h r)
|
||||
{
|
||||
r->writePtr = (r->writePtr + 1) % r->cap;
|
||||
}
|
||||
|
||||
static inline void rb_advance_write_n(ringbuffer_h r, size_t n)
|
||||
{
|
||||
r->writePtr = (r->writePtr + n) % r->cap;
|
||||
}
|
||||
|
||||
static inline void rb_advance_read(ringbuffer_h r)
|
||||
{
|
||||
r->readPtr = (r->readPtr + 1) % r->cap;
|
||||
}
|
||||
|
||||
static inline void rb_len_add(ringbuffer_h r, int n)
|
||||
{
|
||||
atomic_fetch_add(&r->len, n);
|
||||
}
|
||||
|
||||
static inline void rb_len_sub(ringbuffer_h r, int n)
|
||||
{
|
||||
atomic_fetch_sub(&r->len, n);
|
||||
}
|
||||
|
||||
static void rb_init(ringbuffer_h r, size_t cap)
|
||||
{
|
||||
r->buffer = malloc(cap * sizeof(float));
|
||||
r->cap = cap;
|
||||
atomic_init(&r->len, 0);
|
||||
r->writePtr = 0;
|
||||
r->readPtr = 0;
|
||||
}
|
||||
|
||||
static void rb_free(ringbuffer_h r)
|
||||
{
|
||||
free(r->buffer);
|
||||
bzero(r, sizeof(*r));
|
||||
}
|
||||
|
||||
#define UNLIKELY(x) __builtin_expect((x), 0)
|
||||
#define LIKELY(x) __builtin_expect((x), 1)
|
||||
|
||||
static void rb_write_data(ringbuffer_h r, const float *data, size_t len)
|
||||
{
|
||||
size_t avail = rb_avail(r);
|
||||
size_t n = MIN(len, avail);
|
||||
size_t first_write = n;
|
||||
size_t rest_write = 0;
|
||||
|
||||
if (r->writePtr + n > r->cap)
|
||||
{
|
||||
first_write = r->cap - r->writePtr;
|
||||
rest_write = n - first_write;
|
||||
}
|
||||
|
||||
memcpy(r->buffer + r->writePtr, data, first_write*sizeof(float));
|
||||
memcpy(r->buffer, data + first_write, rest_write*sizeof(float));
|
||||
|
||||
rb_advance_write_n(r, n);
|
||||
rb_len_add(r, (int)n);
|
||||
}
|
||||
|
||||
static void rb_read_data(ringbuffer_h r, float *d0, float *d1, size_t len)
|
||||
{
|
||||
size_t need = len*2;
|
||||
|
||||
do {
|
||||
size_t have = rb_len(r);
|
||||
size_t n = MIN(have, need);
|
||||
int i = 0;
|
||||
for (; i < n/2; i++)
|
||||
{
|
||||
d0[i] = r->buffer[r->readPtr];
|
||||
rb_advance_read(r);
|
||||
d1[i] = r->buffer[r->readPtr];
|
||||
rb_advance_read(r);
|
||||
}
|
||||
|
||||
need -= n;
|
||||
rb_len_sub(r, (int)n);
|
||||
|
||||
if (UNLIKELY(need > 0))
|
||||
{
|
||||
/* we got more data */
|
||||
if (rb_len(r) > 0)
|
||||
continue;
|
||||
|
||||
// underflow
|
||||
const float quiet = 0.0f;
|
||||
size_t fill = (need/2)*sizeof(float);
|
||||
memset_pattern4(&d0[i], &quiet, fill);
|
||||
memset_pattern4(&d1[i], &quiet, fill);
|
||||
}
|
||||
} while (0);
|
||||
}
|
||||
|
||||
#pragma mark - CoreAudio3
|
||||
|
||||
static bool g_interrupted;
|
||||
|
||||
@interface CoreAudio3 : NSObject {
|
||||
ringbuffer_t _rb;
|
||||
dispatch_semaphore_t _sema;
|
||||
AUAudioUnit *_au;
|
||||
size_t _bufferSize;
|
||||
BOOL _nonBlock;
|
||||
}
|
||||
|
||||
@property (nonatomic, readwrite) BOOL nonBlock;
|
||||
@property (nonatomic, readonly) BOOL paused;
|
||||
@property (nonatomic, readonly) size_t writeAvailableInBytes;
|
||||
@property (nonatomic, readonly) size_t bufferSizeInBytes;
|
||||
|
||||
- (instancetype)initWithRate:(NSUInteger)rate
|
||||
latency:(NSUInteger)latency;
|
||||
- (ssize_t)writeFloat:(const float *)data samples:(size_t)samples;
|
||||
- (void)start;
|
||||
- (void)stop;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CoreAudio3
|
||||
|
||||
- (instancetype)initWithRate:(NSUInteger)rate
|
||||
latency:(NSUInteger)latency {
|
||||
if (self = [super init])
|
||||
{
|
||||
_sema = dispatch_semaphore_create(0);
|
||||
|
||||
_bufferSize = (latency * rate) / 1000;
|
||||
_bufferSize *= 2; // stereo
|
||||
rb_init(&_rb, _bufferSize);
|
||||
|
||||
AudioComponentDescription desc = {
|
||||
.componentType = kAudioUnitType_Output,
|
||||
.componentSubType = kAudioUnitSubType_DefaultOutput,
|
||||
.componentManufacturer = kAudioUnitManufacturer_Apple,
|
||||
};
|
||||
|
||||
NSError *err;
|
||||
AUAudioUnit *au = [[AUAudioUnit alloc] initWithComponentDescription:desc error:&err];
|
||||
if (err != nil)
|
||||
return nil;
|
||||
|
||||
AVAudioFormat *format = au.outputBusses[0].format;
|
||||
if (format.channelCount != 2)
|
||||
return nil;
|
||||
|
||||
AVAudioFormat *renderFormat = [[AVAudioFormat alloc] initStandardFormatWithSampleRate:rate channels:2];
|
||||
[au.inputBusses[0] setFormat:renderFormat error:&err];
|
||||
if (err != nil)
|
||||
return nil;
|
||||
|
||||
ringbuffer_h rb = &_rb;
|
||||
__block dispatch_semaphore_t sema = _sema;
|
||||
au.outputProvider = ^AUAudioUnitStatus(AudioUnitRenderActionFlags * actionFlags, const AudioTimeStamp * timestamp, AUAudioFrameCount frameCount, NSInteger inputBusNumber, AudioBufferList * inputData) {
|
||||
rb_read_data(rb, inputData->mBuffers[0].mData, inputData->mBuffers[1].mData, frameCount);
|
||||
dispatch_semaphore_signal(sema);
|
||||
return 0;
|
||||
};
|
||||
|
||||
[au allocateRenderResourcesAndReturnError:&err];
|
||||
if (err != nil)
|
||||
return nil;
|
||||
|
||||
_au = au;
|
||||
|
||||
RARCH_LOG("[CoreAudio3]: Using buffer size of %u bytes: (latency = %u ms)\n", (unsigned)self.bufferSizeInBytes, latency);
|
||||
|
||||
[self start];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
rb_free(&_rb);
|
||||
}
|
||||
|
||||
- (BOOL)paused {
|
||||
return !_au.running;
|
||||
}
|
||||
|
||||
- (size_t)bufferSizeInBytes {
|
||||
return _bufferSize * sizeof(float);
|
||||
}
|
||||
|
||||
- (size_t)writeAvailableInBytes {
|
||||
return rb_avail(&_rb) * sizeof(float);
|
||||
}
|
||||
|
||||
- (void)start {
|
||||
NSError *err;
|
||||
[_au startHardwareAndReturnError:&err];
|
||||
}
|
||||
|
||||
- (void)stop {
|
||||
[_au stopHardware];
|
||||
}
|
||||
|
||||
- (ssize_t)writeFloat:(const float *)data samples:(size_t)samples {
|
||||
size_t written = 0;
|
||||
while (!g_interrupted && samples > 0)
|
||||
{
|
||||
size_t write_avail = rb_avail(&_rb);
|
||||
if (write_avail > samples)
|
||||
write_avail = samples;
|
||||
|
||||
rb_write_data(&_rb, data, write_avail);
|
||||
data += write_avail;
|
||||
written += write_avail;
|
||||
samples -= write_avail;
|
||||
|
||||
if (_nonBlock)
|
||||
break;
|
||||
|
||||
if (write_avail == 0)
|
||||
dispatch_semaphore_wait(_sema, DISPATCH_TIME_FOREVER);
|
||||
}
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static void coreaudio3_free(void *data)
|
||||
{
|
||||
CoreAudio3 *dev = (__bridge_transfer CoreAudio3 *)data;
|
||||
if (dev == nil)
|
||||
return;
|
||||
|
||||
[dev stop];
|
||||
dev = nil;
|
||||
}
|
||||
|
||||
static void *coreaudio3_init(const char *device,
|
||||
unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
{
|
||||
CoreAudio3 *dev = [[CoreAudio3 alloc] initWithRate:rate
|
||||
latency:latency];
|
||||
|
||||
*new_rate = rate;
|
||||
|
||||
return (__bridge_retained void *)dev;
|
||||
}
|
||||
|
||||
static ssize_t coreaudio3_write(void *data, const void *buf_, size_t size)
|
||||
{
|
||||
CoreAudio3 *dev = (__bridge CoreAudio3 *)data;
|
||||
return [dev writeFloat:(const float *)buf_ samples:size/sizeof(float)] * sizeof(float);
|
||||
}
|
||||
|
||||
static void coreaudio3_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
CoreAudio3 *dev = (__bridge CoreAudio3 *)data;
|
||||
if (dev == nil)
|
||||
return;
|
||||
|
||||
dev.nonBlock = state;
|
||||
}
|
||||
|
||||
static bool coreaudio3_alive(void *data)
|
||||
{
|
||||
CoreAudio3 *dev = (__bridge CoreAudio3 *)data;
|
||||
if (dev == nil)
|
||||
return NO;
|
||||
|
||||
return !dev.paused;
|
||||
}
|
||||
|
||||
static bool coreaudio3_stop(void *data)
|
||||
{
|
||||
CoreAudio3 *dev = (__bridge CoreAudio3 *)data;
|
||||
if (dev == nil)
|
||||
return NO;
|
||||
|
||||
[dev stop];
|
||||
return dev.paused;
|
||||
}
|
||||
|
||||
static bool coreaudio3_start(void *data, bool is_shutdown)
|
||||
{
|
||||
CoreAudio3 *dev = (__bridge CoreAudio3 *)data;
|
||||
if (dev == nil)
|
||||
return NO;
|
||||
|
||||
[dev start];
|
||||
return !dev.paused;
|
||||
}
|
||||
|
||||
static bool coreaudio3_use_float(void *data)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
static size_t coreaudio3_write_avail(void *data)
|
||||
{
|
||||
CoreAudio3 *dev = (__bridge CoreAudio3 *)data;
|
||||
if (dev == nil)
|
||||
return 0;
|
||||
|
||||
return dev.writeAvailableInBytes;
|
||||
}
|
||||
|
||||
static size_t coreaudio3_buffer_size(void *data)
|
||||
{
|
||||
CoreAudio3 *dev = (__bridge CoreAudio3 *)data;
|
||||
if (dev == nil)
|
||||
return 0;
|
||||
|
||||
return dev.bufferSizeInBytes;
|
||||
}
|
||||
|
||||
audio_driver_t audio_coreaudio3 = {
|
||||
coreaudio3_init,
|
||||
coreaudio3_write,
|
||||
coreaudio3_stop,
|
||||
coreaudio3_start,
|
||||
coreaudio3_alive,
|
||||
coreaudio3_set_nonblock_state,
|
||||
coreaudio3_free,
|
||||
coreaudio3_use_float,
|
||||
"coreaudio3",
|
||||
coreaudio3_write_avail,
|
||||
coreaudio3_buffer_size,
|
||||
};
|
@ -210,4 +210,3 @@ audio_driver_t audio_ctr_dsp = {
|
||||
ctr_dsp_audio_write_avail,
|
||||
ctr_dsp_audio_buffer_size
|
||||
};
|
||||
|
||||
|
@ -84,22 +84,21 @@ static void audioCreateThread(ps2_audio_t *ps2)
|
||||
ps2->running = true;
|
||||
ps2->worker_thread = CreateThread(&thread);
|
||||
|
||||
if (ps2->worker_thread >= 0) {
|
||||
if (ps2->worker_thread >= 0)
|
||||
{
|
||||
ret = StartThread(ps2->worker_thread, NULL);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
printf("sound_init: StartThread returned %d\n", ret);
|
||||
}
|
||||
} else {
|
||||
else
|
||||
printf("CreateThread failed: %d\n", ps2->worker_thread);
|
||||
}
|
||||
}
|
||||
|
||||
static void audioStopNDeleteThread(ps2_audio_t *ps2)
|
||||
{
|
||||
ps2->running = false;
|
||||
if (ps2->worker_thread) {
|
||||
if (ps2->worker_thread)
|
||||
ps2->worker_thread = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void audioConfigure(ps2_audio_t *ps2, unsigned rate)
|
||||
@ -187,14 +186,14 @@ static ssize_t ps2_audio_write(void *data, const void *buf, size_t size)
|
||||
if (!ps2->running)
|
||||
return -1;
|
||||
|
||||
if (ps2->nonblocking){
|
||||
if (ps2->nonblocking)
|
||||
{
|
||||
if (fifo_write_avail(ps2->buffer) < size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (fifo_write_avail(ps2->buffer) < size) {
|
||||
while (fifo_write_avail(ps2->buffer) < size)
|
||||
WaitSema(ps2->cond_lock);
|
||||
}
|
||||
|
||||
WaitSema(ps2->lock);
|
||||
fifo_write(ps2->buffer, buf, size);
|
||||
@ -206,11 +205,10 @@ static ssize_t ps2_audio_write(void *data, const void *buf, size_t size)
|
||||
static bool ps2_audio_alive(void *data)
|
||||
{
|
||||
bool alive = false;
|
||||
|
||||
ps2_audio_t* ps2 = (ps2_audio_t*)data;
|
||||
if (ps2) {
|
||||
|
||||
if (ps2)
|
||||
alive = ps2->running;
|
||||
}
|
||||
|
||||
return alive;
|
||||
}
|
||||
@ -220,7 +218,8 @@ static bool ps2_audio_stop(void *data)
|
||||
bool stop = true;
|
||||
ps2_audio_t* ps2 = (ps2_audio_t*)data;
|
||||
|
||||
if (ps2) {
|
||||
if (ps2)
|
||||
{
|
||||
audioStopNDeleteThread(ps2);
|
||||
audsrv_stop_audio();
|
||||
}
|
||||
@ -233,11 +232,11 @@ 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) {
|
||||
if (ps2)
|
||||
{
|
||||
if (!ps2->running && !ps2->worker_thread)
|
||||
audioCreateThread(ps2);
|
||||
}
|
||||
}
|
||||
|
||||
return start;
|
||||
}
|
||||
@ -246,9 +245,8 @@ static void ps2_audio_set_nonblock_state(void *data, bool toggle)
|
||||
{
|
||||
ps2_audio_t* ps2 = (ps2_audio_t*)data;
|
||||
|
||||
if (ps2) {
|
||||
if (ps2)
|
||||
ps2->nonblocking = toggle;
|
||||
}
|
||||
}
|
||||
|
||||
static bool ps2_audio_use_float(void *data)
|
||||
@ -260,7 +258,8 @@ static size_t ps2_audio_write_avail(void *data)
|
||||
{
|
||||
ps2_audio_t* ps2 = (ps2_audio_t*)data;
|
||||
|
||||
if (ps2 && ps2->running) {
|
||||
if (ps2 && ps2->running)
|
||||
{
|
||||
size_t size;
|
||||
WaitSema(ps2->lock);
|
||||
size = AUDIO_BUFFER - fifo_read_avail(ps2->buffer);
|
||||
|
@ -241,7 +241,6 @@ static ssize_t psp_audio_write(void *data, const void *buf, size_t size)
|
||||
slock_unlock(psp->fifo_lock);
|
||||
return size;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static bool psp_audio_alive(void *data)
|
||||
|
@ -360,4 +360,3 @@ static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32 flags, XAUDIO2_
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -66,7 +66,6 @@
|
||||
#define XAUDIO2D_DLL XAUDIO2D_DLL_A
|
||||
#endif
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* XAudio2 COM object class and interface IDs.
|
||||
@ -103,7 +102,6 @@ DEFINE_IID_X(IXAudio2, 60d8dac8, 5aa1, 4e8e, b5, 97, 2f, 5e, 28, 83, d4, 84);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Ignore the rest of this header if only the GUID definitions were requested
|
||||
#ifndef GUID_DEFS_ONLY
|
||||
|
||||
@ -115,7 +113,6 @@ DEFINE_IID_X(IXAudio2, 60d8dac8, 5aa1, 4e8e, b5, 97, 2f, 5e, 28, 83, d4, 84);
|
||||
// All structures defined in this file use tight field packing
|
||||
#pragma pack(push, 1)
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* XAudio2 constants, flags and error codes.
|
||||
@ -205,7 +202,6 @@ FWD_DECLARE(IXAudio2MasteringVoice);
|
||||
FWD_DECLARE(IXAudio2EngineCallback);
|
||||
FWD_DECLARE(IXAudio2VoiceCallback);
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* XAudio2 structures and enumerations.
|
||||
@ -420,7 +416,6 @@ typedef struct XAUDIO2_DEBUG_CONFIGURATION
|
||||
#define XAUDIO2_LOG_MEMORY 0x0100 // Memory heap usage information.
|
||||
#define XAUDIO2_LOG_STREAMING 0x1000 // Audio streaming information.
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* IXAudio2: Top-level XAudio2 COM interface.
|
||||
@ -512,7 +507,6 @@ DECLARE_INTERFACE_(IXAudio2, IUnknown)
|
||||
_In_opt_ const XAUDIO2_VOICE_SENDS* pSendList X2DEFAULT(NULL),
|
||||
_In_opt_ const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE;
|
||||
|
||||
|
||||
// NAME: IXAudio2::CreateMasteringVoice
|
||||
// DESCRIPTION: Creates and configures a mastering voice.
|
||||
//
|
||||
@ -570,7 +564,6 @@ DECLARE_INTERFACE_(IXAudio2, IUnknown)
|
||||
_Reserved_ void* pReserved X2DEFAULT(NULL)) PURE;
|
||||
};
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* IXAudio2Voice: Base voice management interface.
|
||||
@ -794,7 +787,6 @@ DECLARE_INTERFACE(IXAudio2Voice)
|
||||
Declare_IXAudio2Voice_Methods();
|
||||
};
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* IXAudio2SourceVoice: Source voice management interface.
|
||||
@ -895,7 +887,6 @@ DECLARE_INTERFACE_(IXAudio2SourceVoice, IXAudio2Voice)
|
||||
STDMETHOD(SetSourceSampleRate) (THIS_ UINT32 NewSourceSampleRate) PURE;
|
||||
};
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* IXAudio2SubmixVoice: Submixing voice management interface.
|
||||
@ -912,7 +903,6 @@ DECLARE_INTERFACE_(IXAudio2SubmixVoice, IXAudio2Voice)
|
||||
// There are currently no methods specific to submix voices.
|
||||
};
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* IXAudio2MasteringVoice: Mastering voice management interface.
|
||||
@ -936,7 +926,6 @@ DECLARE_INTERFACE_(IXAudio2MasteringVoice, IXAudio2Voice)
|
||||
STDMETHOD(GetChannelMask) (THIS_ _Out_ DWORD* pChannelmask) PURE;
|
||||
};
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* IXAudio2EngineCallback: Client notification interface for engine events.
|
||||
@ -964,7 +953,6 @@ DECLARE_INTERFACE(IXAudio2EngineCallback)
|
||||
STDMETHOD_(void, OnCriticalError) (THIS_ HRESULT Error) PURE;
|
||||
};
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* IXAudio2VoiceCallback: Client notification interface for voice events.
|
||||
@ -1008,7 +996,6 @@ DECLARE_INTERFACE(IXAudio2VoiceCallback)
|
||||
STDMETHOD_(void, OnVoiceError) (THIS_ void* pBufferContext, HRESULT Error) PURE;
|
||||
};
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macros to make it easier to use the XAudio2 COM interfaces in C code.
|
||||
@ -1127,7 +1114,6 @@ DECLARE_INTERFACE(IXAudio2VoiceCallback)
|
||||
|
||||
#endif /* #ifndef __cplusplus */
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Utility functions used to convert from pitch in semitones and volume
|
||||
@ -1205,10 +1191,8 @@ static INLINE float XAudio2CutoffFrequencyToOnePoleCoefficient(float CutoffFrequ
|
||||
return (1.0f - powf(1.0f - 2.0f * CutoffFrequency / SampleRate, 2.0f));
|
||||
}
|
||||
|
||||
|
||||
#endif // #ifdef XAUDIO2_HELPER_FUNCTIONS
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* XAudio2Create: Top-level function that creates an XAudio2 instance.
|
||||
|
@ -78,7 +78,6 @@
|
||||
# d23: (temp) # d31: buffer[6]
|
||||
# (temp) # buffer[7]
|
||||
|
||||
|
||||
resampler_CC_downsample_neon:
|
||||
_resampler_CC_downsample_neon:
|
||||
|
||||
@ -89,7 +88,6 @@ push {r4}
|
||||
|
||||
mov r4, r0
|
||||
|
||||
|
||||
veor q0, q0, q0
|
||||
vmov.f32 s1, #1.0
|
||||
vmov.f32 s2, #2.0
|
||||
@ -102,18 +100,15 @@ vmov.f32 q5, #1.0
|
||||
vmov.f32 q6, #3.0
|
||||
vmov.f32 q7, #0.25
|
||||
|
||||
|
||||
vldr s5, [r2, #32]
|
||||
vdiv.f32 s6, s20, s4
|
||||
vadd.f32 s7, s6, s8
|
||||
vdup.f32 q4, d2[0]
|
||||
vmin.f32 q4, q4, q5
|
||||
|
||||
|
||||
lsl r3, #3
|
||||
add r3, r3, r1
|
||||
|
||||
|
||||
cmp r3, r1
|
||||
beq 3f
|
||||
1:
|
||||
@ -199,7 +194,6 @@ vpop {q4,q5,q6,q7}
|
||||
|
||||
bx lr
|
||||
|
||||
|
||||
.align 4
|
||||
.globl resampler_CC_upsample_neon
|
||||
#ifndef __MACH__
|
||||
@ -256,7 +250,6 @@ bx lr
|
||||
# d23: (temp) # d31: buffer[6]
|
||||
# (temp) # buffer[7]
|
||||
|
||||
|
||||
resampler_CC_upsample_neon:
|
||||
_resampler_CC_upsample_neon:
|
||||
|
||||
@ -267,7 +260,6 @@ push {r4}
|
||||
|
||||
mov r4, r0
|
||||
|
||||
|
||||
veor q0, q0, q0
|
||||
vmov.f32 s0, #1.0
|
||||
vmov.f32 s2, #-1.0
|
||||
@ -280,18 +272,15 @@ vmov.f32 q5, #1.0
|
||||
vmov.f32 q6, #3.0
|
||||
vmov.f32 q7, #0.25
|
||||
|
||||
|
||||
vldr s5, [r2, #32]
|
||||
vdiv.f32 s6, s20, s4
|
||||
vadd.f32 s7, s6, s8
|
||||
vdup.f32 q4, d2[0]
|
||||
vmin.f32 q4, q4, q5
|
||||
|
||||
|
||||
lsl r3, #3
|
||||
add r3, r3, r1
|
||||
|
||||
|
||||
cmp r3, r1
|
||||
beq 4f
|
||||
1:
|
||||
@ -356,7 +345,6 @@ vst1.f32 d20, [r4, :64]!
|
||||
|
||||
vadd.f32 s5, s5, s6
|
||||
|
||||
|
||||
vcmpe.f32 s5, s20
|
||||
vmrs APSR_nzcv, fpscr
|
||||
blt 2b
|
||||
@ -368,7 +356,6 @@ vsub.f32 s5, s5, s20
|
||||
cmp r3, r1
|
||||
bne 1b
|
||||
|
||||
|
||||
4:
|
||||
vst1.f32 {q14-q15}, [r2, :256]
|
||||
vstr s5, [r2, #32]
|
||||
|
@ -52,7 +52,11 @@
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
#ifdef __CELLOS_LV2__
|
||||
#include <sys/poll.h>
|
||||
#else
|
||||
#include <poll.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#ifdef _WIN32
|
||||
|
@ -167,7 +167,6 @@ SECTIONS
|
||||
.jcr : { KEEP (*(.jcr)) }
|
||||
.got : { *(.got.plt) *(.got) }
|
||||
|
||||
|
||||
/* We want the small data sections together, so single-instruction offsets
|
||||
can access them all, and initialized data all before uninitialized, so
|
||||
we can shorten the on-disk segment size. */
|
||||
|
@ -178,7 +178,6 @@ SECTIONS
|
||||
.jcr : { KEEP (*(.jcr)) }
|
||||
.got : { *(.got.plt) *(.got) }
|
||||
|
||||
|
||||
/* We want the small data sections together, so single-instruction offsets
|
||||
can access them all, and initialized data all before uninitialized, so
|
||||
we can shorten the on-disk segment size. */
|
||||
|
@ -1118,6 +1118,8 @@ enum
|
||||
|
||||
static int cheevos_iterate(coro_t* coro)
|
||||
{
|
||||
const int snes_header_len = 0x200;
|
||||
const int lynx_header_len = 0x40;
|
||||
ssize_t num_read = 0;
|
||||
size_t to_read = 4096;
|
||||
uint8_t *buffer = NULL;
|
||||
@ -1159,10 +1161,10 @@ static int cheevos_iterate(coro_t* coro)
|
||||
|
||||
static cheevos_finder_t finders[] =
|
||||
{
|
||||
{SNES_MD5, "SNES (8Mb padding)", snes_exts},
|
||||
{SNES_MD5, "SNES (discards header)", snes_exts},
|
||||
{GENESIS_MD5, "Genesis (6Mb padding)", genesis_exts},
|
||||
{LYNX_MD5, "Atari Lynx (only first 512 bytes)", lynx_exts},
|
||||
{NES_MD5, "NES (discards VROM)", NULL},
|
||||
{LYNX_MD5, "Atari Lynx (discards header)", lynx_exts},
|
||||
{NES_MD5, "NES (discards header)", NULL},
|
||||
{GENERIC_MD5, "Generic (plain content)", NULL},
|
||||
{FILENAME_MD5, "Generic (filename)", NULL}
|
||||
};
|
||||
@ -1403,33 +1405,22 @@ found:
|
||||
* Output CHEEVOS_VAR_GAMEID the Retro Achievements game ID, or 0 if not found
|
||||
*************************************************************************/
|
||||
CORO_SUB(SNES_MD5)
|
||||
|
||||
MD5_Init(&coro->md5);
|
||||
|
||||
coro->offset = 0;
|
||||
coro->count = 0;
|
||||
|
||||
CORO_GOSUB(EVAL_MD5);
|
||||
|
||||
if (coro->count == 0)
|
||||
/* Checks for the existence of a headered SNES file.
|
||||
Unheadered files fall back to GENERIC_MD5. */
|
||||
if (coro->len < 0x2000 || coro->len % 0x2000 != snes_header_len)
|
||||
{
|
||||
MD5_Final(coro->hash, &coro->md5);
|
||||
coro->gameid = 0;
|
||||
CORO_RET();
|
||||
}
|
||||
|
||||
if (coro->count < CHEEVOS_MB(8))
|
||||
{
|
||||
/*
|
||||
* Inputs: CHEEVOS_VAR_MD5, CHEEVOS_VAR_OFFSET, CHEEVOS_VAR_COUNT
|
||||
* Outputs: CHEEVOS_VAR_MD5
|
||||
*/
|
||||
coro->offset = 0;
|
||||
coro->count = CHEEVOS_MB(8) - coro->count;
|
||||
CORO_GOSUB(FILL_MD5);
|
||||
}
|
||||
coro->offset = snes_header_len;
|
||||
coro->count = 0;
|
||||
|
||||
CORO_GOSUB(EVAL_MD5);
|
||||
MD5_Final(coro->hash, &coro->md5);
|
||||
|
||||
CORO_GOTO(GET_GAMEID);
|
||||
|
||||
/**************************************************************************
|
||||
@ -1469,16 +1460,18 @@ found:
|
||||
*************************************************************************/
|
||||
CORO_SUB(LYNX_MD5)
|
||||
|
||||
if (coro->len < 0x0240)
|
||||
/* Checks for the existence of a headered Lynx file.
|
||||
Unheadered files fall back to GENERIC_MD5. */
|
||||
if (coro->len <= lynx_header_len ||
|
||||
memcmp("LYNX", (void *)coro->data, 5) != 0)
|
||||
{
|
||||
coro->gameid = 0;
|
||||
CORO_RET();
|
||||
}
|
||||
|
||||
MD5_Init(&coro->md5);
|
||||
|
||||
coro->offset = 0x0040;
|
||||
coro->count = 0x0200;
|
||||
coro->offset = lynx_header_len;
|
||||
coro->count = coro->len - lynx_header_len;
|
||||
CORO_GOSUB(EVAL_MD5);
|
||||
|
||||
MD5_Final(coro->hash, &coro->md5);
|
||||
@ -1491,13 +1484,8 @@ found:
|
||||
*************************************************************************/
|
||||
CORO_SUB(NES_MD5)
|
||||
|
||||
/* Note about the references to the FCEU emulator below. There is no
|
||||
* core-specific code in this function, it's rather Retro Achievements
|
||||
* specific code that must be followed to the letter so we compute
|
||||
* the correct ROM hash. Retro Achievements does indeed use some
|
||||
* FCEU related method to compute the hash, since its NES emulator
|
||||
* is based on it. */
|
||||
|
||||
/* Checks for the existence of a headered NES file.
|
||||
Unheadered files fall back to GENERIC_MD5. */
|
||||
if (coro->len < sizeof(coro->header))
|
||||
{
|
||||
coro->gameid = 0;
|
||||
@ -1507,83 +1495,22 @@ found:
|
||||
memcpy((void*)&coro->header, coro->data,
|
||||
sizeof(coro->header));
|
||||
|
||||
if (coro->header.id[0] == 'N'
|
||||
&& coro->header.id[1] == 'E'
|
||||
&& coro->header.id[2] == 'S'
|
||||
&& coro->header.id[3] == 0x1a)
|
||||
if ( coro->header.id[0] != 'N'
|
||||
|| coro->header.id[1] != 'E'
|
||||
|| coro->header.id[2] != 'S'
|
||||
|| coro->header.id[3] != 0x1a)
|
||||
{
|
||||
size_t romsize = 256;
|
||||
/* from FCEU core - compute size using the cart mapper */
|
||||
int mapper = (coro->header.rom_type >> 4) | (coro->header.rom_type2 & 0xF0);
|
||||
|
||||
if (coro->header.rom_size)
|
||||
romsize = next_pow2(coro->header.rom_size);
|
||||
|
||||
/* for games not to the power of 2, so we just read enough
|
||||
* PRG rom from it, but we have to keep ROM_size to the power of 2
|
||||
* since PRGCartMapping wants ROM_size to be to the power of 2
|
||||
* so instead if not to power of 2, we just use head.ROM_size when
|
||||
* we use FCEU_read. */
|
||||
coro->round = mapper != 53 && mapper != 198 && mapper != 228;
|
||||
coro->bytes = coro->round ? romsize : coro->header.rom_size;
|
||||
|
||||
coro->offset = sizeof(coro->header) + (coro->header.rom_type & 4
|
||||
? sizeof(coro->header) : 0);
|
||||
|
||||
/* from FCEU core - check if Trainer included in ROM data */
|
||||
MD5_Init(&coro->md5);
|
||||
coro->count = 0x4000 * coro->bytes;
|
||||
CORO_GOSUB(EVAL_MD5);
|
||||
|
||||
if (coro->count < 0x4000 * coro->bytes)
|
||||
{
|
||||
coro->offset = 0xff;
|
||||
coro->count = 0x4000 * coro->bytes - coro->count;
|
||||
CORO_GOSUB(FILL_MD5);
|
||||
coro->gameid = 0;
|
||||
CORO_RET();
|
||||
}
|
||||
|
||||
MD5_Init(&coro->md5);
|
||||
coro->offset = sizeof(coro->header);
|
||||
coro->count = coro->len - coro->offset;
|
||||
CORO_GOSUB(EVAL_MD5);
|
||||
|
||||
MD5_Final(coro->hash, &coro->md5);
|
||||
CORO_GOTO(GET_GAMEID);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned i;
|
||||
size_t chunks = coro->len >> 14;
|
||||
size_t chunk_size = 0x4000;
|
||||
|
||||
/* Fall back to headerless hashing
|
||||
* PRG ROM size is unknown, so test by 16KB chunks */
|
||||
|
||||
coro->round = 0;
|
||||
coro->offset = 0;
|
||||
|
||||
for (i = 0; i < chunks; i++)
|
||||
{
|
||||
MD5_Init(&coro->md5);
|
||||
|
||||
coro->bytes = i + 1;
|
||||
coro->count = coro->bytes * chunk_size;
|
||||
|
||||
CORO_GOSUB(EVAL_MD5);
|
||||
|
||||
if (coro->count < 0x4000 * coro->bytes)
|
||||
{
|
||||
coro->offset = 0xff;
|
||||
coro->count = 0x4000 * coro->bytes - coro->count;
|
||||
CORO_GOSUB(FILL_MD5);
|
||||
}
|
||||
|
||||
MD5_Final(coro->hash, &coro->md5);
|
||||
CORO_GOSUB(GET_GAMEID);
|
||||
|
||||
if (coro->gameid > 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CORO_RET();
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Info Tries to identify a "generic" game
|
||||
|
@ -2571,6 +2571,8 @@ enum
|
||||
|
||||
static int cheevos_iterate(coro_t *coro)
|
||||
{
|
||||
const int snes_header_len = 0x200;
|
||||
const int lynx_header_len = 0x40;
|
||||
ssize_t num_read = 0;
|
||||
size_t to_read = 4096;
|
||||
uint8_t *buffer = NULL;
|
||||
@ -2614,7 +2616,7 @@ static int cheevos_iterate(coro_t *coro)
|
||||
{
|
||||
{SNES_MD5, "SNES (discards header)", snes_exts},
|
||||
{GENESIS_MD5, "Genesis (6Mb padding)", genesis_exts},
|
||||
{LYNX_MD5, "Atari Lynx (only first 512 bytes)", lynx_exts},
|
||||
{LYNX_MD5, "Atari Lynx (discards header)", lynx_exts},
|
||||
{NES_MD5, "NES (discards header)", NULL},
|
||||
{GENERIC_MD5, "Generic (plain content)", NULL},
|
||||
{FILENAME_MD5, "Generic (filename)", NULL}
|
||||
@ -2903,9 +2905,7 @@ found:
|
||||
/* Checks for the existence of a headered SNES file.
|
||||
Unheadered files fall back to GENERIC_MD5. */
|
||||
|
||||
const int SNES_HEADER_LEN = 0x200;
|
||||
|
||||
if (coro->len < 0x2000 || coro->len % 0x2000 != SNES_HEADER_LEN)
|
||||
if (coro->len < 0x2000 || coro->len % 0x2000 != snes_header_len)
|
||||
{
|
||||
coro->gameid = 0;
|
||||
CORO_RET();
|
||||
@ -2956,16 +2956,19 @@ found:
|
||||
*************************************************************************/
|
||||
CORO_SUB(LYNX_MD5)
|
||||
|
||||
if (coro->len < 0x0240)
|
||||
/* Checks for the existence of a headered Lynx file.
|
||||
Unheadered files fall back to GENERIC_MD5. */
|
||||
|
||||
if (coro->len <= (unsigned)lynx_header_len ||
|
||||
memcmp("LYNX", (void *)coro->data, 5) != 0)
|
||||
{
|
||||
coro->gameid = 0;
|
||||
CORO_RET();
|
||||
}
|
||||
|
||||
MD5_Init(&coro->md5);
|
||||
|
||||
coro->offset = 0x0040;
|
||||
coro->count = 0x0200;
|
||||
coro->offset = lynx_header_len;
|
||||
coro->count = coro->len - lynx_header_len;
|
||||
CORO_GOSUB(EVAL_MD5);
|
||||
|
||||
MD5_Final(coro->hash, &coro->md5);
|
||||
|
63
command.c
63
command.c
@ -42,7 +42,7 @@
|
||||
#ifdef HAVE_CHEEVOS
|
||||
#include "cheevos/cheevos.h"
|
||||
#ifdef HAVE_NEW_CHEEVOS
|
||||
#include "cheevos/fixup.h"
|
||||
#include "cheevos-new/fixup.h"
|
||||
#else
|
||||
#include "cheevos/var.h"
|
||||
#endif
|
||||
@ -89,7 +89,9 @@
|
||||
#include "managers/cheat_manager.h"
|
||||
#include "managers/state_manager.h"
|
||||
#include "ui/ui_companion_driver.h"
|
||||
#include "tasks/task_content.h"
|
||||
#include "tasks/tasks_internal.h"
|
||||
#include "gfx/video_driver.h"
|
||||
#include "list_special.h"
|
||||
|
||||
#include "core.h"
|
||||
@ -174,7 +176,7 @@ static bool command_version(const char* arg)
|
||||
{
|
||||
char reply[256] = {0};
|
||||
|
||||
sprintf(reply, "%s\n", PACKAGE_VERSION);
|
||||
snprintf(reply, sizeof(reply), "%s\n", PACKAGE_VERSION);
|
||||
#if defined(HAVE_CHEEVOS) && (defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING))
|
||||
command_reply(reply, strlen(reply));
|
||||
#endif
|
||||
@ -291,7 +293,7 @@ static bool command_read_ram(const char *arg)
|
||||
|
||||
if (data)
|
||||
{
|
||||
for (i=0;i<nbytes;i++)
|
||||
for (i = 0; i < nbytes; i++)
|
||||
sprintf(reply_at+3*i, " %.2X", data[i]);
|
||||
reply_at[3*nbytes] = '\n';
|
||||
command_reply(reply, reply_at+3*nbytes+1 - reply);
|
||||
@ -323,7 +325,7 @@ static bool command_read_ram(const char *arg)
|
||||
{
|
||||
unsigned nbytes = strtol(reply_at, NULL, 10);
|
||||
|
||||
for (i=0;i<nbytes;i++)
|
||||
for (i = 0; i < nbytes; i++)
|
||||
sprintf(reply_at+3*i, " %.2X", data[i]);
|
||||
reply_at[3*nbytes] = '\n';
|
||||
command_reply(reply, reply_at+3*nbytes+1 - reply);
|
||||
@ -1766,56 +1768,6 @@ static bool command_event_resize_windowed_scale(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
void command_playlist_push_write(
|
||||
playlist_t *playlist,
|
||||
const char *path,
|
||||
const char *label,
|
||||
const char *core_path,
|
||||
const char *core_name)
|
||||
{
|
||||
if (!playlist)
|
||||
return;
|
||||
|
||||
if (playlist_push(
|
||||
playlist,
|
||||
path,
|
||||
label,
|
||||
core_path,
|
||||
core_name,
|
||||
NULL,
|
||||
NULL
|
||||
))
|
||||
playlist_write_file(playlist);
|
||||
}
|
||||
|
||||
void command_playlist_update_write(
|
||||
playlist_t *plist,
|
||||
size_t idx,
|
||||
const char *path,
|
||||
const char *label,
|
||||
const char *core_path,
|
||||
const char *core_display_name,
|
||||
const char *crc32,
|
||||
const char *db_name)
|
||||
{
|
||||
playlist_t *playlist = plist ? plist : playlist_get_cached();
|
||||
|
||||
if (!playlist)
|
||||
return;
|
||||
|
||||
playlist_update(
|
||||
playlist,
|
||||
idx,
|
||||
path,
|
||||
label,
|
||||
core_path,
|
||||
core_display_name,
|
||||
crc32,
|
||||
db_name);
|
||||
|
||||
playlist_write_file(playlist);
|
||||
}
|
||||
|
||||
/**
|
||||
* command_event:
|
||||
* @cmd : Event command index.
|
||||
@ -2020,9 +1972,6 @@ bool command_event(enum event_command cmd, void *data)
|
||||
path_clear(RARCH_PATH_CORE);
|
||||
rarch_ctl(RARCH_CTL_SYSTEM_INFO_FREE, NULL);
|
||||
#endif
|
||||
core_unload_game();
|
||||
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
|
||||
core_unload();
|
||||
#ifdef HAVE_DISCORD
|
||||
if (discord_is_inited)
|
||||
{
|
||||
|
19
command.h
19
command.h
@ -27,8 +27,6 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "playlist.h"
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
typedef struct command command_t;
|
||||
@ -272,23 +270,6 @@ bool command_free(command_t *handle);
|
||||
**/
|
||||
bool command_event(enum event_command action, void *data);
|
||||
|
||||
void command_playlist_push_write(
|
||||
playlist_t *playlist,
|
||||
const char *path,
|
||||
const char *label,
|
||||
const char *core_path,
|
||||
const char *core_name);
|
||||
|
||||
void command_playlist_update_write(
|
||||
playlist_t *playlist,
|
||||
size_t idx,
|
||||
const char *path,
|
||||
const char *label,
|
||||
const char *core_path,
|
||||
const char *core_display_name,
|
||||
const char *crc32,
|
||||
const char *db_name);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
26
config.def.h
26
config.def.h
@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
* Copyright (C) 2016 - Brad Parker
|
||||
* Copyright (C) 2016-2019 - 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-
|
||||
@ -373,14 +373,8 @@ static unsigned menu_shader_pipeline = 2;
|
||||
#endif
|
||||
|
||||
static bool show_advanced_settings = false;
|
||||
static const uint32_t menu_entry_normal_color = 0xffffffff;
|
||||
static const uint32_t menu_entry_hover_color = 0xff64ff64;
|
||||
static const uint32_t menu_title_color = 0xff64ff64;
|
||||
static const uint32_t menu_bg_dark_color = 0xc0202020;
|
||||
static const uint32_t menu_bg_light_color = 0xc0404040;
|
||||
static const uint32_t menu_border_dark_color = 0xc0204020;
|
||||
static const uint32_t menu_border_light_color = 0xc0408040;
|
||||
static unsigned rgui_color_theme = RGUI_THEME_CUSTOM;
|
||||
static unsigned rgui_color_theme = RGUI_THEME_CLASSIC_GREEN;
|
||||
static unsigned rgui_thumbnail_downscaler = RGUI_THUMB_SCALE_POINT;
|
||||
|
||||
#else
|
||||
static bool default_block_config_read = false;
|
||||
@ -402,12 +396,14 @@ 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)
|
||||
#elif defined(PS2) || defined(PSP)
|
||||
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)
|
||||
static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_START_SELECT;
|
||||
#elif TARGET_OS_TV
|
||||
static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_DOWN_Y_L_R;
|
||||
#else
|
||||
static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_NONE;
|
||||
#endif
|
||||
@ -508,6 +504,13 @@ static const bool video_3ds_lcd_bottom = true;
|
||||
/* Will enable audio or not. */
|
||||
static const bool audio_enable = true;
|
||||
|
||||
/* Enable menu audio sounds. */
|
||||
static const bool audio_enable_menu = false;
|
||||
static const bool audio_enable_menu_ok = false;
|
||||
static const bool audio_enable_menu_cancel = false;
|
||||
static const bool audio_enable_menu_notice = false;
|
||||
static const bool audio_enable_menu_bgm = false;
|
||||
|
||||
/* Output samplerate. */
|
||||
#ifdef GEKKO
|
||||
static const unsigned out_rate = 32000;
|
||||
@ -689,6 +692,9 @@ static const uint16_t network_remote_base_port = 55400;
|
||||
/* Number of entries that will be kept in content history playlist file. */
|
||||
static const unsigned default_content_history_size = 100;
|
||||
|
||||
/* File format to use when writing playlists to disk */
|
||||
static const bool playlist_use_old_format = false;
|
||||
|
||||
/* Show Menu start-up screen on boot. */
|
||||
static const bool default_menu_show_start_screen = true;
|
||||
|
||||
|
@ -152,6 +152,12 @@ static const bool _coreaudio_supp = true;
|
||||
static const bool _coreaudio_supp = false;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_COREAUDIO3
|
||||
static const bool _coreaudio3_supp = true;
|
||||
#else
|
||||
static const bool _coreaudio3_supp = false;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_OSS) || defined(HAVE_OSS_BSD)
|
||||
static const bool _oss_supp = true;
|
||||
#else
|
||||
|
104
configuration.c
104
configuration.c
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
* Copyright (C) 2014-2017 - Jean-André Santoni
|
||||
* Copyright (C) 2015-2017 - Andrés Suárez
|
||||
* Copyright (C) 2016-2017 - Brad Parker
|
||||
* Copyright (C) 2016-2019 - 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-
|
||||
@ -34,6 +34,7 @@
|
||||
|
||||
#include "file_path_special.h"
|
||||
#include "audio/audio_driver.h"
|
||||
#include "gfx/video_driver.h"
|
||||
#include "input/input_driver.h"
|
||||
#include "configuration.h"
|
||||
#include "content.h"
|
||||
@ -50,6 +51,7 @@
|
||||
#include "verbosity.h"
|
||||
#include "lakka.h"
|
||||
|
||||
#include "tasks/task_content.h"
|
||||
#include "tasks/tasks_internal.h"
|
||||
|
||||
#include "../list_special.h"
|
||||
@ -190,6 +192,7 @@ enum audio_driver_enum
|
||||
AUDIO_DSOUND,
|
||||
AUDIO_WASAPI,
|
||||
AUDIO_COREAUDIO,
|
||||
AUDIO_COREAUDIO3,
|
||||
AUDIO_PS3,
|
||||
AUDIO_XENON360,
|
||||
AUDIO_WII,
|
||||
@ -298,7 +301,6 @@ enum menu_driver_enum
|
||||
MENU_MATERIALUI,
|
||||
MENU_XMB,
|
||||
MENU_STRIPES,
|
||||
MENU_NUKLEAR,
|
||||
MENU_OZONE,
|
||||
MENU_NULL
|
||||
};
|
||||
@ -393,6 +395,8 @@ static enum audio_driver_enum AUDIO_DEFAULT_DRIVER = AUDIO_TINYALSA;
|
||||
static enum audio_driver_enum AUDIO_DEFAULT_DRIVER = AUDIO_OSS;
|
||||
#elif defined(HAVE_JACK)
|
||||
static enum audio_driver_enum AUDIO_DEFAULT_DRIVER = AUDIO_JACK;
|
||||
#elif defined(HAVE_COREAUDIO3)
|
||||
static enum audio_driver_enum AUDIO_DEFAULT_DRIVER = AUDIO_COREAUDIO3;
|
||||
#elif defined(HAVE_COREAUDIO)
|
||||
static enum audio_driver_enum AUDIO_DEFAULT_DRIVER = AUDIO_COREAUDIO;
|
||||
#elif defined(HAVE_XAUDIO)
|
||||
@ -525,14 +529,14 @@ static enum joypad_driver_enum JOYPAD_DEFAULT_DRIVER = JOYPAD_ANDROID;
|
||||
static enum joypad_driver_enum JOYPAD_DEFAULT_DRIVER = JOYPAD_SDL;
|
||||
#elif defined(DJGPP)
|
||||
static enum joypad_driver_enum JOYPAD_DEFAULT_DRIVER = JOYPAD_DOS;
|
||||
#elif defined(IOS)
|
||||
static enum joypad_driver_enum JOYPAD_DEFAULT_DRIVER = JOYPAD_MFI;
|
||||
#elif defined(HAVE_HID)
|
||||
static enum joypad_driver_enum JOYPAD_DEFAULT_DRIVER = JOYPAD_HID;
|
||||
#elif defined(__QNX__)
|
||||
static enum joypad_driver_enum JOYPAD_DEFAULT_DRIVER = JOYPAD_QNX;
|
||||
#elif defined(EMSCRIPTEN)
|
||||
static enum joypad_driver_enum JOYPAD_DEFAULT_DRIVER = JOYPAD_RWEBPAD;
|
||||
#elif defined(IOS)
|
||||
static enum joypad_driver_enum JOYPAD_DEFAULT_DRIVER = JOYPAD_MFI;
|
||||
#else
|
||||
static enum joypad_driver_enum JOYPAD_DEFAULT_DRIVER = JOYPAD_NULL;
|
||||
#endif
|
||||
@ -570,7 +574,7 @@ static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_RGUI;
|
||||
static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_XUI;
|
||||
#elif defined(HAVE_MATERIALUI) && defined(RARCH_MOBILE)
|
||||
static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_MATERIALUI;
|
||||
#elif defined(HAVE_OZONE) && defined(HAVE_LIBNX)
|
||||
#elif defined(HAVE_OZONE) && (defined(HAVE_LIBNX) || TARGET_OS_TV)
|
||||
static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_OZONE;
|
||||
#elif defined(HAVE_XMB) && !defined(_XBOX)
|
||||
static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_XMB;
|
||||
@ -666,6 +670,8 @@ const char *config_get_default_audio(void)
|
||||
return "roar";
|
||||
case AUDIO_COREAUDIO:
|
||||
return "coreaudio";
|
||||
case AUDIO_COREAUDIO3:
|
||||
return "coreaudio3";
|
||||
case AUDIO_AL:
|
||||
return "openal";
|
||||
case AUDIO_SL:
|
||||
@ -1089,8 +1095,6 @@ const char *config_get_default_menu(void)
|
||||
return "xmb";
|
||||
case MENU_STRIPES:
|
||||
return "stripes";
|
||||
case MENU_NUKLEAR:
|
||||
return "nuklear";
|
||||
case MENU_NULL:
|
||||
break;
|
||||
}
|
||||
@ -1133,6 +1137,9 @@ static struct config_array_setting *populate_settings_array(settings_t *settings
|
||||
unsigned count = 0;
|
||||
struct config_array_setting *tmp = (struct config_array_setting*)calloc(1, (*size + 1) * sizeof(struct config_array_setting));
|
||||
|
||||
if (!tmp)
|
||||
return NULL;
|
||||
|
||||
/* Arrays */
|
||||
SETTING_ARRAY("playlist_names", settings->arrays.playlist_names, false, NULL, true);
|
||||
SETTING_ARRAY("playlist_cores", settings->arrays.playlist_cores, false, NULL, true);
|
||||
@ -1178,6 +1185,9 @@ static struct config_path_setting *populate_settings_path(settings_t *settings,
|
||||
global_t *global = global_get_ptr();
|
||||
struct config_path_setting *tmp = (struct config_path_setting*)calloc(1, (*size + 1) * sizeof(struct config_path_setting));
|
||||
|
||||
if (!tmp)
|
||||
return NULL;
|
||||
|
||||
/* Paths */
|
||||
#ifdef HAVE_XMB
|
||||
SETTING_PATH("xmb_font", settings->paths.path_menu_xmb_font, false, NULL, true);
|
||||
@ -1209,6 +1219,8 @@ static struct config_path_setting *populate_settings_path(settings_t *settings,
|
||||
#ifdef HAVE_MENU
|
||||
SETTING_PATH("menu_wallpaper",
|
||||
settings->paths.path_menu_wallpaper, false, NULL, true);
|
||||
SETTING_PATH("rgui_menu_theme_preset",
|
||||
settings->paths.path_rgui_theme_preset, false, NULL, true);
|
||||
#endif
|
||||
SETTING_PATH("content_history_path",
|
||||
settings->paths.path_content_history, false, NULL, true);
|
||||
@ -1388,7 +1400,11 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("keyboard_gamepad_enable", &settings->bools.input_keyboard_gamepad_enable, true, true, false);
|
||||
SETTING_BOOL("core_set_supports_no_game_enable", &settings->bools.set_supports_no_game_enable, true, true, false);
|
||||
SETTING_BOOL("audio_enable", &settings->bools.audio_enable, true, audio_enable, false);
|
||||
SETTING_BOOL("audio_enable_menu", &settings->bools.audio_enable_menu, true, false, false);
|
||||
SETTING_BOOL("audio_enable_menu", &settings->bools.audio_enable_menu, true, audio_enable_menu, false);
|
||||
SETTING_BOOL("audio_enable_menu_ok", &settings->bools.audio_enable_menu_ok, true, audio_enable_menu_ok, false);
|
||||
SETTING_BOOL("audio_enable_menu_cancel", &settings->bools.audio_enable_menu_cancel, true, audio_enable_menu_cancel, false);
|
||||
SETTING_BOOL("audio_enable_menu_notice", &settings->bools.audio_enable_menu_notice, true, audio_enable_menu_notice, false);
|
||||
SETTING_BOOL("audio_enable_menu_bgm", &settings->bools.audio_enable_menu_bgm, true, audio_enable_menu_bgm, false);
|
||||
SETTING_BOOL("audio_mute_enable", audio_get_bool_ptr(AUDIO_ACTION_MUTE_ENABLE), true, false, false);
|
||||
SETTING_BOOL("audio_mixer_mute_enable", audio_get_bool_ptr(AUDIO_ACTION_MIXER_MUTE_ENABLE), true, false, false);
|
||||
SETTING_BOOL("location_allow", &settings->bools.location_allow, true, false, false);
|
||||
@ -1556,6 +1572,8 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("video_3ds_lcd_bottom", &settings->bools.video_3ds_lcd_bottom, true, video_3ds_lcd_bottom, false);
|
||||
#endif
|
||||
|
||||
SETTING_BOOL("playlist_use_old_format", &settings->bools.playlist_use_old_format, true, playlist_use_old_format, false);
|
||||
|
||||
*size = count;
|
||||
|
||||
return tmp;
|
||||
@ -1566,6 +1584,9 @@ static struct config_float_setting *populate_settings_float(settings_t *settings
|
||||
unsigned count = 0;
|
||||
struct config_float_setting *tmp = (struct config_float_setting*)calloc(1, (*size + 1) * sizeof(struct config_float_setting));
|
||||
|
||||
if (!tmp)
|
||||
return NULL;
|
||||
|
||||
SETTING_FLOAT("video_aspect_ratio", &settings->floats.video_aspect_ratio, true, aspect_ratio, false);
|
||||
SETTING_FLOAT("video_scale", &settings->floats.video_scale, false, 0.0f, false);
|
||||
SETTING_FLOAT("crt_video_refresh_rate", &settings->floats.crt_video_refresh_rate, true, crt_refresh_rate, false);
|
||||
@ -1602,6 +1623,9 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
|
||||
unsigned count = 0;
|
||||
struct config_uint_setting *tmp = (struct config_uint_setting*)malloc((*size + 1) * sizeof(struct config_uint_setting));
|
||||
|
||||
if (!tmp)
|
||||
return NULL;
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
SETTING_UINT("streaming_mode", &settings->uints.streaming_mode, true, STREAMING_MODE_TWITCH, false);
|
||||
#endif
|
||||
@ -1638,7 +1662,10 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
|
||||
SETTING_UINT("dpi_override_value", &settings->uints.menu_dpi_override_value, true, menu_dpi_override_value, false);
|
||||
SETTING_UINT("menu_thumbnails", &settings->uints.menu_thumbnails, true, menu_thumbnails_default, false);
|
||||
SETTING_UINT("menu_timedate_style", &settings->uints.menu_timedate_style, true, menu_timedate_style, false);
|
||||
#ifdef HAVE_RGUI
|
||||
SETTING_UINT("rgui_menu_color_theme", &settings->uints.menu_rgui_color_theme, true, rgui_color_theme, false);
|
||||
SETTING_UINT("rgui_thumbnail_downscaler", &settings->uints.menu_rgui_thumbnail_downscaler, true, rgui_thumbnail_downscaler, false);
|
||||
#endif
|
||||
#ifdef HAVE_LIBNX
|
||||
SETTING_UINT("split_joycon_p1", &settings->uints.input_split_joycon[0], true, 0, false);
|
||||
SETTING_UINT("split_joycon_p2", &settings->uints.input_split_joycon[1], true, 0, false);
|
||||
@ -1663,7 +1690,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
|
||||
SETTING_UINT("materialui_menu_color_theme", &settings->uints.menu_materialui_color_theme, true, MATERIALUI_THEME_BLUE, false);
|
||||
SETTING_UINT("menu_shader_pipeline", &settings->uints.menu_xmb_shader_pipeline, true, menu_shader_pipeline, false);
|
||||
#ifdef HAVE_OZONE
|
||||
SETTING_UINT("ozone_menu_color_theme", &settings->uints.menu_ozone_color_theme, true, 0, false);
|
||||
SETTING_UINT("ozone_menu_color_theme", &settings->uints.menu_ozone_color_theme, true, 1, false);
|
||||
#endif
|
||||
#endif
|
||||
SETTING_UINT("audio_out_rate", &settings->uints.audio_out_rate, true, out_rate, false);
|
||||
@ -1727,6 +1754,9 @@ static struct config_size_setting *populate_settings_size(settings_t *settings,
|
||||
unsigned count = 0;
|
||||
struct config_size_setting *tmp = (struct config_size_setting*)calloc((*size + 1), sizeof(struct config_size_setting));
|
||||
|
||||
if (!tmp)
|
||||
return NULL;
|
||||
|
||||
SETTING_SIZE("rewind_buffer_size", &settings->sizes.rewind_buffer_size, true, rewind_buffer_size, false);
|
||||
|
||||
*size = count;
|
||||
@ -1739,6 +1769,9 @@ static struct config_int_setting *populate_settings_int(settings_t *settings, in
|
||||
unsigned count = 0;
|
||||
struct config_int_setting *tmp = (struct config_int_setting*)calloc((*size + 1), sizeof(struct config_int_setting));
|
||||
|
||||
if (!tmp)
|
||||
return NULL;
|
||||
|
||||
SETTING_INT("state_slot", &settings->ints.state_slot, false, 0 /* TODO */, false);
|
||||
#ifdef HAVE_NETWORKING
|
||||
SETTING_INT("netplay_check_frames", &settings->ints.netplay_check_frames, true, netplay_check_frames, false);
|
||||
@ -1939,13 +1972,6 @@ void config_set_defaults(void)
|
||||
#ifdef HAVE_MENU
|
||||
if (first_initialized)
|
||||
settings->bools.menu_show_start_screen = default_menu_show_start_screen;
|
||||
settings->uints.menu_entry_normal_color = menu_entry_normal_color;
|
||||
settings->uints.menu_entry_hover_color = menu_entry_hover_color;
|
||||
settings->uints.menu_title_color = menu_title_color;
|
||||
settings->uints.menu_bg_dark_color = menu_bg_dark_color;
|
||||
settings->uints.menu_bg_light_color = menu_bg_light_color;
|
||||
settings->uints.menu_border_dark_color = menu_border_dark_color;
|
||||
settings->uints.menu_border_light_color = menu_border_light_color;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
@ -2048,6 +2074,7 @@ void config_set_defaults(void)
|
||||
#endif
|
||||
*settings->paths.path_cheat_database = '\0';
|
||||
*settings->paths.path_menu_wallpaper = '\0';
|
||||
*settings->paths.path_rgui_theme_preset = '\0';
|
||||
*settings->paths.path_content_database = '\0';
|
||||
*settings->paths.path_overlay = '\0';
|
||||
*settings->paths.path_record_config = '\0';
|
||||
@ -2632,6 +2659,8 @@ static void config_file_dump_all(config_file_t *conf)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is no longer used, so comment out to silence warnings...
|
||||
#ifdef HAVE_MENU
|
||||
static void config_get_hex_base(config_file_t *conf,
|
||||
const char *key, unsigned *base)
|
||||
@ -2643,6 +2672,7 @@ static void config_get_hex_base(config_file_t *conf,
|
||||
*base = tmp;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
/**
|
||||
* config_load:
|
||||
@ -2718,11 +2748,11 @@ static bool config_load_file(const char *path, bool set_defaults,
|
||||
|
||||
while (extra_path)
|
||||
{
|
||||
bool ret = config_append_file(conf, extra_path);
|
||||
bool result = config_append_file(conf, extra_path);
|
||||
|
||||
RARCH_LOG("Config: appending config \"%s\"\n", extra_path);
|
||||
|
||||
if (!ret)
|
||||
if (!result)
|
||||
RARCH_ERR("Config: failed to append config \"%s\"\n", extra_path);
|
||||
extra_path = strtok_r(NULL, "|", &save);
|
||||
}
|
||||
@ -2858,22 +2888,6 @@ static bool config_load_file(const char *path, bool set_defaults,
|
||||
settings->floats.video_msg_color_g = ((msg_color >> 8) & 0xff) / 255.0f;
|
||||
settings->floats.video_msg_color_b = ((msg_color >> 0) & 0xff) / 255.0f;
|
||||
}
|
||||
#ifdef HAVE_MENU
|
||||
config_get_hex_base(conf, "menu_entry_normal_color",
|
||||
&settings->uints.menu_entry_normal_color);
|
||||
config_get_hex_base(conf, "menu_entry_hover_color",
|
||||
&settings->uints.menu_entry_hover_color);
|
||||
config_get_hex_base(conf, "menu_title_color",
|
||||
&settings->uints.menu_title_color);
|
||||
config_get_hex_base(conf, "menu_bg_dark_color",
|
||||
&settings->uints.menu_bg_dark_color);
|
||||
config_get_hex_base(conf, "menu_bg_light_color",
|
||||
&settings->uints.menu_bg_light_color);
|
||||
config_get_hex_base(conf, "menu_border_dark_color",
|
||||
&settings->uints.menu_border_dark_color);
|
||||
config_get_hex_base(conf, "menu_border_light_color",
|
||||
&settings->uints.menu_border_light_color);
|
||||
#endif
|
||||
|
||||
/* Float settings */
|
||||
for (i = 0; i < (unsigned)float_settings_size; i++)
|
||||
@ -3062,6 +3076,8 @@ static bool config_load_file(const char *path, bool set_defaults,
|
||||
|
||||
if (string_is_equal(settings->paths.path_menu_wallpaper, "default"))
|
||||
*settings->paths.path_menu_wallpaper = '\0';
|
||||
if (string_is_equal(settings->paths.path_rgui_theme_preset, "default"))
|
||||
*settings->paths.path_rgui_theme_preset = '\0';
|
||||
if (string_is_equal(settings->paths.directory_video_shader, "default"))
|
||||
*settings->paths.directory_video_shader = '\0';
|
||||
if (string_is_equal(settings->paths.directory_video_filter, "default"))
|
||||
@ -4361,22 +4377,6 @@ bool config_save_file(const char *path)
|
||||
|
||||
/* Hexadecimal settings */
|
||||
config_set_hex(conf, "video_message_color", msg_color);
|
||||
#ifdef HAVE_MENU
|
||||
config_set_hex(conf, "menu_entry_normal_color",
|
||||
settings->uints.menu_entry_normal_color);
|
||||
config_set_hex(conf, "menu_entry_hover_color",
|
||||
settings->uints.menu_entry_hover_color);
|
||||
config_set_hex(conf, "menu_title_color",
|
||||
settings->uints.menu_title_color);
|
||||
config_set_hex(conf, "menu_bg_dark_color",
|
||||
settings->uints.menu_bg_dark_color);
|
||||
config_set_hex(conf, "menu_bg_light_color",
|
||||
settings->uints.menu_bg_light_color);
|
||||
config_set_hex(conf, "menu_border_dark_color",
|
||||
settings->uints.menu_border_dark_color);
|
||||
config_set_hex(conf, "menu_border_light_color",
|
||||
settings->uints.menu_border_light_color);
|
||||
#endif
|
||||
|
||||
video_driver_save_settings(conf);
|
||||
|
||||
@ -4734,7 +4734,7 @@ bool config_save_overrides(int override_type)
|
||||
/* Replaces currently loaded configuration file with
|
||||
* another one. Will load a dummy core to flush state
|
||||
* properly. */
|
||||
bool config_replace(bool config_save_on_exit, char *path)
|
||||
bool config_replace(bool config_replace_save_on_exit, char *path)
|
||||
{
|
||||
content_ctx_info_t content_info = {0};
|
||||
|
||||
@ -4746,7 +4746,7 @@ bool config_replace(bool config_save_on_exit, char *path)
|
||||
if (string_is_equal(path, path_get(RARCH_PATH_CONFIG)))
|
||||
return false;
|
||||
|
||||
if (config_save_on_exit && !path_is_empty(RARCH_PATH_CONFIG))
|
||||
if (config_replace_save_on_exit && !path_is_empty(RARCH_PATH_CONFIG))
|
||||
config_save_file(path_get(RARCH_PATH_CONFIG));
|
||||
|
||||
path_set(RARCH_PATH_CONFIG, path);
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
* Copyright (C) 2014-2016 - Jean-André Santoni
|
||||
* Copyright (C) 2016 - Brad Parker
|
||||
* Copyright (C) 2016-2019 - Brad Parker
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
@ -25,7 +25,7 @@
|
||||
#include <retro_common_api.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "gfx/video_driver.h"
|
||||
#include "gfx/video_defines.h"
|
||||
#include "input/input_defines.h"
|
||||
#include "led/led_defines.h"
|
||||
|
||||
@ -110,6 +110,10 @@ typedef struct settings
|
||||
/* Audio */
|
||||
bool audio_enable;
|
||||
bool audio_enable_menu;
|
||||
bool audio_enable_menu_ok;
|
||||
bool audio_enable_menu_cancel;
|
||||
bool audio_enable_menu_notice;
|
||||
bool audio_enable_menu_bgm;
|
||||
bool audio_sync;
|
||||
bool audio_rate_control;
|
||||
bool audio_wasapi_exclusive_mode;
|
||||
@ -300,6 +304,7 @@ typedef struct settings
|
||||
bool video_window_save_positions;
|
||||
|
||||
bool sustained_performance_mode;
|
||||
bool playlist_use_old_format;
|
||||
} bools;
|
||||
|
||||
struct
|
||||
@ -402,14 +407,8 @@ typedef struct settings
|
||||
unsigned menu_timedate_style;
|
||||
unsigned menu_thumbnails;
|
||||
unsigned menu_left_thumbnails;
|
||||
unsigned menu_rgui_thumbnail_downscaler;
|
||||
unsigned menu_dpi_override_value;
|
||||
unsigned menu_entry_normal_color;
|
||||
unsigned menu_entry_hover_color;
|
||||
unsigned menu_title_color;
|
||||
unsigned menu_bg_dark_color;
|
||||
unsigned menu_bg_light_color;
|
||||
unsigned menu_border_dark_color;
|
||||
unsigned menu_border_light_color;
|
||||
unsigned menu_rgui_color_theme;
|
||||
unsigned menu_xmb_layout;
|
||||
unsigned menu_xmb_shader_pipeline;
|
||||
@ -541,6 +540,7 @@ typedef struct settings
|
||||
char path_cheat_settings[PATH_MAX_LENGTH];
|
||||
char path_shader[PATH_MAX_LENGTH];
|
||||
char path_font[PATH_MAX_LENGTH];
|
||||
char path_rgui_theme_preset[PATH_MAX_LENGTH];
|
||||
|
||||
char directory_audio_filter[PATH_MAX_LENGTH];
|
||||
char directory_autoconfig[PATH_MAX_LENGTH];
|
||||
|
6
configure
vendored
6
configure
vendored
@ -4,6 +4,8 @@ PACKAGE_NAME=retroarch
|
||||
|
||||
cat /dev/null > config.log
|
||||
|
||||
. qb/qb.init.sh
|
||||
|
||||
. qb/qb.system.sh
|
||||
|
||||
. qb/qb.params.sh
|
||||
@ -11,3 +13,7 @@ cat /dev/null > config.log
|
||||
. qb/qb.comp.sh
|
||||
|
||||
. qb/qb.libs.sh
|
||||
|
||||
. qb/qb.moc.sh
|
||||
|
||||
. qb/qb.make.sh
|
||||
|
@ -109,6 +109,9 @@ void content_set_subsystem_info(void);
|
||||
/* Get the path to the last selected subsystem rom */
|
||||
char* content_get_subsystem_rom(unsigned index);
|
||||
|
||||
/* Sets the subsystem by name */
|
||||
bool content_set_subsystem_by_name(const char* subsystem_name);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
2
core.h
2
core.h
@ -65,6 +65,8 @@ typedef struct rarch_system_info
|
||||
const char *input_desc_btn[MAX_USERS][RARCH_FIRST_META_KEY];
|
||||
char valid_extensions[255];
|
||||
|
||||
bool supports_vfs;
|
||||
|
||||
struct retro_disk_control_callback disk_control_cb;
|
||||
struct retro_location_callback location_cb;
|
||||
|
||||
|
26
core_info.c
26
core_info.c
@ -201,7 +201,7 @@ static bool core_info_list_iterate(
|
||||
if (!current_path)
|
||||
return false;
|
||||
|
||||
info_path_base = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
info_path_base = (char*)malloc(info_path_base_size);
|
||||
|
||||
info_path_base[0] = '\0';
|
||||
|
||||
@ -230,17 +230,15 @@ static bool core_info_list_iterate(
|
||||
static core_info_list_t *core_info_list_new(const char *path,
|
||||
const char *libretro_info_dir,
|
||||
const char *exts,
|
||||
bool show_hidden_files)
|
||||
bool dir_show_hidden_files)
|
||||
{
|
||||
size_t i;
|
||||
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 = string_list_new();
|
||||
bool ok;
|
||||
|
||||
ok = dir_list_append(contents, path, exts,
|
||||
false, show_hidden_files, false, false);
|
||||
bool ok = dir_list_append(contents, path, exts,
|
||||
false, dir_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 */
|
||||
@ -249,7 +247,7 @@ static core_info_list_t *core_info_list_new(const char *path,
|
||||
for (i = 0; i < core_packages->size; i++)
|
||||
{
|
||||
dir_list_append(contents, core_packages->elems[i].data, exts,
|
||||
false, show_hidden_files, false, false);
|
||||
false, dir_show_hidden_files, false, false);
|
||||
}
|
||||
string_list_free(core_packages);
|
||||
#else
|
||||
@ -574,7 +572,11 @@ static bool core_info_list_update_missing_firmware_internal(
|
||||
if (!info)
|
||||
return false;
|
||||
|
||||
path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
path = (char*)malloc(path_size);
|
||||
|
||||
if (!path)
|
||||
return false;
|
||||
|
||||
path[0] = '\0';
|
||||
|
||||
for (i = 0; i < info->firmware_count; i++)
|
||||
@ -676,12 +678,12 @@ void core_info_deinit_list(void)
|
||||
}
|
||||
|
||||
bool core_info_init_list(const char *path_info, const char *dir_cores,
|
||||
const char *exts, bool show_hidden_files)
|
||||
const char *exts, bool dir_show_hidden_files)
|
||||
{
|
||||
if (!(core_info_curr_list = core_info_list_new(dir_cores,
|
||||
!string_is_empty(path_info) ? path_info : dir_cores,
|
||||
exts,
|
||||
show_hidden_files)))
|
||||
dir_show_hidden_files)))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@ -797,13 +799,13 @@ void core_info_list_get_supported_cores(core_info_list_t *core_info_list,
|
||||
|
||||
void core_info_get_name(const char *path, char *s, size_t len,
|
||||
const char *path_info, const char *dir_cores,
|
||||
const char *exts, bool show_hidden_files)
|
||||
const char *exts, bool dir_show_hidden_files)
|
||||
{
|
||||
size_t i;
|
||||
const char *path_basedir = !string_is_empty(path_info) ?
|
||||
path_info : dir_cores;
|
||||
struct string_list *contents = dir_list_new(
|
||||
dir_cores, exts, false, show_hidden_files, false, false);
|
||||
dir_cores, exts, false, dir_show_hidden_files, false, false);
|
||||
if (!contents)
|
||||
return;
|
||||
|
||||
|
@ -223,4 +223,3 @@ void libretro_dummy_retro_cheat_set(unsigned idx,
|
||||
(void)enabled;
|
||||
(void)code;
|
||||
}
|
||||
|
||||
|
@ -226,4 +226,3 @@ clean:
|
||||
rm -f $(TARGET)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
|
@ -10,4 +10,3 @@ static const char *fragment_source = GLSL(
|
||||
gl_FragColor = vec4(pow(mix(pow(texture2D(sTex0, vTex).rgb, vec3(2.2)), pow(texture2D(sTex1, vTex).rgb, vec3(2.2)), uMix), vec3(1.0 / 2.2)), 1.0);
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -9,4 +9,3 @@ static const char *vertex_source = GLSL(
|
||||
gl_Position = vec4(aVertex, 0.0, 1.0); vTex = aTexCoord;
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -10,4 +10,3 @@ static const char *fragment_source = GLSL(
|
||||
gl_FragColor = vec4(pow(mix(pow(texture2D(sTex0, vTex).bgr, vec3(2.2)), pow(texture2D(sTex1, vTex).bgr, vec3(2.2)), uMix), vec3(1.0 / 2.2)), 1.0);
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -2,4 +2,3 @@
|
||||
global: retro_*;
|
||||
local: *;
|
||||
};
|
||||
|
||||
|
@ -35,7 +35,6 @@
|
||||
|
||||
#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);
|
||||
@ -61,6 +60,7 @@ static bool is_initialized = 0;
|
||||
static unsigned player1_score = 0;
|
||||
static unsigned player2_score = 0;
|
||||
static float current_play_points = 0.0f;
|
||||
static float refresh = 60.0f;
|
||||
|
||||
static unsigned char *video_buf = NULL;
|
||||
|
||||
@ -84,7 +84,7 @@ typedef struct
|
||||
float last_dt;
|
||||
} Game_Input;
|
||||
|
||||
static Game_Input g_input = {0};
|
||||
static Game_Input g_input = {{{0}}};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -145,7 +145,7 @@ void GONG_CORE_PREFIX(retro_get_system_av_info)(struct retro_system_av_info *inf
|
||||
info->geometry.max_width = WIDTH;
|
||||
info->geometry.max_height = HEIGHT;
|
||||
info->geometry.aspect_ratio = 16.0f / 9.0f;
|
||||
info->timing.fps = FPS;
|
||||
info->timing.fps = refresh;
|
||||
info->timing.sample_rate = 44100.0;
|
||||
}
|
||||
|
||||
@ -164,8 +164,6 @@ void GONG_CORE_PREFIX(retro_init)(void)
|
||||
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)
|
||||
@ -182,6 +180,7 @@ void GONG_CORE_PREFIX(retro_set_environment)(retro_environment_t cb)
|
||||
bool no_content = true;
|
||||
|
||||
static const struct retro_variable vars[] = {
|
||||
{ "gong_refresh", "Video Refresh Rate (restart); 60|75|100|120" },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
@ -192,6 +191,19 @@ void GONG_CORE_PREFIX(retro_set_environment)(retro_environment_t cb)
|
||||
cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports);
|
||||
}
|
||||
|
||||
static void check_variables(void)
|
||||
{
|
||||
struct retro_variable var = {0};
|
||||
|
||||
var.key = "gong_refresh";
|
||||
|
||||
if (GONG_CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
||||
{
|
||||
refresh = atoi(var.value);
|
||||
g_input.last_dt = 1.0f / refresh;
|
||||
}
|
||||
}
|
||||
|
||||
void GONG_CORE_PREFIX(retro_set_video_refresh)(retro_video_refresh_t cb)
|
||||
{
|
||||
GONG_CORE_PREFIX(video_cb) = cb;
|
||||
@ -264,6 +276,8 @@ bool GONG_CORE_PREFIX(retro_load_game)(const struct retro_game_info *info)
|
||||
{
|
||||
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_XRGB8888;
|
||||
|
||||
check_variables();
|
||||
|
||||
if (!GONG_CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
|
||||
{
|
||||
if (GONG_CORE_PREFIX(log_cb))
|
||||
@ -324,6 +338,10 @@ void GONG_CORE_PREFIX(retro_run)(void)
|
||||
int i = 0;
|
||||
int16_t analogYLeft1 = 0;
|
||||
int16_t analogYRight1 = 0;
|
||||
bool updated = false;
|
||||
|
||||
if (GONG_CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
|
||||
check_variables();
|
||||
|
||||
GONG_CORE_PREFIX(input_poll_cb)();
|
||||
|
||||
|
@ -2,4 +2,3 @@
|
||||
global: retro_*;
|
||||
local: *;
|
||||
};
|
||||
|
||||
|
@ -145,4 +145,3 @@ clean:
|
||||
rm -f $(OBJECTS) $(TARGET)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
|
@ -21,5 +21,4 @@ endif
|
||||
LOCAL_SRC_FILES += ../libretro-test.c
|
||||
LOCAL_CFLAGS += -O3 -std=gnu99 -ffast-math -funroll-loops
|
||||
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
@ -2,4 +2,3 @@
|
||||
global: retro_*;
|
||||
local: *;
|
||||
};
|
||||
|
||||
|
@ -144,4 +144,3 @@ clean:
|
||||
rm -f $(OBJECTS) $(TARGET)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
|
@ -3,7 +3,6 @@ Libretro core for V4L2 capture devices
|
||||
|
||||
The basic idea is this -- plug your legacy console into a capture device and use RetroArch to upscale it and apply shaders to taste.
|
||||
|
||||
|
||||
## Raspberry Pi specific config
|
||||
|
||||
Add to /boot/config.txt:
|
||||
|
@ -2,4 +2,3 @@
|
||||
global: retro_*;
|
||||
local: *;
|
||||
};
|
||||
|
||||
|
@ -86,7 +86,7 @@ static struct v4l2_capbuf v4l2_capbuf[VIDEO_BUFFERS_MAX];
|
||||
|
||||
static float dummy_pos=0;
|
||||
|
||||
static int video_half_feed_rate=0; // for interlaced captures
|
||||
static int video_half_feed_rate=0; /* for interlaced captures */
|
||||
static uint32_t video_cap_width;
|
||||
static uint32_t video_cap_height;
|
||||
static uint32_t video_out_height;
|
||||
@ -102,7 +102,7 @@ static uint32_t *frame_prev2;
|
||||
static uint32_t *frame_prev3;
|
||||
static uint32_t *frame_curr;
|
||||
|
||||
// Frametime debug messages
|
||||
/* Frametime debug messages */
|
||||
struct timeval ft_prevtime = { 0 }, ft_prevtime2 = { 0 };
|
||||
char *ft_info = NULL, *ft_info2 = NULL;
|
||||
double ft_favg, ft_ftime;
|
||||
@ -282,17 +282,17 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_set_environment)(retro_environment_t
|
||||
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb) = cb;
|
||||
|
||||
// Allows retroarch to seed the previous values
|
||||
/* Allows retroarch to seed the previous values */
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_SET_VARIABLES, envvars);
|
||||
|
||||
// Enumerate all real devices
|
||||
/* Enumerate all real devices */
|
||||
enumerate_video_devices(video_devices, sizeof(video_devices));
|
||||
enumerate_audio_devices(audio_devices, sizeof(audio_devices));
|
||||
|
||||
// Add the dummy device
|
||||
/* Add the dummy device */
|
||||
appendstr(video_devices, "|dummy", ENVVAR_BUFLEN);
|
||||
|
||||
// Registers available devices list (still respects saved device if it exists)
|
||||
/* Registers available devices list (still respects saved device if it exists) */
|
||||
envvars[0].key = "videoproc_videodev";
|
||||
envvars[0].value = video_devices;
|
||||
envvars[1].key = "videoproc_audiodev";
|
||||
@ -503,7 +503,7 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_get_system_av_info)(struct retro_syst
|
||||
if (strcmp(videodev.value, "dummy") == 0) {
|
||||
info->geometry.aspect_ratio = 4.0/3.0;
|
||||
info->geometry.base_width = info->geometry.max_width = video_cap_width;
|
||||
info->geometry.base_height = video_cap_height; //out?
|
||||
info->geometry.base_height = video_cap_height; /* out? */
|
||||
info->geometry.max_height = video_out_height;
|
||||
info->timing.fps = 60;
|
||||
info->timing.sample_rate = AUDIO_SAMPLE_RATE;
|
||||
@ -517,16 +517,17 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_get_system_av_info)(struct retro_syst
|
||||
|
||||
info->geometry.base_width = info->geometry.max_width = video_format.fmt.pix.width;
|
||||
info->geometry.base_height = video_format.fmt.pix.height;
|
||||
//TODO Only double if frames are NOT fields (interlaced, full resolution)
|
||||
/* TODO Only double if frames are NOT fields (interlaced, full resolution) */
|
||||
info->geometry.max_height = video_format.fmt.pix.height * 2;
|
||||
//TODO Only double if frames ARE fields (progressive or deinterlaced, full framerate)
|
||||
// *2 for fields
|
||||
/* TODO Only double if frames ARE fields (progressive or deinterlaced, full framerate)
|
||||
* *2 for fields
|
||||
*/
|
||||
info->timing.fps = ((double)(video_standard.frameperiod.denominator*2)) /
|
||||
(double)video_standard.frameperiod.numerator;
|
||||
info->timing.sample_rate = AUDIO_SAMPLE_RATE;
|
||||
|
||||
if (error == 0) {
|
||||
//TODO Allow for fixed 4:3 and 16:9 modes
|
||||
/* TODO Allow for fixed 4:3 and 16:9 modes */
|
||||
info->geometry.aspect_ratio = (double)info->geometry.base_width / (double)info->geometry.max_height /\
|
||||
((double)cc.pixelaspect.numerator / (double)cc.pixelaspect.denominator);
|
||||
}
|
||||
@ -549,7 +550,7 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_reset)(void)
|
||||
open_devices();
|
||||
}
|
||||
|
||||
//TODO improve this mess and make it generic enough for use with dummy mode
|
||||
/* TODO improve this mess and make it generic enough for use with dummy mode */
|
||||
void v4l2_frame_times(struct v4l2_buffer buf) {
|
||||
if (strcmp("Off", video_frame_times) == 0)
|
||||
return;
|
||||
@ -593,7 +594,8 @@ void source_dummy(int width, int height) {
|
||||
}
|
||||
|
||||
dummy_pos += step;
|
||||
//dummy_pos = M_PI/4; step = 0; // no animation
|
||||
/* no animation */
|
||||
/* dummy_pos = M_PI/4; step = 0; */
|
||||
triangpos = (sinf(dummy_pos)+1)/2*width;
|
||||
if (video_buf.field == V4L2_FIELD_INTERLACED) {
|
||||
if (video_half_feed_rate == 0)
|
||||
@ -609,9 +611,9 @@ void source_dummy(int width, int height) {
|
||||
src[1] = 0x10 + color*0xE0;
|
||||
src[2] = 0x10 + color*0xE0;
|
||||
|
||||
// End of a line
|
||||
/* End of a line */
|
||||
if ( ((i+1) % width) == 0 ) {
|
||||
triangpos -= 2; //offset should be half of this?
|
||||
triangpos -= 2; /* offset should be half of this? */
|
||||
triangpos_t -= 1;
|
||||
triangpos_b -= 1;
|
||||
if (video_buf.field == V4L2_FIELD_INTERLACED) {
|
||||
@ -637,7 +639,7 @@ void source_v4l2_normal(int width, int height) {
|
||||
|
||||
int error;
|
||||
|
||||
// Wait until v4l2 dequees a buffer
|
||||
/* Wait until v4l2 dequees a buffer */
|
||||
memset(&video_buf, 0, sizeof(struct v4l2_buffer));
|
||||
video_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
video_buf.memory = V4L2_MEMORY_MMAP;
|
||||
@ -668,7 +670,7 @@ void source_v4l2_alternate_hack(int width, int height) {
|
||||
int error;
|
||||
uint32_t index;
|
||||
|
||||
// For later, saving time
|
||||
/* For later, saving time */
|
||||
memset(&fmt, 0, sizeof(fmt));
|
||||
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_G_FMT, &fmt);
|
||||
@ -677,7 +679,7 @@ void source_v4l2_alternate_hack(int width, int height) {
|
||||
printf("VIDIOC_G_FMT failed: %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
// Wait until v4l2 dequees a buffer
|
||||
/* Wait until v4l2 dequees a buffer */
|
||||
memset(&video_buf, 0, sizeof(struct v4l2_buffer));
|
||||
video_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
video_buf.memory = V4L2_MEMORY_MMAP;
|
||||
@ -692,7 +694,7 @@ void source_v4l2_alternate_hack(int width, int height) {
|
||||
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
v4l2_ioctl(video_device_fd, VIDIOC_STREAMOFF, &type);
|
||||
|
||||
//Let's get the data as fast as possible!
|
||||
/* Let's get the data as fast as possible! */
|
||||
bufcp = video_buf;
|
||||
memcpy( (uint32_t*) frame_cap, (uint8_t*) v4l2_capbuf[video_buf.index].start, video_format.fmt.pix.width * video_format.fmt.pix.height * 3);
|
||||
|
||||
@ -722,7 +724,7 @@ void source_v4l2_alternate_hack(int width, int height) {
|
||||
printf("VIDIOC_REQBUFS failed: %s\n", strerror(errno));
|
||||
}
|
||||
v4l2_ncapbuf = reqbufs.count;
|
||||
//printf("GOT v4l2_ncapbuf=%ld\n", v4l2_ncapbuf);
|
||||
/* printf("GOT v4l2_ncapbuf=%ld\n", v4l2_ncapbuf); */
|
||||
|
||||
index = 0;
|
||||
memset(&video_buf, 0, sizeof(struct v4l2_buffer));
|
||||
@ -742,9 +744,11 @@ void source_v4l2_alternate_hack(int width, int height) {
|
||||
|
||||
v4l2_ioctl(video_device_fd, VIDIOC_QBUF,& video_buf);
|
||||
|
||||
//error = v4l2_ioctl(video_device_fd, VIDIOC_QBUF, &video_buf);
|
||||
//if (error != 0)
|
||||
// printf("VIDIOC_QBUF failed: %s\n", strerror(errno));
|
||||
#if 0
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_QBUF, &video_buf);
|
||||
if (error != 0)
|
||||
printf("VIDIOC_QBUF failed: %s\n", strerror(errno));
|
||||
#endif
|
||||
|
||||
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_STREAMON, &type);
|
||||
@ -758,10 +762,12 @@ void source_v4l2_alternate_hack(int width, int height) {
|
||||
|
||||
void processing_heal(uint8_t *src, int width, int height) {
|
||||
uint32_t *fp1 = frame_prev1;
|
||||
for (int i = 0; i < width * height; i+=1, src += 3, ++fp1) {
|
||||
// Tries to filter a bunch of blanked out scanline sections my capture cards spits out with this crazy hack
|
||||
// Since the blanked out scanlines are set to a black value bellow anything that can be captued, it's quite
|
||||
//easy to select the scanlines...
|
||||
int i;
|
||||
for (i = 0; i < width * height; i+=1, src += 3, ++fp1) {
|
||||
/* Tries to filter a bunch of blanked out scanline sections my capture cards spits out with this crazy hack
|
||||
* Since the blanked out scanlines are set to a black value bellow anything that can be captued, it's quite
|
||||
* easy to select the scanlines...
|
||||
*/
|
||||
if (src[0] <= 0 && src[1] <= 0 && src[2] <= 0 && i >= width && i <= width * height - width) {
|
||||
if (*(src + 0 - width*3) >= ((*fp1>> 0&0xFF)-6) && \
|
||||
*(src + 1 - width*3) >= ((*fp1>> 8&0xFF)-6) && \
|
||||
@ -786,15 +792,16 @@ void processing_deinterlacing_crap(uint32_t *src, uint32_t *dst, int width, int
|
||||
uint32_t pixacul=0;
|
||||
uint32_t *fp1 = frame_prev1, *fp2 = frame_prev2, *fp3 = frame_prev3;
|
||||
|
||||
// Helps pointing to the pixel in the adjacent row
|
||||
/* Helps pointing to the pixel in the adjacent row */
|
||||
if (field == V4L2_FIELD_TOP)
|
||||
targetrow = width;
|
||||
else
|
||||
targetrow = width*-1;
|
||||
|
||||
// Starts from the even scanline if frame contains bottom fields
|
||||
//On progressive sources, should only skip the destination lines, since all lines the source are the same fields
|
||||
//On interlaced sources, should skip both the source and the destination lines, since only half the lines in the source are the same fields (must also skip fields later)
|
||||
/* Starts from the even scanline if frame contains bottom fields
|
||||
* On progressive sources, should only skip the destination lines, since all lines the source are the same fields
|
||||
* On interlaced sources, should skip both the source and the destination lines, since only half the lines in the source are the same fields (must also skip fields later)
|
||||
*/
|
||||
if (field == V4L2_FIELD_BOTTOM) {
|
||||
dst += width;
|
||||
if (skip_lines_src == 1) {
|
||||
@ -806,13 +813,14 @@ void processing_deinterlacing_crap(uint32_t *src, uint32_t *dst, int width, int
|
||||
}
|
||||
|
||||
for (i = 0; i < width * height; i+=1, src += 1, dst += 1, ++fp1, ++fp2, ++fp3) {
|
||||
// Will fill the current destination line with current field
|
||||
//The masking is used to prserve some information set by the
|
||||
//deinterlacing process, uses the alpha channel to tell if a
|
||||
//pixel needs further processing...
|
||||
/* Will fill the current destination line with current field
|
||||
* The masking is used to prserve some information set by the
|
||||
* deinterlacing process, uses the alpha channel to tell if a
|
||||
* pixel needs further processing...
|
||||
*/
|
||||
*(dst) = (*(src) & 0x00FFFFFF) | (*dst & 0xFF000000);
|
||||
|
||||
// Crappy deinterlacing
|
||||
/* Crappy deinterlacing */
|
||||
if (i >= width && i <= (width*height-width)) {
|
||||
pixacul=((((*(dst)>> 0&0xFF) + (pixacul>> 0&0xFF))>>1<<0 |\
|
||||
((*(dst)>> 8&0xFF) + (pixacul>> 8&0xFF))>>1<<8 |\
|
||||
@ -842,9 +850,10 @@ void processing_deinterlacing_crap(uint32_t *src, uint32_t *dst, int width, int
|
||||
}
|
||||
}
|
||||
|
||||
// Skips a scanline if we reach the end of the current one
|
||||
//On progressive sources, should only skip the destination lines,
|
||||
//On interlaced sources, should skip both the source and the destination lines
|
||||
/* Skips a scanline if we reach the end of the current one
|
||||
* On progressive sources, should only skip the destination lines,
|
||||
* On interlaced sources, should skip both the source and the destination lines
|
||||
*/
|
||||
if ( ((i+1) % width) == 0 ) {
|
||||
dst += width;
|
||||
if (skip_lines_src == 1) {
|
||||
@ -859,7 +868,8 @@ void processing_deinterlacing_crap(uint32_t *src, uint32_t *dst, int width, int
|
||||
|
||||
void processing_bgr_xrgb(uint8_t *src, uint32_t *dst, int width, int height) {
|
||||
/* BGR24 to XRGB8888 conversion */
|
||||
for (int i = 0; i < width * height; i+=1, src += 3, dst += 1) {
|
||||
int i;
|
||||
for (i = 0; i < width * height; i+=1, src += 3, dst += 1) {
|
||||
*dst = 0xFF << 24 | src[2] << 16 | src[1] << 8 | src[0] << 0;
|
||||
}
|
||||
}
|
||||
@ -880,14 +890,15 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_run)(void)
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &capturemode);
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &outputmode);
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &frametimes);
|
||||
// Video or Audio device(s) has(ve) been changed
|
||||
//TODO We may get away without reseting devices when changing output mode...
|
||||
/* Video or Audio device(s) has(ve) been changed
|
||||
* TODO We may get away without reseting devices when changing output mode...
|
||||
*/
|
||||
if ((videodev.value && (strcmp(video_device, videodev.value) != 0)) ||\
|
||||
(audiodev.value && (strcmp(audio_device, audiodev.value) != 0)) ||\
|
||||
(capturemode.value && (strcmp(video_capture_mode, capturemode.value) != 0)) ||\
|
||||
(outputmode.value && (strcmp(video_output_mode, outputmode.value) != 0))) {
|
||||
VIDEOPROC_CORE_PREFIX(retro_unload_game)();
|
||||
// This core does not cares for the retro_game_info * argument?
|
||||
/* This core does not cares for the retro_game_info * argument? */
|
||||
VIDEOPROC_CORE_PREFIX(retro_load_game)(NULL);
|
||||
}
|
||||
|
||||
@ -898,12 +909,13 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_run)(void)
|
||||
|
||||
VIDEOPROC_CORE_PREFIX(input_poll_cb)();
|
||||
|
||||
//printf("%d %d %d %s\n", video_cap_width, video_cap_height, video_buf.field, video_output_mode);
|
||||
//TODO pass frame_curr to source_* functions
|
||||
//half_feed_rate allows interlaced intput to be fed at half the calls to this function
|
||||
//where the same frame is then read by the deinterlacer twice, for each field
|
||||
/* printf("%d %d %d %s\n", video_cap_width, video_cap_height, video_buf.field, video_output_mode);
|
||||
* TODO pass frame_curr to source_* functions
|
||||
* half_feed_rate allows interlaced intput to be fed at half the calls to this function
|
||||
* where the same frame is then read by the deinterlacer twice, for each field
|
||||
*/
|
||||
if (video_half_feed_rate == 0) {
|
||||
// Capture
|
||||
/* Capture */
|
||||
if (strcmp(video_device, "dummy") == 0) {
|
||||
source_dummy(video_cap_width, video_cap_height);
|
||||
} else {
|
||||
@ -921,22 +933,25 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_run)(void)
|
||||
video_half_feed_rate = 0;
|
||||
}
|
||||
|
||||
// Converts from bgr to xrgb, deinterlacing, final copy to the outpuit buffer (frame_out)
|
||||
//Every frame except frame_cap shall be encoded in xrgb
|
||||
//Every frame except frame_out shall have the same height
|
||||
/* Converts from bgr to xrgb, deinterlacing, final copy to the outpuit buffer (frame_out)
|
||||
* Every frame except frame_cap shall be encoded in xrgb
|
||||
* Every frame except frame_out shall have the same height
|
||||
*/
|
||||
if (strcmp(video_output_mode, "deinterlaced") == 0) {
|
||||
processing_bgr_xrgb(frame_cap, frame_curr, video_cap_width, video_cap_height);
|
||||
// When deinterlacing a interlaced intput, we need to process both fields of a frame,
|
||||
//one at a time (retro_run needs to be called twice, vide_half_feed_rate prevents the
|
||||
//source from being read twice...
|
||||
/* When deinterlacing a interlaced intput, we need to process both fields of a frame,
|
||||
* one at a time (retro_run needs to be called twice, vide_half_feed_rate prevents the
|
||||
* source from being read twice...
|
||||
*/
|
||||
if (strcmp(video_capture_mode, "interlaced") == 0) {
|
||||
enum v4l2_field field_read;
|
||||
if (video_half_feed_rate == 0)
|
||||
field_read = V4L2_FIELD_TOP;
|
||||
else
|
||||
field_read = V4L2_FIELD_BOTTOM;
|
||||
//video_half_feed_rate will allow us to capture the interlaced frame once and run the
|
||||
//deinterlacing algo twice, extracting a given field for each run.
|
||||
/* video_half_feed_rate will allow us to capture the interlaced frame once and run the
|
||||
* deinterlacing algo twice, extracting a given field for each run.
|
||||
*/
|
||||
processing_deinterlacing_crap(frame_curr, frame_out, video_cap_width, video_cap_height/2, field_read, 1);
|
||||
} else {
|
||||
processing_deinterlacing_crap(frame_curr, frame_out, video_cap_width, video_cap_height, video_buf.field, 0);
|
||||
@ -950,7 +965,7 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_run)(void)
|
||||
VIDEOPROC_CORE_PREFIX(video_refresh_cb)(frame_out, video_cap_width,
|
||||
video_out_height, video_cap_width * sizeof(uint32_t));
|
||||
} else if (strcmp(video_capture_mode, "alternate_hack") == 0) {
|
||||
// Case where alternate_hack without deinterlacing would not generate previous frame for processing_heal
|
||||
/* Case where alternate_hack without deinterlacing would not generate previous frame for processing_heal */
|
||||
processing_bgr_xrgb(frame_cap, frame_curr, video_cap_width, video_cap_height);
|
||||
aux = frame_prev3;
|
||||
frame_prev3 = frame_prev2;
|
||||
@ -998,15 +1013,17 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_cheat_set)(unsigned index, bool enabl
|
||||
|
||||
static void videoinput_set_control_v4l2( uint32_t id, double val )
|
||||
{
|
||||
//struct v4l2_queryctrl query;
|
||||
#if 0
|
||||
struct v4l2_queryctrl query;
|
||||
|
||||
//query.id = id;
|
||||
//if( ioctl( video_device_fd, VIDIOC_QUERYCTRL, &query ) >= 0 && !(query.flags & V4L2_CTRL_FLAG_DISABLED) ) {
|
||||
// struct v4l2_control control;
|
||||
// control.id = id;
|
||||
// control.value = query.minimum + ((int) ((val * ((double) (query.maximum - query.minimum))) + 0.5));
|
||||
// ioctl( video_device_fd, VIDIOC_S_CTRL, &control );
|
||||
//}
|
||||
query.id = id;
|
||||
if( ioctl( video_device_fd, VIDIOC_QUERYCTRL, &query ) >= 0 && !(query.flags & V4L2_CTRL_FLAG_DISABLED) ) {
|
||||
struct v4l2_control control;
|
||||
control.id = id;
|
||||
control.value = query.minimum + ((int) ((val * ((double) (query.maximum - query.minimum))) + 0.5));
|
||||
ioctl( video_device_fd, VIDIOC_S_CTRL, &control );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_info *game)
|
||||
@ -1050,7 +1067,7 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
}
|
||||
strncpy(video_device, videodev.value, ENVVAR_BUFLEN-1);
|
||||
|
||||
// Audio device is optional...
|
||||
/* Audio device is optional... */
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &audiodev);
|
||||
if (audiodev.value != NULL) {
|
||||
strncpy(audio_device, audiodev.value, ENVVAR_BUFLEN-1);
|
||||
@ -1107,7 +1124,7 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
fmt.fmt.pix.height = 240;
|
||||
fmt.fmt.pix.field = V4L2_FIELD_TOP;
|
||||
|
||||
//TODO Query the size and FPS
|
||||
/* TODO Query the size and FPS */
|
||||
if (strcmp(video_capture_mode, "interlaced") == 0) {
|
||||
v4l2_ncapbuf_target = 2;
|
||||
fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
|
||||
@ -1166,7 +1183,7 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
}
|
||||
|
||||
video_format = fmt;
|
||||
//TODO Check if what we got is indeed what we asked for
|
||||
/* TODO Check if what we got is indeed what we asked for */
|
||||
|
||||
memset(&reqbufs, 0, sizeof(reqbufs));
|
||||
reqbufs.count = v4l2_ncapbuf_target;
|
||||
@ -1229,11 +1246,12 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
return false;
|
||||
}
|
||||
|
||||
//videoinput_set_control_v4l2(V4L2_CID_HUE, (double) 0.4f);
|
||||
/* videoinput_set_control_v4l2(V4L2_CID_HUE, (double) 0.4f); */
|
||||
}
|
||||
|
||||
//TODO Framerates?
|
||||
// Each frame should combine both fields into a full frame (if not already captured interlaced), half frame-rate
|
||||
/* TODO Framerates?
|
||||
* Each frame should combine both fields into a full frame (if not already captured interlaced), half frame-rate
|
||||
*/
|
||||
if (strcmp(video_output_mode, "interlaced") == 0) {
|
||||
if (strcmp(video_capture_mode, "interlaced") == 0) {
|
||||
video_out_height = video_cap_height;
|
||||
@ -1242,10 +1260,10 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
video_capture_mode, video_output_mode);
|
||||
video_out_height = video_cap_height*2;
|
||||
}
|
||||
// Each frame has one field, full frame-rate
|
||||
/* Each frame has one field, full frame-rate */
|
||||
} else if (strcmp(video_output_mode, "progressive") == 0) {
|
||||
video_out_height = video_cap_height;
|
||||
// Each frame has one or both field to be deinterlaced into a full frame (double the lines if one field), full frame-rate
|
||||
/* Each frame has one or both field to be deinterlaced into a full frame (double the lines if one field), full frame-rate */
|
||||
} else if (strcmp(video_output_mode, "deinterlaced") == 0) {
|
||||
if (strcmp(video_capture_mode, "interlaced") == 0)
|
||||
video_out_height = video_cap_height;
|
||||
@ -1259,7 +1277,7 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
|
||||
frame_cap = calloc(1, video_cap_width * video_cap_height * sizeof(uint8_t) * 3);
|
||||
frame_out = calloc(1, video_cap_width * video_out_height * sizeof(uint32_t));
|
||||
//TODO: Only allocate frames if we are going to use it (for deinterlacing or other filters?)
|
||||
/* TODO: Only allocate frames if we are going to use it (for deinterlacing or other filters?) */
|
||||
frames[0] = calloc(1, video_cap_width * video_out_height * sizeof(uint32_t));
|
||||
frames[1] = calloc(1, video_cap_width * video_out_height * sizeof(uint32_t));
|
||||
frames[2] = calloc(1, video_cap_width * video_out_height * sizeof(uint32_t));
|
||||
@ -1270,7 +1288,7 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
frame_prev2 = frames[2];
|
||||
frame_prev3 = frames[3];
|
||||
|
||||
//TODO: Check frames[] allocation
|
||||
/* TODO: Check frames[] allocation */
|
||||
if (!frame_out || !frame_cap)
|
||||
{
|
||||
printf("Cannot allocate buffers\n");
|
||||
@ -1293,6 +1311,7 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
RETRO_API void VIDEOPROC_CORE_PREFIX(retro_unload_game)(void)
|
||||
{
|
||||
struct v4l2_requestbuffers reqbufs;
|
||||
int i;
|
||||
|
||||
#ifdef HAVE_ALSA
|
||||
if (audio_handle != NULL) {
|
||||
@ -1328,7 +1347,7 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_unload_game)(void)
|
||||
free(frame_cap);
|
||||
frame_cap = NULL;
|
||||
|
||||
for (int i=0; i<4; ++i) {
|
||||
for (i = 0; i<4; ++i) {
|
||||
if (frames[i])
|
||||
free(frames[i]);
|
||||
frames[i] = NULL;
|
||||
|
@ -5,4 +5,3 @@
|
||||
|
||||
*startfile:
|
||||
ctr/3dsx_custom_crt0%O%s crti%O%s crtbegin%O%s
|
||||
|
||||
|
@ -72,4 +72,3 @@ ClrLoop:
|
||||
bne ClrLoop
|
||||
|
||||
bx lr
|
||||
|
||||
|
@ -308,4 +308,3 @@ long sysconf(int name)
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,6 @@ typedef struct{
|
||||
|
||||
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};
|
||||
|
||||
|
||||
static void errorAndQuit(const char* errorStr){
|
||||
errorConf error;
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
// 3DS includes
|
||||
#include <3ds.h>
|
||||
|
||||
|
||||
#define ENTRY_ARGBUFSIZE 0x400
|
||||
#define NUM_SERVICESTHATMATTER 5
|
||||
|
||||
@ -50,7 +49,6 @@ typedef enum
|
||||
StrId_Max,
|
||||
} StrId;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char* dst;
|
||||
@ -91,5 +89,4 @@ typedef struct
|
||||
|
||||
#define memmapSize(m) (sizeof(memmap_header_t) + sizeof(memmap_entry_t)*(m)->header.num)
|
||||
|
||||
|
||||
#include "launch.h"
|
||||
|
2
deps/mbedtls/dhm.c
vendored
2
deps/mbedtls/dhm.c
vendored
@ -530,7 +530,7 @@ static int load_file( const char *path, unsigned char **buf, size_t *n )
|
||||
*n = (size_t) size;
|
||||
|
||||
if( *n + 1 == 0 ||
|
||||
( *buf = mbedtls_calloc( 1, *n + 1 ) ) == NULL )
|
||||
( *buf = (unsigned char*)mbedtls_calloc( 1, *n + 1 ) ) == NULL )
|
||||
{
|
||||
fclose( f );
|
||||
return( MBEDTLS_ERR_DHM_ALLOC_FAILED );
|
||||
|
4
deps/mbedtls/ecp.c
vendored
4
deps/mbedtls/ecp.c
vendored
@ -811,7 +811,7 @@ static int ecp_normalize_jac_many( const mbedtls_ecp_group *grp,
|
||||
}
|
||||
#endif
|
||||
|
||||
if( ( c = mbedtls_calloc( t_len, sizeof( mbedtls_mpi ) ) ) == NULL )
|
||||
if( ( c = (mbedtls_mpi*)mbedtls_calloc( t_len, sizeof( mbedtls_mpi ) ) ) == NULL )
|
||||
return( MBEDTLS_ERR_ECP_ALLOC_FAILED );
|
||||
|
||||
mbedtls_mpi_init( &u ); mbedtls_mpi_init( &Zi ); mbedtls_mpi_init( &ZZi );
|
||||
@ -1406,7 +1406,7 @@ static int ecp_mul_comb( mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
|
||||
|
||||
if( T == NULL )
|
||||
{
|
||||
T = mbedtls_calloc( pre_len, sizeof( mbedtls_ecp_point ) );
|
||||
T = (mbedtls_ecp_point*)mbedtls_calloc( pre_len, sizeof( mbedtls_ecp_point ) );
|
||||
if( T == NULL )
|
||||
{
|
||||
ret = MBEDTLS_ERR_ECP_ALLOC_FAILED;
|
||||
|
2
deps/mbedtls/net_sockets.c
vendored
2
deps/mbedtls/net_sockets.c
vendored
@ -578,7 +578,7 @@ int mbedtls_net_send( void *ctx, const unsigned char *buf, size_t len )
|
||||
|
||||
if( ret < 0 )
|
||||
{
|
||||
if( net_would_block( ctx ) != 0 )
|
||||
if( net_would_block((const mbedtls_net_context*)ctx) != 0 )
|
||||
return( MBEDTLS_ERR_SSL_WANT_WRITE );
|
||||
|
||||
#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
|
||||
|
23656
deps/nuklear/nuklear.h
vendored
23656
deps/nuklear/nuklear.h
vendored
File diff suppressed because it is too large
Load Diff
4
dirs.c
4
dirs.c
@ -288,6 +288,10 @@ void dir_set(enum rarch_dir_type type, const char *path)
|
||||
static void check_defaults_dir_create_dir(const char *path)
|
||||
{
|
||||
char *new_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
|
||||
if (!new_path)
|
||||
return;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
path,
|
||||
|
@ -14,18 +14,24 @@
|
||||
*/
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <retro_timers.h>
|
||||
|
||||
#include "discord.h"
|
||||
#include "discord_register.h"
|
||||
|
||||
#include "../deps/discord-rpc/include/discord_rpc.h"
|
||||
|
||||
#include "../retroarch.h"
|
||||
#include "../configuration.h"
|
||||
#include "../core.h"
|
||||
#include "../core_info.h"
|
||||
#include "../paths.h"
|
||||
#include "../playlist.h"
|
||||
#include "../verbosity.h"
|
||||
|
||||
#include "../msg_hash.h"
|
||||
#include "../tasks/task_file_transfer.h"
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
#include "../../network/netplay/netplay.h"
|
||||
@ -70,12 +76,16 @@ DiscordRichPresence discord_presence;
|
||||
|
||||
char* discord_get_own_username(void)
|
||||
{
|
||||
if (discord_is_ready())
|
||||
return user_name;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char* discord_get_own_avatar(void)
|
||||
{
|
||||
if (discord_is_ready())
|
||||
return user_avatar;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool discord_avatar_is_ready(void)
|
||||
@ -187,8 +197,7 @@ static void handle_discord_join_cb(void *task_data, void *user_data, const char
|
||||
|
||||
RARCH_LOG("[Discord] joining lobby at: %s\n", tmp_hostname);
|
||||
task_push_netplay_crc_scan(room->gamecrc,
|
||||
room->gamename, tmp_hostname, room->corename);
|
||||
|
||||
room->gamename, tmp_hostname, room->corename, room->subsystem_name);
|
||||
}
|
||||
|
||||
finish:
|
||||
@ -216,6 +225,12 @@ static void handle_discord_join(const char* secret)
|
||||
RARCH_LOG("[Discord] join secret: (%s)\n", secret);
|
||||
list = string_split(secret, "|");
|
||||
|
||||
strlcpy(party_name, list->elems[1].data, sizeof(party_name));
|
||||
strlcat(party_name, "|", sizeof(party_name));
|
||||
strlcat(party_name, list->elems[2].data, sizeof(party_name));
|
||||
discord_update(DISCORD_PRESENCE_NETPLAY_CLIENT);
|
||||
|
||||
|
||||
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);
|
||||
@ -307,8 +322,10 @@ void discord_update(enum discord_presence presence)
|
||||
break;
|
||||
case DISCORD_PRESENCE_GAME_PAUSED:
|
||||
discord_presence.smallImageKey = "paused";
|
||||
discord_presence.smallImageText = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PAUSED);
|
||||
discord_presence.details = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME_PAUSED);
|
||||
discord_presence.smallImageText = msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PAUSED);
|
||||
discord_presence.details = msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME_PAUSED);
|
||||
pause_time = time(0);
|
||||
ellapsed_time = difftime(time(0), start_time);
|
||||
discord_presence.startTimestamp = pause_time;
|
||||
@ -344,12 +361,18 @@ void discord_update(enum discord_presence presence)
|
||||
ellapsed_time = 0;
|
||||
|
||||
discord_presence.smallImageKey = "playing";
|
||||
discord_presence.smallImageText = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_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;
|
||||
|
||||
if (!string_is_empty(party_name))
|
||||
discord_presence.partyId = strdup(party_name);
|
||||
|
||||
}
|
||||
break;
|
||||
case DISCORD_PRESENCE_NETPLAY_HOSTING:
|
||||
@ -364,19 +387,22 @@ void discord_update(enum discord_presence presence)
|
||||
|
||||
{
|
||||
char join_secret[128];
|
||||
snprintf(join_secret, sizeof(join_secret), "%d|%s", room->id, room->nickname);
|
||||
snprintf(join_secret, sizeof(join_secret), "%d|%s", room->id, party_name);
|
||||
discord_presence.joinSecret = strdup(join_secret);
|
||||
/* discord_presence.spectateSecret = "SPECSPECSPEC"; */
|
||||
discord_presence.partyId = strdup(party_name);
|
||||
discord_presence.partyMax = 0;
|
||||
discord_presence.partySize = 0;
|
||||
discord_presence.partyMax = 2;
|
||||
discord_presence.partySize = 1;
|
||||
|
||||
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:
|
||||
RARCH_LOG("[Discord] party id: %s\n", party_name);
|
||||
discord_presence.partyId = strdup(party_name);
|
||||
break;
|
||||
case DISCORD_PRESENCE_NETPLAY_HOSTING_STOPPED:
|
||||
default:
|
||||
discord_presence.joinSecret = NULL;
|
||||
break;
|
||||
|
@ -20,15 +20,8 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <lists/string_list.h>
|
||||
#include <retro_timers.h>
|
||||
|
||||
#include "../deps/discord-rpc/include/discord_rpc.h"
|
||||
#include "verbosity.h"
|
||||
|
||||
enum discord_presence
|
||||
{
|
||||
@ -53,13 +46,13 @@ void discord_shutdown(void);
|
||||
|
||||
void discord_update(enum discord_presence presence);
|
||||
|
||||
void discord_run_callbacks();
|
||||
void discord_run_callbacks(void);
|
||||
|
||||
bool discord_is_ready();
|
||||
bool discord_is_ready(void);
|
||||
|
||||
void discord_avatar_set_ready(bool ready);
|
||||
|
||||
bool discord_avatar_is_ready();
|
||||
bool discord_avatar_is_ready(void);
|
||||
|
||||
char* discord_get_own_username(void);
|
||||
|
||||
|
@ -125,7 +125,6 @@ if [ $SALAMANDER = "yes" ]; then
|
||||
make -C ../ -f Makefile.${platform}.salamander clean || exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Cleanup existing core if it exists
|
||||
if [ $PLATFORM = "ode-ps3" ]; then
|
||||
make -C ../ -f Makefile.${platform}.cobra clean || exit 1
|
||||
|
@ -28,7 +28,6 @@ rm -f ../retroarch_wiiu_salamander.rpx.elf
|
||||
cp -f ../pkg/wiiu/meta.xml ../pkg/wiiu/rpx/wiiu/apps/retroarch/meta.xml
|
||||
cp -f ../pkg/wiiu/icon.png ../pkg/wiiu/rpx/wiiu/apps/retroarch/icon.png
|
||||
|
||||
|
||||
make -C ../ -f Makefile.${platform} clean || exit 1
|
||||
|
||||
lookup()
|
||||
|
@ -192,4 +192,3 @@ fi
|
||||
for core in $cores; do
|
||||
buildCore $core
|
||||
done
|
||||
|
||||
|
3
driver.c
3
driver.c
@ -22,6 +22,8 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <audio/audio_resampler.h>
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
#include "menu/menu_driver.h"
|
||||
#endif
|
||||
@ -30,6 +32,7 @@
|
||||
|
||||
#include "audio/audio_driver.h"
|
||||
#include "camera/camera_driver.h"
|
||||
#include "gfx/video_driver.h"
|
||||
#include "record/record_driver.h"
|
||||
#include "location/location_driver.h"
|
||||
#include "wifi/wifi_driver.h"
|
||||
|
38
dynamic.c
38
dynamic.c
@ -104,7 +104,7 @@ static dylib_t lib_handle;
|
||||
#define SYMBOL_NETRETROPAD(x) current_core->x = libretro_netretropad_##x
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_VIDEO_PROCESSOR)
|
||||
#if defined(HAVE_VIDEOPROCESSOR)
|
||||
#define SYMBOL_VIDEOPROCESSOR(x) current_core->x = libretro_videoprocessor_##x
|
||||
#endif
|
||||
|
||||
@ -116,6 +116,10 @@ static bool ignore_environment_cb = false;
|
||||
static bool core_set_shared_context = false;
|
||||
static bool *load_no_content_hook = NULL;
|
||||
|
||||
struct retro_subsystem_info subsystem_data[SUBSYSTEM_MAX_SUBSYSTEMS];
|
||||
struct retro_subsystem_rom_info subsystem_data_roms[SUBSYSTEM_MAX_SUBSYSTEMS][SUBSYSTEM_MAX_SUBSYSTEM_ROMS];
|
||||
unsigned subsystem_current_count;
|
||||
|
||||
const struct retro_subsystem_info *libretro_find_subsystem_info(
|
||||
const struct retro_subsystem_info *info, unsigned num_info,
|
||||
const char *ident)
|
||||
@ -187,9 +191,7 @@ static bool environ_cb_get_system_info(unsigned cmd, void *data)
|
||||
break;
|
||||
case RETRO_ENVIRONMENT_SET_SUBSYSTEM_INFO:
|
||||
{
|
||||
unsigned i = 0;
|
||||
unsigned j = 0;
|
||||
unsigned size = i;
|
||||
unsigned i, j, size;
|
||||
const struct retro_subsystem_info *info =
|
||||
(const struct retro_subsystem_info*)data;
|
||||
subsystem_current_count = 0;
|
||||
@ -492,8 +494,9 @@ bool libretro_get_system_info(const char *path,
|
||||
* Setup libretro callback symbols. Returns true on success,
|
||||
* or false if symbols could not be loaded.
|
||||
**/
|
||||
bool init_libretro_sym_custom(enum rarch_core_type type, struct retro_core_t *current_core, const char *lib_path, dylib_t *lib_handle_p)
|
||||
bool init_libretro_sym_custom(enum rarch_core_type type, struct retro_core_t *current_core, const char *lib_path, void *_lib_handle_p)
|
||||
{
|
||||
dylib_t *lib_handle_p = (dylib_t*)_lib_handle_p;
|
||||
#ifdef HAVE_DYNAMIC
|
||||
/* the library handle for use with the SYMBOL macro */
|
||||
dylib_t lib_handle_local;
|
||||
@ -745,7 +748,7 @@ bool init_libretro_sym_custom(enum rarch_core_type type, struct retro_core_t *cu
|
||||
#endif
|
||||
break;
|
||||
case CORE_TYPE_VIDEO_PROCESSOR:
|
||||
#if defined(HAVE_VIDEO_PROCESSOR)
|
||||
#if defined(HAVE_VIDEOPROCESSOR)
|
||||
SYMBOL_VIDEOPROCESSOR(retro_init);
|
||||
SYMBOL_VIDEOPROCESSOR(retro_deinit);
|
||||
|
||||
@ -1923,9 +1926,10 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
|
||||
case RETRO_ENVIRONMENT_GET_VFS_INTERFACE:
|
||||
{
|
||||
const uint32_t supported_vfs_version = 1;
|
||||
const uint32_t supported_vfs_version = 3;
|
||||
static struct retro_vfs_interface vfs_iface =
|
||||
{
|
||||
/* VFS API v1 */
|
||||
retro_vfs_file_get_path_impl,
|
||||
retro_vfs_file_open_impl,
|
||||
retro_vfs_file_close_impl,
|
||||
@ -1935,14 +1939,32 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
retro_vfs_file_read_impl,
|
||||
retro_vfs_file_write_impl,
|
||||
retro_vfs_file_flush_impl,
|
||||
retro_vfs_file_remove_impl
|
||||
retro_vfs_file_remove_impl,
|
||||
retro_vfs_file_rename_impl,
|
||||
/* VFS API v2 */
|
||||
retro_vfs_file_truncate_impl,
|
||||
/* VFS API v3 */
|
||||
retro_vfs_stat_impl,
|
||||
retro_vfs_mkdir_impl,
|
||||
retro_vfs_opendir_impl,
|
||||
retro_vfs_readdir_impl,
|
||||
retro_vfs_dirent_get_name_impl,
|
||||
retro_vfs_dirent_is_dir_impl,
|
||||
retro_vfs_closedir_impl
|
||||
};
|
||||
|
||||
struct retro_vfs_interface_info *vfs_iface_info = (struct retro_vfs_interface_info *) data;
|
||||
if (vfs_iface_info->required_interface_version <= supported_vfs_version)
|
||||
{
|
||||
RARCH_LOG("Core requested VFS version >= v%d, providing v%d\n", vfs_iface_info->required_interface_version, supported_vfs_version);
|
||||
vfs_iface_info->required_interface_version = supported_vfs_version;
|
||||
vfs_iface_info->iface = &vfs_iface;
|
||||
system->supports_vfs = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_WARN("Core requested VFS version v%d which is higher than what we support (v%d)\n", vfs_iface_info->required_interface_version, supported_vfs_version);
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
10
dynamic.h
10
dynamic.h
@ -20,7 +20,6 @@
|
||||
#include <boolean.h>
|
||||
#include <retro_common_api.h>
|
||||
#include <libretro.h>
|
||||
#include <dynamic/dylib.h>
|
||||
|
||||
#include "core_type.h"
|
||||
|
||||
@ -133,7 +132,7 @@ bool libretro_get_shared_context(void);
|
||||
bool init_libretro_sym(enum rarch_core_type type,
|
||||
struct retro_core_t *core);
|
||||
|
||||
bool init_libretro_sym_custom(enum rarch_core_type type, struct retro_core_t *current_core, const char *lib_path, dylib_t *lib_handle_p);
|
||||
bool init_libretro_sym_custom(enum rarch_core_type type, struct retro_core_t *current_core, const char *lib_path, void *lib_handle_p);
|
||||
|
||||
/**
|
||||
* uninit_libretro_sym:
|
||||
@ -151,11 +150,10 @@ void uninit_libretro_sym(struct retro_core_t *core);
|
||||
/* Arbitrary 10 roms for each subsystem limit */
|
||||
#define SUBSYSTEM_MAX_SUBSYSTEM_ROMS 10
|
||||
|
||||
struct retro_subsystem_info subsystem_data[SUBSYSTEM_MAX_SUBSYSTEMS];
|
||||
struct retro_subsystem_rom_info subsystem_data_roms[SUBSYSTEM_MAX_SUBSYSTEMS][SUBSYSTEM_MAX_SUBSYSTEM_ROMS];
|
||||
unsigned subsystem_current_count;
|
||||
extern struct retro_subsystem_info subsystem_data[SUBSYSTEM_MAX_SUBSYSTEMS];
|
||||
extern struct retro_subsystem_rom_info subsystem_data_roms[SUBSYSTEM_MAX_SUBSYSTEMS][SUBSYSTEM_MAX_SUBSYSTEM_ROMS];
|
||||
extern unsigned subsystem_current_count;
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -56,7 +56,6 @@ fetch_revision_git() {
|
||||
git log -n 1 --pretty=format:%H
|
||||
}
|
||||
|
||||
|
||||
# fetch_revision: Output SCM-dependent revision string of a module
|
||||
# (currently just calls fetch_revision_git)
|
||||
#
|
||||
@ -65,10 +64,8 @@ fetch_revision() {
|
||||
fetch_revision_git $1
|
||||
}
|
||||
|
||||
|
||||
### END OF FETCH-RULES.SH
|
||||
|
||||
|
||||
echo "Fetching RetroArch's submodules..."
|
||||
fetch_git "https://github.com/libretro/common-shaders.git" "media/shaders_cg"
|
||||
fetch_git "https://github.com/libretro/common-overlays.git" "media/overlays"
|
||||
|
@ -51,6 +51,10 @@
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <encodings/utf.h>
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
#include "menu/menu_driver.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
@ -160,39 +164,6 @@ void fill_pathname_application_special(char *s,
|
||||
fill_pathname_basedir(s, path_get(RARCH_PATH_CONFIG), len);
|
||||
}
|
||||
break;
|
||||
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_ZARCH_ICONS:
|
||||
#ifdef HAVE_ZARCH
|
||||
{
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_ZARCH_FONT:
|
||||
#ifdef HAVE_ZARCH
|
||||
{
|
||||
char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
s1[0] = '\0';
|
||||
|
||||
fill_pathname_application_special(s1,
|
||||
PATH_MAX_LENGTH * sizeof(char),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_ZARCH);
|
||||
fill_pathname_join(s,
|
||||
s1, "Roboto-Condensed.ttf", len);
|
||||
|
||||
free(s1);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_ZARCH:
|
||||
#ifdef HAVE_ZARCH
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
fill_pathname_join(s,
|
||||
settings->paths.directory_assets,
|
||||
"zarch",
|
||||
len);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS:
|
||||
#ifdef HAVE_XMB
|
||||
{
|
||||
@ -238,6 +209,70 @@ void fill_pathname_application_special(char *s,
|
||||
free(s1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_SOUNDS:
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *menu_ident = settings->arrays.menu_driver;
|
||||
char *s1 = (char*)calloc(1, PATH_MAX_LENGTH * sizeof(char));
|
||||
|
||||
if (string_is_equal(menu_ident, "xmb"))
|
||||
{
|
||||
fill_pathname_application_special(s1, PATH_MAX_LENGTH * sizeof(char), APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB);
|
||||
|
||||
if (!string_is_empty(s1))
|
||||
strlcat(s1, "/sounds", PATH_MAX_LENGTH * sizeof(char));
|
||||
}
|
||||
else if (string_is_equal(menu_ident, "glui"))
|
||||
{
|
||||
fill_pathname_application_special(s1, PATH_MAX_LENGTH * sizeof(char), APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI);
|
||||
|
||||
if (!string_is_empty(s1))
|
||||
strlcat(s1, "/sounds", PATH_MAX_LENGTH * sizeof(char));
|
||||
}
|
||||
else if (string_is_equal(menu_ident, "ozone"))
|
||||
{
|
||||
fill_pathname_application_special(s1, PATH_MAX_LENGTH * sizeof(char), APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE);
|
||||
|
||||
if (!string_is_empty(s1))
|
||||
strlcat(s1, "/sounds", PATH_MAX_LENGTH * sizeof(char));
|
||||
}
|
||||
|
||||
if (string_is_empty(s1))
|
||||
{
|
||||
fill_pathname_join(
|
||||
s1,
|
||||
settings->paths.directory_assets,
|
||||
"sounds",
|
||||
PATH_MAX_LENGTH * sizeof(char)
|
||||
);
|
||||
}
|
||||
|
||||
strlcpy(s, s1, len);
|
||||
free(s1);
|
||||
#endif
|
||||
}
|
||||
|
||||
break;
|
||||
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE:
|
||||
#ifdef HAVE_OZONE
|
||||
{
|
||||
char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
s1[0] = '\0';
|
||||
|
||||
fill_pathname_join(
|
||||
s1,
|
||||
settings->paths.directory_assets,
|
||||
"ozone",
|
||||
PATH_MAX_LENGTH * sizeof(char)
|
||||
);
|
||||
strlcpy(s, s1, len);
|
||||
free(s1);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB:
|
||||
|
@ -108,9 +108,8 @@ enum application_special_type
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_BG,
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS,
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_FONT,
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_ZARCH,
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_ZARCH_FONT,
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_ZARCH_ICONS,
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE,
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_SOUNDS,
|
||||
APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_CHEEVOS_BADGES,
|
||||
APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_DISCORD_AVATARS
|
||||
};
|
||||
|
@ -429,7 +429,6 @@ static void frontend_ctr_init(void* data)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static int frontend_ctr_get_rating(void)
|
||||
{
|
||||
u8 device_model = 0xFF;
|
||||
|
@ -115,7 +115,11 @@ static NSSearchPathDirectory NSConvertFlagsCF(unsigned flags)
|
||||
switch (flags)
|
||||
{
|
||||
case CFDocumentDirectory:
|
||||
#if TARGET_OS_TV
|
||||
return NSCachesDirectory;
|
||||
#else
|
||||
return NSDocumentDirectory;
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -363,7 +367,7 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
|
||||
home_dir_buf, "shaders_glsl",
|
||||
sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
|
||||
#endif
|
||||
#if TARGET_OS_IPHONE
|
||||
#if TARGET_OS_IOS
|
||||
int major, minor;
|
||||
get_ios_version(&major, &minor);
|
||||
if (major >= 10 )
|
||||
@ -372,6 +376,9 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
|
||||
else
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE],
|
||||
home_dir_buf, "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
|
||||
#elif TARGET_OS_TV
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE],
|
||||
bundle_path_buf, "modules", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
|
||||
#else
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], home_dir_buf, "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
|
||||
#endif
|
||||
@ -423,7 +430,7 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#if TARGET_OS_IOS
|
||||
char assets_zip_path[PATH_MAX_LENGTH];
|
||||
if (major > 8)
|
||||
strlcpy(g_defaults.path.buildbot_server_url, "http://buildbot.libretro.com/nightly/apple/ios9/latest/", sizeof(g_defaults.path.buildbot_server_url));
|
||||
@ -459,7 +466,6 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
|
||||
RARCH_ERR("Failed to create or access system directory: %s.\n", g_defaults.dirs[DEFAULT_DIR_SYSTEM]);
|
||||
}
|
||||
|
||||
|
||||
CFRelease(bundle_path);
|
||||
CFRelease(bundle_url);
|
||||
}
|
||||
@ -582,7 +588,7 @@ static enum frontend_powerstate frontend_darwin_get_powerstate(int *seconds, int
|
||||
end:
|
||||
if (blob)
|
||||
CFRelease(blob);
|
||||
#elif defined(IOS)
|
||||
#elif TARGET_OS_IOS
|
||||
float level;
|
||||
UIDevice *uidev = [UIDevice currentDevice];
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#include "../frontend.h"
|
||||
#include "../frontend_driver.h"
|
||||
#include "../../gfx/video_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../defaults.h"
|
||||
#include "../../content.h"
|
||||
|
@ -115,7 +115,6 @@ static void frontend_orbis_get_environment_settings(int *argc, char *argv[],
|
||||
|
||||
sceSystemServiceHideSplashScreen();
|
||||
|
||||
|
||||
uintptr_t intptr=0;
|
||||
sscanf(argv[1],"%p",&intptr);
|
||||
argv[1] = NULL;
|
||||
|
@ -510,6 +510,11 @@ static int frontend_ps2_parse_drive_list(void *data, bool load_content)
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
|
||||
enum_idx,
|
||||
FILE_TYPE_DIRECTORY, 0, 0);
|
||||
menu_entries_append_enum(list,
|
||||
"cdfs:/",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
|
||||
enum_idx,
|
||||
FILE_TYPE_DIRECTORY, 0, 0);
|
||||
menu_entries_append_enum(list,
|
||||
"hdd0:/",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
|
||||
|
@ -271,12 +271,24 @@ static int frontend_uwp_parse_drive_list(void *data, bool load_content)
|
||||
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));
|
||||
char drive[] = " :\\";
|
||||
char *home_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
bool have_any_drives = false;
|
||||
|
||||
fill_pathname_home_dir(home_dir,
|
||||
PATH_MAX_LENGTH * sizeof(char));
|
||||
fill_pathname_home_dir(home_dir, PATH_MAX_LENGTH * sizeof(char));
|
||||
|
||||
for (drive[0] = 'A'; drive[0] <= 'Z'; drive[0]++)
|
||||
{
|
||||
if (uwp_drive_exists(drive))
|
||||
{
|
||||
menu_entries_append_enum(list,
|
||||
drive,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
|
||||
enum_idx,
|
||||
FILE_TYPE_DIRECTORY, 0, 0);
|
||||
have_any_drives = true;
|
||||
}
|
||||
}
|
||||
|
||||
menu_entries_append_enum(list,
|
||||
home_dir,
|
||||
@ -284,6 +296,24 @@ static int frontend_uwp_parse_drive_list(void *data, bool load_content)
|
||||
enum_idx,
|
||||
FILE_TYPE_DIRECTORY, 0, 0);
|
||||
|
||||
if (!have_any_drives)
|
||||
{
|
||||
menu_entries_append_enum(list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FILE_BROWSER_OPEN_PICKER),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_FILE_BROWSER_OPEN_PICKER),
|
||||
MENU_ENUM_LABEL_FILE_BROWSER_OPEN_PICKER,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
|
||||
if (string_is_equal(uwp_device_family, "Windows.Desktop"))
|
||||
{
|
||||
menu_entries_append_enum(list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FILE_BROWSER_OPEN_UWP_PERMISSIONS),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_FILE_BROWSER_OPEN_UWP_PERMISSIONS),
|
||||
MENU_ENUM_LABEL_FILE_BROWSER_OPEN_UWP_PERMISSIONS,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
free(home_dir);
|
||||
#endif
|
||||
|
||||
|
@ -21,11 +21,9 @@ typedef LONG NTSTATUS;
|
||||
// Just for documentation
|
||||
#define EXPORTNUM(x)
|
||||
|
||||
|
||||
// Needed for object structures and related things
|
||||
typedef CONST SHORT CSHORT;
|
||||
|
||||
|
||||
// String types
|
||||
typedef CHAR *PSZ;
|
||||
typedef CONST CHAR *PCSZ;
|
||||
@ -42,7 +40,6 @@ typedef STRING *PSTRING;
|
||||
typedef STRING ANSI_STRING;
|
||||
typedef PSTRING PANSI_STRING;
|
||||
|
||||
|
||||
// IO Status Block type (UNVERIFIED)
|
||||
// Differences from NT: None.
|
||||
typedef struct _IO_STATUS_BLOCK {
|
||||
@ -63,7 +60,6 @@ VOID
|
||||
IN ULONG Reserved
|
||||
);
|
||||
|
||||
|
||||
// Header for dispatcher objects
|
||||
// Differences from NT: None.
|
||||
typedef struct _DISPATCHER_HEADER {
|
||||
@ -75,13 +71,11 @@ typedef struct _DISPATCHER_HEADER {
|
||||
LIST_ENTRY WaitListHead;
|
||||
} DISPATCHER_HEADER;
|
||||
|
||||
|
||||
// Object types
|
||||
#define NotificationTimerObject 8
|
||||
#define SynchronizationTimerObject 9
|
||||
#define DpcObject 19
|
||||
|
||||
|
||||
// Object Attributes type
|
||||
// Differences from NT: There are no Length, SecurityDescriptor, or
|
||||
// SecurityQualityOfService fields. Also, ObjectName is ANSI, not
|
||||
@ -142,7 +136,6 @@ typedef OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES;
|
||||
#define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
|
||||
#define FILE_VALID_SET_FLAGS 0x00000036
|
||||
|
||||
|
||||
// NtQueryVolumeInformation / NtSetVolumeInformation stuff
|
||||
// Type of information to retrieve; FileFsSizeInformation and
|
||||
// FileFsDeviceInformation are the only ones confirmed to work.
|
||||
@ -317,7 +310,6 @@ extern POBJECT_TYPE ExSemaphoreObjectType;
|
||||
extern POBJECT_TYPE IoCompletionObjectType;
|
||||
extern POBJECT_TYPE IoDeviceObjectType;
|
||||
|
||||
|
||||
// *_OBJECT and related structures (mostly opaque since I'm lazy)
|
||||
typedef struct _DRIVER_OBJECT {
|
||||
CSHORT Type;
|
||||
@ -344,7 +336,6 @@ typedef struct _FILE_OBJECT {
|
||||
} FILE_OBJECT;
|
||||
typedef FILE_OBJECT *PFILE_OBJECT;
|
||||
|
||||
|
||||
/* Thread information structures */
|
||||
|
||||
/* IRQL */
|
||||
@ -434,7 +425,6 @@ typedef struct _KDPC {
|
||||
PULONG_PTR Lock;
|
||||
} KDPC, *PKDPC;
|
||||
|
||||
|
||||
// Timers
|
||||
typedef enum _TIMER_TYPE {
|
||||
NotificationTimer,
|
||||
@ -721,7 +711,6 @@ NtFreeVirtualMemory(
|
||||
IN ULONG FreeType
|
||||
);
|
||||
|
||||
|
||||
// Kernel-level routines
|
||||
|
||||
// MmMapIoSpace:
|
||||
@ -822,7 +811,6 @@ IoDeleteSymbolicLink(
|
||||
IN PANSI_STRING SymbolicLinkName
|
||||
);
|
||||
|
||||
|
||||
// ObReferenceObjectByHandle:
|
||||
// Turns a handle into a kernel object pointer. The ObjectType parameter
|
||||
// specifies what type of object it is. This function also increments the
|
||||
|
@ -29,13 +29,20 @@
|
||||
#endif
|
||||
|
||||
#include "frontend.h"
|
||||
#include "frontend_driver.h"
|
||||
#include "../configuration.h"
|
||||
#include "../ui/ui_companion_driver.h"
|
||||
#include "../tasks/tasks_internal.h"
|
||||
#include "../tasks/task_content.h"
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../paths.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../verbosity.h"
|
||||
#include "../record/record_driver.h"
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
||||
#include <objbase.h>
|
||||
#endif
|
||||
|
||||
/* griffin hack */
|
||||
#ifdef HAVE_QT
|
||||
@ -44,15 +51,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_MAIN
|
||||
#include "../retroarch.h"
|
||||
#include "../verbosity.h"
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
||||
#include <objbase.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* main_exit:
|
||||
*
|
||||
@ -94,6 +92,11 @@ void main_exit(void *args)
|
||||
driver_ctl(RARCH_DRIVER_CTL_DEINIT, NULL);
|
||||
ui_companion_driver_free();
|
||||
frontend_driver_free();
|
||||
recording_driver_lock_free();
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
||||
CoUninitialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -114,7 +117,7 @@ int rarch_main(int argc, char *argv[], void *data)
|
||||
const ui_application_t *ui_application = NULL;
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_MAIN) && defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
||||
if (FAILED(CoInitialize(NULL)))
|
||||
{
|
||||
RARCH_ERR("FATAL: Failed to initialize the COM interface\n");
|
||||
@ -170,10 +173,6 @@ int rarch_main(int argc, char *argv[], void *data)
|
||||
ui_application->run(args);
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_MAIN) && defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
||||
CoUninitialize();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "d3d_common.h"
|
||||
#include "d3d12_common.h"
|
||||
#include "dxgi_common.h"
|
||||
#include "d3dcompiler_common.h"
|
||||
@ -219,6 +220,7 @@ bool d3d12_init_swapchain(d3d12_video_t* d3d12,
|
||||
int width, int height, void* corewindow)
|
||||
{
|
||||
unsigned i;
|
||||
HRESULT hr;
|
||||
#ifdef __WINRT__
|
||||
DXGI_SWAP_CHAIN_DESC1 desc;
|
||||
memset(&desc, 0, sizeof(DXGI_SWAP_CHAIN_DESC1));
|
||||
@ -256,10 +258,15 @@ bool d3d12_init_swapchain(d3d12_video_t* d3d12,
|
||||
#endif
|
||||
|
||||
#ifdef __WINRT__
|
||||
DXGICreateSwapChainForCoreWindow(d3d12->factory, d3d12->queue.handle, corewindow, &desc, NULL, &d3d12->chain.handle);
|
||||
hr = DXGICreateSwapChainForCoreWindow(d3d12->factory, d3d12->queue.handle, corewindow, &desc, NULL, &d3d12->chain.handle);
|
||||
#else
|
||||
DXGICreateSwapChain(d3d12->factory, d3d12->queue.handle, &desc, &d3d12->chain.handle);
|
||||
hr = DXGICreateSwapChain(d3d12->factory, d3d12->queue.handle, &desc, &d3d12->chain.handle);
|
||||
#endif
|
||||
if (FAILED(hr))
|
||||
{
|
||||
RARCH_ERR("[D3D12]: Failed to create the swap chain (0x%08X)\n", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef HAVE_WINDOW
|
||||
DXGIMakeWindowAssociation(d3d12->factory, hwnd, DXGI_MWA_NO_ALT_ENTER);
|
||||
|
@ -363,4 +363,3 @@ void d3d8x_font_get_text_metrics(void *data, void *metrics)
|
||||
font->lpVtbl->GetTextMetrics(font, (TEXTMETRICA*)metrics);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -601,7 +601,7 @@ void d3d9x_constant_table_set_matrix(LPDIRECT3DDEVICE9 dev,
|
||||
#if defined(HAVE_D3DX)
|
||||
LPD3DXCONSTANTTABLE consttbl = (LPD3DXCONSTANTTABLE)p;
|
||||
D3DXHANDLE handle = (D3DXHANDLE)data;
|
||||
const D3DXMATRIX *matrix = (const D3DXMATRIX*)matrix;
|
||||
const D3DXMATRIX *matrix = (const D3DXMATRIX*)_matrix;
|
||||
if (consttbl && dev && handle)
|
||||
consttbl->lpVtbl->SetMatrix(consttbl, dev, handle, matrix);
|
||||
#endif
|
||||
|
@ -457,6 +457,12 @@ static INLINE void d3d9_set_viewports(LPDIRECT3DDEVICE9 dev,
|
||||
IDirect3DDevice9_SetViewport(dev, (D3DVIEWPORT9*)vp);
|
||||
}
|
||||
|
||||
static INLINE void d3d9_set_scissor_rect(
|
||||
LPDIRECT3DDEVICE9 dev, RECT *rect)
|
||||
{
|
||||
IDirect3DDevice9_SetScissorRect(dev, rect);
|
||||
}
|
||||
|
||||
static INLINE void d3d9_set_render_state(
|
||||
LPDIRECT3DDEVICE9 dev, D3DRENDERSTATETYPE state, DWORD value)
|
||||
{
|
||||
|
@ -132,7 +132,6 @@ bool d3d_compile(const char* src, size_t size, LPCSTR src_name, LPCSTR entrypoin
|
||||
compileflags |= D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
|
||||
#endif
|
||||
|
||||
|
||||
if (!size)
|
||||
size = strlen(src);
|
||||
|
||||
|
@ -330,12 +330,11 @@ bool egl_init_context(egl_ctx_data_t *egl,
|
||||
EGLenum platform,
|
||||
void *display_data,
|
||||
EGLint *major, EGLint *minor,
|
||||
EGLint *n, const EGLint *attrib_ptr,
|
||||
EGLint *count, const EGLint *attrib_ptr,
|
||||
egl_accept_config_cb_t cb)
|
||||
{
|
||||
EGLint i;
|
||||
EGLConfig *configs = NULL;
|
||||
EGLint count = 0;
|
||||
EGLint matched = 0;
|
||||
int config_index = -1;
|
||||
EGLDisplay dpy = get_egl_display(platform, display_data);
|
||||
@ -353,24 +352,24 @@ bool egl_init_context(egl_ctx_data_t *egl,
|
||||
|
||||
RARCH_LOG("[EGL]: EGL version: %d.%d\n", *major, *minor);
|
||||
|
||||
if (!eglGetConfigs(egl->dpy, NULL, 0, &count) || count < 1)
|
||||
if (!eglGetConfigs(egl->dpy, NULL, 0, count) || *count < 1)
|
||||
{
|
||||
RARCH_ERR("[EGL]: No configs to choose from.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
configs = malloc(count * sizeof(*configs));
|
||||
configs = (EGLConfig*)malloc(*count * sizeof(*configs));
|
||||
if (!configs)
|
||||
return false;
|
||||
|
||||
if (!eglChooseConfig(egl->dpy, attrib_ptr,
|
||||
configs, count, &matched) || !matched)
|
||||
configs, *count, &matched) || !matched)
|
||||
{
|
||||
RARCH_ERR("[EGL]: No EGL configs with appropriate attributes.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
for (i = 0; i < *count; i++)
|
||||
{
|
||||
if (!cb || cb(display_data, egl->dpy, configs[i]))
|
||||
{
|
||||
@ -381,7 +380,7 @@ bool egl_init_context(egl_ctx_data_t *egl,
|
||||
|
||||
free(configs);
|
||||
|
||||
if (i == count)
|
||||
if (i == *count)
|
||||
{
|
||||
RARCH_ERR("[EGL]: No EGL config found which satifies requirements.\n");
|
||||
return false;
|
||||
|
@ -1,80 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <gfx/gl_capabilities.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
#include "gl_common.h"
|
||||
|
||||
static void gl_size_format(GLint* internalFormat)
|
||||
{
|
||||
#ifndef HAVE_PSGL
|
||||
switch (*internalFormat)
|
||||
{
|
||||
case GL_RGB:
|
||||
/* FIXME: PS3 does not support this, neither does it have GL_RGB565_OES. */
|
||||
*internalFormat = GL_RGB565;
|
||||
break;
|
||||
case GL_RGBA:
|
||||
#ifdef HAVE_OPENGLES2
|
||||
*internalFormat = GL_RGBA8_OES;
|
||||
#else
|
||||
*internalFormat = GL_RGBA8;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This function should only be used without mipmaps
|
||||
and when data == NULL */
|
||||
void gl_load_texture_image(GLenum target,
|
||||
GLint level,
|
||||
GLint internalFormat,
|
||||
GLsizei width,
|
||||
GLsizei height,
|
||||
GLint border,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
const GLvoid * data)
|
||||
{
|
||||
#if !defined(HAVE_PSGL) && !defined(ORBIS)
|
||||
#ifdef HAVE_OPENGLES2
|
||||
if (gl_check_capability(GL_CAPS_TEX_STORAGE_EXT) && internalFormat != GL_BGRA_EXT)
|
||||
{
|
||||
gl_size_format(&internalFormat);
|
||||
glTexStorage2DEXT(target, 1, internalFormat, width, height);
|
||||
}
|
||||
#else
|
||||
if (gl_check_capability(GL_CAPS_TEX_STORAGE) && internalFormat != GL_BGRA_EXT)
|
||||
{
|
||||
gl_size_format(&internalFormat);
|
||||
glTexStorage2D(target, 1, internalFormat, width, height);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef HAVE_OPENGLES
|
||||
if (gl_check_capability(GL_CAPS_GLES3_SUPPORTED))
|
||||
#endif
|
||||
gl_size_format(&internalFormat);
|
||||
glTexImage2D(target, level, internalFormat, width, height, border, format, type, data);
|
||||
}
|
||||
}
|
@ -29,13 +29,11 @@
|
||||
#include <retro_inline.h>
|
||||
#include <gfx/math/matrix_4x4.h>
|
||||
#include <gfx/scaler/scaler.h>
|
||||
#include <glsym/glsym.h>
|
||||
#include <formats/image.h>
|
||||
|
||||
#include "../../verbosity.h"
|
||||
#include "../font_driver.h"
|
||||
#include "../video_coord_array.h"
|
||||
#include "../video_driver.h"
|
||||
#include <glsym/glsym.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
@ -92,8 +90,10 @@ RETRO_BEGIN_DECLS
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(HAVE_PSGL)
|
||||
#ifndef GL_RGBA32F
|
||||
#define GL_RGBA32F GL_RGBA32F_ARB
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_PSGL)
|
||||
#define RARCH_GL_INTERNAL_FORMAT32 GL_ARGB_SCE
|
||||
@ -156,82 +156,6 @@ RETRO_BEGIN_DECLS
|
||||
#endif
|
||||
|
||||
typedef struct gl gl_t;
|
||||
typedef struct gl_renderchain_driver gl_renderchain_driver_t;
|
||||
|
||||
struct gl_renderchain_driver
|
||||
{
|
||||
void (*set_coords)(void *handle_data,
|
||||
void *chain_data,
|
||||
void *shader_data, const struct video_coords *coords);
|
||||
void (*set_mvp)(void *data,
|
||||
void *chain_data,
|
||||
void *shader_data,
|
||||
const void *mat_data);
|
||||
void (*init_texture_reference)(
|
||||
gl_t *gl, void *chain_data, unsigned i,
|
||||
unsigned internal_fmt, unsigned texture_fmt,
|
||||
unsigned texture_type);
|
||||
void (*fence_iterate)(void *data, void *chain_data,
|
||||
unsigned hard_sync_frames);
|
||||
void (*fence_free)(void *data, void *chain_data);
|
||||
void (*readback)(gl_t *gl,
|
||||
void *chain_data,
|
||||
unsigned alignment,
|
||||
unsigned fmt, unsigned type,
|
||||
void *src);
|
||||
void (*init_pbo)(unsigned size, const void *data);
|
||||
void (*bind_pbo)(unsigned idx);
|
||||
void (*unbind_pbo)(void *data, void *chain_data);
|
||||
void (*copy_frame)(
|
||||
gl_t *gl,
|
||||
void *chain_data,
|
||||
video_frame_info_t *video_info,
|
||||
const void *frame,
|
||||
unsigned width, unsigned height, unsigned pitch);
|
||||
void (*restore_default_state)(gl_t *gl, void *chain_data);
|
||||
void (*new_vao)(void *data, void *chain_data);
|
||||
void (*free_vao)(void *data, void *chain_data);
|
||||
void (*bind_vao)(void *data, void *chain_data);
|
||||
void (*unbind_vao)(void *data, void *chain_data);
|
||||
void (*disable_client_arrays)(void *data, void *chain_data);
|
||||
void (*ff_vertex)(const void *data);
|
||||
void (*ff_matrix)(const void *data);
|
||||
void (*bind_backbuffer)(void *data, void *chain_data);
|
||||
void (*deinit_fbo)(gl_t *gl, void *chain_data);
|
||||
bool (*read_viewport)(
|
||||
gl_t *gl, void *chain_data, uint8_t *buffer, bool is_idle);
|
||||
void (*bind_prev_texture)(
|
||||
gl_t *gl,
|
||||
void *chain_data,
|
||||
const struct video_tex_info *tex_info);
|
||||
void (*chain_free)(void *data, void *chain_data);
|
||||
void *(*chain_new)(void);
|
||||
void (*init)(gl_t *gl, void *chain_data,
|
||||
unsigned fbo_width, unsigned fbo_height);
|
||||
bool (*init_hw_render)(gl_t *gl, void *chain_data,
|
||||
unsigned width, unsigned height);
|
||||
void (*free)(gl_t *gl, void *chain_data);
|
||||
void (*deinit_hw_render)(gl_t *gl, void *chain_data);
|
||||
void (*start_render)(gl_t *gl, void *chain_data,
|
||||
video_frame_info_t *video_info);
|
||||
void (*check_fbo_dimensions)(gl_t *gl, void *chain_data);
|
||||
void (*recompute_pass_sizes)(gl_t *gl,
|
||||
void *chain_data,
|
||||
unsigned width, unsigned height,
|
||||
unsigned vp_width, unsigned vp_height);
|
||||
void (*renderchain_render)(gl_t *gl,
|
||||
void *chain_data,
|
||||
video_frame_info_t *video_info,
|
||||
uint64_t frame_count,
|
||||
const struct video_tex_info *tex_info,
|
||||
const struct video_tex_info *feedback_info);
|
||||
void (*resolve_extensions)(
|
||||
gl_t *gl,
|
||||
void *chain_data,
|
||||
const char *context_ident,
|
||||
const video_info_t *video);
|
||||
const char *ident;
|
||||
};
|
||||
|
||||
struct gl
|
||||
{
|
||||
@ -315,7 +239,8 @@ struct gl
|
||||
struct video_tex_info prev_info[GFX_MAX_TEXTURES];
|
||||
struct video_fbo_rect fbo_rect[GFX_MAX_SHADERS];
|
||||
|
||||
const gl_renderchain_driver_t *renderchain_driver;
|
||||
const shader_backend_t *shader;
|
||||
void *shader_data;
|
||||
void *renderchain_data;
|
||||
void *ctx_data;
|
||||
const gfx_ctx_driver_t *ctx_driver;
|
||||
@ -331,64 +256,6 @@ static INLINE void gl_bind_texture(GLuint id, GLint wrap_mode, GLint mag_filter,
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter);
|
||||
}
|
||||
|
||||
static INLINE unsigned gl_wrap_type_to_enum(enum gfx_wrap_type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
#ifndef HAVE_OPENGLES
|
||||
case RARCH_WRAP_BORDER: /* GL_CLAMP_TO_BORDER: Available since GL 1.3 */
|
||||
return GL_CLAMP_TO_BORDER;
|
||||
#else
|
||||
case RARCH_WRAP_BORDER:
|
||||
#endif
|
||||
case RARCH_WRAP_EDGE:
|
||||
return GL_CLAMP_TO_EDGE;
|
||||
case RARCH_WRAP_REPEAT:
|
||||
return GL_REPEAT;
|
||||
case RARCH_WRAP_MIRRORED_REPEAT:
|
||||
return GL_MIRRORED_REPEAT;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool gl_query_core_context_in_use(void);
|
||||
|
||||
void gl_load_texture_image(GLenum target,
|
||||
GLint level,
|
||||
GLint internalFormat,
|
||||
GLsizei width,
|
||||
GLsizei height,
|
||||
GLint border,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
const GLvoid * data);
|
||||
|
||||
void gl_load_texture_data(
|
||||
uint32_t id_data,
|
||||
enum gfx_wrap_type wrap_type,
|
||||
enum texture_filter_type filter_type,
|
||||
unsigned alignment,
|
||||
unsigned width, unsigned height,
|
||||
const void *frame, unsigned base_size);
|
||||
|
||||
static INLINE GLenum gl_min_filter_to_mag(GLenum type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case GL_LINEAR_MIPMAP_LINEAR:
|
||||
return GL_LINEAR;
|
||||
case GL_NEAREST_MIPMAP_NEAREST:
|
||||
return GL_NEAREST;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static INLINE bool gl_set_core_context(enum retro_hw_context_type ctx_type)
|
||||
{
|
||||
gfx_ctx_flags_t flags;
|
||||
@ -406,6 +273,12 @@ static INLINE bool gl_set_core_context(enum retro_hw_context_type ctx_type)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool gl_query_core_context_in_use(void);
|
||||
|
||||
bool gl_load_luts(
|
||||
const void *shader_data,
|
||||
GLuint *textures_lut);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Metal/Metal.h>
|
||||
#import <QuartzCore/CAMetalLayer.h>
|
||||
#import "RendererCommon.h"
|
||||
|
||||
@interface Texture : NSObject
|
||||
|
@ -384,7 +384,6 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (bool)_initConversionFilters
|
||||
{
|
||||
NSError *err = nil;
|
||||
@ -708,7 +707,6 @@ static const NSUInteger kConstantAlignment = 256;
|
||||
static const NSUInteger kConstantAlignment = 4;
|
||||
#endif
|
||||
|
||||
|
||||
- (instancetype)initWithDevice:(id<MTLDevice>)device blockLen:(NSUInteger)blockLen
|
||||
{
|
||||
if (self = [super init])
|
||||
@ -811,5 +809,4 @@ static const NSUInteger kConstantAlignment = 4;
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
@ -88,7 +88,6 @@
|
||||
[_context resetScissorRect];
|
||||
}
|
||||
|
||||
|
||||
- (MTLPrimitiveType)_toPrimitiveType:(enum menu_display_prim_type)prim
|
||||
{
|
||||
switch (prim)
|
||||
|
@ -89,4 +89,3 @@ typedef struct
|
||||
} FontFragmentIn;
|
||||
|
||||
#endif /* ShaderTypes_h */
|
||||
|
||||
|
@ -71,7 +71,6 @@ typedef struct
|
||||
vector_float3 vEC;
|
||||
} RibbonOutIn;
|
||||
|
||||
|
||||
vertex RibbonOutIn ribbon_vertex(const SpriteVertex in [[ stage_in ]], const device Uniforms &constants [[ buffer(BufferIndexUniforms) ]])
|
||||
{
|
||||
float4 t = (constants.projectionMatrix * float4(in.position, 0, 1));
|
||||
|
@ -28,15 +28,13 @@
|
||||
#endif
|
||||
|
||||
#include "vulkan_common.h"
|
||||
#include "../../libretro-common/include/retro_timers.h"
|
||||
#include <retro_timers.h>
|
||||
#include "../../configuration.h"
|
||||
#include "../include/vulkan/vulkan.h"
|
||||
#include "../../libretro-common/include/retro_assert.h"
|
||||
#include <retro_assert.h>
|
||||
#include "vksym.h"
|
||||
#include "../../libretro-common/include/dynamic/dylib.h"
|
||||
#include "../../libretro-common/include/libretro_vulkan.h"
|
||||
#include "../../libretro-common/include/retro_math.h"
|
||||
#include "../../libretro-common/include/string/stdstring.h"
|
||||
#include <libretro_vulkan.h>
|
||||
#include <retro_math.h>
|
||||
|
||||
#define VENDOR_ID_AMD 0x1002
|
||||
#define VENDOR_ID_NV 0x10DE
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user