fixed some structures

This commit is contained in:
aap 2015-12-22 12:11:10 +01:00
parent 39ff5b6288
commit aed3fefd01
2 changed files with 128 additions and 129 deletions

View File

@ -13,7 +13,7 @@ struct RslStream {
void relocate(void); void relocate(void);
}; };
struct RslObject; struct RslObject;
struct RslObjectHasFrame; struct RslObjectHasFrame;
struct RslClump; struct RslClump;
struct RslAtomic; struct RslAtomic;
@ -33,88 +33,88 @@ typedef RslClump *(*RslClumpCallBack)(RslClump *clump, void *data);
typedef RslAtomic *(*RslAtomicCallBack)(RslAtomic *atomic, void *data); typedef RslAtomic *(*RslAtomicCallBack)(RslAtomic *atomic, void *data);
typedef RslMaterial *(*RslMaterialCallBack)(RslMaterial *material, void *data); typedef RslMaterial *(*RslMaterialCallBack)(RslMaterial *material, void *data);
struct RslLLLink { struct RslLLLink {
RslLLLink *next; RslLLLink *next;
RslLLLink *prev; RslLLLink *prev;
}; };
struct RslLinkList { struct RslLinkList {
RslLLLink link; RslLLLink link;
}; };
#define rslLLLinkGetData(linkvar,type,entry) \ #define rslLLLinkGetData(linkvar,type,entry) \
((type *)(((uint8 *)(linkvar))-offsetof(type,entry))) ((type *)(((uint8 *)(linkvar))-offsetof(type,entry)))
#define rslLLLinkGetNext(linkvar) \ #define rslLLLinkGetNext(linkvar) \
((linkvar)->next)
#define rslLLLinkGetPrevious(linkvar) \
((linkvar)->prev)
#define rslLLLinkInitialize(linkvar) \
( (linkvar)->prev = (RslLLLink *)NULL, \
(linkvar)->next = (RslLLLink *)NULL )
#define rslLLLinkAttached(linkvar) \
((linkvar)->next) ((linkvar)->next)
struct RslObject { #define rslLLLinkGetPrevious(linkvar) \
uint8 type; ((linkvar)->prev)
uint8 subType;
uint8 flags; #define rslLLLinkInitialize(linkvar) \
uint8 privateFlags; ( (linkvar)->prev = (RslLLLink *)NULL, \
void *parent; (linkvar)->next = (RslLLLink *)NULL )
};
#define rslLLLinkAttached(linkvar) \
struct RslObjectHasFrame { ((linkvar)->next)
RslObject object;
RslLLLink lFrame; struct RslObject {
void (*sync)(); uint8 type;
}; uint8 subType;
uint8 flags;
#define rslObjectGetParent(object) (((const RslObject *)(object))->parent) uint8 privateFlags;
void *parent;
// from Serge };
//void TEX::getInfo(TEXInfo a)
//{ struct RslObjectHasFrame {
// bpp = (a.flags & 0xF000) >> 12; RslObject object;
// swizzle = (a.flags & 0xF000000) >> 24; RslLLLink lFrame;
// Width = (int)pow(2.0, (int)(a.flags & 0xF)); void (*sync)();
// Height = (int)pow(16.0, (int)((a.flags & 0xF00) >> 8))*(int)pow(2.0, (int)(((a.flags & 0xF0) >> 4) / 4)); };
// mipmaps = (a.flags & 0xFF0000) >> 20;
//} #define rslObjectGetParent(object) (((const RslObject *)(object))->parent)
struct RslRasterPS2 { // from Serge
uint8 *data; //void TEX::getInfo(TEXInfo a)
// XXXXSSSSMMMMMMMMBBBBHHHHHHHHWWWW //{
uint32 flags; // bpp = (a.flags & 0xF000) >> 12;
}; // swizzle = (a.flags & 0xF000000) >> 24;
// Width = (int)pow(2.0, (int)(a.flags & 0xF));
struct RslRasterPSP { // Height = (int)pow(16.0, (int)((a.flags & 0xF00) >> 8))*(int)pow(2.0, (int)(((a.flags & 0xF0) >> 4) / 4));
uint32 unk1; // mipmaps = (a.flags & 0xFF0000) >> 20;
uint8 *data; //}
uint32 flags1, flags2;
}; struct RslRasterPS2 {
uint8 *data;
union RslRaster { // XXXXSSSSMMMMMMMMBBBBHHHHHHHHWWWW
RslRasterPS2 ps2; uint32 flags;
RslRasterPSP psp; };
};
struct RslRasterPSP {
struct RslTexDictionary { uint32 unk1;
RslObject object; uint8 *data;
RslLinkList texturesInDict; uint32 flags1, flags2;
RslLLLink lInInstance; };
};
union RslRaster {
struct RslTexture { RslRasterPS2 ps2;
RslRaster *raster; RslRasterPSP psp;
RslTexDictionary *dict; };
RslLLLink lInDictionary;
char name[32]; struct RslTexDictionary {
char mask[32]; RslObject object;
}; RslLinkList texturesInDict;
RslLLLink lInInstance;
};
struct RslTexture {
RslRaster *raster;
RslTexDictionary *dict;
RslLLLink lInDictionary;
char name[32];
char mask[32];
};
struct RslFrame { struct RslFrame {
RslObject object; RslObject object;
RslLLLink inDirtyListLink; // ? RslLLLink inDirtyListLink; // ?
@ -132,14 +132,14 @@ struct RslFrame {
char *name; char *name;
// R* Visibility // R* Visibility
int32 hierId; int32 hierId;
}; };
struct RslClump { struct RslClump {
RslObject object; RslObject object;
RslLinkList atomicList; RslLinkList atomicList;
}; };
#define RslClumpGetFrame(_clump) \ #define RslClumpGetFrame(_clump) \
((RslFrame *) rslObjectGetParent(_clump)) ((RslFrame *) rslObjectGetParent(_clump))
struct RslAtomic { struct RslAtomic {
@ -158,7 +158,7 @@ struct RslAtomic {
int32 pad; // 0xAAAAAAAA int32 pad; // 0xAAAAAAAA
}; };
#define RslAtomicGetFrame(_atomic) \ #define RslAtomicGetFrame(_atomic) \
((RslFrame *) rslObjectGetParent(_atomic)) ((RslFrame *) rslObjectGetParent(_atomic))
struct RslMaterialList { struct RslMaterialList {
@ -169,13 +169,13 @@ struct RslMaterialList {
struct RslGeometry { struct RslGeometry {
RslObject object; RslObject object;
uint16 locked; // ? int16 refCount;
int16 refCount; // ? int16 pad1;
RslMaterialList matList; RslMaterialList matList;
RslSkin *skin; RslSkin *skin;
uint32 pad; // 0xAAAAAAAA uint32 pad2; // 0xAAAAAAAA
}; };
struct RslMatFXEnv { struct RslMatFXEnv {
@ -194,8 +194,7 @@ struct RslMatFX {
struct RslMaterial { struct RslMaterial {
char *texname; char *texname;
uint32 color; uint32 color;
uint16 refCount; uint32 refCount;
uint16 pad;
RslMatFX *matfx; RslMatFX *matfx;
}; };
@ -206,31 +205,31 @@ struct RslHAnimNodeInfo {
RslFrame *frame; RslFrame *frame;
}; };
struct RslHAnimHierarchy { struct RslHAnimHierarchy {
int32 flags; int32 flags;
int32 numNodes; int32 numNodes;
void *pCurrentAnim; void *pCurrentAnim;
float32 currentTime; float32 currentTime;
void *pNextFrame; void *pNextFrame;
void (*pAnimCallBack)(); void (*pAnimCallBack)();
void *pAnimCallBackData; void *pAnimCallBackData;
float32 animCallBackTime; float32 animCallBackTime;
void (*pAnimLoopCallBack)(); void (*pAnimLoopCallBack)();
void *pAnimLoopCallBackData; void *pAnimLoopCallBackData;
float32 *pMatrixArray; float32 *pMatrixArray;
void *pMatrixArrayUnaligned; void *pMatrixArrayUnaligned;
RslHAnimNodeInfo *pNodeInfo; RslHAnimNodeInfo *pNodeInfo;
RslFrame *parentFrame; RslFrame *parentFrame;
int32 maxKeyFrameSize; int32 maxKeyFrameSize;
int32 currentKeyFrameSize; int32 currentKeyFrameSize;
void (*keyFrameToMatrixCB)(); void (*keyFrameToMatrixCB)();
void (*keyFrameBlendCB)(); void (*keyFrameBlendCB)();
void (*keyFrameInterpolateCB)(); void (*keyFrameInterpolateCB)();
void (*keyFrameAddCB)(); void (*keyFrameAddCB)();
RslHAnimHierarchy *parentHierarchy; RslHAnimHierarchy *parentHierarchy;
int32 offsetInParent; int32 offsetInParent;
int32 rootParentOffset; int32 rootParentOffset;
}; };
struct RslSkin { struct RslSkin {
uint32 numBones; uint32 numBones;
@ -249,24 +248,24 @@ struct RslSkin {
}; };
struct RslPS2ResEntryHeader { struct RslPS2ResEntryHeader {
float32 bound[4]; float32 bound[4];
uint32 size; // and numMeshes uint32 size; // and numMeshes
int32 flags; int32 flags;
uint32 unk1; uint32 unk1;
uint32 unk2; uint32 unk2;
uint32 unk3; uint32 unk3;
uint32 unk4; uint32 unk4;
float32 scale[3]; float32 scale[3];
float32 pos[3]; float32 pos[3];
}; };
struct RslPS2InstanceData { struct RslPS2InstanceData {
float32 bound[4]; // ? float32 bound[4]; // ?
float32 uvScale[2]; float32 uvScale[2];
int32 unk1; int32 unk1;
uint8 *dmaPacket; uint8 *dmaPacket;
uint16 numTriangles; uint16 numTriangles;
int16 matID; int16 matID;
void *unk2; void *unk2;
void *unk3; void *unk3;
void *unk4; void *unk4;

View File

@ -26,7 +26,7 @@ RslStream::relocate(void)
} }
} }
RslFrame* RslFrame*
RslFrameForAllChildren(RslFrame *frame, RslFrameCallBack callBack, void *data) RslFrameForAllChildren(RslFrame *frame, RslFrameCallBack callBack, void *data)
{ {
for(RslFrame *child = frame->child; for(RslFrame *child = frame->child;
@ -37,7 +37,7 @@ RslFrameForAllChildren(RslFrame *frame, RslFrameCallBack callBack, void *data)
return frame; return frame;
} }
RslClump* RslClump*
RslClumpForAllAtomics(RslClump *clump, RslAtomicCallBack callback, void *pData) RslClumpForAllAtomics(RslClump *clump, RslAtomicCallBack callback, void *pData)
{ {
RslAtomic *a; RslAtomic *a;
@ -52,7 +52,7 @@ RslClumpForAllAtomics(RslClump *clump, RslAtomicCallBack callback, void *pData)
return clump; return clump;
} }
RslGeometry* RslGeometry*
RslGeometryForAllMaterials(RslGeometry *geometry, RslMaterialCallBack fpCallBack, void *pData) RslGeometryForAllMaterials(RslGeometry *geometry, RslMaterialCallBack fpCallBack, void *pData)
{ {
for(int32 i = 0; i < geometry->matList.numMaterials; i++) for(int32 i = 0; i < geometry->matList.numMaterials; i++)
@ -64,14 +64,14 @@ RslGeometryForAllMaterials(RslGeometry *geometry, RslMaterialCallBack fpCallBack
RslFrame *dumpFrameCB(RslFrame *frame, void *data) RslFrame *dumpFrameCB(RslFrame *frame, void *data)
{ {
printf(" frm: %x %s %x\n", frame->nodeId, frame->name, frame->unk3); printf(" frm: %x %s %x\n", frame->nodeId, frame->name, frame->hierId);
RslFrameForAllChildren(frame, dumpFrameCB, data); RslFrameForAllChildren(frame, dumpFrameCB, data);
return frame; return frame;
} }
RslMaterial *dumpMaterialCB(RslMaterial *material, void*) RslMaterial *dumpMaterialCB(RslMaterial *material, void*)
{ {
printf(" mat: %s %x %x\n", material->texname, material->pad, material->refCount); printf(" mat: %s %x\n", material->texname, material->refCount);
if(material->matfx){ if(material->matfx){
RslMatFX *fx = material->matfx; RslMatFX *fx = material->matfx;
printf(" matfx: ", fx->effectType); printf(" matfx: ", fx->effectType);