diff --git a/src/SB/Core/gc/iModel.cpp b/src/SB/Core/gc/iModel.cpp index dd3e9b61c..7f1ba36c1 100644 --- a/src/SB/Core/gc/iModel.cpp +++ b/src/SB/Core/gc/iModel.cpp @@ -2,6 +2,62 @@ #include +RwFrame* GetChildFrameHierarchy(RwFrame* frame, void* data) +{ + RpHAnimHierarchy* hierarchy = RpHAnimFrameGetHierarchy(frame); + if (hierarchy == 0) + { + RwFrameForAllChildren(frame, GetChildFrameHierarchy, data); + } + else + { + data = hierarchy; + frame = 0; + } + return frame; +} + +void* GetHierarchy(RpAtomic* frame) +{ + void* unk_0[2]; + unk_0[0] = 0; + GetChildFrameHierarchy((RwFrame*)frame, unk_0); + return unk_0[0]; +} + +RpAtomic* iModelFileNew(void* buffer, U32 size) +{ + RwStream* rwmem; + S32 unk_0 = (S32)buffer; + RwStreamType type; + RwStreamAccessType accessType; + + type = (RwStreamType)3; + accessType = (RwStreamAccessType)1; + + rwmem = RwStreamOpen(type, accessType, buffer); + return iModelStreamRead(rwmem); +} + +void iModelUnload(RpAtomic* userdata) +{ + RpClump* clump; + RwFrame* frame = 0; + RwFrame* root; + + clump = (RpClump*)userdata + 0x3c; + if ((RpClump*)userdata != 0) + { + RwFrameGetRoot((RwFrame*)userdata); + RwFrameDestroyHierarchy(frame); + userdata = 0; + } + if (clump != 0) + { + RpClumpDestroy(clump); + } +} + void iModelCacheAtomic(RpAtomic*) { } diff --git a/src/SB/Core/gc/iModel.h b/src/SB/Core/gc/iModel.h index b9ddb99f4..4be240ae0 100644 --- a/src/SB/Core/gc/iModel.h +++ b/src/SB/Core/gc/iModel.h @@ -6,14 +6,18 @@ #include #include +#include void iModelInit(); U32 iModelNumBones(RpAtomic* model); S32 iModelCull(RpAtomic* model, RwMatrixTag* mat); S32 iModelSphereCull(xSphere* sphere); +RpAtomic* iModelStreamRead(RwStream*); +RpAtomic* iModelFileNew(void* buffer, U32 size); RpAtomic* iModelFile_RWMultiAtomic(RpAtomic* model); void iModelSetMaterialTexture(RpAtomic* model, void* texture); void iModelResetMaterial(RpAtomic* model); +void iModelUnload(RpAtomic* userdata); S32 iModelCullPlusShadow(RpAtomic* model, RwMatrix* mat, xVec3* shadowVec, S32* shadowOutside); void iModelTagEval(RpAtomic* model, const xModelTag* tag, RwMatrixTag* mat, xVec3* dest); U32 iModelTagSetup(xModelTag* tag, RpAtomic* model, F32 x, F32 y, F32 z);