This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
CLMP.bt
99 lines (85 loc) · 2.73 KB
/
CLMP.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
//------------------------------------------------
//--- 010 Editor v10.0.1 Binary Template
//
// File: CLMP.bt
// Authors: TKGP
// Version:
// Purpose: Cloth-related .clm files
// Category: Katana
// File Mask: *.clm
// ID Bytes: 43 4C 4D 50
// History:
//------------------------------------------------
#include "Util.bt"
LittleEndian();
if (ReadInt(8) == 0x24000000)
BigEndian();
//------------------------------------------------
typedef struct {
char magic[4]; Assert(magic == "CLMP");
byte unk04; Assert(unk04 == 3);
byte unk05; Assert(unk05 == 2);
short unk06; Assert(unk06 == 0);
int unk08; Assert(unk08 == 0x24);
int struct1Size <format=hex>; Assert(struct1Size == 0x10);
int struct1Count;
int struct2Size <format=hex>; Assert(struct2Size == 0x24);
int struct2Count;
int struct3Size <format=hex>; Assert(struct3Size == 0x10);
int struct3Count;
} Header <bgcolor=cLtRed>;
// One per FLVER mesh
typedef struct {
short unk00;
short unk02; Assert(unk02 == (unk00 == -1 ? -1 : 0));
int dataOffset1 <format=hex>;
int dataOffset2 <format=hex>;
int dataCount; // Matches vertex count
if (dataCount > 0) {
local quad pos <hidden=true> = FTell();
FSeek(dataOffset1);
short data1[dataCount] <bgcolor=cGreen>;
FSeek(dataOffset2);
byte data2[dataCount] <bgcolor=cDkGreen>;
FSeek(pos);
}
} Struct1 <bgcolor=cLtGreen, optimize=false>;
typedef struct {
OffsetString name(0, 0);
int offset04 <format=hex>;
int offset08 <format=hex>;
int offset0C <format=hex>;
int offset10 <format=hex>;
int offset14 <format=hex>;
int count18;
int unk1C;
int unk20 <hidden=true>; Assert(unk20 == 0);
local quad pos <hidden=true> = FTell();
FSeek(offset04);
Vector4 itemsA[count18] <bgcolor=cYellow>;
FSeek(offset08);
Vector4 itemsB[count18] <bgcolor=cYellow>;
FSeek(offset0C);
Vector4 itemsC[count18] <bgcolor=cYellow>;
FSeek(offset10);
Vector4 itemsD[count18] <bgcolor=cYellow>;
FSeek(offset14);
short itemsE[count18] <bgcolor=cDkYellow>;
FSeek(pos);
} Struct2 <read=ReadStruct2, bgcolor=cLtYellow, optimize=false>;
string ReadStruct2(Struct2 &s2) {
return s2.name.str;
}
typedef struct {
byte unk00;
byte unk01;
byte unk02;
byte unk03 <hidden=true>; Assert(unk03 == 0);
int unk04 <hidden=true>; Assert(unk04 == 0);
quad unk08; // Verified via endianness
} Struct3 <bgcolor=cAqua, optimize=false>;
//------------------------------------------------
Header header;
struct { Struct1 struct1s[header.struct1Count]; } struct1s;
struct { Struct2 struct2s[header.struct2Count]; } struct2s;
struct { Struct3 struct3s[header.struct3Count]; } struct3s;