-
Notifications
You must be signed in to change notification settings - Fork 16
/
demo.ksy
118 lines (113 loc) · 2.7 KB
/
demo.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
meta:
id: tw_demo_v3_v4_v5_v6
file-extension: demo
endian: be
license: MIT/Apache-2.0
doc-ref: https://github.com/heinrich5991/libtw2/blob/0085b3eb76ff1ffc7136f874129c79fce0f955ee/doc/demo.md
seq:
- id: header
type: header
- id: timeline_markers
type: timeline_markers
if: header.version >= 4
- id: map_sha256
type: map_sha256
if: header.version >= 6
- id: map
size: header.map_size
- id: chunks
type: chunk
repeat: eos
enums:
chunk_type:
1: snapshot
2: message
3: snapshot_delta
types:
header:
seq:
- id: magic
contents: ['TWDEMO', 0]
- id: version
type: u1
- id: net_version
type: strz
encoding: utf8
size: 64
- id: map_name
type: strz
encoding: utf8
size: 64
- id: map_size
type: s4
- id: map_crc
type: u4
- id: type
type: strz
encoding: utf8
size: 8
- id: length
type: s4
- id: timestamp
type: strz
encoding: utf8
size: 20
timeline_markers:
seq:
- id: num_timeline_markers
type: s4
- id: timeline_marker
type: s4
repeat: expr
repeat-expr: 64
map_sha256:
seq:
- id: magic
contents: [0x6b, 0xe6, 0xda, 0x4a, 0xce, 0xbd, 0x38, 0x0c, 0x9b, 0x5b, 0x12, 0x89, 0xc8, 0x42, 0xd7, 0x80]
- id: map_sha256
size: 32
chunk:
seq:
- id: is_tick
type: b1
# tick
- id: keyframe
type: b1
if: is_tick
- id: inline_tick_delta
type: b1
if: _root.header.version >= 5 and is_tick
- id: tick_delta_v5
type: b5
if: _root.header.version >= 5 and is_tick
- id: tick_delta_v3
type: b6
if: _root.header.version < 5 and is_tick
# non-tick
- id: type
type: b2
enum: chunk_type
if: not is_tick
- id: size_inline
type: b5
if: not is_tick
# tick
- id: tick_absolute
type: s4
if: is_tick and (_root.header.version >= 5 ? not inline_tick_delta : tick_delta_v3 == 0)
# non-tick
- id: size_extern_8
type: u1
if: not is_tick and size_inline == 30
- id: size_extern_16
type: u2le
if: not is_tick and size_inline == 31
- id: compressed_data
size: size
instances:
tick_delta:
value: _root.header.version >= 5 ? tick_delta_v5 : tick_delta_v3
if: is_tick and (_root.header.version >= 5 ? inline_tick_delta : tick_delta_v3 != 0)
size:
value: size_inline == 31 ? size_extern_16 : size_inline == 30 ? size_extern_8 : size_inline
if: not is_tick