diff options
-rw-r--r-- | Makefile | 49 | ||||
-rw-r--r-- | Makefile.common | 43 | ||||
-rw-r--r-- | jni/Android.mk | 29 | ||||
-rw-r--r-- | jni/Application.mk | 1 | ||||
-rw-r--r-- | source/cheats.c | 26 | ||||
-rw-r--r-- | source/seta010.c | 27 | ||||
-rw-r--r-- | source/soundux.c | 2 |
7 files changed, 109 insertions, 68 deletions
@@ -127,53 +127,13 @@ DEFS += -DSPC700_C -DEXECUTE_SUPERFX_PER_LINE -DSDD1_DECOMP \ DEFS += -D__LIBRETRO__ -CATSFC_DIR := libfreedo - -ifeq ($(HAVE_GRIFFIN), 1) -CATSFC_SOURCES := source/catsfc_griffin.c -CATSFC_SOURCES += source/sa1.c source/sa1cpu.c -LIBRETRO_SOURCES := -else -CATSFC_SOURCES := source/apu.c source/c4.c \ - source/c4emu.c \ - source/cheats2.c \ - source/cheats.c \ - source/clip.c \ - source/cpu.c \ - source/cpuexec.c \ - source/cpuops.c \ - source/data.c\ - source/dma.c \ - source/dsp1.c \ - source/fxdbg.c \ - source/fxemu.c \ - source/fxinst.c \ - source/gfx.c source/globals.c \ - source/memmap.c \ - source/obc1.c \ - source/ppu.c \ - source/sa1.c \ - source/sa1cpu.c \ - source/sdd1.c \ - source/sdd1emu.c \ - source/seta010.c \ - source/seta011.c \ - source/seta018.c \ - source/seta.c \ - source/soundux.c \ - source/spc700.c source/spc7110.c \ - source/srtc.c \ - source/tile.c -LIBRETRO_SOURCES := libretro.c -endif +CORE_DIR := ./source +LIBRETRO_DIR := . +include Makefile.common -SOURCES_C := $(LIBRETRO_SOURCES) $(CATSFC_SOURCES) - -SOURCES_CPP := OBJECTS := $(SOURCES_C:.c=.o) -#OBJECTS += $(SOURCES_CPP:.cpp=.o) all: $(TARGET) @@ -189,7 +149,8 @@ endif LDFLAGS += $(fpic) -lz $(SHARED) FLAGS += $(fpic) -FLAGS += -Isource -I. +FLAGS += $(INCFLAGS) + ifeq ($(OLD_GCC), 1) WARNINGS := -Wall diff --git a/Makefile.common b/Makefile.common new file mode 100644 index 0000000..1e8237c --- /dev/null +++ b/Makefile.common @@ -0,0 +1,43 @@ +INCFLAGS := -I$(CORE_DIR) -I$(LIBRETRO_DIR) + +ifeq ($(HAVE_GRIFFIN), 1) +SOURCES_C := $(CORE_DIR)/catsfc_griffin.c +SOURCES_C += $(CORE_DIR)/sa1.c \ + $(CORE_DIR)/sa1cpu.c +else +SOURCES_C := \ + $(CORE_DIR)/apu.c \ + $(CORE_DIR)/c4.c \ + $(CORE_DIR)/c4emu.c \ + $(CORE_DIR)/cheats2.c \ + $(CORE_DIR)/cheats.c \ + $(CORE_DIR)/clip.c \ + $(CORE_DIR)/cpu.c \ + $(CORE_DIR)/cpuexec.c \ + $(CORE_DIR)/cpuops.c \ + $(CORE_DIR)/data.c\ + $(CORE_DIR)/dma.c \ + $(CORE_DIR)/dsp1.c \ + $(CORE_DIR)/fxdbg.c \ + $(CORE_DIR)/fxemu.c \ + $(CORE_DIR)/fxinst.c \ + $(CORE_DIR)/gfx.c \ + $(CORE_DIR)/globals.c \ + $(CORE_DIR)/memmap.c \ + $(CORE_DIR)/obc1.c \ + $(CORE_DIR)/ppu.c \ + $(CORE_DIR)/sa1.c \ + $(CORE_DIR)/sa1cpu.c \ + $(CORE_DIR)/sdd1.c \ + $(CORE_DIR)/sdd1emu.c \ + $(CORE_DIR)/seta010.c \ + $(CORE_DIR)/seta011.c \ + $(CORE_DIR)/seta018.c \ + $(CORE_DIR)/seta.c \ + $(CORE_DIR)/soundux.c \ + $(CORE_DIR)/spc700.c \ + $(CORE_DIR)/spc7110.c \ + $(CORE_DIR)/srtc.c \ + $(CORE_DIR)/tile.c +SOURCES_C += $(LIBRETRO_DIR)/libretro.c +endif diff --git a/jni/Android.mk b/jni/Android.mk new file mode 100644 index 0000000..d51b890 --- /dev/null +++ b/jni/Android.mk @@ -0,0 +1,29 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +CORE_DIR := ../source +LIBRETRO_DIR := .. +HAVE_GRIFFIN := 1 + +LOCAL_MODULE := retro + +ifeq ($(TARGET_ARCH),arm) +LOCAL_CFLAGS += -DANDROID_ARM +LOCAL_ARM_MODE := arm +endif + +ifeq ($(TARGET_ARCH),x86) +LOCAL_CFLAGS += -DANDROID_X86 +endif + +ifeq ($(TARGET_ARCH),mips) +LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__ +endif + +include ../Makefile.common + +LOCAL_SRC_FILES += $(SOURCES_C) +LOCAL_CFLAGS += -O2 -std=gnu99 -ffast-math -DINLINE=inline -DPERF_TEST -D__LIBRETRO__ -DFRONTEND_SUPPORTS_RGB565 -DNDEBUG=1 $(INCFLAGS) + +include $(BUILD_SHARED_LIBRARY) diff --git a/jni/Application.mk b/jni/Application.mk new file mode 100644 index 0000000..a252a72 --- /dev/null +++ b/jni/Application.mk @@ -0,0 +1 @@ +APP_ABI := all diff --git a/source/cheats.c b/source/cheats.c index 62d9a76..f9f1ac8 100644 --- a/source/cheats.c +++ b/source/cheats.c @@ -213,7 +213,7 @@ void S9xStartCheatSearch(SCheatData* d) #define TEST_BIT(a,v) \ ((a)[(v) >> 5] & (1 << ((v) & 31))) -#define _C(c,a,b) \ +#define CHEATS_C(c,a,b) \ ((c) == S9X_LESS_THAN ? (a) < (b) : \ (c) == S9X_GREATER_THAN ? (a) > (b) : \ (c) == S9X_LESS_THAN_OR_EQUAL ? (a) <= (b) : \ @@ -261,7 +261,7 @@ void S9xSearchForChange(SCheatData* d, S9xCheatComparisonType cmp, for (i = 0; i < 0x20000 - l; i++) { if (TEST_BIT(d->WRAM_BITS, i) && - _C(cmp, _DS(size, d->RAM, i), _DS(size, d->CWRAM, i))) + CHEATS_C(cmp, _DS(size, d->RAM, i), _DS(size, d->CWRAM, i))) { if (update) d->CWRAM [i] = d->RAM [i]; @@ -273,7 +273,7 @@ void S9xSearchForChange(SCheatData* d, S9xCheatComparisonType cmp, for (i = 0; i < 0x10000 - l; i++) { if (TEST_BIT(d->SRAM_BITS, i) && - _C(cmp, _DS(size, d->SRAM, i), _DS(size, d->CSRAM, i))) + CHEATS_C(cmp, _DS(size, d->SRAM, i), _DS(size, d->CSRAM, i))) { if (update) d->CSRAM [i] = d->SRAM [i]; @@ -285,7 +285,7 @@ void S9xSearchForChange(SCheatData* d, S9xCheatComparisonType cmp, for (i = 0; i < 0x2000 - l; i++) { if (TEST_BIT(d->IRAM_BITS, i) && - _C(cmp, _DS(size, d->FillRAM + 0x3000, i), _DS(size, d->CIRAM, i))) + CHEATS_C(cmp, _DS(size, d->FillRAM + 0x3000, i), _DS(size, d->CIRAM, i))) { if (update) d->CIRAM [i] = d->FillRAM [i + 0x3000]; @@ -299,7 +299,7 @@ void S9xSearchForChange(SCheatData* d, S9xCheatComparisonType cmp, for (i = 0; i < 0x20000 - l; i++) { if (TEST_BIT(d->WRAM_BITS, i) && - _C(cmp, _D(size, d->RAM, i), _D(size, d->CWRAM, i))) + CHEATS_C(cmp, _D(size, d->RAM, i), _D(size, d->CWRAM, i))) { if (update) d->CWRAM [i] = d->RAM [i]; @@ -311,7 +311,7 @@ void S9xSearchForChange(SCheatData* d, S9xCheatComparisonType cmp, for (i = 0; i < 0x10000 - l; i++) { if (TEST_BIT(d->SRAM_BITS, i) && - _C(cmp, _D(size, d->SRAM, i), _D(size, d->CSRAM, i))) + CHEATS_C(cmp, _D(size, d->SRAM, i), _D(size, d->CSRAM, i))) { if (update) d->CSRAM [i] = d->SRAM [i]; @@ -323,7 +323,7 @@ void S9xSearchForChange(SCheatData* d, S9xCheatComparisonType cmp, for (i = 0; i < 0x2000 - l; i++) { if (TEST_BIT(d->IRAM_BITS, i) && - _C(cmp, _D(size, d->FillRAM + 0x3000, i), _D(size, d->CIRAM, i))) + CHEATS_C(cmp, _D(size, d->FillRAM + 0x3000, i), _D(size, d->CIRAM, i))) { if (update) d->CIRAM [i] = d->FillRAM [i + 0x3000]; @@ -364,7 +364,7 @@ void S9xSearchForValue(SCheatData* d, S9xCheatComparisonType cmp, for (i = 0; i < 0x20000 - l; i++) { if (TEST_BIT(d->WRAM_BITS, i) && - _C(cmp, _DS(size, d->RAM, i), (int32) value)) + CHEATS_C(cmp, _DS(size, d->RAM, i), (int32) value)) { if (update) d->CWRAM [i] = d->RAM [i]; @@ -376,7 +376,7 @@ void S9xSearchForValue(SCheatData* d, S9xCheatComparisonType cmp, for (i = 0; i < 0x10000 - l; i++) { if (TEST_BIT(d->SRAM_BITS, i) && - _C(cmp, _DS(size, d->SRAM, i), (int32) value)) + CHEATS_C(cmp, _DS(size, d->SRAM, i), (int32) value)) { if (update) d->CSRAM [i] = d->SRAM [i]; @@ -388,7 +388,7 @@ void S9xSearchForValue(SCheatData* d, S9xCheatComparisonType cmp, for (i = 0; i < 0x2000 - l; i++) { if (TEST_BIT(d->IRAM_BITS, i) && - _C(cmp, _DS(size, d->FillRAM + 0x3000, i), (int32) value)) + CHEATS_C(cmp, _DS(size, d->FillRAM + 0x3000, i), (int32) value)) { if (update) d->CIRAM [i] = d->FillRAM [i + 0x3000]; @@ -402,7 +402,7 @@ void S9xSearchForValue(SCheatData* d, S9xCheatComparisonType cmp, for (i = 0; i < 0x20000 - l; i++) { if (TEST_BIT(d->WRAM_BITS, i) && - _C(cmp, _D(size, d->RAM, i), value)) + CHEATS_C(cmp, _D(size, d->RAM, i), value)) { if (update) d->CWRAM [i] = d->RAM [i]; @@ -414,7 +414,7 @@ void S9xSearchForValue(SCheatData* d, S9xCheatComparisonType cmp, for (i = 0; i < 0x10000 - l; i++) { if (TEST_BIT(d->SRAM_BITS, i) && - _C(cmp, _D(size, d->SRAM, i), value)) + CHEATS_C(cmp, _D(size, d->SRAM, i), value)) { if (update) d->CSRAM [i] = d->SRAM [i]; @@ -426,7 +426,7 @@ void S9xSearchForValue(SCheatData* d, S9xCheatComparisonType cmp, for (i = 0; i < 0x2000 - l; i++) { if (TEST_BIT(d->IRAM_BITS, i) && - _C(cmp, _D(size, d->FillRAM + 0x3000, i), value)) + CHEATS_C(cmp, _D(size, d->FillRAM + 0x3000, i), value)) { if (update) d->CIRAM [i] = d->FillRAM [i + 0x3000]; diff --git a/source/seta010.c b/source/seta010.c index 75deb74..2bb9b93 100644 --- a/source/seta010.c +++ b/source/seta010.c @@ -442,9 +442,10 @@ void S9xSetST010(uint32 Address, uint8 Byte) // case 0x02: { -#ifdef FAST_LSB_WORD_ACCESS - ST010_SortDrivers(*(short*)&SRAM[0x0024], (uint16*)(SRAM + 0x0040), - (uint16*)(SRAM + 0x0080)); +#if defined(FAST_LSB_WORD_ACCESS) && !defined(ANDROID) + /* TODO - FIXME */ + ST010_SortDrivers(*(short*)&Memory.SRAM[0x0024], (uint16*)(Memory.SRAM + 0x0040), + (uint16*)(Memory.SRAM + 0x0080)); #else uint16 Places[32]; uint16 Positions = ST010_WORD(0x0024); @@ -485,10 +486,11 @@ void S9xSetST010(uint32 Address, uint8 Byte) // case 0x03: { -#ifdef FAST_LSB_WORD_ACCESS +#if defined(FAST_LSB_WORD_ACCESS) && !defined(ANDROID) + /* TODO - FIXME */ ST010_Scale(*(short*)&Memory.SRAM[0x0004], *(short*)&Memory.SRAM[0x0000], *(short*)&Memory.SRAM[0x0002], - (int &) Memory.SRAM[0x0010], (int &) Memory.SRAM[0x0014]); + (int &)Memory.SRAM[0x0010], (int&)Memory.SRAM[0x0014]); #else int x1, y1; @@ -517,7 +519,8 @@ void S9xSetST010(uint32 Address, uint8 Byte) // case 0x06: { -#ifdef FAST_LSB_WORD_ACCESS +#if defined(FAST_LSB_WORD_ACCESS) && !defined(ANDROID) + /* TODO - FIXME */ ST010_Multiply(*(short*)&Memory.SRAM[0x0000], *(short*)&Memory.SRAM[0x0002], (int &) Memory.SRAM[0x0010]); #else @@ -593,7 +596,8 @@ void S9xSetST010(uint32 Address, uint8 Byte) // case 0x08: { -#ifdef FAST_LSB_WORD_ACCESS +#if defined(FAST_LSB_WORD_ACCESS) && !defined(ANDROID) + /* TODO - FIXME */ ST010_Rotate(*(short*)&Memory.SRAM[0x0004], *(short*)&Memory.SRAM[0x0000], *(short*)&Memory.SRAM[0x0002], (short &) Memory.SRAM[0x0010], (short &) Memory.SRAM[0x0012]); @@ -622,7 +626,8 @@ void S9xSetST010(uint32 Address, uint8 Byte) Memory.SRAM[0x0006] = Memory.SRAM[0x0002]; Memory.SRAM[0x0007] = Memory.SRAM[0x0003]; -#ifdef FAST_LSB_WORD_ACCESS +#if defined(FAST_LSB_WORD_ACCESS) && !defined(ANDROID) + /* TODO - FIXME */ ST010_OP01(*(short*)&Memory.SRAM[0x0000], *(short*)&Memory.SRAM[0x0002], (short*) &Memory.SRAM[0x0000], (short*) &Memory.SRAM[0x0002], (short*) &Memory.SRAM[0x0004], (short*) &Memory.SRAM[0x0010]); @@ -647,7 +652,8 @@ void S9xSetST010(uint32 Address, uint8 Byte) case 0x04: { int16 square, x, y; -#ifdef FAST_LSB_WORD_ACCESS +#if defined(FAST_LSB_WORD_ACCESS) && !defined(ANDROID) + /* TODO - FIXME */ x = *((int16*)Memory.SRAM); y = *((int16*)&Memory.SRAM[2]); #else @@ -657,7 +663,8 @@ void S9xSetST010(uint32 Address, uint8 Byte) square = (int16)sqrt((double)(y * y + x * x)); //SETA_Distance( x,y,square ); -#ifdef FAST_LSB_WORD_ACCESS +#if defined(FAST_LSB_WORD_ACCESS) && !defined(ANDROID) + /* TODO - FIXME */ *((int16*)&Memory.SRAM[0x10]) = square; #else Memory.SRAM[0x10] = (uint8)(square); diff --git a/source/soundux.c b/source/soundux.c index 23b2abe..1ddbd48 100644 --- a/source/soundux.c +++ b/source/soundux.c @@ -510,7 +510,7 @@ void AltDecodeBlock(Channel* ch) if ((ch->last_block = filter & 1)) ch->loop = (filter & 2) != 0; -#if (defined (USE_X86_ASM) && (defined (__i386__) || defined (__i486__) ||\ +#if !defined(ANDROID) && (defined (USE_X86_ASM) && (defined (__i386__) || defined (__i486__) ||\ defined (__i586__) || defined (__WIN32__) || defined (__DJGPP))) int16* raw = ch->block = ch->decoded; |