Some preparation work for new platform support.

- Added a "PSP" compile-time define to clean up some compile time checks (replaced !WIN32 && !LINUX && !IOS with PSP) 
-- Wil, I am aware that this is redundant with the PSPENV variable you introduced recently, I think we can clean that up easily
-- This looks like lots of changes, but most of the time I just moved some blocks here and there
-- tested on VC 2010, PSP, and a bit of NDK
-- I might have broken maemo, iOS, or Linux compilation, can you guys check?
- Fixed some warnings reported by NDK
- NDK still does not compile because recent boost additions (mutex, etc...) are apparently not supported
This commit is contained in:
wagic.the.homebrew
2011-04-21 13:16:11 +00:00
parent 5eb36fecc0
commit 8ff6839c8d
26 changed files with 257 additions and 252 deletions

View File

@@ -19,9 +19,7 @@
#include <map>
#include <string>
#if defined (WIN32) || defined (LINUX) || defined(IOS)
#else
#if defined (PSP)
#include <pspiofilemgr.h>
#include <pspiofilemgr_fcntl.h>
#endif
@@ -130,10 +128,10 @@ private:
char *mPassword;
bool mZipAvailable;
void preloadZip(const string& filename);
#if defined (WIN32) || defined (LINUX) || defined(IOS)
FILE *mFile;
#else
#if defined (PSP)
SceUID mFile;
#else
FILE *mFile;
#endif
unzFile mZipFile;
int mFileSize;

View File

@@ -28,18 +28,26 @@
#include <Qt>
typedef u32 LocalKeySym;
#define LOCAL_KEY_NONE Qt::Key_unknown
#elif defined(WIN32)
#include <windows.h>
typedef WPARAM LocalKeySym;
#define LOCAL_KEY_NONE ((WPARAM)-1)
#elif defined(LINUX)
#include <X11/XKBlib.h>
#include <X11/keysym.h>
typedef KeySym LocalKeySym;
#define LOCAL_KEY_NONE XK_VoidSymbol
#elif defined(ANDROID) // This is temporary until we understand how to send real key events from Java
typedef long unsigned int LocalKeySym;
#define LOCAL_KEY_NONE 0
#else
typedef u32 LocalKeySym;
#define LOCAL_KEY_NONE ((u32)-1)
#endif
@@ -51,7 +59,7 @@ u8 JGEGetAnalogX();
u8 JGEGetAnalogY();
bool JGEToggleFullscreen();
#if !defined(WIN32) && !defined(LINUX) && !defined(IOS)
#if defined (PSP)
// hack to fix a typedef definition of u32 inside of newlib's stdint.h
// this used to be defined as an unsigned long, but as of minpspw 11.1, it's

View File

@@ -11,15 +11,9 @@
#ifndef _MD2MODEL_H
#define _MD2MODEL_H
#if defined (WIN32) || defined (LINUX) || defined (IOS)
#else
#if defined (PSP)
#include <pspgu.h>
#include <pspgum.h>
#endif
@@ -236,10 +230,10 @@ private:
void CheckNextState();
#if defined (WIN32) || defined (LINUX) || defined (IOS)
void CalculateNormal(float *p1, float *p2, float *p3);
#else
#if defined (PSP)
void CalculateNormal(ScePspFVector3* normal, float *p1, float *p2, float *p3);
#else
void CalculateNormal(float *p1, float *p2, float *p3);
#endif
MD2Animation **mAnimations;

View File

@@ -15,15 +15,9 @@
using namespace std;
#if defined (WIN32) || defined (LINUX) || defined (IOS)
#else
#if defined (PSP)
#include <pspgu.h>
#include <pspgum.h>
#endif

View File

