Changes were made to allow compilation in Carbide C++ 2.7 and the Nokia S60v5 SDK. Important code from the OpenGL ES 1.1 backend was commented out since it prevented compilation

This commit is contained in:
Dante Leoncini 2026-05-01 07:16:02 -03:00
parent 558f1b9f32
commit 33a8324d08
48 changed files with 486 additions and 295 deletions

View file

@ -30,4 +30,5 @@ MACRO RW_GL3
SYSTEMINCLUDE /epoc32/include/stdapis/stlport
SYSTEMINCLUDE /epoc32/include/stdapis/stlport/stl
MACRO RW_GLES1
MACRO S60V5
#endif

View file

@ -14,7 +14,8 @@ SOURCE engine.cpp error.cpp frame.cpp geometry.cpp geoplg.cpp
SOURCEPATH ../vendor/librw/src/gl
SOURCE gl3.cpp gl3device.cpp gl3immed.cpp gl3matfx.cpp gl3pipe.cpp gl3raster.cpp gl3render.cpp gl3shader.cpp gl3skin.cpp wdgl.cpp
SOURCEPATH ../vendor/librw/src/gles1
SOURCE gl1.cpp gl1device.cpp gl1immed.cpp gl1pipe.cpp gl1raster.cpp gl1render.cpp
SOURCE rwgles1.cpp
//gl1.cpp gl1device.cpp gl1immed.cpp gl1pipe.cpp gl1raster.cpp gl1render.cpp
SOURCEPATH ../vendor/librw/src
SOURCE hanim.cpp image.cpp light.cpp
SOURCEPATH ../vendor/librw/src/lodepng

BIN
sis/re3.sisx Normal file

Binary file not shown.

View file

@ -84,7 +84,11 @@ public:
inline float GetTimeLeft() { return hierarchy->totalLength - currentTime; }
static CAnimBlendAssociation *FromLink(CAnimBlendLink *l) {
return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link));
#ifdef S60V5
return (CAnimBlendAssociation*)((uint8*)l - OFFSET_OF(CAnimBlendAssociation, link));
#else
return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link));
#endif
}
};

View file

