Decompile up to BitmapLoad
This commit is contained in:
parent
e233107006
commit
8c14475c86
2 changed files with 154 additions and 14 deletions
|
|
@ -134,7 +134,7 @@ typedef struct hsf_face {
|
|||
|
||||
typedef struct hsf_const_data {
|
||||
u32 flags;
|
||||
u8 unk[64];
|
||||
u8 unk4[64];
|
||||
} HsfConstData;
|
||||
|
||||
typedef struct hsf_transform {
|
||||
|
|
@ -195,20 +195,31 @@ typedef struct hsf_cenv {
|
|||
typedef struct hsf_part {
|
||||
char *name;
|
||||
u32 count;
|
||||
u16 *data;
|
||||
u16 *vertex;
|
||||
} HsfPart;
|
||||
|
||||
typedef struct hsf_cluster {
|
||||
char *name[3];
|
||||
char *name[2];
|
||||
union {
|
||||
char *targetName;
|
||||
u32 target;
|
||||
};
|
||||
HsfPart *part;
|
||||
u8 unk[144];
|
||||
u8 unk10[132];
|
||||
u8 adjusted;
|
||||
u8 unk95;
|
||||
u16 type;
|
||||
u32 vertexCnt;
|
||||
HsfBuffer **vertex;
|
||||
} HsfCluster;
|
||||
|
||||
typedef struct hsf_shape {
|
||||
char *name;
|
||||
u16 count1;
|
||||
u16 morphTargetCnt;
|
||||
HsfBuffer **morphTargets;
|
||||
union {
|
||||
u16 count16[2];
|
||||
u32 vertexCnt;
|
||||
};
|
||||
HsfBuffer **vertex;
|
||||
} HsfShape;
|
||||
|
||||
typedef struct hsf_object_data {
|
||||
|
|
@ -221,9 +232,10 @@ typedef struct hsf_object_data {
|
|||
struct {
|
||||
HsfVector3f min;
|
||||
HsfVector3f max;
|
||||
u8 unk[136];
|
||||
float baseMorph;
|
||||
float *morphWeight[33];
|
||||
} mesh;
|
||||
struct hsf_object *unk64;
|
||||
struct hsf_object *replica;
|
||||
};
|
||||
|
||||
HsfBuffer *face;
|
||||
|
|
@ -233,7 +245,8 @@ typedef struct hsf_object_data {
|
|||
HsfBuffer *st;
|
||||
HsfMaterial *material;
|
||||
HsfAttribute *attribute;
|
||||
u8 unk2[4];
|
||||
u8 unk120[2];
|
||||
u8 shapeType;
|
||||
u32 vertexShapeCnt;
|
||||
HsfBuffer **vertexShape;
|
||||
u32 clusterCnt;
|
||||
|
|
@ -275,9 +288,12 @@ typedef struct hsf_motion {
|
|||
} HsfMotion;
|
||||
|
||||
typedef struct hsf_map_attr {
|
||||
u8 unk[16];
|
||||
void *unk10;
|
||||
u8 unk2[4];
|
||||
float min_x;
|
||||
float min_z;
|
||||
float max_x;
|
||||
float max_z;
|
||||
s16 *data;
|
||||
u32 dataLen;
|
||||
} HsfMapAttr;
|
||||
|
||||
typedef struct hsf_matrix {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ static void BitmapLoad(void);
|
|||
static void MotionLoad(void);
|
||||
static void MatrixLoad(void);
|
||||
|
||||
static s32 SearchObjectSetName(HsfData *data, char *name);
|
||||
static HsfBuffer *SearchVertexPtr(s32 id);
|
||||
static HsfBuffer *SearchNormalPtr(s32 id);
|
||||
static HsfBuffer *SearchStPtr(s32 id);
|
||||
|
|
@ -85,6 +86,27 @@ HsfData *LoadHSF(void *data)
|
|||
|
||||
}
|
||||
|
||||
void ClusterAdjustObject(HsfData *src_model, HsfData *model)
|
||||
{
|
||||
HsfCluster *cluster;
|
||||
s32 i;
|
||||
if(!model) {
|
||||
return;
|
||||
}
|
||||
if(model->clusterCnt == 0) {
|
||||
return;
|
||||
}
|
||||
cluster = model->cluster;
|
||||
if(cluster->adjusted) {
|
||||
return;
|
||||
}
|
||||
cluster->adjusted = 1;
|
||||
for(i=0; i<model->clusterCnt; i++, cluster++) {
|
||||
char *name = cluster->targetName;
|
||||
cluster->target = SearchObjectSetName(src_model, name);
|
||||
}
|
||||
}
|
||||
|
||||
static void FileLoad(void *data)
|
||||
{
|
||||
fileptr = data;
|
||||
|
|
@ -516,7 +538,7 @@ static void DispObject(HsfObject *parent, HsfObject *object)
|
|||
if(Model.root == NULL) {
|
||||
Model.root = temp_object;
|
||||
}
|
||||
new_object->data.unk64 = &objtop[(u32)new_object->data.unk64];
|
||||
new_object->data.replica = &objtop[(u32)new_object->data.replica];
|
||||
for(i=0; i<data->childrenCount; i++) {
|
||||
DispObject(new_object, new_object->data.children[i]);
|
||||
}
|
||||
|
|
@ -773,6 +795,108 @@ static void SkeletonLoad(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void PartLoad(void)
|
||||
{
|
||||
HsfPart *part_file;
|
||||
HsfPart *part_new;
|
||||
|
||||
u16 *data;
|
||||
s32 i, j;
|
||||
|
||||
if(head.part.count) {
|
||||
part_new = part_file = (HsfPart *)((u32)fileptr+head.part.ofs);
|
||||
Model.partCnt = head.part.count;
|
||||
Model.part = part_file;
|
||||
data = (u16 *)&part_file[head.part.count];
|
||||
for(i=0; i<head.part.count; i++, part_new++) {
|
||||
part_new->name = SetName((u32 *)&part_file[i].name);
|
||||
part_new->count = part_file[i].count;
|
||||
part_new->vertex = &data[(u32)part_file[i].vertex];
|
||||
for(j=0; j<part_new->count; j++) {
|
||||
part_new->vertex[j] = part_new->vertex[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ClusterLoad(void)
|
||||
{
|
||||
HsfCluster *cluster_file;
|
||||
HsfCluster *cluster_new;
|
||||
|
||||
s32 i, j;
|
||||
|
||||
if(head.cluster.count) {
|
||||
cluster_new = cluster_file = (HsfCluster *)((u32)fileptr+head.cluster.ofs);
|
||||
Model.clusterCnt = head.cluster.count;
|
||||
Model.cluster = cluster_file;
|
||||
for(i=0; i<head.cluster.count; i++) {
|
||||
HsfBuffer *vertex;
|
||||
u32 vertexSym;
|
||||
cluster_new[i].name[0] = SetName((u32 *)&cluster_file[i].name[0]);
|
||||
cluster_new[i].name[1] = SetName((u32 *)&cluster_file[i].name[1]);
|
||||
cluster_new[i].targetName = SetName((u32 *)&cluster_file[i].targetName);
|
||||
cluster_new[i].part = SearchPartPtr((s32)cluster_file[i].part);
|
||||
cluster_new[i].unk95 = cluster_file[i].unk95;
|
||||
cluster_new[i].type = cluster_file[i].type;
|
||||
cluster_new[i].vertexCnt = cluster_file[i].vertexCnt;
|
||||
vertexSym = (u32)cluster_file[i].vertex;
|
||||
cluster_new[i].vertex = (HsfBuffer **)&NSymIndex[vertexSym];
|
||||
for(j=0; j<cluster_new[i].vertexCnt; j++) {
|
||||
vertex = SearchVertexPtr((s32)cluster_new[i].vertex[j]);
|
||||
cluster_new[i].vertex[j] = vertex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ShapeLoad(void)
|
||||
{
|
||||
s32 i, j;
|
||||
HsfShape *shape_new;
|
||||
HsfShape *shape_file;
|
||||
|
||||
if(head.shape.count) {
|
||||
shape_new = shape_file = (HsfShape *)((u32)fileptr+head.shape.ofs);
|
||||
Model.shapeCnt = head.shape.count;
|
||||
Model.shape = shape_file;
|
||||
for(i=0; i<Model.shapeCnt; i++) {
|
||||
u32 vertexSym;
|
||||
HsfBuffer *vertex;
|
||||
|
||||
shape_new[i].name = SetName((u32 *)&shape_file[i].name);
|
||||
shape_new[i].count16[0] = shape_file[i].count16[0];
|
||||
shape_new[i].count16[1] = shape_file[i].count16[1];
|
||||
vertexSym = (u32)shape_file[i].vertex;
|
||||
shape_new[i].vertex = (HsfBuffer **)&NSymIndex[vertexSym];
|
||||
for(j=0; j<shape_new[i].count16[1]; j++) {
|
||||
vertex = &vtxtop[(u32)shape_new[i].vertex[j]];
|
||||
shape_new[i].vertex[j] = vertex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void MapAttrLoad(void)
|
||||
{
|
||||
s32 i;
|
||||
HsfMapAttr *mapattr_base;
|
||||
HsfMapAttr *mapattr_file;
|
||||
HsfMapAttr *mapattr_new;
|
||||
s16 *data;
|
||||
|
||||
if(head.mapAttr.count) {
|
||||
mapattr_file = mapattr_base = (HsfMapAttr *)((u32)fileptr+head.mapAttr.ofs);
|
||||
mapattr_new = mapattr_base;
|
||||
Model.mapAttrCnt = head.mapAttr.count;
|
||||
Model.mapAttr = mapattr_base;
|
||||
data = (s16 *)&mapattr_base[head.mapAttr.count];
|
||||
for(i=0; i<head.mapAttr.count; i++, mapattr_file++, mapattr_new++) {
|
||||
mapattr_new->data = &data[(u32)mapattr_file->data];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static s32 SearchObjectSetName(HsfData *data, char *name)
|
||||
{
|
||||
HsfObject *object = data->object;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue