summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraliaspider2015-11-04 17:41:52 +0100
committeraliaspider2015-11-04 17:41:52 +0100
commit47d0f0c4a19a0566912ca293ff29abd32e6d01a9 (patch)
treec01e5fd0ae859ee4848b2cb0b251d3fd3486105a
parenta289acf4862feb298a47f37713fdbdae3a1c52fa (diff)
downloadsnes9x2002-47d0f0c4a19a0566912ca293ff29abd32e6d01a9.tar.gz
snes9x2002-47d0f0c4a19a0566912ca293ff29abd32e6d01a9.tar.bz2
snes9x2002-47d0f0c4a19a0566912ca293ff29abd32e6d01a9.zip
add ctr/3ds target.
-rw-r--r--Makefile75
-rw-r--r--libretro/libretro.cpp18
-rw-r--r--src/port.h2
3 files changed, 90 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index c21dc7a..326d610 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
DEBUG=0
+TARGET_NAME = pocketsnes
ifeq ($(platform),)
platform = unix
@@ -41,6 +42,20 @@ else ifeq ($(platform), wii)
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar
CFLAGS += -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__
+# CTR (3DS)
+else ifeq ($(platform), ctr)
+ TARGET := $(TARGET_NAME)_libretro_ctr.a
+ CC = $(DEVKITARM)/bin/arm-none-eabi-gcc$(EXE_EXT)
+ CXX = $(DEVKITARM)/bin/arm-none-eabi-g++$(EXE_EXT)
+ AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT)
+ CFLAGS += -DARM11 -D_3DS
+ CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard
+ CFLAGS += -Wall -mword-relocations
+ CFLAGS += -fomit-frame-pointer -ffast-math
+ CFLAGS += -D_3DS
+ CFLAGS += -D__GP2X__
+ PLATFORM_DEFINES := -D_3DS
+ STATIC_LINKING = 1
else
TARGET := retro.dll
CC = gcc
@@ -57,9 +72,61 @@ CFLAGS += -O3
endif
-OBJECTS = ./src/apu.o ./src/apuaux.o ./src/c4.o ./src/c4emu.o ./src/cheats.o ./src/cheats2.o ./src/clip.o ./src/data.o ./src/screenshot.o ./src/dsp1.o ./src/fxemu.o ./src/fxinst.o ./src/globals.o ./src/loadzip.o ./src/ppu.o ./src/dma.o ./src/memmap.o ./src/cpu.o ./src/cpuexec.o ./src/cpuops.o ./src/sa1.o ./src/sa1cpu.o ./src/sdd1.o ./src/sdd1emu.o ./src/snapshot.o ./src/soundux.o ./src/spc700.o ./src/spc700a.o ./src/srtc.o ./src/spc_decode.o ./src/tile16.o ./src/tile16add.o ./src/tile16add1_2.o ./src/tile16fadd1_2.o ./src/tile16sub.o ./src/tile16sub1_2.o ./src/tile16fsub1_2.o ./src/mode7new.o ./src/mode7.o ./src/mode7add.o ./src/mode7add1_2.o ./src/mode7sub.o ./src/mode7sub1_2.o ./src/mode7prio.o ./src/mode7addprio.o ./src/mode7add1_2prio.o ./src/mode7subprio.o ./src/mode7sub1_2prio.o ./src/gfx16.o ./src/rops.o ./libretro/libretro.o ./libretro/memstream.o
-
-INCLUDES = -I.
+OBJECTS =
+OBJECTS += ./src/apu.o
+OBJECTS += ./src/apuaux.o
+OBJECTS += ./src/c4.o
+OBJECTS += ./src/c4emu.o
+OBJECTS += ./src/cheats.o
+OBJECTS += ./src/cheats2.o
+OBJECTS += ./src/clip.o
+OBJECTS += ./src/data.o
+OBJECTS += ./src/screenshot.o
+OBJECTS += ./src/dsp1.o
+OBJECTS += ./src/fxemu.o
+OBJECTS += ./src/fxinst.o
+OBJECTS += ./src/globals.o
+OBJECTS += ./src/loadzip.o
+OBJECTS += ./src/ppu.o
+OBJECTS += ./src/dma.o
+OBJECTS += ./src/memmap.o
+OBJECTS += ./src/cpu.o
+OBJECTS += ./src/cpuexec.o
+OBJECTS += ./src/cpuops.o
+OBJECTS += ./src/sa1.o
+OBJECTS += ./src/sa1cpu.o
+OBJECTS += ./src/sdd1.o
+OBJECTS += ./src/sdd1emu.o
+OBJECTS += ./src/snapshot.o
+OBJECTS += ./src/soundux.o
+OBJECTS += ./src/spc700.o
+OBJECTS += ./src/spc700a.o
+OBJECTS += ./src/srtc.o
+OBJECTS += ./src/spc_decode.o
+OBJECTS += ./src/tile16.o
+OBJECTS += ./src/tile16add.o
+OBJECTS += ./src/tile16add1_2.o
+OBJECTS += ./src/tile16fadd1_2.o
+OBJECTS += ./src/tile16sub.o
+OBJECTS += ./src/tile16sub1_2.o
+OBJECTS += ./src/tile16fsub1_2.o
+OBJECTS += ./src/mode7new.o
+OBJECTS += ./src/mode7.o
+OBJECTS += ./src/mode7add.o
+OBJECTS += ./src/mode7add1_2.o
+OBJECTS += ./src/mode7sub.o
+OBJECTS += ./src/mode7sub1_2.o
+OBJECTS += ./src/mode7prio.o
+OBJECTS += ./src/mode7addprio.o
+OBJECTS += ./src/mode7add1_2prio.o
+OBJECTS += ./src/mode7subprio.o
+OBJECTS += ./src/mode7sub1_2prio.o
+OBJECTS += ./src/gfx16.o
+OBJECTS += ./src/rops.o
+OBJECTS += ./libretro/libretro.o
+OBJECTS += ./libretro/memstream.o
+
+INCLUDES = -I. -Ilibretro
DEFINES = -DHAVE_STRINGS_H -DHAVE_STDINT_H -DHAVE_INTTYPES_H -D__LIBRETRO__ -DINLINE=inline -DUSE_SA1
ifeq ($(platform), sncps3)
@@ -85,6 +152,8 @@ else ifeq ($(platform), xenon)
$(AR) rcs $@ $(OBJECTS)
else ifeq ($(platform), wii)
$(AR) rcs $@ $(OBJECTS)
+else ifeq ($(platform), ctr)
+ $(AR) rcs $@ $(OBJECTS)
else
$(CXX) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) -lm
endif
diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp
index f1f6757..64f5e19 100644
--- a/libretro/libretro.cpp
+++ b/libretro/libretro.cpp
@@ -24,6 +24,11 @@
#include "../src/cheats.h"
#include "../src/display.h"
+#ifdef _3DS
+extern "C" void* linearMemAlign(size_t size, size_t alignment);
+extern "C" void linearFree(void* mem);
+#endif
+
#define MAP_BUTTON(id, name) S9xMapButton((id), S9xGetCommandT((name)), false)
#define MAKE_BUTTON(pad, btn) (((pad)<<4)|(btn))
@@ -293,7 +298,12 @@ static void snes_init (void)
GFX.Pitch = use_overscan ? 1024 : 2048;
// hack to make sure GFX.Delta is always (2048 * 512 * 2) >> 1, needed for tile16_t.h
+#ifdef _3DS
+ GFX.Screen = (uint8 *) linearMemAlign(2048 * 512 * 2 * 2, 0x80);
+ memset(GFX.Screen, 0x0, 2048 * 512 * 2 * 2);
+#else
GFX.Screen = (uint8 *) calloc(1, 2048 * 512 * 2 * 2);
+#endif
GFX.SubScreen = GFX.Screen + 2048 * 512 * 2;
GFX.ZBuffer = (uint8 *) calloc(1, GFX.Pitch * 512 * sizeof(uint16));
GFX.SubZBuffer = (uint8 *) calloc(1, GFX.Pitch * 512 * sizeof(uint16));
@@ -337,6 +347,14 @@ void retro_deinit(void)
Memory.Deinit();
S9xGraphicsDeinit();
//S9xUnmapAllControls();
+ if(GFX.Screen)
+#ifdef _3DS
+ linearFree(GFX.Screen);
+#else
+ free(GFX.Screen);
+#endif
+ GFX.Screen = NULL;
+
}
void retro_reset (void)
diff --git a/src/port.h b/src/port.h
index 65a942e..a6641bb 100644
--- a/src/port.h
+++ b/src/port.h
@@ -147,7 +147,6 @@ void _splitpath (const char *path, char *drive, char *dir, char *fname,
char *ext);
#define strcasecmp strcmp
#define strncasecmp strncmp
-#define time(a) (0)
#ifdef INLINE
#undef INLINE
@@ -249,7 +248,6 @@ void _splitpath (const char *path, char *drive, char *dir, char *fname,
char *ext);
#define strcasecmp strcmp
#define strncasecmp strncmp
-#define time(a) (0)
#ifdef INLINE
#undef INLINE