Merge pull request #1 from libretro/master

Merge upstream
This commit is contained in:
meepingsnesroms 2017-11-15 15:44:40 -08:00 committed by GitHub
commit 53d037ee58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1775 changed files with 370338 additions and 107207 deletions

7
.gitignore vendored
View File

@ -63,6 +63,11 @@ menu/driverspzarch.c
/media/shaders_glsl/
/obj-w32/
# Wii U
*.depend
*.rpx
wiiu/wut/elf2rpl/elf2rpl
# Ctags
/tags
@ -105,3 +110,5 @@ obj-unix/
/pkg/msvc/msvc-2010/Release Cg/*.obj
/pkg/msvc/msvc-2010/Release Cg/*.res
/pkg/msvc/msvc-2010/Release Cg/*.pdb
retroarch.cfg

View File

@ -3,6 +3,22 @@ language: generic
matrix:
include:
- compiler: mingw-x86
addons:
apt:
packages:
- g++-mingw-w64-i686
- mingw-w64-i686-dev
script:
- CROSS_COMPILE=i686-w64-mingw32- ./configure --disable-d3d9 && make HAVE_ZLIB=1 HAVE_BUILTINZLIB=1 HAVE_RPNG=1
- compiler: mingw-x64
addons:
apt:
packages:
- g++-mingw-w64-x86-64
- mingw-w64-x86-64-dev
script:
- CROSS_COMPILE=x86_64-w64-mingw32- ./configure --disable-d3d9 && make HAVE_ZLIB=1 HAVE_BUILTINZLIB=1 HAVE_RPNG=1
- compiler: gcc
- compiler: clang
addons:
@ -25,6 +41,7 @@ script:
env:
global:
- MAKEFLAGS="-j2"
- secure: "qc91ReC3OlzSh2gFaSH6TYzC2qIQvgA2AZff6J13eaH8xijAhuMzttZ0rMQJ0DWCIhPeUb0kIzVyaGoe4MwPALzpw1C1AznIWiZJ53HN+hWCOcS/af7YVPk6HPySnwqrS+Wv3AIIvIKFV2mxv21F/JbT/N+pArlRrp904Xj+KPo="
addons:
apt:

View File

@ -1,46 +1,203 @@
# 1.5.1 (future)
- NET: Fix bug #4703 (https://github.com/libretro/RetroArch/issues/4703)
# 1.6.8 (future)
- Audio: Fix the Audio DSP picker
- GUI: (MaterialUI) Fix crash that happened on context reset with Vulkan.
- GUI: (MaterialUI) Skip querying and drawing items that are not visible; Cache content height and bbox calculation.
- GUI: (MaterialUI) Fix entry box highlight calculation.
- GUI: (XMB) Skip drawing the fading list when it is already transparent. Optimization.
- GUI: (XMB) Comment out visible item calculation in xmb_draw_items().
- GUI: (RGUI) Prevent crashes when using a non-English language reliant on UTF8.
- GUI: Add menu option for OSD background color.
- GUI: Add menu option for OSD text color.
- GUI: Add menu option to remove frame count from OSD.
- GUI: Allow wraparound of int/float settings when pressing the left key
- INPUT: Always show the controls menu even if descriptors are not set
- INPUT: Fix input descriptors not being set on cores that don't implement the controllers interface
- INPUT: Apply descriptors only for the amount of cores the core supports
- INPUT: Implement keyboard to gamepad input remapping (limited to one gamepad device for now)
- INPUT: Fix absolute mouse move handling on the winraw driver
- INPUT: Ignore keyboard input if window is not active on udev driver
- INPUT: Sanitize the filenames of autoconfig profiles before saving
- LOBBIES: Fix crash on navigating left / right from the lobby menu
- LOCALIZATION: Update Dutch translation
- LOCALIZATION: Update Italian translation.
- LOCALIZATION: Update Japanese translation.
- LOCALIZATION: Update Portuguese-Brazilian translation.
- LOCALIZATION: Update Russian translation.
- LINUX/ARMHF: Set buildbot updater URL to armhf location instead of blank string
- LINUX/PI: Broadcom VC4: Add Videocore config option
- LINUX/UDEV: Fix - RetroArch reads keyboard input when not focused with the udev input driver.
- NETPLAY: Fix disconnection not fully deinitializing Netplay.
- COMMON: Fix clear/free loop conditionals in playlists.
- WINDOWS/GDI: Fix flickering of text.
- WINDOWS/GDI: Fix graphics corruption on Windows 98
- WINDOWS/GDI: Allow compiling without DirectInput8 for NT support
- WINDOWS/WGL: Try to use wglSwapLayerBuffers instead of SwapBuffers if possible (for more optimal performance).
- WINDOWS: Fix menubar text corruption on Japanese locale systems
- WINDOWS: Support Unicode file I/O (can now display CJK characters in file browser for example).
- WINDOWS: Support Windows 95, NT3.51, NT4
- WINDOWS: add Makefile.griffin targets for msvc6,2003,2005,2010,2012,2013
- WII: Use custom, embedded libogc SDK.
- WIIU: Initial touchscreen support for WiiU gamepad.
- WIIU: Add Cheevos support.
- SCANNER: Fix archive scanning.
- SCANNER: Support CHD files.
- SCANNER: Support Gamecube ISO scanning.
- SCANNER: Use primary data track of disc images for CRC lookups rather than cue files. This is slower but finds matches more reliably, and is necessary for CHD files to work at all. Update your databases!
# 1.6.7
- SCANNER: Fix directory scanning.
- SCANNER: Fix file scanning.
- COMMON: Fix 'Disk Image Append' option.
- FREEBSD: Compatibility fixes for Video4Linux2 camera driver.
- GUI: (MaterialUI) Add disk image append icons.
- GUI: (MaterialUI) Improve word wrapping when menu icons are enabled.
- GUI: (MaterialUI) Add User Interface -> Appearance -> Menu Icons Enable. You can turn on/off the icons on the lefthand side of the menu entries.
- GUI: Performance optimizations for XMB menu driver - only calculates visible items.
- LOCALIZATION: Update Italian translation.
# 1.6.6
- 3DS: Fixes serious performance regression that affected every core; rewind was always implicitly enabled.
- AUDIO: MOD/S3M/XM sound should now be properly mixed in with the core's sound.
- GUI: Visual makeover of MaterialUI.
- GUI: Added 'Music', 'Images' and 'Video' collection options to RGUI/MaterialUI.
- GUI: Allow the user to add 'Favorites'.
- GUI: Allow the user to rename entries.
- GUI: Performance optimizations for XMB menu driver.
- LOCALIZATION: Update Italian translation
- INPUT: Overlay controller response - when we press buttons on the gamepad or keyboard, the corresponding buttons on the overlay will be highlighted as well.
- NETBSD: Silence some compilation warnings.
- COMMON: Fixed bug 'Deleting an entry from a playlist would not update the list view inside XMB'.
- COMMON: Fix inet_ntop_compat on Unix
- LOBBY: Add skeleton to add help descriptions to lobbies
# 1.6.5
Skipped this one.
# 1.6.4
- ANDROID: Fire Stick & Fire TV remote overrides gamepad port 0 on button press and viceversa like SHIELD devices
- ANDROID: Provide default save / system / state / screenshot locations
- AUDIO: Audio mixer supports MOD/S3M/XM file types now!
- INPUT: input swap override flag (for remotes) is cleared correctly
- INPUT: allow specifying libretro device in remap files
- INPUT: allow specifying analog dpad mode in remap files
- INPUT: allow saving libretro device to remap files
- INPUT: allow saving analog dpad mode to remap files
- INPUT: allow removing core and game remap files from the menu
- COMMON: Cores can now request to set a 'shared context'. You no longer need to explicitly enable 'Shared Hardware Context' for Citra/OpenLara/Dolphin.
- COMMON: Add 'Delete Core' option to Core Information menu.
- COMMON: Allow Max Timing Skew to be set to 0.
- COMMON: Change the "content dir" behavior so it works on either a flag or an empty directory setting, now platform drivers can provide defaults for save / system / state / screenshot dirs and still allow the content dir functionality, these settings are under settings / saving and flagged as advanced
- GUI: You can turn on/off 'Horizontal Animation' now for the XMB menu. Turning animations off can result in a performance boost.
- GUI: Fix sublabel word-wrapping in XMB where multi-byte languages were cut off too soon
- LOCALIZATION: Update Dutch translation
- LOCALIZATION: Update Traditional Chinese translation
- LOCALIZATION: Update Italian translation
- LOCALIZATION: Update Russian translation
- WINDOWS: Provide default save / system / state / screenshot locations
- LOBBIES: Show what country the host is in
- MENU: Enable OSD text rendering for gdi and libcaca drivers
- WINDOWS 98/ME/2K: Set default directory for MSVC 2005 RetroArch version.
- WII: Better V-Sync handling, backported from SuperrSonic.
- WIIU: Exception handler rewritten.
# 1.6.3
- IOS: Fix GL regression - 32bit color format cores were no longer rendering
- CHEEVOS: Add support for N64 cheevos and other small fixes.
- CHEEVOS: Add 'Achievements -> Achievements Verbose Mode'. Ability to display cheevos related messages in OSD, useful for RetroAchievements users.
- AUDIO: Audio mixer's volume can now be independently increased/decreased, and muted.
- AUDIO: Mute now no longer disables/enables audio but instead properly mutes the audio volume. Mute is also independent from the audio mixer volume.
- INPUT: Add mouse index selection; ability now to select between different mice
- INPUT: Fix 'All Users Control Menu' setting
- LINUX: Add a tinyalsa audio driver. Doesn't require asoundlib, should be self-contained and lower-level.
- LOBBIES: Announce the RetroArch version too
- LOCALIZATION: Add Traditional Chinese translation
- LOCALIZATION: Update French translation
- LOCALIZATION: Update Italian translation
- LOCALIZATION: Update Japanese translation
- LOCALIZATION: Update Russian translation
- MENU: Add 'User Interface -> Views'. Ability to display/hide online updater and core updater options.
- NETPLAY: Disconnecting one client shouldn't cause everyone to disconnect anymore
- NETWORK: SSL/TLS support, disabled by default
- SCANNER: Fix PS1 game scanning
- SCANNER: Move content list builder into scanner task with progress, fixes menu freeze with large playlists
- SDL2: Fix 'SDL2 driver does not see the hat on wired Xbox 360 controller"
- SETTINGS: Fix regression 'Custom Viewport is no longer overridable per-core or per-game'
- VITA: Add cheevos support
- VITA: Add support for external USB if mounted
- WAYLAND: Fix menu mouse input
- WII: Add support for single-port 'PS1/PS2 to USB controller adapter
# 1.6.0
- ANDROID: Allow remotes to retain OK/Cancel position when menu_swap_ok_cancel is enabled
- ANDROID: Improve autoconf fallback
- ANDROID: Improve shield portable/gamepad device grouping workaround
- ANDROID: Runtime permission checking
- LOCALIZATION: Update/finish French translation
- AUDIO: Audio mixer support. Mix up to 8 streams with the game's audio.
- AUTOSAVE/SRAM - Fix bug #3829 / #4820 (https://github.com/libretro/RetroArch/issues/3829)
- ENDIANNESS: Fixed database scanning. Should fix scanning on PS3/WiiU/Wii, etc.
- LOBBIES: Fallback to filename based matching if no CRC matches are found (for people making playlists by hand)
- LOBBIES: GUI refinement, show stop hosting when a host has been started, show disconnect when playing as client
- LOBBIES: if the game is already loaded it will try to connect directly instead of re-loading content (non-fullpath cores only)
- LOBBIES: unify both netplay menus
- LOCALIZATION/GUI: Korean font should display properly now with XMB/MaterialUI's default font
- LOCALIZATION: Update German translation
- LOCALIZATION: Update Japanese translation
- LOCALIZATION/GUI: Korean font should display properly now with XMB/MaterialUI's
default font
- LOCALIZATION: Update Russian translation
- LOCALIZATION: Update/finish French translation
- MENU: Improved rendering for XMB ribbon; using additive blending (Vulkan/GL)
- MISC: Various frontend optimizations.
- NET: Fix bug #4703 (https://github.com/libretro/RetroArch/issues/4703)
- OSX/MACOS: Fixes serious memory leak
- THUMBNAILS: Thumbnails show up now in Load Content -> Collection, Information -> Database
- VIDEO: Fix threaded video regression; tickering of menu entries would no longer work.
- VITA: Fix 30fps menu (poke into input now instead of reading the entire input buffer which apparently is slow)
- VITA: Fix frame throttle
- VITA: Fix slow I/O
- VULKAN: Fix some crashes on loading some thumbnails
- VULKAN: Unicode font rendering support. Should fix bad character encoding for French characters, etc.
- WII: Fix crashing issues which could occur with the dummy core
- WIIU: HID Controller support
- WIIU: Initial network/netplay support
- WIIU: XMB/MaterialUI menu driver support
- WINDOWS: Added RawInput input driver for low-latency, low-level input.
- WINDOWS: Added WASAPI audio driver for low-latency audio. Both shared and exclusive mode.
- WINDOWS: Core mouse input should be relative again in cores
# 1.5.0
- MOBILE: Single-tap for menu entry selection
- MOBILE: Long-tap a setting to reset to default
- ANDROID: Autoconf fallback
- ANDROID: Mouse support / Emulated mouse support
- AUTOCONF: Fix partial matches for pad name
- CHEEVOS: Fix crashes in the cheevos description menu
- CHEEVOS: WIP leaderboards support
- COMMON: Threading fixes
- COMMON: 9-slice texture drawing support
- COMMON: Threading fixes
- CORETEXT/APPLE: Ability to load menu display font drivers and loading of custom font.
- DOS: Add keyboard driver
- DOS: Improve color accuracy and scaling
- GUI: Various settings are now only visible when advanced settings is enabled
- GUI: Allow changing icon theme on the fly
- GUI: Add a symbol page in the OSK
- GUI: Allow changing icon theme on the fly
- GUI: Better dialogs for XMB
- GUI: Various settings are now only visible when advanced settings is enabled
- LOCALIZATION: Add/update Korean translation
- LOCALIZATION: Rewrite German translation
- LOCALIZATION: Update several English sublabels
- LOCALIZATION: Update several Japanese labels
- MOBILE: Long-tap a setting to reset to default
- MOBILE: Single-tap for menu entry selection
- NET: Allow manual netplay content loading
- NET: Announcing network games to the public lobby is optional now
- NET: Bake in miniupnpc
- NET: Fix netplay join for contentless cores
- NET: Fix netplay rooms being pushed on the wrong tab
- NET: Lan games show next to lobbies with (lan) and connect via the private IP address
- NET: Use new lobby system with MITM support
- NET: Fix netplay rooms being pushed on the wrong tab
- NUKLEAR: Update to current version
- SCANNER: Always add 7z & zip to supported extensions
- VULKAN: Find supported composite alpha in swapchain
- VULKAN: Add snow/bokeh shader pipeline effects - at parity with GL now
- VULKAN: Find supported composite alpha in swapchain
- WIIU: Keyboard support
- WINDOWS: Logging to file no longer spawns an empty window
- WINDOWS: Fix loading of core/content via file menu
- WINDOWS: Logging to file no longer spawns an empty window
# 1.4.1

View File

@ -13,10 +13,6 @@ TARGET = retroarch
OBJDIR := obj-unix
ifeq ($(GLOBAL_CONFIG_DIR),)
GLOBAL_CONFIG_DIR = /etc
endif
OBJ :=
LIBS :=
DEFINES := -DHAVE_CONFIG_H -DRARCH_INTERNAL -DHAVE_OVERLAY
@ -78,7 +74,7 @@ ifneq ($(findstring Win32,$(OS)),)
LDFLAGS += -mwindows
endif
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) $(DEBUG_FLAG) -I.
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) $(DEBUG_FLAG) -I. -Ideps -Ideps/stb
APPEND_CFLAGS := $(CFLAGS)
CXXFLAGS += $(APPEND_CFLAGS) -std=c++11 -D__STDC_CONSTANT_MACROS

View File

@ -1,6 +1,11 @@
ROOT_DIR := .
DEPS_DIR := $(ROOT_DIR)/deps
LIBRETRO_COMM_DIR := $(ROOT_DIR)/libretro-common
WANT_WGL = 0
ifeq ($(HAVE_STACK_USAGE), 1)
CFLAGS += -fstack-usage
endif
ifeq ($(HAVE_GL_CONTEXT),)
HAVE_GL_CONTEXT=0
@ -47,10 +52,6 @@ ifeq ($(HAVE_VITA2D), 1)
DEFINES += -DHAVE_VITA2D
endif
ifeq ($(HAVE_FBO), 1)
DEFINES += -DHAVE_FBO
endif
ifeq ($(HAVE_DYLIB), 1)
DEFINES += -DHAVE_DYLIB
endif
@ -90,7 +91,7 @@ ifeq ($(HAVE_SHADERPIPELINE), 1)
CFLAGS += -DHAVE_SHADERPIPELINE
endif
CFLAGS += -I$(LIBRETRO_COMM_DIR)/include
CFLAGS += -I$(LIBRETRO_COMM_DIR)/include -I$(DEPS_DIR)
# Switches
@ -104,7 +105,7 @@ endif
ifneq ($(findstring BSD,$(OS)),)
BSD_LOCAL_INC += -I/usr/local/include
OBJ += frontend/drivers/platform_bsd.o
HAVE_UNIX = 1
endif
ifneq ($(findstring Darwin,$(OS)),)
@ -118,11 +119,13 @@ ifneq ($(findstring Linux,$(OS)),)
LIBS += -lrt
OBJ += input/drivers/linuxraw_input.o \
input/common/linux_common.o \
input/common/epoll_common.o \
input/drivers_joypad/linuxraw_joypad.o \
frontend/drivers/platform_linux.o
input/drivers_joypad/linuxraw_joypad.o
HAVE_UNIX = 1
endif
ifeq ($(HAVE_UNIX), 1)
OBJ += frontend/drivers/platform_unix.o
endif
ifeq ($(findstring Haiku,$(OS)),)
LIBS += -lm
@ -156,25 +159,25 @@ OBJ += frontend/frontend.o \
retroarch.o \
dirs.o \
paths.o \
input/input_keyboard.o \
command.o \
msg_hash.o \
intl/msg_hash_us.o \
runloop.o \
$(LIBRETRO_COMM_DIR)/queues/task_queue.o \
tasks/task_content.o \
tasks/task_save.o \
tasks/task_file_transfer.o \
tasks/task_image.o \
tasks/task_audio_mixer.o \
$(LIBRETRO_COMM_DIR)/encodings/encoding_utf.o \
$(LIBRETRO_COMM_DIR)/encodings/encoding_crc32.o \
$(LIBRETRO_COMM_DIR)/lists/file_list.o \
$(LIBRETRO_COMM_DIR)/lists/dir_list.o \
$(LIBRETRO_COMM_DIR)/file/retro_dirent.o \
$(LIBRETRO_COMM_DIR)/streams/stdin_stream.o \
$(LIBRETRO_COMM_DIR)/streams/file_stream.o \
$(LIBRETRO_COMM_DIR)/streams/file_stream_transforms.o \
$(LIBRETRO_COMM_DIR)/streams/interface_stream.o \
$(LIBRETRO_COMM_DIR)/streams/memory_stream.o \
$(LIBRETRO_COMM_DIR)/file/retro_stat.o \
$(LIBRETRO_COMM_DIR)/lists/string_list.o \
$(LIBRETRO_COMM_DIR)/string/stdstring.o \
$(LIBRETRO_COMM_DIR)/memmap/memalign.o \
@ -204,8 +207,6 @@ OBJ += frontend/frontend.o \
gfx/drivers_font_renderer/bitmapfont.o \
tasks/task_autodetect.o \
input/input_autodetect_builtin.o \
input/input_joypad_driver.o \
input/input_config.o \
input/input_keymaps.o \
input/input_remapping.o \
tasks/task_overlay.o \
@ -222,7 +223,6 @@ OBJ += frontend/frontend.o \
tasks/task_powerstate.o \
$(LIBRETRO_COMM_DIR)/gfx/scaler/scaler.o \
gfx/drivers_shader/shader_null.o \
gfx/video_shader_driver.o \
gfx/video_shader_parse.o \
$(LIBRETRO_COMM_DIR)/gfx/scaler/pixconv.o \
$(LIBRETRO_COMM_DIR)/gfx/scaler/scaler_int.o \
@ -269,10 +269,12 @@ OBJ += intl/msg_hash_de.o \
intl/msg_hash_ko.o \
intl/msg_hash_nl.o \
intl/msg_hash_pl.o \
intl/msg_hash_pt.o \
intl/msg_hash_pt_br.o \
intl/msg_hash_pt_pt.o \
intl/msg_hash_ru.o \
intl/msg_hash_vn.o \
intl/msg_hash_chs.o
intl/msg_hash_chs.o \
intl/msg_hash_cht.o
endif
@ -332,6 +334,203 @@ OBJ += libretro-db/bintree.o \
tasks/task_database_cue.o
endif
ifneq ($(C89_BUILD), 1)
HAVE_LIBUI = 0
HAVE_GTKPLUS = 0
ifeq ($(HAVE_SSL), 1)
DEFINES += -DHAVE_SSL
DEFINES += -DMBEDTLS_SSL_DEBUG_ALL
# MinGW requires this for some reason, even though the include paths are relative to the source
INCLUDE_DIRS += -Ideps/mbedtls
OBJS_TLS_CRYPTO = deps/mbedtls/aes.o deps/mbedtls/aesni.o deps/mbedtls/arc4.o \
deps/mbedtls/asn1parse.o deps/mbedtls/asn1write.o deps/mbedtls/base64.o \
deps/mbedtls/bignum.o deps/mbedtls/blowfish.o deps/mbedtls/camellia.o \
deps/mbedtls/ccm.o deps/mbedtls/cipher.o deps/mbedtls/cipher_wrap.o \
deps/mbedtls/cmac.o deps/mbedtls/ctr_drbg.o deps/mbedtls/des.o \
deps/mbedtls/dhm.o deps/mbedtls/ecdh.o deps/mbedtls/ecdsa.o \
deps/mbedtls/ecjpake.o deps/mbedtls/ecp.o \
deps/mbedtls/ecp_curves.o deps/mbedtls/entropy.o deps/mbedtls/entropy_poll.o \
deps/mbedtls/error.o deps/mbedtls/gcm.o deps/mbedtls/havege.o \
deps/mbedtls/hmac_drbg.o deps/mbedtls/md.o deps/mbedtls/md2.o \
deps/mbedtls/md4.o deps/mbedtls/md5.o deps/mbedtls/md_wrap.o \
deps/mbedtls/memory_buffer_alloc.o deps/mbedtls/oid.o \
deps/mbedtls/padlock.o deps/mbedtls/pem.o deps/mbedtls/pk.o \
deps/mbedtls/pk_wrap.o deps/mbedtls/pkcs12.o deps/mbedtls/pkcs5.o \
deps/mbedtls/pkparse.o deps/mbedtls/pkwrite.o deps/mbedtls/platform.o \
deps/mbedtls/ripemd160.o deps/mbedtls/rsa.o deps/mbedtls/sha1.o \
deps/mbedtls/sha256.o deps/mbedtls/sha512.o deps/mbedtls/threading.o \
deps/mbedtls/timing.o deps/mbedtls/version.o \
deps/mbedtls/version_features.o deps/mbedtls/xtea.o
OBJS_TLS_X509 = deps/mbedtls/certs.o deps/mbedtls/pkcs11.o deps/mbedtls/x509.o \
deps/mbedtls/x509_create.o deps/mbedtls/x509_crl.o deps/mbedtls/x509_crt.o \
deps/mbedtls/x509_csr.o deps/mbedtls/x509write_crt.o deps/mbedtls/x509write_csr.o
OBJS_TLS = deps/mbedtls/debug.o deps/mbedtls/net_sockets.o \
deps/mbedtls/ssl_cache.o deps/mbedtls/ssl_ciphersuites.o \
deps/mbedtls/ssl_cli.o deps/mbedtls/ssl_cookie.o \
deps/mbedtls/ssl_srv.o deps/mbedtls/ssl_ticket.o \
deps/mbedtls/ssl_tls.o
OBJ += $(OBJS_TLS_CRYPTO) $(OBJS_TLS_X509) $(OBJS_TLS)
endif
ifeq ($(HAVE_LIBUI), 1)
DEFINES += -DHAVE_LIBUI
ifneq ($(findstring Win32,$(OS)),)
OBJ += deps/libui/windows/alloc.o \
deps/libui/windows/area.o \
deps/libui/windows/areadraw.o \
deps/libui/windows/areaevents.o \
deps/libui/windows/areascroll.o \
deps/libui/windows/areautil.o \
deps/libui/windows/box.o \
deps/libui/windows/button.o \
deps/libui/windows/checkbox.o \
deps/libui/windows/colorbutton.o \
deps/libui/windows/colordialog.o \
deps/libui/windows/combobox.o \
deps/libui/windows/container.o \
deps/libui/windows/control.o \
deps/libui/windows/d2dscratch.o \
deps/libui/windows/datetimepicker.o \
deps/libui/windows/debug.o \
deps/libui/windows/draw.o \
deps/libui/windows/drawmatrix.o \
deps/libui/windows/drawpath.o \
deps/libui/windows/drawtext.o \
deps/libui/windows/dwrite.o \
deps/libui/windows/editablecombo.o \
deps/libui/windows/entry.o \
deps/libui/windows/events.o \
deps/libui/windows/fontbutton.o \
deps/libui/windows/fontdialog.o \
deps/libui/windows/form.o \
deps/libui/windows/graphemes.o \
deps/libui/windows/grid.o \
deps/libui/windows/group.o \
deps/libui/windows/init.o \
deps/libui/windows/label.o \
deps/libui/windows/main.o \
deps/libui/windows/menu.o \
deps/libui/windows/multilineentry.o \
deps/libui/windows/parent.o \
deps/libui/windows/progressbar.o \
deps/libui/windows/radiobuttons.o \
deps/libui/windows/separator.o \
deps/libui/windows/sizing.o \
deps/libui/windows/slider.o \
deps/libui/windows/spinbox.o \
deps/libui/windows/stddialogs.o \
deps/libui/windows/tab.o \
deps/libui/windows/tabpage.o \
deps/libui/windows/text.o \
deps/libui/windows/utf16.o \
deps/libui/windows/utilwin.o \
deps/libui/windows/window.o \
deps/libui/windows/winpublic.o \
deps/libui/windows/winutil.o
LIBS += -luxtheme -ld2d1 -ldwrite -lusp10
else
ifneq ($(findstring Darwin,$(OS)),)
OBJ += deps/libui/darwin/alloc.o \
deps/libui/darwin/area.o \
deps/libui/darwin/areaevents.o \
deps/libui/darwin/autolayout.o \
deps/libui/darwin/box.o \
deps/libui/darwin/button.o \
deps/libui/darwin/checkbox.o \
deps/libui/darwin/colorbutton.o \
deps/libui/darwin/combobox.o \
deps/libui/darwin/control.o \
deps/libui/darwin/datetimepicker.o \
deps/libui/darwin/debug.o \
deps/libui/darwin/draw.o \
deps/libui/darwin/drawtext.o \
deps/libui/darwin/editablecombo.o \
deps/libui/darwin/entry.o \
deps/libui/darwin/fontbutton.o \
deps/libui/darwin/form.o \
deps/libui/darwin/grid.o \
deps/libui/darwin/group.o \
deps/libui/darwin/image.o \
deps/libui/darwin/label.o \
deps/libui/darwin/main.o \
deps/libui/darwin/map.o \
deps/libui/darwin/menu.o \
deps/libui/darwin/multilineentry.o \
deps/libui/darwin/progressbar.o \
deps/libui/darwin/radiobuttons.o \
deps/libui/darwin/scrollview.o \
deps/libui/darwin/separator.o \
deps/libui/darwin/slider.o \
deps/libui/darwin/spinbox.o \
deps/libui/darwin/stddialogs.o \
deps/libui/darwin/tab.o \
deps/libui/darwin/text.o \
deps/libui/darwin/util.o \
deps/libui/darwin/window.o \
deps/libui/darwin/winmoveresize.o
else
CFLAGS += -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0
LIBS += -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
OBJ += deps/libui/unix/alloc.o \
deps/libui/unix/area.o \
deps/libui/unix/box.o \
deps/libui/unix/button.o \
deps/libui/unix/cellrendererbutton.o \
deps/libui/unix/checkbox.o \
deps/libui/unix/child.o \
deps/libui/unix/colorbutton.o \
deps/libui/unix/combobox.o \
deps/libui/unix/control.o \
deps/libui/unix/datetimepicker.o \
deps/libui/unix/debug.o \
deps/libui/unix/draw.o \
deps/libui/unix/drawmatrix.o \
deps/libui/unix/drawpath.o \
deps/libui/unix/drawtext.o \
deps/libui/unix/editablecombo.o \
deps/libui/unix/entry.o \
deps/libui/unix/fontbutton.o \
deps/libui/unix/form.o \
deps/libui/unix/future.o \
deps/libui/unix/graphemes.o \
deps/libui/unix/grid.o \
deps/libui/unix/group.o \
deps/libui/unix/image.o \
deps/libui/unix/label.o \
deps/libui/unix/main.o \
deps/libui/unix/menu.o \
deps/libui/unix/multilineentry.o \
deps/libui/unix/progressbar.o \
deps/libui/unix/radiobuttons.o \
deps/libui/unix/separator.o \
deps/libui/unix/slider.o \
deps/libui/unix/spinbox.o \
deps/libui/unix/stddialogs.o \
deps/libui/unix/tab.o \
deps/libui/unix/text.o \
deps/libui/unix/util.o \
deps/libui/unix/window.o
endif
endif
OBJ += deps/libui/common/areaevents.o \
deps/libui/common/control.o \
deps/libui/common/debug.o \
deps/libui/common/matrix.o \
deps/libui/common/shouldquit.o \
deps/libui/common/userbugs.o
OBJ += deps/libui/libui_main.o
endif
endif
# Miscellaneous
ifeq ($(HAVE_STDIN_CMD), 1)
@ -368,9 +567,7 @@ endif
ifeq ($(HAVE_OSS), 1)
OBJ += audio/drivers/oss.o
endif
ifeq ($(HAVE_OSS_BSD), 1)
else ifeq ($(HAVE_OSS_BSD), 1)
OBJ += audio/drivers/oss.o
endif
@ -384,6 +581,11 @@ endif
DEFINES += $(ALSA_CFLAGS)
endif
ifeq ($(HAVE_TINYALSA), 1)
OBJ += audio/drivers/tinyalsa.o
DEFINES += -DHAVE_TINYALSA
endif
ifeq ($(HAVE_ROAR), 1)
OBJ += audio/drivers/roar.o
LIBS += $(ROAR_LIBS)
@ -426,12 +628,17 @@ ifeq ($(HAVE_RSOUND), 1)
endif
ifeq ($(HAVE_DSOUND), 1)
HAVE_DIRECTX=1
OBJ += audio/drivers/dsound.o
DEFINES += -DHAVE_DSOUND
LIBS += -ldxguid -ldsound
endif
ifeq ($(HAVE_WASAPI), 1)
OBJ += audio/drivers/wasapi.o
DEFINES += -DHAVE_WASAPI
LIBS += -lole32 -lksuser
endif
ifeq ($(HAVE_XAUDIO), 1)
OBJ += audio/drivers/xaudio.o
DEFINES += -DHAVE_XAUDIO
@ -518,10 +725,7 @@ endif
ifeq ($(HAVE_NUKLEAR), 1)
OBJ += menu/drivers/nuklear/nk_common.o
OBJ += menu/drivers/nuklear/nk_menu.o
OBJ += menu/drivers/nuklear/nk_wnd_main.o
OBJ += menu/drivers/nuklear/nk_wnd_file_picker.o
OBJ += menu/drivers/nuklear/nk_wnd_shader_parameters.o
OBJ += menu/drivers/nuklear/nk_wnd_settings.o
OBJ += menu/drivers/nuklear/nk_wnd_debug.o
OBJ += menu/drivers/nuklear.o
DEFINES += -DHAVE_NUKLEAR
endif
@ -548,7 +752,6 @@ ifeq ($(HAVE_MENU_COMMON), 1)
menu/menu_input.o \
menu/menu_event.o \
menu/menu_entries.o \
menu/menu_navigation.o \
menu/menu_setting.o \
menu/menu_shader.o \
menu/widgets/menu_filebrowser.o \
@ -576,7 +779,6 @@ ifeq ($(HAVE_MENU_COMMON), 1)
menu/cbs/menu_cbs_up.o \
menu/cbs/menu_cbs_down.o \
menu/cbs/menu_cbs_contentlist_switch.o \
menu/menu_display.o \
menu/menu_displaylist.o \
menu/menu_animation.o \
menu/drivers_display/menu_display_null.o \
@ -602,7 +804,6 @@ endif
ifeq ($(HAVE_THREADS), 1)
OBJ += $(LIBRETRO_COMM_DIR)/rthreads/rthreads.o \
$(LIBRETRO_COMM_DIR)/rthreads/rsemaphore.o \
gfx/video_thread_wrapper.o \
audio/audio_thread_wrapper.o
DEFINES += -DHAVE_THREADS
@ -640,7 +841,8 @@ endif
endif
ifeq ($(HAVE_WAYLAND), 1)
OBJ += gfx/drivers_context/wayland_ctx.o
OBJ += gfx/drivers_context/wayland_ctx.o \
input/drivers/wayland_input.o
DEFINES += $(WAYLAND_CFLAGS) $(WAYLAND_CURSOR_CFLAGS)
LIBS += $(WAYLAND_LIBS) $(WAYLAND_CURSOR_LIBS)
endif
@ -649,7 +851,6 @@ endif
ifeq ($(HAVE_DINPUT), 1)
LIBS += -ldinput8 -ldxguid -lole32
HAVE_DIRECTX=1
DEFINES += -DHAVE_DINPUT
OBJ += input/drivers/dinput.o \
input/drivers_joypad/dinput_joypad.o
@ -671,8 +872,7 @@ ifeq ($(HAVE_X11), 1)
input/drivers/x11_input.o \
gfx/common/dbus_common.o \
gfx/common/x11_common.o \
gfx/common/xinerama_common.o \
input/drivers_keyboard/keyboard_event_x11.o
gfx/common/xinerama_common.o
LIBS += $(X11_LIBS) $(XEXT_LIBS) $(XF86VM_LIBS) $(XINERAMA_LIBS)
DEFINES += $(X11_CFLAGS) $(XEXT_CFLAGS) $(XF86VM_CFLAGS) $(XINERAMA_CFLAGS)
@ -704,8 +904,6 @@ ifeq ($(HAVE_UDEV), 1)
DEFINES += $(UDEV_CFLAGS)
LIBS += $(UDEV_LIBS)
OBJ += input/drivers/udev_input.o \
input/common/udev_common.o \
input/drivers_keyboard/keyboard_event_udev.o \
input/drivers_joypad/udev_joypad.o
endif
@ -734,10 +932,10 @@ endif
ifeq ($(HAVE_HID), 1)
DEFINES += -DHAVE_HID
OBJ += input/input_hid_driver.o \
input/drivers_joypad/hid_joypad.o \
OBJ += input/drivers_joypad/hid_joypad.o \
input/connect/joypad_connection.o \
input/connect/connect_ps2adapter.o \
input/connect/connect_psxadapter.o \
input/connect/connect_ps3.o \
input/connect/connect_ps4.o \
input/connect/connect_wii.o \
@ -751,6 +949,10 @@ ifeq ($(HAVE_PARPORT), 1)
OBJ += input/drivers_joypad/parport_joypad.o
endif
ifneq ($(findstring Win32,$(OS)),)
OBJ += input/drivers/winraw_input.o
endif
# Companion UI
ifneq ($(findstring Win32,$(OS)),)
@ -763,14 +965,8 @@ endif
# Video
OBJ += gfx/video_context_driver.o \
gfx/drivers_context/gfx_null_ctx.o \
gfx/video_state_tracker.o \
$(LIBRETRO_COMM_DIR)/gfx/math/vector_2.o \
$(LIBRETRO_COMM_DIR)/gfx/math/vector_3.o \
$(LIBRETRO_COMM_DIR)/gfx/math/vector_4.o \
$(LIBRETRO_COMM_DIR)/gfx/math/matrix_4x4.o \
$(LIBRETRO_COMM_DIR)/gfx/math/matrix_3x3.o
OBJ += gfx/drivers_context/gfx_null_ctx.o \
gfx/video_state_tracker.o
ifeq ($(HAVE_KMS), 1)
HAVE_AND_WILL_USE_DRM = 1
@ -795,11 +991,14 @@ ifeq ($(HAVE_PLAIN_DRM), 1)
LIBS += -ldrm
endif
OBJ += \
gfx/drivers_renderchain/null_renderchain.o
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/drivers/gl_renderchains/render_chain_gl_legacy.o \
gfx/common/gl_common.o \
gfx/drivers_font/gl_raster_font.o \
$(LIBRETRO_COMM_DIR)/glsym/rglgen.o
@ -844,7 +1043,7 @@ ifeq ($(HAVE_GL_CONTEXT), 1)
ifeq ($(HAVE_FFMPEG), 1)
ifneq ($(C89_BUILD), 1)
ifneq ($(HAVE_OPENGLES), 1)
OBJ += cores/libretro-ffmpeg/fft/fft.o
OBJ += cores/libretro-ffmpeg/ffmpeg_fft.o
DEFINES += -I$(DEPS_DIR) -DHAVE_GL_FFT
NEED_CXX_LINKER=1
endif
@ -868,8 +1067,8 @@ endif
GL_LIBS := -framework OpenGL
OBJ += gfx/drivers_context/cgl_ctx.o
else ifneq ($(findstring Win32,$(OS)),)
GL_LIBS := -lopengl32 -lgdi32 -lcomdlg32 -lcomctl32
OBJ += gfx/drivers_context/wgl_ctx.o
GL_LIBS := -lopengl32 -lgdi32 -lcomdlg32
WANT_WGL=1
endif
LIBS += $(GL_LIBS)
endif
@ -922,6 +1121,7 @@ endif
ifeq ($(HAVE_VULKAN), 1)
ifneq ($(findstring Win32,$(OS)),)
GLSLANG_PLATFORM := Windows
WANT_WGL = 1
else
GLSLANG_PLATFORM := Unix
endif
@ -980,6 +1180,10 @@ ifeq ($(HAVE_VULKAN), 1)
DEFINES += -DHAVE_SLANG
endif
ifeq ($(WANT_WGL), 1)
OBJ += gfx/drivers_context/wgl_ctx.o
LIBS += -lcomctl32
endif
ifeq ($(HAVE_OMAP), 1)
OBJ += gfx/drivers/omap_gfx.o
@ -1027,24 +1231,39 @@ ifeq ($(HAVE_CG), 1)
endif
ifeq ($(HAVE_D3D9), 1)
OBJ += gfx/drivers/d3d.o \
gfx/drivers/d3d_renderchains/render_chain_null.o \
gfx/drivers/d3d_renderchains/render_chain_driver.o \
gfx/common/d3d_common.o \
gfx/drivers_font/d3d_w32_font.o \
gfx/drivers_context/d3d_ctx.o
HAVE_DIRECTX=1
DEFINES += -DHAVE_D3D -DHAVE_D3D9
HAVE_D3D_COMMON = 1
DEFINES += -DHAVE_D3D9
LIBS += -ld3d9 -ld3dx9 -ldxguid
OBJ += gfx/drivers_font/d3d_w32_font.o
ifeq ($(HAVE_CG), 1)
LIBS += -lcgD3D9
OBJ += gfx/drivers_renderchain/d3d9_cg_renderchain.o
endif
ifeq ($(HAVE_HLSL), 1)
LIBS += -lcgD3D9
OBJ += gfx/drivers_renderchain/d3d9_hlsl_renderchain.o \
gfx/drivers_shader/shader_hlsl.o
endif
endif
ifeq ($(HAVE_D3D8), 1)
HAVE_D3D_COMMON = 1
DEFINES += -DHAVE_D3D8
LIBS += -ld3d8 -ld3dx8 -ldxguid
OBJ += gfx/drivers_renderchain/d3d8_renderchain.o
endif
ifeq ($(HAVE_D3D_COMMON), 1)
DEFINES += -DHAVE_D3D
OBJ += gfx/drivers/d3d.o \
gfx/common/d3d_common.o \
gfx/drivers_context/d3d_ctx.o
ifeq ($(HAVE_MENU_COMMON), 1)
OBJ += menu/drivers_display/menu_display_d3d.o
endif
ifeq ($(HAVE_CG), 1)
LIBS += -lcgD3D9
OBJ += gfx/drivers/d3d_renderchains/render_chain_cg.o
endif
endif
#ifeq ($(HAVE_LIBXML2), 1)
@ -1063,14 +1282,14 @@ OBJ += $(LIBRETRO_COMM_DIR)/file/archive_file.o \
ifeq ($(HAVE_7ZIP),1)
CFLAGS += -I$(DEPS_DIR)/7zip
HAVE_COMPRESSION = 1
DEFINES += -DHAVE_7ZIP
DEFINES += -DHAVE_7ZIP -D_7ZIP_ST
7ZOBJ = $(DEPS_DIR)/7zip/7zIn.o \
$(DEPS_DIR)/7zip/7zAlloc.o \
$(DEPS_DIR)/7zip/Bra86.o \
$(DEPS_DIR)/7zip/7zFile.o \
$(DEPS_DIR)/7zip/7zStream.o \
$(DEPS_DIR)/7zip/7zBuf2.o \
$(DEPS_DIR)/7zip/LzFind.o \
$(DEPS_DIR)/7zip/LzmaDec.o \
$(DEPS_DIR)/7zip/LzmaEnc.o \
$(DEPS_DIR)/7zip/7zCrcOpt.o \
$(DEPS_DIR)/7zip/Bra.o \
$(DEPS_DIR)/7zip/7zDec.o \
@ -1082,6 +1301,33 @@ ifeq ($(HAVE_7ZIP),1)
$(7ZOBJ)
endif
ifeq ($(HAVE_FLAC),1)
CFLAGS += -I$(DEPS_DIR)/libFLAC/include
DEFINES += -DHAVE_FLAC -DHAVE_STDINT_H -DHAVE_LROUND -DFLAC__HAS_OGG=0 \
-DFLAC_PACKAGE_VERSION="\"retroarch\""
FLACOBJ = $(DEPS_DIR)/libFLAC/bitmath.o \
$(DEPS_DIR)/libFLAC/bitreader.o \
$(DEPS_DIR)/libFLAC/cpu.o \
$(DEPS_DIR)/libFLAC/crc.o \
$(DEPS_DIR)/libFLAC/fixed.o \
$(DEPS_DIR)/libFLAC/float.o \
$(DEPS_DIR)/libFLAC/format.o \
$(DEPS_DIR)/libFLAC/lpc.o \
$(DEPS_DIR)/libFLAC/lpc_intrin_avx2.o \
$(DEPS_DIR)/libFLAC/lpc_intrin_sse2.o \
$(DEPS_DIR)/libFLAC/lpc_intrin_sse41.o \
$(DEPS_DIR)/libFLAC/lpc_intrin_sse.o \
$(DEPS_DIR)/libFLAC/md5.o \
$(DEPS_DIR)/libFLAC/memory.o \
$(DEPS_DIR)/libFLAC/stream_decoder.o
ifneq ($(findstring Win32,$(OS)),)
DEFINES += -DHAVE_FSEEKO
# make sure not to use this on legacy Windows versions that don't have W-functions implemented
DEFINES += -DNEED_UTF8_SUPPORT
FLACOBJ += $(DEPS_DIR)/libFLAC/windows_unicode_filenames.o
endif
OBJ += $(FLACOBJ)
endif
ifeq ($(HAVE_ZLIB), 1)
OBJ += $(LIBRETRO_COMM_DIR)/file/archive_file_zlib.o \
@ -1090,6 +1336,7 @@ ifeq ($(HAVE_ZLIB), 1)
DEFINES += -DHAVE_ZLIB
HAVE_COMPRESSION = 1
ifeq ($(HAVE_BUILTINZLIB), 1)
INCLUDE_DIRS += -I$(LIBRETRO_COMM_DIR)/include/compat
DEFINES += -DWANT_ZLIB
else
LIBS += -lz
@ -1117,6 +1364,11 @@ ifeq ($(HAVE_RBMP), 1)
OBJ += $(LIBRETRO_COMM_DIR)/formats/bmp/rbmp.o
endif
ifeq ($(HAVE_IBXM), 1)
DEFINES += -DHAVE_IBXM
OBJ += $(DEPS_DIR)/ibxm/ibxm.o
endif
OBJ += $(LIBRETRO_COMM_DIR)/formats/bmp/rbmp_encode.o \
$(LIBRETRO_COMM_DIR)/formats/json/jsonsax.o \
$(LIBRETRO_COMM_DIR)/formats/json/jsonsax_full.o \
@ -1147,6 +1399,19 @@ OBJ += $(ZLIB_OBJS)
endif
endif
ifeq ($(HAVE_7ZIP),1)
ifeq ($(HAVE_FLAC),1)
DEFINES += -DHAVE_CHD -DWANT_SUBCODE -DWANT_RAW_DATA_SECTOR
CFLAGS += -I$(LIBRETRO_COMM_DIR)/formats/libchdr
OBJ += $(LIBRETRO_COMM_DIR)/formats/libchdr/bitstream.o \
$(LIBRETRO_COMM_DIR)/formats/libchdr/cdrom.o \
$(LIBRETRO_COMM_DIR)/formats/libchdr/chd.o \
$(LIBRETRO_COMM_DIR)/formats/libchdr/flac.o \
$(LIBRETRO_COMM_DIR)/formats/libchdr/huffman.o \
$(LIBRETRO_COMM_DIR)/streams/chd_stream.o
endif
endif
# Video4Linux 2
ifeq ($(HAVE_V4L2),1)
@ -1175,6 +1440,10 @@ ifeq ($(HAVE_NETWORKING), 1)
tasks/task_wifi.o \
tasks/task_netplay_find_content.o
ifeq ($(HAVE_SSL), 1)
OBJ += $(LIBRETRO_COMM_DIR)/net/net_socket_ssl.o
endif
ifneq ($(HAVE_SOCKET_LEGACY),1)
OBJ += $(LIBRETRO_COMM_DIR)/net/net_ifinfo.o
endif
@ -1200,14 +1469,18 @@ ifeq ($(HAVE_NETWORKING), 1)
network/netplay/netplay_buf.o \
network/netplay/netplay_room_parse.o
# Retro Achievements (also depends on threads)
# Retro Achievements
ifeq ($(HAVE_CHEEVOS), 1)
ifeq ($(HAVE_THREADS), 1)
DEFINES += -DHAVE_CHEEVOS
OBJ += cheevos/cheevos.o \
$(LIBRETRO_COMM_DIR)/utils/md5.o
endif
DEFINES += -DHAVE_CHEEVOS
OBJ += cheevos/cheevos.o \
cheevos/var.o \
cheevos/cond.o \
$(LIBRETRO_COMM_DIR)/utils/md5.o
endif
ifeq ($(HAVE_KEYMAPPER), 1)
OBJ += input/input_mapper.o
endif
ifeq ($(HAVE_NETWORKGAMEPAD), 1)
@ -1241,7 +1514,6 @@ endif
ifneq ($(findstring Win32,$(OS)),)
OBJ += media/rarch.o \
input/drivers_keyboard/keyboard_event_win32.o \
gfx/common/win32_common.o \
frontend/drivers/platform_win32.o
@ -1280,10 +1552,6 @@ ifeq ($(HAVE_COMPRESSION), 1)
OBJ += tasks/task_decompress.o
endif
#ifeq ($(HAVE_DIRECTX), 1)
#$DEFINES += -I"$(DXSDK_DIR)/Include"
#endif
ifeq ($(HAVE_COCOA),1)
DEFINES += -DHAVE_MAIN
OBJ += input/drivers/cocoa_input.o \

View File

@ -142,7 +142,7 @@ ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_END := -Wl,--no-whole-archive
endif
CFLAGS += -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include
CFLAGS += -I. -Ideps -Ideps/libz -Ideps/7zip -Ideps/stb -Ilibretro-common/include
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE -DSINC_LOWEST_QUALITY
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)

View File

@ -25,6 +25,7 @@ OBJ := ctr/ctr_system.o \
frontend/frontend_driver.o \
frontend/drivers/platform_ctr.o \
frontend/drivers/platform_null.o \
libretro-common/encodings/encoding_utf.o \
libretro-common/compat/compat_strcasestr.o \
libretro-common/file/file_path.o \
libretro-common/string/stdstring.o \
@ -34,7 +35,6 @@ OBJ := ctr/ctr_system.o \
libretro-common/compat/compat_strl.o \
libretro-common/file/config_file.o \
libretro-common/streams/file_stream.o \
libretro-common/file/retro_stat.o \
libretro-common/hash/rhash.o \
file_path_str.o \
verbosity.o
@ -74,7 +74,7 @@ else
CFLAGS += -O3
endif
CFLAGS += -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include
CFLAGS += -I. -Ideps/libz -Ideps/7zip -Ideps/stb -Ilibretro-common/include
#CFLAGS += -DRARCH_INTERNAL
CFLAGS += -DRARCH_CONSOLE -DIS_SALAMANDER

View File

@ -19,7 +19,6 @@ HAVE_RGUI = 1
HAVE_SDL = 0
HAVE_SDL2 = 1
HAVE_ZLIB = 1
HAVE_FBO = 1
WANT_ZLIB = 1
MEMORY = 536870912
@ -72,7 +71,7 @@ OBJ += libretro-common/audio/dsp_filters/phaser.o
OBJ += libretro-common/audio/dsp_filters/reverb.o
OBJ += libretro-common/audio/dsp_filters/wahwah.o
CFLAGS += -Ideps/libz/
CFLAGS += -Ideps/libz -Ideps -Ideps/stb
libretro = libretro_emscripten.bc
ifneq ($(V), 1)

File diff suppressed because it is too large Load Diff

358
Makefile.libogc Normal file
View File

@ -0,0 +1,358 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro")
endif
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif
export PATH := $(DEVKITPPC)/bin:$(PATH)
ifeq ($(PLATFORM),)
PLATFORM=wii
endif
#---------------------------------------------------------------------------------
# change shell on Snow Leopard
#---------------------------------------------------------------------------------
UNAME_S := $(shell uname -s)
UNAME_R := $(shell uname -r)
ifneq (,$(findstring Darwin,$(UNAME_S)))
ifneq (,$(findstring 10.8.0,$(UNAME_R)))
export SHELL=/bin/bash
endif
endif
#---------------------------------------------------------------------------------
# path to tools
#---------------------------------------------------------------------------------
export PORTLIBS := $(DEVKITPRO)/portlibs/ppc
export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH)
#---------------------------------------------------------------------------------
# the prefix on the compiler executables
#---------------------------------------------------------------------------------
PREFIX := powerpc-eabi-
export AS := $(PREFIX)as
export CC := $(PREFIX)gcc
export CXX := $(PREFIX)g++
export AR := $(PREFIX)ar
export OBJCOPY := $(PREFIX)objcopy
ISVC=$(or $(VCBUILDHELPER_COMMAND),$(MSBUILDEXTENSIONSPATH32),$(MSBUILDEXTENSIONSPATH))
#---------------------------------------------------------------------------------
%.a:
#---------------------------------------------------------------------------------
@rm -f $@
$(AR) -rc $@ $^
#---------------------------------------------------------------------------------
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
#---------------------------------------------------------------------------------
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
#---------------------------------------------------------------------------------
%.o: %.m
$(CC) $(OBJCFLAGS) -c $< -o $@
#---------------------------------------------------------------------------------
%.o: %.s
$(CC) -x assembler-with-cpp $(ASFLAGS) -c $< -o $@
#---------------------------------------------------------------------------------
%.o: %.S
$(CC) -x assembler-with-cpp $(ASFLAGS) -c $< -o $@
#---------------------------------------------------------------------------------
# canned command sequence for binary data
#---------------------------------------------------------------------------------
define bin2o
bin2s -a 32 $< | $(AS) -o $(@)
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(<F) | tr . _)`.h
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(<F) | tr . _)`.h
echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(<F) | tr . _)`.h
endef
BUILD := build
BUILD_LITE = 1
CURDIR = .
export BASEDIR := $(CURDIR)
export DEPSDIR := $(BASEDIR)/wii/libogc/deps
export LWIPDIR := $(BASEDIR)/wii/libogc/lwip
export OGCDIR := $(BASEDIR)/wii/libogc/libogc
export DBDIR := $(BASEDIR)/wii/libogc/libdb
export BTEDIR := $(BASEDIR)/wii/libogc/lwbt
export WIIUSEDIR := $(BASEDIR)/wii/libogc/wiiuse
export LIBWIIKEYB := $(BASEDIR)/wii/libogc/libwiikeyboard
export STUBSDIR := $(BASEDIR)/wii/libogc/lockstubs
export LIBS := $(BASEDIR)/wii/libogc/libs
export INCDIR := $(BASEDIR)/wii/libogc/include
export LIBDIR := $(LIBS)/$(PLATFORM)
#---------------------------------------------------------------------------------
BBALIB := $(LIBDIR)/libbba
OGCLIB := $(LIBDIR)/libogc
DBLIB := $(LIBDIR)/libdb
BTELIB := $(LIBDIR)/libbte
WIIUSELIB := $(LIBDIR)/libwiiuse
WIIKEYBLIB := $(LIBDIR)/libwiikeyboard
STUBSLIB := $(LIBDIR)/libgclibstubs
#---------------------------------------------------------------------------------
DEFAULTINCDIR := $(BASEDIR)/wii/libogc/include
DEFINCS := -I$(DEFAULTINCDIR)
INCLUDES := $(DEFINCS) \
-I$(BASEDIR)/wii/libogc \
-I$(DEFAULTINCDIR)/netif \
-I$(DEFAULTINCDIR)/ipv4 \
-I$(DEFAULTINCDIR)/sdcard \
-I$(DEFAULTINCDIR)/ogc \
-I$(DEFAULTINCDIR)/ogc/machine \
-I$(DEFAULTINCDIR)/bte \
-I$(DEFAULTINCDIR)/sdcard \
-I$(DEFAULTINCDIR)/wiikeyboard \
-I$(DEFAULTINCDIR)/wiiuse \
-I$(DEFAULTINCDIR)/di
MACHDEP := -DBIGENDIAN -DGEKKO -mcpu=750 -meabi -msdata=eabi -mhard-float -ffunction-sections -fdata-sections
ifeq ($(PLATFORM),wii)
MACHDEP += -DHW_RVL
endif
ifeq ($(PLATFORM),cube)
MACHDEP += -DHW_DOL
endif
CFLAGS := -DLIBOGC_INTERNAL -DNDEBUG -O2 -fno-strict-aliasing -mregnames -Wall $(MACHDEP) $(INCLUDES)
ASFLAGS := $(MACHDEP) -mregnames -D_LANGUAGE_ASSEMBLY $(INCLUDES)
#---------------------------------------------------------------------------------
VPATH := $(LWIPDIR) \
$(LWIPDIR)/arch/gc \
$(LWIPDIR)/arch/gc/netif \
$(LWIPDIR)/core \
$(LWIPDIR)/core/ipv4 \
$(LWIPDIR)/netif \
$(OGCDIR) \
$(DBDIR) \
$(DBDIR)/uIP \
$(BTEDIR) \
$(WIIUSEDIR) \
$(SDCARDDIR) \
$(LIBWIIKEYB) \
$(STUBSDIR)
#---------------------------------------------------------------------------------
SOURCES_LWIP := $(LWIPDIR)/network.c \
$(LWIPDIR)/netio.c \
$(LWIPDIR)/arch/gc/netif/gcif.c \
$(LWIPDIR)/core/inet.c \
$(LWIPDIR)/core/mem.c \
$(LWIPDIR)/core/dhcp.c \
$(LWIPDIR)/core/raw.c \
$(LWIPDIR)/core/memp.c \
$(LWIPDIR)/core/netif.c \
$(LWIPDIR)/core/pbuf.c \
$(LWIPDIR)/core/stats.c \
$(LWIPDIR)/core/sys.c \
$(LWIPDIR)/core/tcp.c \
$(LWIPDIR)/core/tcp_in.c \
$(LWIPDIR)/core/tcp_out.c \
$(LWIPDIR)/core/udp.c \
$(LWIPDIR)/core/ipv4/icmp.c \
$(LWIPDIR)/core/ipv4/ip.c \
$(LWIPDIR)/core/ipv4/ip_frag.c \
$(LWIPDIR)/core/ipv4/ip_addr.c \
$(LWIPDIR)/netif/etharp.c \
$(LWIPDIR)/netif/loopif.c
LWIPOBJ := $(SOURCES_LWIP:.c=.o)
#---------------------------------------------------------------------------------
SOURCES_OGC := \
$(OGCDIR)/console.c \
$(OGCDIR)/lwp_priority.c \
$(OGCDIR)/lwp_queue.c \
$(OGCDIR)/lwp_threadq.c \
$(OGCDIR)/lwp_threads.c \
$(OGCDIR)/lwp_sema.c \
$(OGCDIR)/lwp_messages.c \
$(OGCDIR)/lwp.c \
$(OGCDIR)/lwp_stack.c \
$(OGCDIR)/lwp_mutex.c \
$(OGCDIR)/lwp_watchdog.c \
$(OGCDIR)/lwp_wkspace.c \
$(OGCDIR)/lwp_objmgr.c \
$(OGCDIR)/lwp_heap.c \
$(OGCDIR)/sys_state.c \
$(OGCDIR)/exception.c \
$(OGCDIR)/irq.c \
$(OGCDIR)/semaphore.c \
$(OGCDIR)/video.c \
$(OGCDIR)/pad.c \
$(OGCDIR)/exi.c \
$(OGCDIR)/mutex.c \
$(OGCDIR)/arqueue.c \
$(OGCDIR)/arqmgr.c \
$(OGCDIR)/system.c \
$(OGCDIR)/cond.c \
$(OGCDIR)/gx.c \
$(OGCDIR)/gu.c \
$(OGCDIR)/audio.c \
$(OGCDIR)/cache.c \
$(OGCDIR)/decrementer.c \
$(OGCDIR)/message.c \
$(OGCDIR)/card.c \
$(OGCDIR)/aram.c \
$(OGCDIR)/depackrnc1.c \
$(OGCDIR)/dsp.c \
$(OGCDIR)/si.c \
$(OGCDIR)/tpl.c \
$(OGCDIR)/ipc.c \
$(OGCDIR)/console_font_8x16.c \
$(OGCDIR)/timesupp.c \
$(OGCDIR)/lock_supp.c \
$(OGCDIR)/newlibc.c \
$(OGCDIR)/usbgecko.c \
$(OGCDIR)/usbmouse.c \
$(OGCDIR)/sbrk.c \
$(OGCDIR)/malloc_lock.c \
$(OGCDIR)/kprintf.c \
$(OGCDIR)/stm.c \
$(OGCDIR)/ios.c \
$(OGCDIR)/es.c \
$(OGCDIR)/isfs.c \
$(OGCDIR)/usb.c \
$(OGCDIR)/network_common.c \
$(OGCDIR)/sdgecko_io.c \
$(OGCDIR)/sdgecko_buf.c \
$(OGCDIR)/gcsd.c \
$(OGCDIR)/argv.c \
$(OGCDIR)/network_wii.c \
$(OGCDIR)/wiisd.c \
$(OGCDIR)/conf.c \
$(OGCDIR)/usbstorage.c \
$(OGCDIR)/texconv.c \
$(OGCDIR)/wiilaunch.c
SOURCES_OGC_ASM := $(OGCDIR)/cache_asm.S \
$(OGCDIR)/decrementer_handler.S \
$(OGCDIR)/depackrnc.S \
$(OGCDIR)/exception_handler.S \
$(OGCDIR)/gu_psasm.S \
$(OGCDIR)/irq_handler.S \
$(OGCDIR)/lwp_handler.S \
$(OGCDIR)/ogc_crt0.S \
$(OGCDIR)/system_asm.S \
$(OGCDIR)/video_asm.S
ifneq ($(BUILD_LITE), 1)
SOURCES_OGC += $(OGCDIR)/dvd.c
endif
OGCOBJ := $(SOURCES_OGC:.c=.o) $(SOURCES_OGC_ASM:.S=.o)
#---------------------------------------------------------------------------------
SOURCES_DB := \
$(DBDIR)/uIP/uip_ip.c \
$(DBDIR)/uIP/uip_tcp.c \
$(DBDIR)/uIP/uip_pbuf.c \
$(DBDIR)/uIP/uip_netif.c \
$(DBDIR)/uIP/uip_arp.c \
$(DBDIR)/uIP/uip_arch.c \
$(DBDIR)/uIP/uip_icmp.c \
$(DBDIR)/uIP/memb.c \
$(DBDIR)/uIP/memr.c \
$(DBDIR)/uIP/bba.c \
$(DBDIR)/tcpip.c \
$(DBDIR)/debug.c \
$(DBDIR)/debug_handler.c \
$(DBDIR)/debug_supp.c \
$(DBDIR)/geckousb.c
DBOBJ := $(SOURCES_DB:.c=.o)
#---------------------------------------------------------------------------------
SOURCES_BTE := \
$(BTEDIR)/bte.c \
$(BTEDIR)/hci.c \
$(BTEDIR)/l2cap.c \
$(BTEDIR)/btmemb.c \
$(BTEDIR)/btmemr.c \
$(BTEDIR)/btpbuf.c \
$(BTEDIR)/physbusif.c
BTEOBJ := $(SOURCES_BTE:.c=.o)
#---------------------------------------------------------------------------------
SOURCES_WIIUSE := \
$(WIIUSEDIR)/classic.c \
$(WIIUSEDIR)/dynamics.c \
$(WIIUSEDIR)/events.c \
$(WIIUSEDIR)/io.c \
$(WIIUSEDIR)/io_wii.c \
$(WIIUSEDIR)/ir.c \
$(WIIUSEDIR)/nunchuk.c \
$(WIIUSEDIR)/wiiuse.c \
$(WIIUSEDIR)/speaker.c \
$(WIIUSEDIR)/wpad.c \
$(WIIUSEDIR)/motion_plus.c
WIIUSEOBJ := $(SOURCES_WIIUSE:.c=.o)
#---------------------------------------------------------------------------------
SOURCES_WIIKEYB = $(LIBWIIKEYB)/usbkeyboard.c \
$(LIBWIIKEYB)/keyboard.c \
$(LIBWIIKEYB)/ukbdmap.c \
$(LIBWIIKEYB)/wskbdutil.c
WIIKEYBLIBOBJ := $(SOURCES_WIIKEYB:.c=.o)
LIBRARIES := $(OGCLIB).a $(DBLIB).a
ifeq ($(PLATFORM),cube)
LIBRARIES += $(BBALIB).a
endif
ifeq ($(PLATFORM),wii)
LIBRARIES += $(BTELIB).a $(WIIUSELIB).a $(WIIKEYBLIB).a
endif
all: $(LIBRARIES)
#---------------------------------------------------------------------------------
$(BBALIB).a: $(LWIPOBJ)
#---------------------------------------------------------------------------------
$(OGCLIB).a: $(OGCOBJ)
#---------------------------------------------------------------------------------
$(DBLIB).a: $(DBOBJ)
#---------------------------------------------------------------------------------
$(WIIKEYBLIB).a: $(WIIKEYBLIBOBJ)
#---------------------------------------------------------------------------------
$(BTELIB).a: $(BTEOBJ)
#---------------------------------------------------------------------------------
$(WIIUSELIB).a: $(WIIUSEOBJ)
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
clean:
#---------------------------------------------------------------------------------
rm -fr $(LWIPOBJ) $(OGCOBJ) $(DBOBJ) $(BTEOBJ) $(WIIUSEOBJ) $(WIIKEYBLIBOBJ)
rm -f *.map

View File

@ -1,4 +1,4 @@
RARCH_VERSION = "0.9.9.3"
include version.all
DEBUG = 0

View File

@ -1,4 +1,4 @@
RARCH_VERSION = "0.9.9.3"
include version.all
#which compiler to build with - GCC or SNC
#set to GCC for debug builds for use with debugger
@ -15,7 +15,6 @@ DEBUG = 0
HAVE_GCMGL = 0
HAVE_LOGGER = 0
HAVE_FREETYPE = 0
HAVE_RLAUNCH = 0
WHOLE_ARCHIVE_LINK = 0
CONTENT_ID_FULL = UP0001-SSNE10000_00-0000000000000001
@ -34,7 +33,7 @@ EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
LDDIRS = -L. -L$(CELL_SDK)/target/ppu/lib/PSGL/RSX/ultra-opt
INCDIRS = -I. -Idefines -Ideps/libz -Ilibretro-common/include
INCDIRS = -I. -Idefines -Ideps/libz -Ilibretro-common/include -Ideps -Ideps/stb
# system platform
system_platform = unix
@ -64,11 +63,7 @@ endif
PPU_SRCS = griffin/griffin.c
ifeq ($(HAVE_RLAUNCH), 1)
DEFINES += -DHAVE_RLAUNCH
endif
DEFINES += -DHAVE_MENU -DHAVE_RGUI -DHAVE_XMB -DHAVE_LIBRETRODB -DHAVE_MATERIALUI -DHAVE_SHADERPIPELINE -DRARCH_INTERNAL -DMSB_FIRST -DHAVE_OVERLAY -DHAVE_CC_RESAMPLER
DEFINES += -DHAVE_MENU -DHAVE_RGUI -DHAVE_XMB -DHAVE_LIBRETRODB -DHAVE_MATERIALUI -DHAVE_SHADERPIPELINE -DRARCH_INTERNAL -DMSB_FIRST -DHAVE_OVERLAY -DHAVE_CC_RESAMPLER -DHAVE_STB_VORBIS
ifeq ($(HAVE_GCMGL), 1)
DEFINES += -DHAVE_GCMGL
@ -106,7 +101,7 @@ PPU_LDLIBS = $(FONT_LIBS) $(GL_LIBS) $(WHOLE_START) -lretro_ps3 $(WHOLE_END) -l
PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_HEADSET -DHAVE_LANGEXTRA -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DHAVE_7Z -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_FILTERS_BUILTIN
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_HEADSET -DHAVE_LANGEXTRA -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DHAVE_7Z -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_FILTERS_BUILTIN
#DEFINES += -DHAVE_IMAGEVIEWER
@ -168,20 +163,20 @@ pkg: $(PPU_TARGET) create-shaders copy-media-files create-npdrm-salamander crea
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf pkg/ps3
pkg-signed: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
pkg-signed-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
pkg-signed-cfw: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
pkg-signed-cfw-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
clean-selfs:
ifeq ($(EBOOT_EXISTS),1)

View File

@ -1,4 +1,4 @@
RARCH_VERSION = "0.9.9.3"
include version.all
#which compiler to build with - GCC or SNC
#set to GCC for debug builds for use with debugger
@ -13,7 +13,6 @@ DEBUG = 0
HAVE_GCMGL = 1
HAVE_LOGGER = 0
HAVE_FREETYPE = 0
HAVE_RLAUNCH = 0
WHOLE_ARCHIVE_LINK = 0
CONTENT_ID_FULL = UP0001-SSNE10000_00-0000000000000001
@ -32,7 +31,7 @@ EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
LDDIRS = -L. -L$(CELL_SDK)/target/ppu/lib/PSGL/RSX/ultra-opt
INCDIRS = -I. -Idefines
INCDIRS = -I. -Idefines -Ideps -Ideps/stb
# system platform
system_platform = unix
@ -62,10 +61,6 @@ endif
PPU_SRCS = griffin/griffin.c
ifeq ($(HAVE_RLAUNCH), 1)
DEFINES += -DHAVE_RLAUNCH
endif
DEFINES += -DHAVE_RGUI -DHAVE_MATERIALUI -DHAVE_XMB -DHAVE_MENU -DRARCH_INTERNAL
ifeq ($(HAVE_GCMGL), 1)
@ -104,7 +99,7 @@ PPU_LDLIBS = $(FONT_LIBS) $(GL_LIBS) $(WHOLE_START) -lretro_ps3 $(WHOLE_END) -l
PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=0 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=0 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_STB_VORBIS
ifeq ($(DEBUG), 1)
PPU_OPTIMIZE_LV := -O0 -g
@ -164,20 +159,20 @@ pkg: $(PPU_TARGET) create-shaders copy-media-files create-npdrm-salamander crea
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf pkg/ps3
pkg-signed: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
pkg-signed-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
pkg-signed-cfw: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
pkg-signed-cfw-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
clean-selfs:
ifeq ($(EBOOT_EXISTS),1)

View File

@ -16,9 +16,20 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win
endif
ifeq ($(DEBUG), 1)
PPU_OPTIMIZE_LV := -O0 -g
else
PPU_OPTIMIZE_LV := -O2 -DNDEBUG
endif
STRIP = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-strip.exe
PPU_CFLAGS += -I. -Ilibretro-common/include -Ideps/libz -D__CELLOS_LV2__ -DIS_SALAMANDER -DRARCH_CONSOLE -DHAVE_SYSUTILS -DHAVE_SYSMODULES -DHAVE_RARCH_EXEC
INCFLAGS = -I. -Idefines -Ilibretro-common/include -Ideps/libz
DEFINES = -D__CELLOS_LV2__ -DIS_SALAMANDER -DRARCH_CONSOLE -DHAVE_SYSUTILS -DHAVE_SYSMODULES -DHAVE_RARCH_EXEC
PPU_CFLAGS := $(PPU_OPTIMIZE_LV) $(INCFLAGS) $(DEFINES)
PPU_CXXFLAGS := $(PPU_OPTIMIZE_LV) $(INCFLAGS) $(DEFINES)
PPU_SRCS = frontend/frontend_salamander.c \
frontend/frontend_driver.c \
frontend/drivers/platform_ps3.c \
@ -27,9 +38,9 @@ PPU_SRCS = frontend/frontend_salamander.c \
libretro-common/lists/dir_list.c \
libretro-common/lists/string_list.c \
libretro-common/file/retro_dirent.c \
libretro-common/file/retro_stat.c \
libretro-common/hash/rhash.c \
libretro-common/string/stdstring.c \
libretro-common/encodings/encoding_utf.c \
libretro-common/compat/compat_strl.c \
libretro-common/compat/compat_strcasestr.c \
libretro-common/streams/file_stream.c \
@ -61,8 +72,6 @@ endif
PPU_LDLIBS += -lm -lnet_stub -lnetctl_stub -lio_stub -lsysmodule_stub -lsysutil_stub -lsysutil_game_stub -lfs_stub -lsysutil_np_stub
PPU_OPTIMIZE_LV := -O2
MAKE_FSELF = $(CELL_SDK)/host-win32/bin/make_fself.exe
include $(CELL_MK_DIR)/sdk.target.mk

View File

@ -1,4 +1,4 @@
RARCH_VERSION = "0.9.9.3"
include version.all
DEBUG = 0
HAVE_LOGGER = 0
@ -17,7 +17,7 @@ ELF_TARGET := retroarch_psl1ght.elf
EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
INCLUDE := -I. -I$(PS3DEV)/ppu/include -Ideps/libz -Ips3/gcmgl/include/export -Ips3/include
INCLUDE := -I. -I$(PS3DEV)/ppu/include -Ideps/libz -Ips3/gcmgl/include/export -Ips3/include -Ideps -Ideps/stb
LIBDIRS := -L$(PS3DEV)/ppu/lib -L$(PS3DEV)/portlibs/ppu/lib -L.
MACHDEP := -D__CELLOS_LV2__ -D__PSL1GHT__
@ -89,7 +89,7 @@ ifeq ($(HAVE_FILE_LOGGER), 1)
CFLAGS += -DHAVE_FILE_LOGGER
endif
SHARED_FLAGS := -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts -DHAVE_CC_RESAMPLER
SHARED_FLAGS := -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts -DHAVE_CC_RESAMPLER
CFLAGS += -std=gnu99 $(SHARED_FLAGS)
CXXFLAGS += $(SHARED_FLAGS)
@ -121,7 +121,7 @@ pkg: $(ELF_TARGET) create-npdrm-core
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf ps3/pkg
pkg-signed: $(ELF_TARGET) create-core
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
clean:
rm -f $(ELF_TARGET)

View File

@ -19,7 +19,7 @@ ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_END := -Wl,--no-whole-archive
endif
INCDIR = deps/libz deps/7zip libretro-common/include
INCDIR = deps deps/stb deps/libz deps/7zip libretro-common/include
CFLAGS = $(OPTIMIZE_LV) -G0 -std=gnu99 -ffast-math
ASFLAGS = $(CFLAGS)

View File

@ -40,11 +40,11 @@ OBJS = frontend/frontend_salamander.o \
libretro-common/lists/string_list.o \
libretro-common/lists/dir_list.o \
libretro-common/file/retro_dirent.o \
libretro-common/encodings/encoding_utf.o \
libretro-common/compat/compat_strl.o \
libretro-common/compat/compat_strcasestr.o \
libretro-common/file/config_file.o \
libretro-common/streams/file_stream.o \
libretro-common/file/retro_stat.o \
libretro-common/hash/rhash.o \
file_path_str.o \
verbosity.o \

View File

@ -45,6 +45,7 @@ else
HAVE_THREADS := 1
HAVE_LIBRETRODB := 1
HAVE_CC_RESAMPLER := 1
HAVE_CHEEVOS := 1
RARCH_CONSOLE := 1
ifeq ($(DEBUG), 1)
@ -97,7 +98,7 @@ STRIP := $(PREFIX)strip
NM := $(PREFIX)nm
LD := $(CXX)
INCDIRS := -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include
INCDIRS := -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Ideps/stb
LIBDIRS := -L.
ARCHFLAGS := -march=armv7-a -mfpu=neon -mfloat-abi=hard -DVITA

View File

@ -41,11 +41,11 @@ OBJS = frontend/frontend_salamander.o \
libretro-common/lists/string_list.o \
libretro-common/lists/dir_list.o \
libretro-common/file/retro_dirent.o \
libretro-common/encodings/encoding_utf.o \
libretro-common/compat/compat_strl.o \
libretro-common/compat/compat_strcasestr.o \
libretro-common/file/config_file.o \
libretro-common/streams/file_stream.o \
libretro-common/file/retro_stat.o \
libretro-common/hash/rhash.o \
file_path_str.o \
verbosity.o

View File

@ -6,6 +6,7 @@
DEBUG = 0
HAVE_LOGGER = 0
HAVE_FILE_LOGGER = 0
EXTERNAL_LIBOGC = 0
# system platform
system_platform = unix
@ -29,13 +30,23 @@ ELF2DOL = $(DEVKITPPC)/bin/elf2dol$(EXE_EXT)
DOL_TARGET := retroarch-salamander_wii.dol
ELF_TARGET := retroarch-salamander_wii.elf
INCLUDE := -I. -I$(DEVKITPRO)/libogc/include -Ilibretro-common/include -Ideps/libz
INCLUDE := -I. -Ilibretro-common/include -Ideps/libz
ifeq ($(EXTERNAL_LIBOGC), 1)
INCLUDE += -I$(DEVKITPRO)/libogc/include
LIBDIRS := -L$(DEVKITPRO)/libogc/lib/wii -L.
else
INCLUDE += -Iwii/libogc/include
LIBDIRS := -Lwii/libogc/libs/wii -L.
endif
MACHDEP := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE)
LDFLAGS := $(MACHDEP) -Wl,-Map,$(notdir $(ELF_TARGET)).map
LIBS := -lfat -lwiiuse -logc -lbte
LIBS := -lwiiuse -logc -lbte
ifeq ($(EXTERNAL_LIBOGC), 1)
LIBS += -lfat
endif
APP_BOOTER_DIR = wii/app_booter
@ -51,7 +62,7 @@ OBJ = frontend/frontend_salamander.o \
libretro-common/lists/dir_list.o \
libretro-common/streams/file_stream.o \
libretro-common/file/retro_dirent.o \
libretro-common/file/retro_stat.o \
libretro-common/encodings/encoding_utf.o \
libretro-common/compat/compat_strl.o \
libretro-common/compat/compat_strcasestr.o \
libretro-common/file/config_file.o \
@ -59,6 +70,20 @@ OBJ = frontend/frontend_salamander.o \
verbosity.o \
$(APP_BOOTER_DIR)/app_booter.binobj
ifeq ($(EXTERNAL_LIBOGC), 1)
else
OBJ += wii/libogc/libfat/cache.o \
wii/libogc/libfat/directory.o \
wii/libogc/libfat/disc.o \
wii/libogc/libfat/fatdir.o \
wii/libogc/libfat/fatfile.o \
wii/libogc/libfat/file_allocation_table.o \
wii/libogc/libfat/filetime.o \
wii/libogc/libfat/libfat.o \
wii/libogc/libfat/lock.o \
wii/libogc/libfat/partition.o
endif
ifeq ($(HAVE_LOGGER), 1)
CFLAGS += -DHAVE_LOGGER
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)

View File

@ -1,18 +1,38 @@
TARGET := retroarch_wiiu
BUILD_HBL_ELF = 1
BUILD_RPX = 1
BUILD_RPX = 1
DEBUG = 0
GRIFFIN_BUILD = 0
WHOLE_ARCHIVE_LINK = 0
PC_DEVELOPMENT_IP_ADDRESS =
PC_DEVELOPMENT_TCP_PORT =
ifneq ($(V), 1)
Q := @
endif
PC_DEVELOPMENT_IP_ADDRESS ?=
PC_DEVELOPMENT_TCP_PORT ?=
OBJ :=
OBJ += wiiu/system/memory.o
OBJ += wiiu/system/exception_handler.o
OBJ += wiiu/system/missing_libc_functions.o
OBJ += wiiu/fs/sd_fat_devoptab.o
OBJ += wiiu/fs/fs_utils.o
OBJ += wiiu/controller_patcher/ControllerPatcher.o
OBJ += wiiu/controller_patcher/ControllerPatcherWrapper.o
OBJ += wiiu/controller_patcher/ConfigReader.o
OBJ += wiiu/controller_patcher/config/ConfigParser.o
OBJ += wiiu/controller_patcher/config/ConfigValues.o
OBJ += wiiu/controller_patcher/network/ControllerPatcherNet.o
OBJ += wiiu/controller_patcher/network/TCPServer.o
OBJ += wiiu/controller_patcher/network/UDPClient.o
OBJ += wiiu/controller_patcher/network/UDPServer.o
OBJ += wiiu/controller_patcher/patcher/ControllerPatcherUtils.o
OBJ += wiiu/controller_patcher/patcher/ControllerPatcherHID.o
OBJ += wiiu/controller_patcher/utils/CPRetainVars.o
OBJ += wiiu/controller_patcher/utils/CPStringTools.o
OBJ += wiiu/controller_patcher/utils/PadConst.o
OBJ += wiiu/controller_patcher/utils/FSHelper.o
OBJ += wiiu/tex_shader.o
OBJ += wiiu/hbl.o
@ -22,7 +42,10 @@ ifeq ($(GRIFFIN_BUILD), 1)
OBJ += griffin/griffin.o
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_RGUI -DHAVE_LIBRETRODB
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -DHAVE_CC_RESAMPLER
# DEFINES += -DHAVE_XMB -DHAVE_MATERIALUI
DEFINES += -DHAVE_STB_FONT -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DHAVE_LIBRETRODB -DHAVE_NETWORKING
# DEFINES += -DWANT_IFADDRS
# DEFINES += -DHAVE_FREETYPE
DEFINES += -DHAVE_XMB -DHAVE_MATERIALUI
else
HAVE_MENU_COMMON = 1
HAVE_RTGA = 1
@ -33,20 +56,29 @@ else
HAVE_ZLIB = 1
HAVE_7ZIP = 1
HAVE_BUILTINZLIB = 1
HAVE_KEYMAPPER = 1
HAVE_LIBRETRODB = 1
HAVE_ZARCH = 0
HAVE_MATERIALUI = 0
HAVE_XMB = 0
HAVE_MATERIALUI = 1
HAVE_XMB = 1
HAVE_STB_FONT = 1
# HAVE_FREETYPE = 1
HAVE_LANGEXTRA = 1
HAVE_LIBRETRODB = 1
HAVE_NETWORKING = 1
HAVE_CHEEVOS = 1
# WANT_IFADDRS = 1
include Makefile.common
BLACKLIST :=
BLACKLIST += input/input_overlay.o
BLACKLIST += tasks/task_overlay.o
BLACKLIST += $(LIBRETRO_COMM_DIR)/net/net_ifinfo.o
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
OBJ += gfx/drivers/wiiu_gfx.o
# OBJ += gfx/drivers_font/wiiu_font.o
# OBJ += menu/drivers_display/menu_display_wiiu.o
OBJ += gfx/drivers_font/wiiu_font.o
OBJ += menu/drivers_display/menu_display_wiiu.o
OBJ += input/drivers/wiiu_input.o
OBJ += input/drivers_joypad/wiiu_joypad.o
OBJ += audio/drivers/wiiu_audio.o
@ -71,6 +103,7 @@ else
OBJ += libretro-common/audio/dsp_filters/wahwah.o
endif
DEFINES += -DHAVE_KEYMAPPER
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
@ -101,7 +134,7 @@ else
endif
INCDIRS := -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Iwiiu -Iwiiu/include -I$(DEVKITPRO)/portlibs/ppc/include
INCDIRS := -I. -Ideps -Ideps/stb -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Iwiiu -Iwiiu/include -I$(DEVKITPRO)/portlibs/ppc/include
LIBDIRS := -L. -L$(DEVKITPRO)/portlibs/ppc/lib
CFLAGS := -mwup -mcpu=750 -meabi -mhard-float
@ -123,6 +156,7 @@ CFLAGS += -ffast-math -Werror=implicit-function-declaration
#todo: remove -DWIIU and use the built-in macros instead (HW_WUP or __wiiu__).
CFLAGS += -DWIIU -DMSB_FIRST
CFLAGS += -DHAVE_MAIN
CFLAGS += -DHAVE_UPDATE_ASSETS
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)
@ -138,7 +172,7 @@ ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_START := -Wl,--whole-archive
WHOLE_END := -Wl,--no-whole-archive
endif
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -D_GNU_SOURCE
LDFLAGS += -Wl,--gc-sections
@ -172,41 +206,50 @@ all: $(TARGETS)
%.o: %.cpp
%.o: %.cpp %.depend
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS) $(DEPFLAGS)
$(POSTCOMPILE)
@$(if $(Q), echo CXX $<,)
$(Q)$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS) $(DEPFLAGS)
$(Q)$(POSTCOMPILE)
%.o: %.c
%.o: %.c %.depend
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) $(DEPFLAGS)
$(POSTCOMPILE)
@$(if $(Q), echo CC $<,)
$(Q)$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) $(DEPFLAGS)
$(Q)$(POSTCOMPILE)
%.o: %.S
%.o: %.S %.depend
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
$(POSTCOMPILE)
@$(if $(Q), echo AS $<,)
$(Q)$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
$(Q)$(POSTCOMPILE)
%.o: %.s
%.o: %.s %.depend
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
$(POSTCOMPILE)
@$(if $(Q), echo AS $<,)
$(Q)$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
$(Q)$(POSTCOMPILE)
%.a:
$(AR) -rc $@ $^
@$(if $(Q), echo AR $<,)
$(Q)$(AR) -rc $@ $^
%.depend: ;
$(ELF2RPL):
$(MAKE) -C wiiu/wut/elf2rpl/
@$(if $(Q), echo MAKE $@,)
$(Q)$(MAKE) -C wiiu/wut/elf2rpl/
$(TARGET).elf: $(OBJ) $(HBL_ELF_OBJ) libretro_wiiu.a wiiu/link_elf.ld
$(LD) $(OBJ) $(HBL_ELF_OBJ) $(LDFLAGS) $(HBL_ELF_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
@$(if $(Q), echo LD $@,)
$(Q)$(LD) $(OBJ) $(HBL_ELF_OBJ) $(LDFLAGS) $(HBL_ELF_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
$(TARGET).rpx.elf: $(OBJ) $(RPX_OBJ) libretro_wiiu.a wiiu/link_elf.ld
$(LD) $(OBJ) $(RPX_OBJ) $(LDFLAGS) $(RPX_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
@$(if $(Q), echo LD $@,)
$(Q)$(LD) $(OBJ) $(RPX_OBJ) $(LDFLAGS) $(RPX_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
$(TARGET).rpx: $(TARGET).rpx.elf $(ELF2RPL)
-$(ELF2RPL) $(TARGET).rpx.elf $@
@$(if $(Q), echo ELF2RPL $@,)
$(Q)-$(ELF2RPL) $(TARGET).rpx.elf $@
clean:
rm -f $(OBJ) $(RPX_OBJ) $(HBL_ELF_OBJ) $(TARGET).elf $(TARGET).rpx.elf $(TARGET).rpx

View File

@ -16,6 +16,7 @@ OBJ += frontend/frontend_salamander.o
OBJ += frontend/frontend_driver.o
OBJ += frontend/drivers/platform_wiiu.o
OBJ += frontend/drivers/platform_null.o
OBJ += libretro-common/encodings/encoding_utf.o
OBJ += libretro-common/compat/compat_strcasestr.o
OBJ += libretro-common/file/file_path.o
OBJ += libretro-common/string/stdstring.o
@ -25,7 +26,6 @@ OBJ += libretro-common/file/retro_dirent.o
OBJ += libretro-common/compat/compat_strl.o
OBJ += libretro-common/file/config_file.o
OBJ += libretro-common/streams/file_stream.o
OBJ += libretro-common/file/retro_stat.o
OBJ += libretro-common/hash/rhash.o
OBJ += file_path_str.o
OBJ += verbosity.o

View File

@ -3,8 +3,8 @@ TARGET = retroarch.exe
HAVE_DINPUT = 1
HAVE_XAUDIO = 1
HAVE_DSOUND = 1
HAVE_WASAPI = 1
HAVE_OPENGL = 1
HAVE_FBO = 1
HAVE_DYLIB = 1
HAVE_D3D9 = 1
HAVE_NETWORKING = 1
@ -121,8 +121,8 @@ else
CXXFLAGS += -O3 -ffast-math
endif
CFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I.
CXXFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I. -std=c++98 -D__STDC_CONSTANT_MACROS
CFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I. -Ideps
CXXFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I. -Ideps -std=c++98 -D__STDC_CONSTANT_MACROS
ifeq ($(CXX_BUILD), 1)
CFLAGS += -std=c++98 -xc++ -D__STDC_CONSTANT_MACROS
else

115
README.md
View File

@ -8,6 +8,12 @@ Popular examples of implementations for this API includes videogame system emula
more generalized 3D programs.
These programs are instantiated as dynamic libraries. We refer to these as "libretro cores".
![XMB menu driver](http://i.imgur.com/BMR1xxr.png "XMB menu driver")
![rgui menu driver](http://i.imgur.com/X3CbBKa.png "rgui menu driver")
![glui menu driver](http://i.imgur.com/ooqv8rw.png "glui menu driver")
## libretro
[libretro](http://libretro.com) is an API that exposes generic audio/video/input callbacks.
@ -30,13 +36,16 @@ or visit our IRC channel: #retroarch @ irc.freenode.org.
## Documentation
See our [wiki](https://github.com/libretro/RetroArch/wiki). On Unix, man-pages are provided.
See our [Documentation Center](https://docs.libretro.com/). On Unix, man-pages are provided.
More developer-centric stuff is found [here](https://github.com/libretro/libretro.github.com/wiki/Documentation-devs).
## Related projects
- Cg/HLSL shaders: [common-shaders](https://github.com/libretro/common-shaders)
- slang shaders: [slang-shaders](https://github.com/libretro/slang-shaders)
- GLSL shaders: [glsl-shaders](https://github.com/libretro/glsl-shaders)
- Helper scripts to build libretro implementations: [libretro-super](https://github.com/libretro/libretro-super)
- GitHub mirrors of projects, useful for generating diff files: [libretro-mirrors](https://github.com/libretro-mirrors/)
## Philosophy
@ -52,12 +61,19 @@ RetroArch also emphasizes on being easy to integrate into various launcher front
## Platforms
RetroArch has been ported to the following platforms outside PC:
RetroArch has been ported to the following platforms:
- Windows
- Linux
- FreeBSD
- NetBSD
- MacOS
- PlayStation 3
- PlayStation Portable
- Original Xbox
- Xbox 360 (Libxenon/XeXDK)
- Xbox 1
- Wii, Gamecube (Libogc)
- Wii, GameCube (Libogc)
- WiiU
- Nintendo 3DS
- Raspberry Pi
- Android
@ -119,94 +135,5 @@ Users only need to configure a certain option if the desired value deviates from
To configure joypads, use the built-in menu or the `retroarch-joyconfig` command-line tool.
## Compiling and installing
**Linux**
- Prerequisites:
```bash
sudo apt-get install -y make git-core curl g++ 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
```
- Compiling:
```bash
./configure
make
```
**Mac**
- Prerequisites: [XCode](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB4QFjAA&url=https%3A%2F%2Fitunes.apple.com%2Fus%2Fapp%2Fxcode%2Fid497799835%3Fmt%3D12&ei=ZmfeVNPtIILVoASBnoCYBw&usg=AFQjCNGrxKmVtXUdvUU3MhqZhP4MHT6Gtg&sig2=RIXKsWQ79YTQBt_lK5fdKA&bvm=bv.85970519,d.cGU), [Cg](https://developer.nvidia.com/cg-toolkit-download).
- You can open the project (**pkg/apple/RetroArch.xcodeproj**) in the Xcode IDE and build (**&#8984;-B**) and run (**&#8984;-R**) it there. Or you can use the command line...
- Debug:
```bash
# Build
xcodebuild -target RetroArch -configuration Debug -project pkg/apple/RetroArch.xcodeproj
# Run
open ./pkg/apple/build/Debug/RetroArch.app/
```
- Release:
```bash
# Build
xcodebuild -target RetroArch -configuration Release -project pkg/apple/RetroArch.xcodeproj
# Run
open ./pkg/apple/build/Release/RetroArch.app/
```
**PC**
Instructions for compiling on PC can be found in the [wiki](https://github.com/Themaister/RetroArch/wiki).
**PlayStation 3**
RetroArch PS3 needs to be compiled in the following order:
1) Compile RetroArch Salamander
make -f Makefile.ps3.salamander
2) Finally, compile RetroArch packed together with the GUI:
make -f Makefile.ps3
**PlayStation 3 - Creating a PKG installable file**
You can add `pkg` as a parameter in order to make a PKG file - for example:
make -f Makefile.ps3 pkg
This creates an NPDRM package. This can be installed on debug PS3s.
To make a non-NPDRM package that can be installed on a jailbroken/CFW PS3 (such as PSGroove or PS3 CFWs and other 3.55 CFW derivatives), do:
make -f Makefile.ps3 pkg-signed
If you're using Kmeaw 3.55 firmware, the package needs to be signed:
make -f Makefile.ps3 pkg-signed-cfw
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch PS3. This file needs to be called ***`libretro_ps3.a`***.
**Xbox 360 (XeXDK)**
You will need Microsoft Visual Studio 2010 installed (or higher) in order to compile RetroArch 360.
The solution file can be found at the following location:
pkg/msvc-360/RetroArch-360.sln
NOTE: A pre-existing libretro library needs to be present in the `pkg/msvc-360/RetroArch-360/Release` directory in order to link RetroArch 360. This file needs to be
called ***`libretro_xdk360.lib`***.
**Xbox 360 (Libxenon)**
You will need to have the libxenon libraries and a working Devkit Xenon toolchain installed in order to compile RetroArch 360 Libxenon.
make -f Makefile.xenon
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch 360 Libxenon. This file needs to be called ***`libretro_xenon360.a`***.
**Wii**
You will need to have the libogc libraries and a working Devkit PPC toolchain installed in order to compile RetroArch Wii.
make -f Makefile.griffin platform=wii
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch Wii. This file needs to be called ***`libretro_wii.a`***.
Instructions for compiling and installing RetroArch can be found in the [Libretro/RetroArch Documentation Center](https://docs.libretro.com/).

View File

@ -23,9 +23,9 @@
#include <audio/conversion/s16_to_float.h>
#include <audio/audio_resampler.h>
#include <audio/dsp_filter.h>
#include <audio/audio_mixer.h>
#include <file/file_path.h>
#include <lists/dir_list.h>
#include <string/stdstring.h>
#ifdef HAVE_CONFIG_H
#include "../config.h"
@ -33,6 +33,7 @@
#include "audio_driver.h"
#include "audio_thread_wrapper.h"
#include "../gfx/video_driver.h"
#include "../record/record_driver.h"
#include "../frontend/frontend_driver.h"
@ -40,13 +41,13 @@
#include "../driver.h"
#include "../configuration.h"
#include "../retroarch.h"
#include "../runloop.h"
#include "../performance_counters.h"
#include "../verbosity.h"
#include "../list_special.h"
#define AUDIO_BUFFER_FREE_SAMPLES_COUNT (8 * 1024)
#define AUDIO_MIXER_MAX_STREAMS 8
static const audio_driver_t *audio_drivers[] = {
#ifdef HAVE_ALSA
&audio_alsa,
@ -54,6 +55,9 @@ static const audio_driver_t *audio_drivers[] = {
&audio_alsathread,
#endif
#endif
#ifdef HAVE_TINYALSA
&audio_tinyalsa,
#endif
#if defined(HAVE_OSS) || defined(HAVE_OSS_BSD)
&audio_oss,
#endif
@ -84,6 +88,9 @@ static const audio_driver_t *audio_drivers[] = {
#ifdef HAVE_DSOUND
&audio_dsound,
#endif
#ifdef HAVE_WASAPI
&audio_wasapi,
#endif
#ifdef HAVE_PULSE
&audio_pulse,
#endif
@ -103,7 +110,7 @@ static const audio_driver_t *audio_drivers[] = {
&audio_rwebaudio,
#endif
#if defined(PSP) || defined(VITA)
&audio_psp,
&audio_psp,
#endif
#ifdef _3DS
&audio_ctr_csnd,
@ -113,44 +120,65 @@ static const audio_driver_t *audio_drivers[] = {
NULL,
};
struct audio_mixer_stream
{
audio_mixer_sound_t *handle;
audio_mixer_voice_t *voice;
audio_mixer_stop_cb_t stop_cb;
enum audio_mixer_state state;
float volume;
void *buf;
size_t bufsize;
};
static unsigned audio_mixer_current_max_idx = 0;
static struct audio_mixer_stream audio_mixer_streams[AUDIO_MIXER_MAX_STREAMS] = {{0}};
static size_t audio_driver_chunk_size = 0;
static size_t audio_driver_chunk_nonblock_size = 0;
static size_t audio_driver_chunk_block_size = 0;
static size_t audio_driver_rewind_ptr = 0;
static size_t audio_driver_rewind_size = 0;
static int16_t *audio_driver_rewind_buf = NULL;
static float *audio_driver_input_data = NULL;
static int16_t *audio_driver_rewind_buf = NULL;
static int16_t *audio_driver_output_samples_conv_buf = NULL;
static unsigned audio_driver_free_samples_buf[AUDIO_BUFFER_FREE_SAMPLES_COUNT];
static uint64_t audio_driver_free_samples_count = 0;
static float *audio_driver_output_samples_buf = NULL;
static int16_t *audio_driver_output_samples_conv_buf = NULL;
static float audio_driver_volume_gain = 0.0f;
static size_t audio_driver_buffer_size = 0;
static size_t audio_driver_data_ptr = 0;
static bool audio_driver_control = false;
static bool audio_driver_control = false;
static bool audio_driver_mixer_mute_enable = false;
static bool audio_driver_mute_enable = false;
static bool audio_driver_use_float = false;
static bool audio_driver_active = false;
static bool audio_driver_data_own = false;
static bool audio_mixer_active = false;
static float audio_driver_rate_control_delta = 0.0f;
static float audio_driver_input = 0.0f;
static float audio_driver_volume_gain = 0.0f;
static float audio_driver_mixer_volume_gain = 0.0f;
static float *audio_driver_input_data = NULL;
static float *audio_driver_output_samples_buf = NULL;
static double audio_source_ratio_original = 0.0f;
static double audio_source_ratio_current = 0.0f;
static struct retro_audio_callback audio_callback = {0};
static retro_dsp_filter_t *audio_driver_dsp = NULL;
static struct string_list *audio_driver_devices_list = NULL;
static const retro_resampler_t *audio_driver_resampler = NULL;
static void *audio_driver_resampler_data = NULL;
static const audio_driver_t *current_audio = NULL;
static void *audio_driver_context_audio_data = NULL;
static bool audio_driver_use_float = false;
static bool audio_driver_active = false;
static bool audio_driver_data_own = false;
/**
* compute_audio_buffer_statistics:
*
@ -160,7 +188,8 @@ static bool audio_driver_data_own = false;
static void compute_audio_buffer_statistics(void)
{
unsigned i, low_water_size, high_water_size, avg, stddev;
float avg_filled, deviation;
float avg_filled = 0.0f;
float deviation = 0.0f;
uint64_t accum = 0;
uint64_t accum_var = 0;
unsigned low_water_count = 0;
@ -183,10 +212,13 @@ static void compute_audio_buffer_statistics(void)
accum_var += diff * diff;
}
stddev = (unsigned)sqrt((double)accum_var / (samples - 2));
avg_filled = 1.0f - (float)avg / audio_driver_buffer_size;
deviation = (float)stddev / audio_driver_buffer_size;
#if defined(_MSC_VER) && _MSC_VER <= 1200
/* FIXME: error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64 */
#else
stddev = (unsigned)sqrt((double)accum_var / (samples - 2));
avg_filled = 1.0f - (float)avg / audio_driver_buffer_size;
deviation = (float)stddev / audio_driver_buffer_size;
#endif
low_water_size = (unsigned)(audio_driver_buffer_size * 3 / 4);
high_water_size = (unsigned)(audio_driver_buffer_size / 4);
@ -198,9 +230,9 @@ static void compute_audio_buffer_statistics(void)
high_water_count++;
}
RARCH_LOG("Average audio buffer saturation: %.2f %%, standard deviation (percentage points): %.2f %%.\n",
RARCH_LOG("[Audio]: Average audio buffer saturation: %.2f %%, standard deviation (percentage points): %.2f %%.\n",
avg_filled * 100.0, deviation * 100.0);
RARCH_LOG("Amount of time spent close to underrun: %.2f %%. Close to blocking: %.2f %%.\n",
RARCH_LOG("[Audio]: Amount of time spent close to underrun: %.2f %%. Close to blocking: %.2f %%.\n",
(100.0 * low_water_count) / (samples - 1),
(100.0 * high_water_count) / (samples - 1));
}
@ -270,7 +302,7 @@ static bool audio_driver_deinit_internal(void)
audio_driver_rewind_size = 0;
if (settings && !settings->audio.enable)
if (settings && !settings->bools.audio_enable)
{
audio_driver_active = false;
return false;
@ -300,17 +332,15 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
float *samples_buf = NULL;
int16_t *conv_buf = NULL;
int16_t *rewind_buf = NULL;
size_t outsamples_max = AUDIO_CHUNK_SIZE_NONBLOCKING * 2;
size_t max_bufsamples = AUDIO_CHUNK_SIZE_NONBLOCKING * 2;
settings_t *settings = config_get_ptr();
/* Accomodate rewind since at some point we might have two full buffers. */
size_t outsamples_max = AUDIO_CHUNK_SIZE_NONBLOCKING * 2 * AUDIO_MAX_RATIO *
settings->floats.slowmotion_ratio;
convert_s16_to_float_init_simd();
convert_float_to_s16_init_simd();
/* Accomodate rewind since at some point we might have two full buffers. */
outsamples_max = max_bufsamples * AUDIO_MAX_RATIO *
settings->slowmotion_ratio;
conv_buf = (int16_t*)malloc(outsamples_max
* sizeof(int16_t));
/* Used for recording even if audio isn't enabled. */
@ -335,7 +365,7 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
audio_driver_rewind_buf = rewind_buf;
audio_driver_rewind_size = max_bufsamples;
if (!settings->audio.enable)
if (!settings->bools.audio_enable)
{
audio_driver_active = false;
return false;
@ -345,14 +375,15 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
#ifdef HAVE_THREADS
if (audio_cb_inited)
{
RARCH_LOG("Starting threaded audio driver ...\n");
RARCH_LOG("[Audio]: Starting threaded audio driver ...\n");
if (!audio_init_thread(
&current_audio,
&audio_driver_context_audio_data,
*settings->audio.device ? settings->audio.device : NULL,
settings->audio.out_rate, &new_rate,
settings->audio.latency,
settings->audio.block_frames,
*settings->arrays.audio_device
? settings->arrays.audio_device : NULL,
settings->uints.audio_out_rate, &new_rate,
settings->uints.audio_latency,
settings->uints.audio_block_frames,
current_audio))
{
RARCH_ERR("Cannot open threaded audio driver ... Exiting ...\n");
@ -363,15 +394,18 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
#endif
{
audio_driver_context_audio_data =
current_audio->init(*settings->audio.device ?
settings->audio.device : NULL,
settings->audio.out_rate, settings->audio.latency,
settings->audio.block_frames,
current_audio->init(*settings->arrays.audio_device ?
settings->arrays.audio_device : NULL,
settings->uints.audio_out_rate,
settings->uints.audio_latency,
settings->uints.audio_block_frames,
&new_rate);
}
if (new_rate != 0)
settings->audio.out_rate = new_rate;
{
configuration_set_int(settings, settings->uints.audio_out_rate, new_rate);
}
if (!audio_driver_context_audio_data)
{
@ -384,7 +418,7 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
&& current_audio->use_float(audio_driver_context_audio_data))
audio_driver_use_float = true;
if (!settings->audio.sync && audio_driver_active)
if (!settings->bools.audio_sync && audio_driver_active)
{
command_event(CMD_EVENT_AUDIO_SET_NONBLOCKING_STATE, NULL);
audio_driver_chunk_size = audio_driver_chunk_nonblock_size;
@ -394,21 +428,21 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
{
/* Should never happen. */
RARCH_WARN("Input rate is invalid (%.3f Hz). Using output rate (%u Hz).\n",
audio_driver_input, settings->audio.out_rate);
audio_driver_input = settings->audio.out_rate;
audio_driver_input, settings->uints.audio_out_rate);
audio_driver_input = settings->uints.audio_out_rate;
}
audio_source_ratio_original = audio_source_ratio_current =
(double)settings->audio.out_rate / audio_driver_input;
(double)settings->uints.audio_out_rate / audio_driver_input;
if (!retro_resampler_realloc(
&audio_driver_resampler_data,
&audio_driver_resampler,
settings->audio.resampler,
settings->arrays.audio_resampler,
audio_source_ratio_original))
{
RARCH_ERR("Failed to initialize resampler \"%s\".\n",
settings->audio.resampler);
settings->arrays.audio_resampler);
audio_driver_active = false;
}
@ -421,7 +455,7 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
audio_driver_input_data = aud_inp_data;
audio_driver_data_ptr = 0;
retro_assert(settings->audio.out_rate <
retro_assert(settings->uints.audio_out_rate <
audio_driver_input * AUDIO_MAX_RATIO);
samples_buf = (float*)malloc(outsamples_max * sizeof(float));
@ -437,7 +471,7 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
if (
!audio_cb_inited
&& audio_driver_active
&& settings->audio.rate_control
&& settings->bools.audio_rate_control
)
{
/* Audio rate control requires write_avail
@ -452,21 +486,15 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
RARCH_WARN("Audio rate control was desired, but driver does not support needed features.\n");
}
/* If we start muted, stop the audio driver,
* so subsequent unmute works. */
if ( !audio_cb_inited
&& audio_driver_active
&& settings->audio.mute_enable)
audio_driver_stop();
command_event(CMD_EVENT_DSP_FILTER_INIT, NULL);
audio_driver_free_samples_count = 0;
audio_mixer_init(settings->uints.audio_out_rate);
/* Threaded driver is initially stopped. */
if (
audio_driver_active
&& !settings->audio.mute_enable
&& audio_cb_inited
)
audio_driver_start(false);
@ -484,8 +512,9 @@ void audio_driver_set_nonblocking_state(bool enable)
audio_driver_active
&& audio_driver_context_audio_data
)
current_audio->set_nonblock_state(audio_driver_context_audio_data,
settings->audio.sync ? enable : true);
current_audio->set_nonblock_state(
audio_driver_context_audio_data,
settings->bools.audio_sync ? enable : true);
audio_driver_chunk_size = enable ?
audio_driver_chunk_nonblock_size :
@ -510,12 +539,10 @@ static bool audio_driver_flush(const int16_t *data, size_t samples)
bool is_paused = false;
bool is_idle = false;
bool is_slowmotion = false;
static struct retro_perf_counter resampler_proc = {0};
static struct retro_perf_counter audio_convert_s16 = {0};
const void *output_data = NULL;
unsigned output_frames = 0;
size_t output_size = sizeof(float);
settings_t *settings = config_get_ptr();
float audio_volume_gain = !audio_driver_mute_enable ?
audio_driver_volume_gain : 0.0f;
src_data.data_in = NULL;
src_data.data_out = NULL;
@ -529,16 +556,13 @@ static bool audio_driver_flush(const int16_t *data, size_t samples)
runloop_get_status(&is_paused, &is_idle, &is_slowmotion,
&is_perfcnt_enable);
if (is_paused || settings->audio.mute_enable)
if (is_paused)
return true;
if (!audio_driver_active || !audio_driver_input_data)
return false;
performance_counter_init(audio_convert_s16, "audio_convert_s16");
performance_counter_start_plus(is_perfcnt_enable, audio_convert_s16);
convert_s16_to_float(audio_driver_input_data, data, samples,
audio_driver_volume_gain);
performance_counter_stop_plus(is_perfcnt_enable, audio_convert_s16);
audio_volume_gain);
src_data.data_in = audio_driver_input_data;
src_data.input_frames = samples >> 1;
@ -546,7 +570,6 @@ static bool audio_driver_flush(const int16_t *data, size_t samples)
if (audio_driver_dsp)
{
static struct retro_perf_counter audio_dsp = {0};
struct retro_dsp_data dsp_data;
dsp_data.input = NULL;
@ -557,15 +580,12 @@ static bool audio_driver_flush(const int16_t *data, size_t samples)
dsp_data.input = audio_driver_input_data;
dsp_data.input_frames = (unsigned)(samples >> 1);
performance_counter_init(audio_dsp, "audio_dsp");
performance_counter_start_plus(is_perfcnt_enable, audio_dsp);
retro_dsp_filter_process(audio_driver_dsp, &dsp_data);
performance_counter_stop_plus(is_perfcnt_enable, audio_dsp);
if (dsp_data.output)
{
src_data.data_in = dsp_data.output;
src_data.input_frames = dsp_data.output_frames;
src_data.data_in = dsp_data.output;
src_data.input_frames = dsp_data.output_frames;
}
}
@ -581,55 +601,61 @@ static bool audio_driver_flush(const int16_t *data, size_t samples)
(int)current_audio->write_avail(audio_driver_context_audio_data);
int delta_mid = avail - half_size;
double direction = (double)delta_mid / half_size;
double adjust = 1.0 + settings->audio.rate_control_delta * direction;
double adjust = 1.0 + audio_driver_rate_control_delta * direction;
#if 0
RARCH_LOG_OUTPUT("Audio buffer is %u%% full\n",
RARCH_LOG_OUTPUT("[Audio]: Audio buffer is %u%% full\n",
(unsigned)(100 - (avail * 100) / audio_driver_buffer_size));
#endif
audio_driver_free_samples_buf[write_idx] = avail;
audio_driver_free_samples_buf
[write_idx] = avail;
audio_source_ratio_current =
audio_source_ratio_original * adjust;
#if 0
RARCH_LOG_OUTPUT("New rate: %lf, Orig rate: %lf\n",
RARCH_LOG_OUTPUT("[Audio]: New rate: %lf, Orig rate: %lf\n",
audio_source_ratio_current,
audio_source_ratio_original);
#endif
}
src_data.ratio = audio_source_ratio_current;
src_data.ratio = audio_source_ratio_current;
if (is_slowmotion)
src_data.ratio *= settings->slowmotion_ratio;
performance_counter_init(resampler_proc, "resampler_proc");
performance_counter_start_plus(is_perfcnt_enable, resampler_proc);
{
settings_t *settings = config_get_ptr();
src_data.ratio *= settings->floats.slowmotion_ratio;
}
audio_driver_resampler->process(audio_driver_resampler_data, &src_data);
performance_counter_stop_plus(is_perfcnt_enable, resampler_proc);
output_data = audio_driver_output_samples_buf;
output_frames = (unsigned)src_data.output_frames;
if (!audio_driver_use_float)
if (audio_mixer_active)
{
static struct retro_perf_counter audio_convert_float = {0};
bool override = audio_driver_mixer_mute_enable ? true :
(audio_driver_mixer_volume_gain != 0.0f) ? true : false;
float mixer_gain = !audio_driver_mixer_mute_enable ?
audio_driver_mixer_volume_gain : 0.0f;
audio_mixer_mix(audio_driver_output_samples_buf,
src_data.output_frames, mixer_gain, override);
}
performance_counter_init(audio_convert_float, "audio_convert_float");
performance_counter_start_plus(is_perfcnt_enable, audio_convert_float);
output_data = audio_driver_output_samples_buf;
output_frames = (unsigned)src_data.output_frames;
if (audio_driver_use_float)
output_frames *= sizeof(float);
else
{
convert_float_to_s16(audio_driver_output_samples_conv_buf,
(const float*)output_data, output_frames * 2);
performance_counter_stop_plus(is_perfcnt_enable, audio_convert_float);
output_data = audio_driver_output_samples_conv_buf;
output_size = sizeof(int16_t);
output_data = audio_driver_output_samples_conv_buf;
output_frames *= sizeof(int16_t);
}
if (current_audio->write(audio_driver_context_audio_data,
output_data, output_frames * output_size * 2,
is_perfcnt_enable) < 0)
output_data, output_frames * 2) < 0)
{
audio_driver_active = false;
return false;
@ -718,11 +744,6 @@ size_t audio_driver_sample_batch_rewind(const int16_t *data, size_t frames)
return frames;
}
void audio_driver_set_volume_gain(float gain)
{
audio_driver_volume_gain = gain;
}
void audio_driver_dsp_filter_free(void)
{
if (audio_driver_dsp)
@ -732,15 +753,14 @@ void audio_driver_dsp_filter_free(void)
void audio_driver_dsp_filter_init(const char *device)
{
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
char basedir[PATH_MAX_LENGTH];
char ext_name[PATH_MAX_LENGTH];
#endif
struct string_list *plugs = NULL;
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
fill_pathname_basedir(basedir, device, sizeof(basedir));
char *basedir = (char*)calloc(PATH_MAX_LENGTH, sizeof(*basedir));
char *ext_name = (char*)calloc(PATH_MAX_LENGTH, sizeof(*ext_name));
size_t str_size = PATH_MAX_LENGTH * sizeof(char);
fill_pathname_basedir(basedir, device, str_size);
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
if (!frontend_driver_get_core_extension(ext_name, str_size))
goto error;
plugs = dir_list_new(basedir, ext_name, false, true, false, false);
@ -752,9 +772,18 @@ void audio_driver_dsp_filter_init(const char *device)
if (!audio_driver_dsp)
goto error;
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
free(basedir);
free(ext_name);
#endif
return;
error:
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
free(basedir);
free(ext_name);
#endif
if (!audio_driver_dsp)
RARCH_ERR("[DSP]: Failed to initialize DSP filter \"%s\".\n", device);
}
@ -768,22 +797,22 @@ void audio_driver_monitor_adjust_system_rates(void)
{
float timing_skew;
settings_t *settings = config_get_ptr();
const struct retro_system_timing *info = NULL;
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
float video_refresh_rate = settings->floats.video_refresh_rate;
float max_timing_skew = settings->floats.audio_max_timing_skew;
const struct retro_system_timing *info = av_info ?
(const struct retro_system_timing*)&av_info->timing : NULL;
if (av_info)
info = (const struct retro_system_timing*)&av_info->timing;
if (!info || info->sample_rate <= 0.0)
return;
timing_skew = fabs(1.0f - info->fps / settings->video.refresh_rate);
timing_skew = fabs(1.0f - info->fps / video_refresh_rate);
audio_driver_input = info->sample_rate;
if (timing_skew <= settings->audio.max_timing_skew)
audio_driver_input *= (settings->video.refresh_rate / info->fps);
if (timing_skew <= max_timing_skew)
audio_driver_input *= (video_refresh_rate / info->fps);
RARCH_LOG("Set audio input rate to: %.2f Hz.\n",
RARCH_LOG("[Audio]: Set audio input rate to: %.2f Hz.\n",
audio_driver_input);
}
@ -813,7 +842,7 @@ bool audio_driver_find_driver(void)
settings_t *settings = config_get_ptr();
drv.label = "audio_driver";
drv.s = settings->audio.driver;
drv.s = settings->arrays.audio_driver;
driver_ctl(RARCH_DRIVER_CTL_FIND_INDEX, &drv);
@ -825,7 +854,7 @@ bool audio_driver_find_driver(void)
{
unsigned d;
RARCH_ERR("Couldn't find any audio driver named \"%s\"\n",
settings->audio.driver);
settings->arrays.audio_driver);
RARCH_LOG_OUTPUT("Available audio drivers are:\n");
for (d = 0; audio_driver_find_handle(d); d++)
RARCH_LOG_OUTPUT("\t%s\n", audio_driver_find_ident(d));
@ -885,9 +914,205 @@ bool audio_driver_get_devices_list(void **data)
return true;
}
bool audio_driver_mixer_extension_supported(const char *ext)
{
union string_list_elem_attr attr;
unsigned i;
bool ret = false;
struct string_list *str_list = string_list_new();
attr.i = 0;
#ifdef HAVE_STB_VORBIS
string_list_append(str_list, "ogg", attr);
#endif
#ifdef HAVE_IBXM
string_list_append(str_list, "mod", attr);
string_list_append(str_list, "s3m", attr);
string_list_append(str_list, "xm", attr);
#endif
string_list_append(str_list, "wav", attr);
for (i = 0; i < str_list->size; i++)
{
const char *str_ext = str_list->elems[i].data;
if (string_is_equal_noncase(str_ext, ext))
{
ret = true;
break;
}
}
string_list_free(str_list);
return ret;
}
static int audio_mixer_find_index(audio_mixer_sound_t *sound)
{
unsigned i;
for (i = 0; i < AUDIO_MIXER_MAX_STREAMS; i++)
{
audio_mixer_sound_t *handle = audio_mixer_streams[i].handle;
if (handle == sound)
return i;
}
return -1;
}
static void audio_mixer_play_stop_cb(
audio_mixer_sound_t *sound, unsigned reason)
{
int idx = audio_mixer_find_index(sound);
switch (reason)
{
case AUDIO_MIXER_SOUND_FINISHED:
audio_mixer_destroy(sound);
if (idx >= 0)
{
unsigned i = (unsigned)idx;
#if 0
if (audio_mixer_streams[i].buf != NULL)
free(audio_mixer_streams[i].buf);
#endif
audio_mixer_streams[i].state = AUDIO_STREAM_STATE_NONE;
audio_mixer_streams[i].volume = 0.0f;
audio_mixer_streams[i].buf = NULL;
audio_mixer_streams[i].stop_cb = NULL;
audio_mixer_streams[i].handle = NULL;
audio_mixer_streams[i].voice = NULL;
audio_mixer_current_max_idx--;
}
break;
case AUDIO_MIXER_SOUND_STOPPED:
break;
case AUDIO_MIXER_SOUND_REPEATED:
break;
}
}
bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params)
{
audio_mixer_voice_t *voice = NULL;
audio_mixer_sound_t *handle = NULL;
audio_mixer_stop_cb_t stop_cb = audio_mixer_play_stop_cb;
bool looped = false;
void *buf = NULL;
if (audio_mixer_current_max_idx >= AUDIO_MIXER_MAX_STREAMS)
return false;
if (params->state == AUDIO_STREAM_STATE_NONE)
return false;
buf = malloc(params->bufsize);
if (!buf)
return false;
memcpy(buf, params->buf, params->bufsize);
switch (params->type)
{
case AUDIO_MIXER_TYPE_WAV:
handle = audio_mixer_load_wav(buf, (int32_t)params->bufsize);
break;
case AUDIO_MIXER_TYPE_OGG:
handle = audio_mixer_load_ogg(buf, (int32_t)params->bufsize);
break;
case AUDIO_MIXER_TYPE_MOD:
handle = audio_mixer_load_mod(buf, (int32_t)params->bufsize);
break;
case AUDIO_MIXER_TYPE_NONE:
free(buf);
return false;
}
if (!handle)
{
free(buf);
return false;
}
if (params->state == AUDIO_STREAM_STATE_PLAYING)
{
voice = audio_mixer_play(handle, looped, params->volume, stop_cb);
audio_set_bool(AUDIO_ACTION_MIXER, true);
}
else if (params->state == AUDIO_STREAM_STATE_PLAYING_LOOPED)
{
looped = true;
voice = audio_mixer_play(handle, looped, params->volume, stop_cb);
audio_set_bool(AUDIO_ACTION_MIXER, true);
}
audio_mixer_streams[audio_mixer_current_max_idx].buf = buf;
audio_mixer_streams[audio_mixer_current_max_idx].handle = handle;
audio_mixer_streams[audio_mixer_current_max_idx].voice = voice;
audio_mixer_streams[audio_mixer_current_max_idx].state = params->state;
audio_mixer_streams[audio_mixer_current_max_idx].volume = params->volume;
audio_mixer_streams[audio_mixer_current_max_idx].stop_cb = stop_cb;
audio_mixer_current_max_idx++;
return true;
}
static void audio_driver_mixer_remove_stream(unsigned i)
{
audio_mixer_sound_t *handle = audio_mixer_streams[i].handle;
audio_mixer_voice_t *voice = audio_mixer_streams[i].voice;
switch (audio_mixer_streams[i].state)
{
case AUDIO_STREAM_STATE_PLAYING:
if (voice)
audio_mixer_stop(voice);
if (handle)
audio_mixer_destroy(handle);
break;
case AUDIO_STREAM_STATE_PLAYING_LOOPED:
if (voice)
audio_mixer_stop(voice);
if (handle)
audio_mixer_destroy(handle);
break;
case AUDIO_STREAM_STATE_STOPPED:
if (handle)
audio_mixer_destroy(handle);
break;
case AUDIO_STREAM_STATE_NONE:
break;
}
audio_mixer_streams[i].state = AUDIO_STREAM_STATE_NONE;
audio_mixer_streams[i].volume = 0.0f;
audio_mixer_streams[i].stop_cb = NULL;
audio_mixer_streams[i].handle = NULL;
audio_mixer_streams[i].voice = NULL;
}
static void audio_driver_mixer_deinit(void)
{
unsigned i;
audio_set_bool(AUDIO_ACTION_MIXER, false);
for (i = 0; i < AUDIO_MIXER_MAX_STREAMS; i++)
audio_driver_mixer_remove_stream(i);
audio_mixer_current_max_idx = 0;
audio_mixer_done();
}
bool audio_driver_deinit(void)
{
audio_driver_mixer_deinit();
audio_driver_free_devices_list();
if (!audio_driver_deinit_internal())
return false;
@ -927,7 +1152,7 @@ bool audio_driver_disable_callback(void)
void audio_driver_monitor_set_rate(void)
{
settings_t *settings = config_get_ptr();
double new_src_ratio = (double)settings->audio.out_rate /
double new_src_ratio = (double)settings->uints.audio_out_rate /
audio_driver_input;
audio_source_ratio_original = new_src_ratio;
@ -947,42 +1172,57 @@ bool audio_driver_callback(void)
bool audio_driver_has_callback(void)
{
return audio_callback.callback;
if (audio_callback.callback)
return true;
return false;
}
bool audio_driver_toggle_mute(void)
{
settings_t *settings = config_get_ptr();
if (!audio_driver_context_audio_data)
return false;
if (!audio_driver_active)
return false;
settings->audio.mute_enable = !settings->audio.mute_enable;
if (settings->audio.mute_enable)
command_event(CMD_EVENT_AUDIO_STOP, NULL);
else if (!command_event(CMD_EVENT_AUDIO_START, NULL))
{
audio_driver_active = false;
return false;
}
audio_driver_mute_enable = !audio_driver_mute_enable;
return true;
}
bool audio_driver_mixer_toggle_mute(void)
{
audio_driver_mixer_mute_enable = !audio_driver_mixer_mute_enable;
return true;
}
static INLINE bool audio_driver_alive(void)
{
if ( current_audio
&& current_audio->alive
&& audio_driver_context_audio_data)
return current_audio->alive(audio_driver_context_audio_data);
return false;
}
bool audio_driver_start(bool is_shutdown)
{
if (!current_audio || !current_audio->start
|| !audio_driver_context_audio_data)
return false;
return current_audio->start(audio_driver_context_audio_data, is_shutdown);
goto error;
if (!current_audio->start(audio_driver_context_audio_data, is_shutdown))
goto error;
return true;
error:
RARCH_ERR("%s\n",
msg_hash_to_str(MSG_FAILED_TO_START_AUDIO_DRIVER));
audio_driver_active = false;
return false;
}
bool audio_driver_stop(void)
{
if (!current_audio || !current_audio->stop
|| !audio_driver_context_audio_data)
return false;
if (!audio_driver_alive())
return false;
return current_audio->stop(audio_driver_context_audio_data);
}
@ -992,15 +1232,6 @@ void audio_driver_unset_callback(void)
audio_callback.set_state = NULL;
}
bool audio_driver_alive(void)
{
if ( current_audio
&& current_audio->alive
&& audio_driver_context_audio_data)
return current_audio->alive(audio_driver_context_audio_data);
return false;
}
void audio_driver_frame_is_reverse(void)
{
/* We just rewound. Flush rewind audio buffer. */
@ -1034,14 +1265,81 @@ void audio_driver_set_active(void)
audio_driver_active = true;
}
void audio_driver_unset_active(void)
{
audio_driver_active = false;
}
void audio_driver_destroy(void)
{
audio_driver_active = false;
audio_driver_data_own = false;
current_audio = NULL;
}
void audio_set_bool(enum audio_action action, bool val)
{
switch (action)
{
case AUDIO_ACTION_MIXER:
audio_mixer_active = val;
break;
case AUDIO_ACTION_NONE:
default:
break;
}
}
/**
* db_to_gain:
* @db : Decibels.
*
* Converts decibels to voltage gain.
*
* Returns: voltage gain value.
**/
#define db_to_gain(db) (powf(10.0f, (db) / 20.0f))
void audio_set_float(enum audio_action action, float val)
{
switch (action)
{
case AUDIO_ACTION_VOLUME_GAIN:
audio_driver_volume_gain = db_to_gain(val);
break;
case AUDIO_ACTION_MIXER_VOLUME_GAIN:
audio_driver_mixer_volume_gain = db_to_gain(val);
break;
case AUDIO_ACTION_RATE_CONTROL_DELTA:
audio_driver_rate_control_delta = val;
break;
case AUDIO_ACTION_NONE:
default:
break;
}
}
float *audio_get_float_ptr(enum audio_action action)
{
switch (action)
{
case AUDIO_ACTION_RATE_CONTROL_DELTA:
return &audio_driver_rate_control_delta;
case AUDIO_ACTION_NONE:
default:
break;
}
return NULL;
}
bool *audio_get_bool_ptr(enum audio_action action)
{
switch (action)
{
case AUDIO_ACTION_MIXER_MUTE_ENABLE:
return &audio_driver_mixer_mute_enable;
case AUDIO_ACTION_MUTE_ENABLE:
return &audio_driver_mute_enable;
case AUDIO_ACTION_NONE:
default:
break;
}
return NULL;
}

View File

@ -22,6 +22,7 @@
#include <sys/types.h>
#include <boolean.h>
#include <audio/audio_mixer.h>
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
@ -33,6 +34,17 @@ RETRO_BEGIN_DECLS
#define AUDIO_MAX_RATIO 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
};
typedef struct audio_driver
{
/* Creates and initializes handle to audio driver.
@ -67,8 +79,7 @@ typedef struct audio_driver
* Unless said otherwise with set_nonblock_state(), all writes
* are blocking, and it should block till it has written all frames.
*/
ssize_t (*write)(void *data, const void *buf, size_t size,
bool is_perfcnt_enable);
ssize_t (*write)(void *data, const void *buf, size_t size);
/* Temporarily pauses the audio driver. */
bool (*stop)(void *data);
@ -116,6 +127,24 @@ typedef struct audio_driver
size_t (*buffer_size)(void *data);
} audio_driver_t;
enum audio_mixer_state
{
AUDIO_STREAM_STATE_NONE = 0,
AUDIO_STREAM_STATE_STOPPED,
AUDIO_STREAM_STATE_PLAYING,
AUDIO_STREAM_STATE_PLAYING_LOOPED
};
typedef struct audio_mixer_stream_params
{
float volume;
enum audio_mixer_type type;
enum audio_mixer_state state;
void *buf;
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);
@ -124,8 +153,6 @@ void audio_driver_unset_own_driver(void);
void audio_driver_set_active(void);
void audio_driver_unset_active(void);
void audio_driver_destroy(void);
void audio_driver_deinit_resampler(void);
@ -175,7 +202,7 @@ void audio_driver_sample_rewind(int16_t left, int16_t right);
size_t audio_driver_sample_batch_rewind(const int16_t *data, size_t frames);
void audio_driver_set_volume_gain(float gain);
bool audio_driver_mixer_extension_supported(const char *ext);
void audio_driver_dsp_filter_free(void);
@ -212,16 +239,27 @@ void audio_driver_unset_callback(void);
void audio_driver_frame_is_reverse(void);
bool audio_driver_alive(void);
void audio_set_float(enum audio_action action, float val);
void audio_set_bool(enum audio_action action, bool val);
void audio_unset_bool(enum audio_action action, bool val);
float *audio_get_float_ptr(enum audio_action action);
bool *audio_get_bool_ptr(enum audio_action action);
bool audio_driver_deinit(void);
bool audio_driver_init(void);
bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params);
extern audio_driver_t audio_rsound;
extern audio_driver_t audio_oss;
extern audio_driver_t audio_alsa;
extern audio_driver_t audio_alsathread;
extern audio_driver_t audio_tinyalsa;
extern audio_driver_t audio_roar;
extern audio_driver_t audio_openal;
extern audio_driver_t audio_opensl;
@ -230,6 +268,7 @@ extern audio_driver_t audio_sdl;
extern audio_driver_t audio_xa;
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_xenon360;
extern audio_driver_t audio_ps3;

View File

@ -228,8 +228,7 @@ static bool audio_thread_use_float(void *data)
return thr->use_float;
}
static ssize_t audio_thread_write(void *data, const void *buf, size_t size,
bool is_perfcnt_enable)
static ssize_t audio_thread_write(void *data, const void *buf, size_t size)
{
ssize_t ret;
audio_thread_t *thr = (audio_thread_t*)data;
@ -237,8 +236,7 @@ static ssize_t audio_thread_write(void *data, const void *buf, size_t size,
if (!thr)
return 0;
ret = thr->driver->write(thr->driver_data, buf, size,
is_perfcnt_enable);
ret = thr->driver->write(thr->driver_data, buf, size);
if (ret < 0)
{

View File

@ -29,6 +29,7 @@ typedef struct alsa
snd_pcm_t *pcm;
size_t buffer_size;
bool nonblock;
unsigned int frame_bits;
bool has_float;
bool can_pause;
bool is_paused;
@ -92,6 +93,9 @@ static void *alsa_init(const char *device, unsigned rate, unsigned latency,
alsa->pcm, params, SND_PCM_ACCESS_RW_INTERLEAVED) < 0)
goto error;
/* channels hardcoded to 2 for now */
alsa->frame_bits = snd_pcm_format_physical_width(format) * 2;
if (snd_pcm_hw_params_set_format(alsa->pcm, params, format) < 0)
goto error;
@ -173,74 +177,82 @@ error:
return NULL;
}
static ssize_t alsa_write(void *data, const void *buf_, size_t size_,
bool is_perfcnt_enable)
#define BYTES_TO_FRAMES(bytes, frame_bits) ((bytes) * 8 / frame_bits)
#define FRAMES_TO_BYTES(frames, frame_bits) ((frames) * frame_bits / 8)
static ssize_t alsa_write(void *data, const void *buf_, size_t size_)
{
alsa_t *alsa = (alsa_t*)data;
const uint8_t *buf = (const uint8_t*)buf_;
bool eagain_retry = true;
snd_pcm_sframes_t written = 0;
snd_pcm_sframes_t size = snd_pcm_bytes_to_frames(alsa->pcm, size_);
snd_pcm_sframes_t size = BYTES_TO_FRAMES(size_, alsa->frame_bits);
size_t frames_size = alsa->has_float ? sizeof(float) : sizeof(int16_t);
while (size)
if (alsa->nonblock)
{
snd_pcm_sframes_t frames;
if (!alsa->nonblock)
while (size)
{
snd_pcm_sframes_t frames = snd_pcm_writei(alsa->pcm, buf, size);
if (frames == -EPIPE || frames == -EINTR || frames == -ESTRPIPE)
{
if (snd_pcm_recover(alsa->pcm, frames, 1) < 0)
return -1;
break;
}
else if (frames == -EAGAIN)
break;
else if (frames < 0)
return -1;
written += frames;
buf += (frames << 1) * frames_size;
size -= frames;
}
}
else
{
bool eagain_retry = true;
while (size)
{
snd_pcm_sframes_t frames;
int rc = snd_pcm_wait(alsa->pcm, -1);
if (rc == -EPIPE || rc == -ESTRPIPE || rc == -EINTR)
{
if (snd_pcm_recover(alsa->pcm, rc, 1) < 0)
{
RARCH_ERR("[ALSA]: (#1) Failed to recover from error (%s)\n",
snd_strerror(rc));
return -1;
continue;
}
frames = snd_pcm_writei(alsa->pcm, buf, size);
if (frames == -EPIPE || frames == -EINTR || frames == -ESTRPIPE)
{
if (snd_pcm_recover(alsa->pcm, frames, 1) < 0)
return -1;
break;
}
else if (frames == -EAGAIN)
{
/* Definitely not supposed to happen. */
if (eagain_retry)
{
eagain_retry = false;
continue;
}
continue;
break;
}
}
frames = snd_pcm_writei(alsa->pcm, buf, size);
if (frames == -EPIPE || frames == -EINTR || frames == -ESTRPIPE)
{
if (snd_pcm_recover(alsa->pcm, frames, 1) < 0)
{
RARCH_ERR("[ALSA]: (#2) Failed to recover from error (%s)\n",
snd_strerror(frames));
else if (frames < 0)
return -1;
}
break;
written += frames;
buf += (frames << 1) * frames_size;
size -= frames;
}
else if (frames == -EAGAIN && !alsa->nonblock)
{
/* Definitely not supposed to happen. */
RARCH_WARN("[ALSA]: poll() was signaled, but EAGAIN returned from write.\n"
"Your ALSA driver might be subtly broken.\n");
if (eagain_retry)
{
eagain_retry = false;
continue;
}
return written;
}
else if (frames == -EAGAIN) /* Expected if we're running nonblock. */
return written;
else if (frames < 0)
{
RARCH_ERR("[ALSA]: Unknown error occurred (%s).\n",
snd_strerror(frames));
return -1;
}
written += frames;
buf += (frames << 1) *
(alsa->has_float ? sizeof(float) : sizeof(int16_t));
size -= frames;
}
return written;
@ -318,19 +330,13 @@ static void alsa_free(void *data)
static size_t alsa_write_avail(void *data)
{
alsa_t *alsa = (alsa_t*)data;
alsa_t *alsa = (alsa_t*)data;
snd_pcm_sframes_t avail = snd_pcm_avail(alsa->pcm);
if (avail < 0)
{
#if 0
RARCH_WARN("[ALSA]: snd_pcm_avail() failed: %s\n",
snd_strerror(avail));
#endif
return alsa->buffer_size;
}
return snd_pcm_frames_to_bytes(alsa->pcm, avail);
return FRAMES_TO_BYTES(avail, alsa->frame_bits);
}
static size_t alsa_buffer_size(void *data)
@ -364,7 +370,7 @@ static void *alsa_device_list_new(void *data)
/* description of device IOID - input / output identifcation
* ("Input" or "Output"), NULL means both) */
if (!io || string_is_equal(io,"Output"))
if (!io || (string_is_equal_fast(io, "Output", 6)))
string_list_append(s, name, attr);
if (name)

View File

@ -17,6 +17,7 @@
#define ALSA_PCM_NEW_HW_PARAMS_API
#define ALSA_PCM_NEW_SW_PARAMS_API
#include <sys/asoundlib.h>
#include <retro_math.h>
#include "../audio_driver.h"
@ -219,8 +220,7 @@ static int check_pcm_status(void *data, int channel_type)
}
static ssize_t alsa_qsa_write(void *data, const void *buf, size_t size,
bool is_perfcnt_enable)
static ssize_t alsa_qsa_write(void *data, const void *buf, size_t size)
{
alsa_t *alsa = (alsa_t*)data;
snd_pcm_sframes_t written = 0;

View File

@ -243,8 +243,7 @@ error:
return NULL;
}
static ssize_t alsa_thread_write(void *data, const void *buf, size_t size,
bool is_perfcnt_enable)
static ssize_t alsa_thread_write(void *data, const void *buf, size_t size)
{
alsa_thread_t *alsa = (alsa_thread_t*)data;
@ -371,7 +370,7 @@ static void *alsa_device_list_new(void *data)
/* description of device IOID - input / output identifcation
* ("Input" or "Output"), NULL means both) */
if (!io || string_is_equal(io,"Output"))
if (!io || (string_is_equal_fast(io,"Output", 6)))
string_list_append(s, name, attr);
if (name)

View File

@ -94,13 +94,11 @@ static OSStatus audio_write_cb(void *userdata,
(void)bus_number;
(void)number_frames;
if (!io_data)
return noErr;
if (io_data->mNumberBuffers != 1)
if (!io_data || io_data->mNumberBuffers != 1)
return noErr;
write_avail = io_data->mBuffers[0].mDataByteSize;
outbuf = io_data->mBuffers[0].mData;
outbuf = io_data->mBuffers[0].mData;
slock_lock(dev->lock);
@ -261,7 +259,7 @@ static void *coreaudio_init(const char *device,
choose_output_device(dev, device);
#endif
dev->dev_alive = true;
dev->dev_alive = true;
/* Set audio format */
stream_desc.mSampleRate = rate;
@ -317,11 +315,11 @@ static void *coreaudio_init(const char *device,
if (AudioUnitInitialize(dev->dev) != noErr)
goto error;
fifo_size = (latency * (*new_rate)) / 1000;
fifo_size *= 2 * sizeof(float);
dev->buffer_size = fifo_size;
fifo_size = (latency * (*new_rate)) / 1000;
fifo_size *= 2 * sizeof(float);
dev->buffer_size = fifo_size;
dev->buffer = fifo_new(fifo_size);
dev->buffer = fifo_new(fifo_size);
if (!dev->buffer)
goto error;
@ -339,8 +337,7 @@ error:
return NULL;
}
static ssize_t coreaudio_write(void *data, const void *buf_, size_t size,
bool is_perfcnt_enable)
static ssize_t coreaudio_write(void *data, const void *buf_, size_t size)
{
coreaudio_t *dev = (coreaudio_t*)data;
const uint8_t *buf = (const uint8_t*)buf_;

View File

@ -17,11 +17,10 @@
#include <string.h>
#include <malloc.h>
#include <retro_miscellaneous.h>
#include <retro_timers.h>
#include "../audio_driver.h"
#include "../../performance_counters.h"
typedef struct
{
bool nonblocking;
@ -163,13 +162,11 @@ static void ctr_csnd_audio_free(void *data)
free(ctr);
}
static ssize_t ctr_csnd_audio_write(void *data, const void *buf, size_t size,
bool is_perfcnt_enable)
static ssize_t ctr_csnd_audio_write(void *data, const void *buf, size_t size)
{
int i;
uint32_t samples_played = 0;
uint64_t current_tick = 0;
static struct retro_perf_counter ctraudio_f = {0};
const uint16_t *src = buf;
ctr_csnd_audio_t *ctr = (ctr_csnd_audio_t*)data;
@ -178,9 +175,6 @@ static ssize_t ctr_csnd_audio_write(void *data, const void *buf, size_t size,
(void)samples_played;
(void)current_tick;
performance_counter_init(ctraudio_f, "ctraudio_f");
performance_counter_start_plus(is_perfcnt_enable, ctraudio_f);
ctr_csnd_audio_update_playpos(ctr);
if((((ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 2)) ||
@ -211,8 +205,6 @@ static ssize_t ctr_csnd_audio_write(void *data, const void *buf, size_t size,
GSPGPU_FlushDataCache(ctr->l, CTR_CSND_AUDIO_SIZE);
GSPGPU_FlushDataCache(ctr->r, CTR_CSND_AUDIO_SIZE);
performance_counter_stop_plus(is_perfcnt_enable, ctraudio_f);
return size;
}

View File

@ -18,7 +18,6 @@
#include <malloc.h>
#include "../audio_driver.h"
#include "../../performance_counters.h"
#include "../../ctr/ctr_debug.h"
typedef struct
@ -93,11 +92,9 @@ static void ctr_dsp_audio_free(void *data)
ndspExit();
}
static ssize_t ctr_dsp_audio_write(void *data, const void *buf, size_t size,
bool is_perfcnt_enable)
static ssize_t ctr_dsp_audio_write(void *data, const void *buf, size_t size)
{
u32 pos;
static struct retro_perf_counter ctraudio_dsp_f = {0};
ctr_dsp_audio_t * ctr = (ctr_dsp_audio_t*)data;
uint32_t sample_pos = ndspChnGetSamplePos(ctr->channel);
@ -117,9 +114,6 @@ static ssize_t ctr_dsp_audio_write(void *data, const void *buf, size_t size,
}
}
performance_counter_init(ctraudio_dsp_f, "ctraudio_dsp_f");
performance_counter_start_plus(is_perfcnt_enable, ctraudio_dsp_f);
pos = ctr->pos << 2;
if((pos + size) > CTR_DSP_AUDIO_SIZE)
@ -141,8 +135,6 @@ static ssize_t ctr_dsp_audio_write(void *data, const void *buf, size_t size,
ctr->pos += size >> 2;
ctr->pos &= CTR_DSP_AUDIO_COUNT_MASK;
performance_counter_stop_plus(is_perfcnt_enable, ctraudio_dsp_f);
return size;
}

View File

@ -31,6 +31,7 @@
#include <retro_inline.h>
#include <retro_miscellaneous.h>
#include <retro_timers.h>
#include <rthreads/rthreads.h>
#include <queues/fifo_queue.h>
@ -321,7 +322,11 @@ static void *dsound_init(const char *device, unsigned rate, unsigned latency,
RARCH_LOG("DirectSound devices:\n");
#ifndef _XBOX
DirectSoundEnumerate(enumerate_cb, &dev);
#ifdef UNICODE
DirectSoundEnumerate((LPDSENUMCALLBACKW)enumerate_cb, &dev);
#else
DirectSoundEnumerate((LPDSENUMCALLBACKA)enumerate_cb, &dev);
#endif
#endif
if (DirectSoundCreate(dev.guid, &ds->ds, NULL) != DS_OK)
@ -426,8 +431,7 @@ static void dsound_set_nonblock_state(void *data, bool state)
ds->nonblock = state;
}
static ssize_t dsound_write(void *data, const void *buf_, size_t size,
bool is_perfcnt_enable)
static ssize_t dsound_write(void *data, const void *buf_, size_t size)
{
size_t written = 0;
dsound_t *ds = (dsound_t*)data;

View File

@ -116,8 +116,7 @@ static INLINE void copy_swapped(uint32_t * restrict dst,
}while(--size);
}
static ssize_t gx_audio_write(void *data, const void *buf_, size_t size,
bool is_perfcnt_enable)
static ssize_t gx_audio_write(void *data, const void *buf_, size_t size)
{
size_t frames = size >> 2;
const uint32_t *buf = buf_;

View File

@ -13,18 +13,16 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <jack/jack.h>
#include <jack/types.h>
#include <jack/ringbuffer.h>
#include <boolean.h>
#include <retro_assert.h>
#include <rthreads/rthreads.h>
#include "../audio_driver.h"
@ -75,7 +73,6 @@ static int process_cb(jack_nframes_t nframes, void *data)
jack_nframes_t f;
jack_default_audio_sample_t *out = (jack_default_audio_sample_t*)jack_port_get_buffer(jd->ports[i], nframes);
retro_assert(out);
jack_ringbuffer_read(jd->buffer[i], (char*)out, min_avail * sizeof(jack_default_audio_sample_t));
for (f = min_avail; f < nframes; f++)
@ -106,7 +103,7 @@ static int parse_ports(char **dest_ports, const char **jports)
char *save = NULL;
int parsed = 0;
settings_t *settings = config_get_ptr();
char *audio_device_cpy = strdup(settings->audio.device);
char *audio_device_cpy = strdup(settings->arrays.audio_device);
const char *con = strtok_r(audio_device_cpy, ",", &save);
if (con)
@ -292,8 +289,7 @@ static size_t write_buffer(jack_t *jd, const float *buf, size_t size)
return written * sizeof(float) * 2;
}
static ssize_t ja_write(void *data, const void *buf, size_t size,
bool is_perfcnt_enable)
static ssize_t ja_write(void *data, const void *buf, size_t size)
{
jack_t *jd = (jack_t*)data;

View File

@ -35,8 +35,7 @@ static void null_audio_free(void *data)
(void)data;
}
static ssize_t null_audio_write(void *data, const void *buf, size_t size,
bool is_perfcnt_enable)
static ssize_t null_audio_write(void *data, const void *buf, size_t size)
{
(void)data;
(void)buf;

View File

@ -31,6 +31,7 @@
#endif
#include <retro_miscellaneous.h>
#include <retro_timers.h>
#include "../audio_driver.h"
#include "../../verbosity.h"
@ -173,8 +174,7 @@ static size_t al_fill_internal_buf(al_t *al, const void *buf, size_t size)
return read_size;
}
static ssize_t al_write(void *data, const void *buf_, size_t size,
bool is_perfcnt_enable)
static ssize_t al_write(void *data, const void *buf_, size_t size)
{
al_t *al = (al_t*)data;
const uint8_t *buf = (const uint8_t*)buf_;

View File

@ -230,8 +230,7 @@ static bool sl_start(void *data, bool is_shutdown)
}
static ssize_t sl_write(void *data, const void *buf_, size_t size,
bool is_perfcnt_enable)
static ssize_t sl_write(void *data, const void *buf_, size_t size)
{
sl_t *sl = (sl_t*)data;
size_t written = 0;

View File

@ -97,8 +97,7 @@ error:
return NULL;
}
static ssize_t oss_write(void *data, const void *buf, size_t size,
bool is_perfcnt_enable)
static ssize_t oss_write(void *data, const void *buf, size_t size)
{
ssize_t ret;
int *fd = (int*)data;
@ -121,7 +120,9 @@ static bool oss_stop(void *data)
{
int *fd = (int*)data;
ioctl(*fd, SNDCTL_DSP_RESET, 0);
if (ioctl(*fd, SNDCTL_DSP_RESET, 0) < 0)
return false;
oss_is_paused = true;
return true;
}
@ -156,7 +157,9 @@ static void oss_free(void *data)
{
int *fd = (int*)data;
ioctl(*fd, SNDCTL_DSP_RESET, 0);
if (ioctl(*fd, SNDCTL_DSP_RESET, 0) < 0)
return;
close(*fd);
free(fd);
}

View File

@ -146,8 +146,7 @@ static void *ps3_audio_init(const char *device,
return data;
}
static ssize_t ps3_audio_write(void *data, const void *buf, size_t size,
bool is_perfcnt_enable)
static ssize_t ps3_audio_write(void *data, const void *buf, size_t size)
{
ps3_audio_t *aud = data;

View File

@ -184,14 +184,12 @@ static void psp_audio_free(void *data)
free(psp);
}
static ssize_t psp_audio_write(void *data, const void *buf, size_t size,
bool is_perfcnt_enable)
static ssize_t psp_audio_write(void *data, const void *buf, size_t size)
{
psp_audio_t* psp = (psp_audio_t*)data;
uint16_t write_pos = psp->write_pos;
uint16_t sampleCount = size / sizeof(uint32_t);
#ifdef VITA
if (psp->nonblocking)
{
if (AUDIO_BUFFER_SIZE - ((uint16_t)
@ -199,12 +197,13 @@ static ssize_t psp_audio_write(void *data, const void *buf, size_t size,
return 0;
}
#ifdef VITA
while (AUDIO_BUFFER_SIZE - ((uint16_t)
(psp->write_pos - psp->read_pos) & AUDIO_BUFFER_SIZE_MASK) < size){
(psp->write_pos - psp->read_pos) & AUDIO_BUFFER_SIZE_MASK) < size)
sceKernelWaitLwCond((struct SceKernelLwCondWork*)&psp->cond, 0);
}
sceKernelLockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1, 0);
#endif
if((write_pos + sampleCount) > AUDIO_BUFFER_SIZE)
{
@ -220,36 +219,13 @@ static ssize_t psp_audio_write(void *data, const void *buf, size_t size,
write_pos += sampleCount;
write_pos &= AUDIO_BUFFER_SIZE_MASK;
psp->write_pos = write_pos;
#ifdef VITA
sceKernelUnlockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1);
return size;
#else
#if 0
if (psp->nonblocking)
{
/* TODO */
}
#endif
if((write_pos + sampleCount) > AUDIO_BUFFER_SIZE)
{
memcpy(psp->buffer + write_pos, buf,
(AUDIO_BUFFER_SIZE - write_pos) * sizeof(uint32_t));
memcpy(psp->buffer, (uint32_t*) buf +
(AUDIO_BUFFER_SIZE - write_pos),
(write_pos + sampleCount - AUDIO_BUFFER_SIZE) * sizeof(uint32_t));
}
else
memcpy(psp->buffer + write_pos, buf, size);
write_pos += sampleCount;
write_pos &= AUDIO_BUFFER_SIZE_MASK;
psp->write_pos = write_pos;
return sampleCount;
return sampleCount;
#endif
}
@ -268,6 +244,9 @@ static bool psp_audio_stop(void *data)
SceUInt timeout = 100000;
psp_audio_t* psp = (psp_audio_t*)data;
if(psp && !psp->running)
return true;
info.size = sizeof(SceKernelThreadInfo);
if (sceKernelGetThreadInfo(
@ -290,6 +269,9 @@ static bool psp_audio_start(void *data, bool is_shutdown)
{
SceKernelThreadInfo info;
psp_audio_t* psp = (psp_audio_t*)data;
if(psp && psp->running)
return true;
info.size = sizeof(SceKernelThreadInfo);
@ -322,20 +304,21 @@ static bool psp_audio_use_float(void *data)
static size_t psp_write_avail(void *data)
{
psp_audio_t* psp = (psp_audio_t*)data;
#ifdef VITA
size_t val;
psp_audio_t* psp = (psp_audio_t*)data;
#ifdef VITA
sceKernelLockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1, 0);
#endif
val = AUDIO_BUFFER_SIZE - ((uint16_t)
(psp->write_pos - psp->read_pos) & AUDIO_BUFFER_SIZE_MASK);
#ifdef VITA
sceKernelUnlockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1);
return val;
#else
/* TODO */
return AUDIO_BUFFER_SIZE - ((uint16_t)
(psp->write_pos - psp->read_pos) & AUDIO_BUFFER_SIZE_MASK);
#endif
return val;
}
static size_t psp_buffer_size(void *data)

View File

@ -236,8 +236,7 @@ error:
return NULL;
}
static ssize_t pulse_write(void *data, const void *buf_, size_t size,
bool is_perfcnt_enable)
static ssize_t pulse_write(void *data, const void *buf_, size_t size)
{
pa_t *pa = (pa_t*)data;
const uint8_t *buf = (const uint8_t*)buf_;

View File

@ -58,8 +58,7 @@ static void *ra_init(const char *device, unsigned rate, unsigned latency,
return roar;
}
static ssize_t ra_write(void *data, const void *buf, size_t size,
bool is_perfcnt_enable)
static ssize_t ra_write(void *data, const void *buf, size_t size)
{
int err;
size_t written = 0;

View File

@ -102,8 +102,7 @@ error:
return NULL;
}
static ssize_t rs_write(void *data, const void *buf, size_t size,
bool is_perfcnt_enable)
static ssize_t rs_write(void *data, const void *buf, size_t size)
{
rsd_t *rsd = (rsd_t*)data;

View File

@ -51,8 +51,7 @@ static void *rwebaudio_init(const char *device, unsigned rate, unsigned latency,
return data;
}
static ssize_t rwebaudio_write(void *data, const void *buf, size_t size,
bool is_perfcnt_enable)
static ssize_t rwebaudio_write(void *data, const void *buf, size_t size)
{
(void)data;
return RWebAudioWrite(buf, size);

View File

@ -26,6 +26,7 @@
#include <rthreads/rthreads.h>
#include <queues/fifo_queue.h>
#include <retro_inline.h>
#include <retro_math.h>
#include "../audio_driver.h"
#include "../../verbosity.h"
@ -140,10 +141,9 @@ error:
return NULL;
}
static ssize_t sdl_audio_write(void *data, const void *buf, size_t size,
bool is_perfcnt_enable)
static ssize_t sdl_audio_write(void *data, const void *buf, size_t size)
{
ssize_t ret = 0;
ssize_t ret = 0;
sdl_audio_t *sdl = (sdl_audio_t*)data;
if (sdl->nonblock)

2435
audio/drivers/tinyalsa.c Normal file

File diff suppressed because it is too large Load Diff

1075
audio/drivers/wasapi.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,6 @@
#include "wiiu/system/memory.h"
#include "audio/audio_driver.h"
#include "performance_counters.h"
typedef struct
{
@ -192,23 +191,17 @@ static bool ax_audio_start(void* data, bool is_shutdown)
return true;
}
static ssize_t ax_audio_write(void* data, const void* buf, size_t size,
bool is_perfcnt_enable)
static ssize_t ax_audio_write(void* data, const void* buf, size_t size)
{
int i;
static struct retro_perf_counter ax_audio_write_perf = {0};
uint32_t i;
size_t countAvail = 0;
ax_audio_t* ax = (ax_audio_t*)data;
const uint16_t* src = buf;
int count = size >> 2;
size_t count = size >> 2;
if(!size || (size & 0x3))
return 0;
/* Measure copy performance from here */
performance_counter_init(ax_audio_write_perf, "ax_audio_write");
performance_counter_start_plus(is_perfcnt_enable, ax_audio_write_perf);
if(count > AX_AUDIO_MAX_FREE)
count = AX_AUDIO_MAX_FREE;
@ -286,9 +279,6 @@ static ssize_t ax_audio_write(void* data, const void* buf, size_t size,
if(!AXIsMultiVoiceRunning(ax->mvoice))
ax_audio_start(ax, false);
/* Done copying new data */
performance_counter_stop_plus(is_perfcnt_enable, ax_audio_write_perf);
/* return what was actually copied */
return (count << 2);
}
@ -340,8 +330,8 @@ audio_driver_t audio_ax =
ax_audio_free,
ax_audio_use_float,
"AX",
NULL,
NULL,
/* ax_audio_write_avail, */
/* ax_audio_buffer_size */
NULL, /* device_list_new */
NULL, /* device_list_free */
NULL, /* write_avail */
NULL, /* buffer_size */
};

View File

@ -53,8 +53,13 @@ typedef struct
size_t bufsize;
} xa_t;
#ifdef __cplusplus
struct xaudio2 : public IXAudio2VoiceCallback
#else
struct xaudio2
#endif
{
#ifdef __cplusplus
xaudio2() :
buf(0), pXAudio2(0), pMasterVoice(0),
pSourceVoice(0), hEvent(0), buffers(0), bufsize(0),
@ -74,6 +79,9 @@ struct xaudio2 : public IXAudio2VoiceCallback
STDMETHOD_(void, OnVoiceError) (void *, HRESULT) {}
STDMETHOD_(void, OnVoiceProcessingPassEnd) () {}
STDMETHOD_(void, OnVoiceProcessingPassStart) (UINT32) {}
#else
const IXAudio2VoiceCallbackVtbl *lpVtbl;
#endif
uint8_t *buf;
IXAudio2 *pXAudio2;
@ -87,6 +95,31 @@ struct xaudio2 : public IXAudio2VoiceCallback
unsigned write_buffer;
};
#ifndef __cplusplus
static void WINAPI voice_on_buffer_end(void *handle_, void *data)
{
xaudio2_t *handle = (xaudio2_t*)handle_;
(void)data;
InterlockedDecrement((LONG volatile*)&handle->buffers);
SetEvent(handle->hEvent);
}
static void WINAPI dummy_voidp(void *handle, void *data) { (void)handle; (void)data; }
static void WINAPI dummy_nil(void *handle) { (void)handle; }
static void WINAPI dummy_uint32(void *handle, UINT32 dummy) { (void)handle; (void)dummy; }
static void WINAPI dummy_voidp_hresult(void *handle, void *data, HRESULT dummy) { (void)handle; (void)data; (void)dummy; }
const struct IXAudio2VoiceCallbackVtbl voice_vtable = {
dummy_uint32,
dummy_nil,
dummy_nil,
dummy_voidp,
voice_on_buffer_end,
dummy_voidp,
dummy_voidp_hresult,
};
#endif
#if 0
static void xaudio2_enumerate_devices(xaudio2_t *xa)
{
@ -97,13 +130,13 @@ static void xaudio2_enumerate_devices(xaudio2_t *xa)
(void)i;
(void)dev_count;
#ifndef _XBOX
xa->pXAudio2->GetDeviceCount(&dev_count);
IXAudio2_GetDeviceCount(xa->pXAudio2, &dev_count);
fprintf(stderr, "XAudio2 devices:\n");
for (i = 0; i < dev_count; i++)
{
XAUDIO2_DEVICE_DETAILS dev_detail;
xa->pXAudio2->GetDeviceDetails(i, &dev_detail);
IXAudio2_GetDeviceDetails(xa->pXAudio2, i, &dev_detail);
fwprintf(stderr, L"\t%u: %s\n", i, dev_detail.DisplayName);
}
#endif
@ -130,21 +163,31 @@ static void xaudio2_free(xaudio2_t *handle)
if (handle->pSourceVoice)
{
handle->pSourceVoice->Stop(0, XAUDIO2_COMMIT_NOW);
handle->pSourceVoice->DestroyVoice();
IXAudio2SourceVoice_Stop(handle->pSourceVoice,
0, XAUDIO2_COMMIT_NOW);
IXAudio2SourceVoice_DestroyVoice(handle->pSourceVoice);
}
if (handle->pMasterVoice)
handle->pMasterVoice->DestroyVoice();
{
IXAudio2MasteringVoice_DestroyVoice(handle->pMasterVoice);
}
if (handle->pXAudio2)
handle->pXAudio2->Release();
{
IXAudio2_Release(handle->pXAudio2);
}
if (handle->hEvent)
CloseHandle(handle->hEvent);
free(handle->buf);
#ifdef __cplusplus
delete handle;
#else
free(handle);
#endif
}
#ifndef COINIT_MULTITHREADED
@ -154,27 +197,38 @@ static void xaudio2_free(xaudio2_t *handle)
static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
size_t size, unsigned device)
{
xaudio2_t *handle;
WAVEFORMATEX wfx = {0};
xaudio2_t *handle = NULL;
WAVEFORMATEX wfx = {0};
#ifndef _XBOX
CoInitializeEx(0, COINIT_MULTITHREADED);
#endif
#ifdef __cplusplus
handle = new xaudio2;
#else
handle = (xaudio2_t*)calloc(1, sizeof(*handle));
#endif
if (!handle)
goto error;
#ifndef __cplusplus
handle->lpVtbl = &voice_vtable;
#endif
if (FAILED(XAudio2Create(&handle->pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR)))
goto error;
if (FAILED(handle->pXAudio2->CreateMasteringVoice(&handle->pMasterVoice,
channels, samplerate, 0, device, NULL)))
if (FAILED(IXAudio2_CreateMasteringVoice(handle->pXAudio2, &handle->pMasterVoice, channels, samplerate, 0, device, NULL)))
goto error;
xaudio2_set_wavefmt(&wfx, channels, samplerate);
if (FAILED(handle->pXAudio2->CreateSourceVoice(&handle->pSourceVoice, &wfx,
XAUDIO2_VOICE_NOSRC, XAUDIO2_DEFAULT_FREQ_RATIO,
handle)))
if (FAILED(IXAudio2_CreateSourceVoice(handle->pXAudio2,
&handle->pSourceVoice, &wfx,
XAUDIO2_VOICE_NOSRC, XAUDIO2_DEFAULT_FREQ_RATIO,
(IXAudio2VoiceCallback*)handle, 0, 0)))
goto error;
handle->hEvent = CreateEvent(0, FALSE, FALSE, 0);
@ -186,7 +240,8 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
if (!handle->buf)
goto error;
if (FAILED(handle->pSourceVoice->Start(0)))
if (FAILED(IXAudio2SourceVoice_Start(handle->pSourceVoice, 0,
XAUDIO2_COMMIT_NOW)))
goto error;
return handle;
@ -201,17 +256,17 @@ static size_t xaudio2_write_avail(xaudio2_t *handle)
return handle->bufsize * (MAX_BUFFERS - handle->buffers - 1);
}
static size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_,
bool is_perfcnt_enable)
static size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_)
{
unsigned bytes = bytes_;
unsigned bytes = bytes_;
const uint8_t *buffer = (const uint8_t*)buf;
while (bytes)
{
unsigned need = MIN(bytes, handle->bufsize - handle->bufptr);
memcpy(handle->buf + handle->write_buffer * handle->bufsize + handle->bufptr,
memcpy(handle->buf + handle->write_buffer *
handle->bufsize + handle->bufptr,
buffer, need);
handle->bufptr += need;
@ -220,15 +275,23 @@ static size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_,
if (handle->bufptr == handle->bufsize)
{
XAUDIO2_BUFFER xa2buffer = {0};
XAUDIO2_BUFFER xa2buffer;
while (handle->buffers == MAX_BUFFERS - 1)
WaitForSingleObject(handle->hEvent, INFINITE);
xa2buffer.Flags = 0;
xa2buffer.AudioBytes = handle->bufsize;
xa2buffer.pAudioData = handle->buf + handle->write_buffer * handle->bufsize;
xa2buffer.PlayBegin = 0;
xa2buffer.PlayLength = 0;
xa2buffer.LoopBegin = 0;
xa2buffer.LoopLength = 0;
xa2buffer.LoopCount = 0;
xa2buffer.pContext = NULL;
if (FAILED(handle->pSourceVoice->SubmitSourceBuffer(&xa2buffer, NULL)))
if (FAILED(IXAudio2SourceVoice_SubmitSourceBuffer(
handle->pSourceVoice, &xa2buffer, NULL)))
return 0;
InterlockedIncrement((LONG volatile*)&handle->buffers);
@ -274,8 +337,7 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency,
return xa;
}
static ssize_t xa_write(void *data, const void *buf, size_t size,
bool is_perfcnt_enable)
static ssize_t xa_write(void *data, const void *buf, size_t size)
{
size_t ret;
xa_t *xa = (xa_t*)data;
@ -290,7 +352,7 @@ static ssize_t xa_write(void *data, const void *buf, size_t size,
size = avail;
}
ret = xaudio2_write(xa->xa, buf, size, is_perfcnt_enable);
ret = xaudio2_write(xa->xa, buf, size);
if (ret == 0 && size > 0)
return -1;
return ret;

View File

@ -15,20 +15,29 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
// Kinda stripped down. Only contains the bare essentials used in RetroArch.
/* Kinda stripped down. Only contains the bare essentials used in RetroArch. */
#ifndef XAUDIO2_STRIPPED_H
#define XAUDIO2_STRIPPED_H
#include <retro_inline.h>
#include <retro_environment.h>
// All structures defined in this file use tight field packing
/* All structures defined in this file use tight field packing */
#pragma pack(push, 1)
#ifdef __cplusplus
#define X2DEFAULT(x) = (x)
#else
#define X2DEFAULT(x)
#endif
#ifdef _XBOX
#include <xtl.h>
#ifndef __cplusplus
#define OPAQUE interface
#endif
#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
DEFINE_GUID(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
@ -38,7 +47,7 @@ DEFINE_CLSID(XAudio2, 3eda9b49, 2085, 498b, 9b, b2, 39, a6, 77, 84, 93, de);
DEFINE_CLSID(XAudio2_Debug, 47199894, 7cc2, 444d, 98, 73, ce, d2, 56, 2c, c6, 0e);
DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
#include <audiodefs.h> // Basic audio data types and constants
#include <audiodefs.h> /* Basic audio data types and constants */
#else
@ -48,6 +57,11 @@ DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
#include <objbase.h>
#include <mmreg.h>
#ifndef __cplusplus
#undef OPAQUE
#define OPAQUE struct
#endif
#define DEFINE_GUID_X(n, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
static const GUID n = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#define DEFINE_CLSID_X(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
@ -55,7 +69,13 @@ DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
#define DEFINE_IID_X(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
DEFINE_GUID_X(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
DEFINE_CLSID_X(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af); // 2.7
#ifndef __cplusplus
#ifndef INTERFACE
#define INTERFACE void
#endif
#endif
DEFINE_CLSID_X(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af); /* 2.7 */
DEFINE_IID_X(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
#endif
@ -99,7 +119,11 @@ typedef enum XAUDIO2_XBOX_HWTHREAD_SPECIFIER
#else
typedef enum XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER
{
#if defined(__STDC_C89__)
XAUDIO2_ANY_PROCESSOR = 0xffff,
#else
XAUDIO2_ANY_PROCESSOR = 0xffffffff,
#endif
XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR
} XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER, XAUDIO2_PROCESSOR;
#endif
@ -118,7 +142,8 @@ typedef struct XAUDIO2_DEVICE_DETAILS
WAVEFORMATEXTENSIBLE OutputFormat;
} XAUDIO2_DEVICE_DETAILS;
// Forward declarations.
/* Forward declarations. */
#ifdef __cplusplus
struct XAUDIO2_VOICE_DETAILS;
struct XAUDIO2_VOICE_SENDS;
struct XAUDIO2_EFFECT_DESCRIPTOR;
@ -130,6 +155,20 @@ struct XAUDIO2_PERFORMANCE_DATA;
struct XAUDIO2_DEBUG_CONFIGURATION;
struct IXAudio2EngineCallback;
struct IXAudio2SubmixVoice;
#else
typedef OPAQUE XAUDIO2_VOICE_DETAILS XAUDIO2_VOICE_DETAILS;
typedef OPAQUE XAUDIO2_VOICE_SENDS XAUDIO2_VOICE_SENDS;
typedef OPAQUE XAUDIO2_EFFECT_DESCRIPTOR XAUDIO2_EFFECT_DESCRIPTOR;
typedef OPAQUE XAUDIO2_EFFECT_CHAIN XAUDIO2_EFFECT_CHAIN;
typedef OPAQUE XAUDIO2_FILTER_PARAMETERS XAUDIO2_FILTER_PARAMETERS;
typedef OPAQUE XAUDIO2_BUFFER_WMA XAUDIO2_BUFFER_WMA;
typedef OPAQUE XAUDIO2_VOICE_STATE XAUDIO2_VOICE_STATE;
typedef OPAQUE XAUDIO2_PERFORMANCE_DATA XAUDIO2_PERFORMANCE_DATA;
typedef OPAQUE XAUDIO2_DEBUG_CONFIGURATION XAUDIO2_DEBUG_CONFIGURATION;
typedef OPAQUE IXAudio2EngineCallback IXAudio2EngineCallback;
typedef OPAQUE IXAudio2SubmixVoice IXAudio2SubmixVoice;
#endif
typedef struct XAUDIO2_BUFFER
{
@ -253,31 +292,65 @@ DECLARE_INTERFACE_(IXAudio2, IUnknown)
void *pReserved X2DEFAULT(NULL)) PURE;
};
#ifdef __cplusplus
/* C++ hooks */
#define IXAudio2_Initialize(handle,a,b) handle->Initialize(a, b)
#define IXAudio2SourceVoice_SubmitSourceBuffer(handle, a, b) handle->SubmitSourceBuffer(a, b)
#define IXAudio2SourceVoice_Stop(handle, a, b) handle->Stop(a, b)
#define IXAudio2SourceVoice_DestroyVoice(handle) handle->DestroyVoice()
#define IXAudio2MasteringVoice_DestroyVoice(handle) handle->DestroyVoice()
#define IXAudio2_Release(handle) handle->Release()
#define IXAudio2_CreateSourceVoice(handle, a, b, c, d, e, f, g) handle->CreateSourceVoice(a, b, c, d, e, f, g)
#define IXAudio2_CreateMasteringVoice(handle, a, b, c, d, e, f) handle->CreateMasteringVoice(a, b, c, d, e, f)
#define IXAudio2SourceVoice_Start(handle, a, b) handle->Start(a, b)
#else
/* C hooks */
#define IXAudio2_Initialize(THIS,a,b) (THIS)->lpVtbl->Initialize(THIS, a, b)
#define IXAudio2_Release(THIS) (THIS)->lpVtbl->Release(THIS)
#define IXAudio2_CreateSourceVoice(THIS,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) (THIS)->lpVtbl->CreateSourceVoice(THIS, ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain)
#define IXAudio2_CreateMasteringVoice(THIS,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain) (THIS)->lpVtbl->CreateMasteringVoice(THIS, ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain)
#define IXAudio2_GetDeviceCount(THIS, puCount) (THIS)->lpVtbl->GetDeviceCount(THIS, puCount)
#define IXAudio2_GetDeviceDetails(THIS, Index,pDeviceDetails) (THIS)->lpVtbl->GetDeviceDetails(THIS, Index, pDeviceDetails)
#define IXAudio2SourceVoice_Start(THIS, Flags, OperationSet) (THIS)->lpVtbl->Start(THIS, Flags, OperationSet)
#define IXAudio2SourceVoice_Stop(THIS, Flags, OperationSet) (THIS)->lpVtbl->Stop(THIS, Flags, OperationSet)
#define IXAudio2SourceVoice_SubmitSourceBuffer(THIS, pBuffer, pBufferWMA) (THIS)->lpVtbl->SubmitSourceBuffer(THIS, pBuffer, pBufferWMA)
#define IXAudio2SourceVoice_DestroyVoice(THIS) (THIS)->lpVtbl->DestroyVoice(THIS)
#define IXAudio2MasteringVoice_DestroyVoice(THIS) (THIS)->lpVtbl->DestroyVoice(THIS)
#endif
#ifdef _XBOX
STDAPI XAudio2Create(__deref_out IXAudio2** ppXAudio2, UINT32 Flags X2DEFAULT(0),
XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR));
#else
static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32, XAUDIO2_PROCESSOR)
static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32 flags, XAUDIO2_PROCESSOR proc)
{
IXAudio2 *pXAudio2;
HRESULT hr;
IXAudio2 *pXAudio2 = NULL;
HRESULT hr = CoCreateInstance(CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, IID_IXAudio2, (void**)&pXAudio2);
(void)flags;
(void)proc;
#ifdef __cplusplus
hr = CoCreateInstance(CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, IID_IXAudio2, (void**)&pXAudio2);
#else
hr = CoCreateInstance(&CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, &IID_IXAudio2, (void**)&pXAudio2);
#endif
if (SUCCEEDED(hr))
{
//hr = IXAudio2_Initialize(pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR);
hr = pXAudio2->Initialize(0, XAUDIO2_DEFAULT_PROCESSOR);
hr = IXAudio2_Initialize(pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR);
if (SUCCEEDED(hr))
*ppXAudio2 = pXAudio2;
else
//IXAudio2_Release(pXAudio2);
pXAudio2->Release();
{
IXAudio2_Release(pXAudio2);
}
}
return hr;
}
#endif
// Undo the #pragma pack(push, 1) directive at the top of this file
/* Undo the #pragma pack(push, 1) directive at the top of this file */
#pragma pack(pop)
#endif

View File

@ -57,8 +57,7 @@ static INLINE uint32_t bswap_32(uint32_t val)
((val >> 8) & 0xff00) | ((val << 8) & 0xff0000);
}
static ssize_t xenon360_audio_write(void *data, const void *buf, size_t size,
bool is_perfcnt_enable)
static ssize_t xenon360_audio_write(void *data, const void *buf, size_t size)
{
size_t written = 0, i;
const uint32_t *in_buf = buf;

View File

@ -73,6 +73,7 @@
#include <retro_inline.h>
#include <retro_assert.h>
#include <retro_miscellaneous.h>
#include <retro_timers.h>
/*
****************************************************************************

View File

@ -37,7 +37,7 @@ void autosave_lock(void);
**/
void autosave_unlock(void);
void autosave_init(void);
bool autosave_init(void);
void autosave_deinit(void);

229
bootstrap/vita/threading.c Normal file
View File

@ -0,0 +1,229 @@
// This provides support for __getreent() as well as implementation of our thread-related wrappers
#include <reent.h>
#include <stdio.h>
#include <string.h>
#include <vitasdk/utils.h>
#include <psp2/kernel/threadmgr.h>
#define MAX_THREADS 256
typedef struct reent_for_thread {
int thread_id;
int needs_reclaim;
void *tls_data_ext;
void *pthread_data_ext;
struct _reent reent;
} reent_for_thread;
static reent_for_thread reent_list[MAX_THREADS];
static int _newlib_reent_mutex;
static struct _reent _newlib_global_reent;
#define TLS_REENT_THID_PTR(thid) sceKernelGetThreadTLSAddr(thid, 0x88)
#define TLS_REENT_PTR sceKernelGetTLSAddr(0x88)
#define list_entry(ptr, type, member) \
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
int __vita_delete_thread_reent(int thid)
{
struct reent_for_thread *for_thread;
// We only need to cleanup if reent is allocated, i.e. if it's on our TLS
// We also don't need to clean up the global reent
struct _reent **on_tls = NULL;
if (thid == 0)
on_tls = TLS_REENT_PTR;
else
on_tls = TLS_REENT_THID_PTR(thid);
if (!*on_tls || *on_tls == &_newlib_global_reent)
return 0;
for_thread = list_entry(*on_tls, struct reent_for_thread, reent);
// Remove from TLS
*on_tls = 0;
// Set thread id to zero, which means the reent is free
for_thread->thread_id = 0;
// We can't reclaim it here, will be done later in __getreent
for_thread->needs_reclaim = 1;
return 1;
}
int vitasdk_delete_thread_reent(int thid)
{
int res = 0;
// Lock the list because we'll be modifying it
sceKernelLockMutex(_newlib_reent_mutex, 1, NULL);
res = __vita_delete_thread_reent(thid);
sceKernelUnlockMutex(_newlib_reent_mutex, 1);
return res;
}
int _exit_thread_common(int exit_status, int (*exit_func)(int)) {
int res = 0;
int ret = 0;
int thid = sceKernelGetThreadId();
// Lock the list because we'll be modifying it
sceKernelLockMutex(_newlib_reent_mutex, 1, NULL);
res = __vita_delete_thread_reent(0);
ret = exit_func(exit_status);
if (res)
{
struct _reent **on_tls = TLS_REENT_PTR;
struct reent_for_thread *for_thread = list_entry(*on_tls, struct reent_for_thread, reent);
for_thread->thread_id = thid;
// And put it back on TLS
*on_tls = &for_thread->reent;
}
sceKernelUnlockMutex(_newlib_reent_mutex, 1);
return ret;
}
int vita_exit_thread(int exit_status) {
return _exit_thread_common(exit_status, sceKernelExitThread);
}
int vita_exit_delete_thread(int exit_status) {
return _exit_thread_common(exit_status, sceKernelExitDeleteThread);
}
static inline void __vita_clean_reent(void)
{
int i;
SceKernelThreadInfo info;
for (i = 0; i < MAX_THREADS; ++i)
{
info.size = sizeof(SceKernelThreadInfo);
if (sceKernelGetThreadInfo(reent_list[i].thread_id, &info) < 0)
{
reent_list[i].thread_id = 0;
reent_list[i].needs_reclaim = 1;
}
}
}
static inline struct reent_for_thread *__vita_allocate_reent(void)
{
int i;
struct reent_for_thread *free_reent = 0;
for (i = 0; i < MAX_THREADS; ++i)
if (reent_list[i].thread_id == 0) {
free_reent = &reent_list[i];
break;
}
return free_reent;
}
struct _reent *__getreent_for_thread(int thid) {
struct reent_for_thread *free_reent = 0;
struct _reent *returned_reent = 0;
// A pointer to our reent should be on the TLS
struct _reent **on_tls = NULL;
if (thid == 0)
on_tls = TLS_REENT_PTR;
else
on_tls = TLS_REENT_THID_PTR(thid);
if (*on_tls) {
return *on_tls;
}
sceKernelLockMutex(_newlib_reent_mutex, 1, 0);
// If it's not on the TLS this means the thread doesn't have a reent allocated yet
// We allocate one and put a pointer to it on the TLS
free_reent = __vita_allocate_reent();
if (!free_reent) {
// clean any hanging thread references
__vita_clean_reent();
free_reent = __vita_allocate_reent();
if (!free_reent) {
// we've exhausted all our resources
__builtin_trap();
}
} else {
// First, check if it needs to be cleaned up (if it came from another thread)
if (free_reent->needs_reclaim) {
_reclaim_reent(&free_reent->reent);
free_reent->needs_reclaim = 0;
}
memset(free_reent, 0, sizeof(struct reent_for_thread));
// Set it up
if(thid==0){
thid = sceKernelGetThreadId();
}
free_reent->thread_id = thid;
_REENT_INIT_PTR(&free_reent->reent);
returned_reent = &free_reent->reent;
}
// Put it on TLS for faster access time
*on_tls = returned_reent;
sceKernelUnlockMutex(_newlib_reent_mutex, 1);
return returned_reent;
}
struct _reent *__getreent(void) {
return __getreent_for_thread(0);
}
void *vitasdk_get_tls_data(SceUID thid)
{
struct reent_for_thread *for_thread;
struct _reent *reent = __getreent_for_thread(thid);
for_thread = list_entry(reent, struct reent_for_thread, reent);
return &for_thread->tls_data_ext;
}
void *vitasdk_get_pthread_data(SceUID thid)
{
struct reent_for_thread *for_thread;
struct _reent *reent = __getreent_for_thread(thid);
for_thread = list_entry(reent, struct reent_for_thread, reent);
return &for_thread->pthread_data_ext;
}
// Called from _start to set up the main thread reentrancy structure
void _init_vita_reent(void) {
memset(reent_list, 0, sizeof(reent_list));
_newlib_reent_mutex = sceKernelCreateMutex("reent list access mutex", 0, 0, 0);
reent_list[0].thread_id = sceKernelGetThreadId();
_REENT_INIT_PTR(&reent_list[0].reent);
*(struct _reent **)(TLS_REENT_PTR) = &reent_list[0].reent;
_REENT_INIT_PTR(&_newlib_global_reent);
}
void _free_vita_reent(void) {
sceKernelDeleteMutex(_newlib_reent_mutex);
}

View File

@ -25,7 +25,6 @@
#include "../configuration.h"
#include "../driver.h"
#include "../retroarch.h"
#include "../runloop.h"
#include "../list_special.h"
#include "../verbosity.h"
@ -48,6 +47,12 @@ static const camera_driver_t *camera_drivers[] = {
NULL,
};
static struct retro_camera_callback camera_cb;
static const camera_driver_t *camera_driver = NULL;
static void *camera_data = NULL;
static bool camera_driver_active = false;
static bool camera_driver_data_own = false;
/**
* camera_driver_find_handle:
* @idx : index of driver to get handle to.
@ -102,14 +107,20 @@ bool driver_camera_start(void)
return camera_driver_ctl(RARCH_CAMERA_CTL_START, NULL);
}
void camera_driver_poll(void)
{
if (!camera_cb.caps)
return;
if (!camera_driver || !camera_driver->poll || !camera_data)
return;
camera_driver->poll(camera_data,
camera_cb.frame_raw_framebuffer,
camera_cb.frame_opengl_texture);
}
bool camera_driver_ctl(enum rarch_camera_ctl_state state, void *data)
{
settings_t *settings = config_get_ptr();
static struct retro_camera_callback camera_cb;
static const camera_driver_t *camera_driver = NULL;
static void *camera_data = NULL;
static bool camera_driver_active = false;
static bool camera_driver_data_own = false;
switch (state)
{
@ -136,7 +147,7 @@ bool camera_driver_ctl(enum rarch_camera_ctl_state state, void *data)
driver_ctx_info_t drv;
drv.label = "camera_driver";
drv.s = settings->camera.driver;
drv.s = settings->arrays.camera_driver;
driver_ctl(RARCH_DRIVER_CTL_FIND_INDEX, &drv);
@ -148,7 +159,7 @@ bool camera_driver_ctl(enum rarch_camera_ctl_state state, void *data)
{
unsigned d;
RARCH_ERR("Couldn't find any camera driver named \"%s\"\n",
settings->camera.driver);
settings->arrays.camera_driver);
RARCH_LOG_OUTPUT("Available camera drivers are:\n");
for (d = 0; camera_driver_find_handle(d); d++)
RARCH_LOG_OUTPUT("\t%s\n", camera_driver_find_ident(d));
@ -188,22 +199,13 @@ bool camera_driver_ctl(enum rarch_camera_ctl_state state, void *data)
case RARCH_CAMERA_CTL_START:
if (camera_driver && camera_data && camera_driver->start)
{
if (settings->camera.allow)
if (settings->bools.camera_allow)
return camera_driver->start(camera_data);
runloop_msg_queue_push(
"Camera is explicitly disabled.\n", 1, 180, false);
}
break;
case RARCH_CAMERA_CTL_POLL:
if (!camera_cb.caps)
return false;
if (!camera_driver || !camera_driver->poll || !camera_data)
return false;
camera_driver->poll(camera_data,
camera_cb.frame_raw_framebuffer,
camera_cb.frame_opengl_texture);
break;
case RARCH_CAMERA_CTL_SET_CB:
{
struct retro_camera_callback *cb =
@ -222,12 +224,12 @@ bool camera_driver_ctl(enum rarch_camera_ctl_state state, void *data)
return false;
camera_data = camera_driver->init(
*settings->camera.device ? settings->camera.device : NULL,
*settings->arrays.camera_device ? settings->arrays.camera_device : NULL,
camera_cb.caps,
settings->camera.width ?
settings->camera.width : camera_cb.width,
settings->camera.height ?
settings->camera.height : camera_cb.height);
settings->uints.camera_width ?
settings->uints.camera_width : camera_cb.width,
settings->uints.camera_height ?
settings->uints.camera_height : camera_cb.height);
if (!camera_data)
{

View File

@ -37,7 +37,6 @@ enum rarch_camera_ctl_state
RARCH_CAMERA_CTL_UNSET_ACTIVE,
RARCH_CAMERA_CTL_IS_ACTIVE,
RARCH_CAMERA_CTL_FIND_DRIVER,
RARCH_CAMERA_CTL_POLL,
RARCH_CAMERA_CTL_SET_CB,
RARCH_CAMERA_CTL_STOP,
RARCH_CAMERA_CTL_START,
@ -105,6 +104,8 @@ void driver_camera_stop(void);
bool driver_camera_start(void);
void camera_driver_poll(void);
bool camera_driver_ctl(enum rarch_camera_ctl_state state, void *data);
RETRO_END_DECLS

View File

@ -16,7 +16,9 @@
*/
#include <stdio.h>
#if !defined(__FreeBSD__) || __FreeBSD__ < 5
#include <malloc.h>
#endif
#include <string.h>
#include <assert.h>
#include <stddef.h>
@ -28,7 +30,9 @@
#include <sys/time.h>
#include <sys/ioctl.h>
#ifndef __FreeBSD__
#include <asm/types.h>
#endif
#include <linux/videodev2.h>
#include <memmap.h>
@ -36,7 +40,8 @@
#include <retro_assert.h>
#include <retro_miscellaneous.h>
#include <gfx/scaler/scaler.h>
#include <retro_stat.h>
#include <gfx/video_frame.h>
#include <file/file_path.h>
#include <compat/strl.h>
@ -352,6 +357,7 @@ error:
static bool preprocess_image(void *data)
{
struct scaler_ctx *ctx = NULL;
video4linux_t *v4l = (video4linux_t*)data;
struct v4l2_buffer buf = {0};
@ -374,7 +380,9 @@ static bool preprocess_image(void *data)
retro_assert(buf.index < v4l->n_buffers);
scaler_ctx_scale(&v4l->scaler, v4l->buffer_output, (const uint8_t*)v4l->buffers[buf.index].start);
ctx = &v4l->scaler;
scaler_ctx_scale_direct(ctx, v4l->buffer_output, (const uint8_t*)v4l->buffers[buf.index].start);
if (xioctl(v4l->fd, (uint8_t)VIDIOC_QBUF, &buf) == -1)
RARCH_ERR("[V4L2]: VIDIOC_QBUF\n");

File diff suppressed because it is too large Load Diff

View File

@ -19,10 +19,25 @@
#include <stdint.h>
#include <stdlib.h>
#include <boolean.h>
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
/*****************************************************************************
Setup - mainly for debugging
*****************************************************************************/
/* Define this macro to get extra-verbose log for cheevos. */
#undef CHEEVOS_VERBOSE
/*****************************************************************************
End of setup
*****************************************************************************/
#define CHEEVOS_TAG "[CHEEVOS]: "
typedef struct cheevos_ctx_desc
{
unsigned idx;
@ -30,14 +45,73 @@ typedef struct cheevos_ctx_desc
size_t len;
} cheevos_ctx_desc_t;
typedef struct
typedef enum
{
unsigned size;
unsigned type;
int bank_id;
unsigned value;
unsigned previous;
} cheevos_var_t;
/* Don't change those, the values match the console IDs
* at retroachievements.org. */
CHEEVOS_CONSOLE_MEGA_DRIVE = 1,
CHEEVOS_CONSOLE_NINTENDO_64 = 2,
CHEEVOS_CONSOLE_SUPER_NINTENDO = 3,
CHEEVOS_CONSOLE_GAMEBOY = 4,
CHEEVOS_CONSOLE_GAMEBOY_ADVANCE = 5,
CHEEVOS_CONSOLE_GAMEBOY_COLOR = 6,
CHEEVOS_CONSOLE_NINTENDO = 7,
CHEEVOS_CONSOLE_PC_ENGINE = 8,
CHEEVOS_CONSOLE_SEGA_CD = 9,
CHEEVOS_CONSOLE_SEGA_32X = 10,
CHEEVOS_CONSOLE_MASTER_SYSTEM = 11,
CHEEVOS_CONSOLE_PLAYSTATION = 12,
CHEEVOS_CONSOLE_ATARI_LYNX = 13,
CHEEVOS_CONSOLE_NEOGEO = 14,
CHEEVOS_CONSOLE_XBOX_360 = 15,
CHEEVOS_CONSOLE_GAMECUBE = 16,
CHEEVOS_CONSOLE_ATARI_JAGUAR = 17,
CHEEVOS_CONSOLE_NINTENDO_DS = 18,
CHEEVOS_CONSOLE_WII = 19,
CHEEVOS_CONSOLE_WII_U = 20,
CHEEVOS_CONSOLE_PLAYSTATION_2 = 21,
CHEEVOS_CONSOLE_XBOX = 22,
CHEEVOS_CONSOLE_SKYNET = 23,
CHEEVOS_CONSOLE_XBOX_ONE = 24,
CHEEVOS_CONSOLE_ATARI_2600 = 25,
CHEEVOS_CONSOLE_MS_DOS = 26,
CHEEVOS_CONSOLE_ARCADE = 27,
CHEEVOS_CONSOLE_VIRTUAL_BOY = 28,
CHEEVOS_CONSOLE_MSX = 29,
CHEEVOS_CONSOLE_COMMODORE_64 = 30,
CHEEVOS_CONSOLE_ZX81 = 31
} cheevos_console_t;
enum
{
CHEEVOS_DIRTY_TITLE = 1 << 0,
CHEEVOS_DIRTY_DESC = 1 << 1,
CHEEVOS_DIRTY_POINTS = 1 << 2,
CHEEVOS_DIRTY_AUTHOR = 1 << 3,
CHEEVOS_DIRTY_ID = 1 << 4,
CHEEVOS_DIRTY_BADGE = 1 << 5,
CHEEVOS_DIRTY_CONDITIONS = 1 << 6,
CHEEVOS_DIRTY_VOTES = 1 << 7,
CHEEVOS_DIRTY_DESCRIPTION = 1 << 8,
CHEEVOS_DIRTY_ALL = (1 << 9) - 1
};
enum
{
CHEEVOS_ACTIVE_SOFTCORE = 1 << 0,
CHEEVOS_ACTIVE_HARDCORE = 1 << 1
};
enum
{
CHEEVOS_FORMAT_FRAMES = 0,
CHEEVOS_FORMAT_SECS,
CHEEVOS_FORMAT_MILLIS,
CHEEVOS_FORMAT_SCORE,
CHEEVOS_FORMAT_VALUE,
CHEEVOS_FORMAT_OTHER
};
bool cheevos_load(const void *data);
@ -61,9 +135,7 @@ void cheevos_set_support_cheevos(bool state);
bool cheevos_get_support_cheevos(void);
void cheevos_parse_guest_addr(cheevos_var_t *var, unsigned value);
uint8_t *cheevos_get_memory(const cheevos_var_t *var);
cheevos_console_t cheevos_get_console(void);
extern bool cheevos_loaded;
extern int cheats_are_enabled;

192
cheevos/cond.c Normal file
View File

@ -0,0 +1,192 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2015-2017 - Andre Leiradella
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* 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 "cond.h"
#include "var.h"
#include "../retroarch.h"
#include "../verbosity.h"
/*****************************************************************************
Parsing
*****************************************************************************/
static cheevos_cond_op_t cheevos_cond_parse_operator(const char** memaddr)
{
const char *str = *memaddr;
cheevos_cond_op_t op;
if (*str == '=' && str[1] == '=')
{
op = CHEEVOS_COND_OP_EQUALS;
str += 2;
}
else if (*str == '=')
{
op = CHEEVOS_COND_OP_EQUALS;
str++;
}
else if (*str == '!' && str[1] == '=')
{
op = CHEEVOS_COND_OP_NOT_EQUAL_TO;
str += 2;
}
else if (*str == '<' && str[1] == '=')
{
op = CHEEVOS_COND_OP_LESS_THAN_OR_EQUAL;
str += 2;
}
else if (*str == '<')
{
op = CHEEVOS_COND_OP_LESS_THAN;
str++;
}
else if (*str == '>' && str[1] == '=')
{
op = CHEEVOS_COND_OP_GREATER_THAN_OR_EQUAL;
str += 2;
}
else if (*str == '>')
{
op = CHEEVOS_COND_OP_GREATER_THAN;
str++;
}
else
{
RARCH_ERR(CHEEVOS_TAG "unknown operator %c\n.", *str);
op = CHEEVOS_COND_OP_EQUALS;
}
*memaddr = str;
return op;
}
void cheevos_cond_parse(cheevos_cond_t* cond, const char** memaddr)
{
const char* str = *memaddr;
cond->type = CHEEVOS_COND_TYPE_STANDARD;
if (*str != 0 && str[1] == ':')
{
int skip = 2;
switch (*str)
{
case 'R':
cond->type = CHEEVOS_COND_TYPE_RESET_IF;
break;
case 'P':
cond->type = CHEEVOS_COND_TYPE_PAUSE_IF;
break;
case 'A':
cond->type = CHEEVOS_COND_TYPE_ADD_SOURCE;
break;
case 'B':
cond->type = CHEEVOS_COND_TYPE_SUB_SOURCE;
break;
case 'C':
cond->type = CHEEVOS_COND_TYPE_ADD_HITS;
break;
default:
skip = 0;
break;
}
str += skip;
}
cheevos_var_parse(&cond->source, &str);
cond->op = cheevos_cond_parse_operator(&str);
cheevos_var_parse(&cond->target, &str);
cond->curr_hits = 0;
if (*str == '(' || *str == '.')
{
char* end;
cond->req_hits = (unsigned)strtol(str + 1, &end, 10);
str = end + (*end == ')' || *end == '.');
}
else
cond->req_hits = 0;
*memaddr = str;
}
unsigned cheevos_cond_count_in_set(const char* memaddr, unsigned which)
{
cheevos_cond_t dummy;
unsigned index = 0;
unsigned count = 0;
for (;;)
{
for (;;)
{
cheevos_cond_parse(&dummy, &memaddr);
if (index == which)
count++;
if (*memaddr != '_')
break;
memaddr++;
}
index++;
if (*memaddr != 'S')
break;
memaddr++;
}
return count;
}
void cheevos_cond_parse_in_set(cheevos_cond_t* cond, const char* memaddr, unsigned which)
{
cheevos_cond_t dummy;
unsigned index = 0;
for (;;)
{
for (;;)
{
if (index == which)
{
cheevos_cond_parse(cond, &memaddr);
#ifdef CHEEVOS_VERBOSE
/*cheevos_log_cond(cond);*/
#endif
cond++;
}
else
cheevos_cond_parse(&dummy, &memaddr);
if (*memaddr != '_')
break;
memaddr++;
}
index++;
if (*memaddr != 'S')
break;
memaddr++;
}
}

62
cheevos/cond.h Normal file
View File

@ -0,0 +1,62 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2015-2017 - Andre Leiradella
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* 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 __RARCH_CHEEVOS_COND_H
#define __RARCH_CHEEVOS_COND_H
#include "var.h"
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
typedef enum
{
CHEEVOS_COND_TYPE_STANDARD,
CHEEVOS_COND_TYPE_PAUSE_IF,
CHEEVOS_COND_TYPE_RESET_IF,
CHEEVOS_COND_TYPE_ADD_SOURCE,
CHEEVOS_COND_TYPE_SUB_SOURCE,
CHEEVOS_COND_TYPE_ADD_HITS
} cheevos_cond_type_t;
typedef enum
{
CHEEVOS_COND_OP_EQUALS,
CHEEVOS_COND_OP_LESS_THAN,
CHEEVOS_COND_OP_LESS_THAN_OR_EQUAL,
CHEEVOS_COND_OP_GREATER_THAN,
CHEEVOS_COND_OP_GREATER_THAN_OR_EQUAL,
CHEEVOS_COND_OP_NOT_EQUAL_TO
} cheevos_cond_op_t;
typedef struct
{
cheevos_cond_type_t type;
unsigned req_hits;
unsigned curr_hits;
cheevos_var_t source;
cheevos_cond_op_t op;
cheevos_var_t target;
} cheevos_cond_t;
void cheevos_cond_parse(cheevos_cond_t* cond, const char** memaddr);
unsigned cheevos_cond_count_in_set(const char* memaddr, unsigned which);
void cheevos_cond_parse_in_set(cheevos_cond_t* cond, const char* memaddr, unsigned which);
RETRO_END_DECLS
#endif /* __RARCH_CHEEVOS_COND_H */

83
cheevos/coro.h Normal file
View File

@ -0,0 +1,83 @@
#ifndef CORO_H
#define CORO_H
/*
Released under the CC0: https://creativecommons.org/publicdomain/zero/1.0/
*/
/* Use at the beginning of the coroutine, you must have declared a variable coro_t* coro */
#define CORO_ENTER() \
{ \
CORO_again: ; \
switch ( coro->step ) { \
case CORO_BEGIN: ;
/* Use to define labels which are targets to GOTO and GOSUB */
#define CORO_SUB( x ) \
case x: ;
/* Use at the end of the coroutine */
#define CORO_LEAVE() \
} \
} \
do { return 0; } while ( 0 )
/* Go to the x label */
#define CORO_GOTO( x ) \
do { \
coro->step = ( x ); \
goto CORO_again; \
} while ( 0 )
/* Go to a subroutine, execution continues until the subroutine returns via RET */
/* x is the subroutine label, y and z are the A and B arguments */
#define CORO_GOSUB( x ) \
do { \
coro->stack[ coro->sp++ ] = __LINE__; \
coro->step = ( x ); \
goto CORO_again; \
case __LINE__: ; \
} while ( 0 )
/* Returns from a subroutine */
#define CORO_RET() \
do { \
coro->step = coro->stack[ --coro->sp ]; \
goto CORO_again; \
} while ( 0 )
/* Yields to the caller, execution continues from this point when the coroutine is resumed */
#define CORO_YIELD() \
do { \
coro->step = __LINE__; \
return 1; \
case __LINE__: ; \
} while ( 0 )
#define CORO_STOP() \
do { \
return 0; \
} while ( 0 )
/* The coroutine entry point, never use 0 as a label */
#define CORO_BEGIN 0
/* Sets up a coroutine, x is a pointer to coro_t */
#define CORO_SETUP( x ) \
do { \
( x )->step = CORO_BEGIN; \
( x )->sp = 0; \
} while ( 0 )
#define CORO_VAR( x ) ( coro->x )
/* A coroutine */
typedef struct
{
CORO_VARS
int step, sp;
int stack[ 8 ];
}
coro_t;
#endif /* CORO_H */

410
cheevos/var.c Normal file
View File

@ -0,0 +1,410 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2015-2017 - Andre Leiradella
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* 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 <ctype.h>
#include <stdint.h>
#include <libretro.h>
#include "var.h"
#include "../retroarch.h"
#include "../core.h"
#include "../verbosity.h"
#ifdef CHEEVOS_VERBOSE
#define CHEEVOS_LOG RARCH_LOG
#else
#define CHEEVOS_LOG(...)
#endif
/*****************************************************************************
Parsing
*****************************************************************************/
static cheevos_var_size_t cheevos_var_parse_prefix(const char** memaddr)
{
/* Careful not to use ABCDEF here, this denotes part of an actual variable! */
const char* str = *memaddr;
cheevos_var_size_t size;
switch (toupper((unsigned char)*str++))
{
case 'M':
size = CHEEVOS_VAR_SIZE_BIT_0;
break;
case 'N':
size = CHEEVOS_VAR_SIZE_BIT_1;
break;
case 'O':
size = CHEEVOS_VAR_SIZE_BIT_2;
break;
case 'P':
size = CHEEVOS_VAR_SIZE_BIT_3;
break;
case 'Q':
size = CHEEVOS_VAR_SIZE_BIT_4;
break;
case 'R':
size = CHEEVOS_VAR_SIZE_BIT_5;
break;
case 'S':
size = CHEEVOS_VAR_SIZE_BIT_6;
break;
case 'T':
size = CHEEVOS_VAR_SIZE_BIT_7;
break;
case 'L':
size = CHEEVOS_VAR_SIZE_NIBBLE_LOWER;
break;
case 'U':
size = CHEEVOS_VAR_SIZE_NIBBLE_UPPER;
break;
case 'H':
size = CHEEVOS_VAR_SIZE_EIGHT_BITS;
break;
case 'X':
size = CHEEVOS_VAR_SIZE_THIRTYTWO_BITS;
break;
default:
str--;
/* fall through */
case ' ':
size = CHEEVOS_VAR_SIZE_SIXTEEN_BITS;
break;
}
*memaddr = str;
return size;
}
static size_t cheevos_var_reduce(size_t addr, size_t mask)
{
while (mask)
{
size_t tmp = (mask - 1) & ~mask;
addr = (addr & tmp) | ((addr >> 1) & ~tmp);
mask = (mask & (mask - 1)) >> 1;
}
return addr;
}
static size_t cheevos_var_highest_bit(size_t n)
{
n |= n >> 1;
n |= n >> 2;
n |= n >> 4;
n |= n >> 8;
n |= n >> 16;
return n ^ (n >> 1);
}
void cheevos_var_parse(cheevos_var_t* var, const char** memaddr)
{
char *end = NULL;
const char *str = *memaddr;
unsigned base = 16;
if (toupper((unsigned char)*str) == 'D' && str[1] == '0' && toupper((unsigned char)str[2]) == 'X')
{
/* d0x + 4 hex digits */
str += 3;
var->type = CHEEVOS_VAR_TYPE_DELTA_MEM;
}
else if (*str == '0' && toupper((unsigned char)str[1]) == 'X')
{
/* 0x + 4 hex digits */
str += 2;
var->type = CHEEVOS_VAR_TYPE_ADDRESS;
}
else
{
var->type = CHEEVOS_VAR_TYPE_VALUE_COMP;
if (toupper((unsigned char)*str) == 'H')
str++;
else
{
if (toupper((unsigned char)*str) == 'V')
str++;
base = 10;
}
}
if (var->type != CHEEVOS_VAR_TYPE_VALUE_COMP)
{
var->size = cheevos_var_parse_prefix(&str);
}
var->value = (unsigned)strtol(str, &end, base);
*memaddr = end;
}
void cheevos_var_patch_addr(cheevos_var_t* var, cheevos_console_t console)
{
rarch_system_info_t *system = runloop_get_system_info();
var->bank_id = -1;
if (console == CHEEVOS_CONSOLE_NINTENDO)
{
if (var->value >= 0x0800 && var->value < 0x2000)
{
CHEEVOS_LOG(CHEEVOS_TAG "NES memory address in mirrorred RAM %X, adjusted to %X\n", var->value, var->value & 0x07ff);
var->value &= 0x07ff;
}
}
else if (console == CHEEVOS_CONSOLE_GAMEBOY_COLOR)
{
if (var->value >= 0xe000 && var->value <= 0xfdff)
{
CHEEVOS_LOG(CHEEVOS_TAG "GBC memory address in echo RAM %X, adjusted to %X\n", var->value, var->value - 0x2000);
var->value -= 0x2000;
}
}
if (system->mmaps.num_descriptors != 0)
{
const rarch_memory_descriptor_t *desc = NULL;
const rarch_memory_descriptor_t *end = NULL;
/* Patch the address to correctly map it to the mmaps */
if (console == CHEEVOS_CONSOLE_GAMEBOY_ADVANCE)
{
if (var->value < 0x8000) /* Internal RAM */
{
CHEEVOS_LOG(CHEEVOS_TAG "GBA memory address %X adjusted to %X\n", var->value, var->value + 0x3000000);
var->value += 0x3000000;
}
else /* Work RAM */
{
CHEEVOS_LOG(CHEEVOS_TAG "GBA memory address %X adjusted to %X\n", var->value, var->value + 0x2000000 - 0x8000);
var->value += 0x2000000 - 0x8000;
}
}
else if (console == CHEEVOS_CONSOLE_PC_ENGINE)
{
CHEEVOS_LOG(CHEEVOS_TAG "PCE memory address %X adjusted to %X\n", var->value, var->value + 0x1f0000);
var->value += 0x1f0000;
}
else if (console == CHEEVOS_CONSOLE_SUPER_NINTENDO)
{
if (var->value < 0x020000) /* Work RAM */
{
CHEEVOS_LOG(CHEEVOS_TAG "SNES memory address %X adjusted to %X\n", var->value, var->value + 0x7e0000);
var->value += 0x7e0000;
}
else /* Save RAM */
{
CHEEVOS_LOG(CHEEVOS_TAG "SNES memory address %X adjusted to %X\n", var->value, var->value + 0x006000 - 0x020000);
var->value += 0x006000 - 0x020000;
}
}
desc = system->mmaps.descriptors;
end = desc + system->mmaps.num_descriptors;
for (; desc < end; desc++)
{
if (((desc->core.start ^ var->value) & desc->core.select) == 0)
{
unsigned addr = var->value;
var->bank_id = (int)(desc - system->mmaps.descriptors);
var->value = (unsigned)cheevos_var_reduce(
(addr - desc->core.start) & desc->disconnect_mask,
desc->core.disconnect);
if (var->value >= desc->core.len)
var->value -= cheevos_var_highest_bit(var->value);
var->value += desc->core.offset;
CHEEVOS_LOG(CHEEVOS_TAG "address %X set to descriptor %d at offset %X\n", addr, var->bank_id + 1, var->value);
break;
}
}
}
else
{
unsigned i;
for (i = 0; i < 4; i++)
{
retro_ctx_memory_info_t meminfo;
switch (i)
{
case 0:
meminfo.id = RETRO_MEMORY_SYSTEM_RAM;
break;
case 1:
meminfo.id = RETRO_MEMORY_SAVE_RAM;
break;
case 2:
meminfo.id = RETRO_MEMORY_VIDEO_RAM;
break;
case 3:
meminfo.id = RETRO_MEMORY_RTC;
break;
}
core_get_memory(&meminfo);
if (var->value < meminfo.size)
{
var->bank_id = i;
break;
}
/* HACK subtract the correct amount of bytes to reach the save RAM */
if (i == 0 && console == CHEEVOS_CONSOLE_NINTENDO)
var->value -= 0x6000;
else
var->value -= meminfo.size;
}
}
}
/*****************************************************************************
Testing
*****************************************************************************/
uint8_t* cheevos_var_get_memory(const cheevos_var_t* var)
{
uint8_t* memory = NULL;
if (var->bank_id >= 0)
{
rarch_system_info_t* system = runloop_get_system_info();
if (system->mmaps.num_descriptors != 0)
memory = (uint8_t*)system->mmaps.descriptors[var->bank_id].core.ptr;
else
{
retro_ctx_memory_info_t meminfo = {NULL, 0, 0};
switch (var->bank_id)
{
case 0:
meminfo.id = RETRO_MEMORY_SYSTEM_RAM;
break;
case 1:
meminfo.id = RETRO_MEMORY_SAVE_RAM;
break;
case 2:
meminfo.id = RETRO_MEMORY_VIDEO_RAM;
break;
case 3:
meminfo.id = RETRO_MEMORY_RTC;
break;
default:
RARCH_ERR(CHEEVOS_TAG "invalid bank id: %s\n", var->bank_id);
break;
}
core_get_memory(&meminfo);
memory = (uint8_t*)meminfo.data;
}
if (memory)
memory += var->value;
}
return memory;
}
unsigned cheevos_var_get_value(cheevos_var_t* var)
{
const uint8_t* memory = NULL;
unsigned value = 0;
switch (var->type)
{
case CHEEVOS_VAR_TYPE_VALUE_COMP:
value = var->value;
break;
case CHEEVOS_VAR_TYPE_ADDRESS:
case CHEEVOS_VAR_TYPE_DELTA_MEM:
memory = cheevos_var_get_memory(var);
if (memory)
{
value = memory[0];
switch (var->size)
{
case CHEEVOS_VAR_SIZE_BIT_0:
value &= 1;
break;
case CHEEVOS_VAR_SIZE_BIT_1:
value = (value >> 1) & 1;
break;
case CHEEVOS_VAR_SIZE_BIT_2:
value = (value >> 2) & 1;
break;
case CHEEVOS_VAR_SIZE_BIT_3:
value = (value >> 3) & 1;
break;
case CHEEVOS_VAR_SIZE_BIT_4:
value = (value >> 4) & 1;
break;
case CHEEVOS_VAR_SIZE_BIT_5:
value = (value >> 5) & 1;
break;
case CHEEVOS_VAR_SIZE_BIT_6:
value = (value >> 6) & 1;
break;
case CHEEVOS_VAR_SIZE_BIT_7:
value = (value >> 7) & 1;
break;
case CHEEVOS_VAR_SIZE_NIBBLE_LOWER:
value &= 0x0f;
break;
case CHEEVOS_VAR_SIZE_NIBBLE_UPPER:
value = (value >> 4) & 0x0f;
break;
case CHEEVOS_VAR_SIZE_EIGHT_BITS:
break;
case CHEEVOS_VAR_SIZE_SIXTEEN_BITS:
value |= memory[1] << 8;
break;
case CHEEVOS_VAR_SIZE_THIRTYTWO_BITS:
value |= memory[1] << 8;
value |= memory[2] << 16;
value |= memory[3] << 24;
break;
}
}
if (var->type == CHEEVOS_VAR_TYPE_DELTA_MEM)
{
unsigned previous = var->previous;
var->previous = value;
value = previous;
}
break;
case CHEEVOS_VAR_TYPE_DYNAMIC_VAR:
/* We shouldn't get here... */
break;
}
return value;
}

77
cheevos/var.h Normal file
View File

@ -0,0 +1,77 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2015-2017 - Andre Leiradella
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* 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 __RARCH_CHEEVOS_VAR_H
#define __RARCH_CHEEVOS_VAR_H
#include <stdint.h>
#include "cheevos.h"
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
typedef enum
{
CHEEVOS_VAR_SIZE_BIT_0 = 0,
CHEEVOS_VAR_SIZE_BIT_1,
CHEEVOS_VAR_SIZE_BIT_2,
CHEEVOS_VAR_SIZE_BIT_3,
CHEEVOS_VAR_SIZE_BIT_4,
CHEEVOS_VAR_SIZE_BIT_5,
CHEEVOS_VAR_SIZE_BIT_6,
CHEEVOS_VAR_SIZE_BIT_7,
CHEEVOS_VAR_SIZE_NIBBLE_LOWER,
CHEEVOS_VAR_SIZE_NIBBLE_UPPER,
/* Byte, */
CHEEVOS_VAR_SIZE_EIGHT_BITS, /* =Byte, */
CHEEVOS_VAR_SIZE_SIXTEEN_BITS,
CHEEVOS_VAR_SIZE_THIRTYTWO_BITS
} cheevos_var_size_t;
typedef enum
{
/* compare to the value of a live address in RAM */
CHEEVOS_VAR_TYPE_ADDRESS = 0,
/* a number. assume 32 bit */
CHEEVOS_VAR_TYPE_VALUE_COMP,
/* the value last known at this address. */
CHEEVOS_VAR_TYPE_DELTA_MEM,
/* a custom user-set variable */
CHEEVOS_VAR_TYPE_DYNAMIC_VAR
} cheevos_var_type_t;
typedef struct
{
cheevos_var_size_t size;
cheevos_var_type_t type;
int bank_id;
unsigned value;
unsigned previous;
} cheevos_var_t;
void cheevos_var_parse(cheevos_var_t* var, const char** memaddr);
void cheevos_var_patch_addr(cheevos_var_t* var, cheevos_console_t console);
uint8_t* cheevos_var_get_memory(const cheevos_var_t* var);
unsigned cheevos_var_get_value(cheevos_var_t* var);
RETRO_END_DECLS
#endif /* __RARCH_CHEEVOS_VAR_H */

1414
command.c

File diff suppressed because it is too large Load Diff

View File

@ -134,6 +134,8 @@ enum event_command
CMD_EVENT_REBOOT,
/* Resume RetroArch when in menu. */
CMD_EVENT_RESUME,
/* Add a playlist entry to favorites. */
CMD_EVENT_ADD_TO_FAVORITES,
/* Toggles pause. */
CMD_EVENT_PAUSE_TOGGLE,
/* Pauses RetroArch. */
@ -191,12 +193,14 @@ enum event_command
CMD_EVENT_REMOTE_INIT,
/* Deinitializes remote gamepad interface. */
CMD_EVENT_REMOTE_DEINIT,
/* Initializes keyboard to gamepad mapper interface. */
CMD_EVENT_MAPPER_INIT,
/* Deinitializes keyboard to gamepad mapper interface. */
CMD_EVENT_MAPPER_DEINIT,
/* Reinitializes audio driver. */
CMD_EVENT_AUDIO_REINIT,
/* Resizes windowed scale. Will reinitialize video driver. */
CMD_EVENT_RESIZE_WINDOWED_SCALE,
/* Deinitializes temporary content. */
CMD_EVENT_TEMPORARY_CONTENT_DEINIT,
CMD_EVENT_LOG_FILE_DEINIT,
/* Toggles disk eject. */
CMD_EVENT_DISK_EJECT_TOGGLE,
@ -217,15 +221,17 @@ enum event_command
CMD_EVENT_PERFCNT_REPORT_FRONTEND_LOG,
CMD_EVENT_VOLUME_UP,
CMD_EVENT_VOLUME_DOWN,
CMD_EVENT_MIXER_VOLUME_UP,
CMD_EVENT_MIXER_VOLUME_DOWN,
CMD_EVENT_DISABLE_OVERRIDES,
CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET
CMD_EVENT_RESTORE_REMAPS,
CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET,
CMD_EVENT_LIBUI_TEST
};
#ifdef HAVE_COMMAND
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
bool command_set_shader(const char *arg);
bool command_network_send(const char *cmd_);
#endif
#endif
bool command_network_new(
command_t *handle,
@ -233,7 +239,7 @@ bool command_network_new(
bool network_enable,
uint16_t port);
command_t *command_new(bool local_enable);
command_t *command_new(void);
bool command_poll(command_t *handle);

View File

@ -20,166 +20,12 @@
#include <boolean.h>
#include "gfx/video_defines.h"
#include "input/input_driver.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "input/input_driver.h"
#include "config.def.keybinds.h"
enum video_driver_enum
{
VIDEO_GL = 0,
VIDEO_VULKAN,
VIDEO_DRM,
VIDEO_XVIDEO,
VIDEO_SDL,
VIDEO_SDL2,
VIDEO_EXT,
VIDEO_WII,
VIDEO_WIIU,
VIDEO_XENON360,
VIDEO_XDK_D3D,
VIDEO_PSP1,
VIDEO_VITA2D,
VIDEO_CTR,
VIDEO_D3D9,
VIDEO_VG,
VIDEO_OMAP,
VIDEO_EXYNOS,
VIDEO_SUNXI,
VIDEO_DISPMANX,
VIDEO_CACA,
VIDEO_GDI,
VIDEO_VGA,
VIDEO_NULL
};
enum audio_driver_enum
{
AUDIO_RSOUND = VIDEO_NULL + 1,
AUDIO_OSS,
AUDIO_ALSA,
AUDIO_ALSATHREAD,
AUDIO_ROAR,
AUDIO_AL,
AUDIO_SL,
AUDIO_JACK,
AUDIO_SDL,
AUDIO_SDL2,
AUDIO_XAUDIO,
AUDIO_PULSE,
AUDIO_EXT,
AUDIO_DSOUND,
AUDIO_COREAUDIO,
AUDIO_PS3,
AUDIO_XENON360,
AUDIO_WII,
AUDIO_WIIU,
AUDIO_RWEBAUDIO,
AUDIO_PSP,
AUDIO_CTR,
AUDIO_NULL
};
enum audio_resampler_driver_enum
{
AUDIO_RESAMPLER_CC = AUDIO_NULL + 1,
AUDIO_RESAMPLER_SINC,
AUDIO_RESAMPLER_NEAREST,
AUDIO_RESAMPLER_NULL
};
enum input_driver_enum
{
INPUT_ANDROID = AUDIO_RESAMPLER_NULL + 1,
INPUT_SDL,
INPUT_SDL2,
INPUT_X,
INPUT_WAYLAND,
INPUT_DINPUT,
INPUT_PS3,
INPUT_PSP,
INPUT_CTR,
INPUT_XENON360,
INPUT_WII,
INPUT_WIIU,
INPUT_XINPUT,
INPUT_UDEV,
INPUT_LINUXRAW,
INPUT_COCOA,
INPUT_QNX,
INPUT_RWEBINPUT,
INPUT_DOS,
INPUT_NULL
};
enum joypad_driver_enum
{
JOYPAD_PS3 = INPUT_NULL + 1,
JOYPAD_XINPUT,
JOYPAD_GX,
JOYPAD_WIIU,
JOYPAD_XDK,
JOYPAD_PSP,
JOYPAD_CTR,
JOYPAD_DINPUT,
JOYPAD_UDEV,
JOYPAD_LINUXRAW,
JOYPAD_ANDROID,
JOYPAD_SDL,
JOYPAD_DOS,
JOYPAD_HID,
JOYPAD_QNX,
JOYPAD_NULL
};
enum camera_driver_enum
{
CAMERA_V4L2 = JOYPAD_NULL + 1,
CAMERA_RWEBCAM,
CAMERA_ANDROID,
CAMERA_AVFOUNDATION,
CAMERA_NULL
};
enum wifi_driver_enum
{
WIFI_CONNMANCTL = CAMERA_NULL + 1,
WIFI_NULL
};
enum location_driver_enum
{
LOCATION_ANDROID = WIFI_NULL + 1,
LOCATION_CORELOCATION,
LOCATION_NULL
};
enum osk_driver_enum
{
OSK_PS3 = LOCATION_NULL + 1,
OSK_NULL
};
enum menu_driver_enum
{
MENU_RGUI = OSK_NULL + 1,
MENU_XUI,
MENU_MATERIALUI,
MENU_XMB,
MENU_NUKLEAR,
MENU_NULL
};
enum record_driver_enum
{
RECORD_FFMPEG = MENU_NULL + 1,
RECORD_NULL
};
#if defined(HW_RVL)
#define MAX_GAMMA_SETTING 30
#elif defined(GEKKO)
@ -188,224 +34,6 @@ enum record_driver_enum
#define MAX_GAMMA_SETTING 1
#endif
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) || defined(__CELLOS_LV2__)
#define VIDEO_DEFAULT_DRIVER VIDEO_GL
#elif defined(GEKKO)
#define VIDEO_DEFAULT_DRIVER VIDEO_WII
#elif defined(WIIU)
#define VIDEO_DEFAULT_DRIVER VIDEO_WIIU
#elif defined(XENON)
#define VIDEO_DEFAULT_DRIVER VIDEO_XENON360
#elif (defined(_XBOX1) || defined(_XBOX360)) && (defined(HAVE_D3D8) || defined(HAVE_D3D9))
#define VIDEO_DEFAULT_DRIVER VIDEO_XDK_D3D
#elif defined(HAVE_D3D9)
#define VIDEO_DEFAULT_DRIVER VIDEO_D3D9
#elif defined(HAVE_VG)
#define VIDEO_DEFAULT_DRIVER VIDEO_VG
#elif defined(HAVE_VITA2D)
#define VIDEO_DEFAULT_DRIVER VIDEO_VITA2D
#elif defined(PSP)
#define VIDEO_DEFAULT_DRIVER VIDEO_PSP1
#elif defined(_3DS)
#define VIDEO_DEFAULT_DRIVER VIDEO_CTR
#elif defined(HAVE_XVIDEO)
#define VIDEO_DEFAULT_DRIVER VIDEO_XVIDEO
#elif defined(HAVE_SDL)
#define VIDEO_DEFAULT_DRIVER VIDEO_SDL
#elif defined(HAVE_SDL2)
#define VIDEO_DEFAULT_DRIVER VIDEO_SDL2
#elif defined(_WIN32) && !defined(_XBOX)
#define VIDEO_DEFAULT_DRIVER VIDEO_GDI
#elif defined(DJGPP)
#define VIDEO_DEFAULT_DRIVER VIDEO_VGA
#elif defined(HAVE_DYLIB) && !defined(ANDROID)
#define VIDEO_DEFAULT_DRIVER VIDEO_EXT
#else
#define VIDEO_DEFAULT_DRIVER VIDEO_NULL
#endif
#if defined(__CELLOS_LV2__)
#define AUDIO_DEFAULT_DRIVER AUDIO_PS3
#elif defined(XENON)
#define AUDIO_DEFAULT_DRIVER AUDIO_XENON360
#elif defined(GEKKO)
#define AUDIO_DEFAULT_DRIVER AUDIO_WII
#elif defined(WIIU)
#define AUDIO_DEFAULT_DRIVER AUDIO_WIIU
#elif defined(PSP) || defined(VITA)
#define AUDIO_DEFAULT_DRIVER AUDIO_PSP
#elif defined(_3DS)
#define AUDIO_DEFAULT_DRIVER AUDIO_CTR
#elif defined(HAVE_PULSE)
#define AUDIO_DEFAULT_DRIVER AUDIO_PULSE
#elif defined(HAVE_ALSA) && defined(HAVE_VIDEOCORE)
#define AUDIO_DEFAULT_DRIVER AUDIO_ALSATHREAD
#elif defined(HAVE_ALSA)
#define AUDIO_DEFAULT_DRIVER AUDIO_ALSA
#elif defined(HAVE_OSS)
#define AUDIO_DEFAULT_DRIVER AUDIO_OSS
#elif defined(HAVE_JACK)
#define AUDIO_DEFAULT_DRIVER AUDIO_JACK
#elif defined(HAVE_COREAUDIO)
#define AUDIO_DEFAULT_DRIVER AUDIO_COREAUDIO
#elif defined(HAVE_XAUDIO)
#define AUDIO_DEFAULT_DRIVER AUDIO_XAUDIO
#elif defined(HAVE_DSOUND)
#define AUDIO_DEFAULT_DRIVER AUDIO_DSOUND
#elif defined(HAVE_AL)
#define AUDIO_DEFAULT_DRIVER AUDIO_AL
#elif defined(HAVE_SL)
#define AUDIO_DEFAULT_DRIVER AUDIO_SL
#elif defined(EMSCRIPTEN)
#define AUDIO_DEFAULT_DRIVER AUDIO_RWEBAUDIO
#elif defined(HAVE_SDL)
#define AUDIO_DEFAULT_DRIVER AUDIO_SDL
#elif defined(HAVE_SDL2)
#define AUDIO_DEFAULT_DRIVER AUDIO_SDL2
#elif defined(HAVE_RSOUND)
#define AUDIO_DEFAULT_DRIVER AUDIO_RSOUND
#elif defined(HAVE_ROAR)
#define AUDIO_DEFAULT_DRIVER AUDIO_ROAR
#elif defined(HAVE_DYLIB) && !defined(ANDROID)
#define AUDIO_DEFAULT_DRIVER AUDIO_EXT
#else
#define AUDIO_DEFAULT_DRIVER AUDIO_NULL
#endif
#if defined(PSP) || defined(EMSCRIPTEN)
#define AUDIO_DEFAULT_RESAMPLER_DRIVER AUDIO_RESAMPLER_CC
#else
#define AUDIO_DEFAULT_RESAMPLER_DRIVER AUDIO_RESAMPLER_SINC
#endif
#if defined(HAVE_FFMPEG)
#define RECORD_DEFAULT_DRIVER RECORD_FFMPEG
#else
#define RECORD_DEFAULT_DRIVER RECORD_NULL
#endif
#if defined(XENON)
#define INPUT_DEFAULT_DRIVER INPUT_XENON360
#elif defined(_XBOX360) || defined(_XBOX) || defined(HAVE_XINPUT2) || defined(HAVE_XINPUT_XBOX1)
#define INPUT_DEFAULT_DRIVER INPUT_XINPUT
#elif defined(ANDROID)
#define INPUT_DEFAULT_DRIVER INPUT_ANDROID
#elif defined(EMSCRIPTEN) && defined(HAVE_SDL2)
#define INPUT_DEFAULT_DRIVER INPUT_SDL2
#elif defined(EMSCRIPTEN)
#define INPUT_DEFAULT_DRIVER INPUT_RWEBINPUT
#elif defined(_WIN32)
#define INPUT_DEFAULT_DRIVER INPUT_DINPUT
#elif defined(__CELLOS_LV2__)
#define INPUT_DEFAULT_DRIVER INPUT_PS3
#elif defined(PSP) || defined(VITA)
#define INPUT_DEFAULT_DRIVER INPUT_PSP
#elif defined(_3DS)
#define INPUT_DEFAULT_DRIVER INPUT_CTR
#elif defined(GEKKO)
#define INPUT_DEFAULT_DRIVER INPUT_WII
#elif defined(WIIU)
#define INPUT_DEFAULT_DRIVER INPUT_WIIU
#elif defined(HAVE_UDEV)
#define INPUT_DEFAULT_DRIVER INPUT_UDEV
#elif defined(__linux__) && !defined(ANDROID)
#define INPUT_DEFAULT_DRIVER INPUT_LINUXRAW
#elif defined(HAVE_X11)
#define INPUT_DEFAULT_DRIVER INPUT_X
#elif defined(HAVE_WAYLAND)
#define INPUT_DEFAULT_DRIVER INPUT_WAYLAND
#elif defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
#define INPUT_DEFAULT_DRIVER INPUT_COCOA
#elif defined(__QNX__)
#define INPUT_DEFAULT_DRIVER INPUT_QNX
#elif defined(HAVE_SDL)
#define INPUT_DEFAULT_DRIVER INPUT_SDL
#elif defined(HAVE_SDL2)
#define INPUT_DEFAULT_DRIVER INPUT_SDL2
#elif defined(DJGPP)
#define INPUT_DEFAULT_DRIVER INPUT_DOS
#else
#define INPUT_DEFAULT_DRIVER INPUT_NULL
#endif
#if defined(__CELLOS_LV2__)
#define JOYPAD_DEFAULT_DRIVER JOYPAD_PS3
#elif defined(HAVE_XINPUT)
#define JOYPAD_DEFAULT_DRIVER JOYPAD_XINPUT
#elif defined(GEKKO)
#define JOYPAD_DEFAULT_DRIVER JOYPAD_GX
#elif defined(WIIU)
#define JOYPAD_DEFAULT_DRIVER JOYPAD_WIIU
#elif defined(_XBOX)
#define JOYPAD_DEFAULT_DRIVER JOYPAD_XDK
#elif defined(PSP) || defined(VITA)
#define JOYPAD_DEFAULT_DRIVER JOYPAD_PSP
#elif defined(_3DS)
#define JOYPAD_DEFAULT_DRIVER JOYPAD_CTR
#elif defined(HAVE_DINPUT)
#define JOYPAD_DEFAULT_DRIVER JOYPAD_DINPUT
#elif defined(HAVE_UDEV)
#define JOYPAD_DEFAULT_DRIVER JOYPAD_UDEV
#elif defined(__linux) && !defined(ANDROID)
#define JOYPAD_DEFAULT_DRIVER JOYPAD_LINUXRAW
#elif defined(ANDROID)
#define JOYPAD_DEFAULT_DRIVER JOYPAD_ANDROID
#elif defined(HAVE_SDL) || defined(HAVE_SDL2)
#define JOYPAD_DEFAULT_DRIVER JOYPAD_SDL
#elif defined(DJGPP)
#define JOYPAD_DEFAULT_DRIVER JOYPAD_DOS
#elif defined(HAVE_HID)
#define JOYPAD_DEFAULT_DRIVER JOYPAD_HID
#elif defined(__QNX__)
#define JOYPAD_DEFAULT_DRIVER JOYPAD_QNX
#else
#define JOYPAD_DEFAULT_DRIVER JOYPAD_NULL
#endif
#if defined(HAVE_V4L2)
#define CAMERA_DEFAULT_DRIVER CAMERA_V4L2
#elif defined(EMSCRIPTEN)
#define CAMERA_DEFAULT_DRIVER CAMERA_RWEBCAM
#elif defined(ANDROID)
#define CAMERA_DEFAULT_DRIVER CAMERA_ANDROID
#elif defined(HAVE_AVFOUNDATION) && (defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH))
#define CAMERA_DEFAULT_DRIVER CAMERA_AVFOUNDATION
#else
#define CAMERA_DEFAULT_DRIVER CAMERA_NULL
#endif
#if defined(HAVE_LAKKA)
#define WIFI_DEFAULT_DRIVER WIFI_CONNMANCTL
#else
#define WIFI_DEFAULT_DRIVER WIFI_NULL
#endif
#if defined(ANDROID)
#define LOCATION_DEFAULT_DRIVER LOCATION_ANDROID
#elif defined(HAVE_CORELOCATION) && (defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH))
#define LOCATION_DEFAULT_DRIVER LOCATION_CORELOCATION
#else
#define LOCATION_DEFAULT_DRIVER LOCATION_NULL
#endif
#if defined(__CELLOS_LV2__)
#define OSK_DEFAULT_DRIVER OSK_PS3
#else
#define OSK_DEFAULT_DRIVER OSK_NULL
#endif
#if defined(HAVE_XUI)
#define MENU_DEFAULT_DRIVER MENU_XUI
#elif defined(HAVE_MATERIALUI) && defined(RARCH_MOBILE)
#define MENU_DEFAULT_DRIVER MENU_MATERIALUI
#elif defined(HAVE_XMB)
#define MENU_DEFAULT_DRIVER MENU_XMB
#elif defined(HAVE_RGUI)
#define MENU_DEFAULT_DRIVER MENU_RGUI
#else
#define MENU_DEFAULT_DRIVER MENU_NULL
#endif
#if defined(XENON) || defined(_XBOX360) || defined(__CELLOS_LV2__)
#define DEFAULT_ASPECT_RATIO 1.7778f
#elif defined(_XBOX1) || defined(GEKKO) || defined(ANDROID)
@ -420,8 +48,6 @@ static const bool pointer_enable = true;
static const bool pointer_enable = false;
#endif
/* Certain platforms might have assets stored in the bundle that
* we need to extract to a user-writable directory on first boot.
*
@ -432,8 +58,13 @@ static bool bundle_assets_extract_enable = true;
static bool bundle_assets_extract_enable = false;
#endif
#ifdef HAVE_MATERIALUI
static bool materialui_icons_enable = true;
#endif
static const bool def_history_list_enable = true;
static const bool def_playlist_entry_remove = true;
static const bool def_playlist_entry_rename = true;
static const unsigned int def_user_language = 0;
@ -594,16 +225,45 @@ static unsigned aspect_ratio_idx = ASPECT_RATIO_CORE;
/* Save configuration file on exit. */
static bool config_save_on_exit = true;
static bool show_hidden_files = true;
static bool show_hidden_files = false;
static const bool overlay_hide_in_menu = true;
static const bool display_keyboard_overlay = false;
#ifdef HAVE_MENU
#include "menu/menu_display.h"
#include "menu/menu_driver.h"
static bool default_block_config_read = true;
static bool default_block_config_read = true;
static bool quick_menu_show_take_screenshot = true;
static bool quick_menu_show_save_load_state = true;
static bool quick_menu_show_undo_save_load_state = true;
static bool quick_menu_show_add_to_favorites = true;
static bool quick_menu_show_options = true;
static bool quick_menu_show_controls = true;
static bool quick_menu_show_cheats = true;
static bool quick_menu_show_shaders = true;
static bool quick_menu_show_save_core_overrides = true;
static bool quick_menu_show_save_game_overrides = true;
static bool quick_menu_show_information = true;
static bool kiosk_mode_enable = false;
static bool menu_show_online_updater = true;
static bool menu_show_load_core = true;
static bool menu_show_load_content = true;
static bool menu_show_information = true;
static bool menu_show_configurations = true;
static bool menu_show_help = true;
static bool menu_show_quit_retroarch = true;
static bool menu_show_reboot = true;
#if defined(HAVE_LAKKA) || defined(VITA)
static bool menu_show_core_updater = false;
#else
static bool menu_show_core_updater = true;
#endif
#ifdef HAVE_XMB
static unsigned xmb_scale_factor = 100;
@ -616,11 +276,12 @@ static bool xmb_shadows_enable = false;
static bool xmb_shadows_enable = true;
#endif
static bool xmb_show_settings = true;
static bool xmb_show_favorites = true;
#ifdef HAVE_IMAGEVIEWER
static bool xmb_show_images = true;
#endif
#ifdef HAVE_FFMPEG
static bool xmb_show_music = true;
#ifdef HAVE_FFMPEG
static bool xmb_show_video = true;
#endif
#ifdef HAVE_NETWORKING
@ -632,19 +293,19 @@ static bool xmb_show_add = true;
#endif
#endif
static float menu_framebuffer_opacity = 0.900;
static float menu_wallpaper_opacity = 0.300;
static float menu_footer_opacity = 1.000;
static float menu_header_opacity = 1.000;
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL) || defined(HAVE_VULKAN)
#if defined(HAVE_OPENGLES2) || (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
static unsigned menu_shader_pipeline = 1;
#else
static unsigned menu_shader_pipeline = 2;
#endif
#endif
static bool show_advanced_settings = false;
static const uint32_t menu_entry_normal_color = 0xffffffff;
@ -663,6 +324,11 @@ static bool default_auto_shaders_enable = true;
static bool default_sort_savefiles_enable = false;
static bool default_sort_savestates_enable = false;
static bool default_savestates_in_content_dir = false;
static bool default_savefiles_in_content_dir = false;
static bool default_systemfiles_in_content_dir = false;
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(VITA)
@ -676,6 +342,8 @@ static unsigned input_backtouch_enable = false;
static unsigned input_backtouch_toggle = false;
#endif
static bool show_physical_inputs = true;
static bool all_users_control_menu = false;
#if defined(ANDROID) || defined(_WIN32)
@ -707,6 +375,12 @@ static const float message_pos_offset_y = 0.05;
* RGB hex value. */
static const uint32_t message_color = 0xffff00;
static const bool message_bgcolor_enable = false;
static const uint32_t message_bgcolor_red = 0;
static const uint32_t message_bgcolor_green = 0;
static const uint32_t message_bgcolor_blue = 0;
static const float message_bgcolor_opacity = 1.0f;
/* Record post-filtered (CPU filter) video,
* rather than raw game output. */
static const bool post_filter_record = false;
@ -791,11 +465,24 @@ static const float max_timing_skew = 0.05;
/* Default audio volume in dB. (0.0 dB == unity gain). */
static const float audio_volume = 0.0;
/* Default audio volume of the audio mixer in dB. (0.0 dB == unity gain). */
static const float audio_mixer_volume = 0.0;
#ifdef HAVE_WASAPI
/* WASAPI defaults */
static const bool wasapi_exclusive_mode = true;
static const bool wasapi_float_format = false;
static const int wasapi_sh_buffer_length = -16; /* auto */
#endif
/* MISC */
/* Enables displaying the current frames per second. */
static const bool fps_show = false;
/* Show frame count on FPS display */
static const bool framecount_show = true;
/* Enables use of rewind. This will incur some memory footprint
* depending on the save state buffer. */
static const bool rewind_enable = false;
@ -942,6 +629,8 @@ static const bool ui_companion_enable = false;
#if defined(ANDROID)
#if defined(ANDROID_ARM)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/android/latest/armeabi-v7a/";
#elif defined(ANDROID_AARCH64)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/android/latest/arm64-v8a/";
#elif defined(ANDROID_X86)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/android/latest/x86/";
#else
@ -960,19 +649,37 @@ static char buildbot_server_url[] = "http://bot.libretro.com/nightly/apple/osx/x
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/apple/osx/ppc/latest/";
#endif
#elif defined(_WIN32) && !defined(_XBOX)
#if _MSC_VER == 1600
#if defined(__x86_64__)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/win-x86_64/latest/";
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2010/x86_64/latest/";
#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_IX86) || defined(_M_IA64)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/win-x86/latest/";
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2010/x86/latest/";
#endif
#elif _MSC_VER == 1400
#if defined(__x86_64__)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2005/x86_64/latest/";
#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_IX86) || defined(_M_IA64)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2005/x86/latest/";
#endif
#else
#if defined(__x86_64__)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows/x86_64/latest/";
#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_IX86) || defined(_M_IA64)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows/x86/latest/";
#endif
#endif
#elif defined(__linux__)
#if defined(__x86_64__)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/linux/x86_64/latest/";
#elif defined(__i386__) || defined(__i486__) || defined(__i686__)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/linux/x86/latest/";
#elif defined(__arm__) && __ARM_ARCH == 7 && defined(__ARM_PCS_VFP)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/linux/armhf/latest/";
#else
static char buildbot_server_url[] = "";
#endif
#elif defined(WIIU)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/nintendo/wiiu/latest/";
#else
static char buildbot_server_url[] = "";
#endif

View File

@ -134,6 +134,12 @@ static const bool _alsa_supp = true;
static const bool _alsa_supp = false;
#endif
#ifdef HAVE_TINYALSA
static const bool _tinyalsa_supp = true;
#else
static const bool _tinyalsa_supp = false;
#endif
#ifdef HAVE_COREAUDIO
static const bool _coreaudio_supp = true;
#else
@ -194,6 +200,12 @@ static const bool _dsound_supp = true;
static const bool _dsound_supp = false;
#endif
#ifdef HAVE_WASAPI
static const bool _wasapi_supp = true;
#else
static const bool _wasapi_supp = false;
#endif
#ifdef HAVE_XAUDIO
static const bool _xaudio_supp = true;
#else
@ -248,12 +260,6 @@ static const bool _sdl_image_supp = true;
static const bool _sdl_image_supp = false;
#endif
#ifdef HAVE_FBO
static const bool _fbo_supp = true;
#else
static const bool _fbo_supp = false;
#endif
#ifdef HAVE_DYNAMIC
static const bool _dynamic_supp = true;
#else

File diff suppressed because it is too large Load Diff

View File

@ -23,14 +23,28 @@
#include <boolean.h>
#include <retro_common_api.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <retro_miscellaneous.h>
#include "gfx/video_driver.h"
#include "input/input_defines.h"
#define configuration_set_float(settings, var, newvar) \
settings->modified = true; \
var = newvar
#define configuration_set_bool(settings, var, newvar) \
settings->modified = true; \
var = newvar
#define configuration_set_uint(settings, var, newvar) \
settings->modified = true; \
var = newvar
#define configuration_set_int(settings, var, newvar) \
settings->modified = true; \
var = newvar
enum override_type
{
OVERRIDE_NONE = 0,
@ -42,446 +56,400 @@ RETRO_BEGIN_DECLS
typedef struct settings
{
video_viewport_t video_viewport_custom;
char playlist_names[PATH_MAX_LENGTH];
char playlist_cores[PATH_MAX_LENGTH];
bool bundle_finished;
struct
{
char driver[32];
char context_driver[32];
float scale;
unsigned window_x;
unsigned window_y;
bool fullscreen;
bool windowed_fullscreen;
unsigned monitor_index;
unsigned fullscreen_x;
unsigned fullscreen_y;
bool vsync;
bool hard_sync;
bool black_frame_insertion;
unsigned max_swapchain_images;
unsigned swap_interval;
unsigned hard_sync_frames;
unsigned frame_delay;
#ifdef GEKKO
unsigned viwidth;
bool vfilter;
#endif
bool smooth;
bool force_aspect;
bool crop_overscan;
float aspect_ratio;
bool aspect_ratio_auto;
bool scale_integer;
unsigned aspect_ratio_idx;
unsigned rotation;
bool placeholder;
bool shader_enable;
/* Video */
bool video_fullscreen;
bool video_windowed_fullscreen;
bool video_vsync;
bool video_hard_sync;
bool video_black_frame_insertion;
bool video_vfilter;
bool video_smooth;
bool video_force_aspect;
bool video_crop_overscan;
bool video_aspect_ratio_auto;
bool video_scale_integer;
bool video_shader_enable;
bool video_threaded;
bool video_font_enable;
bool video_disable_composition;
bool video_post_filter_record;
bool video_gpu_record;
bool video_gpu_screenshot;
bool video_allow_rotate;
bool video_shared_context;
bool video_force_srgb_disable;
bool video_fps_show;
bool video_framecount_show;
bool video_msg_bgcolor_enable;
float refresh_rate;
bool threaded;
/* Audio */
bool audio_enable;
bool audio_sync;
bool audio_rate_control;
bool audio_wasapi_exclusive_mode;
bool audio_wasapi_float_format;
float font_size;
bool font_enable;
float msg_pos_x;
float msg_pos_y;
float msg_color_r;
float msg_color_g;
float msg_color_b;
bool disable_composition;
bool post_filter_record;
bool gpu_record;
bool gpu_screenshot;
bool allow_rotate;
bool shared_context;
bool force_srgb_disable;
} video;
struct
{
char driver[32];
} record;
struct
{
bool menubar_enable;
bool suspend_screensaver_enable;
bool companion_start_on_boot;
bool companion_enable;
} ui;
#ifdef HAVE_MENU
struct
{
char driver[32];
bool pause_libretro;
bool timedate_enable;
bool battery_level_enable;
bool core_enable;
bool dynamic_wallpaper_enable;
unsigned thumbnails;
bool throttle;
struct
{
float opacity;
} wallpaper;
struct
{
float opacity;
} footer;
struct
{
float opacity;
} header;
struct
{
bool enable;
} mouse;
struct
{
bool enable;
} pointer;
struct
{
struct
{
bool enable;
} wraparound;
struct
{
struct
{
bool supported_extensions_enable;
} filter;
} browser;
} navigation;
struct
{
bool override_enable;
unsigned override_value;
} dpi;
bool show_advanced_settings;
unsigned entry_normal_color;
unsigned entry_hover_color;
unsigned title_color;
bool throttle_framerate;
bool linear_filter;
struct
{
unsigned shader_pipeline;
char font[PATH_MAX_LENGTH];
unsigned scale_factor;
unsigned alpha_factor;
unsigned theme;
unsigned menu_color_theme;
bool shadows_enable;
bool show_settings;
bool show_images;
bool show_music;
bool show_video;
bool show_netplay;
bool show_history;
bool show_add;
} xmb;
struct
{
unsigned menu_color_theme;
} materialui;
bool unified_controls;
} menu;
#endif
#ifdef HAVE_THREADS
bool threaded_data_runloop_enable;
#endif
struct
{
char driver[32];
char device[255];
bool allow;
unsigned width;
unsigned height;
} camera;
struct
{
char driver[32];
bool allow;
} wifi;
struct
{
char driver[32];
bool allow;
int update_interval_ms;
int update_interval_distance;
} location;
struct
{
char driver[32];
char resampler[32];
char device[255];
bool enable;
bool mute_enable;
unsigned out_rate;
unsigned block_frames;
unsigned latency;
bool sync;
bool rate_control;
float rate_control_delta;
float max_timing_skew;
float volume; /* dB scale. */
} audio;
struct
{
char driver[32];
char joypad_driver[32];
char keyboard_layout[64];
char device_names[MAX_USERS][64];
unsigned remap_ids[MAX_USERS][RARCH_BIND_LIST_END];
struct retro_keybind binds[MAX_USERS][RARCH_BIND_LIST_END];
struct retro_keybind autoconf_binds[MAX_USERS][RARCH_BIND_LIST_END];
unsigned max_users;
/* Set by autoconfiguration in joypad_autoconfig_dir.
* Does not override main binds. */
bool autoconfigured[MAX_USERS];
int vid[MAX_USERS];
int pid[MAX_USERS];
unsigned libretro_device[MAX_USERS];
unsigned analog_dpad_mode[MAX_USERS];
bool remap_binds_enable;
float axis_threshold;
unsigned joypad_map[MAX_USERS];
unsigned device[MAX_USERS];
unsigned device_name_index[MAX_USERS];
bool autodetect_enable;
unsigned turbo_period;
unsigned turbo_duty_cycle;
bool overlay_enable;
bool overlay_enable_autopreferred;
bool overlay_hide_in_menu;
float overlay_opacity;
float overlay_scale;
unsigned bind_timeout;
/* Input */
bool input_remap_binds_enable;
bool input_autodetect_enable;
bool input_overlay_enable;
bool input_overlay_enable_autopreferred;
bool input_overlay_hide_in_menu;
bool input_overlay_show_physical_inputs;
bool input_descriptor_label_show;
bool input_descriptor_hide_unbound;
bool input_all_users_control_menu;
bool input_menu_swap_ok_cancel_buttons;
bool input_backtouch_enable;
bool input_backtouch_toggle;
bool input_small_keyboard_enable;
bool input_keyboard_gamepad_enable;
unsigned menu_toggle_gamepad_combo;
bool all_users_control_menu;
/* Menu */
bool filter_by_current_core;
bool menu_show_start_screen;
bool menu_pause_libretro;
bool menu_timedate_enable;
bool menu_battery_level_enable;
bool menu_core_enable;
bool menu_dynamic_wallpaper_enable;
bool menu_throttle;
bool menu_mouse_enable;
bool menu_pointer_enable;
bool menu_navigation_wraparound_enable;
bool menu_navigation_browser_filter_supported_extensions_enable;
bool menu_dpi_override_enable;
bool menu_show_advanced_settings;
bool menu_throttle_framerate;
bool menu_linear_filter;
bool menu_horizontal_animation;
bool menu_show_online_updater;
bool menu_show_core_updater;
bool menu_show_load_core;
bool menu_show_load_content;
bool menu_show_information;
bool menu_show_configurations;
bool menu_show_help;
bool menu_show_quit_retroarch;
bool menu_show_reboot;
bool menu_materialui_icons_enable;
bool menu_xmb_shadows_enable;
bool menu_xmb_show_settings;
bool menu_xmb_show_favorites;
bool menu_xmb_show_images;
bool menu_xmb_show_music;
bool menu_xmb_show_video;
bool menu_xmb_show_netplay;
bool menu_xmb_show_history;
bool menu_xmb_show_add;
bool menu_unified_controls;
bool quick_menu_show_take_screenshot;
bool quick_menu_show_save_load_state;
bool quick_menu_show_undo_save_load_state;
bool quick_menu_show_add_to_favorites;
bool quick_menu_show_options;
bool quick_menu_show_controls;
bool quick_menu_show_cheats;
bool quick_menu_show_shaders;
bool quick_menu_show_save_core_overrides;
bool quick_menu_show_save_game_overrides;
bool quick_menu_show_information;
bool kiosk_mode_enable;
bool menu_swap_ok_cancel_buttons;
#if defined(VITA)
bool backtouch_enable;
bool backtouch_toggle;
#endif
#if TARGET_OS_IPHONE
bool small_keyboard_enable;
#endif
bool keyboard_gamepad_enable;
unsigned keyboard_gamepad_mapping_type;
unsigned poll_type_behavior;
} input;
/* Netplay */
bool netplay_public_announce;
bool netplay_start_as_spectator;
bool netplay_allow_slaves;
bool netplay_require_slaves;
bool netplay_stateless_mode;
bool netplay_swap_input;
bool netplay_nat_traversal;
bool netplay_use_mitm_server;
/* Network */
bool network_buildbot_auto_extract_archive;
/* UI */
bool ui_menubar_enable;
bool ui_suspend_screensaver_enable;
bool ui_companion_start_on_boot;
bool ui_companion_enable;
/* Cheevos */
bool cheevos_enable;
bool cheevos_test_unofficial;
bool cheevos_hardcore_mode_enable;
bool cheevos_leaderboards_enable;
bool cheevos_verbose_enable;
/* Camera */
bool camera_allow;
/* WiFi */
bool wifi_allow;
/* Location */
bool location_allow;
/* Multimedia */
bool multimedia_builtin_mediaplayer_enable;
bool multimedia_builtin_imageviewer_enable;
/* Bundle */
bool bundle_finished;
bool bundle_assets_extract_enable;
/* Misc. */
bool threaded_data_runloop_enable;
bool set_supports_no_game_enable;
bool auto_screenshot_filename;
bool history_list_enable;
bool playlist_entry_remove;
bool playlist_entry_rename;
bool rewind_enable;
bool pause_nonactive;
bool block_sram_overwrite;
bool savestate_auto_index;
bool savestate_auto_save;
bool savestate_auto_load;
bool savestate_thumbnail_enable;
bool network_cmd_enable;
bool stdin_cmd_enable;
bool keymapper_enable;
bool network_remote_enable;
bool network_remote_enable_user[MAX_USERS];
bool load_dummy_on_core_shutdown;
bool check_firmware_before_loading;
bool game_specific_options;
bool auto_overrides_enable;
bool auto_remaps_enable;
bool auto_shaders_enable;
bool sort_savefiles_enable;
bool sort_savestates_enable;
bool config_save_on_exit;
bool show_hidden_files;
bool savefiles_in_content_dir;
bool savestates_in_content_dir;
bool screenshots_in_content_dir;
bool systemfiles_in_content_dir;
bool ssh_enable;
bool samba_enable;
bool bluetooth_enable;
} bools;
struct
{
unsigned mode;
} archive;
float placeholder;
float video_scale;
float video_aspect_ratio;
float video_refresh_rate;
float video_font_size;
float video_msg_pos_x;
float video_msg_pos_y;
float video_msg_color_r;
float video_msg_color_g;
float video_msg_color_b;
float video_msg_bgcolor_opacity;
float menu_wallpaper_opacity;
float menu_framebuffer_opacity;
float menu_footer_opacity;
float menu_header_opacity;
float audio_max_timing_skew;
float audio_volume; /* dB scale. */
float audio_mixer_volume; /* dB scale. */
float input_overlay_opacity;
float input_overlay_scale;
float slowmotion_ratio;
float fastforward_ratio;
} floats;
struct
{
char buildbot_url[255];
char buildbot_assets_url[255];
bool buildbot_auto_extract_archive;
} network;
bool set_supports_no_game_enable;
int placeholder;
int netplay_check_frames;
int location_update_interval_ms;
int location_update_interval_distance;
int state_slot;
int audio_wasapi_sh_buffer_length;
} ints;
struct
{
bool builtin_mediaplayer_enable;
bool builtin_imageviewer_enable;
} multimedia;
unsigned placeholder;
unsigned audio_out_rate;
unsigned audio_block_frames;
unsigned audio_latency;
#ifdef HAVE_CHEEVOS
struct
{
bool enable;
bool test_unofficial;
bool hardcore_mode_enable;
char username[32];
char password[32];
} cheevos;
#endif
char browse_url[4096];
int state_slot;
unsigned input_turbo_period;
unsigned input_turbo_duty_cycle;
bool bundle_assets_extract_enable;
unsigned bundle_assets_extract_version_current;
unsigned bundle_assets_extract_last_version;
unsigned input_bind_timeout;
unsigned input_menu_toggle_gamepad_combo;
unsigned input_keyboard_gamepad_mapping_type;
unsigned input_poll_type_behavior;
unsigned netplay_port;
unsigned netplay_input_latency_frames_min;
unsigned netplay_input_latency_frames_range;
unsigned bundle_assets_extract_version_current;
unsigned bundle_assets_extract_last_version;
unsigned content_history_size;
unsigned libretro_log_level;
unsigned rewind_granularity;
unsigned autosave_interval;
unsigned network_cmd_port;
unsigned network_remote_base_port;
unsigned keymapper_port;
unsigned video_window_x;
unsigned video_window_y;
unsigned video_monitor_index;
unsigned video_fullscreen_x;
unsigned video_fullscreen_y;
unsigned video_max_swapchain_images;
unsigned video_swap_interval;
unsigned video_hard_sync_frames;
unsigned video_frame_delay;
unsigned video_viwidth;
unsigned video_aspect_ratio_idx;
unsigned video_rotation;
unsigned video_msg_bgcolor_red;
unsigned video_msg_bgcolor_green;
unsigned video_msg_bgcolor_blue;
unsigned menu_thumbnails;
unsigned menu_dpi_override_value;
unsigned menu_entry_normal_color;
unsigned menu_entry_hover_color;
unsigned menu_title_color;
unsigned menu_xmb_shader_pipeline;
unsigned menu_xmb_scale_factor;
unsigned menu_xmb_alpha_factor;
unsigned menu_xmb_theme;
unsigned menu_xmb_color_theme;
unsigned menu_materialui_color_theme;
unsigned camera_width;
unsigned camera_height;
unsigned input_overlay_show_physical_inputs_port;
unsigned input_joypad_map[MAX_USERS];
unsigned input_device[MAX_USERS];
unsigned input_mouse_index[MAX_USERS];
/* Set by autoconfiguration in joypad_autoconfig_dir.
* Does not override main binds. */
unsigned input_libretro_device[MAX_USERS];
unsigned input_analog_dpad_mode[MAX_USERS];
unsigned input_keymapper_ids[RARCH_CUSTOM_BIND_LIST_END];
unsigned input_remap_ids[MAX_USERS][RARCH_CUSTOM_BIND_LIST_END];
} uints;
struct
{
char cheat_database[PATH_MAX_LENGTH];
char content_database[PATH_MAX_LENGTH];
char overlay[PATH_MAX_LENGTH];
char menu_wallpaper[PATH_MAX_LENGTH];
char audio_dsp_plugin[PATH_MAX_LENGTH];
char softfilter_plugin[PATH_MAX_LENGTH];
char core_options[PATH_MAX_LENGTH];
char content_history[PATH_MAX_LENGTH];
char content_music_history[PATH_MAX_LENGTH];
char content_image_history[PATH_MAX_LENGTH];
char content_video_history[PATH_MAX_LENGTH];
char libretro_info[PATH_MAX_LENGTH];
char cheat_settings[PATH_MAX_LENGTH];
char placeholder;
char video_driver[32];
char record_driver[32];
char camera_driver[32];
char wifi_driver[32];
char location_driver[32];
char menu_driver[32];
char cheevos_username[32];
char cheevos_password[32];
char video_context_driver[32];
char audio_driver[32];
char audio_resampler[32];
char input_driver[32];
char input_joypad_driver[32];
char input_keyboard_layout[64];
char audio_device[255];
char camera_device[255];
char playlist_names[PATH_MAX_LENGTH];
char playlist_cores[PATH_MAX_LENGTH];
char bundle_assets_src[PATH_MAX_LENGTH];
char bundle_assets_dst[PATH_MAX_LENGTH];
char bundle_assets_dst_subdir[PATH_MAX_LENGTH];
char shader[PATH_MAX_LENGTH];
char font[PATH_MAX_LENGTH];
} path;
} arrays;
struct
{
char audio_filter[PATH_MAX_LENGTH];
char autoconfig[PATH_MAX_LENGTH];
char video_filter[PATH_MAX_LENGTH];
char video_shader[PATH_MAX_LENGTH];
char content_history[PATH_MAX_LENGTH];
char libretro[PATH_MAX_LENGTH];
char cursor[PATH_MAX_LENGTH];
char input_remapping[PATH_MAX_LENGTH];
char overlay[PATH_MAX_LENGTH];
char resampler[PATH_MAX_LENGTH];
char screenshot[PATH_MAX_LENGTH];
char system[PATH_MAX_LENGTH];
char cache[PATH_MAX_LENGTH];
char playlist[PATH_MAX_LENGTH];
char core_assets[PATH_MAX_LENGTH];
char assets[PATH_MAX_LENGTH];
char dynamic_wallpapers[PATH_MAX_LENGTH];
char thumbnails[PATH_MAX_LENGTH];
char menu_config[PATH_MAX_LENGTH];
char menu_content[PATH_MAX_LENGTH];
} directory;
char placeholder;
#ifdef HAVE_NETWORKING
struct
{
bool public_announce;
char server[255];
unsigned port;
bool start_as_spectator;
bool allow_slaves;
bool require_slaves;
bool stateless_mode;
int check_frames;
unsigned input_latency_frames_min;
unsigned input_latency_frames_range;
bool swap_input;
bool nat_traversal;
char password[128];
char spectate_password[128];
bool use_mitm_server;
} netplay;
#endif
char username[32];
char netplay_password[128];
char netplay_spectate_password[128];
char netplay_server[255];
char network_buildbot_url[255];
char network_buildbot_assets_url[255];
char browse_url[4096];
unsigned content_history_size;
char path_menu_xmb_font[PATH_MAX_LENGTH];
char menu_xmb_show_settings_password[PATH_MAX_LENGTH];
char kiosk_mode_password[PATH_MAX_LENGTH];
char path_cheat_database[PATH_MAX_LENGTH];
char path_content_database[PATH_MAX_LENGTH];
char path_overlay[PATH_MAX_LENGTH];
char path_menu_wallpaper[PATH_MAX_LENGTH];
char path_audio_dsp_plugin[PATH_MAX_LENGTH];
char path_softfilter_plugin[PATH_MAX_LENGTH];
char path_core_options[PATH_MAX_LENGTH];
char path_content_history[PATH_MAX_LENGTH];
char path_content_favorites[PATH_MAX_LENGTH];
char path_content_music_history[PATH_MAX_LENGTH];
char path_content_image_history[PATH_MAX_LENGTH];
char path_content_video_history[PATH_MAX_LENGTH];
char path_libretro_info[PATH_MAX_LENGTH];
char path_cheat_settings[PATH_MAX_LENGTH];
char path_shader[PATH_MAX_LENGTH];
char path_font[PATH_MAX_LENGTH];
unsigned libretro_log_level;
bool auto_screenshot_filename;
char directory_audio_filter[PATH_MAX_LENGTH];
char directory_autoconfig[PATH_MAX_LENGTH];
char directory_video_filter[PATH_MAX_LENGTH];
char directory_video_shader[PATH_MAX_LENGTH];
char directory_content_history[PATH_MAX_LENGTH];
char directory_content_favorites[PATH_MAX_LENGTH];
char directory_libretro[PATH_MAX_LENGTH];
char directory_cursor[PATH_MAX_LENGTH];
char directory_input_remapping[PATH_MAX_LENGTH];
char directory_overlay[PATH_MAX_LENGTH];
char directory_resampler[PATH_MAX_LENGTH];
char directory_screenshot[PATH_MAX_LENGTH];
char directory_system[PATH_MAX_LENGTH];
char directory_cache[PATH_MAX_LENGTH];
char directory_playlist[PATH_MAX_LENGTH];
char directory_core_assets[PATH_MAX_LENGTH];
char directory_assets[PATH_MAX_LENGTH];
char directory_dynamic_wallpapers[PATH_MAX_LENGTH];
char directory_thumbnails[PATH_MAX_LENGTH];
char directory_menu_config[PATH_MAX_LENGTH];
char directory_menu_content[PATH_MAX_LENGTH];
} paths;
bool modified;
video_viewport_t video_viewport_custom;
bool history_list_enable;
bool playlist_entry_remove;
bool rewind_enable;
size_t rewind_buffer_size;
unsigned rewind_granularity;
float slowmotion_ratio;
float fastforward_ratio;
bool pause_nonactive;
unsigned autosave_interval;
bool block_sram_overwrite;
bool savestate_auto_index;
bool savestate_auto_save;
bool savestate_auto_load;
bool savestate_thumbnail_enable;
bool network_cmd_enable;
unsigned network_cmd_port;
bool stdin_cmd_enable;
bool network_remote_enable;
bool network_remote_enable_user[MAX_USERS];
unsigned network_remote_base_port;
#if defined(HAVE_MENU)
bool menu_show_start_screen;
#endif
bool fps_show;
bool load_dummy_on_core_shutdown;
bool check_firmware_before_loading;
bool game_specific_options;
bool auto_overrides_enable;
bool auto_remaps_enable;
bool auto_shaders_enable;
bool sort_savefiles_enable;
bool sort_savestates_enable;
char username[32];
#ifdef HAVE_LANGEXTRA
unsigned int user_language;
#endif
bool config_save_on_exit;
bool show_hidden_files;
#ifdef HAVE_LAKKA
bool ssh_enable;
bool samba_enable;
bool bluetooth_enable;
#endif
} settings_t;
/**
@ -556,7 +524,6 @@ const char *config_get_default_input(void);
**/
const char *config_get_default_joypad(void);
#ifdef HAVE_MENU
/**
* config_get_default_menu:
*
@ -565,7 +532,6 @@ const char *config_get_default_joypad(void);
* Returns: Default menu driver.
**/
const char *config_get_default_menu(void);
#endif
const char *config_get_default_record(void);

View File

@ -66,7 +66,7 @@ void content_set_does_not_need_content(void);
void content_unset_does_not_need_content(void);
bool content_get_crc(uint32_t **content_crc_ptr);
uint32_t content_get_crc(void);
void content_deinit(void);

17
core.h
View File

@ -60,6 +60,7 @@ typedef struct rarch_system_info
unsigned rotation;
unsigned performance_level;
bool load_no_content;
const char *input_desc_btn[MAX_USERS][RARCH_FIRST_META_KEY];
char valid_extensions[255];
@ -141,14 +142,6 @@ typedef struct retro_ctx_environ_info
retro_environment_t env;
} retro_ctx_environ_info_t;
typedef struct retro_ctx_frame_info
{
const void *data;
unsigned width;
unsigned height;
size_t pitch;
} retro_ctx_frame_info_t;
typedef struct retro_callbacks
{
retro_video_refresh_t frame_cb;
@ -162,7 +155,7 @@ bool core_load(unsigned poll_type_behavior);
bool core_unload(void);
bool core_set_default_callbacks(void *data);
bool core_set_default_callbacks(struct retro_callbacks *cbs);
bool core_set_rewind_callbacks(void);
@ -185,10 +178,6 @@ bool core_unload_game(void);
bool core_reset(void);
void core_frame(retro_ctx_frame_info_t *info);
bool core_poll(void);
bool core_set_environment(retro_ctx_environ_info_t *info);
bool core_serialize_size(retro_ctx_size_info_t *info);
@ -249,6 +238,8 @@ bool core_is_inited(void);
bool core_is_game_loaded(void);
extern struct retro_callbacks retro_ctx;
RETRO_END_DECLS
#endif

View File

@ -44,39 +44,44 @@
#include "gfx/video_driver.h"
#include "audio/audio_driver.h"
static unsigned core_poll_type = POLL_TYPE_EARLY;
static bool core_inited = false;
static bool core_symbols_inited = false;
static bool core_game_loaded = false;
static bool core_input_polled = false;
static bool core_has_set_input_descriptors = false;
static uint64_t core_serialization_quirks_v = 0;
struct retro_callbacks retro_ctx;
struct retro_core_t current_core;
static struct retro_callbacks retro_ctx;
static struct retro_core_t core;
static void retro_run_null(void)
{
}
static void retro_frame_null(const void *data, unsigned width,
unsigned height, size_t pitch)
{
}
static void retro_input_poll_null(void)
{
}
static void core_input_state_poll_maybe(void)
{
if (core_poll_type == POLL_TYPE_NORMAL)
if (current_core.poll_type == POLL_TYPE_NORMAL)
input_poll();
}
static int16_t core_input_state_poll(unsigned port,
unsigned device, unsigned idx, unsigned id)
{
if (core_poll_type == POLL_TYPE_LATE)
if (current_core.poll_type == POLL_TYPE_LATE)
{
if (!core_input_polled)
if (!current_core.input_polled)
input_poll();
core_input_polled = true;
current_core.input_polled = true;
}
return input_state(port, device, idx, id);
}
void core_set_input_state(retro_ctx_input_state_info_t *info)
{
core.retro_set_input_state(info->cb);
current_core.retro_set_input_state(info->cb);
}
/**
@ -86,18 +91,13 @@ void core_set_input_state(retro_ctx_input_state_info_t *info)
* Initializes libretro callbacks, and binds the libretro callbacks
* to default callback functions.
**/
static bool core_init_libretro_cbs(void *data)
static bool core_init_libretro_cbs(struct retro_callbacks *cbs)
{
struct retro_callbacks *cbs = (struct retro_callbacks*)data;
if (!cbs)
return false;
core.retro_set_video_refresh(video_driver_frame);
core.retro_set_audio_sample(audio_driver_sample);
core.retro_set_audio_sample_batch(audio_driver_sample_batch);
core.retro_set_input_state(core_input_state_poll);
core.retro_set_input_poll(core_input_state_poll_maybe);
current_core.retro_set_video_refresh(video_driver_frame);
current_core.retro_set_audio_sample(audio_driver_sample);
current_core.retro_set_audio_sample_batch(audio_driver_sample_batch);
current_core.retro_set_input_state(core_input_state_poll);
current_core.retro_set_input_poll(core_input_state_poll_maybe);
core_set_default_callbacks(cbs);
@ -117,13 +117,8 @@ static bool core_init_libretro_cbs(void *data)
*
* Binds the libretro callbacks to default callback functions.
**/
bool core_set_default_callbacks(void *data)
bool core_set_default_callbacks(struct retro_callbacks *cbs)
{
struct retro_callbacks *cbs = (struct retro_callbacks*)data;
if (!cbs)
return false;
cbs->frame_cb = video_driver_frame;
cbs->sample_cb = audio_driver_sample;
cbs->sample_batch_cb = audio_driver_sample_batch;
@ -141,13 +136,13 @@ bool core_deinit(void *data)
if (!cbs)
return false;
cbs->frame_cb = NULL;
cbs->frame_cb = retro_frame_null;
cbs->sample_cb = NULL;
cbs->sample_batch_cb = NULL;
cbs->state_cb = NULL;
cbs->poll_cb = NULL;
cbs->poll_cb = retro_input_poll_null;
core_inited = false;
current_core.inited = false;
return true;
}
@ -167,13 +162,13 @@ bool core_set_rewind_callbacks(void)
{
if (state_manager_frame_is_reversed())
{
core.retro_set_audio_sample(audio_driver_sample_rewind);
core.retro_set_audio_sample_batch(audio_driver_sample_batch_rewind);
current_core.retro_set_audio_sample(audio_driver_sample_rewind);
current_core.retro_set_audio_sample_batch(audio_driver_sample_batch_rewind);
}
else
{
core.retro_set_audio_sample(audio_driver_sample);
core.retro_set_audio_sample_batch(audio_driver_sample_batch);
current_core.retro_set_audio_sample(audio_driver_sample);
current_core.retro_set_audio_sample_batch(audio_driver_sample_batch);
}
return true;
}
@ -188,13 +183,13 @@ bool core_set_rewind_callbacks(void)
bool core_set_netplay_callbacks(void)
{
/* Force normal poll type for netplay. */
core_poll_type = POLL_TYPE_NORMAL;
current_core.poll_type = POLL_TYPE_NORMAL;
/* And use netplay's interceding callbacks */
core.retro_set_video_refresh(video_frame_net);
core.retro_set_audio_sample(audio_sample_net);
core.retro_set_audio_sample_batch(audio_sample_batch_net);
core.retro_set_input_state(input_state_net);
current_core.retro_set_video_refresh(video_frame_net);
current_core.retro_set_audio_sample(audio_sample_net);
current_core.retro_set_audio_sample_batch(audio_sample_batch_net);
current_core.retro_set_input_state(input_state_net);
return true;
}
@ -211,10 +206,10 @@ bool core_unset_netplay_callbacks(void)
if (!core_set_default_callbacks(&cbs))
return false;
core.retro_set_video_refresh(cbs.frame_cb);
core.retro_set_audio_sample(cbs.sample_cb);
core.retro_set_audio_sample_batch(cbs.sample_batch_cb);
core.retro_set_input_state(cbs.state_cb);
current_core.retro_set_video_refresh(cbs.frame_cb);
current_core.retro_set_audio_sample(cbs.sample_cb);
current_core.retro_set_audio_sample_batch(cbs.sample_batch_cb);
current_core.retro_set_input_state(cbs.state_cb);
return true;
}
@ -222,13 +217,13 @@ bool core_unset_netplay_callbacks(void)
bool core_set_cheat(retro_ctx_cheat_info_t *info)
{
core.retro_cheat_set(info->index, info->enabled, info->code);
current_core.retro_cheat_set(info->index, info->enabled, info->code);
return true;
}
bool core_reset_cheat(void)
{
core.retro_cheat_reset();
current_core.retro_cheat_reset();
return true;
}
@ -236,29 +231,30 @@ bool core_api_version(retro_ctx_api_info_t *api)
{
if (!api)
return false;
api->version = core.retro_api_version();
api->version = current_core.retro_api_version();
return true;
}
bool core_set_poll_type(unsigned *type)
{
core_poll_type = *type;
current_core.poll_type = *type;
return true;
}
void core_uninit_symbols(void)
{
uninit_libretro_sym(&core);
core_symbols_inited = false;
uninit_libretro_sym(&current_core);
current_core.symbols_inited = false;
}
bool core_init_symbols(enum rarch_core_type *type)
{
if (!type)
if (!type || !init_libretro_sym(*type, &current_core))
return false;
if (!init_libretro_sym(*type, &core))
return false;
core_symbols_inited = true;
if (!current_core.retro_run)
current_core.retro_run = retro_run_null;
current_core.symbols_inited = true;
return true;
}
@ -266,7 +262,7 @@ bool core_set_controller_port_device(retro_ctx_controller_info_t *pad)
{
if (!pad)
return false;
core.retro_set_controller_port_device(pad->port, pad->device);
current_core.retro_set_controller_port_device(pad->port, pad->device);
return true;
}
@ -274,8 +270,8 @@ bool core_get_memory(retro_ctx_memory_info_t *info)
{
if (!info)
return false;
info->size = core.retro_get_memory_size(info->id);
info->data = core.retro_get_memory_data(info->id);
info->size = current_core.retro_get_memory_size(info->id);
info->data = current_core.retro_get_memory_data(info->id);
return true;
}
@ -287,31 +283,29 @@ bool core_load_game(retro_ctx_load_content_info_t *load_info)
content_get_status(&contentless, &is_inited);
if (load_info && load_info->special)
core_game_loaded = core.retro_load_game_special(
current_core.game_loaded = current_core.retro_load_game_special(
load_info->special->id, load_info->info, load_info->content->size);
else if (load_info && !string_is_empty(load_info->content->elems[0].data))
core_game_loaded = core.retro_load_game(load_info->info);
current_core.game_loaded = current_core.retro_load_game(load_info->info);
else if (contentless)
core_game_loaded = core.retro_load_game(NULL);
current_core.game_loaded = current_core.retro_load_game(NULL);
else
core_game_loaded = false;
current_core.game_loaded = false;
return core_game_loaded;
return current_core.game_loaded;
}
bool core_get_system_info(struct retro_system_info *system)
{
if (!system)
return false;
core.retro_get_system_info(system);
current_core.retro_get_system_info(system);
return true;
}
bool core_unserialize(retro_ctx_serialize_info_t *info)
{
if (!info)
return false;
if (!core.retro_unserialize(info->data_const, info->size))
if (!info || !current_core.retro_unserialize(info->data_const, info->size))
return false;
#if HAVE_NETWORKING
@ -323,9 +317,7 @@ bool core_unserialize(retro_ctx_serialize_info_t *info)
bool core_serialize(retro_ctx_serialize_info_t *info)
{
if (!info)
return false;
if (!core.retro_serialize(info->data, info->size))
if (!info || !current_core.retro_serialize(info->data, info->size))
return false;
return true;
}
@ -334,40 +326,25 @@ bool core_serialize_size(retro_ctx_size_info_t *info)
{
if (!info)
return false;
info->size = core.retro_serialize_size();
info->size = current_core.retro_serialize_size();
return true;
}
uint64_t core_serialization_quirks(void)
{
return core_serialization_quirks_v;
return current_core.serialization_quirks_v;
}
void core_set_serialization_quirks(uint64_t quirks)
{
core_serialization_quirks_v = quirks;
}
void core_frame(retro_ctx_frame_info_t *info)
{
if (retro_ctx.frame_cb)
retro_ctx.frame_cb(
info->data, info->width, info->height, info->pitch);
}
bool core_poll(void)
{
if (!retro_ctx.poll_cb)
return false;
retro_ctx.poll_cb();
return true;
current_core.serialization_quirks_v = quirks;
}
bool core_set_environment(retro_ctx_environ_info_t *info)
{
if (!info)
return false;
core.retro_set_environment(info->env);
current_core.retro_set_environment(info->env);
return true;
}
@ -375,26 +352,26 @@ bool core_get_system_av_info(struct retro_system_av_info *av_info)
{
if (!av_info)
return false;
core.retro_get_system_av_info(av_info);
current_core.retro_get_system_av_info(av_info);
return true;
}
bool core_reset(void)
{
core.retro_reset();
current_core.retro_reset();
return true;
}
bool core_init(void)
{
core.retro_init();
core_inited = true;
current_core.retro_init();
current_core.inited = true;
return true;
}
bool core_unload(void)
{
core.retro_deinit();
current_core.retro_deinit();
return true;
}
@ -403,8 +380,10 @@ bool core_unload_game(void)
{
video_driver_free_hw_context();
audio_driver_stop();
core.retro_unload_game();
core_game_loaded = false;
current_core.retro_unload_game();
current_core.game_loaded = false;
return true;
}
@ -421,21 +400,21 @@ bool core_run(void)
}
#endif
switch (core_poll_type)
switch (current_core.poll_type)
{
case POLL_TYPE_EARLY:
input_poll();
break;
case POLL_TYPE_LATE:
core_input_polled = false;
current_core.input_polled = false;
break;
default:
break;
}
if (core.retro_run)
core.retro_run();
if (core_poll_type == POLL_TYPE_LATE && !core_input_polled)
current_core.retro_run();
if (current_core.poll_type == POLL_TYPE_LATE && !current_core.input_polled)
input_poll();
#ifdef HAVE_NETWORKING
@ -447,7 +426,7 @@ bool core_run(void)
bool core_load(unsigned poll_type_behavior)
{
core_poll_type = poll_type_behavior;
current_core.poll_type = poll_type_behavior;
if (!core_verify_api_version())
return false;
@ -461,7 +440,7 @@ bool core_load(unsigned poll_type_behavior)
bool core_verify_api_version(void)
{
unsigned api_version = core.retro_api_version();
unsigned api_version = current_core.retro_api_version();
RARCH_LOG("%s: %u\n",
msg_hash_to_str(MSG_VERSION_OF_LIBRETRO_API),
api_version);
@ -481,36 +460,36 @@ bool core_get_region(retro_ctx_region_info_t *info)
{
if (!info)
return false;
info->region = core.retro_get_region();
info->region = current_core.retro_get_region();
return true;
}
bool core_has_set_input_descriptor(void)
{
return core_has_set_input_descriptors;
return current_core.has_set_input_descriptors;
}
void core_set_input_descriptors(void)
{
core_has_set_input_descriptors = true;
current_core.has_set_input_descriptors = true;
}
void core_unset_input_descriptors(void)
{
core_has_set_input_descriptors = false;
current_core.has_set_input_descriptors = false;
}
bool core_is_inited(void)
{
return core_inited;
return current_core.inited;
}
bool core_is_symbols_inited(void)
{
return core_symbols_inited;
return current_core.symbols_inited;
}
bool core_is_game_loaded(void)
{
return core_game_loaded;
return current_core.game_loaded;
}

View File

@ -21,13 +21,11 @@
#include <lists/dir_list.h>
#include <file/archive_file.h>
#include <retro_stat.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "runloop.h"
#include "retroarch.h"
#include "verbosity.h"
#include "config.def.h"
@ -48,9 +46,6 @@ static void core_info_list_resolve_all_extensions(
size_t all_ext_len = 0;
char *all_ext = NULL;
if (!core_info_list)
return;
for (i = 0; i < core_info_list->count; i++)
{
if (core_info_list->list[i].supported_extensions)
@ -191,19 +186,21 @@ static bool core_info_list_iterate(
char *s, size_t len,
struct string_list *contents, size_t i)
{
char info_path_base[PATH_MAX_LENGTH];
size_t info_path_base_size = PATH_MAX_LENGTH * sizeof(char);
char *info_path_base = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
#if defined(RARCH_MOBILE) || (defined(RARCH_CONSOLE) && !defined(PSP) && !defined(_3DS) && !defined(VITA))
char *substr = NULL;
char *substr = NULL;
#endif
settings_t *settings = config_get_ptr();
settings_t *settings = config_get_ptr();
if (!contents || !contents->elems[i].data)
return false;
goto error;
info_path_base[0] = '\0';
fill_pathname_base_noext(info_path_base, contents->elems[i].data,
sizeof(info_path_base));
fill_pathname_base_noext(info_path_base,
contents->elems[i].data,
info_path_base_size);
#if defined(RARCH_MOBILE) || (defined(RARCH_CONSOLE) && !defined(PSP) && !defined(_3DS) && !defined(VITA) && !defined(HW_WUP))
substr = strrchr(info_path_base, '_');
@ -213,14 +210,20 @@ static bool core_info_list_iterate(
strlcat(info_path_base,
file_path_str(FILE_PATH_CORE_INFO_EXTENSION),
sizeof(info_path_base));
info_path_base_size);
fill_pathname_join(s,
(!string_is_empty(settings->path.libretro_info)) ?
settings->path.libretro_info : settings->directory.libretro,
(!string_is_empty(settings->paths.path_libretro_info)) ?
settings->paths.path_libretro_info :
settings->paths.directory_libretro,
info_path_base, len);
free(info_path_base);
return true;
error:
free(info_path_base);
return false;
}
static core_info_list_t *core_info_list_new(const char *path)
@ -247,12 +250,13 @@ static core_info_list_t *core_info_list_new(const char *path)
for (i = 0; i < contents->size; i++)
{
char info_path[PATH_MAX_LENGTH];
size_t info_path_size = PATH_MAX_LENGTH * sizeof(char);
char *info_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
info_path[0] = '\0';
info_path[0] = '\0';
if (
core_info_list_iterate(info_path, sizeof(info_path),
core_info_list_iterate(info_path, info_path_size,
contents, i)
&& path_is_valid(info_path))
{
@ -261,30 +265,36 @@ static core_info_list_t *core_info_list_new(const char *path)
unsigned count = 0;
config_file_t *conf = config_file_new(info_path);
free(info_path);
if (!conf)
continue;
if (config_get_string(conf, "display_name", &tmp) && !string_is_empty(tmp))
if (config_get_string(conf, "display_name", &tmp)
&& !string_is_empty(tmp))
{
core_info[i].display_name = strdup(tmp);
free(tmp);
tmp = NULL;
}
if (config_get_string(conf, "corename", &tmp) && !string_is_empty(tmp))
if (config_get_string(conf, "corename", &tmp)
&& !string_is_empty(tmp))
{
core_info[i].core_name = strdup(tmp);
free(tmp);
tmp = NULL;
}
if (config_get_string(conf, "systemname", &tmp) && !string_is_empty(tmp))
if (config_get_string(conf, "systemname", &tmp)
&& !string_is_empty(tmp))
{
core_info[i].systemname = strdup(tmp);
free(tmp);
tmp = NULL;
}
if (config_get_string(conf, "manufacturer", &tmp) && !string_is_empty(tmp))
if (config_get_string(conf, "manufacturer", &tmp)
&& !string_is_empty(tmp))
{
core_info[i].system_manufacturer = strdup(tmp);
free(tmp);
@ -295,7 +305,8 @@ static core_info_list_t *core_info_list_new(const char *path)
core_info[i].firmware_count = count;
if (config_get_string(conf, "supported_extensions", &tmp) && !string_is_empty(tmp))
if (config_get_string(conf, "supported_extensions", &tmp)
&& !string_is_empty(tmp))
{
core_info[i].supported_extensions = strdup(tmp);
core_info[i].supported_extensions_list =
@ -305,7 +316,8 @@ static core_info_list_t *core_info_list_new(const char *path)
tmp = NULL;
}
if (config_get_string(conf, "authors", &tmp) && !string_is_empty(tmp))
if (config_get_string(conf, "authors", &tmp)
&& !string_is_empty(tmp))
{
core_info[i].authors = strdup(tmp);
core_info[i].authors_list =
@ -315,7 +327,8 @@ static core_info_list_t *core_info_list_new(const char *path)
tmp = NULL;
}
if (config_get_string(conf, "permissions", &tmp) && !string_is_empty(tmp))
if (config_get_string(conf, "permissions", &tmp)
&& !string_is_empty(tmp))
{
core_info[i].permissions = strdup(tmp);
core_info[i].permissions_list =
@ -325,7 +338,8 @@ static core_info_list_t *core_info_list_new(const char *path)
tmp = NULL;
}
if (config_get_string(conf, "license", &tmp) && !string_is_empty(tmp))
if (config_get_string(conf, "license", &tmp)
&& !string_is_empty(tmp))
{
core_info[i].licenses = strdup(tmp);
core_info[i].licenses_list =
@ -335,7 +349,8 @@ static core_info_list_t *core_info_list_new(const char *path)
tmp = NULL;
}
if (config_get_string(conf, "categories", &tmp) && !string_is_empty(tmp))
if (config_get_string(conf, "categories", &tmp)
&& !string_is_empty(tmp))
{
core_info[i].categories = strdup(tmp);
core_info[i].categories_list =
@ -345,7 +360,8 @@ static core_info_list_t *core_info_list_new(const char *path)
tmp = NULL;
}
if (config_get_string(conf, "database", &tmp) && !string_is_empty(tmp))
if (config_get_string(conf, "database", &tmp)
&& !string_is_empty(tmp))
{
core_info[i].databases = strdup(tmp);
core_info[i].databases_list =
@ -355,7 +371,8 @@ static core_info_list_t *core_info_list_new(const char *path)
tmp = NULL;
}
if (config_get_string(conf, "notes", &tmp) && !string_is_empty(tmp))
if (config_get_string(conf, "notes", &tmp)
&& !string_is_empty(tmp))
{
core_info[i].notes = strdup(tmp);
core_info[i].note_list = string_split(core_info[i].notes, "|");
@ -374,6 +391,8 @@ static core_info_list_t *core_info_list_new(const char *path)
core_info[i].config_data = conf;
}
else
free(info_path);
if (!string_is_empty(contents->elems[i].data))
core_info[i].path = strdup(contents->elems[i].data);
@ -383,10 +402,11 @@ static core_info_list_t *core_info_list_new(const char *path)
strdup(path_basename(core_info[i].path));
}
core_info_list_resolve_all_extensions(core_info_list);
if (core_info_list)
{
core_info_list_resolve_all_extensions(core_info_list);
core_info_list_resolve_all_firmware(core_info_list);
}
dir_list_free(contents);
return core_info_list;
@ -495,35 +515,41 @@ static bool core_info_list_update_missing_firmware_internal(
const char *systemdir)
{
size_t i;
char path[PATH_MAX_LENGTH];
core_info_t *info = NULL;
core_info_t *info = NULL;
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
char *path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
if (!core_info_list || !core)
return false;
goto error;
path[0] = '\0';
info = core_info_find_internal(core_info_list, core);
if (!info)
return false;
goto error;
runloop_ctl(RUNLOOP_CTL_UNSET_MISSING_BIOS, NULL);
rarch_ctl(RARCH_CTL_UNSET_MISSING_BIOS, NULL);
for (i = 0; i < info->firmware_count; i++)
{
if (string_is_empty(info->firmware[i].path))
continue;
fill_pathname_join(path, systemdir,
info->firmware[i].path, sizeof(path));
info->firmware[i].path, path_size);
info->firmware[i].missing = !path_file_exists(path);
if (info->firmware[i].missing && !info->firmware[i].optional)
{
runloop_ctl(RUNLOOP_CTL_SET_MISSING_BIOS, NULL);
rarch_ctl(RARCH_CTL_SET_MISSING_BIOS, NULL);
RARCH_WARN("Firmware missing: %s\n", info->firmware[i].path);
}
}
free(path);
return true;
error:
free(path);
return false;
}
#if 0
@ -610,7 +636,7 @@ bool core_info_init_list(void)
settings_t *settings = config_get_ptr();
if (settings)
core_info_curr_list = core_info_list_new(settings->directory.libretro);
core_info_curr_list = core_info_list_new(settings->paths.directory_libretro);
if (!core_info_curr_list)
return false;
@ -726,7 +752,7 @@ void core_info_get_name(const char *path, char *s, size_t len)
size_t i;
settings_t *settings = config_get_ptr();
struct string_list *contents = dir_list_new_special(
settings->directory.libretro,
settings->paths.directory_libretro,
DIR_LIST_CORES, NULL);
if (!contents)
@ -734,24 +760,34 @@ void core_info_get_name(const char *path, char *s, size_t len)
for (i = 0; i < contents->size; i++)
{
char info_path[PATH_MAX_LENGTH];
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
char *info_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
config_file_t *conf = NULL;
char *new_core_name = NULL;
info_path[0] = '\0';
if (!string_is_equal(contents->elems[i].data, path))
{
free(info_path);
continue;
}
if (!core_info_list_iterate(info_path,
sizeof(info_path), contents, i)
path_size, contents, i)
&& path_is_valid(info_path))
{
free(info_path);
continue;
}
conf = config_file_new(info_path);
if (!conf)
{
free(info_path);
continue;
}
if (config_get_string(conf, "corename",
&new_core_name))
@ -761,6 +797,7 @@ void core_info_get_name(const char *path, char *s, size_t len)
}
config_file_free(conf);
free(info_path);
break;
}
@ -786,45 +823,6 @@ size_t core_info_list_num_info_files(core_info_list_t *core_info_list)
return num;
}
bool core_info_unsupported_content_path(const char *path)
{
size_t i;
const char *archive_path = NULL;
const char *delim = path_get_archive_delim(path);
if (delim)
archive_path = delim - 1;
if (!core_info_curr_list)
return false;
/* if the path contains a compressed file and the core supports archives,
* we don't want to look at this file */
if (archive_path)
{
for (i = 0; i < core_info_curr_list->count; i++)
{
const core_info_t *info = &core_info_curr_list->list[i];
if ( !string_list_find_elem(info->supported_extensions_list, "zip")
&& !string_list_find_elem(info->supported_extensions_list, "7z"))
continue;
return false;
}
}
for (i = 0; i < core_info_curr_list->count; i++)
{
const core_info_t *info = &core_info_curr_list->list[i];
if (string_list_find_elem(info->supported_extensions_list, path_get_extension(path)))
return false;
}
return true;
}
bool core_info_database_supports_content_path(const char *database_path, const char *path)
{
char *database = NULL;
@ -836,43 +834,13 @@ bool core_info_database_supports_content_path(const char *database_path, const c
database = strdup(new_path);
if (string_is_empty(database))
{
if (database)
free(database);
return false;
}
goto error;
path_remove_extension(database);
if (core_info_curr_list)
{
size_t i;
const char *delim = path_get_archive_delim(path);
if (delim)
{
const char *archive_path = delim - 1;
/* if the path contains a compressed file and the core supports archives,
* we don't want to look at this file */
if (archive_path)
{
for (i = 0; i < core_info_curr_list->count; i++)
{
const core_info_t *info = &core_info_curr_list->list[i];
if (!string_list_find_elem(info->databases_list, database))
continue;
if ( !string_list_find_elem(info->supported_extensions_list, "zip")
&& !string_list_find_elem(info->supported_extensions_list, "7z"))
continue;
free(database);
return false;
}
}
}
for (i = 0; i < core_info_curr_list->count; i++)
{
@ -890,7 +858,9 @@ bool core_info_database_supports_content_path(const char *database_path, const c
}
}
free(database);
error:
if (database)
free(database);
return false;
}

View File

@ -37,6 +37,8 @@ typedef struct
typedef struct
{
bool supports_no_game;
size_t firmware_count;
char *path;
void *config_data;
char *display_name;
@ -57,10 +59,7 @@ typedef struct
struct string_list *authors_list;
struct string_list *permissions_list;
struct string_list *licenses_list;
core_info_firmware_t *firmware;
size_t firmware_count;
bool supports_no_game;
void *userdata;
} core_info_t;

View File

@ -23,18 +23,22 @@
#include "internal_cores.h"
static uint16_t *frame_buf;
static uint16_t *dummy_frame_buf;
void libretro_dummy_retro_init(void)
{
frame_buf = (uint16_t*)calloc(320 * 240, sizeof(uint16_t));
unsigned i;
dummy_frame_buf = (uint16_t*)calloc(320 * 240, sizeof(uint16_t));
for (i = 0; i < 320 * 240; i++)
dummy_frame_buf[i] = 4 << 5;
}
void libretro_dummy_retro_deinit(void)
{
if (frame_buf)
free(frame_buf);
frame_buf = NULL;
if (dummy_frame_buf)
free(dummy_frame_buf);
dummy_frame_buf = NULL;
}
unsigned libretro_dummy_retro_api_version(void)
@ -121,12 +125,8 @@ void libretro_dummy_retro_reset(void)
void libretro_dummy_retro_run(void)
{
unsigned i;
dummy_input_poll_cb();
for (i = 0; i < 320 * 240; i++)
frame_buf[i] = 4 << 5;
dummy_video_cb(frame_buf, 320, 240, 640);
dummy_video_cb(dummy_frame_buf, 320, 240, 640);
}
/* This should never be called, it's only used as a placeholder. */

View File

@ -161,8 +161,7 @@ GL_SOURCE += $(LIBRETRO_COMM_DIR)/glsym/rglgen.c
ifeq ($(HAVE_GL_FFT), 1)
DEFINES += -DHAVE_GL_FFT
INCFLAGS += -I$(CORE_DIR)/fft
FFT_SOURCE += $(CORE_DIR)/fft/fft.cpp
FFT_SOURCE += $(CORE_DIR)/ffmpeg_fft.c
endif
endif
@ -177,6 +176,7 @@ SOURCES_C := $(GL_SOURCE) \
$(LIBAVFORMAT_SOURCE) \
$(LIBSWSCALE_SOURCE) \
$(LIBAVCODEC_SOURCE) \
$(FFT_SOURCE) \
$(LIBSWRESAMPLE_SOURCE)
SOURCES_CXX := $(FFT_SOURCE)
SOURCES_CXX :=

View File

@ -1,4 +1,3 @@
/* Copyright (C) 2016 - Brad Parker */
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
@ -36,7 +35,7 @@ extern "C" {
#endif
#ifdef HAVE_GL_FFT
#include "fft/fft.h"
#include "ffmpeg_fft.h"
#endif
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
@ -45,6 +44,7 @@ extern "C" {
#include <rthreads/rthreads.h>
#include <queues/fifo_queue.h>
#include <string/stdstring.h>
#include <libretro.h>
#ifdef RARCH_INTERNAL
@ -115,7 +115,7 @@ static struct attachment *attachments;
static size_t attachments_size;
#ifdef HAVE_GL_FFT
static glfft_t *fft;
static fft_t *fft;
unsigned fft_width;
unsigned fft_height;
unsigned fft_multisample;
@ -274,8 +274,8 @@ void CORE_PREFIX(retro_set_environment)(retro_environment_t cb)
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
{ "ffmpeg_temporal_interp", "Temporal Interpolation; enabled|disabled" },
#ifdef HAVE_GL_FFT
{ "ffmpeg_fft_resolution", "GLFFT Resolution; 1280x720|1920x1080|640x360|320x180" },
{ "ffmpeg_fft_multisample", "GLFFT Multisample; 1x|2x|4x" },
{ "ffmpeg_fft_resolution", "FFT Resolution; 1280x720|1920x1080|2560x1440|3840x2160|640x360|320x180" },
{ "ffmpeg_fft_multisample", "FFT Multisample; 1x|2x|4x" },
#endif
#endif
{ "ffmpeg_color_space", "Colorspace; auto|BT.709|BT.601|FCC|SMPTE240M" },
@ -339,9 +339,9 @@ static void check_variables(void)
if (CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (!strcmp(var.value, "enabled"))
if (memcmp(var.value, "enabled", 7) == 0)
temporal_interpolation = true;
else if (!strcmp(var.value, "disabled"))
else if (memcmp(var.value, "disabled", 8) == 0)
temporal_interpolation = false;
}
@ -373,13 +373,13 @@ static void check_variables(void)
if (CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &color_var) && color_var.value)
{
slock_lock(decode_thread_lock);
if (!strcmp(color_var.value, "BT.709"))
if (string_is_equal(color_var.value, "BT.709"))
colorspace = AVCOL_SPC_BT709;
else if (!strcmp(color_var.value, "BT.601"))
else if (string_is_equal(color_var.value, "BT.601"))
colorspace = AVCOL_SPC_BT470BG;
else if (!strcmp(color_var.value, "FCC"))
else if (memcmp(color_var.value, "FCC", 3) == 0)
colorspace = AVCOL_SPC_FCC;
else if (!strcmp(color_var.value, "SMPTE240M"))
else if (string_is_equal(color_var.value, "SMPTE240M"))
colorspace = AVCOL_SPC_SMPTE240M;
else
colorspace = AVCOL_SPC_UNSPECIFIED;
@ -462,7 +462,7 @@ void CORE_PREFIX(retro_run)(void)
}
if (fft && (old_fft_multisample != fft_multisample))
glfft_init_multisample(fft, fft_width, fft_height, fft_multisample);
fft_init_multisample(fft, fft_width, fft_height, fft_multisample);
#endif
CORE_PREFIX(input_poll_cb)();
@ -737,11 +737,11 @@ void CORE_PREFIX(retro_run)(void)
if (to_read > (1 << 11))
to_read = 1 << 11;
glfft_step_fft(fft, buffer, to_read);
fft_step_fft(fft, buffer, to_read);
buffer += to_read * 2;
frames -= to_read;
}
glfft_render(fft, hw_render.get_current_framebuffer(), fft_width, fft_height);
fft_render(fft, hw_render.get_current_framebuffer(), fft_width, fft_height);
CORE_PREFIX(video_cb)(RETRO_HW_FRAME_BUFFER_VALID,
fft_width, fft_height, fft_width * sizeof(uint32_t));
}
@ -1369,7 +1369,7 @@ static void context_destroy(void)
#ifdef HAVE_GL_FFT
if (fft)
{
glfft_free(fft);
fft_free(fft);
fft = NULL;
}
#endif
@ -1400,9 +1400,9 @@ static void context_reset(void)
#ifdef HAVE_GL_FFT
if (audio_streams_num > 0 && video_stream < 0)
{
fft = glfft_new(11, hw_render.get_proc_address);
fft = fft_new(11, hw_render.get_proc_address);
if (fft)
glfft_init_multisample(fft, fft_width, fft_height, fft_multisample);
fft_init_multisample(fft, fft_width, fft_height, fft_multisample);
}
/* Already inits symbols. */
@ -1555,7 +1555,7 @@ void CORE_PREFIX(retro_unload_game)(void)
bool CORE_PREFIX(retro_load_game)(const struct retro_game_info *info)
{
bool is_glfft = false;
bool is_fft = false;
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_XRGB8888;
struct retro_input_descriptor desc[] = {
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "Seek -10 seconds" },
@ -1606,21 +1606,21 @@ bool CORE_PREFIX(retro_load_game)(const struct retro_game_info *info)
}
#ifdef HAVE_GL_FFT
is_glfft = video_stream < 0 && audio_streams_num > 0;
is_fft = video_stream < 0 && audio_streams_num > 0;
#endif
if (video_stream >= 0 || is_glfft)
if (video_stream >= 0 || is_fft)
{
video_decode_fifo = fifo_new(media.width
* media.height * sizeof(uint32_t) * 32);
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
use_gl = true;
hw_render.context_reset = context_reset;
hw_render.context_destroy = context_destroy;
hw_render.bottom_left_origin = is_glfft;
hw_render.depth = is_glfft;
hw_render.stencil = is_glfft;
hw_render.context_reset = context_reset;
hw_render.context_destroy = context_destroy;
hw_render.bottom_left_origin = is_fft;
hw_render.depth = is_fft;
hw_render.stencil = is_fft;
#if defined(HAVE_OPENGLES)
hw_render.context_type = RETRO_HW_CONTEXT_OPENGLES2;
#else

View File

@ -0,0 +1,24 @@
#ifndef FFMPEG_FFT_H_
#define FFMPEG_FFT_H_
#include <glsym/glsym.h>
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
typedef struct GLFFT fft_t;
fft_t *fft_new(unsigned fft_steps, rglgen_proc_address_t proc);
void fft_free(fft_t *fft);
void fft_init_multisample(fft_t *fft, unsigned width, unsigned height, unsigned samples);
void fft_step_fft(fft_t *fft, const GLshort *buffer, unsigned frames);
void fft_render(fft_t *fft, GLuint backbuffer, unsigned width, unsigned height);
RETRO_END_DECLS
#endif

View File

@ -1,26 +0,0 @@
#ifndef FFT_H__
#define FFT_H__
#include <glsym/glsym.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct glfft glfft_t;
glfft_t *glfft_new(unsigned fft_steps, rglgen_proc_address_t proc);
void glfft_free(glfft_t *fft);
void glfft_init_multisample(glfft_t *fft, unsigned width, unsigned height, unsigned samples);
void glfft_step_fft(glfft_t *fft, const GLshort *buffer, unsigned frames);
void glfft_render(glfft_t *fft, GLuint backbuffer, unsigned width, unsigned height);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -22,6 +22,7 @@
#include <net/net_socket.h>
#include <retro_miscellaneous.h>
#include <retro_timers.h>
#include <libretro.h>

View File

@ -59,7 +59,10 @@
#include <libudev.h>
#endif
struct video_buffer {
#include <string/stdstring.h>
struct video_buffer
{
void *start;
size_t len;
};
@ -215,7 +218,7 @@ enumerate_audio_devices(char *buf, size_t buflen)
{
name = snd_device_name_get_hint(*n, "NAME");
ioid = snd_device_name_get_hint(*n, "IOID");
if ((ioid == NULL || !strcmp(ioid, "Input")) &&
if ((ioid == NULL || string_is_equal(ioid, "Input")) &&
(!strncmp(name, "hw:", strlen("hw:")) ||
!strncmp(name, "default:", strlen("default:"))))
{

View File

@ -398,10 +398,34 @@ static int database_cursor_close(libretrodb_t *db, libretrodb_cursor_t *cur)
return 0;
}
database_info_handle_t *database_info_dir_init(const char *dir,
enum database_type type)
static bool type_is_prioritized(enum msg_file_type type)
{
return (type == FILE_TYPE_CUE || type == FILE_TYPE_GDI);
}
static enum msg_file_type file_type(const char *path)
{
return msg_hash_to_file_type(msg_hash_calculate(path_get_extension(path)));
}
static int dir_entry_compare(const void *left, const void *right)
{
const struct string_list_elem *le = (const struct string_list_elem*)left;
const struct string_list_elem *re = (const struct string_list_elem*)right;
bool l = type_is_prioritized(file_type(le->data));
bool r = type_is_prioritized(file_type(re->data));
return (int) r - (int) l;
}
static void dir_list_prioritize(struct string_list *list)
{
qsort(list->elems, list->size, sizeof(*list->elems), dir_entry_compare);
}
database_info_handle_t *database_info_dir_init(const char *dir,
enum database_type type, retro_task_t *task)
{
unsigned i;
database_info_handle_t *db = (database_info_handle_t*)
calloc(1, sizeof(*db));
@ -413,53 +437,12 @@ database_info_handle_t *database_info_dir_init(const char *dir,
if (!db->list)
goto error;
dir_list_prioritize(db->list);
db->list_ptr = 0;
db->status = DATABASE_STATUS_ITERATE;
db->type = type;
if (db->list->size > 0)
{
for (i = 0; i < db->list->size; i++)
{
const char *path = db->list->elems[i].data;
if (path_is_compressed_file(path) && !path_contains_compressed_file(path))
{
struct string_list *archive_list = path_is_compressed_file(path) ?
file_archive_get_file_list(path, NULL) : NULL;
if (archive_list && archive_list->size > 0)
{
unsigned i;
for (i = 0; i < archive_list->size; i++)
{
char new_path[PATH_MAX_LENGTH];
size_t path_len = strlen(path);
new_path[0] = '\0';
strlcpy(new_path, path, sizeof(new_path));
if (path_len + strlen(archive_list->elems[i].data)
+ 1 < PATH_MAX_LENGTH)
{
new_path[path_len] = '#';
strlcpy(new_path + path_len + 1,
archive_list->elems[i].data,
sizeof(new_path) - path_len);
}
string_list_append(db->list, new_path,
archive_list->elems[i].attr);
}
string_list_free(archive_list);
}
}
}
}
return db;
error:
@ -469,15 +452,17 @@ error:
}
database_info_handle_t *database_info_file_init(const char *path,
enum database_type type)
enum database_type type, retro_task_t *task)
{
union string_list_elem_attr attr = {0};
union string_list_elem_attr attr;
database_info_handle_t *db = (database_info_handle_t*)
calloc(1, sizeof(*db));
if (!db)
return NULL;
attr.i = 0;
db->list = string_list_new();
if (!db->list)
@ -485,41 +470,6 @@ database_info_handle_t *database_info_file_init(const char *path,
string_list_append(db->list, path, attr);
if (path_is_compressed_file(path))
{
struct string_list *archive_list =path_is_compressed_file(path) ?
file_archive_get_file_list(path, NULL) : NULL;
if (archive_list && archive_list->size > 0)
{
unsigned i;
for (i = 0; i < archive_list->size; i++)
{
char new_path[PATH_MAX_LENGTH];
size_t path_len = strlen(path);
new_path[0] = '\0';
strlcpy(new_path, path, sizeof(new_path));
if (path_len + strlen(archive_list->elems[i].data)
+ 1 < PATH_MAX_LENGTH)
{
new_path[path_len] = '#';
strlcpy(new_path + path_len + 1,
archive_list->elems[i].data,
sizeof(new_path) - path_len);
}
string_list_append(db->list, new_path,
archive_list->elems[i].attr);
}
string_list_free(archive_list);
}
}
db->list_ptr = 0;
db->status = DATABASE_STATUS_ITERATE;
db->type = type;
@ -557,11 +507,14 @@ database_info_list_t *database_info_list_new(
goto end;
database_info_list = (database_info_list_t*)
calloc(1, sizeof(*database_info_list));
malloc(sizeof(*database_info_list));
if (!database_info_list)
goto end;
database_info_list->count = 0;
database_info_list->list = NULL;
while (ret != -1)
{
database_info_t db_info = {0};

View File

@ -23,6 +23,7 @@
#include <file/archive_file.h>
#include <retro_common_api.h>
#include <queues/task_queue.h>
RETRO_BEGIN_DECLS
@ -80,6 +81,18 @@ typedef struct
typedef struct
{
int analog_supported;
int rumble_supported;
int coop_supported;
uint32_t crc32;
unsigned size;
unsigned famitsu_magazine_rating;
unsigned edge_magazine_rating;
unsigned edge_magazine_issue;
unsigned max_users;
unsigned releasemonth;
unsigned releaseyear;
unsigned tgdb_rating;
char *name;
char *rom_name;
char *serial;
@ -96,27 +109,15 @@ typedef struct
char *pegi_rating;
char *cero_rating;
char *enhancement_hw;
uint32_t crc32;
char *sha1;
char *md5;
unsigned size;
unsigned famitsu_magazine_rating;
unsigned edge_magazine_rating;
unsigned edge_magazine_issue;
unsigned max_users;
unsigned releasemonth;
unsigned releaseyear;
unsigned tgdb_rating;
int analog_supported;
int rumble_supported;
int coop_supported;
void *userdata;
} database_info_t;
typedef struct
{
database_info_t *list;
size_t count;
database_info_t *list;
} database_info_list_t;
database_info_list_t *database_info_list_new(const char *rdb_path,
@ -125,18 +126,13 @@ database_info_list_t *database_info_list_new(const char *rdb_path,
void database_info_list_free(database_info_list_t *list);
database_info_handle_t *database_info_dir_init(const char *dir,
enum database_type type);
enum database_type type, retro_task_t *task);
database_info_handle_t *database_info_file_init(const char *path,
enum database_type type);
enum database_type type, retro_task_t *task);
void database_info_free(database_info_handle_t *handle);
#if 0
int database_info_build_query(
char *query, size_t len, const char *label, const char *path);
#endif
int database_info_build_query_enum(
char *query, size_t len, enum database_query_type type, const char *path);

View File

@ -24,6 +24,39 @@
#include "playlist.h"
#endif
enum default_dirs
{
DEFAULT_DIR_MENU_CONTENT = 0,
DEFAULT_DIR_CORE_ASSETS,
DEFAULT_DIR_MENU_CONFIG,
DEFAULT_DIR_AUTOCONFIG,
DEFAULT_DIR_AUDIO_FILTER,
DEFAULT_DIR_VIDEO_FILTER,
DEFAULT_DIR_ASSETS,
DEFAULT_DIR_CORE,
DEFAULT_DIR_CORE_INFO,
DEFAULT_DIR_OVERLAY,
DEFAULT_DIR_PORT,
DEFAULT_DIR_SHADER,
DEFAULT_DIR_SAVESTATE,
DEFAULT_DIR_RESAMPLER,
DEFAULT_DIR_SRAM,
DEFAULT_DIR_SCREENSHOT,
DEFAULT_DIR_SYSTEM,
DEFAULT_DIR_PLAYLIST,
DEFAULT_DIR_CONTENT_HISTORY,
DEFAULT_DIR_REMAP,
DEFAULT_DIR_CACHE,
DEFAULT_DIR_WALLPAPERS,
DEFAULT_DIR_THUMBNAILS,
DEFAULT_DIR_DATABASE,
DEFAULT_DIR_CURSOR,
DEFAULT_DIR_CHEATS,
DEFAULT_DIR_RECORD_CONFIG,
DEFAULT_DIR_RECORD_OUTPUT,
DEFAULT_DIR_LAST
};
struct defaults
{
#ifdef HAVE_MENU
@ -50,35 +83,7 @@ struct defaults
bool enable;
} overlay;
struct
{
char menu_content[PATH_MAX_LENGTH];
char core_assets[PATH_MAX_LENGTH];
char menu_config[PATH_MAX_LENGTH];
char autoconfig[PATH_MAX_LENGTH];
char audio_filter[PATH_MAX_LENGTH];
char video_filter[PATH_MAX_LENGTH];
char assets[PATH_MAX_LENGTH];
char core[PATH_MAX_LENGTH];
char core_info[PATH_MAX_LENGTH];
char overlay[PATH_MAX_LENGTH];
char port[PATH_MAX_LENGTH];
char shader[PATH_MAX_LENGTH];
char savestate[PATH_MAX_LENGTH];
char resampler[PATH_MAX_LENGTH];
char sram[PATH_MAX_LENGTH];
char screenshot[PATH_MAX_LENGTH];
char system[PATH_MAX_LENGTH];
char playlist[PATH_MAX_LENGTH];
char content_history[PATH_MAX_LENGTH];
char remap[PATH_MAX_LENGTH];
char cache[PATH_MAX_LENGTH];
char wallpapers[PATH_MAX_LENGTH];
char thumbnails[PATH_MAX_LENGTH];
char database[PATH_MAX_LENGTH];
char cursor[PATH_MAX_LENGTH];
char cheats[PATH_MAX_LENGTH];
} dir;
char dirs [DEFAULT_DIR_LAST + 1][PATH_MAX_LENGTH];
struct
{
@ -97,12 +102,13 @@ struct defaults
#ifndef IS_SALAMANDER
playlist_t *content_history;
playlist_t *content_favorites;
#ifdef HAVE_IMAGEVIEWER
playlist_t *image_history;
#endif
playlist_t *music_history;
#ifdef HAVE_FFMPEG
playlist_t *video_history;
playlist_t *music_history;
#endif
#endif
};

View File

@ -21,6 +21,8 @@
/* Direct3D 9 */
#include <d3d9.h>
#define ID3DSURFACE IDirect3DSurface9
#define LPDIRECT3D LPDIRECT3D9
#define LPDIRECT3DDEVICE LPDIRECT3DDEVICE9
#define LPDIRECT3DTEXTURE LPDIRECT3DTEXTURE9
@ -41,8 +43,12 @@
#define D3DCREATE_SOFTWARE_VERTEXPROCESSING 0
#endif
#elif defined(_XBOX1)
#elif defined(HAVE_D3D8)
#ifdef _XBOX
#include <xtl.h>
#else
#include "../gfx/include/d3d8/d3d8.h"
#endif
/* Direct3D 8 */
#define LPDIRECT3D LPDIRECT3D8
@ -56,9 +62,12 @@
#define D3DVERTEXELEMENT D3DVERTEXELEMENT8
#define D3DVIEWPORT D3DVIEWPORT8
#define ID3DSURFACE IDirect3DSurface8
#define D3DCREATE_CTX Direct3DCreate8
#if !defined(D3DLOCK_NOSYSLOCK) && defined(_XBOX)
#define D3DLOCK_NOSYSLOCK (0)
#endif
#define D3DSAMP_ADDRESSU D3DTSS_ADDRESSU
#define D3DSAMP_ADDRESSV D3DTSS_ADDRESSV
#define D3DSAMP_MAGFILTER D3DTSS_MAGFILTER
@ -67,7 +76,7 @@
#if defined(_XBOX360)
#define D3DFVF_CUSTOMVERTEX 0
#elif defined(_XBOX1)
#elif defined(HAVE_D3D8)
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZRHW | D3DFVF_TEX1)
#endif

View File

@ -106,7 +106,7 @@ int sceClibPrintf ( const char * format, ... );
#if defined(VITA)
#define CtrlSetSamplingMode(mode) sceCtrlSetSamplingModeExt(mode)
#define CtrlPeekBufferPositive(port, pad_data, bufs) sceCtrlReadBufferPositiveExt2(port, pad_data, bufs)
#define CtrlPeekBufferPositive(port, pad_data, bufs) sceCtrlPeekBufferPositiveExt2(port, pad_data, bufs)
#else
#define CtrlSetSamplingMode(mode) sceCtrlSetSamplingMode(mode)
#define CtrlPeekBufferPositive(port, pad_data, bufs) sceCtrlPeekBufferPositive(port, pad_data, bufs)

32
deps/7zip/7zAlloc.c vendored
View File

@ -1,32 +0,0 @@
/* 7zAlloc.c -- Allocation functions
2010-10-29 : Igor Pavlov : Public domain */
#include "7zAlloc.h"
void *SzAlloc(void *p, size_t size)
{
(void)p;
if (size == 0)
return 0;
return malloc(size);
}
void SzFree(void *p, void *address)
{
(void)p;
free(address);
}
void *SzAllocTemp(void *p, size_t size)
{
(void)p;
if (size == 0)
return 0;
return malloc(size);
}
void SzFreeTemp(void *p, void *address)
{
(void)p;
free(address);
}

23
deps/7zip/7zAlloc.h vendored
View File

@ -1,23 +0,0 @@
/* 7zAlloc.h -- Allocation functions
2010-10-29 : Igor Pavlov : Public domain */
#ifndef __7Z_ALLOC_H
#define __7Z_ALLOC_H
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
void *SzAlloc(void *p, size_t size);
void SzFree(void *p, void *address);
void *SzAllocTemp(void *p, size_t size);
void SzFreeTemp(void *p, void *address);
#ifdef __cplusplus
}
#endif
#endif

14
deps/7zip/7zBuf.h vendored
View File

@ -4,7 +4,7 @@
#ifndef __7Z_BUF_H
#define __7Z_BUF_H
#include "Types.h"
#include "7zTypes.h"
#ifdef __cplusplus
extern "C" {
@ -20,18 +20,6 @@ void Buf_Init(CBuf *p);
int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc);
void Buf_Free(CBuf *p, ISzAlloc *alloc);
typedef struct
{
uint8_t *data;
size_t size;
size_t pos;
} CDynBuf;
void DynBuf_Construct(CDynBuf *p);
void DynBuf_SeekToBeg(CDynBuf *p);
int DynBuf_Write(CDynBuf *p, const uint8_t *buf, size_t size, ISzAlloc *alloc);
void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc);
#ifdef __cplusplus
}
#endif

47
deps/7zip/7zBuf2.c vendored
View File

@ -1,47 +0,0 @@
/* 7zBuf2.c -- uint8_t Buffer
2008-10-04 : Igor Pavlov : Public domain */
#include <stdint.h>
#include <string.h>
#include "7zBuf.h"
void DynBuf_Construct(CDynBuf *p)
{
p->data = 0;
p->size = 0;
p->pos = 0;
}
void DynBuf_SeekToBeg(CDynBuf *p)
{
p->pos = 0;
}
int DynBuf_Write(CDynBuf *p, const uint8_t *buf, size_t size, ISzAlloc *alloc)
{
if (size > p->size - p->pos)
{
size_t current_size = p->pos + size;
size_t newSize = (current_size) + (current_size / 4);
uint8_t *data = (uint8_t *)alloc->Alloc(alloc, newSize);
if (data == 0)
return 0;
p->size = newSize;
memcpy(data, p->data, p->pos);
alloc->Free(alloc, p->data);
p->data = data;
}
memcpy(p->data + p->pos, buf, size);
p->pos += size;
return 1;
}
void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc)
{
alloc->Free(alloc, p->data);
p->data = 0;
p->size = 0;
p->pos = 0;
}

2
deps/7zip/7zCrc.h vendored
View File

@ -4,7 +4,7 @@
#ifndef __7Z_CRC_H
#define __7Z_CRC_H
#include "Types.h"
#include "7zTypes.h"
#ifdef __cplusplus
extern "C" {

121
deps/7zip/7zDec.c vendored
View File

@ -3,8 +3,7 @@
#include <stdint.h>
#include <string.h>
/* #define _7ZIP_PPMD_SUPPPORT */
#include <boolean.h>
#include "7z.h"
@ -13,9 +12,6 @@
#include "CpuArch.h"
#include "LzmaDec.h"
#include "Lzma2Dec.h"
#ifdef _7ZIP_PPMD_SUPPPORT
#include "Ppmd7.h"
#endif
#define k_Copy 0
#define k_LZMA2 0x21
@ -27,104 +23,6 @@
#define k_SPARC 0x03030805
#define k_BCJ2 0x0303011B
#ifdef _7ZIP_PPMD_SUPPPORT
#define k_PPMD 0x30401
typedef struct
{
Iuint8_tIn p;
const uint8_t *cur;
const uint8_t *end;
const uint8_t *begin;
uint64_t processed;
Bool extra;
SRes res;
ILookInStream *inStream;
} Cuint8_tInToLook;
static uint8_t Readuint8_t(void *pp)
{
Cuint8_tInToLook *p = (Cuint8_tInToLook *)pp;
if (p->cur != p->end)
return *p->cur++;
if (p->res == SZ_OK)
{
size_t size = p->cur - p->begin;
p->processed += size;
p->res = p->inStream->Skip(p->inStream, size);
size = (1 << 25);
p->res = p->inStream->Look(p->inStream, (const void **)&p->begin, &size);
p->cur = p->begin;
p->end = p->begin + size;
if (size != 0)
return *p->cur++;
}
p->extra = True;
return 0;
}
static SRes SzDecodePpmd(CSzCoderInfo *coder, uint64_t inSize, ILookInStream *inStream,
uint8_t *outBuffer, size_t outSize, ISzAlloc *allocMain)
{
CPpmd7 ppmd;
Cuint8_tInToLook s;
SRes res = SZ_OK;
s.p.Read = Readuint8_t;
s.inStream = inStream;
s.begin = s.end = s.cur = NULL;
s.extra = False;
s.res = SZ_OK;
s.processed = 0;
if (coder->Props.size != 5)
return SZ_ERROR_UNSUPPORTED;
{
unsigned order = coder->Props.data[0];
uint32_t memSize = GetUi32(coder->Props.data + 1);
if (order < PPMD7_MIN_ORDER ||
order > PPMD7_MAX_ORDER ||
memSize < PPMD7_MIN_MEM_SIZE ||
memSize > PPMD7_MAX_MEM_SIZE)
return SZ_ERROR_UNSUPPORTED;
Ppmd7_Construct(&ppmd);
if (!Ppmd7_Alloc(&ppmd, memSize, allocMain))
return SZ_ERROR_MEM;
Ppmd7_Init(&ppmd, order);
}
{
CPpmd7z_RangeDec rc;
Ppmd7z_RangeDec_CreateVTable(&rc);
rc.Stream = &s.p;
if (!Ppmd7z_RangeDec_Init(&rc))
res = SZ_ERROR_DATA;
else if (s.extra)
res = (s.res != SZ_OK ? s.res : SZ_ERROR_DATA);
else
{
size_t i;
for (i = 0; i < outSize; i++)
{
int sym = Ppmd7_DecodeSymbol(&ppmd, &rc.p);
if (s.extra || sym < 0)
break;
outBuffer[i] = (uint8_t)sym;
}
if (i != outSize)
res = (s.res != SZ_OK ? s.res : SZ_ERROR_DATA);
else if (s.processed + (s.cur - s.begin) != inSize || !Ppmd7z_RangeDec_IsFinishedOK(&rc))
res = SZ_ERROR_DATA;
}
}
Ppmd7_Free(&ppmd, allocMain);
return res;
}
#endif
static SRes SzDecodeLzma(CSzCoderInfo *coder, uint64_t inSize, ILookInStream *inStream,
uint8_t *outBuffer, size_t outSize, ISzAlloc *allocMain)
{
@ -241,22 +139,19 @@ static SRes SzDecodeCopy(uint64_t inSize, ILookInStream *inStream, uint8_t *outB
return SZ_OK;
}
static Bool IS_MAIN_METHOD(uint32_t m)
static bool IS_MAIN_METHOD(uint32_t m)
{
switch(m)
{
case k_Copy:
case k_LZMA:
case k_LZMA2:
#ifdef _7ZIP_PPMD_SUPPPORT
case k_PPMD:
#endif
return True;
return true;
}
return False;
return false;
}
static Bool IS_SUPPORTED_CODER(const CSzCoderInfo *c)
static bool IS_SUPPORTED_CODER(const CSzCoderInfo *c)
{
return
c->NumInStreams == 1 &&
@ -402,13 +297,7 @@ static SRes SzFolder_Decode2(const CSzFolder *folder, const uint64_t *packSizes,
RINOK(SzDecodeLzma2(coder, inSize, inStream, outBufCur, outSizeCur, allocMain));
}
else
{
#ifdef _7ZIP_PPMD_SUPPPORT
RINOK(SzDecodePpmd(coder, inSize, inStream, outBufCur, outSizeCur, allocMain));
#else
return SZ_ERROR_UNSUPPORTED;
#endif
}
}
else if (coder->MethodID == k_BCJ2)
{

2
deps/7zip/7zFile.h vendored
View File

@ -14,7 +14,7 @@
#include <stdio.h>
#endif
#include "Types.h"
#include "7zTypes.h"
#ifdef __cplusplus
extern "C" {

View File

@ -5,7 +5,7 @@
#include <stdint.h>
#include <string.h>
#include "Types.h"
#include "7zTypes.h"
SRes SeqInStream_Readuint8_t(ISeqInStream *stream, uint8_t *buf);

173
deps/7zip/7zTypes.h vendored Normal file
View File

@ -0,0 +1,173 @@
/* 7zTypes.h -- Basic types
2013-11-12 : Igor Pavlov : Public domain */
#ifndef __7Z_TYPES_H
#define __7Z_TYPES_H
#include <stdint.h>
#include <stddef.h>
#ifndef EXTERN_C_BEGIN
#ifdef __cplusplus
#define EXTERN_C_BEGIN extern "C" {
#define EXTERN_C_END }
#else
#define EXTERN_C_BEGIN
#define EXTERN_C_END
#endif
#endif
EXTERN_C_BEGIN
#ifndef _7ZIP_ST
#define _7ZIP_ST
#endif
#define SZ_OK 0
#define SZ_ERROR_DATA 1
#define SZ_ERROR_MEM 2
#define SZ_ERROR_CRC 3
#define SZ_ERROR_UNSUPPORTED 4
#define SZ_ERROR_PARAM 5
#define SZ_ERROR_INPUT_EOF 6
#define SZ_ERROR_OUTPUT_EOF 7
#define SZ_ERROR_READ 8
#define SZ_ERROR_WRITE 9
#define SZ_ERROR_PROGRESS 10
#define SZ_ERROR_FAIL 11
#define SZ_ERROR_THREAD 12
#define SZ_ERROR_ARCHIVE 16
#define SZ_ERROR_NO_ARCHIVE 17
typedef int SRes;
#ifdef _WIN32
typedef unsigned WRes;
#else
typedef int WRes;
#endif
#ifndef RINOK
#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
#endif
#ifdef _MSC_VER
#define MY_FAST_CALL __fastcall
#else
#define MY_FAST_CALL
#endif
/* The following interfaces use first parameter as pointer to structure */
typedef struct
{
unsigned char (*Read)(void *p); /* reads one byte, returns 0 in case of EOF or error */
} IByteIn;
typedef struct
{
void (*Write)(void *p, unsigned char b);
} IByteOut;
typedef struct
{
SRes (*Read)(void *p, void *buf, size_t *size);
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
(output(*size) < input(*size)) is allowed */
} ISeqInStream;
/* it can return SZ_ERROR_INPUT_EOF */
SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size);
SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType);
SRes SeqInStream_ReadByte(ISeqInStream *stream, unsigned char *buf);
typedef struct
{
size_t (*Write)(void *p, const void *buf, size_t size);
/* Returns: result - the number of actually written bytes.
(result < size) means error */
} ISeqOutStream;
typedef enum
{
SZ_SEEK_SET = 0,
SZ_SEEK_CUR = 1,
SZ_SEEK_END = 2
} ESzSeek;
typedef struct
{
SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */
SRes (*Seek)(void *p, int64_t *pos, ESzSeek origin);
} ISeekInStream;
typedef struct
{
SRes (*Look)(void *p, const void **buf, size_t *size);
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
(output(*size) > input(*size)) is not allowed
(output(*size) < input(*size)) is allowed */
SRes (*Skip)(void *p, size_t offset);
/* offset must be <= output(*size) of Look */
SRes (*Read)(void *p, void *buf, size_t *size);
/* reads directly (without buffer). It's same as ISeqInStream::Read */
SRes (*Seek)(void *p, int64_t *pos, ESzSeek origin);
} ILookInStream;
SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size);
SRes LookInStream_SeekTo(ILookInStream *stream, uint64_t offset);
/* reads via ILookInStream::Read */
SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType);
SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size);
#define LookToRead_BUF_SIZE (1 << 14)
typedef struct
{
ILookInStream s;
ISeekInStream *realStream;
size_t pos;
size_t size;
unsigned char buf[LookToRead_BUF_SIZE];
} CLookToRead;
void LookToRead_CreateVTable(CLookToRead *p, int lookahead);
void LookToRead_Init(CLookToRead *p);
typedef struct
{
ISeqInStream s;
ILookInStream *realStream;
} CSecToLook;
void SecToLook_CreateVTable(CSecToLook *p);
typedef struct
{
ISeqInStream s;
ILookInStream *realStream;
} CSecToRead;
void SecToRead_CreateVTable(CSecToRead *p);
typedef struct
{
SRes (*Progress)(void *p, uint64_t inSize, uint64_t outSize);
} ICompressProgress;
typedef struct
{
void *(*Alloc)(void *p, size_t size);
void (*Free)(void *p, void *address); /* address can be 0 */
} ISzAlloc;
#define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
#define IAlloc_Free(p, a) (p)->Free((p), a)
EXTERN_C_END
#endif

2
deps/7zip/Bcj2.h vendored
View File

@ -4,7 +4,7 @@
#ifndef __BCJ2_H
#define __BCJ2_H
#include "Types.h"
#include "7zTypes.h"
#ifdef __cplusplus
extern "C" {

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