@ -69,7 +69,7 @@ myrand(void)
{
#ifdef USE_PS2_RAND
// Use our own implementation of rand, stolen from PS2
myrand_seed = 0x5851F42D4C957F2D * myrand_seed + 1;
myrand_seed = 0x5851F42D4C957F2DULL * myrand_seed + 1;
return ((myrand_seed >> 32) & 0x7FFFFFFF);
#else
// or original codewarrior rand

View file

@ -406,7 +406,9 @@ public:
openParams.width = RsGlobal.width;
openParams.height = RsGlobal.height;
openParams.windowtitle = RsGlobal.appName;
#ifndef S60V5
openParams.windowtitle = RsGlobal.appName;
#endif
ControlsManager.MakeControllerActionsBlank();
ControlsManager.InitDefaultControlConfiguration();

View file

@ -554,7 +554,11 @@ defaultInstanceCB(Geometry *geo, InstanceDataHeader *header, bool32 reinstance)
// We expect some attributes to always be there, use the constant buffer as fallback
if(!isPrelit){
dcl[i].stream = 2;
dcl[i].offset = offsetof(VertexConstantData, color);
#ifdef S60V5
dcl[i].offset = OFFSET_OF(VertexConstantData, color);
#else
dcl[i].offset = offsetof(VertexConstantData, color);
#endif
dcl[i].type = D3DDECLTYPE_D3DCOLOR;
dcl[i].method = D3DDECLMETHOD_DEFAULT;
dcl[i].usage = D3DDECLUSAGE_COLOR;
@ -563,7 +567,11 @@ defaultInstanceCB(Geometry *geo, InstanceDataHeader *header, bool32 reinstance)
}
if(geo->numTexCoordSets == 0){
dcl[i].stream = 2;
dcl[i].offset = offsetof(VertexConstantData, texCoors[0]);
#ifdef S60V5
dcl[i].offset = OFFSET_OF(VertexConstantData, texCoors);
#else
dcl[i].offset = offsetof(VertexConstantData, texCoors);
#endif
dcl[i].type = D3DDECLTYPE_FLOAT2;
dcl[i].method = D3DDECLMETHOD_DEFAULT;
dcl[i].usage = D3DDECLUSAGE_TEXCOORD;

View file

@ -273,7 +273,7 @@ Engine::open(EngineOpenParams *p)
#elif RW_GL3
engine->device = gl3::renderdevice;
#elif RW_GLES1
engine->device = gles1::renderdevice;
//engine->device = gles1::renderdevice;
#elif RW_D3D9
engine->device = d3d::renderdevice;
#else

View file

@ -23,7 +23,12 @@ static AttribDesc im2dattribDesc[3] = {
{ ATTRIB_POS, GL_FLOAT, GL_FALSE, 4,
sizeof(Im2DVertex), 0 },
{ ATTRIB_COLOR, GL_UNSIGNED_BYTE, GL_TRUE, 4,
sizeof(Im2DVertex), offsetof(Im2DVertex, r) },
#ifdef S60V5
dcl[i].offset = OFFSET_OF(VertexConstantData, texCoors);
#else
dcl[i].offset = offsetof(VertexConstantData, texCoors);
#endif
{ ATTRIB_TEXCOORDS0, GL_FLOAT, GL_FALSE, 2,
sizeof(Im2DVertex), offsetof(Im2DVertex, u) },
};

54
vendor/librw/src/gles1/rwgles1.cpp vendored Normal file
View file

@ -0,0 +1,54 @@
#include "rwgles1.h"
namespace rw {
namespace gles1 {
// --- Funciones dummy (para linkear después) ---
inline void im2DRenderPrimitive(int, void*, int) {}
inline void im2DRenderIndexedPrimitive(int, void*, int, void*, int) {}
inline void im3DTransform(void*, int, void*, unsigned int) {}
inline void im3DRenderPrimitive(int) {}
inline void im3DRenderIndexedPrimitive(int, void*, int) {}
inline void im3DEnd(void) {}
// --- Driver lifecycle ---
static void*
driverOpen(void* object, int32 offset, int32 size)
{
// stub: no hace nada
return object;
}
static void*
driverClose(void* object, int32 offset, int32 size)
{
// stub: no hace nada
return object;
}
// --- Raster ---
static void
registerNativeRaster(void)
{
// stub por ahora
}
void
registerPlatformPlugins(void)
{
Driver::registerPlugin(PLATFORM_GLES1, 0, PLATFORM_GLES1,
driverOpen, driverClose);
registerNativeRaster();
}
void*
destroyNativeData(void *object, int32, int32)
{
//freeInstanceData((Geometry*)object);
return object;
}
}
}

View file

@ -1,7 +1,28 @@
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "../rwbase.h"
#include "../rwerror.h"
#include "../rwplg.h"
#include "../rwpipeline.h"
#include "../rwobjects.h"
#include "../rwengine.h"
#ifdef RW_GLES1
#include <gles/gl.h>
//#include <gles/glext.h>
#include <gles/egl.h>
#include <GLES/gl.h>
#include <GLES/egl.h>
#ifdef __SYMBIAN32__
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
#endif
#endif
namespace rw {
@ -9,247 +30,83 @@ namespace rw {
#ifdef RW_GLES1
struct EngineOpenParams
{
int width, height;
const char *windowtitle;
#ifdef __SYMBIAN32__
void *window; // en Symbian no hay GLFW/SDL
#else
void *window; // stub igual
#endif
int width, height;
};
#endif
namespace gles1 {
// --- Tipos básicos que charset.cpp y otros esperan ---
struct Im2DVertex {
float x, y, z, w;
float camZ;
float recipCamZ;
unsigned char r, g, b, a;
float u, v;
// --- setters esperados por librw ---
void setScreenX(float v) { x = v; }
void setScreenY(float v) { y = v; }
void setScreenZ(float v) { z = v; }
void setCameraZ(float v) { camZ = v; }
void setRecipCameraZ(float v) { recipCamZ = v; }
void setColor(unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a) {
r = _r; g = _g; b = _b; a = _a;
}
void setU(float val, float recipZ) { u = val; }
void setV(float val, float recipZ) { v = val; }
};
struct Im3DVertex {
float x, y, z;
float u, v;
uint32 color;
void setX(float v) { x = v; }
void setY(float v) { y = v; }
void setZ(float v) { z = v; }
void setU(float v) { u = v; }
void setV(float v) { this->v = v; }
void setColor(uint8 r, uint8 g, uint8 b, uint8 a) {
color = (a<<24) | (r<<16) | (g<<8) | b;
}
};
// --- Funciones dummy (para linkear después) ---
inline void im2DRenderPrimitive(int, void*, int);
inline void im2DRenderIndexedPrimitive(int, void*, int, void*, int);
inline void im3DTransform(void*, int, void*, unsigned int);
inline void im3DRenderPrimitive(int);
inline void im3DRenderIndexedPrimitive(int, void*, int);
inline void im3DEnd(void);
// --- Driver lifecycle ---
static void*
driverOpen(void* object, int32 offset, int32 size);
static void*
driverClose(void* object, int32 offset, int32 size);
// --- Raster ---
static void
registerNativeRaster(void);
void registerPlatformPlugins(void);
extern Device renderdevice;
// arguments to glVertexAttribPointer basically
struct AttribDesc
{
uint32 index;
int32 type;
bool32 normalized;
int32 size;
uint32 stride;
uint32 offset;
};
enum AttribIndices
{
ATTRIB_POS = 0,
ATTRIB_NORMAL,
ATTRIB_COLOR,
ATTRIB_WEIGHTS,
ATTRIB_INDICES,
ATTRIB_TEXCOORDS0,
ATTRIB_TEXCOORDS1,
#if 0
ATTRIB_TEXCOORDS2,
ATTRIB_TEXCOORDS3,
ATTRIB_TEXCOORDS4,
ATTRIB_TEXCOORDS5,
ATTRIB_TEXCOORDS6,
ATTRIB_TEXCOORDS7,
#endif
};
// default uniform indices
extern int32 u_matColor;
extern int32 u_surfProps;
struct InstanceData
{
uint32 numIndex;
uint32 minVert; // not used for rendering
int32 numVertices; //
Material *material;
bool32 vertexAlpha;
uint32 program;
uint32 offset;
};
struct InstanceDataHeader : rw::InstanceDataHeader
{
uint32 serialNumber;
uint32 numMeshes;
uint16 *indexBuffer;
uint32 primType;
uint8 *vertexBuffer;
int32 numAttribs;
AttribDesc *attribDesc;
uint32 totalNumIndex;
uint32 totalNumVertex;
uint32 ibo;
uint32 vbo; // or 2?
InstanceData *inst;
};
#ifdef RW_GLES1
struct Im3DVertex
{
V3d position;
uint8 r, g, b, a;
float32 u, v;
void setX(float32 x) { this->position.x = x; }
void setY(float32 y) { this->position.y = y; }
void setZ(float32 z) { this->position.z = z; }
void setColor(uint8 r, uint8 g, uint8 b, uint8 a) {
this->r = r; this->g = g; this->b = b; this->a = a; }
void setU(float32 u) { this->u = u; }
void setV(float32 v) { this->v = v; }
float getX(void) { return this->position.x; }
float getY(void) { return this->position.y; }
float getZ(void) { return this->position.z; }
RGBA getColor(void) { return makeRGBA(this->r, this->g, this->b, this->a); }
float getU(void) { return this->u; }
float getV(void) { return this->v; }
};
struct Im2DVertex
{
float32 x, y, z, w;
uint8 r, g, b, a;
float32 u, v;
void setScreenX(float32 x) { this->x = x; }
void setScreenY(float32 y) { this->y = y; }
void setScreenZ(float32 z) { this->z = z; }
// This is a bit unefficient but we have to counteract GL's divide, so multiply
void setCameraZ(float32 z) { this->w = z; }
void setRecipCameraZ(float32 recipz) { this->w = 1.0f/recipz; }
void setColor(uint8 r, uint8 g, uint8 b, uint8 a) {
this->r = r; this->g = g; this->b = b; this->a = a; }
void setU(float32 u, float recipz) { this->u = u; }
void setV(float32 v, float recipz) { this->v = v; }
float getScreenX(void) { return this->x; }
float getScreenY(void) { return this->y; }
float getScreenZ(void) { return this->z; }
float getCameraZ(void) { return this->w; }
float getRecipCameraZ(void) { return 1.0f/this->w; }
RGBA getColor(void) { return makeRGBA(this->r, this->g, this->b, this->a); }
float getU(void) { return this->u; }
float getV(void) { return this->v; }
};
void setupVertexInput(InstanceDataHeader *header);
void teardownVertexInput(InstanceDataHeader *header);
// Render state
// Vertex shader bits
enum
{
// These should be low so they could be used as indices
VSLIGHT_DIRECT = 1,
VSLIGHT_POINT = 2,
VSLIGHT_SPOT = 4,
VSLIGHT_MASK = 7, // all the above
// less critical
VSLIGHT_AMBIENT = 8,
};
// per Scene
void setProjectionMatrix(float32*);
void setViewMatrix(float32*);
// per Object
void setWorldMatrix(Matrix*);
int32 setLights(WorldLights *lightData);
// per Mesh
void setTexture(int32 n, Texture *tex);
void setMaterial(const RGBA &color, const SurfaceProperties &surfaceprops, float extraSurfProp = 0.0f);
inline void setMaterial(uint32 flags, const RGBA &color, const SurfaceProperties &surfaceprops, float extraSurfProp = 0.0f)
{
static RGBA white = { 255, 255, 255, 255 };
if(flags & Geometry::MODULATE)
setMaterial(color, surfaceprops, extraSurfProp);
else
setMaterial(white, surfaceprops, extraSurfProp);
}
void setAlphaBlend(bool32 enable);
bool32 getAlphaBlend(void);
bool32 getAlphaTest(void);
void bindFramebuffer(uint32 fbo);
uint32 bindTexture(uint32 texid);
void flushCache(void);
#endif
class ObjPipeline : public rw::ObjPipeline
{
public:
void init(void);
static ObjPipeline *create(void);
void (*instanceCB)(Geometry *geo, InstanceDataHeader *header, bool32 reinstance);
void (*uninstanceCB)(Geometry *geo, InstanceDataHeader *header);
void (*renderCB)(Atomic *atomic, InstanceDataHeader *header);
};
void defaultInstanceCB(Geometry *geo, InstanceDataHeader *header, bool32 reinstance);
void defaultUninstanceCB(Geometry *geo, InstanceDataHeader *header);
void defaultRenderCB(Atomic *atomic, InstanceDataHeader *header);
int32 lightingCB(Atomic *atomic);
void drawInst_simple(InstanceDataHeader *header, InstanceData *inst);
// Emulate PS2 GS alpha test FB_ONLY case: failed alpha writes to frame- but not to depth buffer
void drawInst_GSemu(InstanceDataHeader *header, InstanceData *inst);
// This one switches between the above two depending on render state;
void drawInst(InstanceDataHeader *header, InstanceData *inst);
void *destroyNativeData(void *object, int32, int32);
ObjPipeline *makeDefaultPipeline(void);
void setVertexAlpha(bool32 enable);
// Native Texture and Raster
struct Gl1Raster
{
// arguments to glTexImage2D
int32 internalFormat;
int32 type;
int32 format;
int32 bpp; // bytes per pixel
// texture object
uint32 texid;
bool isCompressed;
bool hasAlpha;
bool autogenMipmap;
int8 numLevels;
// cached filtermode and addressing
uint8 filterMode;
uint8 addressU;
uint8 addressV;
int32 maxAnisotropy;
uint32 fbo; // used for camera texture only!
Raster *fboMate; // color or zbuffer raster mate of this one
RasterLevels *backingStore; // if we can't read back GPU memory but have to
};
// GLES can't read back textures very nicely.
// In most cases that's not an issue, but when it is,
// this has to be set before the texture is filled:
extern bool32 needToReadBackTextures;
Texture *readNativeTexture(Stream *stream);
void writeNativeTexture(Texture *tex, Stream *stream);
uint32 getSizeNativeTexture(Texture *tex);
extern int32 nativeRasterOffset;
void registerNativeRaster(void);
#define GETGL1RASTEREXT(raster) PLUGINOFFSET(Gl1Raster, raster, rw::gles1::nativeRasterOffset)
}
}

255
vendor/librw/src/gles1/rwgles1NEW.h vendored Normal file
View file

@ -0,0 +1,255 @@
#ifdef RW_GLES1
#include <gles/gl.h>
//#include <gles/glext.h>
#include <gles/egl.h>
#endif
namespace rw {
#ifdef RW_GLES1
struct EngineOpenParams
{
int width, height;
const char *windowtitle;
};
#endif
namespace gles1 {
void registerPlatformPlugins(void);
extern Device renderdevice;
// arguments to glVertexAttribPointer basically
struct AttribDesc
{
uint32 index;
int32 type;
bool32 normalized;
int32 size;
uint32 stride;
uint32 offset;
};
enum AttribIndices
{
ATTRIB_POS = 0,
ATTRIB_NORMAL,
ATTRIB_COLOR,
ATTRIB_WEIGHTS,
ATTRIB_INDICES,
ATTRIB_TEXCOORDS0,
ATTRIB_TEXCOORDS1,
#if 0
ATTRIB_TEXCOORDS2,
ATTRIB_TEXCOORDS3,
ATTRIB_TEXCOORDS4,
ATTRIB_TEXCOORDS5,
ATTRIB_TEXCOORDS6,
ATTRIB_TEXCOORDS7,
#endif
};
// default uniform indices
extern int32 u_matColor;
extern int32 u_surfProps;
struct InstanceData
{
uint32 numIndex;
uint32 minVert; // not used for rendering
int32 numVertices; //
Material *material;
bool32 vertexAlpha;
uint32 program;
uint32 offset;
};
struct InstanceDataHeader : rw::InstanceDataHeader
{
uint32 serialNumber;
uint32 numMeshes;
uint16 *indexBuffer;
uint32 primType;
uint8 *vertexBuffer;
int32 numAttribs;
AttribDesc *attribDesc;
uint32 totalNumIndex;
uint32 totalNumVertex;
uint32 ibo;
uint32 vbo; // or 2?
InstanceData *inst;
};
#ifdef RW_GLES1
struct Im3DVertex
{
V3d position;
uint8 r, g, b, a;
float32 u, v;
void setX(float32 x) { this->position.x = x; }
void setY(float32 y) { this->position.y = y; }
void setZ(float32 z) { this->position.z = z; }
void setColor(uint8 r, uint8 g, uint8 b, uint8 a) {
this->r = r; this->g = g; this->b = b; this->a = a; }
void setU(float32 u) { this->u = u; }
void setV(float32 v) { this->v = v; }
float getX(void) { return this->position.x; }
float getY(void) { return this->position.y; }
float getZ(void) { return this->position.z; }
RGBA getColor(void) { return makeRGBA(this->r, this->g, this->b, this->a); }
float getU(void) { return this->u; }
float getV(void) { return this->v; }
};
struct Im2DVertex
{
float32 x, y, z, w;
uint8 r, g, b, a;
float32 u, v;
void setScreenX(float32 x) { this->x = x; }
void setScreenY(float32 y) { this->y = y; }
void setScreenZ(float32 z) { this->z = z; }
// This is a bit unefficient but we have to counteract GL's divide, so multiply
void setCameraZ(float32 z) { this->w = z; }
void setRecipCameraZ(float32 recipz) { this->w = 1.0f/recipz; }
void setColor(uint8 r, uint8 g, uint8 b, uint8 a) {
this->r = r; this->g = g; this->b = b; this->a = a; }
void setU(float32 u, float recipz) { this->u = u; }
void setV(float32 v, float recipz) { this->v = v; }
float getScreenX(void) { return this->x; }
float getScreenY(void) { return this->y; }
float getScreenZ(void) { return this->z; }
float getCameraZ(void) { return this->w; }
float getRecipCameraZ(void) { return 1.0f/this->w; }
RGBA getColor(void) { return makeRGBA(this->r, this->g, this->b, this->a); }
float getU(void) { return this->u; }
float getV(void) { return this->v; }
};
void setupVertexInput(InstanceDataHeader *header);
void teardownVertexInput(InstanceDataHeader *header);
// Render state
// Vertex shader bits
enum
{
// These should be low so they could be used as indices
VSLIGHT_DIRECT = 1,
VSLIGHT_POINT = 2,
VSLIGHT_SPOT = 4,
VSLIGHT_MASK = 7, // all the above
// less critical
VSLIGHT_AMBIENT = 8,
};
// per Scene
void setProjectionMatrix(float32*);
void setViewMatrix(float32*);
// per Object
void setWorldMatrix(Matrix*);
int32 setLights(WorldLights *lightData);
// per Mesh
void setTexture(int32 n, Texture *tex);
void setMaterial(const RGBA &color, const SurfaceProperties &surfaceprops, float extraSurfProp = 0.0f);
inline void setMaterial(uint32 flags, const RGBA &color, const SurfaceProperties &surfaceprops, float extraSurfProp = 0.0f)
{
static RGBA white = { 255, 255, 255, 255 };
if(flags & Geometry::MODULATE)
setMaterial(color, surfaceprops, extraSurfProp);
else
setMaterial(white, surfaceprops, extraSurfProp);
}
void setAlphaBlend(bool32 enable);
bool32 getAlphaBlend(void);
bool32 getAlphaTest(void);
void bindFramebuffer(uint32 fbo);
uint32 bindTexture(uint32 texid);
void flushCache(void);
#endif
class ObjPipeline : public rw::ObjPipeline
{
public:
void init(void);
static ObjPipeline *create(void);
void (*instanceCB)(Geometry *geo, InstanceDataHeader *header, bool32 reinstance);
void (*uninstanceCB)(Geometry *geo, InstanceDataHeader *header);
void (*renderCB)(Atomic *atomic, InstanceDataHeader *header);
};
void defaultInstanceCB(Geometry *geo, InstanceDataHeader *header, bool32 reinstance);
void defaultUninstanceCB(Geometry *geo, InstanceDataHeader *header);
void defaultRenderCB(Atomic *atomic, InstanceDataHeader *header);
int32 lightingCB(Atomic *atomic);
void drawInst_simple(InstanceDataHeader *header, InstanceData *inst);
// Emulate PS2 GS alpha test FB_ONLY case: failed alpha writes to frame- but not to depth buffer
void drawInst_GSemu(InstanceDataHeader *header, InstanceData *inst);
// This one switches between the above two depending on render state;
void drawInst(InstanceDataHeader *header, InstanceData *inst);
void *destroyNativeData(void *object, int32, int32);
ObjPipeline *makeDefaultPipeline(void);
void setVertexAlpha(bool32 enable);
// Native Texture and Raster
struct Gl1Raster
{
// arguments to glTexImage2D
int32 internalFormat;
int32 type;
int32 format;
int32 bpp; // bytes per pixel
// texture object
uint32 texid;
bool isCompressed;
bool hasAlpha;
bool autogenMipmap;
int8 numLevels;
// cached filtermode and addressing
uint8 filterMode;
uint8 addressU;
uint8 addressV;
int32 maxAnisotropy;
uint32 fbo; // used for camera texture only!
Raster *fboMate; // color or zbuffer raster mate of this one
RasterLevels *backingStore; // if we can't read back GPU memory but have to
};
// GLES can't read back textures very nicely.
// In most cases that's not an issue, but when it is,
// this has to be set before the texture is filled:
extern bool32 needToReadBackTextures;
Texture *readNativeTexture(Stream *stream);
void writeNativeTexture(Texture *tex, Stream *stream);
uint32 getSizeNativeTexture(Texture *tex);
extern int32 nativeRasterOffset;
void registerNativeRaster(void);
#define GETGL1RASTEREXT(raster) PLUGINOFFSET(Gl1Raster, raster, rw::gles1::nativeRasterOffset)
}
}

View file

@ -413,9 +413,9 @@ flipAlphaBlock5_half(uint8 *dst, uint8 *src)
dst[1] = src[1];
// bits
uint64 bits = *(uint64*)&src[2];
uint64 flipbits = bits & 0xFFFFFF000000;
flipbits |= (bits>>12) & 0xFFF;
flipbits |= (bits<<12) & 0xFFF000;
uint64 flipbits = bits & 0xFFFFFF000000ULL;
flipbits |= (bits>>12) & 0xFFFULL;
flipbits |= (bits<<12) & 0xFFF000ULL;
memcpy(dst+2, &flipbits, 6);
}

View file

@ -11,6 +11,9 @@
#ifdef __SYMBIAN32__
#undef stderr
#define stderr stdout
#ifdef S60V5
#define OFFSET_OF(type, member) ((size_t)&(((type*)0)->member))
#endif
#endif
// TODO: clean up the opengl defines
@ -112,16 +115,14 @@ struct LLLink
}
};
#ifndef RW_GL3
#ifdef __offsetof
#undef __offsetof
#endif
#define __offsetof(type, field) (reinterpret_cast <size_t> \
(&reinterpret_cast <const volatile char &> \
(static_cast<type *> (0)->field)))
#endif
#define LLLinkGetData(linkvar,type,entry) \
#ifdef S60V5
#define LLLinkGetData(linkvar,type,entry) \
((type*)((char*)(linkvar) - (size_t)&(((type*)0)->entry)))
#else
#define LLLinkGetData(linkvar,type,entry) \
((type*)(((rw::uint8*)(linkvar))-offsetof(type,entry)))
#endif
// Have to be careful since the link might be deleted.
#define FORLIST(_link, _list) \

