-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathw3-mdx.ksy
1325 lines (1325 loc) · 26.9 KB
/
w3-mdx.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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
meta:
id: w3_mdx
file-extension: mdx
endian: le
imports:
- w3id
seq:
- id: magic
type: w3id
- id: chunk
type: chunk_router
repeat: expr
repeat-expr: 14
types:
chunk_router:
seq:
- id: magic
type: w3id
- id: size
type: u4
- id: chunk_data
type:
switch-on: magic.value
cases:
'"VERS"': chunk_vers
'"MODL"': chunk_modl
'"SEQS"': chunk_seqs
'"GLBS"': chunk_glbs
'"MTLS"': chunk_mtls(size)
'"TEXS"': chunk_texs
'"GEOS"': chunk_geos
'"GEOA"': chunk_geoa
'"BONE"': chunk_bone
'"HELP"': chunk_help
'"ATCH"': chunk_atch
'"PIVT"': chunk_pivt
'"EVTS"': chunk_evts
'"CLID"': chunk_clid
'"PRE2"': chunk_pre2
'"LITE"': chunk_lite
'"CAMS"': chunk_cams
_: error
size: size
instances:
version:
value: 0x44c
error:
seq:
- id: rest
type: u1
repeat: eos
- id: more
type: str
encoding: ASCII
size: 100
chunk_cams:
seq:
- id: camera
type: camera
repeat: eos
chunk_lite:
seq:
- id: light
type: light
repeat: eos
chunk_pre2:
seq:
- id: particle_emitter2
type: particle_emitter2
repeat: eos
chunk_clid:
seq:
- id: collision_shape
type: collision_shape
repeat: eos
collision_shape:
seq:
- id: node
type: node
- id: type
type: u4
- id: vertex
type: f4_3
repeat: expr
repeat-expr: type == 2 ? 1 : 2
- id: radius
type: f4
if: type == 2 or type == 3
chunk_evts:
seq:
- id: event_object
type: event_object
repeat: eos
chunk_pivt:
seq:
- id: point
type: f4_3
repeat: eos
chunk_atch:
seq:
- id: attachment
type: attachment
repeat: eos
chunk_help:
seq:
- id: helper
type: helper
repeat: eos
helper:
seq:
- id: node
type: node
chunk_bone:
seq:
- id: bone
type: bone
repeat: eos
chunk_geos:
seq:
- id: geoset
type: geoset
repeat: eos
chunk_geoa:
seq:
- id: geoset_anim
type: geoset_anim
repeat: eos
chunk_texs:
seq:
#- id: a
# type: u4
- id: texs_tex
type: texs_tex
repeat: eos
texs_tex:
seq:
- id: id
type: u4
- id: path
type: str
encoding: UTF-8
size: 260
- id: flags
type: u4
chunk_vers:
seq:
- id: version
type: u4
chunk_modl:
seq:
- id: name
type: str
encoding: UTF-8
size: 80
- id: anim_file_name
type: str
encoding: UTF-8
size: 260
- id: extent
type: extent
- id: blend_time
type: u4
chunk_seqs:
seq:
- id: sequence
type: sequence
repeat: expr
repeat-expr: _parent.size / 132
chunk_glbs:
seq:
- id: global_sequence
type: u4
repeat: expr
repeat-expr: _parent.size / 4
chunk_mtls:
params:
- id: size
type: u4
seq:
#- id: inclusive_size
# type: u4
- id: material
type: material(0)
repeat: eos
material:
params:
- id: index
type: u4
seq:
- id: inclusive_size
type: u4
- id: payload
type: material_payload(index)
size: inclusive_size - 4
material_payload:
params:
- id: index
type: u4
seq:
- id: priority_plane
type: u4
- id: flags
type: u4
- id: shader
type: str
encoding: UTF-8
size: 80
if: _root.chunk[0].version > 800 and _root.chunk[0].version < 1100
- id: lays_magic
type: w3id
- id: num_layer
type: u4
- id: layer
type: layer(index)
repeat: expr
repeat-expr: num_layer
layer:
params:
- id: index
type: u4
seq:
- id: inclusive_size
type: u4
- id: layer_payload
type: layer_payload(index)
size: inclusive_size - 4
layer_payload:
params:
- id: index
type: u4
seq:
- id: filter_mode
type: u4
- id: shading_flags
type: u4
- id: texture_id
type: u4
- id: texture_anim_id
type: u4
- id: texture_coord_id
type: u4
- id: alpha
type: f4
- id: emissive_gain
type: f4
if: _root.chunk[0].version > 800
- id: fresnel_color
type: f4
repeat: expr
repeat-expr: 3
if: _root.chunk[0].version > 800
- id: fresnel_opacity
type: f4
if: _root.chunk[0].version > 800
- id: fresnel_team_color
type: f4
if: _root.chunk[0].version > 800
- id: hd
type: u4
- id: num_tex
type: u4
- id: tex_element
type: tex_element
repeat: eos
# if: index == 0
# if: index == 2
#- id: kmte_chunk
# type: kmte_chunk
# repeat: eos
# if: _root.chunk[0].version > 800
#- id: kfc3_chunk
# type: kfc3_chunk
# repeat: eos
# if: _root.chunk[0].version > 900
#- id: kfca_chunk
# type: kfca_chunk
# repeat: eos
# if: _root.chunk[0].version > 900
#- id: kfct_chunk
# type: kfct_chunk
# repeat: eos
# if: _root.chunk[0].version > 900
tex_element:
seq:
- id: discriminator
size: 4
- id: payload
type:
switch-on: discriminator.to_s(ASCII)
cases:
"'KMTF'": kmtf_chunk
"'KMTA'": kmta_chunk
"'KMTE'": kmte_chunk
_: u4
instances:
id:
value: discriminator[0]
if: discriminator[0] != 75 # K
index:
value: payload
if: discriminator[0] != 75 # K
track_magic:
value: discriminator.to_s(ASCII)
if: discriminator[0] == 75 # K
texture_anim:
seq:
- id: inclusive_size
type: u4
- id: ktat_chunk
type: ktat_chunk
- id: ktar_chunk
type: ktar_chunk
- id: ktas_chunk
type: ktas_chunk
extent:
seq:
- id: bounds_radius
type: f4
- id: minimum
type: f4
repeat: expr
repeat-expr: 3
- id: maximum
type: f4
repeat: expr
repeat-expr: 3
sequence:
seq:
- id: name
type: str
encoding: UTF-8
size: 80
- id: interval
type: u4
repeat: expr
repeat-expr: 2
- id: move_speed
type: f4
- id: flags
type: u4
# 0 looping 1 non-looping
- id: rarity
type: f4
- id: sync_point
type: u4
- id: extent
type: extent
geoset:
seq:
- id: inclusive_size
type: u4
- id: geoset_payload
type: geoset_payload
size: inclusive_size - 4
geoset_payload:
seq:
- id: vrtx_magic
type: w3id
- id: num_vertex_position
type: u4
- id: vertex_position
type: vertex_position
repeat: expr
repeat-expr: num_vertex_position
- id: nrms_magic
type: w3id
- id: num_vertex_normal
type: u4
- id: vertex_normal
type: vertex_normal
repeat: expr
repeat-expr: num_vertex_normal
- id: ptyp_magic
type: w3id
- id: num_face_type_group
type: u4
- id: face_type_group
type: u4
repeat: expr
repeat-expr: num_face_type_group
- id: pcnt_magic
type: w3id
- id: num_face_group
type: u4
- id: face_group
type: u4
repeat: expr
repeat-expr: num_face_group
- id: pvtx_magic
type: w3id
- id: num_face
type: u4
- id: face
type: u2
repeat: expr
repeat-expr: num_face
- id: gndx_magic
type: w3id
- id: num_vertex_group
type: u4
- id: vertex_group
type: u1
repeat: expr
repeat-expr: num_vertex_group
- id: mtgc_magic
type: w3id
- id: num_matrix_group
type: u4
- id: matrix_group
type: u4
repeat: expr
repeat-expr: num_matrix_group
- id: mats_magic
type: w3id
- id: num_matrix_index
type: u4
- id: matrix_index
type: u4
repeat: expr
repeat-expr: num_matrix_index
- id: material_id
type: w3id
- id: selection_group
type: u4
- id: selection_flags
type: u4
- id: lod
type: u4
if: _root.chunk[0].version > 800
- id: lod_name
type: str
encoding: UTF-8
size: 80
if: _root.chunk[0].version > 800
- id: extent
type: extent
- id: num_sequence_extent
type: u4
- id: sequence_extent
type: extent
repeat: expr
repeat-expr: num_sequence_extent
- id: tangent_chunk
type: tangent_chunk
if: _root.chunk[0].version > 800 and _root.chunk[0].version < 1200
- id: skin_chunk
type: skin_chunk
if: _root.chunk[0].version > 800 and _root.chunk[0].version < 1200
- id: uvas_magic
type: w3id
- id: num_texture_coordinate_set
type: u4
- id: texture_coordinate_set
type: texture_coordinate_set
repeat: expr
repeat-expr: num_texture_coordinate_set
vertex_position:
seq:
- id: x
type: f4
- id: y
type: f4
- id: z
type: f4
vertex_normal:
seq:
- id: value
type: f4
repeat: expr
repeat-expr: 3
tangent_chunk:
seq:
- id: magic
type: w3id
- id: num_tangent
type: u4
- id: tantent
type: tangent
repeat: expr
repeat-expr: num_tangent
tangent:
seq:
- id: value
type: f4
repeat: expr
repeat-expr: 4
skin_chunk:
seq:
- id: magic
type: w3id
- id: num_skin
type: u4
- id: skin
type: u1
repeat: expr
repeat-expr: num_skin
texture_coordinate_set:
seq:
- id: magic
type: w3id
- id: num_texture_coordinate
type: u4
- id: texture_coordinate
type: texture_coordinate
repeat: expr
repeat-expr: num_texture_coordinate
texture_coordinate:
seq:
- id: x
type: f4
- id: y
type: f4
geoset_anim:
seq:
- id: inclusive_size
type: u4
- id: geoset_anim_payload
type: geoset_anim_payload
size: inclusive_size - 4
geoset_anim_payload:
seq:
- id: alpha
type: f4
- id: flags
type: u4
- id: color1
type: f4
- id: color2
type: f4
- id: color3
type: f4
- id: geoset_id
type: u4
- id: track_chunk
type: geoset_anim_track_chunk_router
repeat: eos
geoset_anim_track_chunk_router:
seq:
- id: magic
type: w3id
- id: chunk
type:
switch-on: magic.value
cases:
'"KGAO"': kgao_chunk
'"KGAC"': kgac_chunk
kgao_chunk:
seq:
- id: value
type: track_chunk_parametric_no_magic("f4")
kgac_chunk:
seq:
- id: value
type: track_chunk_parametric_no_magic("f4_3")
bone:
seq:
- id: node
type: node
- id: geoset_id
type: u4
- id: geoset_anim_id
type: u4
light:
seq:
- id: inclusive_size
type: u4
- id: light_payload
type: light_payload
size: inclusive_size - 4
light_payload:
seq:
- id: node
type: node
- id: type
type: u4
- id: attenuation_start
type: f4
- id: attenuation_end
type: f4
- id: color1
type: f4
- id: color2
type: f4
- id: color3
type: f4
- id: intensity
type: f4
- id: ambient_color1
type: f4
- id: ambient_color2
type: f4
- id: ambient_color3
type: f4
- id: ambient_intensity
type: f4
- id: light_track_chunk_router
type: light_track_chunk_router
repeat: eos
light_track_chunk_router:
seq:
- id: magic
type: w3id
- id: chunk
type:
switch-on: magic.value
cases:
'"KLAS"': klas_chunk
'"KLAE"': klae_chunk
'"KLAC"': klac_chunk
'"KLAI"': klai_chunk
'"KLBI"': klbi_chunk
'"KLBC"': klbc_chunk
'"KLAV"': klav_chunk
helper:
seq:
- id: node
type: node
attachment:
seq:
- id: inclusive_size
type: u4
- id: attachment_payload
type: attachment_payload
size: inclusive_size - 4
attachment_payload:
seq:
- id: node
type: node
- id: path
type: str
encoding: UTF-8
size: 260
- id: attachment_id
type: u4
- id: track_chunk
type: attachment_track_router
repeat: eos
attachment_track_router:
seq:
- id: magic
type: w3id
- id: chunk
type:
switch-on: magic.value
cases:
'"KATV"': katv_chunk
particle_emitter:
seq:
- id: inclusive_size
type: u4
- id: node
type: node
- id: emission_rate
type: f4
- id: gravity
type: f4
- id: longitude
type: f4
- id: latitude
type: f4
- id: spawn_model_file_name
type: str
encoding: UTF-8
size: 260
- id: lifespan
type: f4
- id: initial_velocity
type: f4
- id: kpee_chunk
type: kpee_chunk
- id: kpeg_chunk
type: kpeg_chunk
- id: kpln_chunk
type: kpln_chunk
- id: kplt_chunk
type: kplt_chunk
- id: kpel_chunk
type: kpel_chunk
- id: kpes_chunk
type: kpes_chunk
- id: kpev_chunk
type: kpev_chunk
particle_emitter2:
seq:
- id: inclusive_size
type: u4
- id: particle_emitter2_payload
type: particle_emitter2_payload
size: inclusive_size - 4
particle_emitter2_payload:
seq:
- id: node
type: node
- id: speed
type: f4
- id: variation
type: f4
- id: latitude
type: f4
- id: gravity
type: f4
- id: lifespan
type: f4
- id: emission_rate
type: f4
- id: length
type: f4
- id: width
type: f4
- id: filter_mode
type: u4
- id: num_row
type: u4
- id: num_column
type: u4
- id: head_or_tail
type: u4
- id: tail_length
type: f4
- id: time
type: f4
- id: segment_color
type: segment_color
repeat: expr
repeat-expr: 3
- id: segment1_alpha
type: u1
- id: segment2_alpha
type: u1
- id: segmen3t_alpha
type: u1
- id: segment1_scale
type: f4
- id: segment2_scale
type: f4
- id: segment3_scale
type: f4
- id: segment1_head_interval
type: u4
- id: segment2_head_interval
type: u4
- id: segment3_head_interval
type: u4
- id: segment1_head_decay_interval
type: u4
- id: segment2_head_decay_interval
type: u4
- id: segment3_head_decay_interval
type: u4
- id: segment1_tail_interval
type: u4
- id: segment2_tail_interval
type: u4
- id: segment3_tail_interval
type: u4
- id: segment1_tail_decay_interval
type: u4
- id: segment2_tail_decay_interval
type: u4
- id: segment3_tail_decay_interval
type: u4
- id: texture_id
type: u4
- id: squirt
type: u4
- id: priority_plane
type: u4
- id: replaceable_id
type: u4
- id: particle_emitter2_track_chunk_router
type: particle_emitter2_track_chunk_router
repeat: eos
particle_emitter2_track_chunk_router:
seq:
- id: magic
type: w3id
- id: chunk
type:
switch-on: magic.value
cases:
'"KP2S"': kp2s_chunk
'"KP2R"': kp2r_chunk
'"KP2L"': kp2l_chunk
'"KP2G"': kp2g_chunk
'"KP2E"': kp2e_chunk
'"KP2N"': kp2n_chunk
'"KP2W"': kp2w_chunk
'"KP2V"': kp2v_chunk
ribbon_emitter:
seq:
- id: inclusive_size
type: u4
- id: node
type: node
- id: height_above
type: f4
- id: height_below
type: f4
- id: alpha
type: f4
- id: color1
type: f4
- id: color2
type: f4
- id: color3
type: f4
- id: lifespan
type: f4
- id: texture_slot
type: u4
- id: emission_rate
type: u4
- id: num_row
type: u4
- id: num_column
type: u4
- id: material_id
type: u4
- id: gravity
type: f4
- id: krha_chunk
type: krha_chunk
- id: krhb_chunk
type: krhb_chunk
- id: kral_chunk
type: kral_chunk
- id: krco_chunk
type: krco_chunk
- id: krtx_chunk
type: krtx_chunk
- id: krvs_chunk
type: krvs_chunk
event_object:
seq:
- id: node
type: node
- id: kevt_magic
type: w3id
- id: num_track
type: u4
- id: global_sequence_id
type: u4
- id: track_chunk
type: u4
repeat: expr
repeat-expr: num_track
segment_color:
seq:
- id: color1
type: f4
- id: color2
type: f4
- id: color3
type: f4
camera:
seq:
- id: inclusive_size
type: u4
- id: camera_payload
type: camera_payload
size: inclusive_size - 4
camera_payload:
seq:
- id: name
type: str
encoding: UTF-8
size: 80
- id: position1
type: f4
- id: position2
type: f4
- id: position3
type: f4
- id: field_of_view
type: f4
- id: far_clipping_plane
type: f4
- id: near_clipping_plane
type: f4
- id: target_position1
type: f4
- id: target_position2
type: f4
- id: target_position3
type: f4
- id: camera_track_chunk_router
type: camera_track_chunk_router
repeat: eos
camera_track_chunk_router:
seq:
- id: magic
type: w3id
- id: chunk
type:
switch-on: magic.value
cases:
'"KCTR"': kctr_chunk
'"KTTR"': kttr_chunk
'"KCRL"': kcrl_chunk
collision_shape:
seq:
- id: node
type: node
- id: type
type: u4
- id: vertex
type: f4
repeat: expr
repeat-expr: 3
- id: radius
type: f4
if: type == 2 or type == 3
face_effect:
seq:
- id: target
type: str
encoding: UTF-8
size: 80
- id: path
type: str
encoding: UTF-8
size: 260
corn_emitter:
seq:
- id: inclusive_size
type: u4
- id: node
type: node
- id: lifespan
type: f4
- id: emission_rate
type: f4
- id: speed
type: f4
- id: color1
type: f4
- id: color2
type: f4
- id: color3
type: f4
- id: color4
type: f4
- id: replaceable_id
type: u4
- id: path
type: str
encoding: UTF-8
size: 260
- id: flags
type: str
encoding: UTF-8
size: 260
- id: kppa_chunk
type: kppa_chunk
- id: kppc_chunk
type: kppc_chunk
- id: kppe_chunk
type: kppe_chunk
- id: kppl_chunk
type: kppl_chunk
- id: kpps_chunk
type: kpps_chunk
- id: kppv_chunk
type: kppv_chunk
kgtr_chunk:
seq:
- id: value
type: track_chunk_parametric_no_magic("f4_3") #translation
kgrt_chunk:
seq:
- id: value
type: track_chunk_parametric_no_magic("f4_4") #rotation
kgsc_chunk:
seq:
- id: value
type: track_chunk_parametric_no_magic("f4_3") #scaling
kmtf_chunk:
seq:
- id: value
type: track_chunk_parametric_no_magic("u4") #texture_id
kmta_chunk:
seq:
- id: value
type: track_chunk_parametric_no_magic("f4") #alpha, f4
kmte_chunk:
seq:
- id: value
type: track_chunk_parametric_no_magic("f4") #emissive_gain, f4
kfc3_chunk:
seq:
- id: fresnel_color
type: f4
repeat: expr
repeat-expr: 3
kfca_chunk:
seq:
- id: fresnel_alpha
type: f4
kfct_chunk:
seq: