forked from trigger-segfault/TriggersTools.CatSystem2
cst.ksy
Mario W edited this page Oct 20, 2020
·
5 revisions
Kaitai Scruct binary format specification for the CatSystem2 CST scene file format.
meta:
id: cst
title: CS2 CatScene Script
application: cs2
file-extension: cst
license: CC0-1.0
encoding: shift-jis
endian: le
doc-ref:
- https://github.com/trigger-segfault/TriggersTools.CatSystem2/wiki/CST-Scene
- https://cs2.suki.jp/manual/scene/index.html
seq:
- id: magic
contents: 'CatScene'
- id: compressed_size
type: u4
- id: uncompressed_size
type: u4
- id: compressed_script
size: compressed_size
type: cst_script
process: zlib
if: compressed_size != 0
- id: uncompressed_script
size: uncompressed_size
type: cst_script
if: compressed_size == 0
instances:
script:
value: 'compressed_size != 0 ? compressed_script : uncompressed_script'
types:
cst_script:
seq:
- id: length
type: u4
- id: block_count
type: u4
- id: line_table_offset
type: u4
- id: line_data_offset
type: u4
instances:
line_count:
value: (line_data_offset - line_table_offset) / 4
blocks:
type: block_table_entry
pos: header_size
repeat: expr
repeat-expr: block_count
lines:
type: line_table_entry
pos: header_size + line_table_offset
repeat: expr
repeat-expr: line_count
header_size:
value: 16
block_table_entry:
seq:
- id: length
type: u4
- id: start
type: u4
line_table_entry:
seq:
- id: offset
type: u4
instances:
type:
type: u1
enum: line_type
pos: _parent.header_size + _parent.line_data_offset + offset + 1
string:
type: str
terminator: 0
pos: _parent.header_size + _parent.line_data_offset + offset + 2
enums:
line_type:
0x02: input
0x03: page
0x20: message
0x21: name
0x30: command
0xF0: script_name
0xF1: line_no