-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase_dat.ksy
101 lines (100 loc) · 2.63 KB
/
database_dat.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
meta:
id: database_dat
endian: le
title: WolfRPG DataBase/CDataBase/SysDataBase.dat file
application: WolfRPG
file-extension: dat
license: MIT
imports:
- common
types:
vdata:
params:
- id: property_block1_count
type: u4
- id: property_block2_count
type: u4
seq:
- id: number_block
type: s4
repeat: expr
repeat-expr: property_block1_count
- id: string_block
type: common::t_str
repeat: expr
repeat-expr: property_block2_count
# used for pretty print the data, very laggy.
# results will stored in _root.type_data[type_id].vdata[data_id].output[property_id]
# vvv comment out the following section for performance
- id: output
type: property_output(_index)
repeat: expr
repeat-expr: _parent.property_count
property_output:
params:
- id: i
type: u4
instances:
type:
value: '_parent._parent.property_position[i].block == 1 ? "number" : "string"'
value_number:
value: 'type == "number" ? _parent.number_block[_parent._parent.property_position[i].pos] : 0'
value_string:
value: 'type == "string" ? _parent.string_block[_parent._parent.property_position[i].pos].str : ""'
# ^^^ comment out the section above for performance
type_data:
seq:
- id: sub_header
contents: [0xfe, 0xff, 0xff, 0xff]
- id: data_id_method
type: u4
enum: common::data_id_method
- id: property_count
type: u4
- id: property_position
type: property_position(_index)
repeat: expr
repeat-expr: property_count
- id: size2
type: u4
- id: vdata
type: vdata(property_block1_count, property_block2_count)
repeat: expr
repeat-expr: size2
instances:
property_block1_count:
value: 'property_count == 0 ? 0 : property_position[property_count -1].sum_block1'
property_block2_count:
value: 'property_count - property_block1_count'
property_position:
params:
- id: i
type: u4
seq:
- id: raw
type: u4
instances:
block:
value: raw / 1000
pos:
value: raw % 1000
sum_block1:
value: '(i == 0 ? (block == 1 ? 1 : 0) : (block == 1 ? _parent.property_position[i - 1].sum_block1 + 1 : _parent.property_position[i - 1].sum_block1)).as<u4>'
seq:
- id: magic
contents: [0, 'W', 0, 0, 'O', 'L']
- id: version_header
type: u1
enum: common::version_header
- id: magic2
contents: ['F', 'M', 0]
- id: version
type: u1
- id: length
type: u4
- id: type_data
type: type_data
repeat: expr
repeat-expr: length
- id: footer
type: u1