Add support for PlayBook/BB10 with libretro
authorCatalystG <CatalystGdev@gmail.com>
Sun, 24 Mar 2013 22:09:00 +0000 (18:09 -0400)
committerCatalystG <CatalystGdev@gmail.com>
Sun, 24 Mar 2013 22:09:00 +0000 (18:09 -0400)
Makefile.libretro
blackberry_qnx/.cproject [new file with mode: 0644]
blackberry_qnx/.project [new file with mode: 0644]
libpcsxcore/new_dynarec/new_dynarec.c
libpcsxcore/psxmem.c

index 435a7f7..656b1d2 100644 (file)
@@ -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
@@ -84,6 +84,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
@@ -96,16 +105,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)
@@ -217,6 +230,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 (file)
index 0000000..565f4a9
--- /dev/null
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+       <storageModule moduleId="org.eclipse.cdt.core.settings">
+               <cconfiguration id="com.qnx.qcc.toolChain.1762498539">
+                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.1762498539" moduleId="org.eclipse.cdt.core.settings" name="Device-Debug">
+                               <externalSettings/>
+                               <extensions>
+                                       <extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
+                                       <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                               </extensions>
+                       </storageModule>
+                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                               <configuration artifactName="${ProjName}" buildProperties="" description="" id="com.qnx.qcc.toolChain.1762498539" name="Device-Debug" parent="org.eclipse.cdt.build.core.emptycfg">
+                                       <folderInfo id="com.qnx.qcc.toolChain.1762498539.1561488424" name="/" resourcePath="">
+                                               <toolChain id="com.qnx.qcc.toolChain.682312592" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
+                                                       <option id="com.qnx.qcc.option.os.1720929524" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
+                                                       <option id="com.qnx.qcc.option.cpu.2107899725" name="Target CPU:" superClass="com.qnx.qcc.option.cpu" value="com.qnx.qcc.option.gen.cpu.armle-v7" valueType="enumerated"/>
+                                                       <option id="com.qnx.qcc.option.compiler.596535986" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
+                                                       <option id="com.qnx.qcc.option.runtime.742171011" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
+                                                       <targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.982231418" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
+                                                       <builder arguments="-C .. -f Makefile.libretro platform=qnx" command="make" id="com.qnx.qcc.toolChain.1762498539.480897078" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+                                                       <tool id="com.qnx.qcc.tool.compiler.267897021" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
+                                                               <option id="com.qnx.qcc.option.compiler.optlevel.1293751119" name="Optimization Level" superClass="com.qnx.qcc.option.compiler.optlevel" value="com.qnx.qcc.option.compiler.optlevel.0" valueType="enumerated"/>
+                                                               <option id="com.qnx.qcc.option.compiler.includePath.365274483" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/freetype2"/>
+                                                                       <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                                               </option>
+                                                               <inputType id="com.qnx.qcc.inputType.compiler.116424583" superClass="com.qnx.qcc.inputType.compiler"/>
+                                                       </tool>
+                                                       <tool id="com.qnx.qcc.tool.assembler.1307903249" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
+                                                               <inputType id="com.qnx.qcc.inputType.assembler.1838739065" superClass="com.qnx.qcc.inputType.assembler"/>
+                                                       </tool>
+                                                       <tool id="com.qnx.qcc.tool.linker.1852803277" name="QCC Linker" superClass="com.qnx.qcc.tool.linker"/>
+                                                       <tool id="com.qnx.qcc.tool.archiver.1682937256" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
+                                               </toolChain>
+                                       </folderInfo>
+                               </configuration>
+                       </storageModule>
+                       <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+               </cconfiguration>
+               <cconfiguration id="com.qnx.qcc.toolChain.1815033502">
+                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.1815033502" moduleId="org.eclipse.cdt.core.settings" name="Device-Release">
+                               <externalSettings/>
+                               <extensions>
+                                       <extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
+                                       <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                               </extensions>
+                       </storageModule>
+                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                               <configuration artifactName="${ProjName}" buildProperties="" description="" id="com.qnx.qcc.toolChain.1815033502" name="Device-Release" parent="org.eclipse.cdt.build.core.emptycfg">
+                                       <folderInfo id="com.qnx.qcc.toolChain.1815033502.1093640979" name="/" resourcePath="">
+                                               <toolChain id="com.qnx.qcc.toolChain.1811843468" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
+                                                       <option id="com.qnx.qcc.option.os.66936807" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
+                                                       <option id="com.qnx.qcc.option.cpu.1884625209" name="Target CPU:" superClass="com.qnx.qcc.option.cpu" value="com.qnx.qcc.option.gen.cpu.armle-v7" valueType="enumerated"/>
+                                                       <option id="com.qnx.qcc.option.compiler.903071639" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
+                                                       <option id="com.qnx.qcc.option.runtime.901433789" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
+                                                       <targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.1169345860" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
+                                                       <builder id="com.qnx.qcc.toolChain.1815033502.1831895405" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+                                                       <tool id="com.qnx.qcc.tool.compiler.401658009" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
+                                                               <option id="com.qnx.qcc.option.compiler.optlevel.20820451" name="Optimization Level" superClass="com.qnx.qcc.option.compiler.optlevel" value="com.qnx.qcc.option.compiler.optlevel.0" valueType="enumerated"/>
+                                                               <option id="com.qnx.qcc.option.compiler.includePath.2022402746" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/freetype2"/>
+                                                                       <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                                               </option>
+                                                               <inputType id="com.qnx.qcc.inputType.compiler.1180700251" superClass="com.qnx.qcc.inputType.compiler"/>
+                                                       </tool>
+                                                       <tool id="com.qnx.qcc.tool.assembler.1403530230" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
+                                                               <inputType id="com.qnx.qcc.inputType.assembler.1360707586" superClass="com.qnx.qcc.inputType.assembler"/>
+                                                       </tool>
+                                                       <tool id="com.qnx.qcc.tool.linker.577346665" name="QCC Linker" superClass="com.qnx.qcc.tool.linker"/>
+                                                       <tool id="com.qnx.qcc.tool.archiver.637344581" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
+                                               </toolChain>
+                                       </folderInfo>
+                               </configuration>
+                       </storageModule>
+                       <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+               </cconfiguration>
+               <cconfiguration id="com.qnx.qcc.toolChain.1271074456">
+                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.1271074456" moduleId="org.eclipse.cdt.core.settings" name="Simulator-Debug">
+                               <externalSettings/>
+                               <extensions>
+                                       <extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
+                                       <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                               </extensions>
+                       </storageModule>
+                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                               <configuration artifactName="${ProjName}" buildProperties="" description="" id="com.qnx.qcc.toolChain.1271074456" name="Simulator-Debug" parent="org.eclipse.cdt.build.core.emptycfg">
+                                       <folderInfo id="com.qnx.qcc.toolChain.1271074456.2095507025" name="/" resourcePath="">
+                                               <toolChain id="com.qnx.qcc.toolChain.563285451" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
+                                                       <option id="com.qnx.qcc.option.os.2028959839" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
+                                                       <option id="com.qnx.qcc.option.cpu.460119393" name="Target CPU:" superClass="com.qnx.qcc.option.cpu"/>
+                                                       <option id="com.qnx.qcc.option.compiler.318948553" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
+                                                       <option id="com.qnx.qcc.option.runtime.1244314155" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
+                                                       <targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.2005367550" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
+                                                       <builder id="com.qnx.qcc.toolChain.1271074456.325666051" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+                                                       <tool id="com.qnx.qcc.tool.compiler.821983732" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
+                                                               <option id="com.qnx.qcc.option.compiler.optlevel.1701209030" name="Optimization Level" superClass="com.qnx.qcc.option.compiler.optlevel" value="com.qnx.qcc.option.compiler.optlevel.0" valueType="enumerated"/>
+                                                               <option id="com.qnx.qcc.option.compiler.includePath.1616908655" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/freetype2"/>
+                                                                       <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                                               </option>
+                                                               <inputType id="com.qnx.qcc.inputType.compiler.1059435667" superClass="com.qnx.qcc.inputType.compiler"/>
+                                                       </tool>
+                                                       <tool id="com.qnx.qcc.tool.assembler.1920350417" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
+                                                               <inputType id="com.qnx.qcc.inputType.assembler.618235584" superClass="com.qnx.qcc.inputType.assembler"/>
+                                                       </tool>
+                                                       <tool id="com.qnx.qcc.tool.linker.1321150712" name="QCC Linker" superClass="com.qnx.qcc.tool.linker"/>
+                                                       <tool id="com.qnx.qcc.tool.archiver.1860233844" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
+                                               </toolChain>
+                                       </folderInfo>
+                               </configuration>
+                       </storageModule>
+                       <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+               </cconfiguration>
+       </storageModule>
+       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+               <project id="pcsx_rearmed.null.446260429" name="pcsx_rearmed"/>
+       </storageModule>
+       <storageModule moduleId="scannerConfiguration">
+               <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
+               <scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.1815033502">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
+               </scannerConfigBuildInfo>
+               <scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.1762498539">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
+               </scannerConfigBuildInfo>
+               <scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.1271074456">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
+               </scannerConfigBuildInfo>
+       </storageModule>
+       <storageModule moduleId="refreshScope" versionNumber="1">
+               <resource resourceType="PROJECT" workspacePath="/pcsx_rearmed"/>
+       </storageModule>
+</cproject>
diff --git a/blackberry_qnx/.project b/blackberry_qnx/.project
new file mode 100644 (file)
index 0000000..c8e1e20
--- /dev/null
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>pcsx_rearmed</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+                       <triggers>clean,full,incremental,</triggers>
+                       <arguments>
+                               <dictionary>
+                                       <key>?name?</key>
+                                       <value></value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.append_environment</key>
+                                       <value>true</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
+                                       <value>all</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.buildArguments</key>
+                                       <value>-C .. -f Makefile.libretro platform=qnx</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.buildCommand</key>
+                                       <value>make</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
+                                       <value>clean</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.contents</key>
+                                       <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
+                                       <value>false</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
+                                       <value>true</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.enableFullBuild</key>
+                                       <value>true</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
+                                       <value>all</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.stopOnError</key>
+                                       <value>true</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
+                                       <value>false</value>
+                               </dictionary>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+                       <triggers>full,incremental,</triggers>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>com.qnx.tools.bbt.xml.core.bbtXMLValidationBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.cdt.core.cnature</nature>
+               <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+               <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+               <nature>com.qnx.tools.ide.bbt.core.bbtnature</nature>
+       </natures>
+</projectDescription>
index 21c9669..5cdeb96 100644 (file)
 #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
 
index f12a981..422b485 100644 (file)
@@ -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"));