Merge commit '217e9787bd640cbd1b8250e31c0064331ddc302f'

This commit is contained in:
Lior Halphon 2018-02-10 14:49:57 +02:00
commit 00c67f8842
4 changed files with 835 additions and 268 deletions

View File

@ -7,7 +7,11 @@
#ifdef GB_INTERNAL #ifdef GB_INTERNAL
/* Divides nicely and never overflows with 4 channels and 8 (1-8) volume levels */ /* Divides nicely and never overflows with 4 channels and 8 (1-8) volume levels */
#ifdef WIIU
#define MAX_CH_AMP 0x1FE0 / 4
#else
#define MAX_CH_AMP 0x1FE0 #define MAX_CH_AMP 0x1FE0
#endif
#define CH_STEP (MAX_CH_AMP/0xF/8) #define CH_STEP (MAX_CH_AMP/0xF/8)
#endif #endif

View File

@ -53,6 +53,12 @@ else
endif endif
endif endif
ifneq ($(SANITIZER),)
CFLAGS := -fsanitize=$(SANITIZER) $(CFLAGS)
CXXFLAGS := -fsanitize=$(SANITIZER) $(CXXFLAGS)
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS) -lasan
endif
ifeq ($(platform), osx) ifeq ($(platform), osx)
ifndef ($(NOUNIVERSAL)) ifndef ($(NOUNIVERSAL))
CFLAGS += $(ARCHFLAGS) CFLAGS += $(ARCHFLAGS)
@ -65,7 +71,7 @@ EXT := a
endif endif
ifeq ($(platform), unix) ifeq ($(platform), unix)
EXT ?= so EXT ?= so
TARGET := $(TARGET_NAME)_libretro.$(EXT) TARGET := $(TARGET_NAME)_libretro.$(EXT)
fpic := -fPIC fpic := -fPIC
SHARED := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined SHARED := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined
@ -80,6 +86,14 @@ else ifeq ($(platform), switch)
include $(LIBTRANSISTOR_HOME)/libtransistor.mk include $(LIBTRANSISTOR_HOME)/libtransistor.mk
CFLAGS += -Wl,-q -Wall -O3 -fno-short-enums -fno-optimize-sibling-calls CFLAGS += -Wl,-q -Wall -O3 -fno-short-enums -fno-optimize-sibling-calls
STATIC_LINKING=1 STATIC_LINKING=1
# Nintendo WiiU
else ifeq ($(platform), wiiu)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
CFLAGS += -DGEKKO -DHW_RVL -DWIIU -mwup -mcpu=750 -meabi -mhard-float -D__ppc__ -DMSB_FIRST -I$(DEVKITPRO)/libogc/include
CFLAGS += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int
STATIC_LINKING = 1
else ifneq (,$(findstring osx,$(platform))) else ifneq (,$(findstring osx,$(platform)))
TARGET := $(TARGET_NAME)_libretro.dylib TARGET := $(TARGET_NAME)_libretro.dylib
fpic := -fPIC fpic := -fPIC
@ -96,7 +110,7 @@ endif
DEFINES := -DIOS DEFINES := -DIOS
ifeq ($(platform),ios-arm64) ifeq ($(platform),ios-arm64)
CC = cc -arch armv64 -isysroot $(IOSSDK) CC = cc -arch armv64 -isysroot $(IOSSDK)
else else
CC = cc -arch armv7 -isysroot $(IOSSDK) CC = cc -arch armv7 -isysroot $(IOSSDK)
endif endif
ifeq ($(platform),$(filter $(platform),ios9 ios-arm64)) ifeq ($(platform),$(filter $(platform),ios9 ios-arm64))
@ -147,10 +161,16 @@ CFLAGS += -Wall -D__LIBRETRO__ $(fpic) $(INCFLAGS) -std=gnu11 -D_GNU_SOURCE -D
all: $(TARGET) all: $(TARGET)
$(CORE_DIR)/libretro/%_boot.c: $(CORE_DIR)/build/bin/BootROMs/%_boot.bin $(CORE_DIR)/libretro/%_boot.c: $(CORE_DIR)/BootROMs/prebuilt/%_boot.bin
echo "/* AUTO-GENERATED */" > $@ echo "/* AUTO-GENERATED */" > $@
echo "const unsigned char $(notdir $(@:%.c=%))[] = {" >> $@ echo "const unsigned char $(notdir $(@:%.c=%))[] = {" >> $@
ifneq ($(findstring Haiku,$(shell uname -s)),)
# turns out od is posix, hexdump is not hence is less portable
# this is still rather ugly and could be done better I guess
od -A none -t x1 -v $< | sed -e 's/^\ /0x/' -e 's/\ /,\ 0x/g' -e 's/$$/,/g' | tr '\n' ' ' >> $@
else
hexdump -v -e '/1 "0x%02x, "' $< >> $@ hexdump -v -e '/1 "0x%02x, "' $< >> $@
endif
echo "};" >> $@ echo "};" >> $@
echo "const unsigned $(notdir $(@:%.c=%))_length = sizeof($(notdir $(@:%.c=%)));" >> $@ echo "const unsigned $(notdir $(@:%.c=%))_length = sizeof($(notdir $(@:%.c=%)));" >> $@

View File

@ -25,11 +25,12 @@ endif
CORE_DIR := ../.. CORE_DIR := ../..
include ../../Makefile.common include ../Makefile.common
LOCAL_SRC_FILES := $(SOURCES_CXX) $(SOURCES_C) LOCAL_SRC_FILES := $(SOURCES_CXX) $(SOURCES_C)
LOCAL_CXXFLAGS += -DINLINE=inline -DHAVE_STDINT_H -DHAVE_INTTYPES_H -D__LIBRETRO__ -DNDEBUG -D_USE_MATH_DEFINES -DGB_INTERNAL LOCAL_CFLAGS += -DINLINE=inline -DHAVE_STDINT_H -DHAVE_INTTYPES_H -D__LIBRETRO__ -DNDEBUG -D_USE_MATH_DEFINES -DGB_INTERNAL -std=c99 -I$(CORE_DIR) -DSAMEBOY_CORE_VERSION=\"$(VERSION)\"
LOCAL_C_INCLUDES = $(INCFLAGS) LOCAL_C_INCLUDES = $(INCFLAGS)
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)

File diff suppressed because it is too large Load Diff