From a48745850385e49bf1ca9f8c4e98d925032a8a06 Mon Sep 17 00:00:00 2001
From: CatalystG
Date: Sun, 24 Mar 2013 18:09:00 -0400
Subject: Add support for PlayBook/BB10 with libretro
---
Makefile.libretro | 32 ++++++--
blackberry_qnx/.cproject | 142 ++++++++++++++++++++++++++++++++++
blackberry_qnx/.project | 84 ++++++++++++++++++++
libpcsxcore/new_dynarec/new_dynarec.c | 4 +
libpcsxcore/psxmem.c | 5 ++
5 files changed, 259 insertions(+), 8 deletions(-)
create mode 100644 blackberry_qnx/.cproject
create mode 100644 blackberry_qnx/.project
diff --git a/Makefile.libretro b/Makefile.libretro
index 213b409..d8288f5 100644
--- a/Makefile.libretro
+++ b/Makefile.libretro
@@ -24,9 +24,9 @@ else ifneq ($(findstring win,$(shell uname -a)),)
endif
endif
-CC = gcc
-CXX = g++
-AS = as
+CC ?= gcc
+CXX ?= g++
+AS ?= as
ifeq ($(platform), unix)
TARGET := snes9x_next_libretro.so
@@ -83,6 +83,15 @@ else ifeq ($(platform), wii)
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__
+else ifeq ($(platform), qnx)
+ TARGET := libretro_pcsx_rearmed_qnx.so
+ HAVE_NEON = 1
+ USE_DYNAREC = 1
+ DRC_CACHE_BASE = 0
+ BUILTIN_GPU = neon
+ ARCH = arm
+ CFLAGS += -DBASE_ADDR_FIXED=0 -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
+ ASFLAGS += -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp
else
TARGET := snes9x_next_retro.dll
CC = gcc
@@ -95,16 +104,20 @@ endif
CFLAGS += -fPIC
ASFLAGS +=
LDFLAGS +=
-LDLIBS += -lpthread
+
+ifneq ($(platform),qnx)
+ LDLIBS += -lpthread
+ MAIN_LDLIBS += -ldl
+endif
MAIN_LDFLAGS += -shared
-MAIN_LDLIBS += -ldl -lm -lz
+MAIN_LDLIBS += -lm -lz
PLUGIN_CFLAGS += -fPIC
-TARGET = libretro.so
+TARGET ?= libretro.so
PLATFORM = libretro
-BUILTIN_GPU = peops
+BUILTIN_GPU ?= peops
SOUND_DRIVERS = libretro
-PLUGINS = plugins/dfxvideo/gpu_peops.so plugins/gpu_unai/gpu_unai.so
+#PLUGINS = plugins/dfxvideo/gpu_peops.so plugins/gpu_unai/gpu_unai.so
CC_LINK = $(CC)
LDFLAGS += $(MAIN_LDFLAGS)
@@ -216,6 +229,9 @@ frontend/revision.h: FORCE
%.o: %.S
$(CC) $(CFLAGS) -c $^ -o $@
+
+%.o: %.s
+ $(CC) $(ASFLAGS) -c $^ -o $@
target_: $(TARGET)
diff --git a/blackberry_qnx/.cproject b/blackberry_qnx/.cproject
new file mode 100644
index 0000000..565f4a9
--- /dev/null
+++ b/blackberry_qnx/.cproject
@@ -0,0 +1,142 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/blackberry_qnx/.project b/blackberry_qnx/.project
new file mode 100644
index 0000000..c8e1e20
--- /dev/null
+++ b/blackberry_qnx/.project
@@ -0,0 +1,84 @@
+
+
+ pcsx_rearmed
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+ clean,full,incremental,
+
+
+ ?name?
+
+
+
+ org.eclipse.cdt.make.core.append_environment
+ true
+
+
+ org.eclipse.cdt.make.core.autoBuildTarget
+ all
+
+
+ org.eclipse.cdt.make.core.buildArguments
+ -C .. -f Makefile.libretro platform=qnx
+
+
+ org.eclipse.cdt.make.core.buildCommand
+ make
+
+
+ org.eclipse.cdt.make.core.cleanBuildTarget
+ clean
+
+
+ org.eclipse.cdt.make.core.contents
+ org.eclipse.cdt.make.core.activeConfigSettings
+
+
+ org.eclipse.cdt.make.core.enableAutoBuild
+ false
+
+
+ org.eclipse.cdt.make.core.enableCleanBuild
+ true
+
+
+ org.eclipse.cdt.make.core.enableFullBuild
+ true
+
+
+ org.eclipse.cdt.make.core.fullBuildTarget
+ all
+
+
+ org.eclipse.cdt.make.core.stopOnError
+ true
+
+
+ org.eclipse.cdt.make.core.useDefaultBuildCmd
+ false
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+ full,incremental,
+
+
+
+
+ com.qnx.tools.bbt.xml.core.bbtXMLValidationBuilder
+
+
+
+
+
+ org.eclipse.cdt.core.cnature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+ com.qnx.tools.ide.bbt.core.bbtnature
+
+
diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c
index 21c9669..5cdeb96 100644
--- a/libpcsxcore/new_dynarec/new_dynarec.c
+++ b/libpcsxcore/new_dynarec/new_dynarec.c
@@ -41,6 +41,10 @@
#include "assem_arm.h"
#endif
+#undef __clear_cache
+#define __clear_cache(start,end) msync(start, (size_t)((void*)end - (void*)start), MS_SYNC | MS_CACHE_ONLY | MS_INVALIDATE_ICACHE);
+
+
#define MAXBLOCK 4096
#define MAX_OUTPUT_BLOCK_SIZE 262144
diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c
index f12a981..422b485 100644
--- a/libpcsxcore/psxmem.c
+++ b/libpcsxcore/psxmem.c
@@ -129,8 +129,13 @@ int psxMemInit() {
psxM = psxMap(0x80000000, 0x00210000, 1, MAP_TAG_RAM);
#ifndef RAM_FIXED
+#ifdef __BLACKBERRY_QNX__
+ if (psxM == NULL)
+ psxM = psxMap(0x70000000, 0x00210000, 0, MAP_TAG_RAM);
+#else
if (psxM == NULL)
psxM = psxMap(0x78000000, 0x00210000, 0, MAP_TAG_RAM);
+#endif
#endif
if (psxM == NULL) {
SysMessage(_("mapping main RAM failed"));
--
cgit v1.2.3