@@ -16,9 +16,9 @@
#include <string.h>
#include <stdarg.h>
#if (!defined IOS)
#if (!defined IOS) && (!defined ANDROID)
#include <gif_lib.h>
#endif //IOS
#endif //IOS ANDROID
#include "JTypes.h"
@@ -27,9 +27,7 @@
#include <windows.h>
#elif defined (LINUX) || defined(IOS)
#else
#elif defined (PSP)
#include <pspgu.h>
#include <pspkernel.h>
@@ -80,8 +78,7 @@ protected:
public:
#if defined (WIN32) || defined (LINUX) || defined (IOS)
#else
#if defined (PSP)
int PixelSize(int textureMode);
#endif
@@ -575,13 +572,15 @@ private:
#if (!defined IOS)
void LoadJPG(TextureInfo &textureInfo, const char *filename, int mode = 0, int TextureFormat = TEXTURE_FORMAT);
int LoadPNG(TextureInfo &textureInfo, const char *filename, int mode = 0, int TextureFormat = TEXTURE_FORMAT);
#if (!defined ANDROID)
void LoadGIF(TextureInfo &textureInfo, const char *filename, int mode = 0, int TextureFormat = TEXTURE_FORMAT);
int image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bgcolor, InputFunc readFunc,int mode = 0, int TextureFormat = TEXTURE_FORMAT);
#endif // (ANDROID) How can we get gif support for android ?
#endif //(IOS)
static JRenderer* mInstance;
#if defined (WIN32) || defined (LINUX) || defined (IOS)
#if (!defined PSP)
GLuint mCurrentTex;
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) || (defined WIN32)

View File

@@ -27,10 +27,7 @@
#include <windows.h>
#define WITH_FMOD
#elif defined (LINUX) || defined (IOS)
#else
#elif defined (PSP)
#include <pspgu.h>
#include <pspkernel.h>
#include <pspdisplay.h>
@@ -73,16 +70,17 @@ public:
#else
#if defined (WIN32) || defined (LINUX) || defined (IOS)
#if defined (PSP)
JMP3* mTrack;
#else
#ifdef WITH_FMOD
FSOUND_SAMPLE* mTrack; // MP3 needed to be of "sample" type for FMOD, FMUSIC_MODULE is for MODs
#else
void* mTrack;
#endif
#else
JMP3* mTrack;
#endif
#endif
#endif //WITH_FMOD
#endif //PSP
#endif //USE_PHONON
};
@@ -97,19 +95,20 @@ class JSample
int mVoice;
unsigned long fileSize();
#if defined (WIN32) || defined (LINUX) || defined (IOS)
#if defined (PSP)
WAVDATA *mSample;
#else
#ifdef WITH_FMOD
FSOUND_SAMPLE *mSample;
#else
#ifdef USE_PHONON
Phonon::AudioOutput* mOutput;
Phonon::MediaObject* mMediaObject;
#endif
#endif //USE_PHONON
void* mSample;
#endif
#else
WAVDATA *mSample;
#endif
#endif //WITH_FMOD
#endif //PSP
};

View File

@@ -11,10 +11,10 @@
#ifndef _SPRITE_H_
#define _SPRITE_H_
#if defined (WIN32) || defined(LINUX) || defined(IOS)
#include <math.h>
#else
#if defined (PSP)
#include <fastmath.h>
#else
#include <math.h>
#endif
#include <vector>

View File

@@ -11,11 +11,7 @@
#ifndef _JTYPES_H
#define _JTYPES_H
#if defined (WIN32) || defined (LINUX) || defined (IOS)
#include <stdint.h>
#else
#if defined (PSP)
#include <pspgu.h>
#include <pspgum.h>
@@ -27,9 +23,12 @@
#include <string.h>
#include <pspaudiolib.h>
#include <psprtc.h>
#include "JAudio.h"
#else
#include <stdint.h>
#endif
#ifndef __GNUC__
@@ -46,6 +45,11 @@ enum {
JGE_ERR_GENERIC = -5,
};
#ifdef PSP
#include <fastmath.h>
#else
#include <math.h>
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846f
@@ -81,7 +85,7 @@ enum {
#ifdef WIN32
#include <windows.h>
#endif
#if defined(LINUX) || defined(IOS)
#if defined(LINUX) || defined(IOS) || defined (ANDROID)
typedef uint8_t byte;
typedef uint32_t DWORD;
typedef uint8_t BYTE;
@@ -98,47 +102,27 @@ enum {
#import <OpenGLES/ES2/glext.h>
#import <OpenGLES/ES1/gl.h>
# import <OpenGLES/ES1/glext.h>
#elif defined (WIN32) || defined (LINUX)
#include <GL/gl.h>
#elif defined (WIN32) || defined (LINUX)
#include <GL/gl.h>
#include <GL/glu.h>
//Android GL1 support TODO
/*
#elif defined (ANDROID)
#include <GLES/gl.h>
#include <GLES/glext.h>
*/
//Android GL2 support
#elif defined (ANDROID)
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#endif
#else
# include <QtOpenGL>
#endif
#if defined (WIN32) || defined (LINUX) || defined (IOS)
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
#define BLEND_ZERO GL_ZERO
#define BLEND_ONE GL_ONE
#define BLEND_SRC_COLOR GL_SRC_COLOR
#define BLEND_ONE_MINUS_SRC_COLOR GL_ONE_MINUS_SRC_COLOR
#define BLEND_SRC_ALPHA GL_SRC_ALPHA
#define BLEND_ONE_MINUS_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
#define BLEND_DST_ALPHA GL_DST_ALPHA
#define BLEND_ONE_MINUS_DST_ALPHA GL_ONE_MINUS_DST_ALPHA
#define BLEND_DST_COLOR GL_DST_COLOR
#define BLEND_ONE_MINUS_DST_COLOR GL_ONE_MINUS_DST_COLOR
#define BLEND_SRC_ALPHA_SATURATE GL_SRC_ALPHA_SATURATE
#define ARGB(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
#define RGBA(r, g, b, a) (((a) << 24) | ((b) << 16) | ((g) << 8) | (r))
#define TEXTURE_FORMAT 0
#define GU_PSM_8888 0
#define GU_PSM_5551 0
#define GU_PSM_4444 0
#define GU_PSM_5650 0
#define PIXEL_TYPE DWORD
#else // PSP
#if defined (PSP)
#ifndef ABGR8888
#define ABGR8888
@@ -225,6 +209,37 @@ typedef uint32_t u32;
ScePspFVector3 pos;
} PSPVertex3D;
#else //non PSP
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
#define BLEND_ZERO GL_ZERO
#define BLEND_ONE GL_ONE
#define BLEND_SRC_COLOR GL_SRC_COLOR
#define BLEND_ONE_MINUS_SRC_COLOR GL_ONE_MINUS_SRC_COLOR
#define BLEND_SRC_ALPHA GL_SRC_ALPHA
#define BLEND_ONE_MINUS_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
#define BLEND_DST_ALPHA GL_DST_ALPHA
#define BLEND_ONE_MINUS_DST_ALPHA GL_ONE_MINUS_DST_ALPHA
#define BLEND_DST_COLOR GL_DST_COLOR
#define BLEND_ONE_MINUS_DST_COLOR GL_ONE_MINUS_DST_COLOR
#define BLEND_SRC_ALPHA_SATURATE GL_SRC_ALPHA_SATURATE
#define ARGB(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
#define RGBA(r, g, b, a) (((a) << 24) | ((b) << 16) | ((g) << 8) | (r))
#define TEXTURE_FORMAT 0
#define GU_PSM_8888 0
#define GU_PSM_5551 0
#define GU_PSM_4444 0
#define GU_PSM_5650 0
#define PIXEL_TYPE DWORD
#endif
@@ -338,14 +353,14 @@ public:
int mFilter;
#if defined (WIN32) || defined (LINUX) || defined (IOS)
GLuint mTexId;
u8* mBuffer;
#else
#if defined (PSP)
int mTextureFormat;
int mTexId;
bool mInVideoRAM;
PIXEL_TYPE* mBits;
#else
GLuint mTexId;
u8* mBuffer;
#endif
};
@@ -449,15 +464,15 @@ public:
JTexture* mTex;
#if defined (WIN32) || defined(LINUX) || defined(IOS)
#if defined (PSP)
PIXEL_TYPE mColor[4]; // up to 4 vertices
int mBlend; // GU_TFX_MODULATE, GU_TFX_DECAL, GU_TFX_BLEND, GU_TFX_REPLACE, GU_TFX_ADD
#else
float mTX0;
float mTY0;
float mTX1;
float mTY1;
JColor mColor[4]; // up to 4 vertices
#else
PIXEL_TYPE mColor[4]; // up to 4 vertices
int mBlend; // GU_TFX_MODULATE, GU_TFX_DECAL, GU_TFX_BLEND, GU_TFX_REPLACE, GU_TFX_ADD
#endif
float mX;

View File

@@ -1,7 +1,7 @@
#ifndef THREADING_H
#define THREADING_H
#if defined (WIN32) || defined (LINUX)
#if !defined(PSP)
#include <boost/date_time.hpp>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>

View File

@@ -11,12 +11,10 @@
#ifndef _VECTOR2D_H
#define _VECTOR2D_H
#ifdef WIN32
#include <math.h>
#elif (defined LINUX) || (defined IOS)
#include <math.h>
#else
#ifdef PSP
#include <fastmath.h>
#else
#include <math.h>
#endif

View File

@@ -18,6 +18,7 @@
#include "hgerect.h"
#include <list>
#include <string.h>
class JQuad;