Port most of hsfload to PC (#581)
* Port some of hsfload.c * More byteswaps in hsfload.c * Finish hsfload besides cenv * hsfload fixes
This commit is contained in:
parent
909c743527
commit
bc19d2263b
21 changed files with 1662 additions and 402 deletions
2
extern/aurora
vendored
2
extern/aurora
vendored
|
|
@ -1 +1 @@
|
||||||
Subproject commit d9de6603c79917a5353abd3a9cc26ec557ceee05
|
Subproject commit 3b56e337c08a1dd4946c226298011364c319c7a2
|
||||||
|
|
@ -57,7 +57,7 @@ void Hu3DDrawPreInit(void);
|
||||||
void Hu3DDraw(ModelData *arg0, Mtx arg1, Vec *arg2);
|
void Hu3DDraw(ModelData *arg0, Mtx arg1, Vec *arg2);
|
||||||
s32 ObjCullCheck(HsfData *arg0, HsfObject *arg1, Mtx arg2);
|
s32 ObjCullCheck(HsfData *arg0, HsfObject *arg1, Mtx arg2);
|
||||||
void Hu3DDrawPost(void);
|
void Hu3DDrawPost(void);
|
||||||
void MakeDisplayList(s16 arg0, u32 arg1);
|
void MakeDisplayList(s16 arg0, uintptr_t arg1);
|
||||||
HsfConstData *ObjConstantMake(HsfObject *arg0, u32 arg1);
|
HsfConstData *ObjConstantMake(HsfObject *arg0, u32 arg1);
|
||||||
void mtxTransCat(Mtx arg0, float arg1, float arg2, float arg3);
|
void mtxTransCat(Mtx arg0, float arg1, float arg2, float arg3);
|
||||||
void mtxRotCat(Mtx arg0, float arg1, float arg2, float arg3);
|
void mtxRotCat(Mtx arg0, float arg1, float arg2, float arg3);
|
||||||
|
|
|
||||||
|
|
@ -227,9 +227,8 @@ typedef struct hsf_cluster {
|
||||||
s32 target;
|
s32 target;
|
||||||
};
|
};
|
||||||
HsfPart *part;
|
HsfPart *part;
|
||||||
float unk10;
|
float index;
|
||||||
float unk14[1]; // unknown array size
|
float weight[32]; // unknown array size
|
||||||
u8 unk18[124];
|
|
||||||
u8 adjusted;
|
u8 adjusted;
|
||||||
u8 unk95;
|
u8 unk95;
|
||||||
u16 type;
|
u16 type;
|
||||||
|
|
@ -351,6 +350,9 @@ typedef struct hsf_track {
|
||||||
float value;
|
float value;
|
||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
void *dataTop;
|
||||||
|
#endif
|
||||||
} HsfTrack;
|
} HsfTrack;
|
||||||
|
|
||||||
typedef struct hsf_motion {
|
typedef struct hsf_motion {
|
||||||
|
|
@ -397,6 +399,9 @@ typedef struct hsf_data {
|
||||||
HsfObject *object;
|
HsfObject *object;
|
||||||
HsfMapAttr *mapAttr;
|
HsfMapAttr *mapAttr;
|
||||||
HsfMatrix *matrix;
|
HsfMatrix *matrix;
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
void **symbol;
|
||||||
|
#endif
|
||||||
s16 sceneCnt;
|
s16 sceneCnt;
|
||||||
s16 attributeCnt;
|
s16 attributeCnt;
|
||||||
s16 materialCnt;
|
s16 materialCnt;
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,8 @@ void ClusterAdjustObject(HsfData *model, HsfData *src_model);
|
||||||
char *SetName(u32 *str_ofs);
|
char *SetName(u32 *str_ofs);
|
||||||
char *MakeObjectName(char *name);
|
char *MakeObjectName(char *name);
|
||||||
s32 CmpObjectName(char *name1, char *name2);
|
s32 CmpObjectName(char *name1, char *name2);
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
void KillHSF(HsfData *data);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -10,9 +10,9 @@
|
||||||
|
|
||||||
|
|
||||||
typedef struct motion_data {
|
typedef struct motion_data {
|
||||||
s16 unk_00;
|
s16 attr;
|
||||||
s16 unk_02;
|
s16 modelId;
|
||||||
HsfData *unk_04;
|
HsfData *hsfData;
|
||||||
} MotionData;
|
} MotionData;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@ void *HuMemInit(void *ptr, s32 size);
|
||||||
void HuMemDCFlushAll();
|
void HuMemDCFlushAll();
|
||||||
void HuMemDCFlush(HeapID heap);
|
void HuMemDCFlush(HeapID heap);
|
||||||
void *HuMemDirectMalloc(HeapID heap, s32 size);
|
void *HuMemDirectMalloc(HeapID heap, s32 size);
|
||||||
void *HuMemDirectMallocNum(HeapID heap, s32 size, u32 num);
|
void *HuMemDirectMallocNum(HeapID heap, s32 size, uintptr_t num);
|
||||||
void HuMemDirectFree(void *ptr);
|
void HuMemDirectFree(void *ptr);
|
||||||
void HuMemDirectFreeNum(HeapID heap, u32 num);
|
void HuMemDirectFreeNum(HeapID heap, uintptr_t num);
|
||||||
s32 HuMemUsedMallocSizeGet(HeapID heap);
|
s32 HuMemUsedMallocSizeGet(HeapID heap);
|
||||||
s32 HuMemUsedMallocBlockGet(HeapID heap);
|
s32 HuMemUsedMallocBlockGet(HeapID heap);
|
||||||
u32 HuMemHeapSizeGet(HeapID heap);
|
u32 HuMemHeapSizeGet(HeapID heap);
|
||||||
|
|
@ -29,9 +29,9 @@ void *HuMemHeapPtrGet(HeapID heap);
|
||||||
|
|
||||||
void *HuMemHeapInit(void *ptr, s32 size);
|
void *HuMemHeapInit(void *ptr, s32 size);
|
||||||
void *HuMemMemoryAlloc(void *heap_ptr, s32 size, uintptr_t retaddr);
|
void *HuMemMemoryAlloc(void *heap_ptr, s32 size, uintptr_t retaddr);
|
||||||
void *HuMemMemoryAllocNum(void *heap_ptr, s32 size, u32 num, uintptr_t retaddr);
|
void *HuMemMemoryAllocNum(void *heap_ptr, s32 size, uintptr_t num, uintptr_t retaddr);
|
||||||
void HuMemMemoryFree(void *ptr, uintptr_t retaddr);
|
void HuMemMemoryFree(void *ptr, uintptr_t retaddr);
|
||||||
void HuMemMemoryFreeNum(void *heap_ptr, u32 num, uintptr_t retaddr);
|
void HuMemMemoryFreeNum(void *heap_ptr, uintptr_t num, uintptr_t retaddr);
|
||||||
s32 HuMemUsedMemorySizeGet(void *heap_ptr);
|
s32 HuMemUsedMemorySizeGet(void *heap_ptr);
|
||||||
s32 HuMemUsedMemoryBlockGet(void *heap_ptr);
|
s32 HuMemUsedMemoryBlockGet(void *heap_ptr);
|
||||||
s32 HuMemMemorySizeGet(void *ptr);
|
s32 HuMemMemorySizeGet(void *ptr);
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,233 @@ extern "C"
|
||||||
#include "game/animdata.h"
|
#include "game/animdata.h"
|
||||||
#include "game/hsfformat.h"
|
#include "game/hsfformat.h"
|
||||||
|
|
||||||
|
typedef struct HsfCluster32b {
|
||||||
|
u32 name[2];
|
||||||
|
u32 targetName;
|
||||||
|
u32 part;
|
||||||
|
float index;
|
||||||
|
float weight[32];
|
||||||
|
u8 adjusted;
|
||||||
|
u8 unk95;
|
||||||
|
u16 type;
|
||||||
|
u32 vertexCnt;
|
||||||
|
u32 vertex;
|
||||||
|
} HsfCluster32b;
|
||||||
|
|
||||||
|
typedef struct HsfAttribute32b {
|
||||||
|
u32 name;
|
||||||
|
u32 unk04;
|
||||||
|
u8 unk8[4];
|
||||||
|
float unk0C;
|
||||||
|
u8 unk10[4];
|
||||||
|
float unk14;
|
||||||
|
u8 unk18[8];
|
||||||
|
float unk20;
|
||||||
|
u8 unk24[4];
|
||||||
|
float unk28;
|
||||||
|
float unk2C;
|
||||||
|
float unk30;
|
||||||
|
float unk34;
|
||||||
|
u8 unk38[44];
|
||||||
|
u32 wrap_s;
|
||||||
|
u32 wrap_t;
|
||||||
|
u8 unk6C[12];
|
||||||
|
u32 unk78;
|
||||||
|
u32 flag;
|
||||||
|
u32 bitmap;
|
||||||
|
} HsfAttribute32b;
|
||||||
|
|
||||||
|
typedef struct HsfMaterial32b {
|
||||||
|
u32 name;
|
||||||
|
u8 unk4[4];
|
||||||
|
u16 pass;
|
||||||
|
u8 vtxMode;
|
||||||
|
u8 litColor[3];
|
||||||
|
u8 color[3];
|
||||||
|
u8 shadowColor[3];
|
||||||
|
float hilite_scale;
|
||||||
|
float unk18;
|
||||||
|
float invAlpha;
|
||||||
|
float unk20[2];
|
||||||
|
float refAlpha;
|
||||||
|
float unk2C;
|
||||||
|
u32 flags;
|
||||||
|
u32 numAttrs;
|
||||||
|
u32 attrs;
|
||||||
|
} HsfMaterial32b;
|
||||||
|
|
||||||
|
typedef struct HsfMapAttr32b {
|
||||||
|
float minX;
|
||||||
|
float minZ;
|
||||||
|
float maxX;
|
||||||
|
float maxZ;
|
||||||
|
u32 data;
|
||||||
|
u32 dataLen;
|
||||||
|
} HsfMapAttr32b;
|
||||||
|
|
||||||
|
typedef struct HsfBuffer32b {
|
||||||
|
u32 name;
|
||||||
|
s32 count;
|
||||||
|
u32 data;
|
||||||
|
} HsfBuffer32b;
|
||||||
|
|
||||||
|
typedef struct HsfPalette32b {
|
||||||
|
u32 name;
|
||||||
|
s32 unk;
|
||||||
|
u32 palSize;
|
||||||
|
u32 data;
|
||||||
|
} HsfPalette32b;
|
||||||
|
|
||||||
|
typedef struct HsfBitmap32b {
|
||||||
|
u32 name;
|
||||||
|
u32 maxLod;
|
||||||
|
u8 dataFmt;
|
||||||
|
u8 pixSize;
|
||||||
|
s16 sizeX;
|
||||||
|
s16 sizeY;
|
||||||
|
s16 palSize;
|
||||||
|
GXColor tint;
|
||||||
|
u32 palData;
|
||||||
|
u32 unk;
|
||||||
|
u32 data;
|
||||||
|
} HsfBitmap32b;
|
||||||
|
|
||||||
|
typedef struct HsfPart32b {
|
||||||
|
u32 name;
|
||||||
|
u32 count;
|
||||||
|
u32 vertex;
|
||||||
|
} HsfPart32b;
|
||||||
|
|
||||||
|
typedef struct HsfSkeleton32b {
|
||||||
|
u32 name;
|
||||||
|
HsfTransform transform;
|
||||||
|
} HsfSkeleton32b;
|
||||||
|
|
||||||
|
typedef struct HsfShape32b {
|
||||||
|
u32 name;
|
||||||
|
union {
|
||||||
|
u16 count16[2];
|
||||||
|
u32 vertexCnt;
|
||||||
|
};
|
||||||
|
u32 vertex;
|
||||||
|
} HsfShape32b;
|
||||||
|
|
||||||
|
typedef struct HsfCenv32b {
|
||||||
|
u32 name;
|
||||||
|
u32 singleData;
|
||||||
|
u32 dualData;
|
||||||
|
u32 multiData;
|
||||||
|
u32 singleCount;
|
||||||
|
u32 dualCount;
|
||||||
|
u32 multiCount;
|
||||||
|
u32 vtxCount;
|
||||||
|
u32 copyCount;
|
||||||
|
} HsfCenv32b;
|
||||||
|
|
||||||
|
typedef struct HsfObjectData32b {
|
||||||
|
u32 parent;
|
||||||
|
u32 childrenCount;
|
||||||
|
u32 children;
|
||||||
|
HsfTransform base;
|
||||||
|
HsfTransform curr;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
HsfVector3f min;
|
||||||
|
HsfVector3f max;
|
||||||
|
float baseMorph;
|
||||||
|
float morphWeight[33];
|
||||||
|
} mesh;
|
||||||
|
struct hsf_object *replica;
|
||||||
|
};
|
||||||
|
|
||||||
|
u32 face;
|
||||||
|
u32 vertex;
|
||||||
|
u32 normal;
|
||||||
|
u32 color;
|
||||||
|
u32 st;
|
||||||
|
u32 material;
|
||||||
|
u32 attribute;
|
||||||
|
u8 unk120[2];
|
||||||
|
u8 shapeType;
|
||||||
|
u8 unk123;
|
||||||
|
u32 vertexShapeCnt;
|
||||||
|
u32 vertexShape;
|
||||||
|
u32 clusterCnt;
|
||||||
|
u32 cluster;
|
||||||
|
u32 cenvCnt;
|
||||||
|
u32 cenv;
|
||||||
|
u32 file[2];
|
||||||
|
} HsfObjectData32b;
|
||||||
|
|
||||||
|
typedef struct HsfObject32b {
|
||||||
|
u32 name;
|
||||||
|
u32 type;
|
||||||
|
u32 constData;
|
||||||
|
u32 flags;
|
||||||
|
HsfObjectData32b data;
|
||||||
|
} HsfObject32b;
|
||||||
|
|
||||||
|
typedef struct HsfTrack32b {
|
||||||
|
u8 type;
|
||||||
|
u8 start;
|
||||||
|
union {
|
||||||
|
u16 target;
|
||||||
|
s16 target_s16;
|
||||||
|
};
|
||||||
|
union {
|
||||||
|
s32 unk04;
|
||||||
|
struct {
|
||||||
|
union {
|
||||||
|
s16 param;
|
||||||
|
u16 param_u16;
|
||||||
|
};
|
||||||
|
union {
|
||||||
|
u16 channel;
|
||||||
|
s16 channel_s16;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
u16 curveType;
|
||||||
|
u16 numKeyframes;
|
||||||
|
union {
|
||||||
|
float value;
|
||||||
|
u32 data;
|
||||||
|
};
|
||||||
|
} HsfTrack32b;
|
||||||
|
|
||||||
|
typedef struct HsfMotion32b {
|
||||||
|
u32 name;
|
||||||
|
s32 numTracks;
|
||||||
|
u32 track;
|
||||||
|
float len;
|
||||||
|
} HsfMotion32b;
|
||||||
|
|
||||||
|
typedef struct HsfBitmapKey32b {
|
||||||
|
float time;
|
||||||
|
u32 data;
|
||||||
|
} HsfBitmapKey32b;
|
||||||
|
|
||||||
|
typedef struct HsfFace32b {
|
||||||
|
s16 type;
|
||||||
|
s16 mat;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
s16 indices[3][4];
|
||||||
|
u32 count;
|
||||||
|
u32 data;
|
||||||
|
} strip;
|
||||||
|
s16 indices[4][4];
|
||||||
|
};
|
||||||
|
Vec nbt;
|
||||||
|
} HsfFace32b;
|
||||||
|
|
||||||
|
void byteswap_u16(u16 *src);
|
||||||
|
void byteswap_s16(s16 *src);
|
||||||
void byteswap_u32(u32 *src);
|
void byteswap_u32(u32 *src);
|
||||||
void byteswap_s32(s32 *src);
|
void byteswap_s32(s32 *src);
|
||||||
|
void byteswap_hsfvec3f(HsfVector3f *src);
|
||||||
|
void byteswap_hsfvec2f(HsfVector2f *src);
|
||||||
|
|
||||||
void byteswap_animdata(void *src, AnimData* dest);
|
void byteswap_animdata(void *src, AnimData* dest);
|
||||||
void byteswap_animbankdata(void *src, AnimBankData *dest);
|
void byteswap_animbankdata(void *src, AnimBankData *dest);
|
||||||
void byteswap_animpatdata(void *src, AnimPatData *dest);
|
void byteswap_animpatdata(void *src, AnimPatData *dest);
|
||||||
|
|
@ -18,8 +243,26 @@ void byteswap_animbmpdata(void *src, AnimBmpData *dest);
|
||||||
void byteswap_animframedata(AnimFrameData *src);
|
void byteswap_animframedata(AnimFrameData *src);
|
||||||
void byteswap_animlayerdata(AnimLayerData *src);
|
void byteswap_animlayerdata(AnimLayerData *src);
|
||||||
|
|
||||||
|
|
||||||
void byteswap_hsfheader(HsfHeader *src);
|
void byteswap_hsfheader(HsfHeader *src);
|
||||||
|
void byteswap_hsfcluster(HsfCluster32b *src, HsfCluster *dest);
|
||||||
|
void byteswap_hsfattribute(HsfAttribute32b *src, HsfAttribute *dest);
|
||||||
|
void byteswap_hsfmaterial(HsfMaterial32b *src, HsfMaterial *dest);
|
||||||
|
void byteswap_hsfscene(HsfScene *src);
|
||||||
|
void byteswap_hsfbuffer(HsfBuffer32b *src, HsfBuffer *dest);
|
||||||
|
void byteswap_hsfmatrix(HsfMatrix *src);
|
||||||
|
void byteswap_hsfpalette(HsfPalette32b *src, HsfPalette *dest);
|
||||||
|
void byteswap_hsfpart(HsfPart32b *src, HsfPart *dest);
|
||||||
|
void byteswap_hsfbitmap(HsfBitmap32b *src, HsfBitmap *dest);
|
||||||
|
void byteswap_hsfmapattr(HsfMapAttr32b *src, HsfMapAttr *dest);
|
||||||
|
void byteswap_hsfskeleton(HsfSkeleton32b *src, HsfSkeleton *dest);
|
||||||
|
void byteswap_hsfshape(HsfShape32b *src, HsfShape *dest);
|
||||||
|
void byteswap_hsfcenv_single(HsfCenvSingle *src);
|
||||||
|
void byteswap_hsfcenv(HsfCenv32b *src, HsfCenv *dest);
|
||||||
|
void byteswap_hsfobject(HsfObject32b *src, HsfObject *dest);
|
||||||
|
void byteswap_hsfbitmapkey(HsfBitmapKey32b *src, HsfBitmapKey *dest);
|
||||||
|
void byteswap_hsftrack(HsfTrack32b *src, HsfTrack *dest);
|
||||||
|
void byteswap_hsfmotion(HsfMotion32b *src, HsfMotion *dest);
|
||||||
|
void byteswap_hsfface(HsfFace32b *src, HsfFace *dest);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ float MotionMaxTimeGet(s16 arg0)
|
||||||
HsfMotion *temp_r30;
|
HsfMotion *temp_r30;
|
||||||
s16 temp_r29;
|
s16 temp_r29;
|
||||||
|
|
||||||
temp_r30 = temp_r31->unk_04->motion;
|
temp_r30 = temp_r31->hsfData->motion;
|
||||||
temp_r29 = temp_r30->len;
|
temp_r29 = temp_r30->len;
|
||||||
return temp_r29;
|
return temp_r29;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -371,8 +371,10 @@ void ObjectSetup(void)
|
||||||
s16 group;
|
s16 group;
|
||||||
s16 sprite;
|
s16 sprite;
|
||||||
AnimData *data;
|
AnimData *data;
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
return;
|
||||||
|
#else
|
||||||
option = 0;
|
option = 0;
|
||||||
#ifdef __MWERKS__
|
|
||||||
if (OSGetResetCode() != OS_RESET_RESTART) {
|
if (OSGetResetCode() != OS_RESET_RESTART) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -425,7 +427,6 @@ void ObjectSetup(void)
|
||||||
HuPrcVSleep();
|
HuPrcVSleep();
|
||||||
}
|
}
|
||||||
#ifdef __MWERKS__
|
#ifdef __MWERKS__
|
||||||
// TODO PC
|
|
||||||
if (!option) {
|
if (!option) {
|
||||||
OSSetProgressiveMode(OS_PROGRESSIVE_MODE_ON);
|
OSSetProgressiveMode(OS_PROGRESSIVE_MODE_ON);
|
||||||
VIConfigure(&GXNtsc480Prog);
|
VIConfigure(&GXNtsc480Prog);
|
||||||
|
|
@ -565,8 +566,6 @@ void ObjectSetup(void)
|
||||||
s16 sprite;
|
s16 sprite;
|
||||||
AnimData *sprite_data;
|
AnimData *sprite_data;
|
||||||
s16 i;
|
s16 i;
|
||||||
#ifdef __MWERKS__
|
|
||||||
// TODO PC
|
|
||||||
titleMdlId[0] = model = Hu3DModelCreateFile(TITLE_CHAR_HSF);
|
titleMdlId[0] = model = Hu3DModelCreateFile(TITLE_CHAR_HSF);
|
||||||
Hu3DModelAttrSet(model, HU3D_ATTR_DISPOFF);
|
Hu3DModelAttrSet(model, HU3D_ATTR_DISPOFF);
|
||||||
Hu3DModelAttrSet(model, HU3D_MOTATTR_LOOP);
|
Hu3DModelAttrSet(model, HU3D_MOTATTR_LOOP);
|
||||||
|
|
@ -578,7 +577,6 @@ void ObjectSetup(void)
|
||||||
Hu3DModelAttrSet(model, HU3D_MOTATTR_LOOP);
|
Hu3DModelAttrSet(model, HU3D_MOTATTR_LOOP);
|
||||||
Hu3DModelCameraInfoSet(model, 1);
|
Hu3DModelCameraInfoSet(model, 1);
|
||||||
Hu3DModelLightInfoSet(model, 1);
|
Hu3DModelLightInfoSet(model, 1);
|
||||||
#endif
|
|
||||||
#if VERSION_NTSC
|
#if VERSION_NTSC
|
||||||
bootGrpId = HuSprGrpCreate(4);
|
bootGrpId = HuSprGrpCreate(4);
|
||||||
#else
|
#else
|
||||||
|
|
@ -640,11 +638,8 @@ void ObjectSetup(void)
|
||||||
s16 choice;
|
s16 choice;
|
||||||
float temp;
|
float temp;
|
||||||
repeat:
|
repeat:
|
||||||
#ifdef __MWERKS__
|
|
||||||
// TODO PC
|
|
||||||
Hu3DModelAttrReset(titleMdlId[0], HU3D_ATTR_DISPOFF);
|
Hu3DModelAttrReset(titleMdlId[0], HU3D_ATTR_DISPOFF);
|
||||||
Hu3DModelAttrReset(titleMdlId[1], HU3D_ATTR_DISPOFF);
|
Hu3DModelAttrReset(titleMdlId[1], HU3D_ATTR_DISPOFF);
|
||||||
#endif
|
|
||||||
HuSprAttrReset(bootGrpId, 0, HUSPR_ATTR_DISPOFF);
|
HuSprAttrReset(bootGrpId, 0, HUSPR_ATTR_DISPOFF);
|
||||||
HuSprAttrReset(bootGrpId, 1, HUSPR_ATTR_DISPOFF);
|
HuSprAttrReset(bootGrpId, 1, HUSPR_ATTR_DISPOFF);
|
||||||
#ifdef __MWERKS__
|
#ifdef __MWERKS__
|
||||||
|
|
@ -796,12 +791,9 @@ void ObjectSetup(void)
|
||||||
while (WipeStatGet()) {
|
while (WipeStatGet()) {
|
||||||
HuPrcVSleep();
|
HuPrcVSleep();
|
||||||
}
|
}
|
||||||
#ifdef __MWERKS__
|
|
||||||
// TODO PC
|
|
||||||
Hu3DModelAttrSet(titleMdlId[0], HU3D_ATTR_DISPOFF);
|
Hu3DModelAttrSet(titleMdlId[0], HU3D_ATTR_DISPOFF);
|
||||||
Hu3DModelAttrSet(titleMdlId[1], HU3D_ATTR_DISPOFF);
|
Hu3DModelAttrSet(titleMdlId[1], HU3D_ATTR_DISPOFF);
|
||||||
Hu3DModelAttrSet(titleMdlId[2], HU3D_ATTR_DISPOFF);
|
Hu3DModelAttrSet(titleMdlId[2], HU3D_ATTR_DISPOFF);
|
||||||
#endif
|
|
||||||
#if VERSION_NTSC
|
#if VERSION_NTSC
|
||||||
HuSprAttrSet(bootGrpId, 0, HUSPR_ATTR_DISPOFF);
|
HuSprAttrSet(bootGrpId, 0, HUSPR_ATTR_DISPOFF);
|
||||||
HuSprAttrSet(bootGrpId, 1, HUSPR_ATTR_DISPOFF);
|
HuSprAttrSet(bootGrpId, 1, HUSPR_ATTR_DISPOFF);
|
||||||
|
|
|
||||||
|
|
@ -1263,7 +1263,7 @@ f32 fn_1_BF38(s16 arg0)
|
||||||
f32 length;
|
f32 length;
|
||||||
|
|
||||||
motionData = &Hu3DMotion[arg0];
|
motionData = &Hu3DMotion[arg0];
|
||||||
hsfMotionData = motionData->unk_04->motion;
|
hsfMotionData = motionData->hsfData->motion;
|
||||||
length = hsfMotionData->len;
|
length = hsfMotionData->len;
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
#include "game/hsfmotion.h"
|
#include "game/hsfmotion.h"
|
||||||
#include "game/sprite.h"
|
#include "game/sprite.h"
|
||||||
|
|
||||||
float GetClusterCurve(HsfTrack *arg0, float arg1) {
|
float GetClusterCurve(HsfTrack *arg0, float arg1)
|
||||||
|
{
|
||||||
float *var_r30;
|
float *var_r30;
|
||||||
|
|
||||||
switch (arg0->curveType) {
|
switch (arg0->curveType) {
|
||||||
|
|
@ -18,7 +19,8 @@ float GetClusterCurve(HsfTrack *arg0, float arg1) {
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float GetClusterWeightCurve(HsfTrack *arg0, float arg1) {
|
float GetClusterWeightCurve(HsfTrack *arg0, float arg1)
|
||||||
|
{
|
||||||
float *var_r30;
|
float *var_r30;
|
||||||
|
|
||||||
switch (arg0->curveType) {
|
switch (arg0->curveType) {
|
||||||
|
|
@ -33,7 +35,8 @@ float GetClusterWeightCurve(HsfTrack *arg0, float arg1) {
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetClusterMain(HsfCluster *arg0) {
|
void SetClusterMain(HsfCluster *arg0)
|
||||||
|
{
|
||||||
float var_f30;
|
float var_f30;
|
||||||
float var_f31;
|
float var_f31;
|
||||||
s32 temp_r24;
|
s32 temp_r24;
|
||||||
|
|
@ -53,51 +56,53 @@ void SetClusterMain(HsfCluster *arg0) {
|
||||||
temp_r30 = *arg0->vertex;
|
temp_r30 = *arg0->vertex;
|
||||||
var_f30 = 0.0f;
|
var_f30 = 0.0f;
|
||||||
for (i = 0; i < arg0->vertexCnt; i++) {
|
for (i = 0; i < arg0->vertexCnt; i++) {
|
||||||
var_f30 += arg0->unk14[i];
|
var_f30 += arg0->weight[i];
|
||||||
}
|
}
|
||||||
for (i = 0; i < temp_r27->count; i++, var_r28++) {
|
for (i = 0; i < temp_r27->count; i++, var_r28++) {
|
||||||
temp_r29 = *var_r28;
|
temp_r29 = *var_r28;
|
||||||
Vertextop[temp_r29].x = ((Vec*) temp_r30->data)[i].x;
|
Vertextop[temp_r29].x = ((Vec *)temp_r30->data)[i].x;
|
||||||
Vertextop[temp_r29].y = ((Vec*) temp_r30->data)[i].y;
|
Vertextop[temp_r29].y = ((Vec *)temp_r30->data)[i].y;
|
||||||
Vertextop[temp_r29].z = ((Vec*) temp_r30->data)[i].z;
|
Vertextop[temp_r29].z = ((Vec *)temp_r30->data)[i].z;
|
||||||
}
|
}
|
||||||
for (i = 1; i < arg0->vertexCnt; i++) {
|
for (i = 1; i < arg0->vertexCnt; i++) {
|
||||||
temp_r30 = arg0->vertex[i];
|
temp_r30 = arg0->vertex[i];
|
||||||
var_r28 = temp_r27->vertex;
|
var_r28 = temp_r27->vertex;
|
||||||
var_f31 = arg0->unk14[i];
|
var_f31 = arg0->weight[i];
|
||||||
if (var_f31 < 0.0f) {
|
if (var_f31 < 0.0f) {
|
||||||
var_f31 = 0.0f;
|
var_f31 = 0.0f;
|
||||||
} else if (var_f30 > 1.0f) {
|
}
|
||||||
|
else if (var_f30 > 1.0f) {
|
||||||
var_f31 /= var_f30;
|
var_f31 /= var_f30;
|
||||||
}
|
}
|
||||||
for (j = 0; j < temp_r27->count; j++, var_r28++) {
|
for (j = 0; j < temp_r27->count; j++, var_r28++) {
|
||||||
temp_r29 = *var_r28;
|
temp_r29 = *var_r28;
|
||||||
Vertextop[temp_r29].x += var_f31 * (((Vec*) temp_r30->data)[j].x - Vertextop[temp_r29].x);
|
Vertextop[temp_r29].x += var_f31 * (((Vec *)temp_r30->data)[j].x - Vertextop[temp_r29].x);
|
||||||
Vertextop[temp_r29].y += var_f31 * (((Vec*) temp_r30->data)[j].y - Vertextop[temp_r29].y);
|
Vertextop[temp_r29].y += var_f31 * (((Vec *)temp_r30->data)[j].y - Vertextop[temp_r29].y);
|
||||||
Vertextop[temp_r29].z += var_f31 * (((Vec*) temp_r30->data)[j].z - Vertextop[temp_r29].z);
|
Vertextop[temp_r29].z += var_f31 * (((Vec *)temp_r30->data)[j].z - Vertextop[temp_r29].z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
temp_r24 = arg0->unk10;
|
temp_r24 = arg0->index;
|
||||||
var_r23 = temp_r24 + 1;
|
var_r23 = temp_r24 + 1;
|
||||||
if (var_r23 >= arg0->vertexCnt) {
|
if (var_r23 >= arg0->vertexCnt) {
|
||||||
var_r23 = temp_r24;
|
var_r23 = temp_r24;
|
||||||
}
|
}
|
||||||
var_f31 = arg0->unk10 - temp_r24;
|
var_f31 = arg0->index - temp_r24;
|
||||||
temp_r30 = arg0->vertex[temp_r24];
|
temp_r30 = arg0->vertex[temp_r24];
|
||||||
temp_r25 = arg0->vertex[var_r23];
|
temp_r25 = arg0->vertex[var_r23];
|
||||||
var_r28 = temp_r27->vertex;
|
var_r28 = temp_r27->vertex;
|
||||||
for (i = 0; i < temp_r27->count; i++, var_r28++) {
|
for (i = 0; i < temp_r27->count; i++, var_r28++) {
|
||||||
temp_r29 = *var_r28;
|
temp_r29 = *var_r28;
|
||||||
Vertextop[temp_r29].x = ((Vec*) temp_r30->data)[i].x + var_f31 * (((Vec*) temp_r25->data)[i].x - ((Vec*) temp_r30->data)[i].x);
|
Vertextop[temp_r29].x = ((Vec *)temp_r30->data)[i].x + var_f31 * (((Vec *)temp_r25->data)[i].x - ((Vec *)temp_r30->data)[i].x);
|
||||||
Vertextop[temp_r29].y = ((Vec*) temp_r30->data)[i].y + var_f31 * (((Vec*) temp_r25->data)[i].y - ((Vec*) temp_r30->data)[i].y);
|
Vertextop[temp_r29].y = ((Vec *)temp_r30->data)[i].y + var_f31 * (((Vec *)temp_r25->data)[i].y - ((Vec *)temp_r30->data)[i].y);
|
||||||
Vertextop[temp_r29].z = ((Vec*) temp_r30->data)[i].z + var_f31 * (((Vec*) temp_r25->data)[i].z - ((Vec*) temp_r30->data)[i].z);
|
Vertextop[temp_r29].z = ((Vec *)temp_r30->data)[i].z + var_f31 * (((Vec *)temp_r25->data)[i].z - ((Vec *)temp_r30->data)[i].z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterProc(ModelData *arg0) {
|
void ClusterProc(ModelData *arg0)
|
||||||
|
{
|
||||||
s32 temp_r24;
|
s32 temp_r24;
|
||||||
s32 i;
|
s32 i;
|
||||||
s32 j;
|
s32 j;
|
||||||
|
|
@ -112,7 +117,7 @@ void ClusterProc(ModelData *arg0) {
|
||||||
temp_r24 = arg0->unk_10[i];
|
temp_r24 = arg0->unk_10[i];
|
||||||
if (temp_r24 != -1) {
|
if (temp_r24 != -1) {
|
||||||
temp_r22 = &Hu3DMotion[temp_r24];
|
temp_r22 = &Hu3DMotion[temp_r24];
|
||||||
temp_r27 = temp_r22->unk_04;
|
temp_r27 = temp_r22->hsfData;
|
||||||
temp_r23 = arg0->hsfData;
|
temp_r23 = arg0->hsfData;
|
||||||
var_r29 = temp_r27->cluster;
|
var_r29 = temp_r27->cluster;
|
||||||
for (j = 0; j < temp_r27->clusterCnt; j++, var_r29++) {
|
for (j = 0; j < temp_r27->clusterCnt; j++, var_r29++) {
|
||||||
|
|
@ -122,9 +127,9 @@ void ClusterProc(ModelData *arg0) {
|
||||||
Vertextop = temp_r31->data.vertex->data;
|
Vertextop = temp_r31->data.vertex->data;
|
||||||
if (temp_r31->data.cenvCnt) {
|
if (temp_r31->data.cenvCnt) {
|
||||||
for (k = 0; k < temp_r31->data.vertex->count; k++) {
|
for (k = 0; k < temp_r31->data.vertex->count; k++) {
|
||||||
Vertextop[k].x = ((Vec*) temp_r31->data.file[0])[k].x;
|
Vertextop[k].x = ((Vec *)temp_r31->data.file[0])[k].x;
|
||||||
Vertextop[k].y = ((Vec*) temp_r31->data.file[0])[k].y;
|
Vertextop[k].y = ((Vec *)temp_r31->data.file[0])[k].y;
|
||||||
Vertextop[k].z = ((Vec*) temp_r31->data.file[0])[k].z;
|
Vertextop[k].z = ((Vec *)temp_r31->data.file[0])[k].z;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SetClusterMain(var_r29);
|
SetClusterMain(var_r29);
|
||||||
|
|
@ -136,7 +141,8 @@ void ClusterProc(ModelData *arg0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterMotionExec(ModelData *arg0) {
|
void ClusterMotionExec(ModelData *arg0)
|
||||||
|
{
|
||||||
float temp_f31;
|
float temp_f31;
|
||||||
s32 i;
|
s32 i;
|
||||||
s32 j;
|
s32 j;
|
||||||
|
|
@ -153,7 +159,7 @@ void ClusterMotionExec(ModelData *arg0) {
|
||||||
if (arg0->unk_10[i] != -1) {
|
if (arg0->unk_10[i] != -1) {
|
||||||
var_r20 = arg0->unk_10[i];
|
var_r20 = arg0->unk_10[i];
|
||||||
var_r23 = &Hu3DMotion[var_r20];
|
var_r23 = &Hu3DMotion[var_r20];
|
||||||
temp_r28 = var_r23->unk_04;
|
temp_r28 = var_r23->hsfData;
|
||||||
temp_r27 = temp_r28->motion;
|
temp_r27 = temp_r28->motion;
|
||||||
var_r31 = temp_r27->track;
|
var_r31 = temp_r27->track;
|
||||||
temp_f31 = arg0->unk_A4[i];
|
temp_f31 = arg0->unk_A4[i];
|
||||||
|
|
@ -161,12 +167,12 @@ void ClusterMotionExec(ModelData *arg0) {
|
||||||
switch (var_r31->type) {
|
switch (var_r31->type) {
|
||||||
case 5:
|
case 5:
|
||||||
temp_r26 = &temp_r28->cluster[var_r31->target_s16];
|
temp_r26 = &temp_r28->cluster[var_r31->target_s16];
|
||||||
temp_r26->unk10 = GetClusterCurve(var_r31, temp_f31);
|
temp_r26->index = GetClusterCurve(var_r31, temp_f31);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
var_r30 = var_r31;
|
var_r30 = var_r31;
|
||||||
temp_r26 = &temp_r28->cluster[var_r30->target_s16];
|
temp_r26 = &temp_r28->cluster[var_r30->target_s16];
|
||||||
temp_r26->unk14[var_r30->unk04] = GetClusterCurve(var_r30, temp_f31);
|
temp_r26->weight[var_r30->unk04] = GetClusterCurve(var_r30, temp_f31);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -747,7 +747,7 @@ float BoardModelMotionShapeMaxTimeGet(s16 model)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
motion = &Hu3DMotion[hsf_model->unk_0E];
|
motion = &Hu3DMotion[hsf_model->unk_0E];
|
||||||
motion_hsf = motion->unk_04->motion;
|
motion_hsf = motion->hsfData->motion;
|
||||||
return motion_hsf->len;
|
return motion_hsf->len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ static u16 faceCnt;
|
||||||
static u16 *faceNumBuf;
|
static u16 *faceNumBuf;
|
||||||
static s32 DLTotalNum;
|
static s32 DLTotalNum;
|
||||||
static u32 totalSize;
|
static u32 totalSize;
|
||||||
static u32 mallocNo;
|
static uintptr_t mallocNo;
|
||||||
static s32 curModelID;
|
static s32 curModelID;
|
||||||
static s16 polySize;
|
static s16 polySize;
|
||||||
static s32 PGFinishF;
|
static s32 PGFinishF;
|
||||||
|
|
@ -2367,7 +2367,7 @@ static void ObjDraw(HsfDrawObject *arg0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakeDisplayList(s16 arg0, u32 arg1) {
|
void MakeDisplayList(s16 arg0, uintptr_t arg1) {
|
||||||
HsfData *temp_r31;
|
HsfData *temp_r31;
|
||||||
ModelData *var_r30;
|
ModelData *var_r30;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ void CamMotionEx(s16 arg0, s16 arg1, Vec *arg2, Vec *arg3, Vec *arg4, float arg5
|
||||||
temp_r23 = &Hu3DData[arg0];
|
temp_r23 = &Hu3DData[arg0];
|
||||||
temp_r19 = &Hu3DMotion[temp_r23->unk_08];
|
temp_r19 = &Hu3DMotion[temp_r23->unk_08];
|
||||||
temp_r22 = temp_r23->hsfData;
|
temp_r22 = temp_r23->hsfData;
|
||||||
temp_r18 = temp_r19->unk_04;
|
temp_r18 = temp_r19->hsfData;
|
||||||
temp_r26 = temp_r18->motion;
|
temp_r26 = temp_r18->motion;
|
||||||
for (var_r25 = 0; var_r25 < HU3D_CAM_MAX; var_r25++) {
|
for (var_r25 = 0; var_r25 < HU3D_CAM_MAX; var_r25++) {
|
||||||
if (arg1 & (1 << var_r25)) {
|
if (arg1 & (1 << var_r25)) {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#include "ctype.h"
|
#include "ctype.h"
|
||||||
|
|
||||||
#ifdef TARGET_PC
|
#ifdef TARGET_PC
|
||||||
|
#include "game/memory.h"
|
||||||
#include "port/byteswap.h"
|
#include "port/byteswap.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -26,6 +27,15 @@ HsfBuffer *vtxtop;
|
||||||
HsfCluster *ClusterTop;
|
HsfCluster *ClusterTop;
|
||||||
HsfAttribute *AttributeTop;
|
HsfAttribute *AttributeTop;
|
||||||
HsfMaterial *MaterialTop;
|
HsfMaterial *MaterialTop;
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
HsfBuffer *NormalTop;
|
||||||
|
HsfBuffer *StTop;
|
||||||
|
HsfBuffer *ColorTop;
|
||||||
|
HsfBuffer *FaceTop;
|
||||||
|
HsfCenv *CenvTop;
|
||||||
|
HsfPart *PartTop;
|
||||||
|
HsfBitmap *BitmapTop;
|
||||||
|
#endif
|
||||||
|
|
||||||
static void FileLoad(void *data);
|
static void FileLoad(void *data);
|
||||||
static HsfData *SetHsfModel(void);
|
static HsfData *SetHsfModel(void);
|
||||||
|
|
@ -118,17 +128,43 @@ void ClusterAdjustObject(HsfData *model, HsfData *src_model)
|
||||||
|
|
||||||
static void FileLoad(void *data)
|
static void FileLoad(void *data)
|
||||||
{
|
{
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
s32 i;
|
||||||
|
#endif
|
||||||
fileptr = data;
|
fileptr = data;
|
||||||
memcpy(&head, fileptr, sizeof(HsfHeader));
|
memcpy(&head, fileptr, sizeof(HsfHeader));
|
||||||
memset(&Model, 0, sizeof(HsfData));
|
memset(&Model, 0, sizeof(HsfData));
|
||||||
#ifdef TARGET_PC
|
#ifdef TARGET_PC
|
||||||
byteswap_hsfheader(&head);
|
byteswap_hsfheader(&head);
|
||||||
#endif
|
NSymIndex = HuMemDirectMallocNum(HEAP_DATA, sizeof(void*) * head.symbol.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.symbol.count; i++) {
|
||||||
|
u32 *file_symbol_real = (u32 *)((uintptr_t)fileptr + head.symbol.ofs);
|
||||||
|
byteswap_u32(&file_symbol_real[i]);
|
||||||
|
NSymIndex[i] = (void *)file_symbol_real[i];
|
||||||
|
}
|
||||||
|
StringTable = (char *)((uintptr_t)fileptr+head.string.ofs);
|
||||||
|
ClusterTop = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfCluster) * head.cluster.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.cluster.count; i++) {
|
||||||
|
HsfCluster32b *file_cluster_real = (HsfCluster32b *)((uintptr_t)fileptr + head.cluster.ofs);
|
||||||
|
byteswap_hsfcluster(&file_cluster_real[i], &ClusterTop[i]);
|
||||||
|
}
|
||||||
|
AttributeTop = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfAttribute) * head.attribute.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.attribute.count; i++) {
|
||||||
|
HsfAttribute32b *file_attribute_real = (HsfAttribute32b *)((uintptr_t)fileptr + head.attribute.ofs);
|
||||||
|
byteswap_hsfattribute(&file_attribute_real[i], &AttributeTop[i]);
|
||||||
|
}
|
||||||
|
MaterialTop = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfMaterial) * head.material.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.material.count; i++) {
|
||||||
|
HsfMaterial32b *file_material_real = (HsfMaterial32b *)((uintptr_t)fileptr + head.material.ofs);
|
||||||
|
byteswap_hsfmaterial(&file_material_real[i], &MaterialTop[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
NSymIndex = (void **)((uintptr_t)fileptr+head.symbol.ofs);
|
NSymIndex = (void **)((uintptr_t)fileptr+head.symbol.ofs);
|
||||||
StringTable = (char *)((uintptr_t)fileptr+head.string.ofs);
|
StringTable = (char *)((uintptr_t)fileptr+head.string.ofs);
|
||||||
ClusterTop = (HsfCluster *)((uintptr_t)fileptr+head.cluster.ofs);
|
ClusterTop = (HsfCluster *)((uintptr_t)fileptr+head.cluster.ofs);
|
||||||
AttributeTop = (HsfAttribute *)((uintptr_t)fileptr + head.attribute.ofs);
|
AttributeTop = (HsfAttribute *)((uintptr_t)fileptr + head.attribute.ofs);
|
||||||
MaterialTop = (HsfMaterial *)((uintptr_t)fileptr + head.material.ofs);
|
MaterialTop = (HsfMaterial *)((uintptr_t)fileptr + head.material.ofs);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static HsfData *SetHsfModel(void)
|
static HsfData *SetHsfModel(void)
|
||||||
|
|
@ -173,6 +209,9 @@ static HsfData *SetHsfModel(void)
|
||||||
data->shapeCnt = Model.shapeCnt;
|
data->shapeCnt = Model.shapeCnt;
|
||||||
data->mapAttr = Model.mapAttr;
|
data->mapAttr = Model.mapAttr;
|
||||||
data->mapAttrCnt = Model.mapAttrCnt;
|
data->mapAttrCnt = Model.mapAttrCnt;
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
data->symbol = NSymIndex;
|
||||||
|
#endif
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,7 +232,11 @@ static void MaterialLoad(void)
|
||||||
s32 i;
|
s32 i;
|
||||||
s32 j;
|
s32 j;
|
||||||
if(head.material.count) {
|
if(head.material.count) {
|
||||||
HsfMaterial *file_mat = (HsfMaterial *)((u32)fileptr+head.material.ofs);
|
#ifdef TARGET_PC
|
||||||
|
HsfMaterial *file_mat = MaterialTop;
|
||||||
|
#else
|
||||||
|
HsfMaterial *file_mat = (HsfMaterial *)((uintptr_t)fileptr+head.material.ofs);
|
||||||
|
#endif
|
||||||
HsfMaterial *curr_mat;
|
HsfMaterial *curr_mat;
|
||||||
HsfMaterial *new_mat;
|
HsfMaterial *new_mat;
|
||||||
for(i=0; i<head.material.count; i++) {
|
for(i=0; i<head.material.count; i++) {
|
||||||
|
|
@ -202,7 +245,11 @@ static void MaterialLoad(void)
|
||||||
new_mat = file_mat;
|
new_mat = file_mat;
|
||||||
Model.material = new_mat;
|
Model.material = new_mat;
|
||||||
Model.materialCnt = head.material.count;
|
Model.materialCnt = head.material.count;
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
file_mat = MaterialTop;
|
||||||
|
#else
|
||||||
file_mat = (HsfMaterial *)((u32)fileptr+head.material.ofs);
|
file_mat = (HsfMaterial *)((u32)fileptr+head.material.ofs);
|
||||||
|
#endif
|
||||||
for(i=0; i<head.material.count; i++, new_mat++) {
|
for(i=0; i<head.material.count; i++, new_mat++) {
|
||||||
curr_mat = &file_mat[i];
|
curr_mat = &file_mat[i];
|
||||||
new_mat->name = SetName((u32 *)&curr_mat->name);
|
new_mat->name = SetName((u32 *)&curr_mat->name);
|
||||||
|
|
@ -244,7 +291,11 @@ static void AttributeLoad(void)
|
||||||
HsfAttribute *temp_attr;
|
HsfAttribute *temp_attr;
|
||||||
s32 i;
|
s32 i;
|
||||||
if(head.attribute.count) {
|
if(head.attribute.count) {
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
temp_attr = file_attr = AttributeTop;
|
||||||
|
#else
|
||||||
temp_attr = file_attr = (HsfAttribute *)((u32)fileptr+head.attribute.ofs);
|
temp_attr = file_attr = (HsfAttribute *)((u32)fileptr+head.attribute.ofs);
|
||||||
|
#endif
|
||||||
new_attr = temp_attr;
|
new_attr = temp_attr;
|
||||||
Model.attribute = new_attr;
|
Model.attribute = new_attr;
|
||||||
Model.attributeCnt = head.attribute.count;
|
Model.attributeCnt = head.attribute.count;
|
||||||
|
|
@ -261,10 +312,18 @@ static void AttributeLoad(void)
|
||||||
|
|
||||||
static void SceneLoad(void)
|
static void SceneLoad(void)
|
||||||
{
|
{
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
s32 i;
|
||||||
|
#endif
|
||||||
HsfScene *file_scene;
|
HsfScene *file_scene;
|
||||||
HsfScene *new_scene;
|
HsfScene *new_scene;
|
||||||
if(head.scene.count) {
|
if(head.scene.count) {
|
||||||
file_scene = (HsfScene *)((u32)fileptr+head.scene.ofs);
|
file_scene = (HsfScene *)((uintptr_t)fileptr+head.scene.ofs);
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
for (i = 0; i < head.scene.count; i++) {
|
||||||
|
byteswap_hsfscene(&file_scene[i]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
new_scene = file_scene;
|
new_scene = file_scene;
|
||||||
new_scene->end = file_scene->end;
|
new_scene->end = file_scene->end;
|
||||||
new_scene->start = file_scene->start;
|
new_scene->start = file_scene->start;
|
||||||
|
|
@ -283,18 +342,30 @@ static void ColorLoad(void)
|
||||||
HsfBuffer *temp_color;
|
HsfBuffer *temp_color;
|
||||||
|
|
||||||
if(head.color.count) {
|
if(head.color.count) {
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
HsfBuffer32b * file_color_real = (HsfBuffer32b *)((uintptr_t)fileptr + head.color.ofs);
|
||||||
|
temp_color = file_color = ColorTop = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfBuffer) * head.color.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.color.count; i++) {
|
||||||
|
byteswap_hsfbuffer(&file_color_real[i], &file_color[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
temp_color = file_color = (HsfBuffer *)((u32)fileptr+head.color.ofs);
|
temp_color = file_color = (HsfBuffer *)((u32)fileptr+head.color.ofs);
|
||||||
data = &file_color[head.color.count];
|
data = &file_color[head.color.count];
|
||||||
for(i=0; i<head.color.count; i++, file_color++);
|
for(i=0; i<head.color.count; i++, file_color++);
|
||||||
|
#endif
|
||||||
new_color = temp_color;
|
new_color = temp_color;
|
||||||
Model.color = new_color;
|
Model.color = new_color;
|
||||||
Model.colorCnt = head.color.count;
|
Model.colorCnt = head.color.count;
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
data = (u16 *)&file_color_real[head.color.count];
|
||||||
|
#else
|
||||||
file_color = (HsfBuffer *)((u32)fileptr+head.color.ofs);
|
file_color = (HsfBuffer *)((u32)fileptr+head.color.ofs);
|
||||||
data = &file_color[head.color.count];
|
data = &file_color[head.color.count];
|
||||||
|
#endif
|
||||||
for(i=0; i<head.color.count; i++, new_color++, file_color++) {
|
for(i=0; i<head.color.count; i++, new_color++, file_color++) {
|
||||||
color_data = file_color->data;
|
color_data = file_color->data;
|
||||||
new_color->name = SetName((u32 *)&file_color->name);
|
new_color->name = SetName((u32 *)&file_color->name);
|
||||||
new_color->data = (void *)((u32)data+(u32)color_data);
|
new_color->data = (void *)((uintptr_t)data+(uintptr_t)color_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -309,25 +380,40 @@ static void VertexLoad(void)
|
||||||
void *temp_data;
|
void *temp_data;
|
||||||
|
|
||||||
if(head.vertex.count) {
|
if(head.vertex.count) {
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
HsfBuffer32b *file_vertex_real = (HsfBuffer32b *)((uintptr_t)fileptr + head.vertex.ofs);
|
||||||
|
vtxtop = file_vertex = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfBuffer) * head.vertex.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.vertex.count; i++) {
|
||||||
|
byteswap_hsfbuffer(&file_vertex_real[i], &file_vertex[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
vtxtop = file_vertex = (HsfBuffer *)((u32)fileptr+head.vertex.ofs);
|
vtxtop = file_vertex = (HsfBuffer *)((u32)fileptr+head.vertex.ofs);
|
||||||
data = (void *)&file_vertex[head.vertex.count];
|
data = (void *)&file_vertex[head.vertex.count];
|
||||||
for(i=0; i<head.vertex.count; i++, file_vertex++) {
|
for(i=0; i<head.vertex.count; i++, file_vertex++) {
|
||||||
for(j=0; j<(u32)file_vertex->count; j++) {
|
for(j=0; j<(u32)file_vertex->count; j++) {
|
||||||
data_elem = (HsfVector3f *)(((u32)data)+((u32)file_vertex->data)+(j*sizeof(HsfVector3f)));
|
data_elem = (HsfVector3f *)(((uintptr_t)data)+((uintptr_t)file_vertex->data)+(j*sizeof(HsfVector3f)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
new_vertex = vtxtop;
|
new_vertex = vtxtop;
|
||||||
Model.vertex = new_vertex;
|
Model.vertex = new_vertex;
|
||||||
Model.vertexCnt = head.vertex.count;
|
Model.vertexCnt = head.vertex.count;
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
VertexDataTop = data = (void *)&file_vertex_real[head.vertex.count];
|
||||||
|
#else
|
||||||
file_vertex = (HsfBuffer *)((u32)fileptr+head.vertex.ofs);
|
file_vertex = (HsfBuffer *)((u32)fileptr+head.vertex.ofs);
|
||||||
VertexDataTop = data = (void *)&file_vertex[head.vertex.count];
|
VertexDataTop = data = (void *)&file_vertex[head.vertex.count];
|
||||||
|
#endif
|
||||||
for(i=0; i<head.vertex.count; i++, new_vertex++, file_vertex++) {
|
for(i=0; i<head.vertex.count; i++, new_vertex++, file_vertex++) {
|
||||||
temp_data = file_vertex->data;
|
temp_data = file_vertex->data;
|
||||||
new_vertex->count = file_vertex->count;
|
new_vertex->count = file_vertex->count;
|
||||||
new_vertex->name = SetName((u32 *)&file_vertex->name);
|
new_vertex->name = SetName((u32 *)&file_vertex->name);
|
||||||
new_vertex->data = (void *)((u32)data+(u32)temp_data);
|
new_vertex->data = (void *)((uintptr_t)data + (uintptr_t)temp_data);
|
||||||
for(j=0; j<new_vertex->count; j++) {
|
for(j=0; j<new_vertex->count; j++) {
|
||||||
data_elem = (HsfVector3f *)(((u32)data)+((u32)temp_data)+(j*sizeof(HsfVector3f)));
|
data_elem = (HsfVector3f *)((uintptr_t)data + (uintptr_t)temp_data + (j * sizeof(HsfVector3f)));
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
byteswap_hsfvec3f(data_elem);
|
||||||
|
#endif
|
||||||
((HsfVector3f *)new_vertex->data)[j].x = data_elem->x;
|
((HsfVector3f *)new_vertex->data)[j].x = data_elem->x;
|
||||||
((HsfVector3f *)new_vertex->data)[j].y = data_elem->y;
|
((HsfVector3f *)new_vertex->data)[j].y = data_elem->y;
|
||||||
((HsfVector3f *)new_vertex->data)[j].z = data_elem->z;
|
((HsfVector3f *)new_vertex->data)[j].z = data_elem->z;
|
||||||
|
|
@ -348,18 +434,38 @@ static void NormalLoad(void)
|
||||||
|
|
||||||
if(head.normal.count) {
|
if(head.normal.count) {
|
||||||
s32 cenv_count = head.cenv.count;
|
s32 cenv_count = head.cenv.count;
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
HsfBuffer32b *file_normal_real = (HsfBuffer32b *)((uintptr_t)fileptr + head.normal.ofs);
|
||||||
|
temp_normal = file_normal = NormalTop = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfBuffer) * head.normal.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.normal.count; i++) {
|
||||||
|
byteswap_hsfbuffer(&file_normal_real[i], &file_normal[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
temp_normal = file_normal = (HsfBuffer *)((u32)fileptr+head.normal.ofs);
|
temp_normal = file_normal = (HsfBuffer *)((u32)fileptr+head.normal.ofs);
|
||||||
data = (void *)&file_normal[head.normal.count];
|
data = (void *)&file_normal[head.normal.count];
|
||||||
|
#endif
|
||||||
new_normal = temp_normal;
|
new_normal = temp_normal;
|
||||||
Model.normal = new_normal;
|
Model.normal = new_normal;
|
||||||
Model.normalCnt = head.normal.count;
|
Model.normalCnt = head.normal.count;
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
VertexDataTop = data = (void *)&file_normal_real[head.normal.count];
|
||||||
|
#else
|
||||||
file_normal = (HsfBuffer *)((u32)fileptr+head.normal.ofs);
|
file_normal = (HsfBuffer *)((u32)fileptr+head.normal.ofs);
|
||||||
NormalDataTop = data = (void *)&file_normal[head.normal.count];
|
NormalDataTop = data = (void *)&file_normal[head.normal.count];
|
||||||
|
#endif
|
||||||
for(i=0; i<head.normal.count; i++, new_normal++, file_normal++) {
|
for(i=0; i<head.normal.count; i++, new_normal++, file_normal++) {
|
||||||
temp_data = file_normal->data;
|
temp_data = file_normal->data;
|
||||||
new_normal->count = file_normal->count;
|
new_normal->count = file_normal->count;
|
||||||
new_normal->name = SetName((u32 *)&file_normal->name);
|
new_normal->name = SetName((u32 *)&file_normal->name);
|
||||||
new_normal->data = (void *)((u32)data+(u32)temp_data);
|
new_normal->data = (void *)((uintptr_t)data+(uintptr_t)temp_data);
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
if (cenv_count != 0) {
|
||||||
|
for (i = 0; i < new_normal->count; i++) {
|
||||||
|
HsfVector3f *normalData = &((HsfVector3f *)new_normal->data)[i];
|
||||||
|
byteswap_hsfvec3f(normalData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -375,6 +481,13 @@ static void STLoad(void)
|
||||||
void *temp_data;
|
void *temp_data;
|
||||||
|
|
||||||
if(head.st.count) {
|
if(head.st.count) {
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
HsfBuffer32b *file_st_real = (HsfBuffer32b *)((uintptr_t)fileptr + head.st.ofs);
|
||||||
|
temp_st = file_st = StTop = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfBuffer) * head.st.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.st.count; i++) {
|
||||||
|
byteswap_hsfbuffer(&file_st_real[i], &file_st[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
temp_st = file_st = (HsfBuffer *)((u32)fileptr+head.st.ofs);
|
temp_st = file_st = (HsfBuffer *)((u32)fileptr+head.st.ofs);
|
||||||
data = (void *)&file_st[head.st.count];
|
data = (void *)&file_st[head.st.count];
|
||||||
for(i=0; i<head.st.count; i++, file_st++) {
|
for(i=0; i<head.st.count; i++, file_st++) {
|
||||||
|
|
@ -382,18 +495,26 @@ static void STLoad(void)
|
||||||
data_elem = (HsfVector2f *)(((u32)data)+((u32)file_st->data)+(j*sizeof(HsfVector2f)));
|
data_elem = (HsfVector2f *)(((u32)data)+((u32)file_st->data)+(j*sizeof(HsfVector2f)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
new_st = temp_st;
|
new_st = temp_st;
|
||||||
Model.st = new_st;
|
Model.st = new_st;
|
||||||
Model.stCnt = head.st.count;
|
Model.stCnt = head.st.count;
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
data = (void *)&file_st_real[head.st.count];
|
||||||
|
#else
|
||||||
file_st = (HsfBuffer *)((u32)fileptr+head.st.ofs);
|
file_st = (HsfBuffer *)((u32)fileptr+head.st.ofs);
|
||||||
data = (void *)&file_st[head.st.count];
|
data = (void *)&file_st[head.st.count];
|
||||||
|
#endif
|
||||||
for(i=0; i<head.st.count; i++, new_st++, file_st++) {
|
for(i=0; i<head.st.count; i++, new_st++, file_st++) {
|
||||||
temp_data = file_st->data;
|
temp_data = file_st->data;
|
||||||
new_st->count = file_st->count;
|
new_st->count = file_st->count;
|
||||||
new_st->name = SetName((u32 *)&file_st->name);
|
new_st->name = SetName((u32 *)&file_st->name);
|
||||||
new_st->data = (void *)((u32)data+(u32)temp_data);
|
new_st->data = (void *)((uintptr_t)data + (uintptr_t)temp_data);
|
||||||
for(j=0; j<new_st->count; j++) {
|
for(j=0; j<new_st->count; j++) {
|
||||||
data_elem = (HsfVector2f *)(((u32)data)+((u32)temp_data)+(j*sizeof(HsfVector2f)));
|
data_elem = (HsfVector2f *)((uintptr_t)data + (uintptr_t)temp_data + (j*sizeof(HsfVector2f)));
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
byteswap_hsfvec2f(data_elem);
|
||||||
|
#endif
|
||||||
((HsfVector2f *)new_st->data)[j].x = data_elem->x;
|
((HsfVector2f *)new_st->data)[j].x = data_elem->x;
|
||||||
((HsfVector2f *)new_st->data)[j].y = data_elem->y;
|
((HsfVector2f *)new_st->data)[j].y = data_elem->y;
|
||||||
}
|
}
|
||||||
|
|
@ -415,26 +536,57 @@ static void FaceLoad(void)
|
||||||
s32 j;
|
s32 j;
|
||||||
|
|
||||||
if(head.face.count) {
|
if(head.face.count) {
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
HsfBuffer32b *file_face_real = (HsfBuffer32b *)((uintptr_t)fileptr + head.face.ofs);
|
||||||
|
HsfFace32b *file_facedata_real = (HsfFace32b *)&file_face_real[head.face.count];
|
||||||
|
temp_face = file_face = FaceTop = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfBuffer) * head.face.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.face.count; i++) {
|
||||||
|
byteswap_hsfbuffer(&file_face_real[i], &file_face[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
temp_face = file_face = (HsfBuffer *)((u32)fileptr+head.face.ofs);
|
temp_face = file_face = (HsfBuffer *)((u32)fileptr+head.face.ofs);
|
||||||
data = (HsfFace *)&file_face[head.face.count];
|
data = (HsfFace *)&file_face[head.face.count];
|
||||||
|
#endif
|
||||||
new_face = temp_face;
|
new_face = temp_face;
|
||||||
Model.face = new_face;
|
Model.face = new_face;
|
||||||
Model.faceCnt = head.face.count;
|
Model.faceCnt = head.face.count;
|
||||||
|
#ifdef __MWERKS__
|
||||||
file_face = (HsfBuffer *)((u32)fileptr+head.face.ofs);
|
file_face = (HsfBuffer *)((u32)fileptr+head.face.ofs);
|
||||||
data = (HsfFace *)&file_face[head.face.count];
|
data = (HsfFace *)&file_face[head.face.count];
|
||||||
|
#endif
|
||||||
for(i=0; i<head.face.count; i++, new_face++, file_face++) {
|
for(i=0; i<head.face.count; i++, new_face++, file_face++) {
|
||||||
temp_data = file_face->data;
|
temp_data = file_face->data;
|
||||||
new_face->name = SetName((u32 *)&file_face->name);
|
new_face->name = SetName((u32 *)&file_face->name);
|
||||||
new_face->count = file_face->count;
|
new_face->count = file_face->count;
|
||||||
new_face->data = (void *)((u32)data+(u32)temp_data);
|
#ifdef TARGET_PC
|
||||||
|
{
|
||||||
|
HsfFace32b *facedata_start = (HsfFace32b *)((uintptr_t)file_facedata_real + (uintptr_t)temp_data);
|
||||||
|
data = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfFace) * new_face->count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (j = 0; j < new_face->count; j++) {
|
||||||
|
byteswap_hsfface(&facedata_start[j], &data[j]);
|
||||||
|
}
|
||||||
|
new_face->data = data;
|
||||||
|
strip = (u8 *)(&facedata_start[new_face->count]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
new_face->data = (void *)((uintptr_t)data+(uintptr_t)temp_data);
|
||||||
strip = (u8 *)(&((HsfFace *)new_face->data)[new_face->count]);
|
strip = (u8 *)(&((HsfFace *)new_face->data)[new_face->count]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
new_face = temp_face;
|
new_face = temp_face;
|
||||||
for(i=0; i<head.face.count; i++, new_face++) {
|
for(i=0; i<head.face.count; i++, new_face++) {
|
||||||
file_face_strip = new_face_strip = new_face->data;
|
file_face_strip = new_face_strip = new_face->data;
|
||||||
for(j=0; j<new_face->count; j++, new_face_strip++, file_face_strip++) {
|
for(j=0; j<new_face->count; j++, new_face_strip++, file_face_strip++) {
|
||||||
if(AS_U16(file_face_strip->type) == 4) {
|
if(AS_U16(file_face_strip->type) == 4) {
|
||||||
new_face_strip->strip.data = (s16 *)(strip+(u32)file_face_strip->strip.data*(sizeof(s16)*4));
|
new_face_strip->strip.data = (s16 *)(strip+(uintptr_t)file_face_strip->strip.data*(sizeof(s16)*4));
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
{
|
||||||
|
s32 k;
|
||||||
|
for (k = 0; k < new_face_strip->strip.count; k++) {
|
||||||
|
byteswap_s16(&new_face_strip->strip.data[k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -463,9 +615,9 @@ static void DispObject(HsfObject *parent, HsfObject *object)
|
||||||
data = &object->data;
|
data = &object->data;
|
||||||
new_object = temp_object = object;
|
new_object = temp_object = object;
|
||||||
new_object->data.childrenCount = data->childrenCount;
|
new_object->data.childrenCount = data->childrenCount;
|
||||||
new_object->data.children = (HsfObject **)&NSymIndex[(u32)data->children];
|
new_object->data.children = (HsfObject **)&NSymIndex[(uintptr_t)data->children];
|
||||||
for(i=0; i<new_object->data.childrenCount; i++) {
|
for(i=0; i<new_object->data.childrenCount; i++) {
|
||||||
child_obj = &objtop[(u32)new_object->data.children[i]];
|
child_obj = &objtop[(uintptr_t)new_object->data.children[i]];
|
||||||
new_object->data.children[i] = child_obj;
|
new_object->data.children[i] = child_obj;
|
||||||
}
|
}
|
||||||
new_object->data.parent = parent;
|
new_object->data.parent = parent;
|
||||||
|
|
@ -478,14 +630,14 @@ static void DispObject(HsfObject *parent, HsfObject *object)
|
||||||
new_object->data.st = SearchStPtr((s32)data->st);
|
new_object->data.st = SearchStPtr((s32)data->st);
|
||||||
new_object->data.color = SearchColorPtr((s32)data->color);
|
new_object->data.color = SearchColorPtr((s32)data->color);
|
||||||
new_object->data.face = SearchFacePtr((s32)data->face);
|
new_object->data.face = SearchFacePtr((s32)data->face);
|
||||||
new_object->data.vertexShape = (HsfBuffer **)&NSymIndex[(u32)data->vertexShape];
|
new_object->data.vertexShape = (HsfBuffer **)&NSymIndex[(uintptr_t)data->vertexShape];
|
||||||
for(i=0; i<new_object->data.vertexShapeCnt; i++) {
|
for(i=0; i<new_object->data.vertexShapeCnt; i++) {
|
||||||
temp.shape = &vtxtop[(u32)new_object->data.vertexShape[i]];
|
temp.shape = &vtxtop[(uintptr_t)new_object->data.vertexShape[i]];
|
||||||
new_object->data.vertexShape[i] = temp.shape;
|
new_object->data.vertexShape[i] = temp.shape;
|
||||||
}
|
}
|
||||||
new_object->data.cluster = (HsfCluster **)&NSymIndex[(u32)data->cluster];
|
new_object->data.cluster = (HsfCluster **)&NSymIndex[(uintptr_t)data->cluster];
|
||||||
for(i=0; i<new_object->data.clusterCnt; i++) {
|
for(i=0; i<new_object->data.clusterCnt; i++) {
|
||||||
temp.cluster = &ClusterTop[(u32)new_object->data.cluster[i]];
|
temp.cluster = &ClusterTop[(uintptr_t)new_object->data.cluster[i]];
|
||||||
new_object->data.cluster[i] = temp.cluster;
|
new_object->data.cluster[i] = temp.cluster;
|
||||||
}
|
}
|
||||||
new_object->data.cenv = SearchCenvPtr((s32)data->cenv);
|
new_object->data.cenv = SearchCenvPtr((s32)data->cenv);
|
||||||
|
|
@ -495,8 +647,8 @@ static void DispObject(HsfObject *parent, HsfObject *object)
|
||||||
} else {
|
} else {
|
||||||
new_object->data.attribute = NULL;
|
new_object->data.attribute = NULL;
|
||||||
}
|
}
|
||||||
new_object->data.file[0] = (void *)((u32)fileptr+(u32)data->file[0]);
|
new_object->data.file[0] = (void *)((uintptr_t)fileptr + (uintptr_t)data->file[0]);
|
||||||
new_object->data.file[1] = (void *)((u32)fileptr+(u32)data->file[1]);
|
new_object->data.file[1] = (void *)((uintptr_t)fileptr + (uintptr_t)data->file[1]);
|
||||||
new_object->data.base.pos.x = data->base.pos.x;
|
new_object->data.base.pos.x = data->base.pos.x;
|
||||||
new_object->data.base.pos.y = data->base.pos.y;
|
new_object->data.base.pos.y = data->base.pos.y;
|
||||||
new_object->data.base.pos.z = data->base.pos.z;
|
new_object->data.base.pos.z = data->base.pos.z;
|
||||||
|
|
@ -526,9 +678,9 @@ static void DispObject(HsfObject *parent, HsfObject *object)
|
||||||
new_object = temp_object = object;
|
new_object = temp_object = object;
|
||||||
new_object->data.parent = parent;
|
new_object->data.parent = parent;
|
||||||
new_object->data.childrenCount = data->childrenCount;
|
new_object->data.childrenCount = data->childrenCount;
|
||||||
new_object->data.children = (HsfObject **)&NSymIndex[(u32)data->children];
|
new_object->data.children = (HsfObject **)&NSymIndex[(uintptr_t)data->children];
|
||||||
for(i=0; i<new_object->data.childrenCount; i++) {
|
for(i=0; i<new_object->data.childrenCount; i++) {
|
||||||
child_obj = &objtop[(u32)new_object->data.children[i]];
|
child_obj = &objtop[(uintptr_t)new_object->data.children[i]];
|
||||||
new_object->data.children[i] = child_obj;
|
new_object->data.children[i] = child_obj;
|
||||||
}
|
}
|
||||||
if(Model.root == NULL) {
|
if(Model.root == NULL) {
|
||||||
|
|
@ -548,15 +700,15 @@ static void DispObject(HsfObject *parent, HsfObject *object)
|
||||||
new_object = temp_object = object;
|
new_object = temp_object = object;
|
||||||
new_object->data.parent = parent;
|
new_object->data.parent = parent;
|
||||||
new_object->data.childrenCount = data->childrenCount;
|
new_object->data.childrenCount = data->childrenCount;
|
||||||
new_object->data.children = (HsfObject **)&NSymIndex[(u32)data->children];
|
new_object->data.children = (HsfObject **)&NSymIndex[(uintptr_t)data->children];
|
||||||
for(i=0; i<new_object->data.childrenCount; i++) {
|
for(i=0; i<new_object->data.childrenCount; i++) {
|
||||||
child_obj = &objtop[(u32)new_object->data.children[i]];
|
child_obj = &objtop[(uintptr_t)new_object->data.children[i]];
|
||||||
new_object->data.children[i] = child_obj;
|
new_object->data.children[i] = child_obj;
|
||||||
}
|
}
|
||||||
if(Model.root == NULL) {
|
if(Model.root == NULL) {
|
||||||
Model.root = temp_object;
|
Model.root = temp_object;
|
||||||
}
|
}
|
||||||
new_object->data.replica = &objtop[(u32)new_object->data.replica];
|
new_object->data.replica = &objtop[(uintptr_t)new_object->data.replica];
|
||||||
for(i=0; i<data->childrenCount; i++) {
|
for(i=0; i<data->childrenCount; i++) {
|
||||||
DispObject(new_object, new_object->data.children[i]);
|
DispObject(new_object, new_object->data.children[i]);
|
||||||
}
|
}
|
||||||
|
|
@ -691,7 +843,15 @@ static void ObjectLoad(void)
|
||||||
s32 obj_type;
|
s32 obj_type;
|
||||||
|
|
||||||
if(head.object.count) {
|
if(head.object.count) {
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
HsfObject32b *file_object_real = (HsfObject32b *)((uintptr_t)fileptr + head.object.ofs);
|
||||||
|
objtop = object = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfObject) * head.object.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.object.count; i++) {
|
||||||
|
byteswap_hsfobject(&file_object_real[i], &objtop[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
objtop = object = (HsfObject *)((u32)fileptr+head.object.ofs);
|
objtop = object = (HsfObject *)((u32)fileptr+head.object.ofs);
|
||||||
|
#endif
|
||||||
for(i=0; i<head.object.count; i++, object++) {
|
for(i=0; i<head.object.count; i++, object++) {
|
||||||
new_object = object;
|
new_object = object;
|
||||||
new_object->name = SetName((u32 *)&object->name);
|
new_object->name = SetName((u32 *)&object->name);
|
||||||
|
|
@ -729,24 +889,37 @@ static void CenvLoad(void)
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
if(head.cenv.count) {
|
if(head.cenv.count) {
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
HsfCenv32b *file_cenv_real = (HsfCenv32b *)((uintptr_t)fileptr + head.cenv.ofs);
|
||||||
|
cenv_file = CenvTop = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfCenv) * head.cenv.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.cenv.count; i++) {
|
||||||
|
byteswap_hsfcenv(&file_cenv_real[i], &cenv_file[i]);
|
||||||
|
}
|
||||||
|
data_base = &file_cenv_real[head.cenv.count];
|
||||||
|
#else
|
||||||
cenv_file = (HsfCenv *)((u32)fileptr+head.cenv.ofs);
|
cenv_file = (HsfCenv *)((u32)fileptr+head.cenv.ofs);
|
||||||
data_base = &cenv_file[head.cenv.count];
|
data_base = &cenv_file[head.cenv.count];
|
||||||
|
#endif
|
||||||
weight_base = data_base;
|
weight_base = data_base;
|
||||||
cenv_new = cenv_file;
|
cenv_new = cenv_file;
|
||||||
Model.cenvCnt = head.cenv.count;
|
Model.cenvCnt = head.cenv.count;
|
||||||
Model.cenv = cenv_file;
|
Model.cenv = cenv_file;
|
||||||
for(i=0; i<head.cenv.count; i++) {
|
for(i=0; i<head.cenv.count; i++) {
|
||||||
cenv_new[i].singleData = (HsfCenvSingle *)((u32)cenv_file[i].singleData+(u32)data_base);
|
cenv_new[i].singleData = (HsfCenvSingle *)((uintptr_t)cenv_file[i].singleData + (uintptr_t)data_base);
|
||||||
cenv_new[i].dualData = (HsfCenvDual *)((u32)cenv_file[i].dualData+(u32)data_base);
|
cenv_new[i].dualData = (HsfCenvDual *)((uintptr_t)cenv_file[i].dualData + (uintptr_t)data_base);
|
||||||
cenv_new[i].multiData = (HsfCenvMulti *)((u32)cenv_file[i].multiData+(u32)data_base);
|
cenv_new[i].multiData = (HsfCenvMulti *)((uintptr_t)cenv_file[i].multiData + (uintptr_t)data_base);
|
||||||
cenv_new[i].singleCount = cenv_file[i].singleCount;
|
cenv_new[i].singleCount = cenv_file[i].singleCount;
|
||||||
cenv_new[i].dualCount = cenv_file[i].dualCount;
|
cenv_new[i].dualCount = cenv_file[i].dualCount;
|
||||||
cenv_new[i].multiCount = cenv_file[i].multiCount;
|
cenv_new[i].multiCount = cenv_file[i].multiCount;
|
||||||
cenv_new[i].copyCount = cenv_file[i].copyCount;
|
cenv_new[i].copyCount = cenv_file[i].copyCount;
|
||||||
cenv_new[i].vtxCount = cenv_file[i].vtxCount;
|
cenv_new[i].vtxCount = cenv_file[i].vtxCount;
|
||||||
weight_base = (void *)((u32)weight_base+(cenv_new[i].singleCount*sizeof(HsfCenvSingle)));
|
weight_base = (void *)((uintptr_t)weight_base + (cenv_new[i].singleCount * sizeof(HsfCenvSingle)));
|
||||||
weight_base = (void *)((u32)weight_base+(cenv_new[i].dualCount*sizeof(HsfCenvDual)));
|
weight_base = (void *)((uintptr_t)weight_base + (cenv_new[i].dualCount * sizeof(HsfCenvDual)));
|
||||||
weight_base = (void *)((u32)weight_base+(cenv_new[i].multiCount*sizeof(HsfCenvMulti)));
|
weight_base = (void *)((uintptr_t)weight_base + (cenv_new[i].multiCount * sizeof(HsfCenvMulti)));
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
byteswap_hsfcenv_single(cenv_new[i].singleData);
|
||||||
|
// TODO PC malloc dual, multi etc and byteswap them
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
for(i=0; i<head.cenv.count; i++) {
|
for(i=0; i<head.cenv.count; i++) {
|
||||||
single_new = single_file = cenv_new[i].singleData;
|
single_new = single_file = cenv_new[i].singleData;
|
||||||
|
|
@ -763,7 +936,7 @@ static void CenvLoad(void)
|
||||||
dual_new[j].target1 = dual_file[j].target1;
|
dual_new[j].target1 = dual_file[j].target1;
|
||||||
dual_new[j].target2 = dual_file[j].target2;
|
dual_new[j].target2 = dual_file[j].target2;
|
||||||
dual_new[j].weightCnt = dual_file[j].weightCnt;
|
dual_new[j].weightCnt = dual_file[j].weightCnt;
|
||||||
dual_new[j].weight = (HsfCenvDualWeight *)((u32)weight_base+(u32)dual_file[j].weight);
|
dual_new[j].weight = (HsfCenvDualWeight *)((uintptr_t)weight_base + (uintptr_t)dual_file[j].weight);
|
||||||
}
|
}
|
||||||
multi_new = multi_file = cenv_new[i].multiData;
|
multi_new = multi_file = cenv_new[i].multiData;
|
||||||
for(j=0; j<cenv_new[i].multiCount; j++) {
|
for(j=0; j<cenv_new[i].multiCount; j++) {
|
||||||
|
|
@ -772,7 +945,7 @@ static void CenvLoad(void)
|
||||||
multi_new[j].posCnt = multi_file[j].posCnt;
|
multi_new[j].posCnt = multi_file[j].posCnt;
|
||||||
multi_new[j].normal = multi_file[j].normal;
|
multi_new[j].normal = multi_file[j].normal;
|
||||||
multi_new[j].normalCnt = multi_file[j].normalCnt;
|
multi_new[j].normalCnt = multi_file[j].normalCnt;
|
||||||
multi_new[j].weight = (HsfCenvMultiWeight *)((u32)weight_base+(u32)multi_file[j].weight);
|
multi_new[j].weight = (HsfCenvMultiWeight *)((uintptr_t)weight_base + (uintptr_t)multi_file[j].weight);
|
||||||
}
|
}
|
||||||
dual_new = dual_file = cenv_new[i].dualData;
|
dual_new = dual_file = cenv_new[i].dualData;
|
||||||
for(j=0; j<cenv_new[i].dualCount; j++) {
|
for(j=0; j<cenv_new[i].dualCount; j++) {
|
||||||
|
|
@ -795,7 +968,15 @@ static void SkeletonLoad(void)
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
if(head.skeleton.count) {
|
if(head.skeleton.count) {
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
HsfSkeleton32b *file_skeleton_real = (HsfSkeleton32b *)((uintptr_t)fileptr + head.skeleton.ofs);
|
||||||
|
skeleton_new = skeleton_file = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfSkeleton) * head.skeleton.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.skeleton.count; i++) {
|
||||||
|
byteswap_hsfskeleton(&file_skeleton_real[i], &skeleton_file[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
skeleton_new = skeleton_file = (HsfSkeleton *)((u32)fileptr+head.skeleton.ofs);
|
skeleton_new = skeleton_file = (HsfSkeleton *)((u32)fileptr+head.skeleton.ofs);
|
||||||
|
#endif
|
||||||
Model.skeletonCnt = head.skeleton.count;
|
Model.skeletonCnt = head.skeleton.count;
|
||||||
Model.skeleton = skeleton_file;
|
Model.skeleton = skeleton_file;
|
||||||
for(i=0; i<head.skeleton.count; i++) {
|
for(i=0; i<head.skeleton.count; i++) {
|
||||||
|
|
@ -822,16 +1003,31 @@ static void PartLoad(void)
|
||||||
s32 i, j;
|
s32 i, j;
|
||||||
|
|
||||||
if(head.part.count) {
|
if(head.part.count) {
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
HsfPart32b *file_part_real = (HsfPart32b *)((uintptr_t)fileptr + head.part.ofs);
|
||||||
|
part_new = part_file = PartTop = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfPart) * head.part.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.part.count; i++) {
|
||||||
|
byteswap_hsfpart(&file_part_real[i], &part_file[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
part_new = part_file = (HsfPart *)((u32)fileptr+head.part.ofs);
|
part_new = part_file = (HsfPart *)((u32)fileptr+head.part.ofs);
|
||||||
|
#endif
|
||||||
Model.partCnt = head.part.count;
|
Model.partCnt = head.part.count;
|
||||||
Model.part = part_file;
|
Model.part = part_file;
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
data = (u16 *)&file_part_real[head.part.count];
|
||||||
|
#else
|
||||||
data = (u16 *)&part_file[head.part.count];
|
data = (u16 *)&part_file[head.part.count];
|
||||||
|
#endif
|
||||||
for(i=0; i<head.part.count; i++, part_new++) {
|
for(i=0; i<head.part.count; i++, part_new++) {
|
||||||
part_new->name = SetName((u32 *)&part_file[i].name);
|
part_new->name = SetName((u32 *)&part_file[i].name);
|
||||||
part_new->count = part_file[i].count;
|
part_new->count = part_file[i].count;
|
||||||
part_new->vertex = &data[(u32)part_file[i].vertex];
|
part_new->vertex = &data[(uintptr_t)part_file[i].vertex];
|
||||||
for(j=0; j<part_new->count; j++) {
|
for(j=0; j<part_new->count; j++) {
|
||||||
part_new->vertex[j] = part_new->vertex[j];
|
part_new->vertex[j] = part_new->vertex[j];
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
byteswap_u16(&part_new->vertex[j]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -845,7 +1041,11 @@ static void ClusterLoad(void)
|
||||||
s32 i, j;
|
s32 i, j;
|
||||||
|
|
||||||
if(head.cluster.count) {
|
if(head.cluster.count) {
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
cluster_new = cluster_file = ClusterTop;
|
||||||
|
#else
|
||||||
cluster_new = cluster_file = (HsfCluster *)((u32)fileptr+head.cluster.ofs);
|
cluster_new = cluster_file = (HsfCluster *)((u32)fileptr+head.cluster.ofs);
|
||||||
|
#endif
|
||||||
Model.clusterCnt = head.cluster.count;
|
Model.clusterCnt = head.cluster.count;
|
||||||
Model.cluster = cluster_file;
|
Model.cluster = cluster_file;
|
||||||
for(i=0; i<head.cluster.count; i++) {
|
for(i=0; i<head.cluster.count; i++) {
|
||||||
|
|
@ -858,7 +1058,7 @@ static void ClusterLoad(void)
|
||||||
cluster_new[i].unk95 = cluster_file[i].unk95;
|
cluster_new[i].unk95 = cluster_file[i].unk95;
|
||||||
cluster_new[i].type = cluster_file[i].type;
|
cluster_new[i].type = cluster_file[i].type;
|
||||||
cluster_new[i].vertexCnt = cluster_file[i].vertexCnt;
|
cluster_new[i].vertexCnt = cluster_file[i].vertexCnt;
|
||||||
vertexSym = (u32)cluster_file[i].vertex;
|
vertexSym = (uintptr_t)cluster_file[i].vertex;
|
||||||
cluster_new[i].vertex = (HsfBuffer **)&NSymIndex[vertexSym];
|
cluster_new[i].vertex = (HsfBuffer **)&NSymIndex[vertexSym];
|
||||||
for(j=0; j<cluster_new[i].vertexCnt; j++) {
|
for(j=0; j<cluster_new[i].vertexCnt; j++) {
|
||||||
vertex = SearchVertexPtr((s32)cluster_new[i].vertex[j]);
|
vertex = SearchVertexPtr((s32)cluster_new[i].vertex[j]);
|
||||||
|
|
@ -875,7 +1075,15 @@ static void ShapeLoad(void)
|
||||||
HsfShape *shape_file;
|
HsfShape *shape_file;
|
||||||
|
|
||||||
if(head.shape.count) {
|
if(head.shape.count) {
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
HsfShape32b *file_shape_real = (HsfShape32b *)((uintptr_t)fileptr + head.shape.ofs);
|
||||||
|
shape_new = shape_file = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfShape) * head.shape.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.shape.count; i++) {
|
||||||
|
byteswap_hsfshape(&file_shape_real[i], &shape_file[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
shape_new = shape_file = (HsfShape *)((u32)fileptr+head.shape.ofs);
|
shape_new = shape_file = (HsfShape *)((u32)fileptr+head.shape.ofs);
|
||||||
|
#endif
|
||||||
Model.shapeCnt = head.shape.count;
|
Model.shapeCnt = head.shape.count;
|
||||||
Model.shape = shape_file;
|
Model.shape = shape_file;
|
||||||
for(i=0; i<Model.shapeCnt; i++) {
|
for(i=0; i<Model.shapeCnt; i++) {
|
||||||
|
|
@ -885,7 +1093,7 @@ static void ShapeLoad(void)
|
||||||
shape_new[i].name = SetName((u32 *)&shape_file[i].name);
|
shape_new[i].name = SetName((u32 *)&shape_file[i].name);
|
||||||
shape_new[i].count16[0] = shape_file[i].count16[0];
|
shape_new[i].count16[0] = shape_file[i].count16[0];
|
||||||
shape_new[i].count16[1] = shape_file[i].count16[1];
|
shape_new[i].count16[1] = shape_file[i].count16[1];
|
||||||
vertexSym = (u32)shape_file[i].vertex;
|
vertexSym = (uintptr_t)shape_file[i].vertex;
|
||||||
shape_new[i].vertex = (HsfBuffer **)&NSymIndex[vertexSym];
|
shape_new[i].vertex = (HsfBuffer **)&NSymIndex[vertexSym];
|
||||||
for(j=0; j<shape_new[i].count16[1]; j++) {
|
for(j=0; j<shape_new[i].count16[1]; j++) {
|
||||||
vertex = &vtxtop[(u32)shape_new[i].vertex[j]];
|
vertex = &vtxtop[(u32)shape_new[i].vertex[j]];
|
||||||
|
|
@ -904,11 +1112,23 @@ static void MapAttrLoad(void)
|
||||||
u16 *data;
|
u16 *data;
|
||||||
|
|
||||||
if(head.mapAttr.count) {
|
if(head.mapAttr.count) {
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
HsfMapAttr32b *file_mapattr_real = (HsfMapAttr32b *)((uintptr_t)fileptr + head.mapAttr.ofs);
|
||||||
|
mapattr_file = mapattr_base = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfMapAttr) * head.mapAttr.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.mapAttr.count; i++) {
|
||||||
|
byteswap_hsfmapattr(&file_mapattr_real[i], &mapattr_base[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
mapattr_file = mapattr_base = (HsfMapAttr *)((u32)fileptr+head.mapAttr.ofs);
|
mapattr_file = mapattr_base = (HsfMapAttr *)((u32)fileptr+head.mapAttr.ofs);
|
||||||
|
#endif
|
||||||
mapattr_new = mapattr_base;
|
mapattr_new = mapattr_base;
|
||||||
Model.mapAttrCnt = head.mapAttr.count;
|
Model.mapAttrCnt = head.mapAttr.count;
|
||||||
Model.mapAttr = mapattr_base;
|
Model.mapAttr = mapattr_base;
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
data = (u16 *)&file_mapattr_real[head.part.count];
|
||||||
|
#else
|
||||||
data = (u16 *)&mapattr_base[head.mapAttr.count];
|
data = (u16 *)&mapattr_base[head.mapAttr.count];
|
||||||
|
#endif
|
||||||
for(i=0; i<head.mapAttr.count; i++, mapattr_file++, mapattr_new++) {
|
for(i=0; i<head.mapAttr.count; i++, mapattr_file++, mapattr_new++) {
|
||||||
mapattr_new->data = &data[(u32)mapattr_file->data];
|
mapattr_new->data = &data[(u32)mapattr_file->data];
|
||||||
}
|
}
|
||||||
|
|
@ -925,14 +1145,26 @@ static void BitmapLoad(void)
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
if(head.bitmap.count) {
|
if(head.bitmap.count) {
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
HsfBitmap32b *file_bitmap_real = (HsfBitmap32b *)((uintptr_t)fileptr + head.bitmap.ofs);
|
||||||
|
bitmap_temp = bitmap_file = BitmapTop = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfBitmap) * head.bitmap.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.bitmap.count; i++) {
|
||||||
|
byteswap_hsfbitmap(&file_bitmap_real[i], &bitmap_file[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
bitmap_temp = bitmap_file = (HsfBitmap *)((u32)fileptr+head.bitmap.ofs);
|
bitmap_temp = bitmap_file = (HsfBitmap *)((u32)fileptr+head.bitmap.ofs);
|
||||||
data = &bitmap_file[head.bitmap.count];
|
data = &bitmap_file[head.bitmap.count];
|
||||||
for(i=0; i<head.bitmap.count; i++, bitmap_file++);
|
for(i=0; i<head.bitmap.count; i++, bitmap_file++);
|
||||||
|
#endif
|
||||||
bitmap_new = bitmap_temp;
|
bitmap_new = bitmap_temp;
|
||||||
Model.bitmap = bitmap_file;
|
Model.bitmap = bitmap_file;
|
||||||
Model.bitmapCnt = head.bitmap.count;
|
Model.bitmapCnt = head.bitmap.count;
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
data = (void *)&file_bitmap_real[head.st.count];
|
||||||
|
#else
|
||||||
bitmap_file = (HsfBitmap *)((u32)fileptr+head.bitmap.ofs);
|
bitmap_file = (HsfBitmap *)((u32)fileptr+head.bitmap.ofs);
|
||||||
data = &bitmap_file[head.bitmap.count];
|
data = &bitmap_file[head.bitmap.count];
|
||||||
|
#endif
|
||||||
for(i=0; i<head.bitmap.count; i++, bitmap_file++, bitmap_new++) {
|
for(i=0; i<head.bitmap.count; i++, bitmap_file++, bitmap_new++) {
|
||||||
bitmap_new->name = SetName((u32 *)&bitmap_file->name);
|
bitmap_new->name = SetName((u32 *)&bitmap_file->name);
|
||||||
bitmap_new->dataFmt = bitmap_file->dataFmt;
|
bitmap_new->dataFmt = bitmap_file->dataFmt;
|
||||||
|
|
@ -940,11 +1172,11 @@ static void BitmapLoad(void)
|
||||||
bitmap_new->sizeX = bitmap_file->sizeX;
|
bitmap_new->sizeX = bitmap_file->sizeX;
|
||||||
bitmap_new->sizeY = bitmap_file->sizeY;
|
bitmap_new->sizeY = bitmap_file->sizeY;
|
||||||
bitmap_new->palSize = bitmap_file->palSize;
|
bitmap_new->palSize = bitmap_file->palSize;
|
||||||
palette = SearchPalettePtr((u32)bitmap_file->palData);
|
palette = SearchPalettePtr((uintptr_t)bitmap_file->palData);
|
||||||
if(palette) {
|
if(palette) {
|
||||||
bitmap_new->palData = palette->data;
|
bitmap_new->palData = palette->data;
|
||||||
}
|
}
|
||||||
bitmap_new->data = (void *)((u32)data+(u32)bitmap_file->data);
|
bitmap_new->data = (void *)((uintptr_t)data+(uintptr_t)bitmap_file->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -962,24 +1194,39 @@ static void PaletteLoad(void)
|
||||||
u16 *data;
|
u16 *data;
|
||||||
|
|
||||||
if(head.palette.count) {
|
if(head.palette.count) {
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
HsfPalette32b *file_palette_real = (HsfPalette32b *)((uintptr_t)fileptr + head.palette.ofs);
|
||||||
|
palette_temp = palette_file = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfPalette) * head.palette.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.palette.count; i++) {
|
||||||
|
byteswap_hsfpalette(&file_palette_real[i], &palette_file[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
palette_temp = palette_file = (HsfPalette *)((u32)fileptr+head.palette.ofs);
|
palette_temp = palette_file = (HsfPalette *)((u32)fileptr+head.palette.ofs);
|
||||||
data_base = (u16 *)&palette_file[head.palette.count];
|
data_base = (u16 *)&palette_file[head.palette.count];
|
||||||
for(i=0; i<head.palette.count; i++, palette_file++) {
|
for(i=0; i<head.palette.count; i++, palette_file++) {
|
||||||
temp_data = (u16 *)((u32)data_base+(u32)palette_file->data);
|
temp_data = (u16 *)((uintptr_t)data_base+(uintptr_t)palette_file->data);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
Model.palette = palette_temp;
|
Model.palette = palette_temp;
|
||||||
Model.paletteCnt = head.palette.count;
|
Model.paletteCnt = head.palette.count;
|
||||||
palette_new = palette_temp;
|
palette_new = palette_temp;
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
data_base = (u16 *)&file_palette_real[head.palette.count];
|
||||||
|
#else
|
||||||
palette_file = (HsfPalette *)((u32)fileptr+head.palette.ofs);
|
palette_file = (HsfPalette *)((u32)fileptr+head.palette.ofs);
|
||||||
data_base = (u16 *)&palette_file[head.palette.count];
|
data_base = (u16 *)&palette_file[head.palette.count];
|
||||||
|
#endif
|
||||||
for(i=0; i<head.palette.count; i++, palette_file++, palette_new++) {
|
for(i=0; i<head.palette.count; i++, palette_file++, palette_new++) {
|
||||||
temp_data = (u16 *)((u32)data_base+(u32)palette_file->data);
|
temp_data = (u16 *)((uintptr_t)data_base+(uintptr_t)palette_file->data);
|
||||||
data = temp_data;
|
data = temp_data;
|
||||||
palette_new->name = SetName((u32 *)&palette_file->name);
|
palette_new->name = SetName((u32 *)&palette_file->name);
|
||||||
palette_new->data = data;
|
palette_new->data = data;
|
||||||
palette_new->palSize = palette_file->palSize;
|
palette_new->palSize = palette_file->palSize;
|
||||||
for(j=0; j<palette_file->palSize; j++) {
|
for(j=0; j<palette_file->palSize; j++) {
|
||||||
data[j] = data[j];
|
data[j] = data[j];
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
byteswap_u16(&data[j]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1126,21 +1373,21 @@ static inline void MotionLoadTransform(HsfTrack *track, void *data)
|
||||||
switch(track->curveType) {
|
switch(track->curveType) {
|
||||||
case HSF_CURVE_STEP:
|
case HSF_CURVE_STEP:
|
||||||
{
|
{
|
||||||
step_data = (float *)((u32)data+(u32)track->data);
|
step_data = (float *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
out_track->data = step_data;
|
out_track->data = step_data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HSF_CURVE_LINEAR:
|
case HSF_CURVE_LINEAR:
|
||||||
{
|
{
|
||||||
linear_data = (float *)((u32)data+(u32)track->data);
|
linear_data = (float *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
out_track->data = linear_data;
|
out_track->data = linear_data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HSF_CURVE_BEZIER:
|
case HSF_CURVE_BEZIER:
|
||||||
{
|
{
|
||||||
bezier_data = (float *)((u32)data+(u32)track->data);
|
bezier_data = (float *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
out_track->data = bezier_data;
|
out_track->data = bezier_data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1171,21 +1418,21 @@ static inline void MotionLoadCluster(HsfTrack *track, void *data)
|
||||||
switch(track->curveType) {
|
switch(track->curveType) {
|
||||||
case HSF_CURVE_STEP:
|
case HSF_CURVE_STEP:
|
||||||
{
|
{
|
||||||
step_data = (float *)((u32)data+(u32)track->data);
|
step_data = (float *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
out_track->data = step_data;
|
out_track->data = step_data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HSF_CURVE_LINEAR:
|
case HSF_CURVE_LINEAR:
|
||||||
{
|
{
|
||||||
linear_data = (float *)((u32)data+(u32)track->data);
|
linear_data = (float *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
out_track->data = linear_data;
|
out_track->data = linear_data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HSF_CURVE_BEZIER:
|
case HSF_CURVE_BEZIER:
|
||||||
{
|
{
|
||||||
bezier_data = (float *)((u32)data+(u32)track->data);
|
bezier_data = (float *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
out_track->data = bezier_data;
|
out_track->data = bezier_data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1216,21 +1463,21 @@ static inline void MotionLoadClusterWeight(HsfTrack *track, void *data)
|
||||||
switch(track->curveType) {
|
switch(track->curveType) {
|
||||||
case HSF_CURVE_STEP:
|
case HSF_CURVE_STEP:
|
||||||
{
|
{
|
||||||
step_data = (float *)((u32)data+(u32)track->data);
|
step_data = (float *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
out_track->data = step_data;
|
out_track->data = step_data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HSF_CURVE_LINEAR:
|
case HSF_CURVE_LINEAR:
|
||||||
{
|
{
|
||||||
linear_data = (float *)((u32)data+(u32)track->data);
|
linear_data = (float *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
out_track->data = linear_data;
|
out_track->data = linear_data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HSF_CURVE_BEZIER:
|
case HSF_CURVE_BEZIER:
|
||||||
{
|
{
|
||||||
bezier_data = (float *)((u32)data+(u32)track->data);
|
bezier_data = (float *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
out_track->data = bezier_data;
|
out_track->data = bezier_data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1252,21 +1499,21 @@ static inline void MotionLoadMaterial(HsfTrack *track, void *data)
|
||||||
switch(track->curveType) {
|
switch(track->curveType) {
|
||||||
case HSF_CURVE_STEP:
|
case HSF_CURVE_STEP:
|
||||||
{
|
{
|
||||||
step_data = (float *)((u32)data+(u32)track->data);
|
step_data = (float *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
out_track->data = step_data;
|
out_track->data = step_data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HSF_CURVE_LINEAR:
|
case HSF_CURVE_LINEAR:
|
||||||
{
|
{
|
||||||
linear_data = (float *)((u32)data+(u32)track->data);
|
linear_data = (float *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
out_track->data = linear_data;
|
out_track->data = linear_data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HSF_CURVE_BEZIER:
|
case HSF_CURVE_BEZIER:
|
||||||
{
|
{
|
||||||
bezier_data = (float *)((u32)data+(u32)track->data);
|
bezier_data = (float *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
out_track->data = bezier_data;
|
out_track->data = bezier_data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1299,30 +1546,38 @@ static inline void MotionLoadAttribute(HsfTrack *track, void *data)
|
||||||
switch(track->curveType) {
|
switch(track->curveType) {
|
||||||
case HSF_CURVE_STEP:
|
case HSF_CURVE_STEP:
|
||||||
{
|
{
|
||||||
step_data = (float *)((u32)data+(u32)track->data);
|
step_data = (float *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
out_track->data = step_data;
|
out_track->data = step_data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HSF_CURVE_LINEAR:
|
case HSF_CURVE_LINEAR:
|
||||||
{
|
{
|
||||||
linear_data = (float *)((u32)data+(u32)track->data);
|
linear_data = (float *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
out_track->data = linear_data;
|
out_track->data = linear_data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HSF_CURVE_BEZIER:
|
case HSF_CURVE_BEZIER:
|
||||||
{
|
{
|
||||||
bezier_data = (float *)((u32)data+(u32)track->data);
|
bezier_data = (float *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
out_track->data = bezier_data;
|
out_track->data = bezier_data;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HSF_CURVE_BITMAP:
|
case HSF_CURVE_BITMAP:
|
||||||
{
|
{
|
||||||
new_frame = file_frame = (HsfBitmapKey *)((u32)data+(u32)track->data);
|
#ifdef TARGET_PC
|
||||||
|
HsfBitmapKey32b *file_frame_real = (HsfBitmapKey32b *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
|
new_frame = file_frame = track->dataTop = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfBitmapKey) * track->numKeyframes, MEMORY_DEFAULT_NUM);
|
||||||
|
#else
|
||||||
|
new_frame = file_frame = (HsfBitmapKey *)((uintptr_t)data + (uintptr_t)track->data);
|
||||||
out_track->data = file_frame;
|
out_track->data = file_frame;
|
||||||
|
#endif
|
||||||
for(i=0; i<out_track->numKeyframes; i++, file_frame++, new_frame++) {
|
for(i=0; i<out_track->numKeyframes; i++, file_frame++, new_frame++) {
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
byteswap_hsfbitmapkey(&file_frame_real[i], new_frame);
|
||||||
|
#endif
|
||||||
new_frame->data = SearchBitmapPtr((s32)file_frame->data);
|
new_frame->data = SearchBitmapPtr((s32)file_frame->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1344,12 +1599,31 @@ static void MotionLoad(void)
|
||||||
MotionOnly = FALSE;
|
MotionOnly = FALSE;
|
||||||
MotionModel = NULL;
|
MotionModel = NULL;
|
||||||
if(head.motion.count) {
|
if(head.motion.count) {
|
||||||
temp_motion = file_motion = (HsfMotion *)((u32)fileptr+head.motion.ofs);
|
#ifdef TARGET_PC
|
||||||
|
HsfMotion32b *file_motion_real = (HsfMotion32b *)((uintptr_t)fileptr + head.motion.ofs);
|
||||||
|
temp_motion = file_motion = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfMotion) * head.motion.count, MEMORY_DEFAULT_NUM);
|
||||||
|
for (i = 0; i < head.motion.count; i++) {
|
||||||
|
byteswap_hsfmotion(&file_motion_real[i], &file_motion[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
temp_motion = file_motion = (HsfMotion *)((uintptr_t)fileptr+head.motion.ofs);
|
||||||
|
#endif
|
||||||
new_motion = temp_motion;
|
new_motion = temp_motion;
|
||||||
Model.motion = new_motion;
|
Model.motion = new_motion;
|
||||||
Model.motionCnt = file_motion->numTracks;
|
Model.motionCnt = file_motion->numTracks;
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
{
|
||||||
|
HsfTrack32b *track_base_real = (HsfTrack32b *)&file_motion_real[head.motion.count];
|
||||||
|
track_base = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfTrack) * file_motion->numTracks, MEMORY_DEFAULT_NUM);
|
||||||
|
track_data = &track_base_real[file_motion->numTracks];
|
||||||
|
for (i = 0; i < file_motion->numTracks; i++) {
|
||||||
|
byteswap_hsftrack(&track_base_real[i], &track_base[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
track_base = (HsfTrack *)&file_motion[head.motion.count];
|
track_base = (HsfTrack *)&file_motion[head.motion.count];
|
||||||
track_data = &track_base[file_motion->numTracks];
|
track_data = &track_base[file_motion->numTracks];
|
||||||
|
#endif
|
||||||
new_motion->track = track_base;
|
new_motion->track = track_base;
|
||||||
for(i=0; i<(s32)file_motion->numTracks; i++) {
|
for(i=0; i<(s32)file_motion->numTracks; i++) {
|
||||||
switch(track_base[i].type) {
|
switch(track_base[i].type) {
|
||||||
|
|
@ -1410,8 +1684,13 @@ static void MatrixLoad(void)
|
||||||
HsfMatrix *matrix_file;
|
HsfMatrix *matrix_file;
|
||||||
|
|
||||||
if(head.matrix.count) {
|
if(head.matrix.count) {
|
||||||
matrix_file = (HsfMatrix *)((u32)fileptr+head.matrix.ofs);
|
#ifdef TARGET_PC
|
||||||
|
matrix_file = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfMatrix) * head.matrix.count, MEMORY_DEFAULT_NUM);
|
||||||
|
byteswap_hsfmatrix((HsfMatrix *)((uintptr_t)fileptr + head.matrix.ofs));
|
||||||
|
#else
|
||||||
|
matrix_file = (HsfMatrix *)((uintptr_t)fileptr+head.matrix.ofs);
|
||||||
matrix_file->data = (Mtx *)((u32)fileptr+head.matrix.ofs+sizeof(HsfMatrix));
|
matrix_file->data = (Mtx *)((u32)fileptr+head.matrix.ofs+sizeof(HsfMatrix));
|
||||||
|
#endif
|
||||||
Model.matrix = matrix_file;
|
Model.matrix = matrix_file;
|
||||||
Model.matrixCnt = head.matrix.count;
|
Model.matrixCnt = head.matrix.count;
|
||||||
}
|
}
|
||||||
|
|
@ -1436,7 +1715,11 @@ static HsfBuffer *SearchVertexPtr(s32 id)
|
||||||
if(id == -1) {
|
if(id == -1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
vertex = (HsfBuffer *)((u32)fileptr+head.vertex.ofs);
|
#ifdef TARGET_PC
|
||||||
|
vertex = vtxtop;
|
||||||
|
#else
|
||||||
|
vertex = (HsfBuffer *)((uintptr_t)fileptr+head.vertex.ofs);
|
||||||
|
#endif
|
||||||
vertex += id;
|
vertex += id;
|
||||||
return vertex;
|
return vertex;
|
||||||
}
|
}
|
||||||
|
|
@ -1447,7 +1730,11 @@ static HsfBuffer *SearchNormalPtr(s32 id)
|
||||||
if(id == -1) {
|
if(id == -1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
normal = (HsfBuffer *)((u32)fileptr+head.normal.ofs);
|
#ifdef TARGET_PC
|
||||||
|
normal = NormalTop;
|
||||||
|
#else
|
||||||
|
normal = (HsfBuffer *)((uintptr_t)fileptr+head.normal.ofs);
|
||||||
|
#endif
|
||||||
normal += id;
|
normal += id;
|
||||||
return normal;
|
return normal;
|
||||||
}
|
}
|
||||||
|
|
@ -1458,7 +1745,11 @@ static HsfBuffer *SearchStPtr(s32 id)
|
||||||
if(id == -1) {
|
if(id == -1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
st = (HsfBuffer *)((u32)fileptr+head.st.ofs);
|
#ifdef TARGET_PC
|
||||||
|
st = StTop;
|
||||||
|
#else
|
||||||
|
st = (HsfBuffer *)((uintptr_t)fileptr+head.st.ofs);
|
||||||
|
#endif
|
||||||
st += id;
|
st += id;
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
@ -1469,7 +1760,11 @@ static HsfBuffer *SearchColorPtr(s32 id)
|
||||||
if(id == -1) {
|
if(id == -1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
color = (HsfBuffer *)((u32)fileptr+head.color.ofs);
|
#ifdef TARGET_PC
|
||||||
|
color = ColorTop;
|
||||||
|
#else
|
||||||
|
color = (HsfBuffer *)((uintptr_t)fileptr+head.color.ofs);
|
||||||
|
#endif
|
||||||
color += id;
|
color += id;
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
@ -1480,7 +1775,11 @@ static HsfBuffer *SearchFacePtr(s32 id)
|
||||||
if(id == -1) {
|
if(id == -1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
face = (HsfBuffer *)((u32)fileptr+head.face.ofs);
|
#ifdef TARGET_PC
|
||||||
|
face = FaceTop;
|
||||||
|
#else
|
||||||
|
face = (HsfBuffer *)((uintptr_t)fileptr+head.face.ofs);
|
||||||
|
#endif
|
||||||
face += id;
|
face += id;
|
||||||
return face;
|
return face;
|
||||||
}
|
}
|
||||||
|
|
@ -1491,7 +1790,11 @@ static HsfCenv *SearchCenvPtr(s32 id)
|
||||||
if(id == -1) {
|
if(id == -1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
cenv = (HsfCenv *)((u32)fileptr+head.cenv.ofs);
|
#ifdef TARGET_PC
|
||||||
|
cenv = CenvTop;
|
||||||
|
#else
|
||||||
|
cenv = (HsfCenv *)((uintptr_t)fileptr + head.cenv.ofs);
|
||||||
|
#endif
|
||||||
cenv += id;
|
cenv += id;
|
||||||
return cenv;
|
return cenv;
|
||||||
}
|
}
|
||||||
|
|
@ -1502,7 +1805,11 @@ static HsfPart *SearchPartPtr(s32 id)
|
||||||
if(id == -1) {
|
if(id == -1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
part = (HsfPart *)((u32)fileptr+head.part.ofs);
|
#ifdef TARGET_PC
|
||||||
|
part = PartTop;
|
||||||
|
#else
|
||||||
|
part = (HsfPart *)((uintptr_t)fileptr+head.part.ofs);
|
||||||
|
#endif
|
||||||
part += id;
|
part += id;
|
||||||
return part;
|
return part;
|
||||||
}
|
}
|
||||||
|
|
@ -1524,7 +1831,11 @@ static HsfBitmap *SearchBitmapPtr(s32 id)
|
||||||
if(id == -1) {
|
if(id == -1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
bitmap = (HsfBitmap *)((u32)fileptr+head.bitmap.ofs);
|
#ifdef TARGET_PC
|
||||||
|
bitmap = BitmapTop;
|
||||||
|
#else
|
||||||
|
bitmap = (HsfBitmap *)((uintptr_t)fileptr+head.bitmap.ofs);
|
||||||
|
#endif
|
||||||
bitmap += id;
|
bitmap += id;
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
@ -1540,3 +1851,44 @@ static char *GetMotionString(u16 *str_ofs)
|
||||||
char *ret = &StringTable[*str_ofs];
|
char *ret = &StringTable[*str_ofs];
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
void KillHSF(HsfData *data)
|
||||||
|
{
|
||||||
|
s32 i, j;
|
||||||
|
HuMemDirectFree(data->attribute);
|
||||||
|
HuMemDirectFree(data->bitmap);
|
||||||
|
HuMemDirectFree(data->cenv);
|
||||||
|
HuMemDirectFree(data->skeleton);
|
||||||
|
for (i = 0; i < data->faceCnt; i++) {
|
||||||
|
HuMemDirectFree(data->face[i].data);
|
||||||
|
}
|
||||||
|
HuMemDirectFree(data->face);
|
||||||
|
HuMemDirectFree(data->material);
|
||||||
|
for (i = 0; i < data->motionCnt; i++) {
|
||||||
|
HsfMotion *motion = &data->motion[i];
|
||||||
|
for (j = 0; j < motion->numTracks; j++) {
|
||||||
|
HsfTrack *track = data->motion[i].track;
|
||||||
|
if (track->type == HSF_TRACK_ATTRIBUTE && track->curveType == HSF_CURVE_BITMAP) {
|
||||||
|
// in this case we needed to allocate space for HsfBitmapKey structs
|
||||||
|
HuMemDirectFree(track->dataTop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HuMemDirectFree(motion->track);
|
||||||
|
}
|
||||||
|
HuMemDirectFree(data->motion);
|
||||||
|
HuMemDirectFree(data->normal);
|
||||||
|
HuMemDirectFree(data->object);
|
||||||
|
HuMemDirectFree(data->matrix);
|
||||||
|
HuMemDirectFree(data->palette);
|
||||||
|
HuMemDirectFree(data->st);
|
||||||
|
HuMemDirectFree(data->vertex);
|
||||||
|
HuMemDirectFree(data->cenv);
|
||||||
|
HuMemDirectFree(data->cluster);
|
||||||
|
HuMemDirectFree(data->part);
|
||||||
|
HuMemDirectFree(data->shape);
|
||||||
|
HuMemDirectFree(data->mapAttr);
|
||||||
|
HuMemDirectFree(data->symbol);
|
||||||
|
// TODO PC free embedded data
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ s32 shadowModelDrawF;
|
||||||
s16 Hu3DProjectionNum;
|
s16 Hu3DProjectionNum;
|
||||||
s16 Hu3DCameraNo;
|
s16 Hu3DCameraNo;
|
||||||
s16 Hu3DCameraBit;
|
s16 Hu3DCameraBit;
|
||||||
u32 Hu3DMallocNo;
|
uintptr_t Hu3DMallocNo;
|
||||||
s16 Hu3DPauseF;
|
s16 Hu3DPauseF;
|
||||||
u16 Hu3DCameraExistF;
|
u16 Hu3DCameraExistF;
|
||||||
static u16 NoSyncF;
|
static u16 NoSyncF;
|
||||||
|
|
@ -350,7 +350,7 @@ s16 Hu3DModelCreate(void *arg0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
var_r31->hsfData = LoadHSF(arg0);
|
var_r31->hsfData = LoadHSF(arg0);
|
||||||
var_r31->unk_48 = Hu3DMallocNo = (u32)var_r31->hsfData;
|
var_r31->unk_48 = Hu3DMallocNo = (uintptr_t)var_r31->hsfData;
|
||||||
var_r31->attr = HU3D_ATTR_NONE;
|
var_r31->attr = HU3D_ATTR_NONE;
|
||||||
var_r31->motion_attr = HU3D_ATTR_NONE;
|
var_r31->motion_attr = HU3D_ATTR_NONE;
|
||||||
var_r31->unk_02 = 0;
|
var_r31->unk_02 = 0;
|
||||||
|
|
@ -453,7 +453,7 @@ s16 Hu3DModelLink(s16 arg0) {
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
var_r31->unk_10[i] = temp_r30->unk_10[i];
|
var_r31->unk_10[i] = temp_r30->unk_10[i];
|
||||||
if (var_r31->unk_10[i] != -1) {
|
if (var_r31->unk_10[i] != -1) {
|
||||||
ClusterAdjustObject(var_r31->hsfData, Hu3DMotion[var_r31->unk_10[i]].unk_04);
|
ClusterAdjustObject(var_r31->hsfData, Hu3DMotion[var_r31->unk_10[i]].hsfData);
|
||||||
var_r31->attr |= HU3D_ATTR_CLUSTER_ON;
|
var_r31->attr |= HU3D_ATTR_CLUSTER_ON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -564,6 +564,9 @@ void Hu3DModelKill(s16 arg0) {
|
||||||
}
|
}
|
||||||
Hu3DAnimModelKill(arg0);
|
Hu3DAnimModelKill(arg0);
|
||||||
if (temp_r31->unk_24 != -1) {
|
if (temp_r31->unk_24 != -1) {
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
KillHSF(temp_r31->hsfData);
|
||||||
|
#endif
|
||||||
HuMemDirectFree(temp_r31->hsfData);
|
HuMemDirectFree(temp_r31->hsfData);
|
||||||
HuMemDirectFreeNum(HEAP_DATA, temp_r31->unk_4C);
|
HuMemDirectFreeNum(HEAP_DATA, temp_r31->unk_4C);
|
||||||
var_r28 = temp_r31->unk_C8;
|
var_r28 = temp_r31->unk_C8;
|
||||||
|
|
@ -581,7 +584,7 @@ void Hu3DModelKill(s16 arg0) {
|
||||||
if (temp_r31->unk_20 != -1) {
|
if (temp_r31->unk_20 != -1) {
|
||||||
for (i = 0; i < HU3D_MODEL_MAX; i++, var_r30++) {
|
for (i = 0; i < HU3D_MODEL_MAX; i++, var_r30++) {
|
||||||
if (var_r30->hsfData != 0 && var_r30->unk_24 != -1 && var_r30->unk_C8 == var_r28) {
|
if (var_r30->hsfData != 0 && var_r30->unk_24 != -1 && var_r30->unk_C8 == var_r28) {
|
||||||
Hu3DMotion[temp_r31->unk_20].unk_02 = i;
|
Hu3DMotion[temp_r31->unk_20].modelId = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -592,7 +595,7 @@ void Hu3DModelKill(s16 arg0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (temp_r31->unk_20 != -1 && Hu3DMotionKill(temp_r31->unk_20) == 0) {
|
if (temp_r31->unk_20 != -1 && Hu3DMotionKill(temp_r31->unk_20) == 0) {
|
||||||
Hu3DMotion[temp_r31->unk_20].unk_02 = -1;
|
Hu3DMotion[temp_r31->unk_20].modelId = -1;
|
||||||
HuMemDirectFreeNum(HEAP_DATA, temp_r31->unk_48);
|
HuMemDirectFreeNum(HEAP_DATA, temp_r31->unk_48);
|
||||||
temp_r31->hsfData = NULL;
|
temp_r31->hsfData = NULL;
|
||||||
if (modelKillAllF == 0) {
|
if (modelKillAllF == 0) {
|
||||||
|
|
@ -600,6 +603,9 @@ void Hu3DModelKill(s16 arg0) {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#ifdef TARGET_PC
|
||||||
|
KillHSF(temp_r31->hsfData);
|
||||||
|
#endif
|
||||||
HuMemDirectFree(temp_r31->hsfData);
|
HuMemDirectFree(temp_r31->hsfData);
|
||||||
HuMemDirectFreeNum(HEAP_DATA, temp_r31->unk_48);
|
HuMemDirectFreeNum(HEAP_DATA, temp_r31->unk_48);
|
||||||
for (i = 0; i < temp_r31->unk_26; i++) {
|
for (i = 0; i < temp_r31->unk_26; i++) {
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -59,7 +59,7 @@ void *HuMemDirectMalloc(HeapID heap, s32 size)
|
||||||
return HuMemMemoryAlloc(HeapTbl[heap], size, retaddr);
|
return HuMemMemoryAlloc(HeapTbl[heap], size, retaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *HuMemDirectMallocNum(HeapID heap, s32 size, u32 num)
|
void *HuMemDirectMallocNum(HeapID heap, s32 size, uintptr_t num)
|
||||||
{
|
{
|
||||||
#ifdef TARGET_PC
|
#ifdef TARGET_PC
|
||||||
u32 retaddr = 0;
|
u32 retaddr = 0;
|
||||||
|
|
@ -86,7 +86,7 @@ void HuMemDirectFree(void *ptr)
|
||||||
HuMemMemoryFree(ptr, retaddr);
|
HuMemMemoryFree(ptr, retaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HuMemDirectFreeNum(HeapID heap, u32 num)
|
void HuMemDirectFreeNum(HeapID heap, uintptr_t num)
|
||||||
{
|
{
|
||||||
#ifdef TARGET_PC
|
#ifdef TARGET_PC
|
||||||
u32 retaddr = 0;
|
u32 retaddr = 0;
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,11 @@ struct memory_block {
|
||||||
u8 flag;
|
u8 flag;
|
||||||
struct memory_block *prev;
|
struct memory_block *prev;
|
||||||
struct memory_block *next;
|
struct memory_block *next;
|
||||||
u32 num;
|
uintptr_t num;
|
||||||
uintptr_t retaddr;
|
uintptr_t retaddr;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *HuMemMemoryAlloc2(void *heap_ptr, s32 size, u32 num, uintptr_t retaddr);
|
static void *HuMemMemoryAlloc2(void *heap_ptr, s32 size, uintptr_t num, uintptr_t retaddr);
|
||||||
|
|
||||||
void *HuMemHeapInit(void *ptr, s32 size)
|
void *HuMemHeapInit(void *ptr, s32 size)
|
||||||
{
|
{
|
||||||
|
|
@ -31,7 +31,7 @@ void *HuMemHeapInit(void *ptr, s32 size)
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *HuMemMemoryAllocNum(void *heap_ptr, s32 size, u32 num, uintptr_t retaddr)
|
void *HuMemMemoryAllocNum(void *heap_ptr, s32 size, uintptr_t num, uintptr_t retaddr)
|
||||||
{
|
{
|
||||||
return HuMemMemoryAlloc2(heap_ptr, size, num, retaddr);
|
return HuMemMemoryAlloc2(heap_ptr, size, num, retaddr);
|
||||||
}
|
}
|
||||||
|
|
@ -41,7 +41,7 @@ void *HuMemMemoryAlloc(void *heap_ptr, s32 size, uintptr_t retaddr)
|
||||||
return HuMemMemoryAlloc2(heap_ptr, size, -256, retaddr);
|
return HuMemMemoryAlloc2(heap_ptr, size, -256, retaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *HuMemMemoryAlloc2(void *heap_ptr, s32 size, u32 num, uintptr_t retaddr)
|
static void *HuMemMemoryAlloc2(void *heap_ptr, s32 size, uintptr_t num, uintptr_t retaddr)
|
||||||
{
|
{
|
||||||
s32 alloc_size = MEM_ALLOC_SIZE(size);
|
s32 alloc_size = MEM_ALLOC_SIZE(size);
|
||||||
struct memory_block *block = heap_ptr;
|
struct memory_block *block = heap_ptr;
|
||||||
|
|
@ -76,7 +76,7 @@ static void *HuMemMemoryAlloc2(void *heap_ptr, s32 size, u32 num, uintptr_t reta
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HuMemMemoryFreeNum(void *heap_ptr, u32 num, uintptr_t retaddr)
|
void HuMemMemoryFreeNum(void *heap_ptr, uintptr_t num, uintptr_t retaddr)
|
||||||
{
|
{
|
||||||
struct memory_block *block = heap_ptr;
|
struct memory_block *block = heap_ptr;
|
||||||
do {
|
do {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include "game/hsfformat.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
@ -5,8 +6,7 @@
|
||||||
#include <ext_math.h>
|
#include <ext_math.h>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#include "port/byteswap.h"
|
#include "port/byteswap.h"
|
||||||
|
|
||||||
typedef struct AnimData32b {
|
typedef struct AnimData32b {
|
||||||
|
|
@ -45,7 +45,6 @@ typedef struct AnimBmpData32b {
|
||||||
u32 palData;
|
u32 palData;
|
||||||
u32 data;
|
u32 data;
|
||||||
} AnimBmpData32b;
|
} AnimBmpData32b;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> [[nodiscard]] constexpr T bswap16(T val) noexcept
|
template <typename T> [[nodiscard]] constexpr T bswap16(T val) noexcept
|
||||||
|
|
@ -54,7 +53,7 @@ template <typename T> [[nodiscard]] constexpr T bswap16(T val) noexcept
|
||||||
union {
|
union {
|
||||||
u16 u;
|
u16 u;
|
||||||
T t;
|
T t;
|
||||||
} v{.t = val};
|
} v { .t = val };
|
||||||
#if __GNUC__
|
#if __GNUC__
|
||||||
v.u = __builtin_bswap16(v.u);
|
v.u = __builtin_bswap16(v.u);
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
|
|
@ -71,14 +70,13 @@ template <typename T> [[nodiscard]] constexpr T bswap32(T val) noexcept
|
||||||
union {
|
union {
|
||||||
u32 u;
|
u32 u;
|
||||||
T t;
|
T t;
|
||||||
} v{.t = val};
|
} v { .t = val };
|
||||||
#if __GNUC__
|
#if __GNUC__
|
||||||
v.u = __builtin_bswap32(v.u);
|
v.u = __builtin_bswap32(v.u);
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
v.u = _byteswap_ulong(v.u);
|
v.u = _byteswap_ulong(v.u);
|
||||||
#else
|
#else
|
||||||
v.u = ((v.u & 0x0000FFFF) << 16) | ((v.u & 0xFFFF0000) >> 16) | ((v.u & 0x00FF00FF) << 8) |
|
v.u = ((v.u & 0x0000FFFF) << 16) | ((v.u & 0xFFFF0000) >> 16) | ((v.u & 0x00FF00FF) << 8) | ((v.u & 0xFF00FF00) >> 8);
|
||||||
((v.u & 0xFF00FF00) >> 8);
|
|
||||||
#endif
|
#endif
|
||||||
return v.t;
|
return v.t;
|
||||||
}
|
}
|
||||||
|
|
@ -104,14 +102,11 @@ static std::unordered_set<void *> sVisitedPtrs;
|
||||||
|
|
||||||
template <typename B, typename T> T *offset_ptr(B &base, T *ptr)
|
template <typename B, typename T> T *offset_ptr(B &base, T *ptr)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<T *>(reinterpret_cast<uintptr_t>(&base) +
|
return reinterpret_cast<T *>(reinterpret_cast<uintptr_t>(&base) + reinterpret_cast<uintptr_t>(ptr));
|
||||||
reinterpret_cast<uintptr_t>(ptr));
|
|
||||||
}
|
}
|
||||||
template <typename B, typename T> T *offset_ptr(B &base, T *ptr, void *extra)
|
template <typename B, typename T> T *offset_ptr(B &base, T *ptr, void *extra)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<T *>(reinterpret_cast<uintptr_t>(&base) +
|
return reinterpret_cast<T *>(reinterpret_cast<uintptr_t>(&base) + reinterpret_cast<uintptr_t>(ptr) + reinterpret_cast<uintptr_t>(extra));
|
||||||
reinterpret_cast<uintptr_t>(ptr) +
|
|
||||||
reinterpret_cast<uintptr_t>(extra));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename B, typename T> static inline void bswap(B &base, T &data);
|
template <typename B, typename T> static inline void bswap(B &base, T &data);
|
||||||
|
|
@ -122,15 +117,12 @@ template <typename B, typename P> void bswap(B &base, P *&ptr)
|
||||||
template <typename B, typename T> void bswap(B &base, T *&ptr, s32 count)
|
template <typename B, typename T> void bswap(B &base, T *&ptr, s32 count)
|
||||||
{
|
{
|
||||||
ptr = bswap32(ptr);
|
ptr = bswap32(ptr);
|
||||||
if (ptr == nullptr)
|
if (ptr == nullptr) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
T *objBase = offset_ptr(base, ptr);
|
T *objBase = offset_ptr(base, ptr);
|
||||||
for (s32 i = 0; i < count; ++i)
|
for (s32 i = 0; i < count; ++i) {
|
||||||
{
|
if (sVisitedPtrs.contains(objBase)) {
|
||||||
if (sVisitedPtrs.contains(objBase))
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
sVisitedPtrs.insert(objBase);
|
sVisitedPtrs.insert(objBase);
|
||||||
|
|
@ -141,13 +133,11 @@ template <typename B, typename T> void bswap(B &base, T *&ptr, s32 count)
|
||||||
template <typename B, typename T> void bswap_list(B &base, T **&ptr)
|
template <typename B, typename T> void bswap_list(B &base, T **&ptr)
|
||||||
{
|
{
|
||||||
ptr = bswap32(ptr);
|
ptr = bswap32(ptr);
|
||||||
if (ptr == nullptr)
|
if (ptr == nullptr) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
T **objBase = offset_ptr(base, ptr);
|
T **objBase = offset_ptr(base, ptr);
|
||||||
while (*objBase != nullptr)
|
while (*objBase != nullptr) {
|
||||||
{
|
|
||||||
bswap(base, *objBase, 1);
|
bswap(base, *objBase, 1);
|
||||||
++objBase;
|
++objBase;
|
||||||
}
|
}
|
||||||
|
|
@ -155,8 +145,7 @@ template <typename B, typename T> void bswap_list(B &base, T **&ptr)
|
||||||
template <typename B, typename T> void bswap_list(B &base, T *(&ptr)[])
|
template <typename B, typename T> void bswap_list(B &base, T *(&ptr)[])
|
||||||
{
|
{
|
||||||
T **objBase = ptr;
|
T **objBase = ptr;
|
||||||
while (*objBase != nullptr)
|
while (*objBase != nullptr) {
|
||||||
{
|
|
||||||
bswap(base, *objBase, 1);
|
bswap(base, *objBase, 1);
|
||||||
++objBase;
|
++objBase;
|
||||||
}
|
}
|
||||||
|
|
@ -164,8 +153,7 @@ template <typename B, typename T> void bswap_list(B &base, T *(&ptr)[])
|
||||||
template <typename B, typename T> void bswap_flat(B &base, T *start, s32 count)
|
template <typename B, typename T> void bswap_flat(B &base, T *start, s32 count)
|
||||||
{
|
{
|
||||||
T *objBase = start;
|
T *objBase = start;
|
||||||
for (s32 i = 0; i < count; ++i)
|
for (s32 i = 0; i < count; ++i) {
|
||||||
{
|
|
||||||
bswap(base, objBase[i]);
|
bswap(base, objBase[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -219,6 +207,13 @@ template <typename B> void bswap(B &base, Vec2f &vec)
|
||||||
bswap(base, vec.y);
|
bswap(base, vec.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfVector3f &vec)
|
||||||
|
{
|
||||||
|
bswap(base, vec.x);
|
||||||
|
bswap(base, vec.y);
|
||||||
|
bswap(base, vec.z);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename B> void bswap(B &base, AnimData32b &obj, AnimData &dest)
|
template <typename B> void bswap(B &base, AnimData32b &obj, AnimData &dest)
|
||||||
{
|
{
|
||||||
bswap(base, obj.bankNum);
|
bswap(base, obj.bankNum);
|
||||||
|
|
@ -342,6 +337,427 @@ template <typename B> void bswap(B &base, HsfHeader &obj)
|
||||||
bswap(base, obj.string);
|
bswap(base, obj.string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfCluster32b &obj, HsfCluster &dest)
|
||||||
|
{
|
||||||
|
bswap(base, obj.name[0]);
|
||||||
|
bswap(base, obj.name[1]);
|
||||||
|
bswap(base, obj.targetName);
|
||||||
|
bswap(base, obj.part);
|
||||||
|
bswap(base, obj.index);
|
||||||
|
bswap_flat(base, obj.weight, sizeof(obj.weight) / sizeof(float));
|
||||||
|
bswap(base, obj.type);
|
||||||
|
bswap(base, obj.vertexCnt);
|
||||||
|
bswap(base, obj.vertex);
|
||||||
|
|
||||||
|
dest.name[0] = reinterpret_cast<char *>(obj.name[0]);
|
||||||
|
dest.name[1] = reinterpret_cast<char *>(obj.name[1]);
|
||||||
|
|
||||||
|
dest.targetName = reinterpret_cast<char *>(obj.targetName);
|
||||||
|
dest.index = obj.index;
|
||||||
|
std::copy(std::begin(obj.weight), std::end(obj.weight), dest.weight);
|
||||||
|
|
||||||
|
dest.adjusted = obj.adjusted;
|
||||||
|
dest.unk95 = obj.unk95;
|
||||||
|
dest.type = obj.type;
|
||||||
|
dest.vertexCnt = obj.vertexCnt;
|
||||||
|
dest.vertex = reinterpret_cast<HsfBuffer **>(obj.vertex);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfAttribute32b &obj, HsfAttribute &dest)
|
||||||
|
{
|
||||||
|
bswap(base, obj.name);
|
||||||
|
bswap(base, obj.unk04);
|
||||||
|
bswap(base, obj.unk0C);
|
||||||
|
bswap(base, obj.unk14);
|
||||||
|
bswap(base, obj.unk20);
|
||||||
|
bswap(base, obj.unk28);
|
||||||
|
bswap(base, obj.unk2C);
|
||||||
|
bswap(base, obj.unk30);
|
||||||
|
bswap(base, obj.unk34);
|
||||||
|
bswap(base, obj.wrap_s);
|
||||||
|
bswap(base, obj.wrap_t);
|
||||||
|
bswap(base, obj.unk78);
|
||||||
|
bswap(base, obj.flag);
|
||||||
|
bswap(base, obj.bitmap);
|
||||||
|
|
||||||
|
dest.name = reinterpret_cast<char *>(obj.name);
|
||||||
|
dest.unk04 = reinterpret_cast<struct hsfdraw_struct_01 *>(obj.unk04);
|
||||||
|
std::copy(std::begin(obj.unk8), std::end(obj.unk8), dest.unk8);
|
||||||
|
dest.unk0C = obj.unk0C;
|
||||||
|
std::copy(std::begin(obj.unk10), std::end(obj.unk10), dest.unk10);
|
||||||
|
dest.unk14 = obj.unk14;
|
||||||
|
std::copy(std::begin(obj.unk18), std::end(obj.unk18), dest.unk18);
|
||||||
|
dest.unk20 = obj.unk20;
|
||||||
|
std::copy(std::begin(obj.unk24), std::end(obj.unk24), dest.unk24);
|
||||||
|
dest.unk28 = obj.unk28;
|
||||||
|
dest.unk2C = obj.unk2C;
|
||||||
|
dest.unk30 = obj.unk30;
|
||||||
|
dest.unk34 = obj.unk34;
|
||||||
|
std::copy(std::begin(obj.unk38), std::end(obj.unk38), dest.unk38);
|
||||||
|
dest.wrap_s = obj.wrap_s;
|
||||||
|
dest.wrap_t = obj.wrap_t;
|
||||||
|
std::copy(std::begin(obj.unk6C), std::end(obj.unk6C), dest.unk6C);
|
||||||
|
dest.unk78 = obj.unk78;
|
||||||
|
dest.flag = obj.flag;
|
||||||
|
dest.bitmap = reinterpret_cast<HsfBitmap *>(obj.bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfMaterial32b &obj, HsfMaterial &dest)
|
||||||
|
{
|
||||||
|
bswap(base, obj.name);
|
||||||
|
bswap(base, obj.pass);
|
||||||
|
bswap(base, obj.hilite_scale);
|
||||||
|
bswap(base, obj.unk18);
|
||||||
|
bswap(base, obj.invAlpha);
|
||||||
|
bswap_flat(base, obj.unk20, sizeof(obj.unk20) / sizeof(float));
|
||||||
|
bswap(base, obj.refAlpha);
|
||||||
|
bswap(base, obj.unk2C);
|
||||||
|
bswap(base, obj.flags);
|
||||||
|
bswap(base, obj.numAttrs);
|
||||||
|
bswap(base, obj.attrs);
|
||||||
|
|
||||||
|
dest.name = reinterpret_cast<char *>(obj.name);
|
||||||
|
std::copy(std::begin(obj.unk4), std::end(obj.unk4), dest.unk4);
|
||||||
|
dest.pass = obj.pass;
|
||||||
|
dest.vtxMode = obj.vtxMode;
|
||||||
|
std::copy(std::begin(obj.litColor), std::end(obj.litColor), dest.litColor);
|
||||||
|
std::copy(std::begin(obj.color), std::end(obj.color), dest.color);
|
||||||
|
std::copy(std::begin(obj.shadowColor), std::end(obj.shadowColor), dest.shadowColor);
|
||||||
|
dest.hilite_scale = obj.hilite_scale;
|
||||||
|
dest.unk18 = obj.unk18;
|
||||||
|
dest.invAlpha = obj.invAlpha;
|
||||||
|
std::copy(std::begin(obj.unk20), std::end(obj.unk20), dest.unk20);
|
||||||
|
dest.refAlpha = obj.refAlpha;
|
||||||
|
dest.unk2C = obj.unk2C;
|
||||||
|
dest.flags = obj.flags;
|
||||||
|
dest.numAttrs = obj.numAttrs;
|
||||||
|
dest.attrs = reinterpret_cast<s32 *>(obj.attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfScene &obj)
|
||||||
|
{
|
||||||
|
u32 fogType = static_cast<u32>(obj.fogType);
|
||||||
|
fogType = bswap32(fogType);
|
||||||
|
obj.fogType = static_cast<GXFogType>(fogType);
|
||||||
|
bswap(base, obj.start);
|
||||||
|
bswap(base, obj.end);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfBuffer32b &obj, HsfBuffer &dest)
|
||||||
|
{
|
||||||
|
bswap(base, obj.name);
|
||||||
|
bswap(base, obj.count);
|
||||||
|
bswap(base, obj.data);
|
||||||
|
|
||||||
|
dest.name = reinterpret_cast<char *>(obj.name);
|
||||||
|
dest.count = obj.count;
|
||||||
|
dest.data = reinterpret_cast<void *>(obj.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfMatrix &obj)
|
||||||
|
{
|
||||||
|
bswap(base, obj.base_idx);
|
||||||
|
bswap(base, obj.count);
|
||||||
|
|
||||||
|
obj.data = (Mtx *)((uintptr_t)&obj + sizeof(0xC)); // hardcoded for 64 bit support
|
||||||
|
for (s32 i = 0; i < obj.count; i++) {
|
||||||
|
for (s32 j = 0; j < 3; j++) {
|
||||||
|
bswap_flat(base, obj.data[i][j], 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfPalette32b &obj, HsfPalette &dest)
|
||||||
|
{
|
||||||
|
bswap(base, obj.name);
|
||||||
|
bswap(base, obj.unk);
|
||||||
|
bswap(base, obj.palSize);
|
||||||
|
bswap(base, obj.data);
|
||||||
|
|
||||||
|
dest.name = reinterpret_cast<char *>(obj.name);
|
||||||
|
dest.unk = obj.unk;
|
||||||
|
dest.palSize = obj.palSize;
|
||||||
|
dest.data = reinterpret_cast<u16 *>(obj.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfPart32b &obj, HsfPart &dest)
|
||||||
|
{
|
||||||
|
bswap(base, obj.name);
|
||||||
|
bswap(base, obj.count);
|
||||||
|
bswap(base, obj.vertex);
|
||||||
|
|
||||||
|
dest.name = reinterpret_cast<char *>(obj.name);
|
||||||
|
dest.count = obj.count;
|
||||||
|
dest.vertex = reinterpret_cast<u16 *>(obj.vertex);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfBitmap32b &obj, HsfBitmap &dest)
|
||||||
|
{
|
||||||
|
bswap(base, obj.name);
|
||||||
|
bswap(base, obj.maxLod);
|
||||||
|
bswap(base, obj.sizeX);
|
||||||
|
bswap(base, obj.sizeY);
|
||||||
|
bswap(base, obj.palSize);
|
||||||
|
bswap(base, obj.palData);
|
||||||
|
bswap(base, obj.unk);
|
||||||
|
bswap(base, obj.data);
|
||||||
|
|
||||||
|
dest.name = reinterpret_cast<char *>(obj.name);
|
||||||
|
dest.maxLod = obj.maxLod;
|
||||||
|
dest.dataFmt = obj.dataFmt;
|
||||||
|
dest.pixSize = obj.pixSize;
|
||||||
|
dest.sizeX = obj.sizeX;
|
||||||
|
dest.sizeY = obj.sizeY;
|
||||||
|
dest.palSize = obj.palSize;
|
||||||
|
dest.tint = obj.tint;
|
||||||
|
dest.palData = reinterpret_cast<void *>(obj.palData);
|
||||||
|
dest.unk = obj.unk;
|
||||||
|
dest.data = reinterpret_cast<void *>(obj.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfMapAttr32b &obj, HsfMapAttr &dest)
|
||||||
|
{
|
||||||
|
bswap(base, obj.minX);
|
||||||
|
bswap(base, obj.minZ);
|
||||||
|
bswap(base, obj.maxX);
|
||||||
|
bswap(base, obj.maxZ);
|
||||||
|
bswap(base, obj.data);
|
||||||
|
bswap(base, obj.dataLen);
|
||||||
|
|
||||||
|
dest.minX = obj.minX;
|
||||||
|
dest.minZ = obj.minZ;
|
||||||
|
dest.maxX = obj.maxZ;
|
||||||
|
dest.data = reinterpret_cast<u16 *>(obj.data);
|
||||||
|
dest.dataLen = obj.dataLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfTransform &obj)
|
||||||
|
{
|
||||||
|
bswap(base, obj.pos);
|
||||||
|
bswap(base, obj.rot);
|
||||||
|
bswap(base, obj.scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfSkeleton32b &obj, HsfSkeleton &dest)
|
||||||
|
{
|
||||||
|
bswap(base, obj.name);
|
||||||
|
bswap(base, obj.transform);
|
||||||
|
|
||||||
|
dest.name = reinterpret_cast<char *>(obj.name);
|
||||||
|
dest.transform = obj.transform;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfShape32b &obj, HsfShape &dest)
|
||||||
|
{
|
||||||
|
bswap(base, obj.name);
|
||||||
|
bswap(base, obj.vertex);
|
||||||
|
|
||||||
|
dest.name = reinterpret_cast<char *>(obj.name);
|
||||||
|
dest.vertex = reinterpret_cast<HsfBuffer **>(obj.vertex);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfCenvSingle &obj)
|
||||||
|
{
|
||||||
|
bswap(base, obj.target);
|
||||||
|
bswap(base, obj.pos);
|
||||||
|
bswap(base, obj.posCnt);
|
||||||
|
bswap(base, obj.normal);
|
||||||
|
bswap(base, obj.normalCnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfCenv32b &obj, HsfCenv &dest)
|
||||||
|
{
|
||||||
|
bswap(base, obj.name);
|
||||||
|
bswap(base, obj.singleData);
|
||||||
|
bswap(base, obj.dualData);
|
||||||
|
bswap(base, obj.multiData);
|
||||||
|
bswap(base, obj.singleCount);
|
||||||
|
bswap(base, obj.dualCount);
|
||||||
|
bswap(base, obj.multiCount);
|
||||||
|
bswap(base, obj.vtxCount);
|
||||||
|
bswap(base, obj.copyCount);
|
||||||
|
|
||||||
|
dest.name = reinterpret_cast<char *>(obj.name);
|
||||||
|
dest.singleData = reinterpret_cast<HsfCenvSingle *>(obj.singleData);
|
||||||
|
dest.dualData = reinterpret_cast<HsfCenvDual *>(obj.dualData);
|
||||||
|
dest.multiData = reinterpret_cast<HsfCenvMulti *>(obj.multiData);
|
||||||
|
dest.singleCount = obj.singleCount;
|
||||||
|
dest.dualCount = obj.dualCount;
|
||||||
|
dest.multiCount = obj.multiCount;
|
||||||
|
dest.vtxCount = obj.vtxCount;
|
||||||
|
dest.copyCount = obj.copyCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfObjectData32b &obj, HsfObjectData &dest, u32 type)
|
||||||
|
{
|
||||||
|
bswap(base, obj.parent);
|
||||||
|
bswap(base, obj.childrenCount);
|
||||||
|
bswap(base, obj.children);
|
||||||
|
bswap(base, obj.base);
|
||||||
|
bswap(base, obj.curr);
|
||||||
|
bswap(base, obj.face);
|
||||||
|
bswap(base, obj.vertex);
|
||||||
|
bswap(base, obj.normal);
|
||||||
|
bswap(base, obj.color);
|
||||||
|
bswap(base, obj.st);
|
||||||
|
bswap(base, obj.material);
|
||||||
|
bswap(base, obj.attribute);
|
||||||
|
bswap(base, obj.vertexShapeCnt);
|
||||||
|
bswap(base, obj.vertexShape);
|
||||||
|
bswap(base, obj.clusterCnt);
|
||||||
|
bswap(base, obj.cluster);
|
||||||
|
bswap(base, obj.cenvCnt);
|
||||||
|
bswap(base, obj.cenv);
|
||||||
|
bswap_flat(base, obj.file, sizeof(obj.file) / sizeof(u32));
|
||||||
|
|
||||||
|
dest.parent = reinterpret_cast<struct hsf_object *>(obj.parent);
|
||||||
|
dest.childrenCount = obj.childrenCount;
|
||||||
|
dest.children = reinterpret_cast<struct hsf_object **>(obj.children);
|
||||||
|
dest.base = obj.base;
|
||||||
|
dest.curr = obj.curr;
|
||||||
|
dest.face = reinterpret_cast<HsfBuffer *>(obj.face);
|
||||||
|
dest.vertex = reinterpret_cast<HsfBuffer *>(obj.vertex);
|
||||||
|
dest.normal = reinterpret_cast<HsfBuffer *>(obj.normal);
|
||||||
|
dest.color = reinterpret_cast<HsfBuffer *>(obj.color);
|
||||||
|
dest.st = reinterpret_cast<HsfBuffer *>(obj.st);
|
||||||
|
dest.material = reinterpret_cast<HsfMaterial *>(obj.material);
|
||||||
|
dest.attribute = reinterpret_cast<HsfAttribute *>(obj.attribute);
|
||||||
|
std::copy(std::begin(obj.unk120), std::end(obj.unk120), dest.unk120);
|
||||||
|
dest.shapeType = obj.shapeType;
|
||||||
|
dest.unk123 = obj.unk123;
|
||||||
|
dest.vertexShapeCnt = obj.vertexShapeCnt;
|
||||||
|
dest.vertexShape = reinterpret_cast<HsfBuffer **>(obj.vertexShape);
|
||||||
|
dest.clusterCnt = obj.clusterCnt;
|
||||||
|
dest.cluster = reinterpret_cast<HsfCluster **>(obj.cluster);
|
||||||
|
dest.cenvCnt = obj.cenvCnt;
|
||||||
|
dest.cenv = reinterpret_cast<HsfCenv *>(obj.cenv);
|
||||||
|
dest.file[0] = reinterpret_cast<void *>(obj.file[0]);
|
||||||
|
dest.file[1] = reinterpret_cast<void *>(obj.file[1]);
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case HSF_OBJ_MESH:
|
||||||
|
bswap(base, obj.mesh.min);
|
||||||
|
bswap(base, obj.mesh.max);
|
||||||
|
bswap(base, obj.mesh.baseMorph);
|
||||||
|
bswap_flat(base, obj.mesh.morphWeight, std::size(obj.mesh.morphWeight));
|
||||||
|
|
||||||
|
dest.mesh.min = obj.mesh.min;
|
||||||
|
dest.mesh.max = obj.mesh.max;
|
||||||
|
dest.mesh.baseMorph = obj.mesh.baseMorph;
|
||||||
|
std::copy(std::begin(obj.mesh.morphWeight), std::end(obj.mesh.morphWeight), dest.mesh.morphWeight);
|
||||||
|
break;
|
||||||
|
case HSF_OBJ_REPLICA:
|
||||||
|
bswap(base, obj.replica);
|
||||||
|
|
||||||
|
dest.replica = obj.replica;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfObject32b &obj, HsfObject &dest)
|
||||||
|
{
|
||||||
|
bswap(base, obj.name);
|
||||||
|
bswap(base, obj.type);
|
||||||
|
bswap(base, obj.constData);
|
||||||
|
bswap(base, obj.flags);
|
||||||
|
|
||||||
|
dest.name = reinterpret_cast<char *>(obj.name);
|
||||||
|
dest.type = obj.type;
|
||||||
|
dest.constData = reinterpret_cast<void *>(obj.constData);
|
||||||
|
dest.flags = obj.flags;
|
||||||
|
|
||||||
|
bswap(base, obj.data, dest.data, obj.type);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfBitmapKey32b &obj, HsfBitmapKey &dest)
|
||||||
|
{
|
||||||
|
bswap(base, obj.time);
|
||||||
|
bswap(base, obj.data);
|
||||||
|
|
||||||
|
dest.time = obj.time;
|
||||||
|
dest.data = reinterpret_cast<HsfBitmap *>(obj.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfTrack32b &obj, HsfTrack &dest)
|
||||||
|
{
|
||||||
|
bswap(base, obj.type);
|
||||||
|
bswap(base, obj.start);
|
||||||
|
bswap(base, obj.curveType);
|
||||||
|
bswap(base, obj.numKeyframes);
|
||||||
|
bswap(base, obj.data); // this byteswaps "value" too
|
||||||
|
|
||||||
|
dest.type = obj.type;
|
||||||
|
dest.start = obj.start;
|
||||||
|
dest.curveType = obj.curveType;
|
||||||
|
dest.numKeyframes = obj.numKeyframes;
|
||||||
|
dest.data = reinterpret_cast<void *>(obj.data); // this correctly sets "value" too
|
||||||
|
|
||||||
|
if (obj.type = HSF_TRACK_CLUSTER_WEIGHT) {
|
||||||
|
bswap(base, obj.unk04);
|
||||||
|
|
||||||
|
dest.unk04 = obj.unk04;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bswap(base, obj.param);
|
||||||
|
bswap(base, obj.channel);
|
||||||
|
|
||||||
|
dest.param = obj.param;
|
||||||
|
dest.channel = obj.channel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfMotion32b &obj, HsfMotion &dest)
|
||||||
|
{
|
||||||
|
bswap(base, obj.name);
|
||||||
|
bswap(base, obj.numTracks);
|
||||||
|
bswap(base, obj.track);
|
||||||
|
bswap(base, obj.len);
|
||||||
|
|
||||||
|
dest.name = reinterpret_cast<char *>(obj.name);
|
||||||
|
dest.numTracks = obj.numTracks;
|
||||||
|
dest.track = reinterpret_cast<HsfTrack *>(obj.track);
|
||||||
|
dest.len = obj.len;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename B> void bswap(B &base, HsfFace32b &obj, HsfFace &dest)
|
||||||
|
{
|
||||||
|
bswap(base, obj.type);
|
||||||
|
bswap(base, obj.mat);
|
||||||
|
bswap(base, obj.nbt);
|
||||||
|
|
||||||
|
dest.type = obj.type;
|
||||||
|
dest.mat = obj.mat;
|
||||||
|
dest.nbt = obj.nbt;
|
||||||
|
|
||||||
|
if (obj.type == 4) {
|
||||||
|
bswap(base, obj.strip.count);
|
||||||
|
bswap(base, obj.strip.data);
|
||||||
|
bswap_flat(base, obj.strip.indices[0], 3 * 4);
|
||||||
|
|
||||||
|
dest.strip.count = obj.strip.count;
|
||||||
|
dest.strip.data = reinterpret_cast<s16 *>(obj.strip.data);
|
||||||
|
std::copy(&obj.strip.indices[0][0], &obj.strip.indices[0][0] + 3 * 4, &dest.strip.indices[0][0]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bswap_flat(base, obj.indices[0], 4 * 4);
|
||||||
|
std::copy(&obj.indices[0][0], &obj.indices[0][0] + 4 * 4, &dest.indices[0][0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_u16(u16 *src)
|
||||||
|
{
|
||||||
|
bswap(*src, *src);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_s16(s16 *src)
|
||||||
|
{
|
||||||
|
bswap(*src, *src);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void byteswap_u32(u32 *src)
|
void byteswap_u32(u32 *src)
|
||||||
{
|
{
|
||||||
bswap(*src, *src);
|
bswap(*src, *src);
|
||||||
|
|
@ -354,6 +770,19 @@ void byteswap_s32(s32 *src)
|
||||||
sVisitedPtrs.clear();
|
sVisitedPtrs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfvec3f(HsfVector3f *src)
|
||||||
|
{
|
||||||
|
bswap(*src, *src);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfvec2f(HsfVector2f *src)
|
||||||
|
{
|
||||||
|
auto *vec = reinterpret_cast<Vec2f *>(src);
|
||||||
|
bswap(*vec, *vec);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void byteswap_animdata(void *src, AnimData *dest)
|
void byteswap_animdata(void *src, AnimData *dest)
|
||||||
{
|
{
|
||||||
auto *anim = reinterpret_cast<AnimData32b *>(src);
|
auto *anim = reinterpret_cast<AnimData32b *>(src);
|
||||||
|
|
@ -399,3 +828,119 @@ void byteswap_hsfheader(HsfHeader *src)
|
||||||
bswap(*src, *src);
|
bswap(*src, *src);
|
||||||
sVisitedPtrs.clear();
|
sVisitedPtrs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfcluster(HsfCluster32b *src, HsfCluster *dest)
|
||||||
|
{
|
||||||
|
bswap(*src, *src, *dest);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfattribute(HsfAttribute32b *src, HsfAttribute *dest)
|
||||||
|
{
|
||||||
|
bswap(*src, *src, *dest);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfmaterial(HsfMaterial32b *src, HsfMaterial *dest)
|
||||||
|
{
|
||||||
|
bswap(*src, *src, *dest);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfscene(HsfScene *src)
|
||||||
|
{
|
||||||
|
bswap(*src, *src);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfbuffer(HsfBuffer32b *src, HsfBuffer *dest)
|
||||||
|
{
|
||||||
|
bswap(*src, *src, *dest);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfmatrix(HsfMatrix *src)
|
||||||
|
{
|
||||||
|
bswap(*src, *src);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfpalette(HsfPalette32b *src, HsfPalette *dest)
|
||||||
|
{
|
||||||
|
bswap(*src, *src, *dest);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfpart(HsfPart32b *src, HsfPart *dest)
|
||||||
|
{
|
||||||
|
bswap(*src, *src, *dest);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfbitmap(HsfBitmap32b *src, HsfBitmap *dest)
|
||||||
|
{
|
||||||
|
bswap(*src, *src, *dest);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfmapattr(HsfMapAttr32b *src, HsfMapAttr *dest)
|
||||||
|
{
|
||||||
|
bswap(*src, *src, *dest);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfskeleton(HsfSkeleton32b *src, HsfSkeleton *dest)
|
||||||
|
{
|
||||||
|
bswap(*src, *src, *dest);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfshape(HsfShape32b *src, HsfShape *dest)
|
||||||
|
{
|
||||||
|
bswap(*src, *src, *dest);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfcenv_single(HsfCenvSingle *src)
|
||||||
|
{
|
||||||
|
bswap(*src, *src);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfcenv(HsfCenv32b *src, HsfCenv *dest)
|
||||||
|
{
|
||||||
|
bswap(*src, *src, *dest);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfobject(HsfObject32b *src, HsfObject *dest)
|
||||||
|
{
|
||||||
|
bswap(*src, *src, *dest);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void byteswap_hsfbitmapkey(HsfBitmapKey32b *src, HsfBitmapKey *dest)
|
||||||
|
{
|
||||||
|
bswap(*src, *src, *dest);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void byteswap_hsftrack(HsfTrack32b *src, HsfTrack *dest)
|
||||||
|
{
|
||||||
|
bswap(*src, *src, *dest);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfmotion(HsfMotion32b *src, HsfMotion *dest)
|
||||||
|
{
|
||||||
|
bswap(*src, *src, *dest);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void byteswap_hsfface(HsfFace32b *src, HsfFace *dest)
|
||||||
|
{
|
||||||
|
bswap(*src, *src, *dest);
|
||||||
|
sVisitedPtrs.clear();
|
||||||
|
}
|
||||||
|
|
@ -198,27 +198,27 @@ s32 CARDWriteAsync(CARDFileInfo *fileInfo, const void *addr, s32 length, s32 off
|
||||||
|
|
||||||
void DCFlushRange(void *addr, u32 nBytes)
|
void DCFlushRange(void *addr, u32 nBytes)
|
||||||
{
|
{
|
||||||
puts("DCFlushRange is a stub");
|
//puts("DCFlushRange is a stub");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DCFlushRangeNoSync(void *addr, u32 nBytes)
|
void DCFlushRangeNoSync(void *addr, u32 nBytes)
|
||||||
{
|
{
|
||||||
puts("DCFlushRangeNoSync is a stub");
|
//puts("DCFlushRangeNoSync is a stub");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DCInvalidateRange(void *addr, u32 nBytes)
|
void DCInvalidateRange(void *addr, u32 nBytes)
|
||||||
{
|
{
|
||||||
puts("DCInvalidateRange is a stub");
|
//puts("DCInvalidateRange is a stub");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DCStoreRange(void *addr, u32 nBytes)
|
void DCStoreRange(void *addr, u32 nBytes)
|
||||||
{
|
{
|
||||||
puts("DCStoreRange is a stub");
|
//puts("DCStoreRange is a stub");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DCStoreRangeNoSync(void *addr, u32 nBytes)
|
void DCStoreRangeNoSync(void *addr, u32 nBytes)
|
||||||
{
|
{
|
||||||
puts("DCStoreRangeNoSync is a stub");
|
//puts("DCStoreRangeNoSync is a stub");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DEMOUpdateStats(unsigned char inc)
|
void DEMOUpdateStats(unsigned char inc)
|
||||||
|
|
@ -603,7 +603,7 @@ GXDrawSyncCallback GXSetDrawSyncCallback(GXDrawSyncCallback cb)
|
||||||
|
|
||||||
void PPCSync(void)
|
void PPCSync(void)
|
||||||
{
|
{
|
||||||
puts("PPCSync is a stub");
|
//puts("PPCSync is a stub");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GXUnknownu16(const u16 x)
|
void GXUnknownu16(const u16 x)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue