-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathprogs.ksy
265 lines (241 loc) · 5.18 KB
/
progs.ksy
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
meta:
id: progs
file-extension: dat
endian: le
bit-endian: le
doc-ref: |
https://github.com/id-Software/Quake/blob/master/WinQuake/pr_comp.h
doc: |
QuakeC "Progs" format. Built on opcodes and runs inside a virtual machine.
seq:
- id: header
type: progs_header
- id: extended_header
type: progs_header_extended
if: 'header.version == progs_versions::fte'
instances:
strings:
pos: header.ofs_strings
size: header.num_strings
functions:
pos: header.ofs_functions
repeat: expr
repeat-expr: header.num_functions
type:
switch-on: _root.header.version
cases:
'progs_versions::qtest': progs_function_qtest
'progs_versions::quake': progs_function
'progs_versions::fte': progs_function
fielddefs:
pos: header.ofs_fielddefs
repeat: expr
repeat-expr: header.num_fielddefs
type:
switch-on: _root.header.version
cases:
'progs_versions::qtest': progs_def_qtest
'progs_versions::quake': progs_def
'progs_versions::fte': progs_def
globaldefs:
pos: header.ofs_globaldefs
repeat: expr
repeat-expr: header.num_globaldefs
type:
switch-on: _root.header.version
cases:
'progs_versions::qtest': progs_def_qtest
'progs_versions::quake': progs_def
'progs_versions::fte': progs_def
statements:
pos: header.ofs_statements
repeat: expr
repeat-expr: header.num_statements
type:
switch-on: _root.header.version
cases:
'progs_versions::qtest': progs_statement_qtest
'progs_versions::quake': progs_statement
'progs_versions::fte': progs_statement
globals:
pos: header.ofs_globals
type: progs_global
repeat: expr
repeat-expr: header.num_globals
types:
progs_header:
seq:
- id: version
type: s4
enum: progs_versions
- id: crc
type: s4
enum: progs_crcs
- id: ofs_statements
type: s4
- id: num_statements
type: s4
- id: ofs_globaldefs
type: s4
- id: num_globaldefs
type: s4
- id: ofs_fielddefs
type: s4
- id: num_fielddefs
type: s4
- id: ofs_functions
type: s4
- id: num_functions
type: s4
- id: ofs_strings
type: s4
- id: num_strings
type: s4
- id: ofs_globals
type: s4
- id: num_globals
type: s4
- id: entityfields
type: s4
progs_header_extended:
seq:
- id: ofs_files
type: s4
- id: ofs_linenums
type: s4
- id: ofs_compressed_functions
type: s4
- id: num_compressed_functions
type: s4
- id: ofs_types
type: s4
- id: num_types
type: s4
- id: num_compressed_blocks
type: s4
- id: secondary_version
type: u4
enum: progs_versions_extended
progs_function_qtest:
seq:
- id: first_statement
type: s4
- id: reserved
type: s4
repeat: expr
repeat-expr: 3
- id: s_name
type: s4
- id: s_file
type: s4
- id: num_parms
type: s4
- id: parm_start
type: s4
- id: parm_size
type: s4
repeat: expr
repeat-expr: 8
instances:
name:
pos: s_name + _parent.header.ofs_strings
type: strz
encoding: ascii
filename:
pos: s_file + _parent.header.ofs_strings
type: strz
encoding: ascii
progs_function:
seq:
- id: first_statement
type: s4
- id: parm_start
type: s4
- id: locals
type: s4
- id: profile
type: s4
- id: s_name
type: s4
- id: s_file
type: s4
- id: num_parms
type: s4
- id: parm_size
type: u1
repeat: expr
repeat-expr: 8
instances:
name:
pos: s_name + _parent.header.ofs_strings
type: strz
encoding: ascii
filename:
pos: s_file + _parent.header.ofs_strings
type: strz
encoding: ascii
progs_def_qtest:
seq:
- id: type
type: u4
- id: s_name
type: u4
- id: ofs
type: u4
instances:
name:
pos: s_name + _parent.header.ofs_strings
type: strz
encoding: ascii
progs_def:
seq:
- id: type
type: u2
- id: ofs
type: u2
- id: s_name
type: u4
instances:
name:
pos: s_name + _parent.header.ofs_strings
type: strz
encoding: ascii
progs_statement_qtest:
seq:
- id: line
type: u4
- id: opcode
type: u2
- id: a
type: s2
- id: b
type: s2
- id: c
type: s2
progs_statement:
seq:
- id: opcode
type: u2
- id: a
type: s2
- id: b
type: s2
- id: c
type: s2
progs_global:
seq:
- id: g
size: 4
enums:
progs_versions:
3: qtest
6: quake
7: fte
progs_crcs:
58535: qtest
6956: quake091
5927: quake101
54730: quakeworld
progs_versions_extended:
0x021b1461: fte16
0x65167402: fte32