From 41f5abab31c33cb429e8bc9c03eadea2789c5cd3 Mon Sep 17 00:00:00 2001 From: Sacha Date: Mon, 5 Nov 2012 23:09:49 +1000 Subject: [PATCH] PPSSPP ported to Blackberry10 Now builds on Playbook and Dev Alpha Make emulator more compatible with other OS (case sensitivity, defines, includes) Uses Android's code paths and backend --- Common/ArmEmitter.h | 2 + Common/CMakeLists.txt | 11 +-- Common/Common.h | 2 +- Common/CommonFuncs.h | 4 +- Common/StringUtil.h | 32 +++++++ Common/Thread.h | 2 +- Common/Thunk.h | 4 +- Common/x86Disasm.cpp | 2 +- Common/x86Disasm.h | 2 +- Core/CMakeLists.txt | 30 +++++-- Core/HLE/sceDisplay.cpp | 2 +- Core/MIPS/ARM/Asm.cpp | 4 +- Core/MIPS/ARM/Asm.h | 2 +- Core/MIPS/ARM/CompALU.cpp | 2 +- Core/MIPS/ARM/CompBranch.cpp | 4 +- Core/MIPS/ARM/Jit.h | 4 +- Core/MIPS/ARM/JitCache.cpp | 2 +- Core/MIPS/ARM/RegCache.h | 2 +- Core/MIPS/JitCommon/JitCommon.h | 2 +- Core/MIPS/MIPS.cpp | 4 +- Core/MIPS/MIPSDis.cpp | 2 +- Core/MIPS/MIPSInt.cpp | 2 +- Core/MIPS/MIPSTables.cpp | 2 +- Core/MIPS/x86/Jit.h | 2 +- Core/System.cpp | 2 +- GPU/GLES/DisplayListInterpreter.cpp | 4 +- GPU/GLES/FragmentShaderGenerator.cpp | 2 +- GPU/GLES/Framebuffer.cpp | 4 +- GPU/GLES/ShaderManager.cpp | 2 +- GPU/GLES/TextureCache.cpp | 2 +- GPU/GLES/TransformPipeline.cpp | 4 +- GPU/GLES/VertexDecoder.cpp | 2 +- GPU/GLES/VertexShaderGenerator.cpp | 2 +- GPU/GPUState.cpp | 2 +- Globals.h | 1 + SDL/CMakeLists.txt | 27 ++++-- SDL/build_for_playbook.sh | 122 +++++++++++++++++++++++++++ Windows/OpenGLBase.cpp | 2 +- 38 files changed, 243 insertions(+), 62 deletions(-) create mode 100644 SDL/build_for_playbook.sh diff --git a/Common/ArmEmitter.h b/Common/ArmEmitter.h index 4ab2186dcc..0af0e636aa 100644 --- a/Common/ArmEmitter.h +++ b/Common/ArmEmitter.h @@ -23,6 +23,8 @@ #include "Common.h" #include "MemoryUtil.h" +#undef _SP + namespace ArmGen { diff --git a/Common/CMakeLists.txt b/Common/CMakeLists.txt index c12b4a51ba..bec85d7347 100644 --- a/Common/CMakeLists.txt +++ b/Common/CMakeLists.txt @@ -1,7 +1,5 @@ set(SRCS - ABI.cpp Action.cpp - CPUDetect.cpp ColorUtil.cpp ConsoleListener.cpp ExtendedTrace.cpp @@ -11,23 +9,20 @@ set(SRCS Hash.cpp IniFile.cpp LogManager.cpp - MathUtil.cpp MemArena.cpp MemoryUtil.cpp Misc.cpp MsgHandler.cpp StringUtil.cpp Thread.cpp - Thunk.cpp Timer.cpp - x64Analyzer.cpp - x64Emitter.cpp - x86Disasm.cpp ) # TODO if (ARM) set(SRCS ${SRCS} ArmEmitter.cpp ArmABI.cpp) +else() + set(SRCS ${SRCS} CPUDetect.cpp MathUtil.cpp Thunk.cpp x64Analyzer.cpp x64Emitter.cpp x86Disasm.cpp ABI.cpp) endif (ARM) set(SRCS ${SRCS}) @@ -35,6 +30,6 @@ set(SRCS ${SRCS}) add_library(common STATIC ${SRCS}) if(UNIX) - add_definitions(-fPIC) + add_definitions(-fPIC) endif(UNIX) diff --git a/Common/Common.h b/Common/Common.h index 9d9c146243..696a6bbcc2 100644 --- a/Common/Common.h +++ b/Common/Common.h @@ -25,7 +25,7 @@ #include #include -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #define _M_ARM32 #endif diff --git a/Common/CommonFuncs.h b/Common/CommonFuncs.h index f5193d4beb..832256a083 100644 --- a/Common/CommonFuncs.h +++ b/Common/CommonFuncs.h @@ -36,7 +36,7 @@ template<> struct CompileTimeAssert {}; #define ROUND_UP_POW2(x) (b32(x - 1) + 1) #if defined __GNUC__ && !defined __SSSE3__ -#ifndef ANDROID +#if !defined(ANDROID) && !defined(BLACKBERRY) #include static __inline __m128i __attribute__((__always_inline__)) _mm_shuffle_epi8(__m128i a, __m128i mask) @@ -63,7 +63,7 @@ _mm_shuffle_epi8(__m128i a, __m128i mask) #ifdef GEKKO #define Crash() #else -#ifndef ANDROID +#if !defined(ANDROID) && !defined(BLACKBERRY) #define Crash() {asm ("int $3");} #else #define Crash() {kill( getpid(), SIGINT ) ; } diff --git a/Common/StringUtil.h b/Common/StringUtil.h index 064f79c2b3..a5477a3996 100644 --- a/Common/StringUtil.h +++ b/Common/StringUtil.h @@ -27,6 +27,38 @@ #include "Common.h" +#ifdef BLACKBERRY +// QNX Does not have an implementation of vasprintf +static inline int vasprintf(char **rResult, const char *aFormat, va_list aAp) +{ + int rVal; + char *result; + va_list ap; + + result = (char *) malloc(16); + if (result == NULL) return -1; + + va_copy(ap, aAp); + rVal = vsnprintf(result, 16, aFormat, ap); + va_end(ap); + + if (rVal == -1) return rVal; + else if (rVal >= 16) + { + free(result); + result = (char *) malloc(rVal + 1); + if (result == NULL) return -1; + + va_copy(ap, aAp); + rVal = vsnprintf(result, rVal + 1, aFormat, aAp); + va_end(ap); + } + + *rResult = result; + return rVal; +} +#endif + std::string StringFromFormat(const char* format, ...); // Cheap! bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args); diff --git a/Common/Thread.h b/Common/Thread.h index ce335aee06..65395db065 100644 --- a/Common/Thread.h +++ b/Common/Thread.h @@ -33,7 +33,7 @@ #define INFINITE 0xffffffff #endif -#ifndef ANDROID +#if !defined(ANDROID) && !defined(BLACKBERRY) #include #endif diff --git a/Common/Thunk.h b/Common/Thunk.h index 75b5525a1b..66fe703943 100644 --- a/Common/Thunk.h +++ b/Common/Thunk.h @@ -21,7 +21,7 @@ #include #include "Common.h" -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #include "ArmEmitter.h" #else #include "x64Emitter.h" @@ -38,7 +38,7 @@ // we don't want to pollute the stack, so we store away regs somewhere global. // NOT THREAD SAFE. This may only be used from the CPU thread. // Any other thread using this stuff will be FATAL. -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) class ThunkManager : public ArmGen::ARMXCodeBlock #else class ThunkManager : public Gen::XCodeBlock diff --git a/Common/x86Disasm.cpp b/Common/x86Disasm.cpp index 42a8499c41..535218c7a4 100644 --- a/Common/x86Disasm.cpp +++ b/Common/x86Disasm.cpp @@ -1,7 +1,7 @@ // X86 disassembler - 95% ripped from some GNU source if I remember // correctly, probably GCC or some GCC tool -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #error DO NOT COMPILE THIS INTO ANDROID BUILDS #endif diff --git a/Common/x86Disasm.h b/Common/x86Disasm.h index fcbebd1801..e6de2c54bc 100644 --- a/Common/x86Disasm.h +++ b/Common/x86Disasm.h @@ -1,6 +1,6 @@ #pragma once -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #error DO NOT COMPILE THIS INTO ANDROID BUILDS #endif diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index dc1a37e687..54ab5d1791 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -12,14 +12,6 @@ set(SRCS MIPS/MIPSTables.cpp MIPS/MIPSVFPUUtils.cpp MIPS/JitCommon/JitCommon.cpp - MIPS/x86/Asm.cpp - MIPS/x86/CompALU.cpp - MIPS/x86/CompBranch.cpp - MIPS/x86/CompLoadStore.cpp - MIPS/x86/CompFPU.cpp - MIPS/x86/Jit.cpp - MIPS/x86/JitCache.cpp - MIPS/x86/RegCache.cpp ELF/ElfReader.cpp HLE/HLE.cpp HLE/HLETables.cpp @@ -73,6 +65,28 @@ set(SRCS Core.cpp ) +if(ARM) + set(SRCS ${SRCS} MIPS/ARM/Asm.cpp + MIPS/ARM/CompALU.cpp + MIPS/ARM/CompBranch.cpp + MIPS/ARM/CompLoadStore.cpp + MIPS/ARM/CompFPU.cpp + MIPS/ARM/Jit.cpp + MIPS/ARM/JitCache.cpp + MIPS/ARM/RegCache.cpp + ) +else() + set(SRCS ${SRCS} MIPS/x86/Asm.cpp + MIPS/x86/CompALU.cpp + MIPS/x86/CompBranch.cpp + MIPS/x86/CompLoadStore.cpp + MIPS/x86/CompFPU.cpp + MIPS/x86/Jit.cpp + MIPS/x86/JitCache.cpp + MIPS/x86/RegCache.cpp + ) +endif(ARM) + set(SRCS ${SRCS}) add_library(core STATIC ${SRCS}) diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index e0acade146..869a95e278 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -15,7 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #include #include #else diff --git a/Core/MIPS/ARM/Asm.cpp b/Core/MIPS/ARM/Asm.cpp index 9e4051e81b..da68215c7b 100644 --- a/Core/MIPS/ARM/Asm.cpp +++ b/Core/MIPS/ARM/Asm.cpp @@ -16,9 +16,9 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "ABI.h" -#include "ARMEmitter.h" +#include -#include "../../Memmap.h" +#include "../../MemMap.h" #include "../MIPS.h" #include "../../CoreTiming.h" diff --git a/Core/MIPS/ARM/Asm.h b/Core/MIPS/ARM/Asm.h index 6a5f84f2f8..4897d885f4 100644 --- a/Core/MIPS/ARM/Asm.h +++ b/Core/MIPS/ARM/Asm.h @@ -18,7 +18,7 @@ #ifndef _JIT64ASM_H #define _JIT64ASM_H -#include "ArmEmitter.h" +#include #include "../MIPS.h" // In PPSSPP, we don't use inline assembly. Instead, we generate all machine-near diff --git a/Core/MIPS/ARM/CompALU.cpp b/Core/MIPS/ARM/CompALU.cpp index 8a93e61b83..da608b6655 100644 --- a/Core/MIPS/ARM/CompALU.cpp +++ b/Core/MIPS/ARM/CompALU.cpp @@ -17,7 +17,7 @@ #include "Jit.h" #include "RegCache.h" -#include "ArmEmitter.h" +#include using namespace MIPSAnalyst; #define _RS ((op>>21) & 0x1F) diff --git a/Core/MIPS/ARM/CompBranch.cpp b/Core/MIPS/ARM/CompBranch.cpp index 577ff0e831..e9112d5fcb 100644 --- a/Core/MIPS/ARM/CompBranch.cpp +++ b/Core/MIPS/ARM/CompBranch.cpp @@ -24,7 +24,7 @@ #include "Jit.h" #include "RegCache.h" #include "JitCache.h" -#include "ArmEmitter.h" +#include #define _RS ((op>>21) & 0x1F) #define _RT ((op>>16) & 0x1F) @@ -353,4 +353,4 @@ void Jit::Comp_Syscall(u32 op) } -} // namespace Mipscomp \ No newline at end of file +} // namespace Mipscomp diff --git a/Core/MIPS/ARM/Jit.h b/Core/MIPS/ARM/Jit.h index 83372e4707..fe81735e41 100644 --- a/Core/MIPS/ARM/Jit.h +++ b/Core/MIPS/ARM/Jit.h @@ -20,12 +20,12 @@ #include "../../../Globals.h" #include "Asm.h" -#ifndef ANDROID +#if !defined(ANDROID) && !defined(BLACKBERRY) #error DO NOT BUILD ARM JIT ON x86 #endif -#include "ArmEmitter.h" +#include #include "JitCache.h" #include "RegCache.h" diff --git a/Core/MIPS/ARM/JitCache.cpp b/Core/MIPS/ARM/JitCache.cpp index e345c0424e..4cb912afe8 100644 --- a/Core/MIPS/ARM/JitCache.cpp +++ b/Core/MIPS/ARM/JitCache.cpp @@ -34,7 +34,7 @@ #include "Asm.h" // #include "JitBase.h" -#include "ArmEmitter.h" +#include #if defined USE_OPROFILE && USE_OPROFILE #include diff --git a/Core/MIPS/ARM/RegCache.h b/Core/MIPS/ARM/RegCache.h index 05bdff20d6..afab156b52 100644 --- a/Core/MIPS/ARM/RegCache.h +++ b/Core/MIPS/ARM/RegCache.h @@ -18,7 +18,7 @@ #pragma once #include "../MIPSAnalyst.h" -#include "ArmEmitter.h" +#include using namespace ArmGen; enum FlushMode diff --git a/Core/MIPS/JitCommon/JitCommon.h b/Core/MIPS/JitCommon/JitCommon.h index 3ee066000b..81834be6f2 100644 --- a/Core/MIPS/JitCommon/JitCommon.h +++ b/Core/MIPS/JitCommon/JitCommon.h @@ -17,7 +17,7 @@ #pragma once -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #include "../ARM/Jit.h" #else #include "../x86/Jit.h" diff --git a/Core/MIPS/MIPS.cpp b/Core/MIPS/MIPS.cpp index e7b7789562..98baf93980 100644 --- a/Core/MIPS/MIPS.cpp +++ b/Core/MIPS/MIPS.cpp @@ -23,7 +23,7 @@ #include "../System.h" #include "../Debugger/Breakpoints.h" -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #include "ARM/JitCache.h" #include "ARM/Jit.h" #else @@ -108,7 +108,7 @@ void MIPSState::RunLoopUntil(u64 globalTicks) { // Don't subvert this by setting useJIT to true - other places also check the coreparameter bool useJIT = PSP_CoreParameter().cpuCore == CPU_JIT; -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) useJIT = false; #endif diff --git a/Core/MIPS/MIPSDis.cpp b/Core/MIPS/MIPSDis.cpp index a86cb72c9b..a4d007cd76 100644 --- a/Core/MIPS/MIPSDis.cpp +++ b/Core/MIPS/MIPSDis.cpp @@ -21,7 +21,7 @@ #include "MIPSTables.h" #include "MIPSDebugInterface.h" -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #include "ARM/Jit.h" #else #include "x86/Jit.h" diff --git a/Core/MIPS/MIPSInt.cpp b/Core/MIPS/MIPSInt.cpp index 7da84de969..f9d02fc58d 100644 --- a/Core/MIPS/MIPSInt.cpp +++ b/Core/MIPS/MIPSInt.cpp @@ -55,7 +55,7 @@ void DelayBranchTo(u32 where) int MIPS_SingleStep() { -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) u32 op = Memory::ReadUnchecked_U32(mipsr4k.pc); #else u32 op = Memory::Read_Opcode_JIT(mipsr4k.pc); diff --git a/Core/MIPS/MIPSTables.cpp b/Core/MIPS/MIPSTables.cpp index 09cd8992f7..7904f94385 100644 --- a/Core/MIPS/MIPSTables.cpp +++ b/Core/MIPS/MIPSTables.cpp @@ -24,7 +24,7 @@ #include "MIPSIntVFPU.h" #include "MIPSCodeUtils.h" -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #include "ARM/Jit.h" #else #include "x86/Jit.h" diff --git a/Core/MIPS/x86/Jit.h b/Core/MIPS/x86/Jit.h index 6f5bbb2cac..eac06d027c 100644 --- a/Core/MIPS/x86/Jit.h +++ b/Core/MIPS/x86/Jit.h @@ -20,7 +20,7 @@ #include "../../../Globals.h" #include "Asm.h" -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #error DO NOT BUILD X86 JIT ON ANDROID #endif diff --git a/Core/System.cpp b/Core/System.cpp index 93910a4efe..f44ee16d71 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -19,7 +19,7 @@ #include "MIPS/MIPS.h" -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #include "MIPS/ARM/Jit.h" #else #include "MIPS/x86/Jit.h" diff --git a/GPU/GLES/DisplayListInterpreter.cpp b/GPU/GLES/DisplayListInterpreter.cpp index 79f0656c20..fa8bead636 100644 --- a/GPU/GLES/DisplayListInterpreter.cpp +++ b/GPU/GLES/DisplayListInterpreter.cpp @@ -15,7 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #include #include #else @@ -224,7 +224,7 @@ void SetBlendModePSP(u32 data) GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) GL_FUNC_ADD, GL_FUNC_ADD, #else diff --git a/GPU/GLES/FragmentShaderGenerator.cpp b/GPU/GLES/FragmentShaderGenerator.cpp index ff357dc7fc..f4d3b7ce9b 100644 --- a/GPU/GLES/FragmentShaderGenerator.cpp +++ b/GPU/GLES/FragmentShaderGenerator.cpp @@ -15,7 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #define GLSL_ES_1_0 #else #define GLSL_1_3 diff --git a/GPU/GLES/Framebuffer.cpp b/GPU/GLES/Framebuffer.cpp index 4451b2dba8..d3477958a1 100644 --- a/GPU/GLES/Framebuffer.cpp +++ b/GPU/GLES/Framebuffer.cpp @@ -15,7 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #include #include #else @@ -72,7 +72,7 @@ const char basic_vs[] = void DisplayDrawer_Init() { -#ifndef ANDROID +#if !defined(ANDROID) && !defined(BLACKBERRY) // Old OpenGL stuff that probably has no effect glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); //GL_FILL); diff --git a/GPU/GLES/ShaderManager.cpp b/GPU/GLES/ShaderManager.cpp index 11abeab913..ec0e375ec9 100644 --- a/GPU/GLES/ShaderManager.cpp +++ b/GPU/GLES/ShaderManager.cpp @@ -15,7 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #include #include #else diff --git a/GPU/GLES/TextureCache.cpp b/GPU/GLES/TextureCache.cpp index 25b51eebb5..4a25bb3af8 100644 --- a/GPU/GLES/TextureCache.cpp +++ b/GPU/GLES/TextureCache.cpp @@ -15,7 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #include #include #else diff --git a/GPU/GLES/TransformPipeline.cpp b/GPU/GLES/TransformPipeline.cpp index 475141a7af..0ae6e52df2 100644 --- a/GPU/GLES/TransformPipeline.cpp +++ b/GPU/GLES/TransformPipeline.cpp @@ -15,7 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #include #include #else @@ -227,7 +227,7 @@ void TransformAndDrawPrim(void *verts, void *inds, int prim, int vertexCount, Li // TODO: Split up into multiple draw calls for Android where you can't guarantee support for more than 0x10000 verts. int i = 0; -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) if (vertexCount > 0x10000/3) vertexCount = 0x10000/3; #endif diff --git a/GPU/GLES/VertexDecoder.cpp b/GPU/GLES/VertexDecoder.cpp index 9abc3d4820..e8a0227a00 100644 --- a/GPU/GLES/VertexDecoder.cpp +++ b/GPU/GLES/VertexDecoder.cpp @@ -15,7 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #include #include #else diff --git a/GPU/GLES/VertexShaderGenerator.cpp b/GPU/GLES/VertexShaderGenerator.cpp index 0e8c1528b4..7dde42381a 100644 --- a/GPU/GLES/VertexShaderGenerator.cpp +++ b/GPU/GLES/VertexShaderGenerator.cpp @@ -53,7 +53,7 @@ void WriteLight(char *p, int l) { char *GenerateVertexShader() { char *p = buffer; -#if defined(ANDROID) +#if defined(ANDROID) || defined(BLACKBERRY) WRITE("precision highp float;"); #elif !defined(FORCE_OPENGL_2_0) WRITE("#version 130"); diff --git a/GPU/GPUState.cpp b/GPU/GPUState.cpp index 668980444a..fbc5376b8d 100644 --- a/GPU/GPUState.cpp +++ b/GPU/GPUState.cpp @@ -15,7 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #include #include #else diff --git a/Globals.h b/Globals.h index a4700fc496..9de536c700 100644 --- a/Globals.h +++ b/Globals.h @@ -17,6 +17,7 @@ #pragma once +#include #include #include diff --git a/SDL/CMakeLists.txt b/SDL/CMakeLists.txt index 278d825dd0..f82c09040f 100644 --- a/SDL/CMakeLists.txt +++ b/SDL/CMakeLists.txt @@ -12,6 +12,11 @@ if (APPLE) include_directories(/usr/X11/include) endif() +# TODO: Rely on compiler define instead. __BLACKBERRY__ ? +if (BLACKBERRY) + add_definitions(-DBLACKBERRY) +endif() + include(FindOpenGL) include(FindSDL) @@ -23,11 +28,13 @@ add_definitions(-DSDL) add_definitions(-Wno-multichar) add_definitions(-fno-strict-aliasing) add_definitions(-DUSE_PROFILER) -add_definitions(-D_DEBUG) +if (NOT BLACKBERRY) + add_definitions(-D_DEBUG) +endif() if (UNIX) if (NOT APPLE) # can't build the SDL .m file with -std=gnu++0x - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x") endif() endif() @@ -65,7 +72,15 @@ add_subdirectory(../Common Common) add_subdirectory(../GPU GPU) add_subdirectory(../Core Core) -set(LIBS ${LIBS} ${SDL_LIBRARY} ${OPENGL_LIBRARIES} GLEW file lin ${PNG_LIBRARY} z gfx gfx_es2 etcdec image stb_image mixer net ui profiler timeutil file zip base lin vjson stb_vorbis sha1 jsonwriter common core gpu) +set(LIBS ${LIBS} ${SDL_LIBRARY} ${OPENGL_LIBRARIES} file lin ${PNG_LIBRARY} z gfx gfx_es2 etcdec image stb_image mixer net ui profiler timeutil file zip base lin vjson stb_vorbis sha1 jsonwriter common core gpu) + +# TODO: Blackberry specific libs (eg. TCO) +if(BLACKBERRY) + set(LIBS ${LIBS} socket) +else() + set(LIBS ${LIBS} GLEW) +endif() + set(FILES ../android/jni/NativeApp.cpp ../android/jni/EmuScreen.cpp @@ -76,9 +91,9 @@ set(FILES ../native/base/PCMain.cpp ) -if (APPLE) - SET(FILES ${FILES} SDLMain.m) -endif (APPLE) +if(APPLE) + set(FILES ${FILES} SDLMain.m) +endif(APPLE) add_executable(ppsspp ${FILES}) diff --git a/SDL/build_for_playbook.sh b/SDL/build_for_playbook.sh new file mode 100644 index 0000000000..369ca96e36 --- /dev/null +++ b/SDL/build_for_playbook.sh @@ -0,0 +1,122 @@ +#!/bin/bash + +BUILD_TYPE=Release +if [ -z "$PPSSPP_ROOT" ]; then + PPSSPP_ROOT=${PWD}/.. +fi +if [ -z "$PROJECT_ROOT" ]; then + PROJECT_ROOT=${PPSSPP_ROOT}/.. +fi +PKG_CONFIG_PATH=${PROJECT_ROOT}/install/lib/pkgconfig +PKG_CONFIG_LIBDIR=${PROJECT_ROOT}/install/lib/pkgconfig + +SDL_PROJECT=${PROJECT_ROOT}/SDL +SDLIMAGE_PROJECT=${PROJECT_ROOT}/SDL_image +SDLMIXER_PROJECT=${PROJECT_ROOT}/SDL_mixer +SDLNET_PROJECT=${PROJECT_ROOT}/SDL_net +SDLTTF_PROJECT=${PROJECT_ROOT}/SDL_ttf + +while true; do + case "$1" in + -h | --help ) + echo "Build script for BlackBerry PlayBook" + echo "For normal usage, please use the NDK to build." + echo + echo "Options: " + echo " -d, --debug Create a debug build. (default is release)" + echo " -h, --help Show this help message." + echo " -r, --root PATH Specify the root directory of PPSSPP. (default is PWD parent)" + echo " -p, --project-root PATH Specify the root directory containing all projects. (default is root dirs parent)" + echo " If specific projects are in different directories, you can specify them below." + echo " --pkg-config PATH Specify the pkgconfig directory. (default is PPSSPP_ROOT/../install/lib/pkgconfig)" + echo + echo "Dependency Paths (defaults are under project root): " + echo " --sdl PATH SDL 1.2 project directory (default is SDL)" + echo " --tco PATH TouchControlOverlay project directory (default is TouchControlOverlay)" + echo " --sdl_image PATH SDL_image project directory (default is SDL_image)" + echo " --sdl_mixer PATH SDL_mixer project directory (default is SDL_mixer)" + echo " --sdl_net PATH SDL_net project directory (default is SDL_net)" + echo " --sdl_ttf PATH SDL_ttf project directory (default is SDL_ttf)" + echo " --ogg PATH ogg project directory (default is ogg)" + echo " --vorbis PATH vorbis project directory (default is vorbis)" + exit 0 + ;; + -d | --debug ) BUILD_TYPE=Debug; shift ;; + -r | --root ) PPSSPP_ROOT="$2"; shift 2 ;; + -p | --project-root ) PROJECT_ROOT="$2"; shift 2 ;; + --pkg-config ) PKG_CONFIG_PATH="$2"; PKG_CONFIG_LIBDIR="$2"; shift 2 ;; + --sdl ) SDL_PROJECT="$2"; shift 2 ;; + --sdl_image ) SDLIMAGE_PROJECT="$2"; shift 2 ;; + --sdl_mixer ) SDLMIXER_PROJECT="$2"; shift 2 ;; + --sdl_net ) SDLNET_PROJECT="$2"; shift 2 ;; + --sdl_ttf ) SDLTTF_PROJECT="$2"; shift 2 ;; + --tco ) TCO_PROJECT="$2"; shift 2 ;; + --ogg ) OGG_PROJECT="$2"; shift 2 ;; + --vorbis ) VORBIS_PROJECT="$2"; shift 2 ;; + -- ) shift; break ;; + * ) break ;; + esac +done + +if [ -z "$SDL_PROJECT" ]; then + SDL_PROJECT="$PROJECT_ROOT/SDL" +fi +if [ -z "$SDLIMAGE_PROJECT" ]; then + SDLIMAGE_PROJECT="$PROJECT_ROOT/SDL_image" +fi +if [ -z "$SDLMIXER_PROJECT" ]; then + SDLMIXER_PROJECT="$PROJECT_ROOT/SDL_mixer" +fi +if [ -z "$SDLNET_PROJECT" ]; then + SDLNET_PROJECT="$PROJECT_ROOT/SDL_net" +fi +if [ -z "$SDLTTF_PROJECT" ]; then + SDLTTF_PROJECT="$PROJECT_ROOT/SDL_ttf" +fi +if [ -z "$TCO_PROJECT" ]; then + TCO_PROJECT="$PROJECT_ROOT/TouchControlOverlay" +fi +if [ -z "$OGG_PROJECT" ]; then + OGG_PROJECT="$PROJECT_ROOT/ogg" +fi +if [ -z "$VORBIS_PROJECT" ]; then + VORBIS_PROJECT="$PROJECT_ROOT/vorbis" +fi + +export PKG_CONFIG_PATH +export PKG_CONFIG_LIBDIR + +echo "Build type: ${BUILD_TYPE}" + +cmake \ +-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ +-DCMAKE_SYSTEM_NAME=QNX \ +-DCMAKE_C_COMPILER="${QNX_HOST}/usr/bin/ntoarmv7-gcc" \ +-DCMAKE_CXX_COMPILER="${QNX_HOST}/usr/bin/ntoarmv7-g++" \ +-DTHREADS_PTHREAD_ARG="" \ +-DLIBINTL_INCLUDE_DIR="${QNX_TARGET}/usr/include" \ +-DLIBINTL_LIB_FOUND=TRUE \ +-DLIBINTL_LIBRARIES="${QNX_TARGET}/armle-v7/usr/lib/libintl.so" \ +-DLIBINTL_LIBC_HAS_DGETTEXT=FALSE \ +-DSDL_INCLUDE_DIR="${SDL_PROJECT}/include" \ +-DSDL_LIBRARY="${SDL_PROJECT}/Device-${BUILD_TYPE}/libSDL12.so;${TCO_PROJECT}/Device-${BUILD_TYPE}/libTouchControlOverlay.so" \ +-DSDL_FOUND=ON \ +-DSDLIMAGE_INCLUDE_DIR="${SDLIMAGE_PROJECT}" \ +-DSDLIMAGE_LIBRARY="${SDLIMAGE_PROJECT}/Device-${BUILD_TYPE}/libSDL_image.so" \ +-DSDLIMAGE_FOUND=ON \ +-DSDLMIXER_INCLUDE_DIR="${SDLMIXER_PROJECT}" \ +-DSDLMIXER_LIBRARY="${SDLMIXER_PROJECT}/Device-${BUILD_TYPE}/libSDL_mixer.so;${OGG_PROJECT}/Device-${BUILD_TYPE}/libogg.so;${VORBIS_PROJECT}/Device-${BUILD_TYPE}/libvorbis.so" \ +-DSDLMIXER_FOUND=ON \ +-DSDLNET_INCLUDE_DIR="${SDLNET_PROJECT}" \ +-DSDLNET_LIBRARY="${SDLNET_PROJECT}/Device-${BUILD_TYPE}/libSDL_net.so;${QNX_TARGET}/armle-v7/lib/libsocket.so" \ +-DSDLNET_FOUND=ON \ +-DSDLTTF_INCLUDE_DIR="${SDLTTF_PROJECT}" \ +-DSDLTTF_LIBRARY="${SDLTTF_PROJECT}/Device-${BUILD_TYPE}/libSDL_ttf.so" \ +-DSDLTTF_FOUND=ON \ +-DPNG_LIBRARY="${QNX_TARGET}/armle-v7/usr/lib/libpng.so" \ +-DPNG_PNG_INCLUDE_DIR="${QNX_TARGET}/usr/include" \ +-DBLACKBERRY=10.0.9 \ +-DARM=7 \ +${PWD} + +make -j4 diff --git a/Windows/OpenGLBase.cpp b/Windows/OpenGLBase.cpp index 4edf1c6bec..488b70e9fa 100644 --- a/Windows/OpenGLBase.cpp +++ b/Windows/OpenGLBase.cpp @@ -1,6 +1,6 @@ // NOTE: Apologies for the quality of this code, this is really from pre-opensource Dolphin - that is, 2003. -#ifdef ANDROID +#if defined(ANDROID) || defined(BLACKBERRY) #include #include #else