View file

@ -483,8 +483,9 @@ Texture::streamReadNative(Stream *stream)
if(platform == PLATFORM_GL3)
return gl3::readNativeTexture(stream);
#ifdef RW_GLES1
if(platform == PLATFORM_GLES1)
return gles1::readNativeTexture(stream);
if(platform == PLATFORM_GLES1){
//return gles1::readNativeTexture(stream);
}
#endif
assert(0 && "unsupported platform");
return nil;
@ -504,8 +505,9 @@ Texture::streamWriteNative(Stream *stream)
else if(this->raster->platform == PLATFORM_GL3)
gl3::writeNativeTexture(this, stream);
#ifdef RW_GLES1
else if(this->raster->platform == PLATFORM_GLES1)
gles1::writeNativeTexture(this, stream);
else if(this->raster->platform == PLATFORM_GLES1){
//gles1::writeNativeTexture(this, stream);
}
#endif
else
assert(0 && "unsupported platform");
@ -525,8 +527,9 @@ Texture::streamGetSizeNative(void)
if(this->raster->platform == PLATFORM_GL3)
return gl3::getSizeNativeTexture(this);
#ifdef RW_GLES1
if(this->raster->platform == PLATFORM_GLES1)
return gles1::getSizeNativeTexture(this);
if(this->raster->platform == PLATFORM_GLES1){
//return gles1::getSizeNativeTexture(this);
}
#endif
assert(0 && "unsupported platform");
return 0;