diff --git a/tools/rsltest/rsl.h b/tools/rsltest/rsl.h index c8ebce9..ef20d78 100644 --- a/tools/rsltest/rsl.h +++ b/tools/rsltest/rsl.h @@ -28,6 +28,7 @@ struct RslHAnimNode; struct RslPS2ResEntryHeader; struct RslPS2InstanceData; +typedef RslFrame *(*RslFrameCallBack)(RslFrame *frame, void *data); typedef RslClump *(*RslClumpCallBack)(RslClump *clump, void *data); typedef RslAtomic *(*RslAtomicCallBack)(RslAtomic *atomic, void *data); typedef RslMaterial *(*RslMaterialCallBack)(RslMaterial *material, void *data); @@ -71,6 +72,8 @@ struct RslObjectHasFrame { void (*sync)(); }; +#define rslObjectGetParent(object) (((const RslObject *)(object))->parent) + // from Serge //void TEX::getInfo(TEXInfo a) //{ @@ -81,12 +84,23 @@ struct RslObjectHasFrame { // mipmaps = (a.flags & 0xFF0000) >> 20; //} -struct RslRaster { +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; @@ -100,29 +114,10 @@ struct RslTexture { char name[32]; char mask[32]; }; - -struct RslClump { - RslObject object; - RslLinkList atomicList; -}; - -struct RslAtomic { - RslObjectHasFrame object; - RslGeometry *geometry; - RslClump *clump; - RslLLLink inClumpLink; - - // what's this? - uint32 unk1; - uint16 unk2; - uint16 unk3; - RslHAnimHierarchy *hier; - int32 pad; // 0xAAAAAAAA -}; - + struct RslFrame { - RslObject object; - RslLLLink inDirtyListLink; // ? + RslObject object; + RslLLLink inDirtyListLink; // ? float32 modelling[16]; float32 ltm[16]; @@ -133,12 +128,38 @@ struct RslFrame { // RwHAnimFrameExtension int32 nodeId; RslHAnimHierarchy *hier; - // R* Node name char *name; - uint32 unk3; // ?pad? + // R* Visibility + int32 hierId; +}; + +struct RslClump { + RslObject object; + RslLinkList atomicList; }; +#define RslClumpGetFrame(_clump) \ + ((RslFrame *) rslObjectGetParent(_clump)) + +struct RslAtomic { + RslObjectHasFrame object; + RslGeometry *geometry; + RslClump *clump; + RslLLLink inClumpLink; + + // what's this? rpWorldObj? + uint32 unk1; + uint16 unk2; + uint16 unk3; + // RpSkin + RslHAnimHierarchy *hier; + // what about visibility? matfx? + int32 pad; // 0xAAAAAAAA +}; + +#define RslAtomicGetFrame(_atomic) \ + ((RslFrame *) rslObjectGetParent(_atomic)) struct RslMaterialList { RslMaterial **materials; diff --git a/tools/rsltest/rsltest.cpp b/tools/rsltest/rsltest.cpp index 4828856..a570b84 100644 --- a/tools/rsltest/rsltest.cpp +++ b/tools/rsltest/rsltest.cpp @@ -26,6 +26,17 @@ RslStream::relocate(void) } } +RslFrame* +RslFrameForAllChildren(RslFrame *frame, RslFrameCallBack callBack, void *data) +{ + for(RslFrame *child = frame->child; + child; + child = child->next) + if(callBack(child, data) == NULL) + break; + return frame; +} + RslClump* RslClumpForAllAtomics(RslClump *clump, RslAtomicCallBack callback, void *pData) { @@ -51,6 +62,12 @@ RslGeometryForAllMaterials(RslGeometry *geometry, RslMaterialCallBack fpCallBack } +RslFrame *dumpFrameCB(RslFrame *frame, void *data) +{ + printf(" frm: %x %s %x\n", frame->nodeId, frame->name, frame->unk3); + RslFrameForAllChildren(frame, dumpFrameCB, data); + return frame; +} RslMaterial *dumpMaterialCB(RslMaterial *material, void*) { @@ -102,9 +119,11 @@ main(int argc, char *argv[]) RslAtomic *a = (RslAtomic*)p; clump = a->clump; if(clump) - RslClumpForAllAtomics(clump, dumpAtomicCB, NULL); + //RslClumpForAllAtomics(clump, dumpAtomicCB, NULL); + RslFrameForAllChildren(RslClumpGetFrame(clump), dumpFrameCB, NULL); else - dumpAtomicCB(a, NULL); + //dumpAtomicCB(a, NULL); + RslFrameForAllChildren(RslAtomicGetFrame(a), dumpFrameCB, NULL); } return 0;