Skip to content

Instantly share code, notes, and snippets.

@Qix-
Created November 6, 2021 09:02
Show Gist options
  • Save Qix-/fce044503c1a251375967238d146e220 to your computer and use it in GitHub Desktop.
Save Qix-/fce044503c1a251375967238d146e220 to your computer and use it in GitHub Desktop.
Full MagickaVoxel .VOX kaitai struct definition. Should be completely conformant.
meta:
id: vox
file-extension: vox
endian: le
seq:
- id: magic
contents: ["VOX ", 0x96, 0x00, 0x00, 0x00]
- id: chunks
type: chunk
types:
chunk:
seq:
- id: id
type: u4
enum: chunk_id
- id: content_len
type: u4
- id: children_len
type: u4
- id: content
size: content_len
type:
switch-on: id
cases:
chunk_id::size: ch_size
chunk_id::xyzi: ch_xyzi
chunk_id::rgba: ch_rgba
chunk_id::pack: ch_pack
chunk_id::ntrn: ch_ntrn
chunk_id::ngrp: ch_ngrp
chunk_id::nshp: ch_nshp
chunk_id::matl: ch_matl
chunk_id::layr: ch_layr
chunk_id::robj: ch_robj
chunk_id::rcam: ch_rcam
chunk_id::note: ch_note
chunk_id::imap: ch_imap
- id: children
size: children_len
type: chunk_list
chunk_list:
seq:
- id: chunks
type: chunk
repeat: eos
ch_size:
seq:
- id: x
type: u4
- id: y
type: u4
- id: z
type: u4
ch_xyzi:
seq:
- id: num_voxels
type: u4
- id: voxels
type: voxel
repeat: expr
repeat-expr: num_voxels
types:
voxel:
seq:
- id: x
type: u1
- id: y
type: u1
- id: z
type: u1
- id: palette
type: u1
ch_rgba:
seq:
- id: entries
type: u4
repeat: expr
repeat-expr: 256
ch_pack:
seq:
- id: num_models
type: u4
ch_ntrn:
seq:
- id: node_id
type: u4
- id: attributes
type: dict
- id: child_node_id
type: u4
- type: u4
- id: layer_id
type: u4
- id: num_frames
type: u4
- id: frames
type: dict
repeat: expr
repeat-expr: num_frames
ch_ngrp:
seq:
- id: node_id
type: u4
- id: attributes
type: dict
- id: num_children
type: u4
- id: children
type: u4
repeat: expr
repeat-expr: num_children
ch_nshp:
seq:
- id: node_id
type: u4
- id: attributes
type: dict
- id: num_models
type: u4
- id: models
type: model
repeat: expr
repeat-expr: num_models
types:
model:
seq:
- id: id
type: u4
- id: attributes
type: dict
ch_matl:
seq:
- id: id
type: u4
- id: attributes
type: dict
ch_layr:
seq:
- id: id
type: u4
- id: attributes
type: dict
- type: u4
ch_robj:
seq:
- id: attributes
type: dict
ch_rcam:
seq:
- id: id
type: u4
- id: attributes
type: dict
ch_note:
seq:
- id: num_colors
type: u4
- id: colors
type: str32
repeat: expr
repeat-expr: num_colors
types:
str32:
seq:
- id: len
type: u4
- id: value
type: str
encoding: ascii
size: len
ch_imap:
seq:
- id: mapping
type: u4
repeat: expr
repeat-expr: 256
dict:
seq:
- id: count
type: u4
- id: entries
type: entry
repeat: expr
repeat-expr: count
types:
entry:
seq:
- id: key_len
type: u4
- id: key
type: str
size: key_len
encoding: ascii
- id: val_len
type: u4
- id: val
type: str
encoding: ascii
size: val_len
enums:
chunk_id:
0x0: invalid
0x4e49414d: main
0x4b434150: pack
0x455a4953: size
0x495a5958: xyzi
0x41424752: rgba
0x4c54414d: matl
0x4a424f72: robj
0x45544f4e: note
0x4d414372: rcam
0x5052476e: ngrp
0x4e52546e: ntrn
0x5048536e: nshp
0x5259414c: layr
0x50414d49: imap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment