-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdic.bt
90 lines (84 loc) · 2.28 KB
/
dic.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
typedef struct {
uint32 ref <format=hex>;
uint16 idx1, idx2;
POINTER<PascalString> name;
} DicNode <read=DicNodeRead>;
string DicNodeRead(const DicNode& node) { return PascalStringToString(node.name); }
struct Dic {
char magic[4]; // 'DIC ' (not checked)
uint32 num_nodes;
DicNode root_node;
if (num_nodes > 0)
DicNode nodes[num_nodes] <optimize=false>;
};
typedef struct (string name_) {
const local string name <hidden=true> = name_;
DictionaryItemDatatype type;
uchar x1_padding <hidden=true>;
uint16 size;
uint32 x4 <hidden=true>;
uint64 x8 <hidden=true>;
Assert(x4 == 0);
Assert(x8 == 0);
switch (type) {
case DataType2_kInt:
int32 value;
break;
case DataType2_kIntArray:
int32 value[size];
break;
case DataType2_kBool:
Bool value;
break;
case DataType2_kBoolArray:
Bool value[size];
break;
case DataType2_kFloat:
float value;
break;
case DataType2_kFloatArray:
float value[size];
break;
case DataType2_kString:
POINTER<PascalString> value;
break;
case DataType2_kStringArray:
PascalStringArray value(size);
break;
case DataType2_kArgument:
POINTER<PascalString> argument;
break;
case DataType2_kActorIdentifier:
POINTER<PascalString> actor_name;
POINTER<PascalString> actor_id;
break;
case DataType2_kContainer:
case DataType2_kWString:
case DataType2_kWStringArray:
Assert(false, "Unhandled data type");
break;
default:
Assert(false, "Unknown data type");
break;
}
const local uint padding_size <hidden=true> = ((FTell() + 7) & -8) - FTell();
if (padding_size > 0)
uchar padding[padding_size] <hidden=true>;
} DictionaryItem <read=DictionaryItemRead, bgcolor=0x3e6b43>;
string DictionaryItemRead(const DictionaryItem& s) { return s.name; }
struct Dictionary {
uint16 x0 <hidden=true>;
Assert(x0 == 1);
uint16 num_items;
uint32 x4 <hidden=true>;
Assert(x4 == 0);
POINTER<Dic> dic;
uint64 ptrs[dic.num_nodes] <format=hex>;
const local uint64 pos <hidden=true> = FTell();
local uint i <hidden=true> = 0;
for (i = 0; i < dic.num_nodes; ++i) {
FSeek(ptrs[i]);
DictionaryItem items(PascalStringToString(dic.nodes[i].name));
}
FSeek(pos);
};