diff --git a/tools/rsltest/rsl.h b/tools/rsltest/rsl.h index ef20d78..f4d2590 100644 --- a/tools/rsltest/rsl.h +++ b/tools/rsltest/rsl.h @@ -13,7 +13,7 @@ struct RslStream { void relocate(void); }; -struct RslObject; +struct RslObject; struct RslObjectHasFrame; struct RslClump; struct RslAtomic; @@ -33,88 +33,88 @@ typedef RslClump *(*RslClumpCallBack)(RslClump *clump, void *data); typedef RslAtomic *(*RslAtomicCallBack)(RslAtomic *atomic, void *data); typedef RslMaterial *(*RslMaterialCallBack)(RslMaterial *material, void *data); -struct RslLLLink { - RslLLLink *next; - RslLLLink *prev; +struct RslLLLink { + RslLLLink *next; + RslLLLink *prev; }; -struct RslLinkList { - RslLLLink link; +struct RslLinkList { + RslLLLink link; }; -#define rslLLLinkGetData(linkvar,type,entry) \ - ((type *)(((uint8 *)(linkvar))-offsetof(type,entry))) - -#define rslLLLinkGetNext(linkvar) \ - ((linkvar)->next) - -#define rslLLLinkGetPrevious(linkvar) \ - ((linkvar)->prev) - -#define rslLLLinkInitialize(linkvar) \ - ( (linkvar)->prev = (RslLLLink *)NULL, \ - (linkvar)->next = (RslLLLink *)NULL ) - -#define rslLLLinkAttached(linkvar) \ +#define rslLLLinkGetData(linkvar,type,entry) \ + ((type *)(((uint8 *)(linkvar))-offsetof(type,entry))) + +#define rslLLLinkGetNext(linkvar) \ ((linkvar)->next) -struct RslObject { - uint8 type; - uint8 subType; - uint8 flags; - uint8 privateFlags; - void *parent; -}; - -struct RslObjectHasFrame { - RslObject object; - RslLLLink lFrame; - void (*sync)(); -}; - -#define rslObjectGetParent(object) (((const RslObject *)(object))->parent) - -// from Serge -//void TEX::getInfo(TEXInfo a) -//{ -// bpp = (a.flags & 0xF000) >> 12; -// swizzle = (a.flags & 0xF000000) >> 24; -// Width = (int)pow(2.0, (int)(a.flags & 0xF)); -// 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; -//} - -struct RslRasterPS2 { - uint8 *data; - // XXXXSSSSMMMMMMMMBBBBHHHHHHHHWWWW - uint32 flags; -}; - -struct RslRasterPSP { - uint32 unk1; - uint8 *data; - uint32 flags1, flags2; -}; - -union RslRaster { - RslRasterPS2 ps2; - RslRasterPSP psp; -}; - -struct RslTexDictionary { - RslObject object; - RslLinkList texturesInDict; - RslLLLink lInInstance; -}; - -struct RslTexture { - RslRaster *raster; - RslTexDictionary *dict; - RslLLLink lInDictionary; - char name[32]; - char mask[32]; -}; - +#define rslLLLinkGetPrevious(linkvar) \ + ((linkvar)->prev) + +#define rslLLLinkInitialize(linkvar) \ + ( (linkvar)->prev = (RslLLLink *)NULL, \ + (linkvar)->next = (RslLLLink *)NULL ) + +#define rslLLLinkAttached(linkvar) \ + ((linkvar)->next) + +struct RslObject { + uint8 type; + uint8 subType; + uint8 flags; + uint8 privateFlags; + void *parent; +}; + +struct RslObjectHasFrame { + RslObject object; + RslLLLink lFrame; + void (*sync)(); +}; + +#define rslObjectGetParent(object) (((const RslObject *)(object))->parent) + +// from Serge +//void TEX::getInfo(TEXInfo a) +//{ +// bpp = (a.flags & 0xF000) >> 12; +// swizzle = (a.flags & 0xF000000) >> 24; +// Width = (int)pow(2.0, (int)(a.flags & 0xF)); +// 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; +//} + +struct RslRasterPS2 { + uint8 *data; + // XXXXSSSSMMMMMMMMBBBBHHHHHHHHWWWW + uint32 flags; +}; + +struct RslRasterPSP { + uint32 unk1; + uint8 *data; + uint32 flags1, flags2; +}; + +union RslRaster { + RslRasterPS2 ps2; + RslRasterPSP psp; +}; + +struct RslTexDictionary { + RslObject object; + RslLinkList texturesInDict; + RslLLLink lInInstance; +}; + +struct RslTexture { + RslRaster *raster; + RslTexDictionary *dict; + RslLLLink lInDictionary; + char name[32]; + char mask[32]; +}; + struct RslFrame { RslObject object; RslLLLink inDirtyListLink; // ? @@ -132,14 +132,14 @@ struct RslFrame { char *name; // R* Visibility int32 hierId; -}; +}; struct RslClump { RslObject object; RslLinkList atomicList; }; -#define RslClumpGetFrame(_clump) \ +#define RslClumpGetFrame(_clump) \ ((RslFrame *) rslObjectGetParent(_clump)) struct RslAtomic { @@ -158,7 +158,7 @@ struct RslAtomic { int32 pad; // 0xAAAAAAAA }; -#define RslAtomicGetFrame(_atomic) \ +#define RslAtomicGetFrame(_atomic) \ ((RslFrame *) rslObjectGetParent(_atomic)) struct RslMaterialList { @@ -169,13 +169,13 @@ struct RslMaterialList { struct RslGeometry { RslObject object; - uint16 locked; // ? - int16 refCount; // ? + int16 refCount; + int16 pad1; RslMaterialList matList; RslSkin *skin; - uint32 pad; // 0xAAAAAAAA + uint32 pad2; // 0xAAAAAAAA }; struct RslMatFXEnv { @@ -194,8 +194,7 @@ struct RslMatFX { struct RslMaterial { char *texname; uint32 color; - uint16 refCount; - uint16 pad; + uint32 refCount; RslMatFX *matfx; }; @@ -206,31 +205,31 @@ struct RslHAnimNodeInfo { RslFrame *frame; }; -struct RslHAnimHierarchy { - int32 flags; - int32 numNodes; - void *pCurrentAnim; - float32 currentTime; - void *pNextFrame; - void (*pAnimCallBack)(); - void *pAnimCallBackData; - float32 animCallBackTime; - void (*pAnimLoopCallBack)(); - void *pAnimLoopCallBackData; - float32 *pMatrixArray; - void *pMatrixArrayUnaligned; - RslHAnimNodeInfo *pNodeInfo; - RslFrame *parentFrame; - int32 maxKeyFrameSize; - int32 currentKeyFrameSize; - void (*keyFrameToMatrixCB)(); - void (*keyFrameBlendCB)(); - void (*keyFrameInterpolateCB)(); - void (*keyFrameAddCB)(); - RslHAnimHierarchy *parentHierarchy; - int32 offsetInParent; - int32 rootParentOffset; -}; +struct RslHAnimHierarchy { + int32 flags; + int32 numNodes; + void *pCurrentAnim; + float32 currentTime; + void *pNextFrame; + void (*pAnimCallBack)(); + void *pAnimCallBackData; + float32 animCallBackTime; + void (*pAnimLoopCallBack)(); + void *pAnimLoopCallBackData; + float32 *pMatrixArray; + void *pMatrixArrayUnaligned; + RslHAnimNodeInfo *pNodeInfo; + RslFrame *parentFrame; + int32 maxKeyFrameSize; + int32 currentKeyFrameSize; + void (*keyFrameToMatrixCB)(); + void (*keyFrameBlendCB)(); + void (*keyFrameInterpolateCB)(); + void (*keyFrameAddCB)(); + RslHAnimHierarchy *parentHierarchy; + int32 offsetInParent; + int32 rootParentOffset; +}; struct RslSkin { uint32 numBones; @@ -249,24 +248,24 @@ struct RslSkin { }; struct RslPS2ResEntryHeader { - float32 bound[4]; - uint32 size; // and numMeshes - int32 flags; - uint32 unk1; - uint32 unk2; - uint32 unk3; - uint32 unk4; - float32 scale[3]; + float32 bound[4]; + uint32 size; // and numMeshes + int32 flags; + uint32 unk1; + uint32 unk2; + uint32 unk3; + uint32 unk4; + float32 scale[3]; float32 pos[3]; }; struct RslPS2InstanceData { - float32 bound[4]; // ? - float32 uvScale[2]; - int32 unk1; - uint8 *dmaPacket; - uint16 numTriangles; - int16 matID; + float32 bound[4]; // ? + float32 uvScale[2]; + int32 unk1; + uint8 *dmaPacket; + uint16 numTriangles; + int16 matID; void *unk2; void *unk3; void *unk4; diff --git a/tools/rsltest/rsltest.cpp b/tools/rsltest/rsltest.cpp index a570b84..56983d2 100644 --- a/tools/rsltest/rsltest.cpp +++ b/tools/rsltest/rsltest.cpp @@ -26,7 +26,7 @@ RslStream::relocate(void) } } -RslFrame* +RslFrame* RslFrameForAllChildren(RslFrame *frame, RslFrameCallBack callBack, void *data) { for(RslFrame *child = frame->child; @@ -37,7 +37,7 @@ RslFrameForAllChildren(RslFrame *frame, RslFrameCallBack callBack, void *data) return frame; } -RslClump* +RslClump* RslClumpForAllAtomics(RslClump *clump, RslAtomicCallBack callback, void *pData) { RslAtomic *a; @@ -52,7 +52,7 @@ RslClumpForAllAtomics(RslClump *clump, RslAtomicCallBack callback, void *pData) return clump; } -RslGeometry* +RslGeometry* RslGeometryForAllMaterials(RslGeometry *geometry, RslMaterialCallBack fpCallBack, void *pData) { for(int32 i = 0; i < geometry->matList.numMaterials; i++) @@ -64,14 +64,14 @@ RslGeometryForAllMaterials(RslGeometry *geometry, RslMaterialCallBack fpCallBack 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); return frame; } 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){ RslMatFX *fx = material->matfx; printf(" matfx: ", fx->effectType);