-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevent_command.ksy
205 lines (202 loc) · 4.78 KB
/
event_command.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
meta:
id: event_command
title: WolfRPG event_command-related structures, not used for file parsing
application: WolfRPG
license: MIT
endian: le
imports:
- common
- route
enums:
# TODO: finish this
command_type:
101: show_message_show_text
103: show_message_comment
106: show_message_debug
111: condition_number
210: call_event
211: call_event_reserve
240: chip_management_change_map_chip_settings
241: chip_management_switch_chipset
242: chip_management_overwrite_map_chips
300: call_common_by_name
401: branch
499: branch_end
types:
param_status:
seq:
- id: raw
type: u4
instances:
string_1_enabled:
value: ((raw >> 12) & 1).as<b1>
string_2_enabled:
value: ((raw >> 13) & 1).as<b1>
string_3_enabled:
value: ((raw >> 14) & 1).as<b1>
string_4_enabled:
value: ((raw >> 15) & 1).as<b1>
string_5_enabled:
value: ((raw >> 16) & 1).as<b1>
string_count:
value: (raw >> 4) & 0xf
number_count:
value: (raw >> 0) & 0xf
count:
value: (string_count + number_count)
return_value_enabled:
value: ((raw >> 24) & 1).as<b1>
call_common_by_name:
seq:
- id: na
type: u4
valid: 0
- id: param_status
type: param_status
- id: param_numbers
type: s4
repeat: expr
repeat-expr: param_status.count
- id: return_variable
type: common::magic_number
if: param_status.return_value_enabled
call_event:
seq:
- id: event_id
type: u4
# if it's common event
- id: param_status
type: param_status
if: event_id >= 500000 and event_id <= 599999
- id: param_numbers
type: s4
repeat: expr
repeat-expr: param_status.count
if: event_id >= 500000 and event_id <= 599999
# or other event, here is page-1
- id: page
type: u4
if: event_id < 500000 or event_id > 599999
condition_number__condition:
seq:
- id: variable
type: common::magic_number
- id: value
type: s4
- id: operator
type: u4
enum: common::operator
condition_number:
seq:
- id: use_else_branch
type: b4
valid:
any-of: [0,1]
- id: condition_count
type: b4
- id: na
contents: [0, 0, 0]
- id: conditions
type: condition_number__condition
repeat: expr
repeat-expr: condition_count
branch:
seq:
- id: condition_id
type: u4
branch_end:
seq: []
show_message:
seq: []
chip_management_change_map_chip_settings:
seq:
- id: chipset_id
type: s4
- id: counter
type: b1
- id: square
type: b1
- id: na
type: b1
valid: false
- id: star
type: b1
- id: not_up
type: b1
- id: not_right
type: b1
- id: not_left
type: b1
- id: not_down
type: b1
- id: x
type: b6
- id: downarrow
type: b1
- id: triangle
type: b1
- id: na2
type: u2
instances:
is_reset:
value: chipset_id == -1000000
chip_management_switch_chipset:
seq:
- id: chipset_id
type: u4
chip_management_overwrite_map_chips:
seq:
- id: map_layer
type: u4
- id: map_x
type: u4
- id: map_y
type: u4
- id: width
type: u4
- id: height
type: u4
- id: chip_id
type: u4
seq:
- id: param_count
type: u1
- id: command_type
type: u4
enum: command_type
if: param_count > 0
- id: param
if: param_count > 0
size: param_count * 4 - 4
type:
switch-on: command_type
cases:
command_type::show_message_show_text: show_message
command_type::show_message_comment: show_message
command_type::show_message_debug: show_message
command_type::condition_number: condition_number
command_type::call_event: call_event
command_type::call_event_reserve: call_event
command_type::chip_management_change_map_chip_settings: chip_management_change_map_chip_settings
command_type::chip_management_switch_chipset: chip_management_switch_chipset
command_type::chip_management_overwrite_map_chips: chip_management_overwrite_map_chips
command_type::call_common_by_name: call_common_by_name
command_type::branch: branch
command_type::branch_end: branch_end
- id: branch_depth
if: param_count > 0
type: u1
- id: string_count
if: param_count > 0
type: u1
- id: strings
if: param_count > 0
type: common::t_str
repeat: expr
repeat-expr: string_count
- id: have_route
if: param_count > 0
type: u1
- id: route_info
type: route
if: have_route != 0