-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMHS2 MRL.bt
78 lines (73 loc) · 2.09 KB
/
MHS2 MRL.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
//------------------------------------------------
//--- 010 Editor v9.0.2 Binary Template
//
// File:
// Authors:
// Version:
// Purpose:
// Category:
// File Mask:
// ID Bytes:
// History:
//------------------------------------------------
local int i;
typedef struct{
long id<format=hex>;
uint unkn;
uint materialCount;
uint textureCount;
uint64 unkn;
uint64 textureOffset<format=hex>;
uint64 materialOffset<format=hex>;
}Header;
typedef struct{
// fileTypeCode for tex is [(zlib.crc32("rTexture".encode()) ^ 0xffffffff) & 0x7fffffff]
uint fileTypeCode<format=hex>;
byte unkn2[20];
char path[128];
}Texture;
typedef struct{
uint headId<format=hex>;//this is probably some form of JAMCRC of "Material", can look in detail later
uint null;
//for example (zlib.crc32("NPC_Mt__4".encode()) ^ 0xffffffff) & 0x7fffffff
uint materialNameHash<format=hex>;//^
uint matSize;
uint shaderHash<format=hex>;// 62B2D175 - BSSolid
uint skinid<format=hex>;//B81391A8 - DSZTestWrite
uint RSType<format=hex>;
uint unkn1<format=hex>;
uint unkn2<format=hex>;
ubyte unkn7[16];
uint secondaryMatSize;
uint64 startAddr<format=hex>;
uint64 secondaryStartAddr<format=hex>;
}Material;
typedef struct{
ubyte type;
ubyte unkn1;
ubyte unkn2;
ubyte unkn3;
uint32 x<format=hex>;
//not so shure if this is correct
uint texIdx;
uint unkn5;
}Resbind;
struct MaterialDat(uint index){
byte data[Material1[index].matSize];
};
struct SecondaryDat(uint index){
byte data[Material1[index].secondaryMatSize];
};
Header Header1<bgcolor=0x0000ff>;;
Texture Texture1[Header1.textureCount]<bgcolor=0x00ff00>;
Material Material1[Header1.materialCount]<bgcolor=0xff0000>;
for(i=0;i<Header1.materialCount;i++){
FSeek(Material1[i].startAddr);
MaterialDat materialData(i)<optimize=false,bgcolor=0xFF00FF>;
};
for(i=0;i<Header1.materialCount;i++){
if(Material1[i].secondaryStartAddr){
FSeek(Material1[i].secondaryStartAddr);
SecondaryDat secondaryData(i)<optimize=false,bgcolor=0x0000FF>;
};
};