-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmb.bt
151 lines (140 loc) · 2.89 KB
/
cmb.bt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// CMB struct parser
// Author: @drewler
// Based on info from @xdanieldzd's N3DSCmbViewer
LittleEndian();
typedef struct {
uchar bone_id;
uchar unknown00;
uchar parent_id;
uchar unknown01;
float scale[3];
float rotation[3];
float translation[3];
uint unknown02;
} BONE;
typedef struct {
uint unknown00;
uint bone_count;
uint unknown01;
BONE bone[bone_count];
} SKL;
typedef struct {
uint unknown00;
uint unknown01;
uint unknown02;
uint unknown03;
ushort textureid0;
ushort unknown04;
ushort textureminfilter0;
ushort texturemagfilter0;
ushort texturewrapmodes0;
ushort texturewrapmodet0;
uint unknown05;
uint unknown06;
uint unknown07;
ushort textureid1;
ushort unknown08;
//...
} MATS;
typedef struct {
uint datalength;
ushort unknown00;
ushort unknown01;
ushort width;
ushort height;
uint format;
uint dataoffset;
char name[16];
//...
} TEX;
typedef struct {
uint datalength;
uint unknown00;
ushort unknown01;
ushort unknown02;
ushort unknown03;
ushort unknown04;
uint unknown05;
uint unknown06;
uint unknown07;
uint unknown08;
uint unknown09;
} MSHS;
typedef struct {
uint datalength;
ushort n_prms;
ushort unknown00;
float unknown01;
float unknown02;
float unknown03;
uint unknown04;
uint unknown05;
uint unknown06;
uint offset[9];
float scale[9];
uint datatype[9];
uint unknown07[9];
uint unknown08[9];
uint unknown09[9];
uint unknown10[9];
uint unknown11[3];
} SEPD;
typedef struct {
uint datalength;
uint n_sepd;
uint unknown00;
ushort sepd_offset[n_sepd];
local int i;
for(i = 0; i < n_sepd; i++){
SEPD sepd;
}
} SHP;
typedef struct {
local uint sklm_start = FTell();
uint datalength;
uint mshs_offset;
uint shp_offset;
FSeek(sklm_start + mshs_offset);
MSHS mshs;
FSeek(sklm_start + shp_offset);
SHP shp;
} SKLM;
typedef struct {
char magic[4];
switch(magic){
case "skl\x20":
SKL skl;
break;
case "qtrs":
case "mats":
MATS mats;
break;
case "tex\x20":
TEX tex;
break;
case "sklm":
SKLM sklm;
break;
case "luts":
case "vatr":
case "\x00\x00\x01\x00": // Vertex data
case "\x00\x00\x00\x00": // Texture data
default:
break;
}
} CMB_SUB;
typedef struct {
local uint cmb_start = FTell();
char magic[4];
uint unknown00;
uint unknown01;
uint unknown02;
char name[16];
uint unknown03;
uint chunk_offset[unknown01];
local int i = 0;
for(i = 0; i < unknown01 - 1; i++){
FSeek(cmb_start + chunk_offset[i]);
CMB_SUB cmb_sub;
}
} CMB;