mirror of
https://github.com/libretro/RetroArch
synced 2025-02-01 09:32:58 +00:00
commit
73a119469a
61
Makefile
61
Makefile
@ -25,19 +25,20 @@ OBJ = frontend/frontend.o \
|
||||
core_options.o \
|
||||
compat/compat.o \
|
||||
cheats.o \
|
||||
core_info.o \
|
||||
frontend/info/core_info.o \
|
||||
conf/config_file.o \
|
||||
screenshot.o \
|
||||
gfx/scaler/scaler.o \
|
||||
gfx/shader_parse.o \
|
||||
gfx/scaler/pixconv.o \
|
||||
gfx/scaler/scaler_int.o \
|
||||
gfx/scaler/filter.o \
|
||||
gfx/image.o \
|
||||
gfx/scaler/scaler_filter.o \
|
||||
gfx/image/image.o \
|
||||
gfx/fonts/fonts.o \
|
||||
gfx/fonts/bitmapfont.o \
|
||||
audio/resampler.o \
|
||||
audio/sinc.o \
|
||||
audio/cc_resampler.o \
|
||||
performance.o
|
||||
|
||||
JOYCONFIG_OBJ = tools/retroarch-joyconfig.o \
|
||||
@ -63,7 +64,9 @@ ifeq ($(findstring Haiku,$(OS)),)
|
||||
LIBS = -lm
|
||||
endif
|
||||
|
||||
DEFINES = -DHAVE_CONFIG_H -DHAVE_SCREENSHOTS -DRARCH_INTERNAL
|
||||
DEFINES = -DHAVE_CONFIG_H -DHAVE_SCREENSHOTS -DRARCH_INTERNAL -DHAVE_CC_RESAMPLER
|
||||
|
||||
#HAVE_LAKKA = 1
|
||||
|
||||
ifeq ($(GLOBAL_CONFIG_DIR),)
|
||||
GLOBAL_CONFIG_DIR = /etc
|
||||
@ -93,8 +96,17 @@ ifneq ($(findstring Linux,$(OS)),)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RGUI), 1)
|
||||
OBJ += frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_context.o file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_navigation.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||
DEFINES += -DHAVE_MENU
|
||||
HAVE_MENU_COMMON = 1
|
||||
ifeq ($(HAVE_LAKKA), 1)
|
||||
OBJ += frontend/menu/disp/lakka.o
|
||||
DEFINES += -DHAVE_LAKKA
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
OBJ += frontend/menu/backend/menu_common_backend.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_THREADS), 1)
|
||||
@ -116,12 +128,6 @@ ifeq ($(HAVE_COMMAND), 1)
|
||||
OBJ += command.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RSOUND), 1)
|
||||
OBJ += audio/rsound.o
|
||||
DEFINES += $(RSOUND_CFLAGS)
|
||||
LIBS += $(RSOUND_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_OSS), 1)
|
||||
OBJ += audio/oss.o
|
||||
endif
|
||||
@ -134,6 +140,12 @@ ifeq ($(HAVE_OSS_LIB), 1)
|
||||
LIBS += -lossaudio
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RSOUND), 1)
|
||||
OBJ += audio/rsound.o
|
||||
DEFINES += $(RSOUND_CFLAGS)
|
||||
LIBS += $(RSOUND_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_ALSA), 1)
|
||||
OBJ += audio/alsa.o audio/alsathread.o
|
||||
LIBS += $(ALSA_LIBS)
|
||||
@ -293,6 +305,7 @@ endif
|
||||
|
||||
ifeq ($(HAVE_DYLIB), 1)
|
||||
LIBS += $(DYLIB_LIB)
|
||||
OBJ += gfx/filter.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FREETYPE), 1)
|
||||
@ -315,7 +328,7 @@ endif
|
||||
ifeq ($(HAVE_FFMPEG), 1)
|
||||
OBJ += record/ffemu.o
|
||||
LIBS += $(AVCODEC_LIBS) $(AVFORMAT_LIBS) $(AVUTIL_LIBS) $(SWSCALE_LIBS)
|
||||
DEFINES += $(AVCODEC_CFLAGS) $(AVFORMAT_CFLAGS) $(AVUTIL_CFLAGS) $(SWSCALE_CFLAGS)
|
||||
DEFINES += $(AVCODEC_CFLAGS) $(AVFORMAT_CFLAGS) $(AVUTIL_CFLAGS) $(SWSCALE_CFLAGS) -DHAVE_RECORD
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_DYNAMIC), 1)
|
||||
@ -403,6 +416,8 @@ RARCH_RETROLAUNCH_OBJ := $(addprefix $(OBJDIR)/,$(RETROLAUNCH_OBJ))
|
||||
|
||||
all: $(TARGET) config.mk
|
||||
|
||||
-include $(RARCH_OBJ:.o=.d) $(RARCH_JOYCONFIG_OBJ:.o=.d) $(RARCH_RETROLAUNCH_OBJ:.o=.d)
|
||||
|
||||
config.mk: configure qb/*
|
||||
@echo "config.mk is outdated or non-existing. Run ./configure again."
|
||||
@exit 1
|
||||
@ -423,37 +438,37 @@ tools/retrolaunch/retrolaunch: $(RARCH_RETROLAUNCH_OBJ)
|
||||
@$(if $(Q), $(shell echo echo LD $@),)
|
||||
$(Q)$(LD) -o $@ $(RARCH_RETROLAUNCH_OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
|
||||
|
||||
$(OBJDIR)/%.o: %.c config.h config.mk $(HEADERS)
|
||||
$(OBJDIR)/%.o: %.c config.h config.mk
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
.FORCE:
|
||||
|
||||
$(OBJDIR)/git_version.o: git_version.c .FORCE
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/tools/linuxraw_joypad.o: input/linuxraw_joypad.c $(HEADERS)
|
||||
$(OBJDIR)/tools/linuxraw_joypad.o: input/linuxraw_joypad.c
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_JOYCONFIG -c -o $@ $<
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/tools/udev_joypad.o: input/udev_joypad.c $(HEADERS)
|
||||
$(OBJDIR)/tools/udev_joypad.o: input/udev_joypad.c
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_JOYCONFIG -c -o $@ $<
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/tools/input_common_launch.o: input/input_common.c $(HEADERS)
|
||||
$(OBJDIR)/tools/input_common_launch.o: input/input_common.c
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_RETROLAUNCH -c -o $@ $<
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_RETROLAUNCH -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/tools/input_common_joyconfig.o: input/input_common.c $(HEADERS)
|
||||
$(OBJDIR)/tools/input_common_joyconfig.o: input/input_common.c
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_JOYCONFIG -c -o $@ $<
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.S config.h config.mk $(HEADERS)
|
||||
@mkdir -p $(dir $@)
|
||||
|
@ -30,17 +30,18 @@ OBJ = frontend/platform/platform_emscripten.o \
|
||||
gfx/scaler/scaler.o \
|
||||
gfx/scaler/pixconv.o \
|
||||
gfx/scaler/scaler_int.o \
|
||||
gfx/scaler/filter.o \
|
||||
gfx/scaler/scaler_filter.o \
|
||||
gfx/state_tracker.o \
|
||||
gfx/shader_parse.o \
|
||||
gfx/fonts/fonts.o \
|
||||
gfx/fonts/bitmapfont.o \
|
||||
gfx/image.o \
|
||||
gfx/image/image.o \
|
||||
audio/resampler.o \
|
||||
audio/sinc.o \
|
||||
audio/cc_resampler.o \
|
||||
audio/null.o \
|
||||
performance.o \
|
||||
core_info.o \
|
||||
frontend/info/core_info.o \
|
||||
camera/rwebcam.o
|
||||
|
||||
HAVE_OPENGL = 1
|
||||
@ -61,7 +62,7 @@ endif
|
||||
libretro = libretro_emscripten.bc
|
||||
|
||||
LIBS =
|
||||
DEFINES = -DHAVE_SCREENSHOTS -DHAVE_CAMERA -DHAVE_NULLAUDIO -DHAVE_BSV_MOVIE -DRARCH_INTERNAL
|
||||
DEFINES = -DHAVE_SCREENSHOTS -DHAVE_CAMERA -DHAVE_NULLAUDIO -DHAVE_BSV_MOVIE -DRARCH_INTERNAL -DHAVE_CC_RESAMPLER
|
||||
LDFLAGS = -L. -s TOTAL_MEMORY=$(MEMORY) -s OUTLINING_LIMIT=50000 --js-library emscripten/library_rwebaudio.js --js-library emscripten/library_rwebinput.js --js-library emscripten/library_rwebcam.js --no-heap-copy
|
||||
|
||||
ifeq ($(PERF_TEST), 1)
|
||||
@ -70,7 +71,12 @@ endif
|
||||
|
||||
ifeq ($(HAVE_RGUI), 1)
|
||||
DEFINES += -DHAVE_MENU -DHAVE_RGUI
|
||||
OBJ += frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_context.o file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_navigation.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||
HAVE_MENU_COMMON = 1
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
OBJ += frontend/menu/backend/menu_common_backend.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SDL), 1)
|
||||
|
273
Makefile.griffin
Normal file
273
Makefile.griffin
Normal file
@ -0,0 +1,273 @@
|
||||
DEBUG = 0
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FILE_LOGGER = 0
|
||||
PERF_TEST = 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
BIG_STACK = 0
|
||||
PC_DEVELOPMENT_IP_ADDRESS = 255.255.255.255
|
||||
PC_DEVELOPMENT_UDP_PORT = 3490
|
||||
|
||||
ifneq ($(EMSCRIPTEN),)
|
||||
platform = emscripten
|
||||
endif
|
||||
|
||||
ifeq ($(platform),)
|
||||
platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
platform = win
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
platform = osx
|
||||
else ifneq ($(findstring win,$(shell uname -a)),)
|
||||
platform = win
|
||||
endif
|
||||
endif
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
EXE_EXT = .exe
|
||||
system_platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
system_platform = osx
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
TARGET_NAME := retroarch
|
||||
|
||||
INCLUDE :=
|
||||
LDFLAGS :=
|
||||
LIBDIRS :=
|
||||
|
||||
SHADER_DIR := media/shaders
|
||||
OVERLAY_DIR := media/overlays
|
||||
SHADER_GLSL_DIR := media/shaders_glsl
|
||||
|
||||
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
|
||||
endif
|
||||
|
||||
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/rzlib
|
||||
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
|
||||
endif
|
||||
LIBS := -lfat $(WHOLE_START) -lretro_ngc $(WHOLE_END) -logc
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
LIBS += -lbba
|
||||
endif
|
||||
PLATCFLAGS := -DGEKKO
|
||||
|
||||
HAVE_THREADS := 1
|
||||
HAVE_ZLIB := 1
|
||||
HAVE_RPNG := 1
|
||||
HAVE_OVERLAY := 1
|
||||
else ifeq ($(platform), ps3)
|
||||
#TODO
|
||||
MEDIA_SHADER_DIR := ps3/pkg/USRDIR/cores/shaders
|
||||
else ifeq ($(platform), ps3-cobra)
|
||||
#TODO
|
||||
MEDIA_SHADER_DIR := ps3/iso/PS3_GAME/USRDIR/cores/shaders
|
||||
else ifeq ($(platform), wii)
|
||||
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
|
||||
INCLUDE += -I. -I$(DEVKITPRO)/libogc/include -Ideps/rzlib
|
||||
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
|
||||
endif
|
||||
LIBS := -lfat $(WHOLE_START) -lretro_wii $(WHOLE_END) -logc -lwiiuse -lbte
|
||||
APP_BOOTER_DIR = wii/app_booter
|
||||
PLATOBJS := $(APP_BOOTER_DIR)/app_booter.binobj
|
||||
PLATCFLAGS := -DGEKKO
|
||||
|
||||
HAVE_RARCH_EXEC := 1
|
||||
HAVE_THREADS := 1
|
||||
HAVE_RSOUND := 1
|
||||
HAVE_LIBRETRO_MANAGEMENT := 1
|
||||
HAVE_ZLIB := 1
|
||||
HAVE_RPNG := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_LIBSICKSAXIS := 0
|
||||
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
|
||||
|
||||
HAVE_LIBRETRO_MANAGEMENT := 1
|
||||
HAVE_RPNG := 1
|
||||
endif
|
||||
|
||||
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE)
|
||||
|
||||
OBJ = griffin/griffin.o $(PLATOBJS)
|
||||
|
||||
ifeq ($(PERF_TEST), 1)
|
||||
CFLAGS += -DPERF_TEST
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_LOGGER
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
INCLUDE += -Iconsole/logger
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LIBRETRO_MANAGEMENT), 1)
|
||||
CFLAGS += -DHAVE_LIBRETRO_MANAGEMENT
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LIBSICKSAXIS), 1)
|
||||
CFLAGS += -DHAVE_LIBSICKSAXIS
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RPNG), 1)
|
||||
CFLAGS += -DWANT_RPNG
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
INCLUDE += -Iconsole/logger
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RARCH_EXEC), 1)
|
||||
CFLAGS += -DHAVE_RARCH_EXEC
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_ZLIB), 1)
|
||||
CFLAGS += -DHAVE_ZLIB -DWANT_MINIZ
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_OVERLAY), 1)
|
||||
CFLAGS += -DHAVE_OVERLAY
|
||||
endif
|
||||
|
||||
CFLAGS += -std=gnu99 -DSINC_LOWER_QUALITY -DHAVE_CC_RESAMPLER -DHAVE_RGUI -DHAVE_MENU -DRARCH_CONSOLE -DHAVE_GRIFFIN=1 -DHAVE_SCREENSHOTS -Wno-char-subscripts -DRARCH_INTERNAL
|
||||
|
||||
ifeq ($(HAVE_THREADS), 1)
|
||||
CFLAGS += -DHAVE_THREADS
|
||||
ifeq ($(platform), psp1)
|
||||
LIBS += -lpthread-psp
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RSOUND), 1)
|
||||
CFLAGS += -DHAVE_RSOUND
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -g -DDEBUG
|
||||
else ifeq ($(platform), psp1)
|
||||
CFLAGS += -O2
|
||||
else
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
all: $(EXT_TARGET)
|
||||
|
||||
%.dol: %.elf
|
||||
$(ELF2DOL) $< $@
|
||||
|
||||
$(EXT_INTER_TARGET): $(OBJ)
|
||||
$(CXX) -o $@ $(LDFLAGS) $(LIBDIRS) $(OBJ) $(LIBS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
%.bmpobj: %.bmp
|
||||
$(LD) -r -b binary -o $@ $<
|
||||
|
||||
%.binobj: %.bin
|
||||
$(LD) -r -b binary -o $@ $<
|
||||
|
||||
$(APP_BOOTER_DIR)/app_booter.bin:
|
||||
$(MAKE) -C $(APP_BOOTER_DIR)
|
||||
|
||||
pkg: all
|
||||
ifeq ($(platform), wii)
|
||||
cp -r $(EXT_TARGET) wii/pkg/CORE.dol
|
||||
else ifeq ($(platform), ngc)
|
||||
cp -r $(EXT_TARGET) ngc/pkg/CORE.dol
|
||||
else ifeq ($(platform), psp1)
|
||||
psp-fixup-imports$(EXT) $(EXT_TARGET)
|
||||
endif
|
||||
|
||||
shaders-checkout:
|
||||
@if test -d $(SHADER_DIR); then \
|
||||
echo "[SHADER CHECKOUT::] Git pulling common-shaders..."; \
|
||||
cd $(SHADER_DIR); \
|
||||
$(GIT) pull; \
|
||||
cd ../../../../..; \
|
||||
else \
|
||||
echo "[SHADER CHECKOUT::] Git cloning common-shaders first..."; \
|
||||
$(GIT) clone git://github.com/libretro/common-shaders.git $(SHADER_DIR); \
|
||||
fi
|
||||
|
||||
shaders-deploy:
|
||||
ifeq ($(platform), ps3)
|
||||
@if test -d $(MEDIA_SHADER_DIR); then \
|
||||
cp -r $(SHADER_DIR)/* $(MEDIA_SHADER_DIR); \
|
||||
else \
|
||||
echo "[DEPLOY PS3::] Creating PS3 shader directory first..."; \
|
||||
mkdir -p $(MEDIA_SHADER_DIR) || bin/true; \
|
||||
fi
|
||||
@echo "[DEPLOY PS3::] Copied shaders to PS3 shaders directory."
|
||||
else ifeq ($(platform), ps3-cobra)
|
||||
@if test -d $(MEDIA_SHADER_DIR); then \
|
||||
cp -r $(SHADER_DIR)/* $(MEDIA_SHADER_DIR); \
|
||||
else \
|
||||
echo "[DEPLOY PS3::] Creating PS3 shader directory first..."; \
|
||||
mkdir -p $(MEDIA_SHADER_DIR) || bin/true; \
|
||||
fi
|
||||
@echo "[DEPLOY PS3::] Copied shaders to PS3 shaders directory."
|
||||
endif
|
||||
|
||||
shaders-convert-glsl:
|
||||
$(PYTHON3) tools/cg2glsl.py $(SHADER_DIR) $(SHADER_GLSL_DIR)
|
||||
|
||||
overlays-checkout:
|
||||
@if test -d $(OVERLAY_DIR); then \
|
||||
echo "[OVERLAY CHECKOUT::] Git pulling common-overlays..."; \
|
||||
cd $(OVERLAY_DIR); \
|
||||
$(GIT) pull; \
|
||||
cd ../../../../..; \
|
||||
else \
|
||||
echo "[OVERLAY CHECKOUT::] Git cloning common-overlays first..."; \
|
||||
$(GIT) clone git://github.com/libretro/common-overlays.git $(OVERLAY_DIR); \
|
||||
fi
|
||||
|
||||
|
||||
clean:
|
||||
rm -f $(EXT_TARGET)
|
||||
rm -f $(EXT_INTER_TARGET)
|
||||
rm -f $(OBJ)
|
||||
ifeq ($(platform), wii)
|
||||
$(MAKE) -C $(APP_BOOTER_DIR) clean
|
||||
endif
|
||||
|
||||
.PHONY: clean
|
99
Makefile.ngc
99
Makefile.ngc
@ -1,99 +0,0 @@
|
||||
RARCH_VERSION = "0.9.9.3"
|
||||
|
||||
DEBUG = 0
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FILE_LOGGER = 0
|
||||
PERF_TEST = 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
BIG_STACK = 0
|
||||
|
||||
PC_DEVELOPMENT_IP_ADDRESS = "192.168.1.7"
|
||||
PC_DEVELOPMENT_UDP_PORT = 3490
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
EXE_EXT = .exe
|
||||
system_platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
system_platform = osx
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
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)
|
||||
|
||||
DOL_TARGET := retroarch_ngc.dol
|
||||
ELF_TARGET := retroarch_ngc.elf
|
||||
|
||||
INCLUDE := -I. -I$(DEVKITPRO)/libogc/include -Ideps/rzlib
|
||||
LIBDIRS := -L$(DEVKITPRO)/libogc/lib/cube -L.
|
||||
|
||||
MACHDEP := -DGEKKO -DHW_DOL -mogc -mcpu=750 -meabi -mhard-float
|
||||
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE)
|
||||
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_START := -Wl,--whole-archive
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
LDFLAGS := $(MACHDEP) -Wl,-Map,$(notdir $(ELF_TARGET)).map
|
||||
ifeq ($(BIG_STACK), 1)
|
||||
LDFLAGS += -T gx/ld/ogc.ld
|
||||
endif
|
||||
LIBS := -lfat $(WHOLE_START) -lretro_ngc $(WHOLE_END) -logc
|
||||
|
||||
OBJ = griffin/griffin.o
|
||||
|
||||
ifeq ($(PERF_TEST), 1)
|
||||
CFLAGS += -DPERF_TEST
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_LOGGER
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
CFLAGS += -Iconsole/logger
|
||||
LIBS += -lbba
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
CFLAGS += -Iconsole/logger
|
||||
endif
|
||||
|
||||
CFLAGS += -std=gnu99 -DSINC_LOWER_QUALITY -DHAVE_RGUI -DHAVE_MENU -DRARCH_CONSOLE -DGEKKO -DHAVE_ZLIB -DWANT_MINIZ -DHAVE_GRIFFIN=1 -DHAVE_SCREENSHOTS -DHAVE_THREADS -Wno-char-subscripts -DRARCH_INTERNAL
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -g
|
||||
else
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
all: $(DOL_TARGET)
|
||||
|
||||
%.dol: %.elf
|
||||
$(ELF2DOL) $< $@
|
||||
|
||||
$(ELF_TARGET): $(OBJ)
|
||||
$(CXX) -o $@ $(LDFLAGS) $(LIBDIRS) $(OBJ) $(LIBS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
%.binobj: %.bin
|
||||
$(LD) -r -b binary -o $@ $<
|
||||
|
||||
%.bmpobj: %.bmp
|
||||
$(LD) -r -b binary -o $@ $<
|
||||
|
||||
pkg: all
|
||||
cp -r $(DOL_TARGET) ngc/pkg/CORE.dol
|
||||
|
||||
clean:
|
||||
rm -f $(DOL_TARGET)
|
||||
rm -f $(ELF_TARGET)
|
||||
rm -f $(OBJ)
|
||||
|
||||
.PHONY: clean
|
||||
|
10
Makefile.ps3
10
Makefile.ps3
@ -12,7 +12,7 @@ RMENU_IMG_DIR := media/rmenu
|
||||
DOWNLOAD_SHADERS = 1
|
||||
STRIPPING_ENABLE = 0
|
||||
DEBUG = 0
|
||||
HAVE_RGL = 1
|
||||
HAVE_GCMGL = 1
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FREETYPE = 0
|
||||
HAVE_RLAUNCH = 0
|
||||
@ -73,10 +73,10 @@ ifeq ($(HAVE_RLAUNCH), 1)
|
||||
DEFINES += -DHAVE_RLAUNCH
|
||||
endif
|
||||
|
||||
DEFINES += -DHAVE_RMENU -DHAVE_MENU -DRARCH_INTERNAL
|
||||
DEFINES += -DHAVE_RMENU -DHAVE_MENU -DRARCH_INTERNAL -DMSB_FIRST
|
||||
|
||||
ifeq ($(HAVE_RGL), 1)
|
||||
DEFINES += -DHAVE_RGL
|
||||
ifeq ($(HAVE_GCMGL), 1)
|
||||
DEFINES += -DHAVE_GCMGL
|
||||
GL_LIBS := -L. -lrgl_ps3
|
||||
else
|
||||
GL_LIBS := -L$(CELL_SDK)/target/ppu/lib/PSGL/RSX/ultra-opt -lPSGL -lPSGLcgc
|
||||
@ -111,7 +111,7 @@ PPU_LDLIBS = $(FONT_LIBS) $(GL_LIBS) $(WHOLE_START) -lretro_ps3 $(WHOLE_END) -l
|
||||
|
||||
PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe
|
||||
|
||||
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_VID_CONTEXT -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -DWANT_MINIZ -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_OSK -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -DWANT_MINIZ -DSINC_LOWER_QUALITY -DHAVE_CC_RESAMPLER -D__CELLOS_LV2__ -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_OSK -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
PPU_OPTIMIZE_LV := -O0 -g
|
||||
|
@ -12,7 +12,7 @@ RMENU_IMG_DIR := media/rmenu
|
||||
DOWNLOAD_SHADERS = 1
|
||||
STRIPPING_ENABLE = 0
|
||||
DEBUG = 0
|
||||
HAVE_RGL = 1
|
||||
HAVE_GCMGL = 1
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FREETYPE = 0
|
||||
HAVE_RLAUNCH = 0
|
||||
@ -75,8 +75,8 @@ endif
|
||||
|
||||
DEFINES += -DHAVE_RMENU -DHAVE_MENU -DRARCH_INTERNAL
|
||||
|
||||
ifeq ($(HAVE_RGL), 1)
|
||||
DEFINES += -DHAVE_RGL
|
||||
ifeq ($(HAVE_GCMGL), 1)
|
||||
DEFINES += -DHAVE_GCMGL
|
||||
GL_LIBS := -L. -lrgl_ps3
|
||||
else
|
||||
GL_LIBS := -L$(CELL_SDK)/target/ppu/lib/PSGL/RSX/ultra-opt -lPSGL -lPSGLcgc
|
||||
@ -111,7 +111,7 @@ PPU_LDLIBS = $(FONT_LIBS) $(GL_LIBS) $(WHOLE_START) -lretro_ps3 $(WHOLE_END) -l
|
||||
|
||||
PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe
|
||||
|
||||
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_VID_CONTEXT -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -DWANT_MINIZ -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_OSK -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=0 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -DWANT_MINIZ -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_OSK -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=0 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
PPU_OPTIMIZE_LV := -O0 -g
|
||||
|
@ -16,9 +16,9 @@ include $(CELL_MK_DIR)/sdk.makedef.mk
|
||||
PPU_LIB_TARGET = librgl_ps3.a
|
||||
|
||||
LDDIRS = -L.
|
||||
INCDIRS = -I. -Ips3/rgl/include
|
||||
INCDIRS = -I. -Ips3/gcmgl/include
|
||||
|
||||
RGL_DIR = ps3/rgl/src
|
||||
RGL_DIR = ps3/gcmgl/src
|
||||
|
||||
PPU_SRCS = $(RGL_DIR)/libelf/readelf.c \
|
||||
$(RGL_DIR)/rgl_ps3_raster.cpp \
|
||||
@ -50,10 +50,6 @@ else
|
||||
PPU_OPTIMIZE_LV := -O3
|
||||
endif
|
||||
|
||||
ifeq ($(RGL_2D), 1)
|
||||
PPU_OPTIMIZE_LV += -DHAVE_RGL_2D
|
||||
endif
|
||||
|
||||
PPU_CFLAGS = $(PPU_OPTIMIZE_LV) $(INCDIRS) $(DEFINES)
|
||||
PPU_CXXFLAGS = $(PPU_OPTIMIZE_LV) $(INCDIRS) $(DEFINES)
|
||||
|
||||
|
@ -17,13 +17,13 @@ ELF_TARGET := retroarch_psl1ght.elf
|
||||
EBOOT_PATH = ps3/pkg/USRDIR/EBOOT.BIN
|
||||
CORE_PATH = ps3/pkg/USRDIR/cores/CORE.SELF
|
||||
|
||||
INCLUDE := -I. -I$(PS3DEV)/ppu/include
|
||||
INCLUDE := -I. -I$(PS3DEV)/ppu/include -Ideps/rzlib -Ips3/gcmgl/include/export -Ips3/include
|
||||
LIBDIRS := -L$(PS3DEV)/ppu/lib -L$(PS3DEV)/portlibs/ppu/lib -L.
|
||||
|
||||
MACHDEP := -D__CELLOS_LV2__ -D__PSL1GHT__
|
||||
CFLAGS += -Wall $(MACHDEP) $(INCLUDE)
|
||||
LDFLAGS := $(MACHDEP)
|
||||
LIBS := -lretro_psl1ght -laudio -lGL -lEGL -lrsx -lgcm_sys -lnet -lio -lsysutil -lsysmodule -lm -ljpgdec -lpngdec -llv2 -lnet -lnetctl
|
||||
LIBS := -lrgl_ps3 -lretro_psl1ght -laudio -lrsx -lgcm_sys -lnet -lio -lsysutil -lsysmodule -lm -ljpgdec -lpngdec -llv2 -lnet -lnetctl
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
@ -90,9 +90,7 @@ ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
endif
|
||||
|
||||
RSXGL_DEFINES = -D__RSX__ -DGL3_PROTOTYPES
|
||||
|
||||
SHARED_FLAGS := $(RSXGL_DEFINES) -DHAVE_OPENGL -DHAVE_EGL -DHAVE_OPENGL_MODERN -DHAVE_GLSL -DHAVE_VID_CONTEXT -DHAVE_FBO -DHAVE_MOUSE -DRARCH_CONSOLE -DHAVE_ZLIB -DWANT_MINIZ -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_GRIFFIN=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts
|
||||
SHARED_FLAGS := -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DWANT_MINIZ -DHAVE_GRIFFIN=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts
|
||||
CFLAGS += -std=gnu99 $(SHARED_FLAGS)
|
||||
CXXFLAGS += $(SHARED_FLAGS)
|
||||
|
||||
|
@ -1,14 +1,30 @@
|
||||
RARCH_VERSION = "0.9.9.3"
|
||||
|
||||
HAVE_FILE_LOGGER = 1
|
||||
BUILD_PRX = 1
|
||||
DEBUG = 0
|
||||
HAVE_FILE_LOGGER = 0
|
||||
HAVE_THREADS = 0
|
||||
|
||||
TARGET = retroarchpsp
|
||||
|
||||
INCDIR =
|
||||
CFLAGS = -O2 -G0 -g -std=gnu99 -ffast-math
|
||||
ifeq ($(DEBUG), 1)
|
||||
OPTIMIZE_LV := -O0 -g
|
||||
else
|
||||
OPTIMIZE_LV := -O2 -g
|
||||
endif
|
||||
|
||||
INCDIR = $(PSPPATH)/include
|
||||
CFLAGS = $(OPTIMIZE_LV) -G0 -std=gnu99 -ffast-math
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
RARCH_DEFINES = -DPSP -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_ZLIB -DWANT_MINIZ -DHAVE_GRIFFIN=1 -DHAVE_NULLAUDIO -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_MENU -DHAVE_RGUI -DWANT_RPNG
|
||||
RARCH_DEFINES = -DPSP -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_ZLIB -DWANT_MINIZ -DHAVE_GRIFFIN=1 -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_MENU -DHAVE_RGUI -DWANT_RPNG -DSINC_LOWEST_QUALITY -DHAVE_CC_RESAMPLER
|
||||
|
||||
LIBDIR =
|
||||
LDFLAGS =
|
||||
LIBS = -lretro_psp1 -lstdc++ -lpspgu -lpspgum -lm -lpspaudio -lpspfpu -lpsppower
|
||||
|
||||
ifeq ($(HAVE_THREADS), 1)
|
||||
RARCH_DEFINES += -DHAVE_THREADS
|
||||
LIBS += -lpthread-psp
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
@ -16,9 +32,6 @@ endif
|
||||
|
||||
CFLAGS += $(RARCH_DEFINES)
|
||||
|
||||
LIBDIR =
|
||||
LDFLAGS =
|
||||
LIBS = -lretro_psp1 -lstdc++ -lpspgu -lpspgum -lm
|
||||
|
||||
EXTRA_TARGETS = EBOOT.PBP
|
||||
PSP_EBOOT_TITLE = RetroArch PSP1
|
||||
|
@ -1,65 +0,0 @@
|
||||
DOWNLOAD_SHADERS = 1
|
||||
SHADER_DIR := media/shaders
|
||||
SHADER_GLSL_DIR := media/shaders_glsl
|
||||
|
||||
SHADER_DEST_PS3_DIR := ps3/pkg/USRDIR/cores/shaders
|
||||
SHADER_DEST_PS3_COBRA_DIR := ps3/iso/PS3_GAME/USRDIR/cores/shaders
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
EXE_EXT = .exe
|
||||
system_platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
system_platform = osx
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
ifeq ($(shell uname), Linux)
|
||||
PYTHON2 = python2
|
||||
PYTHON3 = python
|
||||
GIT = git
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
PYTHON2 = python2
|
||||
PYTHON3 = python
|
||||
GIT = git
|
||||
else
|
||||
PYTHON2 = python2.exe
|
||||
PYTHON3 = python.exe
|
||||
GIT = git.exe
|
||||
endif
|
||||
|
||||
checkout-shaders:
|
||||
ifeq ($(DOWNLOAD_SHADERS),1)
|
||||
@if test -d $(SHADER_DIR); then \
|
||||
echo "[SHADER CHECKOUT::] Git pulling common-shaders..."; \
|
||||
cd $(SHADER_DIR); \
|
||||
$(GIT) pull; \
|
||||
cd ../../../../..; \
|
||||
else \
|
||||
echo "[SHADER CHECKOUT::] Git cloning common-shaders first..."; \
|
||||
$(GIT) clone git://github.com/libretro/common-shaders.git $(SHADER_DIR); \
|
||||
fi
|
||||
endif
|
||||
|
||||
convert-xml:
|
||||
$(PYTHON) tools/cg2glsl.py $(SHADER_DIR) $(SHADER_GLSL_DIR)
|
||||
|
||||
deploy-ps3: checkout-shaders
|
||||
@if test -d $(SHADER_DEST_PS3_DIR); then \
|
||||
cp -r $(SHADER_DIR)/* $(SHADER_DEST_PS3_DIR); \
|
||||
else \
|
||||
echo "[DEPLOY PS3::] Creating PS3 shader directory first..."; \
|
||||
mkdir -p $(SHADER_DEST_PS3_DIR) || bin/true; \
|
||||
fi
|
||||
@echo "[DEPLOY PS3::] Copied shaders to PS3 shaders directory."
|
||||
|
||||
deploy-ps3-cobra: checkout-shaders
|
||||
@if test -d $(SHADER_DEST_PS3_COBRA_DIR); then \
|
||||
cp -r $(SHADER_DIR)/* $(SHADER_DEST_PS3_COBRA_DIR); \
|
||||
else \
|
||||
echo "[DEPLOY PS3::] Creating PS3 shader directory first..."; \
|
||||
mkdir -p $(SHADER_DEST_PS3_COBRA_DIR) || bin/true; \
|
||||
fi
|
||||
@echo "[DEPLOY PS3::] Copied shaders to PS3 shaders directory."
|
104
Makefile.wii
104
Makefile.wii
@ -1,104 +0,0 @@
|
||||
RARCH_VERSION = "0.9.9.3"
|
||||
|
||||
DEBUG = 0
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FILE_LOGGER = 0
|
||||
PERF_TEST = 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
BIG_STACK = 0
|
||||
|
||||
PC_DEVELOPMENT_IP_ADDRESS = 192.168.1.138
|
||||
PC_DEVELOPMENT_UDP_PORT = 3490
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
EXE_EXT = .exe
|
||||
system_platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
system_platform = osx
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
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)
|
||||
|
||||
DOL_TARGET := retroarch_wii.dol
|
||||
ELF_TARGET := retroarch_wii.elf
|
||||
|
||||
INCLUDE := -I. -I$(DEVKITPRO)/libogc/include -I$(DEVKITPRO)/libogc/include/ogc -Ideps/rzlib
|
||||
LIBDIRS := -L$(DEVKITPRO)/libogc/lib/wii -L.
|
||||
|
||||
MACHDEP := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float
|
||||
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE)
|
||||
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_START := -Wl,--whole-archive
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
LDFLAGS := $(MACHDEP) -Wl,-Map,$(notdir $(ELF_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
|
||||
endif
|
||||
LIBS := -lfat $(WHOLE_START) -lretro_wii $(WHOLE_END) -logc -lwiiuse -lbte
|
||||
APP_BOOTER_DIR = wii/app_booter
|
||||
|
||||
OBJ = griffin/griffin.o $(APP_BOOTER_DIR)/app_booter.binobj
|
||||
|
||||
ifeq ($(PERF_TEST), 1)
|
||||
CFLAGS += -DPERF_TEST
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_LOGGER
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
CFLAGS += -Iconsole/logger
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
CFLAGS += -Iconsole/logger
|
||||
endif
|
||||
|
||||
|
||||
CFLAGS += -std=gnu99 -DSINC_LOWER_QUALITY -DHAVE_RGUI -DHAVE_MENU -DRARCH_CONSOLE -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RARCH_EXEC -DGEKKO -DHAVE_ZLIB -DWANT_MINIZ -DHAVE_GRIFFIN=1 -DHAVE_SCREENSHOTS -DHAVE_THREADS -DHAVE_RSOUND -Wno-char-subscripts -DRARCH_INTERNAL
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -g -DDEBUG
|
||||
else
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
all: $(DOL_TARGET)
|
||||
|
||||
%.dol: %.elf
|
||||
$(ELF2DOL) $< $@
|
||||
|
||||
$(ELF_TARGET): $(OBJ)
|
||||
$(CXX) -o $@ $(LDFLAGS) $(LIBDIRS) $(OBJ) $(LIBS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
%.bmpobj: %.bmp
|
||||
$(LD) -r -b binary -o $@ $<
|
||||
|
||||
%.binobj: %.bin
|
||||
$(LD) -r -b binary -o $@ $<
|
||||
|
||||
$(APP_BOOTER_DIR)/app_booter.bin:
|
||||
$(MAKE) -C $(APP_BOOTER_DIR)
|
||||
|
||||
pkg: all
|
||||
cp -r $(DOL_TARGET) wii/pkg/CORE.dol
|
||||
|
||||
clean:
|
||||
rm -f $(DOL_TARGET)
|
||||
rm -f $(ELF_TARGET)
|
||||
rm -f $(OBJ)
|
||||
$(MAKE) -C $(APP_BOOTER_DIR) clean
|
||||
|
||||
.PHONY: clean
|
||||
|
37
Makefile.win
37
Makefile.win
@ -26,7 +26,7 @@ OBJ = frontend/frontend.o \
|
||||
compat/compat.o \
|
||||
screenshot.o \
|
||||
cheats.o \
|
||||
core_info.o \
|
||||
frontend/info/core_info.o \
|
||||
audio/utils.o \
|
||||
input/overlay.o \
|
||||
fifo_buffer.o \
|
||||
@ -35,14 +35,15 @@ OBJ = frontend/frontend.o \
|
||||
gfx/scaler/scaler.o \
|
||||
gfx/scaler/pixconv.o \
|
||||
gfx/scaler/scaler_int.o \
|
||||
gfx/scaler/filter.o \
|
||||
gfx/scaler/scaler_filter.o \
|
||||
gfx/state_tracker.o \
|
||||
gfx/shader_parse.o \
|
||||
gfx/fonts/fonts.o \
|
||||
gfx/fonts/bitmapfont.o \
|
||||
gfx/image.o \
|
||||
gfx/image/image.o \
|
||||
audio/resampler.o \
|
||||
audio/sinc.o \
|
||||
audio/cc_resampler.o \
|
||||
performance.o
|
||||
|
||||
JOBJ := conf/config_file.o \
|
||||
@ -95,7 +96,7 @@ endif
|
||||
libretro ?= -lretro
|
||||
|
||||
LIBS = -lm
|
||||
DEFINES = -I. -DHAVE_SCREENSHOTS -DHAVE_BSV_MOVIE -DHAVE_BUILTIN_AUTOCONFIG -DRARCH_INTERNAL
|
||||
DEFINES = -I. -DHAVE_SCREENSHOTS -DHAVE_BSV_MOVIE -DHAVE_BUILTIN_AUTOCONFIG -DRARCH_INTERNAL -DHAVE_CC_RESAMPLER
|
||||
LDFLAGS = -L. -static-libgcc
|
||||
|
||||
ifeq ($(TDM_GCC),)
|
||||
@ -114,7 +115,12 @@ JLIBS =
|
||||
|
||||
ifeq ($(HAVE_RGUI), 1)
|
||||
DEFINES += -DHAVE_RGUI -DHAVE_MENU
|
||||
OBJ += frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_context.o file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_navigation.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||
HAVE_MENU_COMMON = 1
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
OBJ += frontend/menu/backend/menu_common_backend.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SDL), 1)
|
||||
@ -150,7 +156,7 @@ else
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_D3D9), 1)
|
||||
OBJ += gfx/d3d9/d3d.o gfx/d3d9/d3d9_pc.o gfx/d3d9/render_chain.o gfx/fonts/d3d_font.o gfx/fonts/d3d_w32_font.o
|
||||
OBJ += gfx/d3d9/d3d.o gfx/d3d9/render_chain.o gfx/fonts/d3d_font.o gfx/fonts/d3d_w32_font.o gfx/context/d3d_ctx.o
|
||||
DEFINES += -DHAVE_WIN32_D3D9
|
||||
LIBS += -ld3d9 -lcg -lcgD3D9 -ld3dx9 -ldxguid
|
||||
endif
|
||||
@ -194,6 +200,7 @@ endif
|
||||
|
||||
ifeq ($(HAVE_DYLIB), 1)
|
||||
DEFINES += -DHAVE_DYLIB
|
||||
OBJ += gfx/filter.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_STDIN_CMD), 1)
|
||||
@ -242,7 +249,7 @@ endif
|
||||
|
||||
ifeq ($(HAVE_FFMPEG), 1)
|
||||
LIBS += -lavformat -lavcodec -lavutil -lswscale -lws2_32 -lz
|
||||
DEFINES += -DHAVE_FFMPEG -Iffmpeg
|
||||
DEFINES += -DHAVE_FFMPEG -DHAVE_RECORD -Iffmpeg
|
||||
OBJ += record/ffemu.o
|
||||
endif
|
||||
|
||||
@ -285,31 +292,33 @@ RARCH_JOBJ := $(addprefix $(OBJDIR)/,$(JOBJ))
|
||||
|
||||
all: $(TARGET) $(JTARGET)
|
||||
|
||||
-include $(RARCH_OBJ:.o=.d) $(RARCH_JOBJ:.o=.d)
|
||||
|
||||
$(TARGET): $(RARCH_OBJ)
|
||||
@$(if $(Q), $(shell echo echo LD $@),)
|
||||
$(Q)$(CXX) -o $@ $(RARCH_OBJ) $(LIBS) $(LDFLAGS) $(LDCXXFLAGS)
|
||||
|
||||
$(OBJDIR)/%.o: %.c $(HEADERS)
|
||||
$(OBJDIR)/%.o: %.c
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
.FORCE:
|
||||
|
||||
$(OBJDIR)/git_version.o: git_version.c .FORCE
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/tools/input_common_joyconfig.o: input/input_common.c $(HEADERS)
|
||||
$(OBJDIR)/tools/input_common_joyconfig.o: input/input_common.c
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_JOYCONFIG -c -o $@ $<
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_JOYCONFIG -MMD -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.cpp $(HEADERS)
|
||||
$(OBJDIR)/%.o: %.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CXX $<),)
|
||||
$(Q)$(CXX) $(CXXFLAGS) $(DEFINES) -c -o $@ $<
|
||||
$(Q)$(CXX) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.rc $(HEADERS)
|
||||
@mkdir -p $(dir $@)
|
||||
|
@ -18,7 +18,11 @@ The original Lima driver suffers from a similar problem as the blob, since it ca
|
||||
|
||||
[lima-drm repository](https://github.com/tobiasjakobi/lima-drm)
|
||||
|
||||
The Lima video driver for RetroArch only works with this version. Proceed with the usual steps to install limare from the repository onto your system. After that compile RetroArch against the resulting limare library.
|
||||
The Lima video driver for RetroArch only works with this version. Proceed with the usual steps to install limare from the repository onto your system. Make sure that you have a recent version of [libdrm](http://cgit.freedesktop.org/mesa/drm/) installed on your system, and that Exynos API support is enabled in libdrm. If you're compiling libdrm from source, then use
|
||||
|
||||
./configure --enable-exynos-experimental-api
|
||||
|
||||
to enable the Exynos API. After finishing the limare build, compile RetroArch against the resulting limare library (*liblimare.so*). I usually just skip the make install step and manually place the library and header (which is *limare.h*) in *$HOME/local/lib/* and *$HOME/local/include/* respectively (this requires adjustements for *LD_LIBRARY_PATH* and *CFLAGS*).
|
||||
|
||||
The video driver name is 'lima'. It honors the following video settings:
|
||||
|
||||
@ -35,3 +39,4 @@ The driver still suffers from some issues.
|
||||
|
||||
- The aspect ratio is wrong. The dimensions of the emulator framebuffer on the screen are not computed correctly at the moment.
|
||||
- Limare should be able to handle a custom pitch, when uploading texture pixel data. This would save some memcpy for emulator cores which don't provide the framebuffer with full pitch (snes9x-next for example).
|
||||
- Font rendering is kinda inefficient, since the whole font texture is invalidated each frame. It would be better to introduce something like an invalidated rectangle, which tracks the region which needs to be updated.
|
||||
|
@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- BEGIN_INCLUDE(manifest) -->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.retroarch.retroarch"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<!-- This is the platform API where NativeActivity was introduced. -->
|
||||
<uses-sdk android:minSdkVersion="9" />
|
||||
|
||||
<!-- This .apk has no Java code itself, so set hasCode to false. -->
|
||||
<application android:label="@string/app_name" android:hasCode="false">
|
||||
|
||||
<!-- Our activity is the built-in NativeActivity framework class.
|
||||
This will take care of integrating with our NDK code. -->
|
||||
<activity android:name="android.app.NativeActivity"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<!-- Tell NativeActivity the name of or .so -->
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="retroarch" />
|
||||
<meta-data android:name="android.app.func_name"
|
||||
android:value="ANativeActivity_onCreate" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
<!-- END_INCLUDE(manifest) -->
|
@ -23,12 +23,11 @@ endif
|
||||
ifeq ($(HAVE_NEON),1)
|
||||
LOCAL_SRC_FILES += ../../../audio/sinc_neon.S.neon
|
||||
endif
|
||||
LOCAL_CFLAGS += -DSINC_LOWER_QUALITY
|
||||
LOCAL_CFLAGS += -DSINC_LOWER_QUALITY
|
||||
|
||||
LOCAL_CFLAGS += -DANDROID_ARM_V7
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(TARGET_ARCH),mips)
|
||||
LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__
|
||||
endif
|
||||
@ -47,9 +46,16 @@ ifeq ($(PERF_TEST), 1)
|
||||
LOCAL_CFLAGS += -DPERF_TEST
|
||||
endif
|
||||
|
||||
LOCAL_CFLAGS += -Wall -pthread -Wno-unused-function -O3 -fno-stack-protector -funroll-loops -DNDEBUG -DRARCH_MOBILE -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_FBO -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_VID_CONTEXT -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_GLSL -DHAVE_MENU -DHAVE_RGUI -DHAVE_SCREENSHOTS -DHAVE_ZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREADS -D__LIBRETRO__ -I../../../deps/miniz -DHAVE_RSOUND -DHAVE_NETPLAY -DHAVE_CAMERA -DRARCH_INTERNAL -DHAVE_LOCATION
|
||||
ifeq ($(GLES),3)
|
||||
GLES_LIB := -lGLESv3
|
||||
LOCAL_CFLAGS += -DHAVE_OPENGLES3
|
||||
else
|
||||
GLES_LIB := -lGLESv2
|
||||
endif
|
||||
|
||||
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -landroid -lEGL -lGLESv2 $(LOGGER_LDLIBS) -ldl
|
||||
LOCAL_CFLAGS += -Wall -pthread -Wno-unused-function -O3 -fno-stack-protector -funroll-loops -DNDEBUG -DRARCH_MOBILE -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_FBO -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_DYLIB -DHAVE_GLSL -DHAVE_MENU -DHAVE_RGUI -DHAVE_SCREENSHOTS -DHAVE_ZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREADS -D__LIBRETRO__ -I../../../deps/miniz -DHAVE_RSOUND -DHAVE_NETPLAY -DHAVE_CAMERA -DRARCH_INTERNAL -DHAVE_LOCATION -DHAVE_CC_RESAMPLER -DHAVE_FILTERS_BUILTIN
|
||||
|
||||
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -landroid -lEGL $(GLES_LIB) $(LOGGER_LDLIBS) -ldl
|
||||
|
||||
LOCAL_CFLAGS += -DHAVE_SL
|
||||
LOCAL_LDLIBS += -lOpenSLES -lz
|
||||
|
@ -1,2 +0,0 @@
|
||||
APP_PLATFORM := android-9
|
||||
APP_ABI := all
|
@ -1422,7 +1422,7 @@ static void android_input_set_keybinds(void *data, unsigned device,
|
||||
strlcpy(g_settings.input.device_names[port], "DragonRise",
|
||||
sizeof(g_settings.input.device_names[port]));
|
||||
/* TODO: L3/R3 */
|
||||
|
||||
|
||||
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
||||
android->keycode_lut[AKEYCODE_BUTTON_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
||||
android->keycode_lut[AKEYCODE_BUTTON_3] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
||||
@ -1433,6 +1433,35 @@ static void android_input_set_keybinds(void *data, unsigned device,
|
||||
android->keycode_lut[AKEYCODE_BUTTON_7] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
||||
android->keycode_lut[AKEYCODE_BUTTON_8] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
||||
break;
|
||||
|
||||
case DEVICE_SAMSUNG_GAMEPAD_EIGP20:
|
||||
g_settings.input.device[port] = device;
|
||||
strlcpy(g_settings.input.device_names[port], "Samsung Game Pad EI-GP20",
|
||||
sizeof(g_settings.input.device_names[port]));
|
||||
|
||||
android->dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
||||
|
||||
//B: "Pad 0: 96, ac=1, src = 1281"
|
||||
android->keycode_lut[AKEYCODE_BUTTON_B] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
|
||||
//A: "Pad 0: 97, ac=1, src = 1281"
|
||||
android->keycode_lut[AKEYCODE_BUTTON_A] |= ((RETRO_DEVICE_ID_JOYPAD_B+1) << shift);
|
||||
//X: "Pad 0: 99, ac=1, src = 1281"
|
||||
android->keycode_lut[AKEYCODE_BUTTON_X] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
|
||||
//Y: "Pad 0: 100, ac=1, src = 1281"
|
||||
android->keycode_lut[AKEYCODE_BUTTON_Y] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
|
||||
//Left Trigger: "Pad 0: 102, ac=1, src = 1281"
|
||||
android->keycode_lut[AKEYCODE_BUTTON_L1] |= ((RETRO_DEVICE_ID_JOYPAD_L+1) << shift);
|
||||
//Right Trigger: "Pad 0: 103, ac=1, src = 1281"
|
||||
android->keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
|
||||
//Play Button: "Pad 0: 0, ac=1, src = 1281"
|
||||
//Start: "Pad 0: 108, ac=1, src = 1281"
|
||||
android->keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
||||
//Select: "Pad 0: 109, ac=1, src = 1281"
|
||||
android->keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case DEVICE_TOMEE_NES_USB:
|
||||
g_settings.input.device[port] = device;
|
||||
strlcpy(g_settings.input.device_names[port], "Tomee NES USB",
|
||||
@ -2081,6 +2110,11 @@ static float android_input_get_sensor_input(void *data, unsigned port, unsigned
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned android_input_devices_size(void *data)
|
||||
{
|
||||
return DEVICE_LAST;
|
||||
}
|
||||
|
||||
const input_driver_t input_android = {
|
||||
android_input_init,
|
||||
android_input_poll,
|
||||
@ -2091,5 +2125,6 @@ const input_driver_t input_android = {
|
||||
android_input_set_sensor_state,
|
||||
android_input_get_sensor_input,
|
||||
android_input_get_capabilities,
|
||||
android_input_devices_size,
|
||||
"android_input",
|
||||
};
|
||||
|
@ -231,6 +231,8 @@ void input_autodetect_setup(void *data, char *msg, size_t sizeof_msg, unsigned p
|
||||
port = 0; // Shield is always player 1.
|
||||
*primary = true;
|
||||
}
|
||||
else if (strstr(name_buf, "Samsung Game Pad EI-GP20"))
|
||||
device = DEVICE_SAMSUNG_GAMEPAD_EIGP20;
|
||||
|
||||
if (strstr(current_ime, "net.obsidianx.android.mogaime"))
|
||||
{
|
||||
|
@ -96,6 +96,72 @@ enum {
|
||||
AKEYCODE_ASSIST = 219,
|
||||
};
|
||||
|
||||
enum input_devices
|
||||
{
|
||||
DEVICE_NONE = 0,
|
||||
DEVICE_LOGITECH_RUMBLEPAD2,
|
||||
DEVICE_LOGITECH_DUAL_ACTION,
|
||||
DEVICE_LOGITECH_PRECISION_GAMEPAD,
|
||||
DEVICE_ICONTROLPAD_HID_JOYSTICK,
|
||||
DEVICE_ICONTROLPAD_BLUEZ_IME,
|
||||
DEVICE_TTT_THT_ARCADE,
|
||||
DEVICE_TOMMO_NEOGEOX_ARCADE,
|
||||
DEVICE_MADCATZ_PC_USB_STICK,
|
||||
DEVICE_LOGICOOL_RUMBLEPAD2,
|
||||
DEVICE_IDROID_X360,
|
||||
DEVICE_ZEEMOTE_STEELSERIES,
|
||||
DEVICE_HUIJIA_USB_SNES,
|
||||
DEVICE_SUPER_SMARTJOY,
|
||||
DEVICE_SAITEK_RUMBLE_P480,
|
||||
DEVICE_MS_SIDEWINDER_DUAL_STRIKE,
|
||||
DEVICE_MS_SIDEWINDER,
|
||||
DEVICE_MS_XBOX,
|
||||
DEVICE_WISEGROUP_PLAYSTATION2,
|
||||
DEVICE_JCPS102_PLAYSTATION2,
|
||||
DEVICE_GENERIC_PLAYSTATION2_CONVERTER,
|
||||
DEVICE_PSMOVE_NAVI,
|
||||
DEVICE_JXD_S7300B,
|
||||
DEVICE_JXD_S7800B,
|
||||
DEVICE_IDROID_CON,
|
||||
DEVICE_GENIUS_MAXFIRE_G08XU,
|
||||
DEVICE_USB_2_AXIS_8_BUTTON_GAMEPAD,
|
||||
DEVICE_BUFFALO_BGC_FC801,
|
||||
DEVICE_RETROUSB_RETROPAD,
|
||||
DEVICE_RETROUSB_SNES_RETROPORT,
|
||||
DEVICE_CYPRESS_USB,
|
||||
DEVICE_MAYFLASH_WII_CLASSIC,
|
||||
DEVICE_SZMY_POWER_DUAL_BOX_WII,
|
||||
DEVICE_ARCHOS_GAMEPAD,
|
||||
DEVICE_JXD_S5110,
|
||||
DEVICE_JXD_S5110_SKELROM,
|
||||
DEVICE_XPERIA_PLAY,
|
||||
DEVICE_BROADCOM_BLUETOOTH_HID,
|
||||
DEVICE_THRUST_PREDATOR,
|
||||
DEVICE_DRAGONRISE,
|
||||
DEVICE_PLAYSTATION3_VERSION1,
|
||||
DEVICE_PLAYSTATION3_VERSION2,
|
||||
DEVICE_MOGA_IME,
|
||||
DEVICE_NYKO_PLAYPAD_PRO,
|
||||
DEVICE_TOODLES_2008_CHIMP,
|
||||
DEVICE_MOGA,
|
||||
DEVICE_SEGA_VIRTUA_STICK_HIGH_GRADE,
|
||||
DEVICE_CCPCREATIONS_WIIUSE_IME,
|
||||
DEVICE_KEYBOARD_RETROPAD,
|
||||
DEVICE_OUYA,
|
||||
DEVICE_ONLIVE_WIRELESS_CONTROLLER,
|
||||
DEVICE_TOMEE_NES_USB,
|
||||
DEVICE_THRUSTMASTER_T_MINI,
|
||||
DEVICE_GAMEMID,
|
||||
DEVICE_DEFENDER_GAME_RACER_CLASSIC,
|
||||
DEVICE_HOLTEK_JC_U912F,
|
||||
DEVICE_NVIDIA_SHIELD,
|
||||
DEVICE_MUCH_IREADGO_I5,
|
||||
DEVICE_WIKIPAD,
|
||||
DEVICE_FC30_GAMEPAD,
|
||||
DEVICE_SAMSUNG_GAMEPAD_EIGP20,
|
||||
DEVICE_LAST
|
||||
};
|
||||
|
||||
#define LAST_KEYCODE AKEYCODE_ASSIST
|
||||
|
||||
void input_autodetect_setup(void *data, char *msg, size_t sizeof_msg, unsigned port, unsigned id, int source, bool *primary);
|
||||
|
4
android/phoenix/.gitignore
vendored
4
android/phoenix/.gitignore
vendored
@ -1,5 +1,5 @@
|
||||
/gen
|
||||
/bin
|
||||
/libs/*/*
|
||||
/libs/*/*.so
|
||||
/obj
|
||||
/jni/modules/*.so
|
||||
/jni/modules/*.so
|
||||
|
@ -1,7 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.retroarch"
|
||||
android:versionCode="32"
|
||||
android:versionName="1.0.0.1" >
|
||||
android:versionCode="37"
|
||||
android:versionName="1.0.0.2" >
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
|
||||
<uses-sdk
|
||||
|
@ -37,6 +37,10 @@
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<condition property="ndk.dir" value="${env.ANDROID_NDK}">
|
||||
<isset property="env.ANDROID_NDK" />
|
||||
</condition>
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
@ -67,7 +71,17 @@
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
<target name="-pre-build">
|
||||
<exec executable="${ndk.dir}/ndk-build" failonerror="true">
|
||||
<arg value="-j4"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="clean" depends="android_rules.clean">
|
||||
<exec executable="${ndk.dir}/ndk-build" failonerror="true">
|
||||
<arg value="clean"/>
|
||||
</exec>
|
||||
</target>
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
|
@ -4,7 +4,7 @@ include $(CLEAR_VARS)
|
||||
LOCAL_ARM_MODE := arm
|
||||
LOCAL_MODULE := retroarch-jni
|
||||
RARCH_DIR := ../../..
|
||||
LOCAL_CFLAGS += -std=gnu99 -Wall -DHAVE_LOGGER -DRARCH_DUMMY_LOG -DHAVE_ZLIB -DHAVE_MMAP -I$(RARCH_DIR)
|
||||
LOCAL_CFLAGS += -std=gnu99 -Wall -DHAVE_LOGGER -DRARCH_DUMMY_LOG -DHAVE_ZLIB -DHAVE_MMAP -I$(LOCAL_PATH)/$(RARCH_DIR)
|
||||
LOCAL_LDLIBS := -llog -lz
|
||||
LOCAL_SRC_FILES := apk-extract/apk-extract.c $(RARCH_DIR)/file_extract.c $(RARCH_DIR)/file_path.c $(RARCH_DIR)/compat/compat.c
|
||||
|
||||
|
@ -1,2 +1,6 @@
|
||||
APP_PLATFORM := android-9
|
||||
ifeq ($(GLES),3)
|
||||
APP_PLATFORM := android-18
|
||||
else
|
||||
APP_PLATFORM := android-9
|
||||
endif
|
||||
APP_ABI := all
|
||||
|
92
android/phoenix/libs/appcompat/build.xml
Normal file
92
android/phoenix/libs/appcompat/build.xml
Normal file
@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="retroarch" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
92
android/phoenix/libs/googleplay/build.xml
Normal file
92
android/phoenix/libs/googleplay/build.xml
Normal file
@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="retroarch" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
@ -60,7 +60,7 @@
|
||||
<string name="welcome_to_retroarch">Welcome to RetroArch</string>
|
||||
<string name="welcome_to_retroarch_desc">This is your first time starting up RetroArch. RetroArch will now be preconfigured for the best possible user experience.</string>
|
||||
<string name="gpl_waiver">GPL waiver</string>
|
||||
<string name="gpl_waiver_desc">Copyright © 2010–2013 RetroArch Team.\n\nThis program 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 Foundation; either version 3 of the License, or (at your option) any later version.\n\nThis program 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.\n\nYou should have received a copy of the GNU General Public License along with this program; if not, see www.gnu.org/licenses.\n\nAdditional permission under GNU GPL version 3 section 7\n\nIf you modify this Program, or any covered work, by linking or combining it with any non-GPL libretro core, containing parts covered by the terms of the core\'s license, the licensors of this Program grant you additional permission to convey the resulting work.</string>
|
||||
<string name="gpl_waiver_desc">Copyright © 2010–2014 RetroArch Team.\n\nThis program 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 Foundation; either version 3 of the License, or (at your option) any later version.\n\nThis program 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.\n\nYou should have received a copy of the GNU General Public License along with this program; if not, see www.gnu.org/licenses.\n\nAdditional permission under GNU GPL version 3 section 7\n\nIf you modify this Program, or any covered work, by linking or combining it with any non-GPL libretro core, containing parts covered by the terms of the core\'s license, the licensors of this Program grant you additional permission to convey the resulting work.</string>
|
||||
<string name="detect_device_msg_ouya">The ideal configuration options for your device will now be preconfigured.\n\nNOTE: For optimal performance, turn off Google Account sync, GPS and Wi-Fi in your Android settings menu.</string>
|
||||
<string name="detect_device_msg_general">The ideal configuration options for your device will now be preconfigured.\n\nNOTE: For optimal performance, turn off Google Account sync, Google Play Store auto-updates, GPS and Wi-Fi in your Android settings menu.</string>
|
||||
<string name="nvidia_shield_detected">NVidia Shield detected</string>
|
||||
|
@ -1,5 +1,31 @@
|
||||
package com.retroarch.browser.retroactivity;
|
||||
|
||||
public final class RetroActivityFuture extends RetroActivityCamera
|
||||
{
|
||||
import android.view.View;
|
||||
|
||||
public final class RetroActivityFuture extends RetroActivityCamera {
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= 19) {
|
||||
// Immersive mode
|
||||
|
||||
// Constants from API > 14
|
||||
final int API_SYSTEM_UI_FLAG_LAYOUT_STABLE = 0x00000100;
|
||||
final int API_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION = 0x00000200;
|
||||
final int API_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = 0x00000400;
|
||||
final int API_SYSTEM_UI_FLAG_FULLSCREEN = 0x00000004;
|
||||
final int API_SYSTEM_UI_FLAG_IMMERSIVE_STICKY = 0x00001000;
|
||||
|
||||
View thisView = getWindow().getDecorView();
|
||||
thisView.setSystemUiVisibility(API_SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| API_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| API_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| API_SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| API_SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,11 +30,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<string>1.0.3</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<string>1.0.3</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#import "../common/RetroArch_Apple.h"
|
||||
#include "../common/rarch_wrapper.h"
|
||||
#include "../common/apple_input.h"
|
||||
#include "../../input/apple_input.h"
|
||||
|
||||
#include "../../file.h"
|
||||
|
||||
@ -34,20 +34,20 @@ static void* const associated_core_key = (void*)&associated_core_key;
|
||||
{
|
||||
[super sendEvent:event];
|
||||
|
||||
NSEventType event_type = [event type];
|
||||
NSEventType event_type = event.type;
|
||||
|
||||
if (event_type == NSKeyDown || event_type == NSKeyUp)
|
||||
{
|
||||
NSString* ch = [event characters];
|
||||
NSString* ch = (NSString*)event.characters;
|
||||
|
||||
if (!ch || [ch length] == 0)
|
||||
apple_input_keyboard_event(event_type == NSKeyDown, [event keyCode], 0, 0);
|
||||
if (!ch || ch.length == 0)
|
||||
apple_input_keyboard_event(event_type == NSKeyDown, event.keyCode, 0, 0);
|
||||
else
|
||||
{
|
||||
apple_input_keyboard_event(event_type == NSKeyDown, [event keyCode], [ch characterAtIndex:0], [event modifierFlags]);
|
||||
apple_input_keyboard_event(event_type == NSKeyDown, event.keyCode, [ch characterAtIndex:0], event.modifierFlags);
|
||||
|
||||
for (unsigned i = 1; i != [ch length]; i ++)
|
||||
apple_input_keyboard_event(event_type == NSKeyDown, 0, [ch characterAtIndex:i], [event modifierFlags]);
|
||||
for (unsigned i = 1; i < ch.length; i ++)
|
||||
apple_input_keyboard_event(event_type == NSKeyDown, 0, [ch characterAtIndex:i], event.modifierFlags);
|
||||
}
|
||||
}
|
||||
else if (event_type == NSFlagsChanged)
|
||||
@ -57,14 +57,14 @@ static void* const associated_core_key = (void*)&associated_core_key;
|
||||
bool down = (new_flags & old_flags) == old_flags;
|
||||
old_flags = new_flags;
|
||||
|
||||
apple_input_keyboard_event(down, [event keyCode], 0, [event modifierFlags]);
|
||||
apple_input_keyboard_event(down, event.keyCode, 0, event.modifierFlags);
|
||||
}
|
||||
else if (event_type == NSMouseMoved || event_type == NSLeftMouseDragged ||
|
||||
event_type == NSRightMouseDragged || event_type == NSOtherMouseDragged)
|
||||
{
|
||||
// Relative
|
||||
g_current_input_data.mouse_delta[0] += [event deltaX];
|
||||
g_current_input_data.mouse_delta[1] += [event deltaY];
|
||||
g_current_input_data.mouse_delta[0] += event.deltaX;
|
||||
g_current_input_data.mouse_delta[1] += event.deltaY;
|
||||
|
||||
// Absolute
|
||||
NSPoint pos = [[RAGameView get] convertPoint:[event locationInWindow] fromView:nil];
|
||||
@ -73,12 +73,12 @@ static void* const associated_core_key = (void*)&associated_core_key;
|
||||
}
|
||||
else if (event_type == NSLeftMouseDown || event_type == NSRightMouseDown || event_type == NSOtherMouseDown)
|
||||
{
|
||||
g_current_input_data.mouse_buttons |= 1 << [event buttonNumber];
|
||||
g_current_input_data.mouse_buttons |= 1 << event.buttonNumber;
|
||||
g_current_input_data.touch_count = 1;
|
||||
}
|
||||
else if (event_type == NSLeftMouseUp || event_type == NSRightMouseUp || event_type == NSOtherMouseUp)
|
||||
{
|
||||
g_current_input_data.mouse_buttons &= ~(1 << [event buttonNumber]);
|
||||
g_current_input_data.mouse_buttons &= ~(1 << event.buttonNumber);
|
||||
g_current_input_data.touch_count = 0;
|
||||
}
|
||||
}
|
||||
@ -129,10 +129,10 @@ static char** waiting_argv;
|
||||
apple_platform = self;
|
||||
_loaded = true;
|
||||
|
||||
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
|
||||
self.configDirectory = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"RetroArch"];
|
||||
self.globalConfigFile = [NSString stringWithFormat:@"%@/retroarch.cfg", self.configDirectory];
|
||||
self.coreDirectory = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"Contents/Resources/modules"];
|
||||
NSArray* paths = (NSArray*)NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
|
||||
self.configDirectory = [[paths objectAtIndex:0] stringByAppendingPathComponent:BOXSTRING("RetroArch")];
|
||||
self.globalConfigFile = [NSString stringWithFormat:BOXSTRING("%@/retroarch.cfg"), self.configDirectory];
|
||||
self.coreDirectory = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:BOXSTRING("Contents/Resources/modules")];
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||
[self.window setCollectionBehavior:[self.window collectionBehavior] | NSWindowCollectionBehaviorFullScreenPrimary];
|
||||
@ -142,28 +142,34 @@ static char** waiting_argv;
|
||||
|
||||
[[RAGameView get] setFrame: [[self.window contentView] bounds]];
|
||||
[[self.window contentView] setAutoresizesSubviews:YES];
|
||||
#if defined(IOS) || defined(MAC_OS_X_VERSION_10_5)
|
||||
[[self.window contentView] addSubview:RAGameView.get];
|
||||
#endif
|
||||
[self.window makeFirstResponder:[RAGameView get]];
|
||||
|
||||
self.settingsWindow = [[[NSWindowController alloc] initWithWindowNibName:@"Settings"] autorelease];
|
||||
self.settingsWindow = [[[NSWindowController alloc] initWithWindowNibName:BOXSTRING("Settings")] autorelease];
|
||||
|
||||
// Create core select list
|
||||
NSComboBox* cb = (NSComboBox*)[[self.coreSelectSheet contentView] viewWithTag:1];
|
||||
|
||||
apple_core_info_set_core_path([self.coreDirectory UTF8String]);
|
||||
apple_core_info_set_config_path([self.configDirectory UTF8String]);
|
||||
const core_info_list_t* cores = apple_core_info_list_get();
|
||||
for (int i = 0; cores && i != cores->count; i ++)
|
||||
core_info_set_core_path(self.coreDirectory.UTF8String);
|
||||
core_info_set_config_path(self.configDirectory.UTF8String);
|
||||
const core_info_list_t* cores = (const core_info_list_t*)core_info_list_get();
|
||||
|
||||
for (int i = 0; cores && i < cores->count; i ++)
|
||||
{
|
||||
NSString* desc = BOXSTRING(cores->list[i].display_name);
|
||||
NSString* desc = (NSString*)BOXSTRING(cores->list[i].display_name);
|
||||
#if defined(MAC_OS_X_VERSION_10_6)
|
||||
/* FIXME - Rewrite this so that this is no longer an associated object - requires ObjC 2.0 runtime */
|
||||
objc_setAssociatedObject(desc, associated_core_key, apple_get_core_id(&cores->list[i]), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
[cb addItemWithObjectValue:desc];
|
||||
#endif
|
||||
[cb addItemWithObjectValue:desc];
|
||||
}
|
||||
|
||||
if ([cb numberOfItems])
|
||||
if (cb.numberOfItems)
|
||||
[cb selectItemAtIndex:0];
|
||||
else
|
||||
apple_display_alert(@"No libretro cores were found.\nSelect \"Go->Cores Directory\" from the menu and place libretro dylib files there.", @"RetroArch");
|
||||
apple_display_alert(BOXSTRING("No libretro cores were found.\nSelect \"Go->Cores Directory\" from the menu and place libretro dylib files there."), BOXSTRING("RetroArch"));
|
||||
|
||||
if (waiting_argc)
|
||||
{
|
||||
@ -202,7 +208,7 @@ static char** waiting_argv;
|
||||
|
||||
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
|
||||
{
|
||||
if ([filenames count] == 1 && [filenames objectAtIndex:0])
|
||||
if (filenames.count == 1 && [filenames objectAtIndex:0])
|
||||
{
|
||||
self.file = [filenames objectAtIndex:0];
|
||||
|
||||
@ -215,7 +221,7 @@ static char** waiting_argv;
|
||||
}
|
||||
else
|
||||
{
|
||||
apple_display_alert(@"Cannot open multiple files", @"RetroArch");
|
||||
apple_display_alert(BOXSTRING("Cannot open multiple files"), BOXSTRING("RetroArch"));
|
||||
[sender replyToOpenOrPrint:NSApplicationDelegateReplyFailure];
|
||||
}
|
||||
}
|
||||
@ -223,16 +229,21 @@ static char** waiting_argv;
|
||||
- (void)openDocument:(id)sender
|
||||
{
|
||||
NSOpenPanel* panel = [NSOpenPanel openPanel];
|
||||
#if defined(MAC_OS_X_VERSION_10_5)
|
||||
[panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result)
|
||||
{
|
||||
[[NSApplication sharedApplication] stopModal];
|
||||
|
||||
if (result == NSOKButton && [panel URL])
|
||||
if (result == NSOKButton && panel.URL)
|
||||
{
|
||||
self.file = [[panel URL] path];
|
||||
NSURL *url = (NSURL*)panel.URL;
|
||||
self.file = url.path;
|
||||
[self performSelector:@selector(chooseCore) withObject:nil afterDelay:.5f];
|
||||
}
|
||||
}];
|
||||
#else
|
||||
[panel beginSheetForDirectory:nil file:nil modalForWindopw:[self window] modalDelegate:self didEndSelector:@selector(didEndSaveSheet:returnCode:contextInfo:) contextInfo:NULL];
|
||||
#endif
|
||||
[[NSApplication sharedApplication] runModalForWindow:panel];
|
||||
}
|
||||
|
||||
@ -242,7 +253,7 @@ static char** waiting_argv;
|
||||
_wantReload = apple_is_running;
|
||||
|
||||
if (!apple_is_running)
|
||||
apple_run_core(self.core, [self.file UTF8String]);
|
||||
apple_run_core(self.core, self.file.UTF8String);
|
||||
else
|
||||
apple_event_basic_command(QUIT);
|
||||
}
|
||||
@ -263,7 +274,10 @@ static char** waiting_argv;
|
||||
return;
|
||||
|
||||
NSComboBox* cb = (NSComboBox*)[[self.coreSelectSheet contentView] viewWithTag:1];
|
||||
self.core = objc_getAssociatedObject([cb objectValueOfSelectedItem], associated_core_key);
|
||||
#if defined(MAC_OS_X_VERSION_10_6)
|
||||
/* FIXME - Rewrite this so that this is no longer an associated object - requires ObjC 2.0 runtime */
|
||||
self.core = objc_getAssociatedObject(cb.objectValueOfSelectedItem, associated_core_key);
|
||||
#endif
|
||||
|
||||
[self runCore];
|
||||
}
|
||||
@ -281,7 +295,7 @@ static char** waiting_argv;
|
||||
[[NSApplication sharedApplication] terminate:nil];
|
||||
|
||||
if (_wantReload)
|
||||
apple_run_core(self.core, [self.file UTF8String]);
|
||||
apple_run_core(self.core, self.file.UTF8String);
|
||||
else if(apple_use_tv_mode)
|
||||
apple_run_core(nil, 0);
|
||||
else
|
||||
|
@ -16,7 +16,7 @@
|
||||
#import <objc/runtime.h>
|
||||
#import "../common/RetroArch_Apple.h"
|
||||
#include "../common/setting_data.h"
|
||||
#include "../common/apple_input.h"
|
||||
#include "../../input/apple_input.h"
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../input/input_common.h"
|
||||
@ -88,9 +88,12 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
@end
|
||||
|
||||
|
||||
@interface RASettingsDelegate : NSObject<NSTableViewDataSource, NSTableViewDelegate,
|
||||
NSOutlineViewDataSource, NSOutlineViewDelegate,
|
||||
NSWindowDelegate>
|
||||
@interface RASettingsDelegate : NSObject
|
||||
#ifdef MAC_OS_X_VERSION_10_6
|
||||
<NSTableViewDataSource, NSTableViewDelegate,
|
||||
NSOutlineViewDataSource, NSOutlineViewDelegate,
|
||||
NSWindowDelegate>
|
||||
#endif
|
||||
{
|
||||
RAInputBinder* _binderWindow;
|
||||
NSButtonCell* _booleanCell;
|
||||
@ -141,7 +144,7 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
|
||||
setting_data_load_current();
|
||||
|
||||
const rarch_setting_t* setting_data = setting_data_get_list();
|
||||
const rarch_setting_t *setting_data = (const rarch_setting_t *)setting_data_get_list();
|
||||
|
||||
for (int i = 0; setting_data[i].type; i ++)
|
||||
{
|
||||
@ -150,7 +153,10 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
case ST_GROUP:
|
||||
{
|
||||
thisGroup = [NSMutableArray array];
|
||||
objc_setAssociatedObject(thisGroup, associated_name_tag, [NSString stringWithFormat:@"%s", setting_data[i].name], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
#if defined(MAC_OS_X_VERSION_10_6)
|
||||
/* FIXME - Rewrite this so that this is no longer an associated object - requires ObjC 2.0 runtime */
|
||||
objc_setAssociatedObject(thisGroup, associated_name_tag, [NSString stringWithFormat:BOXSTRING("%s"), setting_data[i].name], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@ -165,7 +171,10 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
case ST_SUB_GROUP:
|
||||
{
|
||||
thisSubGroup = [NSMutableArray array];
|
||||
objc_setAssociatedObject(thisSubGroup, associated_name_tag, [NSString stringWithFormat:@"%s", setting_data[i].name], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
#if defined(MAC_OS_X_VERSION_10_6)
|
||||
/* FIXME - Rewrite this so that this is no longer an associated object - requires ObjC 2.0 runtime */
|
||||
objc_setAssociatedObject(thisSubGroup, associated_name_tag, [NSString stringWithFormat:BOXSTRING("%s"), setting_data[i].name], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@ -184,14 +193,20 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setting_data_load_config_path(setting_data_get_list(), [apple_platform.globalConfigFile UTF8String]);
|
||||
|
||||
#ifdef MAC_OS_X_VERSION_10_6
|
||||
/* FIXME - fix for 10.5.8 and lower */
|
||||
setting_data_load_config_path(setting_data_get_list(), apple_platform.globalConfigFile.UTF8String);
|
||||
#endif
|
||||
apple_stop_iteration();
|
||||
}
|
||||
|
||||
- (void)windowWillClose:(NSNotification *)notification
|
||||
{
|
||||
setting_data_save_config_path(setting_data_get_list(), [apple_platform.globalConfigFile UTF8String]);
|
||||
#ifdef MAC_OS_X_VERSION_10_6
|
||||
/* FIXME - fix for 10.5.8 and lower */
|
||||
setting_data_save_config_path(setting_data_get_list(), apple_platform.globalConfigFile.UTF8String);
|
||||
#endif
|
||||
[NSApp stopModal];
|
||||
|
||||
apple_start_iteration();
|
||||
@ -200,12 +215,17 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
#pragma mark Section Table
|
||||
- (NSInteger)numberOfRowsInTableView:(NSTableView*)view
|
||||
{
|
||||
return [self.settings count];
|
||||
return self.settings.count;
|
||||
}
|
||||
|
||||
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
|
||||
{
|
||||
#if defined(MAC_OS_X_VERSION_10_6)
|
||||
return objc_getAssociatedObject([self.settings objectAtIndex:row], associated_name_tag);
|
||||
#else
|
||||
/* FIXME - Rewrite this so that this is no longer an associated object - requires ObjC 2.0 runtime */
|
||||
return 0; /* stub */
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
|
||||
@ -242,25 +262,30 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
|
||||
if ([item isKindOfClass:[NSArray class]])
|
||||
{
|
||||
if ([[tableColumn identifier] isEqualToString:@"left"])
|
||||
#ifdef MAC_OS_X_VERSION_10_6
|
||||
/* FIXME - Rewrite this so that this is no longer an associated object - requires ObjC 2.0 runtime */
|
||||
if ([[tableColumn identifier] isEqualToString:BOXSTRING("left")])
|
||||
return objc_getAssociatedObject(item, associated_name_tag);
|
||||
else
|
||||
return @"";
|
||||
#endif
|
||||
return BOXSTRING("");
|
||||
}
|
||||
else
|
||||
{
|
||||
const rarch_setting_t* setting_data = setting_data_get_list();
|
||||
const rarch_setting_t* setting = &setting_data[[item intValue]];
|
||||
const rarch_setting_t* setting_data = (const rarch_setting_t*)setting_data_get_list();
|
||||
const rarch_setting_t* setting = (const rarch_setting_t*)&setting_data[[item intValue]];
|
||||
char buffer[PATH_MAX];
|
||||
|
||||
if ([[tableColumn identifier] isEqualToString:@"left"])
|
||||
if ([[tableColumn identifier] isEqualToString:BOXSTRING("left")])
|
||||
return BOXSTRING(setting->short_description);
|
||||
else
|
||||
{
|
||||
switch (setting->type)
|
||||
{
|
||||
case ST_BOOL: return BOXINT(*setting->value.boolean);
|
||||
default: return BOXSTRING(setting_data_get_string_representation(setting, buffer, sizeof(buffer)));
|
||||
case ST_BOOL:
|
||||
return BOXINT(*setting->value.boolean);
|
||||
default:
|
||||
return BOXSTRING(setting_data_get_string_representation(setting, buffer, sizeof(buffer)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -274,17 +299,20 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
if ([item isKindOfClass:[NSArray class]])
|
||||
return [tableColumn dataCell];
|
||||
|
||||
if ([[tableColumn identifier] isEqualToString:@"left"])
|
||||
if ([[tableColumn identifier] isEqualToString:BOXSTRING("left")])
|
||||
return [tableColumn dataCell];
|
||||
|
||||
const rarch_setting_t* setting_data = setting_data_get_list();
|
||||
const rarch_setting_t* setting = &setting_data[[item intValue]];
|
||||
const rarch_setting_t *setting_data = (const rarch_setting_t *)setting_data_get_list();
|
||||
const rarch_setting_t *setting = (const rarch_setting_t *)&setting_data[[item intValue]];
|
||||
|
||||
switch (setting->type)
|
||||
{
|
||||
case ST_BOOL: return self.booleanCell;
|
||||
case ST_BIND: return self.binderCell;
|
||||
default: return [tableColumn dataCell];
|
||||
case ST_BOOL:
|
||||
return self.booleanCell;
|
||||
case ST_BIND:
|
||||
return self.binderCell;
|
||||
default:
|
||||
return tableColumn.dataCell;
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,14 +324,19 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
|
||||
if ([item isKindOfClass:[NSNumber class]])
|
||||
{
|
||||
const rarch_setting_t* setting_data = setting_data_get_list();
|
||||
const rarch_setting_t* setting = &setting_data[[item intValue]];
|
||||
const rarch_setting_t* setting_data = (const rarch_setting_t*)setting_data_get_list();
|
||||
const rarch_setting_t* setting = (const rarch_setting_t*)&setting_data[[item intValue]];
|
||||
|
||||
switch (setting->type)
|
||||
{
|
||||
case ST_BOOL: *setting->value.boolean = !*setting->value.boolean; return;
|
||||
case ST_BIND: [self.binderWindow runForSetting:setting onWindow:[self.outline window]]; return;
|
||||
default: return;
|
||||
case ST_BOOL:
|
||||
*setting->value.boolean = !*setting->value.boolean;
|
||||
break;
|
||||
case ST_BIND:
|
||||
[self.binderWindow runForSetting:setting onWindow:[self.outline window]];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -313,16 +346,17 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
{
|
||||
if ([notification object] == self.outline)
|
||||
{
|
||||
NSText* editor = [[notification userInfo] objectForKey:@"NSFieldEditor"];
|
||||
NSText* editor = [[notification userInfo] objectForKey:BOXSTRING("NSFieldEditor")];
|
||||
|
||||
id item = [self.outline itemAtRow:[self.outline selectedRow]];
|
||||
|
||||
if ([item isKindOfClass:[NSNumber class]])
|
||||
{
|
||||
const rarch_setting_t* setting_data = setting_data_get_list();
|
||||
const rarch_setting_t* setting = &setting_data[[item intValue]];
|
||||
const rarch_setting_t* setting_data = (const rarch_setting_t *)setting_data_get_list();
|
||||
const rarch_setting_t* setting = (const rarch_setting_t*)&setting_data[[item intValue]];
|
||||
NSString *editor_string = (NSString*)editor.string;
|
||||
|
||||
setting_data_set_with_string_representation(setting, [editor.string UTF8String]);
|
||||
setting_data_set_with_string_representation(setting, editor_string.UTF8String);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -300,17 +300,17 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/OSX/RetroArch-Info.plist";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.5;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_CFLAGS = (
|
||||
"-DHAVE_GRIFFIN",
|
||||
"-DHAVE_CC_RESAMPLER",
|
||||
"-DHAVE_LOCATION",
|
||||
"-DHAVE_RGUI",
|
||||
"-DHAVE_MENU",
|
||||
"-DOSX",
|
||||
"-DHAVE_OPENGL",
|
||||
"-DHAVE_FBO",
|
||||
"-DHAVE_VID_CONTEXT",
|
||||
"-DHAVE_GLSL",
|
||||
"-DINLINE=inline",
|
||||
"-DLSB_FIRST",
|
||||
@ -324,6 +324,7 @@
|
||||
"-DSINC_LOWER_QUALITY",
|
||||
"-DHAVE_NETPLAY",
|
||||
"-DRARCH_INTERNAL",
|
||||
"-DHAVE_THREADS",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
@ -353,19 +354,19 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/OSX/RetroArch-Info.plist";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.5;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_CFLAGS = (
|
||||
"-DNS_BLOCK_ASSERTIONS=1",
|
||||
"-DNDEBUG",
|
||||
"-DHAVE_GRIFFIN",
|
||||
"-DHAVE_CC_RESAMPLER",
|
||||
"-DHAVE_LOCATION",
|
||||
"-DHAVE_RGUI",
|
||||
"-DHAVE_MENU",
|
||||
"-DOSX",
|
||||
"-DHAVE_OPENGL",
|
||||
"-DHAVE_FBO",
|
||||
"-DHAVE_VID_CONTEXT",
|
||||
"-DHAVE_GLSL",
|
||||
"-DINLINE=inline",
|
||||
"-DLSB_FIRST",
|
||||
@ -379,6 +380,7 @@
|
||||
"-DSINC_LOWER_QUALITY",
|
||||
"-DHAVE_NETPLAY",
|
||||
"-DRARCH_INTERNAL",
|
||||
"-DHAVE_THREADS",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; };
|
||||
7A7C248118FC43ED00DB92FD /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A7C248018FC43ED00DB92FD /* CoreFoundation.framework */; };
|
||||
7A7C24C318FC446400DB92FD /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A7C24C218FC446400DB92FD /* IOKit.framework */; };
|
||||
7AA19E9618AA09D000D16488 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7AA19E9518AA09D000D16488 /* OpenGL.framework */; };
|
||||
7AA19E9E18AA0C9900D16488 /* platform.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AA19E9D18AA0C9900D16488 /* platform.m */; };
|
||||
7AA19EA018AA0CA600D16488 /* settings.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AA19E9F18AA0CA600D16488 /* settings.m */; };
|
||||
@ -27,6 +29,8 @@
|
||||
1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
|
||||
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
|
||||
7A7C248018FC43ED00DB92FD /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
|
||||
7A7C24C218FC446400DB92FD /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
|
||||
7AA19E9518AA09D000D16488 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
|
||||
7AA19E9D18AA0C9900D16488 /* platform.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = platform.m; path = ../OSX/platform.m; sourceTree = SOURCE_ROOT; };
|
||||
7AA19E9F18AA0CA600D16488 /* settings.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = settings.m; path = ../OSX/settings.m; sourceTree = SOURCE_ROOT; };
|
||||
@ -46,6 +50,8 @@
|
||||
files = (
|
||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
|
||||
7AA19E9618AA09D000D16488 /* OpenGL.framework in Frameworks */,
|
||||
7A7C248118FC43ED00DB92FD /* CoreFoundation.framework in Frameworks */,
|
||||
7A7C24C318FC446400DB92FD /* IOKit.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -88,6 +94,8 @@
|
||||
29B97314FDCFA39411CA2CEA /* RetroArch_OSX_PPC */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7A7C248018FC43ED00DB92FD /* CoreFoundation.framework */,
|
||||
7A7C24C218FC446400DB92FD /* IOKit.framework */,
|
||||
7AA19E9518AA09D000D16488 /* OpenGL.framework */,
|
||||
080E96DDFE201D6D7F000001 /* Classes */,
|
||||
29B97315FDCFA39411CA2CEA /* Other Sources */,
|
||||
@ -284,13 +292,17 @@
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_CFLAGS = (
|
||||
"-DHAVE_DYNAMIC,",
|
||||
"-DHAVE_GRIFFIN,",
|
||||
"-DHAVE_CC_RESAMPLER,",
|
||||
"-DHAVE_MENU,",
|
||||
"-DWANT_RPNG,",
|
||||
"-DHAVE_OPENGL,",
|
||||
"-DWANT_MINIZ,",
|
||||
"-DHAVE_ZLIB,",
|
||||
"-DRARCH_INTERNAL,",
|
||||
"-DOSX",
|
||||
"-DOSX,",
|
||||
"-DHAVE_GLSL,",
|
||||
"-DHAVE_RGUI",
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
|
||||
@ -309,13 +321,17 @@
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
OTHER_CFLAGS = (
|
||||
"-DHAVE_DYNAMIC,",
|
||||
"-DHAVE_GRIFFIN,",
|
||||
"-DHAVE_CC_RESAMPLER,",
|
||||
"-DHAVE_MENU,",
|
||||
"-DWANT_RPNG,",
|
||||
"-DHAVE_OPENGL,",
|
||||
"-DWANT_MINIZ,",
|
||||
"-DHAVE_ZLIB,",
|
||||
"-DRARCH_INTERNAL,",
|
||||
"-DOSX",
|
||||
"-DOSX,",
|
||||
"-DHAVE_GLSL,",
|
||||
"-DHAVE_RGUI",
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -9,8 +9,6 @@
|
||||
/* Begin PBXBuildFile section */
|
||||
501881EC184BAD6D006F665D /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 501881EB184BAD6D006F665D /* AVFoundation.framework */; };
|
||||
501881EE184BB54C006F665D /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 501881ED184BB54C006F665D /* CoreMedia.framework */; };
|
||||
5027DAD91871E55B007F4DA5 /* sinc_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 5027DAD81871E55B007F4DA5 /* sinc_neon.S */; };
|
||||
5027DADB1871E572007F4DA5 /* utils_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 5027DADA1871E572007F4DA5 /* utils_neon.S */; };
|
||||
509FC979183F9F18007A5A30 /* menu.m in Sources */ = {isa = PBXBuildFile; fileRef = 509FC978183F9F18007A5A30 /* menu.m */; };
|
||||
50CCC828185E0E7D001F5BC8 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50CCC827185E0E7D001F5BC8 /* CoreLocation.framework */; };
|
||||
50E7189F184B88AA001956CE /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50E7189E184B88AA001956CE /* CoreVideo.framework */; };
|
||||
@ -46,8 +44,6 @@
|
||||
/* Begin PBXFileReference section */
|
||||
501881EB184BAD6D006F665D /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
|
||||
501881ED184BB54C006F665D /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
|
||||
5027DAD81871E55B007F4DA5 /* sinc_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = sinc_neon.S; sourceTree = "<group>"; };
|
||||
5027DADA1871E572007F4DA5 /* utils_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = utils_neon.S; sourceTree = "<group>"; };
|
||||
509FC978183F9F18007A5A30 /* menu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = menu.m; path = iOS/menu.m; sourceTree = SOURCE_ROOT; };
|
||||
50CCC827185E0E7D001F5BC8 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
|
||||
50E7189E184B88AA001956CE /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
|
||||
@ -209,8 +205,6 @@
|
||||
96AFAEE516C1DC73009DE44C /* audio */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5027DADA1871E572007F4DA5 /* utils_neon.S */,
|
||||
5027DAD81871E55B007F4DA5 /* sinc_neon.S */,
|
||||
);
|
||||
name = audio;
|
||||
path = ../audio;
|
||||
@ -318,9 +312,7 @@
|
||||
963C3C32186E3D2600A6EB1E /* apple_gamecontroller.m in Sources */,
|
||||
96297A0F16C5AEA100E6DCE0 /* main.m in Sources */,
|
||||
963F5AC816CC523B009BBD19 /* RAGameView.m in Sources */,
|
||||
5027DADB1871E572007F4DA5 /* utils_neon.S in Sources */,
|
||||
D48581DE16F823F9004BEB17 /* griffin.c in Sources */,
|
||||
5027DAD91871E55B007F4DA5 /* sinc_neon.S in Sources */,
|
||||
96337E82176AC6E5004685F3 /* utility.m in Sources */,
|
||||
509FC979183F9F18007A5A30 /* menu.m in Sources */,
|
||||
9678945B1788EAAE00D6CA69 /* browser.m in Sources */,
|
||||
@ -366,10 +358,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = ../;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_CFLAGS = (
|
||||
"-DHAVE_CAMERA",
|
||||
"-DHAVE_CC_RESAMPLER",
|
||||
"-DHAVE_GRIFFIN",
|
||||
"-DHAVE_LOCATION",
|
||||
"-DHAVE_RGUI",
|
||||
@ -379,12 +372,11 @@
|
||||
"-DHAVE_OPENGL",
|
||||
"-DHAVE_FBO",
|
||||
"-DHAVE_OPENGLES",
|
||||
"-DHAVE_VID_CONTEXT",
|
||||
"-DHAVE_OPENGLES2",
|
||||
"-DHAVE_GLSL",
|
||||
"-DINLINE=inline",
|
||||
"-DLSB_FIRST",
|
||||
"-DHAVE_THREAD",
|
||||
"-DHAVE_THREADS",
|
||||
"-D__LIBRETRO__",
|
||||
"-DRARCH_MOBILE",
|
||||
"-std=gnu99",
|
||||
@ -413,15 +405,17 @@
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_OPTIMIZATION_LEVEL = 2;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = ../;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
|
||||
OTHER_CFLAGS = (
|
||||
"-DNS_BLOCK_ASSERTIONS=1",
|
||||
"-DNDEBUG",
|
||||
"-DHAVE_CAMERA",
|
||||
"-DHAVE_CC_RESAMPLER",
|
||||
"-DHAVE_GRIFFIN",
|
||||
"-DHAVE_LOCATION",
|
||||
"-DHAVE_RGUI",
|
||||
@ -431,12 +425,11 @@
|
||||
"-DHAVE_OPENGL",
|
||||
"-DHAVE_FBO",
|
||||
"-DHAVE_OPENGLES",
|
||||
"-DHAVE_VID_CONTEXT",
|
||||
"-DHAVE_OPENGLES2",
|
||||
"-DHAVE_GLSL",
|
||||
"-DINLINE=inline",
|
||||
"-DLSB_FIRST",
|
||||
"-DHAVE_THREAD",
|
||||
"-DHAVE_THREADS",
|
||||
"-D__LIBRETRO__",
|
||||
"-DRARCH_MOBILE",
|
||||
"-std=gnu99",
|
||||
@ -467,6 +460,7 @@
|
||||
LIBRARY_SEARCH_PATHS = "";
|
||||
OTHER_CFLAGS = (
|
||||
"-DHAVE_CAMERA",
|
||||
"-DHAVE_CC_RESAMPLER",
|
||||
"-DHAVE_GRIFFIN",
|
||||
"-DHAVE_LOCATION",
|
||||
"-DHAVE_RGUI",
|
||||
@ -475,7 +469,6 @@
|
||||
"-DHAVE_OPENGL",
|
||||
"-DHAVE_FBO",
|
||||
"-DHAVE_OPENGLES",
|
||||
"-DHAVE_VID_CONTEXT",
|
||||
"-DHAVE_OPENGLES2",
|
||||
"-DHAVE_GLSL",
|
||||
"-DINLINE=inline",
|
||||
@ -512,6 +505,34 @@
|
||||
"-DNS_BLOCK_ASSERTIONS=1",
|
||||
"-DNDEBUG",
|
||||
"-DHAVE_CAMERA",
|
||||
"-DHAVE_CC_RESAMPLER",
|
||||
"-DHAVE_GRIFFIN",
|
||||
"-DHAVE_LOCATION",
|
||||
"-DHAVE_RGUI",
|
||||
"-DHAVE_MENU",
|
||||
"-DIOS",
|
||||
"-DHAVE_OPENGL",
|
||||
"-DHAVE_FBO",
|
||||
"-DHAVE_OPENGLES",
|
||||
"-DHAVE_OPENGLES2",
|
||||
"-DHAVE_GLSL",
|
||||
"-DINLINE=inline",
|
||||
"-DLSB_FIRST",
|
||||
"-D__LIBRETRO__",
|
||||
"-DRARCH_MOBILE",
|
||||
"-DHAVE_COREAUDIO",
|
||||
"-DHAVE_DYNAMIC",
|
||||
"-DHAVE_OVERLAY",
|
||||
"-DHAVE_ZLIB",
|
||||
"-DWANT_MINIZ",
|
||||
"-DSINC_LOWER_QUALITY",
|
||||
"-DRARCH_INTERNAL",
|
||||
);
|
||||
"OTHER_CFLAGS[arch=*]" = (
|
||||
"-DNS_BLOCK_ASSERTIONS=1",
|
||||
"-DNDEBUG",
|
||||
"-DHAVE_CAMERA",
|
||||
"-DHAVE_CC_RESAMPLER",
|
||||
"-DHAVE_GRIFFIN",
|
||||
"-DHAVE_LOCATION",
|
||||
"-DHAVE_RGUI",
|
||||
@ -520,7 +541,6 @@
|
||||
"-DHAVE_OPENGL",
|
||||
"-DHAVE_FBO",
|
||||
"-DHAVE_OPENGLES",
|
||||
"-DHAVE_VID_CONTEXT",
|
||||
"-DHAVE_OPENGLES2",
|
||||
"-DHAVE_GLSL",
|
||||
"-DINLINE=inline",
|
||||
|
@ -71,7 +71,7 @@ static CLLocationAccuracy currentVerticalAccuracy;
|
||||
@implementation NSScreen (IOSCompat)
|
||||
- (CGRect)bounds
|
||||
{
|
||||
CGRect cgrect = NSRectToCGRect([self frame]);
|
||||
CGRect cgrect = (CGRect)NSRectToCGRect(self.frame);
|
||||
return CGRectMake(0, 0, CGRectGetWidth(cgrect), CGRectGetHeight(cgrect));
|
||||
}
|
||||
- (float) scale { return 1.0f; }
|
||||
@ -97,7 +97,7 @@ static bool newFrame = false;
|
||||
|
||||
#elif defined(OSX)
|
||||
|
||||
#include "apple_input.h"
|
||||
#include "../../input/apple_input.h"
|
||||
|
||||
static bool g_has_went_fullscreen;
|
||||
static NSOpenGLPixelFormat* g_format;
|
||||
@ -164,7 +164,7 @@ static bool g_is_syncing = true;
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
UINib *xib = [UINib nibWithNibName:@"PauseIndicatorView" bundle:nil];
|
||||
UINib *xib = [UINib nibWithNibName:BOXSTRING("PauseIndicatorView") bundle:nil];
|
||||
g_pause_indicator_view = [[xib instantiateWithOwner:[RetroArch_iOS get] options:nil] lastObject];
|
||||
|
||||
g_view = [GLKView new];
|
||||
@ -243,7 +243,7 @@ void event_process_camera_frame(void* pixelBufferPtr)
|
||||
{
|
||||
CVPixelBufferRef pixelBuffer = (CVPixelBufferRef)pixelBufferPtr;
|
||||
|
||||
int width, height;
|
||||
size_t width, height;
|
||||
CVReturn ret;
|
||||
|
||||
width = CVPixelBufferGetWidth(pixelBuffer);
|
||||
@ -257,7 +257,7 @@ void event_process_camera_frame(void* pixelBufferPtr)
|
||||
// textureCache will be what you previously made with CVOpenGLESTextureCacheCreate
|
||||
ret = CVOpenGLESTextureCacheCreateTextureFromImage(kCFAllocatorDefault,
|
||||
textureCache, pixelBuffer, NULL, GL_TEXTURE_2D,
|
||||
GL_RGBA, width, height, GL_BGRA, GL_UNSIGNED_BYTE, 0, &renderTexture);
|
||||
GL_RGBA, (GLsizei)width, (GLsizei)height, GL_BGRA, GL_UNSIGNED_BYTE, 0, &renderTexture);
|
||||
if (!renderTexture || ret)
|
||||
{
|
||||
RARCH_ERR("ioscamera: CVOpenGLESTextureCacheCreateTextureFromImage failed.\n");
|
||||
@ -289,7 +289,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
||||
fromConnection:(AVCaptureConnection *)connection
|
||||
{
|
||||
// TODO: Don't post if event queue is full
|
||||
CVPixelBufferRef pixelBuffer = CVPixelBufferRetain(CMSampleBufferGetImageBuffer(sampleBuffer));
|
||||
CVPixelBufferRef pixelBuffer = (CVPixelBufferRef)CVPixelBufferRetain(CMSampleBufferGetImageBuffer(sampleBuffer));
|
||||
event_process_camera_frame(pixelBuffer);
|
||||
}
|
||||
|
||||
@ -320,13 +320,13 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
||||
[_session setSessionPreset:_sessionPreset];
|
||||
|
||||
//-- Creata a video device and input from that Device. Add the input to the capture session.
|
||||
AVCaptureDevice * videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
|
||||
AVCaptureDevice *videoDevice = (AVCaptureDevice*)[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
|
||||
if(videoDevice == nil)
|
||||
assert(0);
|
||||
|
||||
//-- Add the device to the session.
|
||||
NSError *error;
|
||||
AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error];
|
||||
AVCaptureDeviceInput *input = (AVCaptureDeviceInput*)[AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error];
|
||||
if(error)
|
||||
{
|
||||
RARCH_ERR("video device input %s\n", error.localizedDescription.UTF8String);
|
||||
@ -336,7 +336,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
||||
[_session addInput:input];
|
||||
|
||||
//-- Create the output for the capture session.
|
||||
AVCaptureVideoDataOutput * dataOutput = [[AVCaptureVideoDataOutput alloc] init];
|
||||
AVCaptureVideoDataOutput * dataOutput = (AVCaptureVideoDataOutput*)[[AVCaptureVideoDataOutput alloc] init];
|
||||
[dataOutput setAlwaysDiscardsLateVideoFrames:NO]; // Probably want to set this to NO when recording
|
||||
|
||||
[dataOutput setVideoSettings:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:kCVPixelFormatType_32BGRA] forKey:(id)kCVPixelBufferPixelFormatTypeKey]];
|
||||
@ -391,11 +391,11 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
||||
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
|
||||
{
|
||||
locationChanged = true;
|
||||
CLLocation *location = [locations objectAtIndex:([locations count] - 1)];
|
||||
CLLocation *location = (CLLocation*)[locations objectAtIndex:([locations count] - 1)];
|
||||
currentLatitude = [location coordinate].latitude;
|
||||
currentLongitude = [location coordinate].longitude;
|
||||
currentHorizontalAccuracy = [location horizontalAccuracy];
|
||||
currentVerticalAccuracy = [location verticalAccuracy];
|
||||
currentHorizontalAccuracy = location.horizontalAccuracy;
|
||||
currentVerticalAccuracy = location.verticalAccuracy;
|
||||
RARCH_LOG("didUpdateLocations - latitude %f, longitude %f\n", (float)currentLatitude, (float)currentLongitude);
|
||||
}
|
||||
|
||||
@ -431,27 +431,32 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
||||
@end
|
||||
|
||||
static RAScreen* get_chosen_screen(void)
|
||||
{
|
||||
{
|
||||
#if defined(OSX) && !defined(MAC_OS_X_VERSION_10_6)
|
||||
#else
|
||||
if (g_settings.video.monitor_index >= RAScreen.screens.count)
|
||||
{
|
||||
RARCH_WARN("video_monitor_index is greater than the number of connected monitors; using main screen instead.\n");
|
||||
return [RAScreen mainScreen];
|
||||
}
|
||||
#endif
|
||||
|
||||
NSArray *screens = [RAScreen screens];
|
||||
NSArray *screens = (NSArray*)[RAScreen screens];
|
||||
return (RAScreen*)[screens objectAtIndex:g_settings.video.monitor_index];
|
||||
}
|
||||
|
||||
bool apple_gfx_ctx_init(void)
|
||||
bool apple_gfx_ctx_init(void *data)
|
||||
{
|
||||
(void)data;
|
||||
// Make sure the view was created
|
||||
[RAGameView get];
|
||||
g_initialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void apple_gfx_ctx_destroy(void)
|
||||
void apple_gfx_ctx_destroy(void *data)
|
||||
{
|
||||
(void)data;
|
||||
g_initialized = false;
|
||||
|
||||
[GLContextClass clearCurrentContext];
|
||||
@ -463,8 +468,9 @@ void apple_gfx_ctx_destroy(void)
|
||||
g_context = nil;
|
||||
}
|
||||
|
||||
bool apple_gfx_ctx_bind_api(enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
bool apple_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
(void)data;
|
||||
if (api != GLAPIType)
|
||||
return false;
|
||||
|
||||
@ -501,8 +507,9 @@ bool apple_gfx_ctx_bind_api(enum gfx_ctx_api api, unsigned major, unsigned minor
|
||||
return true;
|
||||
}
|
||||
|
||||
void apple_gfx_ctx_swap_interval(unsigned interval)
|
||||
void apple_gfx_ctx_swap_interval(void *data, unsigned interval)
|
||||
{
|
||||
(void)data;
|
||||
#ifdef IOS // < No way to disable Vsync on iOS?
|
||||
// Just skip presents so fast forward still works.
|
||||
g_is_syncing = interval ? true : false;
|
||||
@ -513,8 +520,9 @@ void apple_gfx_ctx_swap_interval(unsigned interval)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool apple_gfx_ctx_set_video_mode(unsigned width, unsigned height, bool fullscreen)
|
||||
bool apple_gfx_ctx_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen)
|
||||
{
|
||||
(void)data;
|
||||
#ifdef OSX
|
||||
// TODO: Sceen mode support
|
||||
|
||||
@ -540,30 +548,32 @@ bool apple_gfx_ctx_set_video_mode(unsigned width, unsigned height, bool fullscre
|
||||
return true;
|
||||
}
|
||||
|
||||
void apple_gfx_ctx_get_video_size(unsigned* width, unsigned* height)
|
||||
void apple_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height)
|
||||
{
|
||||
RAScreen* screen = get_chosen_screen();
|
||||
(void)data;
|
||||
RAScreen* screen = (RAScreen*)get_chosen_screen();
|
||||
CGRect size;
|
||||
|
||||
if (g_initialized)
|
||||
{
|
||||
#if defined(OSX)
|
||||
CGRect cgrect = NSRectToCGRect([g_view frame]);
|
||||
CGRect cgrect = (CGRect)NSRectToCGRect([g_view frame]);
|
||||
size = CGRectMake(0, 0, CGRectGetWidth(cgrect), CGRectGetHeight(cgrect));
|
||||
#else
|
||||
size = [g_view bounds];
|
||||
size = g_view.bounds;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
size = [screen bounds];
|
||||
size = screen.bounds;
|
||||
|
||||
|
||||
*width = CGRectGetWidth(size) * [screen scale];
|
||||
*height = CGRectGetHeight(size) * [screen scale];
|
||||
*width = CGRectGetWidth(size) * screen.scale;
|
||||
*height = CGRectGetHeight(size) * screen.scale;
|
||||
}
|
||||
|
||||
void apple_gfx_ctx_update_window_title(void)
|
||||
void apple_gfx_ctx_update_window_title(void *data)
|
||||
{
|
||||
(void)data;
|
||||
static char buf[128], buf_fps[128];
|
||||
bool fps_draw = g_settings.fps_show;
|
||||
bool got_text = gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps));
|
||||
@ -578,20 +588,22 @@ void apple_gfx_ctx_update_window_title(void)
|
||||
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
|
||||
}
|
||||
|
||||
bool apple_gfx_ctx_has_focus(void)
|
||||
bool apple_gfx_ctx_has_focus(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return APP_HAS_FOCUS;
|
||||
}
|
||||
|
||||
void apple_gfx_ctx_swap_buffers()
|
||||
void apple_gfx_ctx_swap_buffers(void *data)
|
||||
{
|
||||
bool swap = --g_fast_forward_skips < 0;
|
||||
|
||||
if (!swap)
|
||||
return;
|
||||
|
||||
[g_view display];
|
||||
g_fast_forward_skips = g_is_syncing ? 0 : 3;
|
||||
(void)data;
|
||||
bool swap = --g_fast_forward_skips < 0;
|
||||
|
||||
if (!swap)
|
||||
return;
|
||||
|
||||
[g_view display];
|
||||
g_fast_forward_skips = g_is_syncing ? 0 : 3;
|
||||
}
|
||||
|
||||
gfx_ctx_proc_t apple_gfx_ctx_get_proc_address(const char *symbol_name)
|
||||
@ -701,7 +713,7 @@ typedef struct apple_location
|
||||
void *empty;
|
||||
} applelocation_t;
|
||||
|
||||
static void *apple_location_init()
|
||||
static void *apple_location_init(void)
|
||||
{
|
||||
applelocation_t *applelocation = (applelocation_t*)calloc(1, sizeof(applelocation_t));
|
||||
if (!applelocation)
|
||||
@ -755,10 +767,10 @@ static bool apple_location_get_position(void *data, double *lat, double *lon, do
|
||||
if (!ret)
|
||||
goto fail;
|
||||
|
||||
*lat = currentLatitude;
|
||||
*lon = currentLongitude;
|
||||
*lat = currentLatitude;
|
||||
*lon = currentLongitude;
|
||||
*horiz_accuracy = currentHorizontalAccuracy;
|
||||
*vert_accuracy = currentVerticalAccuracy;
|
||||
*vert_accuracy = currentVerticalAccuracy;
|
||||
return true;
|
||||
|
||||
fail:
|
||||
|
@ -20,8 +20,7 @@
|
||||
#include <Foundation/Foundation.h>
|
||||
#import <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
#include "../../core_info.h"
|
||||
#include "core_info_ext.h"
|
||||
#include "../../frontend/info/core_info.h"
|
||||
#include "setting_data.h"
|
||||
#include "apple_export.h"
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#ifndef __APPLE_RARCH_GAMECONTROLLER_H__
|
||||
#define __APPLE_RARCH_GAMECONTROLLER_H__
|
||||
|
||||
void apple_gamecontroller_init();
|
||||
void apple_gamecontroller_poll_all();
|
||||
void apple_gamecontroller_init(void);
|
||||
void apple_gamecontroller_poll_all(void);
|
||||
|
||||
#endif
|
||||
|
@ -24,7 +24,7 @@
|
||||
#define IS_PRESSED(x) (x.value > .01f)
|
||||
|
||||
#import <GameController/GameController.h>
|
||||
#include "apple_input.h"
|
||||
#include "../../input/apple_input.h"
|
||||
|
||||
static void apple_gamecontroller_poll(GCController* controller)
|
||||
{
|
||||
@ -35,13 +35,13 @@ static void apple_gamecontroller_poll(GCController* controller)
|
||||
if (!controller || controller.playerIndex == MAX_PLAYERS)
|
||||
return;
|
||||
|
||||
uint32_t slot = controller.playerIndex;
|
||||
uint32_t slot = (uint32_t)controller.playerIndex;
|
||||
g_current_input_data.pad_buttons[slot] = 0;
|
||||
memset(g_current_input_data.pad_axis[slot], 0, sizeof(g_current_input_data.pad_axis[0]));
|
||||
|
||||
if (controller.extendedGamepad)
|
||||
{
|
||||
GCExtendedGamepad* gp = controller.extendedGamepad;
|
||||
GCExtendedGamepad* gp = (GCExtendedGamepad*)controller.extendedGamepad;
|
||||
g_current_input_data.pad_buttons[slot] |= IS_PRESSED(gp.dpad.up) ? 1 : 0;
|
||||
g_current_input_data.pad_buttons[slot] |= IS_PRESSED(gp.dpad.down) ? 2 : 0;
|
||||
g_current_input_data.pad_buttons[slot] |= IS_PRESSED(gp.dpad.left) ? 4 : 0;
|
||||
@ -62,7 +62,7 @@ static void apple_gamecontroller_poll(GCController* controller)
|
||||
}
|
||||
else if (controller.gamepad)
|
||||
{
|
||||
GCGamepad* gp = controller.gamepad;
|
||||
GCGamepad* gp = (GCGamepad*)controller.gamepad;
|
||||
g_current_input_data.pad_buttons[slot] |= IS_PRESSED(gp.dpad.up) ? 1 : 0;
|
||||
g_current_input_data.pad_buttons[slot] |= IS_PRESSED(gp.dpad.down) ? 2 : 0;
|
||||
g_current_input_data.pad_buttons[slot] |= IS_PRESSED(gp.dpad.left) ? 4 : 0;
|
||||
@ -82,9 +82,9 @@ void apple_gamecontroller_poll_all(void)
|
||||
if (IOS_IS_VERSION_6_OR_LOWER())
|
||||
return;
|
||||
#endif
|
||||
NSArray* controllers = [GCController controllers];
|
||||
NSArray* controllers = (NSArray*)GCController.controllers;
|
||||
|
||||
for (int i = 0; i != [controllers count]; i ++)
|
||||
for (int i = 0; i < controllers.count; i ++)
|
||||
apple_gamecontroller_poll([controllers objectAtIndex:i]);
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ void apple_gamecontroller_disconnect(GCController* controller)
|
||||
if (controller.playerIndex == GCControllerPlayerIndexUnset)
|
||||
return;
|
||||
|
||||
apple_joypad_disconnect(controller.playerIndex);
|
||||
apple_joypad_disconnect((uint32_t)controller.playerIndex);
|
||||
}
|
||||
|
||||
void apple_gamecontroller_init(void)
|
||||
|
@ -1,112 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2013-2014 - Jason Fetters
|
||||
*
|
||||
* 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 "core_info_ext.h"
|
||||
|
||||
static core_info_list_t* global_core_list = 0;
|
||||
static char core_config_path[PATH_MAX];
|
||||
|
||||
void apple_core_info_set_core_path(const char* core_path)
|
||||
{
|
||||
if (global_core_list)
|
||||
core_info_list_free(global_core_list);
|
||||
|
||||
global_core_list = core_path ? core_info_list_new(core_path) : 0;
|
||||
|
||||
if (!global_core_list)
|
||||
RARCH_WARN("No cores were found at %s", core_path ? core_path : "(null");
|
||||
}
|
||||
|
||||
void apple_core_info_set_config_path(const char* config_path)
|
||||
{
|
||||
if (!config_path || strlcpy(core_config_path, config_path, sizeof(core_config_path)) >= PATH_MAX)
|
||||
*core_config_path = '\0';
|
||||
}
|
||||
|
||||
core_info_list_t* apple_core_info_list_get(void)
|
||||
{
|
||||
if (!global_core_list)
|
||||
RARCH_WARN("apple_core_info_list_get() called before apple_core_info_set_core_path()");
|
||||
|
||||
return global_core_list;
|
||||
}
|
||||
|
||||
const core_info_t* apple_core_info_list_get_by_id(const char* core_id)
|
||||
{
|
||||
if (core_id)
|
||||
{
|
||||
const core_info_list_t* cores = apple_core_info_list_get();
|
||||
|
||||
for (int i = 0; i != cores->count; i ++)
|
||||
if (cores->list[i].path && strcmp(core_id, cores->list[i].path) == 0)
|
||||
return &cores->list[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* apple_core_info_get_id(const core_info_t* info, char* buffer, size_t buffer_length)
|
||||
{
|
||||
if (!buffer || !buffer_length)
|
||||
return "";
|
||||
|
||||
if (info && info->path && strlcpy(buffer, info->path, buffer_length) < buffer_length)
|
||||
return buffer;
|
||||
|
||||
*buffer = 0;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
const char* apple_core_info_get_custom_config(const char* core_id, char* buffer, size_t buffer_length)
|
||||
{
|
||||
if (!core_id || !buffer || !buffer_length)
|
||||
return 0;
|
||||
|
||||
snprintf(buffer, buffer_length, "%s/%s", core_config_path, path_basename(core_id));
|
||||
fill_pathname(buffer, buffer, ".cfg", buffer_length);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
bool apple_core_info_has_custom_config(const char* core_id)
|
||||
{
|
||||
if (!core_id)
|
||||
return false;
|
||||
|
||||
char path[PATH_MAX];
|
||||
apple_core_info_get_custom_config(core_id, path, sizeof(path));
|
||||
return path_file_exists(path);
|
||||
}
|
||||
|
||||
// ROM HISTORY EXTENSIONS
|
||||
const char* apple_rom_history_get_path(rom_history_t* history, uint32_t index)
|
||||
{
|
||||
const char *path, *core_path, *core_name;
|
||||
rom_history_get_index(history, index, &path, &core_path, &core_name);
|
||||
return path ? path : "";
|
||||
}
|
||||
|
||||
const char* apple_rom_history_get_core_path(rom_history_t* history, uint32_t index)
|
||||
{
|
||||
const char *path, *core_path, *core_name;
|
||||
rom_history_get_index(history, index, &path, &core_path, &core_name);
|
||||
return core_path ? core_path : "";
|
||||
}
|
||||
|
||||
const char* apple_rom_history_get_core_name(rom_history_t* history, uint32_t index)
|
||||
{
|
||||
const char *path, *core_path, *core_name;
|
||||
rom_history_get_index(history, index, &path, &core_path, &core_name);
|
||||
return core_name ? core_name : "";
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2013-2014 - Jason Fetters
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __APPLE_RARCH_CORE_INFO_EXT_H__
|
||||
#define __APPLE_RARCH_CORE_INFO_EXT_H__
|
||||
|
||||
#include "../../core_info.h"
|
||||
#include "../../frontend/menu/history.h"
|
||||
|
||||
void apple_core_info_set_core_path(const char* core_path);
|
||||
void apple_core_info_set_config_path(const char* config_path);
|
||||
|
||||
core_info_list_t* apple_core_info_list_get(void);
|
||||
const core_info_t* apple_core_info_list_get_by_id(const char* core_id);
|
||||
const char* apple_core_info_get_id(const core_info_t* info, char* buffer, size_t buffer_length);
|
||||
|
||||
const char* apple_core_info_get_custom_config(const char* core_id, char* buffer, size_t buffer_length);
|
||||
bool apple_core_info_has_custom_config(const char* core_id);
|
||||
|
||||
|
||||
// ROM HISTORY EXTENSIONS
|
||||
const char* apple_rom_history_get_path(rom_history_t* history, uint32_t index);
|
||||
const char* apple_rom_history_get_core_path(rom_history_t* history, uint32_t index);
|
||||
const char* apple_rom_history_get_core_name(rom_history_t* history, uint32_t index);
|
||||
|
||||
#endif
|
@ -18,7 +18,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../../../boolean.h"
|
||||
#include "../apple_input.h"
|
||||
#include "../../../input/apple_input.h"
|
||||
|
||||
struct hidpad_ps3_data
|
||||
{
|
||||
@ -56,7 +56,7 @@ static void hidpad_ps3_send_control(struct hidpad_ps3_data* device)
|
||||
|
||||
static void* hidpad_ps3_connect(struct apple_pad_connection* connection, uint32_t slot)
|
||||
{
|
||||
struct hidpad_ps3_data* device = calloc(1, sizeof(struct hidpad_ps3_data));
|
||||
struct hidpad_ps3_data* device = (struct hidpad_ps3_data*)calloc(1, sizeof(struct hidpad_ps3_data));
|
||||
device->connection = connection;
|
||||
device->slot = slot;
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
static void* hidpad_wii_connect(struct apple_pad_connection* connection, uint32_t slot)
|
||||
{
|
||||
struct wiimote_t* device = calloc(1, sizeof(struct wiimote_t));
|
||||
struct wiimote_t* device = (struct wiimote_t*)calloc(1, sizeof(struct wiimote_t));
|
||||
|
||||
device->connection = connection;
|
||||
device->unid = slot;
|
||||
@ -47,11 +47,16 @@ static int16_t hidpad_wii_get_axis(struct wiimote_t* device, unsigned axis)
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0: return device->exp.cc.classic.ljs.x.value * 0x7FFF;
|
||||
case 1: return device->exp.cc.classic.ljs.y.value * 0x7FFF;
|
||||
case 2: return device->exp.cc.classic.rjs.x.value * 0x7FFF;
|
||||
case 3: return device->exp.cc.classic.rjs.y.value * 0x7FFF;
|
||||
default: return 0;
|
||||
case 0:
|
||||
return device->exp.cc.classic.ljs.x.value * 0x7FFF;
|
||||
case 1:
|
||||
return device->exp.cc.classic.ljs.y.value * 0x7FFF;
|
||||
case 2:
|
||||
return device->exp.cc.classic.rjs.x.value * 0x7FFF;
|
||||
case 3:
|
||||
return device->exp.cc.classic.rjs.y.value * 0x7FFF;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,15 +75,16 @@ void wiimote_status(struct wiimote_t* wm)
|
||||
wiimote_send(wm, WM_CMD_CTRL_STATUS, &buf, 1);
|
||||
}
|
||||
|
||||
void wiimote_data_report(struct wiimote_t* wm, byte type) {
|
||||
byte buf[2] = {0x0,0x0};
|
||||
void wiimote_data_report(struct wiimote_t* wm, byte type)
|
||||
{
|
||||
byte buf[2] = {0x0,0x0};
|
||||
|
||||
if (!wm || !WIIMOTE_IS_CONNECTED(wm))
|
||||
return;
|
||||
if (!wm || !WIIMOTE_IS_CONNECTED(wm))
|
||||
return;
|
||||
|
||||
buf[1] = type;
|
||||
//CUIDADO es un &buf?
|
||||
wiimote_send(wm, WM_CMD_REPORT_TYPE, buf, 2);
|
||||
buf[1] = type;
|
||||
//CUIDADO es un &buf?
|
||||
wiimote_send(wm, WM_CMD_REPORT_TYPE, buf, 2);
|
||||
}
|
||||
|
||||
|
||||
@ -95,18 +96,19 @@ void wiimote_data_report(struct wiimote_t* wm, byte type) {
|
||||
*
|
||||
* \a leds is a bitwise or of WIIMOTE_LED_1, WIIMOTE_LED_2, WIIMOTE_LED_3, or WIIMOTE_LED_4.
|
||||
*/
|
||||
void wiimote_set_leds(struct wiimote_t* wm, int leds) {
|
||||
byte buf;
|
||||
void wiimote_set_leds(struct wiimote_t* wm, int leds)
|
||||
{
|
||||
byte buf;
|
||||
|
||||
if (!wm || !WIIMOTE_IS_CONNECTED(wm))
|
||||
return;
|
||||
if (!wm || !WIIMOTE_IS_CONNECTED(wm))
|
||||
return;
|
||||
|
||||
/* remove the lower 4 bits because they control rumble */
|
||||
wm->leds = (leds & 0xF0);
|
||||
/* remove the lower 4 bits because they control rumble */
|
||||
wm->leds = (leds & 0xF0);
|
||||
|
||||
buf = wm->leds;
|
||||
buf = wm->leds;
|
||||
|
||||
wiimote_send(wm, WM_CMD_LED, &buf, 1);
|
||||
wiimote_send(wm, WM_CMD_LED, &buf, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,14 +117,15 @@ void wiimote_set_leds(struct wiimote_t* wm, int leds) {
|
||||
* @param wm Pointer to a wiimote_t structure.
|
||||
* @param msg The message specified in the event packet.
|
||||
*/
|
||||
void wiimote_pressed_buttons(struct wiimote_t* wm, byte* msg) {
|
||||
short now;
|
||||
void wiimote_pressed_buttons(struct wiimote_t* wm, byte* msg)
|
||||
{
|
||||
short now;
|
||||
|
||||
/* convert to big endian */
|
||||
now = BIG_ENDIAN_SHORT(*(short*)msg) & WIIMOTE_BUTTON_ALL;
|
||||
/* convert to big endian */
|
||||
now = BIG_ENDIAN_SHORT(*(short*)msg) & WIIMOTE_BUTTON_ALL;
|
||||
|
||||
/* buttons pressed now */
|
||||
wm->btns = now;
|
||||
/* buttons pressed now */
|
||||
wm->btns = now;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -131,14 +134,16 @@ void wiimote_pressed_buttons(struct wiimote_t* wm, byte* msg) {
|
||||
* @param wm A pointer to a wiimote_t structure.
|
||||
* @param msg The message specified in the event packet for the expansion.
|
||||
*/
|
||||
void wiimote_handle_expansion(struct wiimote_t* wm, byte* msg) {
|
||||
switch (wm->exp.type) {
|
||||
case EXP_CLASSIC:
|
||||
classic_ctrl_event(&wm->exp.cc.classic, msg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
void wiimote_handle_expansion(struct wiimote_t* wm, byte* msg)
|
||||
{
|
||||
switch (wm->exp.type)
|
||||
{
|
||||
case EXP_CLASSIC:
|
||||
classic_ctrl_event(&wm->exp.cc.classic, msg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -154,16 +159,17 @@ void wiimote_handle_expansion(struct wiimote_t* wm, byte* msg) {
|
||||
* The handshake will be concluded when the wiimote responds
|
||||
* with this data.
|
||||
*/
|
||||
int wiimote_handshake(struct wiimote_t* wm, byte event, byte* data, unsigned short len) {
|
||||
int wiimote_handshake(struct wiimote_t* wm, byte event, byte* data, unsigned short len)
|
||||
{
|
||||
|
||||
if (!wm) return 0;
|
||||
if (!wm) return 0;
|
||||
|
||||
while(1)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
#ifdef WIIMOTE_DBG
|
||||
printf("Handshake %d\n",wm->handshake_state);
|
||||
printf("Handshake %d\n",wm->handshake_state);
|
||||
#endif
|
||||
switch (wm->handshake_state)
|
||||
switch (wm->handshake_state)
|
||||
{
|
||||
case 0://no ha habido nunca handshake, debemos forzar un mensaje de staus para ver que pasa.
|
||||
{
|
||||
@ -230,7 +236,9 @@ int wiimote_handshake(struct wiimote_t* wm, byte event, byte* data, unsigned sh
|
||||
wm->handshake_state = 4;
|
||||
return 0;
|
||||
|
||||
} else if (!attachment && WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP)) {
|
||||
}
|
||||
else if (!attachment && WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP))
|
||||
{
|
||||
/* attachment removed */
|
||||
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP);
|
||||
wm->exp.type = EXP_NONE;
|
||||
@ -327,7 +335,7 @@ int wiimote_handshake(struct wiimote_t* wm, byte event, byte* data, unsigned sh
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -376,28 +384,29 @@ int wiimote_send(struct wiimote_t* wm, byte report_type, byte* msg, int len)
|
||||
* to a pending list and be sent out when the previous
|
||||
* finishes.
|
||||
*/
|
||||
int wiimote_read_data(struct wiimote_t* wm, unsigned int addr, unsigned short len) {
|
||||
//No puden ser mas de 16 lo leido o vendra en trozos!
|
||||
int wiimote_read_data(struct wiimote_t* wm, unsigned int addr, unsigned short len)
|
||||
{
|
||||
//No puden ser mas de 16 lo leido o vendra en trozos!
|
||||
|
||||
if (!wm || !WIIMOTE_IS_CONNECTED(wm))
|
||||
return 0;
|
||||
if (!len /*|| len > 16*/)
|
||||
return 0;
|
||||
if (!wm || !WIIMOTE_IS_CONNECTED(wm))
|
||||
return 0;
|
||||
if (!len /*|| len > 16*/)
|
||||
return 0;
|
||||
|
||||
byte buf[6];
|
||||
byte buf[6];
|
||||
|
||||
/* the offset is in big endian */
|
||||
*(int*)(buf) = BIG_ENDIAN_LONG(addr);
|
||||
/* the offset is in big endian */
|
||||
*(int*)(buf) = BIG_ENDIAN_LONG(addr);
|
||||
|
||||
/* the length is in big endian */
|
||||
*(short*)(buf + 4) = BIG_ENDIAN_SHORT(len);
|
||||
/* the length is in big endian */
|
||||
*(short*)(buf + 4) = BIG_ENDIAN_SHORT(len);
|
||||
|
||||
#ifdef WIIMOTE_DBG
|
||||
printf("Request read at address: 0x%x length: %i", addr, len);
|
||||
printf("Request read at address: 0x%x length: %i", addr, len);
|
||||
#endif
|
||||
wiimote_send(wm, WM_CMD_READ_DATA, buf, 6);
|
||||
wiimote_send(wm, WM_CMD_READ_DATA, buf, 6);
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -408,16 +417,17 @@ int wiimote_read_data(struct wiimote_t* wm, unsigned int addr, unsigned short le
|
||||
* @param data The data to be written to the memory location.
|
||||
* @param len The length of the block to be written.
|
||||
*/
|
||||
int wiimote_write_data(struct wiimote_t* wm, unsigned int addr, byte* data, byte len) {
|
||||
byte buf[21] = {0}; /* the payload is always 23 */
|
||||
int wiimote_write_data(struct wiimote_t* wm, unsigned int addr, byte* data, byte len)
|
||||
{
|
||||
byte buf[21] = {0}; /* the payload is always 23 */
|
||||
|
||||
if (!wm || !WIIMOTE_IS_CONNECTED(wm))
|
||||
return 0;
|
||||
if (!data || !len)
|
||||
return 0;
|
||||
if (!wm || !WIIMOTE_IS_CONNECTED(wm))
|
||||
return 0;
|
||||
if (!data || !len)
|
||||
return 0;
|
||||
|
||||
#ifdef WIIMOTE_DBG
|
||||
printf("Writing %i bytes to memory location 0x%x...\n", len, addr);
|
||||
printf("Writing %i bytes to memory location 0x%x...\n", len, addr);
|
||||
|
||||
int i = 0;
|
||||
printf("Write data is: ");
|
||||
@ -426,17 +436,17 @@ int wiimote_write_data(struct wiimote_t* wm, unsigned int addr, byte* data, byte
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
/* the offset is in big endian */
|
||||
*(int*)(buf) = BIG_ENDIAN_LONG(addr);
|
||||
/* the offset is in big endian */
|
||||
*(int*)(buf) = BIG_ENDIAN_LONG(addr);
|
||||
|
||||
/* length */
|
||||
*(byte*)(buf + 4) = len;
|
||||
/* length */
|
||||
*(byte*)(buf + 4) = len;
|
||||
|
||||
/* data */
|
||||
memcpy(buf + 5, data, len);
|
||||
/* data */
|
||||
memcpy(buf + 5, data, len);
|
||||
|
||||
wiimote_send(wm, WM_CMD_WRITE_DATA, buf, 21);
|
||||
return 1;
|
||||
wiimote_send(wm, WM_CMD_WRITE_DATA, buf, 21);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,173 +0,0 @@
|
||||
/*
|
||||
Taken from https://github.com/depp/keycode, distributed with the following license:
|
||||
|
||||
Copyright 2011-2012 Dietrich Epp <depp@zdome.net>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* This file is automatically generated by keycode.py. */
|
||||
#ifndef KEYCODE_KEYCODE_H
|
||||
#define KEYCODE_KEYCODE_H
|
||||
enum {
|
||||
KEY_A = 4,
|
||||
KEY_B = 5,
|
||||
KEY_C = 6,
|
||||
KEY_D = 7,
|
||||
KEY_E = 8,
|
||||
KEY_F = 9,
|
||||
KEY_G = 10,
|
||||
KEY_H = 11,
|
||||
KEY_I = 12,
|
||||
KEY_J = 13,
|
||||
KEY_K = 14,
|
||||
KEY_L = 15,
|
||||
KEY_M = 16,
|
||||
KEY_N = 17,
|
||||
KEY_O = 18,
|
||||
KEY_P = 19,
|
||||
KEY_Q = 20,
|
||||
KEY_R = 21,
|
||||
KEY_S = 22,
|
||||
KEY_T = 23,
|
||||
KEY_U = 24,
|
||||
KEY_V = 25,
|
||||
KEY_W = 26,
|
||||
KEY_X = 27,
|
||||
KEY_Y = 28,
|
||||
KEY_Z = 29,
|
||||
KEY_1 = 30,
|
||||
KEY_2 = 31,
|
||||
KEY_3 = 32,
|
||||
KEY_4 = 33,
|
||||
KEY_5 = 34,
|
||||
KEY_6 = 35,
|
||||
KEY_7 = 36,
|
||||
KEY_8 = 37,
|
||||
KEY_9 = 38,
|
||||
KEY_0 = 39,
|
||||
KEY_Enter = 40,
|
||||
KEY_Escape = 41,
|
||||
KEY_Delete = 42,
|
||||
KEY_Tab = 43,
|
||||
KEY_Space = 44,
|
||||
KEY_Minus = 45,
|
||||
KEY_Equals = 46,
|
||||
KEY_LeftBracket = 47,
|
||||
KEY_RightBracket = 48,
|
||||
KEY_Backslash = 49,
|
||||
KEY_Semicolon = 51,
|
||||
KEY_Quote = 52,
|
||||
KEY_Grave = 53,
|
||||
KEY_Comma = 54,
|
||||
KEY_Period = 55,
|
||||
KEY_Slash = 56,
|
||||
KEY_CapsLock = 57,
|
||||
KEY_F1 = 58,
|
||||
KEY_F2 = 59,
|
||||
KEY_F3 = 60,
|
||||
KEY_F4 = 61,
|
||||
KEY_F5 = 62,
|
||||
KEY_F6 = 63,
|
||||
KEY_F7 = 64,
|
||||
KEY_F8 = 65,
|
||||
KEY_F9 = 66,
|
||||
KEY_F10 = 67,
|
||||
KEY_F11 = 68,
|
||||
KEY_F12 = 69,
|
||||
KEY_PrintScreen = 70,
|
||||
KEY_ScrollLock = 71,
|
||||
KEY_Pause = 72,
|
||||
KEY_Insert = 73,
|
||||
KEY_Home = 74,
|
||||
KEY_PageUp = 75,
|
||||
KEY_DeleteForward = 76,
|
||||
KEY_End = 77,
|
||||
KEY_PageDown = 78,
|
||||
KEY_Right = 79,
|
||||
KEY_Left = 80,
|
||||
KEY_Down = 81,
|
||||
KEY_Up = 82,
|
||||
KP_NumLock = 83,
|
||||
KP_Divide = 84,
|
||||
KP_Multiply = 85,
|
||||
KP_Subtract = 86,
|
||||
KP_Add = 87,
|
||||
KP_Enter = 88,
|
||||
KP_1 = 89,
|
||||
KP_2 = 90,
|
||||
KP_3 = 91,
|
||||
KP_4 = 92,
|
||||
KP_5 = 93,
|
||||
KP_6 = 94,
|
||||
KP_7 = 95,
|
||||
KP_8 = 96,
|
||||
KP_9 = 97,
|
||||
KP_0 = 98,
|
||||
KP_Point = 99,
|
||||
KEY_NonUSBackslash = 100,
|
||||
KP_Equals = 103,
|
||||
KEY_F13 = 104,
|
||||
KEY_F14 = 105,
|
||||
KEY_F15 = 106,
|
||||
KEY_F16 = 107,
|
||||
KEY_F17 = 108,
|
||||
KEY_F18 = 109,
|
||||
KEY_F19 = 110,
|
||||
KEY_F20 = 111,
|
||||
KEY_F21 = 112,
|
||||
KEY_F22 = 113,
|
||||
KEY_F23 = 114,
|
||||
KEY_F24 = 115,
|
||||
KEY_Help = 117,
|
||||
KEY_Menu = 118,
|
||||
KEY_LeftControl = 224,
|
||||
KEY_LeftShift = 225,
|
||||
KEY_LeftAlt = 226,
|
||||
KEY_LeftGUI = 227,
|
||||
KEY_RightControl = 228,
|
||||
KEY_RightShift = 229,
|
||||
KEY_RightAlt = 230,
|
||||
KEY_RightGUI = 231
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
#include "../../input/input_common.h" // < For rarch_key_map
|
||||
|
||||
struct apple_key_name_map_entry
|
||||
{
|
||||
const char* const keyname;
|
||||
const uint32_t hid_id;
|
||||
};
|
||||
|
||||
extern const struct apple_key_name_map_entry apple_key_name_map[];
|
||||
extern const struct rarch_key_map apple_key_map_hidusage[];
|
||||
|
||||
|
||||
const char* apple_keycode_hidusage_to_name(uint32_t hid_usage);
|
||||
|
||||
#endif
|
@ -1,222 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2013-2014 - Jason Fetters
|
||||
*
|
||||
* 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 "keycode.h"
|
||||
|
||||
const struct apple_key_name_map_entry apple_key_name_map[] =
|
||||
{
|
||||
{ "left", KEY_Left }, { "right", KEY_Right },
|
||||
{ "up", KEY_Up }, { "down", KEY_Down },
|
||||
{ "enter", KEY_Enter }, { "kp_enter", KP_Enter },
|
||||
{ "space", KEY_Space }, { "tab", KEY_Tab },
|
||||
{ "shift", KEY_LeftShift }, { "rshift", KEY_RightShift },
|
||||
{ "ctrl", KEY_LeftControl }, { "alt", KEY_LeftAlt },
|
||||
{ "escape", KEY_Escape }, { "backspace", KEY_DeleteForward },
|
||||
{ "backquote", KEY_Grave }, { "pause", KEY_Pause },
|
||||
|
||||
{ "f1", KEY_F1 }, { "f2", KEY_F2 },
|
||||
{ "f3", KEY_F3 }, { "f4", KEY_F4 },
|
||||
{ "f5", KEY_F5 }, { "f6", KEY_F6 },
|
||||
{ "f7", KEY_F7 }, { "f8", KEY_F8 },
|
||||
{ "f9", KEY_F9 }, { "f10", KEY_F10 },
|
||||
{ "f11", KEY_F11 }, { "f12", KEY_F12 },
|
||||
|
||||
{ "num0", KEY_0 }, { "num1", KEY_1 },
|
||||
{ "num2", KEY_2 }, { "num3", KEY_3 },
|
||||
{ "num4", KEY_4 }, { "num5", KEY_5 },
|
||||
{ "num6", KEY_6 }, { "num7", KEY_7 },
|
||||
{ "num8", KEY_8 }, { "num9", KEY_9 },
|
||||
|
||||
{ "insert", KEY_Insert }, { "del", KEY_DeleteForward },
|
||||
{ "home", KEY_Home }, { "end", KEY_End },
|
||||
{ "pageup", KEY_PageUp }, { "pagedown", KEY_PageDown },
|
||||
|
||||
{ "add", KP_Add }, { "subtract", KP_Subtract },
|
||||
{ "multiply", KP_Multiply }, { "divide", KP_Divide },
|
||||
{ "keypad0", KP_0 }, { "keypad1", KP_1 },
|
||||
{ "keypad2", KP_2 }, { "keypad3", KP_3 },
|
||||
{ "keypad4", KP_4 }, { "keypad5", KP_5 },
|
||||
{ "keypad6", KP_6 }, { "keypad7", KP_7 },
|
||||
{ "keypad8", KP_8 }, { "keypad9", KP_9 },
|
||||
|
||||
{ "period", KEY_Period }, { "capslock", KEY_CapsLock },
|
||||
{ "numlock", KP_NumLock }, { "print_screen", KEY_PrintScreen },
|
||||
{ "scroll_lock", KEY_ScrollLock },
|
||||
|
||||
{ "a", KEY_A }, { "b", KEY_B }, { "c", KEY_C }, { "d", KEY_D },
|
||||
{ "e", KEY_E }, { "f", KEY_F }, { "g", KEY_G }, { "h", KEY_H },
|
||||
{ "i", KEY_I }, { "j", KEY_J }, { "k", KEY_K }, { "l", KEY_L },
|
||||
{ "m", KEY_M }, { "n", KEY_N }, { "o", KEY_O }, { "p", KEY_P },
|
||||
{ "q", KEY_Q }, { "r", KEY_R }, { "s", KEY_S }, { "t", KEY_T },
|
||||
{ "u", KEY_U }, { "v", KEY_V }, { "w", KEY_W }, { "x", KEY_X },
|
||||
{ "y", KEY_Y }, { "z", KEY_Z },
|
||||
|
||||
{ "nul", 0x00},
|
||||
};
|
||||
|
||||
const struct rarch_key_map apple_key_map_hidusage[] =
|
||||
{
|
||||
{ KEY_Delete, RETROK_BACKSPACE },
|
||||
{ KEY_Tab, RETROK_TAB },
|
||||
// RETROK_CLEAR },
|
||||
{ KEY_Enter, RETROK_RETURN },
|
||||
{ KEY_Pause, RETROK_PAUSE },
|
||||
{ KEY_Escape, RETROK_ESCAPE },
|
||||
{ KEY_Space, RETROK_SPACE },
|
||||
// RETROK_EXCLAIM },
|
||||
// RETROK_QUOTEDBL },
|
||||
// RETROK_HASH },
|
||||
// RETROK_DOLLAR },
|
||||
// RETROK_AMPERSAND },
|
||||
{ KEY_Quote, RETROK_QUOTE },
|
||||
// RETROK_LEFTPAREN },
|
||||
// RETROK_RIGHTPAREN },
|
||||
// RETROK_ASTERISK },
|
||||
// RETROK_PLUS },
|
||||
{ KEY_Comma, RETROK_COMMA },
|
||||
{ KEY_Minus, RETROK_MINUS },
|
||||
{ KEY_Period, RETROK_PERIOD },
|
||||
{ KEY_Slash, RETROK_SLASH },
|
||||
{ KEY_0, RETROK_0 },
|
||||
{ KEY_1, RETROK_1 },
|
||||
{ KEY_2, RETROK_2 },
|
||||
{ KEY_3, RETROK_3 },
|
||||
{ KEY_4, RETROK_4 },
|
||||
{ KEY_5, RETROK_5 },
|
||||
{ KEY_6, RETROK_6 },
|
||||
{ KEY_7, RETROK_7 },
|
||||
{ KEY_8, RETROK_8 },
|
||||
{ KEY_9, RETROK_9 },
|
||||
// RETROK_COLON },
|
||||
{ KEY_Semicolon, RETROK_SEMICOLON },
|
||||
// RETROK_LESS },
|
||||
{ KEY_Equals, RETROK_EQUALS },
|
||||
// RETROK_GREATER },
|
||||
// RETROK_QUESTION },
|
||||
// RETROK_AT },
|
||||
{ KEY_LeftBracket, RETROK_LEFTBRACKET },
|
||||
{ KEY_Backslash, RETROK_BACKSLASH },
|
||||
{ KEY_RightBracket, RETROK_RIGHTBRACKET },
|
||||
// RETROK_CARET },
|
||||
// RETROK_UNDERSCORE },
|
||||
{ KEY_Grave, RETROK_BACKQUOTE },
|
||||
{ KEY_A, RETROK_a },
|
||||
{ KEY_B, RETROK_b },
|
||||
{ KEY_C, RETROK_c },
|
||||
{ KEY_D, RETROK_d },
|
||||
{ KEY_E, RETROK_e },
|
||||
{ KEY_F, RETROK_f },
|
||||
{ KEY_G, RETROK_g },
|
||||
{ KEY_H, RETROK_h },
|
||||
{ KEY_I, RETROK_i },
|
||||
{ KEY_J, RETROK_j },
|
||||
{ KEY_K, RETROK_k },
|
||||
{ KEY_L, RETROK_l },
|
||||
{ KEY_M, RETROK_m },
|
||||
{ KEY_N, RETROK_n },
|
||||
{ KEY_O, RETROK_o },
|
||||
{ KEY_P, RETROK_p },
|
||||
{ KEY_Q, RETROK_q },
|
||||
{ KEY_R, RETROK_r },
|
||||
{ KEY_S, RETROK_s },
|
||||
{ KEY_T, RETROK_t },
|
||||
{ KEY_U, RETROK_u },
|
||||
{ KEY_V, RETROK_v },
|
||||
{ KEY_W, RETROK_w },
|
||||
{ KEY_X, RETROK_x },
|
||||
{ KEY_Y, RETROK_y },
|
||||
{ KEY_Z, RETROK_z },
|
||||
{ KEY_DeleteForward, RETROK_DELETE },
|
||||
|
||||
{ KP_0, RETROK_KP0 },
|
||||
{ KP_1, RETROK_KP1 },
|
||||
{ KP_2, RETROK_KP2 },
|
||||
{ KP_3, RETROK_KP3 },
|
||||
{ KP_4, RETROK_KP4 },
|
||||
{ KP_5, RETROK_KP5 },
|
||||
{ KP_6, RETROK_KP6 },
|
||||
{ KP_7, RETROK_KP7 },
|
||||
{ KP_8, RETROK_KP8 },
|
||||
{ KP_9, RETROK_KP9 },
|
||||
{ KP_Point, RETROK_KP_PERIOD },
|
||||
{ KP_Divide, RETROK_KP_DIVIDE },
|
||||
{ KP_Multiply, RETROK_KP_MULTIPLY },
|
||||
{ KP_Subtract, RETROK_KP_MINUS },
|
||||
{ KP_Add, RETROK_KP_PLUS },
|
||||
{ KP_Enter, RETROK_KP_ENTER },
|
||||
{ KP_Equals, RETROK_KP_EQUALS },
|
||||
|
||||
{ KEY_Up, RETROK_UP },
|
||||
{ KEY_Down, RETROK_DOWN },
|
||||
{ KEY_Right, RETROK_RIGHT },
|
||||
{ KEY_Left, RETROK_LEFT },
|
||||
{ KEY_Insert, RETROK_INSERT },
|
||||
{ KEY_Home, RETROK_HOME },
|
||||
{ KEY_End, RETROK_END },
|
||||
{ KEY_PageUp, RETROK_PAGEUP },
|
||||
{ KEY_PageDown, RETROK_PAGEDOWN },
|
||||
|
||||
{ KEY_F1, RETROK_F1 },
|
||||
{ KEY_F2, RETROK_F2 },
|
||||
{ KEY_F3, RETROK_F3 },
|
||||
{ KEY_F4, RETROK_F4 },
|
||||
{ KEY_F5, RETROK_F5 },
|
||||
{ KEY_F6, RETROK_F6 },
|
||||
{ KEY_F7, RETROK_F7 },
|
||||
{ KEY_F8, RETROK_F8 },
|
||||
{ KEY_F9, RETROK_F9 },
|
||||
{ KEY_F10, RETROK_F10 },
|
||||
{ KEY_F11, RETROK_F11 },
|
||||
{ KEY_F12, RETROK_F12 },
|
||||
{ KEY_F13, RETROK_F13 },
|
||||
{ KEY_F14, RETROK_F14 },
|
||||
{ KEY_F15, RETROK_F15 },
|
||||
|
||||
// RETROK_NUMLOCK },
|
||||
{ KEY_CapsLock, RETROK_CAPSLOCK },
|
||||
// RETROK_SCROLLOCK },
|
||||
{ KEY_RightShift, RETROK_RSHIFT },
|
||||
{ KEY_LeftShift, RETROK_LSHIFT },
|
||||
{ KEY_RightControl, RETROK_RCTRL },
|
||||
{ KEY_LeftControl, RETROK_LCTRL },
|
||||
{ KEY_RightAlt, RETROK_RALT },
|
||||
{ KEY_LeftAlt, RETROK_LALT },
|
||||
{ KEY_RightGUI, RETROK_RMETA },
|
||||
{ KEY_LeftGUI, RETROK_RMETA },
|
||||
// RETROK_LSUPER },
|
||||
// RETROK_RSUPER },
|
||||
// RETROK_MODE },
|
||||
// RETROK_COMPOSE },
|
||||
|
||||
// RETROK_HELP },
|
||||
{ KEY_PrintScreen, RETROK_PRINT },
|
||||
// RETROK_SYSREQ },
|
||||
// RETROK_BREAK },
|
||||
{ KEY_Menu, RETROK_MENU },
|
||||
// RETROK_POWER },
|
||||
// RETROK_EURO },
|
||||
// RETROK_UNDO },
|
||||
{ 0, RETROK_UNKNOWN }
|
||||
};
|
||||
|
||||
|
||||
const char* apple_keycode_hidusage_to_name(uint32_t hid_usage)
|
||||
{
|
||||
for (int i = 0; apple_key_name_map[i].hid_id; i ++)
|
||||
if (apple_key_name_map[i].hid_id == hid_usage)
|
||||
return apple_key_name_map[i].keyname;
|
||||
|
||||
return "nul";
|
||||
}
|
@ -20,7 +20,7 @@
|
||||
#include "rarch_wrapper.h"
|
||||
#include "../../frontend/frontend.h"
|
||||
|
||||
#include "apple_input.h"
|
||||
#include "../../input/apple_input.h"
|
||||
|
||||
#include "../../file.h"
|
||||
|
||||
@ -31,11 +31,9 @@ bool apple_is_running;
|
||||
bool apple_use_tv_mode;
|
||||
NSString* apple_core;
|
||||
|
||||
static CFRunLoopObserverRef iterate_observer;
|
||||
|
||||
static void apple_rarch_exited()
|
||||
void apple_rarch_exited(void)
|
||||
{
|
||||
NSString* used_core = apple_core;
|
||||
NSString* used_core = (NSString*)apple_core;
|
||||
apple_core = 0;
|
||||
|
||||
if (apple_is_running)
|
||||
@ -52,41 +50,6 @@ static void apple_rarch_exited()
|
||||
apple_run_core(nil, 0);
|
||||
}
|
||||
|
||||
static void do_iteration()
|
||||
{
|
||||
bool iterate = iterate_observer && apple_is_running && !g_extern.is_paused;
|
||||
|
||||
if (!iterate)
|
||||
return;
|
||||
|
||||
if (main_entry_iterate(0, NULL, NULL))
|
||||
{
|
||||
main_exit(NULL);
|
||||
apple_rarch_exited();
|
||||
}
|
||||
else
|
||||
CFRunLoopWakeUp(CFRunLoopGetMain());
|
||||
}
|
||||
|
||||
void apple_start_iteration()
|
||||
{
|
||||
if (iterate_observer)
|
||||
return;
|
||||
|
||||
iterate_observer = CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting, true, 0, do_iteration, 0);
|
||||
CFRunLoopAddObserver(CFRunLoopGetMain(), iterate_observer, kCFRunLoopCommonModes);
|
||||
}
|
||||
|
||||
void apple_stop_iteration()
|
||||
{
|
||||
if (!iterate_observer)
|
||||
return;
|
||||
|
||||
CFRunLoopObserverInvalidate(iterate_observer);
|
||||
CFRelease(iterate_observer);
|
||||
iterate_observer = 0;
|
||||
}
|
||||
|
||||
void apple_run_core(NSString* core, const char* file)
|
||||
{
|
||||
if (apple_is_running)
|
||||
@ -109,8 +72,8 @@ void apple_run_core(NSString* core, const char* file)
|
||||
#ifdef IOS
|
||||
static char config_path[PATH_MAX];
|
||||
|
||||
if (apple_core_info_has_custom_config(apple_core.UTF8String))
|
||||
apple_core_info_get_custom_config(apple_core.UTF8String, config_path, sizeof(config_path));
|
||||
if (core_info_has_custom_config(apple_core.UTF8String))
|
||||
core_info_get_custom_config(apple_core.UTF8String, config_path, sizeof(config_path));
|
||||
else
|
||||
strlcpy(config_path, apple_platform.globalConfigFile.UTF8String, sizeof(config_path));
|
||||
|
||||
|
@ -20,15 +20,15 @@
|
||||
#include "../../gfx/gfx_context.h"
|
||||
|
||||
// These functions must only be called in gfx/context/apple_gl_context.c
|
||||
bool apple_gfx_ctx_init(void);
|
||||
void apple_gfx_ctx_destroy(void);
|
||||
bool apple_gfx_ctx_bind_api(enum gfx_ctx_api api, unsigned major, unsigned minor);
|
||||
void apple_gfx_ctx_swap_interval(unsigned interval);
|
||||
bool apple_gfx_ctx_set_video_mode(unsigned width, unsigned height, bool fullscreen);
|
||||
void apple_gfx_ctx_get_video_size(unsigned* width, unsigned* height);
|
||||
void apple_gfx_ctx_update_window_title(void);
|
||||
bool apple_gfx_ctx_has_focus(void);
|
||||
void apple_gfx_ctx_swap_buffers(void);
|
||||
bool apple_gfx_ctx_init(void *data);
|
||||
void apple_gfx_ctx_destroy(void *data);
|
||||
bool apple_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor);
|
||||
void apple_gfx_ctx_swap_interval(void *data, unsigned interval);
|
||||
bool apple_gfx_ctx_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen);
|
||||
void apple_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height);
|
||||
void apple_gfx_ctx_update_window_title(void *data);
|
||||
bool apple_gfx_ctx_has_focus(void *data);
|
||||
void apple_gfx_ctx_swap_buffers(void *data);
|
||||
gfx_ctx_proc_t apple_gfx_ctx_get_proc_address(const char *symbol_name);
|
||||
|
||||
#ifdef IOS
|
||||
|
@ -20,7 +20,7 @@
|
||||
struct settings fake_settings;
|
||||
struct global fake_extern;
|
||||
|
||||
void setting_data_load_current()
|
||||
void setting_data_load_current(void)
|
||||
{
|
||||
memcpy(&fake_settings, &g_settings, sizeof(struct settings));
|
||||
memcpy(&fake_extern, &g_extern, sizeof(struct global));
|
||||
@ -99,26 +99,35 @@ void setting_data_reset_setting(const rarch_setting_t* setting)
|
||||
{
|
||||
switch (setting->type)
|
||||
{
|
||||
case ST_BOOL: *setting->value.boolean = setting->default_value.boolean; break;
|
||||
case ST_INT: *setting->value.integer = setting->default_value.integer; break;
|
||||
case ST_UINT: *setting->value.unsigned_integer = setting->default_value.unsigned_integer; break;
|
||||
case ST_FLOAT: *setting->value.fraction = setting->default_value.fraction; break;
|
||||
case ST_BIND: *setting->value.keybind = *setting->default_value.keybind; break;
|
||||
|
||||
case ST_BOOL:
|
||||
*setting->value.boolean = setting->default_value.boolean;
|
||||
break;
|
||||
case ST_INT:
|
||||
*setting->value.integer = setting->default_value.integer;
|
||||
break;
|
||||
case ST_UINT:
|
||||
*setting->value.unsigned_integer = setting->default_value.unsigned_integer;
|
||||
break;
|
||||
case ST_FLOAT:
|
||||
*setting->value.fraction = setting->default_value.fraction;
|
||||
break;
|
||||
case ST_BIND:
|
||||
*setting->value.keybind = *setting->default_value.keybind;
|
||||
break;
|
||||
case ST_STRING:
|
||||
case ST_PATH:
|
||||
{
|
||||
if (setting->default_value.string)
|
||||
{
|
||||
if (setting->type == ST_STRING)
|
||||
strlcpy(setting->value.string, setting->default_value.string, setting->size);
|
||||
else
|
||||
fill_pathname_expand_special(setting->value.string, setting->default_value.string, setting->size);
|
||||
{
|
||||
if (setting->default_value.string)
|
||||
{
|
||||
if (setting->type == ST_STRING)
|
||||
strlcpy(setting->value.string, setting->default_value.string, setting->size);
|
||||
else
|
||||
fill_pathname_expand_special(setting->value.string, setting->default_value.string, setting->size);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (setting->change_handler)
|
||||
@ -177,7 +186,7 @@ bool setting_data_load_config(const rarch_setting_t* settings, config_file_t* co
|
||||
|
||||
case ST_BIND:
|
||||
{
|
||||
const char* prefix = get_input_config_prefix(i);
|
||||
const char *prefix = (const char *)get_input_config_prefix(i);
|
||||
input_config_parse_key (config, prefix, i->name, i->value.keybind);
|
||||
input_config_parse_joy_button(config, prefix, i->name, i->value.keybind);
|
||||
input_config_parse_joy_axis (config, prefix, i->name, i->value.keybind);
|
||||
@ -194,13 +203,14 @@ bool setting_data_load_config(const rarch_setting_t* settings, config_file_t* co
|
||||
|
||||
bool setting_data_save_config_path(const rarch_setting_t* settings, const char* path)
|
||||
{
|
||||
config_file_t* config = config_file_new(path);
|
||||
bool result = false;
|
||||
config_file_t* config = (config_file_t*)config_file_new(path);
|
||||
|
||||
if (!config)
|
||||
config = config_file_new(0);
|
||||
|
||||
setting_data_save_config(settings, config);
|
||||
bool result = config_file_write(config, path);
|
||||
result = config_file_write(config, path);
|
||||
config_file_free(config);
|
||||
|
||||
return result;
|
||||
@ -215,35 +225,36 @@ bool setting_data_save_config(const rarch_setting_t* settings, config_file_t* co
|
||||
{
|
||||
switch (i->type)
|
||||
{
|
||||
case ST_BOOL: config_set_bool (config, i->name, *i->value.boolean); break;
|
||||
case ST_PATH: config_set_path(config, i->name, i->value.string); break;
|
||||
case ST_STRING: config_set_string(config, i->name, i->value.string); break;
|
||||
|
||||
case ST_BOOL:
|
||||
config_set_bool(config, i->name, *i->value.boolean);
|
||||
break;
|
||||
case ST_PATH:
|
||||
config_set_path(config, i->name, i->value.string);
|
||||
break;
|
||||
case ST_STRING:
|
||||
config_set_string(config, i->name, i->value.string);
|
||||
break;
|
||||
case ST_INT:
|
||||
ENFORCE_RANGE(i, integer);
|
||||
config_set_int(config, i->name, *i->value.integer);
|
||||
break;
|
||||
|
||||
case ST_UINT:
|
||||
ENFORCE_RANGE(i, unsigned_integer);
|
||||
config_set_uint64(config, i->name, *i->value.unsigned_integer);
|
||||
break;
|
||||
|
||||
case ST_FLOAT:
|
||||
ENFORCE_RANGE(i, fraction);
|
||||
config_set_float(config, i->name, *i->value.fraction);
|
||||
break;
|
||||
|
||||
case ST_BIND:
|
||||
{
|
||||
config_set_string(config, get_input_config_key(i, 0 ), get_key_name(i));
|
||||
config_set_string(config, get_input_config_key(i, "btn" ), get_button_name(i));
|
||||
config_set_string(config, get_input_config_key(i, "axis"), get_axis_name(i));
|
||||
break;
|
||||
}
|
||||
|
||||
case ST_HEX: break;
|
||||
default: break;
|
||||
case ST_HEX:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,11 +292,15 @@ void setting_data_set_with_string_representation(const rarch_setting_t* setting,
|
||||
sscanf(value, "%f", setting->value.fraction);
|
||||
ENFORCE_RANGE(setting, fraction);
|
||||
break;
|
||||
case ST_PATH:
|
||||
strlcpy(setting->value.string, value, setting->size);
|
||||
break;
|
||||
case ST_STRING:
|
||||
strlcpy(setting->value.string, value, setting->size);
|
||||
break;
|
||||
|
||||
case ST_PATH: strlcpy(setting->value.string, value, setting->size); break;
|
||||
case ST_STRING: strlcpy(setting->value.string, value, setting->size); break;
|
||||
|
||||
default: return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (setting->change_handler)
|
||||
@ -299,20 +314,29 @@ const char* setting_data_get_string_representation(const rarch_setting_t* settin
|
||||
|
||||
switch (setting->type)
|
||||
{
|
||||
case ST_BOOL: snprintf(buffer, length, "%s", *setting->value.boolean ? "True" : "False"); break;
|
||||
case ST_INT: snprintf(buffer, length, "%d", *setting->value.integer); break;
|
||||
case ST_UINT: snprintf(buffer, length, "%u", *setting->value.unsigned_integer); break;
|
||||
case ST_FLOAT: snprintf(buffer, length, "%f", *setting->value.fraction); break;
|
||||
case ST_PATH: strlcpy(buffer, setting->value.string, length); break;
|
||||
case ST_STRING: strlcpy(buffer, setting->value.string, length); break;
|
||||
|
||||
case ST_BOOL:
|
||||
snprintf(buffer, length, "%s", *setting->value.boolean ? "True" : "False");
|
||||
break;
|
||||
case ST_INT:
|
||||
snprintf(buffer, length, "%d", *setting->value.integer);
|
||||
break;
|
||||
case ST_UINT:
|
||||
snprintf(buffer, length, "%u", *setting->value.unsigned_integer);
|
||||
break;
|
||||
case ST_FLOAT:
|
||||
snprintf(buffer, length, "%f", *setting->value.fraction);
|
||||
break;
|
||||
case ST_PATH:
|
||||
strlcpy(buffer, setting->value.string, length);
|
||||
break;
|
||||
case ST_STRING:
|
||||
strlcpy(buffer, setting->value.string, length);
|
||||
break;
|
||||
case ST_BIND:
|
||||
{
|
||||
snprintf(buffer, length, "[KB:%s] [JS:%s] [AX:%s]", get_key_name(setting), get_button_name(setting), get_axis_name(setting));
|
||||
break;
|
||||
}
|
||||
|
||||
default: return "";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
||||
return buffer;
|
||||
@ -338,7 +362,9 @@ DEFINE_BASIC_SETTING_TYPE(int, int, integer, ST_INT)
|
||||
DEFINE_BASIC_SETTING_TYPE(uint, unsigned int, unsigned_integer, ST_UINT)
|
||||
DEFINE_BASIC_SETTING_TYPE(float, float, fraction, ST_FLOAT)
|
||||
|
||||
rarch_setting_t setting_data_string_setting(enum setting_type type, const char* name, const char* description, char* target, unsigned size, const char* default_value)
|
||||
rarch_setting_t setting_data_string_setting(enum setting_type type,
|
||||
const char* name, const char* description, char* target,
|
||||
unsigned size, const char* default_value)
|
||||
{
|
||||
rarch_setting_t result = { type, name, size, description };
|
||||
result.value.string = target;
|
||||
@ -346,8 +372,9 @@ rarch_setting_t setting_data_string_setting(enum setting_type type, const char*
|
||||
return result;
|
||||
}
|
||||
|
||||
rarch_setting_t setting_data_bind_setting(const char* name, const char* description, struct retro_keybind* target, uint32_t index,
|
||||
const struct retro_keybind* default_value)
|
||||
rarch_setting_t setting_data_bind_setting(const char* name,
|
||||
const char* description, struct retro_keybind* target,
|
||||
uint32_t index, const struct retro_keybind* default_value)
|
||||
{
|
||||
rarch_setting_t result = { ST_BIND, name, 0, description };
|
||||
result.value.keybind = target;
|
||||
@ -367,7 +394,6 @@ static const uint32_t features = SD_FEATURE_VIDEO_MODE | SD_FEATURE_SHADERS |
|
||||
#define g_settings fake_settings
|
||||
#define g_extern fake_extern
|
||||
|
||||
|
||||
#define DEFAULT_ME_YO 0
|
||||
#define NEXT (list[index++])
|
||||
#define WITH_FEATURE(FTS) if (!FTS || features & FTS)
|
||||
@ -394,7 +420,7 @@ static const uint32_t features = SD_FEATURE_VIDEO_MODE | SD_FEATURE_SHADERS |
|
||||
|
||||
#define WITH_VALUES(VALUES) (list[index -1]).values = VALUES;
|
||||
|
||||
const rarch_setting_t* setting_data_get_list()
|
||||
const rarch_setting_t* setting_data_get_list(void)
|
||||
{
|
||||
static rarch_setting_t list[512] = { 0 };
|
||||
|
||||
@ -402,11 +428,11 @@ const rarch_setting_t* setting_data_get_list()
|
||||
{
|
||||
unsigned index = 0;
|
||||
|
||||
/***********/
|
||||
/* DRIVERS */
|
||||
/***********/
|
||||
WITH_FEATURE(SD_FEATURE_MULTI_DRIVER) START_GROUP("Drivers")
|
||||
START_SUB_GROUP("Drivers")
|
||||
/***********/
|
||||
/* DRIVERS */
|
||||
/***********/
|
||||
WITH_FEATURE(SD_FEATURE_MULTI_DRIVER) START_GROUP("Drivers")
|
||||
START_SUB_GROUP("Drivers")
|
||||
CONFIG_STRING(g_settings.video.driver, "video_driver", "Video Driver", config_get_default_video())
|
||||
CONFIG_STRING(g_settings.video.gl_context, "video_gl_context", "OpenGL Driver", "")
|
||||
CONFIG_STRING(g_settings.audio.driver, "audio_driver", "Audio Driver", config_get_default_audio())
|
||||
@ -414,17 +440,17 @@ const rarch_setting_t* setting_data_get_list()
|
||||
CONFIG_STRING(g_settings.input.joypad_driver, "input_joypad_driver", "Joypad Driver", "")
|
||||
CONFIG_STRING(g_settings.input.keyboard_layout, "input_keyboard_layout", "Keyboard Layout", DEFAULT_ME_YO)
|
||||
|
||||
#ifdef HAVE_CAMERA
|
||||
#ifdef HAVE_CAMERA
|
||||
CONFIG_STRING(g_settings.camera.device, "camera_device", "Camera Driver", config_get_default_camera())
|
||||
#endif
|
||||
END_SUB_GROUP()
|
||||
END_GROUP()
|
||||
#endif
|
||||
END_SUB_GROUP()
|
||||
END_GROUP()
|
||||
|
||||
/*********/
|
||||
/* PATHS */
|
||||
/*********/
|
||||
START_GROUP("Paths")
|
||||
START_SUB_GROUP("Paths")
|
||||
/*********/
|
||||
/* PATHS */
|
||||
/*********/
|
||||
START_GROUP("Paths")
|
||||
START_SUB_GROUP("Paths")
|
||||
CONFIG_PATH(g_settings.libretro, "libretro_path", "libretro Path", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY)
|
||||
CONFIG_PATH(g_settings.libretro_info_path, "libretro_info_path", "Info Path", default_libretro_info_path) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR)
|
||||
CONFIG_PATH(g_settings.core_options_path, "core_options_path", "Core Options Path", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY)
|
||||
@ -434,73 +460,73 @@ const rarch_setting_t* setting_data_get_list()
|
||||
CONFIG_PATH(g_settings.game_history_path, "game_history_path", "Content History Path", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY)
|
||||
CONFIG_UINT(g_settings.game_history_size, "game_history_size", "Content History Size", game_history_size)
|
||||
|
||||
#ifdef HAVE_RGUI
|
||||
#ifdef HAVE_RGUI
|
||||
CONFIG_PATH(g_settings.rgui_content_directory, "rgui_browser_directory", "Content Directory", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR)
|
||||
CONFIG_PATH(g_settings.rgui_config_directory, "rgui_config_directory", "Config Directory", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR)
|
||||
CONFIG_BOOL(g_settings.rgui_show_start_screen, "rgui_show_start_screen", "Show Start Screen", rgui_show_start_screen)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
#ifdef HAVE_OVERLAY
|
||||
CONFIG_PATH(g_extern.overlay_dir, "overlay_directory", "Overlay Directory", default_overlay_dir) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// savefile_directory
|
||||
// savestate_directory
|
||||
// system_directory
|
||||
END_SUB_GROUP()
|
||||
END_GROUP()
|
||||
END_SUB_GROUP()
|
||||
END_GROUP()
|
||||
|
||||
|
||||
/*************/
|
||||
/* EMULATION */
|
||||
/*************/
|
||||
START_GROUP("Emulation")
|
||||
START_SUB_GROUP("Emulation")
|
||||
/*************/
|
||||
/* EMULATION */
|
||||
/*************/
|
||||
START_GROUP("Emulation")
|
||||
START_SUB_GROUP("Emulation")
|
||||
CONFIG_BOOL(g_settings.pause_nonactive, "pause_nonactive", "Pause when inactive", pause_nonactive)
|
||||
CONFIG_BOOL(g_settings.rewind_enable, "rewind_enable", "Enable Rewind", rewind_enable)
|
||||
// CONFIG_INT(g_settings.rewind_buffer_size, "rewind_buffer_size", "Rewind Buffer Size", rewind_buffer_size) WITH_SCALE(1000000)
|
||||
//CONFIG_INT(g_settings.rewind_buffer_size, "rewind_buffer_size", "Rewind Buffer Size", rewind_buffer_size) WITH_SCALE(1000000)
|
||||
CONFIG_UINT(g_settings.rewind_granularity, "rewind_granularity", "Rewind Granularity", rewind_granularity)
|
||||
CONFIG_FLOAT(g_settings.slowmotion_ratio, "slowmotion_ratio", "Slow Motion Ratio", slowmotion_ratio) WITH_RANGE(0, 1)
|
||||
CONFIG_FLOAT(g_settings.fastforward_ratio, "fastforward_ratio", "Fast Forward Ratio", fastforward_ratio)
|
||||
CONFIG_BOOL(g_settings.fps_show, "fps_show", "Show Frame Rate", DEFAULT_ME_YO)
|
||||
END_SUB_GROUP()
|
||||
END_SUB_GROUP()
|
||||
|
||||
START_SUB_GROUP("Saves")
|
||||
START_SUB_GROUP("Saves")
|
||||
CONFIG_UINT(g_settings.autosave_interval, "autosave_interval", "Autosave Interval", autosave_interval)
|
||||
CONFIG_BOOL(g_settings.block_sram_overwrite, "block_sram_overwrite", "Block SRAM overwrite", block_sram_overwrite)
|
||||
CONFIG_BOOL(g_settings.savestate_auto_index, "savestate_auto_index", "Save State Auto Index", savestate_auto_index)
|
||||
CONFIG_BOOL(g_settings.savestate_auto_save, "savestate_auto_save", "Auto Save State", savestate_auto_save)
|
||||
CONFIG_BOOL(g_settings.savestate_auto_load, "savestate_auto_load", "Auto Load State", savestate_auto_load)
|
||||
CONFIG_UINT(g_extern.state_slot, "state_slot", "State Slot", 0)
|
||||
END_SUB_GROUP()
|
||||
END_GROUP()
|
||||
CONFIG_INT(g_extern.state_slot, "state_slot", "State Slot", 0)
|
||||
END_SUB_GROUP()
|
||||
END_GROUP()
|
||||
|
||||
/*********/
|
||||
/* VIDEO */
|
||||
/*********/
|
||||
START_GROUP("Video")
|
||||
WITH_FEATURE(SD_FEATURE_VIDEO_MODE) START_SUB_GROUP("Monitor")
|
||||
/*********/
|
||||
/* VIDEO */
|
||||
/*********/
|
||||
START_GROUP("Video")
|
||||
WITH_FEATURE(SD_FEATURE_VIDEO_MODE) START_SUB_GROUP("Monitor")
|
||||
CONFIG_UINT(g_settings.video.monitor_index, "video_monitor_index", "Monitor Index", monitor_index)
|
||||
CONFIG_BOOL(g_settings.video.fullscreen, "video_fullscreen", "Use Fullscreen mode", fullscreen)
|
||||
CONFIG_BOOL(g_settings.video.windowed_fullscreen, "video_windowed_fullscreen", "Windowed Fullscreen Mode", windowed_fullscreen)
|
||||
CONFIG_UINT(g_settings.video.fullscreen_x, "video_fullscreen_x", "Fullscreen Width", fullscreen_x)
|
||||
CONFIG_UINT(g_settings.video.fullscreen_y, "video_fullscreen_y", "Fullscreen Height", fullscreen_y)
|
||||
CONFIG_FLOAT(g_settings.video.refresh_rate, "video_refresh_rate", "Refresh Rate", refresh_rate)
|
||||
END_SUB_GROUP()
|
||||
END_SUB_GROUP()
|
||||
|
||||
/* Video: Window Manager */
|
||||
WITH_FEATURE(SD_FEATURE_WINDOW_MANAGER) START_SUB_GROUP("Window Manager")
|
||||
/* Video: Window Manager */
|
||||
WITH_FEATURE(SD_FEATURE_WINDOW_MANAGER) START_SUB_GROUP("Window Manager")
|
||||
CONFIG_BOOL(g_settings.video.disable_composition, "video_disable_composition", "Disable WM Composition", disable_composition)
|
||||
END_SUB_GROUP()
|
||||
END_SUB_GROUP()
|
||||
|
||||
START_SUB_GROUP("Aspect")
|
||||
START_SUB_GROUP("Aspect")
|
||||
CONFIG_BOOL(g_settings.video.force_aspect, "video_force_aspect", "Force aspect ratio", force_aspect)
|
||||
CONFIG_FLOAT(g_settings.video.aspect_ratio, "video_aspect_ratio", "Aspect Ratio", aspect_ratio)
|
||||
CONFIG_BOOL(g_settings.video.aspect_ratio_auto, "video_aspect_ratio_auto", "Use Auto Aspect Ratio", aspect_ratio_auto)
|
||||
CONFIG_UINT(g_settings.video.aspect_ratio_idx, "aspect_ratio_index", "Aspect Ratio Index", aspect_ratio_idx)
|
||||
END_SUB_GROUP()
|
||||
END_SUB_GROUP()
|
||||
|
||||
START_SUB_GROUP("Scaling")
|
||||
START_SUB_GROUP("Scaling")
|
||||
CONFIG_FLOAT(g_settings.video.xscale, "video_xscale", "X Scale", xscale)
|
||||
CONFIG_FLOAT(g_settings.video.yscale, "video_yscale", "Y Scale", yscale)
|
||||
CONFIG_BOOL(g_settings.video.scale_integer, "video_scale_integer", "Integer Scale", scale_integer)
|
||||
@ -512,36 +538,36 @@ const rarch_setting_t* setting_data_get_list()
|
||||
|
||||
CONFIG_BOOL(g_settings.video.smooth, "video_smooth", "Use bilinear filtering", video_smooth)
|
||||
CONFIG_UINT(g_settings.video.rotation, "video_rotation", "Rotation", DEFAULT_ME_YO)
|
||||
END_SUB_GROUP()
|
||||
END_SUB_GROUP()
|
||||
|
||||
WITH_FEATURE(SD_FEATURE_SHADERS) START_SUB_GROUP("Shader")
|
||||
WITH_FEATURE(SD_FEATURE_SHADERS) START_SUB_GROUP("Shader")
|
||||
CONFIG_BOOL(g_settings.video.shader_enable, "video_shader_enable", "Enable Shaders", shader_enable)
|
||||
CONFIG_PATH(g_settings.video.shader_dir, "video_shader_dir", "Shader Directory", default_shader_dir) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR)
|
||||
CONFIG_PATH(g_settings.video.shader_path, "video_shader", "Shader", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY)
|
||||
END_SUB_GROUP()
|
||||
END_SUB_GROUP()
|
||||
|
||||
WITH_FEATURE(SD_FEATURE_VSYNC) START_SUB_GROUP("Sync")
|
||||
WITH_FEATURE(SD_FEATURE_VSYNC) START_SUB_GROUP("Sync")
|
||||
CONFIG_BOOL(g_settings.video.threaded, "video_threaded", "Use threaded video", video_threaded)
|
||||
CONFIG_BOOL(g_settings.video.vsync, "video_vsync", "VSync", vsync)
|
||||
CONFIG_UINT(g_settings.video.swap_interval, "video_swap_interval", "VSync Swap interval", swap_interval) WITH_RANGE(1, 4)
|
||||
CONFIG_BOOL(g_settings.video.hard_sync, "video_hard_sync", "Hard GPU Sync", hard_sync)
|
||||
CONFIG_UINT(g_settings.video.hard_sync_frames, "video_hard_sync_frames", "Hard GPU Sync Frames", hard_sync_frames) WITH_RANGE(0, 3)
|
||||
CONFIG_BOOL(g_settings.video.black_frame_insertion,"video_black_frame_insertion","Black Frame Insertion", black_frame_insertion)
|
||||
END_SUB_GROUP()
|
||||
END_SUB_GROUP()
|
||||
|
||||
START_SUB_GROUP("Misc")
|
||||
START_SUB_GROUP("Misc")
|
||||
CONFIG_BOOL(g_settings.video.post_filter_record, "video_post_filter_record", "Post filter record", post_filter_record)
|
||||
CONFIG_BOOL(g_settings.video.gpu_record, "video_gpu_record", "GPU Record", gpu_record)
|
||||
CONFIG_BOOL(g_settings.video.gpu_screenshot, "video_gpu_screenshot", "GPU Screenshot", gpu_screenshot)
|
||||
CONFIG_BOOL(g_settings.video.allow_rotate, "video_allow_rotate", "Allow rotation", allow_rotate)
|
||||
CONFIG_BOOL(g_settings.video.crop_overscan, "video_crop_overscan", "Crop Overscan (reload)", crop_overscan)
|
||||
|
||||
#ifdef HAVE_DYLIB
|
||||
#ifdef HAVE_DYLIB
|
||||
CONFIG_PATH(g_settings.video.filter_path, "video_filter", "Software filter", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY)
|
||||
#endif
|
||||
END_SUB_GROUP()
|
||||
#endif
|
||||
END_SUB_GROUP()
|
||||
|
||||
START_SUB_GROUP("Messages")
|
||||
START_SUB_GROUP("Messages")
|
||||
CONFIG_PATH(g_settings.video.font_path, "video_font_path", "Font Path", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY)
|
||||
CONFIG_FLOAT(g_settings.video.font_size, "video_font_size", "Font Size", font_size)
|
||||
CONFIG_BOOL(g_settings.video.font_enable, "video_font_enable", "Font Enable", font_enable)
|
||||
@ -549,83 +575,83 @@ const rarch_setting_t* setting_data_get_list()
|
||||
CONFIG_FLOAT(g_settings.video.msg_pos_x, "video_message_pos_x", "Message X Position", message_pos_offset_x)
|
||||
CONFIG_FLOAT(g_settings.video.msg_pos_y, "video_message_pos_y", "Message Y Position", message_pos_offset_y)
|
||||
/* message color */
|
||||
END_SUB_GROUP()
|
||||
END_GROUP()
|
||||
END_SUB_GROUP()
|
||||
END_GROUP()
|
||||
|
||||
/*********/
|
||||
/* AUDIO */
|
||||
/*********/
|
||||
START_GROUP("Audio")
|
||||
START_SUB_GROUP("State")
|
||||
/*********/
|
||||
/* AUDIO */
|
||||
/*********/
|
||||
START_GROUP("Audio")
|
||||
START_SUB_GROUP("State")
|
||||
CONFIG_BOOL(g_settings.audio.enable, "audio_enable", "Enable", audio_enable)
|
||||
CONFIG_FLOAT(g_settings.audio.volume, "audio_volume", "Volume", audio_volume)
|
||||
CONFIG_BOOL(g_extern.audio_data.mute, "audio_mute", "Mute", DEFAULT_ME_YO)
|
||||
END_SUB_GROUP()
|
||||
END_SUB_GROUP()
|
||||
|
||||
START_SUB_GROUP("Sync")
|
||||
START_SUB_GROUP("Sync")
|
||||
CONFIG_BOOL(g_settings.audio.sync, "audio_sync", "Enable Sync", audio_sync)
|
||||
CONFIG_UINT(g_settings.audio.latency, "audio_latency", "Latency", out_latency)
|
||||
CONFIG_BOOL(g_settings.audio.rate_control, "audio_rate_control", "Enable Rate Control", rate_control)
|
||||
CONFIG_FLOAT(g_settings.audio.rate_control_delta, "audio_rate_control_delta", "Rate Control Delta", rate_control_delta)
|
||||
CONFIG_UINT(g_settings.audio.block_frames, "audio_block_frames", "Block Frames", DEFAULT_ME_YO)
|
||||
END_SUB_GROUP()
|
||||
END_SUB_GROUP()
|
||||
|
||||
WITH_FEATURE(SD_FEATURE_AUDIO_DEVICE) START_SUB_GROUP("Misc")
|
||||
WITH_FEATURE(SD_FEATURE_AUDIO_DEVICE) START_SUB_GROUP("Misc")
|
||||
CONFIG_STRING(g_settings.audio.device, "audio_device", "Device", DEFAULT_ME_YO)
|
||||
CONFIG_UINT(g_settings.audio.out_rate, "audio_out_rate", "Ouput Rate", out_rate)
|
||||
CONFIG_PATH(g_settings.audio.dsp_plugin, "audio_dsp_plugin", "DSP Plugin", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY)
|
||||
END_SUB_GROUP()
|
||||
END_GROUP()
|
||||
END_SUB_GROUP()
|
||||
END_GROUP()
|
||||
|
||||
/*********/
|
||||
/* INPUT */
|
||||
/*********/
|
||||
START_GROUP("Input")
|
||||
START_SUB_GROUP("Input")
|
||||
/*********/
|
||||
/* INPUT */
|
||||
/*********/
|
||||
START_GROUP("Input")
|
||||
START_SUB_GROUP("Input")
|
||||
CONFIG_BOOL(g_settings.input.autodetect_enable, "input_autodetect_enable", "Use joypad autodetection", input_autodetect_enable)
|
||||
CONFIG_PATH(g_settings.input.autoconfig_dir, "joypad_autoconfig_dir", "Joypad Autoconfig Directory",DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR)
|
||||
END_SUB_GROUP()
|
||||
END_SUB_GROUP()
|
||||
|
||||
START_SUB_GROUP("Joypad Mapping")
|
||||
START_SUB_GROUP("Joypad Mapping")
|
||||
//TODO: input_libretro_device_p%u
|
||||
CONFIG_INT(g_settings.input.joypad_map[0], "input_player1_joypad_index", "Player 1 Pad Index", 0)
|
||||
CONFIG_INT(g_settings.input.joypad_map[1], "input_player2_joypad_index", "Player 2 Pad Index", 1)
|
||||
CONFIG_INT(g_settings.input.joypad_map[2], "input_player3_joypad_index", "Player 3 Pad Index", 2)
|
||||
CONFIG_INT(g_settings.input.joypad_map[3], "input_player4_joypad_index", "Player 4 Pad Index", 3)
|
||||
CONFIG_INT(g_settings.input.joypad_map[4], "input_player5_joypad_index", "Player 5 Pad Index", 4)
|
||||
END_SUB_GROUP()
|
||||
END_SUB_GROUP()
|
||||
|
||||
START_SUB_GROUP("Turbo/Deadzone")
|
||||
START_SUB_GROUP("Turbo/Deadzone")
|
||||
CONFIG_FLOAT(g_settings.input.axis_threshold, "input_axis_threshold", "Axis Deadzone", axis_threshold)
|
||||
CONFIG_UINT(g_settings.input.turbo_period, "input_turbo_period", "Turbo Period", turbo_period)
|
||||
CONFIG_UINT(g_settings.input.turbo_duty_cycle, "input_duty_cycle", "Duty Cycle", turbo_duty_cycle)
|
||||
END_SUB_GROUP()
|
||||
END_SUB_GROUP()
|
||||
|
||||
START_SUB_GROUP("Misc")
|
||||
START_SUB_GROUP("Misc")
|
||||
CONFIG_BOOL(g_settings.input.netplay_client_swap_input, "netplay_client_swap_input", "Swap Netplay Input", netplay_client_swap_input)
|
||||
CONFIG_BOOL(g_settings.input.debug_enable, "input_debug_enable", "Enable Input Debugging", input_debug_enable)
|
||||
END_SUB_GROUP()
|
||||
END_SUB_GROUP()
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
START_SUB_GROUP("Overlay")
|
||||
#ifdef HAVE_OVERLAY
|
||||
START_SUB_GROUP("Overlay")
|
||||
CONFIG_PATH(g_settings.input.overlay, "input_overlay", "Input Overlay", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY) WITH_VALUES("cfg")
|
||||
CONFIG_FLOAT(g_settings.input.overlay_opacity, "input_overlay_opacity", "Overlay Opacity", 0.7f) WITH_RANGE(0, 1)
|
||||
CONFIG_FLOAT(g_settings.input.overlay_scale, "input_overlay_scale", "Overlay Scale", 1.0f)
|
||||
END_SUB_GROUP()
|
||||
#endif
|
||||
END_SUB_GROUP()
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
START_SUB_GROUP("Android")
|
||||
#ifdef ANDROID
|
||||
START_SUB_GROUP("Android")
|
||||
CONFIG_INT(g_settings.input.back_behavior, "input_back_behavior", "Back Behavior", BACK_BUTTON_QUIT)
|
||||
CONFIG_INT(g_settings.input.icade_profile[0], "input_autodetect_icade_profile_pad1", "iCade 1", DEFAULT_ME_YO)
|
||||
CONFIG_INT(g_settings.input.icade_profile[1], "input_autodetect_icade_profile_pad2", "iCade 2", DEFAULT_ME_YO)
|
||||
CONFIG_INT(g_settings.input.icade_profile[2], "input_autodetect_icade_profile_pad3", "iCade 3", DEFAULT_ME_YO)
|
||||
CONFIG_INT(g_settings.input.icade_profile[3], "input_autodetect_icade_profile_pad4", "iCade 4", DEFAULT_ME_YO)
|
||||
END_SUB_GROUP()
|
||||
#endif
|
||||
END_SUB_GROUP()
|
||||
#endif
|
||||
|
||||
// The second argument to config bind is 1 based for players and 0 only for meta keys
|
||||
START_SUB_GROUP("Meta Keys")
|
||||
// The second argument to config bind is 1 based for players and 0 only for meta keys
|
||||
START_SUB_GROUP("Meta Keys")
|
||||
for (int i = 0; i != RARCH_BIND_LIST_END; i ++)
|
||||
if (input_config_bind_map[i].meta)
|
||||
{
|
||||
@ -634,35 +660,35 @@ const rarch_setting_t* setting_data_get_list()
|
||||
}
|
||||
END_SUB_GROUP()
|
||||
|
||||
for (int player = 0; player < MAX_PLAYERS; player ++)
|
||||
{
|
||||
const struct retro_keybind* const defaults = (player == 0) ? retro_keybinds_1 : retro_keybinds_rest;
|
||||
|
||||
char buffer[32];
|
||||
snprintf(buffer, 32, "Player %d", player + 1);
|
||||
START_SUB_GROUP(strdup(buffer))
|
||||
for (int i = 0; i != RARCH_BIND_LIST_END; i ++)
|
||||
if (!input_config_bind_map[i].meta)
|
||||
{
|
||||
const struct input_bind_map* bind = &input_config_bind_map[i];
|
||||
CONFIG_BIND(g_settings.input.binds[player][i], player + 1, bind->base, bind->desc, &defaults[i])
|
||||
}
|
||||
END_SUB_GROUP()
|
||||
}
|
||||
END_GROUP()
|
||||
for (int player = 0; player < MAX_PLAYERS; player ++)
|
||||
{
|
||||
const struct retro_keybind* const defaults = (player == 0) ? retro_keybinds_1 : retro_keybinds_rest;
|
||||
|
||||
/********/
|
||||
/* Misc */
|
||||
/********/
|
||||
START_GROUP("Misc")
|
||||
START_SUB_GROUP("Misc")
|
||||
char buffer[32];
|
||||
snprintf(buffer, 32, "Player %d", player + 1);
|
||||
START_SUB_GROUP(strdup(buffer))
|
||||
for (int i = 0; i != RARCH_BIND_LIST_END; i ++)
|
||||
if (!input_config_bind_map[i].meta)
|
||||
{
|
||||
const struct input_bind_map* bind = &input_config_bind_map[i];
|
||||
CONFIG_BIND(g_settings.input.binds[player][i], player + 1, bind->base, bind->desc, &defaults[i])
|
||||
}
|
||||
END_SUB_GROUP()
|
||||
}
|
||||
END_GROUP()
|
||||
|
||||
/********/
|
||||
/* Misc */
|
||||
/********/
|
||||
START_GROUP("Misc")
|
||||
START_SUB_GROUP("Misc")
|
||||
CONFIG_BOOL(g_extern.config_save_on_exit, "config_save_on_exit", "Save Config On Exit", config_save_on_exit)
|
||||
CONFIG_BOOL(g_settings.network_cmd_enable, "network_cmd_enable", "Network Commands", network_cmd_enable)
|
||||
//CONFIG_INT(g_settings.network_cmd_port, "network_cmd_port", "Network Command Port", network_cmd_port)
|
||||
CONFIG_BOOL(g_settings.stdin_cmd_enable, "stdin_cmd_enable", "stdin command", stdin_cmd_enable)
|
||||
END_SUB_GROUP()
|
||||
END_GROUP()
|
||||
END_SUB_GROUP()
|
||||
END_GROUP()
|
||||
}
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
@ -18,8 +18,22 @@
|
||||
|
||||
#include "../../general.h"
|
||||
|
||||
enum setting_type { ST_NONE, ST_BOOL, ST_INT, ST_UINT, ST_FLOAT, ST_PATH, ST_STRING, ST_HEX, ST_BIND,
|
||||
ST_GROUP, ST_SUB_GROUP, ST_END_GROUP, ST_END_SUB_GROUP };
|
||||
enum setting_type
|
||||
{
|
||||
ST_NONE = 0,
|
||||
ST_BOOL,
|
||||
ST_INT,
|
||||
ST_UINT,
|
||||
ST_FLOAT,
|
||||
ST_PATH,
|
||||
ST_STRING,
|
||||
ST_HEX,
|
||||
ST_BIND,
|
||||
ST_GROUP,
|
||||
ST_SUB_GROUP,
|
||||
ST_END_GROUP,
|
||||
ST_END_SUB_GROUP
|
||||
};
|
||||
|
||||
enum setting_features
|
||||
{
|
||||
@ -108,10 +122,10 @@ rarch_setting_t setting_data_bind_setting(const char* name, const char* descript
|
||||
const struct retro_keybind* default_value);
|
||||
|
||||
// These functions operate only on RetroArch's main settings list
|
||||
void setting_data_load_current();
|
||||
const rarch_setting_t* setting_data_get_list();
|
||||
void setting_data_load_current(void);
|
||||
const rarch_setting_t* setting_data_get_list(void);
|
||||
|
||||
// Keyboard
|
||||
#include "keycode.h"
|
||||
#include "../../input/apple_keycode.h"
|
||||
|
||||
#endif
|
||||
|
@ -24,16 +24,16 @@
|
||||
void apple_display_alert(NSString* message, NSString* title)
|
||||
{
|
||||
#ifdef IOS
|
||||
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:title ? title : @"RetroArch"
|
||||
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:title ? title : BOXSTRING("RetroArch")
|
||||
message:message
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"OK"
|
||||
cancelButtonTitle:BOXSTRING("OK")
|
||||
otherButtonTitles:nil];
|
||||
[alert show];
|
||||
#else
|
||||
NSAlert* alert = [[NSAlert new] autorelease];
|
||||
|
||||
[alert setMessageText:title ? title : @"RetroArch"];
|
||||
[alert setMessageText:title ? title : BOXSTRING("RetroArch")];
|
||||
[alert setInformativeText:message];
|
||||
[alert setAlertStyle:NSInformationalAlertStyle];
|
||||
[alert beginSheetModalForWindow:[RetroArch_OSX get].window
|
||||
@ -49,7 +49,7 @@ NSString* objc_get_value_from_config(config_file_t* config, NSString* name, NSSt
|
||||
{
|
||||
char* data = 0;
|
||||
if (config)
|
||||
config_get_string(config, [name UTF8String], &data);
|
||||
config_get_string(config, name.UTF8String, &data);
|
||||
|
||||
NSString* result = data ? BOXSTRING(data) : defaultValue;
|
||||
free(data);
|
||||
@ -60,12 +60,12 @@ NSString* objc_get_value_from_config(config_file_t* config, NSString* name, NSSt
|
||||
NSString *apple_get_core_id(const core_info_t *core)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
return BOXSTRING(apple_core_info_get_id(core, buf, sizeof(buf)));
|
||||
return BOXSTRING(core_info_get_id(core, buf, sizeof(buf)));
|
||||
}
|
||||
|
||||
NSString *apple_get_core_display_name(NSString *core_id)
|
||||
{
|
||||
const core_info_t *core = apple_core_info_list_get_by_id([core_id UTF8String]);
|
||||
const core_info_t *core = (const core_info_t*)core_info_list_get_by_id(core_id.UTF8String);
|
||||
return core ? BOXSTRING(core->display_name) : core_id;
|
||||
}
|
||||
|
||||
@ -91,14 +91,14 @@ NSString *apple_get_core_display_name(NSString *core_id)
|
||||
{
|
||||
bool hasDot = false;
|
||||
|
||||
if ([partialString length])
|
||||
for (int i = 0; i != [partialString length]; i ++)
|
||||
if (partialString.length)
|
||||
for (int i = 0; i < partialString.length; i ++)
|
||||
{
|
||||
unichar ch = [partialString characterAtIndex:i];
|
||||
|
||||
if (i == 0 && (![self minimum] || [[self minimum] intValue] < 0) && ch == '-')
|
||||
if (i == 0 && (!self.minimum || [[self minimum] intValue] < 0) && ch == '-')
|
||||
continue;
|
||||
else if ([self allowsFloats] && !hasDot && ch == '.')
|
||||
else if (self.allowsFloats && !hasDot && ch == '.')
|
||||
hasDot = true;
|
||||
else if (!isdigit(ch))
|
||||
return NO;
|
||||
@ -110,7 +110,7 @@ NSString *apple_get_core_display_name(NSString *core_id)
|
||||
#ifdef IOS
|
||||
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
|
||||
{
|
||||
NSString* text = [[textField text] stringByReplacingCharactersInRange:range withString:string];
|
||||
NSString* text = (NSString*)[[textField text] stringByReplacingCharactersInRange:range withString:string];
|
||||
return [self isPartialStringValid:text newEditingString:nil errorDescription:nil];
|
||||
}
|
||||
#endif
|
||||
|
@ -29,11 +29,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<string>1.0.3</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<string>1.0.3</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIApplicationExitsOnSuspend</key>
|
||||
|
@ -385,7 +385,7 @@ static void file_action(enum file_action action, NSString* source, NSString* tar
|
||||
NSString* text = [alertView textFieldAtIndex:0].text;
|
||||
|
||||
if (text.length)
|
||||
file_action(alertView.tag, self.selectedItem.path, [_path stringByAppendingPathComponent:text]);
|
||||
file_action((enum file_action)alertView.tag, self.selectedItem.path, [_path stringByAppendingPathComponent:text]);
|
||||
}
|
||||
|
||||
[self browseTo:_path];
|
||||
|
157
apple/iOS/menu.m
157
apple/iOS/menu.m
@ -15,7 +15,7 @@
|
||||
|
||||
#include <objc/runtime.h>
|
||||
#include "apple/common/RetroArch_Apple.h"
|
||||
#include "apple/common/apple_input.h"
|
||||
#include "../../input/apple_input.h"
|
||||
#include "menu.h"
|
||||
|
||||
/*********************************************/
|
||||
@ -191,10 +191,14 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
{
|
||||
switch (setting->type)
|
||||
{
|
||||
case ST_BOOL: return [[RAMenuItemBooleanSetting alloc] initWithSetting:setting];
|
||||
case ST_PATH: return [[RAMenuItemPathSetting alloc] initWithSetting:setting];
|
||||
case ST_BIND: return [[RAMenuItemBindSetting alloc] initWithSetting:setting];
|
||||
default: break;
|
||||
case ST_BOOL:
|
||||
return [[RAMenuItemBooleanSetting alloc] initWithSetting:setting];
|
||||
case ST_PATH:
|
||||
return [[RAMenuItemPathSetting alloc] initWithSetting:setting];
|
||||
case ST_BIND:
|
||||
return [[RAMenuItemBindSetting alloc] initWithSetting:setting];
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (setting->type == ST_STRING && setting->values)
|
||||
@ -245,8 +249,8 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
|
||||
- (void)wasSelectedOnTableView:(UITableView*)tableView ofController:(UIViewController*)controller
|
||||
{
|
||||
UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Enter new value" message:BOXSTRING(self.setting->short_description) delegate:self
|
||||
cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
|
||||
UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:BOXSTRING("Enter new value") message:BOXSTRING(self.setting->short_description) delegate:self
|
||||
cancelButtonTitle:BOXSTRING("Cancel") otherButtonTitles:BOXSTRING("OK"), nil];
|
||||
alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
|
||||
|
||||
UITextField* field = [alertView textFieldAtIndex:0];
|
||||
@ -260,7 +264,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
|
||||
- (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
|
||||
{
|
||||
NSString* text = [alertView textFieldAtIndex:0].text;
|
||||
NSString* text = (NSString*)[alertView textFieldAtIndex:0].text;
|
||||
|
||||
if (buttonIndex == alertView.firstOtherButtonIndex && text.length)
|
||||
{
|
||||
@ -283,7 +287,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
{
|
||||
RAMenuItemGeneralSetting __weak* weakSelf = self;
|
||||
|
||||
struct string_list* items = string_split("OK", "|");
|
||||
struct string_list* items = (struct string_list*)string_split("OK", "|");
|
||||
RunActionSheet("Really Reset Value?", items, self.parentTable,
|
||||
^(UIActionSheet* actionSheet, NSInteger buttonIndex)
|
||||
{
|
||||
@ -316,7 +320,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
{
|
||||
static NSString* const cell_id = @"boolean_setting";
|
||||
|
||||
UITableViewCell* result = [tableView dequeueReusableCellWithIdentifier:cell_id];
|
||||
UITableViewCell* result = (UITableViewCell*)[tableView dequeueReusableCellWithIdentifier:cell_id];
|
||||
if (!result)
|
||||
{
|
||||
result = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cell_id];
|
||||
@ -393,7 +397,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
{
|
||||
RAMenuItemEnumSetting __weak* weakSelf = self;
|
||||
|
||||
struct string_list* items = string_split(self.setting->values, "|");
|
||||
struct string_list* items = (struct string_list*)string_split(self.setting->values, "|");
|
||||
RunActionSheet(self.setting->short_description, items, self.parentTable,
|
||||
^(UIActionSheet* actionSheet, NSInteger buttonIndex)
|
||||
{
|
||||
@ -423,11 +427,11 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
|
||||
- (void)wasSelectedOnTableView:(UITableView *)tableView ofController:(UIViewController *)controller
|
||||
{
|
||||
self.alert = [[UIAlertView alloc] initWithTitle:@"RetroArch"
|
||||
self.alert = [[UIAlertView alloc] initWithTitle:BOXSTRING("RetroArch")
|
||||
message:BOXSTRING(self.setting->short_description)
|
||||
delegate:self
|
||||
cancelButtonTitle:@"Cancel"
|
||||
otherButtonTitles:@"Clear Keyboard", @"Clear Joystick", @"Clear Axis", nil];
|
||||
cancelButtonTitle:BOXSTRING("Cancel")
|
||||
otherButtonTitles:BOXSTRING("Clear Keyboard"), BOXSTRING("Clear Joystick"), BOXSTRING("Clear Axis"), nil];
|
||||
|
||||
[self.alert show];
|
||||
|
||||
@ -493,7 +497,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
- (id)init
|
||||
{
|
||||
if ((self = [super initWithStyle:UITableViewStylePlain]))
|
||||
self.title = @"RetroArch";
|
||||
self.title = BOXSTRING("RetroArch");
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -507,44 +511,44 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
RAMainMenu* __weak weakSelf = self;
|
||||
self.sections = [NSMutableArray array];
|
||||
|
||||
NSMutableArray* settings = [NSMutableArray arrayWithObjects:@"Settings",
|
||||
[RAMenuItemBasic itemWithDescription:@"Frontend"
|
||||
NSMutableArray* settings = [NSMutableArray arrayWithObjects:BOXSTRING("Settings"),
|
||||
[RAMenuItemBasic itemWithDescription:BOXSTRING("Frontend")
|
||||
action:^{ [weakSelf.navigationController pushViewController:[RAFrontendSettingsMenu new] animated:YES]; }],
|
||||
nil];
|
||||
|
||||
if (!apple_is_running)
|
||||
{
|
||||
[self.sections addObject:[NSArray arrayWithObjects:@"Content",
|
||||
[RAMenuItemBasic itemWithDescription:@"Choose Core"
|
||||
[self.sections addObject:[NSArray arrayWithObjects:BOXSTRING("Content"),
|
||||
[RAMenuItemBasic itemWithDescription:BOXSTRING("Choose Core")
|
||||
action:^{ [weakSelf chooseCoreWithPath:nil]; }
|
||||
detail:^{ return weakSelf.core ? apple_get_core_display_name(weakSelf.core) : @"Auto Detect"; }],
|
||||
[RAMenuItemBasic itemWithDescription:@"Load Content" action:^{ [weakSelf loadGame]; }],
|
||||
[RAMenuItemBasic itemWithDescription:@"Load Content (History)" action:^{ [weakSelf loadHistory]; }],
|
||||
detail:^{ return weakSelf.core ? apple_get_core_display_name(weakSelf.core) : BOXSTRING("Auto Detect"); }],
|
||||
[RAMenuItemBasic itemWithDescription:BOXSTRING("Load Content") action:^{ [weakSelf loadGame]; }],
|
||||
[RAMenuItemBasic itemWithDescription:BOXSTRING("Load Content (History)") action:^{ [weakSelf loadHistory]; }],
|
||||
nil]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self.sections addObject:[NSArray arrayWithObjects:@"Actions",
|
||||
[RAMenuItemBasic itemWithDescription:@"Reset Content" action:^{ [weakSelf performBasicAction:RESET]; }],
|
||||
[RAMenuItemBasic itemWithDescription:@"Close Content" action:^{ [weakSelf performBasicAction:QUIT]; }],
|
||||
[self.sections addObject:[NSArray arrayWithObjects:BOXSTRING("Actions"),
|
||||
[RAMenuItemBasic itemWithDescription:BOXSTRING("Reset Content") action:^{ [weakSelf performBasicAction:RESET]; }],
|
||||
[RAMenuItemBasic itemWithDescription:BOXSTRING("Close Content") action:^{ [weakSelf performBasicAction:QUIT]; }],
|
||||
nil]];
|
||||
|
||||
[self.sections addObject:[NSArray arrayWithObjects:@"States",
|
||||
[self.sections addObject:[NSArray arrayWithObjects:BOXSTRING("States"),
|
||||
[RAMenuItemStateSelect new],
|
||||
[RAMenuItemBasic itemWithDescription:@"Load State" action:^{ [weakSelf performBasicAction:LOAD_STATE]; }],
|
||||
[RAMenuItemBasic itemWithDescription:@"Save State" action:^{ [weakSelf performBasicAction:SAVE_STATE]; }],
|
||||
[RAMenuItemBasic itemWithDescription:BOXSTRING("Load State") action:^{ [weakSelf performBasicAction:LOAD_STATE]; }],
|
||||
[RAMenuItemBasic itemWithDescription:BOXSTRING("Save State") action:^{ [weakSelf performBasicAction:SAVE_STATE]; }],
|
||||
nil]];
|
||||
|
||||
[settings addObject:[RAMenuItemBasic itemWithDescription:@"Core"
|
||||
[settings addObject:[RAMenuItemBasic itemWithDescription:BOXSTRING("Core")
|
||||
action:^{ [weakSelf.navigationController pushViewController:[[RACoreSettingsMenu alloc] initWithCore:apple_core] animated:YES]; }]];
|
||||
[settings addObject:[RAMenuItemBasic itemWithDescription:@"Core Options"
|
||||
[settings addObject:[RAMenuItemBasic itemWithDescription:BOXSTRING("Core Options")
|
||||
action:^{ [weakSelf.navigationController pushViewController:[RACoreOptionsMenu new] animated:YES]; }]];
|
||||
}
|
||||
|
||||
[self.sections addObject:settings];
|
||||
|
||||
if (apple_is_running)
|
||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Resume" style:UIBarButtonItemStyleBordered target:[RetroArch_iOS get] action:@selector(showGameView)];
|
||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:BOXSTRING("Resume") style:UIBarButtonItemStyleBordered target:[RetroArch_iOS get] action:@selector(showGameView)];
|
||||
else
|
||||
self.navigationItem.leftBarButtonItem = nil;
|
||||
}
|
||||
@ -563,7 +567,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
action: ^(NSString* core)
|
||||
{
|
||||
if (path)
|
||||
apple_run_core(core, [path UTF8String]);
|
||||
apple_run_core(core, path.UTF8String);
|
||||
else
|
||||
{
|
||||
weakSelf.core = core;
|
||||
@ -587,7 +591,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
if (item && !item.isDirectory)
|
||||
{
|
||||
if (weakSelf.core)
|
||||
apple_run_core(weakSelf.core, [item.path UTF8String]);
|
||||
apple_run_core(weakSelf.core, item.path.UTF8String);
|
||||
else
|
||||
[weakSelf chooseCoreWithPath:item.path];
|
||||
}
|
||||
@ -598,7 +602,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
|
||||
- (void)loadHistory
|
||||
{
|
||||
NSString* history_path = [NSString stringWithFormat:@"%@/%s", [RetroArch_iOS get].systemDirectory, ".retroarch-game-history.txt"];
|
||||
NSString* history_path = [NSString stringWithFormat:BOXSTRING("%@/%s"), [RetroArch_iOS get].systemDirectory, ".retroarch-game-history.txt"];
|
||||
[self.navigationController pushViewController:[[RAHistoryMenu alloc] initWithHistoryPath:history_path] animated:YES];
|
||||
}
|
||||
|
||||
@ -623,7 +627,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
{
|
||||
_history = rom_history_init([historyPath UTF8String], 100);
|
||||
[self reloadData];
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Clear History"
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:BOXSTRING("Clear History")
|
||||
style:UIBarButtonItemStyleBordered target:self action:@selector(clearHistory)];
|
||||
}
|
||||
|
||||
@ -640,14 +644,14 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
- (void)willReloadData
|
||||
{
|
||||
RAHistoryMenu* __weak weakSelf = self;
|
||||
NSMutableArray* section = [NSMutableArray arrayWithObject:@""];
|
||||
NSMutableArray* section = [NSMutableArray arrayWithObject:BOXSTRING("")];
|
||||
|
||||
for (int i = 0; _history && i != rom_history_size(_history); i ++)
|
||||
for (int i = 0; _history && i < rom_history_size(_history); i ++)
|
||||
{
|
||||
RAMenuItemBasic* item = [RAMenuItemBasic itemWithDescription:BOXSTRING(path_basename(apple_rom_history_get_path(weakSelf.history, i)))
|
||||
action:^{ apple_run_core(BOXSTRING(apple_rom_history_get_core_path(weakSelf.history, i)),
|
||||
apple_rom_history_get_path(weakSelf.history, i)); }
|
||||
detail:^{ return BOXSTRING(apple_rom_history_get_core_name(weakSelf.history, i)); }];
|
||||
RAMenuItemBasic* item = [RAMenuItemBasic itemWithDescription:BOXSTRING(path_basename(rom_history_get_path(weakSelf.history, i)))
|
||||
action:^{ apple_run_core(BOXSTRING(rom_history_get_core_path(weakSelf.history, i)),
|
||||
rom_history_get_path(weakSelf.history, i)); }
|
||||
detail:^{ return BOXSTRING(rom_history_get_core_name(weakSelf.history, i)); }];
|
||||
[section addObject:item];
|
||||
}
|
||||
|
||||
@ -672,7 +676,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
|
||||
NSMutableArray* settings = nil;
|
||||
|
||||
for (const rarch_setting_t* i = group + 1; i->type != ST_END_GROUP; i ++)
|
||||
for (const rarch_setting_t* i = group + 1; i->type < ST_END_GROUP; i ++)
|
||||
{
|
||||
if (i->type == ST_SUB_GROUP)
|
||||
settings = [NSMutableArray arrayWithObjects:BOXSTRING(i->name), nil];
|
||||
@ -712,24 +716,24 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
|
||||
if ((self = [super initWithStyle:UITableViewStyleGrouped]))
|
||||
{
|
||||
_isCustom = apple_core_info_has_custom_config([core UTF8String]);
|
||||
_isCustom = core_info_has_custom_config(core.UTF8String);
|
||||
if (_isCustom)
|
||||
{
|
||||
self.title = apple_get_core_display_name(core);
|
||||
|
||||
_pathToSave = BOXSTRING(apple_core_info_get_custom_config([core UTF8String], buffer, sizeof(buffer)));
|
||||
_pathToSave = BOXSTRING(core_info_get_custom_config(core.UTF8String, buffer, sizeof(buffer)));
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target:self action:@selector(deleteCustom)];
|
||||
}
|
||||
else
|
||||
{
|
||||
self.title = @"Global Core Config";
|
||||
self.title = BOXSTRING("Global Core Config");
|
||||
_pathToSave = apple_platform.globalConfigFile;
|
||||
}
|
||||
|
||||
const rarch_setting_t* setting_data = setting_data_get_list();
|
||||
const rarch_setting_t* setting_data = (const rarch_setting_t*)setting_data_get_list();
|
||||
|
||||
setting_data_reset(setting_data);
|
||||
setting_data_load_config_path(setting_data, [_pathToSave UTF8String]);
|
||||
setting_data_load_config_path(setting_data, _pathToSave.UTF8String);
|
||||
|
||||
// HACK: Load the key mapping table
|
||||
apple_input_find_any_key();
|
||||
@ -752,10 +756,10 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
[section addObject:[RAMenuItemGeneralSetting itemForSetting:setting_data_find_setting(setting_data, groups[i][j])]];
|
||||
}
|
||||
|
||||
NSMutableArray* settings = [NSMutableArray arrayWithObjects:@"", nil];
|
||||
NSMutableArray* settings = [NSMutableArray arrayWithObjects:BOXSTRING(""), nil];
|
||||
[self.sections addObject:settings];
|
||||
|
||||
for (const rarch_setting_t* i = setting_data; i->type != ST_NONE; i ++)
|
||||
for (const rarch_setting_t* i = setting_data; i->type < ST_NONE; i++)
|
||||
if (i->type == ST_GROUP)
|
||||
[settings addObject:[RAMenuItemBasic itemWithDescription:BOXSTRING(i->name) action:
|
||||
^{
|
||||
@ -770,7 +774,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
{
|
||||
if (self.pathToSave)
|
||||
{
|
||||
config_file_t* config = config_file_new([self.pathToSave UTF8String]);
|
||||
config_file_t* config = (config_file_t*)config_file_new(self.pathToSave.UTF8String);
|
||||
if (!config)
|
||||
config = config_file_new(0);
|
||||
|
||||
@ -779,7 +783,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
config_set_string(config, "system_directory", [[RetroArch_iOS get].systemDirectory UTF8String]);
|
||||
config_set_string(config, "savefile_directory", [[RetroArch_iOS get].systemDirectory UTF8String]);
|
||||
config_set_string(config, "savestate_directory", [[RetroArch_iOS get].systemDirectory UTF8String]);
|
||||
config_file_write(config, [self.pathToSave UTF8String]);
|
||||
config_file_write(config, self.pathToSave.UTF8String);
|
||||
config_file_free(config);
|
||||
|
||||
apple_refresh_config();
|
||||
@ -819,11 +823,11 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
{
|
||||
RAFrontendSettingsMenu* __weak weakSelf = self;
|
||||
|
||||
self.title = @"Frontend Settings";
|
||||
self.title = BOXSTRING("Frontend Settings");
|
||||
|
||||
RAMenuItemBasic* diagnostic_item = [RAMenuItemBasic itemWithDescription:@"Diagnostic Log"
|
||||
RAMenuItemBasic* diagnostic_item = [RAMenuItemBasic itemWithDescription:BOXSTRING("Diagnostic Log")
|
||||
action:^{ [weakSelf.navigationController pushViewController:[[RALogMenu alloc] initWithFile:[[RetroArch_iOS get].logPath UTF8String]] animated:YES]; }];
|
||||
[self.sections insertObject:@[@"", diagnostic_item] atIndex:0];
|
||||
[self.sections insertObject:@[BOXSTRING(""), diagnostic_item] atIndex:0];
|
||||
|
||||
_coreConfigOptions = [NSMutableArray array];
|
||||
[self.sections addObject:_coreConfigOptions];
|
||||
@ -840,27 +844,27 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
- (void)willReloadData
|
||||
{
|
||||
RAFrontendSettingsMenu* __weak weakSelf = self;
|
||||
NSMutableArray* cores = self.coreConfigOptions;
|
||||
NSMutableArray* cores = (NSMutableArray*)self.coreConfigOptions;
|
||||
|
||||
[cores removeAllObjects];
|
||||
|
||||
[cores addObject:@"Configurations"];
|
||||
[cores addObject:[RAMenuItemBasic itemWithDescription:@"Global Core Config"
|
||||
[cores addObject:BOXSTRING("Configurations")];
|
||||
[cores addObject:[RAMenuItemBasic itemWithDescription:BOXSTRING("Global Core Config")
|
||||
action: ^{ [weakSelf showCoreConfigFor:nil]; }]];
|
||||
|
||||
[cores addObject:[RAMenuItemBasic itemWithDescription:@"New Config for Core"
|
||||
[cores addObject:[RAMenuItemBasic itemWithDescription:BOXSTRING("New Config for Core")
|
||||
action: ^{ [weakSelf createNewConfig]; }]];
|
||||
|
||||
const core_info_list_t* core_list = apple_core_info_list_get();
|
||||
const core_info_list_t* core_list = (const core_info_list_t*)core_info_list_get();
|
||||
for (int i = 0; i < core_list->count; i ++)
|
||||
{
|
||||
NSString* core_id = apple_get_core_id(&core_list->list[i]);
|
||||
if (apple_core_info_has_custom_config([core_id UTF8String]))
|
||||
NSString* core_id = (NSString*)apple_get_core_id(&core_list->list[i]);
|
||||
if (core_info_has_custom_config(core_id.UTF8String))
|
||||
{
|
||||
[cores addObject:[RAMenuItemBasic itemWithDescription:BOXSTRING(core_list->list[i].display_name)
|
||||
association:core_id
|
||||
action: ^(id userdata) { [weakSelf showCoreConfigFor:userdata]; }
|
||||
detail: ^(id userdata) { return @""; }]];
|
||||
detail: ^(id userdata) { return BOXSTRING(""); }]];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -882,10 +886,10 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
RAMenuCoreList* list = [[RAMenuCoreList alloc] initWithPath:nil allowAutoDetect:false
|
||||
action:^(NSString* core)
|
||||
{
|
||||
if (!apple_core_info_has_custom_config([core UTF8String]))
|
||||
if (!core_info_has_custom_config(core.UTF8String))
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
apple_core_info_get_custom_config([core UTF8String], path, sizeof(path));
|
||||
core_info_get_custom_config(core.UTF8String, path, sizeof(path));
|
||||
|
||||
if (![[NSFileManager defaultManager] copyItemAtPath:apple_platform.globalConfigFile toPath:BOXSTRING(path) error:nil])
|
||||
RARCH_WARN("Could not create custom config at %s", path);
|
||||
@ -914,20 +918,21 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
if ((self = [super initWithStyle:UITableViewStyleGrouped]))
|
||||
{
|
||||
RACoreOptionsMenu* __weak weakSelf = self;
|
||||
core_option_manager_t* options = g_extern.system.core_options;
|
||||
core_option_manager_t* options = (core_option_manager_t*)g_extern.system.core_options;
|
||||
|
||||
NSMutableArray* section = [NSMutableArray arrayWithObject:@""];
|
||||
NSMutableArray* section = (NSMutableArray*)[NSMutableArray arrayWithObject:BOXSTRING("")];
|
||||
[self.sections addObject:section];
|
||||
|
||||
if (options)
|
||||
{
|
||||
for (int i = 0; i != core_option_size(options); i ++)
|
||||
unsigned i;
|
||||
for (i = 0; i < core_option_size(options); i ++)
|
||||
[section addObject:[RAMenuItemBasic itemWithDescription:BOXSTRING(core_option_get_desc(options, i)) association:nil
|
||||
action:^{ [weakSelf editValue:i]; }
|
||||
detail:^{ return BOXSTRING(core_option_get_val(options, i)); }]];
|
||||
}
|
||||
else
|
||||
[section addObject:[RAMenuItemBasic itemWithDescription:@"The running core has no options." action:NULL]];
|
||||
[section addObject:[RAMenuItemBasic itemWithDescription:BOXSTRING("The running core has no options.") action:NULL]];
|
||||
}
|
||||
|
||||
return self;
|
||||
@ -1011,37 +1016,37 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
{
|
||||
if ((self = [super initWithStyle:UITableViewStyleGrouped]))
|
||||
{
|
||||
self.title = @"Choose Core";
|
||||
self.title = BOXSTRING("Choose Core");
|
||||
_action = action;
|
||||
_path = path;
|
||||
|
||||
if (autoDetect)
|
||||
{
|
||||
RAMenuCoreList* __weak weakSelf = self;
|
||||
[self.sections addObject: @[@"", [RAMenuItemBasic itemWithDescription:@"Auto Detect"
|
||||
[self.sections addObject: @[BOXSTRING(""), [RAMenuItemBasic itemWithDescription:BOXSTRING("Auto Detect")
|
||||
action: ^{ if(weakSelf.action) weakSelf.action(nil); }]]];
|
||||
}
|
||||
|
||||
NSMutableArray* core_section = [NSMutableArray arrayWithObject:@"Cores"];
|
||||
NSMutableArray* core_section = (NSMutableArray*)[NSMutableArray arrayWithObject:BOXSTRING("Cores")];
|
||||
[self.sections addObject:core_section];
|
||||
|
||||
core_info_list_t* core_list = apple_core_info_list_get();
|
||||
core_info_list_t* core_list = (core_info_list_t*)core_info_list_get();
|
||||
if (core_list)
|
||||
{
|
||||
if (_path)
|
||||
{
|
||||
const core_info_t* core_support = 0;
|
||||
size_t core_count = 0;
|
||||
core_info_list_get_supported_cores(core_list, [_path UTF8String], &core_support, &core_count);
|
||||
core_info_list_get_supported_cores(core_list, _path.UTF8String, &core_support, &core_count);
|
||||
|
||||
if (core_count == 1 && _action)
|
||||
[self runAction:apple_get_core_id(&core_support[0])];
|
||||
else if (core_count > 1)
|
||||
[self load:core_count coresFromList:core_support toSection:core_section];
|
||||
[self load:(uint32_t)core_count coresFromList:core_support toSection:core_section];
|
||||
}
|
||||
|
||||
if (!_path || [core_section count] == 1)
|
||||
[self load:core_list->count coresFromList:core_list->list toSection:core_section];
|
||||
[self load:(uint32_t)core_list->count coresFromList:core_list->list toSection:core_section];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1130,7 +1135,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
|
||||
+ (void)changed:(UISegmentedControl*)sender
|
||||
{
|
||||
g_extern.state_slot = sender.selectedSegmentIndex;
|
||||
g_extern.state_slot = (int)sender.selectedSegmentIndex;
|
||||
}
|
||||
|
||||
- (void)wasSelectedOnTableView:(UITableView *)tableView ofController:(UIViewController *)controller
|
||||
|
@ -18,7 +18,7 @@
|
||||
#import "RetroArch_Apple.h"
|
||||
#include "rarch_wrapper.h"
|
||||
|
||||
#include "apple/common/apple_input.h"
|
||||
#include "../../input/apple_input.h"
|
||||
#include "apple/common/setting_data.h"
|
||||
#include "apple/common/apple_gamecontroller.h"
|
||||
#include "menu.h"
|
||||
@ -114,7 +114,7 @@ void ios_set_logging_state(const char *log_path, bool on)
|
||||
// Input helpers: This is kept here because it needs objective-c
|
||||
static void handle_touch_event(NSArray* touches)
|
||||
{
|
||||
const int numTouches = [touches count];
|
||||
unsigned long numTouches = touches.count;
|
||||
const float scale = [[UIScreen mainScreen] scale];
|
||||
|
||||
g_current_input_data.touch_count = 0;
|
||||
@ -123,12 +123,12 @@ static void handle_touch_event(NSArray* touches)
|
||||
{
|
||||
UITouch* touch = [touches objectAtIndex:i];
|
||||
|
||||
if ([touch view] != [RAGameView get].view)
|
||||
if (touch.view != [RAGameView get].view)
|
||||
continue;
|
||||
|
||||
const CGPoint coord = [touch locationInView:[touch view]];
|
||||
|
||||
if ([touch phase] != UITouchPhaseEnded && [touch phase] != UITouchPhaseCancelled)
|
||||
if (touch.phase != UITouchPhaseEnded && touch.phase != UITouchPhaseCancelled)
|
||||
{
|
||||
g_current_input_data.touches[g_current_input_data.touch_count ].screen_x = coord.x * scale;
|
||||
g_current_input_data.touches[g_current_input_data.touch_count ++].screen_y = coord.y * scale;
|
||||
@ -161,23 +161,23 @@ static void handle_touch_event(NSArray* touches)
|
||||
// but is bad for business with events.
|
||||
static double last_time_stamp;
|
||||
|
||||
if (last_time_stamp == [event timestamp])
|
||||
if (last_time_stamp == event.timestamp)
|
||||
return [super _keyCommandForEvent:event];
|
||||
last_time_stamp = [event timestamp];
|
||||
last_time_stamp = event.timestamp;
|
||||
|
||||
// If the _hidEvent is null, [event _keyCode] will crash. (This happens with the on screen keyboard.)
|
||||
if ([event _hidEvent])
|
||||
if (event._hidEvent)
|
||||
{
|
||||
NSString* ch = [event _privateInput];
|
||||
NSString* ch = (NSString*)event._privateInput;
|
||||
|
||||
if (!ch || [ch length] == 0)
|
||||
apple_input_keyboard_event([event _isKeyDown], [event _keyCode], 0, [event _modifierFlags]);
|
||||
apple_input_keyboard_event(event._isKeyDown, (uint32_t)event._keyCode, 0, (uint32_t)event._modifierFlags);
|
||||
else
|
||||
{
|
||||
apple_input_keyboard_event([event _isKeyDown], [event _keyCode], [ch characterAtIndex:0], [event _modifierFlags]);
|
||||
apple_input_keyboard_event(event._isKeyDown, (uint32_t)event._keyCode, [ch characterAtIndex:0], (uint32_t)event._modifierFlags);
|
||||
|
||||
for (unsigned i = 1; i != [ch length]; i ++)
|
||||
apple_input_keyboard_event([event _isKeyDown], 0, [ch characterAtIndex:i], [event _modifierFlags]);
|
||||
apple_input_keyboard_event(event._isKeyDown, 0, [ch characterAtIndex:i], (uint32_t)event._modifierFlags);
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,8 +188,8 @@ static void handle_touch_event(NSArray* touches)
|
||||
{
|
||||
[super sendEvent:event];
|
||||
|
||||
if ([[event allTouches] count])
|
||||
handle_touch_event([[event allTouches] allObjects]);
|
||||
if (event.allTouches.count)
|
||||
handle_touch_event(event.allTouches.allObjects);
|
||||
|
||||
if (!(IOS_IS_VERSION_7_OR_HIGHER()) && [event respondsToSelector:@selector(_gsEvent)])
|
||||
{
|
||||
@ -250,9 +250,10 @@ static void handle_touch_event(NSArray* touches)
|
||||
}
|
||||
|
||||
// Warn if there are no cores present
|
||||
apple_core_info_set_core_path([self.coreDirectory UTF8String]);
|
||||
apple_core_info_set_config_path([self.configDirectory UTF8String]);
|
||||
const core_info_list_t* core_list = apple_core_info_list_get();
|
||||
core_info_set_core_path([self.coreDirectory UTF8String]);
|
||||
core_info_set_config_path([self.configDirectory UTF8String]);
|
||||
|
||||
const core_info_list_t* core_list = (const core_info_list_t*)core_info_list_get();
|
||||
|
||||
if (!core_list || core_list->count == 0)
|
||||
apple_display_alert(@"No libretro cores were found. You will not be able to run any content.", 0);
|
||||
@ -260,7 +261,7 @@ static void handle_touch_event(NSArray* touches)
|
||||
apple_gamecontroller_init();
|
||||
|
||||
// Load system config
|
||||
const rarch_setting_t* frontend_settings = apple_get_frontend_settings();
|
||||
const rarch_setting_t* frontend_settings = (const rarch_setting_t*)apple_get_frontend_settings();
|
||||
setting_data_reset(frontend_settings);
|
||||
setting_data_load_config_path(frontend_settings, [self.systemConfigPath UTF8String]);
|
||||
}
|
||||
@ -277,7 +278,7 @@ static void handle_touch_event(NSArray* touches)
|
||||
|
||||
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
|
||||
{
|
||||
NSString* filename = [[url path] lastPathComponent];
|
||||
NSString* filename = (NSString*)url.path.lastPathComponent;
|
||||
|
||||
NSError* error = nil;
|
||||
[[NSFileManager defaultManager] moveItemAtPath:[url path] toPath:[self.documentsDirectory stringByAppendingPathComponent:filename] error:&error];
|
||||
|
@ -17,7 +17,7 @@
|
||||
#define _RARCH_APPLE_VIEWS_H
|
||||
|
||||
#include <UIKit/UIKit.h>
|
||||
#include "core_info.h"
|
||||
#include "frontend/info/core_info.h"
|
||||
|
||||
|
||||
#include "menu.h"
|
||||
|
@ -87,9 +87,12 @@ static void *alsa_init(const char *device, unsigned rate, unsigned latency)
|
||||
|
||||
TRY_ALSA(snd_pcm_hw_params(alsa->pcm, params));
|
||||
|
||||
snd_pcm_hw_params_get_period_size(params, &buffer_size, NULL);
|
||||
// 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);
|
||||
snd_pcm_hw_params_get_buffer_size(params, &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);
|
||||
|
@ -177,10 +177,14 @@ static void *alsa_thread_init(const char *device, unsigned rate, unsigned latenc
|
||||
|
||||
TRY_ALSA(snd_pcm_hw_params(alsa->pcm, params));
|
||||
|
||||
snd_pcm_hw_params_get_period_size(params, &alsa->period_frames, NULL);
|
||||
// Shouldn't have to bother with this, but some drivers are apparently broken.
|
||||
if (snd_pcm_hw_params_get_period_size(params, &alsa->period_frames, NULL))
|
||||
snd_pcm_hw_params_get_period_size_min(params, &alsa->period_frames, NULL);
|
||||
RARCH_LOG("ALSA: Period size: %d frames\n", (int)alsa->period_frames);
|
||||
snd_pcm_hw_params_get_buffer_size(params, &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->period_size = snd_pcm_frames_to_bytes(alsa->pcm, alsa->period_frames);
|
||||
|
||||
|
324
audio/cc_resampler.c
Normal file
324
audio/cc_resampler.c
Normal file
@ -0,0 +1,324 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2014 - Ali Bouhlel ( aliaspider@gmail.com )
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
// Convoluted Cosine Resampler
|
||||
|
||||
#include "resampler.h"
|
||||
#include "../libretro.h"
|
||||
#include "../performance.h"
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef RESAMPLER_TEST
|
||||
#include "../general.h"
|
||||
#else
|
||||
#define RARCH_LOG(...) fprintf(stderr, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
typedef struct audio_frame_float
|
||||
{
|
||||
float l;
|
||||
float r;
|
||||
} audio_frame_float_t;
|
||||
|
||||
typedef struct audio_frame_int16
|
||||
{
|
||||
int16_t l;
|
||||
int16_t r;
|
||||
} audio_frame_int16_t;
|
||||
|
||||
#ifdef _MIPS_ARCH_ALLEGREX1
|
||||
static void resampler_CC_process(void *re_, struct resampler_data *data)
|
||||
{
|
||||
(void)re_;
|
||||
float ratio, fraction;
|
||||
|
||||
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;
|
||||
|
||||
__asm__ (
|
||||
".set push\n"
|
||||
".set noreorder\n"
|
||||
|
||||
"mtv %2, s700 \n" // 700 = data->ratio = b
|
||||
// "vsat0.s s700, s700 \n"
|
||||
"vrcp.s s701, s700 \n" // 701 = 1.0 / b
|
||||
"vadd.s s702, s700, s700 \n" // 702 = 2 * b
|
||||
"vmul.s s703, s700, s710 \n" // 703 = b * pi
|
||||
|
||||
"mfv %0, s701 \n"
|
||||
"mfv %1, s730 \n"
|
||||
|
||||
".set pop\n"
|
||||
: "=r"(ratio), "=r"(fraction)
|
||||
: "r"((float)data->ratio)
|
||||
);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
while (fraction < ratio)
|
||||
{
|
||||
__asm__ (
|
||||
".set push \n"
|
||||
".set noreorder \n"
|
||||
|
||||
"lv.s s620, 0(%1) \n"
|
||||
"lv.s s621, 4(%1) \n"
|
||||
|
||||
"vsub.s s731, s701, s730 \n"
|
||||
|
||||
"vadd.q c600, c730[-X,Y,-X,Y], c730[1/2,1/2,-1/2,-1/2]\n"
|
||||
|
||||
"vmul.q c610, c600, c700[Z,Z,Z,Z] \n" //*2*b
|
||||
"vmul.q c600, c600, c700[W,W,W,W] \n" //*b*pi
|
||||
"vsin.q c610, c610 \n"
|
||||
"vadd.q c600, c600, c610 \n"
|
||||
|
||||
"vmul.q c600[-1:1,-1:1,-1:1,-1:1], c600, c710[Y,Y,Y,Y] \n"
|
||||
|
||||
"vsub.p c600, c600, c602 \n"
|
||||
|
||||
"vmul.q c620, c620[X,Y,X,Y], c600[X,X,Y,Y] \n"
|
||||
|
||||
"vadd.q c720, c720, c620 \n"
|
||||
|
||||
|
||||
"vadd.s s730, s730, s730[1] \n"
|
||||
"mfv %0, s730 \n"
|
||||
|
||||
".set pop \n"
|
||||
: "=r"(fraction)
|
||||
: "r"(inp));
|
||||
|
||||
inp++;
|
||||
if (inp == inp_max)
|
||||
goto done;
|
||||
}
|
||||
__asm__ (
|
||||
".set push \n"
|
||||
".set noreorder \n"
|
||||
|
||||
"vmul.p c720, c720, c720[1/2,1/2] \n"
|
||||
"sv.s s720, 0(%1) \n"
|
||||
"sv.s s721, 4(%1) \n"
|
||||
"vmov.q c720, c720[Z,W,0,0] \n"
|
||||
"vsub.s s730, s730, s701 \n"
|
||||
"mfv %0, s730 \n"
|
||||
|
||||
".set pop \n"
|
||||
: "=r"(fraction)
|
||||
: "r"(outp));
|
||||
|
||||
outp++;
|
||||
}
|
||||
|
||||
// The VFPU state is assumed to remain intact in-between calls to resampler_CC_process.
|
||||
|
||||
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(double bandwidth_mod)
|
||||
{
|
||||
__asm__ (
|
||||
".set push\n"
|
||||
".set noreorder\n"
|
||||
|
||||
"vcst.s s710, VFPU_PI \n" // 710 = pi
|
||||
"vcst.s s711, VFPU_1_PI \n" // 711 = 1.0 / (pi)
|
||||
|
||||
"vzero.q c720 \n"
|
||||
"vzero.q c730 \n"
|
||||
|
||||
".set pop\n");
|
||||
|
||||
RARCH_LOG("\nConvoluted Cosine resampler (VFPU): \n");
|
||||
return (void*)-1;
|
||||
}
|
||||
#else
|
||||
|
||||
// C reference version. Not optimized.
|
||||
typedef struct rarch_CC_resampler
|
||||
{
|
||||
audio_frame_float_t buffer[4];
|
||||
float distance;
|
||||
void (*process)(void *re, struct resampler_data *data);
|
||||
} rarch_CC_resampler_t;
|
||||
|
||||
static inline float cc_int(float x, float b)
|
||||
{
|
||||
float val = x * b * M_PI + sinf(x * b * M_PI);
|
||||
return (val > M_PI) ? M_PI : (val < -M_PI) ? -M_PI : val;
|
||||
}
|
||||
|
||||
static inline float cc_kernel(float x, float b)
|
||||
{
|
||||
return (cc_int(x + 0.5, b) - cc_int(x - 0.5, b)) / (2.0 * M_PI);
|
||||
}
|
||||
|
||||
static inline void add_to(const audio_frame_float_t *source, audio_frame_float_t *target, float ratio)
|
||||
{
|
||||
target->l += source->l * ratio;
|
||||
target->r += source->r * ratio;
|
||||
}
|
||||
|
||||
static void resampler_CC_downsample(void *re_, struct resampler_data *data)
|
||||
{
|
||||
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
|
||||
|
||||
while (inp != inp_max)
|
||||
{
|
||||
add_to(inp, re->buffer + 0, cc_kernel(re->distance, b));
|
||||
add_to(inp, re->buffer + 1, cc_kernel(re->distance - ratio, b));
|
||||
add_to(inp, re->buffer + 2, cc_kernel(re->distance - ratio - ratio, b));
|
||||
|
||||
re->distance++;
|
||||
inp++;
|
||||
|
||||
if (re->distance > (ratio + 0.5))
|
||||
{
|
||||
*outp = re->buffer[0];
|
||||
|
||||
re->buffer[0] = re->buffer[1];
|
||||
re->buffer[1] = re->buffer[2];
|
||||
|
||||
re->buffer[2].l = 0.0;
|
||||
re->buffer[2].r = 0.0;
|
||||
|
||||
re->distance -= ratio;
|
||||
outp++;
|
||||
}
|
||||
}
|
||||
|
||||
data->output_frames = outp - (audio_frame_float_t*)data->data_out;
|
||||
}
|
||||
|
||||
#ifndef min
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
static void resampler_CC_upsample(void *re_, struct resampler_data *data)
|
||||
{
|
||||
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 = inp + data->input_frames;
|
||||
audio_frame_float_t *outp = (audio_frame_float_t*)data->data_out;
|
||||
|
||||
float b = min(data->ratio, 1.00); // cutoff frequency
|
||||
float ratio = 1.0 / data->ratio;
|
||||
|
||||
while (inp != inp_max)
|
||||
{
|
||||
re->buffer[0] = re->buffer[1];
|
||||
re->buffer[1] = re->buffer[2];
|
||||
re->buffer[2] = re->buffer[3];
|
||||
re->buffer[3] = *inp;
|
||||
|
||||
while (re->distance < 1.0)
|
||||
{
|
||||
int i;
|
||||
float temp;
|
||||
outp->l = 0.0;
|
||||
outp->r = 0.0;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
temp = cc_kernel(re->distance + 1.0 - i, b);
|
||||
outp->l += re->buffer[i].l * temp;
|
||||
outp->r += re->buffer[i].r * temp;
|
||||
}
|
||||
|
||||
re->distance += ratio;
|
||||
outp++;
|
||||
}
|
||||
|
||||
re->distance -= 1.0;
|
||||
inp++;
|
||||
}
|
||||
|
||||
data->output_frames = outp - (audio_frame_float_t*)data->data_out;
|
||||
}
|
||||
|
||||
static void resampler_CC_process(void *re_, struct resampler_data *data)
|
||||
{
|
||||
rarch_CC_resampler_t *re = (rarch_CC_resampler_t*)re_;
|
||||
re->process(re_, data);
|
||||
}
|
||||
|
||||
static void resampler_CC_free(void *re_)
|
||||
{
|
||||
rarch_CC_resampler_t *re = (rarch_CC_resampler_t*)re_;
|
||||
if (re)
|
||||
free(re);
|
||||
}
|
||||
|
||||
static void *resampler_CC_init(double bandwidth_mod)
|
||||
{
|
||||
int i;
|
||||
rarch_CC_resampler_t *re = (rarch_CC_resampler_t*)calloc(1, sizeof(rarch_CC_resampler_t));
|
||||
if (!re)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
re->buffer[i].l = 0.0;
|
||||
re->buffer[i].r = 0.0;
|
||||
}
|
||||
|
||||
RARCH_LOG("Convoluted Cosine resampler (C) : ");
|
||||
|
||||
if (bandwidth_mod < 0.75) // variations of data->ratio around 0.75 are safer than around 1.0 for both up/downsampler.
|
||||
{
|
||||
RARCH_LOG("CC_downsample @%f \n", bandwidth_mod);
|
||||
re->process = resampler_CC_downsample;
|
||||
re->distance = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_LOG("CC_upsample @%f \n", bandwidth_mod);
|
||||
re->process = resampler_CC_upsample;
|
||||
re->distance = 2.0;
|
||||
}
|
||||
|
||||
return re;
|
||||
}
|
||||
#endif
|
||||
|
||||
const rarch_resampler_t CC_resampler = {
|
||||
resampler_CC_init,
|
||||
resampler_CC_process,
|
||||
resampler_CC_free,
|
||||
"CC",
|
||||
};
|
||||
|
@ -1,113 +0,0 @@
|
||||
/////
|
||||
// API header for external RetroArch DSP plugins.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef __RARCH_DSP_PLUGIN_H
|
||||
#define __RARCH_DSP_PLUGIN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef RARCH_DLL_IMPORT
|
||||
#define RARCH_API_EXPORT __declspec(dllimport)
|
||||
#else
|
||||
#define RARCH_API_EXPORT __declspec(dllexport)
|
||||
#endif
|
||||
#define RARCH_API_CALLTYPE __cdecl
|
||||
#else
|
||||
#define RARCH_API_EXPORT
|
||||
#define RARCH_API_CALLTYPE
|
||||
#endif
|
||||
|
||||
#ifndef RARCH_FALSE
|
||||
#define RARCH_FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef RARCH_TRUE
|
||||
#define RARCH_TRUE 1
|
||||
#endif
|
||||
|
||||
#define RARCH_DSP_API_VERSION 5
|
||||
|
||||
typedef struct rarch_dsp_info
|
||||
{
|
||||
// Input sample rate that the DSP plugin receives.
|
||||
float input_rate;
|
||||
} rarch_dsp_info_t;
|
||||
|
||||
typedef struct rarch_dsp_output
|
||||
{
|
||||
// The DSP plugin has to provide the buffering for the output samples.
|
||||
// This is for performance reasons to avoid redundant copying of data.
|
||||
// The samples are laid out in interleaving order: LRLRLRLR
|
||||
// The range of the samples are [-1.0, 1.0].
|
||||
// This range cannot be exceeded without horrible audio glitches.
|
||||
const float *samples;
|
||||
|
||||
// Frames which the DSP plugin outputted for the current process.
|
||||
// One frame is here defined as a combined sample of
|
||||
// left and right channels.
|
||||
// (I.e. 44.1kHz, 16bit stereo will have
|
||||
// 88.2k samples/sec and 44.1k frames/sec.)
|
||||
unsigned frames;
|
||||
} rarch_dsp_output_t;
|
||||
|
||||
typedef struct rarch_dsp_input
|
||||
{
|
||||
// Input data for the DSP. The samples are interleaved in order: LRLRLRLR
|
||||
const float *samples;
|
||||
|
||||
// Number of frames for input data.
|
||||
// One frame is here defined as a combined sample of
|
||||
// left and right channels.
|
||||
// (I.e. 44.1kHz, 16bit stereo will have
|
||||
// 88.2k samples/sec and 44.1k frames/sec.)
|
||||
unsigned frames;
|
||||
} rarch_dsp_input_t;
|
||||
|
||||
typedef struct rarch_dsp_plugin
|
||||
{
|
||||
// Creates a handle of the plugin. Returns NULL if failed.
|
||||
void *(*init)(const rarch_dsp_info_t *info);
|
||||
|
||||
// Processes input data.
|
||||
// The plugin is allowed to return variable sizes for output data.
|
||||
void (*process)(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input);
|
||||
|
||||
// Frees the handle.
|
||||
void (*free)(void *data);
|
||||
|
||||
// API version used to compile the plugin.
|
||||
// Used to detect mismatches in API.
|
||||
// Must be set to RARCH_DSP_API_VERSION on compile.
|
||||
int api_version;
|
||||
|
||||
// Signal plugin that it may open a configuring window or
|
||||
// something similiar. The behavior of this function
|
||||
// is thus plugin dependent. Implementing this is optional,
|
||||
// and can be set to NULL.
|
||||
void (*config)(void *data);
|
||||
|
||||
// Human readable identification string.
|
||||
const char *ident;
|
||||
|
||||
// Called every frame, allows creating a GUI main loop in the main thread.
|
||||
// GUI events can be processed here in a non-blocking fashion.
|
||||
// Can be set to NULL to ignore it.
|
||||
void (*events)(void *data);
|
||||
} rarch_dsp_plugin_t;
|
||||
|
||||
// Called by RetroArch at startup to get the callback struct.
|
||||
// This is NOT dynamically allocated!
|
||||
RARCH_API_EXPORT const rarch_dsp_plugin_t* RARCH_API_CALLTYPE
|
||||
rarch_dsp_plugin_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
91
audio/filters/Makefile
Normal file
91
audio/filters/Makefile
Normal file
@ -0,0 +1,91 @@
|
||||
compiler := gcc
|
||||
extra_flags :=
|
||||
use_neon := 0
|
||||
release := release
|
||||
DYLIB := so
|
||||
|
||||
ifeq ($(platform),)
|
||||
platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
platform = win
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
platform = osx
|
||||
arch = intel
|
||||
ifeq ($(shell uname -p),powerpc)
|
||||
arch = ppc
|
||||
endif
|
||||
else ifneq ($(findstring win,$(shell uname -a)),)
|
||||
platform = win
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(platform),gcc)
|
||||
extra_rules_gcc := $(shell $(compiler) -dumpmachine)
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring armv7,$(extra_rules_gcc)))
|
||||
extra_flags += -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon
|
||||
use_neon := 1
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring hardfloat,$(extra_rules_gcc)))
|
||||
extra_flags += -mfloat-abi=hard
|
||||
endif
|
||||
|
||||
ifeq (release,$(build))
|
||||
extra_flags += -O2
|
||||
endif
|
||||
|
||||
ifeq (debug,$(build))
|
||||
extra_flags += -O0 -g
|
||||
endif
|
||||
|
||||
ldflags := -shared -Wl,--version-script=link.T
|
||||
|
||||
ifeq ($(platform), unix)
|
||||
DYLIB = so
|
||||
else ifeq ($(platform), osx)
|
||||
compiler := $(CC)
|
||||
DYLIB = dylib
|
||||
ldflags := -dynamiclib
|
||||
else
|
||||
extra_flags += -static-libgcc -static-libstdc++
|
||||
DYLIB = dll
|
||||
endif
|
||||
|
||||
CC := $(compiler)
|
||||
CXX := $(subst CC,++,$(compiler)) -std=gnu++0x
|
||||
flags := -fPIC $(extra_flags)
|
||||
asflags := -fPIC $(extra_flags)
|
||||
objects :=
|
||||
flags += -std=c99
|
||||
|
||||
|
||||
ifeq (1,$(use_neon))
|
||||
ASMFLAGS := -INEON/asm
|
||||
asflags += -mfpu=neon
|
||||
endif
|
||||
|
||||
objects += echo.$(DYLIB) eq.$(DYLIB) iir.$(DYLIB) phaser.$(DYLIB) reverb.$(DYLIB) volume.$(DYLIB) wah.$(DYLIB)
|
||||
|
||||
all: build;
|
||||
|
||||
%.o: %.S
|
||||
$(CC) -c -o $@ $(asflags) $(ASMFLAGS) $<
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c -o $@ $(flags) $<
|
||||
|
||||
%.$(DYLIB): %.o
|
||||
$(CC) -o $@ $(ldflags) $(flags) $^
|
||||
|
||||
build: $(objects)
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f *.$(DYLIB)
|
||||
|
||||
strip:
|
||||
strip -s *.$(DYLIB)
|
33
audio/filters/boolean.h
Normal file
33
audio/filters/boolean.h
Normal file
@ -0,0 +1,33 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __RARCH_BOOLEAN_H
|
||||
#define __RARCH_BOOLEAN_H
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#if defined(_MSC_VER) && !defined(SN_TARGET_PS3)
|
||||
/* Hack applied for MSVC when compiling in C89 mode as it isn't C99 compliant. */
|
||||
#define bool unsigned char
|
||||
#define true 1
|
||||
#define false 0
|
||||
#else
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
187
audio/filters/echo.c
Normal file
187
audio/filters/echo.c
Normal file
@ -0,0 +1,187 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "rarch_dsp.h"
|
||||
|
||||
// 4 source echo.
|
||||
|
||||
#ifndef ALIGNED
|
||||
#ifdef __GNUC__
|
||||
#define ALIGNED __attribute__((aligned(16)))
|
||||
#else
|
||||
#define ALIGNED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef min
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
struct echo_filter
|
||||
{
|
||||
float *history; // history buffer
|
||||
int pos; // current position in history buffer
|
||||
int amp; // amplification of echoes (0-256)
|
||||
int delay; // delay in number of samples
|
||||
int ms; // delay in miliseconds
|
||||
int rate; // sample rate
|
||||
|
||||
float f_amp; // amplification (0-1)
|
||||
float input_rate;
|
||||
};
|
||||
|
||||
struct echo_filter_data
|
||||
{
|
||||
struct echo_filter echo_l;
|
||||
struct echo_filter echo_r;
|
||||
float buf[4096];
|
||||
};
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#define rarch_dsp_plugin_init echo_dsp_plugin_init
|
||||
#endif
|
||||
|
||||
static float echo_process(void *data, float in)
|
||||
{
|
||||
struct echo_filter *echo = (struct echo_filter*)data;
|
||||
|
||||
float smp = echo->history[echo->pos];
|
||||
smp *= echo->f_amp;
|
||||
smp += in;
|
||||
echo->history[echo->pos] = smp;
|
||||
echo->pos = (echo->pos + 1) % echo->delay;
|
||||
return smp;
|
||||
}
|
||||
|
||||
static void echo_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input)
|
||||
{
|
||||
int num_samples, i;
|
||||
struct echo_filter_data *echo = (struct echo_filter_data*)data;
|
||||
output->samples = echo->buf;
|
||||
num_samples = input->frames * 2;
|
||||
|
||||
for (i = 0; i < num_samples;)
|
||||
{
|
||||
echo->buf[i] = echo_process(&echo->echo_l, input->samples[i]);
|
||||
i++;
|
||||
echo->buf[i] = echo_process(&echo->echo_r, input->samples[i]);
|
||||
i++;
|
||||
}
|
||||
output->frames = input->frames;
|
||||
}
|
||||
|
||||
static void echo_dsp_free(void *data)
|
||||
{
|
||||
struct echo_filter_data *echo = (struct echo_filter_data*)data;
|
||||
|
||||
if (echo)
|
||||
free(echo);
|
||||
}
|
||||
|
||||
static void echo_set_delay(void *data, int ms)
|
||||
{
|
||||
int new_delay, how_much, i;
|
||||
float *new_history;
|
||||
struct echo_filter *echo = (struct echo_filter*)data;
|
||||
|
||||
new_delay = ms * echo->input_rate / 1000;
|
||||
if (new_delay == 0)
|
||||
new_delay = 1;
|
||||
|
||||
new_history = (float*)malloc(new_delay * sizeof(float));
|
||||
memset(new_history, 0, new_delay * sizeof(float));
|
||||
|
||||
if (echo->history)
|
||||
{
|
||||
how_much = echo->delay - echo->pos;
|
||||
how_much = min(how_much, new_delay);
|
||||
memcpy(new_history, echo->history + echo->pos, how_much * sizeof(float));
|
||||
|
||||
if (how_much < new_delay)
|
||||
{
|
||||
i = how_much;
|
||||
how_much = new_delay - how_much;
|
||||
how_much = min(how_much, echo->delay);
|
||||
how_much = min(how_much, echo->pos);
|
||||
memcpy(new_history + i, echo->history, how_much * sizeof(float));
|
||||
}
|
||||
|
||||
if (echo->history)
|
||||
free(echo->history);
|
||||
}
|
||||
echo->history = new_history;
|
||||
echo->pos = 0;
|
||||
echo->delay = new_delay;
|
||||
echo->ms = ms;
|
||||
}
|
||||
|
||||
static void *echo_dsp_init(const rarch_dsp_info_t *info)
|
||||
{
|
||||
struct echo_filter_data *echo = (struct echo_filter_data*)calloc(1, sizeof(*echo));;
|
||||
|
||||
if (!echo)
|
||||
return NULL;
|
||||
|
||||
echo->echo_l.history = NULL;
|
||||
echo->echo_l.input_rate = info->input_rate;
|
||||
echo_set_delay(&echo->echo_l, 200);
|
||||
echo->echo_l.amp = 128;
|
||||
echo->echo_l.f_amp = (float)echo->echo_l.amp / 256.0f;
|
||||
echo->echo_l.pos = 0;
|
||||
|
||||
echo->echo_r.history = NULL;
|
||||
echo->echo_r.input_rate = info->input_rate;
|
||||
echo_set_delay(&echo->echo_r, 200);
|
||||
echo->echo_r.amp = 128;
|
||||
echo->echo_r.f_amp = (float)echo->echo_r.amp / 256.0f;
|
||||
echo->echo_r.pos = 0;
|
||||
|
||||
fprintf(stderr, "[Echo] loaded!\n");
|
||||
|
||||
return echo;
|
||||
}
|
||||
|
||||
static void echo_dsp_config(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static const struct dspfilter_implementation generic_echo_dsp = {
|
||||
echo_dsp_init,
|
||||
echo_dsp_process,
|
||||
echo_dsp_free,
|
||||
RARCH_DSP_API_VERSION,
|
||||
echo_dsp_config,
|
||||
"Echo",
|
||||
NULL
|
||||
};
|
||||
|
||||
const struct dspfilter_implementation *rarch_dsp_plugin_init(dspfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &generic_echo_dsp;
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#undef rarch_dsp_plugin_init
|
||||
#endif
|
422
audio/filters/eq.c
Normal file
422
audio/filters/eq.c
Normal file
@ -0,0 +1,422 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "rarch_dsp.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <complex.h> //FIXME: This is a dependency missing pretty much everywhere except Linux
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include "boolean.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265
|
||||
#endif
|
||||
|
||||
#ifndef EQ_COEFF_SIZE
|
||||
#define EQ_COEFF_SIZE 256
|
||||
#endif
|
||||
|
||||
#ifndef EQ_FILT_SIZE
|
||||
#define EQ_FILT_SIZE (EQ_COEFF_SIZE * 2)
|
||||
#endif
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#define rarch_dsp_plugin_init eq_dsp_plugin_init
|
||||
#endif
|
||||
|
||||
typedef struct dsp_eq_state dsp_eq_state_t;
|
||||
|
||||
static complex float phase_lut[2 * EQ_FILT_SIZE + 1];
|
||||
static complex float * const phase_lut_ptr = phase_lut + EQ_FILT_SIZE;
|
||||
|
||||
static void generate_phase_lut(void)
|
||||
{
|
||||
int i;
|
||||
for (i = -EQ_FILT_SIZE; i <= EQ_FILT_SIZE; i++)
|
||||
{
|
||||
float phase = (float)i / EQ_FILT_SIZE;
|
||||
phase_lut_ptr[i] = cexpf(M_PI * I * phase);
|
||||
}
|
||||
}
|
||||
|
||||
static inline unsigned bitrange(unsigned len)
|
||||
{
|
||||
unsigned ret;
|
||||
ret = 0;
|
||||
while ((len >>= 1))
|
||||
ret++;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline unsigned bitswap(unsigned i, unsigned range)
|
||||
{
|
||||
unsigned ret, shifts;
|
||||
ret = 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]
|
||||
static void interleave(complex float *butterfly_buf, size_t samples)
|
||||
{
|
||||
unsigned range, i, target;
|
||||
range = bitrange(samples);
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
target = bitswap(i, range);
|
||||
if (target > i)
|
||||
{
|
||||
complex float tmp = butterfly_buf[target];
|
||||
butterfly_buf[target] = butterfly_buf[i];
|
||||
butterfly_buf[i] = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void butterfly(complex float *a, complex float *b, complex float mod)
|
||||
{
|
||||
complex float a_, b_;
|
||||
mod *= *b;
|
||||
a_ = *a + mod;
|
||||
b_ = *a - mod;
|
||||
*a = a_;
|
||||
*b = b_;
|
||||
}
|
||||
|
||||
static void butterflies(complex float *butterfly_buf, int phase_dir, size_t step_size, size_t samples)
|
||||
{
|
||||
unsigned i, j;
|
||||
int phase_step;
|
||||
for (i = 0; i < samples; i += 2 * step_size)
|
||||
{
|
||||
phase_step = EQ_FILT_SIZE * phase_dir / (int)step_size;
|
||||
for (j = i; j < i + step_size; j++)
|
||||
butterfly(&butterfly_buf[j], &butterfly_buf[j + step_size], phase_lut_ptr[phase_step * (int)(j - i)]);
|
||||
}
|
||||
}
|
||||
|
||||
static void calculate_fft_butterfly(complex float *butterfly_buf, size_t samples)
|
||||
{
|
||||
unsigned step_size;
|
||||
// Interleave buffer to work with FFT.
|
||||
interleave(butterfly_buf, samples);
|
||||
|
||||
// Fly, lovely butterflies! :D
|
||||
for (step_size = 1; step_size < samples; step_size *= 2)
|
||||
butterflies(butterfly_buf, -1, step_size, samples);
|
||||
}
|
||||
|
||||
static void calculate_fft(const float *data, complex float *butterfly_buf, size_t samples)
|
||||
{
|
||||
unsigned i, step_size;
|
||||
for (i = 0; i < samples; i++)
|
||||
butterfly_buf[i] = data[i];
|
||||
|
||||
// Interleave buffer to work with FFT.
|
||||
interleave(butterfly_buf, samples);
|
||||
|
||||
// Fly, lovely butterflies! :D
|
||||
for (step_size = 1; step_size < samples; step_size *= 2)
|
||||
butterflies(butterfly_buf, -1, step_size, samples);
|
||||
}
|
||||
|
||||
static void calculate_ifft(complex float *butterfly_buf, size_t samples)
|
||||
{
|
||||
unsigned step_size, i;
|
||||
float factor;
|
||||
|
||||
// Interleave buffer to work with FFT.
|
||||
interleave(butterfly_buf, samples);
|
||||
|
||||
// Fly, lovely butterflies! In opposite direction! :D
|
||||
for (step_size = 1; step_size < samples; step_size *= 2)
|
||||
butterflies(butterfly_buf, 1, step_size, samples);
|
||||
|
||||
factor = 1.0 / samples;
|
||||
for (i = 0; i < samples; i++)
|
||||
butterfly_buf[i] *= factor;
|
||||
}
|
||||
|
||||
struct eq_band
|
||||
{
|
||||
float gain;
|
||||
unsigned min_bin;
|
||||
unsigned max_bin;
|
||||
};
|
||||
|
||||
struct dsp_eq_state
|
||||
{
|
||||
struct eq_band *bands;
|
||||
unsigned num_bands;
|
||||
|
||||
complex float fft_coeffs[EQ_FILT_SIZE];
|
||||
float cosine_window[EQ_COEFF_SIZE];
|
||||
|
||||
float last_buf[EQ_COEFF_SIZE];
|
||||
float stage_buf[EQ_FILT_SIZE];
|
||||
unsigned stage_ptr;
|
||||
};
|
||||
|
||||
static void calculate_band_range(struct eq_band *band, float norm_freq)
|
||||
{
|
||||
unsigned max_bin = (unsigned)round(norm_freq * EQ_COEFF_SIZE);
|
||||
|
||||
band->gain = 1.0;
|
||||
band->max_bin = max_bin;
|
||||
}
|
||||
|
||||
static void recalculate_fft_filt(dsp_eq_state_t *eq)
|
||||
{
|
||||
unsigned i, j, start, end;
|
||||
complex float freq_response[EQ_FILT_SIZE] = {0.0f};
|
||||
|
||||
for (i = 0; i < eq->num_bands; i++)
|
||||
{
|
||||
for (j = eq->bands[i].min_bin; j <= eq->bands[i].max_bin; j++)
|
||||
freq_response[j] = eq->bands[i].gain;
|
||||
}
|
||||
|
||||
memset(eq->fft_coeffs, 0, sizeof(eq->fft_coeffs));
|
||||
|
||||
for (start = 1, end = EQ_COEFF_SIZE - 1; start < EQ_COEFF_SIZE / 2; start++, end--)
|
||||
freq_response[end] = freq_response[start];
|
||||
|
||||
calculate_ifft(freq_response, EQ_COEFF_SIZE);
|
||||
|
||||
// ifftshift(). Needs to be done for some reason ... TODO: Figure out why :D
|
||||
memcpy(eq->fft_coeffs + EQ_COEFF_SIZE / 2, freq_response + 0, EQ_COEFF_SIZE / 2 * sizeof(complex float));
|
||||
memcpy(eq->fft_coeffs + 0, freq_response + EQ_COEFF_SIZE / 2, EQ_COEFF_SIZE / 2 * sizeof(complex float));
|
||||
|
||||
for (i = 0; i < EQ_COEFF_SIZE; i++)
|
||||
eq->fft_coeffs[i] *= eq->cosine_window[i];
|
||||
|
||||
calculate_fft_butterfly(eq->fft_coeffs, EQ_FILT_SIZE);
|
||||
}
|
||||
|
||||
static void dsp_eq_free(dsp_eq_state_t *eq)
|
||||
{
|
||||
if (eq)
|
||||
{
|
||||
if (eq->bands)
|
||||
free(eq->bands);
|
||||
free(eq);
|
||||
}
|
||||
}
|
||||
|
||||
static dsp_eq_state_t *dsp_eq_new(float input_rate, const float *bands, unsigned num_bands)
|
||||
{
|
||||
unsigned i;
|
||||
dsp_eq_state_t *state;
|
||||
|
||||
for (i = 1; i < num_bands; i++)
|
||||
{
|
||||
if (bands[i] <= bands[i - 1])
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (num_bands < 2)
|
||||
return NULL;
|
||||
|
||||
state = (dsp_eq_state_t*)calloc(1, sizeof(*state));
|
||||
if (!state)
|
||||
return NULL;
|
||||
|
||||
state->num_bands = num_bands;
|
||||
|
||||
state->bands = (struct eq_band*)calloc(num_bands, sizeof(struct eq_band));
|
||||
if (!state->bands)
|
||||
goto error;
|
||||
|
||||
calculate_band_range(&state->bands[0], ((bands[0] + bands[1]) / 2.0) / input_rate);
|
||||
state->bands[0].min_bin = 0;
|
||||
|
||||
for (i = 1; i < num_bands - 1; i++)
|
||||
{
|
||||
calculate_band_range(&state->bands[i], ((bands[i + 1] + bands[i + 0]) / 2.0) / input_rate);
|
||||
state->bands[i].min_bin = state->bands[i - 1].max_bin + 1;
|
||||
|
||||
if (state->bands[i].max_bin < state->bands[i].min_bin)
|
||||
fprintf(stderr, "[Equalizer]: Band @ %.2f Hz does not have enough spectral resolution to fit.\n", bands[i]);
|
||||
}
|
||||
|
||||
state->bands[num_bands - 1].max_bin = EQ_COEFF_SIZE / 2;
|
||||
state->bands[num_bands - 1].min_bin = state->bands[num_bands - 2].max_bin + 1;
|
||||
state->bands[num_bands - 1].gain = 1.0f;
|
||||
|
||||
for (i = 0; i < EQ_COEFF_SIZE; i++)
|
||||
state->cosine_window[i] = cosf(M_PI * (i + 0.5 - EQ_COEFF_SIZE / 2) / EQ_COEFF_SIZE);
|
||||
|
||||
generate_phase_lut();
|
||||
recalculate_fft_filt(state);
|
||||
|
||||
return state;
|
||||
|
||||
error:
|
||||
dsp_eq_free(state);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void dsp_eq_set_gain(dsp_eq_state_t *eq, unsigned band, float gain)
|
||||
{
|
||||
assert(band < eq->num_bands);
|
||||
|
||||
eq->bands[band].gain = gain;
|
||||
recalculate_fft_filt(eq);
|
||||
}
|
||||
#endif
|
||||
|
||||
static size_t dsp_eq_process(dsp_eq_state_t *eq, float *output, size_t out_samples,
|
||||
const float *input, size_t in_samples, unsigned stride)
|
||||
{
|
||||
size_t written = 0;
|
||||
while (in_samples)
|
||||
{
|
||||
unsigned i;
|
||||
size_t to_read = EQ_COEFF_SIZE - eq->stage_ptr;
|
||||
|
||||
if (to_read > in_samples)
|
||||
to_read = in_samples;
|
||||
|
||||
for (i = 0; i < to_read; i++, input += stride)
|
||||
eq->stage_buf[eq->stage_ptr + i] = *input;
|
||||
|
||||
in_samples -= to_read;
|
||||
eq->stage_ptr += to_read;
|
||||
|
||||
if (eq->stage_ptr >= EQ_COEFF_SIZE)
|
||||
{
|
||||
complex float butterfly_buf[EQ_FILT_SIZE];
|
||||
if (out_samples < EQ_COEFF_SIZE)
|
||||
return written;
|
||||
|
||||
calculate_fft(eq->stage_buf, butterfly_buf, EQ_FILT_SIZE);
|
||||
for (i = 0; i < EQ_FILT_SIZE; i++)
|
||||
butterfly_buf[i] *= eq->fft_coeffs[i];
|
||||
|
||||
calculate_ifft(butterfly_buf, EQ_FILT_SIZE);
|
||||
|
||||
for (i = 0; i < EQ_COEFF_SIZE; i++, output += stride, out_samples--, written++)
|
||||
*output = crealf(butterfly_buf[i]) + eq->last_buf[i];
|
||||
|
||||
for (i = 0; i < EQ_COEFF_SIZE; i++)
|
||||
eq->last_buf[i] = crealf(butterfly_buf[i + EQ_COEFF_SIZE]);
|
||||
|
||||
eq->stage_ptr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static float db2gain(float val)
|
||||
{
|
||||
return powf(10.0, val / 20.0);
|
||||
}
|
||||
|
||||
static float noise(void)
|
||||
{
|
||||
return 2.0 * ((float)(rand()) / RAND_MAX - 0.5);
|
||||
}
|
||||
#endif
|
||||
|
||||
struct equalizer_filter_data
|
||||
{
|
||||
dsp_eq_state_t *eq_l;
|
||||
dsp_eq_state_t *eq_r;
|
||||
float out_buffer[8092];
|
||||
};
|
||||
|
||||
static size_t equalizer_process(void *data, const float *in, unsigned frames)
|
||||
{
|
||||
struct equalizer_filter_data *eq = (struct equalizer_filter_data*)data;
|
||||
|
||||
size_t written = dsp_eq_process(eq->eq_l, eq->out_buffer + 0, 4096, in + 0, frames, 2);
|
||||
dsp_eq_process(eq->eq_r, eq->out_buffer + 1, 4096, in + 1, frames, 2);
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
static void * eq_dsp_init(const rarch_dsp_info_t *info)
|
||||
{
|
||||
const float bands[] = { 30, 80, 150, 250, 500, 800, 1000, 2000, 3000, 5000, 8000, 10000, 12000, 15000 };
|
||||
struct equalizer_filter_data *eq = (struct equalizer_filter_data*)calloc(1, sizeof(*eq));
|
||||
|
||||
if (!eq)
|
||||
return NULL;
|
||||
|
||||
eq->eq_l = dsp_eq_new(info->input_rate, bands, sizeof(bands) / sizeof(bands[0]));
|
||||
eq->eq_r = dsp_eq_new(info->input_rate, bands, sizeof(bands) / sizeof(bands[0]));
|
||||
|
||||
return eq;
|
||||
}
|
||||
|
||||
static void eq_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input)
|
||||
{
|
||||
struct equalizer_filter_data *eq = (struct equalizer_filter_data*)data;
|
||||
|
||||
output->samples = eq->out_buffer;
|
||||
size_t out_frames = equalizer_process(eq, input->samples, input->frames);
|
||||
output->frames = out_frames;
|
||||
}
|
||||
|
||||
static void eq_dsp_free(void *data)
|
||||
{
|
||||
struct equalizer_filter_data *eq = (struct equalizer_filter_data*)data;
|
||||
|
||||
if (eq)
|
||||
{
|
||||
dsp_eq_free(eq->eq_l);
|
||||
dsp_eq_free(eq->eq_r);
|
||||
free(eq);
|
||||
}
|
||||
}
|
||||
|
||||
static void eq_dsp_config(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
const struct dspfilter_implementation generic_eq_dsp = {
|
||||
eq_dsp_init,
|
||||
eq_dsp_process,
|
||||
eq_dsp_free,
|
||||
RARCH_DSP_API_VERSION,
|
||||
eq_dsp_config,
|
||||
"Equalizer",
|
||||
NULL
|
||||
};
|
||||
|
||||
const struct dspfilter_implementation *rarch_dsp_plugin_init(dspfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &generic_eq_dsp;
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#undef rarch_dsp_plugin_init
|
||||
#endif
|
419
audio/filters/iir.c
Normal file
419
audio/filters/iir.c
Normal file
@ -0,0 +1,419 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - Daniel De Matteis
|
||||
* Copyright (C) 2012-2014 - Brad Miller
|
||||
*
|
||||
* 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 "rarch_dsp.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef __SSE2__
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.1415926535897932384626433832795
|
||||
#endif
|
||||
|
||||
#ifndef ALIGNED
|
||||
#ifdef __GNUC__
|
||||
#define ALIGNED __attribute__((aligned(16)));
|
||||
#else
|
||||
#define ALIGNED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define sqr(a) ((a) * (a))
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#define rarch_dsp_plugin_init iir_dsp_plugin_init
|
||||
#endif
|
||||
|
||||
struct iir_filter
|
||||
{
|
||||
#ifdef __SSE2__
|
||||
__m128 fir_coeff[2];
|
||||
__m128 fir_buf[2];
|
||||
|
||||
__m128 iir_coeff;
|
||||
__m128 iir_buf;
|
||||
#endif
|
||||
float pf_freq, pf_qfact, pf_gain;
|
||||
int type, pf_q_is_bandwidth;
|
||||
float xn1,xn2,yn1,yn2;
|
||||
float omega, cs, a1pha, beta, b0, b1, b2, a0, a1,a2, A, sn;
|
||||
};
|
||||
|
||||
struct iir_filter_data
|
||||
{
|
||||
struct iir_filter iir_l ALIGNED;
|
||||
struct iir_filter iir_r ALIGNED;
|
||||
float buf[4096] ALIGNED;
|
||||
int rate;
|
||||
unsigned type;
|
||||
};
|
||||
|
||||
/* filter types */
|
||||
enum
|
||||
{
|
||||
LPF, /* low pass filter */
|
||||
HPF, /* High pass filter */
|
||||
BPCSGF,/* band pass filter 1 */
|
||||
BPZPGF,/* band pass filter 2 */
|
||||
APF, /* Allpass filter*/
|
||||
NOTCH, /* Notch Filter */
|
||||
RIAA_phono, /* RIAA record/tape deemphasis */
|
||||
PEQ, /* Peaking band EQ filter */
|
||||
BBOOST, /* Bassboost filter */
|
||||
LSH, /* Low shelf filter */
|
||||
HSH, /* High shelf filter */
|
||||
RIAA_CD /* CD de-emphasis */
|
||||
};
|
||||
|
||||
//lynched from SoX >w>
|
||||
static void iir_make_poly_from_roots(double const * roots, size_t num_roots, float * poly)
|
||||
{
|
||||
size_t i, j;
|
||||
poly[0] = 1;
|
||||
poly[1] = -roots[0];
|
||||
memset(poly + 2, 0, (num_roots + 1 - 2) * sizeof(*poly));
|
||||
for (i = 1; i < num_roots; ++i)
|
||||
for (j = num_roots; j > 0; --j)
|
||||
poly[j] -= poly[j - 1] * roots[i];
|
||||
}
|
||||
|
||||
static void iir_init(void *data, int samplerate, int filter_type)
|
||||
{
|
||||
struct iir_filter *iir = (struct iir_filter*)data;
|
||||
|
||||
if (!iir)
|
||||
return;
|
||||
|
||||
iir->xn1=0;
|
||||
iir->xn2=0;
|
||||
iir->yn1=0;
|
||||
iir->yn2=0;
|
||||
iir->omega = 2 * M_PI * iir->pf_freq/samplerate;
|
||||
iir->cs = cos(iir->omega);
|
||||
iir->sn = sin(iir->omega);
|
||||
iir->a1pha = iir->sn / (2.0 * iir->pf_qfact);
|
||||
iir->A = exp(log(10.0) * iir->pf_gain / 40);
|
||||
iir->beta = sqrt(iir->A + iir->A);
|
||||
//Set up filter coefficients according to type
|
||||
switch (filter_type)
|
||||
{
|
||||
case LPF:
|
||||
iir->b0 = (1.0 - iir->cs) / 2.0 ;
|
||||
iir->b1 = 1.0 - iir->cs ;
|
||||
iir->b2 = (1.0 - iir->cs) / 2.0 ;
|
||||
iir->a0 = 1.0 + iir->a1pha ;
|
||||
iir->a1 = -2.0 * iir->cs ;
|
||||
iir->a2 = 1.0 - iir->a1pha ;
|
||||
break;
|
||||
case HPF:
|
||||
iir->b0 = (1.0 + iir->cs) / 2.0 ;
|
||||
iir->b1 = -(1.0 + iir->cs) ;
|
||||
iir->b2 = (1.0 + iir->cs) / 2.0 ;
|
||||
iir->a0 = 1.0 + iir->a1pha ;
|
||||
iir->a1 = -2.0 * iir->cs ;
|
||||
iir->a2 = 1.0 - iir->a1pha ;
|
||||
break;
|
||||
case APF:
|
||||
iir->b0 = 1.0 - iir->a1pha;
|
||||
iir->b1 = -2.0 * iir->cs;
|
||||
iir->b2 = 1.0 + iir->a1pha;
|
||||
iir->a0 = 1.0 + iir->a1pha;
|
||||
iir->a1 = -2.0 * iir->cs;
|
||||
iir->a2 = 1.0 - iir->a1pha;
|
||||
break;
|
||||
case BPZPGF:
|
||||
iir->b0 = iir->a1pha ;
|
||||
iir->b1 = 0.0 ;
|
||||
iir->b2 = -iir->a1pha ;
|
||||
iir->a0 = 1.0 + iir->a1pha ;
|
||||
iir->a1 = -2.0 * iir->cs ;
|
||||
iir->a2 = 1.0 - iir->a1pha ;
|
||||
break;
|
||||
case BPCSGF:
|
||||
iir->b0=iir->sn/2.0;
|
||||
iir->b1=0.0;
|
||||
iir->b2=-iir->sn/2;
|
||||
iir->a0=1.0+iir->a1pha;
|
||||
iir->a1=-2.0*iir->cs;
|
||||
iir->a2=1.0-iir->a1pha;
|
||||
break;
|
||||
case NOTCH:
|
||||
iir->b0 = 1;
|
||||
iir->b1 = -2 * iir->cs;
|
||||
iir->b2 = 1;
|
||||
iir->a0 = 1 + iir->a1pha;
|
||||
iir->a1 = -2 * iir->cs;
|
||||
iir->a2 = 1 - iir->a1pha;
|
||||
break;
|
||||
case RIAA_phono: /* http://www.dsprelated.com/showmessage/73300/3.php */
|
||||
if (samplerate == 44100) {
|
||||
static const double zeros[] = {-0.2014898, 0.9233820};
|
||||
static const double poles[] = {0.7083149, 0.9924091};
|
||||
iir_make_poly_from_roots(zeros, (size_t)2, &iir->b0);
|
||||
iir_make_poly_from_roots(poles, (size_t)2, &iir->a0);
|
||||
}
|
||||
else if (samplerate == 48000) {
|
||||
static const double zeros[] = {-0.1766069, 0.9321590};
|
||||
static const double poles[] = {0.7396325, 0.9931330};
|
||||
iir_make_poly_from_roots(zeros, (size_t)2, &iir->b0);
|
||||
iir_make_poly_from_roots(poles, (size_t)2, &iir->a0);
|
||||
}
|
||||
else if (samplerate == 88200) {
|
||||
static const double zeros[] = {-0.1168735, 0.9648312};
|
||||
static const double poles[] = {0.8590646, 0.9964002};
|
||||
iir_make_poly_from_roots(zeros, (size_t)2, &iir->b0);
|
||||
iir_make_poly_from_roots(poles, (size_t)2, &iir->a0);
|
||||
}
|
||||
else if (samplerate == 96000) {
|
||||
static const double zeros[] = {-0.1141486, 0.9676817};
|
||||
static const double poles[] = {0.8699137, 0.9966946};
|
||||
iir_make_poly_from_roots(zeros, (size_t)2, &iir->b0);
|
||||
iir_make_poly_from_roots(poles, (size_t)2, &iir->a0);
|
||||
}
|
||||
{ /* Normalise to 0dB at 1kHz (Thanks to Glenn Davis) */
|
||||
double y = 2 * M_PI * 1000 / samplerate ;
|
||||
double b_re = iir->b0 + iir->b1 * cos(-y) + iir->b2 * cos(-2 * y);
|
||||
double a_re = iir->a0 + iir->a1 * cos(-y) + iir->a2 * cos(-2 * y);
|
||||
double b_im = iir->b1 * sin(-y) + iir->b2 * sin(-2 * y);
|
||||
double a_im = iir->a1 * sin(-y) + iir->a2 * sin(-2 * y);
|
||||
double g = 1 / sqrt((sqr(b_re) + sqr(b_im)) / (sqr(a_re) + sqr(a_im)));
|
||||
iir->b0 *= g;
|
||||
iir->b1 *= g;
|
||||
iir->b2 *= g;
|
||||
}
|
||||
break;
|
||||
case PEQ:
|
||||
iir->b0 = 1 + iir->a1pha * iir->A ;
|
||||
iir->b1 = -2 * iir->cs ;
|
||||
iir->b2 = 1 - iir->a1pha * iir->A ;
|
||||
iir->a0 = 1 + iir->a1pha / iir->A ;
|
||||
iir->a1 = -2 * iir->cs ;
|
||||
iir->a2 = 1 - iir->a1pha / iir->A ;
|
||||
break;
|
||||
case BBOOST:
|
||||
iir->beta = sqrt((iir->A * iir->A + 1) / 1.0 - (pow((iir->A - 1), 2)));
|
||||
iir->b0 = iir->A * ((iir->A + 1) - (iir->A - 1) * iir->cs + iir->beta * iir->sn);
|
||||
iir->b1 = 2 * iir->A * ((iir->A - 1) - (iir->A + 1) * iir->cs);
|
||||
iir->b2 = iir->A * ((iir->A + 1) - (iir->A - 1) * iir->cs - iir->beta * iir->sn);
|
||||
iir->a0 = ((iir->A + 1) + (iir->A - 1) * iir->cs + iir->beta * iir->sn);
|
||||
iir->a1 = -2 * ((iir->A - 1) + (iir->A + 1) * iir->cs);
|
||||
iir->a2 = (iir->A + 1) + (iir->A - 1) * iir->cs - iir->beta * iir->sn;
|
||||
break;
|
||||
case LSH:
|
||||
iir->b0 = iir->A * ((iir->A + 1) - (iir->A - 1) * iir->cs + iir->beta * iir->sn);
|
||||
iir->b1 = 2 * iir->A * ((iir->A - 1) - (iir->A + 1) * iir->cs);
|
||||
iir->b2 = iir->A * ((iir->A + 1) - (iir->A - 1) * iir->cs - iir->beta * iir->sn);
|
||||
iir->a0 = (iir->A + 1) + (iir->A - 1) * iir->cs + iir->beta * iir->sn;
|
||||
iir->a1 = -2 * ((iir->A - 1) + (iir->A + 1) * iir->cs);
|
||||
iir->a2 = (iir->A + 1) + (iir->A - 1) * iir->cs - iir->beta * iir->sn;
|
||||
break;
|
||||
case RIAA_CD:
|
||||
iir->omega = 2 * M_PI * 5283 / samplerate;
|
||||
iir->cs = cos(iir->omega);
|
||||
iir->sn = sin(iir->omega);
|
||||
iir->a1pha = iir->sn / (2.0 * 0.4845);
|
||||
iir->A = exp(log(10.0) * -9.477 / 40);
|
||||
iir->beta = sqrt(iir->A + iir->A);
|
||||
case HSH:
|
||||
iir->b0 = iir->A * ((iir->A + 1) + (iir->A - 1) * iir->cs + iir->beta * iir->sn);
|
||||
iir->b1 = -2 * iir->A * ((iir->A - 1) + (iir->A + 1) * iir->cs);
|
||||
iir->b2 = iir->A * ((iir->A + 1) + (iir->A - 1) * iir->cs - iir->beta * iir->sn);
|
||||
iir->a0 = (iir->A + 1) - (iir->A - 1) * iir->cs + iir->beta * iir->sn;
|
||||
iir->a1 = 2 * ((iir->A - 1) - (iir->A + 1) * iir->cs);
|
||||
iir->a2 = (iir->A + 1) - (iir->A - 1) * iir->cs - iir->beta * iir->sn;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef __SSE2__
|
||||
iir->fir_coeff[0] = _mm_set_ps(iir->b1 / iir->a0, iir->b1 / iir->a0, iir->b0 / iir->a0, iir->b0 / iir->a0);
|
||||
iir->fir_coeff[1] = _mm_set_ps(0.0f, 0.0f, iir->b2 / iir->a0, iir->b2 / iir->a0);
|
||||
iir->iir_coeff = _mm_set_ps(-iir->a2 / iir->a0, -iir->a2 / iir->a0, -iir->a1 / iir->a0, -iir->a1 / iir->a0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __SSE2__
|
||||
static void iir_process_batch(void *data, float *out, const float *in, unsigned frames)
|
||||
{
|
||||
unsigned i;
|
||||
struct iir_filter *iir = (struct iir_filter*)data;
|
||||
|
||||
__m128 fir_coeff[2] = { iir->fir_coeff[0], iir->fir_coeff[1] };
|
||||
__m128 iir_coeff = iir->iir_coeff;
|
||||
__m128 fir_buf[2] = { iir->fir_buf[0], iir->fir_buf[1] };
|
||||
__m128 iir_buf = iir->iir_buf;
|
||||
|
||||
for (i = 0; (i + 4) <= (2 * frames); in += 4, i += 4, out += 4)
|
||||
{
|
||||
__m128 input = _mm_loadu_ps(in);
|
||||
|
||||
fir_buf[1] = _mm_shuffle_ps(fir_buf[0], fir_buf[1], _MM_SHUFFLE(1, 0, 3, 2));
|
||||
fir_buf[0] = _mm_shuffle_ps(input, fir_buf[0], _MM_SHUFFLE(1, 0, 1, 0));
|
||||
|
||||
__m128 res[3] = {
|
||||
_mm_mul_ps(fir_buf[0], fir_coeff[0]),
|
||||
_mm_mul_ps(fir_buf[1], fir_coeff[1]),
|
||||
_mm_mul_ps(iir_buf, iir_coeff),
|
||||
};
|
||||
|
||||
__m128 result = _mm_add_ps(_mm_add_ps(res[0], res[1]), res[2]);
|
||||
result = _mm_add_ps(result, _mm_shuffle_ps(result, result, _MM_SHUFFLE(0, 0, 3, 2)));
|
||||
|
||||
iir_buf = _mm_shuffle_ps(result, iir_buf, _MM_SHUFFLE(1, 0, 1, 0));
|
||||
|
||||
fir_buf[1] = _mm_shuffle_ps(fir_buf[0], fir_buf[1], _MM_SHUFFLE(1, 0, 3, 2));
|
||||
fir_buf[0] = _mm_shuffle_ps(input, fir_buf[0], _MM_SHUFFLE(1, 0, 3, 2));
|
||||
|
||||
res[0] = _mm_mul_ps(fir_buf[0], fir_coeff[0]);
|
||||
res[1] = _mm_mul_ps(fir_buf[1], fir_coeff[1]);
|
||||
res[2] = _mm_mul_ps(iir_buf, iir_coeff);
|
||||
|
||||
__m128 result2 = _mm_add_ps(_mm_add_ps(res[0], res[1]), res[2]);
|
||||
result2 = _mm_add_ps(result2, _mm_shuffle_ps(result2, result2, _MM_SHUFFLE(0, 0, 3, 2)));
|
||||
|
||||
iir_buf = _mm_shuffle_ps(result2, iir_buf, _MM_SHUFFLE(1, 0, 1, 0));
|
||||
|
||||
_mm_store_ps(out, _mm_shuffle_ps(result, result2, _MM_SHUFFLE(1, 0, 1, 0)));
|
||||
}
|
||||
|
||||
iir->fir_buf[0] = fir_buf[0];
|
||||
iir->fir_buf[1] = fir_buf[1];
|
||||
iir->iir_buf = iir_buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
static float iir_process(void *data, float samp)
|
||||
{
|
||||
struct iir_filter *iir = (struct iir_filter*)data;
|
||||
|
||||
float out, in = 0;
|
||||
in = samp;
|
||||
out = (iir->b0 * in + iir->b1 * iir->xn1 + iir->b2 * iir->xn2 - iir->a1 * iir->yn1 - iir->a2 * iir->yn2) / iir->a0;
|
||||
iir->xn2 = iir->xn1;
|
||||
iir->xn1 = in;
|
||||
iir->yn2 = iir->yn1;
|
||||
iir->yn1 = out;
|
||||
return out;
|
||||
}
|
||||
|
||||
static void * iir_dsp_init(const rarch_dsp_info_t *info)
|
||||
{
|
||||
struct iir_filter_data *iir = (struct iir_filter_data*)calloc(1, sizeof(*iir));
|
||||
|
||||
if (!iir)
|
||||
return NULL;
|
||||
|
||||
iir->rate = info->input_rate;
|
||||
iir->type = 0;
|
||||
iir->iir_l.pf_freq = 1024;
|
||||
iir->iir_l.pf_qfact = 0.707;
|
||||
iir->iir_l.pf_gain = 0;
|
||||
iir_init(&iir->iir_l, info->input_rate, 0);
|
||||
iir->iir_r.pf_freq = 1024;
|
||||
iir->iir_r.pf_qfact = 0.707;
|
||||
iir->iir_r.pf_gain = 0;
|
||||
iir_init(&iir->iir_r, info->input_rate, 0);
|
||||
|
||||
return iir;
|
||||
}
|
||||
|
||||
static void iir_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input)
|
||||
{
|
||||
int i, num_samples;
|
||||
struct iir_filter_data *iir = (struct iir_filter_data*)data;
|
||||
|
||||
output->samples = iir->buf;
|
||||
|
||||
num_samples = input->frames * 2;
|
||||
for (i = 0; i<num_samples;)
|
||||
{
|
||||
iir->buf[i] = iir_process(&iir->iir_l, input->samples[i]);
|
||||
i++;
|
||||
iir->buf[i] = iir_process(&iir->iir_r, input->samples[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
output->frames = input->frames;
|
||||
}
|
||||
|
||||
#ifdef __SSE2__
|
||||
static void iir_dsp_process_sse2(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input)
|
||||
{
|
||||
struct iir_filter_data *iir = (struct iir_filter_data*)data;
|
||||
|
||||
output->samples = iir->buf;
|
||||
iir_process_batch(&iir->iir_l, iir->buf, input->samples, input->frames);
|
||||
output->frames = input->frames;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void iir_dsp_free(void *data)
|
||||
{
|
||||
struct iir_filter_data *iir = (struct iir_filter_data*)data;
|
||||
|
||||
if (iir)
|
||||
free(iir);
|
||||
}
|
||||
|
||||
static void iir_dsp_config(void* data)
|
||||
{
|
||||
}
|
||||
|
||||
const struct dspfilter_implementation generic_iir_dsp = {
|
||||
iir_dsp_init,
|
||||
iir_dsp_process,
|
||||
iir_dsp_free,
|
||||
RARCH_DSP_API_VERSION,
|
||||
iir_dsp_config,
|
||||
"IIR",
|
||||
NULL
|
||||
};
|
||||
|
||||
#ifdef __SSE2__
|
||||
const struct dspfilter_implementation sse2_iir_dsp = {
|
||||
iir_dsp_init,
|
||||
iir_dsp_process_sse2,
|
||||
iir_dsp_free,
|
||||
RARCH_DSP_API_VERSION,
|
||||
iir_dsp_config,
|
||||
"IIR (SSE2)",
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
const struct dspfilter_implementation *rarch_dsp_plugin_init(dspfilter_simd_mask_t simd)
|
||||
{
|
||||
#ifdef __SSE2__
|
||||
if (simd & DSPFILTER_SIMD_SSE2)
|
||||
return &sse2_iir_dsp;
|
||||
#endif
|
||||
return &generic_iir_dsp;
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#undef rarch_dsp_plugin_init
|
||||
#endif
|
4
audio/filters/link.T
Normal file
4
audio/filters/link.T
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
global: rarch_dsp_*;
|
||||
local: *;
|
||||
};
|
193
audio/filters/phaser.c
Normal file
193
audio/filters/phaser.c
Normal file
@ -0,0 +1,193 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - Daniel De Matteis
|
||||
* Copyright (C) 2012-2014 - Brad Miller
|
||||
*
|
||||
* 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 "rarch_dsp.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.1415926535897932384626433832795
|
||||
#endif
|
||||
|
||||
#define PHASERLFOSHAPE 4.0
|
||||
#define PHASER_LFOSKIPSAMPLES 20
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#define rarch_dsp_plugin_init phaser_dsp_plugin_init
|
||||
#endif
|
||||
|
||||
struct phaser_filter
|
||||
{
|
||||
float freq;
|
||||
float startphase;
|
||||
float fb;
|
||||
int depth;
|
||||
int stages;
|
||||
int drywet;
|
||||
unsigned long skipcount;
|
||||
float old[24];
|
||||
float gain;
|
||||
float fbout;
|
||||
float lfoskip;
|
||||
float phase;
|
||||
};
|
||||
|
||||
struct phaser_filter_data
|
||||
{
|
||||
struct phaser_filter phase_l;
|
||||
struct phaser_filter phase_r;
|
||||
float buf[4096];
|
||||
};
|
||||
|
||||
static void phaser_init(void *data, int samplerate)
|
||||
{
|
||||
int j;
|
||||
struct phaser_filter *phaser = (struct phaser_filter*)data;
|
||||
|
||||
phaser->skipcount = 0;
|
||||
phaser->gain = 0.0;
|
||||
phaser->fbout = 0.0;
|
||||
phaser->lfoskip = phaser->freq * 2 * M_PI / samplerate;
|
||||
phaser->phase = phaser->startphase * M_PI / 180;
|
||||
for (j = 0; j < phaser->stages; j++)
|
||||
phaser->old[j] = 0;
|
||||
}
|
||||
|
||||
static float phaser_process(void *data, float in)
|
||||
{
|
||||
float m, tmp, out;
|
||||
int j;
|
||||
struct phaser_filter *phaser = (struct phaser_filter*)data;
|
||||
|
||||
m = in + phaser->fbout * phaser->fb / 100;
|
||||
|
||||
if (((phaser->skipcount++) % PHASER_LFOSKIPSAMPLES) == 0)
|
||||
{
|
||||
phaser->gain = (1 + cos(phaser->skipcount * phaser->lfoskip + phaser->phase)) / 2;
|
||||
phaser->gain =(exp(phaser->gain * PHASERLFOSHAPE) - 1) / (exp(PHASERLFOSHAPE)-1);
|
||||
phaser->gain = 1 - phaser->gain / 255 * phaser->depth;
|
||||
}
|
||||
for (j = 0; j < phaser->stages; j++)
|
||||
{
|
||||
tmp = phaser->old[j];
|
||||
phaser->old[j] = phaser->gain * tmp + m;
|
||||
m = tmp - phaser->gain * phaser->old[j];
|
||||
}
|
||||
phaser->fbout = m;
|
||||
out = (m * phaser->drywet + in * (255 - phaser->drywet)) / 255;
|
||||
if (out < -1.0) out = -1.0;
|
||||
if (out > 1.0) out = 1.0;
|
||||
return out;
|
||||
}
|
||||
|
||||
static void * phaser_dsp_init(const rarch_dsp_info_t *info)
|
||||
{
|
||||
float freq, startphase, fb;
|
||||
int depth, stages, drywet;
|
||||
struct phaser_filter_data *phaser;
|
||||
|
||||
freq = 0.4;
|
||||
startphase = 0;
|
||||
fb = 0;
|
||||
depth = 100;
|
||||
stages = 2;
|
||||
drywet = 128;
|
||||
|
||||
phaser = (struct phaser_filter_data*)calloc(1, sizeof(*phaser));
|
||||
|
||||
if (!phaser)
|
||||
return NULL;
|
||||
|
||||
phaser->phase_l.freq = freq;
|
||||
phaser->phase_l.startphase = startphase;
|
||||
phaser->phase_l.fb = fb;
|
||||
phaser->phase_l.depth = depth;
|
||||
phaser->phase_l.stages = stages;
|
||||
phaser->phase_l.drywet = drywet;
|
||||
phaser_init(&phaser->phase_l, info->input_rate);
|
||||
|
||||
phaser->phase_r.freq = freq;
|
||||
phaser->phase_r.startphase = startphase;
|
||||
phaser->phase_r.fb = fb;
|
||||
phaser->phase_r.depth = depth;
|
||||
phaser->phase_r.stages = stages;
|
||||
phaser->phase_r.drywet = drywet;
|
||||
phaser_init(&phaser->phase_r, info->input_rate);
|
||||
|
||||
return phaser;
|
||||
}
|
||||
|
||||
static void phaser_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input)
|
||||
{
|
||||
int i, num_samples;
|
||||
struct phaser_filter_data *phaser = (struct phaser_filter_data*)data;
|
||||
|
||||
output->samples = phaser->buf;
|
||||
num_samples = input->frames * 2;
|
||||
for (i = 0; i<num_samples;)
|
||||
{
|
||||
phaser->buf[i] = phaser_process(&phaser->phase_l, input->samples[i]);
|
||||
i++;
|
||||
phaser->buf[i] = phaser_process(&phaser->phase_r, input->samples[i]);
|
||||
i++;
|
||||
}
|
||||
output->frames = input->frames;
|
||||
}
|
||||
|
||||
static void phaser_dsp_free(void *data)
|
||||
{
|
||||
struct phaser_filter_data *phaser = (struct phaser_filter_data*)data;
|
||||
|
||||
if (phaser)
|
||||
{
|
||||
int j;
|
||||
for (j = 0; j < phaser->phase_l.stages; j++)
|
||||
phaser->phase_l.old[j] = 0;
|
||||
for (j = 0; j < phaser->phase_r.stages; j++)
|
||||
phaser->phase_r.old[j] = 0;
|
||||
free(phaser);
|
||||
}
|
||||
}
|
||||
|
||||
static void phaser_dsp_config(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
const struct dspfilter_implementation generic_phaser_dsp = {
|
||||
phaser_dsp_init,
|
||||
phaser_dsp_process,
|
||||
phaser_dsp_free,
|
||||
RARCH_DSP_API_VERSION,
|
||||
phaser_dsp_config,
|
||||
"Phaser",
|
||||
NULL
|
||||
};
|
||||
|
||||
const struct dspfilter_implementation *rarch_dsp_plugin_init(dspfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &generic_phaser_dsp;
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#undef rarch_dsp_plugin_init
|
||||
#endif
|
126
audio/filters/rarch_dsp.h
Normal file
126
audio/filters/rarch_dsp.h
Normal file
@ -0,0 +1,126 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DSPFILTER_API_H__
|
||||
#define DSPFILTER_API_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DSPFILTER_SIMD_SSE (1 << 0)
|
||||
#define DSPFILTER_SIMD_SSE2 (1 << 1)
|
||||
#define DSPFILTER_SIMD_VMX (1 << 2)
|
||||
#define DSPFILTER_SIMD_VMX128 (1 << 3)
|
||||
#define DSPFILTER_SIMD_AVX (1 << 4)
|
||||
#define DSPFILTER_SIMD_NEON (1 << 5)
|
||||
#define DSPFILTER_SIMD_SSE3 (1 << 6)
|
||||
#define DSPFILTER_SIMD_SSSE3 (1 << 7)
|
||||
#define DSPFILTER_SIMD_MMX (1 << 8)
|
||||
#define DSPFILTER_SIMD_MMXEXT (1 << 9)
|
||||
#define DSPFILTER_SIMD_SSE4 (1 << 10)
|
||||
#define DSPFILTER_SIMD_SSE42 (1 << 11)
|
||||
#define DSPFILTER_SIMD_AVX2 (1 << 12)
|
||||
#define DSPFILTER_SIMD_VFPU (1 << 13)
|
||||
#define DSPFILTER_SIMD_PS (1 << 14)
|
||||
|
||||
// A bit-mask of all supported SIMD instruction sets.
|
||||
// Allows an implementation to pick different dspfilter_implementation structs.
|
||||
typedef unsigned dspfilter_simd_mask_t;
|
||||
|
||||
// Dynamic library endpoint.
|
||||
typedef const struct dspfilter_implementation *(*dspfilter_get_implementation_t)(dspfilter_simd_mask_t);
|
||||
// The same SIMD mask argument is forwarded to create() callback as well to avoid having to keep lots of state around.
|
||||
const struct dspfilter_implementation *rarch_dsp_plugin_init(dspfilter_simd_mask_t);
|
||||
|
||||
#define RARCH_DSP_API_VERSION 6
|
||||
|
||||
typedef struct rarch_dsp_info
|
||||
{
|
||||
// Input sample rate that the DSP plugin receives.
|
||||
float input_rate;
|
||||
} rarch_dsp_info_t;
|
||||
|
||||
typedef struct rarch_dsp_output
|
||||
{
|
||||
// The DSP plugin has to provide the buffering for the output samples.
|
||||
// This is for performance reasons to avoid redundant copying of data.
|
||||
// The samples are laid out in interleaving order: LRLRLRLR
|
||||
// The range of the samples are [-1.0, 1.0].
|
||||
// This range cannot be exceeded without horrible audio glitches.
|
||||
const float *samples;
|
||||
|
||||
// Frames which the DSP plugin outputted for the current process.
|
||||
// One frame is here defined as a combined sample of
|
||||
// left and right channels.
|
||||
// (I.e. 44.1kHz, 16bit stereo will have
|
||||
// 88.2k samples/sec and 44.1k frames/sec.)
|
||||
unsigned frames;
|
||||
} rarch_dsp_output_t;
|
||||
|
||||
typedef struct rarch_dsp_input
|
||||
{
|
||||
// Input data for the DSP. The samples are interleaved in order: LRLRLRLR
|
||||
const float *samples;
|
||||
|
||||
// Number of frames for input data.
|
||||
// One frame is here defined as a combined sample of
|
||||
// left and right channels.
|
||||
// (I.e. 44.1kHz, 16bit stereo will have
|
||||
// 88.2k samples/sec and 44.1k frames/sec.)
|
||||
unsigned frames;
|
||||
} rarch_dsp_input_t;
|
||||
|
||||
// Creates a handle of the plugin. Returns NULL if failed.
|
||||
typedef void *(*dspfilter_init_t)(const rarch_dsp_info_t *info);
|
||||
|
||||
// Frees the handle.
|
||||
typedef void (*dspfilter_free_t)(void *data);
|
||||
|
||||
// Processes input data.
|
||||
// The plugin is allowed to return variable sizes for output data.
|
||||
typedef void (*dspfilter_process_t)(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input);
|
||||
|
||||
// Signal plugin that it may open a configuring window or
|
||||
// something similar. The behavior of this function
|
||||
// is thus plugin dependent. Implementing this is optional,
|
||||
// and can be set to NULL.
|
||||
typedef void (*dspfilter_config_t)(void *data);
|
||||
|
||||
// Called every frame, allows creating a GUI main loop in the main thread.
|
||||
// GUI events can be processed here in a non-blocking fashion.
|
||||
// Can be set to NULL to ignore it.
|
||||
typedef void (*dspfilter_events_t)(void *data);
|
||||
|
||||
struct dspfilter_implementation
|
||||
{
|
||||
dspfilter_init_t init;
|
||||
dspfilter_process_t process;
|
||||
dspfilter_free_t free;
|
||||
int api_version; // Must be RARCH_DSP_API_VERSION
|
||||
dspfilter_config_t config;
|
||||
const char *ident; // Human readable identifier of implementation.
|
||||
dspfilter_events_t events;
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
397
audio/filters/reverb.c
Normal file
397
audio/filters/reverb.c
Normal file
@ -0,0 +1,397 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - Daniel De Matteis
|
||||
* Copyright (C) 2012-2014 - Brad Miller
|
||||
*
|
||||
* 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 "rarch_dsp.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define NUMCOMBS 8
|
||||
#define NUMALLPASSES 4
|
||||
#define MUTED 0
|
||||
#define FIXEDGAIN 0.015f
|
||||
#define SCALEWET 3
|
||||
#define SCALEDRY 2
|
||||
#define SCALEDAMP 0.4f
|
||||
#define SCALEROOM 0.28f
|
||||
#define OFFSETROOM 0.7f
|
||||
#define INITIALROOM 0.5f
|
||||
#define INITIALDAMP 0.5f
|
||||
#define INITIALWET (1 / SCALEWET)
|
||||
#define INITIALDRY 0
|
||||
#define INITIALWIDTH 1
|
||||
#define INITIALMODE 0
|
||||
#define FREEZEMODE 0.5f
|
||||
|
||||
#define COMBTUNINGL1 1116
|
||||
#define COMBTUNINGL2 1188
|
||||
#define COMBTUNINGL3 1277
|
||||
#define COMBTUNINGL4 1356
|
||||
#define COMBTUNINGL5 1422
|
||||
#define COMBTUNINGL6 1491
|
||||
#define COMBTUNINGL7 1557
|
||||
#define COMBTUNINGL8 1617
|
||||
#define ALLPASSTUNINGL1 556
|
||||
#define ALLPASSTUNINGL2 441
|
||||
#define ALLPASSTUNINGL3 341
|
||||
#define ALLPASSTUNINGL4 225
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#define rarch_dsp_plugin_init reverb_dsp_plugin_init
|
||||
#endif
|
||||
|
||||
struct comb
|
||||
{
|
||||
float feedback;
|
||||
float filterstore;
|
||||
float damp1;
|
||||
float damp2;
|
||||
float *buffer;
|
||||
int bufsize;
|
||||
int bufidx;
|
||||
};
|
||||
|
||||
struct allpass
|
||||
{
|
||||
float feedback;
|
||||
float *buffer;
|
||||
int bufsize;
|
||||
int bufidx;
|
||||
};
|
||||
|
||||
struct revmodel
|
||||
{
|
||||
float gain;
|
||||
float roomsize, roomsize1;
|
||||
float damp, damp1;
|
||||
float wet, wet1, wet2;
|
||||
float dry;
|
||||
float width;
|
||||
float mode;
|
||||
|
||||
struct comb combL[NUMCOMBS];
|
||||
|
||||
struct allpass allpassL[NUMALLPASSES];
|
||||
|
||||
float bufcombL1[COMBTUNINGL1];
|
||||
float bufcombL2[COMBTUNINGL2];
|
||||
float bufcombL3[COMBTUNINGL3];
|
||||
float bufcombL4[COMBTUNINGL4];
|
||||
float bufcombL5[COMBTUNINGL5];
|
||||
float bufcombL6[COMBTUNINGL6];
|
||||
float bufcombL7[COMBTUNINGL7];
|
||||
float bufcombL8[COMBTUNINGL8];
|
||||
|
||||
float bufallpassL1[ALLPASSTUNINGL1];
|
||||
float bufallpassL2[ALLPASSTUNINGL2];
|
||||
float bufallpassL3[ALLPASSTUNINGL3];
|
||||
float bufallpassL4[ALLPASSTUNINGL4];
|
||||
};
|
||||
|
||||
// FIXME: Fix this really ugly hack
|
||||
static inline float undenormalise(void *sample)
|
||||
{
|
||||
if (((*(unsigned int*)sample) & 0x7f800000) == 0)
|
||||
return 0.0f;
|
||||
return *(float*)sample;
|
||||
}
|
||||
|
||||
static inline float comb_process(void *data, float input)
|
||||
{
|
||||
struct comb *comb = (struct comb*)data;
|
||||
float output;
|
||||
|
||||
output = comb->buffer[comb->bufidx];
|
||||
undenormalise(&output);
|
||||
|
||||
comb->filterstore = (output * comb->damp2) + (comb->filterstore * comb->damp1);
|
||||
undenormalise(&comb->filterstore);
|
||||
|
||||
comb->buffer[comb->bufidx] = input + (comb->filterstore * comb->feedback);
|
||||
|
||||
if (++comb->bufidx >= comb->bufsize)
|
||||
comb->bufidx = 0;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
static inline float allpass_process(void *data, float input)
|
||||
{
|
||||
struct allpass *allpass = (struct allpass*)data;
|
||||
float output, bufout;
|
||||
|
||||
bufout = allpass->buffer[allpass->bufidx];
|
||||
undenormalise(&bufout);
|
||||
|
||||
output = -input + bufout;
|
||||
allpass->buffer[allpass->bufidx] = input + (bufout * allpass->feedback);
|
||||
|
||||
if (++allpass->bufidx >= allpass->bufsize)
|
||||
allpass->bufidx = 0;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
static float revmodel_getmode(float mode)
|
||||
{
|
||||
if (mode >= FREEZEMODE)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void revmodel_update(void *data)
|
||||
{
|
||||
int i;
|
||||
struct revmodel *rev = (struct revmodel*)data;
|
||||
|
||||
rev->wet1 = rev->wet * (rev->width / 2 + 0.5f);
|
||||
|
||||
if (rev->mode >= FREEZEMODE)
|
||||
{
|
||||
rev->roomsize1 = 1;
|
||||
rev->damp1 = 0;
|
||||
rev->gain = MUTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
rev->roomsize1 = rev->roomsize;
|
||||
rev->damp1 = rev->damp;
|
||||
rev->gain = FIXEDGAIN;
|
||||
}
|
||||
|
||||
for (i = 0; i < NUMCOMBS; i++)
|
||||
rev->combL[i].feedback = rev->roomsize1;
|
||||
|
||||
for (i = 0; i < NUMCOMBS; i++)
|
||||
{
|
||||
rev->combL[i].damp1 = rev->damp1;
|
||||
rev->combL[i].damp2 = 1 - rev->damp1;
|
||||
}
|
||||
}
|
||||
|
||||
static void revmodel_set(void *data, float drytime,
|
||||
float wettime, float damping, float roomwidth, float roomsize)
|
||||
{
|
||||
int i, j;
|
||||
struct revmodel *rev = (struct revmodel*)data;
|
||||
|
||||
rev->wet = wettime;
|
||||
revmodel_update(rev);
|
||||
|
||||
rev->roomsize = roomsize;
|
||||
revmodel_update(rev);
|
||||
|
||||
rev->dry = drytime;
|
||||
|
||||
rev->damp = damping;
|
||||
revmodel_update(rev);
|
||||
|
||||
rev->width = roomwidth;
|
||||
revmodel_update(rev);
|
||||
|
||||
rev->mode = INITIALMODE;
|
||||
revmodel_update(rev);
|
||||
|
||||
if (revmodel_getmode(rev->mode) >= FREEZEMODE)
|
||||
return;
|
||||
|
||||
for (i = 0; i < NUMCOMBS; i++)
|
||||
{
|
||||
for (j = 0; j < rev->combL[i].bufsize; j++)
|
||||
rev->combL[i].buffer[j] = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < NUMALLPASSES; i++)
|
||||
{
|
||||
for (j = 0; j < rev->allpassL[i].bufsize; j++)
|
||||
rev->allpassL[i].buffer[j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void revmodel_init(void *data)
|
||||
{
|
||||
struct revmodel *rev = (struct revmodel*)data;
|
||||
|
||||
rev->combL[0].filterstore = 0;
|
||||
rev->combL[0].bufidx = 0;
|
||||
rev->combL[0].buffer = (float*)rev->bufcombL1;
|
||||
rev->combL[0].bufsize = COMBTUNINGL1;
|
||||
rev->combL[1].filterstore = 0;
|
||||
rev->combL[1].bufidx = 0;
|
||||
rev->combL[1].buffer = (float*)rev->bufcombL2;
|
||||
rev->combL[1].bufsize = COMBTUNINGL2;
|
||||
rev->combL[2].filterstore = 0;
|
||||
rev->combL[2].bufidx = 0;
|
||||
rev->combL[2].buffer = (float*)rev->bufcombL3;
|
||||
rev->combL[2].bufsize = COMBTUNINGL3;
|
||||
rev->combL[3].filterstore = 0;
|
||||
rev->combL[3].bufidx = 0;
|
||||
rev->combL[3].buffer = (float*)rev->bufcombL4;
|
||||
rev->combL[3].bufsize = COMBTUNINGL4;
|
||||
rev->combL[4].filterstore = 0;
|
||||
rev->combL[4].bufidx = 0;
|
||||
rev->combL[4].buffer = (float*)rev->bufcombL5;
|
||||
rev->combL[4].bufsize = COMBTUNINGL5;
|
||||
rev->combL[5].filterstore = 0;
|
||||
rev->combL[5].bufidx = 0;
|
||||
rev->combL[5].buffer = (float*)rev->bufcombL6;
|
||||
rev->combL[5].bufsize = COMBTUNINGL6;
|
||||
rev->combL[6].filterstore = 0;
|
||||
rev->combL[6].bufidx = 0;
|
||||
rev->combL[6].buffer = (float*)rev->bufcombL7;
|
||||
rev->combL[6].bufsize = COMBTUNINGL7;
|
||||
rev->combL[7].filterstore = 0;
|
||||
rev->combL[7].bufidx = 0;
|
||||
rev->combL[7].buffer = (float*)rev->bufcombL8;
|
||||
rev->combL[7].bufsize = COMBTUNINGL8;
|
||||
|
||||
rev->allpassL[0].bufidx = 0;
|
||||
rev->allpassL[0].buffer = (float*)rev->bufallpassL1;
|
||||
rev->allpassL[0].bufsize = ALLPASSTUNINGL1;
|
||||
rev->allpassL[0].feedback = 0.5f;
|
||||
rev->allpassL[1].bufidx = 0;
|
||||
rev->allpassL[1].buffer = (float*)rev->bufallpassL2;
|
||||
rev->allpassL[1].bufsize = ALLPASSTUNINGL2;
|
||||
rev->allpassL[1].feedback = 0.5f;
|
||||
rev->allpassL[2].bufidx = 0;
|
||||
rev->allpassL[2].buffer = (float*)rev->bufallpassL3;
|
||||
rev->allpassL[2].bufsize = ALLPASSTUNINGL3;
|
||||
rev->allpassL[2].feedback = 0.5f;
|
||||
rev->allpassL[3].bufidx = 0;
|
||||
rev->allpassL[3].buffer = (float*)rev->bufallpassL4;
|
||||
rev->allpassL[3].bufsize = ALLPASSTUNINGL4;
|
||||
rev->allpassL[3].feedback = 0.5f;
|
||||
|
||||
}
|
||||
|
||||
static float revmodel_process(void *data, float in)
|
||||
{
|
||||
float samp, mono_out, mono_in, input;
|
||||
int i;
|
||||
struct revmodel *rev = (struct revmodel*)data;
|
||||
|
||||
samp = in;
|
||||
mono_out = 0.0f;
|
||||
mono_in = samp;
|
||||
input = (mono_in) * rev->gain;
|
||||
|
||||
for(i=0; i < NUMCOMBS; i++)
|
||||
mono_out += comb_process(&rev->combL[i], input);
|
||||
for(i = 0; i < NUMALLPASSES; i++)
|
||||
mono_out = allpass_process(&rev->allpassL[i], mono_out);
|
||||
samp = mono_in * rev->dry + mono_out * rev->wet1;
|
||||
return samp;
|
||||
}
|
||||
|
||||
|
||||
#define REVMODEL_GETWET(revmodel) (revmodel->wet / SCALEWET)
|
||||
#define REVMODEL_GETROOMSIZE(revmodel) ((revmodel->roomsize - OFFSETROOM) / SCALEROOM)
|
||||
#define REVMODEL_GETDRY(revmodel) (revmodel->dry / SCALEDRY)
|
||||
#define REVMODEL_GETWIDTH(revmodel) (revmodel->width)
|
||||
|
||||
|
||||
|
||||
struct reverb_filter_data
|
||||
{
|
||||
struct revmodel rev_l;
|
||||
struct revmodel rev_r;
|
||||
float buf[4096];
|
||||
};
|
||||
|
||||
|
||||
static void * reverb_dsp_init(const rarch_dsp_info_t *info)
|
||||
{
|
||||
float drytime, wettime, damping, roomwidth, roomsize;
|
||||
(void)info;
|
||||
|
||||
drytime = 0.43;
|
||||
wettime = 0.57;
|
||||
damping = 0.45;
|
||||
roomwidth = 0.56;
|
||||
roomsize = 0.56;
|
||||
|
||||
struct reverb_filter_data *reverb = (struct reverb_filter_data*)calloc(1, sizeof(*reverb));
|
||||
|
||||
if (!reverb)
|
||||
return NULL;
|
||||
|
||||
revmodel_init(&reverb->rev_l);
|
||||
revmodel_set(&reverb->rev_l, INITIALDRY,
|
||||
INITIALWET * SCALEWET, INITIALDAMP * SCALEDAMP, INITIALWIDTH, (INITIALROOM * SCALEROOM) + OFFSETROOM);
|
||||
revmodel_set(&reverb->rev_l, drytime, wettime, damping, roomwidth, roomsize);
|
||||
|
||||
revmodel_init(&reverb->rev_r);
|
||||
revmodel_set(&reverb->rev_r, INITIALDRY,
|
||||
INITIALWET * SCALEWET, INITIALDAMP * SCALEDAMP, INITIALWIDTH, (INITIALROOM * SCALEROOM) + OFFSETROOM);
|
||||
revmodel_set(&reverb->rev_r, drytime, wettime, damping, roomwidth, roomsize);
|
||||
|
||||
return reverb;
|
||||
}
|
||||
|
||||
static void reverb_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input)
|
||||
{
|
||||
int i, num_samples;
|
||||
struct reverb_filter_data *reverb = (struct reverb_filter_data*)data;
|
||||
|
||||
output->samples = reverb->buf;
|
||||
num_samples = input->frames * 2;
|
||||
for (i = 0; i < num_samples;)
|
||||
{
|
||||
reverb->buf[i] = revmodel_process(&reverb->rev_l, input->samples[i]);
|
||||
i++;
|
||||
reverb->buf[i] = revmodel_process(&reverb->rev_r, input->samples[i]);
|
||||
i++;
|
||||
}
|
||||
output->frames = input->frames;
|
||||
}
|
||||
|
||||
static void reverb_dsp_free(void *data)
|
||||
{
|
||||
struct reverb_filter_data *rev = (struct reverb_filter_data*)data;
|
||||
|
||||
if (rev)
|
||||
free(rev);
|
||||
}
|
||||
|
||||
static void reverb_dsp_config(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
const struct dspfilter_implementation generic_reverb_dsp = {
|
||||
reverb_dsp_init,
|
||||
reverb_dsp_process,
|
||||
reverb_dsp_free,
|
||||
RARCH_DSP_API_VERSION,
|
||||
reverb_dsp_config,
|
||||
"Reverberatation",
|
||||
NULL
|
||||
};
|
||||
|
||||
const struct dspfilter_implementation *rarch_dsp_plugin_init(dspfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &generic_reverb_dsp;
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#undef rarch_dsp_plugin_init
|
||||
#endif
|
131
audio/filters/volume.c
Normal file
131
audio/filters/volume.c
Normal file
@ -0,0 +1,131 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "rarch_dsp.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#define rarch_dsp_plugin_init volume_dsp_plugin_init
|
||||
#endif
|
||||
|
||||
struct volume_filter_data
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
float buf[4096] __attribute__((aligned(16)));
|
||||
#else
|
||||
float buf[4096];
|
||||
#endif
|
||||
float m_vol;
|
||||
float m_pan_vol_l;
|
||||
float m_pan_vol_r;
|
||||
};
|
||||
|
||||
#if 0
|
||||
static void pan2gain(float &left, float &right, int val)
|
||||
{
|
||||
left = (100 - val) / 100.0f;
|
||||
right = (val + 100) / 100.0f;
|
||||
if (left > 1.0)
|
||||
left = 1.0;
|
||||
if (right > 1.0)
|
||||
right = 1.0;
|
||||
}
|
||||
|
||||
static float db2gain(float val)
|
||||
{
|
||||
return powf(10.0, val / 20.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void volume_process(void *data, const float *in, unsigned frames)
|
||||
{
|
||||
float vol_left, vol_right;
|
||||
unsigned i;
|
||||
struct volume_filter_data *vol = (struct volume_filter_data*)data;
|
||||
|
||||
if (!vol)
|
||||
return;
|
||||
|
||||
vol_left = vol->m_vol * vol->m_pan_vol_l;
|
||||
vol_right = vol->m_vol * vol->m_pan_vol_r;
|
||||
|
||||
for (i = 0; i < frames; i++)
|
||||
{
|
||||
vol->buf[(i << 1) + 0] = in[(i << 1) + 0] * vol_left;
|
||||
vol->buf[(i << 1) + 1] = in[(i << 1) + 1] * vol_right;
|
||||
}
|
||||
}
|
||||
|
||||
static void *volume_dsp_init(const rarch_dsp_info_t *info)
|
||||
{
|
||||
struct volume_filter_data *vol = (struct volume_filter_data*)calloc(1, sizeof(*vol));
|
||||
(void)info;
|
||||
|
||||
if (!vol)
|
||||
return NULL;
|
||||
|
||||
vol->m_vol = 1.0;
|
||||
vol->m_pan_vol_l = 1.0;
|
||||
vol->m_pan_vol_r = 1.0;
|
||||
|
||||
return vol;
|
||||
}
|
||||
|
||||
static void volume_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input)
|
||||
{
|
||||
struct volume_filter_data *vol = (struct volume_filter_data*)data;
|
||||
|
||||
output->samples = vol->buf;
|
||||
volume_process(vol, input->samples, input->frames);
|
||||
output->frames = input->frames;
|
||||
}
|
||||
|
||||
static void volume_dsp_free(void *data)
|
||||
{
|
||||
struct volume_filter_data *vol = (struct volume_filter_data*)data;
|
||||
|
||||
if (vol)
|
||||
free(vol);
|
||||
}
|
||||
|
||||
static void volume_dsp_config(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
const struct dspfilter_implementation generic_volume_dsp = {
|
||||
volume_dsp_init,
|
||||
volume_dsp_process,
|
||||
volume_dsp_free,
|
||||
RARCH_DSP_API_VERSION,
|
||||
volume_dsp_config,
|
||||
"Volume",
|
||||
NULL
|
||||
};
|
||||
|
||||
const struct dspfilter_implementation *rarch_dsp_plugin_init(dspfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &generic_volume_dsp;
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#undef rarch_dsp_plugin_init
|
||||
#endif
|
186
audio/filters/wah.c
Normal file
186
audio/filters/wah.c
Normal file
@ -0,0 +1,186 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - Daniel De Matteis
|
||||
* Copyright (C) 2012-2014 - Brad Miller
|
||||
*
|
||||
* 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 "rarch_dsp.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.1415926535897932384626433832795
|
||||
#endif
|
||||
|
||||
#ifndef LFOSKIPSAMPLES
|
||||
#define LFOSKIPSAMPLES 30
|
||||
#endif
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#define rarch_dsp_plugin_init wah_dsp_plugin_init
|
||||
#endif
|
||||
|
||||
struct wahwah_filter
|
||||
{
|
||||
float phase;
|
||||
float lfoskip;
|
||||
unsigned long skipcount;
|
||||
float xn1, xn2, yn1, yn2;
|
||||
float b0, b1, b2, a0, a1, a2;
|
||||
float freq, startphase;
|
||||
float depth, freqofs, res;
|
||||
};
|
||||
|
||||
struct wahwah_filter_data
|
||||
{
|
||||
struct wahwah_filter wah_l;
|
||||
struct wahwah_filter wah_r;
|
||||
float buf[4096];
|
||||
};
|
||||
|
||||
static void wahwah_init(void *data, int samplerate)
|
||||
{
|
||||
struct wahwah_filter *wah = (struct wahwah_filter*)data;
|
||||
|
||||
wah->lfoskip = wah->freq * 2 * M_PI / samplerate;
|
||||
wah->skipcount = 0;
|
||||
wah->xn1 = 0;
|
||||
wah->xn2 = 0;
|
||||
wah->yn1 = 0;
|
||||
wah->yn2 = 0;
|
||||
wah->b0 = 0;
|
||||
wah->b1 = 0;
|
||||
wah->b2 = 0;
|
||||
wah->a0 = 0;
|
||||
wah->a1 = 0;
|
||||
wah->a2 = 0;
|
||||
wah->phase = wah->startphase * M_PI / 180;
|
||||
}
|
||||
|
||||
static float wahwah_process(void *data, float samp)
|
||||
{
|
||||
float frequency, omega, sn, cs, alpha;
|
||||
float in, out;
|
||||
struct wahwah_filter *wah = (struct wahwah_filter*)data;
|
||||
|
||||
in = samp;
|
||||
if ((wah->skipcount++) % LFOSKIPSAMPLES == 0)
|
||||
{
|
||||
frequency = (1 + cos(wah->skipcount * wah->lfoskip + wah->phase)) / 2;
|
||||
frequency = frequency * wah->depth * (1 - wah->freqofs) + wah->freqofs;
|
||||
frequency = exp((frequency - 1) * 6);
|
||||
omega = M_PI * frequency;
|
||||
sn = sin(omega);
|
||||
cs = cos(omega);
|
||||
alpha = sn / (2 * wah->res);
|
||||
wah->b0 = (1 - cs) / 2;
|
||||
wah->b1 = 1 - cs;
|
||||
wah->b2 = (1 - cs) / 2;
|
||||
wah->a0 = 1 + alpha;
|
||||
wah->a1 = -2 * cs;
|
||||
wah->a2 = 1 - alpha;
|
||||
}
|
||||
|
||||
out = (wah->b0 * in + wah->b1 * wah->xn1 + wah->b2 * wah->xn2 - wah->a1 * wah->yn1 - wah->a2 * wah->yn2) / wah->a0;
|
||||
wah->xn2 = wah->xn1;
|
||||
wah->xn1 = in;
|
||||
wah->yn2 = wah->yn1;
|
||||
wah->yn1 = out;
|
||||
samp = out;
|
||||
return samp;
|
||||
}
|
||||
|
||||
static void * wah_dsp_init(const rarch_dsp_info_t *info)
|
||||
{
|
||||
float freq = 1.5;
|
||||
float startphase = 0.0;
|
||||
float res = 2.5;
|
||||
float depth = 0.70;
|
||||
float freqofs = 0.30;
|
||||
|
||||
struct wahwah_filter_data *wah = (struct wahwah_filter_data*)calloc(1, sizeof(*wah));
|
||||
|
||||
if (!wah)
|
||||
return NULL;
|
||||
|
||||
wah->wah_l.depth = depth;
|
||||
wah->wah_l.freqofs = freqofs;
|
||||
wah->wah_l.freq = freq;
|
||||
wah->wah_l.startphase = startphase;
|
||||
wah->wah_l.res = res;
|
||||
wahwah_init(&wah->wah_l, info->input_rate);
|
||||
|
||||
wah->wah_r.depth = depth;
|
||||
wah->wah_r.freqofs = freqofs;
|
||||
wah->wah_r.freq = freq;
|
||||
wah->wah_r.startphase = startphase;
|
||||
wah->wah_r.res = res;
|
||||
wahwah_init(&wah->wah_r, info->input_rate);
|
||||
|
||||
return wah;
|
||||
}
|
||||
|
||||
static void wah_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input)
|
||||
{
|
||||
int num_samples, i;
|
||||
struct wahwah_filter_data *wah = (struct wahwah_filter_data*)data;
|
||||
|
||||
output->samples = wah->buf;
|
||||
num_samples = input->frames * 2;
|
||||
|
||||
for (i = 0; i < num_samples;)
|
||||
{
|
||||
wah->buf[i] = wahwah_process(&wah->wah_l, input->samples[i]);
|
||||
i++;
|
||||
wah->buf[i] = wahwah_process(&wah->wah_r, input->samples[i]);
|
||||
i++;
|
||||
}
|
||||
output->frames = input->frames;
|
||||
}
|
||||
|
||||
static void wah_dsp_free(void *data)
|
||||
{
|
||||
struct wahwah_filter_data *wah = (struct wahwah_filter_data*)data;
|
||||
|
||||
if (wah)
|
||||
free(wah);
|
||||
}
|
||||
|
||||
static void wah_dsp_config(void *data)
|
||||
{
|
||||
}
|
||||
|
||||
const struct dspfilter_implementation generic_wah_dsp = {
|
||||
wah_dsp_init,
|
||||
wah_dsp_process,
|
||||
wah_dsp_free,
|
||||
RARCH_DSP_API_VERSION,
|
||||
wah_dsp_config,
|
||||
"Wah",
|
||||
NULL
|
||||
};
|
||||
|
||||
const struct dspfilter_implementation *rarch_dsp_plugin_init(dspfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &generic_wah_dsp;
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#undef rarch_dsp_plugin_init
|
||||
#endif
|
@ -130,7 +130,7 @@ static void *sl_init(const char *device, unsigned rate, unsigned latency)
|
||||
else
|
||||
sl->buf_size = next_pow2(32 * latency);
|
||||
|
||||
sl->buf_count = (latency * 4 * out_rate + 500) / 1000;
|
||||
sl->buf_count = (latency * 4 * rate + 500) / 1000;
|
||||
sl->buf_count = (sl->buf_count + sl->buf_size / 2) / sl->buf_size;
|
||||
|
||||
sl->buffer = (uint8_t**)calloc(sizeof(uint8_t*), sl->buf_count);
|
||||
|
@ -22,12 +22,75 @@
|
||||
|
||||
#include "../general.h"
|
||||
|
||||
static const rarch_resampler_t *backends[] = {
|
||||
&sinc_resampler,
|
||||
#ifdef HAVE_CC_RESAMPLER
|
||||
&CC_resampler,
|
||||
#endif
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int find_resampler_driver_index(const char *driver)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; backends[i]; i++)
|
||||
if (strcasecmp(driver, backends[i]->ident) == 0)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Resampler is used by multiple modules so avoid clobbering g_extern.audio_data.resampler here.
|
||||
static const rarch_resampler_t *find_resampler_driver(const char *ident)
|
||||
{
|
||||
if (!ident)
|
||||
return backends[0];
|
||||
|
||||
int i = find_resampler_driver_index(ident);
|
||||
if (i >= 0)
|
||||
return backends[i];
|
||||
else
|
||||
{
|
||||
unsigned d;
|
||||
RARCH_ERR("Couldn't find any resampler driver named \"%s\"\n", ident);
|
||||
RARCH_LOG_OUTPUT("Available resampler drivers are:\n");
|
||||
for (d = 0; backends[d]; d++)
|
||||
RARCH_LOG_OUTPUT("\t%s\n", backends[d]->ident);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef RESAMPLER_TEST
|
||||
void find_prev_resampler_driver(void)
|
||||
{
|
||||
int i = find_resampler_driver_index(g_settings.audio.resampler);
|
||||
if (i > 0)
|
||||
strlcpy(g_settings.audio.resampler, backends[i - 1]->ident, sizeof(g_settings.audio.resampler));
|
||||
else
|
||||
RARCH_WARN("Couldn't find any previous resampler driver (current one: \"%s\").\n", g_extern.audio_data.resampler->ident);
|
||||
}
|
||||
|
||||
void find_next_resampler_driver(void)
|
||||
{
|
||||
int i = find_resampler_driver_index(g_settings.audio.resampler);
|
||||
if (i >= 0 && backends[i + 1])
|
||||
strlcpy(g_settings.audio.resampler, backends[i + 1]->ident, sizeof(g_settings.audio.resampler));
|
||||
else
|
||||
RARCH_WARN("Couldn't find any next resampler driver (current one: \"%s\").\n", g_extern.audio_data.resampler->ident);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool rarch_resampler_realloc(void **re, const rarch_resampler_t **backend, const char *ident, double bw_ratio)
|
||||
{
|
||||
if (*re && *backend)
|
||||
(*backend)->free(*re);
|
||||
|
||||
*backend = &sinc_resampler;
|
||||
*re = NULL;
|
||||
*backend = NULL;
|
||||
|
||||
*backend = find_resampler_driver(ident);
|
||||
if (!*backend)
|
||||
return false;
|
||||
|
||||
*re = (*backend)->init(bw_ratio);
|
||||
|
||||
if (!*re)
|
||||
|
@ -51,6 +51,7 @@ typedef struct rarch_resampler
|
||||
} rarch_resampler_t;
|
||||
|
||||
extern const rarch_resampler_t sinc_resampler;
|
||||
extern const rarch_resampler_t CC_resampler;
|
||||
|
||||
// Reallocs resampler. Will free previous handle before allocating a new one.
|
||||
// If ident is NULL, first resampler will be used.
|
||||
@ -65,13 +66,9 @@ bool rarch_resampler_realloc(void **re, const rarch_resampler_t **backend, const
|
||||
*handle = NULL; \
|
||||
} while(0)
|
||||
|
||||
#ifdef RARCH_CONSOLE
|
||||
#define rarch_resampler_process(backend, handle, data) resampler_sinc_process(handle, data)
|
||||
#else
|
||||
#define rarch_resampler_process(backend, handle, data) do { \
|
||||
(backend)->process(handle, data); \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -379,7 +379,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(HAVE_NEON)
|
||||
#elif defined(HAVE_NEON) && !defined(__MACH__)
|
||||
|
||||
#if SINC_COEFF_LERP
|
||||
#error "NEON asm does not support SINC lerp."
|
||||
@ -473,7 +473,7 @@ static void *resampler_sinc_new(double bandwidth_mod)
|
||||
}
|
||||
|
||||
// Be SIMD-friendly.
|
||||
#if (defined(__AVX__) && ENABLE_AVX) || defined(HAVE_NEON)
|
||||
#if (defined(__AVX__) && ENABLE_AVX) || defined(HAVE_NEON) && !defined(__MACH__)
|
||||
re->taps = (re->taps + 7) & ~7;
|
||||
#else
|
||||
re->taps = (re->taps + 3) & ~3;
|
||||
@ -499,7 +499,7 @@ static void *resampler_sinc_new(double bandwidth_mod)
|
||||
RARCH_LOG("Sinc resampler [AVX]\n");
|
||||
#elif defined(__SSE__)
|
||||
RARCH_LOG("Sinc resampler [SSE]\n");
|
||||
#elif defined(HAVE_NEON)
|
||||
#elif defined(HAVE_NEON) && !defined(__MACH__)
|
||||
unsigned cpu = rarch_get_cpu_features();
|
||||
process_sinc_func = cpu & RETRO_SIMD_NEON ? process_sinc_neon : process_sinc_C;
|
||||
RARCH_LOG("Sinc resampler [%s]\n", cpu & RETRO_SIMD_NEON ? "NEON" : "C");
|
||||
|
@ -14,7 +14,9 @@
|
||||
*/
|
||||
#if defined(__ARM_NEON__) || defined(HAVE_NEON)
|
||||
|
||||
#ifndef __MACH__
|
||||
.arm
|
||||
#endif
|
||||
.align 4
|
||||
.globl process_sinc_neon_asm
|
||||
.globl _process_sinc_neon_asm
|
||||
|
@ -7,9 +7,11 @@ TESTS := test-sinc-lowest \
|
||||
test-sinc-higher \
|
||||
test-snr-sinc-higher \
|
||||
test-sinc-highest \
|
||||
test-snr-sinc-highest
|
||||
test-snr-sinc-highest \
|
||||
test-cc \
|
||||
test-snr-cc
|
||||
|
||||
CFLAGS += -O3 -ffast-math -g -Wall -pedantic -march=native -std=gnu99 -DRESAMPLER_TEST
|
||||
CFLAGS += -O3 -ffast-math -g -Wall -pedantic -march=native -std=gnu99 -DRESAMPLER_TEST -DRARCH_DUMMY_LOG
|
||||
LDFLAGS += -lm
|
||||
|
||||
all: $(TESTS)
|
||||
@ -17,6 +19,12 @@ all: $(TESTS)
|
||||
resampler-sinc.o: ../resampler.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
resampler-cc.o: ../resampler.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS) -DHAVE_CC_RESAMPLER
|
||||
|
||||
cc-resampler.o: ../cc_resampler.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
sinc-lowest.o: ../sinc.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS) -DSINC_LOWEST_QUALITY
|
||||
|
||||
@ -62,6 +70,12 @@ test-sinc-highest: sinc-highest.o ../utils.o main.o resampler-sinc.o
|
||||
test-snr-sinc-highest: sinc-highest.o ../utils.o snr.o resampler-sinc.o
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-cc: cc-resampler.o ../utils.o main.o resampler-cc.o sinc.o
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-snr-cc: cc-resampler.o ../utils.o snr.o resampler-cc.o sinc.o
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
|
135
audio/utils.c
135
audio/utils.c
@ -1,5 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2014 - Ali Bouhlel ( aliaspider@gmail.com )
|
||||
*
|
||||
* 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-
|
||||
@ -139,7 +140,7 @@ void audio_convert_float_to_s16_altivec(int16_t *out,
|
||||
else
|
||||
audio_convert_float_to_s16_C(out, in, samples);
|
||||
}
|
||||
#elif defined(HAVE_NEON)
|
||||
#elif defined(HAVE_NEON) && !defined(__MACH__)
|
||||
void audio_convert_s16_float_asm(float *out, const int16_t *in, size_t samples, const float *gain); // Avoid potential hard-float/soft-float ABI issues.
|
||||
static void audio_convert_s16_to_float_neon(float *out, const int16_t *in, size_t samples,
|
||||
float gain)
|
||||
@ -163,11 +164,107 @@ static void audio_convert_float_to_s16_neon(int16_t *out, const float *in, size_
|
||||
audio_convert_float_to_s16_C(out + aligned_samples, in + aligned_samples,
|
||||
samples - aligned_samples);
|
||||
}
|
||||
#elif defined(_MIPS_ARCH_ALLEGREX)
|
||||
void audio_convert_s16_to_float_ALLEGREX(float *out,
|
||||
const int16_t *in, size_t samples, float gain)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// 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);
|
||||
#endif
|
||||
|
||||
size_t i;
|
||||
gain = gain / 0x8000;
|
||||
__asm__ (
|
||||
".set push \n"
|
||||
".set noreorder \n"
|
||||
"mtv %0, s200 \n"
|
||||
".set pop \n"
|
||||
::"r"(gain));
|
||||
|
||||
for (i = 0; i + 16 <= samples; i += 16)
|
||||
{
|
||||
__asm__ (
|
||||
".set push \n"
|
||||
".set noreorder \n"
|
||||
|
||||
"lv.s s100, 0(%0) \n"
|
||||
"lv.s s101, 4(%0) \n"
|
||||
"lv.s s110, 8(%0) \n"
|
||||
"lv.s s111, 12(%0) \n"
|
||||
"lv.s s120, 16(%0) \n"
|
||||
"lv.s s121, 20(%0) \n"
|
||||
"lv.s s130, 24(%0) \n"
|
||||
"lv.s s131, 28(%0) \n"
|
||||
|
||||
"vs2i.p c100, c100 \n"
|
||||
"vs2i.p c110, c110 \n"
|
||||
"vs2i.p c120, c120 \n"
|
||||
"vs2i.p c130, c130 \n"
|
||||
|
||||
"vi2f.q c100, c100, 16 \n"
|
||||
"vi2f.q c110, c110, 16 \n"
|
||||
"vi2f.q c120, c120, 16 \n"
|
||||
"vi2f.q c130, c130, 16 \n"
|
||||
|
||||
"vmscl.q e100, e100, s200 \n"
|
||||
|
||||
"sv.q c100, 0(%1) \n"
|
||||
"sv.q c110, 16(%1) \n"
|
||||
"sv.q c120, 32(%1) \n"
|
||||
"sv.q c130, 48(%1) \n"
|
||||
|
||||
".set pop \n"
|
||||
:: "r"(in + i), "r"(out + i));
|
||||
}
|
||||
|
||||
for (; i < samples; i++)
|
||||
out[i] = (float)in[i] * gain;
|
||||
}
|
||||
|
||||
void audio_convert_float_to_s16_ALLEGREX(int16_t *out,
|
||||
const float *in, size_t samples)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// 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);
|
||||
#endif
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i + 8 <= samples; i += 8)
|
||||
{
|
||||
__asm__ (
|
||||
".set push \n"
|
||||
".set noreorder \n"
|
||||
|
||||
"lv.q c100, 0(%0) \n"
|
||||
"lv.q c110, 16(%0) \n"
|
||||
|
||||
"vf2in.q c100, c100, 31 \n"
|
||||
"vf2in.q c110, c110, 31 \n"
|
||||
"vi2s.q c100, c100 \n"
|
||||
"vi2s.q c102, c110 \n"
|
||||
|
||||
"sv.q c100, 0(%1) \n"
|
||||
|
||||
".set pop \n"
|
||||
:: "r"(in + i), "r"(out + i));
|
||||
}
|
||||
|
||||
for (; i < samples; i++)
|
||||
{
|
||||
int32_t val = (int32_t)(in[i] * 0x8000);
|
||||
out[i] = (val > 0x7FFF) ? 0x7FFF : (val < -0x8000 ? -0x8000 : (int16_t)val);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void audio_convert_init_simd(void)
|
||||
{
|
||||
#ifdef HAVE_NEON
|
||||
#if defined HAVE_NEON && !defined(__MACH__)
|
||||
unsigned cpu = rarch_get_cpu_features();
|
||||
audio_convert_s16_to_float_arm = cpu & RETRO_SIMD_NEON ?
|
||||
audio_convert_s16_to_float_neon : audio_convert_s16_to_float_C;
|
||||
@ -176,37 +273,3 @@ void audio_convert_init_simd(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_RSOUND
|
||||
|
||||
bool rarch_rsound_start(const char *ip)
|
||||
{
|
||||
strlcpy(g_settings.audio.driver, "rsound", sizeof(g_settings.audio.driver));
|
||||
strlcpy(g_settings.audio.device, ip, sizeof(g_settings.audio.device));
|
||||
driver.audio_data = NULL;
|
||||
|
||||
// If driver already has started, it must be reinited.
|
||||
if (driver.audio_data)
|
||||
{
|
||||
uninit_audio();
|
||||
driver.audio_data = NULL;
|
||||
init_drivers_pre();
|
||||
init_audio();
|
||||
}
|
||||
return g_extern.audio_active;
|
||||
}
|
||||
|
||||
void rarch_rsound_stop(void)
|
||||
{
|
||||
strlcpy(g_settings.audio.driver, config_get_default_audio(), sizeof(g_settings.audio.driver));
|
||||
|
||||
// If driver already has started, it must be reinited.
|
||||
if (driver.audio_data)
|
||||
{
|
||||
uninit_audio();
|
||||
driver.audio_data = NULL;
|
||||
init_drivers_pre();
|
||||
init_audio();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -51,7 +51,14 @@ void (*audio_convert_s16_to_float_arm)(float *out,
|
||||
const int16_t *in, size_t samples, float gain);
|
||||
void (*audio_convert_float_to_s16_arm)(int16_t *out,
|
||||
const float *in, size_t samples);
|
||||
#elif defined(_MIPS_ARCH_ALLEGREX)
|
||||
#define audio_convert_s16_to_float audio_convert_s16_to_float_ALLEGREX
|
||||
#define audio_convert_float_to_s16 audio_convert_float_to_s16_ALLEGREX
|
||||
|
||||
void audio_convert_s16_to_float_ALLEGREX(float *out,
|
||||
const int16_t *in, size_t samples, float gain);
|
||||
void audio_convert_float_to_s16_ALLEGREX(int16_t *out,
|
||||
const float *in, size_t samples);
|
||||
#else
|
||||
#define audio_convert_s16_to_float audio_convert_s16_to_float_C
|
||||
#define audio_convert_float_to_s16 audio_convert_float_to_s16_C
|
||||
@ -64,10 +71,5 @@ void audio_convert_float_to_s16_C(int16_t *out,
|
||||
|
||||
void audio_convert_init_simd(void);
|
||||
|
||||
#ifdef HAVE_RSOUND
|
||||
bool rarch_rsound_start(const char *ip);
|
||||
void rarch_rsound_stop(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -14,7 +14,9 @@
|
||||
*/
|
||||
#if defined(__ARM_NEON__) || defined(HAVE_NEON)
|
||||
|
||||
#ifndef __MACH__
|
||||
.arm
|
||||
#endif
|
||||
|
||||
.align 4
|
||||
.globl audio_convert_s16_float_asm
|
||||
|
@ -122,6 +122,9 @@ void autosave_unlock(autosave_t *handle)
|
||||
|
||||
void autosave_free(autosave_t *handle)
|
||||
{
|
||||
if (!handle)
|
||||
return;
|
||||
|
||||
slock_lock(handle->cond_lock);
|
||||
handle->quit = true;
|
||||
slock_unlock(handle->cond_lock);
|
||||
@ -139,7 +142,7 @@ void autosave_free(autosave_t *handle)
|
||||
void lock_autosave(void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < ARRAY_SIZE(g_extern.autosave); i++)
|
||||
for (i = 0; i < g_extern.num_autosave; i++)
|
||||
{
|
||||
if (g_extern.autosave[i])
|
||||
autosave_lock(g_extern.autosave[i]);
|
||||
@ -149,7 +152,7 @@ void lock_autosave(void)
|
||||
void unlock_autosave(void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < ARRAY_SIZE(g_extern.autosave); i++)
|
||||
for (i = 0; i < g_extern.num_autosave; i++)
|
||||
{
|
||||
if (g_extern.autosave[i])
|
||||
autosave_unlock(g_extern.autosave[i]);
|
||||
|
@ -7,7 +7,7 @@ LIBS += -lbbcascadespickers -lbbdata -lbbdevice
|
||||
|
||||
DEFINES += HAVE_RGUI HAVE_MENU HAVE_NEON RARCH_MOBILE \
|
||||
SINC_LOWER_QUALITY \
|
||||
HAVE_VID_CONTEXT HAVE_FBO HAVE_GRIFFIN __LIBRETRO__ \
|
||||
HAVE_FBO HAVE_GRIFFIN __LIBRETRO__ \
|
||||
HAVE_DYNAMIC HAVE_ZLIB __BLACKBERRY_QNX__ HAVE_OPENGLES \
|
||||
HAVE_OPENGLES2 HAVE_NULLINPUT \
|
||||
HAVE_AL HAVE_THREADS WANT_MINIZ HAVE_OVERLAY HAVE_GLSL \
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <screen/screen.h>
|
||||
#include <sys/neutrino.h>
|
||||
#include "ButtonMap.h"
|
||||
#include "../../../core_info.h"
|
||||
#include "../../../frontend/info/core_info.h"
|
||||
|
||||
using namespace bb::cascades;
|
||||
|
||||
|
@ -37,7 +37,6 @@
|
||||
<listOptionValue builtIn="false" value="RARCH_INTERNAL"/>
|
||||
<listOptionValue builtIn="false" value="RARCH_MOBILE"/>
|
||||
<listOptionValue builtIn="false" value="SINC_LOWER_QUALITY"/>
|
||||
<listOptionValue builtIn="false" value="HAVE_VID_CONTEXT"/>
|
||||
<listOptionValue builtIn="false" value="HAVE_FBO"/>
|
||||
<listOptionValue builtIn="false" value="HAVE_GRIFFIN"/>
|
||||
<listOptionValue builtIn="false" value="__LIBRETRO__"/>
|
||||
@ -159,7 +158,6 @@
|
||||
<listOptionValue builtIn="false" value="HAVE_NEON"/>
|
||||
<listOptionValue builtIn="false" value="RARCH_MOBILE"/>
|
||||
<listOptionValue builtIn="false" value="SINC_LOWER_QUALITY"/>
|
||||
<listOptionValue builtIn="false" value="HAVE_VID_CONTEXT"/>
|
||||
<listOptionValue builtIn="false" value="HAVE_FBO"/>
|
||||
<listOptionValue builtIn="false" value="HAVE_GRIFFIN"/>
|
||||
<listOptionValue builtIn="false" value="__LIBRETRO__"/>
|
||||
@ -276,7 +274,6 @@
|
||||
<listOptionValue builtIn="false" value="HAVE_NEON"/>
|
||||
<listOptionValue builtIn="false" value="RARCH_MOBILE"/>
|
||||
<listOptionValue builtIn="false" value="SINC_LOWER_QUALITY"/>
|
||||
<listOptionValue builtIn="false" value="HAVE_VID_CONTEXT"/>
|
||||
<listOptionValue builtIn="false" value="HAVE_FBO"/>
|
||||
<listOptionValue builtIn="false" value="HAVE_GRIFFIN"/>
|
||||
<listOptionValue builtIn="false" value="__LIBRETRO__"/>
|
||||
@ -394,7 +391,6 @@
|
||||
<listOptionValue builtIn="false" value="HAVE_NEON"/>
|
||||
<listOptionValue builtIn="false" value="RARCH_MOBILE"/>
|
||||
<listOptionValue builtIn="false" value="SINC_LOWER_QUALITY"/>
|
||||
<listOptionValue builtIn="false" value="HAVE_VID_CONTEXT"/>
|
||||
<listOptionValue builtIn="false" value="HAVE_FBO"/>
|
||||
<listOptionValue builtIn="false" value="HAVE_GRIFFIN"/>
|
||||
<listOptionValue builtIn="false" value="__LIBRETRO__"/>
|
||||
|
@ -30,6 +30,17 @@
|
||||
#define MAX_TOUCH 4
|
||||
#endif
|
||||
|
||||
enum input_devices
|
||||
{
|
||||
DEVICE_NONE,
|
||||
DEVICE_WIIMOTE,
|
||||
DEVICE_KEYBOARD,
|
||||
DEVICE_IPEGA,
|
||||
DEVICE_KEYPAD,
|
||||
DEVICE_UNKNOWN,
|
||||
DEVICE_LAST
|
||||
};
|
||||
|
||||
struct touches
|
||||
{
|
||||
int16_t x, y;
|
||||
@ -854,6 +865,11 @@ static uint64_t qnx_input_get_capabilities(void *data)
|
||||
return caps;
|
||||
}
|
||||
|
||||
unsigned qnx_input_devices_size(void *data)
|
||||
{
|
||||
return DEVICE_LAST;
|
||||
}
|
||||
|
||||
const input_driver_t input_qnx = {
|
||||
qnx_input_init,
|
||||
qnx_input_poll,
|
||||
@ -864,5 +880,6 @@ const input_driver_t input_qnx = {
|
||||
NULL,
|
||||
NULL,
|
||||
qnx_input_get_capabilities,
|
||||
qnx_input_devices_size,
|
||||
"qnx_input",
|
||||
};
|
||||
|
@ -15,7 +15,7 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <GLES2/gl2.h>
|
||||
#include "../gfx/glsym/glsym.h"
|
||||
#include "../driver.h"
|
||||
#include "../android/native/jni/jni_macros.h"
|
||||
|
||||
|
2
cheats.c
2
cheats.c
@ -169,7 +169,7 @@ static void cheat_manager_load_config(cheat_manager_t *handle, const char *path,
|
||||
return;
|
||||
}
|
||||
|
||||
char *save;
|
||||
char *save = NULL;
|
||||
const char *num = strtok_r(str, ";", &save);
|
||||
while (num)
|
||||
{
|
||||
|
12
command.c
12
command.c
@ -301,7 +301,7 @@ static void parse_sub_msg(rarch_cmd_t *handle, const char *tok)
|
||||
|
||||
static void parse_msg(rarch_cmd_t *handle, char *buf)
|
||||
{
|
||||
char *save;
|
||||
char *save = NULL;
|
||||
const char *tok = strtok_r(buf, "\n", &save);
|
||||
while (tok)
|
||||
{
|
||||
@ -322,7 +322,7 @@ bool rarch_cmd_get(rarch_cmd_t *handle, unsigned id)
|
||||
}
|
||||
|
||||
#ifdef HAVE_NETWORK_CMD
|
||||
static void network_cmd_pre_frame(rarch_cmd_t *handle)
|
||||
static void network_cmd_poll(rarch_cmd_t *handle)
|
||||
{
|
||||
if (handle->net_fd < 0)
|
||||
return;
|
||||
@ -453,7 +453,7 @@ static size_t read_stdin(char *buf, size_t size)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void stdin_cmd_pre_frame(rarch_cmd_t *handle)
|
||||
static void stdin_cmd_poll(rarch_cmd_t *handle)
|
||||
{
|
||||
if (!handle->stdin_enable)
|
||||
return;
|
||||
@ -489,16 +489,16 @@ static void stdin_cmd_pre_frame(rarch_cmd_t *handle)
|
||||
}
|
||||
#endif
|
||||
|
||||
void rarch_cmd_pre_frame(rarch_cmd_t *handle)
|
||||
void rarch_cmd_poll(rarch_cmd_t *handle)
|
||||
{
|
||||
memset(handle->state, 0, sizeof(handle->state));
|
||||
|
||||
#ifdef HAVE_NETWORK_CMD
|
||||
network_cmd_pre_frame(handle);
|
||||
network_cmd_poll(handle);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDIN_CMD
|
||||
stdin_cmd_pre_frame(handle);
|
||||
stdin_cmd_poll(handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ typedef struct rarch_cmd rarch_cmd_t;
|
||||
rarch_cmd_t *rarch_cmd_new(bool stdin_enable, bool network_enable, uint16_t port);
|
||||
void rarch_cmd_free(rarch_cmd_t *handle);
|
||||
|
||||
void rarch_cmd_pre_frame(rarch_cmd_t *handle);
|
||||
void rarch_cmd_poll(rarch_cmd_t *handle);
|
||||
void rarch_cmd_set(rarch_cmd_t *handle, unsigned id);
|
||||
bool rarch_cmd_get(rarch_cmd_t *handle, unsigned id);
|
||||
|
||||
|
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