Merge remote-tracking branch 'refs/remotes/libretro/master'
|
@ -23,7 +23,7 @@ Debug
|
|||
Release
|
||||
ipch
|
||||
*.user
|
||||
/wii/app_booter/app_booter.bin
|
||||
/bootstrap/gx/wii/app_booter/app_booter.bin
|
||||
*.zip
|
||||
RetroArch-w32/
|
||||
RetroArch-w64/
|
||||
|
@ -62,12 +62,12 @@ apple/RetroArch_iOS.xcodeproj/project.xcworkspace/*
|
|||
/obj-w32/
|
||||
|
||||
# Android
|
||||
/android/phoenix/obj/
|
||||
/android/phoenix/assets/
|
||||
/android/phoenix/libs/
|
||||
/android/phoenix/bin/
|
||||
/android/phoenix/gen/
|
||||
/android/phoenix/local.properties
|
||||
/pkg/android/phoenix/obj/
|
||||
/pkg/android/phoenix/assets/
|
||||
/pkg/android/phoenix/libs/
|
||||
/pkg/android/phoenix/bin/
|
||||
/pkg/android/phoenix/gen/
|
||||
/pkg/android/phoenix/local.properties
|
||||
|
||||
# Cloned by libretro-fetch.sh
|
||||
/media/assets/
|
||||
|
@ -76,8 +76,8 @@ apple/RetroArch_iOS.xcodeproj/project.xcworkspace/*
|
|||
/media/shaders_cg/
|
||||
/media/libretrodb/
|
||||
|
||||
apple/iOS/build/
|
||||
apple/iOS/modules/
|
||||
pkg/apple/iOS/build/
|
||||
pkg/apple/iOS/modules/
|
||||
|
||||
obj-unix/
|
||||
.vagrant/
|
||||
|
|
9
Makefile
|
@ -1,6 +1,10 @@
|
|||
HAVE_FILE_LOGGER=1
|
||||
MISSING_DECLS =0
|
||||
|
||||
ifneq ($(C90_BUILD),)
|
||||
C89_BUILD=1
|
||||
endif
|
||||
|
||||
include config.mk
|
||||
|
||||
TARGET = retroarch
|
||||
|
@ -77,9 +81,8 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(C89_BUILD)$(C90_BUILD),)
|
||||
#looks kinda ugly, but it makes both C89_BUILD and C90_BUILD work and refer to the same thing
|
||||
CFLAGS += -std=c89 -ansi -pedantic -Werror=pedantic
|
||||
ifneq ($(C89_BUILD),)
|
||||
CFLAGS += -std=c89 -ansi -pedantic -Werror=pedantic -Wno-long-long
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ ifeq ($(TDM_GCC),)
|
|||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER -Ilogger/netlogger
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
endif
|
||||
|
||||
CFLAGS += -I./libretro-common/include
|
||||
|
@ -131,6 +131,8 @@ OBJ += frontend/frontend.o \
|
|||
libretro-common/file/file_list.o \
|
||||
libretro-common/file/dir_list.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/file/retro_file.o \
|
||||
libretro-common/file/retro_stat.o \
|
||||
libretro-common/string/string_list.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
libretro-common/memmap/memalign.o \
|
||||
|
@ -210,15 +212,10 @@ OBJ += frontend/frontend.o \
|
|||
|
||||
OBJ += gfx/image/image.o
|
||||
|
||||
ifneq ($(C89_BUILD), 1)
|
||||
ifneq ($(C90_BUILD), 1)
|
||||
# stb_image is not a C89/C90-compliant API.
|
||||
ifeq ($(HAVE_IMAGEVIEWER), 1)
|
||||
DEFINES += -DHAVE_IMAGEVIEWER
|
||||
OBJ += cores/image_core.o
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Qt
|
||||
|
||||
|
@ -237,7 +234,8 @@ OBJ += libretro-db/bintree.o \
|
|||
libretro-db/rmsgpack.o \
|
||||
libretro-db/rmsgpack_dom.o \
|
||||
database_info.o \
|
||||
tasks/task_database.o
|
||||
tasks/task_database.o \
|
||||
tasks/task_database_cue.o
|
||||
endif
|
||||
|
||||
# Miscellaneous
|
||||
|
@ -246,16 +244,11 @@ ifeq ($(HAVE_STDIN_CMD), 1)
|
|||
DEFINES += -DHAVE_COMMAND -DHAVE_STDIN_CMD
|
||||
endif
|
||||
|
||||
ifneq ($(C89_BUILD), 1)
|
||||
ifneq ($(C90_BUILD), 1)
|
||||
# Python 3.x bindings are not C89/C90-compliant.
|
||||
ifeq ($(HAVE_PYTHON), 1)
|
||||
DEFINES += $(PYTHON_CFLAGS) -Wno-unused-parameter
|
||||
LIBS += $(PYTHON_LIBS)
|
||||
OBJ += gfx/video_state_python.o
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_EMSCRIPTEN), 1)
|
||||
OBJ += frontend/drivers/platform_emscripten.o \
|
||||
|
@ -315,16 +308,11 @@ ifeq ($(HAVE_JACK),1)
|
|||
DEFINES += $(JACK_CFLAGS)
|
||||
endif
|
||||
|
||||
ifneq ($(C89_BUILD), 1)
|
||||
ifneq ($(C90_BUILD), 1)
|
||||
# PulseAudio is not a C89/C90-compliant API.
|
||||
ifeq ($(HAVE_PULSE), 1)
|
||||
OBJ += audio/drivers/pulse.o
|
||||
LIBS += $(PULSE_LIBS)
|
||||
DEFINES += $(PULSE_CFLAGS)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_OSS_LIB), 1)
|
||||
LIBS += -lossaudio
|
||||
|
@ -474,16 +462,11 @@ endif
|
|||
|
||||
#Input
|
||||
|
||||
ifneq ($(C89_BUILD), 1)
|
||||
ifneq ($(C90_BUILD), 1)
|
||||
# Wayland is not a C89/C90-compliant API.
|
||||
ifeq ($(HAVE_WAYLAND), 1)
|
||||
#OBJ += input/drivers/wayland.o
|
||||
DEFINES += $(WAYLAND_CFLAGS)
|
||||
LIBS += $(WAYLAND_LIBS)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_DINPUT), 1)
|
||||
LIBS += -ldinput8 -ldxguid -lole32
|
||||
|
@ -521,9 +504,6 @@ ifeq ($(HAVE_UDEV), 1)
|
|||
input/drivers_joypad/udev_joypad.o
|
||||
endif
|
||||
|
||||
ifneq ($(C89_BUILD), 1)
|
||||
ifneq ($(C90_BUILD), 1)
|
||||
# libusb is not a C89/C90-compliant API.
|
||||
ifeq ($(HAVE_LIBUSB), 1)
|
||||
DEFINES += -DHAVE_LIBUSB
|
||||
OBJ += input/drivers_hid/libusb_hid.o
|
||||
|
@ -531,8 +511,6 @@ ifeq ($(HAVE_LIBUSB), 1)
|
|||
JOYCONFIG_LIBS += -lusb-1.0
|
||||
HAVE_HID = 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_IOHIDMANAGER), 1)
|
||||
DEFINES += -DHAVE_IOHIDMANAGER
|
||||
|
@ -612,16 +590,11 @@ ifeq ($(HAVE_GL_CONTEXT), 1)
|
|||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(C89_BUILD), 1)
|
||||
ifneq ($(C90_BUILD), 1)
|
||||
# Wayland is not a C89/C90-compliant API.
|
||||
ifeq ($(HAVE_WAYLAND), 1)
|
||||
ifeq ($(HAVE_EGL), 1)
|
||||
OBJ += gfx/drivers_context/wayland_ctx.o
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_GLES), 1)
|
||||
LIBS += $(GLES_LIBS)
|
||||
|
@ -689,7 +662,7 @@ endif
|
|||
|
||||
ifeq ($(HAVE_EXYNOS), 1)
|
||||
OBJ += gfx/drivers/exynos_gfx.o \
|
||||
mem/neon/memcpy-neon.o
|
||||
memory/neon/memcpy-neon.o
|
||||
LIBS += $(DRM_LIBS) $(EXYNOS_LIBS)
|
||||
DEFINES += $(DRM_CFLAGS) $(EXYNOS_CFLAGS)
|
||||
endif
|
||||
|
@ -770,7 +743,6 @@ ifeq ($(HAVE_7ZIP),1)
|
|||
OBJ += $(7ZOBJ)
|
||||
endif
|
||||
|
||||
OBJ += libretro-common/formats/tga/tga_decode.o
|
||||
|
||||
ifeq ($(HAVE_ZLIB), 1)
|
||||
OBJ += libretro-common/file/file_extract.o
|
||||
|
@ -791,11 +763,11 @@ ifdef HAVE_RPNG
|
|||
endif
|
||||
|
||||
ifeq ($(HAVE_RPNG), 1)
|
||||
OBJ += libretro-common/formats/png/rpng_nbio.o \
|
||||
libretro-common/formats/png/rpng_fbio.o \
|
||||
libretro-common/formats/png/rpng_decode.o \
|
||||
OBJ += libretro-common/formats/png/rpng.o \
|
||||
libretro-common/formats/png/rpng_encode.o
|
||||
endif
|
||||
OBJ += libretro-common/formats/bmp/rbmp_encode.o \
|
||||
libretro-common/formats/tga/rtga.o
|
||||
|
||||
ifdef HAVE_COMPRESSION
|
||||
DEFINES += -DHAVE_COMPRESSION
|
||||
|
@ -874,9 +846,6 @@ endif
|
|||
|
||||
# Record
|
||||
|
||||
ifneq ($(C89_BUILD), 1)
|
||||
ifneq ($(C90_BUILD), 1)
|
||||
# ffmpeg and friends are not C89/C90-compliant APIs.
|
||||
ifeq ($(HAVE_FFMPEG), 1)
|
||||
OBJ += record/drivers/record_ffmpeg.o \
|
||||
cores/ffmpeg_core.o
|
||||
|
@ -884,8 +853,6 @@ ifeq ($(HAVE_FFMPEG), 1)
|
|||
DEFINES += $(AVCODEC_CFLAGS) $(AVFORMAT_CFLAGS) $(AVUTIL_CFLAGS) $(SWSCALE_CFLAGS) $(SWRESAMPLE_CFLAGS)
|
||||
DEFINES += -DHAVE_FFMPEG -Iffmpeg
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_COMPRESSION), 1)
|
||||
DEFINES += -DHAVE_COMPRESSION
|
||||
|
|
49
Makefile.ctr
|
@ -1,11 +1,12 @@
|
|||
TARGET := retroarch_3ds
|
||||
LIBRETRO =
|
||||
|
||||
DEBUG = 0
|
||||
GRIFFIN_BUILD = 1
|
||||
DEBUG = 0
|
||||
GRIFFIN_BUILD = 1
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
BUILD_3DSX = 1
|
||||
BUILD_CIA = 1
|
||||
BIG_STACK = 0
|
||||
BUILD_3DSX = 1
|
||||
BUILD_CIA = 1
|
||||
|
||||
APP_TITLE = Retroarch 3DS
|
||||
APP_DESCRIPTION = Retroarch 3DS
|
||||
|
@ -15,6 +16,16 @@ APP_UNIQUE_ID = 0xBAC00
|
|||
APP_ICON = ctr/default.png
|
||||
APP_BANNER = ctr/libretro_banner.png
|
||||
APP_AUDIO = ctr/silent.wav
|
||||
APP_CIA_RSF = ctr/tools/template-cia.rsf
|
||||
APP_3DS_RSF = ctr/tools/template-3ds.rsf
|
||||
|
||||
|
||||
ifeq ($(BIG_STACK),1)
|
||||
CTR_STACK_SIZE = 0x400000
|
||||
else
|
||||
CTR_STACK_SIZE = 0x100000
|
||||
endif
|
||||
CTR_LINEAR_HEAP_SIZE = 0x600000
|
||||
|
||||
include ctr/Makefile.cores
|
||||
|
||||
|
@ -39,11 +50,10 @@ else
|
|||
OBJS += gfx/drivers_context/gfx_null_ctx.o
|
||||
OBJS += gfx/image/image.o
|
||||
OBJS += gfx/video_texture.o
|
||||
OBJS += libretro-common/formats/tga/tga_decode.o
|
||||
OBJS += libretro-common/formats/png/rpng_fbio.o
|
||||
OBJS += libretro-common/formats/png/rpng_nbio.o
|
||||
OBJS += libretro-common/formats/png/rpng_decode.o
|
||||
OBJS += libretro-common/formats/tga/rtga.o
|
||||
OBJS += libretro-common/formats/png/rpng.o
|
||||
OBJS += libretro-common/formats/png/rpng_encode.o
|
||||
OBJS += libretro-common/formats/bmp/rbmp_encode.o
|
||||
OBJS += gfx/drivers/ctr_gfx.o
|
||||
OBJS += gfx/drivers/nullgfx.o
|
||||
OBJS += gfx/font_renderer_driver.o
|
||||
|
@ -117,6 +127,7 @@ else
|
|||
OBJS += file_path_special.o
|
||||
OBJS += libretro-common/file/dir_list.o
|
||||
OBJS += libretro-common/file/retro_dirent.o
|
||||
OBJS += libretro-common/file/retro_file.o
|
||||
OBJS += dir_list_special.o
|
||||
OBJS += libretro-common/string/string_list.o
|
||||
OBJS += libretro-common/string/stdstring.o
|
||||
|
@ -264,6 +275,14 @@ ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
|||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
|
||||
ifneq ($(CTR_STACK_SIZE),)
|
||||
CFLAGS += -DCTR_STACK_SIZE=$(CTR_STACK_SIZE)
|
||||
endif
|
||||
|
||||
ifneq ($(CTR_LINEAR_HEAP_SIZE),)
|
||||
CFLAGS += -DCTR_LINEAR_HEAP_SIZE=$(CTR_LINEAR_HEAP_SIZE)
|
||||
endif
|
||||
|
||||
CFLAGS += -I. -Ideps/zlib -Ideps/7zip -Ilibretro-common/include
|
||||
|
||||
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE -DSINC_LOWEST_QUALITY
|
||||
|
@ -316,13 +335,13 @@ NM := $(PREFIX)nm
|
|||
LD := $(CXX)
|
||||
|
||||
ifneq ($(findstring Linux,$(shell uname -a)),)
|
||||
MAKEROM = ctr/tools/makerom-linux
|
||||
MAKEROM = ctr/tools/makerom-linux
|
||||
BANNERTOOL = ctr/tools/bannertool-linux
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
MAKEROM = ctr/tools/makerom-mac
|
||||
MAKEROM = ctr/tools/makerom-mac
|
||||
BANNERTOOL = ctr/tools/bannertool-mac
|
||||
else
|
||||
MAKEROM = ctr/tools/makerom.exe
|
||||
MAKEROM = ctr/tools/makerom.exe
|
||||
BANNERTOOL = ctr/tools/bannertool.exe
|
||||
endif
|
||||
|
||||
|
@ -369,15 +388,12 @@ $(TARGET).bnr: $(APP_BANNER) $(APP_AUDIO)
|
|||
$(TARGET).icn: $(APP_ICON)
|
||||
$(BANNERTOOL) makesmdh -s "$(APP_TITLE)" -l "$(APP_TITLE)" -p "$(APP_AUTHOR)" -i $(APP_ICON) -o $@
|
||||
|
||||
$(TARGET).rsf: ctr/tools/template-cia.rsf
|
||||
cat ctr/tools/template-cia.rsf | sed 's/{APP_TITLE}/$(APP_TITLE)/' | sed 's/{APP_PRODUCT_CODE}/$(APP_PRODUCT_CODE)/' | sed 's/{APP_UNIQUE_ID}/$(APP_UNIQUE_ID)/' > $@
|
||||
|
||||
$(TARGET)_stripped.elf: $(TARGET).elf
|
||||
cp $(TARGET).elf $@
|
||||
$(STRIP) $@
|
||||
|
||||
$(TARGET).cia: $(TARGET)_stripped.elf $(TARGET).bnr $(TARGET).icn $(TARGET).rsf
|
||||
$(MAKEROM) -f cia -o $@ -rsf $(TARGET).rsf -target t -exefslogo -elf $(TARGET)_stripped.elf -icon $(TARGET).icn -banner $(TARGET).bnr
|
||||
$(TARGET).cia: $(TARGET)_stripped.elf $(TARGET).bnr $(TARGET).icn
|
||||
$(MAKEROM) -f cia -o $@ -rsf $(APP_CIA_RSF) -target t -exefslogo -elf $(TARGET)_stripped.elf -icon $(TARGET).icn -banner $(TARGET).bnr -DAPP_TITLE="$(APP_TITLE)" -DAPP_PRODUCT_CODE="$(APP_PRODUCT_CODE)" -DAPP_UNIQUE_ID=$(APP_UNIQUE_ID)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
|
@ -387,7 +403,6 @@ clean:
|
|||
rm -f $(TARGET).cia
|
||||
rm -f $(TARGET).bnr
|
||||
rm -f $(TARGET).icn
|
||||
rm -f $(TARGET).rsf
|
||||
rm -f *_shader_shbin.h
|
||||
|
||||
.PHONY: clean
|
||||
|
|
|
@ -100,12 +100,12 @@ endif
|
|||
ifeq ($(platform), ngc)
|
||||
LDFLAGS += $(MACHDEP) -Wl,-Map,$(notdir $(EXT_INTER_TARGET)).map
|
||||
ifeq ($(BIG_STACK), 1)
|
||||
LDFLAGS += -T gx/ld/ogc.ld
|
||||
LDFLAGS += -T bootstrap/gx/ogc.ld
|
||||
endif
|
||||
else ifeq ($(platform), wii)
|
||||
LDFLAGS += $(MACHDEP) -Wl,-Map,$(notdir $(EXT_INTER_TARGET)).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,strdup,-wrap,strndup,-wrap,malloc_usable_size
|
||||
ifeq ($(BIG_STACK), 1)
|
||||
LDFLAGS += -T gx/ld/rvl.ld
|
||||
LDFLAGS += -T bootstrap/gx/rvl.ld
|
||||
endif
|
||||
endif
|
||||
LIBS += -lfat -logc
|
||||
|
@ -202,10 +202,10 @@ else ifeq ($(platform), vita)
|
|||
EXT_TARGET := $(TARGET_NAME)_$(platform).velf
|
||||
EXT_INTER_TARGET := $(TARGET_NAME)_$(platform).elf
|
||||
MACHDEP := -DVITA
|
||||
PLATCFLAGS := -O3 -U__ARM_NEON__
|
||||
PLATCFLAGS := -O3 -mfloat-abi=hard -ffast-math -fsingle-precision-constant
|
||||
LIBS += -lSceKernel_stub -lSceDisplay_stub -lSceGxm_stub -lSceNet_stub \
|
||||
-lSceSysmodule_stub -lSceCtrl_stub -lSceAudio_stub \
|
||||
-lScePower_stub -lSceRtc_stub -lz -lm -lc
|
||||
-lSceSysmodule_stub -lSceCtrl_stub -lSceAudio_stub -lUVLoader_stub \
|
||||
-lScePower_stub -lSceRtc_stub -lSceCommonDialog_stub -lz -lm -lc
|
||||
|
||||
PLATOBJS += audio/audio_utils_neon.o audio/drivers_resampler/sinc_neon.o \
|
||||
audio/drivers_resampler/cc_resampler_neon.o
|
||||
|
@ -213,6 +213,7 @@ else ifeq ($(platform), vita)
|
|||
LIBDIRS += -L.
|
||||
LDFLAGS += -Wl,-q
|
||||
|
||||
HAVE_FILTERS_BUILTIN := 1
|
||||
HAVE_LIBRETRO_MANAGEMENT := 1
|
||||
HAVE_BUILTIN_AUTOCONFIG := 1
|
||||
HAVE_RPNG := 1
|
||||
|
@ -231,7 +232,6 @@ INCLUDE += -I./libretro-common/include
|
|||
ifeq ($(HAVE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_LOGGER
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
INCLUDE += -Ilogger/netlogger
|
||||
endif
|
||||
|
||||
ifeq ($(platform), wii)
|
||||
|
@ -276,7 +276,6 @@ endif
|
|||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
INCLUDE += -Ilogger/netlogger
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RARCH_EXEC), 1)
|
||||
|
@ -359,7 +358,7 @@ all: $(EXT_TARGET)
|
|||
|
||||
%.velf: %.elf
|
||||
arm-vita-eabi-strip -g $<
|
||||
vita-elf-create $< $@ $(VITASDK)/bin/db.json
|
||||
vita-elf-create $< $@ $(VITASDK)/bin/db.json $(VITASDK)/bin/extra.json
|
||||
|
||||
%.elf32: %.elf
|
||||
ifeq ($(platform), xenon360)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# $ source /usr/local/angstrom/arm/environment-setup
|
||||
# $ setprj retroarch
|
||||
|
||||
PNDDIR=./pandora
|
||||
PNDDIR=./pkg/pandora
|
||||
BINDIR=$(PNDDIR)/bin
|
||||
|
||||
all: $(BINDIR)/retroarch
|
||||
|
|
|
@ -34,7 +34,7 @@ EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
|
|||
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
|
||||
|
||||
LDDIRS = -L. -L$(CELL_SDK)/target/ppu/lib/PSGL/RSX/ultra-opt
|
||||
INCDIRS = -I. -Ips3 -Icommon -Ideps/zlib -Ilibretro-common/include
|
||||
INCDIRS = -I. -Idefines -Ideps/zlib -Ilibretro-common/include
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
|
@ -47,7 +47,7 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
|||
system_platform = win
|
||||
endif
|
||||
|
||||
PKG_SCRIPT = ps3/ps3py/pkg.py
|
||||
PKG_SCRIPT = tools/ps3/ps3py/pkg.py
|
||||
ifeq ($(shell uname), Linux)
|
||||
PKG_FINALIZE = package_finalize
|
||||
MAKE_SELF_WC = make_self_wc
|
||||
|
@ -116,7 +116,6 @@ endif
|
|||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
DEFINES += -DHAVE_LOGGER
|
||||
INCDIRS += -Ilogger/netlogger
|
||||
endif
|
||||
|
||||
PPU_CFLAGS := $(PPU_OPTIMIZE_LV) $(INCDIRS) $(DEFINES)
|
||||
|
|
|
@ -34,7 +34,7 @@ EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
|
|||
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
|
||||
|
||||
LDDIRS = -L. -L$(CELL_SDK)/target/ppu/lib/PSGL/RSX/ultra-opt
|
||||
INCDIRS = -I. -Ips3 -Icommon
|
||||
INCDIRS = -I. -Idefines
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
|
@ -47,7 +47,7 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
|||
system_platform = win
|
||||
endif
|
||||
|
||||
PKG_SCRIPT = ps3/ps3py/pkg.py
|
||||
PKG_SCRIPT = tools/ps3/ps3py/pkg.py
|
||||
ifeq ($(shell uname), Linux)
|
||||
PKG_FINALIZE = package_finalize
|
||||
MAKE_SELF_WC = make_self_wc
|
||||
|
@ -116,7 +116,6 @@ endif
|
|||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
DEFINES += -DHAVE_LOGGER
|
||||
INCDIRS += -Ilogger/netlogger
|
||||
endif
|
||||
|
||||
PPU_CFLAGS := $(PPU_OPTIMIZE_LV) $(INCDIRS) $(DEFINES)
|
||||
|
|
|
@ -26,14 +26,16 @@ PPU_SRCS = frontend/frontend_salamander.c \
|
|||
libretro-common/file/file_path.c \
|
||||
libretro-common/file/dir_list.c \
|
||||
libretro-common/file/retro_dirent.c \
|
||||
libretro-common/file/retro_stat.c \
|
||||
libretro-common/hash/rhash.c \
|
||||
libretro-common/string/string_list.c \
|
||||
libretro-common/compat/compat.c \
|
||||
libretro-common/file/retro_file.c \
|
||||
libretro-common/file/config_file.c
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
PPU_CFLAGS += -DHAVE_LOGGER -Ilogger/netlogger
|
||||
PPU_SRCS += logger/netlogger/logger.c
|
||||
PPU_CFLAGS += -DHAVE_LOGGER
|
||||
PPU_SRCS += netlogger.c
|
||||
endif
|
||||
|
||||
PPU_TARGET = retroarch-salamander_ps3.elf
|
||||
|
|
|
@ -36,7 +36,7 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
|||
system_platform = win
|
||||
endif
|
||||
|
||||
PKG_SCRIPT = ps3/ps3py/pkg.py
|
||||
PKG_SCRIPT = tools/ps3/ps3py/pkg.py
|
||||
ifeq ($(shell uname), Linux)
|
||||
PKG_FINALIZE = package_finalize
|
||||
MAKE_SELF_WC = make_self_wc
|
||||
|
@ -61,7 +61,7 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
|||
system_platform = win
|
||||
endif
|
||||
|
||||
PKG_SCRIPT = ps3/ps3py/pkg.py
|
||||
PKG_SCRIPT = tools/ps3/ps3py/pkg.py
|
||||
ifeq ($(shell uname), Linux)
|
||||
PKG_FINALIZE = package_finalize
|
||||
MAKE_SELF_WC = make_self_wc
|
||||
|
|
|
@ -51,7 +51,7 @@ CFLAGS += $(RARCH_DEFINES)
|
|||
EXTRA_TARGETS = EBOOT.PBP
|
||||
PSP_EBOOT_TITLE = RetroArch PSP1
|
||||
|
||||
PSP_OBJECTS = griffin/griffin.o psp1/kernel_functions.o
|
||||
PSP_OBJECTS = griffin/griffin.o bootstrap/psp1/kernel_functions.o
|
||||
|
||||
OBJS = $(PSP_OBJECTS)
|
||||
|
||||
|
|
|
@ -26,10 +26,10 @@ endif
|
|||
|
||||
CFLAGS += $(RARCH_DEFINES)
|
||||
|
||||
EXTRA_TARGETS = EBOOT.PBP
|
||||
EXTRA_TARGETS = EBOOT.PBP
|
||||
PSP_EBOOT_TITLE = RetroArch
|
||||
PSP_EBOOT_ICON = psp1/ICON0.PNG
|
||||
PSP_EBOOT_PIC1 = psp1/PIC1.PNG
|
||||
PSP_EBOOT_ICON = pkg/psp1/ICON0.PNG
|
||||
PSP_EBOOT_PIC1 = pkg/psp1/PIC1.PNG
|
||||
|
||||
OBJS = frontend/frontend_salamander.o \
|
||||
frontend/frontend_driver.o \
|
||||
|
@ -41,8 +41,10 @@ OBJS = frontend/frontend_salamander.o \
|
|||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/compat/compat.o \
|
||||
libretro-common/file/config_file.o \
|
||||
libretro-common/file/retro_file.o \
|
||||
libretro-common/file/retro_stat.o \
|
||||
libretro-common/hash/rhash.o \
|
||||
psp1/kernel_functions.o
|
||||
bootstrap/psp1/kernel_functions.o
|
||||
|
||||
PSPSDK=$(shell psp-config --pspsdk-path)
|
||||
include $(PSPSDK)/lib/build.mak
|
||||
|
|
|
@ -48,7 +48,9 @@ OBJ = frontend/frontend_salamander.o \
|
|||
libretro-common/hash/rhash.o \
|
||||
libretro-common/string/string_list.o \
|
||||
libretro-common/file/dir_list.o \
|
||||
libretro-common/file/retro_file.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/file/retro_stat.o \
|
||||
libretro-common/compat/compat.o \
|
||||
libretro-common/file/config_file.o \
|
||||
$(APP_BOOTER_DIR)/app_booter.binobj
|
||||
|
@ -56,13 +58,11 @@ OBJ = frontend/frontend_salamander.o \
|
|||
ifeq ($(HAVE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_LOGGER
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
CFLAGS += -Ilogger/netlogger
|
||||
OBJ += logger/netlogger/logger.o
|
||||
OBJ += logger/netlogger.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
CFLAGS += -Ilogger/netlogger
|
||||
endif
|
||||
|
||||
CFLAGS += -std=gnu99 -DIS_SALAMANDER -DRARCH_CONSOLE -DHAVE_RARCH_EXEC -DGEKKO -Wno-char-subscripts
|
||||
|
|
14
README.md
|
@ -123,20 +123,20 @@ make
|
|||
|
||||
<b>Mac</b><br/>
|
||||
- Prerequisites: [XCode](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB4QFjAA&url=https%3A%2F%2Fitunes.apple.com%2Fus%2Fapp%2Fxcode%2Fid497799835%3Fmt%3D12&ei=ZmfeVNPtIILVoASBnoCYBw&usg=AFQjCNGrxKmVtXUdvUU3MhqZhP4MHT6Gtg&sig2=RIXKsWQ79YTQBt_lK5fdKA&bvm=bv.85970519,d.cGU), [Cg](https://developer.nvidia.com/cg-toolkit-download).
|
||||
- You can open the project (**apple/RetroArch.xcodeproj**) in the Xcode IDE and build (**⌘-B**) and run (**⌘-R**) it there. Or you can use the command line...
|
||||
- You can open the project (**pkg/apple/RetroArch.xcodeproj**) in the Xcode IDE and build (**⌘-B**) and run (**⌘-R**) it there. Or you can use the command line...
|
||||
- Debug:
|
||||
```bash
|
||||
# Build
|
||||
xcodebuild -target RetroArch -configuration Debug -project apple/RetroArch.xcodeproj
|
||||
xcodebuild -target RetroArch -configuration Debug -project pkg/apple/RetroArch.xcodeproj
|
||||
# Run
|
||||
open ./apple/build/Debug/RetroArch.app/
|
||||
open ./pkg/apple/build/Debug/RetroArch.app/
|
||||
```
|
||||
- Release:
|
||||
```bash
|
||||
# Build
|
||||
xcodebuild -target RetroArch -configuration Release -project apple/RetroArch.xcodeproj
|
||||
xcodebuild -target RetroArch -configuration Release -project pkg/apple/RetroArch.xcodeproj
|
||||
# Run
|
||||
open ./apple/build/Release/RetroArch.app/
|
||||
open ./pkg/apple/build/Release/RetroArch.app/
|
||||
```
|
||||
|
||||
<b>PC</b><br/>
|
||||
|
@ -186,9 +186,9 @@ You will need Microsoft Visual Studio 2010 installed (or higher) in order to com
|
|||
|
||||
The solution file can be found at the following location:
|
||||
|
||||
<tt>msvc-360/RetroArch-360.sln</tt>
|
||||
<tt>pkg/msvc-360/RetroArch-360.sln</tt>
|
||||
|
||||
NOTE: A pre-existing libretro library needs to be present in the `msvc-360/RetroArch-360/Release` directory in order to link RetroArch 360. This file needs to be
|
||||
NOTE: A pre-existing libretro library needs to be present in the `pkg/msvc-360/RetroArch-360/Release` directory in order to link RetroArch 360. This file needs to be
|
||||
called <em><b>`libretro_xdk360.lib`</b></em>.
|
||||
|
||||
<b> Xbox 360 (Libxenon)</b><br />
|
||||
|
|
|
@ -594,15 +594,19 @@ void audio_driver_set_nonblocking_state(bool enable)
|
|||
**/
|
||||
bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||
{
|
||||
const void *output_data = NULL;
|
||||
unsigned output_frames = 0;
|
||||
size_t output_size = sizeof(float);
|
||||
struct resampler_data src_data = {0};
|
||||
struct rarch_dsp_data dsp_data = {0};
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const audio_driver_t *audio = driver ?
|
||||
static struct retro_perf_counter audio_convert_s16 = {0};
|
||||
static struct retro_perf_counter audio_convert_float = {0};
|
||||
static struct retro_perf_counter audio_dsp = {0};
|
||||
static struct retro_perf_counter resampler_proc = {0};
|
||||
struct resampler_data src_data = {0};
|
||||
struct rarch_dsp_data dsp_data = {0};
|
||||
const void *output_data = NULL;
|
||||
unsigned output_frames = 0;
|
||||
size_t output_size = sizeof(float);
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const audio_driver_t *audio = driver ?
|
||||
(const audio_driver_t*)driver->audio : NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (driver->recording_data)
|
||||
{
|
||||
|
@ -619,11 +623,11 @@ bool audio_driver_flush(const int16_t *data, size_t samples)
|
|||
if (!driver->audio_active || !audio_data.data)
|
||||
return false;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(audio_convert_s16);
|
||||
RARCH_PERFORMANCE_START(audio_convert_s16);
|
||||
rarch_perf_init(&audio_convert_s16, "audio_convert_s16");
|
||||
retro_perf_start(&audio_convert_s16);
|
||||
audio_convert_s16_to_float(audio_data.data, data, samples,
|
||||
audio_data.volume_gain);
|
||||
RARCH_PERFORMANCE_STOP(audio_convert_s16);
|
||||
retro_perf_stop(&audio_convert_s16);
|
||||
|
||||
src_data.data_in = audio_data.data;
|
||||
src_data.input_frames = samples >> 1;
|
||||
|
@ -633,10 +637,10 @@ bool audio_driver_flush(const int16_t *data, size_t samples)
|
|||
|
||||
if (audio_data.dsp)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(audio_dsp);
|
||||
RARCH_PERFORMANCE_START(audio_dsp);
|
||||
rarch_perf_init(&audio_dsp, "audio_dsp");
|
||||
retro_perf_start(&audio_dsp);
|
||||
rarch_dsp_filter_process(audio_data.dsp, &dsp_data);
|
||||
RARCH_PERFORMANCE_STOP(audio_dsp);
|
||||
retro_perf_stop(&audio_dsp);
|
||||
|
||||
if (dsp_data.output)
|
||||
{
|
||||
|
@ -654,22 +658,22 @@ bool audio_driver_flush(const int16_t *data, size_t samples)
|
|||
if (rarch_main_is_slowmotion())
|
||||
src_data.ratio *= settings->slowmotion_ratio;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(resampler_proc);
|
||||
RARCH_PERFORMANCE_START(resampler_proc);
|
||||
rarch_perf_init(&resampler_proc, "resampler_proc");
|
||||
retro_perf_start(&resampler_proc);
|
||||
rarch_resampler_process(driver->resampler,
|
||||
driver->resampler_data, &src_data);
|
||||
RARCH_PERFORMANCE_STOP(resampler_proc);
|
||||
retro_perf_stop(&resampler_proc);
|
||||
|
||||
output_data = audio_data.outsamples;
|
||||
output_frames = src_data.output_frames;
|
||||
|
||||
if (!audio_data.use_float)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(audio_convert_float);
|
||||
RARCH_PERFORMANCE_START(audio_convert_float);
|
||||
rarch_perf_init(&audio_convert_float, "audio_convert_float");
|
||||
retro_perf_start(&audio_convert_float);
|
||||
audio_convert_float_to_s16(audio_data.conv_outsamples,
|
||||
(const float*)output_data, output_frames * 2);
|
||||
RARCH_PERFORMANCE_STOP(audio_convert_float);
|
||||
retro_perf_stop(&audio_convert_float);
|
||||
|
||||
output_data = audio_data.conv_outsamples;
|
||||
output_size = sizeof(int16_t);
|
||||
|
|
|
@ -146,7 +146,7 @@ static const dspfilter_get_implementation_t dsp_plugs_builtin[] = {
|
|||
static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
{
|
||||
unsigned i;
|
||||
dspfilter_simd_mask_t mask = rarch_get_cpu_features();
|
||||
dspfilter_simd_mask_t mask = retro_get_cpu_features();
|
||||
|
||||
(void)list;
|
||||
|
||||
|
@ -170,7 +170,7 @@ static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
|||
static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
{
|
||||
unsigned i;
|
||||
dspfilter_simd_mask_t mask = rarch_get_cpu_features();
|
||||
dspfilter_simd_mask_t mask = retro_get_cpu_features();
|
||||
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ ifeq (debug,$(build))
|
|||
extra_flags += -O0 -g
|
||||
endif
|
||||
|
||||
ldflags := -shared -lm -Wl,--version-script=link.T
|
||||
ldflags := $(LDFLAGS) -shared -lm -Wl,--version-script=link.T
|
||||
|
||||
ifeq ($(platform), unix)
|
||||
DYLIB = so
|
||||
|
@ -57,8 +57,8 @@ endif
|
|||
|
||||
CC := $(compiler) -Wall
|
||||
CXX := $(subst CC,++,$(compiler)) -std=gnu++0x -Wall
|
||||
flags := -fPIC $(extra_flags) -I../../libretro-common/include
|
||||
asflags := -fPIC $(extra_flags)
|
||||
flags := $(CFLAGS) -fPIC $(extra_flags) -I../../libretro-common/include
|
||||
asflags := $(ASFLAGS) -fPIC $(extra_flags)
|
||||
objects :=
|
||||
|
||||
ifeq (1,$(use_neon))
|
||||
|
|
|
@ -171,7 +171,7 @@ retro_get_cpu_features_t perf_get_cpu_features_cb;
|
|||
static resampler_simd_mask_t resampler_get_cpu_features(void)
|
||||
{
|
||||
#ifdef RARCH_INTERNAL
|
||||
return rarch_get_cpu_features();
|
||||
return retro_get_cpu_features();
|
||||
#else
|
||||
return perf_get_cpu_features_cb();
|
||||
#endif
|
||||
|
|
|
@ -215,7 +215,7 @@ void audio_convert_float_to_s16_altivec(int16_t *out,
|
|||
}
|
||||
audio_convert_float_to_s16_C(out, in, samples_in);
|
||||
}
|
||||
#elif defined(__ARM_NEON__)
|
||||
#elif defined(__ARM_NEON__) && !defined(VITA)
|
||||
/* Avoid potential hard-float/soft-float ABI issues. */
|
||||
void audio_convert_s16_float_asm(float *out, const int16_t *in,
|
||||
size_t samples, const float *gain);
|
||||
|
@ -409,7 +409,7 @@ retro_get_cpu_features_t perf_get_cpu_features_cb;
|
|||
static unsigned audio_convert_get_cpu_features(void)
|
||||
{
|
||||
#ifdef RARCH_INTERNAL
|
||||
return rarch_get_cpu_features();
|
||||
return retro_get_cpu_features();
|
||||
#else
|
||||
return perf_get_cpu_features_cb();
|
||||
#endif
|
||||
|
@ -426,7 +426,7 @@ void audio_convert_init_simd(void)
|
|||
unsigned cpu = audio_convert_get_cpu_features();
|
||||
|
||||
(void)cpu;
|
||||
#if defined(__ARM_NEON__)
|
||||
#if defined(__ARM_NEON__) && !defined(VITA)
|
||||
audio_convert_s16_to_float_arm = cpu & RETRO_SIMD_NEON ?
|
||||
audio_convert_s16_to_float_neon : audio_convert_s16_to_float_C;
|
||||
audio_convert_float_to_s16_arm = cpu & RETRO_SIMD_NEON ?
|
||||
|
|
|
@ -93,7 +93,7 @@ void audio_convert_s16_to_float_altivec(float *out,
|
|||
void audio_convert_float_to_s16_altivec(int16_t *out,
|
||||
const float *in, size_t samples);
|
||||
|
||||
#elif defined(__ARM_NEON__)
|
||||
#elif defined(__ARM_NEON__) && !defined(VITA)
|
||||
#define audio_convert_s16_to_float audio_convert_s16_to_float_arm
|
||||
#define audio_convert_float_to_s16 audio_convert_float_to_s16_arm
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#include <AudioToolbox/AudioToolbox.h>
|
||||
|
@ -29,6 +28,7 @@
|
|||
|
||||
#include <boolean.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <retro_endianness.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
|
@ -44,8 +44,8 @@
|
|||
|
||||
typedef struct coreaudio
|
||||
{
|
||||
pthread_mutex_t lock;
|
||||
pthread_cond_t cond;
|
||||
slock_t *lock;
|
||||
scond_t *cond;
|
||||
|
||||
#ifdef OSX_PPC
|
||||
ComponentInstance dev;
|
||||
|
@ -82,8 +82,8 @@ static void coreaudio_free(void *data)
|
|||
if (dev->buffer)
|
||||
fifo_free(dev->buffer);
|
||||
|
||||
pthread_mutex_destroy(&dev->lock);
|
||||
pthread_cond_destroy(&dev->cond);
|
||||
slock_free(dev->lock);
|
||||
scond_free(dev->cond);
|
||||
|
||||
free(dev);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ static OSStatus audio_write_cb(void *userdata,
|
|||
write_avail = io_data->mBuffers[0].mDataByteSize;
|
||||
outbuf = io_data->mBuffers[0].mData;
|
||||
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
slock_lock(dev->lock);
|
||||
|
||||
if (fifo_read_avail(dev->buffer) < write_avail)
|
||||
{
|
||||
|
@ -118,16 +118,16 @@ static OSStatus audio_write_cb(void *userdata,
|
|||
/* Seems to be needed. */
|
||||
memset(outbuf, 0, write_avail);
|
||||
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
slock_unlock(dev->lock);
|
||||
|
||||
/* Technically possible to deadlock without. */
|
||||
pthread_cond_signal(&dev->cond);
|
||||
scond_signal(dev->cond);
|
||||
return noErr;
|
||||
}
|
||||
|
||||
fifo_read(dev->buffer, outbuf, write_avail);
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
pthread_cond_signal(&dev->cond);
|
||||
slock_unlock(dev->lock);
|
||||
scond_signal(dev->cond);
|
||||
return noErr;
|
||||
}
|
||||
|
||||
|
@ -218,8 +218,8 @@ static void *coreaudio_init(const char *device,
|
|||
if (!dev)
|
||||
return NULL;
|
||||
|
||||
pthread_mutex_init(&dev->lock, NULL);
|
||||
pthread_cond_init(&dev->cond, NULL);
|
||||
dev->lock = slock_new();
|
||||
dev->cond = scond_new();
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
if (!session_initialized)
|
||||
|
@ -343,22 +343,11 @@ static ssize_t coreaudio_write(void *data, const void *buf_, size_t size)
|
|||
const uint8_t *buf = (const uint8_t*)buf_;
|
||||
size_t written = 0;
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
struct timespec timeout;
|
||||
struct timeval time;
|
||||
|
||||
gettimeofday(&time, 0);
|
||||
|
||||
memset(&timeout, 0, sizeof(timeout));
|
||||
timeout.tv_sec = time.tv_sec + 3;
|
||||
timeout.tv_nsec = time.tv_usec * 1000;
|
||||
#endif
|
||||
|
||||
while (!g_interrupted && size > 0)
|
||||
{
|
||||
size_t write_avail;
|
||||
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
slock_lock(dev->lock);
|
||||
|
||||
write_avail = fifo_write_avail(dev->buffer);
|
||||
if (write_avail > size)
|
||||
|
@ -371,19 +360,19 @@ static ssize_t coreaudio_write(void *data, const void *buf_, size_t size)
|
|||
|
||||
if (dev->nonblock)
|
||||
{
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
slock_unlock(dev->lock);
|
||||
break;
|
||||
}
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
if (write_avail == 0 && pthread_cond_timedwait(
|
||||
&dev->cond, &dev->lock, &timeout) == ETIMEDOUT)
|
||||
if (write_avail == 0 && !scond_wait_timeout(
|
||||
dev->cond, dev->lock, 3000000))
|
||||
g_interrupted = true;
|
||||
#else
|
||||
if (write_avail == 0)
|
||||
pthread_cond_wait(&dev->cond, &dev->lock);
|
||||
scond_wait(dev->cond, dev->lock);
|
||||
#endif
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
slock_unlock(dev->lock);
|
||||
}
|
||||
|
||||
return written;
|
||||
|
@ -433,9 +422,9 @@ static size_t coreaudio_write_avail(void *data)
|
|||
size_t avail;
|
||||
coreaudio_t *dev = (coreaudio_t*)data;
|
||||
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
slock_lock(dev->lock);
|
||||
avail = fifo_write_avail(dev->buffer);
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
slock_unlock(dev->lock);
|
||||
|
||||
return avail;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ typedef struct
|
|||
uint64_t cpu_ticks_last;
|
||||
|
||||
int rate;
|
||||
|
||||
} ctr_audio_t;
|
||||
|
||||
#define CTR_AUDIO_COUNT (1u << 11u)
|
||||
|
@ -44,28 +43,26 @@ typedef struct
|
|||
|
||||
static void *ctr_audio_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
ctr_audio_t *ctr = (ctr_audio_t*)calloc(1, sizeof(ctr_audio_t));
|
||||
|
||||
if (!ctr)
|
||||
return NULL;
|
||||
|
||||
(void)device;
|
||||
(void)rate;
|
||||
(void)latency;
|
||||
|
||||
// if(!csndInit())
|
||||
// return NULL;
|
||||
|
||||
ctr_audio_t *ctr = (ctr_audio_t*)calloc(1, sizeof(ctr_audio_t));
|
||||
|
||||
ctr->l = linearAlloc(CTR_AUDIO_SIZE);
|
||||
ctr->r = linearAlloc(CTR_AUDIO_SIZE);
|
||||
ctr->l = linearAlloc(CTR_AUDIO_SIZE);
|
||||
ctr->r = linearAlloc(CTR_AUDIO_SIZE);
|
||||
|
||||
memset(ctr->l, 0, CTR_AUDIO_SIZE);
|
||||
memset(ctr->r, 0, CTR_AUDIO_SIZE);
|
||||
|
||||
ctr->l_paddr = osConvertVirtToPhys((u32)ctr->l);
|
||||
ctr->r_paddr = osConvertVirtToPhys((u32)ctr->r);
|
||||
ctr->l_paddr = osConvertVirtToPhys((u32)ctr->l);
|
||||
ctr->r_paddr = osConvertVirtToPhys((u32)ctr->r);
|
||||
|
||||
ctr->pos = 0;
|
||||
ctr->rate = rate;
|
||||
ctr->pos = 0;
|
||||
ctr->rate = rate;
|
||||
ctr->cpu_ticks_per_sample = CSND_TIMER(rate) * 4;
|
||||
|
||||
GSPGPU_FlushDataCache(NULL, (u8*)ctr->l_paddr, CTR_AUDIO_SIZE);
|
||||
|
@ -76,9 +73,9 @@ static void *ctr_audio_init(const char *device, unsigned rate, unsigned latency)
|
|||
csndPlaySound(0x9, SOUND_LOOPMODE(CSND_LOOPMODE_NORMAL)| SOUND_FORMAT(CSND_ENCODING_PCM16),
|
||||
rate, 1.0, 1.0, ctr->r, ctr->r, CTR_AUDIO_SIZE);
|
||||
|
||||
ctr->playpos = 0;
|
||||
ctr->cpu_ticks_last = svcGetSystemTick();
|
||||
ctr->playing = true;
|
||||
ctr->playpos = 0;
|
||||
ctr->cpu_ticks_last = svcGetSystemTick();
|
||||
ctr->playing = true;
|
||||
|
||||
return ctr;
|
||||
}
|
||||
|
@ -100,20 +97,22 @@ static void ctr_audio_free(void *data)
|
|||
|
||||
static ssize_t ctr_audio_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
int i;
|
||||
uint32_t samples_played;
|
||||
uint64_t current_tick;
|
||||
static struct retro_perf_counter ctraudio_f = {0};
|
||||
const uint16_t *src = buf;
|
||||
ctr_audio_t *ctr = (ctr_audio_t*)data;
|
||||
|
||||
(void)data;
|
||||
(void)buf;
|
||||
|
||||
ctr_audio_t* ctr = (ctr_audio_t*)data;
|
||||
rarch_perf_init(&ctraudio_f, "ctraudio_f");
|
||||
retro_perf_start(&ctraudio_f);
|
||||
|
||||
int i;
|
||||
const uint16_t* src = buf;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(ctraudio_f);
|
||||
RARCH_PERFORMANCE_START(ctraudio_f);
|
||||
|
||||
uint64_t current_tick = svcGetSystemTick();
|
||||
uint32_t samples_played = (current_tick - ctr->cpu_ticks_last) / ctr->cpu_ticks_per_sample;
|
||||
ctr->playpos = (ctr->playpos + samples_played) & CTR_AUDIO_COUNT_MASK;
|
||||
current_tick = svcGetSystemTick();
|
||||
samples_played = (current_tick - ctr->cpu_ticks_last) / ctr->cpu_ticks_per_sample;
|
||||
ctr->playpos = (ctr->playpos + samples_played) & CTR_AUDIO_COUNT_MASK;
|
||||
ctr->cpu_ticks_last += samples_played * ctr->cpu_ticks_per_sample;
|
||||
|
||||
|
||||
|
@ -127,7 +126,7 @@ static ssize_t ctr_audio_write(void *data, const void *buf, size_t size)
|
|||
{
|
||||
do{
|
||||
/* todo: compute the correct sleep period */
|
||||
rarch_sleep(1);
|
||||
retro_sleep(1);
|
||||
current_tick = svcGetSystemTick();
|
||||
samples_played = (current_tick - ctr->cpu_ticks_last) / ctr->cpu_ticks_per_sample;
|
||||
ctr->playpos = (ctr->playpos + samples_played) & CTR_AUDIO_COUNT_MASK;
|
||||
|
@ -144,11 +143,11 @@ static ssize_t ctr_audio_write(void *data, const void *buf, size_t size)
|
|||
ctr->pos++;
|
||||
ctr->pos &= CTR_AUDIO_COUNT_MASK;
|
||||
}
|
||||
|
||||
GSPGPU_FlushDataCache(NULL, (u8*)ctr->l, CTR_AUDIO_SIZE);
|
||||
GSPGPU_FlushDataCache(NULL, (u8*)ctr->r, CTR_AUDIO_SIZE);
|
||||
|
||||
|
||||
RARCH_PERFORMANCE_STOP(ctraudio_f);
|
||||
retro_perf_stop(&ctraudio_f);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
@ -160,8 +159,10 @@ static bool ctr_audio_stop(void *data)
|
|||
/* using SetPlayState would make tracking the playback
|
||||
* position more difficult */
|
||||
|
||||
// CSND_SetPlayState(0x8, 0);
|
||||
// CSND_SetPlayState(0x9, 0);
|
||||
#if 0
|
||||
CSND_SetPlayState(0x8, 0);
|
||||
CSND_SetPlayState(0x9, 0);
|
||||
#endif
|
||||
|
||||
/* setting the channel volume to 0 seems to make it
|
||||
* impossible to set it back to full volume later */
|
||||
|
@ -186,14 +187,16 @@ static bool ctr_audio_start(void *data)
|
|||
ctr_audio_t* ctr = (ctr_audio_t*)data;
|
||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||
|
||||
/* prevents restarting audio when the menu
|
||||
/* Prevents restarting audio when the menu
|
||||
* is toggled off on shutdown */
|
||||
|
||||
if (system->shutdown)
|
||||
return true;
|
||||
|
||||
// CSND_SetPlayState(0x8, 1);
|
||||
// CSND_SetPlayState(0x9, 1);
|
||||
#if 0
|
||||
CSND_SetPlayState(0x8, 1);
|
||||
CSND_SetPlayState(0x9, 1);
|
||||
#endif
|
||||
|
||||
CSND_SetVol(0x8, 0x00008000, 0);
|
||||
CSND_SetVol(0x9, 0x80000000, 0);
|
||||
|
|
|
@ -166,7 +166,7 @@ static void dsound_thread(void *data)
|
|||
* but it is not guaranteed to work, so use high
|
||||
* priority sleeping patterns.
|
||||
*/
|
||||
rarch_sleep(1);
|
||||
retro_sleep(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ static bool al_get_buffer(al_t *al, ALuint *buffer)
|
|||
return false;
|
||||
|
||||
/* Must sleep as there is no proper blocking method. */
|
||||
rarch_sleep(1);
|
||||
retro_sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,13 @@ typedef struct psp_audio
|
|||
#define AUDIO_BUFFER_SIZE (1u<<13u)
|
||||
#define AUDIO_BUFFER_SIZE_MASK (AUDIO_BUFFER_SIZE-1)
|
||||
|
||||
#ifdef VITA
|
||||
#define PSP_THREAD_STOPPED PSP2_THREAD_STOPPED
|
||||
#else
|
||||
#define SceKernelThreadInfo SceKernelThreadRunStatus
|
||||
#define sceKernelGetThreadInfo sceKernelReferThreadRunStatus
|
||||
#endif
|
||||
|
||||
static int audioMainLoop(SceSize args, void* argp)
|
||||
{
|
||||
psp_audio_t* psp = *((psp_audio_t**)argp);
|
||||
|
@ -190,37 +197,22 @@ static bool psp_audio_alive(void *data)
|
|||
return psp->running;
|
||||
}
|
||||
|
||||
|
||||
static bool psp_audio_stop(void *data)
|
||||
{
|
||||
SceKernelThreadInfo info;
|
||||
SceUInt timeout = 100000;
|
||||
psp_audio_t* psp = (psp_audio_t*)data;
|
||||
|
||||
#if defined(VITA)
|
||||
SceKernelThreadInfo info;
|
||||
|
||||
info.size = sizeof(SceKernelThreadInfo);
|
||||
|
||||
if (sceKernelGetThreadInfo(
|
||||
psp->thread, &info) < 0) /* Error */
|
||||
return false;
|
||||
|
||||
if (info.status == PSP2_THREAD_STOPPED)
|
||||
if (info.status == PSP_THREAD_STOPPED)
|
||||
return false;
|
||||
|
||||
#else
|
||||
SceKernelThreadRunStatus runStatus;
|
||||
|
||||
runStatus.size = sizeof(SceKernelThreadRunStatus);
|
||||
|
||||
if (sceKernelReferThreadRunStatus(
|
||||
psp->thread, &runStatus) < 0) /* Error */
|
||||
return false;
|
||||
|
||||
if (runStatus.status == PSP_THREAD_STOPPED)
|
||||
return false;
|
||||
|
||||
#endif
|
||||
|
||||
psp->running = false;
|
||||
#if defined(VITA)
|
||||
sceKernelWaitThreadEnd(psp->thread, NULL, &timeout);
|
||||
|
@ -233,10 +225,8 @@ static bool psp_audio_stop(void *data)
|
|||
|
||||
static bool psp_audio_start(void *data)
|
||||
{
|
||||
psp_audio_t* psp = (psp_audio_t*)data;
|
||||
|
||||
#if defined(VITA)
|
||||
SceKernelThreadInfo info;
|
||||
psp_audio_t* psp = (psp_audio_t*)data;
|
||||
|
||||
info.size = sizeof(SceKernelThreadInfo);
|
||||
|
||||
|
@ -244,22 +234,9 @@ static bool psp_audio_start(void *data)
|
|||
psp->thread, &info) < 0) /* Error */
|
||||
return false;
|
||||
|
||||
if (info.status != PSP2_THREAD_STOPPED)
|
||||
if (info.status != PSP_THREAD_STOPPED)
|
||||
return false;
|
||||
|
||||
#else
|
||||
SceKernelThreadRunStatus runStatus;
|
||||
|
||||
runStatus.size = sizeof(SceKernelThreadRunStatus);
|
||||
|
||||
if (sceKernelReferThreadRunStatus(
|
||||
psp->thread, &runStatus) < 0) /* Error */
|
||||
return false;
|
||||
if (runStatus.status != PSP_THREAD_STOPPED)
|
||||
return false;
|
||||
|
||||
#endif
|
||||
|
||||
psp->running = true;
|
||||
|
||||
sceKernelStartThread(psp->thread, sizeof(psp_audio_t*), &psp);
|
||||
|
|
|
@ -334,7 +334,7 @@ static void process_sinc(rarch_sinc_resampler_t *resamp, float *out_buffer)
|
|||
/* movehl { X, R, X, L } == { X, R, X, R } */
|
||||
_mm_store_ss(out_buffer + 1, _mm_movehl_ps(sum, sum));
|
||||
}
|
||||
#elif defined(__ARM_NEON__)
|
||||
#elif defined(__ARM_NEON__) && !defined(VITA)
|
||||
|
||||
#if SINC_COEFF_LERP
|
||||
#error "NEON asm does not support SINC lerp."
|
||||
|
@ -437,7 +437,7 @@ static void *resampler_sinc_new(const struct resampler_config *config,
|
|||
}
|
||||
|
||||
/* Be SIMD-friendly. */
|
||||
#if (defined(__AVX__) && ENABLE_AVX) || defined(__ARM_NEON__)
|
||||
#if (defined(__AVX__) && ENABLE_AVX) || (defined(__ARM_NEON__)&& !defined(VITA))
|
||||
re->taps = (re->taps + 7) & ~7;
|
||||
#else
|
||||
re->taps = (re->taps + 3) & ~3;
|
||||
|
@ -460,7 +460,7 @@ static void *resampler_sinc_new(const struct resampler_config *config,
|
|||
init_sinc_table(re, cutoff, re->phase_table,
|
||||
1 << PHASE_BITS, re->taps, SINC_COEFF_LERP);
|
||||
|
||||
#if defined(__ARM_NEON__)
|
||||
#if defined(__ARM_NEON__) && !defined(VITA)
|
||||
process_sinc_func = mask & RESAMPLER_SIMD_NEON
|
||||
? process_sinc_neon : process_sinc_C;
|
||||
#endif
|
||||
|
@ -480,4 +480,3 @@ rarch_resampler_t sinc_resampler = {
|
|||
"sinc",
|
||||
"sinc"
|
||||
};
|
||||
|
||||
|
|
|
@ -153,7 +153,6 @@ static int rsnd_send_info_query(rsound_t *rd);
|
|||
static int rsnd_update_server_info(rsound_t *rd);
|
||||
|
||||
static int rsnd_poll(struct pollfd *fd, int numfd, int timeout);
|
||||
static void rsnd_sleep(int msec);
|
||||
|
||||
static void rsnd_cb_thread(void *thread_data);
|
||||
static void rsnd_thread(void *thread_data);
|
||||
|
@ -363,12 +362,12 @@ static int rsnd_send_header_info(rsound_t *rd)
|
|||
#define LSB16(x) if ( !rsnd_is_little_endian() ) { rsnd_swap_endian_16(&(x)); }
|
||||
#define LSB32(x) if ( !rsnd_is_little_endian() ) { rsnd_swap_endian_32(&(x)); }
|
||||
|
||||
// Here we embed in the rest of the WAV header for it to be somewhat valid
|
||||
/* Here we embed in the rest of the WAV header for it to be somewhat valid */
|
||||
|
||||
strcpy(header, "RIFF");
|
||||
strlcpy(header, "RIFF", sizeof(header));
|
||||
SET32(header, 4, 0);
|
||||
strcpy(header+8, "WAVE");
|
||||
strcpy(header+12, "fmt ");
|
||||
strlcpy(header+8, "WAVE", sizeof(header));
|
||||
strlcpy(header+12, "fmt ", sizeof(header));
|
||||
|
||||
temp32 = 16;
|
||||
LSB32(temp32);
|
||||
|
@ -414,15 +413,15 @@ static int rsnd_send_header_info(rsound_t *rd)
|
|||
LSB16(temp_bits);
|
||||
SET16(header, FRAMESIZE, temp_bits);
|
||||
|
||||
strcpy(header+36, "data");
|
||||
strlcpy(header+36, "data", sizeof(header));
|
||||
|
||||
// Do not care about cksize here (impossible to know beforehand). It is used by
|
||||
// the server for format.
|
||||
/* Do not care about cksize here (impossible to know beforehand).
|
||||
* It is used by the server for format. */
|
||||
|
||||
LSB16(temp_format);
|
||||
SET16(header, FORMAT, temp_format);
|
||||
|
||||
// End static header
|
||||
/* End static header */
|
||||
|
||||
if ( rsnd_send_chunk(rd->conn.socket, header, HEADER_SIZE, 1) != HEADER_SIZE )
|
||||
{
|
||||
|
@ -748,12 +747,6 @@ static int64_t rsnd_get_time_usec(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void rsnd_sleep(int msec)
|
||||
{
|
||||
rarch_sleep(msec);
|
||||
}
|
||||
|
||||
|
||||
/* Calculates how many bytes there are in total in the virtual buffer. This is calculated client side.
|
||||
It should be accurate enough unless we have big problems with buffer underruns.
|
||||
This function is called by rsd_delay() to determine the latency.
|
||||
|
@ -1246,7 +1239,7 @@ static void rsnd_cb_thread(void *thread_data)
|
|||
// The network might do things in large chunks, so it may request large amounts of data in short periods of time.
|
||||
// This breaks when the caller cannot buffer up big buffers beforehand, so do short sleeps inbetween.
|
||||
// This is somewhat dirty, but I cannot see a better solution
|
||||
rsnd_sleep(1);
|
||||
retro_sleep(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1513,7 +1506,7 @@ void rsd_delay_wait(rsound_t *rd)
|
|||
{
|
||||
int64_t sleep_ms = latency_ms - rd->max_latency;
|
||||
RSD_DEBUG("[RSound] Delay wait: %d ms.\n", (int)sleep_ms);
|
||||
rsnd_sleep((int)sleep_ms);
|
||||
retro_sleep((int)sleep_ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ SHAREDOBJ += $(LIBRETRO_COMM_DIR)/memmap/memalign.o \
|
|||
$(LIBRETRO_COMM_DIR)/string/string_list.o \
|
||||
$(LIBRETRO_COMM_DIR)/file/config_file_userdata.o \
|
||||
$(LIBRETRO_COMM_DIR)/file/config_file.o \
|
||||
$(LIBRETRO_COMM_DIR)/file/retro_file.o \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path.o \
|
||||
$(LIBRETRO_COMM_DIR)/compat/compat.o \
|
||||
$(LIBRETRO_COMM_DIR)/hash/rhash.o \
|
||||
|
|
|
@ -21,7 +21,7 @@ include $(PSPSDK)/lib/build.mak
|
|||
|
||||
all:
|
||||
psp-build-exports -s $(PRX_EXPORTS)
|
||||
cp $(TARGET).prx ../../$(TARGET).prx
|
||||
cp $(TARGET).prx ../../../$(TARGET).prx
|
||||
cp $(TARGET).S ../$(TARGET).S
|
||||
cp $(TARGET).h ../$(TARGET).h
|
||||
rm -f $(TARGET).prx
|
|
@ -8,6 +8,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
unsigned int read_system_buttons(void);
|
||||
|
||||
void exitspawn_kernel( const char* fileName, SceSize args, void * argp);
|
||||
|
||||
#ifdef __cplusplus
|
|
@ -1,16 +1,15 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <pspdebug.h>
|
||||
#include <pspsdk.h>
|
||||
#include <pspctrl.h>
|
||||
#include <psploadexec_kernel.h>
|
||||
#include <pspthreadman_kernel.h>
|
||||
#include <string.h>
|
||||
|
||||
PSP_MODULE_INFO("kernel_functions", PSP_MODULE_KERNEL, 0, 0);
|
||||
PSP_MAIN_THREAD_ATTR(0);
|
||||
|
||||
|
||||
static volatile int thread_active;
|
||||
static unsigned int buttons;
|
||||
static SceUID main_thread_id;
|
||||
|
@ -33,16 +32,17 @@ static int main_thread(SceSize args, void *argp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
unsigned int read_system_buttons(void)
|
||||
{
|
||||
return buttons;
|
||||
}
|
||||
|
||||
void exitspawn_kernel( const char* fileName, SceSize args, void * argp){
|
||||
thread_active = 0;
|
||||
void exitspawn_kernel(const char *fileName, SceSize args, void *argp)
|
||||
{
|
||||
struct SceKernelLoadExecVSHParam game_param;
|
||||
|
||||
thread_active = 0;
|
||||
|
||||
memset(&game_param,0,sizeof(game_param));
|
||||
|
||||
game_param.size = sizeof(game_param);
|
||||
|
@ -75,7 +75,6 @@ int module_start(SceSize args, void *argp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int module_stop(void)
|
||||
{
|
||||
if (main_thread_id >= 0)
|
|
@ -24,7 +24,6 @@
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
@ -35,6 +34,7 @@
|
|||
#include <memmap.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <gfx/scaler/scaler.h>
|
||||
#include <retro_stat.h>
|
||||
|
||||
#include <compat/strl.h>
|
||||
|
||||
|
@ -63,13 +63,14 @@ typedef struct video4linux
|
|||
char dev_name[PATH_MAX_LENGTH];
|
||||
} video4linux_t;
|
||||
|
||||
static void process_image(video4linux_t *v4l,
|
||||
const uint8_t *buffer_yuv)
|
||||
static void process_image(video4linux_t *v4l, const uint8_t *buffer_yuv)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(yuv_convert_direct);
|
||||
RARCH_PERFORMANCE_START(yuv_convert_direct);
|
||||
static struct retro_perf_counter yuv_convert_direct = {0};
|
||||
|
||||
rarch_perf_init(&yuv_convert_direct, "yuv_convert_direct");
|
||||
retro_perf_start(&yuv_convert_direct);
|
||||
scaler_ctx_scale(&v4l->scaler, v4l->buffer_output, buffer_yuv);
|
||||
RARCH_PERFORMANCE_STOP(yuv_convert_direct);
|
||||
retro_perf_stop(&yuv_convert_direct);
|
||||
}
|
||||
|
||||
static int xioctl(int fd, int request, void *args)
|
||||
|
@ -95,7 +96,7 @@ static bool init_mmap(void *data)
|
|||
req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
req.memory = V4L2_MEMORY_MMAP;
|
||||
|
||||
if (xioctl(v4l->fd, VIDIOC_REQBUFS, &req) == -1)
|
||||
if (xioctl(v4l->fd, (uint8_t)VIDIOC_REQBUFS, &req) == -1)
|
||||
{
|
||||
if (errno == EINVAL)
|
||||
RARCH_ERR("%s does not support memory mapping.\n", v4l->dev_name);
|
||||
|
@ -128,7 +129,7 @@ static bool init_mmap(void *data)
|
|||
buf.memory = V4L2_MEMORY_MMAP;
|
||||
buf.index = v4l->n_buffers;
|
||||
|
||||
if (xioctl(v4l->fd, VIDIOC_QUERYBUF, &buf) == -1)
|
||||
if (xioctl(v4l->fd, (uint8_t)VIDIOC_QUERYBUF, &buf) == -1)
|
||||
{
|
||||
RARCH_ERR("Error - xioctl VIDIOC_QUERYBUF.\n");
|
||||
return false;
|
||||
|
@ -158,7 +159,7 @@ static bool init_device(void *data)
|
|||
struct v4l2_format fmt;
|
||||
video4linux_t *v4l = (video4linux_t*)data;
|
||||
|
||||
if (xioctl(v4l->fd, VIDIOC_QUERYCAP, &cap) < 0)
|
||||
if (xioctl(v4l->fd, (uint8_t)VIDIOC_QUERYCAP, &cap) < 0)
|
||||
{
|
||||
if (errno == EINVAL)
|
||||
RARCH_ERR("%s is no V4L2 device.\n", v4l->dev_name);
|
||||
|
@ -183,7 +184,7 @@ static bool init_device(void *data)
|
|||
memset(&cropcap, 0, sizeof(cropcap));
|
||||
cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
|
||||
if (xioctl(v4l->fd, VIDIOC_CROPCAP, &cropcap) == 0)
|
||||
if (xioctl(v4l->fd, (uint8_t)VIDIOC_CROPCAP, &cropcap) == 0)
|
||||
{
|
||||
crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
crop.c = cropcap.defrect;
|
||||
|
@ -199,7 +200,7 @@ static bool init_device(void *data)
|
|||
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
|
||||
fmt.fmt.pix.field = V4L2_FIELD_NONE;
|
||||
|
||||
if (xioctl(v4l->fd, VIDIOC_S_FMT, &fmt) < 0)
|
||||
if (xioctl(v4l->fd, (uint8_t)VIDIOC_S_FMT, &fmt) < 0)
|
||||
{
|
||||
RARCH_ERR("Error - VIDIOC_S_FMT\n");
|
||||
return false;
|
||||
|
@ -259,7 +260,7 @@ static bool v4l_start(void *data)
|
|||
buf.memory = V4L2_MEMORY_MMAP;
|
||||
buf.index = i;
|
||||
|
||||
if (xioctl(v4l->fd, VIDIOC_QBUF, &buf) == -1)
|
||||
if (xioctl(v4l->fd, (uint8_t)VIDIOC_QBUF, &buf) == -1)
|
||||
{
|
||||
RARCH_ERR("Error - VIDIOC_QBUF.\n");
|
||||
return false;
|
||||
|
@ -299,7 +300,6 @@ static void v4l_free(void *data)
|
|||
static void *v4l_init(const char *device, uint64_t caps,
|
||||
unsigned width, unsigned height)
|
||||
{
|
||||
struct stat st;
|
||||
video4linux_t *v4l = NULL;
|
||||
|
||||
if ((caps & (UINT64_C(1) << RETRO_CAMERA_BUFFER_RAW_FRAMEBUFFER)) == 0)
|
||||
|
@ -319,14 +319,7 @@ static void *v4l_init(const char *device, uint64_t caps,
|
|||
v4l->height = height;
|
||||
v4l->ready = false;
|
||||
|
||||
if (stat(v4l->dev_name, &st) == -1)
|
||||
{
|
||||
RARCH_ERR("Cannot identify '%s' : %d, %s\n", v4l->dev_name,
|
||||
errno, strerror(errno));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!S_ISCHR(st.st_mode))
|
||||
if (!path_is_character_special(v4l->dev_name))
|
||||
{
|
||||
RARCH_ERR("%s is no device.\n", v4l->dev_name);
|
||||
goto error;
|
||||
|
@ -384,7 +377,7 @@ static bool preprocess_image(void *data)
|
|||
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
buf.memory = V4L2_MEMORY_MMAP;
|
||||
|
||||
if (xioctl(v4l->fd, VIDIOC_DQBUF, &buf) == -1)
|
||||
if (xioctl(v4l->fd, (uint8_t)VIDIOC_DQBUF, &buf) == -1)
|
||||
{
|
||||
switch (errno)
|
||||
{
|
||||
|
@ -400,7 +393,7 @@ static bool preprocess_image(void *data)
|
|||
|
||||
process_image(v4l, (const uint8_t*)v4l->buffers[buf.index].start);
|
||||
|
||||
if (xioctl(v4l->fd, VIDIOC_QBUF, &buf) == -1)
|
||||
if (xioctl(v4l->fd, (uint8_t)VIDIOC_QBUF, &buf) == -1)
|
||||
RARCH_ERR("VIDIOC_QBUF\n");
|
||||
|
||||
return true;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <string.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <file/file_path.h>
|
||||
#include <compat/strl.h>
|
||||
#include <compat/posix_string.h>
|
||||
#include <retro_stat.h>
|
||||
|
||||
#include "config.def.h"
|
||||
#include "input/input_common.h"
|
||||
|
@ -1630,6 +1631,7 @@ static bool config_load_file(const char *path, bool set_defaults)
|
|||
CONFIG_GET_BOOL_BASE(conf, settings, network_cmd_enable, "network_cmd_enable");
|
||||
CONFIG_GET_INT_BASE(conf, settings, network_cmd_port, "network_cmd_port");
|
||||
CONFIG_GET_BOOL_BASE(conf, settings, stdin_cmd_enable, "stdin_cmd_enable");
|
||||
CONFIG_GET_BOOL_BASE(conf, settings, debug_panel_enable, "debug_panel_enable");
|
||||
|
||||
CONFIG_GET_PATH_BASE(conf, settings, content_history_directory, "content_history_dir");
|
||||
|
||||
|
|
|
@ -326,6 +326,7 @@ typedef struct settings
|
|||
bool network_cmd_enable;
|
||||
unsigned network_cmd_port;
|
||||
bool stdin_cmd_enable;
|
||||
bool debug_panel_enable;
|
||||
|
||||
char core_assets_directory[PATH_MAX_LENGTH];
|
||||
char assets_directory[PATH_MAX_LENGTH];
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include <compat/strl.h>
|
||||
#include <file/file_path.h>
|
||||
#include <file/file_extract.h>
|
||||
#include <retro_file.h>
|
||||
#include <retro_stat.h>
|
||||
|
||||
#include "msg_hash.h"
|
||||
#include "content.h"
|
||||
|
@ -118,7 +120,7 @@ static void dump_to_file_desperate(const void *data,
|
|||
strftime(timebuf, sizeof(timebuf), "%Y-%m-%d-%H-%M-%S", localtime(&time_));
|
||||
strlcat(path, timebuf, sizeof(path));
|
||||
|
||||
if (write_file(path, data, size))
|
||||
if (retro_write_file(path, data, size))
|
||||
RARCH_WARN("Succeeded in saving RAM data to \"%s\".\n", path);
|
||||
else
|
||||
goto error;
|
||||
|
@ -169,7 +171,7 @@ bool save_state(const char *path)
|
|||
ret = pretro_serialize(data, size);
|
||||
|
||||
if (ret)
|
||||
ret = write_file(path, data, size);
|
||||
ret = retro_write_file(path, data, size);
|
||||
|
||||
if (!ret)
|
||||
RARCH_ERR("%s \"%s\".\n",
|
||||
|
@ -332,7 +334,7 @@ void save_ram_file(const char *path, int type)
|
|||
if (size <= 0)
|
||||
return;
|
||||
|
||||
if (!write_file(path, data, size))
|
||||
if (!retro_write_file(path, data, size))
|
||||
{
|
||||
RARCH_ERR("%s.\n",
|
||||
msg_hash_to_str(MSG_FAILED_TO_SAVE_SRAM));
|
||||
|
|
10
core_info.c
|
@ -460,11 +460,13 @@ bool core_info_does_support_file(const core_info_t *core, const char *path)
|
|||
core->supported_extensions_list, ".", path_get_extension(path));
|
||||
}
|
||||
|
||||
const char *core_info_list_get_all_extensions(core_info_list_t *core_info_list)
|
||||
const char *core_info_list_get_all_extensions(void)
|
||||
{
|
||||
if (!core_info_list)
|
||||
return "";
|
||||
return core_info_list->all_ext;
|
||||
global_t *global = global_get_ptr();
|
||||
core_info_list_t *list = (global->core_info.list) ? global->core_info.list : NULL;
|
||||
if (!list)
|
||||
return NULL;
|
||||
return list->all_ext;
|
||||
}
|
||||
|
||||
/* qsort_r() is not in standard C, sadly. */
|
||||
|
|
|
@ -99,7 +99,7 @@ void core_info_list_update_missing_firmware(core_info_list_t *list,
|
|||
bool core_info_list_get_info(core_info_list_t *list,
|
||||
core_info_t *info, const char *path);
|
||||
|
||||
const char *core_info_list_get_all_extensions(core_info_list_t *list);
|
||||
const char *core_info_list_get_all_extensions(void);
|
||||
|
||||
bool core_info_list_get_display_name(core_info_list_t *list,
|
||||
const char *path, char *buf, size_t size);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#define STBI_SUPPORT_ZLIB
|
||||
#endif
|
||||
|
||||
#include "stb_image.h"
|
||||
#include "../deps/stb/stb_image.h"
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#include "internal_cores.h"
|
||||
|
|
|
@ -131,4 +131,85 @@ else ifeq ($(LIBRETRO), snes9x_next)
|
|||
#APP_BANNER = ctr/libretro_banner.png
|
||||
#APP_AUDIO = ctr/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), mgba)
|
||||
APP_TITLE = mGBA Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = Jeffrey Pfau
|
||||
APP_PRODUCT_CODE = RARCH-MGBA
|
||||
APP_UNIQUE_ID = 0xBAC0E
|
||||
APP_ICON = ctr/mgba.png
|
||||
#APP_BANNER = ctr/libretro_banner.png
|
||||
#APP_AUDIO = ctr/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), quicknes)
|
||||
APP_TITLE = QuickNES Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = blargg, kode54
|
||||
APP_PRODUCT_CODE = RARCH-QUICKNES
|
||||
APP_UNIQUE_ID = 0xBAC0F
|
||||
APP_ICON = ctr/quicknes.png
|
||||
#APP_BANNER = ctr/libretro_banner.png
|
||||
#APP_AUDIO = ctr/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), fb_alpha_neo)
|
||||
APP_TITLE = Neo Geo (FB Alpha)
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = Team FB Alpha
|
||||
APP_PRODUCT_CODE = RARCH-FBANEOGEO
|
||||
APP_UNIQUE_ID = 0xBAC10
|
||||
APP_ICON = ctr/fb_alpha_neo.png
|
||||
#APP_BANNER = ctr/libretro_banner.png
|
||||
#APP_AUDIO = ctr/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), fb_alpha_cps1)
|
||||
APP_TITLE = Final Burn Alpha - CPS-1
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = Team FB Alpha
|
||||
APP_PRODUCT_CODE = RARCH-FBACPS1
|
||||
APP_UNIQUE_ID = 0xBAC11
|
||||
APP_ICON = ctr/fb_alpha_cps1.png
|
||||
#APP_BANNER = ctr/libretro_banner.png
|
||||
#APP_AUDIO = ctr/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), fb_alpha_cps2)
|
||||
APP_TITLE = Final Burn Alpha - CPS-2
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = Team FB Alpha
|
||||
APP_PRODUCT_CODE = RARCH-FBACPS2
|
||||
APP_UNIQUE_ID = 0xBAC12
|
||||
APP_ICON = ctr/fb_alpha_cps2.png
|
||||
#APP_BANNER = ctr/libretro_banner.png
|
||||
#APP_AUDIO = ctr/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), catsfc_plus)
|
||||
APP_TITLE = CATSFC Plus Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-CATSFCPLUS
|
||||
APP_UNIQUE_ID = 0xBAC13
|
||||
APP_ICON = ctr/catsfc_plus.png
|
||||
#APP_BANNER = ctr/libretro_banner.png
|
||||
#APP_AUDIO = ctr/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), mednafen_pce_fast)
|
||||
APP_TITLE = Mednafen/Beetle PCE FAST
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = Ryphecha
|
||||
APP_PRODUCT_CODE = RARCH-M-PCE-FAST
|
||||
APP_UNIQUE_ID = 0xBAC14
|
||||
APP_ICON = ctr/mednafen_pce_fast.png
|
||||
#APP_BANNER = ctr/libretro_banner.png
|
||||
#APP_AUDIO = ctr/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), pcsx_rearmed)
|
||||
APP_TITLE = PCSX ReARMed
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = PCSX Team, notaz, Exophase
|
||||
APP_PRODUCT_CODE = RARCH-PCSXRARMD
|
||||
APP_UNIQUE_ID = 0xBAC15
|
||||
APP_ICON = ctr/pcsx_rearmed.png
|
||||
#APP_BANNER = ctr/libretro_banner.png
|
||||
#APP_AUDIO = ctr/silent.wav
|
||||
BUILD_3DSX = 0
|
||||
|
||||
endif
|
||||
|
|
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 668 B |
After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 5.5 KiB |
|
@ -1,7 +1,7 @@
|
|||
BasicInfo:
|
||||
Title : "{APP_TITLE}"
|
||||
Title : "$(APP_TITLE)"
|
||||
CompanyCode : "00"
|
||||
ProductCode : "{APP_PRODUCT_CODE}"
|
||||
ProductCode : "$(APP_PRODUCT_CODE)"
|
||||
ContentType : Application
|
||||
Logo : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem
|
||||
|
||||
|
@ -9,9 +9,8 @@ BasicInfo:
|
|||
# Specifies the root path of the file system to include in the ROM.
|
||||
# HostRoot : "romfs"
|
||||
|
||||
|
||||
TitleInfo:
|
||||
UniqueId : {APP_UNIQUE_ID}
|
||||
UniqueId : $(APP_UNIQUE_ID)
|
||||
Category : Application
|
||||
|
||||
CardInfo:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
BasicInfo:
|
||||
Title : "{APP_TITLE}"
|
||||
Title : "$(APP_TITLE)"
|
||||
CompanyCode : "00"
|
||||
ProductCode : "{APP_PRODUCT_CODE}"
|
||||
ProductCode : "$(APP_PRODUCT_CODE)"
|
||||
ContentType : Application
|
||||
Logo : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem
|
||||
|
||||
|
@ -10,7 +10,7 @@ BasicInfo:
|
|||
# HostRoot : "romfs"
|
||||
|
||||
TitleInfo:
|
||||
UniqueId : {APP_UNIQUE_ID}
|
||||
UniqueId : $(APP_UNIQUE_ID)
|
||||
Category : Application
|
||||
|
||||
CardInfo:
|
||||
|
@ -90,6 +90,7 @@ AccessControlInfo:
|
|||
Priority : 16
|
||||
|
||||
MaxCpu : 0x9E # Default
|
||||
CpuSpeed : 804mhz
|
||||
|
||||
DisableDebug : false
|
||||
EnableForceDebug : false
|
||||
|
|
|
@ -201,7 +201,7 @@ int database_info_build_query(char *s, size_t len,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static char *bin_to_hex_alloc(const uint8_t *data, size_t len)
|
||||
char *bin_to_hex_alloc(const uint8_t *data, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
char *ret = (char*)malloc(len * 2 + 1);
|
||||
|
@ -447,15 +447,18 @@ void database_info_free(database_info_handle_t *db)
|
|||
database_info_list_t *database_info_list_new(
|
||||
const char *rdb_path, const char *query)
|
||||
{
|
||||
libretrodb_t db;
|
||||
libretrodb_cursor_t cur;
|
||||
int ret = 0;
|
||||
unsigned k = 0;
|
||||
database_info_t *database_info = NULL;
|
||||
database_info_list_t *database_info_list = NULL;
|
||||
libretrodb_t *db = libretrodb_new();
|
||||
libretrodb_cursor_t *cur = libretrodb_cursor_new();
|
||||
|
||||
if ((database_cursor_open(&db, &cur, rdb_path, query) != 0))
|
||||
return NULL;
|
||||
if (!db || !cur)
|
||||
goto end;
|
||||
|
||||
if ((database_cursor_open(db, cur, rdb_path, query) != 0))
|
||||
goto end;
|
||||
|
||||
database_info_list = (database_info_list_t*)
|
||||
calloc(1, sizeof(*database_info_list));
|
||||
|
@ -466,7 +469,7 @@ database_info_list_t *database_info_list_new(
|
|||
while (ret != -1)
|
||||
{
|
||||
database_info_t db_info = {0};
|
||||
ret = database_cursor_iterate(&cur, &db_info);
|
||||
ret = database_cursor_iterate(cur, &db_info);
|
||||
|
||||
if (ret == 0)
|
||||
{
|
||||
|
@ -496,7 +499,12 @@ database_info_list_t *database_info_list_new(
|
|||
database_info_list->count = k;
|
||||
|
||||
end:
|
||||
database_cursor_close(&db, &cur);
|
||||
database_cursor_close(db, cur);
|
||||
|
||||
if (db)
|
||||
libretrodb_free(db);
|
||||
if (cur)
|
||||
libretrodb_cursor_free(cur);
|
||||
|
||||
return database_info_list;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ enum database_type
|
|||
DATABASE_TYPE_NONE = 0,
|
||||
DATABASE_TYPE_ITERATE,
|
||||
DATABASE_TYPE_ITERATE_ZIP,
|
||||
DATABASE_TYPE_SERIAL_LOOKUP,
|
||||
DATABASE_TYPE_CRC_LOOKUP
|
||||
};
|
||||
|
||||
|
@ -112,6 +113,8 @@ void database_info_free(database_info_handle_t *handle);
|
|||
int database_info_build_query(
|
||||
char *query, size_t len, const char *label, const char *path);
|
||||
|
||||
char *bin_to_hex_alloc(const uint8_t *data, size_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,46 +1,43 @@
|
|||
// stb_rect_pack.h - v0.06 - public domain - rectangle packing
|
||||
// Sean Barrett 2014
|
||||
//
|
||||
// Useful for e.g. packing rectangular textures into an atlas.
|
||||
// Does not do rotation.
|
||||
//
|
||||
// Not necessarily the awesomest packing method, but better than
|
||||
// the totally naive one in stb_truetype (which is primarily what
|
||||
// this is meant to replace).
|
||||
//
|
||||
// Has only had a few tests run, may have issues.
|
||||
//
|
||||
// More docs to come.
|
||||
//
|
||||
// No memory allocations; uses qsort() and assert() from stdlib.
|
||||
// Can override those by defining STBRP_SORT and STBRP_ASSERT.
|
||||
//
|
||||
// This library currently uses the Skyline Bottom-Left algorithm.
|
||||
//
|
||||
// Please note: better rectangle packers are welcome! Please
|
||||
// implement them to the same API, but with a different init
|
||||
// function.
|
||||
//
|
||||
// Credits
|
||||
//
|
||||
// Library
|
||||
// Sean Barrett
|
||||
// Minor features
|
||||
// Martins Mozeiko
|
||||
// Bugfixes / warning fixes
|
||||
// [your name could be here]
|
||||
//
|
||||
// Version history:
|
||||
//
|
||||
// 0.06 (2015-04-15) added STBRP_SORT to allow replacing qsort
|
||||
// 0.05: added STBRP_ASSERT to allow replacing assert
|
||||
// 0.04: fixed minor bug in STBRP_LARGE_RECTS support
|
||||
// 0.01: initial release
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// INCLUDE SECTION
|
||||
//
|
||||
/*
|
||||
* stb_rect_pack.h - v0.06 - public domain - rectangle packing
|
||||
* Sean Barrett 2014
|
||||
*
|
||||
* Useful for e.g. packing rectangular textures into an atlas.
|
||||
* Does not do rotation.
|
||||
*
|
||||
* Not necessarily the awesomest packing method, but better than
|
||||
* the totally naive one in stb_truetype (which is primarily what
|
||||
* this is meant to replace).
|
||||
*
|
||||
* Has only had a few tests run, may have issues.
|
||||
*
|
||||
* More docs to come.
|
||||
*
|
||||
* No memory allocations; uses qsort() and assert() from stdlib.
|
||||
* Can override those by defining STBRP_SORT and STBRP_ASSERT.
|
||||
*
|
||||
* This library currently uses the Skyline Bottom-Left algorithm.
|
||||
*
|
||||
* Please note: better rectangle packers are welcome! Please
|
||||
* implement them to the same API, but with a different init
|
||||
* function.
|
||||
*
|
||||
* Credits
|
||||
*
|
||||
* Library
|
||||
* Sean Barrett
|
||||
* Minor features
|
||||
* Martins Mozeiko
|
||||
* Bugfixes / warning fixes
|
||||
* [your name could be here]
|
||||
*
|
||||
* Version history:
|
||||
*
|
||||
* 0.06 (2015-04-15) added STBRP_SORT to allow replacing qsort
|
||||
* 0.05: added STBRP_ASSERT to allow replacing assert
|
||||
* 0.04: fixed minor bug in STBRP_LARGE_RECTS support
|
||||
* 0.01: initial release
|
||||
*/
|
||||
|
||||
#ifndef STB_INCLUDE_STB_RECT_PACK_H
|
||||
#define STB_INCLUDE_STB_RECT_PACK_H
|
||||
|
@ -67,87 +64,89 @@ typedef int stbrp_coord;
|
|||
typedef unsigned short stbrp_coord;
|
||||
#endif
|
||||
|
||||
STBRP_DEF void stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int num_rects);
|
||||
// Assign packed locations to rectangles. The rectangles are of type
|
||||
// 'stbrp_rect' defined below, stored in the array 'rects', and there
|
||||
// are 'num_rects' many of them.
|
||||
//
|
||||
// Rectangles which are successfully packed have the 'was_packed' flag
|
||||
// set to a non-zero value and 'x' and 'y' store the minimum location
|
||||
// on each axis (i.e. bottom-left in cartesian coordinates, top-left
|
||||
// if you imagine y increasing downwards). Rectangles which do not fit
|
||||
// have the 'was_packed' flag set to 0.
|
||||
//
|
||||
// You should not try to access the 'rects' array from another thread
|
||||
// while this function is running, as the function temporarily reorders
|
||||
// the array while it executes.
|
||||
//
|
||||
// To pack into another rectangle, you need to call stbrp_init_target
|
||||
// again. To continue packing into the same rectangle, you can call
|
||||
// this function again. Calling this multiple times with multiple rect
|
||||
// arrays will probably produce worse packing results than calling it
|
||||
// a single time with the full rectangle array, but the option is
|
||||
// available.
|
||||
STBRP_DEF void stbrp_pack_rects (stbrp_context *context,
|
||||
stbrp_rect *rects, int num_rects);
|
||||
|
||||
/* Assign packed locations to rectangles. The rectangles are of type
|
||||
* 'stbrp_rect' defined below, stored in the array 'rects', and there
|
||||
* are 'num_rects' many of them.
|
||||
*
|
||||
* Rectangles which are successfully packed have the 'was_packed' flag
|
||||
* set to a non-zero value and 'x' and 'y' store the minimum location
|
||||
* on each axis (i.e. bottom-left in cartesian coordinates, top-left
|
||||
* if you imagine y increasing downwards). Rectangles which do not fit
|
||||
* have the 'was_packed' flag set to 0.
|
||||
*
|
||||
* You should not try to access the 'rects' array from another thread
|
||||
* while this function is running, as the function temporarily reorders
|
||||
* the array while it executes.
|
||||
*
|
||||
* To pack into another rectangle, you need to call stbrp_init_target
|
||||
* again. To continue packing into the same rectangle, you can call
|
||||
* this function again. Calling this multiple times with multiple rect
|
||||
* arrays will probably produce worse packing results than calling it
|
||||
* a single time with the full rectangle array, but the option is
|
||||
* available.
|
||||
*/
|
||||
|
||||
struct stbrp_rect
|
||||
{
|
||||
// reserved for your use:
|
||||
int id;
|
||||
|
||||
// input:
|
||||
stbrp_coord w, h;
|
||||
|
||||
// output:
|
||||
stbrp_coord x, y;
|
||||
int was_packed; // non-zero if valid packing
|
||||
|
||||
}; // 16 bytes, nominally
|
||||
int id; /* reserved for your use: */
|
||||
stbrp_coord w, h; /* input: */
|
||||
stbrp_coord x, y; /* output: */
|
||||
int was_packed; /* non-zero if valid packing */
|
||||
}; /* 16 bytes, nominally */
|
||||
|
||||
|
||||
STBRP_DEF void stbrp_init_target (stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes);
|
||||
// Initialize a rectangle packer to:
|
||||
// pack a rectangle that is 'width' by 'height' in dimensions
|
||||
// using temporary storage provided by the array 'nodes', which is 'num_nodes' long
|
||||
//
|
||||
// You must call this function every time you start packing into a new target.
|
||||
//
|
||||
// There is no "shutdown" function. The 'nodes' memory must stay valid for
|
||||
// the following stbrp_pack_rects() call (or calls), but can be freed after
|
||||
// the call (or calls) finish.
|
||||
//
|
||||
// Note: to guarantee best results, either:
|
||||
// 1. make sure 'num_nodes' >= 'width'
|
||||
// or 2. call stbrp_allow_out_of_mem() defined below with 'allow_out_of_mem = 1'
|
||||
//
|
||||
// If you don't do either of the above things, widths will be quantized to multiples
|
||||
// of small integers to guarantee the algorithm doesn't run out of temporary storage.
|
||||
//
|
||||
// If you do #2, then the non-quantized algorithm will be used, but the algorithm
|
||||
// may run out of temporary storage and be unable to pack some rectangles.
|
||||
STBRP_DEF void stbrp_init_target (stbrp_context *context,
|
||||
int width, int height, stbrp_node *nodes, int num_nodes);
|
||||
|
||||
/* Initialize a rectangle packer to:
|
||||
* pack a rectangle that is 'width' by 'height' in dimensions
|
||||
* using temporary storage provided by the array 'nodes', which is 'num_nodes' long
|
||||
*
|
||||
* You must call this function every time you start packing into a new target.
|
||||
*
|
||||
* There is no "shutdown" function. The 'nodes' memory must stay valid for
|
||||
* the following stbrp_pack_rects() call (or calls), but can be freed after
|
||||
* the call (or calls) finish.
|
||||
*
|
||||
* Note: to guarantee best results, either:
|
||||
* 1. make sure 'num_nodes' >= 'width'
|
||||
* or 2. call stbrp_allow_out_of_mem() defined below with 'allow_out_of_mem = 1'
|
||||
*
|
||||
* If you don't do either of the above things, widths will be quantized to multiples
|
||||
* of small integers to guarantee the algorithm doesn't run out of temporary storage.
|
||||
*
|
||||
* If you do #2, then the non-quantized algorithm will be used, but the algorithm
|
||||
* may run out of temporary storage and be unable to pack some rectangles.
|
||||
*/
|
||||
|
||||
STBRP_DEF void stbrp_setup_allow_out_of_mem (stbrp_context *context, int allow_out_of_mem);
|
||||
// Optionally call this function after init but before doing any packing to
|
||||
// change the handling of the out-of-temp-memory scenario, described above.
|
||||
// If you call init again, this will be reset to the default (false).
|
||||
|
||||
/* Optionally call this function after init but before doing any packing to
|
||||
* change the handling of the out-of-temp-memory scenario, described above.
|
||||
* If you call init again, this will be reset to the default (false).
|
||||
*/
|
||||
|
||||
|
||||
STBRP_DEF void stbrp_setup_heuristic (stbrp_context *context, int heuristic);
|
||||
// Optionally select which packing heuristic the library should use. Different
|
||||
// heuristics will produce better/worse results for different data sets.
|
||||
// If you call init again, this will be reset to the default.
|
||||
|
||||
/* Optionally select which packing heuristic the library should use. Different
|
||||
* heuristics will produce better/worse results for different data sets.
|
||||
* If you call init again, this will be reset to the default.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
STBRP_HEURISTIC_Skyline_default=0,
|
||||
STBRP_HEURISTIC_Skyline_BL_sortHeight = STBRP_HEURISTIC_Skyline_default,
|
||||
STBRP_HEURISTIC_Skyline_BF_sortHeight,
|
||||
STBRP_HEURISTIC_Skyline_BF_sortHeight
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// the details of the following structures don't matter to you, but they must
|
||||
// be visible so you can handle the memory allocations for them
|
||||
/* the details of the following structures don't matter to you, but they must
|
||||
* be visible so you can handle the memory allocations for them
|
||||
*/
|
||||
|
||||
struct stbrp_node
|
||||
{
|
||||
|
@ -165,7 +164,7 @@ struct stbrp_context
|
|||
int num_nodes;
|
||||
stbrp_node *active_head;
|
||||
stbrp_node *free_head;
|
||||
stbrp_node extra[2]; // we allocate two extra nodes so optimal user-node-count is 'width' not 'width+2'
|
||||
stbrp_node extra[2]; /* we allocate two extra nodes so optimal user-node-count is 'width' not 'width+2' */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -174,10 +173,7 @@ struct stbrp_context
|
|||
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPLEMENTATION SECTION
|
||||
//
|
||||
/* IMPLEMENTATION SECTION */
|
||||
|
||||
#ifdef STB_RECT_PACK_IMPLEMENTATION
|
||||
#ifndef STBRP_SORT
|
||||
|
@ -192,12 +188,13 @@ struct stbrp_context
|
|||
|
||||
enum
|
||||
{
|
||||
STBRP__INIT_skyline = 1,
|
||||
STBRP__INIT_skyline = 1
|
||||
};
|
||||
|
||||
STBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic)
|
||||
{
|
||||
switch (context->init_mode) {
|
||||
switch (context->init_mode)
|
||||
{
|
||||
case STBRP__INIT_skyline:
|
||||
STBRP_ASSERT(heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight || heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight);
|
||||
context->heuristic = heuristic;
|
||||
|
@ -209,20 +206,22 @@ STBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic)
|
|||
|
||||
STBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context *context, int allow_out_of_mem)
|
||||
{
|
||||
/* if it's ok to run out of memory, then don't bother aligning them;
|
||||
* this gives better packing, but may fail due to OOM (even though
|
||||
* the rectangles easily fit). @TODO a smarter approach would be to only
|
||||
* quantize once we've hit OOM, then we could get rid of this parameter.
|
||||
*/
|
||||
if (allow_out_of_mem)
|
||||
// if it's ok to run out of memory, then don't bother aligning them;
|
||||
// this gives better packing, but may fail due to OOM (even though
|
||||
// the rectangles easily fit). @TODO a smarter approach would be to only
|
||||
// quantize once we've hit OOM, then we could get rid of this parameter.
|
||||
context->align = 1;
|
||||
else {
|
||||
// if it's not ok to run out of memory, then quantize the widths
|
||||
// so that num_nodes is always enough nodes.
|
||||
//
|
||||
// I.e. num_nodes * align >= width
|
||||
// align >= width / num_nodes
|
||||
// align = ceil(width/num_nodes)
|
||||
|
||||
else
|
||||
{
|
||||
/* if it's not ok to run out of memory, then quantize the widths
|
||||
* so that num_nodes is always enough nodes.
|
||||
*
|
||||
* I.e. num_nodes * align >= width
|
||||
* align >= width / num_nodes
|
||||
* align = ceil(width/num_nodes)
|
||||
*/
|
||||
context->align = (context->width + context->num_nodes-1) / context->num_nodes;
|
||||
}
|
||||
}
|
||||
|
@ -246,7 +245,8 @@ STBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int height,
|
|||
context->num_nodes = num_nodes;
|
||||
stbrp_setup_allow_out_of_mem(context, 0);
|
||||
|
||||
// node 0 is the full width, node 1 is the sentinel (lets us not store width explicitly)
|
||||
/* node 0 is the full width,
|
||||
* node 1 is the sentinel (lets us not store width explicitly) */
|
||||
context->extra[0].x = 0;
|
||||
context->extra[0].y = 0;
|
||||
context->extra[0].next = &context->extra[1];
|
||||
|
@ -259,41 +259,41 @@ STBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int height,
|
|||
context->extra[1].next = NULL;
|
||||
}
|
||||
|
||||
// find minimum y position if it starts at x1
|
||||
static int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first, int x0, int width, int *pwaste)
|
||||
/* Find minimum y position if it starts at x1 */
|
||||
static int stbrp__skyline_find_min_y(stbrp_context *c,
|
||||
stbrp_node *first, int x0, int width, int *pwaste)
|
||||
{
|
||||
int min_y, visited_width, waste_area;
|
||||
stbrp_node *node = first;
|
||||
int x1 = x0 + width;
|
||||
int min_y, visited_width, waste_area;
|
||||
|
||||
STBRP_ASSERT(first->x <= x0);
|
||||
|
||||
#if 0
|
||||
// skip in case we're past the node
|
||||
while (node->next->x <= x0)
|
||||
++node;
|
||||
#else
|
||||
STBRP_ASSERT(node->next->x > x0); // we ended up handling this in the caller for efficiency
|
||||
#endif
|
||||
|
||||
STBRP_ASSERT(node->next->x > x0);
|
||||
STBRP_ASSERT(node->x <= x0);
|
||||
|
||||
min_y = 0;
|
||||
waste_area = 0;
|
||||
visited_width = 0;
|
||||
while (node->x < x1) {
|
||||
if (node->y > min_y) {
|
||||
// raise min_y higher.
|
||||
// we've accounted for all waste up to min_y,
|
||||
// but we'll now add more waste for everything we've visted
|
||||
while (node->x < x1)
|
||||
{
|
||||
if (node->y > min_y)
|
||||
{
|
||||
/* raise min_y higher.
|
||||
* we've accounted for all waste up to min_y,
|
||||
* but we'll now add more waste for everything we've visted
|
||||
*/
|
||||
waste_area += visited_width * (node->y - min_y);
|
||||
min_y = node->y;
|
||||
// the first time through, visited_width might be reduced
|
||||
|
||||
/* the first time through, visited_width might be reduced */
|
||||
if (node->x < x0)
|
||||
visited_width += node->next->x - x0;
|
||||
else
|
||||
visited_width += node->next->x - node->x;
|
||||
} else {
|
||||
// add waste area
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add waste area */
|
||||
int under_width = node->next->x - node->x;
|
||||
if (under_width + visited_width > width)
|
||||
under_width = width - visited_width;
|
||||
|
@ -319,27 +319,35 @@ static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int widt
|
|||
stbrp__findresult fr;
|
||||
stbrp_node **prev, *node, *tail, **best = NULL;
|
||||
|
||||
// align to multiple of c->align
|
||||
/* align to multiple of c->align */
|
||||
width = (width + c->align - 1);
|
||||
width -= width % c->align;
|
||||
STBRP_ASSERT(width % c->align == 0);
|
||||
|
||||
node = c->active_head;
|
||||
prev = &c->active_head;
|
||||
while (node->x + width <= c->width) {
|
||||
int y,waste;
|
||||
y = stbrp__skyline_find_min_y(c, node, node->x, width, &waste);
|
||||
if (c->heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight) { // actually just want to test BL
|
||||
// bottom left
|
||||
if (y < best_y) {
|
||||
while (node->x + width <= c->width)
|
||||
{
|
||||
int waste;
|
||||
int y = stbrp__skyline_find_min_y(c, node, node->x, width, &waste);
|
||||
|
||||
if (c->heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight)
|
||||
{
|
||||
/* actually just want to test BL bottom left */
|
||||
if (y < best_y)
|
||||
{
|
||||
best_y = y;
|
||||
best = prev;
|
||||
}
|
||||
} else {
|
||||
// best-fit
|
||||
if (y + height <= c->height) {
|
||||
// can only use it if it first vertically
|
||||
if (y < best_y || (y == best_y && waste < best_waste)) {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* best-fit */
|
||||
if (y + height <= c->height)
|
||||
{
|
||||
/* can only use it if it first vertically */
|
||||
if (y < best_y || (y == best_y && waste < best_waste))
|
||||
{
|
||||
best_y = y;
|
||||
best_waste = waste;
|
||||
best = prev;
|
||||
|
@ -352,44 +360,54 @@ static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int widt
|
|||
|
||||
best_x = (best == NULL) ? 0 : (*best)->x;
|
||||
|
||||
// if doing best-fit (BF), we also have to try aligning right edge to each node position
|
||||
//
|
||||
// e.g, if fitting
|
||||
//
|
||||
// ____________________
|
||||
// |____________________|
|
||||
//
|
||||
// into
|
||||
//
|
||||
// | |
|
||||
// | ____________|
|
||||
// |____________|
|
||||
//
|
||||
// then right-aligned reduces waste, but bottom-left BL is always chooses left-aligned
|
||||
//
|
||||
// This makes BF take about 2x the time
|
||||
/* if doing best-fit (BF), we also have to try aligning right edge to each node position
|
||||
*
|
||||
* e.g, if fitting
|
||||
*
|
||||
* ____________________
|
||||
* |____________________|
|
||||
*
|
||||
* into
|
||||
*
|
||||
* | |
|
||||
* | ____________|
|
||||
* |____________|
|
||||
*
|
||||
* then right-aligned reduces waste, but bottom-left BL is always chooses left-aligned
|
||||
*
|
||||
* This makes BF take about 2x the time
|
||||
*/
|
||||
|
||||
if (c->heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight) {
|
||||
if (c->heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight)
|
||||
{
|
||||
tail = c->active_head;
|
||||
node = c->active_head;
|
||||
prev = &c->active_head;
|
||||
// find first node that's admissible
|
||||
/* find first node that's admissible */
|
||||
while (tail->x < width)
|
||||
tail = tail->next;
|
||||
while (tail) {
|
||||
while (tail)
|
||||
{
|
||||
int xpos = tail->x - width;
|
||||
int y,waste;
|
||||
STBRP_ASSERT(xpos >= 0);
|
||||
// find the left position that matches this
|
||||
while (node->next->x <= xpos) {
|
||||
|
||||
/* find the left position that matches this */
|
||||
while (node->next->x <= xpos)
|
||||
{
|
||||
prev = &node->next;
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
STBRP_ASSERT(node->next->x > xpos && node->x <= xpos);
|
||||
y = stbrp__skyline_find_min_y(c, node, xpos, width, &waste);
|
||||
if (y + height < c->height) {
|
||||
if (y <= best_y) {
|
||||
if (y < best_y || waste < best_waste || (waste==best_waste && xpos < best_x)) {
|
||||
|
||||
if (y + height < c->height)
|
||||
{
|
||||
if (y <= best_y)
|
||||
{
|
||||
if (y < best_y || waste < best_waste || (waste==best_waste && xpos < best_x))
|
||||
{
|
||||
best_x = xpos;
|
||||
STBRP_ASSERT(y <= best_y);
|
||||
best_y = y;
|
||||
|
@ -410,83 +428,62 @@ static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int widt
|
|||
|
||||
static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, int width, int height)
|
||||
{
|
||||
// find best position according to heuristic
|
||||
stbrp__findresult res = stbrp__skyline_find_best_pos(context, width, height);
|
||||
/* find best position according to heuristic */
|
||||
stbrp_node *node, *cur;
|
||||
stbrp__findresult res = stbrp__skyline_find_best_pos(context, width, height);
|
||||
|
||||
// bail if:
|
||||
// 1. it failed
|
||||
// 2. the best node doesn't fit (we don't always check this)
|
||||
// 3. we're out of memory
|
||||
if (res.prev_link == NULL || res.y + height > context->height || context->free_head == NULL) {
|
||||
/* bail if:
|
||||
* 1. it failed
|
||||
* 2. the best node doesn't fit (we don't always check this)
|
||||
* 3. we're out of memory
|
||||
*/
|
||||
if (res.prev_link == NULL || res.y + height > context->height || context->free_head == NULL)
|
||||
{
|
||||
res.prev_link = NULL;
|
||||
return res;
|
||||
}
|
||||
|
||||
// on success, create new node
|
||||
/* on success, create new node */
|
||||
node = context->free_head;
|
||||
node->x = (stbrp_coord) res.x;
|
||||
node->y = (stbrp_coord) (res.y + height);
|
||||
|
||||
context->free_head = node->next;
|
||||
|
||||
// insert the new node into the right starting point, and
|
||||
// let 'cur' point to the remaining nodes needing to be
|
||||
// stiched back in
|
||||
/* insert the new node into the right starting point, and
|
||||
* let 'cur' point to the remaining nodes needing to be
|
||||
* stiched back in
|
||||
*/
|
||||
|
||||
cur = *res.prev_link;
|
||||
if (cur->x < res.x) {
|
||||
// preserve the existing one, so start testing with the next one
|
||||
if (cur->x < res.x)
|
||||
{
|
||||
/* preserve the existing one, so start testing with the next one */
|
||||
stbrp_node *next = cur->next;
|
||||
cur->next = node;
|
||||
cur = next;
|
||||
} else {
|
||||
*res.prev_link = node;
|
||||
}
|
||||
else
|
||||
*res.prev_link = node;
|
||||
|
||||
// from here, traverse cur and free the nodes, until we get to one
|
||||
// that shouldn't be freed
|
||||
while (cur->next && cur->next->x <= res.x + width) {
|
||||
/* from here, traverse cur and free the nodes, until we get to one
|
||||
* that shouldn't be freed */
|
||||
while (cur->next && cur->next->x <= res.x + width)
|
||||
{
|
||||
stbrp_node *next = cur->next;
|
||||
// move the current node to the free list
|
||||
|
||||
/* move the current node to the free list */
|
||||
cur->next = context->free_head;
|
||||
context->free_head = cur;
|
||||
cur = next;
|
||||
}
|
||||
|
||||
// stitch the list back in
|
||||
/* stitch the list back in */
|
||||
node->next = cur;
|
||||
|
||||
if (cur->x < res.x + width)
|
||||
cur->x = (stbrp_coord) (res.x + width);
|
||||
|
||||
#ifdef _DEBUG
|
||||
cur = context->active_head;
|
||||
while (cur->x < context->width) {
|
||||
STBRP_ASSERT(cur->x < cur->next->x);
|
||||
cur = cur->next;
|
||||
}
|
||||
STBRP_ASSERT(cur->next == NULL);
|
||||
|
||||
{
|
||||
stbrp_node *L1 = NULL, *L2 = NULL;
|
||||
int count=0;
|
||||
cur = context->active_head;
|
||||
while (cur) {
|
||||
L1 = cur;
|
||||
cur = cur->next;
|
||||
++count;
|
||||
}
|
||||
cur = context->free_head;
|
||||
while (cur) {
|
||||
L2 = cur;
|
||||
cur = cur->next;
|
||||
++count;
|
||||
}
|
||||
STBRP_ASSERT(count == context->num_nodes+2);
|
||||
}
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -529,20 +526,23 @@ STBRP_DEF void stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int n
|
|||
{
|
||||
int i;
|
||||
|
||||
// we use the 'was_packed' field internally to allow sorting/unsorting
|
||||
for (i=0; i < num_rects; ++i) {
|
||||
/* we use the 'was_packed' field internally to allow sorting/unsorting */
|
||||
for (i=0; i < num_rects; ++i)
|
||||
{
|
||||
rects[i].was_packed = i;
|
||||
#ifndef STBRP_LARGE_RECTS
|
||||
STBRP_ASSERT(rects[i].w <= 0xffff && rects[i].h <= 0xffff);
|
||||
#endif
|
||||
}
|
||||
|
||||
// sort according to heuristic
|
||||
/* sort according to heuristic */
|
||||
STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_height_compare);
|
||||
|
||||
for (i=0; i < num_rects; ++i) {
|
||||
for (i=0; i < num_rects; ++i)
|
||||
{
|
||||
stbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h);
|
||||
if (fr.prev_link) {
|
||||
if (fr.prev_link)
|
||||
{
|
||||
rects[i].x = (stbrp_coord) fr.x;
|
||||
rects[i].y = (stbrp_coord) fr.y;
|
||||
} else {
|
||||
|
@ -550,10 +550,10 @@ STBRP_DEF void stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int n
|
|||
}
|
||||
}
|
||||
|
||||
// unsort
|
||||
/* unsort */
|
||||
STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order);
|
||||
|
||||
// set was_packed flags
|
||||
/* set was_packed flags */
|
||||
for (i=0; i < num_rects; ++i)
|
||||
rects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ struct string_list *dir_list_new_special(const char *input_dir, enum dir_list_ty
|
|||
const char *exts = NULL;
|
||||
bool include_dirs = false;
|
||||
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)input_dir;
|
||||
|
@ -39,7 +38,7 @@ struct string_list *dir_list_new_special(const char *input_dir, enum dir_list_ty
|
|||
break;
|
||||
case DIR_LIST_CORE_INFO:
|
||||
dir = input_dir;
|
||||
exts = (global->core_info.list) ? core_info_list_get_all_extensions(global->core_info.list) : NULL;
|
||||
exts = core_info_list_get_all_extensions();
|
||||
break;
|
||||
case DIR_LIST_SHADERS:
|
||||
dir = settings->video.shader_dir;
|
||||
|
|
|
@ -13,8 +13,8 @@ EXT=a
|
|||
|
||||
mkdir -p ../pkg/${platform}/cores/
|
||||
|
||||
make -C ../${platform}/kernel_functions_prx/ clean || exit 1
|
||||
make -C ../${platform}/kernel_functions_prx/ || exit 1
|
||||
make -C ../bootstrap/${platform}/kernel_functions_prx/ clean || exit 1
|
||||
make -C ../bootstrap/${platform}/kernel_functions_prx/ || exit 1
|
||||
cp -f ../kernel_functions.prx ../pkg/${platform}/kernel_functions.prx
|
||||
|
||||
# Vita
|
||||
|
@ -158,7 +158,7 @@ for f in *_${platform}.${EXT} ; do
|
|||
# Move executable files
|
||||
if [ $platform = "ps3" ] ; then
|
||||
if [ $PLATFORM = "ode-ps3" ] ; then
|
||||
mv -f ../CORE.SELF ../${platform}/iso/PS3_GAME/USRDIR/cores/"${name}_libretro_${platform}.SELF"
|
||||
mv -f ../CORE.SELF ../pkg/${platform}_iso/PS3_GAME/USRDIR/cores/"${name}_libretro_${platform}.SELF"
|
||||
else
|
||||
mv -f ../CORE.SELF ../pkg/${platform}/USRDIR/cores/"${name}_libretro_${platform}.SELF"
|
||||
fi
|
||||
|
@ -227,8 +227,8 @@ elif [ $PLATFORM = "cex-ps3" ] ; then
|
|||
rm -rf ../retroarch-salamander_${platform}.elf
|
||||
python2 ../ps3/ps3py/pkg.py --contentid UP0001-SSNE10000_00-0000000000000001 ../pkg/${platform} retroarch-${platform}-cfw-$RARCH_VERSION.pkg
|
||||
elif [ $PLATFORM = "ode-ps3" ] ; then
|
||||
$SCETOOL_PATH $SCETOOL_FLAGS --encrypt ../retroarch-salamander_${platform}.elf ../${platform}/iso/PS3_GAME/USRDIR/EBOOT.BIN
|
||||
$SCETOOL_PATH $SCETOOL_FLAGS --encrypt ../retroarch-salamander_${platform}.elf ../pkg/${platform}_iso/PS3_GAME/USRDIR/EBOOT.BIN
|
||||
rm -rf ../retroarch-salamander_${platform}.elf
|
||||
|
||||
$GENPS3ISO_PATH ../${platform}/iso RetroArch-COBRA-ODE.iso
|
||||
$GENPS3ISO_PATH ../pkg/${platform}_iso/RetroArch-COBRA-ODE.iso
|
||||
fi
|
||||
|
|
224
dynamic.c
|
@ -17,12 +17,13 @@
|
|||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <file/file_path.h>
|
||||
#include <retro_log.h>
|
||||
#include <compat/strl.h>
|
||||
#include <compat/posix_string.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
@ -39,8 +40,7 @@
|
|||
#include "input/input_sensor.h"
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
#undef SYM
|
||||
#define SYM(x) do { \
|
||||
#define SYMBOL(x) do { \
|
||||
function_t func = dylib_proc(lib_handle, #x); \
|
||||
memcpy(&p##x, &func, sizeof(func)); \
|
||||
if (p##x == NULL) { RARCH_ERR("Failed to load symbol: \"%s\"\n", #x); rarch_fail(1, "init_libretro_sym()"); } \
|
||||
|
@ -48,17 +48,17 @@
|
|||
|
||||
static dylib_t lib_handle;
|
||||
#else
|
||||
#define SYM(x) p##x = x
|
||||
#define SYMBOL(x) p##x = x
|
||||
#endif
|
||||
|
||||
#define SYM_DUMMY(x) p##x = libretro_dummy_##x
|
||||
#define SYMBOL_DUMMY(x) p##x = libretro_dummy_##x
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
#define SYM_FFMPEG(x) p##x = libretro_ffmpeg_##x
|
||||
#define SYMBOL_FFMPEG(x) p##x = libretro_ffmpeg_##x
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
#define SYM_IMAGEVIEWER(x) p##x = libretro_imageviewer_##x
|
||||
#define SYMBOL_IMAGEVIEWER(x) p##x = libretro_imageviewer_##x
|
||||
#endif
|
||||
|
||||
void (*pretro_init)(void);
|
||||
|
@ -333,147 +333,147 @@ static void load_symbols(enum rarch_core_type type)
|
|||
#endif
|
||||
}
|
||||
|
||||
SYM(retro_init);
|
||||
SYM(retro_deinit);
|
||||
SYMBOL(retro_init);
|
||||
SYMBOL(retro_deinit);
|
||||
|
||||
SYM(retro_api_version);
|
||||
SYM(retro_get_system_info);
|
||||
SYM(retro_get_system_av_info);
|
||||
SYMBOL(retro_api_version);
|
||||
SYMBOL(retro_get_system_info);
|
||||
SYMBOL(retro_get_system_av_info);
|
||||
|
||||
SYM(retro_set_environment);
|
||||
SYM(retro_set_video_refresh);
|
||||
SYM(retro_set_audio_sample);
|
||||
SYM(retro_set_audio_sample_batch);
|
||||
SYM(retro_set_input_poll);
|
||||
SYM(retro_set_input_state);
|
||||
SYMBOL(retro_set_environment);
|
||||
SYMBOL(retro_set_video_refresh);
|
||||
SYMBOL(retro_set_audio_sample);
|
||||
SYMBOL(retro_set_audio_sample_batch);
|
||||
SYMBOL(retro_set_input_poll);
|
||||
SYMBOL(retro_set_input_state);
|
||||
|
||||
SYM(retro_set_controller_port_device);
|
||||
SYMBOL(retro_set_controller_port_device);
|
||||
|
||||
SYM(retro_reset);
|
||||
SYM(retro_run);
|
||||
SYMBOL(retro_reset);
|
||||
SYMBOL(retro_run);
|
||||
|
||||
SYM(retro_serialize_size);
|
||||
SYM(retro_serialize);
|
||||
SYM(retro_unserialize);
|
||||
SYMBOL(retro_serialize_size);
|
||||
SYMBOL(retro_serialize);
|
||||
SYMBOL(retro_unserialize);
|
||||
|
||||
SYM(retro_cheat_reset);
|
||||
SYM(retro_cheat_set);
|
||||
SYMBOL(retro_cheat_reset);
|
||||
SYMBOL(retro_cheat_set);
|
||||
|
||||
SYM(retro_load_game);
|
||||
SYM(retro_load_game_special);
|
||||
SYMBOL(retro_load_game);
|
||||
SYMBOL(retro_load_game_special);
|
||||
|
||||
SYM(retro_unload_game);
|
||||
SYM(retro_get_region);
|
||||
SYM(retro_get_memory_data);
|
||||
SYM(retro_get_memory_size);
|
||||
SYMBOL(retro_unload_game);
|
||||
SYMBOL(retro_get_region);
|
||||
SYMBOL(retro_get_memory_data);
|
||||
SYMBOL(retro_get_memory_size);
|
||||
break;
|
||||
case CORE_TYPE_DUMMY:
|
||||
SYM_DUMMY(retro_init);
|
||||
SYM_DUMMY(retro_deinit);
|
||||
SYMBOL_DUMMY(retro_init);
|
||||
SYMBOL_DUMMY(retro_deinit);
|
||||
|
||||
SYM_DUMMY(retro_api_version);
|
||||
SYM_DUMMY(retro_get_system_info);
|
||||
SYM_DUMMY(retro_get_system_av_info);
|
||||
SYMBOL_DUMMY(retro_api_version);
|
||||
SYMBOL_DUMMY(retro_get_system_info);
|
||||
SYMBOL_DUMMY(retro_get_system_av_info);
|
||||
|
||||
SYM_DUMMY(retro_set_environment);
|
||||
SYM_DUMMY(retro_set_video_refresh);
|
||||
SYM_DUMMY(retro_set_audio_sample);
|
||||
SYM_DUMMY(retro_set_audio_sample_batch);
|
||||
SYM_DUMMY(retro_set_input_poll);
|
||||
SYM_DUMMY(retro_set_input_state);
|
||||
SYMBOL_DUMMY(retro_set_environment);
|
||||
SYMBOL_DUMMY(retro_set_video_refresh);
|
||||
SYMBOL_DUMMY(retro_set_audio_sample);
|
||||
SYMBOL_DUMMY(retro_set_audio_sample_batch);
|
||||
SYMBOL_DUMMY(retro_set_input_poll);
|
||||
SYMBOL_DUMMY(retro_set_input_state);
|
||||
|
||||
SYM_DUMMY(retro_set_controller_port_device);
|
||||
SYMBOL_DUMMY(retro_set_controller_port_device);
|
||||
|
||||
SYM_DUMMY(retro_reset);
|
||||
SYM_DUMMY(retro_run);
|
||||
SYMBOL_DUMMY(retro_reset);
|
||||
SYMBOL_DUMMY(retro_run);
|
||||
|
||||
SYM_DUMMY(retro_serialize_size);
|
||||
SYM_DUMMY(retro_serialize);
|
||||
SYM_DUMMY(retro_unserialize);
|
||||
SYMBOL_DUMMY(retro_serialize_size);
|
||||
SYMBOL_DUMMY(retro_serialize);
|
||||
SYMBOL_DUMMY(retro_unserialize);
|
||||
|
||||
SYM_DUMMY(retro_cheat_reset);
|
||||
SYM_DUMMY(retro_cheat_set);
|
||||
SYMBOL_DUMMY(retro_cheat_reset);
|
||||
SYMBOL_DUMMY(retro_cheat_set);
|
||||
|
||||
SYM_DUMMY(retro_load_game);
|
||||
SYM_DUMMY(retro_load_game_special);
|
||||
SYMBOL_DUMMY(retro_load_game);
|
||||
SYMBOL_DUMMY(retro_load_game_special);
|
||||
|
||||
SYM_DUMMY(retro_unload_game);
|
||||
SYM_DUMMY(retro_get_region);
|
||||
SYM_DUMMY(retro_get_memory_data);
|
||||
SYM_DUMMY(retro_get_memory_size);
|
||||
SYMBOL_DUMMY(retro_unload_game);
|
||||
SYMBOL_DUMMY(retro_get_region);
|
||||
SYMBOL_DUMMY(retro_get_memory_data);
|
||||
SYMBOL_DUMMY(retro_get_memory_size);
|
||||
break;
|
||||
#ifdef HAVE_FFMPEG
|
||||
case CORE_TYPE_FFMPEG:
|
||||
SYM_FFMPEG(retro_init);
|
||||
SYM_FFMPEG(retro_deinit);
|
||||
SYMBOL_FFMPEG(retro_init);
|
||||
SYMBOL_FFMPEG(retro_deinit);
|
||||
|
||||
SYM_FFMPEG(retro_api_version);
|
||||
SYM_FFMPEG(retro_get_system_info);
|
||||
SYM_FFMPEG(retro_get_system_av_info);
|
||||
SYMBOL_FFMPEG(retro_api_version);
|
||||
SYMBOL_FFMPEG(retro_get_system_info);
|
||||
SYMBOL_FFMPEG(retro_get_system_av_info);
|
||||
|
||||
SYM_FFMPEG(retro_set_environment);
|
||||
SYM_FFMPEG(retro_set_video_refresh);
|
||||
SYM_FFMPEG(retro_set_audio_sample);
|
||||
SYM_FFMPEG(retro_set_audio_sample_batch);
|
||||
SYM_FFMPEG(retro_set_input_poll);
|
||||
SYM_FFMPEG(retro_set_input_state);
|
||||
SYMBOL_FFMPEG(retro_set_environment);
|
||||
SYMBOL_FFMPEG(retro_set_video_refresh);
|
||||
SYMBOL_FFMPEG(retro_set_audio_sample);
|
||||
SYMBOL_FFMPEG(retro_set_audio_sample_batch);
|
||||
SYMBOL_FFMPEG(retro_set_input_poll);
|
||||
SYMBOL_FFMPEG(retro_set_input_state);
|
||||
|
||||
SYM_FFMPEG(retro_set_controller_port_device);
|
||||
SYMBOL_FFMPEG(retro_set_controller_port_device);
|
||||
|
||||
SYM_FFMPEG(retro_reset);
|
||||
SYM_FFMPEG(retro_run);
|
||||
SYMBOL_FFMPEG(retro_reset);
|
||||
SYMBOL_FFMPEG(retro_run);
|
||||
|
||||
SYM_FFMPEG(retro_serialize_size);
|
||||
SYM_FFMPEG(retro_serialize);
|
||||
SYM_FFMPEG(retro_unserialize);
|
||||
SYMBOL_FFMPEG(retro_serialize_size);
|
||||
SYMBOL_FFMPEG(retro_serialize);
|
||||
SYMBOL_FFMPEG(retro_unserialize);
|
||||
|
||||
SYM_FFMPEG(retro_cheat_reset);
|
||||
SYM_FFMPEG(retro_cheat_set);
|
||||
SYMBOL_FFMPEG(retro_cheat_reset);
|
||||
SYMBOL_FFMPEG(retro_cheat_set);
|
||||
|
||||
SYM_FFMPEG(retro_load_game);
|
||||
SYM_FFMPEG(retro_load_game_special);
|
||||
SYMBOL_FFMPEG(retro_load_game);
|
||||
SYMBOL_FFMPEG(retro_load_game_special);
|
||||
|
||||
SYM_FFMPEG(retro_unload_game);
|
||||
SYM_FFMPEG(retro_get_region);
|
||||
SYM_FFMPEG(retro_get_memory_data);
|
||||
SYM_FFMPEG(retro_get_memory_size);
|
||||
SYMBOL_FFMPEG(retro_unload_game);
|
||||
SYMBOL_FFMPEG(retro_get_region);
|
||||
SYMBOL_FFMPEG(retro_get_memory_data);
|
||||
SYMBOL_FFMPEG(retro_get_memory_size);
|
||||
break;
|
||||
#endif
|
||||
case CORE_TYPE_IMAGEVIEWER:
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
SYM_IMAGEVIEWER(retro_init);
|
||||
SYM_IMAGEVIEWER(retro_deinit);
|
||||
SYMBOL_IMAGEVIEWER(retro_init);
|
||||
SYMBOL_IMAGEVIEWER(retro_deinit);
|
||||
|
||||
SYM_IMAGEVIEWER(retro_api_version);
|
||||
SYM_IMAGEVIEWER(retro_get_system_info);
|
||||
SYM_IMAGEVIEWER(retro_get_system_av_info);
|
||||
SYMBOL_IMAGEVIEWER(retro_api_version);
|
||||
SYMBOL_IMAGEVIEWER(retro_get_system_info);
|
||||
SYMBOL_IMAGEVIEWER(retro_get_system_av_info);
|
||||
|
||||
SYM_IMAGEVIEWER(retro_set_environment);
|
||||
SYM_IMAGEVIEWER(retro_set_video_refresh);
|
||||
SYM_IMAGEVIEWER(retro_set_audio_sample);
|
||||
SYM_IMAGEVIEWER(retro_set_audio_sample_batch);
|
||||
SYM_IMAGEVIEWER(retro_set_input_poll);
|
||||
SYM_IMAGEVIEWER(retro_set_input_state);
|
||||
SYMBOL_IMAGEVIEWER(retro_set_environment);
|
||||
SYMBOL_IMAGEVIEWER(retro_set_video_refresh);
|
||||
SYMBOL_IMAGEVIEWER(retro_set_audio_sample);
|
||||
SYMBOL_IMAGEVIEWER(retro_set_audio_sample_batch);
|
||||
SYMBOL_IMAGEVIEWER(retro_set_input_poll);
|
||||
SYMBOL_IMAGEVIEWER(retro_set_input_state);
|
||||
|
||||
SYM_IMAGEVIEWER(retro_set_controller_port_device);
|
||||
SYMBOL_IMAGEVIEWER(retro_set_controller_port_device);
|
||||
|
||||
SYM_IMAGEVIEWER(retro_reset);
|
||||
SYM_IMAGEVIEWER(retro_run);
|
||||
SYMBOL_IMAGEVIEWER(retro_reset);
|
||||
SYMBOL_IMAGEVIEWER(retro_run);
|
||||
|
||||
SYM_IMAGEVIEWER(retro_serialize_size);
|
||||
SYM_IMAGEVIEWER(retro_serialize);
|
||||
SYM_IMAGEVIEWER(retro_unserialize);
|
||||
SYMBOL_IMAGEVIEWER(retro_serialize_size);
|
||||
SYMBOL_IMAGEVIEWER(retro_serialize);
|
||||
SYMBOL_IMAGEVIEWER(retro_unserialize);
|
||||
|
||||
SYM_IMAGEVIEWER(retro_cheat_reset);
|
||||
SYM_IMAGEVIEWER(retro_cheat_set);
|
||||
SYMBOL_IMAGEVIEWER(retro_cheat_reset);
|
||||
SYMBOL_IMAGEVIEWER(retro_cheat_set);
|
||||
|
||||
SYM_IMAGEVIEWER(retro_load_game);
|
||||
SYM_IMAGEVIEWER(retro_load_game_special);
|
||||
SYMBOL_IMAGEVIEWER(retro_load_game);
|
||||
SYMBOL_IMAGEVIEWER(retro_load_game_special);
|
||||
|
||||
SYM_IMAGEVIEWER(retro_unload_game);
|
||||
SYM_IMAGEVIEWER(retro_get_region);
|
||||
SYM_IMAGEVIEWER(retro_get_memory_data);
|
||||
SYM_IMAGEVIEWER(retro_get_memory_size);
|
||||
SYMBOL_IMAGEVIEWER(retro_unload_game);
|
||||
SYMBOL_IMAGEVIEWER(retro_get_region);
|
||||
SYMBOL_IMAGEVIEWER(retro_get_memory_data);
|
||||
SYMBOL_IMAGEVIEWER(retro_get_memory_size);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
@ -1120,12 +1120,12 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
struct retro_perf_callback *cb = (struct retro_perf_callback*)data;
|
||||
|
||||
RARCH_LOG("Environ GET_PERF_INTERFACE.\n");
|
||||
cb->get_time_usec = rarch_get_time_usec;
|
||||
cb->get_cpu_features = rarch_get_cpu_features;
|
||||
cb->get_perf_counter = rarch_get_perf_counter;
|
||||
cb->get_time_usec = retro_get_time_usec;
|
||||
cb->get_cpu_features = retro_get_cpu_features;
|
||||
cb->get_perf_counter = retro_get_perf_counter;
|
||||
cb->perf_register = retro_perf_register; /* libretro specific path. */
|
||||
cb->perf_start = rarch_perf_start;
|
||||
cb->perf_stop = rarch_perf_stop;
|
||||
cb->perf_start = retro_perf_start;
|
||||
cb->perf_stop = retro_perf_stop;
|
||||
cb->perf_log = retro_perf_log; /* libretro specific path. */
|
||||
break;
|
||||
}
|
||||
|
|
158
file_ops.c
|
@ -30,6 +30,7 @@
|
|||
#include <retro_assert.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <file/file_path.h>
|
||||
#include <retro_file.h>
|
||||
#include <string/string_list.h>
|
||||
#ifdef HAVE_COMPRESSION
|
||||
#include <file/file_extract.h>
|
||||
|
@ -200,17 +201,19 @@ static int read_7zip_file(
|
|||
SRes res;
|
||||
ISzAlloc allocImp;
|
||||
ISzAlloc allocTempImp;
|
||||
uint16_t *temp = NULL;
|
||||
size_t tempSize = 0;
|
||||
long outsize = -1;
|
||||
bool file_found = false;
|
||||
uint8_t *outBuffer = 0;
|
||||
size_t outBufferSize = 0;
|
||||
uint16_t *temp = NULL;
|
||||
size_t tempSize = 0;
|
||||
long outsize = -1;
|
||||
bool file_found = false;
|
||||
|
||||
/*These are the allocation routines.
|
||||
* Currently using the non-standard 7zip choices. */
|
||||
allocImp.Alloc = SzAlloc;
|
||||
allocImp.Free = SzFree;
|
||||
allocTempImp.Alloc = SzAllocTemp;
|
||||
allocTempImp.Free = SzFreeTemp;
|
||||
allocImp.Alloc = SzAlloc;
|
||||
allocImp.Free = SzFree;
|
||||
allocTempImp.Alloc = SzAllocTemp;
|
||||
allocTempImp.Free = SzFreeTemp;
|
||||
|
||||
if (InFile_Open(&archiveStream.file, archive_path))
|
||||
{
|
||||
|
@ -235,8 +238,6 @@ static int read_7zip_file(
|
|||
{
|
||||
uint32_t i;
|
||||
uint32_t blockIndex = 0xFFFFFFFF;
|
||||
uint8_t *outBuffer = 0;
|
||||
size_t outBufferSize = 0;
|
||||
|
||||
for (i = 0; i < db.db.NumFiles; i++)
|
||||
{
|
||||
|
@ -246,14 +247,13 @@ static int read_7zip_file(
|
|||
size_t outSizeProcessed = 0;
|
||||
const CSzFileItem *f = db.db.Files + i;
|
||||
|
||||
/* We skip over everything which is not a directory.
|
||||
* FIXME: Why continue then if f->IsDir is true?*/
|
||||
if (f->IsDir)
|
||||
{
|
||||
/* We skip over everything which is not a directory.
|
||||
* FIXME: Why continue then if f->IsDir is true?*/
|
||||
continue;
|
||||
}
|
||||
|
||||
len = SzArEx_GetFileNameUtf16(&db, i, NULL);
|
||||
|
||||
if (len > tempSize)
|
||||
{
|
||||
free(temp);
|
||||
|
@ -265,6 +265,7 @@ static int read_7zip_file(
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SzArEx_GetFileNameUtf16(&db, i, temp);
|
||||
res = ConvertUtf16toCharString(temp,infile);
|
||||
|
||||
|
@ -277,26 +278,25 @@ static int read_7zip_file(
|
|||
res = SzArEx_Extract(&db, &lookStream.s, i,&blockIndex,
|
||||
&outBuffer, &outBufferSize,&offset, &outSizeProcessed,
|
||||
&allocImp, &allocTempImp);
|
||||
|
||||
if (res != SZ_OK)
|
||||
{
|
||||
break; /* This goes to the error section. */
|
||||
}
|
||||
|
||||
outsize = outSizeProcessed;
|
||||
|
||||
if (optional_outfile != NULL)
|
||||
{
|
||||
FILE* outsink = fopen(optional_outfile,"wb");
|
||||
if (outsink == NULL)
|
||||
const void *ptr = (const void*)(outBuffer + offset);
|
||||
|
||||
if (!retro_write_file(optional_outfile, ptr, outsize))
|
||||
{
|
||||
RARCH_ERR("Could not open outfilepath %s.\n",
|
||||
optional_outfile);
|
||||
IAlloc_Free(&allocImp, outBuffer);
|
||||
SzArEx_Free(&db, &allocImp);
|
||||
free(temp);
|
||||
File_Close(&archiveStream.file);
|
||||
return -1;
|
||||
res = SZ_OK;
|
||||
file_found = true;
|
||||
outsize = -1;
|
||||
break;
|
||||
}
|
||||
fwrite(outBuffer+offset,1,outsize,outsink);
|
||||
fclose(outsink);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -309,14 +309,14 @@ static int read_7zip_file(
|
|||
((char*)(*buf))[outsize] = '\0';
|
||||
memcpy(*buf,outBuffer+offset,outsize);
|
||||
}
|
||||
IAlloc_Free(&allocImp, outBuffer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IAlloc_Free(&allocImp, outBuffer);
|
||||
SzArEx_Free(&db, &allocImp);
|
||||
free(temp);
|
||||
|
||||
File_Close(&archiveStream.file);
|
||||
|
||||
if (res == SZ_OK && file_found == true)
|
||||
|
@ -559,31 +559,27 @@ static int read_zip_file(const char *archive_path,
|
|||
else
|
||||
{
|
||||
char read_buffer[RARCH_ZIP_SUPPORT_BUFFER_SIZE_MAX] = {0};
|
||||
FILE* outsink = fopen(optional_outfile,"wb");
|
||||
RFILE* outsink = retro_fopen(optional_outfile, RFILE_MODE_WRITE, -1);
|
||||
|
||||
if (outsink == NULL)
|
||||
if (!outsink)
|
||||
goto close;
|
||||
|
||||
bytes_read = 0;
|
||||
|
||||
do
|
||||
{
|
||||
ssize_t fwrite_bytes;
|
||||
|
||||
bytes_read = unzReadCurrentFile(zipfile, read_buffer,
|
||||
RARCH_ZIP_SUPPORT_BUFFER_SIZE_MAX );
|
||||
fwrite_bytes = fwrite(read_buffer, 1, bytes_read,outsink);
|
||||
|
||||
if (fwrite_bytes == bytes_read)
|
||||
if (retro_fwrite(outsink, read_buffer, bytes_read) == bytes_read)
|
||||
continue;
|
||||
|
||||
/* couldn't write all bytes */
|
||||
RARCH_ERR("Error writing to %s.\n",optional_outfile);
|
||||
fclose(outsink);
|
||||
RARCH_ERR("Error writing to %s.\n", optional_outfile);
|
||||
retro_fclose(outsink);
|
||||
goto close;
|
||||
} while(bytes_read > 0);
|
||||
|
||||
fclose(outsink);
|
||||
retro_fclose(outsink);
|
||||
}
|
||||
finished_reading = true;
|
||||
}
|
||||
|
@ -619,90 +615,6 @@ error:
|
|||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* write_file:
|
||||
* @path : path to file.
|
||||
* @data : contents to write to the file.
|
||||
* @size : size of the contents.
|
||||
*
|
||||
* Writes data to a file.
|
||||
*
|
||||
* Returns: true (1) on success, false (0) otherwise.
|
||||
*/
|
||||
bool write_file(const char *path, const void *data, ssize_t size)
|
||||
{
|
||||
ssize_t ret = 0;
|
||||
FILE *file = fopen(path, "wb");
|
||||
if (!file)
|
||||
return false;
|
||||
|
||||
ret = fwrite(data, 1, size, file);
|
||||
fclose(file);
|
||||
return (ret == size);
|
||||
}
|
||||
|
||||
/**
|
||||
* read_generic_file:
|
||||
* @path : path to file.
|
||||
* @buf : buffer to allocate and read the contents of the
|
||||
* file into. Needs to be freed manually.
|
||||
*
|
||||
* Read the contents of a file into @buf.
|
||||
*
|
||||
* Returns: number of items read, -1 on error.
|
||||
*/
|
||||
static int read_generic_file(const char *path, void **buf, ssize_t *len)
|
||||
{
|
||||
size_t bytes_read = 0;
|
||||
size_t content_buf_size = 0;
|
||||
void *content_buf = NULL;
|
||||
FILE *file = fopen(path, "rb");
|
||||
|
||||
if (!file)
|
||||
goto error;
|
||||
|
||||
if (fseek(file, 0, SEEK_END) != 0)
|
||||
goto error;
|
||||
|
||||
content_buf_size = ftell(file);
|
||||
if (content_buf_size < 0)
|
||||
goto error;
|
||||
|
||||
rewind(file);
|
||||
|
||||
content_buf = malloc(content_buf_size + 1);
|
||||
|
||||
if (!content_buf)
|
||||
goto error;
|
||||
|
||||
if ((bytes_read = fread(content_buf, 1, content_buf_size, file)) < content_buf_size)
|
||||
RARCH_WARN("Didn't read whole file.\n");
|
||||
|
||||
*buf = content_buf;
|
||||
|
||||
/* Allow for easy reading of strings to be safe.
|
||||
* Will only work with sane character formatting (Unix). */
|
||||
((char*)content_buf)[content_buf_size] = '\0';
|
||||
|
||||
if (fclose(file) != 0)
|
||||
RARCH_WARN("Failed to close file stream.\n");
|
||||
|
||||
if (len)
|
||||
*len = bytes_read;
|
||||
|
||||
return 1;
|
||||
|
||||
error:
|
||||
if (file)
|
||||
fclose(file);
|
||||
if (content_buf)
|
||||
free(content_buf);
|
||||
if (len)
|
||||
*len = -1;
|
||||
*buf = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_COMPRESSION
|
||||
/* Generic compressed file loader.
|
||||
* Extracts to buf, unless optional_filename != 0
|
||||
|
@ -783,7 +695,7 @@ int read_compressed_file(const char * path, void **buf,
|
|||
* @length : Number of items read, -1 on error.
|
||||
*
|
||||
* Read the contents of a file into @buf. Will call read_compressed_file
|
||||
* if path contains a compressed file, otherwise will call read_generic_file.
|
||||
* if path contains a compressed file, otherwise will call retro_read_file().
|
||||
*
|
||||
* Returns: 1 if file read, 0 on error.
|
||||
*/
|
||||
|
@ -796,7 +708,7 @@ int read_file(const char *path, void **buf, ssize_t *length)
|
|||
return 1;
|
||||
}
|
||||
#endif
|
||||
return read_generic_file(path, buf, length);
|
||||
return retro_read_file(path, buf, length);
|
||||
}
|
||||
|
||||
struct string_list *compressed_file_list_new(const char *path,
|
||||
|
|
|
@ -26,26 +26,16 @@
|
|||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef __HAIKU__
|
||||
#include <kernel/image.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <unistd.h> /* stat() is defined here */
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(x) (x & 0040000)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include <compat/strl.h>
|
||||
#include <compat/posix_string.h>
|
||||
|
@ -131,8 +121,8 @@ void fill_pathname_abbreviate_special(char *out_path,
|
|||
rarch_assert(src_size < size);
|
||||
|
||||
out_path += src_size;
|
||||
size -= src_size;
|
||||
in_path += strlen(candidates[i]);
|
||||
size -= src_size;
|
||||
in_path += strlen(candidates[i]);
|
||||
|
||||
if (!path_char_is_slash(*in_path))
|
||||
{
|
||||
|
@ -193,7 +183,7 @@ void fill_pathname_application_path(char *buf, size_t size)
|
|||
char link_path[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
*buf = '\0';
|
||||
pid = getpid();
|
||||
pid = getpid();
|
||||
|
||||
/* Linux, BSD and Solaris paths. Not standardized. */
|
||||
for (i = 0; i < ARRAY_SIZE(exts); i++)
|
||||
|
@ -203,6 +193,7 @@ void fill_pathname_application_path(char *buf, size_t size)
|
|||
snprintf(link_path, sizeof(link_path), "/proc/%u/%s",
|
||||
(unsigned)pid, exts[i]);
|
||||
ret = readlink(link_path, buf, size - 1);
|
||||
|
||||
if (ret >= 0)
|
||||
{
|
||||
buf[ret] = '\0';
|
||||
|
|
|
@ -13,13 +13,14 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
#include <file/file_path.h>
|
||||
#ifndef IS_SALAMANDER
|
||||
#include <file/file_list.h>
|
||||
|
@ -35,15 +36,77 @@
|
|||
#include "../../menu/menu_list.h"
|
||||
#endif
|
||||
|
||||
|
||||
int __stacksize__ = 1*1024*1024;
|
||||
|
||||
const char* elf_path_cst = "sdmc:/retroarch/test.3dsx";
|
||||
|
||||
void wait_for_input(void);
|
||||
|
||||
#define DEBUG_HOLD() do{printf("%s@%s:%d.\n",__FUNCTION__, __FILE__, __LINE__);fflush(stdout);wait_for_input();}while(0)
|
||||
|
||||
#ifndef CTR_STACK_SIZE
|
||||
#define CTR_STACK_SIZE 0x100000
|
||||
#endif
|
||||
|
||||
#ifndef CTR_LINEAR_HEAP_SIZE
|
||||
#define CTR_LINEAR_HEAP_SIZE 0x600000
|
||||
#endif
|
||||
|
||||
int __stacksize__ = CTR_STACK_SIZE;
|
||||
|
||||
extern char* fake_heap_start;
|
||||
extern char* fake_heap_end;
|
||||
u32 __linear_heap;
|
||||
u32 __heapBase;
|
||||
static u32 __heap_size_local, __linear_heap_size_local;
|
||||
|
||||
extern void (*__system_retAddr)(void);
|
||||
|
||||
void __destroy_handle_list(void);
|
||||
void __appExit();
|
||||
void __libc_fini_array(void);
|
||||
|
||||
void __system_allocateHeaps() {
|
||||
u32 tmp=0;
|
||||
int64_t mem_used;
|
||||
svcGetSystemInfo(&mem_used, 0, 1);
|
||||
|
||||
__linear_heap_size_local = CTR_LINEAR_HEAP_SIZE;
|
||||
__heap_size_local = (0x4000000 - mem_used - __linear_heap_size_local - 0x1000) & 0xFFFFF000;
|
||||
|
||||
// Allocate the application heap
|
||||
__heapBase = 0x08000000;
|
||||
svcControlMemory(&tmp, __heapBase, 0x0, __heap_size_local, MEMOP_ALLOC, MEMPERM_READ | MEMPERM_WRITE);
|
||||
|
||||
// Allocate the linear heap
|
||||
svcControlMemory(&__linear_heap, 0x0, 0x0, __linear_heap_size_local, MEMOP_ALLOC_LINEAR, MEMPERM_READ | MEMPERM_WRITE);
|
||||
// Set up newlib heap
|
||||
fake_heap_start = (char*)__heapBase;
|
||||
fake_heap_end = fake_heap_start + __heap_size_local;
|
||||
|
||||
}
|
||||
|
||||
void __attribute__((noreturn)) __libctru_exit(int rc)
|
||||
{
|
||||
u32 tmp=0;
|
||||
|
||||
// Unmap the linear heap
|
||||
svcControlMemory(&tmp, __linear_heap, 0x0, __linear_heap_size_local, MEMOP_FREE, 0x0);
|
||||
|
||||
// Unmap the application heap
|
||||
svcControlMemory(&tmp, __heapBase, 0x0, __heap_size_local, MEMOP_FREE, 0x0);
|
||||
|
||||
// Close some handles
|
||||
__destroy_handle_list();
|
||||
|
||||
// Jump to the loader if it provided a callback
|
||||
if (__system_retAddr)
|
||||
__system_retAddr();
|
||||
|
||||
// Since above did not jump, end this process
|
||||
svcExitProcess();
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void frontend_ctr_get_environment_settings(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
{
|
||||
|
@ -77,6 +140,8 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[],
|
|||
"system", sizeof(g_defaults.dir.system));
|
||||
fill_pathname_join(g_defaults.dir.playlist, g_defaults.dir.core,
|
||||
"playlists", sizeof(g_defaults.dir.playlist));
|
||||
fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.port,
|
||||
"remaps", sizeof(g_defaults.dir.remap));
|
||||
fill_pathname_join(g_defaults.path.config, g_defaults.dir.port,
|
||||
"retroarch.cfg", sizeof(g_defaults.path.config));
|
||||
|
||||
|
@ -199,12 +264,32 @@ void wait_for_input(void)
|
|||
break;
|
||||
|
||||
if (kDown & KEY_SELECT)
|
||||
select_pressed = true;
|
||||
exit(0);
|
||||
#if 0
|
||||
select_pressed = true;
|
||||
#endif
|
||||
|
||||
rarch_sleep(1);
|
||||
retro_sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
int usleep (useconds_t us)
|
||||
{
|
||||
svcSleepThread((int64_t)us * 1000);
|
||||
}
|
||||
|
||||
long sysconf(int name)
|
||||
{
|
||||
switch(name)
|
||||
{
|
||||
case _SC_NPROCESSORS_ONLN:
|
||||
return 2;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
enum frontend_architecture frontend_ctr_get_architecture(void)
|
||||
{
|
||||
return FRONTEND_ARCH_ARM;
|
||||
|
|
|
@ -16,8 +16,10 @@
|
|||
*/
|
||||
|
||||
#include <emscripten/emscripten.h>
|
||||
#include "../../general.h"
|
||||
|
||||
#include <file/config_file.h>
|
||||
|
||||
#include "../../general.h"
|
||||
#include "../../content.h"
|
||||
#include "../frontend.h"
|
||||
#include "../../retroarch.h"
|
||||
|
@ -30,7 +32,7 @@ static void emscripten_mainloop(void)
|
|||
unsigned sleep_ms = 0;
|
||||
int ret = rarch_main_iterate(&sleep_ms);
|
||||
if (ret == 1 && sleep_ms > 0)
|
||||
rarch_sleep(sleep_ms);
|
||||
retro_sleep(sleep_ms);
|
||||
rarch_main_data_iterate();
|
||||
if (ret != -1)
|
||||
return;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#if defined(HW_RVL) && !defined(IS_SALAMANDER)
|
||||
#include <ogc/mutex.h>
|
||||
#include <ogc/cond.h>
|
||||
#include "../../wii/mem2_manager.h"
|
||||
#include "../../memory/wii/mem2_manager.h"
|
||||
#endif
|
||||
|
||||
#include <boolean.h>
|
||||
|
|
|
@ -15,9 +15,44 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _PLATFORM_ANDROID_H
|
||||
#define _PLATFORM_ANDROID_H
|
||||
#ifndef _PLATFORM_LINUX_H
|
||||
#define _PLATFORM_LINUX_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CPU_FAMILY_UNKNOWN = 0,
|
||||
CPU_FAMILY_ARM,
|
||||
CPU_FAMILY_X86,
|
||||
CPU_FAMILY_MIPS,
|
||||
|
||||
CPU_FAMILY_MAX /* do not remove */
|
||||
} cpu_family;
|
||||
|
||||
enum
|
||||
{
|
||||
CPU_ARM_FEATURE_ARMv7 = (1 << 0),
|
||||
CPU_ARM_FEATURE_VFPv3 = (1 << 1),
|
||||
CPU_ARM_FEATURE_NEON = (1 << 2),
|
||||
CPU_ARM_FEATURE_LDREX_STREX = (1 << 3)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CPU_X86_FEATURE_SSSE3 = (1 << 0),
|
||||
CPU_X86_FEATURE_POPCNT = (1 << 1),
|
||||
CPU_X86_FEATURE_MOVBE = (1 << 2)
|
||||
};
|
||||
|
||||
cpu_family linux_get_cpu_family(void);
|
||||
|
||||
uint64_t linux_get_cpu_features(void);
|
||||
|
||||
int linux_get_cpu_count(void);
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <jni.h>
|
||||
#include <poll.h>
|
||||
#include <sched.h>
|
||||
|
@ -237,5 +272,7 @@ enum
|
|||
extern JNIEnv *jni_thread_getenv(void);
|
||||
|
||||
extern struct android_app *g_android;
|
||||
#else
|
||||
#endif
|
||||
|
||||
#endif /* _PLATFORM_ANDROID_H */
|
||||
#endif
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -32,6 +31,7 @@ int scePowerSetArmClockFrequency(int freq);
|
|||
#include <pspsdk.h>
|
||||
#endif
|
||||
|
||||
#include <boolean.h>
|
||||
#include <retro_log.h>
|
||||
#include <file/file_path.h>
|
||||
#ifndef IS_SALAMANDER
|
||||
|
@ -43,12 +43,13 @@ int scePowerSetArmClockFrequency(int freq);
|
|||
|
||||
#if defined(HAVE_KERNEL_PRX) || defined(IS_SALAMANDER)
|
||||
#ifndef VITA
|
||||
#include "../../psp1/kernel_functions.h"
|
||||
#include "../../bootstrap/psp1/kernel_functions.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VITA
|
||||
PSP2_MODULE_INFO(0, 0, "RetroArch");
|
||||
int _newlib_heap_size_user = 64 * 1024 * 1024;
|
||||
#else
|
||||
PSP_MODULE_INFO("RetroArch", 0, 1, 1);
|
||||
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER|THREAD_ATTR_VFPU);
|
||||
|
@ -71,6 +72,7 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[],
|
|||
void *args, void *params_data)
|
||||
{
|
||||
struct rarch_main_wrap *params = NULL;
|
||||
char buf[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
(void)args;
|
||||
|
||||
|
@ -110,9 +112,9 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[],
|
|||
"playlists", sizeof(g_defaults.dir.playlist));
|
||||
fill_pathname_join(g_defaults.path.config, g_defaults.dir.port,
|
||||
"retroarch.cfg", sizeof(g_defaults.path.config));
|
||||
fill_pathname_join(g_defaults.dir.cheats, g_defaults.dir.cheats,
|
||||
fill_pathname_join(g_defaults.dir.cheats, g_defaults.dir.port,
|
||||
"cheats", sizeof(g_defaults.dir.cheats));
|
||||
fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.remap,
|
||||
fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.port,
|
||||
"remaps", sizeof(g_defaults.dir.remap));
|
||||
|
||||
#ifdef VITA
|
||||
|
|
|
@ -14,12 +14,14 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <bps/bps.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <bps/bps.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../../dynamic.h"
|
||||
#include "../../libretro_private.h"
|
||||
|
||||
|
|
|
@ -18,18 +18,21 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <fat.h>
|
||||
#include <gctypes.h>
|
||||
#include <ogc/cache.h>
|
||||
#include "../../gfx/drivers/ppc_asm.h"
|
||||
#include <ogc/system.h>
|
||||
#include <ogc/usbstorage.h>
|
||||
#include <sdcard/wiisd_io.h>
|
||||
|
||||
#include <retro_log.h>
|
||||
#include <retro_file.h>
|
||||
#include <file/file_path.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "../../gfx/drivers/ppc_asm.h"
|
||||
|
||||
#define EXECUTE_ADDR ((uint8_t *) 0x91800000)
|
||||
#define BOOTER_ADDR ((uint8_t *) 0x93000000)
|
||||
#define ARGS_ADDR ((uint8_t *) 0x93200000)
|
||||
|
@ -46,10 +49,9 @@ char gx_rom_path[PATH_MAX_LENGTH];
|
|||
static void dol_copy_argv_path(const char *dolpath, const char *argpath)
|
||||
{
|
||||
char tmp[PATH_MAX_LENGTH];
|
||||
size_t t_len;
|
||||
size_t t_len, len = 0;
|
||||
struct __argv *argv = (struct __argv *)ARGS_ADDR;
|
||||
char *cmdline = NULL;
|
||||
size_t len = 0;
|
||||
|
||||
memset(ARGS_ADDR, 0, sizeof(struct __argv));
|
||||
|
||||
|
@ -113,13 +115,13 @@ static void dol_copy_argv_path(const char *dolpath, const char *argpath)
|
|||
* heap memory and are restricted to the stack only. */
|
||||
void system_exec_wii(const char *_path, bool should_load_game)
|
||||
{
|
||||
FILE *fp;
|
||||
size_t size, booter_size;
|
||||
void *dol;
|
||||
size_t booter_size;
|
||||
ssize_t length;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
char game_path[PATH_MAX_LENGTH];
|
||||
void *dol = NULL;
|
||||
#ifndef IS_SALAMANDER
|
||||
global_t *global = global_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
bool original_verbose = global->verbosity;
|
||||
global->verbosity = true;
|
||||
#endif
|
||||
|
@ -137,30 +139,12 @@ void system_exec_wii(const char *_path, bool should_load_game)
|
|||
}
|
||||
|
||||
RARCH_LOG("Attempt to load executable: [%s]\n", path);
|
||||
|
||||
fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
if (retro_read_file(path, dol, &length) != 1)
|
||||
{
|
||||
RARCH_ERR("Could not open DOL file %s.\n", path);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
fseek(fp, 0, SEEK_END);
|
||||
size = ftell(fp);
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
|
||||
/* try to allocate a buffer for it. if we can't, fail. */
|
||||
dol = malloc(size);
|
||||
if (!dol)
|
||||
{
|
||||
RARCH_ERR("Could not execute DOL file %s.\n", path);
|
||||
fclose(fp);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
fread(dol, 1, size, fp);
|
||||
fclose(fp);
|
||||
|
||||
fatUnmount("carda:");
|
||||
fatUnmount("cardb:");
|
||||
fatUnmount("sd:");
|
||||
|
@ -169,8 +153,8 @@ void system_exec_wii(const char *_path, bool should_load_game)
|
|||
__io_usbstorage.shutdown();
|
||||
|
||||
/* don't use memcpy, there might be an overlap. */
|
||||
memmove(EXECUTE_ADDR, dol, size);
|
||||
DCFlushRange(EXECUTE_ADDR, size);
|
||||
memmove(EXECUTE_ADDR, dol, length);
|
||||
DCFlushRange(EXECUTE_ADDR, length);
|
||||
|
||||
dol_copy_argv_path(path, should_load_game ? game_path : NULL);
|
||||
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <dynamic/dylib.h>
|
||||
#include <file/file_list.h>
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <xtl.h>
|
||||
#include <xbdm.h>
|
||||
#include <xgraphics.h>
|
||||
|
||||
#include <file/file_path.h>
|
||||
#ifndef IS_SALAMANDER
|
||||
|
@ -33,7 +34,6 @@ static bool exit_spawn;
|
|||
static bool exitspawn_start_game;
|
||||
|
||||
#ifdef _XBOX360
|
||||
|
||||
typedef struct _STRING
|
||||
{
|
||||
USHORT Length;
|
||||
|
@ -425,3 +425,264 @@ frontend_ctx_driver_t frontend_ctx_xdk = {
|
|||
frontend_xdk_parse_drive_list,
|
||||
"xdk",
|
||||
};
|
||||
|
||||
#ifdef _XBOX360
|
||||
struct XPR_HEADER
|
||||
{
|
||||
DWORD dwMagic;
|
||||
DWORD dwHeaderSize;
|
||||
DWORD dwDataSize;
|
||||
};
|
||||
#endif
|
||||
|
||||
#define XPR0_MAGIC_VALUE 0x30525058
|
||||
#define XPR1_MAGIC_VALUE 0x31525058
|
||||
#define XPR2_MAGIC_VALUE 0x58505232
|
||||
|
||||
PackedResource::PackedResource()
|
||||
{
|
||||
m_pSysMemData = NULL;
|
||||
m_dwSysMemDataSize = 0L;
|
||||
m_pVidMemData = NULL;
|
||||
m_dwVidMemDataSize = 0L;
|
||||
m_pResourceTags = NULL;
|
||||
m_dwNumResourceTags = 0L;
|
||||
m_bInitialized = FALSE;
|
||||
}
|
||||
|
||||
|
||||
PackedResource::~PackedResource()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void *PackedResource::GetData(const char *strName) const
|
||||
{
|
||||
if (m_pResourceTags == NULL || strName == NULL)
|
||||
return NULL;
|
||||
|
||||
#if defined(_XBOX1)
|
||||
for (DWORD i=0; m_pResourceTags[i].strName; i++)
|
||||
#elif defined(_XBOX360)
|
||||
for (DWORD i = 0; i < m_dwNumResourceTags; i++)
|
||||
#endif
|
||||
{
|
||||
if (!strcasecmp(strName, m_pResourceTags[i].strName))
|
||||
return &m_pSysMemData[m_pResourceTags[i].dwOffset];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static INLINE void* AllocateContiguousMemory(DWORD Size, DWORD Alignment)
|
||||
{
|
||||
#if defined(_XBOX1)
|
||||
return D3D_AllocContiguousMemory(Size, Alignment);
|
||||
#elif defined(_XBOX360)
|
||||
return XMemAlloc(Size, MAKE_XALLOC_ATTRIBUTES(0, 0, 0, 0, eXALLOCAllocatorId_GameMax,
|
||||
Alignment, XALLOC_MEMPROTECT_WRITECOMBINE, 0, XALLOC_MEMTYPE_PHYSICAL));
|
||||
#endif
|
||||
}
|
||||
|
||||
static INLINE void FreeContiguousMemory(void* pData)
|
||||
{
|
||||
#if defined(_XBOX1)
|
||||
return D3D_FreeContiguousMemory(pData);
|
||||
#elif defined(_XBOX360)
|
||||
return XMemFree(pData, MAKE_XALLOC_ATTRIBUTES(0, 0, 0, 0, eXALLOCAllocatorId_GameMax,
|
||||
0, 0, 0, XALLOC_MEMTYPE_PHYSICAL));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _XBOX1
|
||||
char g_strMediaPath[512] = "D:\\Media\\";
|
||||
|
||||
static HRESULT FindMediaFile(char *strPath, const char *strFilename, size_t strPathsize)
|
||||
{
|
||||
if(strFilename == NULL || strPath == NULL)
|
||||
return E_INVALIDARG;
|
||||
|
||||
strlcpy(strPath, strFilename, strPathsize);
|
||||
|
||||
if(strFilename[1] != ':')
|
||||
snprintf(strPath, strPathsize, "%s%s", g_strMediaPath, strFilename);
|
||||
|
||||
HANDLE hFile = CreateFile(strPath, GENERIC_READ, FILE_SHARE_READ, NULL,
|
||||
OPEN_EXISTING, 0, NULL);
|
||||
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
return 0x82000004;
|
||||
|
||||
CloseHandle(hFile);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_XBOX1)
|
||||
HRESULT PackedResource::Create(const char *strFilename,
|
||||
DWORD dwNumResourceTags, XBRESOURCE* pResourceTags)
|
||||
#elif defined(_XBOX360)
|
||||
HRESULT PackedResource::Create(const char *strFilename)
|
||||
#endif
|
||||
{
|
||||
HANDLE hFile;
|
||||
DWORD dwNumBytesRead;
|
||||
XPR_HEADER xprh;
|
||||
bool retval;
|
||||
#ifdef _XBOX1
|
||||
BOOL bHasResourceOffsetsTable = FALSE;
|
||||
char strResourcePath[512];
|
||||
|
||||
if (FAILED(FindMediaFile(strResourcePath, strFilename, sizeof(strResourcePath))))
|
||||
return E_FAIL;
|
||||
strFilename = strResourcePath;
|
||||
#endif
|
||||
|
||||
hFile = CreateFile(strFilename, GENERIC_READ, FILE_SHARE_READ, NULL,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
return E_FAIL;
|
||||
|
||||
retval = ReadFile(hFile, &xprh, sizeof(XPR_HEADER), &dwNumBytesRead, NULL);
|
||||
|
||||
#if defined(_XBOX1)
|
||||
if(xprh.dwMagic == XPR0_MAGIC_VALUE)
|
||||
bHasResourceOffsetsTable = FALSE;
|
||||
else if(xprh.dwMagic == XPR1_MAGIC_VALUE)
|
||||
bHasResourceOffsetsTable = TRUE;
|
||||
else
|
||||
#elif defined(_XBOX360)
|
||||
if(!retval)
|
||||
{
|
||||
CloseHandle(hFile);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (xprh.dwMagic != XPR2_MAGIC_VALUE)
|
||||
#endif
|
||||
{
|
||||
CloseHandle(hFile);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// Compute memory requirements
|
||||
#if defined(_XBOX1)
|
||||
m_dwSysMemDataSize = xprh.dwHeaderSize - sizeof(XPR_HEADER);
|
||||
m_dwVidMemDataSize = xprh.dwTotalSize - xprh.dwHeaderSize;
|
||||
#elif defined(_XBOX360)
|
||||
m_dwSysMemDataSize = xprh.dwHeaderSize;
|
||||
m_dwVidMemDataSize = xprh.dwDataSize;
|
||||
#endif
|
||||
|
||||
// Allocate memory
|
||||
m_pSysMemData = (BYTE*)malloc(m_dwSysMemDataSize);
|
||||
if (m_pSysMemData == NULL)
|
||||
{
|
||||
m_dwSysMemDataSize = 0;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pVidMemData = (BYTE*)AllocateContiguousMemory(m_dwVidMemDataSize,
|
||||
#if defined(_XBOX1)
|
||||
D3DTEXTURE_ALIGNMENT
|
||||
#elif defined(_XBOX360)
|
||||
XALLOC_PHYSICAL_ALIGNMENT_4K
|
||||
#endif
|
||||
);
|
||||
|
||||
if(m_pVidMemData == NULL)
|
||||
{
|
||||
m_dwSysMemDataSize = 0;
|
||||
m_dwVidMemDataSize = 0;
|
||||
free(m_pSysMemData);
|
||||
m_pSysMemData = NULL;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// Read in the data from the file
|
||||
if( !ReadFile( hFile, m_pSysMemData, m_dwSysMemDataSize, &dwNumBytesRead, NULL) ||
|
||||
!ReadFile( hFile, m_pVidMemData, m_dwVidMemDataSize, &dwNumBytesRead, NULL))
|
||||
{
|
||||
CloseHandle( hFile);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// Done with the file
|
||||
CloseHandle( hFile);
|
||||
|
||||
#ifdef _XBOX1
|
||||
if (bHasResourceOffsetsTable)
|
||||
{
|
||||
#endif
|
||||
|
||||
// Extract resource table from the header data
|
||||
m_dwNumResourceTags = *(DWORD*)(m_pSysMemData + 0);
|
||||
m_pResourceTags = (XBRESOURCE*)(m_pSysMemData + 4);
|
||||
|
||||
// Patch up the resources
|
||||
for(DWORD i = 0; i < m_dwNumResourceTags; i++)
|
||||
{
|
||||
m_pResourceTags[i].strName = (char*)(m_pSysMemData + (DWORD)m_pResourceTags[i].strName);
|
||||
#ifdef _XBOX360
|
||||
if((m_pResourceTags[i].dwType & 0xffff0000) == (RESOURCETYPE_TEXTURE & 0xffff0000))
|
||||
{
|
||||
D3DTexture *pTexture = (D3DTexture*)&m_pSysMemData[m_pResourceTags[i].dwOffset];
|
||||
XGOffsetBaseTextureAddress(pTexture, m_pVidMemData, m_pVidMemData);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _XBOX1
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX1
|
||||
// Use user-supplied number of resources and the resource tags
|
||||
if(dwNumResourceTags != 0 || pResourceTags != NULL)
|
||||
{
|
||||
m_pResourceTags = pResourceTags;
|
||||
m_dwNumResourceTags = dwNumResourceTags;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_bInitialized = TRUE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#ifdef _XBOX360
|
||||
void PackedResource::GetResourceTags(DWORD* pdwNumResourceTags,
|
||||
XBRESOURCE** ppResourceTags)
|
||||
{
|
||||
if (pdwNumResourceTags)
|
||||
(*pdwNumResourceTags) = m_dwNumResourceTags;
|
||||
|
||||
if (ppResourceTags)
|
||||
(*ppResourceTags) = m_pResourceTags;
|
||||
}
|
||||
#endif
|
||||
|
||||
void PackedResource::Destroy()
|
||||
{
|
||||
free(m_pSysMemData);
|
||||
m_pSysMemData = NULL;
|
||||
m_dwSysMemDataSize = 0L;
|
||||
|
||||
if (m_pVidMemData != NULL)
|
||||
FreeContiguousMemory(m_pVidMemData);
|
||||
|
||||
m_pVidMemData = NULL;
|
||||
m_dwVidMemDataSize = 0L;
|
||||
|
||||
m_pResourceTags = NULL;
|
||||
m_dwNumResourceTags = 0L;
|
||||
|
||||
m_bInitialized = FALSE;
|
||||
}
|
||||
|
||||
BOOL PackedResource::Initialized() const
|
||||
{
|
||||
return m_bInitialized;
|
||||
}
|
|
@ -988,4 +988,111 @@ extern "C"
|
|||
|
||||
#endif
|
||||
|
||||
DWORD XBResource_SizeOf( LPDIRECT3DRESOURCE pResource );
|
||||
|
||||
//structure member offsets matter
|
||||
struct XBRESOURCE
|
||||
{
|
||||
#if defined(_XBOX1)
|
||||
char *strName;
|
||||
DWORD dwOffset;
|
||||
#elif defined(_XBOX360)
|
||||
DWORD dwType;
|
||||
DWORD dwOffset;
|
||||
DWORD dwSize;
|
||||
char *strName;
|
||||
#endif
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RESOURCETYPE_USERDATA = ( ( 'U' << 24 ) | ( 'S' << 16 ) | ( 'E' << 8 ) | ( 'R' ) ),
|
||||
RESOURCETYPE_TEXTURE = ( ( 'T' << 24 ) | ( 'X' << 16 ) | ( '2' << 8 ) | ( 'D' ) ),
|
||||
RESOURCETYPE_VERTEXBUFFER = ( ( 'V' << 24 ) | ( 'B' << 16 ) | ( 'U' << 8 ) | ( 'F' ) ),
|
||||
RESOURCETYPE_INDEXBUFFER = ( ( 'I' << 24 ) | ( 'B' << 16 ) | ( 'U' << 8 ) | ( 'F' ) ),
|
||||
RESOURCETYPE_EOF = 0xffffffff
|
||||
};
|
||||
|
||||
class PackedResource
|
||||
{
|
||||
protected:
|
||||
BYTE* m_pSysMemData; // Alloc'ed memory for resource headers etc.
|
||||
DWORD m_dwSysMemDataSize;
|
||||
|
||||
BYTE* m_pVidMemData; // Alloc'ed memory for resource data, etc.
|
||||
DWORD m_dwVidMemDataSize;
|
||||
|
||||
XBRESOURCE* m_pResourceTags; // Tags to associate names with the resources
|
||||
DWORD m_dwNumResourceTags; // Number of resource tags
|
||||
BOOL m_bInitialized; // Resource is fully initialized
|
||||
|
||||
public:
|
||||
// Loads the resources out of the specified bundle
|
||||
#if defined(_XBOX1)
|
||||
HRESULT Create( const char *strFilename, DWORD dwNumResourceTags = 0L,
|
||||
XBRESOURCE* pResourceTags = NULL );
|
||||
#elif defined(_XBOX360)
|
||||
HRESULT Create( const char * strFilename );
|
||||
#endif
|
||||
|
||||
void Destroy();
|
||||
|
||||
BOOL Initialized() const;
|
||||
|
||||
#ifdef _XBOX360
|
||||
// Retrieves the resource tags
|
||||
void GetResourceTags( DWORD* pdwNumResourceTags, XBRESOURCE** ppResourceTags );
|
||||
#endif
|
||||
|
||||
// Helper function to make sure a resource is registered
|
||||
LPDIRECT3DRESOURCE RegisterResource( LPDIRECT3DRESOURCE pResource ) const
|
||||
{
|
||||
#ifdef _XBOX1
|
||||
// Register the resource, if it has not yet been registered. We mark
|
||||
// a resource as registered by upping it's reference count.
|
||||
if( pResource && ( pResource->Common & D3DCOMMON_REFCOUNT_MASK ) == 1 )
|
||||
{
|
||||
// Special case CPU-copy push buffers (which live in system memory)
|
||||
if( ( pResource->Common & D3DCOMMON_TYPE_PUSHBUFFER ) &&
|
||||
( pResource->Common & D3DPUSHBUFFER_RUN_USING_CPU_COPY ) )
|
||||
pResource->Data += (DWORD)m_pSysMemData;
|
||||
else
|
||||
pResource->Register( m_pVidMemData );
|
||||
|
||||
pResource->AddRef();
|
||||
}
|
||||
#endif
|
||||
return pResource;
|
||||
}
|
||||
|
||||
// Functions to retrieve resources by their offset
|
||||
void *GetData( DWORD dwOffset ) const
|
||||
{ return &m_pSysMemData[dwOffset]; }
|
||||
|
||||
LPDIRECT3DRESOURCE GetResource( DWORD dwOffset ) const
|
||||
{ return RegisterResource( (LPDIRECT3DRESOURCE)GetData(dwOffset) ); }
|
||||
|
||||
LPDIRECT3DTEXTURE GetTexture( DWORD dwOffset ) const
|
||||
{ return (LPDIRECT3DTEXTURE)GetResource( dwOffset ); }
|
||||
|
||||
LPDIRECT3DVERTEXBUFFER GetVertexBuffer( DWORD dwOffset ) const
|
||||
{ return (LPDIRECT3DVERTEXBUFFER)GetResource( dwOffset ); }
|
||||
|
||||
// Functions to retrieve resources by their name
|
||||
void *GetData( const char* strName ) const;
|
||||
|
||||
LPDIRECT3DRESOURCE GetResource( const char* strName ) const
|
||||
{ return RegisterResource( (LPDIRECT3DRESOURCE)GetData( strName ) ); }
|
||||
|
||||
LPDIRECT3DTEXTURE GetTexture( const char* strName ) const
|
||||
{ return (LPDIRECT3DTEXTURE)GetResource( strName ); }
|
||||
|
||||
LPDIRECT3DVERTEXBUFFER GetVertexBuffer( const char* strName ) const
|
||||
{ return (LPDIRECT3DVERTEXBUFFER)GetResource( strName ); }
|
||||
|
||||
// Constructor/destructor
|
||||
PackedResource();
|
||||
~PackedResource();
|
||||
};
|
||||
|
||||
#endif // __XBOX_INTERNAL_H__
|
||||
|
|
|
@ -15,21 +15,23 @@
|
|||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <time/time.h>
|
||||
|
||||
#include <debug.h>
|
||||
#include <xenos/xenos.h>
|
||||
#include <diskio/ata.h>
|
||||
#include <input/input.h>
|
||||
#include <console/console.h>
|
||||
#include <usb/usbmain.h>
|
||||
#include <time/time.h>
|
||||
#include <ppc/timebase.h>
|
||||
#include <xenon_soc/xenon_power.h>
|
||||
#include <elf/elf.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../../dynamic.h"
|
||||
#include "../../libretro_private.h"
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include <retro_stat.h>
|
||||
|
||||
#include "frontend.h"
|
||||
#include "../system.h"
|
||||
|
@ -345,7 +346,7 @@ int rarch_main(int argc, char *argv[], void *data)
|
|||
ret = rarch_main_iterate(&sleep_ms);
|
||||
|
||||
if (ret == 1 && sleep_ms > 0)
|
||||
rarch_sleep(sleep_ms);
|
||||
retro_sleep(sleep_ms);
|
||||
rarch_main_data_iterate();
|
||||
}while(ret != -1);
|
||||
|
||||
|
|
|
@ -38,10 +38,7 @@ static frontend_ctx_driver_t *frontend_ctx_drivers[] = {
|
|||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
&frontend_ctx_darwin,
|
||||
#endif
|
||||
#if defined(ANDROID)
|
||||
&frontend_ctx_android,
|
||||
#endif
|
||||
#if defined(__linux__) && !defined(ANDROID)
|
||||
#if defined(__linux__)
|
||||
&frontend_ctx_linux,
|
||||
#endif
|
||||
#if defined(PSP) || defined(VITA)
|
||||
|
|
|
@ -81,7 +81,6 @@ extern frontend_ctx_driver_t frontend_ctx_ps3;
|
|||
extern frontend_ctx_driver_t frontend_ctx_xdk;
|
||||
extern frontend_ctx_driver_t frontend_ctx_qnx;
|
||||
extern frontend_ctx_driver_t frontend_ctx_darwin;
|
||||
extern frontend_ctx_driver_t frontend_ctx_android;
|
||||
extern frontend_ctx_driver_t frontend_ctx_linux;
|
||||
extern frontend_ctx_driver_t frontend_ctx_psp;
|
||||
extern frontend_ctx_driver_t frontend_ctx_ctr;
|
||||
|
|
|
@ -158,7 +158,7 @@ static INLINE void rarch_fail(int error_code, const char *error)
|
|||
* just exit right away. */
|
||||
rarch_assert(global->inited.error);
|
||||
|
||||
strcpy(global->error_string, error);
|
||||
strlcpy(global->error_string, error, sizeof(global->error_string));
|
||||
longjmp(global->error_sjlj_context, error_code);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
|
|
|
@ -1628,12 +1628,13 @@ static bool d3d_frame(void *data, const void *frame,
|
|||
{
|
||||
unsigned width, height;
|
||||
D3DVIEWPORT screen_vp;
|
||||
unsigned i = 0;
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const font_renderer_t *font_ctx = driver->font_osd_driver;
|
||||
static struct retro_perf_counter d3d_frame = {0};
|
||||
unsigned i = 0;
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const font_renderer_t *font_ctx = driver->font_osd_driver;
|
||||
|
||||
(void)i;
|
||||
|
||||
|
@ -1642,8 +1643,8 @@ static bool d3d_frame(void *data, const void *frame,
|
|||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(d3d_frame);
|
||||
RARCH_PERFORMANCE_START(d3d_frame);
|
||||
rarch_perf_init(&d3d_frame, "d3d_frame");
|
||||
retro_perf_start(&d3d_frame);
|
||||
|
||||
#ifndef _XBOX
|
||||
/* We cannot recover in fullscreen. */
|
||||
|
@ -1746,7 +1747,7 @@ static bool d3d_frame(void *data, const void *frame,
|
|||
#endif
|
||||
#endif
|
||||
|
||||
RARCH_PERFORMANCE_STOP(d3d_frame);
|
||||
retro_perf_stop(&d3d_frame);
|
||||
|
||||
gfx_ctx_update_window_title(d3d);
|
||||
|
||||
|
@ -1768,11 +1769,12 @@ static bool d3d_read_viewport(void *data, uint8_t *buffer)
|
|||
bool ret = true;
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||
static struct retro_perf_counter d3d_read_viewport = {0};
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(d3d_read_viewport);
|
||||
RARCH_PERFORMANCE_START(d3d_read_viewport);
|
||||
rarch_perf_init(&d3d_read_viewport, "d3d_read_viewport");
|
||||
retro_perf_start(&d3d_read_viewport);
|
||||
|
||||
(void)data;
|
||||
(void)buffer;
|
||||
|
@ -1827,7 +1829,7 @@ static bool d3d_read_viewport(void *data, uint8_t *buffer)
|
|||
ret = false;
|
||||
|
||||
end:
|
||||
RARCH_PERFORMANCE_STOP(d3d_read_viewport);
|
||||
retro_perf_stop(&d3d_read_viewport);
|
||||
if (target)
|
||||
target->Release();
|
||||
if (dest)
|
||||
|
|
|
@ -18,9 +18,13 @@
|
|||
#include <string.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <retro_inline.h>
|
||||
|
||||
#include <Cg/cg.h>
|
||||
#include <Cg/cgD3D9.h>
|
||||
|
||||
#include <retro_inline.h>
|
||||
#include <compat/strl.h>
|
||||
|
||||
#include "render_chain_driver.h"
|
||||
#include "../video_driver.h"
|
||||
#include "../../general.h"
|
||||
|
@ -1166,7 +1170,7 @@ static bool cg_d3d9_renderchain_add_lut(void *data,
|
|||
|
||||
info.tex = lut;
|
||||
info.smooth = smooth;
|
||||
strcpy(info.id, id);
|
||||
strlcpy(info.id, id, sizeof(info.id));
|
||||
if (!lut)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -349,13 +349,14 @@ static bool ctr_frame(void* data, const void* frame,
|
|||
uint64_t frame_count,
|
||||
unsigned pitch, const char* msg)
|
||||
{
|
||||
ctr_video_t* ctr = (ctr_video_t*)data;
|
||||
settings_t* settings = config_get_ptr();
|
||||
|
||||
uint32_t diff;
|
||||
static uint64_t currentTick,lastTick;
|
||||
static float fps = 0.0;
|
||||
ctr_video_t *ctr = (ctr_video_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
static float fps = 0.0;
|
||||
static int total_frames = 0;
|
||||
static int frames = 0;
|
||||
static int frames = 0;
|
||||
static struct retro_perf_counter ctrframe_f = {0};
|
||||
|
||||
extern bool select_pressed;
|
||||
|
||||
|
@ -390,7 +391,7 @@ static bool ctr_frame(void* data, const void* frame,
|
|||
svcClearEvent(gspEvents[GSPEVENT_VBlank0]);
|
||||
|
||||
currentTick = svcGetSystemTick();
|
||||
uint32_t diff = currentTick - lastTick;
|
||||
diff = currentTick - lastTick;
|
||||
if(diff > CTR_CPU_TICKS_PER_SECOND)
|
||||
{
|
||||
fps = (float)frames * ((float) CTR_CPU_TICKS_PER_SECOND / (float) diff);
|
||||
|
@ -401,14 +402,12 @@ static bool ctr_frame(void* data, const void* frame,
|
|||
printf("fps: %8.4f frames: %i\r", fps, total_frames++);
|
||||
fflush(stdout);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(ctrframe_f);
|
||||
RARCH_PERFORMANCE_START(ctrframe_f);
|
||||
rarch_perf_init(&ctrframe_f, "ctrframe_f");
|
||||
retro_perf_start(&ctrframe_f);
|
||||
|
||||
if (ctr->should_resize)
|
||||
ctr_update_viewport(ctr);
|
||||
|
||||
|
||||
|
||||
ctrGuSetMemoryFill(true, (u32*)CTR_GPU_FRAMEBUFFER, 0x00000000,
|
||||
(u32*)(CTR_GPU_FRAMEBUFFER + CTR_TOP_FRAMEBUFFER_WIDTH * CTR_TOP_FRAMEBUFFER_HEIGHT * sizeof(uint32_t)),
|
||||
0x201, (u32*)CTR_GPU_DEPTHBUFFER, 0x00000000,
|
||||
|
@ -435,8 +434,9 @@ static bool ctr_frame(void* data, const void* frame,
|
|||
else
|
||||
{
|
||||
int i;
|
||||
uint16_t* dst = (uint16_t*)ctr->texture_linear;
|
||||
const uint8_t* src = frame;
|
||||
uint16_t *dst = (uint16_t*)ctr->texture_linear;
|
||||
const uint8_t *src = frame;
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
memcpy(dst, src, width * sizeof(uint16_t));
|
||||
|
@ -496,7 +496,7 @@ static bool ctr_frame(void* data, const void* frame,
|
|||
gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), 240,400,CTRGU_RGB8, CTRGU_MULTISAMPLE_NONE);
|
||||
|
||||
gfxSwapBuffersGpu();
|
||||
RARCH_PERFORMANCE_STOP(ctrframe_f);
|
||||
retro_perf_stop(&ctrframe_f);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ extern Handle gspEvents[GSPEVENT_MAX];
|
|||
extern u32* gpuCmdBuf;
|
||||
extern u32 gpuCmdBufOffset;
|
||||
extern u32 __linear_heap_size;
|
||||
extern u32* __linear_heap;
|
||||
extern u32 __linear_heap;
|
||||
|
||||
__attribute__((always_inline))
|
||||
static INLINE void ctrGuSetTexture(GPU_TEXUNIT unit, u32* data,
|
||||
|
@ -119,7 +119,7 @@ __attribute__((always_inline))
|
|||
static INLINE void ctrGuFlushAndRun(bool queued)
|
||||
{
|
||||
//take advantage of GX_SetCommandList_First to flush gsp heap
|
||||
ctrGuSetCommandList_First(queued, gpuCmdBuf, gpuCmdBufOffset*4, __linear_heap, __linear_heap_size, NULL, 0);
|
||||
ctrGuSetCommandList_First(queued, gpuCmdBuf, gpuCmdBufOffset*4, (u32*)__linear_heap, __linear_heap_size, NULL, 0);
|
||||
ctrGuSetCommandList_Last(queued, gpuCmdBuf, gpuCmdBufOffset*4, 0x0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1389,8 +1389,10 @@ static void gl_init_textures(gl_t *gl, const video_info_t *video)
|
|||
static INLINE void gl_copy_frame(gl_t *gl, const void *frame,
|
||||
unsigned width, unsigned height, unsigned pitch)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(copy_frame);
|
||||
RARCH_PERFORMANCE_START(copy_frame);
|
||||
static struct retro_perf_counter copy_frame = {0};
|
||||
|
||||
rarch_perf_init(©_frame, "copy_frame");
|
||||
retro_perf_start(©_frame);
|
||||
|
||||
#if defined(HAVE_OPENGLES2)
|
||||
#if defined(HAVE_EGL)
|
||||
|
@ -1500,7 +1502,7 @@ static INLINE void gl_copy_frame(gl_t *gl, const void *frame,
|
|||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
}
|
||||
#endif
|
||||
RARCH_PERFORMANCE_STOP(copy_frame);
|
||||
retro_perf_stop(©_frame);
|
||||
}
|
||||
|
||||
static INLINE void gl_set_prev_texture(gl_t *gl,
|
||||
|
@ -1536,6 +1538,8 @@ static INLINE void gl_set_shader_viewport(gl_t *gl, unsigned shader)
|
|||
#if defined(HAVE_GL_ASYNC_READBACK) && defined(HAVE_MENU)
|
||||
static void gl_pbo_async_readback(gl_t *gl)
|
||||
{
|
||||
static struct retro_perf_counter async_readback = {0};
|
||||
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER,
|
||||
gl->pbo_readback[gl->pbo_readback_index++]);
|
||||
gl->pbo_readback_index &= 3;
|
||||
|
@ -1548,8 +1552,8 @@ static void gl_pbo_async_readback(gl_t *gl)
|
|||
video_pixel_get_alignment(gl->vp.width * sizeof(uint32_t)));
|
||||
|
||||
/* Read asynchronously into PBO buffer. */
|
||||
RARCH_PERFORMANCE_INIT(async_readback);
|
||||
RARCH_PERFORMANCE_START(async_readback);
|
||||
rarch_perf_init(&async_readback, "async_readback");
|
||||
retro_perf_start(&async_readback);
|
||||
glReadBuffer(GL_BACK);
|
||||
#ifdef HAVE_OPENGLES3
|
||||
glReadPixels(gl->vp.x, gl->vp.y,
|
||||
|
@ -1560,7 +1564,7 @@ static void gl_pbo_async_readback(gl_t *gl)
|
|||
gl->vp.width, gl->vp.height,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
|
||||
#endif
|
||||
RARCH_PERFORMANCE_STOP(async_readback);
|
||||
retro_perf_stop(&async_readback);
|
||||
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||
}
|
||||
|
@ -1629,13 +1633,15 @@ static bool gl_frame(void *data, const void *frame,
|
|||
unsigned pitch, const char *msg)
|
||||
{
|
||||
unsigned width, height;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct gfx_tex_info feedback_info;
|
||||
static struct retro_perf_counter frame_run = {0};
|
||||
gl_t *gl = (gl_t*)data;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const struct font_renderer *font_driver = driver ? driver->font_osd_driver : NULL;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(frame_run);
|
||||
RARCH_PERFORMANCE_START(frame_run);
|
||||
rarch_perf_init(&frame_run, "frame_run");
|
||||
retro_perf_start(&frame_run);
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
|
@ -1737,7 +1743,8 @@ static bool gl_frame(void *data, const void *frame,
|
|||
gl->tex_info.tex_size[0] = gl->tex_w;
|
||||
gl->tex_info.tex_size[1] = gl->tex_h;
|
||||
|
||||
struct gfx_tex_info feedback_info = gl->tex_info;
|
||||
feedback_info = gl->tex_info;
|
||||
|
||||
if (gl->fbo_feedback_enable)
|
||||
{
|
||||
const struct gfx_fbo_rect *rect = &gl->fbo_rect[gl->fbo_feedback_pass];
|
||||
|
@ -1796,7 +1803,7 @@ static bool gl_frame(void *data, const void *frame,
|
|||
|
||||
gfx_ctx_update_window_title(gl);
|
||||
|
||||
RARCH_PERFORMANCE_STOP(frame_run);
|
||||
retro_perf_stop(&frame_run);
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
/* Reset state which could easily mess up libretro core. */
|
||||
|
@ -1846,8 +1853,10 @@ static bool gl_frame(void *data, const void *frame,
|
|||
#ifdef HAVE_GL_SYNC
|
||||
if (settings->video.hard_sync && gl->have_sync)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(gl_fence);
|
||||
RARCH_PERFORMANCE_START(gl_fence);
|
||||
static struct retro_perf_counter gl_fence = {0};
|
||||
|
||||
rarch_perf_init(&gl_fence, "gl_fence");
|
||||
retro_perf_start(&gl_fence);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->fences[gl->fence_count++] =
|
||||
glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
|
@ -1863,7 +1872,7 @@ static bool gl_frame(void *data, const void *frame,
|
|||
gl->fence_count * sizeof(GLsync));
|
||||
}
|
||||
|
||||
RARCH_PERFORMANCE_STOP(gl_fence);
|
||||
retro_perf_stop(&gl_fence);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2844,16 +2853,17 @@ static bool gl_read_viewport(void *data, uint8_t *buffer)
|
|||
#else
|
||||
static bool gl_read_viewport(void *data, uint8_t *buffer)
|
||||
{
|
||||
unsigned num_pixels = 0;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
static struct retro_perf_counter read_viewport = {0};
|
||||
unsigned num_pixels = 0;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
|
||||
if (!gl)
|
||||
return false;
|
||||
|
||||
context_bind_hw_render(gl, false);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(read_viewport);
|
||||
RARCH_PERFORMANCE_START(read_viewport);
|
||||
rarch_perf_init(&read_viewport, "read_viewport");
|
||||
retro_perf_start(&read_viewport);
|
||||
|
||||
#ifdef HAVE_GL_ASYNC_READBACK
|
||||
if (gl->pbo_readback_enable)
|
||||
|
@ -2927,7 +2937,7 @@ static bool gl_read_viewport(void *data, uint8_t *buffer)
|
|||
gl->readback_buffer_screenshot = malloc(num_pixels * sizeof(uint32_t));
|
||||
if (!gl->readback_buffer_screenshot)
|
||||
{
|
||||
RARCH_PERFORMANCE_STOP(read_viewport);
|
||||
retro_perf_stop(&read_viewport);
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -2947,7 +2957,7 @@ static bool gl_read_viewport(void *data, uint8_t *buffer)
|
|||
gl->readback_buffer_screenshot = NULL;
|
||||
}
|
||||
|
||||
RARCH_PERFORMANCE_STOP(read_viewport);
|
||||
retro_perf_stop(&read_viewport);
|
||||
context_bind_hw_render(gl, true);
|
||||
return true;
|
||||
|
||||
|
|
|
@ -14,6 +14,14 @@
|
|||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <gccore.h>
|
||||
#include <ogcsys.h>
|
||||
|
||||
#include <retro_file.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
|
@ -24,15 +32,9 @@
|
|||
#include "../video_monitor.h"
|
||||
|
||||
#ifdef HW_RVL
|
||||
#include "../../wii/mem2_manager.h"
|
||||
#include "../../memory/wii/mem2_manager.h"
|
||||
#endif
|
||||
|
||||
#include <gccore.h>
|
||||
#include <ogcsys.h>
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ppc_asm.h"
|
||||
#include "gx_gfx_inl.h"
|
||||
#include "../../defines/gx_defines.h"
|
||||
|
@ -600,19 +602,19 @@ static void build_disp_list(void)
|
|||
static void gx_efb_screenshot(void)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
uint8_t tga_header[] = {0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0xE0, 0x01, 0x18, 0x00};
|
||||
FILE *out = fopen("/screenshot.tga", "wb");
|
||||
RFILE *out = retro_fopen("/screenshot.tga", RFILE_MODE_WRITE, -1);
|
||||
|
||||
if (!out)
|
||||
return;
|
||||
|
||||
fwrite(tga_header, 1, sizeof(tga_header), out);
|
||||
retro_fwrite(out, tga_header, sizeof(tga_header));
|
||||
|
||||
for (y = 479; y >= 0; --y)
|
||||
{
|
||||
uint8_t line[640 * 3];
|
||||
unsigned i = 0;
|
||||
|
||||
for (x = 0; x < 640; x++)
|
||||
{
|
||||
GXColor color;
|
||||
|
@ -621,10 +623,10 @@ static void gx_efb_screenshot(void)
|
|||
line[i++] = color.g;
|
||||
line[i++] = color.r;
|
||||
}
|
||||
fwrite(line, 1, sizeof(line), out);
|
||||
retro_fwrite(out, line, sizeof(line));
|
||||
}
|
||||
|
||||
fclose(out);
|
||||
retro_fclose(out);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1035,15 +1037,16 @@ static bool gx_frame(void *data, const void *frame,
|
|||
uint64_t frame_count, unsigned pitch,
|
||||
const char *msg)
|
||||
{
|
||||
char fps_txt[128] = {0};
|
||||
char fps_text_buf[128] = {0};
|
||||
gx_video_t *gx = (gx_video_t*)data;
|
||||
struct __gx_regdef *__gx = (struct __gx_regdef*)__gxregs;
|
||||
u8 clear_efb = GX_FALSE;
|
||||
settings_t *settings = config_get_ptr();
|
||||
static struct retro_perf_counter gx_frame = {0};
|
||||
char fps_txt[128] = {0};
|
||||
char fps_text_buf[128] = {0};
|
||||
gx_video_t *gx = (gx_video_t*)data;
|
||||
struct __gx_regdef *__gx = (struct __gx_regdef*)__gxregs;
|
||||
u8 clear_efb = GX_FALSE;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
RARCH_PERFORMANCE_INIT(gx_frame);
|
||||
RARCH_PERFORMANCE_START(gx_frame);
|
||||
rarch_perf_init(&gx_frame, "gx_frame");
|
||||
retro_perf_start(&gx_frame);
|
||||
|
||||
if(!gx || (!frame && !gx->menu_texture_enable))
|
||||
return true;
|
||||
|
@ -1076,8 +1079,10 @@ static bool gx_frame(void *data, const void *frame,
|
|||
|
||||
if (frame)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(gx_frame_convert);
|
||||
RARCH_PERFORMANCE_START(gx_frame_convert);
|
||||
static struct retro_perf_counter gx_frame_convert = {0};
|
||||
|
||||
rarch_perf_init(&gx_frame_convert, "gx_frame_convert");
|
||||
retro_perf_start(&gx_frame_convert);
|
||||
|
||||
if (gx->rgb32)
|
||||
convert_texture32(frame, g_tex.data, width, height, pitch);
|
||||
|
@ -1087,7 +1092,7 @@ static bool gx_frame(void *data, const void *frame,
|
|||
convert_texture16(frame, g_tex.data, width, height, pitch);
|
||||
DCFlushRange(g_tex.data, height * (width << (gx->rgb32 ? 2 : 1)));
|
||||
|
||||
RARCH_PERFORMANCE_STOP(gx_frame_convert);
|
||||
retro_perf_stop(&gx_frame_convert);
|
||||
}
|
||||
|
||||
if (gx->menu_texture_enable && gx->menu_data)
|
||||
|
@ -1164,7 +1169,7 @@ static bool gx_frame(void *data, const void *frame,
|
|||
VISetNextFrameBuffer(g_framebuf[g_current_framebuf]);
|
||||
VIFlush();
|
||||
|
||||
RARCH_PERFORMANCE_STOP(gx_frame);
|
||||
retro_perf_stop(&gx_frame);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -37,11 +37,14 @@
|
|||
*
|
||||
****************************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <gccore.h>
|
||||
#include <ogcsys.h>
|
||||
#include "../gfx/drivers/ppc_asm.h"
|
||||
#include <retro_inline.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "../../gfx/drivers/ppc_asm.h"
|
||||
|
||||
/****************************************************************************
|
||||
* I2C driver by Hector Martin (marcan)
|
||||
|
@ -61,150 +64,151 @@ static vu32* const _i2cReg = (u32*)0xCD800000;
|
|||
|
||||
static INLINE void __viOpenI2C(u32 channel)
|
||||
{
|
||||
u32 val = ((_i2cReg[49]&~0x8000)|0x4000);
|
||||
val |= _SHIFTL(channel,15,1);
|
||||
u32 val = ((_i2cReg[49]&~0x8000)|0x4000) | _SHIFTL(channel,15,1);
|
||||
_i2cReg[49] = val;
|
||||
}
|
||||
|
||||
static INLINE void __viSetSCL(u32 channel)
|
||||
{
|
||||
u32 val = (_i2cReg[48]&~0x4000);
|
||||
val |= _SHIFTL(channel,14,1);
|
||||
_i2cReg[48] = val;
|
||||
u32 val = (_i2cReg[48]&~0x4000) | _SHIFTL(channel,14,1);
|
||||
_i2cReg[48] = val;
|
||||
}
|
||||
|
||||
static INLINE void __viSetSDA(u32 channel)
|
||||
{
|
||||
u32 val = (_i2cReg[48]&~0x8000);
|
||||
val |= _SHIFTL(channel,15,1);
|
||||
_i2cReg[48] = val;
|
||||
u32 val = (_i2cReg[48]&~0x8000) | _SHIFTL(channel,15,1);
|
||||
_i2cReg[48] = val;
|
||||
}
|
||||
|
||||
#define __viGetSDA() (_SHIFTR(_i2cReg[50],15,1))
|
||||
|
||||
static u32 __sendSlaveAddress(u8 addr)
|
||||
{
|
||||
u32 i;
|
||||
u32 i;
|
||||
|
||||
__viSetSDA(i2cIdentFlag^1);
|
||||
udelay(2);
|
||||
__viSetSDA(i2cIdentFlag^1);
|
||||
udelay(2);
|
||||
|
||||
__viSetSCL(0);
|
||||
for(i=0;i<8;i++) {
|
||||
if(addr&0x80) __viSetSDA(i2cIdentFlag);
|
||||
else __viSetSDA(i2cIdentFlag^1);
|
||||
udelay(2);
|
||||
__viSetSCL(0);
|
||||
for(i=0;i<8;i++)
|
||||
{
|
||||
if (addr&0x80)
|
||||
__viSetSDA(i2cIdentFlag);
|
||||
else
|
||||
__viSetSDA(i2cIdentFlag^1);
|
||||
udelay(2);
|
||||
|
||||
__viSetSCL(1);
|
||||
udelay(2);
|
||||
__viSetSCL(1);
|
||||
udelay(2);
|
||||
|
||||
__viSetSCL(0);
|
||||
addr <<= 1;
|
||||
}
|
||||
__viSetSCL(0);
|
||||
addr <<= 1;
|
||||
}
|
||||
|
||||
__viOpenI2C(0);
|
||||
udelay(2);
|
||||
__viOpenI2C(0);
|
||||
udelay(2);
|
||||
|
||||
__viSetSCL(1);
|
||||
udelay(2);
|
||||
__viSetSCL(1);
|
||||
udelay(2);
|
||||
|
||||
if(i2cIdentFlag==1 && __viGetSDA()!=0) return 0;
|
||||
if(i2cIdentFlag==1 && __viGetSDA()!=0)
|
||||
return 0;
|
||||
|
||||
__viSetSDA(i2cIdentFlag^1);
|
||||
__viOpenI2C(1);
|
||||
__viSetSCL(0);
|
||||
__viSetSDA(i2cIdentFlag^1);
|
||||
__viOpenI2C(1);
|
||||
__viSetSCL(0);
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void VIDEO_SetTrapFilter(bool enable)
|
||||
{
|
||||
u8 disable;
|
||||
u8 data;
|
||||
u8 reg;
|
||||
u8 buf[2];
|
||||
void *val;
|
||||
u8 buf[2];
|
||||
s32 i,j;
|
||||
u32 c, level, ret;
|
||||
|
||||
disable = !enable;
|
||||
data = !disable;
|
||||
reg = 0x03;
|
||||
u8 disable = !enable;
|
||||
u8 data = !disable;
|
||||
u8 reg = 0x03;
|
||||
u8 addr = 0xe0;
|
||||
u32 len = 2;
|
||||
|
||||
buf[0] = reg;
|
||||
buf[1] = data;
|
||||
buf[0] = reg;
|
||||
buf[1] = data;
|
||||
|
||||
u8 addr = 0xe0;
|
||||
void* val = buf;
|
||||
u32 len = 2;
|
||||
val = buf;
|
||||
|
||||
u8 c;
|
||||
s32 i,j;
|
||||
u32 level,ret;
|
||||
if(i2cIdentFirst==0)
|
||||
{
|
||||
__viOpenI2C(0);
|
||||
udelay(4);
|
||||
|
||||
if(i2cIdentFirst==0)
|
||||
{
|
||||
__viOpenI2C(0);
|
||||
udelay(4);
|
||||
i2cIdentFlag = 0;
|
||||
if(__viGetSDA()!=0)
|
||||
i2cIdentFlag = 1;
|
||||
i2cIdentFirst = 1;
|
||||
}
|
||||
|
||||
i2cIdentFlag = 0;
|
||||
if(__viGetSDA()!=0)
|
||||
i2cIdentFlag = 1;
|
||||
i2cIdentFirst = 1;
|
||||
}
|
||||
_CPU_ISR_Disable(level);
|
||||
(void)level;
|
||||
|
||||
_CPU_ISR_Disable(level);
|
||||
(void)level;
|
||||
__viOpenI2C(1);
|
||||
__viSetSCL(1);
|
||||
|
||||
__viOpenI2C(1);
|
||||
__viSetSCL(1);
|
||||
__viSetSDA(i2cIdentFlag);
|
||||
udelay(4);
|
||||
|
||||
__viSetSDA(i2cIdentFlag);
|
||||
udelay(4);
|
||||
ret = __sendSlaveAddress(addr);
|
||||
if(ret==0) {
|
||||
_CPU_ISR_Restore(level);
|
||||
goto end;
|
||||
}
|
||||
|
||||
ret = __sendSlaveAddress(addr);
|
||||
if(ret==0) {
|
||||
_CPU_ISR_Restore(level);
|
||||
goto end;
|
||||
}
|
||||
__viOpenI2C(1);
|
||||
for(i=0;i<len;i++)
|
||||
{
|
||||
c = ((u8*)val)[i];
|
||||
for(j=0;j<8;j++)
|
||||
{
|
||||
u32 chan = i2cIdentFlag;
|
||||
if(c&0x80) {}
|
||||
else
|
||||
chan ^= 1;
|
||||
|
||||
__viOpenI2C(1);
|
||||
for(i=0;i<len;i++) {
|
||||
c = ((u8*)val)[i];
|
||||
for(j=0;j<8;j++) {
|
||||
u32 chan = i2cIdentFlag;
|
||||
if(c&0x80) {}
|
||||
else
|
||||
chan ^= 1;
|
||||
__viSetSDA(chan);
|
||||
udelay(2);
|
||||
|
||||
__viSetSDA(chan);
|
||||
udelay(2);
|
||||
__viSetSCL(1);
|
||||
udelay(2);
|
||||
__viSetSCL(0);
|
||||
|
||||
__viSetSCL(1);
|
||||
udelay(2);
|
||||
__viSetSCL(0);
|
||||
c <<= 1;
|
||||
}
|
||||
__viOpenI2C(0);
|
||||
udelay(2);
|
||||
__viSetSCL(1);
|
||||
udelay(2);
|
||||
|
||||
c <<= 1;
|
||||
}
|
||||
__viOpenI2C(0);
|
||||
udelay(2);
|
||||
__viSetSCL(1);
|
||||
udelay(2);
|
||||
if(i2cIdentFlag==1 && __viGetSDA()!=0)
|
||||
{
|
||||
_CPU_ISR_Restore(level);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if(i2cIdentFlag==1 && __viGetSDA()!=0) {
|
||||
_CPU_ISR_Restore(level);
|
||||
goto end;
|
||||
}
|
||||
__viSetSDA(i2cIdentFlag^1);
|
||||
__viOpenI2C(1);
|
||||
__viSetSCL(0);
|
||||
}
|
||||
|
||||
__viSetSDA(i2cIdentFlag^1);
|
||||
__viOpenI2C(1);
|
||||
__viSetSCL(0);
|
||||
}
|
||||
__viOpenI2C(1);
|
||||
__viSetSDA(i2cIdentFlag^1);
|
||||
udelay(2);
|
||||
__viSetSDA(i2cIdentFlag);
|
||||
|
||||
__viOpenI2C(1);
|
||||
__viSetSDA(i2cIdentFlag^1);
|
||||
udelay(2);
|
||||
__viSetSDA(i2cIdentFlag);
|
||||
|
||||
_CPU_ISR_Restore(level);
|
||||
_CPU_ISR_Restore(level);
|
||||
|
||||
end:
|
||||
|
||||
udelay(2);
|
||||
udelay(2);
|
||||
}
|
|
@ -463,15 +463,17 @@ static bool psp_frame(void *data, const void *frame,
|
|||
unsigned width, unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg)
|
||||
{
|
||||
static char fps_txt[128] = {0};
|
||||
static char fps_text_buf[128] = {0};
|
||||
psp1_video_t *psp = (psp1_video_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
#ifdef DISPLAY_FPS
|
||||
uint32_t diff;
|
||||
static uint64_t currentTick,lastTick;
|
||||
static float fps=0.0;
|
||||
static int frames;
|
||||
static float fps = 0.0;
|
||||
#endif
|
||||
static struct retro_perf_counter psp_frame_run = {0};
|
||||
static char fps_txt[128] = {0};
|
||||
static char fps_text_buf[128] = {0};
|
||||
psp1_video_t *psp = (psp1_video_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!width || !height)
|
||||
return false;
|
||||
|
@ -510,7 +512,7 @@ static bool psp_frame(void *data, const void *frame,
|
|||
#ifdef DISPLAY_FPS
|
||||
frames++;
|
||||
sceRtcGetCurrentTick(¤tTick);
|
||||
uint32_t diff = currentTick - lastTick;
|
||||
diff = currentTick - lastTick;
|
||||
if(diff > 1000000)
|
||||
{
|
||||
fps = (float)frames * 1000000.0 / diff;
|
||||
|
@ -524,8 +526,8 @@ static bool psp_frame(void *data, const void *frame,
|
|||
|
||||
psp->draw_buffer = FROM_GU_POINTER(sceGuSwapBuffers());
|
||||
|
||||
RARCH_PERFORMANCE_INIT(psp_frame_run);
|
||||
RARCH_PERFORMANCE_START(psp_frame_run);
|
||||
rarch_perf_init(&psp_frame_run, "psp_frame_run");
|
||||
retro_perf_start(&psp_frame_run);
|
||||
|
||||
if (psp->should_resize)
|
||||
psp_update_viewport(psp);
|
||||
|
@ -558,7 +560,7 @@ static bool psp_frame(void *data, const void *frame,
|
|||
|
||||
sceGuFinish();
|
||||
|
||||
RARCH_PERFORMANCE_STOP(psp_frame_run);
|
||||
retro_perf_stop(&psp_frame_run);
|
||||
|
||||
if(psp->menu.active)
|
||||
{
|
||||
|
|
|
@ -340,11 +340,12 @@ static void sdl_refresh_input_size(sdl2_video_t *vid, bool menu, bool rgb32,
|
|||
|| target->rgb32 != rgb32 || target->pitch != pitch)
|
||||
{
|
||||
unsigned format;
|
||||
static struct retro_perf_counter sdl_create_texture = {0};
|
||||
|
||||
sdl_tex_zero(target);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(sdl_create_texture);
|
||||
RARCH_PERFORMANCE_START(sdl_create_texture);
|
||||
rarch_perf_init(&sdl_create_texture, "sdl_create_texture");
|
||||
retro_perf_start(&sdl_create_texture);
|
||||
|
||||
if (menu)
|
||||
format = rgb32 ? SDL_PIXELFORMAT_ARGB8888 : SDL_PIXELFORMAT_RGBA4444;
|
||||
|
@ -358,7 +359,7 @@ static void sdl_refresh_input_size(sdl2_video_t *vid, bool menu, bool rgb32,
|
|||
target->tex = SDL_CreateTexture(vid->renderer, format,
|
||||
SDL_TEXTUREACCESS_STREAMING, width, height);
|
||||
|
||||
RARCH_PERFORMANCE_STOP(sdl_create_texture);
|
||||
retro_perf_stop(&sdl_create_texture);
|
||||
|
||||
if (!target->tex)
|
||||
{
|
||||
|
@ -502,14 +503,16 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width,
|
|||
|
||||
if (frame)
|
||||
{
|
||||
static struct retro_perf_counter sdl_copy_frame = {0};
|
||||
|
||||
sdl_refresh_input_size(vid, false, vid->video.rgb32, width, height, pitch);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(sdl_copy_frame);
|
||||
RARCH_PERFORMANCE_START(sdl_copy_frame);
|
||||
rarch_perf_init(&sdl_copy_frame, "sdl_copy_frame");
|
||||
retro_perf_start(&sdl_copy_frame);
|
||||
|
||||
SDL_UpdateTexture(vid->frame.tex, NULL, frame, pitch);
|
||||
|
||||
RARCH_PERFORMANCE_STOP(sdl_copy_frame);
|
||||
retro_perf_stop(&sdl_copy_frame);
|
||||
}
|
||||
|
||||
SDL_RenderCopyEx(vid->renderer, vid->frame.tex, NULL, NULL, vid->rotation, NULL, SDL_FLIP_NONE);
|
||||
|
@ -620,9 +623,10 @@ static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer)
|
|||
{
|
||||
SDL_Surface *surf = NULL, *bgr24 = NULL;
|
||||
sdl2_video_t *vid = (sdl2_video_t*)data;
|
||||
static struct retro_perf_counter sdl2_gfx_read_viewport = {0};
|
||||
|
||||
RARCH_PERFORMANCE_INIT(sdl2_gfx_read_viewport);
|
||||
RARCH_PERFORMANCE_START(sdl2_gfx_read_viewport);
|
||||
rarch_perf_init(&sdl2_gfx_read_viewport, "sdl2_gfx_read_viewport");
|
||||
retro_perf_start(&sdl2_gfx_read_viewport);
|
||||
|
||||
video_driver_cached_frame();
|
||||
|
||||
|
@ -637,7 +641,7 @@ static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer)
|
|||
|
||||
memcpy(buffer, bgr24->pixels, bgr24->h * bgr24->pitch);
|
||||
|
||||
RARCH_PERFORMANCE_STOP(sdl2_gfx_read_viewport);
|
||||
retro_perf_stop(&sdl2_gfx_read_viewport);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -695,15 +699,17 @@ static void sdl2_poke_set_texture_frame(void *data, const void *frame, bool rgb3
|
|||
|
||||
if (frame)
|
||||
{
|
||||
static struct retro_perf_counter copy_texture_frame = {0};
|
||||
|
||||
sdl_refresh_input_size(vid, true, rgb32, width, height,
|
||||
width * (rgb32 ? 4 : 2));
|
||||
|
||||
RARCH_PERFORMANCE_INIT(copy_texture_frame);
|
||||
RARCH_PERFORMANCE_START(copy_texture_frame);
|
||||
rarch_perf_init(©_texture_frame, "copy_texture_frame");
|
||||
retro_perf_start(©_texture_frame);
|
||||
|
||||
SDL_UpdateTexture(vid->menu.tex, NULL, frame, vid->menu.pitch);
|
||||
|
||||
RARCH_PERFORMANCE_STOP(copy_texture_frame);
|
||||
retro_perf_stop(©_texture_frame);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -348,8 +348,9 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
|
|||
unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg)
|
||||
{
|
||||
char buf[128] = {0};
|
||||
sdl_video_t *vid = (sdl_video_t*)data;
|
||||
char buf[128] = {0};
|
||||
static struct retro_perf_counter sdl_scale = {0};
|
||||
sdl_video_t *vid = (sdl_video_t*)data;
|
||||
|
||||
if (!frame)
|
||||
return true;
|
||||
|
@ -359,10 +360,10 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
|
|||
if (SDL_MUSTLOCK(vid->screen))
|
||||
SDL_LockSurface(vid->screen);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(sdl_scale);
|
||||
RARCH_PERFORMANCE_START(sdl_scale);
|
||||
rarch_perf_init(&sdl_scale, "sdl_scale");
|
||||
retro_perf_start(&sdl_scale);
|
||||
scaler_ctx_scale(&vid->scaler, vid->screen->pixels, frame);
|
||||
RARCH_PERFORMANCE_STOP(sdl_scale);
|
||||
retro_perf_stop(&sdl_scale);
|
||||
|
||||
if (vid->menu.active)
|
||||
SDL_BlitSurface(vid->menu.frame, NULL, vid->screen, NULL);
|
||||
|
|
|
@ -314,10 +314,12 @@ static bool vg_frame(void *data, const void *frame,
|
|||
uint64_t frame_count, unsigned pitch, const char *msg)
|
||||
{
|
||||
unsigned width, height;
|
||||
vg_t *vg = (vg_t*)data;
|
||||
vg_t *vg = (vg_t*)data;
|
||||
static struct retro_perf_counter vg_fr = {0};
|
||||
static struct retro_perf_counter vg_image = {0};
|
||||
|
||||
RARCH_PERFORMANCE_INIT(vg_fr);
|
||||
RARCH_PERFORMANCE_START(vg_fr);
|
||||
rarch_perf_init(&vg_fr, "vg_fr");
|
||||
retro_perf_start(&vg_fr);
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
|
@ -341,10 +343,10 @@ static bool vg_frame(void *data, const void *frame,
|
|||
vgClear(0, 0, width, height);
|
||||
vgSeti(VG_SCISSORING, VG_TRUE);
|
||||
|
||||
RARCH_PERFORMANCE_INIT(vg_image);
|
||||
RARCH_PERFORMANCE_START(vg_image);
|
||||
rarch_perf_init(&vg_image, "vg_image");
|
||||
retro_perf_start(&vg_image);
|
||||
vg_copy_frame(vg, frame, frame_width, frame_height, pitch);
|
||||
RARCH_PERFORMANCE_STOP(vg_image);
|
||||
retro_perf_stop(&vg_image);
|
||||
|
||||
vgDrawImage(vg->mImage);
|
||||
|
||||
|
@ -355,7 +357,7 @@ static bool vg_frame(void *data, const void *frame,
|
|||
|
||||
gfx_ctx_update_window_title(vg);
|
||||
|
||||
RARCH_PERFORMANCE_STOP(vg_fr);
|
||||
retro_perf_stop(&vg_fr);
|
||||
|
||||
gfx_ctx_swap_buffers(vg);
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ static void *vita2d_gfx_init(const video_info_t *video,
|
|||
RARCH_SCALE_BASE, video->input_scale, RARCH_SCALE_BASE * video->input_scale);
|
||||
|
||||
vita2d_init();
|
||||
vita2d_set_clear_color(RGBA8(0x40, 0x40, 0x40, 0xFF));
|
||||
vita2d_set_clear_color(RGBA8(0x00, 0x00, 0x00, 0xFF));
|
||||
vita2d_set_vblank_wait(video->vsync);
|
||||
|
||||
if (vita->rgb32)
|
||||
|
@ -142,7 +142,7 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
|
|||
vita->width = width;
|
||||
vita->height = height;
|
||||
vita->texture = vita2d_create_empty_texture_format(width, height, vita->format);
|
||||
vita2d_texture_set_texture_filter(vita->texture,vita->tex_filter);
|
||||
vita2d_texture_set_filters(vita->texture,vita->tex_filter,vita->tex_filter);
|
||||
}
|
||||
tex_p = vita2d_texture_get_datap(vita->texture);
|
||||
stride = vita2d_texture_get_stride(vita->texture);
|
||||
|
@ -424,7 +424,7 @@ static void vita_set_filtering(void *data, unsigned index, bool smooth)
|
|||
if (vita)
|
||||
{
|
||||
vita->tex_filter = smooth? SCE_GXM_TEXTURE_FILTER_LINEAR : SCE_GXM_TEXTURE_FILTER_POINT;
|
||||
vita2d_texture_set_texture_filter(vita->texture,vita->tex_filter);
|
||||
vita2d_texture_set_filters(vita->texture,vita->tex_filter,vita->tex_filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -499,7 +499,7 @@ static void vita_set_texture_frame(void *data, const void *frame, bool rgb32,
|
|||
vita->menu.width = width;
|
||||
vita->menu.height = height;
|
||||
}
|
||||
vita2d_texture_set_texture_filter(vita->menu.texture,SCE_GXM_TEXTURE_FILTER_LINEAR);
|
||||
vita2d_texture_set_filters(vita->menu.texture,SCE_GXM_TEXTURE_FILTER_LINEAR,SCE_GXM_TEXTURE_FILTER_LINEAR);
|
||||
tex_p = vita2d_texture_get_datap(vita->menu.texture);
|
||||
stride = vita2d_texture_get_stride(vita->menu.texture);
|
||||
|
||||
|
|
|
@ -13,6 +13,12 @@
|
|||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <sys/system_properties.h>
|
||||
|
||||
#include <formats/image.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
|
@ -20,12 +26,7 @@
|
|||
#include "../video_monitor.h"
|
||||
#include "../drivers/gl_common.h"
|
||||
|
||||
#include <EGL/egl.h>
|
||||
|
||||
#include "../../frontend/drivers/platform_android.h"
|
||||
#include <formats/image.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../../frontend/drivers/platform_linux.h"
|
||||
|
||||
/* forward declaration */
|
||||
int system_property_get(const char *name, char *value);
|
||||
|
|
|
@ -14,24 +14,25 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES2/gl2.h>
|
||||
|
||||
#include <bps/screen.h>
|
||||
#include <bps/navigator.h>
|
||||
#include <bps/event.h>
|
||||
#include <screen/screen.h>
|
||||
#include <sys/platform.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
#include "../../runloop.h"
|
||||
#include "../video_monitor.h"
|
||||
#include "../drivers/gl_common.h"
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <bps/screen.h>
|
||||
#include <bps/navigator.h>
|
||||
#include <bps/event.h>
|
||||
#include <screen/screen.h>
|
||||
#include <sys/platform.h>
|
||||
#include <GLES2/gl2.h>
|
||||
|
||||
#include "../image/image.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef HAVE_GLSL
|
||||
#include "../shader_glsl.h"
|
||||
#endif
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
Based on http://fernlightning.com/doku.php?id=randd:xopengl.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
#include <OpenGL/CGLTypes.h>
|
||||
|
@ -25,10 +29,6 @@
|
|||
#include <OpenGL/OpenGL.h>
|
||||
#include <OpenGL/gl.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../runloop.h"
|
||||
#include "../../configuration.h"
|
||||
|
|