-
Notifications
You must be signed in to change notification settings - Fork 8
/
MHStoriesArc.bt
74 lines (67 loc) · 1.56 KB
/
MHStoriesArc.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
//------------------------------------------------
//--- 010 Editor v11.0.1 Binary Template
//
// File:
// Authors:
// Version:
// Purpose:
// Category:
// File Mask:
// ID Bytes:
// History:
//------------------------------------------------
uint createJamcrc(char name[]){
local uchar result[5];
local uint a1;
local uint a2;
local uint a3;
local uint a4;
ChecksumAlgArrayBytes(CHECKSUM_CRC32,result,name,Strlen(name),"",-1,-1);
a1 = result[0];
a2 = result[1];
a3 = result[2];
a4 = result[3];
return 0xFFFFFFFF ^ ((a1<<24) | (a2<<16) | (a3<< 8) | (a4));
}
string getExt(int hash){
switch(hash){
case createJamcrc("rModel") & 0x7FFFFFFF:
return ".mod";
case createJamcrc("rTexture") & 0x7FFFFFFF:
return ".tex";
default:
string s;
SPrintf(s, ".%x", hash);
return s;
};
};
local int i;
typedef struct{
char ARC0[4];
short version;
short fileCount;
}Header;
typedef struct{
char FilePath[128];
uint ExtensionHash;
int compSize;
int uncompSize : 24;
int unkn : 8;
int offset;
}SwitchFileEntry;
typedef struct(uint length){
byte data[length];
}FileData;
string ReadEntry(SwitchFileEntry &s){
return s.FilePath + getExt(s.ExtensionHash);
};
Header header;
struct FileEntries{
for(i=0;i<header.fileCount;i++){
SwitchFileEntry file<read=ReadEntry>;
};
}files;
for(i=0;i<header.fileCount;i++){
FSeek(files.file[i].offset);
FileData fileData(files.file[i].compSize);
};