mirror of
https://github.com/aap/librw.git
synced 2024-11-25 05:05:42 +00:00
fixed build for ps2
This commit is contained in:
parent
f1d04ff732
commit
12e998800e
28
Make.common
Normal file
28
Make.common
Normal file
@ -0,0 +1,28 @@
|
||||
BUILDDIR=build-$(BUILD)
|
||||
SRCDIR=src
|
||||
SRC := $(wildcard $(SRCDIR)/*.cpp $(SRCDIR)/*/*.cpp)
|
||||
OBJ := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$(SRC))
|
||||
DEP := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.d,$(SRC))
|
||||
INC := $(INC) -I/usr/local/include
|
||||
# define render target, e.g. null -> -DRW_NULL
|
||||
BUILDDEF := $(shell echo $(BUILD) | tr a-z A-Z | sed 's/^/-DRW_/')
|
||||
CFLAGS := $(CFLAGS) $(BUILDDEF)
|
||||
|
||||
default: $(TARGET)
|
||||
|
||||
$(BUILDDIR)/%.o: $(SRCDIR)/%.cpp
|
||||
@mkdir -p $(@D)
|
||||
$(CXX) $(CFLAGS) $(INC) -c $< -o $@
|
||||
|
||||
$(BUILDDIR)/%.d: $(SRCDIR)/%.cpp
|
||||
@mkdir -p $(@D)
|
||||
$(CXX) -MM -MT '$(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$<)' $(CFLAGS) $(INC) $< > $@
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)
|
||||
|
||||
cleanall:
|
||||
rm -rf $(BUILDDIR)
|
||||
rm $(TARGET)
|
||||
|
||||
-include $(DEP)
|
35
Makefile.ps2
35
Makefile.ps2
@ -1,33 +1,10 @@
|
||||
CXX=ee-g++
|
||||
# null, opengl
|
||||
BUILD=ps2
|
||||
BUILD := ps2
|
||||
TARGET := librw-$(BUILD).a
|
||||
CFLAGS := -Wall -g
|
||||
INC := -I$(PS2SDK)/ee/include -I$(PS2SDK)/common/include
|
||||
|
||||
# e.g. null -> -DRW_NULL
|
||||
BUILDDEF:=$(shell echo $(BUILD) | tr a-z A-Z | sed 's/^/-DRW_/')
|
||||
BUILDDIR=build-$(BUILD)
|
||||
SRCDIR=src
|
||||
SRC := $(patsubst %.cpp,$(SRCDIR)/%.cpp, rwbase.cpp clump.cpp\
|
||||
geometry.cpp plugins.cpp pipeline.cpp\
|
||||
ps2.cpp ogl.cpp xbox.cpp\
|
||||
image.cpp gtaplg.cpp)
|
||||
OBJ := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$(SRC))
|
||||
DEP := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.d,$(SRC))
|
||||
CFLAGS=-Wall -g $(BUILDDEF) -Wno-parentheses #-Wconversion
|
||||
INCPATH=-I$(PS2SDK)/ee/include -I$(PS2SDK)/common/include
|
||||
LIB=librw-$(BUILD).a
|
||||
include Make.common
|
||||
|
||||
$(LIB): $(OBJ)
|
||||
$(TARGET): $(OBJ)
|
||||
ar scr $@ $(OBJ)
|
||||
|
||||
$(BUILDDIR)/%.o: $(SRCDIR)/%.cpp
|
||||
@mkdir -p $(@D)
|
||||
$(CXX) $(CFLAGS) $(INCPATH) -c $< -o $@
|
||||
|
||||
$(BUILDDIR)/%.d: $(SRCDIR)/%.cpp
|
||||
@mkdir -p $(@D)
|
||||
$(CXX) -MM -MT '$(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$<)' $(CFLAGS) $< > $@
|
||||
|
||||
clean:
|
||||
rm -f $(BUILDDIR)/*.[od]
|
||||
|
||||
-include $(DEP)
|
||||
|
14
src/base.cpp
14
src/base.cpp
@ -35,16 +35,16 @@ char *debugFile = nil;
|
||||
// TODO: comparison tolerances
|
||||
|
||||
static Matrix identMat = {
|
||||
{ 1.0f, 0.0f, 0.0f}, 0.0f,
|
||||
{ 0.0f, 1.0f, 0.0f}, 0.0f,
|
||||
{ 0.0f, 0.0f, 1.0f}, 0.0f,
|
||||
{ 0.0f, 0.0f, 0.0f}, 1.0f
|
||||
V3d( 1.0f, 0.0f, 0.0f), 0.0f,
|
||||
V3d( 0.0f, 1.0f, 0.0f), 0.0f,
|
||||
V3d( 0.0f, 0.0f, 1.0f), 0.0f,
|
||||
V3d( 0.0f, 0.0f, 0.0f), 1.0f
|
||||
};
|
||||
|
||||
static Matrix3 identMat3 = {
|
||||
{ 1.0f, 0.0f, 0.0f},
|
||||
{ 0.0f, 1.0f, 0.0f},
|
||||
{ 0.0f, 0.0f, 1.0f}
|
||||
V3d( 1.0f, 0.0f, 0.0f),
|
||||
V3d( 0.0f, 1.0f, 0.0f),
|
||||
V3d( 0.0f, 0.0f, 1.0f)
|
||||
};
|
||||
|
||||
// lazy implementation
|
||||
|
@ -61,7 +61,7 @@ Clump::destroy(void)
|
||||
Light::fromClump(lnk)->destroy();
|
||||
FORLIST(lnk, this->cameras)
|
||||
Camera::fromClump(lnk)->destroy();
|
||||
if(f = this->getFrame())
|
||||
if(f = this->getFrame(), f)
|
||||
f->destroyHierarchy();
|
||||
free(this);
|
||||
}
|
||||
|
@ -22,7 +22,8 @@ using namespace d3d;
|
||||
|
||||
// TODO: move to header, but not as #define
|
||||
#ifndef RW_D3D9
|
||||
#define D3DDECL_END() {0xFF,0,D3DDECLTYPE_UNUSED,0,0,0}
|
||||
static VertexElement _d3ddec_end = {0xFF,0,D3DDECLTYPE_UNUSED,0,0,0};
|
||||
#define D3DDECL_END() _d3ddec_end
|
||||
#endif
|
||||
|
||||
#define NUMDECLELT 12
|
||||
|
@ -93,7 +93,7 @@ Texture *readNativeTexture(Stream *stream);
|
||||
void writeNativeTexture(Texture *tex, Stream *stream);
|
||||
uint32 getSizeNativeTexture(Texture *tex);
|
||||
|
||||
enum : rw::uint32 {
|
||||
enum {
|
||||
D3DFMT_UNKNOWN = 0xFFFFFFFF,
|
||||
|
||||
/* Swizzled formats */
|
||||
|
@ -24,9 +24,10 @@ void
|
||||
Engine::init(void)
|
||||
{
|
||||
engine = new Engine;
|
||||
PluginList init = { sizeof(Driver), sizeof(Driver), nil, nil };
|
||||
|
||||
for(uint i = 0; i < NUM_PLATFORMS; i++)
|
||||
Driver::s_plglist[i] = { sizeof(Driver), sizeof(Driver), nil, nil };
|
||||
Driver::s_plglist[i] = init;
|
||||
|
||||
Frame::dirtyList.init();
|
||||
|
||||
|
@ -817,7 +817,7 @@ Material::streamRead(Stream *stream)
|
||||
if(version < 0x30400)
|
||||
mat->surfaceProps = defaultSurfaceProps;
|
||||
else
|
||||
stream->read(&mat->surfaceProps, sizeof(surfaceProps));
|
||||
stream->read(&mat->surfaceProps, sizeof(SurfaceProperties));
|
||||
if(buf.textured){
|
||||
if(!findChunk(stream, ID_TEXTURE, &length, nil)){
|
||||
RWERROR((ERR_CHUNK, "TEXTURE"));
|
||||
|
@ -229,7 +229,7 @@ Texture::read(const char *name, const char *mask)
|
||||
Raster *raster = nil;
|
||||
Texture *tex;
|
||||
|
||||
if(tex = Texture::findCB(name)){
|
||||
if(tex = Texture::findCB(name), tex){
|
||||
tex->refCount++;
|
||||
return tex;
|
||||
}
|
||||
@ -452,11 +452,11 @@ decompressDXT1(uint8 *adst, int32 w, int32 h, uint8 *src)
|
||||
{
|
||||
/* j loops through old texels
|
||||
* x and y loop through new texels */
|
||||
uint32 x = 0, y = 0;
|
||||
int32 x = 0, y = 0;
|
||||
uint32 c[4][4];
|
||||
uint8 idx[16];
|
||||
uint8 (*dst)[4] = (uint8(*)[4])adst;
|
||||
for(uint32 j = 0; j < w*h/2; j += 8){
|
||||
for(int32 j = 0; j < w*h/2; j += 8){
|
||||
/* calculate colors */
|
||||
uint32 col0 = *((uint16*)&src[j+0]);
|
||||
uint32 col1 = *((uint16*)&src[j+2]);
|
||||
@ -519,12 +519,12 @@ decompressDXT3(uint8 *adst, int32 w, int32 h, uint8 *src)
|
||||
{
|
||||
/* j loops through old texels
|
||||
* x and y loop through new texels */
|
||||
uint32 x = 0, y = 0;
|
||||
int32 x = 0, y = 0;
|
||||
uint32 c[4][4];
|
||||
uint8 idx[16];
|
||||
uint8 a[16];
|
||||
uint8 (*dst)[4] = (uint8(*)[4])adst;
|
||||
for(uint32 j = 0; j < w*h; j += 16){
|
||||
for(int32 j = 0; j < w*h; j += 16){
|
||||
/* calculate colors */
|
||||
uint32 col0 = *((uint16*)&src[j+8]);
|
||||
uint32 col1 = *((uint16*)&src[j+10]);
|
||||
@ -577,13 +577,13 @@ decompressDXT5(uint8 *adst, int32 w, int32 h, uint8 *src)
|
||||
{
|
||||
/* j loops through old texels
|
||||
* x and y loop through new texels */
|
||||
uint32 x = 0, y = 0;
|
||||
int32 x = 0, y = 0;
|
||||
uint32 c[4][4];
|
||||
uint32 a[8];
|
||||
uint8 idx[16];
|
||||
uint8 aidx[16];
|
||||
uint8 (*dst)[4] = (uint8(*)[4])adst;
|
||||
for(uint32 j = 0; j < w*h; j += 16){
|
||||
for(int32 j = 0; j < w*h; j += 16){
|
||||
/* calculate colors */
|
||||
uint32 col0 = *((uint16*)&src[j+8]);
|
||||
uint32 col1 = *((uint16*)&src[j+10]);
|
||||
|
@ -98,10 +98,10 @@ struct Driver
|
||||
extern Driver *driver[NUM_PLATFORMS];
|
||||
#define DRIVER driver[rw::platform]
|
||||
|
||||
inline void setRenderState(int32 state, uint32 value){
|
||||
inline void SetRenderState(int32 state, uint32 value){
|
||||
engine->setRenderState(state, value); }
|
||||
|
||||
inline uint32 getRenderState(int32 state){
|
||||
inline uint32 GetRenderState(int32 state){
|
||||
return engine->getRenderState(state); }
|
||||
|
||||
namespace null {
|
||||
|
@ -16,7 +16,7 @@ struct LLLink
|
||||
}
|
||||
};
|
||||
|
||||
#define LLLinkGetData(linkvar,type,entry) \
|
||||
#define LLLinkGetData(linkvar,type,entry) \
|
||||
((type*)(((uint8*)(linkvar))-offsetof(type,entry)))
|
||||
|
||||
// Have to be careful since the link might be deleted.
|
||||
|
@ -353,8 +353,8 @@ Skin::init(int32 numBones, int32 numUsedBones, int32 numVertices)
|
||||
|
||||
|
||||
|
||||
static_assert(sizeof(Skin::RLEcount) == 2, "RLEcount size");
|
||||
static_assert(sizeof(Skin::RLE) == 2, "RLE size");
|
||||
//static_assert(sizeof(Skin::RLEcount) == 2, "RLEcount size");
|
||||
//static_assert(sizeof(Skin::RLE) == 2, "RLE size");
|
||||
|
||||
void
|
||||
Skin::findNumWeights(int32 numVertices)
|
||||
|
@ -16,9 +16,9 @@ namespace rw {
|
||||
World*
|
||||
World::create(void)
|
||||
{
|
||||
World *world = (World*)malloc(PluginBase::s_plglist.size);
|
||||
World *world = (World*)malloc(s_plglist.size);
|
||||
if(world == nil){
|
||||
RWERROR((ERR_ALLOC, PluginBase::s_plglist.size));
|
||||
RWERROR((ERR_ALLOC, s_plglist.size));
|
||||
return nil;
|
||||
}
|
||||
world->object.init(World::ID, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user