commit
c8e5c5d720
7 changed files with 1990 additions and 2 deletions
|
|
@ -5399,7 +5399,8 @@ HuSprOrder = .bss:0x8015AE90; // type:object size:0x1800
|
||||||
bmpNoCC = .bss:0x8015C690; // type:object size:0x20 scope:local
|
bmpNoCC = .bss:0x8015C690; // type:object size:0x20 scope:local
|
||||||
HuSprLayerDrawNo = .bss:0x8015C6B0; // type:object size:0x10 scope:local
|
HuSprLayerDrawNo = .bss:0x8015C6B0; // type:object size:0x10 scope:local
|
||||||
Model = .bss:0x8015C6C0; // type:object size:0x80
|
Model = .bss:0x8015C6C0; // type:object size:0x80
|
||||||
head = .bss:0x8015C740; // type:object size:0x240
|
head = .bss:0x8015C740; // type:object size:0xB0
|
||||||
|
rgba = .bss:0x8015C7F0; // type:object size:0x190
|
||||||
lbl_8015C980 = .bss:0x8015C980; // type:object size:0x300 scope:local data:byte
|
lbl_8015C980 = .bss:0x8015C980; // type:object size:0x300 scope:local data:byte
|
||||||
DrawObjData = .bss:0x8015CC80; // type:object size:0x9000 scope:local
|
DrawObjData = .bss:0x8015CC80; // type:object size:0x9000 scope:local
|
||||||
BmpPtrBak = .bss:0x80165C80; // type:object size:0x20 scope:local data:4byte
|
BmpPtrBak = .bss:0x80165C80; // type:object size:0x20 scope:local data:4byte
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ config.libs = [
|
||||||
Object(Matching, "game/process.c"),
|
Object(Matching, "game/process.c"),
|
||||||
Object(Matching, "game/sprman.c"),
|
Object(Matching, "game/sprman.c"),
|
||||||
Object(Matching, "game/sprput.c"),
|
Object(Matching, "game/sprput.c"),
|
||||||
Object(NonMatching, "game/hsfload.c"),
|
Object(Matching, "game/hsfload.c"),
|
||||||
Object(NonMatching, "game/hsfdraw.c"),
|
Object(NonMatching, "game/hsfdraw.c"),
|
||||||
Object(NonMatching, "game/hsfman.c"),
|
Object(NonMatching, "game/hsfman.c"),
|
||||||
Object(NonMatching, "game/hsfmotion.c"),
|
Object(NonMatching, "game/hsfmotion.c"),
|
||||||
|
|
|
||||||
51
include/ctype.h
Normal file
51
include/ctype.h
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
#ifndef _CTYPE_H
|
||||||
|
#define _CTYPE_H
|
||||||
|
|
||||||
|
|
||||||
|
extern unsigned char __ctype_map[256];
|
||||||
|
extern unsigned char __lower_map[256];
|
||||||
|
extern unsigned char __upper_map[256];
|
||||||
|
|
||||||
|
#define __control_char 0x01
|
||||||
|
#define __motion_char 0x02
|
||||||
|
#define __space_char 0x04
|
||||||
|
#define __punctuation 0x08
|
||||||
|
#define __digit 0x10
|
||||||
|
#define __hex_digit 0x20
|
||||||
|
#define __lower_case 0x40
|
||||||
|
#define __upper_case 0x80
|
||||||
|
|
||||||
|
#define __letter (__lower_case | __upper_case)
|
||||||
|
#define __alphanumeric (__letter | __digit)
|
||||||
|
#define __graphic (__alphanumeric | __punctuation)
|
||||||
|
#define __printable (__graphic | __space_char)
|
||||||
|
#define __whitespace (__motion_char | __space_char)
|
||||||
|
#define __control (__motion_char | __control_char)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__declspec(weak) int isalpha(int __c);
|
||||||
|
__declspec(weak) int isdigit(int __c);
|
||||||
|
__declspec(weak) int isspace(int __c);
|
||||||
|
__declspec(weak) int isupper(int __c);
|
||||||
|
__declspec(weak) int isxdigit(int __c);
|
||||||
|
|
||||||
|
__declspec(weak) int tolower(int __c);
|
||||||
|
__declspec(weak) int toupper(int __c);
|
||||||
|
|
||||||
|
// added underscore to avoid naming conflicts
|
||||||
|
inline int _isalpha(int c) { return (int)(__ctype_map[(u8)c] & __letter); }
|
||||||
|
inline int _isdigit(int c) { return (int)(__ctype_map[(u8)c] & __digit); }
|
||||||
|
inline int _isspace(int c) { return (int)(__ctype_map[(u8)c] & __whitespace); }
|
||||||
|
inline int _isupper(int c) { return (int)(__ctype_map[(u8)c] & __upper_case); }
|
||||||
|
inline int _isxdigit(int c) { return (int)(__ctype_map[(u8)c] & __hex_digit); }
|
||||||
|
inline int _tolower(int c) { return (c == -1 ? -1 : (int)__lower_map[(u8)c]); }
|
||||||
|
inline int _toupper(int c) { return (c == -1 ? -1 : (int)__upper_map[(u8)c]); }
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
373
include/game/hsfformat.h
Normal file
373
include/game/hsfformat.h
Normal file
|
|
@ -0,0 +1,373 @@
|
||||||
|
#ifndef _GAME_HSFFORMAT_H
|
||||||
|
#define _GAME_HSFFORMAT_H
|
||||||
|
|
||||||
|
#include "dolphin.h"
|
||||||
|
|
||||||
|
#define HSF_OBJ_NULL1 0
|
||||||
|
#define HSF_OBJ_REPLICA 1
|
||||||
|
#define HSF_OBJ_MESH 2
|
||||||
|
#define HSF_OBJ_ROOT 3
|
||||||
|
#define HSF_OBJ_JOINT 4
|
||||||
|
#define HSF_OBJ_NULL2 5
|
||||||
|
#define HSF_OBJ_NULL3 6
|
||||||
|
#define HSF_OBJ_NONE1 7
|
||||||
|
#define HSF_OBJ_NONE2 8
|
||||||
|
#define HSF_OBJ_MAP 9
|
||||||
|
|
||||||
|
#define HSF_TRACK_TRANSFORM 2
|
||||||
|
#define HSF_TRACK_MORPH 3
|
||||||
|
#define HSF_TRACK_CLUSTER 5
|
||||||
|
#define HSF_TRACK_CLUSTER_WEIGHT 6
|
||||||
|
#define HSF_TRACK_MATERIAL 9
|
||||||
|
#define HSF_TRACK_ATTRIBUTE 10
|
||||||
|
|
||||||
|
#define HSF_CURVE_STEP 0
|
||||||
|
#define HSF_CURVE_LINEAR 1
|
||||||
|
#define HSF_CURVE_BEZIER 2
|
||||||
|
#define HSF_CURVE_BITMAP 3
|
||||||
|
#define HSF_CURVE_CONST 4
|
||||||
|
|
||||||
|
typedef struct hsf_vector3f {
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float z;
|
||||||
|
} HsfVector3f;
|
||||||
|
|
||||||
|
typedef struct hsf_vector2f {
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
} HsfVector2f;
|
||||||
|
|
||||||
|
typedef struct hsf_section {
|
||||||
|
s32 ofs;
|
||||||
|
s32 count;
|
||||||
|
} HsfSection;
|
||||||
|
|
||||||
|
typedef struct hsf_header {
|
||||||
|
char magic[8];
|
||||||
|
HsfSection scene;
|
||||||
|
HsfSection color;
|
||||||
|
HsfSection material;
|
||||||
|
HsfSection attribute;
|
||||||
|
HsfSection vertex;
|
||||||
|
HsfSection normal;
|
||||||
|
HsfSection st;
|
||||||
|
HsfSection face;
|
||||||
|
HsfSection object;
|
||||||
|
HsfSection bitmap;
|
||||||
|
HsfSection palette;
|
||||||
|
HsfSection motion;
|
||||||
|
HsfSection cenv;
|
||||||
|
HsfSection skeleton;
|
||||||
|
HsfSection part;
|
||||||
|
HsfSection cluster;
|
||||||
|
HsfSection shape;
|
||||||
|
HsfSection mapAttr;
|
||||||
|
HsfSection matrix;
|
||||||
|
HsfSection symbol;
|
||||||
|
HsfSection string;
|
||||||
|
} HsfHeader;
|
||||||
|
|
||||||
|
typedef struct hsf_scene {
|
||||||
|
GXColor unk0;
|
||||||
|
f32 unk4;
|
||||||
|
f32 unk8;
|
||||||
|
u32 unkC;
|
||||||
|
} HsfScene;
|
||||||
|
|
||||||
|
typedef struct hsf_bitmap {
|
||||||
|
char *name;
|
||||||
|
s32 maxLod;
|
||||||
|
u8 dataFmt;
|
||||||
|
u8 pixSize;
|
||||||
|
s16 sizeX;
|
||||||
|
s16 sizeY;
|
||||||
|
s16 palSize;
|
||||||
|
GXColor tint;
|
||||||
|
void *palData;
|
||||||
|
u32 unk;
|
||||||
|
void *data;
|
||||||
|
} HsfBitmap;
|
||||||
|
|
||||||
|
typedef struct hsf_palette {
|
||||||
|
char *name;
|
||||||
|
s32 unk;
|
||||||
|
u32 palSize;
|
||||||
|
u16 *data;
|
||||||
|
} HsfPalette;
|
||||||
|
|
||||||
|
typedef struct hsf_attribute {
|
||||||
|
char *name;
|
||||||
|
u8 unk4[96];
|
||||||
|
u32 wrap_s;
|
||||||
|
u32 wrap_t;
|
||||||
|
u8 unk6C[16];
|
||||||
|
u32 flag;
|
||||||
|
HsfBitmap *bitmap;
|
||||||
|
} HsfAttribute;
|
||||||
|
|
||||||
|
typedef struct hsf_material {
|
||||||
|
char *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;
|
||||||
|
HsfAttribute **attrs;
|
||||||
|
} HsfMaterial;
|
||||||
|
|
||||||
|
typedef struct hsf_vertex_buf {
|
||||||
|
char *name;
|
||||||
|
s32 count;
|
||||||
|
void *data;
|
||||||
|
} HsfBuffer;
|
||||||
|
|
||||||
|
typedef struct hsf_tristrip {
|
||||||
|
u16 data[4];
|
||||||
|
} HsfTristrip;
|
||||||
|
|
||||||
|
typedef struct hsf_face {
|
||||||
|
u16 type;
|
||||||
|
u16 mat;
|
||||||
|
u16 indices[12];
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
u32 count;
|
||||||
|
HsfTristrip *data;
|
||||||
|
} strip;
|
||||||
|
u16 ext_indices[4];
|
||||||
|
};
|
||||||
|
float nbt[3];
|
||||||
|
} HsfFace;
|
||||||
|
|
||||||
|
typedef struct hsf_const_data {
|
||||||
|
u32 flags;
|
||||||
|
u8 unk4[64];
|
||||||
|
} HsfConstData;
|
||||||
|
|
||||||
|
typedef struct hsf_transform {
|
||||||
|
HsfVector3f pos;
|
||||||
|
HsfVector3f rot;
|
||||||
|
HsfVector3f scale;
|
||||||
|
} HsfTransform;
|
||||||
|
|
||||||
|
typedef struct hsf_cenv_single {
|
||||||
|
u32 target;
|
||||||
|
u16 pos;
|
||||||
|
u16 posCnt;
|
||||||
|
u16 normal;
|
||||||
|
u16 normalCnt;
|
||||||
|
} HsfCenvSingle;
|
||||||
|
|
||||||
|
typedef struct hsf_cenv_dual_weight {
|
||||||
|
float weight;
|
||||||
|
u16 pos;
|
||||||
|
u16 posCnt;
|
||||||
|
u16 normal;
|
||||||
|
u16 normalCnt;
|
||||||
|
} HsfCenvDualWeight;
|
||||||
|
|
||||||
|
typedef struct hsf_cenv_dual {
|
||||||
|
u32 target1;
|
||||||
|
u32 target2;
|
||||||
|
u32 weightCnt;
|
||||||
|
HsfCenvDualWeight *weight;
|
||||||
|
} HsfCenvDual;
|
||||||
|
|
||||||
|
typedef struct hsf_cenv_multi_weight {
|
||||||
|
u32 target;
|
||||||
|
float value;
|
||||||
|
} HsfCenvMultiWeight;
|
||||||
|
|
||||||
|
typedef struct hsf_cenv_multi {
|
||||||
|
u32 weightCnt;
|
||||||
|
u16 pos;
|
||||||
|
u16 posCnt;
|
||||||
|
u16 normal;
|
||||||
|
u16 normalCnt;
|
||||||
|
HsfCenvMultiWeight *weight;
|
||||||
|
} HsfCenvMulti;
|
||||||
|
|
||||||
|
typedef struct hsf_cenv {
|
||||||
|
char *name;
|
||||||
|
HsfCenvSingle *singleData;
|
||||||
|
HsfCenvDual *dualData;
|
||||||
|
HsfCenvMulti *multiData;
|
||||||
|
u32 singleCount;
|
||||||
|
u32 dualCount;
|
||||||
|
u32 multiCount;
|
||||||
|
u32 vtxCount;
|
||||||
|
u32 copyCount;
|
||||||
|
} HsfCenv;
|
||||||
|
|
||||||
|
typedef struct hsf_part {
|
||||||
|
char *name;
|
||||||
|
u32 count;
|
||||||
|
u16 *vertex;
|
||||||
|
} HsfPart;
|
||||||
|
|
||||||
|
typedef struct hsf_cluster {
|
||||||
|
char *name[2];
|
||||||
|
union {
|
||||||
|
char *targetName;
|
||||||
|
u32 target;
|
||||||
|
};
|
||||||
|
HsfPart *part;
|
||||||
|
u8 unk10[132];
|
||||||
|
u8 adjusted;
|
||||||
|
u8 unk95;
|
||||||
|
u16 type;
|
||||||
|
u32 vertexCnt;
|
||||||
|
HsfBuffer **vertex;
|
||||||
|
} HsfCluster;
|
||||||
|
|
||||||
|
typedef struct hsf_shape {
|
||||||
|
char *name;
|
||||||
|
union {
|
||||||
|
u16 count16[2];
|
||||||
|
u32 vertexCnt;
|
||||||
|
};
|
||||||
|
HsfBuffer **vertex;
|
||||||
|
} HsfShape;
|
||||||
|
|
||||||
|
typedef struct hsf_object_data {
|
||||||
|
struct hsf_object *parent;
|
||||||
|
u32 childrenCount;
|
||||||
|
struct hsf_object **children;
|
||||||
|
HsfTransform base;
|
||||||
|
HsfTransform curr;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
HsfVector3f min;
|
||||||
|
HsfVector3f max;
|
||||||
|
float baseMorph;
|
||||||
|
float *morphWeight[33];
|
||||||
|
} mesh;
|
||||||
|
struct hsf_object *replica;
|
||||||
|
};
|
||||||
|
|
||||||
|
HsfBuffer *face;
|
||||||
|
HsfBuffer *vertex;
|
||||||
|
HsfBuffer *normal;
|
||||||
|
HsfBuffer *color;
|
||||||
|
HsfBuffer *st;
|
||||||
|
HsfMaterial *material;
|
||||||
|
HsfAttribute *attribute;
|
||||||
|
u8 unk120[2];
|
||||||
|
u8 shapeType;
|
||||||
|
u32 vertexShapeCnt;
|
||||||
|
HsfBuffer **vertexShape;
|
||||||
|
u32 clusterCnt;
|
||||||
|
HsfCluster **cluster;
|
||||||
|
u32 hook;
|
||||||
|
HsfCenv *cenv;
|
||||||
|
void *file[2];
|
||||||
|
} HsfObjectData;
|
||||||
|
|
||||||
|
typedef struct hsf_object {
|
||||||
|
char *name;
|
||||||
|
s32 type;
|
||||||
|
HsfConstData *constData;
|
||||||
|
u32 flags;
|
||||||
|
HsfObjectData data;
|
||||||
|
} HsfObject;
|
||||||
|
|
||||||
|
typedef struct hsf_skeleton {
|
||||||
|
char *name;
|
||||||
|
HsfTransform transform;
|
||||||
|
} HsfSkeleton;
|
||||||
|
|
||||||
|
typedef struct hsf_bitmap_keyframe {
|
||||||
|
float time;
|
||||||
|
HsfBitmap *data;
|
||||||
|
} HsfBitmapKey;
|
||||||
|
|
||||||
|
typedef struct hsf_track {
|
||||||
|
u8 type;
|
||||||
|
u8 start;
|
||||||
|
u16 target;
|
||||||
|
u16 param;
|
||||||
|
u16 channel;
|
||||||
|
u16 curveType;
|
||||||
|
u16 numKeyframes;
|
||||||
|
union {
|
||||||
|
float value;
|
||||||
|
void *data;
|
||||||
|
};
|
||||||
|
} HsfTrack;
|
||||||
|
|
||||||
|
typedef struct hsf_motion {
|
||||||
|
char *name;
|
||||||
|
u32 numTracks;
|
||||||
|
HsfTrack *track;
|
||||||
|
float len;
|
||||||
|
} HsfMotion;
|
||||||
|
|
||||||
|
typedef struct hsf_map_attr {
|
||||||
|
float minX;
|
||||||
|
float minZ;
|
||||||
|
float maxX;
|
||||||
|
float maxZ;
|
||||||
|
s16 *data;
|
||||||
|
u32 dataLen;
|
||||||
|
} HsfMapAttr;
|
||||||
|
|
||||||
|
typedef struct hsf_matrix {
|
||||||
|
u32 base_idx;
|
||||||
|
u32 count;
|
||||||
|
Mtx *data;
|
||||||
|
} HsfMatrix;
|
||||||
|
|
||||||
|
typedef struct hsf_data {
|
||||||
|
u8 magic[8];
|
||||||
|
HsfScene *scene;
|
||||||
|
HsfAttribute *attribute;
|
||||||
|
HsfMaterial *material;
|
||||||
|
HsfBuffer *vertex;
|
||||||
|
HsfBuffer *normal;
|
||||||
|
HsfBuffer *st;
|
||||||
|
HsfBuffer *color;
|
||||||
|
HsfBuffer *face;
|
||||||
|
HsfBitmap *bitmap;
|
||||||
|
HsfPalette *palette;
|
||||||
|
HsfObject *root;
|
||||||
|
HsfCenv *cenv;
|
||||||
|
HsfSkeleton *skeleton;
|
||||||
|
HsfCluster *cluster;
|
||||||
|
HsfPart *part;
|
||||||
|
HsfShape *shape;
|
||||||
|
HsfMotion *motion;
|
||||||
|
HsfObject *object;
|
||||||
|
HsfMapAttr *mapAttr;
|
||||||
|
HsfMatrix *matrix;
|
||||||
|
s16 sceneCnt;
|
||||||
|
s16 attributeCnt;
|
||||||
|
s16 materialCnt;
|
||||||
|
s16 vertexCnt;
|
||||||
|
s16 normalCnt;
|
||||||
|
s16 stCnt;
|
||||||
|
s16 colorCnt;
|
||||||
|
s16 faceCnt;
|
||||||
|
s16 bitmapCnt;
|
||||||
|
s16 paletteCnt;
|
||||||
|
s16 objectCnt;
|
||||||
|
s16 cenvCnt;
|
||||||
|
s16 skeletonCnt;
|
||||||
|
s16 clusterCnt;
|
||||||
|
s16 partCnt;
|
||||||
|
s16 shapeCnt;
|
||||||
|
s16 mapAttrCnt;
|
||||||
|
s16 motionCnt;
|
||||||
|
s16 matrixCnt;
|
||||||
|
} HsfData;
|
||||||
|
|
||||||
|
#endif
|
||||||
12
include/game/hsfload.h
Normal file
12
include/game/hsfload.h
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef _GAME_HSFLOAD_H
|
||||||
|
#define _GAME_HSFLOAD_H
|
||||||
|
|
||||||
|
#include "game/hsfformat.h"
|
||||||
|
|
||||||
|
HsfData *LoadHSF(void *data);
|
||||||
|
void ClusterAdjustObject(HsfData *model, HsfData *src_model);
|
||||||
|
char *SetName(u32 *str_ofs);
|
||||||
|
char *MakeObjectName(char *name);
|
||||||
|
int CmpObjectName(char *name1, char *name2);
|
||||||
|
|
||||||
|
#endif
|
||||||
18
include/string.h
Normal file
18
include/string.h
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
#ifndef _STRING_H_
|
||||||
|
#define _STRING_H_
|
||||||
|
|
||||||
|
typedef unsigned long size_t;
|
||||||
|
|
||||||
|
void* memcpy(void* dst, const void* src, size_t n);
|
||||||
|
void* memset(void* dst, int val, size_t n);
|
||||||
|
|
||||||
|
char* strrchr(const char* str, int c);
|
||||||
|
char* strchr(const char* str, int c);
|
||||||
|
int strncmp(const char* str1, const char* str2, size_t n);
|
||||||
|
int strcmp(const char* str1, const char* str2);
|
||||||
|
char* strcat(char* dst, const char* src);
|
||||||
|
char* strncpy(char* dst, const char* src, size_t n);
|
||||||
|
char* strcpy(char* dst, const char* src);
|
||||||
|
size_t strlen(const char* str);
|
||||||
|
|
||||||
|
#endif
|
||||||
1533
src/game/hsfload.c
Normal file
1533
src/game/hsfload.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue