mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Merge remote-tracking branch 'libretro/master'
This commit is contained in:
commit
83d63fcdd1
19
.gitignore
vendored
19
.gitignore
vendored
@ -23,7 +23,7 @@ Debug
|
||||
Release
|
||||
ipch
|
||||
*.user
|
||||
/wii/app_booter/app_booter.bin
|
||||
/bootstrap/gx/wii/app_booter/app_booter.bin
|
||||
*.zip
|
||||
RetroArch-w32/
|
||||
RetroArch-w64/
|
||||
@ -46,6 +46,7 @@ DerivedData
|
||||
apple/tmp
|
||||
apple/*.mobileprovision
|
||||
apple/RetroArch_iOS.xcodeproj/project.xcworkspace/*
|
||||
menu/driverspzarch.c
|
||||
/Cg/
|
||||
/GL/
|
||||
/SDL/
|
||||
@ -62,12 +63,12 @@ apple/RetroArch_iOS.xcodeproj/project.xcworkspace/*
|
||||
/obj-w32/
|
||||
|
||||
# Android
|
||||
/android/phoenix/obj/
|
||||
/android/phoenix/assets/
|
||||
/android/phoenix/libs/
|
||||
/android/phoenix/bin/
|
||||
/android/phoenix/gen/
|
||||
/android/phoenix/local.properties
|
||||
/pkg/android/phoenix/obj/
|
||||
/pkg/android/phoenix/assets/
|
||||
/pkg/android/phoenix/libs/
|
||||
/pkg/android/phoenix/bin/
|
||||
/pkg/android/phoenix/gen/
|
||||
/pkg/android/phoenix/local.properties
|
||||
|
||||
# Cloned by libretro-fetch.sh
|
||||
/media/assets/
|
||||
@ -76,8 +77,8 @@ apple/RetroArch_iOS.xcodeproj/project.xcworkspace/*
|
||||
/media/shaders_cg/
|
||||
/media/libretrodb/
|
||||
|
||||
apple/iOS/build/
|
||||
apple/iOS/modules/
|
||||
pkg/apple/iOS/build/
|
||||
pkg/apple/iOS/modules/
|
||||
|
||||
obj-unix/
|
||||
.vagrant/
|
||||
|
73
AUTHORS
73
AUTHORS
@ -1,73 +0,0 @@
|
||||
Hans-Kristian Arntzen - <maister@archlinux.us>
|
||||
- Main code
|
||||
- Initial Gamecube/Wii libogc port
|
||||
|
||||
Daniel De Matteis - <libretro@gmail.com>
|
||||
- Maintainer
|
||||
- Main code
|
||||
|
||||
Devin J. Pohly - <djpohly@djpohly.com>
|
||||
- Joypad axis support
|
||||
|
||||
Chris Moeller - <kode54@gmail.com>
|
||||
- CoreAudio audio driver
|
||||
|
||||
Tobias Jakobi - <TBA>
|
||||
- OMAP graphics driver
|
||||
|
||||
Jason Fetters - <TBA>
|
||||
- Phoenix Java frontend
|
||||
- Android port patches
|
||||
- iOS port
|
||||
|
||||
CatalystG - <catalystgdev@gmail.com>
|
||||
- Blackberry 10/Playbook input driver
|
||||
- Blackberry 10/Playbook patches
|
||||
|
||||
David Reichelt - <freakdave@hotmail.com>
|
||||
- XBox 1 port
|
||||
|
||||
tukuyomi - <tukuyomi@free.fr>
|
||||
- Cleanups in quickbuild
|
||||
|
||||
Michael Lelli - <toadking@toadking.com>
|
||||
- Gamecube/Wii libogc port
|
||||
- Raspberry Pi video driver
|
||||
- Linux Raw keyboard input driver
|
||||
- Android port patches
|
||||
|
||||
Ali Bouhlel - <aliaspider@gmail.com>
|
||||
- PSP port
|
||||
- Convoluted Cosine resampler
|
||||
|
||||
Darren Alton -
|
||||
- OpenPandora port
|
||||
|
||||
Fabian Knopf -
|
||||
- WGL multi-monitor support
|
||||
- D3D9 overlay, multi-monitor and menu support
|
||||
|
||||
Gražvydas Ignotas -
|
||||
- ARM Linux patches
|
||||
|
||||
Saggi Mizrahi -
|
||||
- RetroLaunch utility
|
||||
|
||||
Alfred Agrell - <floating@muncher.se>
|
||||
- Rewritten savestate manager
|
||||
|
||||
Jean-André Santoni - <jean.andre.santoni@gmail.com>
|
||||
- Lakka menu driver
|
||||
|
||||
Morgane Alonso -
|
||||
- Lakka menu driver (graphic design)
|
||||
|
||||
Timo Strunk - <Timo.Strunk@gmail.com>
|
||||
- 7zip support
|
||||
|
||||
Higor Euripedes - <TBA>
|
||||
- SDL2 drivers
|
||||
|
||||
Jay McCarthy - <jay.mccarthy@gmail.com>
|
||||
- CoreText font driver
|
||||
- (Apple) CFRunLoop improvements
|
62
Makefile
62
Makefile
@ -1,9 +1,13 @@
|
||||
HAVE_FILE_LOGGER=1
|
||||
MISSING_DECLS =0
|
||||
|
||||
ifneq ($(C90_BUILD),)
|
||||
C89_BUILD=1
|
||||
endif
|
||||
|
||||
include config.mk
|
||||
|
||||
TARGET = retroarch
|
||||
JTARGET = tools/retroarch-joyconfig
|
||||
|
||||
OBJDIR := obj-unix
|
||||
|
||||
@ -12,7 +16,6 @@ ifeq ($(GLOBAL_CONFIG_DIR),)
|
||||
endif
|
||||
|
||||
OBJ :=
|
||||
JOYCONFIG_OBJ :=
|
||||
LIBS :=
|
||||
DEFINES := -DHAVE_CONFIG_H -DRARCH_INTERNAL -DHAVE_OVERLAY
|
||||
DEFINES += -DGLOBAL_CONFIG_DIR='"$(GLOBAL_CONFIG_DIR)"'
|
||||
@ -23,8 +26,16 @@ endif
|
||||
|
||||
include Makefile.common
|
||||
|
||||
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang"),1)
|
||||
DEFINES += -Wno-invalid-source-encoding
|
||||
endif
|
||||
|
||||
HEADERS = $(wildcard */*/*.h) $(wildcard */*.h) $(wildcard *.h)
|
||||
|
||||
ifeq ($(MISSING_DECLS), 1)
|
||||
DEFINES += -Werror=missing-declarations
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_DYLIB), 1)
|
||||
LIBS += $(DYLIB_LIB)
|
||||
endif
|
||||
@ -46,7 +57,7 @@ else
|
||||
endif
|
||||
|
||||
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) $(DEBUG_FLAG) -I.
|
||||
CXXFLAGS := $(CFLAGS) -std=c++0x -D__STDC_CONSTANT_MACROS
|
||||
CXXFLAGS := $(CFLAGS) -std=c++98 -D__STDC_CONSTANT_MACROS
|
||||
OBJCFLAGS := $(CFLAGS) -D__STDC_CONSTANT_MACROS
|
||||
|
||||
ifeq ($(CXX_BUILD), 1)
|
||||
@ -68,9 +79,8 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(C89_BUILD)$(C90_BUILD),)
|
||||
#looks kinda ugly, but it makes both C89_BUILD and C90_BUILD work and refer to the same thing
|
||||
CFLAGS += -std=c89 -ansi -pedantic -Werror=pedantic
|
||||
ifneq ($(C89_BUILD),)
|
||||
CFLAGS += -std=c89 -ansi -pedantic -Werror=pedantic -Wno-long-long
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -84,7 +94,6 @@ ifeq ($(NOUNUSED_VARIABLE), yes)
|
||||
endif
|
||||
|
||||
RARCH_OBJ := $(addprefix $(OBJDIR)/,$(OBJ))
|
||||
RARCH_JOYCONFIG_OBJ := $(addprefix $(OBJDIR)/,$(JOYCONFIG_OBJ))
|
||||
|
||||
ifneq ($(SANITIZER),)
|
||||
CFLAGS := -fsanitize=$(SANITIZER) $(CFLAGS)
|
||||
@ -92,9 +101,9 @@ ifneq ($(SANITIZER),)
|
||||
LDFLAGS := -fsanitize=$(SANITIZER) $(LDLAGS)
|
||||
endif
|
||||
|
||||
all: $(TARGET) $(JTARGET) config.mk
|
||||
all: $(TARGET) config.mk
|
||||
|
||||
-include $(RARCH_OBJ:.o=.d) $(RARCH_JOYCONFIG_OBJ:.o=.d)
|
||||
-include $(RARCH_OBJ:.o=.d)
|
||||
config.mk: configure qb/*
|
||||
@echo "config.mk is outdated or non-existing. Run ./configure again."
|
||||
@exit 1
|
||||
@ -103,10 +112,6 @@ retroarch: $(RARCH_OBJ)
|
||||
@$(if $(Q), $(shell echo echo LD $@),)
|
||||
$(Q)$(LINK) -o $@ $(RARCH_OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
|
||||
|
||||
$(JTARGET): $(RARCH_JOYCONFIG_OBJ)
|
||||
@$(if $(Q), $(shell echo echo LD $@),)
|
||||
$(Q)$(LINK) -o $@ $(RARCH_JOYCONFIG_OBJ) $(JOYCONFIG_LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
|
||||
|
||||
$(OBJDIR)/%.o: %.c config.h config.mk
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
@ -129,21 +134,6 @@ $(OBJDIR)/git_version.o: git_version.c .FORCE
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/tools/linuxraw_joypad.o: input/linuxraw_joypad.c
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/tools/parport_joypad.o: input/parport_joypad.c
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/tools/udev_joypad.o: input/udev_joypad.c
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.S config.h config.mk $(HEADERS)
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo AS $<),)
|
||||
@ -158,33 +148,29 @@ install: $(TARGET)
|
||||
rm -f $(OBJDIR)/git_version.o
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(GLOBAL_CONFIG_DIR) 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/share/applications 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(MAN_DIR) 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/share/pixmaps 2>/dev/null || /bin/true
|
||||
install -m755 $(TARGET) $(DESTDIR)$(PREFIX)/bin
|
||||
install -m755 tools/cg2glsl.py $(DESTDIR)$(PREFIX)/bin/retroarch-cg2glsl
|
||||
install -m755 $(JTARGET) $(DESTDIR)$(PREFIX)/bin
|
||||
install -m644 retroarch.cfg $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
|
||||
install -m644 retroarch.desktop $(DESTDIR)$(PREFIX)/share/applications
|
||||
install -m644 docs/retroarch.1 $(DESTDIR)$(MAN_DIR)
|
||||
install -m644 docs/retroarch-cg2glsl.1 $(DESTDIR)$(MAN_DIR)
|
||||
install -m644 docs/retroarch-joyconfig.1 $(DESTDIR)$(MAN_DIR)
|
||||
install -m644 media/retroarch.png $(DESTDIR)$(PREFIX)/share/pixmaps
|
||||
install -m644 media/retroarch.svg $(DESTDIR)$(PREFIX)/share/pixmaps
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch-joyconfig
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch-cg2glsl
|
||||
rm -f $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
|
||||
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/retroarch.1
|
||||
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/retroarch-cg2glsl.1
|
||||
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/retroarch-joyconfig.1
|
||||
rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/retroarch.png
|
||||
rm -f $(DESTDIR)$(PREFIX)/share/applications/retroarch.desktop
|
||||
rm -f $(DESTDIR)$(MAN_DIR)/retroarch.1
|
||||
rm -f $(DESTDIR)$(MAN_DIR)/retroarch-cg2glsl.1
|
||||
rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/retroarch.svg
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJDIR)
|
||||
rm -f $(TARGET)
|
||||
rm -f $(JTARGET)
|
||||
rm -f *.d
|
||||
|
||||
.PHONY: all install uninstall clean
|
||||
|
613
Makefile.common
613
Makefile.common
@ -28,7 +28,6 @@ endif
|
||||
|
||||
ifeq ($(HAVE_DYLIB), 1)
|
||||
DEFINES += -DHAVE_DYLIB
|
||||
JOYCONFIG_LIBS += $(DYLIB_LIB)
|
||||
endif
|
||||
|
||||
ifeq ($(SCALER_NO_SIMD), 1)
|
||||
@ -54,7 +53,7 @@ ifeq ($(TDM_GCC),)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER -Ilogger/netlogger
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
endif
|
||||
|
||||
CFLAGS += -I./libretro-common/include
|
||||
@ -71,17 +70,16 @@ endif
|
||||
ifneq ($(findstring Darwin,$(OS)),)
|
||||
OSX := 1
|
||||
LIBS += -framework AppKit
|
||||
JOYCONFIG_LIBS += -framework CoreFoundation
|
||||
else
|
||||
OSX := 0
|
||||
endif
|
||||
|
||||
ifneq ($(findstring Linux,$(OS)),)
|
||||
LIBS += -lrt
|
||||
JOYCONFIG_LIBS += -lrt -lpthread
|
||||
OBJ += input/drivers/linuxraw_input.o \
|
||||
input/drivers_joypad/linuxraw_joypad.o \
|
||||
frontend/drivers/platform_linux.o
|
||||
input/common/linux_common.o \
|
||||
input/drivers_joypad/linuxraw_joypad.o \
|
||||
frontend/drivers/platform_linux.o
|
||||
endif
|
||||
|
||||
ifeq ($(findstring Haiku,$(OS)),)
|
||||
@ -104,136 +102,150 @@ endif
|
||||
# General object files
|
||||
|
||||
OBJ += frontend/frontend.o \
|
||||
frontend/frontend_driver.o \
|
||||
frontend/drivers/platform_null.o \
|
||||
ui/ui_companion_driver.o \
|
||||
ui/drivers/ui_null.o \
|
||||
libretro_version_1.o \
|
||||
retroarch.o \
|
||||
system.o \
|
||||
retroarch_info.o \
|
||||
command_event.o \
|
||||
msg_hash.o \
|
||||
intl/msg_hash_de.o \
|
||||
intl/msg_hash_eo.o \
|
||||
intl/msg_hash_es.o \
|
||||
intl/msg_hash_fr.o \
|
||||
intl/msg_hash_it.o \
|
||||
intl/msg_hash_nl.o \
|
||||
intl/msg_hash_pl.o \
|
||||
intl/msg_hash_pt.o \
|
||||
intl/msg_hash_us.o \
|
||||
runloop.o \
|
||||
runloop_data.o \
|
||||
runloop_msg.o \
|
||||
tasks/task_file_transfer.o \
|
||||
content.o \
|
||||
libretro-common/file/file_list.o \
|
||||
libretro-common/file/dir_list.o \
|
||||
libretro-common/string/string_list.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
dir_list_special.o \
|
||||
file_ops.o \
|
||||
libretro-common/file/nbio/nbio_stdio.o \
|
||||
libretro-common/file/file_path.o \
|
||||
file_path_special.o \
|
||||
libretro-common/hash/rhash.o \
|
||||
audio/audio_driver.o \
|
||||
input/input_driver.o \
|
||||
input/input_hid_driver.o \
|
||||
gfx/video_common.o \
|
||||
gfx/video_driver.o \
|
||||
gfx/video_pixel_converter.o \
|
||||
gfx/video_viewport.o \
|
||||
camera/camera_driver.o \
|
||||
menu/menu_driver.o \
|
||||
location/location_driver.o \
|
||||
driver.o \
|
||||
configuration.o \
|
||||
libretro-common/dynamic/dylib.o \
|
||||
dynamic.o \
|
||||
cores/dynamic_dummy.o \
|
||||
libretro-common/queues/message_queue.o \
|
||||
rewind.o \
|
||||
gfx/drivers_font_renderer/bitmapfont.o \
|
||||
input/input_autodetect.o \
|
||||
input/input_joypad_driver.o \
|
||||
input/input_joypad.o \
|
||||
input/input_common.o \
|
||||
input/input_keymaps.o \
|
||||
input/input_remapping.o \
|
||||
input/input_sensor.o \
|
||||
input/keyboard_line.o \
|
||||
tasks/task_overlay.o \
|
||||
input/input_overlay.o \
|
||||
patch.o \
|
||||
libretro-common/queues/fifo_buffer.o \
|
||||
core_options.o \
|
||||
libretro-common/compat/compat.o \
|
||||
libretro-common/compat/compat_fnmatch.o \
|
||||
cheats.o \
|
||||
core_info.o \
|
||||
libretro-common/file/config_file.o \
|
||||
libretro-common/file/config_file_userdata.o \
|
||||
screenshot.o \
|
||||
libretro-common/gfx/scaler/scaler.o \
|
||||
gfx/drivers_shader/shader_null.o \
|
||||
gfx/video_shader_driver.o \
|
||||
gfx/video_shader_parse.o \
|
||||
libretro-common/gfx/scaler/pixconv.o \
|
||||
libretro-common/gfx/scaler/scaler_int.o \
|
||||
libretro-common/gfx/scaler/scaler_filter.o \
|
||||
gfx/font_driver.o \
|
||||
gfx/font_renderer_driver.o \
|
||||
gfx/video_filter.o \
|
||||
audio/audio_resampler_driver.o \
|
||||
audio/audio_dsp_filter.o \
|
||||
audio/drivers_resampler/sinc.o \
|
||||
audio/drivers_resampler/nearest.o \
|
||||
audio/drivers_resampler/cc_resampler.o \
|
||||
location/drivers/nulllocation.o \
|
||||
camera/drivers/nullcamera.o \
|
||||
gfx/drivers/nullgfx.o \
|
||||
audio/drivers/nullaudio.o \
|
||||
input/drivers/nullinput.o \
|
||||
input/drivers_hid/null_hid.o \
|
||||
input/drivers_joypad/null_joypad.o \
|
||||
input/drivers_joypad/hid_joypad.o \
|
||||
playlist.o \
|
||||
movie.o \
|
||||
record/record_driver.o \
|
||||
record/drivers/record_null.o \
|
||||
performance.o
|
||||
frontend/frontend_driver.o \
|
||||
frontend/drivers/platform_null.o \
|
||||
ui/ui_companion_driver.o \
|
||||
ui/drivers/ui_null.o \
|
||||
libretro_version_1.o \
|
||||
retroarch.o \
|
||||
input/keyboard_line.o \
|
||||
system.o \
|
||||
retroarch_info.o \
|
||||
command_event.o \
|
||||
msg_hash.o \
|
||||
intl/msg_hash_de.o \
|
||||
intl/msg_hash_eo.o \
|
||||
intl/msg_hash_es.o \
|
||||
intl/msg_hash_fr.o \
|
||||
intl/msg_hash_it.o \
|
||||
intl/msg_hash_nl.o \
|
||||
intl/msg_hash_pl.o \
|
||||
intl/msg_hash_pt.o \
|
||||
intl/msg_hash_us.o \
|
||||
runloop.o \
|
||||
runloop_data.o \
|
||||
runloop_msg.o \
|
||||
tasks/task_file_transfer.o \
|
||||
content.o \
|
||||
libretro-common/encodings/encoding_utf.o \
|
||||
libretro-common/file/file_list.o \
|
||||
libretro-common/file/dir_list.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/file/retro_file.o \
|
||||
libretro-common/file/retro_stat.o \
|
||||
libretro-common/string/string_list.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
libretro-common/memmap/memalign.o \
|
||||
dir_list_special.o \
|
||||
string_list_special.o \
|
||||
file_ops.o \
|
||||
libretro-common/file/nbio/nbio_stdio.o \
|
||||
libretro-common/file/file_path.o \
|
||||
file_path_special.o \
|
||||
libretro-common/hash/rhash.o \
|
||||
audio/audio_driver.o \
|
||||
input/input_driver.o \
|
||||
input/input_hid_driver.o \
|
||||
gfx/video_common.o \
|
||||
gfx/video_driver.o \
|
||||
gfx/video_pixel_converter.o \
|
||||
gfx/video_viewport.o \
|
||||
camera/camera_driver.o \
|
||||
location/location_driver.o \
|
||||
driver.o \
|
||||
configuration.o \
|
||||
libretro-common/dynamic/dylib.o \
|
||||
dynamic.o \
|
||||
cores/dynamic_dummy.o \
|
||||
libretro-common/queues/message_queue.o \
|
||||
rewind.o \
|
||||
gfx/drivers_font_renderer/bitmapfont.o \
|
||||
input/input_autodetect.o \
|
||||
input/input_joypad_driver.o \
|
||||
input/input_joypad.o \
|
||||
input/input_common.o \
|
||||
input/input_keymaps.o \
|
||||
input/input_remapping.o \
|
||||
input/input_sensor.o \
|
||||
tasks/task_overlay.o \
|
||||
input/input_overlay.o \
|
||||
patch.o \
|
||||
libretro-common/queues/fifo_buffer.o \
|
||||
core_options.o \
|
||||
libretro-common/compat/compat_fnmatch.o \
|
||||
libretro-common/compat/compat_posix_string.o \
|
||||
cheats.o \
|
||||
core_info.o \
|
||||
libretro-common/file/config_file.o \
|
||||
libretro-common/file/config_file_userdata.o \
|
||||
screenshot.o \
|
||||
libretro-common/gfx/scaler/scaler.o \
|
||||
gfx/drivers_shader/shader_null.o \
|
||||
gfx/video_shader_driver.o \
|
||||
gfx/video_shader_parse.o \
|
||||
libretro-common/gfx/scaler/pixconv.o \
|
||||
libretro-common/gfx/scaler/scaler_int.o \
|
||||
libretro-common/gfx/scaler/scaler_filter.o \
|
||||
gfx/font_driver.o \
|
||||
gfx/font_renderer_driver.o \
|
||||
gfx/video_filter.o \
|
||||
audio/audio_resampler_driver.o \
|
||||
audio/audio_dsp_filter.o \
|
||||
audio/drivers_resampler/sinc.o \
|
||||
audio/drivers_resampler/nearest.o \
|
||||
audio/drivers_resampler/cc_resampler.o \
|
||||
location/drivers/nulllocation.o \
|
||||
camera/drivers/nullcamera.o \
|
||||
gfx/drivers/nullgfx.o \
|
||||
audio/drivers/nullaudio.o \
|
||||
input/drivers/nullinput.o \
|
||||
input/drivers_hid/null_hid.o \
|
||||
input/drivers_joypad/null_joypad.o \
|
||||
input/drivers_joypad/hid_joypad.o \
|
||||
playlist.o \
|
||||
movie.o \
|
||||
record/record_driver.o \
|
||||
record/drivers/record_null.o \
|
||||
performance.o
|
||||
|
||||
ifneq ($(HAVE_GETOPT_LONG), 1)
|
||||
OBJ += libretro-common/compat/compat_getopt.o
|
||||
endif
|
||||
|
||||
ifneq ($(HAVE_STRCASESTR), 1)
|
||||
OBJ += libretro-common/compat/compat_strcasestr.o
|
||||
endif
|
||||
|
||||
ifneq ($(HAVE_STRL), 1)
|
||||
OBJ += libretro-common/compat/compat_strl.o
|
||||
endif
|
||||
|
||||
OBJ += gfx/image/image.o
|
||||
|
||||
ifneq ($(C89_BUILD), 1)
|
||||
# stb_image is not a C89-compliant API.
|
||||
ifeq ($(HAVE_IMAGEVIEWER), 1)
|
||||
DEFINES += -DHAVE_IMAGEVIEWER
|
||||
OBJ += cores/image_core.o
|
||||
endif
|
||||
endif
|
||||
|
||||
# Qt
|
||||
|
||||
ifeq ($(HAVE_QT), 1)
|
||||
OBJ += ui/drivers/ui_qt.o
|
||||
# TODO/FIXME - figure out which libraries we need to link against
|
||||
LIBS += -lQt5Quick -lQt5Widgets -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lglu32 -lopengl32 -L./ui/drivers/qt/release -lwrapper
|
||||
LIBS += -lQt5Quick -lQt5Widgets -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lglu32 -lopengl32 -L./ui/drivers/qt/wrapper/build/release -lwrapper
|
||||
endif
|
||||
|
||||
# LibretroDB
|
||||
|
||||
ifeq ($(HAVE_LIBRETRODB), 1)
|
||||
OBJ += libretro-db/bintree.o \
|
||||
libretro-db/libretrodb.o \
|
||||
libretro-db/query.o \
|
||||
libretro-db/rmsgpack.o \
|
||||
libretro-db/rmsgpack_dom.o \
|
||||
database_info.o \
|
||||
tasks/task_database.o
|
||||
libretro-db/libretrodb.o \
|
||||
libretro-db/query.o \
|
||||
libretro-db/rmsgpack.o \
|
||||
libretro-db/rmsgpack_dom.o \
|
||||
database_info.o \
|
||||
tasks/task_database.o \
|
||||
tasks/task_database_cue.o
|
||||
endif
|
||||
|
||||
# Miscellaneous
|
||||
@ -242,24 +254,17 @@ ifeq ($(HAVE_STDIN_CMD), 1)
|
||||
DEFINES += -DHAVE_COMMAND -DHAVE_STDIN_CMD
|
||||
endif
|
||||
|
||||
ifneq ($(C89_BUILD), 1)
|
||||
# Python 3.x bindings are not C89-compliant.
|
||||
ifeq ($(HAVE_PYTHON), 1)
|
||||
DEFINES += $(PYTHON_CFLAGS) -Wno-unused-parameter
|
||||
LIBS += $(PYTHON_LIBS)
|
||||
OBJ += gfx/video_state_python.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OSX), 1)
|
||||
DEFINES += -Wno-invalid-source-encoding
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_EMSCRIPTEN), 1)
|
||||
OBJ += frontend/drivers/platform_emscripten.o \
|
||||
input/drivers/rwebinput_input.o \
|
||||
audio/drivers/rwebaudio.o \
|
||||
camera/drivers/rwebcam.o
|
||||
input/drivers/rwebinput_input.o \
|
||||
audio/drivers/rwebaudio.o \
|
||||
camera/drivers/rwebcam.o
|
||||
endif
|
||||
|
||||
# Audio
|
||||
@ -304,7 +309,7 @@ ifeq ($(HAVE_AL), 1)
|
||||
endif
|
||||
|
||||
ifneq ($(findstring Darwin,$(OS)),)
|
||||
OBJ += frontend/drivers/platform_darwin.o
|
||||
OBJ += frontend/drivers/platform_darwin.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_JACK),1)
|
||||
@ -313,14 +318,11 @@ ifeq ($(HAVE_JACK),1)
|
||||
DEFINES += $(JACK_CFLAGS)
|
||||
endif
|
||||
|
||||
ifneq ($(C89_BUILD), 1)
|
||||
# PulseAudio is not a C89-compliant API.
|
||||
ifeq ($(HAVE_PULSE), 1)
|
||||
OBJ += audio/drivers/pulse.o
|
||||
LIBS += $(PULSE_LIBS)
|
||||
DEFINES += $(PULSE_CFLAGS)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_OSS_LIB), 1)
|
||||
LIBS += -lossaudio
|
||||
@ -348,7 +350,7 @@ endif
|
||||
|
||||
ifeq ($(HAVE_NEON),1)
|
||||
OBJ += audio/drivers_resampler/sinc_neon.o \
|
||||
audio/drivers_resampler/cc_resampler_neon.o
|
||||
audio/drivers_resampler/cc_resampler_neon.o
|
||||
# When compiled without this, tries to attempt to compile sinc lerp,
|
||||
# which will error out
|
||||
#
|
||||
@ -363,27 +365,36 @@ ifeq ($(HAVE_NEON),1)
|
||||
OBJ += audio/audio_utils_neon.o
|
||||
endif
|
||||
|
||||
# XMB and GLUI are always enabled if supported and not explicitly disabled
|
||||
# XMB and MaterialUI are always enabled if supported and not explicitly disabled
|
||||
ifeq ($(HAVE_RGUI)$(HAVE_GL_CONTEXT), 11)
|
||||
ifeq ($(HAVE_GLUI),)
|
||||
HAVE_GLUI = 1
|
||||
ifeq ($(HAVE_ZARCH),)
|
||||
HAVE_ZARCH = 1
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_MATERIALUI),)
|
||||
HAVE_MATERIALUI = 1
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_XMB),)
|
||||
HAVE_XMB = 1
|
||||
endif
|
||||
else
|
||||
HAVE_GLUI = 0
|
||||
HAVE_XMB = 0
|
||||
HAVE_ZARCH = 0
|
||||
HAVE_MATERIALUI = 0
|
||||
HAVE_XMB = 0
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RGUI), 1)
|
||||
OBJ += menu/drivers/rgui.o
|
||||
DEFINES += -DHAVE_MENU -DHAVE_RGUI
|
||||
HAVE_MENU_COMMON = 1
|
||||
ifeq ($(HAVE_GLUI), 1)
|
||||
OBJ += menu/drivers/glui.o
|
||||
DEFINES += -DHAVE_GLUI
|
||||
ifeq ($(HAVE_MATERIALUI), 1)
|
||||
OBJ += menu/drivers/materialui.o
|
||||
DEFINES += -DHAVE_MATERIALUI
|
||||
endif
|
||||
ifeq ($(HAVE_ZARCH), 1)
|
||||
OBJ += menu/drivers/zarch.o
|
||||
DEFINES += -DHAVE_ZARCH
|
||||
endif
|
||||
ifeq ($(HAVE_XMB), 1)
|
||||
OBJ += menu/drivers/xmb.o
|
||||
@ -391,47 +402,60 @@ ifeq ($(HAVE_XMB), 1)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LAKKA), 1)
|
||||
DEFINES += -DHAVE_LAKKA
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
ifeq ($(PSEUDOLOC), 1)
|
||||
PSEUDO_NS := pseudo
|
||||
else
|
||||
PSEUDO_NS :=
|
||||
endif
|
||||
OBJ += menu/menu.o \
|
||||
menu/menu_hash.o \
|
||||
menu/intl/menu_hash_de.o \
|
||||
menu/intl/menu_hash_es.o \
|
||||
menu/intl/menu_hash_eo.o \
|
||||
menu/intl/menu_hash_fr.o \
|
||||
menu/intl/menu_hash_it.o \
|
||||
menu/intl/menu_hash_nl.o \
|
||||
menu/intl/menu_hash_pl.o \
|
||||
menu/intl/menu_hash_pt.o \
|
||||
menu/intl/menu_hash_us.o \
|
||||
menu/menu_input.o \
|
||||
menu/menu_entry.o \
|
||||
menu/menu_entries.o \
|
||||
menu/menu_navigation.o \
|
||||
menu/menu_setting.o \
|
||||
menu/menu_shader.o \
|
||||
menu/menu_video.o \
|
||||
menu/menu_cbs.o \
|
||||
menu/cbs/menu_cbs_ok.o \
|
||||
menu/cbs/menu_cbs_cancel.o \
|
||||
menu/cbs/menu_cbs_select.o \
|
||||
menu/cbs/menu_cbs_start.o \
|
||||
menu/cbs/menu_cbs_info.o \
|
||||
menu/cbs/menu_cbs_refresh.o \
|
||||
menu/cbs/menu_cbs_left.o \
|
||||
menu/cbs/menu_cbs_right.o \
|
||||
menu/cbs/menu_cbs_deferred_push.o \
|
||||
menu/cbs/menu_cbs_scan.o \
|
||||
menu/cbs/menu_cbs_get_value.o \
|
||||
menu/cbs/menu_cbs_iterate.o \
|
||||
menu/cbs/menu_cbs_title.o \
|
||||
menu/cbs/menu_cbs_up.o \
|
||||
menu/cbs/menu_cbs_down.o \
|
||||
menu/cbs/menu_cbs_contentlist_switch.o \
|
||||
menu/menu_list.o \
|
||||
menu/menu_display.o \
|
||||
menu/menu_displaylist.o \
|
||||
menu/menu_animation.o \
|
||||
menu/drivers/null.o
|
||||
menu/menu_hash.o \
|
||||
menu/menu_driver.o \
|
||||
menu/intl/menu_hash_de.o \
|
||||
menu/intl/menu_hash_es.o \
|
||||
menu/intl/menu_hash_eo.o \
|
||||
menu/intl/menu_hash_fr.o \
|
||||
menu/intl/menu_hash_it.o \
|
||||
menu/intl/menu_hash_nl.o \
|
||||
menu/intl/menu_hash_pl.o \
|
||||
menu/intl/menu_hash_pt.o \
|
||||
menu/intl/menu_hash_us$(PSEUDO_NS).o \
|
||||
menu/menu_input.o \
|
||||
menu/menu_entry.o \
|
||||
menu/menu_entries.o \
|
||||
menu/menu_navigation.o \
|
||||
menu/menu_setting.o \
|
||||
menu/menu_shader.o \
|
||||
menu/menu_cbs.o \
|
||||
menu/cbs/menu_cbs_ok.o \
|
||||
menu/cbs/menu_cbs_cancel.o \
|
||||
menu/cbs/menu_cbs_select.o \
|
||||
menu/cbs/menu_cbs_start.o \
|
||||
menu/cbs/menu_cbs_info.o \
|
||||
menu/cbs/menu_cbs_refresh.o \
|
||||
menu/cbs/menu_cbs_left.o \
|
||||
menu/cbs/menu_cbs_right.o \
|
||||
menu/cbs/menu_cbs_deferred_push.o \
|
||||
menu/cbs/menu_cbs_scan.o \
|
||||
menu/cbs/menu_cbs_get_value.o \
|
||||
menu/cbs/menu_cbs_title.o \
|
||||
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 \
|
||||
menu/drivers/menu_generic.o \
|
||||
menu/drivers/null.o
|
||||
endif
|
||||
|
||||
ifeq ($(UTF8), 1)
|
||||
DEFINES += -DHAVE_UTF8
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_STB_FONT), 1)
|
||||
@ -447,6 +471,8 @@ endif
|
||||
ifeq ($(HAVE_THREADS), 1)
|
||||
OBJ += autosave.o \
|
||||
libretro-common/rthreads/rthreads.o \
|
||||
libretro-common/rthreads/rsemaphore.o \
|
||||
libretro-common/rthreads/async_job.o \
|
||||
gfx/video_thread_wrapper.o \
|
||||
audio/audio_thread_wrapper.o
|
||||
DEFINES += -DHAVE_THREADS
|
||||
@ -461,21 +487,17 @@ endif
|
||||
|
||||
#Input
|
||||
|
||||
ifneq ($(C89_BUILD), 1)
|
||||
# Wayland is not a C89-compliant API.
|
||||
ifeq ($(HAVE_WAYLAND), 1)
|
||||
#OBJ += input/drivers/wayland.o
|
||||
DEFINES += $(WAYLAND_CFLAGS)
|
||||
LIBS += $(WAYLAND_LIBS)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_DINPUT), 1)
|
||||
LIBS += -ldinput8 -ldxguid -lole32
|
||||
DEFINES += -DHAVE_DINPUT
|
||||
OBJ += input/drivers/dinput.o \
|
||||
input/drivers_joypad/dinput_joypad.o
|
||||
JOYCONFIG_LIBS += -ldinput8 -ldxguid -lole32
|
||||
input/drivers_joypad/dinput_joypad.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_XINPUT), 1)
|
||||
@ -486,8 +508,9 @@ endif
|
||||
|
||||
ifeq ($(HAVE_X11), 1)
|
||||
OBJ += input/drivers/x11_input.o \
|
||||
gfx/common/x11_common.o \
|
||||
input/drivers_keyboard/keyboard_event_x11.o
|
||||
gfx/common/x11_common.o \
|
||||
input/drivers_keyboard/keyboard_event_x11.o
|
||||
|
||||
LIBS += $(X11_LIBS) $(XEXT_LIBS) $(XF86VM_LIBS) $(XINERAMA_LIBS)
|
||||
DEFINES += $(X11_CFLAGS) $(XEXT_CFLAGS) $(XF86VM_CFLAGS) $(XINERAMA_CFLAGS)
|
||||
endif
|
||||
@ -501,28 +524,22 @@ endif
|
||||
ifeq ($(HAVE_UDEV), 1)
|
||||
DEFINES += $(UDEV_CFLAGS)
|
||||
LIBS += $(UDEV_LIBS)
|
||||
JOYCONFIG_LIBS += $(UDEV_LIBS)
|
||||
OBJ += input/drivers/udev_input.o \
|
||||
input/drivers_joypad/udev_joypad.o
|
||||
input/drivers_joypad/udev_joypad.o
|
||||
endif
|
||||
|
||||
ifneq ($(C89_BUILD), 1)
|
||||
# libusb is not a C89-compliant API.
|
||||
ifeq ($(HAVE_LIBUSB), 1)
|
||||
DEFINES += -DHAVE_LIBUSB
|
||||
OBJ += input/drivers_hid/libusb_hid.o
|
||||
LIBS += -lusb-1.0
|
||||
JOYCONFIG_LIBS += -lusb-1.0
|
||||
HAVE_HID = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_IOHIDMANAGER), 1)
|
||||
DEFINES += -DHAVE_IOHIDMANAGER
|
||||
OBJ += input/drivers_hid/iohidmanager_hid.o
|
||||
HAVE_HID = 1
|
||||
LIBS += -framework IOKit
|
||||
JOYCONFIG_LIBS += -framework IOKit
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_CORELOCATION), 1)
|
||||
@ -533,9 +550,9 @@ endif
|
||||
ifeq ($(HAVE_HID), 1)
|
||||
DEFINES += -DHAVE_HID
|
||||
OBJ += input/connect/joypad_connection.o \
|
||||
input/connect/connect_ps3.o \
|
||||
input/connect/connect_ps4.o \
|
||||
input/connect/connect_wii.o
|
||||
input/connect/connect_ps3.o \
|
||||
input/connect/connect_ps4.o \
|
||||
input/connect/connect_wii.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_PARPORT), 1)
|
||||
@ -544,17 +561,28 @@ endif
|
||||
|
||||
# Video
|
||||
|
||||
OBJ += gfx/video_context_driver.o \
|
||||
gfx/drivers_context/gfx_null_ctx.o \
|
||||
gfx/video_state_tracker.o \
|
||||
libretro-common/gfx/math/matrix_4x4.o \
|
||||
libretro-common/gfx/math/matrix_3x3.o
|
||||
|
||||
ifneq ($(findstring Win32,$(OS)),)
|
||||
OBJ += gfx/video_texture.o
|
||||
else
|
||||
OBJ += gfx/video_texture_c.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_GL_CONTEXT), 1)
|
||||
DEFINES += -DHAVE_OPENGL -DHAVE_GLSL
|
||||
OBJ += gfx/drivers/gl.o \
|
||||
gfx/video_context_driver.o \
|
||||
gfx/drivers_context/gfx_null_ctx.o \
|
||||
gfx/drivers/gl_common.o \
|
||||
gfx/drivers_font/gl_raster_font.o \
|
||||
libretro-common/gfx/math/matrix_4x4.o \
|
||||
gfx/video_state_tracker.o \
|
||||
gfx/video_texture.o \
|
||||
libretro-common/glsym/rglgen.o
|
||||
gfx/common/gl_common.o \
|
||||
gfx/drivers_font/gl_raster_font.o \
|
||||
libretro-common/glsym/rglgen.o
|
||||
|
||||
ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
OBJ += menu/drivers_display/menu_display_gl.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_KMS), 1)
|
||||
OBJ += gfx/drivers_context/drm_egl_ctx.o
|
||||
@ -595,15 +623,12 @@ ifeq ($(HAVE_GL_CONTEXT), 1)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(C89_BUILD), 1)
|
||||
# Wayland is not a C89-compliant API.
|
||||
ifeq ($(HAVE_WAYLAND), 1)
|
||||
ifeq ($(HAVE_EGL), 1)
|
||||
OBJ += gfx/drivers_context/wayland_ctx.o
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(HAVE_GLES), 1)
|
||||
LIBS += $(GLES_LIBS)
|
||||
DEFINES += $(GLES_CFLAGS) -DHAVE_OPENGLES -DHAVE_OPENGLES2
|
||||
@ -620,12 +645,13 @@ endif
|
||||
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 gfx/drivers_wm/win32_shader_dlg.o
|
||||
OBJ += gfx/drivers_context/wgl_ctx.o \
|
||||
gfx/drivers_wm/win32_shader_dlg.o
|
||||
endif
|
||||
LIBS += $(GL_LIBS)
|
||||
endif
|
||||
|
||||
OBJ += gfx/drivers_shader/shader_glsl.o
|
||||
OBJ += gfx/drivers_shader/shader_glsl.o
|
||||
DEFINES += -DHAVE_GLSL
|
||||
endif
|
||||
|
||||
@ -635,30 +661,28 @@ endif
|
||||
|
||||
ifeq ($(HAVE_SDL), 1)
|
||||
OBJ += gfx/drivers/sdl_gfx.o \
|
||||
input/drivers/sdl_input.o \
|
||||
input/drivers_joypad/sdl_joypad.o \
|
||||
audio/drivers/sdl_audio.o
|
||||
input/drivers/sdl_input.o \
|
||||
input/drivers_joypad/sdl_joypad.o \
|
||||
audio/drivers/sdl_audio.o
|
||||
|
||||
ifeq ($(HAVE_GL_CONTEXT), 1)
|
||||
OBJ += gfx/drivers_context/sdl_gl_ctx.o
|
||||
endif
|
||||
|
||||
JOYCONFIG_LIBS += $(SDL_LIBS)
|
||||
DEFINES += $(SDL_CFLAGS) $(BSD_LOCAL_INC)
|
||||
LIBS += $(SDL_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SDL2), 1)
|
||||
OBJ += gfx/drivers/sdl2_gfx.o \
|
||||
input/drivers/sdl_input.o \
|
||||
input/drivers_joypad/sdl_joypad.o \
|
||||
audio/drivers/sdl_audio.o
|
||||
input/drivers/sdl_input.o \
|
||||
input/drivers_joypad/sdl_joypad.o \
|
||||
audio/drivers/sdl_audio.o
|
||||
|
||||
ifeq ($(HAVE_GL_CONTEXT), 1)
|
||||
OBJ += gfx/drivers_context/sdl_gl_ctx.o
|
||||
endif
|
||||
|
||||
JOYCONFIG_LIBS += $(SDL2_LIBS)
|
||||
DEFINES += $(SDL2_CFLAGS) $(BSD_LOCAL_INC)
|
||||
LIBS += $(SDL2_LIBS)
|
||||
HAVE_SDL = 0
|
||||
@ -670,7 +694,7 @@ endif
|
||||
|
||||
ifeq ($(HAVE_EXYNOS), 1)
|
||||
OBJ += gfx/drivers/exynos_gfx.o \
|
||||
mem/neon/memcpy-neon.o
|
||||
memory/neon/memcpy-neon.o
|
||||
LIBS += $(DRM_LIBS) $(EXYNOS_LIBS)
|
||||
DEFINES += $(DRM_CFLAGS) $(EXYNOS_CFLAGS)
|
||||
endif
|
||||
@ -683,22 +707,27 @@ endif
|
||||
|
||||
ifeq ($(HAVE_SUNXI), 1)
|
||||
OBJ += gfx/drivers/sunxi_gfx.o \
|
||||
gfx/pixman/pixman-arm-neon-asm.o
|
||||
gfx/include/pixman/pixman-arm-neon-asm.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_VG), 1)
|
||||
OBJ += gfx/drivers/vg.o \
|
||||
libretro-common/gfx/math/matrix_3x3.o
|
||||
OBJ += gfx/drivers/vg.o
|
||||
DEFINES += $(VG_CFLAGS)
|
||||
LIBS += $(VG_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_XVIDEO), 1)
|
||||
OBJ += gfx/drivers/xvideo.o
|
||||
LIBS += $(XVIDEO_LIBS)
|
||||
LIBS += $(XVIDEO_LIBS)
|
||||
DEFINES += $(XVIDEO_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_XSHM), 1)
|
||||
OBJ += gfx/drivers/xshm.o
|
||||
LIBS += $(XSHM_LIBS)
|
||||
DEFINES += $(XSHM_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_CG), 1)
|
||||
DEFINES += -DHAVE_CG
|
||||
OBJ += gfx/drivers_shader/shader_gl_cg.o
|
||||
@ -707,17 +736,21 @@ endif
|
||||
|
||||
ifeq ($(HAVE_D3D9), 1)
|
||||
OBJ += gfx/d3d/d3d.o \
|
||||
gfx/d3d/render_chain_null.o \
|
||||
gfx/d3d/render_chain_driver.o \
|
||||
gfx/d3d/d3d_wrapper.o \
|
||||
gfx/drivers_font/d3d_w32_font.o \
|
||||
gfx/drivers_context/d3d_ctx.o
|
||||
gfx/d3d/render_chain_null.o \
|
||||
gfx/d3d/render_chain_driver.o \
|
||||
gfx/d3d/d3d_wrapper.o \
|
||||
gfx/drivers_font/d3d_w32_font.o \
|
||||
gfx/drivers_context/d3d_ctx.o
|
||||
DEFINES += -DHAVE_D3D -DHAVE_D3D9
|
||||
LIBS += -ld3d9 -ld3dx9 -ldxguid
|
||||
|
||||
ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
OBJ += menu/drivers_display/menu_display_d3d.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_CG), 1)
|
||||
LIBS += -lcgD3D9
|
||||
OBJ += gfx/d3d/render_chain_cg.o
|
||||
OBJ += gfx/d3d/render_chain_cg.o
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -732,36 +765,32 @@ endif
|
||||
|
||||
ifeq ($(HAVE_7ZIP),1)
|
||||
CFLAGS += -I./deps/7zip
|
||||
HAVE_COMPRESSION = 1
|
||||
HAVE_COMPRESSION = 1
|
||||
DEFINES += -DHAVE_7ZIP
|
||||
7ZOBJ = deps/7zip/7zIn.o \
|
||||
deps/7zip/7zAlloc.o \
|
||||
deps/7zip/Bra86.o \
|
||||
deps/7zip/CpuArch.o \
|
||||
deps/7zip/7zFile.o \
|
||||
deps/7zip/7zStream.o \
|
||||
deps/7zip/7zBuf2.o \
|
||||
deps/7zip/LzmaDec.o \
|
||||
deps/7zip/7zCrcOpt.o \
|
||||
deps/7zip/Bra.o \
|
||||
deps/7zip/7zDec.o \
|
||||
deps/7zip/Bcj2.o \
|
||||
deps/7zip/7zCrc.o \
|
||||
deps/7zip/Lzma2Dec.o \
|
||||
deps/7zip/7zBuf.o \
|
||||
decompress/7zip_support.o
|
||||
7ZOBJ = deps/7zip/7zIn.o \
|
||||
deps/7zip/7zAlloc.o \
|
||||
deps/7zip/Bra86.o \
|
||||
deps/7zip/7zFile.o \
|
||||
deps/7zip/7zStream.o \
|
||||
deps/7zip/7zBuf2.o \
|
||||
deps/7zip/LzmaDec.o \
|
||||
deps/7zip/7zCrcOpt.o \
|
||||
deps/7zip/Bra.o \
|
||||
deps/7zip/7zDec.o \
|
||||
deps/7zip/Bcj2.o \
|
||||
deps/7zip/7zCrc.o \
|
||||
deps/7zip/Lzma2Dec.o \
|
||||
deps/7zip/7zBuf.o
|
||||
OBJ += $(7ZOBJ)
|
||||
endif
|
||||
|
||||
OBJ += libretro-common/formats/tga/tga_decode.o
|
||||
|
||||
ifeq ($(HAVE_ZLIB), 1)
|
||||
ZLIB_OBJS = decompress/zip_support.o
|
||||
OBJ += libretro-common/file/file_extract.o
|
||||
OBJ += libretro-common/file/file_extract.o
|
||||
OBJ += $(ZLIB_OBJS)
|
||||
DEFINES += -DHAVE_ZLIB
|
||||
HAVE_RPNG = 1
|
||||
HAVE_COMPRESSION = 1
|
||||
HAVE_COMPRESSION = 1
|
||||
ifeq ($(WANT_ZLIB), 1)
|
||||
DEFINES += -DWANT_ZLIB
|
||||
else
|
||||
@ -775,37 +804,38 @@ ifdef HAVE_RPNG
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RPNG), 1)
|
||||
OBJ += libretro-common/formats/png/rpng_nbio.o \
|
||||
libretro-common/formats/png/rpng_fbio.o \
|
||||
libretro-common/formats/png/rpng_decode.o \
|
||||
libretro-common/formats/png/rpng_encode.o
|
||||
OBJ += libretro-common/formats/png/rpng.o \
|
||||
libretro-common/formats/png/rpng_encode.o
|
||||
endif
|
||||
OBJ += libretro-common/formats/bmp/rbmp_encode.o \
|
||||
libretro-common/formats/tga/rtga.o \
|
||||
libretro-common/formats/json/jsonsax.o
|
||||
|
||||
ifdef HAVE_COMPRESSION
|
||||
DEFINES += -DHAVE_COMPRESSION
|
||||
endif
|
||||
|
||||
ifeq ($(WANT_ZLIB),1)
|
||||
OBJ += deps/zlib/adler32.o \
|
||||
deps/zlib/compress.o \
|
||||
deps/zlib/crc32.o \
|
||||
deps/zlib/deflate.o \
|
||||
deps/zlib/gzclose.o \
|
||||
deps/zlib/gzlib.o \
|
||||
deps/zlib/gzread.o \
|
||||
deps/zlib/gzwrite.o \
|
||||
deps/zlib/inffast.o \
|
||||
deps/zlib/inflate.o \
|
||||
deps/zlib/inftrees.o \
|
||||
deps/zlib/trees.o \
|
||||
deps/zlib/uncompr.o \
|
||||
deps/zlib/zutil.o \
|
||||
deps/zlib/ioapi.o \
|
||||
deps/zlib/unzip.o
|
||||
OBJ += deps/zlib/adler32.o \
|
||||
deps/zlib/compress.o \
|
||||
deps/zlib/crc32.o \
|
||||
deps/zlib/deflate.o \
|
||||
deps/zlib/gzclose.o \
|
||||
deps/zlib/gzlib.o \
|
||||
deps/zlib/gzread.o \
|
||||
deps/zlib/gzwrite.o \
|
||||
deps/zlib/inffast.o \
|
||||
deps/zlib/inflate.o \
|
||||
deps/zlib/inftrees.o \
|
||||
deps/zlib/trees.o \
|
||||
deps/zlib/uncompr.o \
|
||||
deps/zlib/zutil.o \
|
||||
deps/zlib/ioapi.o \
|
||||
deps/zlib/unzip.o
|
||||
else
|
||||
ifeq ($(HAVE_ZLIB),1)
|
||||
ZLIB_OBJS = deps/zlib/unzip.o \
|
||||
deps/zlib/ioapi.o
|
||||
deps/zlib/ioapi.o
|
||||
OBJ += $(ZLIB_OBJS)
|
||||
HAVE_ZLIB_DEFLATE = 1
|
||||
endif
|
||||
@ -822,34 +852,46 @@ ifeq ($(HAVE_V4L2),1)
|
||||
DEFINES += -DHAVE_V4L2
|
||||
endif
|
||||
|
||||
# Netplay
|
||||
# Things that depend on network availability
|
||||
|
||||
ifeq ($(HAVE_NETWORKING), 1)
|
||||
DEFINES += -DHAVE_NETWORKING
|
||||
OBJ += libretro-common/net/net_compat.o \
|
||||
libretro-common/net/net_http.o \
|
||||
tasks/task_http.o
|
||||
libretro-common/net/net_http.o \
|
||||
net_http_special.o \
|
||||
tasks/task_http.o
|
||||
|
||||
ifneq ($(findstring Win32,$(OS)),)
|
||||
LIBS += -lws2_32
|
||||
endif
|
||||
|
||||
# Netplay
|
||||
|
||||
ifeq ($(HAVE_NETPLAY), 1)
|
||||
DEFINES += -DHAVE_NETPLAY -DHAVE_NETWORK_CMD
|
||||
OBJ += netplay.o
|
||||
endif
|
||||
|
||||
# Retro Achievements (also depends on threads)
|
||||
|
||||
ifeq ($(HAVE_CHEEVOS), 1)
|
||||
ifeq ($(HAVE_THREADS), 1)
|
||||
DEFINES += -DHAVE_CHEEVOS
|
||||
OBJ += cheevos.o libretro-common/utils/md5.o
|
||||
endif
|
||||
endif
|
||||
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
|
||||
gfx/common/win32_common.o \
|
||||
frontend/drivers/platform_win32.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_AVFOUNDATION), 1)
|
||||
ifeq ($(HAVE_COCOA), 1)
|
||||
DEFINES += -DHAVE_AVFOUNDATION
|
||||
DEFINES += -DHAVE_AVFOUNDATION
|
||||
LIBS += -framework AVFoundation
|
||||
LIBS += -framework CoreVideo
|
||||
LIBS += -framework CoreMedia
|
||||
@ -858,30 +900,23 @@ endif
|
||||
|
||||
# Record
|
||||
|
||||
ifneq ($(C89_BUILD), 1)
|
||||
# ffmpeg and friends are not C89-compliant APIs.
|
||||
ifeq ($(HAVE_FFMPEG), 1)
|
||||
OBJ += record/drivers/record_ffmpeg.o \
|
||||
cores/ffmpeg_core.o
|
||||
cores/libretro-ffmpeg/ffmpeg_core.o
|
||||
LIBS += $(AVCODEC_LIBS) $(AVFORMAT_LIBS) $(AVUTIL_LIBS) $(SWSCALE_LIBS) $(SWRESAMPLE_LIBS) $(FFMPEG_LIBS)
|
||||
DEFINES += $(AVCODEC_CFLAGS) $(AVFORMAT_CFLAGS) $(AVUTIL_CFLAGS) $(SWSCALE_CFLAGS) $(SWRESAMPLE_CFLAGS)
|
||||
DEFINES += -DHAVE_FFMPEG -Iffmpeg
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_COMPRESSION), 1)
|
||||
DEFINES += -DHAVE_COMPRESSION
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_COCOA),1)
|
||||
DEFINES += -DHAVE_MAIN
|
||||
OBJ += input/drivers/cocoa_input.o \
|
||||
input/drivers_keyboard/keyboard_event_apple.o \
|
||||
ui/drivers/ui_cocoa.o \
|
||||
ui/drivers/cocoa/cocoa_common.o \
|
||||
gfx/drivers_context/cocoa_gl_ctx.o
|
||||
input/drivers_keyboard/keyboard_event_apple.o \
|
||||
ui/drivers/ui_cocoa.o \
|
||||
ui/drivers/cocoa/cocoa_common.o \
|
||||
gfx/drivers_context/cocoa_gl_ctx.o
|
||||
endif
|
||||
|
||||
|
||||
# Joyconfig binary
|
||||
JOYCONFIG_OBJ += tools/retroarch-joyconfig-griffin.o
|
||||
|
364
Makefile.ctr
364
Makefile.ctr
@ -1,8 +1,236 @@
|
||||
TARGET := retroarch_3ds
|
||||
LIBRETRO =
|
||||
|
||||
DEBUG = 0
|
||||
GRIFFIN_BUILD = 1
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
BUILD_3DSX = 1
|
||||
BUILD_3DS = 1
|
||||
BUILD_CIA = 1
|
||||
|
||||
APP_TITLE = Retroarch 3DS
|
||||
APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RETROARCH-3DS
|
||||
APP_UNIQUE_ID = 0xBAC00
|
||||
APP_ICON = ctr/default.png
|
||||
APP_BANNER = ctr/libretro_banner.png
|
||||
APP_AUDIO = ctr/silent.wav
|
||||
APP_RSF = ctr/tools/template.rsf
|
||||
APP_SYSTEM_MODE = 64MB
|
||||
APP_SYSTEM_MODE_EXT = 124MB
|
||||
APP_BIG_TEXT_SECTION = 0
|
||||
|
||||
include ctr/Makefile.cores
|
||||
|
||||
OBJS :=
|
||||
OBJS += gfx/drivers/ctr_sprite.o griffin/griffin.o
|
||||
#NO_SMDH = 1
|
||||
DEBUG = 0
|
||||
OBJS += gfx/drivers/ctr_sprite.o
|
||||
OBJS += ctr/ctr_system.o
|
||||
OBJS += ctr/ctr_memory.o
|
||||
OBJS += ctr/ctr_linear.o
|
||||
OBJS += ctr/ctr_svchax.o
|
||||
|
||||
ifeq ($(GRIFFIN_BUILD), 1)
|
||||
OBJS += griffin/griffin.o
|
||||
else
|
||||
OBJS += libretro-common/file/file_extract.o
|
||||
OBJS += performance.o
|
||||
OBJS += libretro-common/compat/compat_getopt.o
|
||||
OBJS += libretro-common/compat/compat_strcasestr.o
|
||||
OBJS += libretro-common/compat/compat_strl.o
|
||||
OBJS += libretro-common/compat/compat_fnmatch.o
|
||||
OBJS += libretro-common/memmap/memalign.o
|
||||
OBJS += libretro-common/file/config_file.o
|
||||
OBJS += libretro-common/file/config_file_userdata.o
|
||||
OBJS += core_options.o
|
||||
OBJS += cheats.o
|
||||
OBJS += libretro-common/hash/rhash.o
|
||||
OBJS += gfx/video_context_driver.o
|
||||
OBJS += gfx/drivers_context/gfx_null_ctx.o
|
||||
OBJS += gfx/image/image.o
|
||||
OBJS += gfx/video_texture.o
|
||||
OBJS += libretro-common/formats/tga/rtga.o
|
||||
OBJS += libretro-common/formats/png/rpng.o
|
||||
OBJS += libretro-common/formats/png/rpng_encode.o
|
||||
OBJS += libretro-common/formats/bmp/rbmp_encode.o
|
||||
OBJS += libretro-common/gfx/math/matrix_4x4.o
|
||||
OBJS += libretro-common/gfx/math/matrix_3x3.o
|
||||
OBJS += gfx/drivers/ctr_gfx.o
|
||||
OBJS += gfx/drivers/nullgfx.o
|
||||
OBJS += gfx/font_renderer_driver.o
|
||||
OBJS += gfx/drivers_font_renderer/bitmapfont.o
|
||||
OBJS += gfx/font_driver.o
|
||||
OBJS += input/input_autodetect.o
|
||||
OBJS += input/input_joypad_driver.o
|
||||
OBJS += input/input_joypad.o
|
||||
OBJS += input/input_hid_driver.o
|
||||
OBJS += input/input_common.o
|
||||
OBJS += input/input_keymaps.o
|
||||
OBJS += input/input_remapping.o
|
||||
OBJS += input/input_sensor.o
|
||||
OBJS += input/keyboard_line.o
|
||||
OBJS += input/drivers/ctr_input.o
|
||||
OBJS += input/drivers_joypad/ctr_joypad.o
|
||||
OBJS += input/autoconf/builtin_ctr.o
|
||||
OBJS += input/drivers/nullinput.o
|
||||
OBJS += input/drivers_joypad/null_joypad.o
|
||||
OBJS += input/drivers_joypad/hid_joypad.o
|
||||
OBJS += input/drivers_hid/null_hid.o
|
||||
OBJS += gfx/video_state_tracker.o
|
||||
OBJS += libretro-common/queues/fifo_buffer.o
|
||||
OBJS += audio/audio_resampler_driver.o
|
||||
OBJS += audio/drivers_resampler/sinc.o
|
||||
OBJS += audio/drivers_resampler/nearest.o
|
||||
OBJS += audio/drivers_resampler/cc_resampler.o
|
||||
OBJS += camera/drivers/nullcamera.o
|
||||
OBJS += location/drivers/nulllocation.o
|
||||
OBJS += audio/drivers/ctr_csnd_audio.o
|
||||
OBJS += audio/drivers/ctr_dsp_audio.o
|
||||
OBJS += audio/drivers/nullaudio.o
|
||||
OBJS += gfx/video_driver.o
|
||||
OBJS += gfx/video_common.o
|
||||
OBJS += gfx/video_pixel_converter.o
|
||||
OBJS += gfx/video_viewport.o
|
||||
OBJS += input/input_driver.o
|
||||
OBJS += audio/audio_driver.o
|
||||
OBJS += camera/camera_driver.o
|
||||
OBJS += location/location_driver.o
|
||||
OBJS += menu/menu_driver.o
|
||||
OBJS += driver.o
|
||||
OBJS += libretro-common/gfx/scaler/scaler_filter.o
|
||||
OBJS += libretro-common/gfx/scaler/pixconv.o
|
||||
OBJS += libretro-common/gfx/scaler/scaler.o
|
||||
OBJS += libretro-common/gfx/scaler/scaler_int.o
|
||||
OBJS += gfx/video_filters/2xsai.o
|
||||
OBJS += gfx/video_filters/super2xsai.o
|
||||
OBJS += gfx/video_filters/supereagle.o
|
||||
OBJS += gfx/video_filters/2xbr.o
|
||||
OBJS += gfx/video_filters/darken.o
|
||||
OBJS += gfx/video_filters/epx.o
|
||||
OBJS += gfx/video_filters/scale2x.o
|
||||
OBJS += gfx/video_filters/blargg_ntsc_snes.o
|
||||
OBJS += gfx/video_filters/lq2x.o
|
||||
OBJS += gfx/video_filters/phosphor2x.o
|
||||
OBJS += audio/audio_filters/echo.o
|
||||
OBJS += audio/audio_filters/eq.o
|
||||
OBJS += audio/audio_filters/chorus.o
|
||||
OBJS += audio/audio_filters/iir.o
|
||||
OBJS += audio/audio_filters/panning.o
|
||||
OBJS += audio/audio_filters/phaser.o
|
||||
OBJS += audio/audio_filters/reverb.o
|
||||
OBJS += audio/audio_filters/wahwah.o
|
||||
OBJS += libretro-common/dynamic/dylib.o
|
||||
OBJS += dynamic.o
|
||||
OBJS += gfx/video_filter.o
|
||||
OBJS += audio/audio_dsp_filter.o
|
||||
OBJS += cores/dynamic_dummy.o
|
||||
OBJS += content.o
|
||||
OBJS += libretro-common/file/file_path.o
|
||||
OBJS += file_path_special.o
|
||||
OBJS += libretro-common/file/dir_list.o
|
||||
OBJS += libretro-common/file/retro_dirent.o
|
||||
OBJS += libretro-common/file/retro_file.o
|
||||
OBJS += libretro-common/file/retro_stat.o
|
||||
OBJS += dir_list_special.o
|
||||
OBJS += string_list_special.o
|
||||
OBJS += libretro-common/string/string_list.o
|
||||
OBJS += libretro-common/string/stdstring.o
|
||||
OBJS += file_ops.o
|
||||
OBJS += libretro-common/file/nbio/nbio_stdio.o
|
||||
OBJS += libretro-common/file/file_list.o
|
||||
OBJS += libretro-common/queues/message_queue.o
|
||||
OBJS += patch.o
|
||||
OBJS += configuration.o
|
||||
OBJS += rewind.o
|
||||
OBJS += frontend/frontend_driver.o
|
||||
OBJS += frontend/drivers/platform_ctr.o
|
||||
OBJS += frontend/drivers/platform_null.o
|
||||
OBJS += core_info.o
|
||||
OBJS += ui/ui_companion_driver.o
|
||||
OBJS += ui/drivers/ui_null.o
|
||||
OBJS += frontend/frontend.o
|
||||
OBJS += libretro_version_1.o
|
||||
OBJS += retroarch.o
|
||||
OBJS += retroarch_info.o
|
||||
OBJS += runloop.o
|
||||
OBJS += runloop_data.o
|
||||
OBJS += runloop_msg.o
|
||||
OBJS += system.o
|
||||
OBJS += msg_hash.o
|
||||
OBJS += intl/msg_hash_de.o
|
||||
OBJS += intl/msg_hash_es.o
|
||||
OBJS += intl/msg_hash_eo.o
|
||||
OBJS += intl/msg_hash_fr.o
|
||||
OBJS += intl/msg_hash_it.o
|
||||
OBJS += intl/msg_hash_nl.o
|
||||
OBJS += intl/msg_hash_pt.o
|
||||
OBJS += intl/msg_hash_pl.o
|
||||
OBJS += intl/msg_hash_us.o
|
||||
OBJS += movie.o
|
||||
OBJS += record/record_driver.o
|
||||
OBJS += record/drivers/record_null.o
|
||||
OBJS += tasks/task_file_transfer.o
|
||||
OBJS += screenshot.o
|
||||
OBJS += playlist.o
|
||||
OBJS += menu/menu.o
|
||||
OBJS += menu/menu_hash.o
|
||||
OBJS += menu/menu_input.o
|
||||
OBJS += menu/menu_entry.o
|
||||
OBJS += menu/menu_entries.o
|
||||
OBJS += menu/menu_setting.o
|
||||
OBJS += menu/menu_cbs.o
|
||||
OBJS += menu/cbs/menu_cbs_ok.o
|
||||
OBJS += menu/cbs/menu_cbs_cancel.o
|
||||
OBJS += menu/cbs/menu_cbs_select.o
|
||||
OBJS += menu/cbs/menu_cbs_start.o
|
||||
OBJS += menu/cbs/menu_cbs_info.o
|
||||
OBJS += menu/cbs/menu_cbs_refresh.o
|
||||
OBJS += menu/cbs/menu_cbs_left.o
|
||||
OBJS += menu/cbs/menu_cbs_right.o
|
||||
OBJS += menu/cbs/menu_cbs_title.o
|
||||
OBJS += menu/cbs/menu_cbs_deferred_push.o
|
||||
OBJS += menu/cbs/menu_cbs_scan.o
|
||||
OBJS += menu/cbs/menu_cbs_get_value.o
|
||||
OBJS += menu/cbs/menu_cbs_up.o
|
||||
OBJS += menu/cbs/menu_cbs_down.o
|
||||
OBJS += menu/cbs/menu_cbs_contentlist_switch.o
|
||||
OBJS += menu/menu_shader.o
|
||||
OBJS += menu/menu_navigation.o
|
||||
OBJS += menu/menu_display.o
|
||||
OBJS += menu/menu_displaylist.o
|
||||
OBJS += menu/menu_animation.o
|
||||
OBJS += menu/intl/menu_hash_de.o
|
||||
OBJS += menu/intl/menu_hash_es.o
|
||||
OBJS += menu/intl/menu_hash_eo.o
|
||||
OBJS += menu/intl/menu_hash_fr.o
|
||||
OBJS += menu/intl/menu_hash_it.o
|
||||
OBJS += menu/intl/menu_hash_nl.o
|
||||
OBJS += menu/intl/menu_hash_pl.o
|
||||
OBJS += menu/intl/menu_hash_pt.o
|
||||
OBJS += menu/intl/menu_hash_us.o
|
||||
OBJS += menu/drivers/null.o
|
||||
OBJS += menu/drivers/menu_generic.o
|
||||
OBJS += menu/drivers_display/menu_display_null.o
|
||||
OBJS += menu/drivers/rgui.o
|
||||
OBJS += command_event.o
|
||||
OBJS += deps/zlib/adler32.o
|
||||
OBJS += deps/zlib/compress.o
|
||||
OBJS += deps/zlib/crc32.o
|
||||
OBJS += deps/zlib/deflate.o
|
||||
OBJS += deps/zlib/gzclose.o
|
||||
OBJS += deps/zlib/gzlib.o
|
||||
OBJS += deps/zlib/gzread.o
|
||||
OBJS += deps/zlib/gzwrite.o
|
||||
OBJS += deps/zlib/inffast.o
|
||||
OBJS += deps/zlib/inflate.o
|
||||
OBJS += deps/zlib/inftrees.o
|
||||
OBJS += deps/zlib/trees.o
|
||||
OBJS += deps/zlib/uncompr.o
|
||||
OBJS += deps/zlib/zutil.o
|
||||
OBJS += deps/zlib/ioapi.o
|
||||
OBJS += deps/zlib/unzip.o
|
||||
OBJS += audio/audio_utils.o
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
@ -17,14 +245,28 @@ ifeq ($(strip $(AEMSTRO)),)
|
||||
$(error "Please set AEMSTRO in your environment. export AEMSTRO=<path to>aemstro")
|
||||
endif
|
||||
|
||||
ifeq ($(wildcard $(CTRULIB)/include/3ds/ndsp),)
|
||||
$(error "Please update ctrulib to the great-refactor branch")
|
||||
endif
|
||||
|
||||
|
||||
APP_TITLE := $(shell echo "$(APP_TITLE)" | cut -c1-128)
|
||||
APP_DESCRIPTION := $(shell echo "$(APP_DESCRIPTION)" | cut -c1-256)
|
||||
APP_AUTHOR := $(shell echo "$(APP_AUTHOR)" | cut -c1-128)
|
||||
APP_PRODUCT_CODE := $(shell echo $(APP_PRODUCT_CODE) | cut -c1-16)
|
||||
APP_UNIQUE_ID := $(shell echo $(APP_UNIQUE_ID) | cut -c1-7)
|
||||
|
||||
MAKEROM_ARGS_COMMON = -rsf $(APP_RSF) -exefslogo -elf $(TARGET).elf -icon $(TARGET).icn -banner $(TARGET).bnr -DAPP_TITLE="$(APP_TITLE)" -DAPP_PRODUCT_CODE="$(APP_PRODUCT_CODE)" -DAPP_UNIQUE_ID=$(APP_UNIQUE_ID) -DAPP_SYSTEM_MODE=$(APP_SYSTEM_MODE) -DAPP_SYSTEM_MODE_EXT=$(APP_SYSTEM_MODE_EXT)
|
||||
|
||||
INCDIRS := -I$(CTRULIB)/include
|
||||
LIBDIRS := -L. -L$(CTRULIB)/lib
|
||||
|
||||
|
||||
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard
|
||||
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp
|
||||
|
||||
CFLAGS += -mword-relocations \
|
||||
-fomit-frame-pointer -ffast-math \
|
||||
-Werror=implicit-function-declaration \
|
||||
$(ARCH)
|
||||
|
||||
#CFLAGS += -Wall
|
||||
@ -35,6 +277,12 @@ ifeq ($(DEBUG), 1)
|
||||
else
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_START := -Wl,--whole-archive
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
|
||||
CFLAGS += -I. -Ideps/zlib -Ideps/7zip -Ilibretro-common/include
|
||||
|
||||
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE -DSINC_LOWEST_QUALITY
|
||||
@ -45,45 +293,39 @@ CFLAGS += -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_BUILTIN_AUTOCONFIG
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
||||
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
ASFLAGS := -g $(ARCH) -O3
|
||||
LDFLAGS = -specs=ctr/3dsx_custom.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
CFLAGS += -std=gnu99 -ffast-math
|
||||
|
||||
|
||||
LIBS := -lretro_ctr -lctru -lm
|
||||
LIBS := $(WHOLE_START) -lretro_ctr $(WHOLE_END) -lctru -lm
|
||||
|
||||
|
||||
ifeq ($(BUILD_3DSX), 1)
|
||||
TARGET_3DSX := $(TARGET).3dsx $(TARGET).smdh
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_3DS), 1)
|
||||
TARGET_3DS := $(TARGET).3ds
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_CIA), 1)
|
||||
TARGET_CIA := $(TARGET).cia
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean all
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
all: $(TARGET)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
rm -f $(TARGET).3dsx
|
||||
rm -f $(TARGET).elf
|
||||
$(TARGET): $(TARGET_3DSX) $(TARGET_3DS) $(TARGET_CIA)
|
||||
$(TARGET).3dsx: $(TARGET).elf
|
||||
$(TARGET).elf: $(OBJS) libretro_ctr.a
|
||||
|
||||
ctr_sprite_shader_shbin.h: gfx/drivers/ctr_sprite.o
|
||||
gfx/drivers/ctr_gfx.c: ctr_sprite_shader_shbin.h
|
||||
griffin/griffin.o: gfx/drivers/ctr_gfx.c
|
||||
|
||||
$(TARGET): $(TARGET).3dsx
|
||||
$(TARGET).3dsx : $(TARGET).elf
|
||||
$(TARGET).elf : $(OBJS)
|
||||
|
||||
ifeq ($(strip $(APP_TITLE)),)
|
||||
APP_TITLE := $(notdir $(TARGET))
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(APP_DESCRIPTION)),)
|
||||
APP_DESCRIPTION := Built with devkitARM & libctru
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(APP_AUTHOR)),)
|
||||
APP_AUTHOR := Unspecified Author
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(APP_ICON)),)
|
||||
APP_ICON := $(CTRULIB)/default_icon.png
|
||||
endif
|
||||
|
||||
PREFIX := $(DEVKITARM)/bin/arm-none-eabi-
|
||||
|
||||
@ -96,12 +338,20 @@ STRIP := $(PREFIX)strip
|
||||
NM := $(PREFIX)nm
|
||||
LD := $(CXX)
|
||||
|
||||
ifneq ($(findstring Linux,$(shell uname -a)),)
|
||||
MAKEROM = ctr/tools/makerom-linux
|
||||
BANNERTOOL = ctr/tools/bannertool-linux
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
MAKEROM = ctr/tools/makerom-mac
|
||||
BANNERTOOL = ctr/tools/bannertool-mac
|
||||
else
|
||||
MAKEROM = ctr/tools/makerom.exe
|
||||
BANNERTOOL = ctr/tools/bannertool.exe
|
||||
endif
|
||||
|
||||
%.o: %.shader
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
python $(AEMSTRO)/aemstro_as.py $< $(notdir $<).shbin
|
||||
bin2s $(notdir $<).shbin | $(PREFIX)as -o $@
|
||||
$(DEVKITARM)/bin/bin2s $(notdir $<).shbin | $(PREFIX)as -o $@
|
||||
echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
@ -125,22 +375,46 @@ LD := $(CXX)
|
||||
|
||||
%.vsh:
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.smdh: $(APP_ICON) $(MAKEFILE_LIST)
|
||||
@echo building ... $(notdir $@)
|
||||
$(TARGET).smdh: $(APP_ICON)
|
||||
smdhtool --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.3dsx: %.elf
|
||||
@echo building ... $(notdir $@)
|
||||
3dsxtool $< $@ $(_3DSXFLAGS)
|
||||
$(TARGET).3dsx: $(TARGET).elf
|
||||
ifeq ($(APP_BIG_TEXT_SECTION), 1)
|
||||
cp ctr/big_text_section.xml $(TARGET).xml
|
||||
else
|
||||
rm -f $(TARGET).xml
|
||||
endif
|
||||
-3dsxtool $< $@ $(_3DSXFLAGS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.elf: .FORCE
|
||||
@echo linking $(notdir $@)
|
||||
$(TARGET).elf: ctr/3dsx_custom_crt0.o
|
||||
$(LD) $(LDFLAGS) $(OBJS) $(LIBDIRS) $(LIBS) -o $@
|
||||
$(NM) -CSn $@ > $(notdir $*.lst)
|
||||
|
||||
$(TARGET).bnr: $(APP_BANNER) $(APP_AUDIO)
|
||||
$(BANNERTOOL) makebanner -i "$(APP_BANNER)" -a "$(APP_AUDIO)" -o $@
|
||||
|
||||
.PHONY: .FORCE
|
||||
$(TARGET).icn: $(APP_ICON)
|
||||
$(BANNERTOOL) makesmdh -s "$(APP_TITLE)" -l "$(APP_TITLE)" -p "$(APP_AUTHOR)" -i $(APP_ICON) -o $@
|
||||
|
||||
$(TARGET).3ds: $(TARGET).elf $(TARGET).bnr $(TARGET).icn $(APP_RSF)
|
||||
$(MAKEROM) -f cci -o $@ $(MAKEROM_ARGS_COMMON) -DAPP_ENCRYPTED=true
|
||||
|
||||
$(TARGET).cia: $(TARGET).elf $(TARGET).bnr $(TARGET).icn $(APP_RSF)
|
||||
$(MAKEROM) -f cia -o $@ $(MAKEROM_ARGS_COMMON) -DAPP_ENCRYPTED=false
|
||||
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
rm -f $(TARGET).3dsx
|
||||
rm -f $(TARGET).elf
|
||||
rm -f $(TARGET).3ds
|
||||
rm -f $(TARGET).cia
|
||||
rm -f $(TARGET).smdh
|
||||
rm -f $(TARGET).bnr
|
||||
rm -f $(TARGET).icn
|
||||
rm -f *_shader_shbin.h
|
||||
rm -f ctr/ctr_config_*.o
|
||||
rm -f ctr/3dsx_custom_crt0.o
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
|
@ -23,7 +23,7 @@ ifneq ($(NATIVE_ZLIB),)
|
||||
endif
|
||||
|
||||
LIBS :=
|
||||
LDFLAGS := -L. --no-heap-copy -s USE_ZLIB=1 `-s TOTAL_MEMORY=$(MEMORY) -s OUTLINING_LIMIT=50000 \
|
||||
LDFLAGS := -L. --no-heap-copy -s USE_ZLIB=1 -s TOTAL_MEMORY=$(MEMORY) -s OUTLINING_LIMIT=50000 \
|
||||
-s EXPORTED_FUNCTIONS="['_main', '_malloc', '_cmd_savefiles', '_cmd_save_state', '_cmd_load_state', '_cmd_take_screenshot']" \
|
||||
--js-library emscripten/library_rwebaudio.js \
|
||||
--js-library emscripten/library_rwebinput.js \
|
||||
@ -116,4 +116,3 @@ clean:
|
||||
rm -f *.d
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
|
280
Makefile.griffin
280
Makefile.griffin
@ -5,6 +5,7 @@ WHOLE_ARCHIVE_LINK = 0
|
||||
BIG_STACK = 1
|
||||
PC_DEVELOPMENT_IP_ADDRESS = 255.255.255.255
|
||||
PC_DEVELOPMENT_UDP_PORT = 3490
|
||||
RARCH_CONSOLE = 0
|
||||
|
||||
ifneq ($(EMSCRIPTEN),)
|
||||
platform = emscripten
|
||||
@ -34,110 +35,198 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
TARGET_NAME := retroarch
|
||||
TARGET_NAME := retroarch
|
||||
|
||||
INCLUDE :=
|
||||
LDFLAGS :=
|
||||
LIBDIRS :=
|
||||
INCLUDE :=
|
||||
LDFLAGS :=
|
||||
LIBDIRS :=
|
||||
|
||||
SHADER_CG_DIR := media/shaders_cg
|
||||
OVERLAY_DIR := media/overlays
|
||||
SHADER_GLSL_DIR := media/shaders_glsl
|
||||
OVERLAY_DIR := media/overlays
|
||||
SHADER_GLSL_DIR := media/shaders_glsl
|
||||
|
||||
PYTHON2 = python2$(EXE_EXT)
|
||||
PYTHON3 = python3$(EXE_EXT)
|
||||
GIT = git$(EXE_EXT)
|
||||
PYTHON2 := python2$(EXE_EXT)
|
||||
PYTHON3 := python3$(EXE_EXT)
|
||||
GIT := git$(EXE_EXT)
|
||||
|
||||
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_START := -Wl,--whole-archive
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
WHOLE_START := -Wl,--whole-archive
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
|
||||
LIBS := $(WHOLE_START) -lretro_$(platform) $(WHOLE_END)
|
||||
|
||||
libogc_platform :=
|
||||
|
||||
ifeq ($(platform), ngc)
|
||||
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
|
||||
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT)
|
||||
LD = $(DEVKITPPC)/bin/powerpc-eabi-ld$(EXE_EXT)
|
||||
ELF2DOL = $(DEVKITPPC)/bin/elf2dol$(EXE_EXT)
|
||||
EXT_TARGET := $(TARGET_NAME)_ngc.dol
|
||||
EXT_INTER_TARGET := $(TARGET_NAME)_ngc.elf
|
||||
INCLUDE += -I. -I$(DEVKITPRO)/libogc/include -Ideps/zlib
|
||||
LIBDIRS += -L$(DEVKITPRO)/libogc/lib/cube -L.
|
||||
MACHDEP := -DGEKKO -DHW_DOL -mogc -mcpu=750 -meabi -mhard-float -DMSB_FIRST
|
||||
LDFLAGS += $(MACHDEP) -Wl,-Map,$(notdir $(EXT_INTER_TARGET)).map
|
||||
ifeq ($(BIG_STACK), 1)
|
||||
LDFLAGS += -T gx/ld/ogc.ld
|
||||
libogc_platform := 1
|
||||
else ifeq ($(platform), wii)
|
||||
libogc_platform := 1
|
||||
endif
|
||||
LIBS := -lfat $(WHOLE_START) -lretro_ngc $(WHOLE_END) -logc
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
LIBS += -lbba
|
||||
endif
|
||||
PLATCFLAGS := -DGEKKO
|
||||
|
||||
HAVE_FILTERS_BUILTIN := 1
|
||||
HAVE_THREADS := 1
|
||||
HAVE_ZLIB := 1
|
||||
HAVE_RPNG := 1
|
||||
HAVE_7ZIP := 1
|
||||
HAVE_RPNG := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_BUILTIN_AUTOCONFIG := 1
|
||||
else ifeq ($(platform), ps3)
|
||||
# PS3
|
||||
ifeq ($(platform), ps3)
|
||||
#TODO
|
||||
MEDIA_SHADER_DIR := ps3/pkg/USRDIR/cores/shaders
|
||||
MEDIA_SHADER_DIR := pkg/ps3/USRDIR/cores/shaders
|
||||
RARCH_CONSOLE = 1
|
||||
|
||||
# PS3 - Cobra
|
||||
else ifeq ($(platform), ps3-cobra)
|
||||
#TODO
|
||||
MEDIA_SHADER_DIR := ps3/iso/PS3_GAME/USRDIR/cores/shaders
|
||||
else ifeq ($(platform), wii)
|
||||
RARCH_CONSOLE = 1
|
||||
|
||||
# NGC/Wii - libogc
|
||||
else ifeq ($(libogc_platform), 1)
|
||||
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
|
||||
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT)
|
||||
LD = $(DEVKITPPC)/bin/powerpc-eabi-ld$(EXE_EXT)
|
||||
ELF2DOL = $(DEVKITPPC)/bin/elf2dol$(EXE_EXT)
|
||||
EXT_TARGET := $(TARGET_NAME)_wii.dol
|
||||
EXT_INTER_TARGET := $(TARGET_NAME)_wii.elf
|
||||
EXT_TARGET := $(TARGET_NAME)_$(platform).dol
|
||||
EXT_INTER_TARGET := $(TARGET_NAME)_$(platform).elf
|
||||
|
||||
INCLUDE += -I. -I$(DEVKITPRO)/libogc/include -Ideps/zlib
|
||||
LIBDIRS += -L$(DEVKITPRO)/libogc/lib/wii -L.
|
||||
MACHDEP := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DMSB_FIRST
|
||||
LDFLAGS += $(MACHDEP) -Wl,-Map,$(notdir $(EXT_INTER_TARGET)).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,strdup,-wrap,strndup,-wrap,malloc_usable_size
|
||||
ifeq ($(BIG_STACK), 1)
|
||||
LDFLAGS += -T gx/ld/rvl.ld
|
||||
|
||||
ifeq ($(platform), ngc)
|
||||
LIBDIRS += -L$(DEVKITPRO)/libogc/lib/cube
|
||||
MACHDEP := -DHW_DOL -mogc
|
||||
else ifeq ($(platform), wii)
|
||||
LIBDIRS += -L$(DEVKITPRO)/libogc/lib/wii
|
||||
MACHDEP := -DHW_RVL -mrvl
|
||||
endif
|
||||
LIBS := -lfat $(WHOLE_START) -lretro_wii $(WHOLE_END) -logc -lwiiuse -lbte
|
||||
LIBDIRS += -L.
|
||||
MACHDEP += -DGEKKO -mcpu=750 -meabi -mhard-float -DMSB_FIRST
|
||||
|
||||
ifeq ($(platform), ngc)
|
||||
LDFLAGS += $(MACHDEP) -Wl,-Map,$(notdir $(EXT_INTER_TARGET)).map
|
||||
ifeq ($(BIG_STACK), 1)
|
||||
LDFLAGS += -T bootstrap/gx/ogc.ld
|
||||
endif
|
||||
else ifeq ($(platform), wii)
|
||||
LDFLAGS += $(MACHDEP) -Wl,-Map,$(notdir $(EXT_INTER_TARGET)).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,strdup,-wrap,strndup,-wrap,malloc_usable_size
|
||||
ifeq ($(BIG_STACK), 1)
|
||||
LDFLAGS += -T bootstrap/gx/rvl.ld
|
||||
endif
|
||||
endif
|
||||
LIBS += -lfat -logc
|
||||
|
||||
ifeq ($(platform), wii)
|
||||
LIBS += -lwiiuse -lbte
|
||||
ifeq ($(USBGECKO), 1)
|
||||
LIBS += -ldb
|
||||
endif
|
||||
else ifeq ($(platform), ngc)
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
LIBS += -lbba
|
||||
endif
|
||||
endif
|
||||
|
||||
CFLAGS += -DGEKKO
|
||||
|
||||
HAVE_FILTERS_BUILTIN := 1
|
||||
HAVE_THREADS := 1
|
||||
HAVE_RPNG := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_BUILTIN_AUTOCONFIG := 1
|
||||
HAVE_ZLIB := 1
|
||||
HAVE_7ZIP := 1
|
||||
RARCH_CONSOLE = 1
|
||||
|
||||
ifeq ($(platform), wii)
|
||||
HAVE_WIIUSB_HID := 1
|
||||
HAVE_RARCH_EXEC := 1
|
||||
HAVE_RSOUND := 1
|
||||
HAVE_LIBRETRO_MANAGEMENT := 1
|
||||
HAVE_LIBSICKSAXIS := 1
|
||||
|
||||
APP_BOOTER_DIR = wii/app_booter
|
||||
PLATOBJS := $(APP_BOOTER_DIR)/app_booter.binobj
|
||||
CFLAGS += -DGEKKO
|
||||
ifeq ($(USBGECKO), 1)
|
||||
CFLAGS += -DUSBGECKO
|
||||
endif
|
||||
endif
|
||||
|
||||
HAVE_FILTERS_BUILTIN := 1
|
||||
HAVE_RARCH_EXEC := 1
|
||||
# Libxenon (Xbox 360)
|
||||
else ifeq ($(platform), xenon360)
|
||||
CC = xenon-gcc$(EXE_EXT)
|
||||
CXX = xenon-g++$(EXE_EXT)
|
||||
OBJCOPY = xenon-objcopy$(EXE_EXT)
|
||||
LD = xenon-ld$(EXE_EXT)
|
||||
STRIP = xenon-strip$(EXE_EXT)
|
||||
INCLUDE += -I$(DEVKITXENON)/usr/include
|
||||
|
||||
EXT_TARGET := $(TARGET_NAME)_$(platform).elf32
|
||||
EXT_INTER_TARGET := $(TARGET_NAME)_$(platform).elf
|
||||
|
||||
LIBS += -lxenon -lm -lc
|
||||
|
||||
LIBDIRS += -L. -L$(DEVKITXENON)/usr/lib -L$(DEVKITXENON)/xenon/lib/32
|
||||
LDFLAGS += -Wl,-q -m32 -n -T$(DEVKITXENON)/app.lds
|
||||
PLATCFLAGS := -DHAVE_GETOPT_LONG=1
|
||||
PLATCFLAGS += -maltivec -mhard-float -m32 -mpowerpc64 -mcpu=cell -mtune=cell -fno-pic -g -Wall -DXENON $(INCDIRS) -Wno-char-subscripts
|
||||
PLATCFLAGS += -u read -u _start -u exc_base
|
||||
HAVE_THREADS := 1
|
||||
HAVE_RSOUND := 1
|
||||
HAVE_7ZIP := 1
|
||||
HAVE_LIBRETRO_MANAGEMENT := 1
|
||||
HAVE_ZLIB := 1
|
||||
HAVE_RPNG := 1
|
||||
HAVE_RPNG := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_LIBSICKSAXIS := 1
|
||||
HAVE_BUILTIN_AUTOCONFIG := 1
|
||||
HAVE_GETOPT_LONG := 1
|
||||
RARCH_CONSOLE = 1
|
||||
|
||||
# PSP
|
||||
else ifeq ($(platform), psp1)
|
||||
CC = psp-gcc$(EXE_EXT)
|
||||
CXX = psp-g++$(EXE_EXT)
|
||||
LD = psp-ld$(EXE_EXT)
|
||||
INCLUDE += -I$(PSPSDK)/psp/sdk/include
|
||||
EXT_TARGET := $(TARGET_NAME)_psp1.elf
|
||||
EXT_INTER_TARGET := $(TARGET_NAME)_psp1.elf
|
||||
PLATCFLAGS := -DPSP -D_PSP_FW_VERSION=150 -G0
|
||||
EXT_TARGET := $(TARGET_NAME)_$(platform).elf
|
||||
EXT_INTER_TARGET := $(TARGET_NAME)_$(platform).elf
|
||||
PLATCFLAGS := -DPSP -D_PSP_FW_VERSION=150 -G0 \
|
||||
-D_MIPS_ARCH_ALLEGREX
|
||||
LIBS += -lpspgu -lpspgum -lm -lpspaudio -lpspfpu -lpsppower -lpsprtc -lpspkernel
|
||||
|
||||
LIBDIRS += -L.
|
||||
LDFLAGS += -Wl,-q
|
||||
|
||||
BUILD_PRX = 1
|
||||
HAVE_LIBRETRO_MANAGEMENT := 1
|
||||
HAVE_RPNG := 1
|
||||
HAVE_KERNEL_PRX := 1
|
||||
RARCH_CONSOLE = 1
|
||||
|
||||
ifeq ($(BUILD_PRX), 1)
|
||||
LDFLAGS += $(addprefix -L,$(PSPSDK)/lib) -specs=$(PSPSDK)/lib/prxspecs -Wl,-q,-T$(PSPSDK)/lib/linkfile.prx $(LDFLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE)
|
||||
# Vita
|
||||
else ifeq ($(platform), vita)
|
||||
CC = arm-vita-eabi-gcc$(EXE_EXT)
|
||||
CXX = arm-vita-eabi-g++$(EXE_EXT)
|
||||
LD = arm-vita-eabi-ld$(EXE_EXT)
|
||||
EXT_TARGET := $(TARGET_NAME)_$(platform).velf
|
||||
EXT_INTER_TARGET := $(TARGET_NAME)_$(platform).elf
|
||||
MACHDEP := -DVITA
|
||||
PLATCFLAGS := -O3 -mfloat-abi=hard -ffast-math -fsingle-precision-constant
|
||||
LIBS += -lSceKernel_stub -lSceDisplay_stub -lSceGxm_stub -lSceNet_stub -lSceNetCtl_stub\
|
||||
-lSceSysmodule_stub -lSceCtrl_stub -lSceAudio_stub -lUVLoader_stub \
|
||||
-lScePower_stub -lSceRtc_stub -lSceCommonDialog_stub -lfreetype -lz -lm -lc -lpng
|
||||
|
||||
PLATOBJS += audio/audio_utils_neon.o audio/drivers_resampler/sinc_neon.o \
|
||||
audio/drivers_resampler/cc_resampler_neon.o
|
||||
|
||||
LIBDIRS += -L.
|
||||
LDFLAGS += -Wl,-q
|
||||
|
||||
HAVE_FILTERS_BUILTIN := 1
|
||||
HAVE_LIBRETRO_MANAGEMENT := 1
|
||||
HAVE_BUILTIN_AUTOCONFIG := 1
|
||||
HAVE_RPNG := 1
|
||||
HAVE_ZLIB := 1
|
||||
HAVE_VITA2D := 1
|
||||
HAVE_NETWORKING := 1
|
||||
HAVE_NETPLAY := 1
|
||||
HAVE_OVERLAY := 1
|
||||
RARCH_CONSOLE = 1
|
||||
endif
|
||||
|
||||
|
||||
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(PLATCFLAGS) $(INCLUDE)
|
||||
|
||||
OBJ = griffin/griffin.o $(PLATOBJS)
|
||||
|
||||
@ -146,28 +235,50 @@ INCLUDE += -I./libretro-common/include
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_LOGGER
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
INCLUDE += -Ilogger/netlogger
|
||||
endif
|
||||
|
||||
ifeq ($(platform), wii)
|
||||
CFLAGS += -DHAVE_SOCKET_LEGACY
|
||||
endif
|
||||
|
||||
ifeq ($(platform), vita)
|
||||
CFLAGS += -DHAVE_SOCKET_LEGACY
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LIBRETRO_MANAGEMENT), 1)
|
||||
CFLAGS += -DHAVE_LIBRETRO_MANAGEMENT
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_KERNEL_PRX), 1)
|
||||
CFLAGS += -DHAVE_KERNEL_PRX
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LIBSICKSAXIS), 1)
|
||||
CFLAGS += -DHAVE_LIBSICKSAXIS
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_WIIUSB_HID), 1)
|
||||
CFLAGS += -DHAVE_WIIUSB_HID -DHAVE_HID
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_VITA2D), 1)
|
||||
CFLAGS += -DHAVE_VITA2D
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LIBRETRODB), 1)
|
||||
CFLAGS += -DHAVE_LIBRETRODB
|
||||
endif
|
||||
|
||||
ifeq ($(BIG_STACK),1)
|
||||
CFLAGS += -DBIG_STACK
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RPNG), 1)
|
||||
CFLAGS += -DWANT_RPNG
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
INCLUDE += -Ilogger/netlogger
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RARCH_EXEC), 1)
|
||||
@ -202,7 +313,15 @@ ifeq ($(HAVE_NETPLAY), 1)
|
||||
CFLAGS += -DHAVE_NETPLAY
|
||||
endif
|
||||
|
||||
CFLAGS += -std=gnu99 -DSINC_LOWER_QUALITY -DHAVE_RGUI -DHAVE_MENU -DRARCH_CONSOLE -DHAVE_GRIFFIN=1 -Wno-char-subscripts -DRARCH_INTERNAL
|
||||
ifeq ($(RARCH_CONSOLE), 1)
|
||||
CFLAGS += -DRARCH_CONSOLE
|
||||
endif
|
||||
|
||||
ifeq ($(RARCH_MOBILE), 1)
|
||||
CFLAGS += -DRARCH_MOBILE
|
||||
endif
|
||||
|
||||
CFLAGS += -std=gnu99 -DSINC_LOWER_QUALITY -DHAVE_RGUI -DHAVE_MENU -DHAVE_GRIFFIN=1 -Wno-char-subscripts -DRARCH_INTERNAL
|
||||
|
||||
ifeq ($(HAVE_FILTERS_BUILTIN), 1)
|
||||
CFLAGS += -DHAVE_FILTERS_BUILTIN
|
||||
@ -215,10 +334,18 @@ LIBS += -lpthread-psp
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_VITA2D), 1)
|
||||
LIBS := -lvita2d $(LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RSOUND), 1)
|
||||
CFLAGS += -DHAVE_RSOUND
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_GETOPT_LONG), 1)
|
||||
CFLAGS += -DHAVE_GETOPT_LONG=1
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -g -DDEBUG
|
||||
else ifeq ($(platform), psp1)
|
||||
@ -232,12 +359,29 @@ all: $(EXT_TARGET)
|
||||
%.dol: %.elf
|
||||
$(ELF2DOL) $< $@
|
||||
|
||||
%.velf: %.elf
|
||||
arm-vita-eabi-strip -g $<
|
||||
vita-elf-create $< $@ $(VITASDK)/bin/db.json $(VITASDK)/bin/extra.json
|
||||
|
||||
%.elf32: %.elf
|
||||
ifeq ($(platform), xenon360)
|
||||
$(OBJCOPY) -O elf32-powerpc --adjust-vma 0x80000000 $< $@
|
||||
endif
|
||||
|
||||
%.prx: %.elf
|
||||
ifeq ($(platform),psp1)
|
||||
psp-prxgen $< $@
|
||||
endif
|
||||
|
||||
$(EXT_INTER_TARGET): $(OBJ)
|
||||
$(CXX) -o $@ $(LDFLAGS) $(LIBDIRS) $(OBJ) $(LIBS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
%.o: %.S
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
%.bmpobj: %.bmp
|
||||
$(LD) -r -b binary -o $@ $<
|
||||
|
||||
@ -249,9 +393,9 @@ $(APP_BOOTER_DIR)/app_booter.bin:
|
||||
|
||||
pkg: all
|
||||
ifeq ($(platform), wii)
|
||||
cp -r $(EXT_TARGET) wii/pkg/CORE.dol
|
||||
cp -r $(EXT_TARGET) pkg/wii/CORE.dol
|
||||
else ifeq ($(platform), ngc)
|
||||
cp -r $(EXT_TARGET) ngc/pkg/CORE.dol
|
||||
cp -r $(EXT_TARGET) pkg/ngc/CORE.dol
|
||||
else ifeq ($(platform), psp1)
|
||||
psp-fixup-imports$(EXT) $(EXT_TARGET)
|
||||
endif
|
||||
|
@ -2,7 +2,7 @@
|
||||
# $ source /usr/local/angstrom/arm/environment-setup
|
||||
# $ setprj retroarch
|
||||
|
||||
PNDDIR=./pandora
|
||||
PNDDIR=./pkg/pandora
|
||||
BINDIR=$(PNDDIR)/bin
|
||||
|
||||
all: $(BINDIR)/retroarch
|
||||
|
28
Makefile.ps3
28
Makefile.ps3
@ -6,7 +6,7 @@ CELL_BUILD_TOOLS = SNC
|
||||
CELL_GPU_TYPE = RSX
|
||||
CELL_PSGL_VERSION = ultra-opt
|
||||
|
||||
RMENU_IMG_DIR := media/rmenu
|
||||
ASSETS_DIR := media/assets
|
||||
|
||||
# options
|
||||
DOWNLOAD_SHADERS = 1
|
||||
@ -30,11 +30,11 @@ include $(CELL_MK_DIR)/sdk.makedef.mk
|
||||
PPU_TARGET = retroarch_ps3.elf
|
||||
SALAMANDER_TARGET = retroarch-salamander_ps3.elf
|
||||
|
||||
EBOOT_PATH = ps3/pkg/USRDIR/EBOOT.BIN
|
||||
CORE_PATH = ps3/pkg/USRDIR/cores/CORE.SELF
|
||||
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. -Ips3 -Icommon -Ideps/zlib -Ilibretro-common/include
|
||||
INCDIRS = -I. -Idefines -Ideps/zlib -Ilibretro-common/include
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
@ -47,7 +47,7 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
PKG_SCRIPT = ps3/ps3py/pkg.py
|
||||
PKG_SCRIPT = tools/ps3/ps3py/pkg.py
|
||||
ifeq ($(shell uname), Linux)
|
||||
PKG_FINALIZE = package_finalize
|
||||
MAKE_SELF_WC = make_self_wc
|
||||
@ -68,7 +68,7 @@ ifeq ($(HAVE_RLAUNCH), 1)
|
||||
DEFINES += -DHAVE_RLAUNCH
|
||||
endif
|
||||
|
||||
DEFINES += -DHAVE_MENU -DHAVE_RGUI -DHAVE_GLUI -DRARCH_INTERNAL -DMSB_FIRST -DHAVE_OVERLAY -DHAVE_STB_FONT
|
||||
DEFINES += -DHAVE_MENU -DHAVE_RGUI -DHAVE_MATERIALUI -DRARCH_INTERNAL -DMSB_FIRST -DHAVE_OVERLAY -DHAVE_STB_FONT
|
||||
|
||||
ifeq ($(HAVE_GCMGL), 1)
|
||||
DEFINES += -DHAVE_GCMGL
|
||||
@ -116,7 +116,6 @@ endif
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
DEFINES += -DHAVE_LOGGER
|
||||
INCDIRS += -Ilogger/netlogger
|
||||
endif
|
||||
|
||||
PPU_CFLAGS := $(PPU_OPTIMIZE_LV) $(INCDIRS) $(DEFINES)
|
||||
@ -157,28 +156,29 @@ create-salamander:
|
||||
$(MAKE_SELF) $(SALAMANDER_TARGET) $(EBOOT_PATH) $(CONTENT_ID_FULL)
|
||||
|
||||
copy-media-files:
|
||||
@cp -r $(RMENU_IMG_DIR)/*.png ps3/pkg/USRDIR/cores/borders/Menu/
|
||||
@cp -r $(ASSETS_DIR)/glui pkg/ps3/USRDIR/cores/assets
|
||||
@cp -r $(ASSETS_DIR)/xmb pkg/ps3/USRDIR/cores/assets
|
||||
|
||||
create-shaders:
|
||||
make -f Makefile.shaders deploy-ps3
|
||||
make -f Makefile.griffin platform=ps3 shaders-deploy
|
||||
|
||||
pkg: $(PPU_TARGET) create-shaders copy-media-files create-npdrm-salamander create-npdrm-core
|
||||
$(MAKE_PACKAGE_NPDRM) ps3/pkg/package.conf ps3/pkg
|
||||
$(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) ps3/pkg/ retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_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) ps3/pkg/ retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
|
||||
pkg-signed-cfw: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) ps3/pkg/ retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(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
|
||||
|
||||
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) ps3/pkg/ retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
|
||||
clean-selfs:
|
||||
|
@ -30,11 +30,11 @@ include $(CELL_MK_DIR)/sdk.makedef.mk
|
||||
PPU_TARGET = retroarch_ps3.elf
|
||||
SALAMANDER_TARGET = retroarch-salamander_ps3.elf
|
||||
|
||||
EBOOT_PATH = ps3/pkg/USRDIR/EBOOT.BIN
|
||||
CORE_PATH = ps3/pkg/USRDIR/cores/CORE.SELF
|
||||
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. -Ips3 -Icommon
|
||||
INCDIRS = -I. -Idefines
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
@ -47,7 +47,7 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
PKG_SCRIPT = ps3/ps3py/pkg.py
|
||||
PKG_SCRIPT = tools/ps3/ps3py/pkg.py
|
||||
ifeq ($(shell uname), Linux)
|
||||
PKG_FINALIZE = package_finalize
|
||||
MAKE_SELF_WC = make_self_wc
|
||||
@ -116,7 +116,6 @@ endif
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
DEFINES += -DHAVE_LOGGER
|
||||
INCDIRS += -Ilogger/netlogger
|
||||
endif
|
||||
|
||||
PPU_CFLAGS := $(PPU_OPTIMIZE_LV) $(INCDIRS) $(DEFINES)
|
||||
@ -157,28 +156,28 @@ create-salamander:
|
||||
$(MAKE_SELF) $(SALAMANDER_TARGET) $(EBOOT_PATH) $(CONTENT_ID_FULL)
|
||||
|
||||
copy-media-files:
|
||||
@cp -r $(RMENU_IMG_DIR)/*.png ps3/pkg/USRDIR/cores/borders/Menu/
|
||||
@cp -r $(RMENU_IMG_DIR)/*.png pkg/ps3/USRDIR/cores/borders/Menu/
|
||||
|
||||
create-shaders:
|
||||
make -f Makefile.shaders deploy-ps3
|
||||
|
||||
pkg: $(PPU_TARGET) create-shaders copy-media-files create-npdrm-salamander create-npdrm-core
|
||||
$(MAKE_PACKAGE_NPDRM) ps3/pkg/package.conf ps3/pkg
|
||||
$(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) ps3/pkg/ retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_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) ps3/pkg/ retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
|
||||
pkg-signed-cfw: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) ps3/pkg/ retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(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
|
||||
|
||||
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) ps3/pkg/ retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
|
||||
clean-selfs:
|
||||
|
@ -25,14 +25,17 @@ PPU_SRCS = frontend/frontend_salamander.c \
|
||||
frontend/drivers/platform_null.c \
|
||||
libretro-common/file/file_path.c \
|
||||
libretro-common/file/dir_list.c \
|
||||
libretro-common/file/retro_dirent.c \
|
||||
libretro-common/file/retro_stat.c \
|
||||
libretro-common/hash/rhash.c \
|
||||
libretro-common/string/string_list.c \
|
||||
libretro-common/compat/compat.c \
|
||||
libretro-common/compat/compat_strl.c \
|
||||
libretro-common/file/retro_file.c \
|
||||
libretro-common/file/config_file.c
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
PPU_CFLAGS += -DHAVE_LOGGER -Ilogger/netlogger
|
||||
PPU_SRCS += logger/netlogger/logger.c
|
||||
PPU_CFLAGS += -DHAVE_LOGGER
|
||||
PPU_SRCS += netlogger.c
|
||||
endif
|
||||
|
||||
PPU_TARGET = retroarch-salamander_ps3.elf
|
||||
|
@ -14,8 +14,8 @@ LD = $(PS3DEV)/ppu/bin/ppu-ld
|
||||
CONTENT_ID_FULL = UP0001-SSNE10000_00-0000000000000001
|
||||
|
||||
ELF_TARGET := retroarch_psl1ght.elf
|
||||
EBOOT_PATH = ps3/pkg/USRDIR/EBOOT.BIN
|
||||
CORE_PATH = ps3/pkg/USRDIR/cores/CORE.SELF
|
||||
EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
|
||||
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
|
||||
|
||||
INCLUDE := -I. -I$(PS3DEV)/ppu/include -Ideps/zlib -Ips3/gcmgl/include/export -Ips3/include
|
||||
LIBDIRS := -L$(PS3DEV)/ppu/lib -L$(PS3DEV)/portlibs/ppu/lib -L.
|
||||
@ -36,7 +36,7 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
PKG_SCRIPT = ps3/ps3py/pkg.py
|
||||
PKG_SCRIPT = tools/ps3/ps3py/pkg.py
|
||||
ifeq ($(shell uname), Linux)
|
||||
PKG_FINALIZE = package_finalize
|
||||
MAKE_SELF_WC = make_self_wc
|
||||
@ -61,7 +61,7 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
PKG_SCRIPT = ps3/ps3py/pkg.py
|
||||
PKG_SCRIPT = tools/ps3/ps3py/pkg.py
|
||||
ifeq ($(shell uname), Linux)
|
||||
PKG_FINALIZE = package_finalize
|
||||
MAKE_SELF_WC = make_self_wc
|
||||
@ -119,10 +119,10 @@ create-core:
|
||||
$(MAKE_SELF_WC) $(ELF_TARGET) $(CORE_PATH)
|
||||
|
||||
pkg: $(ELF_TARGET) create-npdrm-core
|
||||
$(MAKE_PACKAGE_NPDRM) ps3/pkg/package.conf ps3/pkg
|
||||
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf ps3/pkg
|
||||
|
||||
pkg-signed: $(ELF_TARGET) create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) ps3/pkg/ retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
|
||||
clean:
|
||||
rm -f $(ELF_TARGET)
|
||||
|
@ -51,7 +51,7 @@ CFLAGS += $(RARCH_DEFINES)
|
||||
EXTRA_TARGETS = EBOOT.PBP
|
||||
PSP_EBOOT_TITLE = RetroArch PSP1
|
||||
|
||||
PSP_OBJECTS = griffin/griffin.o psp1/kernel_functions.o
|
||||
PSP_OBJECTS = griffin/griffin.o bootstrap/psp1/kernel_functions.o
|
||||
|
||||
OBJS = $(PSP_OBJECTS)
|
||||
|
||||
|
@ -26,10 +26,10 @@ endif
|
||||
|
||||
CFLAGS += $(RARCH_DEFINES)
|
||||
|
||||
EXTRA_TARGETS = EBOOT.PBP
|
||||
EXTRA_TARGETS = EBOOT.PBP
|
||||
PSP_EBOOT_TITLE = RetroArch
|
||||
PSP_EBOOT_ICON = psp1/ICON0.PNG
|
||||
PSP_EBOOT_PIC1 = psp1/PIC1.PNG
|
||||
PSP_EBOOT_ICON = pkg/psp1/ICON0.PNG
|
||||
PSP_EBOOT_PIC1 = pkg/psp1/PIC1.PNG
|
||||
|
||||
OBJS = frontend/frontend_salamander.o \
|
||||
frontend/frontend_driver.o \
|
||||
@ -38,10 +38,13 @@ OBJS = frontend/frontend_salamander.o \
|
||||
libretro-common/file/file_path.o \
|
||||
libretro-common/string/string_list.o \
|
||||
libretro-common/file/dir_list.o \
|
||||
libretro-common/compat/compat.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/compat/compat_strl.o \
|
||||
libretro-common/file/config_file.o \
|
||||
libretro-common/file/retro_file.o \
|
||||
libretro-common/file/retro_stat.o \
|
||||
libretro-common/hash/rhash.o \
|
||||
psp1/kernel_functions.o
|
||||
bootstrap/psp1/kernel_functions.o
|
||||
|
||||
PSPSDK=$(shell psp-config --pspsdk-path)
|
||||
include $(PSPSDK)/lib/build.mak
|
||||
|
@ -39,21 +39,33 @@ LIBS := -lfat -lwiiuse -logc -lbte
|
||||
|
||||
APP_BOOTER_DIR = wii/app_booter
|
||||
|
||||
OBJ = frontend/frontend_salamander.o frontend/frontend_driver.o frontend/drivers/platform_gx.o frontend/drivers/platform_wii.o frontend/drivers/platform_null.o libretro-common/file/file_path.o libretro-common/hash/rhash.o libretro-common/string/string_list.o libretro-common/file/dir_list.o libretro-common/compat/compat.o libretro-common/file/config_file.o $(APP_BOOTER_DIR)/app_booter.binobj
|
||||
OBJ = frontend/frontend_salamander.o \
|
||||
frontend/frontend_driver.o \
|
||||
frontend/drivers/platform_gx.o \
|
||||
frontend/drivers/platform_wii.o \
|
||||
frontend/drivers/platform_null.o \
|
||||
libretro-common/file/file_path.o \
|
||||
libretro-common/hash/rhash.o \
|
||||
libretro-common/string/string_list.o \
|
||||
libretro-common/file/dir_list.o \
|
||||
libretro-common/file/retro_file.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/file/retro_stat.o \
|
||||
libretro-common/compat/compat_strl.o \
|
||||
libretro-common/file/config_file.o \
|
||||
$(APP_BOOTER_DIR)/app_booter.binobj
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_LOGGER
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
CFLAGS += -Ilogger/netlogger
|
||||
OBJ += logger/netlogger/logger.o
|
||||
OBJ += logger/netlogger.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
CFLAGS += -Ilogger/netlogger
|
||||
endif
|
||||
|
||||
CFLAGS += -std=gnu99 -DIS_SALAMANDER -DRARCH_CONSOLE -DHAVE_RARCH_EXEC -DGEKKO -Wno-char-subscripts
|
||||
CFLAGS += -std=gnu99 -DIS_SALAMANDER -DRARCH_CONSOLE -DHAVE_RARCH_EXEC -DGEKKO -Wno-char-subscripts
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -g
|
||||
@ -61,6 +73,11 @@ else
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
ifeq ($(USBGECKO), 1)
|
||||
LIBS += -ldb
|
||||
CFLAGS += -DUSBGECKO
|
||||
endif
|
||||
|
||||
all: $(DOL_TARGET)
|
||||
|
||||
%.dol: %.elf
|
||||
@ -79,7 +96,7 @@ $(APP_BOOTER_DIR)/app_booter.bin:
|
||||
$(MAKE) -C $(APP_BOOTER_DIR)
|
||||
|
||||
pkg: all
|
||||
cp -r $(DOL_TARGET) wii/pkg/boot.dol
|
||||
cp -r $(DOL_TARGET) pkg/wii/boot.dol
|
||||
|
||||
clean:
|
||||
rm -f $(DOL_TARGET)
|
||||
@ -88,4 +105,3 @@ clean:
|
||||
$(MAKE) -C $(APP_BOOTER_DIR) clean
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
|
17
Makefile.win
17
Makefile.win
@ -14,7 +14,7 @@ HAVE_STDIN_CMD = 1
|
||||
HAVE_COMMAND = 1
|
||||
HAVE_THREADS = 1
|
||||
HAVE_RGUI = 1
|
||||
HAVE_GLUI = 1
|
||||
HAVE_MATERIALUI = 1
|
||||
HAVE_7ZIP = 1
|
||||
HAVE_ZLIB_DEFLATE = 1
|
||||
HAVE_PYTHON = 0
|
||||
@ -127,9 +127,9 @@ else
|
||||
endif
|
||||
|
||||
CFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I.
|
||||
CXXFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I. -std=c++0x -D__STDC_CONSTANT_MACROS
|
||||
CXXFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I. -std=c++98 -D__STDC_CONSTANT_MACROS
|
||||
ifeq ($(CXX_BUILD), 1)
|
||||
CFLAGS += -std=c++0x -xc++ -D__STDC_CONSTANT_MACROS
|
||||
CFLAGS += -std=c++98 -xc++ -D__STDC_CONSTANT_MACROS
|
||||
else
|
||||
ifneq ($(GNU90_BUILD), 1)
|
||||
CFLAGS += -std=gnu99
|
||||
@ -147,25 +147,26 @@ $(TARGET): $(RARCH_OBJ)
|
||||
@$(if $(Q), $(shell echo echo LD $@),)
|
||||
$(Q)$(CXX) -o $@ $(RARCH_OBJ) $(LIBS) $(LDFLAGS) $(LDCXXFLAGS)
|
||||
|
||||
#those mkdir shenanigans are really ugly, but I can't find any better solution
|
||||
$(OBJDIR)/%.o: %.c
|
||||
@mkdir -p $(dir $@)
|
||||
@-mkdir -p $(dir $@) || mkdir $(subst /,\,$(dir $@)) || echo .
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
.FORCE:
|
||||
|
||||
$(OBJDIR)/git_version.o: git_version.c .FORCE
|
||||
@mkdir -p $(dir $@)
|
||||
@-mkdir -p $(dir $@) || mkdir $(subst /,\,$(dir $@)) || echo .
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
$(OBJDIR)/%.o: %.cpp | $(dir $@)
|
||||
@-mkdir -p $(dir $@) || mkdir $(subst /,\,$(dir $@)) || echo .
|
||||
@$(if $(Q), $(shell echo echo CXX $<),)
|
||||
$(Q)$(CXX) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.rc $(HEADERS)
|
||||
@mkdir -p $(dir $@)
|
||||
@-mkdir -p $(dir $@) || mkdir $(subst /,\,$(dir $@)) || echo .
|
||||
@$(if $(Q), $(shell echo echo WINDRES $<),)
|
||||
$(Q)$(WINDRES) -o $@ $<
|
||||
|
||||
|
@ -1,49 +0,0 @@
|
||||
RARCH_VERSION = "0.9.9.3"
|
||||
|
||||
DEBUG = 0
|
||||
|
||||
CC = xenon-gcc
|
||||
CXX = xenon-g++
|
||||
OBJCOPY = xenon-objcopy
|
||||
STRIP = xenon-strip
|
||||
|
||||
PPU_TARGET := retroarch-libxenon.elf
|
||||
PPU_TARGET_ADJUSTED := retroarch-libxenon.elf32
|
||||
|
||||
LDDIRS = -L. -L$(DEVKITXENON)/usr/lib -L$(DEVKITXENON)/xenon/lib/32
|
||||
INCDIRS = -I. -I$(DEVKITXENON)/usr/include
|
||||
|
||||
OBJ = griffin/griffin.o
|
||||
|
||||
LIBS = -lretro_xenon360 -lxenon -lm -lc
|
||||
DEFINES = -std=gnu99 -DRARCH_CONSOLE -DHAVE_THREADS -DHAVE_GETOPT_LONG=1 -DHAVE_GRIFFIN -DRARCH_INTERNAL
|
||||
DEFINES += -maltivec -mhard-float -m32 -mpowerpc64 -mcpu=cell -mtune=cell -fno-pic -g -Wall -DXENON $(INCDIRS) -Wno-char-subscripts
|
||||
DEFINES += -u read -u _start -u exc_base
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
OPTIMIZE_LV := -O0 -g
|
||||
else
|
||||
OPTIMIZE_LV := -O3
|
||||
endif
|
||||
|
||||
all: $(PPU_TARGET_ADJUSTED)
|
||||
|
||||
CFLAGS := $(OPTIMIZE_LV) $(DEFINES)
|
||||
|
||||
LDFLAGS := -m32 -n -T $(DEVKITXENON)/app.lds
|
||||
|
||||
$(PPU_TARGET_ADJUSTED): $(PPU_TARGET)
|
||||
$(OBJCOPY) -O elf32-powerpc --adjust-vma 0x80000000 $< $@
|
||||
$(STRIP) $@
|
||||
|
||||
$(PPU_TARGET): $(OBJ)
|
||||
$(CXX) -o $@ $(OBJ) $(LDFLAGS) $(LDDIRS) $(LIBS)
|
||||
|
||||
%.o: %.c config.h
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f $(PPU_TARGET)
|
||||
rm -f $(OBJ)
|
||||
|
||||
.PHONY: clean
|
24
README.md
24
README.md
@ -123,20 +123,20 @@ make
|
||||
|
||||
<b>Mac</b><br/>
|
||||
- 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 (**apple/RetroArch.xcodeproj**) in the Xcode IDE and build (**⌘-B**) and run (**⌘-R**) it there. Or you can use the command line...
|
||||
- You can open the project (**pkg/apple/RetroArch.xcodeproj**) in the Xcode IDE and build (**⌘-B**) and run (**⌘-R**) it there. Or you can use the command line...
|
||||
- Debug:
|
||||
```bash
|
||||
# Build
|
||||
xcodebuild -target RetroArch -configuration Debug -project apple/RetroArch.xcodeproj
|
||||
xcodebuild -target RetroArch -configuration Debug -project pkg/apple/RetroArch.xcodeproj
|
||||
# Run
|
||||
open ./apple/build/Debug/RetroArch.app/
|
||||
open ./pkg/apple/build/Debug/RetroArch.app/
|
||||
```
|
||||
- Release:
|
||||
```bash
|
||||
# Build
|
||||
xcodebuild -target RetroArch -configuration Release -project apple/RetroArch.xcodeproj
|
||||
xcodebuild -target RetroArch -configuration Release -project pkg/apple/RetroArch.xcodeproj
|
||||
# Run
|
||||
open ./apple/build/Release/RetroArch.app/
|
||||
open ./pkg/apple/build/Release/RetroArch.app/
|
||||
```
|
||||
|
||||
<b>PC</b><br/>
|
||||
@ -150,15 +150,7 @@ RetroArch PS3 needs to be compiled in the following order:
|
||||
|
||||
<tt>make -f Makefile.ps3.salamander</tt>
|
||||
|
||||
2) Compile the RGL video driver
|
||||
|
||||
<tt>make -f Makefile.ps3.rgl</tt>
|
||||
|
||||
3) Compile RetroArch as a library
|
||||
|
||||
<tt>make -f Makefile.ps3.retroarch</tt>
|
||||
|
||||
4) Finally, compile RetroArch packed together with the GUI:
|
||||
2) Finally, compile RetroArch packed together with the GUI:
|
||||
|
||||
<tt>make -f Makefile.ps3</tt>
|
||||
|
||||
@ -186,9 +178,9 @@ You will need Microsoft Visual Studio 2010 installed (or higher) in order to com
|
||||
|
||||
The solution file can be found at the following location:
|
||||
|
||||
<tt>msvc-360/RetroArch-360.sln</tt>
|
||||
<tt>pkg/msvc-360/RetroArch-360.sln</tt>
|
||||
|
||||
NOTE: A pre-existing libretro library needs to be present in the `msvc-360/RetroArch-360/Release` directory in order to link RetroArch 360. This file needs to be
|
||||
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 <em><b>`libretro_xdk360.lib`</b></em>.
|
||||
|
||||
<b> Xbox 360 (Libxenon)</b><br />
|
||||
|
@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>*</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>All Files</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>RetroArch</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>libretro.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.1</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2015 RetroArch. All rights reserved.</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>RApplication</string>
|
||||
</dict>
|
||||
</plist>
|
@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>*</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>All Files</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>RetroArch</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>libretro.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.3</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0.3</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2013 RetroArch. All rights reserved.</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>RApplication</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>*</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>All Files</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>RetroArch</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>libretro.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.3</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0.3</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2013 RetroArch. All rights reserved.</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>RApplication</string>
|
||||
</dict>
|
||||
</plist>
|
@ -1,2 +0,0 @@
|
||||
/* Localized versions of Info.plist keys */
|
||||
|
@ -15,16 +15,14 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <string/string_list.h>
|
||||
#include "audio_driver.h"
|
||||
|
||||
#include "audio_monitor.h"
|
||||
#include "audio_driver.h"
|
||||
#include "audio_utils.h"
|
||||
#include "audio_thread_wrapper.h"
|
||||
#include "../driver.h"
|
||||
|
||||
#include "../general.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../runloop.h"
|
||||
#include "../performance.h"
|
||||
#include "../string_list_special.h"
|
||||
|
||||
#ifndef AUDIO_BUFFER_FREE_SAMPLES_COUNT
|
||||
#define AUDIO_BUFFER_FREE_SAMPLES_COUNT (8 * 1024)
|
||||
@ -118,11 +116,12 @@ static const audio_driver_t *audio_drivers[] = {
|
||||
#ifdef EMSCRIPTEN
|
||||
&audio_rwebaudio,
|
||||
#endif
|
||||
#ifdef PSP
|
||||
&audio_psp1,
|
||||
#if defined(PSP) || defined(VITA)
|
||||
&audio_psp,
|
||||
#endif
|
||||
#ifdef _3DS
|
||||
&audio_ctr,
|
||||
&audio_ctr_csnd,
|
||||
&audio_ctr_dsp,
|
||||
#endif
|
||||
&audio_null,
|
||||
NULL,
|
||||
@ -225,42 +224,9 @@ const char *audio_driver_find_ident(int idx)
|
||||
*
|
||||
* Returns: string listing of all audio driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_audio_driver_options(void)
|
||||
const char *config_get_audio_driver_options(void)
|
||||
{
|
||||
union string_list_elem_attr attr;
|
||||
unsigned i;
|
||||
char *options = NULL;
|
||||
int options_len = 0;
|
||||
struct string_list *options_l = string_list_new();
|
||||
|
||||
attr.i = 0;
|
||||
|
||||
if (!options_l)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; audio_driver_find_handle(i); i++)
|
||||
{
|
||||
const char *opt = audio_driver_find_ident(i);
|
||||
|
||||
options_len += strlen(opt) + 1;
|
||||
string_list_append(options_l, opt, attr);
|
||||
}
|
||||
|
||||
options = (char*)calloc(options_len, sizeof(char));
|
||||
|
||||
if (!options)
|
||||
{
|
||||
options = NULL;
|
||||
goto end;
|
||||
}
|
||||
|
||||
string_list_join_concat(options, options_len, options_l, "|");
|
||||
|
||||
end:
|
||||
string_list_free(options_l);
|
||||
options_l = NULL;
|
||||
|
||||
return options;
|
||||
return char_list_new_special(STRING_LIST_AUDIO_DRIVERS, NULL);
|
||||
}
|
||||
|
||||
void find_audio_driver(void)
|
||||
@ -285,7 +251,7 @@ void find_audio_driver(void)
|
||||
driver->audio = (const audio_driver_t*)audio_driver_find_handle(0);
|
||||
|
||||
if (!driver->audio)
|
||||
rarch_fail(1, "find_audio_driver()");
|
||||
retro_fail(1, "find_audio_driver()");
|
||||
}
|
||||
}
|
||||
|
||||
@ -351,7 +317,7 @@ void init_audio(void)
|
||||
settings->slowmotion_ratio;
|
||||
|
||||
/* Used for recording even if audio isn't enabled. */
|
||||
rarch_assert(audio_data.conv_outsamples =
|
||||
retro_assert(audio_data.conv_outsamples =
|
||||
(int16_t*)malloc(outsamples_max * sizeof(int16_t)));
|
||||
|
||||
if (!audio_data.conv_outsamples)
|
||||
@ -363,7 +329,7 @@ void init_audio(void)
|
||||
|
||||
/* Needs to be able to hold full content of a full max_bufsamples
|
||||
* in addition to its own. */
|
||||
rarch_assert(audio_data.rewind_buf = (int16_t*)
|
||||
retro_assert(audio_data.rewind_buf = (int16_t*)
|
||||
malloc(max_bufsamples * sizeof(int16_t)));
|
||||
|
||||
if (!audio_data.rewind_buf)
|
||||
@ -388,7 +354,7 @@ void init_audio(void)
|
||||
driver->audio))
|
||||
{
|
||||
RARCH_ERR("Cannot open threaded audio driver ... Exiting ...\n");
|
||||
rarch_fail(1, "init_audio()");
|
||||
retro_fail(1, "init_audio()");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -435,7 +401,7 @@ void init_audio(void)
|
||||
driver->audio_active = false;
|
||||
}
|
||||
|
||||
rarch_assert(audio_data.data = (float*)
|
||||
retro_assert(audio_data.data = (float*)
|
||||
malloc(max_bufsamples * sizeof(float)));
|
||||
|
||||
if (!audio_data.data)
|
||||
@ -443,9 +409,9 @@ void init_audio(void)
|
||||
|
||||
audio_data.data_ptr = 0;
|
||||
|
||||
rarch_assert(settings->audio.out_rate <
|
||||
retro_assert(settings->audio.out_rate <
|
||||
audio_data.in_rate * AUDIO_MAX_RATIO);
|
||||
rarch_assert(audio_data.outsamples = (float*)
|
||||
retro_assert(audio_data.outsamples = (float*)
|
||||
malloc(outsamples_max * sizeof(float)));
|
||||
|
||||
if (!audio_data.outsamples)
|
||||
@ -596,16 +562,20 @@ void audio_driver_set_nonblocking_state(bool enable)
|
||||
**/
|
||||
bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||
{
|
||||
const void *output_data = NULL;
|
||||
unsigned output_frames = 0;
|
||||
size_t output_size = sizeof(float);
|
||||
struct resampler_data src_data = {0};
|
||||
struct rarch_dsp_data dsp_data = {0};
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const audio_driver_t *audio = driver ?
|
||||
bool is_slowmotion, is_paused;
|
||||
static struct retro_perf_counter audio_convert_s16 = {0};
|
||||
static struct retro_perf_counter audio_convert_float = {0};
|
||||
static struct retro_perf_counter audio_dsp = {0};
|
||||
static struct retro_perf_counter resampler_proc = {0};
|
||||
struct resampler_data src_data = {0};
|
||||
struct rarch_dsp_data dsp_data = {0};
|
||||
const void *output_data = NULL;
|
||||
unsigned output_frames = 0;
|
||||
size_t output_size = sizeof(float);
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const audio_driver_t *audio = driver ?
|
||||
(const audio_driver_t*)driver->audio : NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (driver->recording_data)
|
||||
{
|
||||
@ -617,16 +587,18 @@ bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||
driver->recording->push_audio(driver->recording_data, &ffemu_data);
|
||||
}
|
||||
|
||||
if (runloop->is_paused || settings->audio.mute_enable)
|
||||
rarch_main_ctl(RARCH_MAIN_CTL_IS_PAUSED, &is_paused);
|
||||
|
||||
if (is_paused || settings->audio.mute_enable)
|
||||
return true;
|
||||
if (!driver->audio_active || !audio_data.data)
|
||||
return false;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(audio_convert_s16);
|
||||
RARCH_PERFORMANCE_START(audio_convert_s16);
|
||||
rarch_perf_init(&audio_convert_s16, "audio_convert_s16");
|
||||
retro_perf_start(&audio_convert_s16);
|
||||
audio_convert_s16_to_float(audio_data.data, data, samples,
|
||||
audio_data.volume_gain);
|
||||
RARCH_PERFORMANCE_STOP(audio_convert_s16);
|
||||
retro_perf_stop(&audio_convert_s16);
|
||||
|
||||
src_data.data_in = audio_data.data;
|
||||
src_data.input_frames = samples >> 1;
|
||||
@ -636,10 +608,10 @@ bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||
|
||||
if (audio_data.dsp)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(audio_dsp);
|
||||
RARCH_PERFORMANCE_START(audio_dsp);
|
||||
rarch_perf_init(&audio_dsp, "audio_dsp");
|
||||
retro_perf_start(&audio_dsp);
|
||||
rarch_dsp_filter_process(audio_data.dsp, &dsp_data);
|
||||
RARCH_PERFORMANCE_STOP(audio_dsp);
|
||||
retro_perf_stop(&audio_dsp);
|
||||
|
||||
if (dsp_data.output)
|
||||
{
|
||||
@ -654,25 +626,28 @@ bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||
audio_driver_readjust_input_rate();
|
||||
|
||||
src_data.ratio = audio_data.src_ratio;
|
||||
if (runloop->is_slowmotion)
|
||||
|
||||
rarch_main_ctl(RARCH_MAIN_CTL_IS_SLOWMOTION, &is_slowmotion);
|
||||
|
||||
if (is_slowmotion)
|
||||
src_data.ratio *= settings->slowmotion_ratio;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(resampler_proc);
|
||||
RARCH_PERFORMANCE_START(resampler_proc);
|
||||
rarch_perf_init(&resampler_proc, "resampler_proc");
|
||||
retro_perf_start(&resampler_proc);
|
||||
rarch_resampler_process(driver->resampler,
|
||||
driver->resampler_data, &src_data);
|
||||
RARCH_PERFORMANCE_STOP(resampler_proc);
|
||||
retro_perf_stop(&resampler_proc);
|
||||
|
||||
output_data = audio_data.outsamples;
|
||||
output_frames = src_data.output_frames;
|
||||
|
||||
if (!audio_data.use_float)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(audio_convert_float);
|
||||
RARCH_PERFORMANCE_START(audio_convert_float);
|
||||
rarch_perf_init(&audio_convert_float, "audio_convert_float");
|
||||
retro_perf_start(&audio_convert_float);
|
||||
audio_convert_float_to_s16(audio_data.conv_outsamples,
|
||||
(const float*)output_data, output_frames * 2);
|
||||
RARCH_PERFORMANCE_STOP(audio_convert_float);
|
||||
retro_perf_stop(&audio_convert_float);
|
||||
|
||||
output_data = audio_data.conv_outsamples;
|
||||
output_size = sizeof(int16_t);
|
||||
@ -811,17 +786,17 @@ void audio_driver_frame_is_reverse(void)
|
||||
void audio_monitor_adjust_system_rates(void)
|
||||
{
|
||||
float timing_skew;
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct retro_system_av_info *av_info =
|
||||
video_viewport_get_system_av_info();
|
||||
const struct retro_system_timing *info =
|
||||
av_info ? (const struct retro_system_timing*)&av_info->timing : NULL;
|
||||
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();
|
||||
|
||||
if (av_info)
|
||||
info = (const struct retro_system_timing*)&av_info->timing;
|
||||
|
||||
if (info->sample_rate <= 0.0)
|
||||
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 / settings->video.refresh_rate);
|
||||
audio_data.in_rate = info->sample_rate;
|
||||
|
||||
if (timing_skew <= settings->audio.max_timing_skew)
|
||||
|
@ -88,8 +88,9 @@ extern audio_driver_t audio_coreaudio;
|
||||
extern audio_driver_t audio_xenon360;
|
||||
extern audio_driver_t audio_ps3;
|
||||
extern audio_driver_t audio_gx;
|
||||
extern audio_driver_t audio_psp1;
|
||||
extern audio_driver_t audio_ctr;
|
||||
extern audio_driver_t audio_psp;
|
||||
extern audio_driver_t audio_ctr_csnd;
|
||||
extern audio_driver_t audio_ctr_dsp;
|
||||
extern audio_driver_t audio_rwebaudio;
|
||||
extern audio_driver_t audio_null;
|
||||
|
||||
|
@ -146,7 +146,7 @@ static const dspfilter_get_implementation_t dsp_plugs_builtin[] = {
|
||||
static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
{
|
||||
unsigned i;
|
||||
dspfilter_simd_mask_t mask = rarch_get_cpu_features();
|
||||
dspfilter_simd_mask_t mask = retro_get_cpu_features();
|
||||
|
||||
(void)list;
|
||||
|
||||
@ -170,7 +170,7 @@ static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
{
|
||||
unsigned i;
|
||||
dspfilter_simd_mask_t mask = rarch_get_cpu_features();
|
||||
dspfilter_simd_mask_t mask = retro_get_cpu_features();
|
||||
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
@ -242,12 +242,12 @@ rarch_dsp_filter_t *rarch_dsp_filter_new(
|
||||
#if !defined(HAVE_FILTERS_BUILTIN) && defined(HAVE_DYLIB)
|
||||
fill_pathname_basedir(basedir, filter_config, sizeof(basedir));
|
||||
|
||||
plugs = dir_list_new(basedir, EXT_EXECUTABLES, false);
|
||||
plugs = dir_list_new(basedir, EXT_EXECUTABLES, false, false);
|
||||
if (!plugs)
|
||||
goto error;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_DYLIB)
|
||||
#if defined(HAVE_DYLIB) || defined(HAVE_FILTERS_BUILTIN)
|
||||
if (!append_plugs(dsp, plugs))
|
||||
goto error;
|
||||
#endif
|
||||
@ -317,4 +317,3 @@ void rarch_dsp_filter_process(rarch_dsp_filter_t *dsp,
|
||||
data->output = output.samples;
|
||||
data->output_frames = output.frames;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ ifeq (debug,$(build))
|
||||
extra_flags += -O0 -g
|
||||
endif
|
||||
|
||||
ldflags := -shared -lm -Wl,--version-script=link.T
|
||||
ldflags := $(LDFLAGS) -shared -lm -Wl,--version-script=link.T
|
||||
|
||||
ifeq ($(platform), unix)
|
||||
DYLIB = so
|
||||
@ -57,8 +57,8 @@ endif
|
||||
|
||||
CC := $(compiler) -Wall
|
||||
CXX := $(subst CC,++,$(compiler)) -std=gnu++0x -Wall
|
||||
flags := -fPIC $(extra_flags) -I../../libretro-common/include
|
||||
asflags := -fPIC $(extra_flags)
|
||||
flags := $(CFLAGS) -fPIC $(extra_flags) -I../../libretro-common/include
|
||||
asflags := $(ASFLAGS) -fPIC $(extra_flags)
|
||||
objects :=
|
||||
|
||||
ifeq (1,$(use_neon))
|
||||
|
@ -56,29 +56,32 @@ static void chorus_process(void *data, struct dspfilter_output *output,
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
unsigned delay_int;
|
||||
float delay_frac, l_a, l_b, r_a, r_b;
|
||||
float chorus_l, chorus_r;
|
||||
float in[2] = { out[0], out[1] };
|
||||
|
||||
float delay = ch->delay + ch->depth * sin((2.0 * M_PI * ch->lfo_ptr++) / ch->lfo_period);
|
||||
|
||||
delay *= ch->input_rate;
|
||||
if (ch->lfo_ptr >= ch->lfo_period)
|
||||
ch->lfo_ptr = 0;
|
||||
|
||||
unsigned delay_int = (unsigned)delay;
|
||||
delay_int = (unsigned)delay;
|
||||
if (delay_int >= CHORUS_MAX_DELAY - 1)
|
||||
delay_int = CHORUS_MAX_DELAY - 2;
|
||||
float delay_frac = delay - delay_int;
|
||||
delay_frac = delay - delay_int;
|
||||
|
||||
ch->old[0][ch->old_ptr] = in[0];
|
||||
ch->old[1][ch->old_ptr] = in[1];
|
||||
|
||||
float l_a = ch->old[0][(ch->old_ptr - delay_int - 0) & CHORUS_DELAY_MASK];
|
||||
float l_b = ch->old[0][(ch->old_ptr - delay_int - 1) & CHORUS_DELAY_MASK];
|
||||
float r_a = ch->old[1][(ch->old_ptr - delay_int - 0) & CHORUS_DELAY_MASK];
|
||||
float r_b = ch->old[1][(ch->old_ptr - delay_int - 1) & CHORUS_DELAY_MASK];
|
||||
l_a = ch->old[0][(ch->old_ptr - delay_int - 0) & CHORUS_DELAY_MASK];
|
||||
l_b = ch->old[0][(ch->old_ptr - delay_int - 1) & CHORUS_DELAY_MASK];
|
||||
r_a = ch->old[1][(ch->old_ptr - delay_int - 0) & CHORUS_DELAY_MASK];
|
||||
r_b = ch->old[1][(ch->old_ptr - delay_int - 1) & CHORUS_DELAY_MASK];
|
||||
|
||||
// Lerp introduces aliasing of the chorus component, but doing full polyphase here is probably overkill.
|
||||
float chorus_l = l_a * (1.0f - delay_frac) + l_b * delay_frac;
|
||||
float chorus_r = r_a * (1.0f - delay_frac) + r_b * delay_frac;
|
||||
/* Lerp introduces aliasing of the chorus component, but doing full polyphase here is probably overkill. */
|
||||
chorus_l = l_a * (1.0f - delay_frac) + l_b * delay_frac;
|
||||
chorus_r = r_a * (1.0f - delay_frac) + r_b * delay_frac;
|
||||
|
||||
out[0] = ch->mix_dry * in[0] + ch->mix_wet * chorus_l;
|
||||
out[1] = ch->mix_dry * in[1] + ch->mix_wet * chorus_r;
|
||||
@ -90,11 +93,11 @@ static void chorus_process(void *data, struct dspfilter_output *output,
|
||||
static void *chorus_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
float delay, depth, lfo_freq, drywet;
|
||||
struct chorus_data *ch = (struct chorus_data*)calloc(1, sizeof(*ch));
|
||||
if (!ch)
|
||||
return NULL;
|
||||
|
||||
float delay, depth, lfo_freq, drywet;
|
||||
config->get_float(userdata, "delay_ms", &delay, 25.0f);
|
||||
config->get_float(userdata, "depth_ms", &depth, 1.0f);
|
||||
config->get_float(userdata, "lfo_freq", &lfo_freq, 0.5f);
|
||||
|
@ -60,6 +60,7 @@ static void echo_process(void *data, struct dspfilter_output *output,
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
float left, right;
|
||||
float echo_left = 0.0f;
|
||||
float echo_right = 0.0f;
|
||||
|
||||
@ -72,8 +73,8 @@ static void echo_process(void *data, struct dspfilter_output *output,
|
||||
echo_left *= echo->amp;
|
||||
echo_right *= echo->amp;
|
||||
|
||||
float left = out[0] + echo_left;
|
||||
float right = out[1] + echo_right;
|
||||
left = out[0] + echo_left;
|
||||
right = out[1] + echo_right;
|
||||
|
||||
for (c = 0; c < echo->num_channels; c++)
|
||||
{
|
||||
@ -94,22 +95,21 @@ static void echo_process(void *data, struct dspfilter_output *output,
|
||||
static void *echo_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
unsigned i;
|
||||
struct echo_data *echo = (struct echo_data*)calloc(1, sizeof(*echo));
|
||||
if (!echo)
|
||||
return NULL;
|
||||
|
||||
unsigned i, channels;
|
||||
float *delay = NULL, *feedback = NULL;
|
||||
unsigned num_delay = 0, num_feedback = 0;
|
||||
|
||||
static const float default_delay[] = { 200.0f };
|
||||
static const float default_feedback[] = { 0.5f };
|
||||
struct echo_data *echo = (struct echo_data*)calloc(1, sizeof(*echo));
|
||||
if (!echo)
|
||||
return NULL;
|
||||
|
||||
config->get_float_array(userdata, "delay", &delay, &num_delay, default_delay, 1);
|
||||
config->get_float_array(userdata, "feedback", &feedback, &num_feedback, default_feedback, 1);
|
||||
config->get_float(userdata, "amp", &echo->amp, 0.2f);
|
||||
|
||||
unsigned channels = num_feedback = num_delay = min(num_delay, num_feedback);
|
||||
channels = num_feedback = num_delay = min(num_delay, num_feedback);
|
||||
|
||||
echo->channels = (struct echo_channel*)calloc(channels, sizeof(*echo->channels));
|
||||
if (!echo->channels)
|
||||
|
@ -12,12 +12,14 @@
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dspfilter.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <retro_inline.h>
|
||||
#include <filters.h>
|
||||
|
||||
#include "dspfilter.h"
|
||||
|
||||
#include "fft/fft.c"
|
||||
|
||||
@ -45,7 +47,7 @@ struct eq_data
|
||||
struct eq_gain
|
||||
{
|
||||
float freq;
|
||||
float gain; // Linear.
|
||||
float gain; /* Linear. */
|
||||
};
|
||||
|
||||
static void eq_free(void *data)
|
||||
@ -65,18 +67,22 @@ static void eq_free(void *data)
|
||||
static void eq_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
float *out;
|
||||
const float *in;
|
||||
unsigned input_frames;
|
||||
struct eq_data *eq = (struct eq_data*)data;
|
||||
|
||||
output->samples = eq->buffer;
|
||||
output->frames = 0;
|
||||
output->samples = eq->buffer;
|
||||
output->frames = 0;
|
||||
|
||||
float *out = eq->buffer;
|
||||
const float *in = input->samples;
|
||||
unsigned input_frames = input->frames;
|
||||
out = eq->buffer;
|
||||
in = input->samples;
|
||||
input_frames = input->frames;
|
||||
|
||||
while (input_frames)
|
||||
{
|
||||
unsigned write_avail = eq->block_size - eq->block_ptr;
|
||||
|
||||
if (input_frames < write_avail)
|
||||
write_avail = input_frames;
|
||||
|
||||
@ -119,10 +125,9 @@ static int gains_cmp(const void *a_, const void *b_)
|
||||
const struct eq_gain *b = (const struct eq_gain*)b_;
|
||||
if (a->freq < b->freq)
|
||||
return -1;
|
||||
else if (a->freq > b->freq)
|
||||
if (a->freq > b->freq)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void generate_response(fft_complex_t *response,
|
||||
@ -133,8 +138,8 @@ static void generate_response(fft_complex_t *response,
|
||||
float start_freq = 0.0f;
|
||||
float start_gain = 1.0f;
|
||||
|
||||
float end_freq = 1.0f;
|
||||
float end_gain = 1.0f;
|
||||
float end_freq = 1.0f;
|
||||
float end_gain = 1.0f;
|
||||
|
||||
if (num_gains)
|
||||
{
|
||||
@ -147,6 +152,8 @@ static void generate_response(fft_complex_t *response,
|
||||
// Create a response by linear interpolation between known frequency sample points.
|
||||
for (i = 0; i <= samples; i++)
|
||||
{
|
||||
float gain;
|
||||
float lerp = 0.5f;
|
||||
float freq = (float)i / samples;
|
||||
|
||||
while (freq >= end_freq)
|
||||
@ -171,11 +178,10 @@ static void generate_response(fft_complex_t *response,
|
||||
}
|
||||
}
|
||||
|
||||
float lerp = 0.5f;
|
||||
// Edge case where i == samples.
|
||||
/* Edge case where i == samples. */
|
||||
if (end_freq > start_freq)
|
||||
lerp = (freq - start_freq) / (end_freq - start_freq);
|
||||
float gain = (1.0f - lerp) * start_gain + lerp * end_gain;
|
||||
gain = (1.0f - lerp) * start_gain + lerp * end_gain;
|
||||
|
||||
response[i].real = gain;
|
||||
response[i].imag = 0.0f;
|
||||
@ -184,58 +190,25 @@ static void generate_response(fft_complex_t *response,
|
||||
}
|
||||
}
|
||||
|
||||
// Modified Bessel function of first order.
|
||||
// Check Wiki for mathematical definition ...
|
||||
static INLINE double kaiser_besseli0(double x)
|
||||
{
|
||||
unsigned i;
|
||||
double sum = 0.0;
|
||||
|
||||
double factorial = 1.0;
|
||||
double factorial_mult = 0.0;
|
||||
double x_pow = 1.0;
|
||||
double two_div_pow = 1.0;
|
||||
double x_sqr = x * x;
|
||||
|
||||
// Approximate. This is an infinite sum.
|
||||
// Luckily, it converges rather fast.
|
||||
for (i = 0; i < 18; i++)
|
||||
{
|
||||
sum += x_pow * two_div_pow / (factorial * factorial);
|
||||
|
||||
factorial_mult += 1.0;
|
||||
x_pow *= x_sqr;
|
||||
two_div_pow *= 0.25;
|
||||
factorial *= factorial_mult;
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
static INLINE double kaiser_window(double index, double beta)
|
||||
{
|
||||
return kaiser_besseli0(beta * sqrt(1 - index * index));
|
||||
}
|
||||
|
||||
static void create_filter(struct eq_data *eq, unsigned size_log2,
|
||||
struct eq_gain *gains, unsigned num_gains, double beta, const char *filter_path)
|
||||
{
|
||||
int i;
|
||||
int half_block_size = eq->block_size >> 1;
|
||||
double window_mod = 1.0 / kaiser_window(0.0, beta);
|
||||
double window_mod = 1.0 / kaiser_window_function(0.0, beta);
|
||||
|
||||
fft_t *fft = fft_new(size_log2);
|
||||
float *time_filter = (float*)calloc(eq->block_size * 2 + 1, sizeof(*time_filter));
|
||||
if (!fft || !time_filter)
|
||||
goto end;
|
||||
|
||||
// Make sure bands are in correct order.
|
||||
/* Make sure bands are in correct order. */
|
||||
qsort(gains, num_gains, sizeof(*gains), gains_cmp);
|
||||
|
||||
// Compute desired filter response.
|
||||
/* Compute desired filter response. */
|
||||
generate_response(eq->filter, gains, num_gains, half_block_size);
|
||||
|
||||
// Get equivalent time-domain filter.
|
||||
/* Get equivalent time-domain filter. */
|
||||
fft_process_inverse(fft, time_filter, eq->filter, 1);
|
||||
|
||||
// ifftshift() to create the correct linear phase filter.
|
||||
@ -248,16 +221,16 @@ static void create_filter(struct eq_data *eq, unsigned size_log2,
|
||||
time_filter[i] = tmp;
|
||||
}
|
||||
|
||||
// Apply a window to smooth out the frequency repsonse.
|
||||
/* Apply a window to smooth out the frequency repsonse. */
|
||||
for (i = 0; i < (int)eq->block_size; i++)
|
||||
{
|
||||
// Kaiser window.
|
||||
/* Kaiser window. */
|
||||
double phase = (double)i / eq->block_size;
|
||||
phase = 2.0 * (phase - 0.5);
|
||||
time_filter[i] *= window_mod * kaiser_window(phase, beta);
|
||||
time_filter[i] *= window_mod * kaiser_window_function(phase, beta);
|
||||
}
|
||||
|
||||
// Debugging.
|
||||
/* Debugging. */
|
||||
if (filter_path)
|
||||
{
|
||||
FILE *file = fopen(filter_path, "w");
|
||||
@ -269,9 +242,10 @@ static void create_filter(struct eq_data *eq, unsigned size_log2,
|
||||
}
|
||||
}
|
||||
|
||||
// Padded FFT to create our FFT filter.
|
||||
// Make our even-length filter odd by discarding the first coefficient.
|
||||
// For some interesting reason, this allows us to design an odd-length linear phase filter.
|
||||
/* Padded FFT to create our FFT filter.
|
||||
* Make our even-length filter odd by discarding the first coefficient.
|
||||
* For some interesting reason, this allows us to design an odd-length linear phase filter.
|
||||
*/
|
||||
fft_process_forward(eq->fft, eq->filter, time_filter + 1, 1);
|
||||
|
||||
end:
|
||||
@ -282,28 +256,27 @@ end:
|
||||
static void *eq_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
unsigned i;
|
||||
float *frequencies, *gain;
|
||||
unsigned num_freq, num_gain, i, size;
|
||||
int size_log2;
|
||||
float beta;
|
||||
struct eq_gain *gains = NULL;
|
||||
char *filter_path = NULL;
|
||||
const float default_freq[] = { 0.0f, info->input_rate };
|
||||
const float default_gain[] = { 0.0f, 0.0f };
|
||||
struct eq_data *eq = (struct eq_data*)calloc(1, sizeof(*eq));
|
||||
if (!eq)
|
||||
return NULL;
|
||||
|
||||
const float default_freq[] = { 0.0f, info->input_rate };
|
||||
const float default_gain[] = { 0.0f, 0.0f };
|
||||
|
||||
float beta;
|
||||
config->get_float(userdata, "window_beta", &beta, 4.0f);
|
||||
|
||||
int size_log2;
|
||||
config->get_int(userdata, "block_size_log2", &size_log2, 8);
|
||||
unsigned size = 1 << size_log2;
|
||||
size = 1 << size_log2;
|
||||
|
||||
struct eq_gain *gains = NULL;
|
||||
float *frequencies, *gain;
|
||||
unsigned num_freq, num_gain;
|
||||
config->get_float_array(userdata, "frequencies", &frequencies, &num_freq, default_freq, 2);
|
||||
config->get_float_array(userdata, "gains", &gain, &num_gain, default_gain, 2);
|
||||
|
||||
char *filter_path = NULL;
|
||||
if (!config->get_string(userdata, "impulse_response_output", &filter_path, ""))
|
||||
{
|
||||
config->free(filter_path);
|
||||
@ -331,8 +304,9 @@ static void *eq_init(const struct dspfilter_info *info,
|
||||
eq->fftblock = (fft_complex_t*)calloc(2 * size, sizeof(*eq->fftblock));
|
||||
eq->filter = (fft_complex_t*)calloc(2 * size, sizeof(*eq->filter));
|
||||
|
||||
// Use an FFT which is twice the block size with zero-padding
|
||||
// to make circular convolution => proper convolution.
|
||||
/* Use an FFT which is twice the block size with zero-padding
|
||||
* to make circular convolution => proper convolution.
|
||||
*/
|
||||
eq->fft = fft_new(size_log2 + 1);
|
||||
|
||||
if (!eq->fft || !eq->fftblock || !eq->save || !eq->block || !eq->filter)
|
||||
|
@ -61,30 +61,34 @@ static void iir_free(void *data)
|
||||
static void iir_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
float b0, b1, b2, a0, a1, a2;
|
||||
float xn1_l, xn2_l, yn1_l, yn2_l;
|
||||
float xn1_r, xn2_r, yn1_r, yn2_r;
|
||||
unsigned i;
|
||||
float *out;
|
||||
struct iir_data *iir = (struct iir_data*)data;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
|
||||
float *out = output->samples;
|
||||
out = output->samples;
|
||||
|
||||
float b0 = iir->b0;
|
||||
float b1 = iir->b1;
|
||||
float b2 = iir->b2;
|
||||
float a0 = iir->a0;
|
||||
float a1 = iir->a1;
|
||||
float a2 = iir->a2;
|
||||
b0 = iir->b0;
|
||||
b1 = iir->b1;
|
||||
b2 = iir->b2;
|
||||
a0 = iir->a0;
|
||||
a1 = iir->a1;
|
||||
a2 = iir->a2;
|
||||
|
||||
float xn1_l = iir->l.xn1;
|
||||
float xn2_l = iir->l.xn2;
|
||||
float yn1_l = iir->l.yn1;
|
||||
float yn2_l = iir->l.yn2;
|
||||
xn1_l = iir->l.xn1;
|
||||
xn2_l = iir->l.xn2;
|
||||
yn1_l = iir->l.yn1;
|
||||
yn2_l = iir->l.yn2;
|
||||
|
||||
float xn1_r = iir->r.xn1;
|
||||
float xn2_r = iir->r.xn2;
|
||||
float yn1_r = iir->r.yn1;
|
||||
float yn2_r = iir->r.yn2;
|
||||
xn1_r = iir->r.xn1;
|
||||
xn2_r = iir->r.xn2;
|
||||
yn1_r = iir->r.yn1;
|
||||
yn2_r = iir->r.yn2;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
@ -155,15 +159,15 @@ static void iir_filter_init(struct iir_data *iir,
|
||||
float sample_rate, float freq, float qual, float gain, enum IIRFilter filter_type)
|
||||
{
|
||||
double omega = 2.0 * M_PI * freq / sample_rate;
|
||||
double cs = cos(omega);
|
||||
double sn = sin(omega);
|
||||
double cs = cos(omega);
|
||||
double sn = sin(omega);
|
||||
double a1pha = sn / (2.0 * qual);
|
||||
double A = exp(log(10.0) * gain / 40.0);
|
||||
double beta = sqrt(A + A);
|
||||
double A = exp(log(10.0) * gain / 40.0);
|
||||
double beta = sqrt(A + A);
|
||||
|
||||
float b0 = 0.0, b1 = 0.0, b2 = 0.0, a0 = 0.0, a1 = 0.0, a2 = 0.0;
|
||||
float b0 = 0.0, b1 = 0.0, b2 = 0.0, a0 = 0.0, a1 = 0.0, a2 = 0.0;
|
||||
|
||||
// Set up filter coefficients according to type
|
||||
/* Set up filter coefficients according to type */
|
||||
switch (filter_type)
|
||||
{
|
||||
case LPF:
|
||||
@ -216,6 +220,7 @@ static void iir_filter_init(struct iir_data *iir,
|
||||
break;
|
||||
case RIAA_phono: /* http://www.dsprelated.com/showmessage/73300/3.php */
|
||||
{
|
||||
double y, b_re, a_re, b_im, a_im, g;
|
||||
float b[3], a[3];
|
||||
|
||||
if ((int)sample_rate == 44100)
|
||||
@ -247,21 +252,22 @@ static void iir_filter_init(struct iir_data *iir,
|
||||
make_poly_from_roots(poles, 2, a);
|
||||
}
|
||||
|
||||
b0 = b[0];
|
||||
b1 = b[1];
|
||||
b2 = b[2];
|
||||
a0 = a[0];
|
||||
a1 = a[1];
|
||||
a2 = a[2];
|
||||
b0 = b[0];
|
||||
b1 = b[1];
|
||||
b2 = b[2];
|
||||
a0 = a[0];
|
||||
a1 = a[1];
|
||||
a2 = a[2];
|
||||
|
||||
|
||||
/* Normalise to 0dB at 1kHz (Thanks to Glenn Davis) */
|
||||
double y = 2.0 * M_PI * 1000.0 / sample_rate;
|
||||
double b_re = b0 + b1 * cos(-y) + b2 * cos(-2.0 * y);
|
||||
double a_re = a0 + a1 * cos(-y) + a2 * cos(-2.0 * y);
|
||||
double b_im = b1 * sin(-y) + b2 * sin(-2.0 * y);
|
||||
double a_im = a1 * sin(-y) + a2 * sin(-2.0 * y);
|
||||
double g = 1.0 / sqrt((sqr(b_re) + sqr(b_im)) / (sqr(a_re) + sqr(a_im)));
|
||||
b0 *= g; b1 *= g; b2 *= g;
|
||||
y = 2.0 * M_PI * 1000.0 / sample_rate;
|
||||
b_re = b0 + b1 * cos(-y) + b2 * cos(-2.0 * y);
|
||||
a_re = a0 + a1 * cos(-y) + a2 * cos(-2.0 * y);
|
||||
b_im = b1 * sin(-y) + b2 * sin(-2.0 * y);
|
||||
a_im = a1 * sin(-y) + a2 * sin(-2.0 * y);
|
||||
g = 1.0 / sqrt((sqr(b_re) + sqr(b_im)) / (sqr(a_re) + sqr(a_im)));
|
||||
b0 *= g; b1 *= g; b2 *= g;
|
||||
break;
|
||||
}
|
||||
case PEQ:
|
||||
@ -296,6 +302,7 @@ static void iir_filter_init(struct iir_data *iir,
|
||||
a1pha = sn / (2.0 * 0.4845);
|
||||
A = exp(log(10.0) * -9.477 / 40.0);
|
||||
beta = sqrt(A + A);
|
||||
(void)a1pha;
|
||||
case HSH:
|
||||
b0 = A * ((A + 1.0) + (A - 1.0) * cs + beta * sn);
|
||||
b1 = -2.0 * A * ((A - 1.0) + (A + 1.0) * cs);
|
||||
@ -319,19 +326,20 @@ static void iir_filter_init(struct iir_data *iir,
|
||||
static void *iir_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
float freq, qual, gain;
|
||||
enum IIRFilter filter;
|
||||
char *type = NULL;
|
||||
struct iir_data *iir = (struct iir_data*)calloc(1, sizeof(*iir));
|
||||
if (!iir)
|
||||
return NULL;
|
||||
|
||||
float freq, qual, gain;
|
||||
config->get_float(userdata, "frequency", &freq, 1024.0f);
|
||||
config->get_float(userdata, "quality", &qual, 0.707f);
|
||||
config->get_float(userdata, "gain", &gain, 0.0f);
|
||||
|
||||
char *type = NULL;
|
||||
config->get_string(userdata, "type", &type, "LPF");
|
||||
|
||||
enum IIRFilter filter = str_to_type(type);
|
||||
filter = str_to_type(type);
|
||||
config->free(type);
|
||||
|
||||
iir_filter_init(iir, info->input_rate, freq, qual, gain, filter);
|
||||
|
@ -33,12 +33,12 @@ static void panning_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
unsigned i;
|
||||
float *out;
|
||||
struct panning_data *pan = (struct panning_data*)data;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
|
||||
float *out = output->samples;
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
@ -52,28 +52,19 @@ static void panning_process(void *data, struct dspfilter_output *output,
|
||||
static void *panning_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
static const float default_left[] = { 1.0f, 0.0f };
|
||||
static const float default_right[] = { 0.0f, 1.0f };
|
||||
float *left = NULL, *right = NULL;
|
||||
unsigned num_left = 0, num_right = 0;
|
||||
struct panning_data *pan = (struct panning_data*)calloc(1, sizeof(*pan));
|
||||
if (!pan)
|
||||
return NULL;
|
||||
|
||||
float *left = NULL, *right = NULL;
|
||||
unsigned num_left = 0, num_right = 0;
|
||||
|
||||
static const float default_left[] = { 1.0f, 0.0f };
|
||||
static const float default_right[] = { 0.0f, 1.0f };
|
||||
|
||||
config->get_float_array(userdata, "left_mix", &left, &num_left, default_left, 2);
|
||||
config->get_float_array(userdata, "right_mix", &right, &num_right, default_right, 2);
|
||||
|
||||
if (num_left == 2)
|
||||
memcpy(pan->left, left, sizeof(pan->left));
|
||||
else
|
||||
memcpy(pan->left, default_left, sizeof(pan->left));
|
||||
|
||||
if (num_right == 2)
|
||||
memcpy(pan->right, right, sizeof(pan->right));
|
||||
else
|
||||
memcpy(pan->right, default_right, sizeof(pan->right));
|
||||
memcpy(pan->left, (num_left == 2) ? left : default_left, sizeof(pan->left));
|
||||
memcpy(pan->right, (num_right == 2) ? right : default_right, sizeof(pan->right));
|
||||
|
||||
config->free(left);
|
||||
config->free(right);
|
||||
|
@ -53,12 +53,12 @@ static void phaser_process(void *data, struct dspfilter_output *output,
|
||||
{
|
||||
unsigned i, c;
|
||||
int s;
|
||||
float m[2], tmp[2];
|
||||
float m[2], tmp[2], *out;
|
||||
struct phaser_data *ph = (struct phaser_data*)data;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
float *out = output->samples;
|
||||
out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
@ -95,12 +95,11 @@ static void phaser_process(void *data, struct dspfilter_output *output,
|
||||
static void *phaser_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
float lfo_freq, lfo_start_phase;
|
||||
struct phaser_data *ph = (struct phaser_data*)calloc(1, sizeof(*ph));
|
||||
if (!ph)
|
||||
return NULL;
|
||||
|
||||
float lfo_freq, lfo_start_phase;
|
||||
|
||||
config->get_float(userdata, "lfo_freq", &lfo_freq, 0.4f);
|
||||
config->get_float(userdata, "lfo_start_phase", &lfo_start_phase, 0.0f);
|
||||
config->get_float(userdata, "feedback", &ph->fb, 0.0f);
|
||||
|
@ -245,11 +245,12 @@ static void reverb_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
unsigned i;
|
||||
float *out;
|
||||
struct reverb_data *rev = (struct reverb_data*)data;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
float *out = output->samples;
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
@ -263,11 +264,12 @@ static void reverb_process(void *data, struct dspfilter_output *output,
|
||||
static void *reverb_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
struct reverb_data *rev = (struct reverb_data*)calloc(1, sizeof(*rev));
|
||||
float drytime, wettime, damping, roomwidth, roomsize;
|
||||
struct reverb_data *rev = (struct reverb_data*)
|
||||
calloc(1, sizeof(*rev));
|
||||
if (!rev)
|
||||
return NULL;
|
||||
|
||||
float drytime, wettime, damping, roomwidth, roomsize;
|
||||
config->get_float(userdata, "drytime", &drytime, 0.43f);
|
||||
config->get_float(userdata, "wettime", &wettime, 0.4f);
|
||||
config->get_float(userdata, "damping", &damping, 0.8f);
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define wahwahlfoskipsamples 30
|
||||
#define WAHWAH_LFO_SKIP_SAMPLES 30
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.1415926535897932384626433832795
|
||||
@ -42,44 +42,49 @@ struct wahwah_data
|
||||
|
||||
static void wahwah_free(void *data)
|
||||
{
|
||||
free(data);
|
||||
if (data)
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void wahwah_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
unsigned i;
|
||||
float *out;
|
||||
struct wahwah_data *wah = (struct wahwah_data*)data;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
float *out = output->samples;
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
float out_l, out_r;
|
||||
float in[2] = { out[0], out[1] };
|
||||
|
||||
if ((wah->skipcount++ % wahwahlfoskipsamples) == 0)
|
||||
if ((wah->skipcount++ % WAHWAH_LFO_SKIP_SAMPLES) == 0)
|
||||
{
|
||||
float omega, sn, cs, alpha;
|
||||
float frequency = (1.0 + cos(wah->skipcount * wah->lfoskip + wah->phase)) / 2.0;
|
||||
|
||||
frequency = frequency * wah->depth * (1.0 - wah->freqofs) + wah->freqofs;
|
||||
frequency = exp((frequency - 1.0) * 6.0);
|
||||
|
||||
float omega = M_PI * frequency;
|
||||
float sn = sin(omega);
|
||||
float cs = cos(omega);
|
||||
float alpha = sn / (2.0 * wah->res);
|
||||
omega = M_PI * frequency;
|
||||
sn = sin(omega);
|
||||
cs = cos(omega);
|
||||
alpha = sn / (2.0 * wah->res);
|
||||
|
||||
wah->b0 = (1.0 - cs) / 2.0;
|
||||
wah->b1 = 1.0 - cs;
|
||||
wah->b2 = (1.0 - cs) / 2.0;
|
||||
wah->a0 = 1.0 + alpha;
|
||||
wah->a1 = -2.0 * cs;
|
||||
wah->a2 = 1.0 - alpha;
|
||||
wah->b0 = (1.0 - cs) / 2.0;
|
||||
wah->b1 = 1.0 - cs;
|
||||
wah->b2 = (1.0 - cs) / 2.0;
|
||||
wah->a0 = 1.0 + alpha;
|
||||
wah->a1 = -2.0 * cs;
|
||||
wah->a2 = 1.0 - alpha;
|
||||
}
|
||||
|
||||
float out_l = (wah->b0 * in[0] + wah->b1 * wah->l.xn1 + wah->b2 * wah->l.xn2 - wah->a1 * wah->l.yn1 - wah->a2 * wah->l.yn2) / wah->a0;
|
||||
float out_r = (wah->b0 * in[1] + wah->b1 * wah->r.xn1 + wah->b2 * wah->r.xn2 - wah->a1 * wah->r.yn1 - wah->a2 * wah->r.yn2) / wah->a0;
|
||||
out_l = (wah->b0 * in[0] + wah->b1 * wah->l.xn1 + wah->b2 * wah->l.xn2 - wah->a1 * wah->l.yn1 - wah->a2 * wah->l.yn2) / wah->a0;
|
||||
out_r = (wah->b0 * in[1] + wah->b1 * wah->r.xn1 + wah->b2 * wah->r.xn2 - wah->a1 * wah->r.yn1 - wah->a2 * wah->r.yn2) / wah->a0;
|
||||
|
||||
wah->l.xn2 = wah->l.xn1;
|
||||
wah->l.xn1 = in[0];
|
||||
@ -91,8 +96,8 @@ static void wahwah_process(void *data, struct dspfilter_output *output,
|
||||
wah->r.yn2 = wah->r.yn1;
|
||||
wah->r.yn1 = out_r;
|
||||
|
||||
out[0] = out_l;
|
||||
out[1] = out_r;
|
||||
out[0] = out_l;
|
||||
out[1] = out_r;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <file/config_file_userdata.h>
|
||||
#include <string.h>
|
||||
#ifndef DONT_HAVE_STRING_LIST
|
||||
#include <string/string_list.h>
|
||||
#include "../string_list_special.h"
|
||||
#endif
|
||||
|
||||
static const rarch_resampler_t *resampler_drivers[] = {
|
||||
@ -99,40 +99,7 @@ const char *audio_resampler_driver_find_ident(int idx)
|
||||
**/
|
||||
const char* config_get_audio_resampler_driver_options(void)
|
||||
{
|
||||
union string_list_elem_attr attr;
|
||||
unsigned i;
|
||||
char *options = NULL;
|
||||
int options_len = 0;
|
||||
struct string_list *options_l = string_list_new();
|
||||
|
||||
attr.i = 0;
|
||||
|
||||
if (!options_l)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; resampler_drivers[i]; i++)
|
||||
{
|
||||
const char *opt = resampler_drivers[i]->ident;
|
||||
|
||||
options_len += strlen(opt) + 1;
|
||||
string_list_append(options_l, opt, attr);
|
||||
}
|
||||
|
||||
options = (char*)calloc(options_len, sizeof(char));
|
||||
|
||||
if (!options)
|
||||
{
|
||||
options = NULL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
string_list_join_concat(options, options_len, options_l, "|");
|
||||
|
||||
done:
|
||||
string_list_free(options_l);
|
||||
options_l = NULL;
|
||||
|
||||
return options;
|
||||
return char_list_new_special(STRING_LIST_AUDIO_RESAMPLER_DRIVERS, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -158,7 +125,7 @@ static const rarch_resampler_t *find_resampler_driver(const char *ident)
|
||||
#ifndef RARCH_INTERNAL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
extern "C" {
|
||||
#endif
|
||||
retro_get_cpu_features_t perf_get_cpu_features_cb;
|
||||
|
||||
@ -171,7 +138,7 @@ retro_get_cpu_features_t perf_get_cpu_features_cb;
|
||||
static resampler_simd_mask_t resampler_get_cpu_features(void)
|
||||
{
|
||||
#ifdef RARCH_INTERNAL
|
||||
return rarch_get_cpu_features();
|
||||
return retro_get_cpu_features();
|
||||
#else
|
||||
return perf_get_cpu_features_cb();
|
||||
#endif
|
||||
|
@ -215,7 +215,7 @@ void audio_convert_float_to_s16_altivec(int16_t *out,
|
||||
}
|
||||
audio_convert_float_to_s16_C(out, in, samples_in);
|
||||
}
|
||||
#elif defined(__ARM_NEON__)
|
||||
#elif defined(__ARM_NEON__) && !defined(VITA)
|
||||
/* Avoid potential hard-float/soft-float ABI issues. */
|
||||
void audio_convert_s16_float_asm(float *out, const int16_t *in,
|
||||
size_t samples, const float *gain);
|
||||
@ -288,7 +288,7 @@ void audio_convert_s16_to_float_ALLEGREX(float *out,
|
||||
/* Make sure the buffer is 16 byte aligned, this should be the
|
||||
* default behaviour of malloc in the PSPSDK.
|
||||
* Only the output buffer can be assumed to be 16-byte aligned. */
|
||||
rarch_assert(((uintptr_t)out & 0xf) == 0);
|
||||
retro_assert(((uintptr_t)out & 0xf) == 0);
|
||||
#endif
|
||||
|
||||
size_t i;
|
||||
@ -360,8 +360,8 @@ void audio_convert_float_to_s16_ALLEGREX(int16_t *out,
|
||||
/* Make sure the buffers are 16 byte aligned, this should be
|
||||
* the default behaviour of malloc in the PSPSDK.
|
||||
* Both buffers are allocated by RetroArch, so can assume alignment. */
|
||||
rarch_assert(((uintptr_t)in & 0xf) == 0);
|
||||
rarch_assert(((uintptr_t)out & 0xf) == 0);
|
||||
retro_assert(((uintptr_t)in & 0xf) == 0);
|
||||
retro_assert(((uintptr_t)out & 0xf) == 0);
|
||||
#endif
|
||||
|
||||
for (i = 0; i + 8 <= samples; i += 8)
|
||||
@ -396,7 +396,7 @@ void audio_convert_float_to_s16_ALLEGREX(int16_t *out,
|
||||
#ifndef RARCH_INTERNAL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
extern "C" {
|
||||
#endif
|
||||
retro_get_cpu_features_t perf_get_cpu_features_cb;
|
||||
|
||||
@ -409,7 +409,7 @@ retro_get_cpu_features_t perf_get_cpu_features_cb;
|
||||
static unsigned audio_convert_get_cpu_features(void)
|
||||
{
|
||||
#ifdef RARCH_INTERNAL
|
||||
return rarch_get_cpu_features();
|
||||
return retro_get_cpu_features();
|
||||
#else
|
||||
return perf_get_cpu_features_cb();
|
||||
#endif
|
||||
@ -426,10 +426,10 @@ void audio_convert_init_simd(void)
|
||||
unsigned cpu = audio_convert_get_cpu_features();
|
||||
|
||||
(void)cpu;
|
||||
#if defined(__ARM_NEON__)
|
||||
audio_convert_s16_to_float_arm = cpu & RETRO_SIMD_NEON ?
|
||||
#if defined(__ARM_NEON__) && !defined(VITA)
|
||||
audio_convert_s16_to_float_arm = (cpu & RETRO_SIMD_NEON) ?
|
||||
audio_convert_s16_to_float_neon : audio_convert_s16_to_float_C;
|
||||
audio_convert_float_to_s16_arm = cpu & RETRO_SIMD_NEON ?
|
||||
audio_convert_float_to_s16_arm = (cpu & RETRO_SIMD_NEON) ?
|
||||
audio_convert_float_to_s16_neon : audio_convert_float_to_s16_C;
|
||||
#endif
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ void audio_convert_s16_to_float_altivec(float *out,
|
||||
void audio_convert_float_to_s16_altivec(int16_t *out,
|
||||
const float *in, size_t samples);
|
||||
|
||||
#elif defined(__ARM_NEON__)
|
||||
#elif defined(__ARM_NEON__) && !defined(VITA)
|
||||
#define audio_convert_s16_to_float audio_convert_s16_to_float_arm
|
||||
#define audio_convert_float_to_s16 audio_convert_float_to_s16_arm
|
||||
|
||||
|
@ -13,16 +13,13 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include <stdlib.h>
|
||||
#include <alsa/asoundlib.h>
|
||||
#include "../../general.h"
|
||||
|
||||
#define TRY_ALSA(x) if (x < 0) { \
|
||||
goto error; \
|
||||
}
|
||||
|
||||
typedef struct alsa
|
||||
{
|
||||
snd_pcm_t *pcm;
|
||||
@ -73,43 +70,72 @@ static void *alsa_init(const char *device, unsigned rate, unsigned latency)
|
||||
if (device)
|
||||
alsa_dev = device;
|
||||
|
||||
TRY_ALSA(snd_pcm_open(
|
||||
&alsa->pcm, alsa_dev, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK));
|
||||
TRY_ALSA(snd_pcm_hw_params_malloc(¶ms));
|
||||
if (snd_pcm_open(
|
||||
&alsa->pcm, alsa_dev, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK) < 0)
|
||||
goto error;
|
||||
|
||||
if (snd_pcm_hw_params_malloc(¶ms) < 0)
|
||||
goto error;
|
||||
|
||||
alsa->has_float = find_float_format(alsa->pcm, params);
|
||||
format = alsa->has_float ? SND_PCM_FORMAT_FLOAT : SND_PCM_FORMAT_S16;
|
||||
|
||||
TRY_ALSA(snd_pcm_hw_params_any(alsa->pcm, params));
|
||||
TRY_ALSA(snd_pcm_hw_params_set_access(
|
||||
alsa->pcm, params, SND_PCM_ACCESS_RW_INTERLEAVED));
|
||||
TRY_ALSA(snd_pcm_hw_params_set_format(alsa->pcm, params, format));
|
||||
TRY_ALSA(snd_pcm_hw_params_set_channels(alsa->pcm, params, channels));
|
||||
TRY_ALSA(snd_pcm_hw_params_set_rate(alsa->pcm, params, rate, 0));
|
||||
if (snd_pcm_hw_params_any(alsa->pcm, params) < 0)
|
||||
goto error;
|
||||
|
||||
TRY_ALSA(snd_pcm_hw_params_set_buffer_time_near(
|
||||
alsa->pcm, params, &latency_usec, NULL));
|
||||
TRY_ALSA(snd_pcm_hw_params_set_periods_near(
|
||||
alsa->pcm, params, &periods, NULL));
|
||||
if (snd_pcm_hw_params_set_access(
|
||||
alsa->pcm, params, SND_PCM_ACCESS_RW_INTERLEAVED) < 0)
|
||||
goto error;
|
||||
|
||||
TRY_ALSA(snd_pcm_hw_params(alsa->pcm, params));
|
||||
if (snd_pcm_hw_params_set_format(alsa->pcm, params, format) < 0)
|
||||
goto error;
|
||||
|
||||
if (snd_pcm_hw_params_set_channels(alsa->pcm, params, channels) < 0)
|
||||
goto error;
|
||||
|
||||
if (snd_pcm_hw_params_set_rate(alsa->pcm, params, rate, 0) < 0)
|
||||
goto error;
|
||||
|
||||
if (snd_pcm_hw_params_set_buffer_time_near(
|
||||
alsa->pcm, params, &latency_usec, NULL) < 0)
|
||||
goto error;
|
||||
|
||||
if (snd_pcm_hw_params_set_periods_near(
|
||||
alsa->pcm, params, &periods, NULL) < 0)
|
||||
goto error;
|
||||
|
||||
if (snd_pcm_hw_params(alsa->pcm, params) < 0)
|
||||
goto error;
|
||||
|
||||
/* Shouldn't have to bother with this,
|
||||
* but some drivers are apparently broken. */
|
||||
if (snd_pcm_hw_params_get_period_size(params, &buffer_size, NULL))
|
||||
snd_pcm_hw_params_get_period_size_min(params, &buffer_size, NULL);
|
||||
|
||||
RARCH_LOG("ALSA: Period size: %d frames\n", (int)buffer_size);
|
||||
|
||||
if (snd_pcm_hw_params_get_buffer_size(params, &buffer_size))
|
||||
snd_pcm_hw_params_get_buffer_size_max(params, &buffer_size);
|
||||
|
||||
RARCH_LOG("ALSA: Buffer size: %d frames\n", (int)buffer_size);
|
||||
|
||||
alsa->buffer_size = snd_pcm_frames_to_bytes(alsa->pcm, buffer_size);
|
||||
alsa->can_pause = snd_pcm_hw_params_can_pause(params);
|
||||
|
||||
RARCH_LOG("ALSA: Can pause: %s.\n", alsa->can_pause ? "yes" : "no");
|
||||
|
||||
TRY_ALSA(snd_pcm_sw_params_malloc(&sw_params));
|
||||
TRY_ALSA(snd_pcm_sw_params_current(alsa->pcm, sw_params));
|
||||
TRY_ALSA(snd_pcm_sw_params_set_start_threshold(
|
||||
alsa->pcm, sw_params, buffer_size / 2));
|
||||
TRY_ALSA(snd_pcm_sw_params(alsa->pcm, sw_params));
|
||||
if (snd_pcm_sw_params_malloc(&sw_params) < 0)
|
||||
goto error;
|
||||
|
||||
if (snd_pcm_sw_params_current(alsa->pcm, sw_params) < 0)
|
||||
goto error;
|
||||
|
||||
if (snd_pcm_sw_params_set_start_threshold(
|
||||
alsa->pcm, sw_params, buffer_size / 2) < 0)
|
||||
goto error;
|
||||
|
||||
if (snd_pcm_sw_params(alsa->pcm, sw_params) < 0)
|
||||
goto error;
|
||||
|
||||
snd_pcm_hw_params_free(params);
|
||||
snd_pcm_sw_params_free(sw_params);
|
||||
|
@ -14,13 +14,13 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../../general.h"
|
||||
#include "../../driver.h"
|
||||
|
||||
#define ALSA_PCM_NEW_HW_PARAMS_API
|
||||
#define ALSA_PCM_NEW_SW_PARAMS_API
|
||||
#include <sys/asoundlib.h>
|
||||
|
||||
#include "../../general.h"
|
||||
#include "../../driver.h"
|
||||
|
||||
#define MAX_FRAG_SIZE 3072
|
||||
#define DEFAULT_RATE 48000
|
||||
|
||||
@ -222,8 +222,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)
|
||||
{
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
snd_pcm_channel_status_t cstatus = {0};
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
snd_pcm_sframes_t written = 0;
|
||||
|
||||
while (size)
|
||||
@ -233,10 +232,11 @@ static ssize_t alsa_qsa_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
memcpy(alsa->buffer[alsa->buffer_index] +
|
||||
alsa->buffer_ptr, buf, avail_write);
|
||||
alsa->buffer_ptr += avail_write;
|
||||
buf += avail_write;
|
||||
size -= avail_write;
|
||||
written += avail_write;
|
||||
|
||||
alsa->buffer_ptr += avail_write;
|
||||
buf = (void*)((uint8_t*)buf + avail_write);
|
||||
size -= avail_write;
|
||||
written += avail_write;
|
||||
}
|
||||
|
||||
if (alsa->buffer_ptr >= alsa->buf_size)
|
||||
@ -245,7 +245,7 @@ static ssize_t alsa_qsa_write(void *data, const void *buf, size_t size)
|
||||
alsa->buffer[alsa->buffer_index], alsa->buf_size);
|
||||
|
||||
alsa->buffer_index = (alsa->buffer_index + 1) % alsa->buf_count;
|
||||
alsa->buffer_ptr = 0;
|
||||
alsa->buffer_ptr = 0;
|
||||
|
||||
if (frames <= 0)
|
||||
{
|
||||
|
@ -14,14 +14,16 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "../../driver.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
#include "../../general.h"
|
||||
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
|
||||
#define TRY_ALSA(x) if (x < 0) { \
|
||||
goto error; \
|
||||
}
|
||||
|
@ -13,13 +13,8 @@
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#include <AudioToolbox/AudioToolbox.h>
|
||||
@ -31,6 +26,14 @@
|
||||
#include <AudioUnit/AudioUnit.h>
|
||||
#include <AudioUnit/AUComponent.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <retro_endianness.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
|
||||
#if defined(__powerpc__) || defined(__ppc__) || defined(__POWERPC__)
|
||||
|
||||
#ifndef OSX_PPC
|
||||
@ -41,8 +44,8 @@
|
||||
|
||||
typedef struct coreaudio
|
||||
{
|
||||
pthread_mutex_t lock;
|
||||
pthread_cond_t cond;
|
||||
slock_t *lock;
|
||||
scond_t *cond;
|
||||
|
||||
#ifdef OSX_PPC
|
||||
ComponentInstance dev;
|
||||
@ -79,8 +82,8 @@ static void coreaudio_free(void *data)
|
||||
if (dev->buffer)
|
||||
fifo_free(dev->buffer);
|
||||
|
||||
pthread_mutex_destroy(&dev->lock);
|
||||
pthread_cond_destroy(&dev->cond);
|
||||
slock_free(dev->lock);
|
||||
scond_free(dev->cond);
|
||||
|
||||
free(dev);
|
||||
}
|
||||
@ -106,7 +109,7 @@ static OSStatus audio_write_cb(void *userdata,
|
||||
write_avail = io_data->mBuffers[0].mDataByteSize;
|
||||
outbuf = io_data->mBuffers[0].mData;
|
||||
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
slock_lock(dev->lock);
|
||||
|
||||
if (fifo_read_avail(dev->buffer) < write_avail)
|
||||
{
|
||||
@ -115,16 +118,16 @@ static OSStatus audio_write_cb(void *userdata,
|
||||
/* Seems to be needed. */
|
||||
memset(outbuf, 0, write_avail);
|
||||
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
slock_unlock(dev->lock);
|
||||
|
||||
/* Technically possible to deadlock without. */
|
||||
pthread_cond_signal(&dev->cond);
|
||||
scond_signal(dev->cond);
|
||||
return noErr;
|
||||
}
|
||||
|
||||
fifo_read(dev->buffer, outbuf, write_avail);
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
pthread_cond_signal(&dev->cond);
|
||||
slock_unlock(dev->lock);
|
||||
scond_signal(dev->cond);
|
||||
return noErr;
|
||||
}
|
||||
|
||||
@ -215,8 +218,8 @@ static void *coreaudio_init(const char *device,
|
||||
if (!dev)
|
||||
return NULL;
|
||||
|
||||
pthread_mutex_init(&dev->lock, NULL);
|
||||
pthread_cond_init(&dev->cond, NULL);
|
||||
dev->lock = slock_new();
|
||||
dev->cond = scond_new();
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
if (!session_initialized)
|
||||
@ -340,22 +343,11 @@ static ssize_t coreaudio_write(void *data, const void *buf_, size_t size)
|
||||
const uint8_t *buf = (const uint8_t*)buf_;
|
||||
size_t written = 0;
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
struct timespec timeout;
|
||||
struct timeval time;
|
||||
|
||||
gettimeofday(&time, 0);
|
||||
|
||||
memset(&timeout, 0, sizeof(timeout));
|
||||
timeout.tv_sec = time.tv_sec + 3;
|
||||
timeout.tv_nsec = time.tv_usec * 1000;
|
||||
#endif
|
||||
|
||||
while (!g_interrupted && size > 0)
|
||||
{
|
||||
size_t write_avail;
|
||||
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
slock_lock(dev->lock);
|
||||
|
||||
write_avail = fifo_write_avail(dev->buffer);
|
||||
if (write_avail > size)
|
||||
@ -368,19 +360,19 @@ static ssize_t coreaudio_write(void *data, const void *buf_, size_t size)
|
||||
|
||||
if (dev->nonblock)
|
||||
{
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
slock_unlock(dev->lock);
|
||||
break;
|
||||
}
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
if (write_avail == 0 && pthread_cond_timedwait(
|
||||
&dev->cond, &dev->lock, &timeout) == ETIMEDOUT)
|
||||
if (write_avail == 0 && !scond_wait_timeout(
|
||||
dev->cond, dev->lock, 3000000))
|
||||
g_interrupted = true;
|
||||
#else
|
||||
if (write_avail == 0)
|
||||
pthread_cond_wait(&dev->cond, &dev->lock);
|
||||
scond_wait(dev->cond, dev->lock);
|
||||
#endif
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
slock_unlock(dev->lock);
|
||||
}
|
||||
|
||||
return written;
|
||||
@ -430,9 +422,9 @@ static size_t coreaudio_write_avail(void *data)
|
||||
size_t avail;
|
||||
coreaudio_t *dev = (coreaudio_t*)data;
|
||||
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
slock_lock(dev->lock);
|
||||
avail = fifo_write_avail(dev->buffer);
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
slock_unlock(dev->lock);
|
||||
|
||||
return avail;
|
||||
}
|
||||
|
@ -1,241 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2014-2015 - Ali Bouhlel
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* 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 "../../general.h"
|
||||
#include "../../driver.h"
|
||||
#include "../../performance.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool nonblocking;
|
||||
bool playing;
|
||||
int16_t* l;
|
||||
int16_t* r;
|
||||
|
||||
uint32_t l_paddr;
|
||||
uint32_t r_paddr;
|
||||
|
||||
uint32_t pos;
|
||||
|
||||
uint32_t playpos;
|
||||
uint32_t cpu_ticks_per_sample;
|
||||
uint64_t cpu_ticks_last;
|
||||
|
||||
int rate;
|
||||
|
||||
} ctr_audio_t;
|
||||
|
||||
#define CTR_AUDIO_COUNT (1u << 11u)
|
||||
#define CTR_AUDIO_COUNT_MASK (CTR_AUDIO_COUNT - 1u)
|
||||
#define CTR_AUDIO_SIZE (CTR_AUDIO_COUNT * sizeof(int16_t))
|
||||
#define CTR_AUDIO_SIZE_MASK (CTR_AUDIO_SIZE - 1u)
|
||||
|
||||
static void *ctr_audio_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
|
||||
|
||||
(void)device;
|
||||
(void)rate;
|
||||
(void)latency;
|
||||
|
||||
// if(!csndInit())
|
||||
// return NULL;
|
||||
|
||||
ctr_audio_t *ctr = (ctr_audio_t*)calloc(1, sizeof(ctr_audio_t));
|
||||
|
||||
ctr->l = linearAlloc(CTR_AUDIO_SIZE);
|
||||
ctr->r = linearAlloc(CTR_AUDIO_SIZE);
|
||||
|
||||
memset(ctr->l, 0, CTR_AUDIO_SIZE);
|
||||
memset(ctr->r, 0, CTR_AUDIO_SIZE);
|
||||
|
||||
ctr->l_paddr = osConvertVirtToPhys((u32)ctr->l);
|
||||
ctr->r_paddr = osConvertVirtToPhys((u32)ctr->r);
|
||||
|
||||
ctr->pos = 0;
|
||||
ctr->rate = rate;
|
||||
ctr->cpu_ticks_per_sample = CSND_TIMER(rate) * 4;
|
||||
|
||||
GSPGPU_FlushDataCache(NULL, (u8*)ctr->l_paddr, CTR_AUDIO_SIZE);
|
||||
GSPGPU_FlushDataCache(NULL, (u8*)ctr->r_paddr, CTR_AUDIO_SIZE);
|
||||
csndPlaySound(0x8, SOUND_LOOPMODE(CSND_LOOPMODE_NORMAL)| SOUND_FORMAT(CSND_ENCODING_PCM16),
|
||||
rate, 1.0, -1.0, ctr->l, ctr->l, CTR_AUDIO_SIZE);
|
||||
|
||||
csndPlaySound(0x9, SOUND_LOOPMODE(CSND_LOOPMODE_NORMAL)| SOUND_FORMAT(CSND_ENCODING_PCM16),
|
||||
rate, 1.0, 1.0, ctr->r, ctr->r, CTR_AUDIO_SIZE);
|
||||
|
||||
ctr->playpos = 0;
|
||||
ctr->cpu_ticks_last = svcGetSystemTick();
|
||||
ctr->playing = true;
|
||||
|
||||
return ctr;
|
||||
}
|
||||
|
||||
static void ctr_audio_free(void *data)
|
||||
{
|
||||
ctr_audio_t* ctr = (ctr_audio_t*)data;
|
||||
|
||||
// csndExit();
|
||||
CSND_SetPlayState(0x8, 0);
|
||||
CSND_SetPlayState(0x9, 0);
|
||||
csndExecCmds(false);
|
||||
|
||||
linearFree(ctr->l);
|
||||
linearFree(ctr->r);
|
||||
|
||||
free(ctr);
|
||||
}
|
||||
|
||||
static ssize_t ctr_audio_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
(void)data;
|
||||
(void)buf;
|
||||
|
||||
ctr_audio_t* ctr = (ctr_audio_t*)data;
|
||||
|
||||
int i;
|
||||
const uint16_t* src = buf;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(ctraudio_f);
|
||||
RARCH_PERFORMANCE_START(ctraudio_f);
|
||||
|
||||
uint64_t current_tick = svcGetSystemTick();
|
||||
uint32_t samples_played = (current_tick - ctr->cpu_ticks_last) / ctr->cpu_ticks_per_sample;
|
||||
ctr->playpos = (ctr->playpos + samples_played) & CTR_AUDIO_COUNT_MASK;
|
||||
ctr->cpu_ticks_last += samples_played * ctr->cpu_ticks_per_sample;
|
||||
|
||||
|
||||
if((((ctr->playpos - ctr->pos) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 2)) ||
|
||||
(((ctr->pos - ctr->playpos ) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 4)) ||
|
||||
(((ctr->playpos - ctr->pos) & CTR_AUDIO_COUNT_MASK) < (size >> 2)))
|
||||
{
|
||||
if (ctr->nonblocking)
|
||||
ctr->pos = (ctr->playpos + (CTR_AUDIO_COUNT >> 1)) & CTR_AUDIO_COUNT_MASK;
|
||||
else
|
||||
{
|
||||
do{
|
||||
/* todo: compute the correct sleep period */
|
||||
rarch_sleep(1);
|
||||
current_tick = svcGetSystemTick();
|
||||
samples_played = (current_tick - ctr->cpu_ticks_last) / ctr->cpu_ticks_per_sample;
|
||||
ctr->playpos = (ctr->playpos + samples_played) & CTR_AUDIO_COUNT_MASK;
|
||||
ctr->cpu_ticks_last += samples_played * ctr->cpu_ticks_per_sample;
|
||||
}while (((ctr->playpos - ctr->pos) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 1)
|
||||
|| (((ctr->pos - ctr->playpos) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 4)));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < (size >> 1); i += 2)
|
||||
{
|
||||
ctr->l[ctr->pos] = src[i];
|
||||
ctr->r[ctr->pos] = src[i + 1];
|
||||
ctr->pos++;
|
||||
ctr->pos &= CTR_AUDIO_COUNT_MASK;
|
||||
}
|
||||
GSPGPU_FlushDataCache(NULL, (u8*)ctr->l, CTR_AUDIO_SIZE);
|
||||
GSPGPU_FlushDataCache(NULL, (u8*)ctr->r, CTR_AUDIO_SIZE);
|
||||
|
||||
|
||||
RARCH_PERFORMANCE_STOP(ctraudio_f);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static bool ctr_audio_stop(void *data)
|
||||
{
|
||||
ctr_audio_t* ctr = (ctr_audio_t*)data;
|
||||
|
||||
/* using SetPlayState would make tracking the playback
|
||||
* position more difficult */
|
||||
|
||||
// CSND_SetPlayState(0x8, 0);
|
||||
// CSND_SetPlayState(0x9, 0);
|
||||
|
||||
/* setting the channel volume to 0 seems to make it
|
||||
* impossible to set it back to full volume later */
|
||||
|
||||
CSND_SetVol(0x8, 0x00000001, 0);
|
||||
CSND_SetVol(0x9, 0x00010000, 0);
|
||||
csndExecCmds(false);
|
||||
|
||||
ctr->playing = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ctr_audio_alive(void *data)
|
||||
{
|
||||
ctr_audio_t* ctr = (ctr_audio_t*)data;
|
||||
return ctr->playing;
|
||||
}
|
||||
|
||||
static bool ctr_audio_start(void *data)
|
||||
{
|
||||
ctr_audio_t* ctr = (ctr_audio_t*)data;
|
||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||
|
||||
/* prevents restarting audio when the menu
|
||||
* is toggled off on shutdown */
|
||||
|
||||
if (system->shutdown)
|
||||
return true;
|
||||
|
||||
// CSND_SetPlayState(0x8, 1);
|
||||
// CSND_SetPlayState(0x9, 1);
|
||||
|
||||
CSND_SetVol(0x8, 0x00008000, 0);
|
||||
CSND_SetVol(0x9, 0x80000000, 0);
|
||||
|
||||
csndExecCmds(false);
|
||||
|
||||
ctr->playing = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void ctr_audio_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
ctr_audio_t* ctr = (ctr_audio_t*)data;
|
||||
if (ctr)
|
||||
ctr->nonblocking = state;
|
||||
}
|
||||
|
||||
static bool ctr_audio_use_float(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return false;
|
||||
}
|
||||
|
||||
static size_t ctr_audio_write_avail(void *data)
|
||||
{
|
||||
/* stub */
|
||||
(void)data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
audio_driver_t audio_ctr = {
|
||||
ctr_audio_init,
|
||||
ctr_audio_write,
|
||||
ctr_audio_stop,
|
||||
ctr_audio_start,
|
||||
ctr_audio_alive,
|
||||
ctr_audio_set_nonblock_state,
|
||||
ctr_audio_free,
|
||||
ctr_audio_use_float,
|
||||
"ctr",
|
||||
ctr_audio_write_avail,
|
||||
NULL
|
||||
};
|
303
audio/drivers/ctr_csnd_audio.c
Normal file
303
audio/drivers/ctr_csnd_audio.c
Normal file
@ -0,0 +1,303 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2014-2015 - Ali Bouhlel
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* 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 <3ds.h>
|
||||
#include "../../general.h"
|
||||
#include "../../driver.h"
|
||||
#include "../../performance.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool nonblocking;
|
||||
bool playing;
|
||||
int16_t* l;
|
||||
int16_t* r;
|
||||
|
||||
uint32_t l_paddr;
|
||||
uint32_t r_paddr;
|
||||
|
||||
uint32_t pos;
|
||||
|
||||
uint32_t playpos;
|
||||
uint64_t cpu_ticks_last;
|
||||
} ctr_csnd_audio_t;
|
||||
|
||||
#define CTR_CSND_AUDIO_COUNT (1u << 11u)
|
||||
#define CTR_CSND_AUDIO_COUNT_MASK (CTR_CSND_AUDIO_COUNT - 1u)
|
||||
#define CTR_CSND_AUDIO_SIZE (CTR_CSND_AUDIO_COUNT * sizeof(int16_t))
|
||||
#define CTR_CSND_AUDIO_SIZE_MASK (CTR_CSND_AUDIO_SIZE - 1u)
|
||||
|
||||
#define CTR_CSND_AUDIO_RATE 32730
|
||||
#define CTR_CSND_TICKS_PER_SAMPLE 2048
|
||||
#define CTR_CSND_CPU_TICKS_PER_SAMPLE (CTR_CSND_TICKS_PER_SAMPLE * 4)
|
||||
|
||||
static void ctr_csnd_audio_update_playpos(ctr_csnd_audio_t* ctr)
|
||||
{
|
||||
uint32_t samples_played;
|
||||
uint64_t current_tick;
|
||||
|
||||
current_tick = svcGetSystemTick();
|
||||
samples_played = (current_tick - ctr->cpu_ticks_last) / CTR_CSND_CPU_TICKS_PER_SAMPLE;
|
||||
ctr->playpos = (ctr->playpos + samples_played) & CTR_CSND_AUDIO_COUNT_MASK;
|
||||
ctr->cpu_ticks_last += samples_played * CTR_CSND_CPU_TICKS_PER_SAMPLE;
|
||||
}
|
||||
|
||||
|
||||
Result csndPlaySound_custom(int chn, u32 flags, float vol, float pan, void* data0, void* data1, u32 size)
|
||||
{
|
||||
if (!(csndChannels & BIT(chn)))
|
||||
return 1;
|
||||
|
||||
u32 paddr0 = 0, paddr1 = 0;
|
||||
|
||||
int encoding = (flags >> 12) & 3;
|
||||
int loopMode = (flags >> 10) & 3;
|
||||
|
||||
if (!loopMode) flags |= SOUND_ONE_SHOT;
|
||||
|
||||
if (encoding != CSND_ENCODING_PSG)
|
||||
{
|
||||
if (data0) paddr0 = osConvertVirtToPhys((u32)data0);
|
||||
if (data1) paddr1 = osConvertVirtToPhys((u32)data1);
|
||||
|
||||
if (data0 && encoding == CSND_ENCODING_ADPCM)
|
||||
{
|
||||
int adpcmSample = ((s16*)data0)[-2];
|
||||
int adpcmIndex = ((u8*)data0)[-2];
|
||||
CSND_SetAdpcmState(chn, 0, adpcmSample, adpcmIndex);
|
||||
}
|
||||
}
|
||||
|
||||
flags &= ~0xFFFF001F;
|
||||
flags |= SOUND_ENABLE | SOUND_CHANNEL(chn) | (CTR_CSND_TICKS_PER_SAMPLE << 16);
|
||||
|
||||
u32 volumes = CSND_VOL(vol, pan);
|
||||
CSND_SetChnRegs(flags, paddr0, paddr1, size, volumes, volumes);
|
||||
|
||||
if (loopMode == CSND_LOOPMODE_NORMAL && paddr1 > paddr0)
|
||||
{
|
||||
// Now that the first block is playing, configure the size of the subsequent blocks
|
||||
size -= paddr1 - paddr0;
|
||||
CSND_SetBlock(chn, 1, paddr1, size);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *ctr_csnd_audio_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
ctr_csnd_audio_t *ctr = (ctr_csnd_audio_t*)calloc(1, sizeof(ctr_csnd_audio_t));
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!ctr)
|
||||
return NULL;
|
||||
|
||||
(void)device;
|
||||
(void)rate;
|
||||
(void)latency;
|
||||
|
||||
settings->audio.out_rate = CTR_CSND_AUDIO_RATE;
|
||||
|
||||
ctr->l = linearAlloc(CTR_CSND_AUDIO_SIZE);
|
||||
ctr->r = linearAlloc(CTR_CSND_AUDIO_SIZE);
|
||||
|
||||
memset(ctr->l, 0, CTR_CSND_AUDIO_SIZE);
|
||||
memset(ctr->r, 0, CTR_CSND_AUDIO_SIZE);
|
||||
|
||||
ctr->l_paddr = osConvertVirtToPhys((u32)ctr->l);
|
||||
ctr->r_paddr = osConvertVirtToPhys((u32)ctr->r);
|
||||
|
||||
ctr->pos = 0;
|
||||
|
||||
GSPGPU_FlushDataCache(ctr->l_paddr, CTR_CSND_AUDIO_SIZE);
|
||||
GSPGPU_FlushDataCache(ctr->r_paddr, CTR_CSND_AUDIO_SIZE);
|
||||
csndPlaySound_custom(0x8, SOUND_LOOPMODE(CSND_LOOPMODE_NORMAL)| SOUND_FORMAT(CSND_ENCODING_PCM16),
|
||||
1.0, -1.0, ctr->l, ctr->l, CTR_CSND_AUDIO_SIZE);
|
||||
|
||||
csndPlaySound_custom(0x9, SOUND_LOOPMODE(CSND_LOOPMODE_NORMAL)| SOUND_FORMAT(CSND_ENCODING_PCM16),
|
||||
1.0, 1.0, ctr->r, ctr->r, CTR_CSND_AUDIO_SIZE);
|
||||
|
||||
csndExecCmds(true);
|
||||
ctr->playpos = 0;
|
||||
ctr->cpu_ticks_last = svcGetSystemTick();
|
||||
ctr->playing = true;
|
||||
|
||||
return ctr;
|
||||
}
|
||||
|
||||
static void ctr_csnd_audio_free(void *data)
|
||||
{
|
||||
ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data;
|
||||
|
||||
// csndExit();
|
||||
CSND_SetPlayState(0x8, 0);
|
||||
CSND_SetPlayState(0x9, 0);
|
||||
csndExecCmds(false);
|
||||
|
||||
linearFree(ctr->l);
|
||||
linearFree(ctr->r);
|
||||
|
||||
free(ctr);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
(void)data;
|
||||
(void)buf;
|
||||
(void)samples_played;
|
||||
(void)current_tick;
|
||||
|
||||
rarch_perf_init(&ctraudio_f, "ctraudio_f");
|
||||
retro_perf_start(&ctraudio_f);
|
||||
|
||||
ctr_csnd_audio_update_playpos(ctr);
|
||||
|
||||
if((((ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 2)) ||
|
||||
(((ctr->pos - ctr->playpos ) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 4)) ||
|
||||
(((ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK) < (size >> 2)))
|
||||
{
|
||||
if (ctr->nonblocking)
|
||||
ctr->pos = (ctr->playpos + (CTR_CSND_AUDIO_COUNT >> 1)) & CTR_CSND_AUDIO_COUNT_MASK;
|
||||
else
|
||||
{
|
||||
do{
|
||||
/* todo: compute the correct sleep period */
|
||||
retro_sleep(1);
|
||||
ctr_csnd_audio_update_playpos(ctr);
|
||||
}while (((ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 1)
|
||||
|| (((ctr->pos - ctr->playpos) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 4)));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < (size >> 1); i += 2)
|
||||
{
|
||||
ctr->l[ctr->pos] = src[i];
|
||||
ctr->r[ctr->pos] = src[i + 1];
|
||||
ctr->pos++;
|
||||
ctr->pos &= CTR_CSND_AUDIO_COUNT_MASK;
|
||||
}
|
||||
|
||||
GSPGPU_FlushDataCache(ctr->l, CTR_CSND_AUDIO_SIZE);
|
||||
GSPGPU_FlushDataCache(ctr->r, CTR_CSND_AUDIO_SIZE);
|
||||
|
||||
retro_perf_stop(&ctraudio_f);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static bool ctr_csnd_audio_stop(void *data)
|
||||
{
|
||||
ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data;
|
||||
|
||||
/* using SetPlayState would make tracking the playback
|
||||
* position more difficult */
|
||||
|
||||
#if 0
|
||||
CSND_SetPlayState(0x8, 0);
|
||||
CSND_SetPlayState(0x9, 0);
|
||||
#endif
|
||||
|
||||
/* setting the channel volume to 0 seems to make it
|
||||
* impossible to set it back to full volume later */
|
||||
|
||||
CSND_SetVol(0x8, 0x00000001, 0);
|
||||
CSND_SetVol(0x9, 0x00010000, 0);
|
||||
csndExecCmds(false);
|
||||
|
||||
ctr->playing = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ctr_csnd_audio_alive(void *data)
|
||||
{
|
||||
ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data;
|
||||
return ctr->playing;
|
||||
}
|
||||
|
||||
static bool ctr_csnd_audio_start(void *data)
|
||||
{
|
||||
ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data;
|
||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||
|
||||
/* Prevents restarting audio when the menu
|
||||
* is toggled off on shutdown */
|
||||
|
||||
if (system->shutdown)
|
||||
return true;
|
||||
|
||||
#if 0
|
||||
CSND_SetPlayState(0x8, 1);
|
||||
CSND_SetPlayState(0x9, 1);
|
||||
#endif
|
||||
|
||||
CSND_SetVol(0x8, 0x00008000, 0);
|
||||
CSND_SetVol(0x9, 0x80000000, 0);
|
||||
|
||||
csndExecCmds(false);
|
||||
|
||||
ctr->playing = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void ctr_csnd_audio_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data;
|
||||
if (ctr)
|
||||
ctr->nonblocking = state;
|
||||
}
|
||||
|
||||
static bool ctr_csnd_audio_use_float(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return false;
|
||||
}
|
||||
|
||||
static size_t ctr_csnd_audio_write_avail(void *data)
|
||||
{
|
||||
ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data;
|
||||
|
||||
ctr_csnd_audio_update_playpos(ctr);
|
||||
return (ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK;
|
||||
}
|
||||
|
||||
static size_t ctr_csnd_audio_buffer_size(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return CTR_CSND_AUDIO_COUNT;
|
||||
}
|
||||
|
||||
|
||||
audio_driver_t audio_ctr_csnd = {
|
||||
ctr_csnd_audio_init,
|
||||
ctr_csnd_audio_write,
|
||||
ctr_csnd_audio_stop,
|
||||
ctr_csnd_audio_start,
|
||||
ctr_csnd_audio_alive,
|
||||
ctr_csnd_audio_set_nonblock_state,
|
||||
ctr_csnd_audio_free,
|
||||
ctr_csnd_audio_use_float,
|
||||
"csnd",
|
||||
ctr_csnd_audio_write_avail,
|
||||
ctr_csnd_audio_buffer_size
|
||||
};
|
281
audio/drivers/ctr_dsp_audio.c
Normal file
281
audio/drivers/ctr_dsp_audio.c
Normal file
@ -0,0 +1,281 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2014-2015 - Ali Bouhlel
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* 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 <3ds.h>
|
||||
#include "../../general.h"
|
||||
#include "../../driver.h"
|
||||
#include "../../performance.h"
|
||||
|
||||
|
||||
#define CTR_DSP_BUFFERS_COUNT (1u << 4u)
|
||||
#define CTR_DSP_BUFFERS_MASK (CTR_DSP_BUFFERS_COUNT - 1)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool nonblocking;
|
||||
bool playing;
|
||||
|
||||
int channel;
|
||||
ndspWaveBuf dsp_buf[CTR_DSP_BUFFERS_COUNT];
|
||||
uint32_t dsp_buf_id;
|
||||
uint8_t* linear_buffer;
|
||||
|
||||
} ctr_dsp_audio_t;
|
||||
|
||||
#define CTR_DSP_AUDIO_COUNT (1u << 11u)
|
||||
#define CTR_DSP_AUDIO_COUNT_MASK (CTR_DSP_AUDIO_COUNT - 1u)
|
||||
#define CTR_DSP_AUDIO_SIZE (CTR_DSP_AUDIO_COUNT * sizeof(int16_t) * 2)
|
||||
#define CTR_DSP_AUDIO_SIZE_MASK (CTR_DSP_AUDIO_SIZE - 1u)
|
||||
|
||||
|
||||
#ifndef DEBUG_HOLD
|
||||
void wait_for_input(void);
|
||||
#define PRINTFPOS(X,Y) "\x1b["#X";"#Y"H"
|
||||
#define DEBUG_HOLD() do{printf("%s@%s:%d.\n",__FUNCTION__, __FILE__, __LINE__);fflush(stdout);wait_for_input();}while(0)
|
||||
#define DEBUG_VAR(X) printf( "%-20s: 0x%08X\n", #X, (u32)(X))
|
||||
#define DEBUG_VAR64(X) printf( #X"\r\t\t\t\t : 0x%016llX\n", (u64)(X))
|
||||
#endif
|
||||
|
||||
|
||||
static uint32_t ctr_get_queued_samples(ctr_dsp_audio_t* ctr)
|
||||
{
|
||||
uint32_t sample_pos, sample_count;
|
||||
uint16_t buf_seq;
|
||||
|
||||
buf_seq = ndspChnGetWaveBufSeq(ctr->channel);
|
||||
|
||||
if(!buf_seq)
|
||||
return 0;
|
||||
|
||||
sample_pos = ndspChnGetSamplePos(ctr->channel);
|
||||
sample_count = 0;
|
||||
|
||||
int buf_id = ctr->dsp_buf_id;
|
||||
do
|
||||
{
|
||||
buf_id++;
|
||||
buf_id&= CTR_DSP_BUFFERS_MASK;
|
||||
}
|
||||
while(ctr->dsp_buf[buf_id].sequence_id != buf_seq);
|
||||
ndspWaveBuf* current = &ctr->dsp_buf[buf_id];
|
||||
|
||||
sample_count = current->nsamples - sample_pos;
|
||||
while((current = current->next))
|
||||
{
|
||||
sample_count += current->nsamples;
|
||||
}
|
||||
return sample_count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void *ctr_dsp_audio_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
ctr_dsp_audio_t *ctr;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)device;
|
||||
(void)rate;
|
||||
(void)latency;
|
||||
|
||||
if (ndspInit() < 0)
|
||||
return NULL;
|
||||
|
||||
ctr = (ctr_dsp_audio_t*)calloc(1, sizeof(ctr_dsp_audio_t));
|
||||
|
||||
if (!ctr)
|
||||
return NULL;
|
||||
|
||||
// memset(ctr, 0, sizeof(*ctr));
|
||||
|
||||
settings->audio.out_rate = 32730;
|
||||
|
||||
ctr->channel = 0;
|
||||
ctr->dsp_buf_id = 0;
|
||||
|
||||
ndspSetOutputMode(NDSP_OUTPUT_STEREO);
|
||||
ndspSetClippingMode(NDSP_CLIP_SOFT); //??
|
||||
// ndspSetClippingMode(NDSP_CLIP_NORMAL); //??
|
||||
ndspSetOutputCount(CTR_DSP_BUFFERS_COUNT);
|
||||
ndspChnReset(ctr->channel);
|
||||
// ndspChnInitParams(ctr->channel);
|
||||
ndspChnSetFormat(ctr->channel, NDSP_FORMAT_STEREO_PCM16);
|
||||
ndspChnSetInterp(ctr->channel, NDSP_INTERP_NONE);
|
||||
// ndspChnSetInterp(ctr->channel, NDSP_INTERP_LINEAR);
|
||||
// ndspChnSetInterp(ctr->channel, NDSP_INTERP_POLYPHASE);
|
||||
ndspChnSetRate(ctr->channel, 32728.0f);
|
||||
// ndspChnSetRate(ctr->channel, CTR_DSP_AUDIO_RATE);
|
||||
// ndspChnSetRate(ctr->channel, 0x7F00);
|
||||
// ndspChnSetMix(ctr->channel, (float[12]){1.0, 1.0, 0.0});
|
||||
ndspChnWaveBufClear(ctr->channel);
|
||||
|
||||
ctr->linear_buffer = linearAlloc(CTR_DSP_BUFFERS_COUNT * CTR_DSP_AUDIO_SIZE);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < CTR_DSP_BUFFERS_COUNT; i++)
|
||||
ctr->dsp_buf[i].data_pcm16 = (uint16_t*)(ctr->linear_buffer + i * CTR_DSP_AUDIO_SIZE);
|
||||
|
||||
return ctr;
|
||||
}
|
||||
|
||||
static void ctr_dsp_audio_free(void *data)
|
||||
{
|
||||
ctr_dsp_audio_t* ctr = (ctr_dsp_audio_t*)data;
|
||||
|
||||
linearFree(ctr->linear_buffer);
|
||||
free(ctr);
|
||||
ndspExit();
|
||||
}
|
||||
|
||||
static ssize_t ctr_dsp_audio_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
static struct retro_perf_counter ctraudio_dsp_f = {0};
|
||||
ctr_dsp_audio_t* ctr = (ctr_dsp_audio_t*)data;
|
||||
|
||||
ndspWaveBuf* current_buf = &ctr->dsp_buf[ctr->dsp_buf_id];
|
||||
static int dropped=0;
|
||||
uint32_t queued = ctr_get_queued_samples(ctr);
|
||||
|
||||
if(size > CTR_DSP_AUDIO_SIZE)
|
||||
{
|
||||
DEBUG_VAR(size);
|
||||
ctr_dsp_audio_write(ctr, buf, CTR_DSP_AUDIO_SIZE);
|
||||
buf = (const void*)((u32)buf + CTR_DSP_AUDIO_SIZE);
|
||||
size = size - CTR_DSP_AUDIO_SIZE;
|
||||
}
|
||||
|
||||
dropped++;
|
||||
if(ctr->nonblocking)
|
||||
{
|
||||
if((current_buf->status == NDSP_WBUF_QUEUED) || (current_buf->status == NDSP_WBUF_PLAYING))
|
||||
return size;
|
||||
|
||||
if((queued + (size>>2)) > 0x2000)
|
||||
return size;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(queued > (0x1000 + (size>>2)))
|
||||
{
|
||||
// printf(PRINTFPOS(24,0)"queued :0x%08X \n", ctr_get_queued_samples(ctr));
|
||||
while(ctr_get_queued_samples(ctr) > 160 )
|
||||
svcSleepThread(100000);
|
||||
}
|
||||
}
|
||||
dropped--;
|
||||
|
||||
|
||||
rarch_perf_init(&ctraudio_dsp_f, "ctraudio_dsp_f");
|
||||
retro_perf_start(&ctraudio_dsp_f);
|
||||
|
||||
memcpy(current_buf->data_pcm16, buf, size);
|
||||
current_buf->nsamples = size>>2;
|
||||
|
||||
DSP_FlushDataCache(current_buf->data_pcm16, size);
|
||||
DSP_FlushDataCache(ctr->dsp_buf, sizeof(ctr->dsp_buf));
|
||||
gfxFlushBuffers();
|
||||
|
||||
ndspChnWaveBufAdd(ctr->channel, current_buf);
|
||||
retro_perf_stop(&ctraudio_dsp_f);
|
||||
|
||||
// printf(PRINTFPOS(25,0)"dropped:0x%08X queued :0x%08X \n", dropped, queued);
|
||||
// printf(PRINTFPOS(26,0)"current:0x%08X nsamples:0x%08X \n", ctr->dsp_buf_id, current_buf->nsamples);
|
||||
// printf(PRINTFPOS(27,0)"dropped:0x%08X count :0x%08X \n", ndspGetDroppedFrames(), ndspGetFrameCount());
|
||||
// printf(PRINTFPOS(28,0)"Pos :0x%08X Seq :0x%08X \n", ndspChnGetSamplePos(ctr->channel), ndspChnGetWaveBufSeq(ctr->channel));
|
||||
|
||||
ctr->dsp_buf_id++;
|
||||
ctr->dsp_buf_id &= CTR_DSP_BUFFERS_MASK;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static bool ctr_dsp_audio_stop(void *data)
|
||||
{
|
||||
ctr_dsp_audio_t* ctr = (ctr_dsp_audio_t*)data;
|
||||
|
||||
ndspChnWaveBufClear(ctr->channel);
|
||||
ctr->playing = false;
|
||||
int i;
|
||||
memset(ctr->dsp_buf, 0, sizeof(ctr->dsp_buf));
|
||||
for (i = 0; i < CTR_DSP_BUFFERS_COUNT; i++)
|
||||
ctr->dsp_buf[i].data_pcm16 = (uint16_t*)(ctr->linear_buffer + i * CTR_DSP_AUDIO_SIZE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ctr_dsp_audio_alive(void *data)
|
||||
{
|
||||
ctr_dsp_audio_t* ctr = (ctr_dsp_audio_t*)data;
|
||||
return ctr->playing;
|
||||
}
|
||||
|
||||
static bool ctr_dsp_audio_start(void *data)
|
||||
{
|
||||
ctr_dsp_audio_t* ctr = (ctr_dsp_audio_t*)data;
|
||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||
|
||||
/* Prevents restarting audio when the menu
|
||||
* is toggled off on shutdown */
|
||||
|
||||
if (system->shutdown)
|
||||
return true;
|
||||
|
||||
ctr->playing = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void ctr_dsp_audio_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
ctr_dsp_audio_t* ctr = (ctr_dsp_audio_t*)data;
|
||||
if (ctr)
|
||||
ctr->nonblocking = state;
|
||||
}
|
||||
|
||||
static bool ctr_dsp_audio_use_float(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return false;
|
||||
}
|
||||
|
||||
static size_t ctr_dsp_audio_write_avail(void *data)
|
||||
{
|
||||
ctr_dsp_audio_t* ctr = (ctr_dsp_audio_t*)data;
|
||||
uint32_t queued_samples = ctr_get_queued_samples(ctr);
|
||||
|
||||
return queued_samples < 0x1000 ? 0x1000 - queued_samples : 0;
|
||||
}
|
||||
|
||||
static size_t ctr_dsp_audio_buffer_size(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return 0x1000;
|
||||
}
|
||||
|
||||
|
||||
audio_driver_t audio_ctr_dsp = {
|
||||
ctr_dsp_audio_init,
|
||||
ctr_dsp_audio_write,
|
||||
ctr_dsp_audio_stop,
|
||||
ctr_dsp_audio_start,
|
||||
ctr_dsp_audio_alive,
|
||||
ctr_dsp_audio_set_nonblock_state,
|
||||
ctr_dsp_audio_free,
|
||||
ctr_dsp_audio_use_float,
|
||||
"dsp",
|
||||
ctr_dsp_audio_write_avail,
|
||||
ctr_dsp_audio_buffer_size
|
||||
};
|
||||
|
@ -14,14 +14,28 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER) && !defined(_XBOX)
|
||||
#pragma comment(lib, "dsound")
|
||||
#pragma comment(lib, "dxguid")
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef _XBOX
|
||||
#include <windows.h>
|
||||
#include <mmreg.h>
|
||||
#include <mmsystem.h>
|
||||
#endif
|
||||
|
||||
#include <dsound.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include <retro_inline.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
|
||||
#ifdef _XBOX
|
||||
#define DSERR_BUFFERLOST MAKE_DSHRESULT(150)
|
||||
@ -29,21 +43,11 @@
|
||||
#define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT(70)
|
||||
#endif
|
||||
|
||||
#include "../../driver.h"
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef _XBOX
|
||||
// Need these includes in MinGW-w64 4.9 it seems ...
|
||||
#include <mmreg.h>
|
||||
#include <mmsystem.h>
|
||||
#if defined(_MSC_VER) && !defined(_XBOX)
|
||||
#pragma comment(lib, "dsound")
|
||||
#pragma comment(lib, "dxguid")
|
||||
#endif
|
||||
#include <dsound.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include "../../general.h"
|
||||
|
||||
|
||||
typedef struct dsound
|
||||
{
|
||||
@ -83,7 +87,7 @@ struct audio_lock
|
||||
DWORD size2;
|
||||
};
|
||||
|
||||
static INLINE bool grab_region(dsound_t *ds, DWORD write_ptr,
|
||||
static INLINE bool grab_region(dsound_t *ds, uint32_t write_ptr,
|
||||
struct audio_lock *region)
|
||||
{
|
||||
const char *err;
|
||||
@ -118,16 +122,11 @@ static INLINE bool grab_region(dsound_t *ds, DWORD write_ptr,
|
||||
break;
|
||||
|
||||
default:
|
||||
err = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (err)
|
||||
{
|
||||
RARCH_WARN("[DirectSound error]: %s\n", err);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
RARCH_WARN("[DirectSound error]: %s\n", err);
|
||||
return false;
|
||||
}
|
||||
|
||||
static INLINE void release_region(dsound_t *ds, const struct audio_lock *region)
|
||||
@ -167,7 +166,7 @@ static void dsound_thread(void *data)
|
||||
* but it is not guaranteed to work, so use high
|
||||
* priority sleeping patterns.
|
||||
*/
|
||||
rarch_sleep(1);
|
||||
retro_sleep(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -14,12 +14,8 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../../driver.h"
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
#include "../../general.h"
|
||||
#include <string.h>
|
||||
#include <retro_inline.h>
|
||||
|
||||
#ifdef GEKKO
|
||||
#include <gccore.h>
|
||||
@ -28,7 +24,12 @@
|
||||
#include <cafe/ai.h>
|
||||
#endif
|
||||
|
||||
#include "../../gfx/drivers/gx_sdk_defines.h"
|
||||
#include <boolean.h>
|
||||
#include <retro_inline.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
#include "../../defines/gx_defines.h"
|
||||
|
||||
#define CHUNK_FRAMES 64
|
||||
#define CHUNK_SIZE (CHUNK_FRAMES * sizeof(uint32_t))
|
||||
|
@ -13,20 +13,22 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "../../driver.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "../../general.h"
|
||||
#include <string.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <jack/jack.h>
|
||||
#include <jack/types.h>
|
||||
#include <jack/ringbuffer.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
|
||||
#define FRAMES(x) (x / (sizeof(float) * 2))
|
||||
|
||||
typedef struct jack
|
||||
|
@ -13,8 +13,8 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenAL/al.h>
|
||||
@ -24,13 +24,13 @@
|
||||
#include <AL/alc.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
|
||||
#define BUFSIZE 1024
|
||||
|
||||
typedef struct al
|
||||
@ -151,7 +151,7 @@ static bool al_get_buffer(al_t *al, ALuint *buffer)
|
||||
return false;
|
||||
|
||||
/* Must sleep as there is no proper blocking method. */
|
||||
rarch_sleep(1);
|
||||
retro_sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,15 +14,16 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include <SLES/OpenSLES.h>
|
||||
#ifdef ANDROID
|
||||
#include <SLES/OpenSLES_Android.h>
|
||||
#endif
|
||||
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
|
||||
/* Helper macros, COM-style. */
|
||||
#define SLObjectItf_Realize(a, ...) ((*(a))->Realize(a, __VA_ARGS__))
|
||||
#define SLObjectItf_GetInterface(a, ...) ((*(a))->GetInterface(a, __VA_ARGS__))
|
||||
|
@ -12,14 +12,12 @@
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_OSS_BSD
|
||||
#include <soundcard.h>
|
||||
@ -27,11 +25,14 @@
|
||||
#include <sys/soundcard.h>
|
||||
#endif
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <retro_endianness.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
|
||||
#ifdef HAVE_OSS_BSD
|
||||
#define DEFAULT_OSS_DEV "/dev/audio"
|
||||
|
@ -14,14 +14,15 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../general.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#include "../ps3/sdk_defines.h"
|
||||
#include "../driver.h"
|
||||
#include "../general.h"
|
||||
|
||||
#include "../../defines/ps3_defines.h"
|
||||
|
||||
#define AUDIO_BLOCKS 8
|
||||
#define AUDIO_CHANNELS 2
|
||||
|
@ -15,14 +15,23 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#ifdef VITA
|
||||
#include <psp2/kernel/processmgr.h>
|
||||
#include <psp2/kernel/threadmgr.h>
|
||||
#include <psp2/kernel/sysmem.h>
|
||||
#include <psp2/audioout.h>
|
||||
#else
|
||||
#include <pspkernel.h>
|
||||
#include <pspaudio.h>
|
||||
#endif
|
||||
|
||||
#include "../../general.h"
|
||||
#include "../../driver.h"
|
||||
|
||||
#include <pspkernel.h>
|
||||
#include <pspaudio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct psp1_audio
|
||||
typedef struct psp_audio
|
||||
{
|
||||
bool nonblocking;
|
||||
uint32_t* buffer;
|
||||
@ -33,37 +42,58 @@ typedef struct psp1_audio
|
||||
volatile bool running;
|
||||
volatile uint16_t readPos;
|
||||
volatile uint16_t writePos;
|
||||
} psp1_audio_t;
|
||||
} psp_audio_t;
|
||||
|
||||
#define AUDIO_OUT_COUNT 512u
|
||||
#define AUDIO_BUFFER_SIZE (1u<<13u)
|
||||
#define AUDIO_BUFFER_SIZE_MASK (AUDIO_BUFFER_SIZE-1)
|
||||
|
||||
#ifdef VITA
|
||||
#define PSP_THREAD_STOPPED PSP2_THREAD_STOPPED
|
||||
#else
|
||||
#define SceKernelThreadInfo SceKernelThreadRunStatus
|
||||
#define sceKernelGetThreadInfo sceKernelReferThreadRunStatus
|
||||
#endif
|
||||
|
||||
static int audioMainLoop(SceSize args, void* argp)
|
||||
{
|
||||
psp1_audio_t* psp = *((psp1_audio_t**)argp);
|
||||
psp_audio_t* psp = *((psp_audio_t**)argp);
|
||||
|
||||
#ifdef VITA
|
||||
int port = sceAudioOutOpenPort(PSP2_AUDIO_OUT_PORT_TYPE_MAIN, AUDIO_OUT_COUNT,
|
||||
psp->rate, PSP2_AUDIO_OUT_MODE_STEREO);
|
||||
#else
|
||||
sceAudioSRCChReserve(AUDIO_OUT_COUNT, psp->rate, 2);
|
||||
#endif
|
||||
|
||||
while (psp->running)
|
||||
{
|
||||
/* Get a non-volatile copy. */
|
||||
uint16_t readPos = psp->readPos;
|
||||
bool cond = ((uint16_t)(psp->writePos - readPos) & AUDIO_BUFFER_SIZE_MASK)
|
||||
< (AUDIO_OUT_COUNT * 2);
|
||||
|
||||
if (((uint16_t)(psp->writePos - readPos) & AUDIO_BUFFER_SIZE_MASK)
|
||||
< (AUDIO_OUT_COUNT * 2))
|
||||
sceAudioSRCOutputBlocking(PSP_AUDIO_VOLUME_MAX, psp->zeroBuffer);
|
||||
else
|
||||
#ifdef VITA
|
||||
sceAudioOutOutput(port,
|
||||
cond ? psp->zeroBuffer : (psp->buffer + readPos));
|
||||
#else
|
||||
sceAudioSRCOutputBlocking(PSP_AUDIO_VOLUME_MAX, cond ? (psp->zeroBuffer)
|
||||
: (psp->buffer + readPos));
|
||||
#endif
|
||||
|
||||
if (!cond)
|
||||
{
|
||||
sceAudioSRCOutputBlocking(PSP_AUDIO_VOLUME_MAX,
|
||||
psp->buffer + readPos);
|
||||
readPos += AUDIO_OUT_COUNT;
|
||||
readPos &= AUDIO_BUFFER_SIZE_MASK;
|
||||
psp->readPos = readPos;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VITA
|
||||
sceAudioOutReleasePort(port);
|
||||
#else
|
||||
sceAudioSRCChRelease();
|
||||
#endif
|
||||
sceKernelExitThread(0);
|
||||
return 0;
|
||||
}
|
||||
@ -71,7 +101,7 @@ static int audioMainLoop(SceSize args, void* argp)
|
||||
static void *psp_audio_init(const char *device,
|
||||
unsigned rate, unsigned latency)
|
||||
{
|
||||
psp1_audio_t *psp = (psp1_audio_t*)calloc(1, sizeof(psp1_audio_t));
|
||||
psp_audio_t *psp = (psp_audio_t*)calloc(1, sizeof(psp_audio_t));
|
||||
|
||||
if (!psp)
|
||||
return NULL;
|
||||
@ -91,12 +121,17 @@ static void *psp_audio_init(const char *device,
|
||||
psp->readPos = 0;
|
||||
psp->writePos = 0;
|
||||
psp->rate = rate;
|
||||
#if defined(VITA)
|
||||
psp->thread = sceKernelCreateThread
|
||||
("audioMainLoop", audioMainLoop, 0x10000100, 0x10000, 0, 0, NULL);
|
||||
#else
|
||||
psp->thread = sceKernelCreateThread
|
||||
("audioMainLoop", audioMainLoop, 0x08, 0x10000, 0, NULL);
|
||||
#endif
|
||||
psp->nonblocking = false;
|
||||
|
||||
psp->running = true;
|
||||
sceKernelStartThread(psp->thread, sizeof(psp1_audio_t*), &psp);
|
||||
sceKernelStartThread(psp->thread, sizeof(psp_audio_t*), &psp);
|
||||
|
||||
return psp;
|
||||
}
|
||||
@ -104,13 +139,16 @@ static void *psp_audio_init(const char *device,
|
||||
static void psp_audio_free(void *data)
|
||||
{
|
||||
SceUInt timeout = 100000;
|
||||
psp1_audio_t* psp = (psp1_audio_t*)data;
|
||||
psp_audio_t* psp = (psp_audio_t*)data;
|
||||
if(!psp)
|
||||
return;
|
||||
|
||||
psp->running = false;
|
||||
|
||||
#if defined(VITA)
|
||||
sceKernelWaitThreadEnd(psp->thread, NULL, &timeout);
|
||||
#else
|
||||
sceKernelWaitThreadEnd(psp->thread, &timeout);
|
||||
#endif
|
||||
sceKernelDeleteThread(psp->thread);
|
||||
|
||||
free(psp->buffer);
|
||||
@ -121,7 +159,7 @@ static void psp_audio_free(void *data)
|
||||
static ssize_t psp_audio_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
uint16_t sampleCount;
|
||||
psp1_audio_t* psp = (psp1_audio_t*)data;
|
||||
psp_audio_t* psp = (psp_audio_t*)data;
|
||||
uint16_t writePos = psp->writePos;
|
||||
|
||||
sampleCount= size / sizeof(uint32_t);
|
||||
@ -153,55 +191,62 @@ static ssize_t psp_audio_write(void *data, const void *buf, size_t size)
|
||||
|
||||
static bool psp_audio_alive(void *data)
|
||||
{
|
||||
psp1_audio_t* psp = (psp1_audio_t*)data;
|
||||
psp_audio_t* psp = (psp_audio_t*)data;
|
||||
if (!psp)
|
||||
return false;
|
||||
return psp->running;
|
||||
}
|
||||
|
||||
|
||||
static bool psp_audio_stop(void *data)
|
||||
{
|
||||
SceKernelThreadRunStatus runStatus;
|
||||
SceKernelThreadInfo info;
|
||||
SceUInt timeout = 100000;
|
||||
psp1_audio_t* psp = (psp1_audio_t*)data;
|
||||
psp_audio_t* psp = (psp_audio_t*)data;
|
||||
|
||||
runStatus.size = sizeof(SceKernelThreadRunStatus);
|
||||
info.size = sizeof(SceKernelThreadInfo);
|
||||
|
||||
if (sceKernelReferThreadRunStatus(
|
||||
psp->thread, &runStatus) < 0) /* Error */
|
||||
if (sceKernelGetThreadInfo(
|
||||
psp->thread, &info) < 0) /* Error */
|
||||
return false;
|
||||
if (runStatus.status == PSP_THREAD_STOPPED)
|
||||
|
||||
if (info.status == PSP_THREAD_STOPPED)
|
||||
return false;
|
||||
|
||||
psp->running = false;
|
||||
#if defined(VITA)
|
||||
sceKernelWaitThreadEnd(psp->thread, NULL, &timeout);
|
||||
#else
|
||||
sceKernelWaitThreadEnd(psp->thread, &timeout);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool psp_audio_start(void *data)
|
||||
{
|
||||
SceKernelThreadRunStatus runStatus;
|
||||
psp1_audio_t* psp = (psp1_audio_t*)data;
|
||||
SceKernelThreadInfo info;
|
||||
psp_audio_t* psp = (psp_audio_t*)data;
|
||||
|
||||
runStatus.size = sizeof(SceKernelThreadRunStatus);
|
||||
info.size = sizeof(SceKernelThreadInfo);
|
||||
|
||||
if (sceKernelReferThreadRunStatus(
|
||||
psp->thread, &runStatus) < 0) /* Error */
|
||||
if (sceKernelGetThreadInfo(
|
||||
psp->thread, &info) < 0) /* Error */
|
||||
return false;
|
||||
if (runStatus.status != PSP_THREAD_STOPPED)
|
||||
|
||||
if (info.status != PSP_THREAD_STOPPED)
|
||||
return false;
|
||||
|
||||
psp->running = true;
|
||||
|
||||
sceKernelStartThread(psp->thread, sizeof(psp1_audio_t*), &psp);
|
||||
sceKernelStartThread(psp->thread, sizeof(psp_audio_t*), &psp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void psp_audio_set_nonblock_state(void *data, bool toggle)
|
||||
{
|
||||
psp1_audio_t* psp = (psp1_audio_t*)data;
|
||||
psp_audio_t* psp = (psp_audio_t*)data;
|
||||
if (psp)
|
||||
psp->nonblocking = toggle;
|
||||
}
|
||||
@ -215,7 +260,7 @@ static bool psp_audio_use_float(void *data)
|
||||
static size_t psp_write_avail(void *data)
|
||||
{
|
||||
/* TODO */
|
||||
psp1_audio_t* psp = (psp1_audio_t*)data;
|
||||
psp_audio_t* psp = (psp_audio_t*)data;
|
||||
return AUDIO_BUFFER_SIZE - ((uint16_t)
|
||||
(psp->writePos - psp->readPos) & AUDIO_BUFFER_SIZE_MASK);
|
||||
}
|
||||
@ -227,7 +272,7 @@ static size_t psp_buffer_size(void *data)
|
||||
}
|
||||
|
||||
|
||||
audio_driver_t audio_psp1 = {
|
||||
audio_driver_t audio_psp = {
|
||||
psp_audio_init,
|
||||
psp_audio_write,
|
||||
psp_audio_stop,
|
||||
@ -236,7 +281,11 @@ audio_driver_t audio_psp1 = {
|
||||
psp_audio_set_nonblock_state,
|
||||
psp_audio_free,
|
||||
psp_audio_use_float,
|
||||
"psp1",
|
||||
#ifdef VITA
|
||||
"vita",
|
||||
#else
|
||||
"psp",
|
||||
#endif
|
||||
psp_write_avail,
|
||||
psp_buffer_size,
|
||||
};
|
@ -13,13 +13,16 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <pulse/pulseaudio.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <retro_endianness.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
#include <pulse/pulseaudio.h>
|
||||
#include <boolean.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -13,13 +13,16 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <roaraudio.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include <stdlib.h>
|
||||
#include <roaraudio.h>
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
#include "../../general.h"
|
||||
|
||||
typedef struct
|
||||
@ -55,7 +58,6 @@ static void *ra_init(const char *device, unsigned rate, unsigned latency)
|
||||
static ssize_t ra_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
int err;
|
||||
ssize_t rc;
|
||||
size_t written = 0;
|
||||
roar_t *roar = (roar_t*)data;
|
||||
|
||||
@ -64,6 +66,7 @@ static ssize_t ra_write(void *data, const void *buf, size_t size)
|
||||
|
||||
while (written < size)
|
||||
{
|
||||
ssize_t rc;
|
||||
size_t write_amt = size - written;
|
||||
|
||||
if ((rc = roar_vs_write(roar->vss, (const char*)buf + written, write_amt, &err)) < (ssize_t)write_amt)
|
||||
@ -120,7 +123,6 @@ static void ra_free(void *data)
|
||||
|
||||
static bool ra_use_float(void *data)
|
||||
{
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -13,13 +13,15 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include <stdlib.h>
|
||||
#include "rsound.h"
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <boolean.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
typedef struct rsd
|
||||
{
|
||||
|
@ -13,22 +13,22 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "../../driver.h"
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_audio.h"
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../../general.h"
|
||||
#include <boolean.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <retro_inline.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
|
||||
typedef struct sdl_audio
|
||||
{
|
||||
bool nonblock;
|
||||
|
@ -14,14 +14,17 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../../driver.h"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <compat/msvc.h>
|
||||
#include <boolean.h>
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
|
||||
#include <compat/msvc.h>
|
||||
|
||||
#include "xaudio.h"
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
|
||||
typedef struct xaudio2 xaudio2_t;
|
||||
@ -56,7 +59,7 @@ struct xaudio2 : public IXAudio2VoiceCallback
|
||||
STDMETHOD_(void, OnBufferStart) (void *) {}
|
||||
STDMETHOD_(void, OnBufferEnd) (void *)
|
||||
{
|
||||
InterlockedDecrement(&buffers);
|
||||
InterlockedDecrement((LONG volatile*)&buffers);
|
||||
SetEvent(hEvent);
|
||||
}
|
||||
STDMETHOD_(void, OnLoopEnd) (void *) {}
|
||||
@ -71,7 +74,7 @@ struct xaudio2 : public IXAudio2VoiceCallback
|
||||
IXAudio2SourceVoice *pSourceVoice;
|
||||
HANDLE hEvent;
|
||||
|
||||
volatile long buffers;
|
||||
unsigned long volatile buffers;
|
||||
unsigned bufsize;
|
||||
unsigned bufptr;
|
||||
unsigned write_buffer;
|
||||
@ -216,7 +219,7 @@ static size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_)
|
||||
if (FAILED(handle->pSourceVoice->SubmitSourceBuffer(&xa2buffer, NULL)))
|
||||
return 0;
|
||||
|
||||
InterlockedIncrement(&handle->buffers);
|
||||
InterlockedIncrement((LONG volatile*)&handle->buffers);
|
||||
handle->bufptr = 0;
|
||||
handle->write_buffer = (handle->write_buffer + 1) & MAX_BUFFERS_MASK;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
#define X2DEFAULT(x) = (x)
|
||||
|
||||
#ifdef _XBOX
|
||||
#include <xtl.h>
|
||||
|
||||
#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)
|
||||
|
@ -14,14 +14,16 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../../driver.h"
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
#include "../../general.h"
|
||||
#include <retro_inline.h>
|
||||
|
||||
#include <xenon_sound/sound.h>
|
||||
|
||||
#include <retro_inline.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
|
||||
#define SOUND_FREQUENCY 48000
|
||||
#define MAX_BUFFER 2048
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
/* Convoluted Cosine Resampler */
|
||||
|
||||
#include "../audio_resampler_driver.h"
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
@ -23,6 +22,9 @@
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
#include <retro_inline.h>
|
||||
#include <memalign.h>
|
||||
|
||||
#include "../audio_resampler_driver.h"
|
||||
|
||||
/* Since SSE and NEON don't provide support for trigonometric functions
|
||||
* we approximate those with polynoms
|
||||
@ -54,34 +56,6 @@ typedef struct rarch_CC_resampler
|
||||
void (*process)(void *re, struct resampler_data *data);
|
||||
} rarch_CC_resampler_t;
|
||||
|
||||
/* memalign() replacement functions
|
||||
* copied from sinc.c and changed signature so no conflict
|
||||
* happens when using griffin.c
|
||||
* these functions should probably be moved to a common header
|
||||
*/
|
||||
|
||||
static void *memalign_alloc__(size_t boundary, size_t size)
|
||||
{
|
||||
void **place;
|
||||
uintptr_t addr = 0;
|
||||
void *ptr = malloc(boundary + size + sizeof(uintptr_t));
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
|
||||
addr = ((uintptr_t)
|
||||
ptr + sizeof(uintptr_t) + boundary)
|
||||
& ~(boundary - 1);
|
||||
place = (void**)addr;
|
||||
place[-1] = ptr;
|
||||
|
||||
return (void*)addr;
|
||||
}
|
||||
|
||||
static void memalign_free__(void *ptr)
|
||||
{
|
||||
void **p = (void**)ptr;
|
||||
free(p[-1]);
|
||||
}
|
||||
|
||||
#ifdef _MIPS_ARCH_ALLEGREX
|
||||
static void resampler_CC_process(void *re_, struct resampler_data *data)
|
||||
@ -177,12 +151,6 @@ done:
|
||||
data->output_frames = outp - (audio_frame_float_t*)data->data_out;
|
||||
}
|
||||
|
||||
|
||||
static void resampler_CC_free(void *re_)
|
||||
{
|
||||
(void)re_;
|
||||
}
|
||||
|
||||
static void *resampler_CC_init(const struct resampler_config *config,
|
||||
double bandwidth_mod, resampler_simd_mask_t mask)
|
||||
{
|
||||
@ -206,25 +174,21 @@ static void *resampler_CC_init(const struct resampler_config *config,
|
||||
}
|
||||
#else
|
||||
|
||||
|
||||
#if defined(__SSE__)
|
||||
#define CC_RESAMPLER_IDENT "SSE"
|
||||
|
||||
static void resampler_CC_downsample(void *re_, struct resampler_data *data)
|
||||
{
|
||||
__m128 vec_previous, vec_current;
|
||||
float ratio, b;
|
||||
rarch_CC_resampler_t *re = (rarch_CC_resampler_t*)re_;
|
||||
|
||||
audio_frame_float_t *inp = (audio_frame_float_t*)data->data_in;
|
||||
audio_frame_float_t *inp_max = (audio_frame_float_t*)(inp + data->input_frames);
|
||||
audio_frame_float_t *outp = (audio_frame_float_t*)data->data_out;
|
||||
float ratio = 1.0 / data->ratio;
|
||||
float b = data->ratio; /* cutoff frequency. */
|
||||
|
||||
ratio = 1.0 / data->ratio;
|
||||
b = data->ratio; /* cutoff frequency. */
|
||||
|
||||
vec_previous = _mm_loadu_ps((float*)&re->buffer[0]);
|
||||
vec_current = _mm_loadu_ps((float*)&re->buffer[2]);
|
||||
__m128 vec_previous = _mm_loadu_ps((float*)&re->buffer[0]);
|
||||
__m128 vec_current = _mm_loadu_ps((float*)&re->buffer[2]);
|
||||
|
||||
while (inp != inp_max)
|
||||
{
|
||||
@ -527,27 +491,20 @@ static void resampler_CC_process(void *re_, struct resampler_data *data)
|
||||
re->process(re_, data);
|
||||
}
|
||||
|
||||
static void resampler_CC_free(void *re_)
|
||||
{
|
||||
rarch_CC_resampler_t *re = (rarch_CC_resampler_t*)re_;
|
||||
if (re)
|
||||
memalign_free__(re);
|
||||
}
|
||||
|
||||
static void *resampler_CC_init(const struct resampler_config *config,
|
||||
double bandwidth_mod, resampler_simd_mask_t mask)
|
||||
{
|
||||
int i;
|
||||
rarch_CC_resampler_t *re = (rarch_CC_resampler_t*)
|
||||
memalign_alloc__(32, sizeof(rarch_CC_resampler_t));
|
||||
memalign_alloc(32, sizeof(rarch_CC_resampler_t));
|
||||
|
||||
/* TODO: lookup if NEON support can be detected at
|
||||
* runtime and a funcptr set at runtime for either
|
||||
* C codepath or NEON codepath. This will help out
|
||||
* Android. */
|
||||
(void)mask;
|
||||
(void)config;
|
||||
|
||||
(void)config;
|
||||
if (!re)
|
||||
return NULL;
|
||||
|
||||
@ -574,6 +531,16 @@ static void *resampler_CC_init(const struct resampler_config *config,
|
||||
}
|
||||
#endif
|
||||
|
||||
static void resampler_CC_free(void *re_)
|
||||
{
|
||||
#ifndef _MIPS_ARCH_ALLEGREX
|
||||
rarch_CC_resampler_t *re = (rarch_CC_resampler_t*)re_;
|
||||
if (re)
|
||||
memalign_free(re);
|
||||
#endif
|
||||
(void)re_;
|
||||
}
|
||||
|
||||
rarch_resampler_t CC_resampler = {
|
||||
resampler_CC_init,
|
||||
resampler_CC_process,
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
/* Bog-standard windowed SINC implementation. */
|
||||
|
||||
#include "../audio_resampler_driver.h"
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
@ -24,7 +23,12 @@
|
||||
#ifdef __SSE__
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
|
||||
#include <retro_inline.h>
|
||||
#include <filters.h>
|
||||
#include <memalign.h>
|
||||
|
||||
#include "../audio_resampler_driver.h"
|
||||
|
||||
/* Rough SNR values for upsampling:
|
||||
* LOWEST: 40 dB
|
||||
@ -113,44 +117,10 @@ typedef struct rarch_sinc_resampler
|
||||
float *main_buffer;
|
||||
} rarch_sinc_resampler_t;
|
||||
|
||||
static INLINE double sinc(double val)
|
||||
{
|
||||
if (fabs(val) < 0.00001)
|
||||
return 1.0;
|
||||
return sin(val) / val;
|
||||
}
|
||||
|
||||
#if defined(SINC_WINDOW_LANCZOS)
|
||||
#define window_function(idx) (sinc(M_PI * (idx)))
|
||||
#define window_function(idx) (lanzcos_window_function(idx))
|
||||
#elif defined(SINC_WINDOW_KAISER)
|
||||
/* Modified Bessel function of first order.
|
||||
* Check Wiki for mathematical definition ... */
|
||||
static INLINE double besseli0(double x)
|
||||
{
|
||||
unsigned i;
|
||||
double sum = 0.0;
|
||||
double factorial = 1.0;
|
||||
double factorial_mult = 0.0;
|
||||
double x_pow = 1.0;
|
||||
double two_div_pow = 1.0;
|
||||
double x_sqr = x * x;
|
||||
|
||||
/* Approximate. This is an infinite sum.
|
||||
* Luckily, it converges rather fast. */
|
||||
for (i = 0; i < 18; i++)
|
||||
{
|
||||
sum += x_pow * two_div_pow / (factorial * factorial);
|
||||
|
||||
factorial_mult += 1.0;
|
||||
x_pow *= x_sqr;
|
||||
two_div_pow *= 0.25;
|
||||
factorial *= factorial_mult;
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
#define window_function(idx) (besseli0(SINC_WINDOW_KAISER_BETA * sqrt(1 - (idx) * (idx))))
|
||||
#define window_function(idx) (kaiser_window_function(idx, SINC_WINDOW_KAISER_BETA))
|
||||
#else
|
||||
#error "No SINC window function defined."
|
||||
#endif
|
||||
@ -158,7 +128,7 @@ static INLINE double besseli0(double x)
|
||||
static void init_sinc_table(rarch_sinc_resampler_t *resamp, double cutoff,
|
||||
float *phase_table, int phases, int taps, bool calculate_delta)
|
||||
{
|
||||
int i, j, p;
|
||||
int i, j;
|
||||
double window_mod = window_function(0.0); /* Need to normalize w(0) to 1.0. */
|
||||
int stride = calculate_delta ? 2 : 1;
|
||||
double sidelobes = taps / 2.0;
|
||||
@ -183,6 +153,7 @@ static void init_sinc_table(rarch_sinc_resampler_t *resamp, double cutoff,
|
||||
if (calculate_delta)
|
||||
{
|
||||
int phase;
|
||||
int p;
|
||||
|
||||
for (p = 0; p < phases - 1; p++)
|
||||
{
|
||||
@ -212,30 +183,6 @@ static void init_sinc_table(rarch_sinc_resampler_t *resamp, double cutoff,
|
||||
}
|
||||
}
|
||||
|
||||
/* No memalign() for us on Win32 ... */
|
||||
static void *aligned_alloc__(size_t boundary, size_t size)
|
||||
{
|
||||
void **place;
|
||||
uintptr_t addr = 0;
|
||||
void *ptr = malloc(boundary + size + sizeof(uintptr_t));
|
||||
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
|
||||
addr = ((uintptr_t)ptr + sizeof(uintptr_t) + boundary)
|
||||
& ~(boundary - 1);
|
||||
place = (void**)addr;
|
||||
place[-1] = ptr;
|
||||
|
||||
return (void*)addr;
|
||||
}
|
||||
|
||||
static void aligned_free__(void *ptr)
|
||||
{
|
||||
void **p = (void**)ptr;
|
||||
free(p[-1]);
|
||||
}
|
||||
|
||||
#if !(defined(__AVX__) && ENABLE_AVX) && !defined(__SSE__)
|
||||
static INLINE void process_sinc_C(rarch_sinc_resampler_t *resamp,
|
||||
float *out_buffer)
|
||||
@ -388,7 +335,7 @@ static void process_sinc(rarch_sinc_resampler_t *resamp, float *out_buffer)
|
||||
/* movehl { X, R, X, L } == { X, R, X, R } */
|
||||
_mm_store_ss(out_buffer + 1, _mm_movehl_ps(sum, sum));
|
||||
}
|
||||
#elif defined(__ARM_NEON__)
|
||||
#elif defined(__ARM_NEON__) && !defined(VITA)
|
||||
|
||||
#if SINC_COEFF_LERP
|
||||
#error "NEON asm does not support SINC lerp."
|
||||
@ -462,7 +409,7 @@ static void resampler_sinc_free(void *re)
|
||||
{
|
||||
rarch_sinc_resampler_t *resampler = (rarch_sinc_resampler_t*)re;
|
||||
if (resampler)
|
||||
aligned_free__(resampler->main_buffer);
|
||||
memalign_free(resampler->main_buffer);
|
||||
free(resampler);
|
||||
}
|
||||
|
||||
@ -480,7 +427,7 @@ static void *resampler_sinc_new(const struct resampler_config *config,
|
||||
(void)config;
|
||||
|
||||
re->taps = TAPS;
|
||||
cutoff = CUTOFF;
|
||||
cutoff = CUTOFF;
|
||||
|
||||
/* Downsampling, must lower cutoff, and extend number of
|
||||
* taps accordingly to keep same stopband attenuation. */
|
||||
@ -491,7 +438,7 @@ static void *resampler_sinc_new(const struct resampler_config *config,
|
||||
}
|
||||
|
||||
/* Be SIMD-friendly. */
|
||||
#if (defined(__AVX__) && ENABLE_AVX) || defined(__ARM_NEON__)
|
||||
#if (defined(__AVX__) && ENABLE_AVX) || (defined(__ARM_NEON__)&& !defined(VITA))
|
||||
re->taps = (re->taps + 7) & ~7;
|
||||
#else
|
||||
re->taps = (re->taps + 3) & ~3;
|
||||
@ -503,8 +450,7 @@ static void *resampler_sinc_new(const struct resampler_config *config,
|
||||
#endif
|
||||
elems = phase_elems + 4 * re->taps;
|
||||
|
||||
re->main_buffer = (float*)
|
||||
aligned_alloc__(128, sizeof(float) * elems);
|
||||
re->main_buffer = (float*)memalign_alloc(128, sizeof(float) * elems);
|
||||
if (!re->main_buffer)
|
||||
goto error;
|
||||
|
||||
@ -515,7 +461,7 @@ static void *resampler_sinc_new(const struct resampler_config *config,
|
||||
init_sinc_table(re, cutoff, re->phase_table,
|
||||
1 << PHASE_BITS, re->taps, SINC_COEFF_LERP);
|
||||
|
||||
#if defined(__ARM_NEON__)
|
||||
#if defined(__ARM_NEON__) && !defined(VITA)
|
||||
process_sinc_func = mask & RESAMPLER_SIMD_NEON
|
||||
? process_sinc_neon : process_sinc_C;
|
||||
#endif
|
||||
@ -535,4 +481,3 @@ rarch_resampler_t sinc_resampler = {
|
||||
"sinc",
|
||||
"sinc"
|
||||
};
|
||||
|
||||
|
@ -46,6 +46,7 @@
|
||||
#define NETWORK_COMPAT_HEADERS 1
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef NETWORK_COMPAT_HEADERS
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
@ -71,6 +72,7 @@
|
||||
|
||||
#include <compat/strl.h>
|
||||
#include <retro_inline.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
@ -151,7 +153,6 @@ static int rsnd_send_info_query(rsound_t *rd);
|
||||
static int rsnd_update_server_info(rsound_t *rd);
|
||||
|
||||
static int rsnd_poll(struct pollfd *fd, int numfd, int timeout);
|
||||
static void rsnd_sleep(int msec);
|
||||
|
||||
static void rsnd_cb_thread(void *thread_data);
|
||||
static void rsnd_thread(void *thread_data);
|
||||
@ -361,12 +362,12 @@ static int rsnd_send_header_info(rsound_t *rd)
|
||||
#define LSB16(x) if ( !rsnd_is_little_endian() ) { rsnd_swap_endian_16(&(x)); }
|
||||
#define LSB32(x) if ( !rsnd_is_little_endian() ) { rsnd_swap_endian_32(&(x)); }
|
||||
|
||||
// Here we embed in the rest of the WAV header for it to be somewhat valid
|
||||
/* Here we embed in the rest of the WAV header for it to be somewhat valid */
|
||||
|
||||
strcpy(header, "RIFF");
|
||||
strlcpy(header, "RIFF", sizeof(header));
|
||||
SET32(header, 4, 0);
|
||||
strcpy(header+8, "WAVE");
|
||||
strcpy(header+12, "fmt ");
|
||||
strlcpy(header+8, "WAVE", sizeof(header));
|
||||
strlcpy(header+12, "fmt ", sizeof(header));
|
||||
|
||||
temp32 = 16;
|
||||
LSB32(temp32);
|
||||
@ -412,15 +413,15 @@ static int rsnd_send_header_info(rsound_t *rd)
|
||||
LSB16(temp_bits);
|
||||
SET16(header, FRAMESIZE, temp_bits);
|
||||
|
||||
strcpy(header+36, "data");
|
||||
strlcpy(header+36, "data", sizeof(header));
|
||||
|
||||
// Do not care about cksize here (impossible to know beforehand). It is used by
|
||||
// the server for format.
|
||||
/* Do not care about cksize here (impossible to know beforehand).
|
||||
* It is used by the server for format. */
|
||||
|
||||
LSB16(temp_format);
|
||||
SET16(header, FORMAT, temp_format);
|
||||
|
||||
// End static header
|
||||
/* End static header */
|
||||
|
||||
if ( rsnd_send_chunk(rd->conn.socket, header, HEADER_SIZE, 1) != HEADER_SIZE )
|
||||
{
|
||||
@ -464,7 +465,7 @@ static int rsnd_get_backend_info ( rsound_t *rd )
|
||||
rd->backend_info.chunk_size = MAX_CHUNK_SIZE;
|
||||
|
||||
/* Assumes a default buffer size should it cause problems of being too small */
|
||||
if ( rd->buffer_size <= 0 || rd->buffer_size < rd->backend_info.chunk_size * 2 )
|
||||
if ( rd->buffer_size == 0 || rd->buffer_size < rd->backend_info.chunk_size * 2 )
|
||||
rd->buffer_size = rd->backend_info.chunk_size * 32;
|
||||
|
||||
if ( rd->fifo_buffer != NULL )
|
||||
@ -746,27 +747,6 @@ static int64_t rsnd_get_time_usec(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void rsnd_sleep(int msec)
|
||||
{
|
||||
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
|
||||
sys_timer_usleep(1000 * msec);
|
||||
#elif defined(PSP)
|
||||
sceKernelDelayThread(1000 * msec);
|
||||
#elif defined(_WIN32)
|
||||
Sleep(msec);
|
||||
#elif defined(XENON)
|
||||
udelay(1000 * msec);
|
||||
#elif defined(GEKKO) || defined(__PSL1GHT__) || defined(__QNX__)
|
||||
usleep(1000 * msec);
|
||||
#else
|
||||
struct timespec tv = {0};
|
||||
tv.tv_sec = msec / 1000;
|
||||
tv.tv_nsec = (msec % 1000) * 1000000;
|
||||
nanosleep(&tv, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Calculates how many bytes there are in total in the virtual buffer. This is calculated client side.
|
||||
It should be accurate enough unless we have big problems with buffer underruns.
|
||||
This function is called by rsd_delay() to determine the latency.
|
||||
@ -1022,9 +1002,6 @@ static int rsnd_send_info_query(rsound_t *rd)
|
||||
// In that case, we read the packet.
|
||||
static int rsnd_update_server_info(rsound_t *rd)
|
||||
{
|
||||
|
||||
ssize_t rc;
|
||||
|
||||
long long int client_ptr = -1;
|
||||
long long int serv_ptr = -1;
|
||||
char temp[RSD_PROTO_MAXSIZE + 1] = {0};
|
||||
@ -1032,6 +1009,7 @@ static int rsnd_update_server_info(rsound_t *rd)
|
||||
// We read until we have the last (most recent) data in the network buffer.
|
||||
for (;;)
|
||||
{
|
||||
ssize_t rc;
|
||||
const char *substr;
|
||||
char *tmpstr;
|
||||
memset(temp, 0, sizeof(temp));
|
||||
@ -1259,7 +1237,7 @@ static void rsnd_cb_thread(void *thread_data)
|
||||
// The network might do things in large chunks, so it may request large amounts of data in short periods of time.
|
||||
// This breaks when the caller cannot buffer up big buffers beforehand, so do short sleeps inbetween.
|
||||
// This is somewhat dirty, but I cannot see a better solution
|
||||
rsnd_sleep(1);
|
||||
retro_sleep(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1335,24 +1313,21 @@ int rsd_stop(rsound_t *rd)
|
||||
|
||||
size_t rsd_write( rsound_t *rsound, const void* buf, size_t size)
|
||||
{
|
||||
size_t max_write, written = 0;
|
||||
assert(rsound != NULL);
|
||||
if ( !rsound->ready_for_data )
|
||||
return 0;
|
||||
|
||||
size_t result;
|
||||
size_t max_write = (rsound->buffer_size - rsound->backend_info.chunk_size)/2;
|
||||
|
||||
size_t written = 0;
|
||||
size_t write_size;
|
||||
max_write = (rsound->buffer_size - rsound->backend_info.chunk_size)/2;
|
||||
|
||||
/* Makes sure that we can handle arbitrary large write sizes */
|
||||
|
||||
while ( written < size )
|
||||
{
|
||||
write_size = (size - written) > max_write ? max_write : (size - written);
|
||||
result = rsnd_fill_buffer(rsound, (const char*)buf + written, write_size);
|
||||
size_t write_size = (size - written) > max_write ? max_write : (size - written);
|
||||
size_t result = rsnd_fill_buffer(rsound, (const char*)buf + written, write_size);
|
||||
|
||||
if ( result <= 0 )
|
||||
if (result == 0)
|
||||
{
|
||||
rsd_stop(rsound);
|
||||
return 0;
|
||||
@ -1371,10 +1346,7 @@ int rsd_start(rsound_t *rsound)
|
||||
assert(rsound->port != NULL);
|
||||
|
||||
if ( rsnd_create_connection(rsound) < 0 )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1526,7 +1498,7 @@ void rsd_delay_wait(rsound_t *rd)
|
||||
{
|
||||
int64_t sleep_ms = latency_ms - rd->max_latency;
|
||||
RSD_DEBUG("[RSound] Delay wait: %d ms.\n", (int)sleep_ms);
|
||||
rsnd_sleep((int)sleep_ms);
|
||||
retro_sleep((int)sleep_ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,18 +11,29 @@ TESTS := test-sinc-lowest \
|
||||
test-cc \
|
||||
test-snr-cc
|
||||
|
||||
LIBRETRO_COMM_DIR = ../../libretro-common
|
||||
|
||||
CFLAGS += -O3 -ffast-math -g -Wall -pedantic -march=native -std=gnu99
|
||||
CFLAGS += -DRESAMPLER_TEST -DRARCH_DUMMY_LOG
|
||||
CFLAGS += -I../../libretro-common/include -I../../
|
||||
CFLAGS += -DRESAMPLER_TEST -DRARCH_DUMMY_LOG -DRARCH_INTERNAL
|
||||
CFLAGS += -I$(LIBRETRO_COMM_DIR)/include -I../../
|
||||
|
||||
LDFLAGS += -lm
|
||||
|
||||
SHAREDOBJ += $(LIBRETRO_COMM_DIR)/memmap/memalign.o \
|
||||
$(LIBRETRO_COMM_DIR)/string/string_list.o \
|
||||
$(LIBRETRO_COMM_DIR)/file/config_file_userdata.o \
|
||||
$(LIBRETRO_COMM_DIR)/file/config_file.o \
|
||||
$(LIBRETRO_COMM_DIR)/file/retro_file.o \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path.o \
|
||||
$(LIBRETRO_COMM_DIR)/compat/compat.o \
|
||||
$(LIBRETRO_COMM_DIR)/hash/rhash.o \
|
||||
|
||||
all: $(TESTS)
|
||||
|
||||
resampler-sinc.o: ../audio_resampler_driver.c
|
||||
resampler-sinc.o: ../audio_resampler_driver.c $(SHAREDOBJ)
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
resampler-cc.o: ../audio_resampler_driver.c
|
||||
resampler-cc.o: ../audio_resampler_driver.c $(SHAREDOBJ)
|
||||
$(CC) -c -o $@ $< $(CFLAGS) -DRESAMPLER_IDENT='"CC"'
|
||||
|
||||
main-cc.o: main.c
|
||||
@ -31,7 +42,7 @@ main-cc.o: main.c
|
||||
snr-cc.o: snr.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS) -DRESAMPLER_IDENT='"CC"'
|
||||
|
||||
cc-resampler.o: ../resamplers/cc_resampler.c
|
||||
cc-resampler.o: ../drivers_resampler/cc_resampler.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
sinc-lowest.o: ../drivers_resampler/sinc.c
|
||||
@ -52,40 +63,40 @@ sinc-higher.o: ../drivers_resampler/sinc.c
|
||||
sinc-highest.o: ../drivers_resampler/sinc.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS) -DSINC_HIGHEST_QUALITY
|
||||
|
||||
test-sinc-lowest: sinc-lowest.o ../audio_utils.o main.o resampler-sinc.o nearest.o
|
||||
test-sinc-lowest: sinc-lowest.o ../audio_utils.o main.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-snr-sinc-lowest: sinc-lowest.o ../audio_utils.o snr.o resampler-sinc.o nearest.o
|
||||
test-snr-sinc-lowest: sinc-lowest.o ../audio_utils.o snr.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-sinc-lower: sinc-lower.o ../audio_utils.o main.o resampler-sinc.o nearest.o
|
||||
test-sinc-lower: sinc-lower.o ../audio_utils.o main.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-snr-sinc-lower: sinc-lower.o ../audio_utils.o snr.o resampler-sinc.o nearest.o
|
||||
test-snr-sinc-lower: sinc-lower.o ../audio_utils.o snr.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-sinc: sinc.o ../audio_utils.o main.o resampler-sinc.o nearest.o
|
||||
test-sinc: sinc.o ../audio_utils.o main.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-snr-sinc: sinc.o ../audio_utils.o snr.o resampler-sinc.o nearest.o
|
||||
test-snr-sinc: sinc.o ../audio_utils.o snr.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-sinc-higher: sinc-higher.o ../audio_utils.o main.o resampler-sinc.o nearest.o
|
||||
test-sinc-higher: sinc-higher.o ../audio_utils.o main.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-snr-sinc-higher: sinc-higher.o ../audio_utils.o snr.o resampler-sinc.o nearest.o
|
||||
test-snr-sinc-higher: sinc-higher.o ../audio_utils.o snr.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-sinc-highest: sinc-highest.o ../audio_utils.o main.o resampler-sinc.o nearest.o
|
||||
test-sinc-highest: sinc-highest.o ../audio_utils.o main.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-snr-sinc-highest: sinc-highest.o ../audio_utils.o snr.o resampler-sinc.o nearest.o
|
||||
test-snr-sinc-highest: sinc-highest.o ../audio_utils.o snr.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-cc: cc-resampler.o ../audio_utils.o main-cc.o resampler-cc.o sinc.o nearest.o
|
||||
test-cc: cc-resampler.o ../audio_utils.o main-cc.o resampler-cc.o resampler-cc.o sinc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-snr-cc: cc-resampler.o ../audio_utils.o snr-cc.o resampler-cc.o sinc.o nearest.o
|
||||
test-snr-cc: cc-resampler.o ../audio_utils.o snr-cc.o resampler-cc.o sinc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
%.o: %.c
|
||||
|
@ -28,14 +28,18 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
srand(time(NULL));
|
||||
int16_t input_i[1024];
|
||||
int16_t output_i[1024 * 8];
|
||||
|
||||
float input_f[1024];
|
||||
float output_f[1024 * 8];
|
||||
|
||||
double in_rate, out_rate, ratio;
|
||||
double ratio_max_deviation = 0.0;
|
||||
const rarch_resampler_t *resampler = NULL;
|
||||
void *re = NULL;
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
if (argc < 3 || argc > 4)
|
||||
{
|
||||
@ -48,18 +52,16 @@ int main(int argc, char *argv[])
|
||||
fprintf(stderr, "Ratio deviation: %.4f.\n", ratio_max_deviation);
|
||||
}
|
||||
|
||||
double in_rate = strtod(argv[1], NULL);
|
||||
double out_rate = strtod(argv[2], NULL);
|
||||
in_rate = strtod(argv[1], NULL);
|
||||
out_rate = strtod(argv[2], NULL);
|
||||
ratio = out_rate / in_rate;
|
||||
|
||||
double ratio = out_rate / in_rate;
|
||||
if (ratio >= 7.99)
|
||||
{
|
||||
fprintf(stderr, "Ratio is too high.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const rarch_resampler_t *resampler = NULL;
|
||||
void *re = NULL;
|
||||
if (!rarch_resampler_realloc(&re, &resampler, RESAMPLER_IDENT, out_rate / in_rate))
|
||||
{
|
||||
fprintf(stderr, "Failed to allocate resampler ...\n");
|
||||
@ -68,24 +70,26 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (;;)
|
||||
{
|
||||
size_t output_samples;
|
||||
struct resampler_data data;
|
||||
double uniform, rate_mod;
|
||||
|
||||
if (fread(input_i, sizeof(int16_t), 1024, stdin) != 1024)
|
||||
break;
|
||||
|
||||
double uniform = (2.0 * rand()) / RAND_MAX - 1.0;
|
||||
double rate_mod = 1.0 + ratio_max_deviation * uniform;
|
||||
uniform = (2.0 * rand()) / RAND_MAX - 1.0;
|
||||
rate_mod = 1.0 + ratio_max_deviation * uniform;
|
||||
|
||||
audio_convert_s16_to_float(input_f, input_i, 1024, 1.0f);
|
||||
|
||||
struct resampler_data data = {
|
||||
.data_in = input_f,
|
||||
.data_out = output_f,
|
||||
.input_frames = sizeof(input_f) / (2 * sizeof(float)),
|
||||
.ratio = ratio * rate_mod,
|
||||
};
|
||||
data.data_in = input_f;
|
||||
data.data_out = output_f;
|
||||
data.input_frames = sizeof(input_f) / (2 * sizeof(float));
|
||||
data.ratio = ratio * rate_mod;
|
||||
|
||||
rarch_resampler_process(resampler, re, &data);
|
||||
|
||||
size_t output_samples = data.output_frames * 2;
|
||||
output_samples = data.output_frames * 2;
|
||||
|
||||
audio_convert_float_to_s16(output_i, output_f, output_samples);
|
||||
|
||||
|
177
audio/test/snr.c
177
audio/test/snr.c
@ -13,8 +13,6 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../resamplers/resampler.h"
|
||||
#include "../audio_utils.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
@ -23,6 +21,9 @@
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "../audio_resampler_driver.h"
|
||||
#include "../audio_utils.h"
|
||||
|
||||
#ifndef RESAMPLER_IDENT
|
||||
#define RESAMPLER_IDENT "sinc"
|
||||
#endif
|
||||
@ -32,7 +33,9 @@
|
||||
|
||||
static void gen_signal(float *out, double omega, double bias_samples, size_t samples)
|
||||
{
|
||||
for (size_t i = 0; i < samples; i += 2)
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < samples; i += 2)
|
||||
{
|
||||
out[i + 0] = cos(((i >> 1) + bias_samples) * omega);
|
||||
out[i + 1] = out[i + 0];
|
||||
@ -59,21 +62,26 @@ static unsigned bitrange(unsigned len)
|
||||
|
||||
static unsigned bitswap(unsigned i, unsigned range)
|
||||
{
|
||||
unsigned shifts;
|
||||
unsigned ret = 0;
|
||||
for (unsigned shifts = 0; shifts < range; shifts++)
|
||||
ret |= i & (1 << (range - shifts - 1)) ? (1 << shifts) : 0;
|
||||
|
||||
for (shifts = 0; shifts < range; shifts++)
|
||||
ret |= (i & (1 << (range - shifts - 1))) ? (1 << shifts) : 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// When interleaving the butterfly buffer, addressing puts bits in reverse.
|
||||
// [0, 1, 2, 3, 4, 5, 6, 7] => [0, 4, 2, 6, 1, 5, 3, 7]
|
||||
/* When interleaving the butterfly buffer, addressing puts bits in reverse.
|
||||
* [0, 1, 2, 3, 4, 5, 6, 7] => [0, 4, 2, 6, 1, 5, 3, 7] */
|
||||
static void interleave(complex double *butterfly_buf, size_t samples)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned range = bitrange(samples);
|
||||
for (unsigned i = 0; i < samples; i++)
|
||||
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
unsigned target = bitswap(i, range);
|
||||
|
||||
if (target > i)
|
||||
{
|
||||
complex double tmp = butterfly_buf[target];
|
||||
@ -90,58 +98,68 @@ static complex double gen_phase(double index)
|
||||
|
||||
static void butterfly(complex double *a, complex double *b, complex double mod)
|
||||
{
|
||||
complex double a_;
|
||||
complex double b_;
|
||||
|
||||
mod *= *b;
|
||||
complex double a_ = *a + mod;
|
||||
complex double b_ = *a - mod;
|
||||
*a = a_;
|
||||
*b = b_;
|
||||
a_ = *a + mod;
|
||||
b_ = *a - mod;
|
||||
*a = a_;
|
||||
*b = b_;
|
||||
}
|
||||
|
||||
static void butterflies(complex double *butterfly_buf, double phase_dir, size_t step_size, size_t samples)
|
||||
{
|
||||
for (unsigned i = 0; i < samples; i += 2 * step_size)
|
||||
for (unsigned j = i; j < i + step_size; j++)
|
||||
unsigned i, j;
|
||||
|
||||
for (i = 0; i < samples; i += 2 * step_size)
|
||||
for (j = i; j < i + step_size; j++)
|
||||
butterfly(&butterfly_buf[j], &butterfly_buf[j + step_size], gen_phase((phase_dir * (j - i)) / step_size));
|
||||
}
|
||||
|
||||
static void calculate_fft(const float *data, complex double *butterfly_buf, size_t samples)
|
||||
{
|
||||
// Enforce POT.
|
||||
unsigned i;
|
||||
|
||||
/* Enforce POT. */
|
||||
assert((samples & (samples - 1)) == 0);
|
||||
|
||||
for (unsigned i = 0; i < samples; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
butterfly_buf[i] = data[2 * i];
|
||||
|
||||
// Interleave buffer to work with FFT.
|
||||
/* Interleave buffer to work with FFT. */
|
||||
interleave(butterfly_buf, samples);
|
||||
|
||||
// Fly, lovely butterflies! :D
|
||||
/* Fly, lovely butterflies! :D */
|
||||
for (unsigned step_size = 1; step_size < samples; step_size *= 2)
|
||||
butterflies(butterfly_buf, -1.0, step_size, samples);
|
||||
}
|
||||
|
||||
static void calculate_fft_adjust(complex double *butterfly_buf, double gain, bool merge_high, size_t samples)
|
||||
{
|
||||
unsigned i;
|
||||
if (merge_high)
|
||||
{
|
||||
for (unsigned i = 1; i < samples / 2; i++)
|
||||
for (i = 1; i < samples / 2; i++)
|
||||
butterfly_buf[i] *= 2.0;
|
||||
}
|
||||
|
||||
// Normalize amplitudes.
|
||||
for (unsigned i = 0; i < samples; i++)
|
||||
/* Normalize amplitudes. */
|
||||
for (i = 0; i < samples; i++)
|
||||
butterfly_buf[i] *= gain;
|
||||
}
|
||||
|
||||
static void calculate_ifft(complex double *butterfly_buf, size_t samples, bool normalize)
|
||||
{
|
||||
// Enforce POT.
|
||||
unsigned step_size;
|
||||
|
||||
/* Enforce POT. */
|
||||
assert((samples & (samples - 1)) == 0);
|
||||
|
||||
interleave(butterfly_buf, samples);
|
||||
|
||||
// Fly, lovely butterflies! In opposite direction! :D
|
||||
for (unsigned step_size = 1; step_size < samples; step_size *= 2)
|
||||
/* Fly, lovely butterflies! In opposite direction! :D */
|
||||
for (step_size = 1; step_size < samples; step_size *= 2)
|
||||
butterflies(butterfly_buf, 1.0, step_size, samples);
|
||||
|
||||
if (normalize)
|
||||
@ -150,25 +168,25 @@ static void calculate_ifft(complex double *butterfly_buf, size_t samples, bool n
|
||||
|
||||
static void test_fft(void)
|
||||
{
|
||||
fprintf(stderr, "Sanity checking FFT ...\n");
|
||||
unsigned i, j;
|
||||
float signal[32];
|
||||
complex double butterfly_buf[16];
|
||||
complex double buf_tmp[16];
|
||||
|
||||
const float cos_freqs[] = {
|
||||
1.0, 4.0, 6.0,
|
||||
};
|
||||
|
||||
const float sin_freqs[] = {
|
||||
-2.0, 5.0, 7.0,
|
||||
};
|
||||
|
||||
for (unsigned i = 0; i < 16; i++)
|
||||
fprintf(stderr, "Sanity checking FFT ...\n");
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
signal[2 * i] = 0.0;
|
||||
for (unsigned j = 0; j < sizeof(cos_freqs) / sizeof(cos_freqs[0]); j++)
|
||||
for (j = 0; j < sizeof(cos_freqs) / sizeof(cos_freqs[0]); j++)
|
||||
signal[2 * i] += cos(2.0 * M_PI * i * cos_freqs[j] / 16.0);
|
||||
for (unsigned j = 0; j < sizeof(sin_freqs) / sizeof(sin_freqs[0]); j++)
|
||||
for ( j = 0; j < sizeof(sin_freqs) / sizeof(sin_freqs[0]); j++)
|
||||
signal[2 * i] += sin(2.0 * M_PI * i * sin_freqs[j] / 16.0);
|
||||
}
|
||||
|
||||
@ -177,26 +195,27 @@ static void test_fft(void)
|
||||
calculate_fft_adjust(buf_tmp, 1.0 / 16, true, 16);
|
||||
|
||||
fprintf(stderr, "FFT: { ");
|
||||
for (unsigned i = 0; i < 7; i++)
|
||||
for (i = 0; i < 7; i++)
|
||||
fprintf(stderr, "(%4.2lf, %4.2lf), ", creal(buf_tmp[i]), cimag(buf_tmp[i]));
|
||||
fprintf(stderr, "(%4.2lf, %4.2lf) }\n", creal(buf_tmp[7]), cimag(buf_tmp[7]));
|
||||
|
||||
calculate_ifft(butterfly_buf, 16, true);
|
||||
|
||||
fprintf(stderr, "Original: { ");
|
||||
for (unsigned i = 0; i < 15; i++)
|
||||
for (i = 0; i < 15; i++)
|
||||
fprintf(stderr, "%5.2f, ", signal[2 * i]);
|
||||
fprintf(stderr, "%5.2f }\n", signal[2 * 15]);
|
||||
|
||||
fprintf(stderr, "FFT => IFFT: { ");
|
||||
for (unsigned i = 0; i < 15; i++)
|
||||
for ( i = 0; i < 15; i++)
|
||||
fprintf(stderr, "%5.2lf, ", creal(butterfly_buf[i]));
|
||||
fprintf(stderr, "%5.2lf }\n", creal(butterfly_buf[15]));
|
||||
}
|
||||
|
||||
static void set_alias_power(struct snr_result *res, unsigned freq, double power)
|
||||
{
|
||||
for (unsigned i = 0; i < 3; i++)
|
||||
unsigned i;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (power >= res->alias_power[i])
|
||||
{
|
||||
@ -211,21 +230,24 @@ static void set_alias_power(struct snr_result *res, unsigned freq, double power)
|
||||
|
||||
static void calculate_snr(struct snr_result *res,
|
||||
unsigned in_rate, unsigned max_rate,
|
||||
const float *resamp, complex double *butterfly_buf, size_t samples)
|
||||
const float *resamp, complex double *butterfly_buf,
|
||||
size_t samples)
|
||||
{
|
||||
unsigned i;
|
||||
double signal;
|
||||
double noise = 0.0;
|
||||
|
||||
samples >>= 1;
|
||||
calculate_fft(resamp, butterfly_buf, samples);
|
||||
calculate_fft_adjust(butterfly_buf, 1.0 / samples, true, samples);
|
||||
|
||||
memset(res, 0, sizeof(*res));
|
||||
|
||||
double signal = cabs(butterfly_buf[in_rate] * butterfly_buf[in_rate]);
|
||||
signal = cabs(butterfly_buf[in_rate] * butterfly_buf[in_rate]);
|
||||
butterfly_buf[in_rate] = 0.0;
|
||||
|
||||
double noise = 0.0;
|
||||
|
||||
// Aliased frequencies above half the original sampling rate are not considered.
|
||||
for (unsigned i = 0; i <= max_rate; i++)
|
||||
/* Aliased frequencies above half the original sampling rate are not considered. */
|
||||
for (i = 0; i <= max_rate; i++)
|
||||
{
|
||||
double power = cabs(butterfly_buf[i] * butterfly_buf[i]);
|
||||
set_alias_power(res, i, power);
|
||||
@ -235,25 +257,12 @@ static void calculate_snr(struct snr_result *res,
|
||||
res->snr = 10.0 * log10(signal / noise);
|
||||
res->gain = 10.0 * log10(signal);
|
||||
|
||||
for (unsigned i = 0; i < 3; i++)
|
||||
for (i = 0; i < 3; i++)
|
||||
res->alias_power[i] = 10.0 * log10(res->alias_power[i]);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc != 2)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s <ratio> (out-rate is fixed for FFT).\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
double ratio = strtod(argv[1], NULL);
|
||||
|
||||
const unsigned fft_samples = 1024 * 128;
|
||||
unsigned out_rate = fft_samples / 2;
|
||||
unsigned in_rate = round(out_rate / ratio);
|
||||
ratio = (double)out_rate / in_rate;
|
||||
|
||||
static const float freq_list[] = {
|
||||
0.001, 0.002, 0.003, 0.004, 0.005, 0.006, 0.007, 0.008, 0.009,
|
||||
0.010, 0.015, 0.020, 0.025, 0.030, 0.035, 0.040, 0.045, 0.050,
|
||||
@ -264,38 +273,63 @@ int main(int argc, char *argv[])
|
||||
0.495, 0.496, 0.497, 0.498, 0.499,
|
||||
};
|
||||
|
||||
unsigned samples = in_rate * 4;
|
||||
float *input = calloc(sizeof(float), samples);
|
||||
float *output = calloc(sizeof(float), (fft_samples + 16) * 2);
|
||||
complex double *butterfly_buf = calloc(sizeof(complex double), fft_samples / 2);
|
||||
unsigned out_rate, in_rate, samples, i;
|
||||
double ratio;
|
||||
float *input, *output;
|
||||
complex double *butterfly_buf;
|
||||
const rarch_resampler_t *resampler = NULL;
|
||||
const unsigned fft_samples = 1024 * 128;
|
||||
void *re = NULL;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s <ratio> (out-rate is fixed for FFT).\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ratio = strtod(argv[1], NULL);
|
||||
out_rate = fft_samples / 2;
|
||||
in_rate = round(out_rate / ratio);
|
||||
ratio = (double)out_rate / in_rate;
|
||||
|
||||
samples = in_rate * 4;
|
||||
input = calloc(sizeof(float), samples);
|
||||
output = calloc(sizeof(float), (fft_samples + 16) * 2);
|
||||
butterfly_buf = calloc(sizeof(complex double), fft_samples / 2);
|
||||
|
||||
assert(input);
|
||||
assert(output);
|
||||
|
||||
void *re = NULL;
|
||||
const rarch_resampler_t *resampler = NULL;
|
||||
if (!rarch_resampler_realloc(&re, &resampler, RESAMPLER_IDENT, ratio))
|
||||
{
|
||||
free(input);
|
||||
free(output);
|
||||
free(butterfly_buf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
test_fft();
|
||||
|
||||
for (unsigned i = 0; i < sizeof(freq_list) / sizeof(freq_list[0]); i++)
|
||||
for (i = 0; i < sizeof(freq_list) / sizeof(freq_list[0]); i++)
|
||||
{
|
||||
struct resampler_data data;
|
||||
unsigned max_freq;
|
||||
struct snr_result res = {0};
|
||||
unsigned freq = freq_list[i] * in_rate;
|
||||
double omega = 2.0 * M_PI * freq / in_rate;
|
||||
double omega = 2.0 * M_PI * freq / in_rate;
|
||||
|
||||
gen_signal(input, omega, 0, samples);
|
||||
|
||||
struct resampler_data data = {
|
||||
.data_in = input,
|
||||
.data_out = output,
|
||||
.input_frames = in_rate * 2,
|
||||
.ratio = ratio,
|
||||
};
|
||||
data.data_in = input;
|
||||
data.data_out = output;
|
||||
data.input_frames = in_rate * 2;
|
||||
data.ratio = ratio;
|
||||
|
||||
rarch_resampler_process(resampler, re, &data);
|
||||
|
||||
// We generate 2 seconds worth of audio, however, only the last second is considered so phase has stabilized.
|
||||
struct snr_result res = {0};
|
||||
unsigned max_freq = min(in_rate, out_rate) / 2;
|
||||
/* We generate 2 seconds worth of audio, however,
|
||||
* only the last second is considered so phase has stabilized. */
|
||||
max_freq = min(in_rate, out_rate) / 2;
|
||||
if (freq > max_freq)
|
||||
continue;
|
||||
|
||||
@ -311,6 +345,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
rarch_resampler_freep(&resampler, &re);
|
||||
|
||||
free(input);
|
||||
free(output);
|
||||
free(butterfly_buf);
|
||||
|
26
autosave.c
26
autosave.c
@ -14,12 +14,14 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "autosave.h"
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "general.h"
|
||||
|
||||
struct autosave
|
||||
@ -73,7 +75,7 @@ static void autosave_thread(void *data)
|
||||
|
||||
while (!save->quit)
|
||||
{
|
||||
bool differ = false;
|
||||
bool differ;
|
||||
|
||||
autosave_lock(save);
|
||||
differ = memcmp(save->buffer, save->retro_buffer,
|
||||
@ -196,10 +198,10 @@ void lock_autosave(void)
|
||||
unsigned i;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
for (i = 0; i < global->num_autosave; i++)
|
||||
for (i = 0; i < global->autosave.num; i++)
|
||||
{
|
||||
if (global->autosave[i])
|
||||
autosave_lock(global->autosave[i]);
|
||||
if (global->autosave.list[i])
|
||||
autosave_lock(global->autosave.list[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,10 +215,10 @@ void unlock_autosave(void)
|
||||
unsigned i;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
for (i = 0; i < global->num_autosave; i++)
|
||||
for (i = 0; i < global->autosave.num; i++)
|
||||
{
|
||||
if (global->autosave[i])
|
||||
autosave_unlock(global->autosave[i]);
|
||||
if (global->autosave.list[i])
|
||||
autosave_unlock(global->autosave.list[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ include $(PSPSDK)/lib/build.mak
|
||||
|
||||
all:
|
||||
psp-build-exports -s $(PRX_EXPORTS)
|
||||
cp $(TARGET).prx ../../$(TARGET).prx
|
||||
cp $(TARGET).prx ../../../$(TARGET).prx
|
||||
cp $(TARGET).S ../$(TARGET).S
|
||||
cp $(TARGET).h ../$(TARGET).h
|
||||
rm -f $(TARGET).prx
|
@ -8,6 +8,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
unsigned int read_system_buttons(void);
|
||||
|
||||
void exitspawn_kernel( const char* fileName, SceSize args, void * argp);
|
||||
|
||||
#ifdef __cplusplus
|
@ -1,48 +1,48 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <pspdebug.h>
|
||||
#include <pspsdk.h>
|
||||
#include <pspctrl.h>
|
||||
#include <psploadexec_kernel.h>
|
||||
#include <pspthreadman_kernel.h>
|
||||
#include <string.h>
|
||||
|
||||
PSP_MODULE_INFO("kernel_functions", PSP_MODULE_KERNEL, 0, 0);
|
||||
PSP_MAIN_THREAD_ATTR(0);
|
||||
|
||||
|
||||
static volatile int thread_active;
|
||||
static unsigned int buttons;
|
||||
static SceUID main_thread_id;
|
||||
|
||||
static int main_thread(SceSize args, void *argp)
|
||||
{
|
||||
SceCtrlData paddata;
|
||||
SceCtrlData paddata;
|
||||
|
||||
thread_active = 1;
|
||||
thread_active = 1;
|
||||
|
||||
while (thread_active)
|
||||
{
|
||||
{
|
||||
sceCtrlPeekBufferPositive(&paddata, 1);
|
||||
buttons = paddata.Buttons;
|
||||
sceKernelDelayThread(1000000/60);
|
||||
}
|
||||
buttons = paddata.Buttons;
|
||||
sceKernelDelayThread(1000000/60);
|
||||
}
|
||||
|
||||
sceKernelExitThread(0);
|
||||
sceKernelExitThread(0);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
unsigned int read_system_buttons(void)
|
||||
{
|
||||
return buttons;
|
||||
return buttons;
|
||||
}
|
||||
|
||||
void exitspawn_kernel( const char* fileName, SceSize args, void * argp){
|
||||
thread_active = 0;
|
||||
void exitspawn_kernel(const char *fileName, SceSize args, void *argp)
|
||||
{
|
||||
struct SceKernelLoadExecVSHParam game_param;
|
||||
|
||||
thread_active = 0;
|
||||
|
||||
memset(&game_param,0,sizeof(game_param));
|
||||
|
||||
game_param.size = sizeof(game_param);
|
||||
@ -65,23 +65,22 @@ int module_start(SceSize args, void *argp)
|
||||
(void)args;
|
||||
(void)argp;
|
||||
|
||||
buttons = 0;
|
||||
thread_active = 0;
|
||||
main_thread_id = sceKernelCreateThread("main Thread", main_thread, 0x11, 0x200, 0, NULL);
|
||||
buttons = 0;
|
||||
thread_active = 0;
|
||||
main_thread_id = sceKernelCreateThread("main Thread", main_thread, 0x11, 0x200, 0, NULL);
|
||||
|
||||
if (main_thread >= 0)
|
||||
sceKernelStartThread(main_thread_id, 0, 0);
|
||||
sceKernelStartThread(main_thread_id, 0, 0);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int module_stop(void)
|
||||
{
|
||||
if (main_thread_id >= 0)
|
||||
{
|
||||
thread_active = 0;
|
||||
sceKernelWaitThreadEnd(main_thread_id, NULL);
|
||||
}
|
||||
return 0;
|
||||
if (main_thread_id >= 0)
|
||||
{
|
||||
thread_active = 0;
|
||||
sceKernelWaitThreadEnd(main_thread_id, NULL);
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -15,11 +15,10 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <string/string_list.h>
|
||||
|
||||
#include "camera_driver.h"
|
||||
#include "../driver.h"
|
||||
#include "../general.h"
|
||||
#include "../system.h"
|
||||
#include "../string_list_special.h"
|
||||
|
||||
static const camera_driver_t *camera_drivers[] = {
|
||||
#ifdef HAVE_V4L2
|
||||
@ -81,39 +80,7 @@ const char *camera_driver_find_ident(int idx)
|
||||
**/
|
||||
const char* config_get_camera_driver_options(void)
|
||||
{
|
||||
union string_list_elem_attr attr;
|
||||
unsigned i;
|
||||
char *options = NULL;
|
||||
int options_len = 0;
|
||||
struct string_list *options_l = string_list_new();
|
||||
|
||||
attr.i = 0;
|
||||
|
||||
if (!options_l)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; camera_driver_find_handle(i); i++)
|
||||
{
|
||||
const char *opt = camera_driver_find_ident(i);
|
||||
options_len += strlen(opt) + 1;
|
||||
string_list_append(options_l, opt, attr);
|
||||
}
|
||||
|
||||
options = (char*)calloc(options_len, sizeof(char));
|
||||
|
||||
if (!options)
|
||||
{
|
||||
string_list_free(options_l);
|
||||
options_l = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
string_list_join_concat(options, options_len, options_l, "|");
|
||||
|
||||
string_list_free(options_l);
|
||||
options_l = NULL;
|
||||
|
||||
return options;
|
||||
return char_list_new_special(STRING_LIST_CAMERA_DRIVERS, NULL);
|
||||
}
|
||||
|
||||
void find_camera_driver(void)
|
||||
@ -138,7 +105,7 @@ void find_camera_driver(void)
|
||||
driver->camera = (const camera_driver_t*)camera_driver_find_handle(0);
|
||||
|
||||
if (!driver->camera)
|
||||
rarch_fail(1, "find_camera_driver()");
|
||||
retro_fail(1, "find_camera_driver()");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include <glsym/glsym.h>
|
||||
#include "../../driver.h"
|
||||
#include "../../gfx/video_texture.h"
|
||||
|
||||
typedef struct android_camera
|
||||
{
|
||||
@ -149,7 +150,7 @@ static void android_camera_stop(void *data)
|
||||
androidcamera->onCameraStop);
|
||||
|
||||
if (androidcamera->tex)
|
||||
glDeleteTextures(1, &androidcamera->tex);
|
||||
video_texture_unload(TEXTURE_BACKEND_OPENGL, (uintptr_t*)&androidcamera->tex);
|
||||
}
|
||||
|
||||
static bool android_camera_poll(void *data,
|
||||
|
@ -24,17 +24,17 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <linux/videodev2.h>
|
||||
|
||||
#include <memmap.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <gfx/scaler/scaler.h>
|
||||
#include <retro_stat.h>
|
||||
|
||||
#include <compat/strl.h>
|
||||
|
||||
@ -63,13 +63,14 @@ typedef struct video4linux
|
||||
char dev_name[PATH_MAX_LENGTH];
|
||||
} video4linux_t;
|
||||
|
||||
static void process_image(video4linux_t *v4l,
|
||||
const uint8_t *buffer_yuv)
|
||||
static void process_image(video4linux_t *v4l, const uint8_t *buffer_yuv)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(yuv_convert_direct);
|
||||
RARCH_PERFORMANCE_START(yuv_convert_direct);
|
||||
static struct retro_perf_counter yuv_convert_direct = {0};
|
||||
|
||||
rarch_perf_init(&yuv_convert_direct, "yuv_convert_direct");
|
||||
retro_perf_start(&yuv_convert_direct);
|
||||
scaler_ctx_scale(&v4l->scaler, v4l->buffer_output, buffer_yuv);
|
||||
RARCH_PERFORMANCE_STOP(yuv_convert_direct);
|
||||
retro_perf_stop(&yuv_convert_direct);
|
||||
}
|
||||
|
||||
static int xioctl(int fd, int request, void *args)
|
||||
@ -95,7 +96,7 @@ static bool init_mmap(void *data)
|
||||
req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
req.memory = V4L2_MEMORY_MMAP;
|
||||
|
||||
if (xioctl(v4l->fd, VIDIOC_REQBUFS, &req) == -1)
|
||||
if (xioctl(v4l->fd, (uint8_t)VIDIOC_REQBUFS, &req) == -1)
|
||||
{
|
||||
if (errno == EINVAL)
|
||||
RARCH_ERR("%s does not support memory mapping.\n", v4l->dev_name);
|
||||
@ -128,7 +129,7 @@ static bool init_mmap(void *data)
|
||||
buf.memory = V4L2_MEMORY_MMAP;
|
||||
buf.index = v4l->n_buffers;
|
||||
|
||||
if (xioctl(v4l->fd, VIDIOC_QUERYBUF, &buf) == -1)
|
||||
if (xioctl(v4l->fd, (uint8_t)VIDIOC_QUERYBUF, &buf) == -1)
|
||||
{
|
||||
RARCH_ERR("Error - xioctl VIDIOC_QUERYBUF.\n");
|
||||
return false;
|
||||
@ -158,7 +159,7 @@ static bool init_device(void *data)
|
||||
struct v4l2_format fmt;
|
||||
video4linux_t *v4l = (video4linux_t*)data;
|
||||
|
||||
if (xioctl(v4l->fd, VIDIOC_QUERYCAP, &cap) < 0)
|
||||
if (xioctl(v4l->fd, (uint8_t)VIDIOC_QUERYCAP, &cap) < 0)
|
||||
{
|
||||
if (errno == EINVAL)
|
||||
RARCH_ERR("%s is no V4L2 device.\n", v4l->dev_name);
|
||||
@ -183,7 +184,7 @@ static bool init_device(void *data)
|
||||
memset(&cropcap, 0, sizeof(cropcap));
|
||||
cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
|
||||
if (xioctl(v4l->fd, VIDIOC_CROPCAP, &cropcap) == 0)
|
||||
if (xioctl(v4l->fd, (uint8_t)VIDIOC_CROPCAP, &cropcap) == 0)
|
||||
{
|
||||
crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
crop.c = cropcap.defrect;
|
||||
@ -199,7 +200,7 @@ static bool init_device(void *data)
|
||||
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
|
||||
fmt.fmt.pix.field = V4L2_FIELD_NONE;
|
||||
|
||||
if (xioctl(v4l->fd, VIDIOC_S_FMT, &fmt) < 0)
|
||||
if (xioctl(v4l->fd, (uint8_t)VIDIOC_S_FMT, &fmt) < 0)
|
||||
{
|
||||
RARCH_ERR("Error - VIDIOC_S_FMT\n");
|
||||
return false;
|
||||
@ -259,7 +260,7 @@ static bool v4l_start(void *data)
|
||||
buf.memory = V4L2_MEMORY_MMAP;
|
||||
buf.index = i;
|
||||
|
||||
if (xioctl(v4l->fd, VIDIOC_QBUF, &buf) == -1)
|
||||
if (xioctl(v4l->fd, (uint8_t)VIDIOC_QBUF, &buf) == -1)
|
||||
{
|
||||
RARCH_ERR("Error - VIDIOC_QBUF.\n");
|
||||
return false;
|
||||
@ -299,7 +300,6 @@ static void v4l_free(void *data)
|
||||
static void *v4l_init(const char *device, uint64_t caps,
|
||||
unsigned width, unsigned height)
|
||||
{
|
||||
struct stat st;
|
||||
video4linux_t *v4l = NULL;
|
||||
|
||||
if ((caps & (UINT64_C(1) << RETRO_CAMERA_BUFFER_RAW_FRAMEBUFFER)) == 0)
|
||||
@ -319,14 +319,7 @@ static void *v4l_init(const char *device, uint64_t caps,
|
||||
v4l->height = height;
|
||||
v4l->ready = false;
|
||||
|
||||
if (stat(v4l->dev_name, &st) == -1)
|
||||
{
|
||||
RARCH_ERR("Cannot identify '%s' : %d, %s\n", v4l->dev_name,
|
||||
errno, strerror(errno));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!S_ISCHR(st.st_mode))
|
||||
if (!path_is_character_special(v4l->dev_name))
|
||||
{
|
||||
RARCH_ERR("%s is no device.\n", v4l->dev_name);
|
||||
goto error;
|
||||
@ -384,7 +377,7 @@ static bool preprocess_image(void *data)
|
||||
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
buf.memory = V4L2_MEMORY_MMAP;
|
||||
|
||||
if (xioctl(v4l->fd, VIDIOC_DQBUF, &buf) == -1)
|
||||
if (xioctl(v4l->fd, (uint8_t)VIDIOC_DQBUF, &buf) == -1)
|
||||
{
|
||||
switch (errno)
|
||||
{
|
||||
@ -396,11 +389,11 @@ static bool preprocess_image(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
rarch_assert(buf.index < v4l->n_buffers);
|
||||
retro_assert(buf.index < v4l->n_buffers);
|
||||
|
||||
process_image(v4l, (const uint8_t*)v4l->buffers[buf.index].start);
|
||||
|
||||
if (xioctl(v4l->fd, VIDIOC_QBUF, &buf) == -1)
|
||||
if (xioctl(v4l->fd, (uint8_t)VIDIOC_QBUF, &buf) == -1)
|
||||
RARCH_ERR("VIDIOC_QBUF\n");
|
||||
|
||||
return true;
|
||||
|
97
cheats.c
97
cheats.c
@ -14,22 +14,56 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "cheats.h"
|
||||
#include "general.h"
|
||||
#include "runloop.h"
|
||||
#include "dynamic.h"
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <file/config_file.h>
|
||||
#include <file/file_path.h>
|
||||
#include <compat/strl.h>
|
||||
#include <compat/posix_string.h>
|
||||
|
||||
#include "cheats.h"
|
||||
#include "general.h"
|
||||
#include "runloop.h"
|
||||
#include "dynamic.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_CHEEVOS
|
||||
#include "cheevos.h"
|
||||
#endif
|
||||
|
||||
struct item_cheat
|
||||
{
|
||||
char *desc;
|
||||
bool state;
|
||||
char *code;
|
||||
};
|
||||
|
||||
struct cheat_manager
|
||||
{
|
||||
struct item_cheat *cheats;
|
||||
unsigned ptr;
|
||||
unsigned size;
|
||||
unsigned buf_size;
|
||||
};
|
||||
|
||||
unsigned cheat_manager_get_buf_size(cheat_manager_t *handle)
|
||||
{
|
||||
if (!handle)
|
||||
return 0;
|
||||
return handle->buf_size;
|
||||
}
|
||||
|
||||
unsigned cheat_manager_get_size(cheat_manager_t *handle)
|
||||
{
|
||||
if (!handle)
|
||||
return 0;
|
||||
return handle->size;
|
||||
}
|
||||
|
||||
void cheat_manager_apply_cheats(cheat_manager_t *handle)
|
||||
{
|
||||
@ -38,13 +72,26 @@ void cheat_manager_apply_cheats(cheat_manager_t *handle)
|
||||
if (!handle)
|
||||
return;
|
||||
|
||||
pretro_cheat_reset();
|
||||
core.retro_cheat_reset();
|
||||
|
||||
for (i = 0; i < handle->size; i++)
|
||||
{
|
||||
if (handle->cheats[i].state)
|
||||
pretro_cheat_set(idx++, true, handle->cheats[i].code);
|
||||
core.retro_cheat_set(idx++, true, handle->cheats[i].code);
|
||||
}
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
cheevos_globals.cheats_are_enabled = idx != 0;
|
||||
cheevos_globals.cheats_were_enabled |= cheevos_globals.cheats_are_enabled;
|
||||
#endif
|
||||
}
|
||||
|
||||
void cheat_manager_set_code(cheat_manager_t *handle, unsigned i, const char *str)
|
||||
{
|
||||
if (!handle)
|
||||
return;
|
||||
handle->cheats[i].code = strdup(str);
|
||||
handle->cheats[i].state = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -230,12 +277,13 @@ bool cheat_manager_realloc(cheat_manager_t *handle, unsigned new_size)
|
||||
|
||||
void cheat_manager_free(cheat_manager_t *handle)
|
||||
{
|
||||
unsigned i;
|
||||
if (!handle)
|
||||
return;
|
||||
|
||||
if (handle->cheats)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < handle->size; i++)
|
||||
{
|
||||
free(handle->cheats[i].desc);
|
||||
@ -264,6 +312,14 @@ void cheat_manager_update(cheat_manager_t *handle, unsigned handle_idx)
|
||||
RARCH_LOG("%s\n", msg);
|
||||
}
|
||||
|
||||
void cheat_manager_toggle_index(cheat_manager_t *handle, unsigned i)
|
||||
{
|
||||
if (!handle)
|
||||
return;
|
||||
|
||||
handle->cheats[i].state = !handle->cheats[i].state;
|
||||
cheat_manager_update(handle, i);
|
||||
}
|
||||
|
||||
void cheat_manager_toggle(cheat_manager_t *handle)
|
||||
{
|
||||
@ -296,3 +352,24 @@ void cheat_manager_index_prev(cheat_manager_t *handle)
|
||||
|
||||
cheat_manager_update(handle, handle->ptr);
|
||||
}
|
||||
|
||||
const char *cheat_manager_get_code(cheat_manager_t *handle, unsigned i)
|
||||
{
|
||||
if (!handle)
|
||||
return NULL;
|
||||
return handle->cheats[i].code;
|
||||
}
|
||||
|
||||
const char *cheat_manager_get_desc(cheat_manager_t *handle, unsigned i)
|
||||
{
|
||||
if (!handle)
|
||||
return NULL;
|
||||
return handle->cheats[i].desc;
|
||||
}
|
||||
|
||||
bool cheat_manager_get_code_state(cheat_manager_t *handle, unsigned i)
|
||||
{
|
||||
if (!handle)
|
||||
return false;
|
||||
return handle->cheats[i].state;
|
||||
}
|
||||
|
29
cheats.h
29
cheats.h
@ -23,23 +23,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct item_cheat
|
||||
{
|
||||
char *desc;
|
||||
bool state;
|
||||
char *code;
|
||||
};
|
||||
|
||||
struct cheat_manager
|
||||
{
|
||||
struct item_cheat *cheats;
|
||||
unsigned ptr;
|
||||
unsigned size;
|
||||
unsigned buf_size;
|
||||
};
|
||||
|
||||
typedef struct cheat_manager cheat_manager_t;
|
||||
|
||||
unsigned cheat_manager_get_size(cheat_manager_t *handle);
|
||||
|
||||
cheat_manager_t *cheat_manager_new(unsigned size);
|
||||
|
||||
cheat_manager_t *cheat_manager_load(const char *path);
|
||||
@ -56,6 +43,8 @@ bool cheat_manager_save(cheat_manager_t *handle, const char *path);
|
||||
|
||||
bool cheat_manager_realloc(cheat_manager_t *handle, unsigned new_size);
|
||||
|
||||
void cheat_manager_set_code(cheat_manager_t *handle, unsigned index, const char *str);
|
||||
|
||||
void cheat_manager_free(cheat_manager_t *handle);
|
||||
|
||||
void cheat_manager_index_next(cheat_manager_t *handle);
|
||||
@ -68,6 +57,16 @@ void cheat_manager_apply_cheats(cheat_manager_t *handle);
|
||||
|
||||
void cheat_manager_update(cheat_manager_t *handle, unsigned handle_idx);
|
||||
|
||||
void cheat_manager_toggle_index(cheat_manager_t *handle, unsigned i);
|
||||
|
||||
unsigned cheat_manager_get_buf_size(cheat_manager_t *handle);
|
||||
|
||||
const char *cheat_manager_get_desc(cheat_manager_t *handle, unsigned i);
|
||||
|
||||
const char *cheat_manager_get_code(cheat_manager_t *handle, unsigned i);
|
||||
|
||||
bool cheat_manager_get_code_state(cheat_manager_t *handle, unsigned i);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2014-2015 - Timo Strunk
|
||||
* Copyright (C) 2011-2015 - Daniel De Matteis
|
||||
*
|
||||
* Copyright (C) 2015 - 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.
|
||||
@ -14,21 +13,31 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __RARCH_7ZIP_SUPPORT_H
|
||||
#define __RARCH_7ZIP_SUPPORT_H
|
||||
#ifndef __RARCH_CHEEVOS_H
|
||||
#define __RARCH_CHEEVOS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int read_7zip_file(const char * archive_path,
|
||||
const char *relative_path, void **buf, char const* optional_outfileq);
|
||||
#include "libretro.h"
|
||||
#include "menu/menu_entries.h"
|
||||
|
||||
struct string_list *compressed_7zip_file_list_new(const char *path,
|
||||
const char* ext);
|
||||
typedef struct
|
||||
{
|
||||
int cheats_are_enabled;
|
||||
int cheats_were_enabled;
|
||||
} cheevos_globals_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
extern cheevos_globals_t cheevos_globals;
|
||||
|
||||
#endif
|
||||
int cheevos_load(const struct retro_game_info *info);
|
||||
|
||||
void cheevos_populate_menu(menu_displaylist_info_t *info);
|
||||
|
||||
void cheevos_get_description(unsigned cheevo_ndx, char *str, size_t len);
|
||||
|
||||
void cheevos_test(void);
|
||||
|
||||
void cheevos_unload(void);
|
||||
|
||||
#endif /* __RARCH_CHEEVOS_H */
|
22
command.c
22
command.c
@ -19,7 +19,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
@ -82,7 +81,7 @@ static bool cmd_init_network(rarch_cmd_t *handle, uint16_t port)
|
||||
|
||||
|
||||
snprintf(port_buf, sizeof(port_buf), "%hu", (unsigned short)port);
|
||||
if (getaddrinfo_rarch(NULL, port_buf, &hints, &res) < 0)
|
||||
if (getaddrinfo_retro(NULL, port_buf, &hints, &res) < 0)
|
||||
goto error;
|
||||
|
||||
handle->net_fd = socket(res->ai_family,
|
||||
@ -101,12 +100,12 @@ static bool cmd_init_network(rarch_cmd_t *handle, uint16_t port)
|
||||
goto error;
|
||||
}
|
||||
|
||||
freeaddrinfo_rarch(res);
|
||||
freeaddrinfo_retro(res);
|
||||
return true;
|
||||
|
||||
error:
|
||||
if (res)
|
||||
freeaddrinfo_rarch(res);
|
||||
freeaddrinfo_retro(res);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@ -133,28 +132,29 @@ rarch_cmd_t *rarch_cmd_new(bool stdin_enable,
|
||||
if (!handle)
|
||||
return NULL;
|
||||
|
||||
(void)network_enable;
|
||||
(void)port;
|
||||
(void)stdin_enable;
|
||||
|
||||
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
|
||||
handle->net_fd = -1;
|
||||
if (network_enable && !cmd_init_network(handle, port))
|
||||
goto error;
|
||||
#else
|
||||
(void)network_enable;
|
||||
(void)port;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDIN_CMD
|
||||
handle->stdin_enable = stdin_enable;
|
||||
if (stdin_enable && !cmd_init_stdin(handle))
|
||||
goto error;
|
||||
#else
|
||||
(void)stdin_enable;
|
||||
#endif
|
||||
|
||||
return handle;
|
||||
|
||||
#if (defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)) || defined(HAVE_STDIN_CMD)
|
||||
error:
|
||||
rarch_cmd_free(handle);
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
void rarch_cmd_free(rarch_cmd_t *handle)
|
||||
@ -560,7 +560,7 @@ static bool send_udp_packet(const char *host,
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
|
||||
snprintf(port_buf, sizeof(port_buf), "%hu", (unsigned short)port);
|
||||
if (getaddrinfo_rarch(host, port_buf, &hints, &res) < 0)
|
||||
if (getaddrinfo_retro(host, port_buf, &hints, &res) < 0)
|
||||
return false;
|
||||
|
||||
/* Send to all possible targets.
|
||||
@ -592,7 +592,7 @@ static bool send_udp_packet(const char *host,
|
||||
}
|
||||
|
||||
end:
|
||||
freeaddrinfo_rarch(res);
|
||||
freeaddrinfo_retro(res);
|
||||
if (fd >= 0)
|
||||
socket_close(fd);
|
||||
return ret;
|
||||
|
422
command_event.c
422
command_event.c
@ -1,6 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2015 - Daniel De Matteis
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: 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.
|
||||
@ -13,14 +13,14 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include <compat/strl.h>
|
||||
|
||||
#include "command_event.h"
|
||||
|
||||
#include "general.h"
|
||||
#include "performance.h"
|
||||
#include "runloop_data.h"
|
||||
#include "runloop.h"
|
||||
#include "dynamic.h"
|
||||
#include "content.h"
|
||||
#include "screenshot.h"
|
||||
@ -28,6 +28,11 @@
|
||||
#include "retroarch.h"
|
||||
#include "dir_list_special.h"
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
#include "cheevos.h"
|
||||
#endif
|
||||
|
||||
#include "runloop_data.h"
|
||||
#include "configuration.h"
|
||||
#include "input/input_remapping.h"
|
||||
|
||||
@ -102,26 +107,26 @@ static void event_init_autosave(void)
|
||||
if (settings->autosave_interval < 1 || !global->savefiles)
|
||||
return;
|
||||
|
||||
if (!(global->autosave = (autosave_t**)calloc(global->savefiles->size,
|
||||
sizeof(*global->autosave))))
|
||||
if (!(global->autosave.list = (autosave_t**)calloc(global->savefiles->size,
|
||||
sizeof(*global->autosave.list))))
|
||||
return;
|
||||
|
||||
global->num_autosave = global->savefiles->size;
|
||||
global->autosave.num = global->savefiles->size;
|
||||
|
||||
for (i = 0; i < global->savefiles->size; i++)
|
||||
{
|
||||
const char *path = global->savefiles->elems[i].data;
|
||||
unsigned type = global->savefiles->elems[i].attr.i;
|
||||
|
||||
if (pretro_get_memory_size(type) <= 0)
|
||||
if (core.retro_get_memory_size(type) <= 0)
|
||||
continue;
|
||||
|
||||
global->autosave[i] = autosave_new(path,
|
||||
pretro_get_memory_data(type),
|
||||
pretro_get_memory_size(type),
|
||||
global->autosave.list[i] = autosave_new(path,
|
||||
core.retro_get_memory_data(type),
|
||||
core.retro_get_memory_size(type),
|
||||
settings->autosave_interval);
|
||||
|
||||
if (!global->autosave[i])
|
||||
if (!global->autosave.list[i])
|
||||
RARCH_WARN("%s\n", msg_hash_to_str(MSG_AUTOSAVE_FAILED));
|
||||
}
|
||||
}
|
||||
@ -131,14 +136,14 @@ static void event_deinit_autosave(void)
|
||||
unsigned i;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
for (i = 0; i < global->num_autosave; i++)
|
||||
autosave_free(global->autosave[i]);
|
||||
for (i = 0; i < global->autosave.num; i++)
|
||||
autosave_free(global->autosave.list[i]);
|
||||
|
||||
if (global->autosave)
|
||||
free(global->autosave);
|
||||
global->autosave = NULL;
|
||||
if (global->autosave.list)
|
||||
free(global->autosave.list);
|
||||
|
||||
global->num_autosave = 0;
|
||||
global->autosave.list = NULL;
|
||||
global->autosave.num = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -147,7 +152,7 @@ static void event_save_files(void)
|
||||
unsigned i;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!global->savefiles || !global->use_sram)
|
||||
if (!global->savefiles || !global->sram.use)
|
||||
return;
|
||||
|
||||
for (i = 0; i < global->savefiles->size; i++)
|
||||
@ -176,7 +181,7 @@ static void event_init_movie(void)
|
||||
RARCH_ERR("%s: \"%s\".\n",
|
||||
msg_hash_to_str(MSG_FAILED_TO_LOAD_MOVIE_FILE),
|
||||
global->bsv.movie_start_path);
|
||||
rarch_fail(1, "event_init_movie()");
|
||||
retro_fail(1, "event_init_movie()");
|
||||
}
|
||||
|
||||
global->bsv.movie_playback = true;
|
||||
@ -222,7 +227,7 @@ static void event_disk_control_set_eject(bool new_state, bool print_log)
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
bool error = false;
|
||||
rarch_system_info_t *info = rarch_system_info_get_ptr();
|
||||
const struct retro_disk_control_callback *control =
|
||||
const struct retro_disk_control_callback *control =
|
||||
info ? (const struct retro_disk_control_callback*)&info->disk_control : NULL;
|
||||
|
||||
if (!control || !control->get_num_images)
|
||||
@ -256,60 +261,6 @@ static void event_disk_control_set_eject(bool new_state, bool print_log)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* event_disk_control_append_image:
|
||||
* @path : Path to disk image.
|
||||
*
|
||||
* Appends disk image to disk image list.
|
||||
**/
|
||||
void event_disk_control_append_image(const char *path)
|
||||
{
|
||||
unsigned new_idx;
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
struct retro_game_info info = {0};
|
||||
global_t *global = global_get_ptr();
|
||||
rarch_system_info_t *sysinfo = rarch_system_info_get_ptr();
|
||||
const struct retro_disk_control_callback *control =
|
||||
sysinfo ? (const struct retro_disk_control_callback*)&sysinfo->disk_control
|
||||
: NULL;
|
||||
|
||||
if (!control)
|
||||
return;
|
||||
|
||||
event_disk_control_set_eject(true, false);
|
||||
|
||||
control->add_image_index();
|
||||
new_idx = control->get_num_images();
|
||||
if (!new_idx)
|
||||
return;
|
||||
new_idx--;
|
||||
|
||||
info.path = path;
|
||||
control->replace_image_index(new_idx, &info);
|
||||
|
||||
snprintf(msg, sizeof(msg), "%s: ", msg_hash_to_str(MSG_APPENDED_DISK));
|
||||
strlcat(msg, path, sizeof(msg));
|
||||
RARCH_LOG("%s\n", msg);
|
||||
rarch_main_msg_queue_push(msg, 0, 180, true);
|
||||
|
||||
event_command(EVENT_CMD_AUTOSAVE_DEINIT);
|
||||
|
||||
/* TODO: Need to figure out what to do with subsystems case. */
|
||||
if (!*global->subsystem)
|
||||
{
|
||||
/* Update paths for our new image.
|
||||
* If we actually use append_image, we assume that we
|
||||
* started out in a single disk case, and that this way
|
||||
* of doing it makes the most sense. */
|
||||
rarch_set_paths(path);
|
||||
rarch_fill_pathnames();
|
||||
}
|
||||
|
||||
event_command(EVENT_CMD_AUTOSAVE_INIT);
|
||||
|
||||
event_disk_control_set_eject(false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* event_check_disk_eject:
|
||||
* @control : Handle to disk control handle.
|
||||
@ -334,7 +285,7 @@ static void event_disk_control_set_index(unsigned idx)
|
||||
unsigned num_disks;
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
rarch_system_info_t *info = rarch_system_info_get_ptr();
|
||||
const struct retro_disk_control_callback *control =
|
||||
const struct retro_disk_control_callback *control =
|
||||
info ? (const struct retro_disk_control_callback*)&info->disk_control : NULL;
|
||||
bool error = false;
|
||||
|
||||
@ -377,6 +328,60 @@ static void event_disk_control_set_index(unsigned idx)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* event_disk_control_append_image:
|
||||
* @path : Path to disk image.
|
||||
*
|
||||
* Appends disk image to disk image list.
|
||||
**/
|
||||
void event_disk_control_append_image(const char *path)
|
||||
{
|
||||
unsigned new_idx;
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
struct retro_game_info info = {0};
|
||||
global_t *global = global_get_ptr();
|
||||
rarch_system_info_t *sysinfo = rarch_system_info_get_ptr();
|
||||
const struct retro_disk_control_callback *control =
|
||||
sysinfo ? (const struct retro_disk_control_callback*)&sysinfo->disk_control
|
||||
: NULL;
|
||||
|
||||
if (!control)
|
||||
return;
|
||||
|
||||
event_disk_control_set_eject(true, false);
|
||||
|
||||
control->add_image_index();
|
||||
new_idx = control->get_num_images();
|
||||
if (!new_idx)
|
||||
return;
|
||||
new_idx--;
|
||||
|
||||
info.path = path;
|
||||
control->replace_image_index(new_idx, &info);
|
||||
|
||||
snprintf(msg, sizeof(msg), "%s: ", msg_hash_to_str(MSG_APPENDED_DISK));
|
||||
strlcat(msg, path, sizeof(msg));
|
||||
RARCH_LOG("%s\n", msg);
|
||||
rarch_main_msg_queue_push(msg, 0, 180, true);
|
||||
|
||||
event_command(EVENT_CMD_AUTOSAVE_DEINIT);
|
||||
|
||||
/* TODO: Need to figure out what to do with subsystems case. */
|
||||
if (!*global->subsystem)
|
||||
{
|
||||
/* Update paths for our new image.
|
||||
* If we actually use append_image, we assume that we
|
||||
* started out in a single disk case, and that this way
|
||||
* of doing it makes the most sense. */
|
||||
rarch_set_paths(path);
|
||||
rarch_ctl(RARCH_ACTION_STATE_FILL_PATHNAMES, NULL);
|
||||
}
|
||||
|
||||
event_command(EVENT_CMD_AUTOSAVE_INIT);
|
||||
event_disk_control_set_index(new_idx);
|
||||
event_disk_control_set_eject(false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* event_check_disk_prev:
|
||||
* @control : Handle to disk control handle.
|
||||
@ -514,7 +519,7 @@ static void event_init_controllers(void)
|
||||
{
|
||||
case RETRO_DEVICE_NONE:
|
||||
RARCH_LOG("Disconnecting device from port %u.\n", i + 1);
|
||||
pretro_set_controller_port_device(i, device);
|
||||
core.retro_set_controller_port_device(i, device);
|
||||
break;
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
break;
|
||||
@ -524,7 +529,7 @@ static void event_init_controllers(void)
|
||||
* cores needlessly. */
|
||||
RARCH_LOG("Connecting %s (ID: %u) to port %u.\n", ident,
|
||||
device, i + 1);
|
||||
pretro_set_controller_port_device(i, device);
|
||||
core.retro_set_controller_port_device(i, device);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -533,24 +538,18 @@ static void event_init_controllers(void)
|
||||
static void event_deinit_core(bool reinit)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *info = rarch_system_info_get_ptr();
|
||||
pretro_unload_game();
|
||||
pretro_deinit();
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
/* Unload the achievements from memory. */
|
||||
cheevos_unload();
|
||||
#endif
|
||||
|
||||
core.retro_unload_game();
|
||||
core.retro_deinit();
|
||||
|
||||
if (reinit)
|
||||
event_command(EVENT_CMD_DRIVERS_DEINIT);
|
||||
|
||||
/* per-core saves: restore the original path so the config is not affected */
|
||||
if(settings->sort_savefiles_enable)
|
||||
strlcpy(global->savefile_dir,orig_savefile_dir,sizeof(global->savefile_dir));
|
||||
if(settings->sort_savestates_enable)
|
||||
strlcpy(global->savestate_dir,orig_savestate_dir,sizeof(global->savestate_dir));
|
||||
|
||||
/* restore system directory if it was set to <content dir> */
|
||||
if(settings->system_in_content_dir && !strcmp(info->info.library_name,"No Core"))
|
||||
settings->system_directory[0] = '\0';
|
||||
|
||||
/* auto overrides: reload the original config */
|
||||
if(global->overrides_active)
|
||||
{
|
||||
@ -587,7 +586,7 @@ static bool event_load_save_files(void)
|
||||
|
||||
if (!global)
|
||||
return false;
|
||||
if (!global->savefiles || global->sram_load_disable)
|
||||
if (!global->savefiles || global->sram.load_disable)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < global->savefiles->size; i++)
|
||||
@ -606,14 +605,14 @@ static void event_load_auto_state(void)
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
if (global->netplay_enable && !global->netplay_is_spectate)
|
||||
if (global->netplay.enable && !global->netplay.is_spectate)
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (!settings->savestate_auto_load)
|
||||
return;
|
||||
|
||||
fill_pathname_noext(savestate_name_auto, global->savestate_name,
|
||||
fill_pathname_noext(savestate_name_auto, global->name.savestate,
|
||||
".auto", sizeof(savestate_name_auto));
|
||||
|
||||
if (!path_file_exists(savestate_name_auto))
|
||||
@ -649,12 +648,12 @@ static void event_set_savestate_auto_index(void)
|
||||
* /foo/path/content.state%d, where %d is the largest number available.
|
||||
*/
|
||||
|
||||
fill_pathname_basedir(state_dir, global->savestate_name,
|
||||
fill_pathname_basedir(state_dir, global->name.savestate,
|
||||
sizeof(state_dir));
|
||||
fill_pathname_base(state_base, global->savestate_name,
|
||||
fill_pathname_base(state_base, global->name.savestate,
|
||||
sizeof(state_base));
|
||||
|
||||
if (!(dir_list = dir_list_new_special(state_dir, DIR_LIST_PLAIN)))
|
||||
if (!(dir_list = dir_list_new_special(state_dir, DIR_LIST_PLAIN, NULL)))
|
||||
return;
|
||||
|
||||
for (i = 0; i < dir_list->size; i++)
|
||||
@ -670,7 +669,7 @@ static void event_set_savestate_auto_index(void)
|
||||
continue;
|
||||
|
||||
end = dir_elem + strlen(dir_elem);
|
||||
while ((end > dir_elem) && isdigit(end[-1]))
|
||||
while ((end > dir_elem) && isdigit((int)end[-1]))
|
||||
end--;
|
||||
|
||||
idx = strtoul(end, NULL, 0);
|
||||
@ -690,16 +689,16 @@ static bool event_init_content(void)
|
||||
|
||||
/* No content to be loaded for dummy core,
|
||||
* just successfully exit. */
|
||||
if (global->core_type == CORE_TYPE_DUMMY)
|
||||
if (global->inited.core.type == CORE_TYPE_DUMMY)
|
||||
return true;
|
||||
|
||||
if (!global->libretro_no_content)
|
||||
rarch_fill_pathnames();
|
||||
if (!global->inited.core.no_content)
|
||||
rarch_ctl(RARCH_ACTION_STATE_FILL_PATHNAMES, NULL);
|
||||
|
||||
if (!init_content_file())
|
||||
return false;
|
||||
|
||||
if (global->libretro_no_content)
|
||||
if (global->inited.core.no_content)
|
||||
return true;
|
||||
|
||||
event_set_savestate_auto_index();
|
||||
@ -721,39 +720,33 @@ static bool event_init_core(void)
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
/* per-core saves: save the original path */
|
||||
if(orig_savefile_dir[0] == '\0')
|
||||
strlcpy(orig_savefile_dir,global->savefile_dir,sizeof(orig_savefile_dir));
|
||||
if(orig_savestate_dir[0] == '\0')
|
||||
strlcpy(orig_savestate_dir,global->savestate_dir,sizeof(orig_savestate_dir));
|
||||
|
||||
/* auto overrides: apply overrides */
|
||||
if(settings->auto_overrides_enable)
|
||||
{
|
||||
if (config_load_override())
|
||||
global->overrides_active = true;
|
||||
else
|
||||
global->overrides_active = false;
|
||||
global->overrides_active = false;
|
||||
}
|
||||
|
||||
/* reset video format to libretro's default */
|
||||
video_driver_set_pixel_format(RETRO_PIXEL_FORMAT_0RGB1555);
|
||||
|
||||
pretro_set_environment(rarch_environment_cb);
|
||||
core.retro_set_environment(rarch_environment_cb);
|
||||
|
||||
/* auto-remap: apply remap files */
|
||||
if(settings->auto_remaps_enable)
|
||||
config_load_remap();
|
||||
|
||||
/* per-core saves: reset redirection paths */
|
||||
if((settings->sort_savestates_enable || settings->sort_savefiles_enable) && !global->libretro_no_content)
|
||||
set_paths_redirect(global->basename);
|
||||
if((settings->sort_savestates_enable || settings->sort_savefiles_enable) && !global->inited.core.no_content)
|
||||
set_paths_redirect(global->name.base);
|
||||
|
||||
rarch_verify_api_version();
|
||||
pretro_init();
|
||||
rarch_ctl(RARCH_ACTION_STATE_VERIFY_API_VERSION, NULL);
|
||||
core.retro_init();
|
||||
|
||||
global->use_sram = (global->core_type == CORE_TYPE_PLAIN) &&
|
||||
!global->libretro_no_content;
|
||||
global->sram.use = (global->inited.core.type == CORE_TYPE_PLAIN) &&
|
||||
!global->inited.core.no_content;
|
||||
|
||||
if (!event_init_content())
|
||||
return false;
|
||||
@ -771,12 +764,12 @@ static bool event_save_auto_state(void)
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!settings->savestate_auto_save ||
|
||||
(global->core_type == CORE_TYPE_DUMMY) ||
|
||||
global->libretro_no_content)
|
||||
if (!settings->savestate_auto_save ||
|
||||
(global->inited.core.type == CORE_TYPE_DUMMY) ||
|
||||
global->inited.core.no_content)
|
||||
return false;
|
||||
|
||||
fill_pathname_noext(savestate_name_auto, global->savestate_name,
|
||||
fill_pathname_noext(savestate_name_auto, global->name.savestate,
|
||||
".auto", sizeof(savestate_name_auto));
|
||||
|
||||
ret = save_state(savestate_name_auto);
|
||||
@ -789,11 +782,13 @@ static bool event_save_auto_state(void)
|
||||
static void event_init_remapping(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *path = settings->input.remapping_path;
|
||||
config_file_t *conf = config_file_new(path);
|
||||
|
||||
if (!settings->input.remap_binds_enable)
|
||||
if (!settings->input.remap_binds_enable || !conf)
|
||||
return;
|
||||
|
||||
input_remapping_load_file(settings->input.remapping_path);
|
||||
input_remapping_load_file(conf, path);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -821,8 +816,8 @@ static bool event_save_core_config(void)
|
||||
if (*settings->menu_config_directory)
|
||||
strlcpy(config_dir, settings->menu_config_directory,
|
||||
sizeof(config_dir));
|
||||
else if (*global->config_path) /* Fallback */
|
||||
fill_pathname_basedir(config_dir, global->config_path,
|
||||
else if (*global->path.config) /* Fallback */
|
||||
fill_pathname_basedir(config_dir, global->path.config,
|
||||
sizeof(config_dir));
|
||||
else
|
||||
{
|
||||
@ -882,8 +877,8 @@ static bool event_save_core_config(void)
|
||||
|
||||
if ((ret = config_save_file(config_path)))
|
||||
{
|
||||
strlcpy(global->config_path, config_path,
|
||||
sizeof(global->config_path));
|
||||
strlcpy(global->path.config, config_path,
|
||||
sizeof(global->path.config));
|
||||
snprintf(msg, sizeof(msg), "Saved new config to \"%s\".",
|
||||
config_path);
|
||||
RARCH_LOG("%s\n", msg);
|
||||
@ -900,6 +895,34 @@ static bool event_save_core_config(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* event_save_current_config:
|
||||
*
|
||||
* Saves current configuration file to disk, and (optionally)
|
||||
* autosave state.
|
||||
**/
|
||||
void event_save_current_config(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (settings->config_save_on_exit && *global->path.config)
|
||||
{
|
||||
/* Save last core-specific config to the default config location,
|
||||
* needed on consoles for core switching and reusing last good
|
||||
* config for new cores.
|
||||
*/
|
||||
config_save_file(global->path.config);
|
||||
|
||||
/* Flush out the core specific config. */
|
||||
if (*global->path.core_specific_config &&
|
||||
settings->core_specific_config)
|
||||
config_save_file(global->path.core_specific_config);
|
||||
}
|
||||
|
||||
event_command(EVENT_CMD_AUTOSAVE_STATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* event_save_state
|
||||
* @path : Path to state.
|
||||
@ -964,14 +987,14 @@ static void event_main_state(unsigned cmd)
|
||||
|
||||
if (settings->state_slot > 0)
|
||||
snprintf(path, sizeof(path), "%s%d",
|
||||
global->savestate_name, settings->state_slot);
|
||||
global->name.savestate, settings->state_slot);
|
||||
else if (settings->state_slot < 0)
|
||||
fill_pathname_join_delim(path,
|
||||
global->savestate_name, "auto", '.', sizeof(path));
|
||||
global->name.savestate, "auto", '.', sizeof(path));
|
||||
else
|
||||
strlcpy(path, global->savestate_name, sizeof(path));
|
||||
strlcpy(path, global->name.savestate, sizeof(path));
|
||||
|
||||
if (pretro_serialize_size())
|
||||
if (core.retro_serialize_size())
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
@ -990,6 +1013,7 @@ static void event_main_state(unsigned cmd)
|
||||
RARCH_LOG("%s\n", msg);
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
static bool event_update_system_info(struct retro_system_info *_info,
|
||||
bool *load_no_content)
|
||||
{
|
||||
@ -1003,15 +1027,16 @@ static bool event_update_system_info(struct retro_system_info *_info,
|
||||
libretro_get_system_info(settings->libretro, _info,
|
||||
load_no_content);
|
||||
#endif
|
||||
if (!global->core_info)
|
||||
if (!global->core_info.list)
|
||||
return false;
|
||||
|
||||
if (!core_info_list_get_info(global->core_info,
|
||||
global->core_info_current, settings->libretro))
|
||||
if (!core_info_list_get_info(global->core_info.list,
|
||||
global->core_info.current, settings->libretro))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* event_command:
|
||||
@ -1025,11 +1050,10 @@ bool event_command(enum event_command cmd)
|
||||
{
|
||||
unsigned i = 0;
|
||||
bool boolean = false;
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||
rarch_system_info_t *info = rarch_system_info_get_ptr();
|
||||
|
||||
(void)i;
|
||||
|
||||
@ -1039,15 +1063,15 @@ bool event_command(enum event_command cmd)
|
||||
#ifdef HAVE_DYNAMIC
|
||||
event_command(EVENT_CMD_LOAD_CORE);
|
||||
#endif
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT);
|
||||
rarch_ctl(RARCH_ACTION_STATE_LOAD_CONTENT, NULL);
|
||||
break;
|
||||
#ifdef HAVE_FFMPEG
|
||||
case EVENT_CMD_LOAD_CONTENT_FFMPEG:
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT_FFMPEG);
|
||||
rarch_ctl(RARCH_ACTION_STATE_LOAD_CONTENT_FFMPEG, NULL);
|
||||
break;
|
||||
#endif
|
||||
case EVENT_CMD_LOAD_CONTENT_IMAGEVIEWER:
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT_IMAGEVIEWER);
|
||||
rarch_ctl(RARCH_ACTION_STATE_LOAD_CONTENT_IMAGEVIEWER, NULL);
|
||||
break;
|
||||
case EVENT_CMD_LOAD_CONTENT:
|
||||
#ifdef HAVE_DYNAMIC
|
||||
@ -1056,13 +1080,15 @@ bool event_command(enum event_command cmd)
|
||||
rarch_environment_cb(RETRO_ENVIRONMENT_SET_LIBRETRO_PATH,
|
||||
(void*)settings->libretro);
|
||||
rarch_environment_cb(RETRO_ENVIRONMENT_EXEC,
|
||||
(void*)global->fullpath);
|
||||
(void*)global->path.fullpath);
|
||||
event_command(EVENT_CMD_QUIT);
|
||||
#endif
|
||||
break;
|
||||
case EVENT_CMD_LOAD_CORE_DEINIT:
|
||||
#ifdef HAVE_DYNAMIC
|
||||
#ifdef HAVE_MENU
|
||||
libretro_free_system_info(&global->menu.info);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
case EVENT_CMD_LOAD_CORE_PERSIST:
|
||||
@ -1083,7 +1109,7 @@ bool event_command(enum event_command cmd)
|
||||
#endif
|
||||
break;
|
||||
case EVENT_CMD_LOAD_STATE:
|
||||
/* Immutable - disallow savestate load when
|
||||
/* Immutable - disallow savestate load when
|
||||
* we absolutely cannot change game state. */
|
||||
if (global->bsv.movie)
|
||||
return false;
|
||||
@ -1106,10 +1132,12 @@ bool event_command(enum event_command cmd)
|
||||
global->pending.windowed_scale = 0;
|
||||
break;
|
||||
case EVENT_CMD_MENU_TOGGLE:
|
||||
#ifdef HAVE_MENU
|
||||
if (menu_driver_alive())
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED);
|
||||
rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED, NULL);
|
||||
else
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING);
|
||||
rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING, NULL);
|
||||
#endif
|
||||
break;
|
||||
case EVENT_CMD_CONTROLLERS_INIT:
|
||||
event_init_controllers();
|
||||
@ -1117,7 +1145,11 @@ bool event_command(enum event_command cmd)
|
||||
case EVENT_CMD_RESET:
|
||||
RARCH_LOG("%s.\n", msg_hash_to_str(MSG_RESET));
|
||||
rarch_main_msg_queue_push_new(MSG_RESET, 1, 120, true);
|
||||
pretro_reset();
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
cheevos_globals.cheats_were_enabled = cheevos_globals.cheats_are_enabled;
|
||||
#endif
|
||||
core.retro_reset();
|
||||
|
||||
/* bSNES since v073r01 resets controllers to JOYPAD
|
||||
* after a reset, so just enforce it here. */
|
||||
@ -1129,6 +1161,14 @@ bool event_command(enum event_command cmd)
|
||||
|
||||
event_main_state(cmd);
|
||||
break;
|
||||
case EVENT_CMD_SAVE_STATE_DECREMENT:
|
||||
/* Slot -1 is (auto) slot. */
|
||||
if (settings->state_slot >= 0)
|
||||
settings->state_slot--;
|
||||
break;
|
||||
case EVENT_CMD_SAVE_STATE_INCREMENT:
|
||||
settings->state_slot++;
|
||||
break;
|
||||
case EVENT_CMD_TAKE_SCREENSHOT:
|
||||
if (!take_screenshot())
|
||||
return false;
|
||||
@ -1142,9 +1182,9 @@ bool event_command(enum event_command cmd)
|
||||
#endif
|
||||
rarch_main_data_deinit();
|
||||
|
||||
*global->fullpath = '\0';
|
||||
*global->path.fullpath = '\0';
|
||||
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT);
|
||||
rarch_ctl(RARCH_ACTION_STATE_LOAD_CONTENT, NULL);
|
||||
}
|
||||
break;
|
||||
case EVENT_CMD_UNLOAD_CORE:
|
||||
@ -1152,13 +1192,13 @@ bool event_command(enum event_command cmd)
|
||||
event_command(EVENT_CMD_LOAD_CORE_DEINIT);
|
||||
break;
|
||||
case EVENT_CMD_QUIT:
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_QUIT);
|
||||
rarch_ctl(RARCH_ACTION_STATE_QUIT, NULL);
|
||||
break;
|
||||
case EVENT_CMD_REINIT:
|
||||
{
|
||||
const struct retro_hw_render_callback *hw_render =
|
||||
(const struct retro_hw_render_callback*)video_driver_callback();
|
||||
const input_driver_t *input = driver ?
|
||||
const input_driver_t *input = driver ?
|
||||
(const input_driver_t*)driver->input : NULL;
|
||||
|
||||
driver->video_cache_context = hw_render->cache_context;
|
||||
@ -1170,7 +1210,7 @@ bool event_command(enum event_command cmd)
|
||||
input->poll(driver->input_data);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_display_fb_set_dirty();
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG, NULL);
|
||||
|
||||
if (menu_driver_alive())
|
||||
event_command(EVENT_CMD_VIDEO_SET_BLOCKING_STATE);
|
||||
@ -1189,6 +1229,12 @@ bool event_command(enum event_command cmd)
|
||||
event_command(EVENT_CMD_CHEATS_DEINIT);
|
||||
event_init_cheats();
|
||||
break;
|
||||
case EVENT_CMD_CHEATS_APPLY:
|
||||
if (!global->cheat)
|
||||
break;
|
||||
|
||||
cheat_manager_apply_cheats(global->cheat);
|
||||
break;
|
||||
case EVENT_CMD_REMAPPING_DEINIT:
|
||||
break;
|
||||
case EVENT_CMD_REMAPPING_INIT:
|
||||
@ -1207,7 +1253,8 @@ bool event_command(enum event_command cmd)
|
||||
global->rewind.state = NULL;
|
||||
break;
|
||||
case EVENT_CMD_REWIND_INIT:
|
||||
init_rewind();
|
||||
if (!driver->netplay_data)
|
||||
init_rewind();
|
||||
break;
|
||||
case EVENT_CMD_REWIND_TOGGLE:
|
||||
if (settings->rewind_enable)
|
||||
@ -1334,9 +1381,9 @@ bool event_command(enum event_command cmd)
|
||||
if (!global)
|
||||
break;
|
||||
|
||||
if (global->core_info)
|
||||
core_info_list_free(global->core_info);
|
||||
global->core_info = NULL;
|
||||
if (global->core_info.list)
|
||||
core_info_list_free(global->core_info.list);
|
||||
global->core_info.list = NULL;
|
||||
break;
|
||||
case EVENT_CMD_DATA_RUNLOOP_FREE:
|
||||
rarch_main_data_free();
|
||||
@ -1345,7 +1392,7 @@ bool event_command(enum event_command cmd)
|
||||
event_command(EVENT_CMD_CORE_INFO_DEINIT);
|
||||
|
||||
if (*settings->libretro_directory)
|
||||
global->core_info = core_info_list_new();
|
||||
global->core_info.list = core_info_list_new();
|
||||
break;
|
||||
case EVENT_CMD_CORE_DEINIT:
|
||||
{
|
||||
@ -1402,20 +1449,30 @@ bool event_command(enum event_command cmd)
|
||||
event_command(EVENT_CMD_DRIVERS_INIT);
|
||||
break;
|
||||
case EVENT_CMD_QUIT_RETROARCH:
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_FORCE_QUIT);
|
||||
rarch_ctl(RARCH_ACTION_STATE_FORCE_QUIT, NULL);
|
||||
break;
|
||||
case EVENT_CMD_SHUTDOWN:
|
||||
#if defined(__linux__) && !defined(ANDROID)
|
||||
rarch_main_msg_queue_push("Shutting down...", 1, 180, true);
|
||||
rarch_ctl(RARCH_ACTION_STATE_FORCE_QUIT, NULL);
|
||||
system("shutdown -P now");
|
||||
#endif
|
||||
break;
|
||||
case EVENT_CMD_RESUME:
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED);
|
||||
rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED, NULL);
|
||||
break;
|
||||
case EVENT_CMD_RESTART_RETROARCH:
|
||||
#if defined(GEKKO) && defined(HW_RVL)
|
||||
fill_pathname_join(global->fullpath, g_defaults.core_dir,
|
||||
fill_pathname_join(global->path.fullpath, g_defaults.dir.core,
|
||||
SALAMANDER_FILE,
|
||||
sizeof(global->fullpath));
|
||||
sizeof(global->path.fullpath));
|
||||
#endif
|
||||
if (driver->frontend_ctx && driver->frontend_ctx->set_fork)
|
||||
driver->frontend_ctx->set_fork(true, false);
|
||||
break;
|
||||
case EVENT_CMD_MENU_SAVE_CURRENT_CONFIG:
|
||||
event_save_current_config();
|
||||
break;
|
||||
case EVENT_CMD_MENU_SAVE_CONFIG:
|
||||
if (!event_save_core_config())
|
||||
return false;
|
||||
@ -1426,7 +1483,9 @@ bool event_command(enum event_command cmd)
|
||||
#endif
|
||||
break;
|
||||
case EVENT_CMD_PAUSE_CHECKS:
|
||||
if (runloop->is_paused)
|
||||
rarch_main_ctl(RARCH_MAIN_CTL_IS_PAUSED, &boolean);
|
||||
|
||||
if (boolean)
|
||||
{
|
||||
RARCH_LOG("%s\n", msg_hash_to_str(MSG_PAUSED));
|
||||
event_command(EVENT_CMD_AUDIO_STOP);
|
||||
@ -1441,18 +1500,25 @@ bool event_command(enum event_command cmd)
|
||||
}
|
||||
break;
|
||||
case EVENT_CMD_PAUSE_TOGGLE:
|
||||
runloop->is_paused = !runloop->is_paused;
|
||||
rarch_main_ctl(RARCH_MAIN_CTL_IS_PAUSED, &boolean);
|
||||
boolean = !boolean;
|
||||
rarch_main_ctl(RARCH_MAIN_CTL_SET_PAUSED, &boolean);
|
||||
event_command(EVENT_CMD_PAUSE_CHECKS);
|
||||
break;
|
||||
case EVENT_CMD_UNPAUSE:
|
||||
runloop->is_paused = false;
|
||||
boolean = false;
|
||||
|
||||
rarch_main_ctl(RARCH_MAIN_CTL_SET_PAUSED, &boolean);
|
||||
event_command(EVENT_CMD_PAUSE_CHECKS);
|
||||
break;
|
||||
case EVENT_CMD_PAUSE:
|
||||
runloop->is_paused = true;
|
||||
boolean = true;
|
||||
|
||||
rarch_main_ctl(RARCH_MAIN_CTL_SET_PAUSED, &boolean);
|
||||
event_command(EVENT_CMD_PAUSE_CHECKS);
|
||||
break;
|
||||
case EVENT_CMD_MENU_PAUSE_LIBRETRO:
|
||||
#ifdef HAVE_MENU
|
||||
if (menu_driver_alive())
|
||||
{
|
||||
if (settings->menu.pause_libretro)
|
||||
@ -1465,6 +1531,7 @@ bool event_command(enum event_command cmd)
|
||||
if (settings->menu.pause_libretro)
|
||||
event_command(EVENT_CMD_AUDIO_START);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case EVENT_CMD_SHADER_DIR_DEINIT:
|
||||
if (!global)
|
||||
@ -1480,7 +1547,7 @@ bool event_command(enum event_command cmd)
|
||||
if (!*settings->video.shader_dir)
|
||||
return false;
|
||||
|
||||
global->shader_dir.list = dir_list_new_special(NULL, DIR_LIST_SHADERS);
|
||||
global->shader_dir.list = dir_list_new_special(NULL, DIR_LIST_SHADERS, NULL);
|
||||
|
||||
if (!global->shader_dir.list || global->shader_dir.list->size == 0)
|
||||
{
|
||||
@ -1508,17 +1575,17 @@ bool event_command(enum event_command cmd)
|
||||
global->savefiles = NULL;
|
||||
break;
|
||||
case EVENT_CMD_SAVEFILES_INIT:
|
||||
global->use_sram = global->use_sram && !global->sram_save_disable
|
||||
global->sram.use = global->sram.use && !global->sram.save_disable
|
||||
#ifdef HAVE_NETPLAY
|
||||
&& (!driver->netplay_data || !global->netplay_is_client)
|
||||
&& (!driver->netplay_data || !global->netplay.is_client)
|
||||
#endif
|
||||
;
|
||||
|
||||
if (!global->use_sram)
|
||||
if (!global->sram.use)
|
||||
RARCH_LOG("%s\n",
|
||||
msg_hash_to_str(MSG_SRAM_WILL_NOT_BE_SAVED));
|
||||
|
||||
if (global->use_sram)
|
||||
if (global->sram.use)
|
||||
event_command(EVENT_CMD_AUTOSAVE_INIT);
|
||||
break;
|
||||
case EVENT_CMD_MSG_QUEUE_DEINIT:
|
||||
@ -1577,7 +1644,7 @@ bool event_command(enum event_command cmd)
|
||||
if (!video_driver_has_windowed())
|
||||
return false;
|
||||
|
||||
/* If we go fullscreen we drop all drivers and
|
||||
/* If we go fullscreen we drop all drivers and
|
||||
* reinitialize to be safe. */
|
||||
settings->video.fullscreen = !settings->video.fullscreen;
|
||||
event_command(EVENT_CMD_REINIT);
|
||||
@ -1621,11 +1688,11 @@ bool event_command(enum event_command cmd)
|
||||
global->log_file = NULL;
|
||||
break;
|
||||
case EVENT_CMD_DISK_EJECT_TOGGLE:
|
||||
if (system && system->disk_control.get_num_images)
|
||||
if (info && info->disk_control.get_num_images)
|
||||
{
|
||||
const struct retro_disk_control_callback *control =
|
||||
const struct retro_disk_control_callback *control =
|
||||
(const struct retro_disk_control_callback*)
|
||||
&system->disk_control;
|
||||
&info->disk_control;
|
||||
|
||||
if (control)
|
||||
event_check_disk_eject(control);
|
||||
@ -1636,11 +1703,11 @@ bool event_command(enum event_command cmd)
|
||||
1, 120, true);
|
||||
break;
|
||||
case EVENT_CMD_DISK_NEXT:
|
||||
if (system && system->disk_control.get_num_images)
|
||||
if (info && info->disk_control.get_num_images)
|
||||
{
|
||||
const struct retro_disk_control_callback *control =
|
||||
const struct retro_disk_control_callback *control =
|
||||
(const struct retro_disk_control_callback*)
|
||||
&system->disk_control;
|
||||
&info->disk_control;
|
||||
|
||||
if (!control)
|
||||
return false;
|
||||
@ -1656,11 +1723,11 @@ bool event_command(enum event_command cmd)
|
||||
1, 120, true);
|
||||
break;
|
||||
case EVENT_CMD_DISK_PREV:
|
||||
if (system && system->disk_control.get_num_images)
|
||||
if (info && info->disk_control.get_num_images)
|
||||
{
|
||||
const struct retro_disk_control_callback *control =
|
||||
const struct retro_disk_control_callback *control =
|
||||
(const struct retro_disk_control_callback*)
|
||||
&system->disk_control;
|
||||
&info->disk_control;
|
||||
|
||||
if (!control)
|
||||
return false;
|
||||
@ -1707,6 +1774,9 @@ bool event_command(enum event_command cmd)
|
||||
case EVENT_CMD_VOLUME_DOWN:
|
||||
event_set_volume(-0.5f);
|
||||
break;
|
||||
case EVENT_CMD_SET_FRAME_LIMIT:
|
||||
rarch_main_ctl(RARCH_MAIN_CTL_SET_FRAME_LIMIT_LAST_TIME, NULL);
|
||||
break;
|
||||
case EVENT_CMD_NONE:
|
||||
default:
|
||||
return false;
|
||||
|
@ -41,6 +41,8 @@ enum event_command
|
||||
EVENT_CMD_UNLOAD_CORE,
|
||||
EVENT_CMD_LOAD_STATE,
|
||||
EVENT_CMD_SAVE_STATE,
|
||||
EVENT_CMD_SAVE_STATE_DECREMENT,
|
||||
EVENT_CMD_SAVE_STATE_INCREMENT,
|
||||
/* Takes screenshot. */
|
||||
EVENT_CMD_TAKE_SCREENSHOT,
|
||||
/* Initializes dummy core. */
|
||||
@ -115,6 +117,8 @@ enum event_command
|
||||
EVENT_CMD_RESTART_RETROARCH,
|
||||
/* Force-quit RetroArch. */
|
||||
EVENT_CMD_QUIT_RETROARCH,
|
||||
/* Shutdown the OS */
|
||||
EVENT_CMD_SHUTDOWN,
|
||||
/* Resume RetroArch when in menu. */
|
||||
EVENT_CMD_RESUME,
|
||||
/* Toggles pause. */
|
||||
@ -124,6 +128,7 @@ enum event_command
|
||||
/* Unpauses retroArch. */
|
||||
EVENT_CMD_PAUSE,
|
||||
EVENT_CMD_PAUSE_CHECKS,
|
||||
EVENT_CMD_MENU_SAVE_CURRENT_CONFIG,
|
||||
EVENT_CMD_MENU_SAVE_CONFIG,
|
||||
EVENT_CMD_MENU_PAUSE_LIBRETRO,
|
||||
/* Toggles menu on/off. */
|
||||
@ -149,6 +154,8 @@ enum event_command
|
||||
EVENT_CMD_CHEATS_INIT,
|
||||
/* Deinitializes cheats. */
|
||||
EVENT_CMD_CHEATS_DEINIT,
|
||||
/* Apply cheats. */
|
||||
EVENT_CMD_CHEATS_APPLY,
|
||||
/* Deinitializes network system. */
|
||||
EVENT_CMD_NETWORK_DEINIT,
|
||||
/* Initializes network system. */
|
||||
@ -196,6 +203,7 @@ enum event_command
|
||||
EVENT_CMD_REMAPPING_DEINIT,
|
||||
EVENT_CMD_VOLUME_UP,
|
||||
EVENT_CMD_VOLUME_DOWN,
|
||||
EVENT_CMD_SET_FRAME_LIMIT,
|
||||
EVENT_CMD_DATA_RUNLOOP_FREE
|
||||
};
|
||||
|
||||
|
118
config.def.h
118
config.def.h
@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2015 - Daniel De Matteis
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: 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.
|
||||
@ -26,7 +26,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
enum
|
||||
enum
|
||||
{
|
||||
VIDEO_GL = 0,
|
||||
VIDEO_XVIDEO,
|
||||
@ -37,7 +37,7 @@ enum
|
||||
VIDEO_XENON360,
|
||||
VIDEO_XDK_D3D,
|
||||
VIDEO_PSP1,
|
||||
VIDEO_VITA,
|
||||
VIDEO_VITA2D,
|
||||
VIDEO_CTR,
|
||||
VIDEO_D3D9,
|
||||
VIDEO_VG,
|
||||
@ -66,7 +66,7 @@ enum
|
||||
AUDIO_XENON360,
|
||||
AUDIO_WII,
|
||||
AUDIO_RWEBAUDIO,
|
||||
AUDIO_PSP1,
|
||||
AUDIO_PSP,
|
||||
AUDIO_CTR,
|
||||
AUDIO_NULL,
|
||||
|
||||
@ -124,7 +124,7 @@ enum
|
||||
MENU_RGUI,
|
||||
MENU_RMENU,
|
||||
MENU_RMENU_XUI,
|
||||
MENU_GLUI,
|
||||
MENU_MATERIALUI,
|
||||
MENU_XMB,
|
||||
|
||||
RECORD_FFMPEG,
|
||||
@ -143,8 +143,8 @@ enum
|
||||
#define VIDEO_DEFAULT_DRIVER VIDEO_D3D9
|
||||
#elif defined(HAVE_VG)
|
||||
#define VIDEO_DEFAULT_DRIVER VIDEO_VG
|
||||
#elif defined(SN_TARGET_PSP2)
|
||||
#define VIDEO_DEFAULT_DRIVER VIDEO_VITA
|
||||
#elif defined(HAVE_VITA2D)
|
||||
#define VIDEO_DEFAULT_DRIVER VIDEO_VITA2D
|
||||
#elif defined(PSP)
|
||||
#define VIDEO_DEFAULT_DRIVER VIDEO_PSP1
|
||||
#elif defined(_3DS)
|
||||
@ -167,8 +167,8 @@ enum
|
||||
#define AUDIO_DEFAULT_DRIVER AUDIO_XENON360
|
||||
#elif defined(GEKKO)
|
||||
#define AUDIO_DEFAULT_DRIVER AUDIO_WII
|
||||
#elif defined(PSP)
|
||||
#define AUDIO_DEFAULT_DRIVER AUDIO_PSP1
|
||||
#elif defined(PSP) || defined(VITA)
|
||||
#define AUDIO_DEFAULT_DRIVER AUDIO_PSP
|
||||
#elif defined(_3DS)
|
||||
#define AUDIO_DEFAULT_DRIVER AUDIO_CTR
|
||||
#elif defined(HAVE_ALSA) && defined(HAVE_VIDEOCORE)
|
||||
@ -183,20 +183,20 @@ enum
|
||||
#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(HAVE_DSOUND)
|
||||
#define AUDIO_DEFAULT_DRIVER AUDIO_DSOUND
|
||||
#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_XAUDIO)
|
||||
#define AUDIO_DEFAULT_DRIVER AUDIO_XAUDIO
|
||||
#elif defined(HAVE_RSOUND)
|
||||
#define AUDIO_DEFAULT_DRIVER AUDIO_RSOUND
|
||||
#elif defined(HAVE_ROAR)
|
||||
@ -231,7 +231,7 @@ enum
|
||||
#define INPUT_DEFAULT_DRIVER INPUT_DINPUT
|
||||
#elif defined(__CELLOS_LV2__)
|
||||
#define INPUT_DEFAULT_DRIVER INPUT_PS3
|
||||
#elif (defined(SN_TARGET_PSP2) || defined(PSP))
|
||||
#elif defined(PSP) || defined(VITA)
|
||||
#define INPUT_DEFAULT_DRIVER INPUT_PSP
|
||||
#elif defined(_3DS)
|
||||
#define INPUT_DEFAULT_DRIVER INPUT_CTR
|
||||
@ -265,7 +265,7 @@ enum
|
||||
#define JOYPAD_DEFAULT_DRIVER JOYPAD_GX
|
||||
#elif defined(_XBOX)
|
||||
#define JOYPAD_DEFAULT_DRIVER JOYPAD_XDK
|
||||
#elif defined(PSP)
|
||||
#elif defined(PSP) || defined(VITA)
|
||||
#define JOYPAD_DEFAULT_DRIVER JOYPAD_PSP
|
||||
#elif defined(_3DS)
|
||||
#define JOYPAD_DEFAULT_DRIVER JOYPAD_CTR
|
||||
@ -318,7 +318,9 @@ enum
|
||||
#elif defined(HAVE_RMENU_XUI)
|
||||
#define MENU_DEFAULT_DRIVER MENU_RMENU_XUI
|
||||
#elif defined(IOS) || defined(ANDROID) || defined(__CELLOS_LV2__)
|
||||
#define MENU_DEFAULT_DRIVER MENU_GLUI
|
||||
#define MENU_DEFAULT_DRIVER MENU_MATERIALUI
|
||||
#elif defined(MAC_OS_X_VERSION_10_6)
|
||||
#define MENU_DEFAULT_DRIVER MENU_XMB
|
||||
#else
|
||||
#define MENU_DEFAULT_DRIVER MENU_RGUI
|
||||
#endif
|
||||
@ -337,6 +339,8 @@ 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.
|
||||
*
|
||||
@ -351,6 +355,12 @@ static const bool def_history_list_enable = true;
|
||||
|
||||
static const unsigned int def_user_language = 0;
|
||||
|
||||
#if (defined(__APPLE__) && defined(__MACH__) && defined(OSX)) || (defined(_WIN32) && !defined(_XBOX))
|
||||
static const bool def_mouse_enable = true;
|
||||
#else
|
||||
static const bool def_mouse_enable = false;
|
||||
#endif
|
||||
|
||||
/* VIDEO */
|
||||
|
||||
#if defined(_XBOX360)
|
||||
@ -371,7 +381,7 @@ static const float scale = 3.0;
|
||||
static const bool fullscreen = false;
|
||||
|
||||
/* To use windowed mode or not when going fullscreen. */
|
||||
static const bool windowed_fullscreen = true;
|
||||
static const bool windowed_fullscreen = true;
|
||||
|
||||
/* Which monitor to prefer. 0 is any monitor, 1 and up selects
|
||||
* specific monitors, 1 being the first monitor. */
|
||||
@ -412,8 +422,8 @@ static const unsigned hard_sync_frames = 0;
|
||||
static const unsigned frame_delay = 0;
|
||||
|
||||
/* Inserts a black frame inbetween frames.
|
||||
* Useful for 120 Hz monitors who want to play 60 Hz material with eliminated
|
||||
* ghosting. video_refresh_rate should still be configured as if it
|
||||
* Useful for 120 Hz monitors who want to play 60 Hz material with eliminated
|
||||
* ghosting. video_refresh_rate should still be configured as if it
|
||||
* is a 60 Hz monitor (divide refresh rate by 2).
|
||||
*/
|
||||
static bool black_frame_insertion = false;
|
||||
@ -423,7 +433,7 @@ static bool black_frame_insertion = false;
|
||||
*/
|
||||
static unsigned swap_interval = 1;
|
||||
|
||||
/* Threaded video. Will possibly increase performance significantly
|
||||
/* Threaded video. Will possibly increase performance significantly
|
||||
* at the cost of worse synchronization and latency.
|
||||
*/
|
||||
static const bool video_threaded = false;
|
||||
@ -452,7 +462,7 @@ static const bool video_vfilter = true;
|
||||
static const bool video_smooth = true;
|
||||
|
||||
/* On resize and fullscreen, rendering area will stay 4:3 */
|
||||
static const bool force_aspect = true;
|
||||
static const bool force_aspect = true;
|
||||
|
||||
/* Enable use of shaders. */
|
||||
#ifdef RARCH_CONSOLE
|
||||
@ -495,7 +505,6 @@ static const bool overlay_hide_in_menu = true;
|
||||
#ifdef HAVE_MENU
|
||||
static bool default_block_config_read = true;
|
||||
|
||||
static bool collapse_subgroups_enable = true;
|
||||
static bool show_advanced_settings = true;
|
||||
static const uint32_t menu_entry_normal_color = 0xffffffff;
|
||||
static const uint32_t menu_entry_hover_color = 0xff64ff64;
|
||||
@ -510,6 +519,7 @@ static bool default_core_specific_config = true;
|
||||
static bool default_core_specific_config = false;
|
||||
#endif
|
||||
|
||||
static bool default_game_specific_options = false;
|
||||
static bool default_auto_overrides_enable = false;
|
||||
static bool default_auto_remaps_enable = false;
|
||||
|
||||
@ -544,7 +554,7 @@ static const float font_size = 1.0f;
|
||||
static const float font_size = 32;
|
||||
#endif
|
||||
|
||||
/* Offset for where messages will be placed on-screen.
|
||||
/* Offset for where messages will be placed on-screen.
|
||||
* Values are in range [0.0, 1.0]. */
|
||||
static const float message_pos_offset_x = 0.05;
|
||||
#if defined(_XBOX1)
|
||||
@ -572,21 +582,23 @@ static const bool font_enable = true;
|
||||
|
||||
/* The accurate refresh rate of your monitor (Hz).
|
||||
* This is used to calculate audio input rate with the formula:
|
||||
* audio_input_rate = game_input_rate * display_refresh_rate /
|
||||
* audio_input_rate = game_input_rate * display_refresh_rate /
|
||||
* game_refresh_rate.
|
||||
*
|
||||
* If the implementation does not report any values,
|
||||
* NTSC defaults will be assumed for compatibility.
|
||||
* This value should stay close to 60Hz to avoid large pitch changes.
|
||||
* If your monitor does not run at 60Hz, or something close to it,
|
||||
* If your monitor does not run at 60Hz, or something close to it,
|
||||
* disable VSync, and leave this at its default. */
|
||||
#if defined(RARCH_CONSOLE)
|
||||
static const float refresh_rate = 60/1.001;
|
||||
#ifdef _3DS
|
||||
static const float refresh_rate = (32730.0 * 8192.0) / 4481134.0 ;
|
||||
#elif defined(RARCH_CONSOLE)
|
||||
static const float refresh_rate = 60/1.001;
|
||||
#else
|
||||
static const float refresh_rate = 59.95;
|
||||
static const float refresh_rate = 59.95;
|
||||
#endif
|
||||
|
||||
/* Allow games to set rotation. If false, rotation requests are
|
||||
/* Allow games to set rotation. If false, rotation requests are
|
||||
* honored, but ignored.
|
||||
* Used for setups where one manually rotates the monitor. */
|
||||
static const bool allow_rotate = true;
|
||||
@ -597,12 +609,18 @@ static const bool allow_rotate = true;
|
||||
static const bool audio_enable = true;
|
||||
|
||||
/* Output samplerate. */
|
||||
#ifdef GEKKO
|
||||
static const unsigned out_rate = 32000;
|
||||
#elif defined(_3DS)
|
||||
static const unsigned out_rate = 32730;
|
||||
#else
|
||||
static const unsigned out_rate = 48000;
|
||||
#endif
|
||||
|
||||
/* Audio device (e.g. hw:0,0 or /dev/audio). If NULL, will use defaults. */
|
||||
static const char *audio_device = NULL;
|
||||
|
||||
/* Desired audio latency in milliseconds. Might not be honored
|
||||
/* Desired audio latency in milliseconds. Might not be honored
|
||||
* if driver can't provide given latency. */
|
||||
static const int out_latency = 64;
|
||||
|
||||
@ -616,7 +634,7 @@ static const bool rate_control = true;
|
||||
static const bool rate_control = false;
|
||||
#endif
|
||||
|
||||
/* Rate control delta. Defines how much rate_control
|
||||
/* Rate control delta. Defines how much rate_control
|
||||
* is allowed to adjust input rate. */
|
||||
static const float rate_control_delta = 0.005;
|
||||
|
||||
@ -632,11 +650,11 @@ static const float audio_volume = 0.0;
|
||||
/* Enables displaying the current frames per second. */
|
||||
static const bool fps_show = false;
|
||||
|
||||
/* Enables use of rewind. This will incur some memory footprint
|
||||
/* Enables use of rewind. This will incur some memory footprint
|
||||
* depending on the save state buffer. */
|
||||
static const bool rewind_enable = false;
|
||||
|
||||
/* The buffer size for the rewind buffer. This needs to be about
|
||||
/* The buffer size for the rewind buffer. This needs to be about
|
||||
* 15-20MB per minute. Very game dependant. */
|
||||
static const unsigned rewind_buffer_size = 20 << 20; /* 20MiB */
|
||||
|
||||
@ -644,13 +662,13 @@ static const unsigned rewind_buffer_size = 20 << 20; /* 20MiB */
|
||||
static const unsigned rewind_granularity = 1;
|
||||
|
||||
/* Pause gameplay when gameplay loses focus. */
|
||||
static const bool pause_nonactive = false;
|
||||
static const bool pause_nonactive = true;
|
||||
|
||||
/* Saves non-volatile SRAM at a regular interval.
|
||||
* It is measured in seconds. A value of 0 disables autosave. */
|
||||
static const unsigned autosave_interval = 0;
|
||||
|
||||
/* When being client over netplay, use keybinds for
|
||||
/* When being client over netplay, use keybinds for
|
||||
* user 1 rather than user 2. */
|
||||
static const bool netplay_client_swap_input = true;
|
||||
|
||||
@ -658,15 +676,15 @@ static const bool netplay_client_swap_input = true;
|
||||
* This could potentially lead to buggy games. */
|
||||
static const bool block_sram_overwrite = false;
|
||||
|
||||
/* When saving savestates, state index is automatically
|
||||
/* When saving savestates, state index is automatically
|
||||
* incremented before saving.
|
||||
* When the content is loaded, state index will be set
|
||||
* When the content is loaded, state index will be set
|
||||
* to the highest existing value. */
|
||||
static const bool savestate_auto_index = false;
|
||||
|
||||
/* Automatically saves a savestate at the end of RetroArch's lifetime.
|
||||
* The path is $SRAM_PATH.auto.
|
||||
* RetroArch will automatically load any savestate with this path on
|
||||
* RetroArch will automatically load any savestate with this path on
|
||||
* startup if savestate_auto_load is set. */
|
||||
static const bool savestate_auto_save = false;
|
||||
static const bool savestate_auto_load = false;
|
||||
@ -675,10 +693,7 @@ static const bool savestate_auto_load = false;
|
||||
static const float slowmotion_ratio = 3.0;
|
||||
|
||||
/* Maximum fast forward ratio. */
|
||||
static const float fastforward_ratio = 1.0;
|
||||
|
||||
/* Throttle fast forward. */
|
||||
static const bool fastforward_ratio_throttle_enable = false;
|
||||
static const float fastforward_ratio = 0.0;
|
||||
|
||||
/* Enable stdin/network command interface. */
|
||||
static const bool network_cmd_enable = false;
|
||||
@ -724,7 +739,7 @@ static const unsigned turbo_duty_cycle = 3;
|
||||
* gamepads, plug-and-play style. */
|
||||
static const bool input_autodetect_enable = true;
|
||||
|
||||
/* Show the input descriptors set by the core instead
|
||||
/* Show the input descriptors set by the core instead
|
||||
* of the default ones. */
|
||||
static const bool input_descriptor_label_show = true;
|
||||
|
||||
@ -732,6 +747,12 @@ static const bool input_descriptor_hide_unbound = false;
|
||||
|
||||
static const unsigned input_max_users = 5;
|
||||
|
||||
#ifdef IOS
|
||||
static const bool ui_companion_start_on_boot = false;
|
||||
#else
|
||||
static const bool ui_companion_start_on_boot = true;
|
||||
#endif
|
||||
|
||||
#if defined(ANDROID)
|
||||
#if defined(ANDROID_ARM)
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/android/latest/armeabi-v7a/";
|
||||
@ -741,14 +762,14 @@ static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/androi
|
||||
static char buildbot_server_url[] = "";
|
||||
#endif
|
||||
#elif defined(IOS)
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/ios/latest/";
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/apple/ios/latest/";
|
||||
#elif defined(OSX)
|
||||
#if defined(__x86_64__)
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/osx-x86_64/latest/";
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/apple/osx/x86_64/latest/";
|
||||
#elif defined(__i386__) || defined(__i486__) || defined(__i686__)
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/osx-i386/latest/";
|
||||
static char buildbot_server_url[] = "http://bot.libretro.com/nightly/apple/osx/x86/latest/";
|
||||
#else
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/osx-ppc/latest/";
|
||||
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/apple/osx/ppc/latest/";
|
||||
#endif
|
||||
#elif defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(__x86_64__)
|
||||
@ -759,6 +780,8 @@ static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/win-x8
|
||||
#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/";
|
||||
#else
|
||||
static char buildbot_server_url[] = "";
|
||||
#endif
|
||||
@ -869,4 +892,3 @@ static const struct retro_keybind retro_keybinds_rest[] = {
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
670
configuration.c
670
configuration.c
File diff suppressed because it is too large
Load Diff
@ -14,8 +14,8 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __RARCH_SETTINGS_H__
|
||||
#define __RARCH_SETTINGS_H__
|
||||
#ifndef __RARCH_CONFIGURATION_H__
|
||||
#define __RARCH_CONFIGURATION_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
@ -33,6 +33,11 @@ extern "C" {
|
||||
|
||||
typedef struct settings
|
||||
{
|
||||
video_viewport_t video_viewport_custom;
|
||||
|
||||
char playlist_names[PATH_MAX_LENGTH];
|
||||
char playlist_cores[PATH_MAX_LENGTH];
|
||||
|
||||
struct
|
||||
{
|
||||
char driver[32];
|
||||
@ -130,8 +135,7 @@ typedef struct settings
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool horizontal_enable;
|
||||
bool vertical_enable;
|
||||
bool enable;
|
||||
bool setting_enable;
|
||||
} wraparound;
|
||||
struct
|
||||
@ -149,11 +153,7 @@ typedef struct settings
|
||||
unsigned override_value;
|
||||
} dpi;
|
||||
|
||||
bool collapse_subgroups_enable;
|
||||
bool show_advanced_settings;
|
||||
#ifdef HAVE_THREADS
|
||||
bool threaded_data_runloop_enable;
|
||||
#endif
|
||||
|
||||
unsigned entry_normal_color;
|
||||
unsigned entry_hover_color;
|
||||
@ -161,6 +161,10 @@ typedef struct settings
|
||||
} menu;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
bool threaded_data_runloop_enable;
|
||||
#endif
|
||||
|
||||
struct
|
||||
{
|
||||
char driver[32];
|
||||
@ -239,7 +243,6 @@ typedef struct settings
|
||||
float overlay_scale;
|
||||
|
||||
char autoconfig_dir[PATH_MAX_LENGTH];
|
||||
bool autoconfig_descriptor_label_show;
|
||||
bool input_descriptor_label_show;
|
||||
bool input_descriptor_hide_unbound;
|
||||
|
||||
@ -247,6 +250,12 @@ typedef struct settings
|
||||
|
||||
unsigned menu_toggle_gamepad_combo;
|
||||
bool back_as_menu_toggle_enable;
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
bool small_keyboard_enable;
|
||||
#endif
|
||||
bool keyboard_gamepad_enable;
|
||||
unsigned keyboard_gamepad_mapping_type;
|
||||
} input;
|
||||
|
||||
struct
|
||||
@ -280,6 +289,16 @@ typedef struct settings
|
||||
bool builtin_imageviewer_enable;
|
||||
} multimedia;
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
struct
|
||||
{
|
||||
bool enable;
|
||||
bool test_unofficial;
|
||||
char username[32];
|
||||
char password[32];
|
||||
} cheevos;
|
||||
#endif
|
||||
|
||||
int state_slot;
|
||||
|
||||
bool bundle_assets_extract_enable;
|
||||
@ -300,12 +319,12 @@ typedef struct settings
|
||||
char cheat_settings_path[PATH_MAX_LENGTH];
|
||||
char input_remapping_directory[PATH_MAX_LENGTH];
|
||||
|
||||
char overlay_directory[PATH_MAX_LENGTH];
|
||||
char resampler_directory[PATH_MAX_LENGTH];
|
||||
char screenshot_directory[PATH_MAX_LENGTH];
|
||||
char system_directory[PATH_MAX_LENGTH];
|
||||
bool system_in_content_dir;
|
||||
|
||||
char extraction_directory[PATH_MAX_LENGTH];
|
||||
char cache_directory[PATH_MAX_LENGTH];
|
||||
char playlist_directory[PATH_MAX_LENGTH];
|
||||
|
||||
bool history_list_enable;
|
||||
@ -315,7 +334,6 @@ typedef struct settings
|
||||
|
||||
float slowmotion_ratio;
|
||||
float fastforward_ratio;
|
||||
bool fastforward_ratio_throttle_enable;
|
||||
|
||||
bool pause_nonactive;
|
||||
unsigned autosave_interval;
|
||||
@ -328,6 +346,7 @@ typedef struct settings
|
||||
bool network_cmd_enable;
|
||||
unsigned network_cmd_port;
|
||||
bool stdin_cmd_enable;
|
||||
bool debug_panel_enable;
|
||||
|
||||
char core_assets_directory[PATH_MAX_LENGTH];
|
||||
char assets_directory[PATH_MAX_LENGTH];
|
||||
@ -342,6 +361,7 @@ typedef struct settings
|
||||
bool load_dummy_on_core_shutdown;
|
||||
|
||||
bool core_specific_config;
|
||||
bool game_specific_options;
|
||||
bool auto_overrides_enable;
|
||||
bool auto_remaps_enable;
|
||||
|
||||
|
79
content.c
79
content.c
@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2015 - Daniel De Matteis
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: 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.
|
||||
@ -33,6 +33,8 @@
|
||||
#include <compat/strl.h>
|
||||
#include <file/file_path.h>
|
||||
#include <file/file_extract.h>
|
||||
#include <retro_file.h>
|
||||
#include <retro_stat.h>
|
||||
|
||||
#include "msg_hash.h"
|
||||
#include "content.h"
|
||||
@ -43,6 +45,10 @@
|
||||
#include "patch.h"
|
||||
#include "system.h"
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
#include "cheevos.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* read_content_file:
|
||||
* @path : buffer of the content file.
|
||||
@ -73,9 +79,9 @@ static bool read_content_file(unsigned i, const char *path, void **buf,
|
||||
return true;
|
||||
|
||||
/* Attempt to apply a patch. */
|
||||
if (!global->block_patch)
|
||||
if (!global->patch.block_patch)
|
||||
patch_content(&ret_buf, length);
|
||||
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
global->content_crc = zlib_crc32_calculate(ret_buf, *length);
|
||||
|
||||
@ -118,7 +124,7 @@ static void dump_to_file_desperate(const void *data,
|
||||
strftime(timebuf, sizeof(timebuf), "%Y-%m-%d-%H-%M-%S", localtime(&time_));
|
||||
strlcat(path, timebuf, sizeof(path));
|
||||
|
||||
if (write_file(path, data, size))
|
||||
if (retro_write_file(path, data, size))
|
||||
RARCH_WARN("Succeeded in saving RAM data to \"%s\".\n", path);
|
||||
else
|
||||
goto error;
|
||||
@ -148,7 +154,7 @@ bool save_state(const char *path)
|
||||
{
|
||||
bool ret = false;
|
||||
void *data = NULL;
|
||||
size_t size = pretro_serialize_size();
|
||||
size_t size = core.retro_serialize_size();
|
||||
|
||||
RARCH_LOG("%s: \"%s\".\n",
|
||||
msg_hash_to_str(MSG_SAVING_STATE),
|
||||
@ -162,17 +168,17 @@ bool save_state(const char *path)
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
RARCH_LOG("%s: %d %s.\n",
|
||||
RARCH_LOG("%s: %d %s.\n",
|
||||
msg_hash_to_str(MSG_STATE_SIZE),
|
||||
(int)size,
|
||||
msg_hash_to_str(MSG_BYTES));
|
||||
ret = pretro_serialize(data, size);
|
||||
ret = core.retro_serialize(data, size);
|
||||
|
||||
if (ret)
|
||||
ret = write_file(path, data, size);
|
||||
ret = retro_write_file(path, data, size);
|
||||
|
||||
if (!ret)
|
||||
RARCH_ERR("%s \"%s\".\n",
|
||||
RARCH_ERR("%s \"%s\".\n",
|
||||
msg_hash_to_str(MSG_FAILED_TO_SAVE_STATE_TO),
|
||||
path);
|
||||
|
||||
@ -234,7 +240,7 @@ bool load_state(const char *path)
|
||||
}
|
||||
|
||||
for (i = 0; i < num_blocks; i++)
|
||||
blocks[i].size = pretro_get_memory_size(blocks[i].type);
|
||||
blocks[i].size = core.retro_get_memory_size(blocks[i].type);
|
||||
|
||||
for (i = 0; i < num_blocks; i++)
|
||||
if (blocks[i].size)
|
||||
@ -245,20 +251,20 @@ bool load_state(const char *path)
|
||||
{
|
||||
if (blocks[i].data)
|
||||
{
|
||||
const void *ptr = pretro_get_memory_data(blocks[i].type);
|
||||
const void *ptr = core.retro_get_memory_data(blocks[i].type);
|
||||
if (ptr)
|
||||
memcpy(blocks[i].data, ptr, blocks[i].size);
|
||||
}
|
||||
}
|
||||
|
||||
ret = pretro_unserialize(buf, size);
|
||||
ret = core.retro_unserialize(buf, size);
|
||||
|
||||
/* Flush back. */
|
||||
for (i = 0; i < num_blocks; i++)
|
||||
{
|
||||
if (blocks[i].data)
|
||||
{
|
||||
void *ptr = pretro_get_memory_data(blocks[i].type);
|
||||
void *ptr = core.retro_get_memory_data(blocks[i].type);
|
||||
if (ptr)
|
||||
memcpy(ptr, blocks[i].data, blocks[i].size);
|
||||
}
|
||||
@ -283,8 +289,8 @@ void load_ram_file(const char *path, int type)
|
||||
ssize_t rc;
|
||||
bool ret = false;
|
||||
void *buf = NULL;
|
||||
size_t size = pretro_get_memory_size(type);
|
||||
void *data = pretro_get_memory_data(type);
|
||||
size_t size = core.retro_get_memory_size(type);
|
||||
void *data = core.retro_get_memory_data(type);
|
||||
|
||||
if (size == 0 || !data)
|
||||
return;
|
||||
@ -324,15 +330,15 @@ void load_ram_file(const char *path, int type)
|
||||
*/
|
||||
void save_ram_file(const char *path, int type)
|
||||
{
|
||||
size_t size = pretro_get_memory_size(type);
|
||||
void *data = pretro_get_memory_data(type);
|
||||
size_t size = core.retro_get_memory_size(type);
|
||||
void *data = core.retro_get_memory_data(type);
|
||||
|
||||
if (!data)
|
||||
return;
|
||||
if (size <= 0)
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
if (!write_file(path, data, size))
|
||||
if (!retro_write_file(path, data, size))
|
||||
{
|
||||
RARCH_ERR("%s.\n",
|
||||
msg_hash_to_str(MSG_FAILED_TO_SAVE_SRAM));
|
||||
@ -401,15 +407,15 @@ static bool load_content_need_fullpath(
|
||||
RARCH_LOG("Compressed file in case of need_fullpath."
|
||||
"Now extracting to temporary directory.\n");
|
||||
|
||||
strlcpy(new_basedir, settings->extraction_directory,
|
||||
strlcpy(new_basedir, settings->cache_directory,
|
||||
sizeof(new_basedir));
|
||||
|
||||
if ((!strcmp(new_basedir, "")) ||
|
||||
!path_is_directory(new_basedir))
|
||||
{
|
||||
RARCH_WARN("Tried extracting to extraction directory, but "
|
||||
"extraction directory was not set or found. "
|
||||
"Setting extraction directory to directory "
|
||||
RARCH_WARN("Tried extracting to cache directory, but "
|
||||
"cache directory was not set or found. "
|
||||
"Setting cache directory to directory "
|
||||
"derived by basename...\n");
|
||||
fill_pathname_basedir(new_basedir, path,
|
||||
sizeof(new_basedir));
|
||||
@ -438,7 +444,7 @@ static bool load_content_need_fullpath(
|
||||
* The following part takes care of cleanup of the unzipped files
|
||||
* after exit.
|
||||
*/
|
||||
rarch_assert(global->temporary_content != NULL);
|
||||
retro_assert(global->temporary_content != NULL);
|
||||
string_list_append(global->temporary_content,
|
||||
new_path, attributes);
|
||||
|
||||
@ -449,7 +455,7 @@ static bool load_content_need_fullpath(
|
||||
/**
|
||||
* load_content:
|
||||
* @special : subsystem of content to be loaded. Can be NULL.
|
||||
* content :
|
||||
* content :
|
||||
*
|
||||
* Load content file (for libretro core).
|
||||
*
|
||||
@ -485,7 +491,7 @@ static bool load_content(const struct retro_subsystem_info *special,
|
||||
}
|
||||
|
||||
info[i].path = NULL;
|
||||
|
||||
|
||||
if (*path)
|
||||
info[i].path = path;
|
||||
|
||||
@ -506,9 +512,18 @@ static bool load_content(const struct retro_subsystem_info *special,
|
||||
}
|
||||
|
||||
if (special)
|
||||
ret = pretro_load_game_special(special->id, info, content->size);
|
||||
ret = core.retro_load_game_special(special->id, info, content->size);
|
||||
else
|
||||
ret = pretro_load_game(*content->elems[0].data ? info : NULL);
|
||||
{
|
||||
ret = core.retro_load_game(*content->elems[0].data ? info : NULL);
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
/* Load the achievements into memory if the game has content. */
|
||||
|
||||
cheevos_globals.cheats_were_enabled = cheevos_globals.cheats_are_enabled;
|
||||
cheevos_load(*content->elems[0].data ? info : NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
RARCH_ERR("%s.\n", msg_hash_to_str(MSG_FAILED_TO_LOAD_CONTENT));
|
||||
@ -610,7 +625,7 @@ bool init_content_file(void)
|
||||
attr.i |= system->info.need_fullpath << 1;
|
||||
attr.i |= (!system->no_content) << 2;
|
||||
string_list_append(content,
|
||||
(global->libretro_no_content && settings->core.set_supports_no_game_enable) ? "" : global->fullpath, attr);
|
||||
(global->inited.core.no_content && settings->core.set_supports_no_game_enable) ? "" : global->path.fullpath, attr);
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
@ -637,8 +652,8 @@ bool init_content_file(void)
|
||||
|
||||
if (!zlib_extract_first_content_file(temporary_content,
|
||||
sizeof(temporary_content), valid_ext,
|
||||
*settings->extraction_directory ?
|
||||
settings->extraction_directory : NULL))
|
||||
*settings->cache_directory ?
|
||||
settings->cache_directory : NULL))
|
||||
{
|
||||
RARCH_ERR("Failed to extract content from zipped file: %s.\n",
|
||||
temporary_content);
|
||||
@ -655,7 +670,7 @@ bool init_content_file(void)
|
||||
ret = load_content(special, content);
|
||||
|
||||
error:
|
||||
global->content_is_init = (ret) ? true : false;
|
||||
global->inited.content = (ret) ? true : false;
|
||||
|
||||
if (content)
|
||||
string_list_free(content);
|
||||
|
25
core_info.c
25
core_info.c
@ -15,11 +15,10 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "core_info.h"
|
||||
#include "general.h"
|
||||
#include <file/file_path.h>
|
||||
#include "file_ext.h"
|
||||
#include <file/file_extract.h>
|
||||
|
||||
#include "general.h"
|
||||
#include "dir_list_special.h"
|
||||
#include "config.def.h"
|
||||
|
||||
@ -108,7 +107,7 @@ void core_info_get_name(const char *path, char *s, size_t len)
|
||||
core_info_t *core_info = NULL;
|
||||
core_info_list_t *core_info_list = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct string_list *contents = dir_list_new_special(NULL, DIR_LIST_CORES);
|
||||
struct string_list *contents = dir_list_new_special(NULL, DIR_LIST_CORES, NULL);
|
||||
|
||||
if (!contents)
|
||||
return;
|
||||
@ -175,7 +174,7 @@ core_info_list_t *core_info_list_new(void)
|
||||
core_info_t *core_info = NULL;
|
||||
core_info_list_t *core_info_list = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct string_list *contents = dir_list_new_special(NULL, DIR_LIST_CORES);
|
||||
struct string_list *contents = dir_list_new_special(NULL, DIR_LIST_CORES, NULL);
|
||||
|
||||
if (!contents)
|
||||
return NULL;
|
||||
@ -461,11 +460,13 @@ bool core_info_does_support_file(const core_info_t *core, const char *path)
|
||||
core->supported_extensions_list, ".", path_get_extension(path));
|
||||
}
|
||||
|
||||
const char *core_info_list_get_all_extensions(core_info_list_t *core_info_list)
|
||||
const char *core_info_list_get_all_extensions(void)
|
||||
{
|
||||
if (!core_info_list)
|
||||
return "";
|
||||
return core_info_list->all_ext;
|
||||
global_t *global = global_get_ptr();
|
||||
core_info_list_t *list = (global->core_info.list) ? global->core_info.list : NULL;
|
||||
if (!list)
|
||||
return NULL;
|
||||
return list->all_ext;
|
||||
}
|
||||
|
||||
/* qsort_r() is not in standard C, sadly. */
|
||||
@ -537,7 +538,7 @@ void core_info_list_get_supported_cores(core_info_list_t *core_info_list,
|
||||
*num_infos = supported;
|
||||
}
|
||||
|
||||
static core_info_t *find_core_info(core_info_list_t *list,
|
||||
core_info_t *core_info_find(core_info_list_t *list,
|
||||
const char *core)
|
||||
{
|
||||
size_t i;
|
||||
@ -578,7 +579,7 @@ void core_info_list_update_missing_firmware(core_info_list_t *core_info_list,
|
||||
if (!core_info_list || !core)
|
||||
return;
|
||||
|
||||
if (!(info = find_core_info(core_info_list, core)))
|
||||
if (!(info = core_info_find(core_info_list, core)))
|
||||
return;
|
||||
|
||||
for (i = 0; i < info->firmware_count; i++)
|
||||
@ -606,7 +607,7 @@ void core_info_list_get_missing_firmware(core_info_list_t *core_info_list,
|
||||
*firmware = NULL;
|
||||
*num_firmware = 0;
|
||||
|
||||
if (!(info = find_core_info(core_info_list, core)))
|
||||
if (!(info = core_info_find(core_info_list, core)))
|
||||
return;
|
||||
|
||||
*firmware = info->firmware;
|
||||
|
@ -99,7 +99,10 @@ void core_info_list_update_missing_firmware(core_info_list_t *list,
|
||||
bool core_info_list_get_info(core_info_list_t *list,
|
||||
core_info_t *info, const char *path);
|
||||
|
||||
const char *core_info_list_get_all_extensions(core_info_list_t *list);
|
||||
const char *core_info_list_get_all_extensions(void);
|
||||
|
||||
core_info_t *core_info_find(core_info_list_t *list,
|
||||
const char *core);
|
||||
|
||||
bool core_info_list_get_display_name(core_info_list_t *list,
|
||||
const char *path, char *buf, size_t size);
|
||||
|
@ -14,14 +14,16 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "core_options.h"
|
||||
#include <string.h>
|
||||
|
||||
#include <file/config_file.h>
|
||||
#include <file/dir_list.h>
|
||||
#include <compat/posix_string.h>
|
||||
#include <compat/strl.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "core_options.h"
|
||||
|
||||
struct core_option
|
||||
{
|
||||
char *desc;
|
||||
@ -90,7 +92,6 @@ void core_option_get(core_option_manager_t *opt, struct retro_variable *var)
|
||||
static bool parse_variable(core_option_manager_t *opt, size_t idx,
|
||||
const struct retro_variable *var)
|
||||
{
|
||||
size_t i;
|
||||
const char *val_start = NULL;
|
||||
char *value = NULL;
|
||||
char *desc_end = NULL;
|
||||
@ -124,6 +125,8 @@ static bool parse_variable(core_option_manager_t *opt, size_t idx,
|
||||
|
||||
if (config_get_string(opt->conf, option->key, &config_val))
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < option->vals->size; i++)
|
||||
{
|
||||
if (!strcmp(option->vals->elems[i].data, config_val))
|
||||
@ -234,6 +237,30 @@ bool core_option_flush(core_option_manager_t *opt)
|
||||
return config_file_write(opt->conf, opt->conf_path);
|
||||
}
|
||||
|
||||
/**
|
||||
* core_option_flush_game_specific:
|
||||
* @opt : options manager handle
|
||||
* @path : path for the core options file
|
||||
*
|
||||
* Writes core option key-pair values to a custom file.
|
||||
*
|
||||
* Returns: true (1) if core option values could be
|
||||
* successfully saved to disk, otherwise false (0).
|
||||
**/
|
||||
bool core_option_flush_game_specific(core_option_manager_t *opt, char* path)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < opt->size; i++)
|
||||
{
|
||||
struct core_option *option = (struct core_option*)&opt->opts[i];
|
||||
|
||||
if (option)
|
||||
config_set_string(opt->conf, option->key, core_option_get_val(opt, i));
|
||||
}
|
||||
|
||||
return config_file_write(opt->conf, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* core_option_size:
|
||||
* @opt : options manager handle
|
||||
|
@ -62,6 +62,18 @@ bool core_option_updated(core_option_manager_t *opt);
|
||||
**/
|
||||
bool core_option_flush(core_option_manager_t *opt);
|
||||
|
||||
/**
|
||||
* core_option_flush_game_specific:
|
||||
* @opt : options manager handle
|
||||
* @path : path for the core options file
|
||||
*
|
||||
* Writes core option key-pair values to a custom file.
|
||||
*
|
||||
* Returns: true (1) if core option values could be
|
||||
* successfully saved to disk, otherwise false (0).
|
||||
**/
|
||||
bool core_option_flush_game_specific(core_option_manager_t *opt, char* path);
|
||||
|
||||
/**
|
||||
* core_option_free:
|
||||
* @opt : options manager handle
|
||||
|
@ -15,11 +15,13 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../libretro.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "internal_cores.h"
|
||||
#include "../libretro.h"
|
||||
|
||||
static uint16_t *frame_buf;
|
||||
|
||||
void libretro_dummy_retro_init(void)
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
@ -16,9 +17,10 @@
|
||||
#define STBI_SUPPORT_ZLIB
|
||||
#endif
|
||||
|
||||
#include "stb_image.h"
|
||||
#include "../deps/stb/stb_image.h"
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#include "internal_cores.h"
|
||||
#include "../libretro.h"
|
||||
#define IMAGE_CORE_PREFIX(s) libretro_imageviewer_##s
|
||||
#else
|
||||
|
2188
cores/libretro-ffmpeg/Makefile
Normal file
2188
cores/libretro-ffmpeg/Makefile
Normal file
File diff suppressed because it is too large
Load Diff
@ -35,14 +35,18 @@ extern "C" {
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#include "libretro.h"
|
||||
#ifdef RARCH_INTERNAL
|
||||
#include "../libretro.h"
|
||||
#include "internal_cores.h"
|
||||
#define CORE_PREFIX(s) libretro_ffmpeg_##s
|
||||
#else
|
||||
#include "libretro.h"
|
||||
#define CORE_PREFIX(s) s
|
||||
#endif
|
||||
|
||||
#ifndef PIX_FMT_RGB32
|
||||
#define PIX_FMT_RGB32 AV_PIX_FMT_RGB32
|
||||
#endif
|
||||
|
||||
static bool reset_triggered;
|
||||
static void fallback_log(enum retro_log_level level, const char *fmt, ...)
|
||||
{
|
||||
@ -305,10 +309,14 @@ void CORE_PREFIX(retro_reset)(void)
|
||||
|
||||
static void check_variables(void)
|
||||
{
|
||||
struct retro_variable color_var, var, fft_var, fft_ms_var;
|
||||
|
||||
(void)var;
|
||||
(void)fft_var;
|
||||
struct retro_variable color_var = {0};
|
||||
#ifdef HAVE_OPENGL
|
||||
struct retro_variable var = {0};
|
||||
#endif
|
||||
#ifdef HAVE_GL_FFT
|
||||
struct retro_variable fft_var = {0};
|
||||
struct retro_variable fft_ms_var = {0};
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
var.key = "ffmpeg_temporal_interp";
|
||||
@ -760,7 +768,7 @@ static bool codec_id_is_ttf(enum AVCodecID id)
|
||||
switch (id)
|
||||
{
|
||||
#ifdef OLD_FFMPEG_API
|
||||
case CODEC_ID_TTF;
|
||||
case CODEC_ID_TTF:
|
||||
#else
|
||||
case AV_CODEC_ID_TTF:
|
||||
#endif
|
||||
@ -1157,7 +1165,7 @@ static void decode_thread(void *data)
|
||||
AVCodecContext *actx_active;
|
||||
AVCodecContext *sctx_active;
|
||||
#ifdef HAVE_SSA
|
||||
ASS_Track *ass_track_active
|
||||
ASS_Track *ass_track_active;
|
||||
#endif
|
||||
|
||||
slock_lock(fifo_lock);
|
1
cores/libretro-ffmpeg/internal_cores.h
Normal file
1
cores/libretro-ffmpeg/internal_cores.h
Normal file
@ -0,0 +1 @@
|
||||
#include "../internal_cores.h"
|
1
cores/libretro-ffmpeg/libretro.h
Normal file
1
cores/libretro-ffmpeg/libretro.h
Normal file
@ -0,0 +1 @@
|
||||
#include "../../libretro.h"
|
5
cores/libretro-ffmpeg/link.T
Normal file
5
cores/libretro-ffmpeg/link.T
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
global: retro_*;
|
||||
local: *;
|
||||
};
|
||||
|
@ -1,3 +1,6 @@
|
||||
ifneq ($(EMSCRIPTEN),)
|
||||
platform = emscripten
|
||||
endif
|
||||
|
||||
ifeq ($(platform),)
|
||||
platform = unix
|
||||
@ -38,7 +41,7 @@ ifeq ($(platform), unix)
|
||||
fpic := -fPIC
|
||||
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
||||
GL_LIB := -lGL
|
||||
else ifeq ($(platform), osx)
|
||||
else ifneq (,$(findstring osx,$(platform)))
|
||||
TARGET := $(TARGET_NAME)_libretro.dylib
|
||||
fpic := -fPIC
|
||||
SHARED := -dynamiclib
|
||||
@ -49,9 +52,7 @@ else ifeq ($(platform), osx)
|
||||
endif
|
||||
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
|
||||
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
|
||||
ifeq ($(OSX_LT_MAVERICKS),"YES")
|
||||
fpic += -mmacosx-version-min=10.5
|
||||
endif
|
||||
fpic += -mmacosx-version-min=10.1
|
||||
else ifeq ($(platform), pi)
|
||||
TARGET := $(TARGET_NAME)_libretro.so
|
||||
fpic := -fPIC
|
||||
@ -59,15 +60,27 @@ else ifeq ($(platform), pi)
|
||||
CFLAGS += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/vmcs_host/linux
|
||||
GLES := 1
|
||||
LIBS += -L/opt/vc/lib
|
||||
else ifeq ($(platform), ios)
|
||||
else ifneq (,$(findstring ios,$(platform)))
|
||||
TARGET := $(TARGET_NAME)_libretro_ios.dylib
|
||||
fpic := -fPIC
|
||||
SHARED := -dynamiclib
|
||||
|
||||
ifeq ($(IOSSDK),)
|
||||
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
|
||||
endif
|
||||
|
||||
GL_LIB := -framework OpenGLES
|
||||
DEFINES := -DIOS
|
||||
CFLAGS += -DGLES $(DEFINES)
|
||||
CC = clang -arch armv7 -isysroot $(IOSSDK)
|
||||
else ifeq ($(platform), qnx)
|
||||
CC = cc -arch armv7 -isysroot $(IOSSDK)
|
||||
ifeq ($(platform),ios9)
|
||||
CC += -miphoneos-version-min=8.0
|
||||
CFLAGS += -miphoneos-version-min=8.0
|
||||
else
|
||||
CC += -miphoneos-version-min=5.0
|
||||
CFLAGS += -miphoneos-version-min=5.0
|
||||
endif
|
||||
else ifneq (,$(findstring qnx,$(platform)))
|
||||
TARGET := $(TARGET_NAME)_libretro_qnx.so
|
||||
fpic := -fPIC
|
||||
SHARED := -shared -Wl,--version-script=link.T
|
||||
@ -77,6 +90,7 @@ else ifeq ($(platform), qnx)
|
||||
AR = qcc -Vgcc_ntoarmv7le
|
||||
CFLAGS += -DGLES
|
||||
GL_LIB := -lGLESv2
|
||||
GLES := 1
|
||||
else ifneq (,$(findstring armv,$(platform)))
|
||||
CC = gcc
|
||||
TARGET := $(TARGET_NAME)_libretro.so
|
||||
@ -103,6 +117,9 @@ else ifneq (,$(findstring hardfloat,$(platform)))
|
||||
CFLAGS += -mfloat-abi=hard
|
||||
endif
|
||||
CFLAGS += -DARM
|
||||
# emscripten
|
||||
else ifeq ($(platform), emscripten)
|
||||
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
|
||||
else
|
||||
CC = gcc
|
||||
TARGET := $(TARGET_NAME)_libretro.dll
|
||||
@ -117,10 +134,10 @@ else
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
ifeq ($(platform), qnx)
|
||||
CFLAGS += -Wc,-std=gnu99
|
||||
ifneq (,$(findstring qnx,$(platform)))
|
||||
CFLAGS += -Wc,-std=c99
|
||||
else
|
||||
CFLAGS += -std=gnu99
|
||||
CFLAGS += -std=gnu99
|
||||
endif
|
||||
|
||||
OBJECTS := libretro-test.o ../../libretro-common/glsym/rglgen.o
|
||||
|
@ -1,15 +1,16 @@
|
||||
#include "../../libretro.h"
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <glsym/glsym.h>
|
||||
|
||||
#include "../../libretro.h"
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
static struct retro_hw_render_callback hw_render;
|
||||
|
||||
#include <glsym/glsym.h>
|
||||
|
||||
#if defined(HAVE_PSGL)
|
||||
#define RARCH_GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
|
||||
#define RARCH_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES
|
||||
@ -50,16 +51,6 @@ static GLuint fbo;
|
||||
static GLuint rbo_color, rbo_depth_stencil;
|
||||
#endif
|
||||
|
||||
static const GLfloat vertex_data[] = {
|
||||
-0.5, -0.5,
|
||||
0.5, -0.5,
|
||||
-0.5, 0.5,
|
||||
0.5, 0.5,
|
||||
1.0, 1.0, 1.0, 1.0,
|
||||
1.0, 1.0, 0.0, 1.0,
|
||||
0.0, 1.0, 1.0, 1.0,
|
||||
1.0, 0.0, 1.0, 1.0,
|
||||
};
|
||||
|
||||
#ifdef CORE
|
||||
static const char *vertex_shader[] = {
|
||||
@ -182,6 +173,17 @@ static void init_multisample(unsigned samples)
|
||||
|
||||
static void setup_vao(void)
|
||||
{
|
||||
static const GLfloat vertex_data[] = {
|
||||
-0.5, -0.5,
|
||||
0.5, -0.5,
|
||||
-0.5, 0.5,
|
||||
0.5, 0.5,
|
||||
1.0, 1.0, 1.0, 1.0,
|
||||
1.0, 1.0, 0.0, 1.0,
|
||||
0.0, 1.0, 1.0, 1.0,
|
||||
1.0, 0.0, 1.0, 1.0,
|
||||
};
|
||||
|
||||
#ifdef CORE
|
||||
glGenVertexArrays(1, &vao);
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user