trigger-segfault / TriggersTools.CatSystem2

A library for extracting from and working with the CatSystem 2 visual novel game engine.
MIT License
50 stars 8 forks source link

About the CST format #2

Open AtomCrafty opened 3 years ago

AtomCrafty commented 3 years ago

Hey, thanks for compiling all of this information in one place! It's been very useful.

I thought I'd share some of my own findings about the CST format, but unfortunately the wiki seems to be read-only.

What you call the "Input Offset Table" is actually the list of script blocks.

Conceptually, a CatScene script consists of a number of blocks, where each block contains one or more lines. Blocks are not only used for skipping, they are also essential so how saving and loading works.
It is not possible to create a save state in the middle of a block, just between them.
When you save while a block is being executed and load the resulting save file, the entire block will start from the beginning.

When debug mode is enabled and you open the "Messages" window, what you are seeing is actually a list of script blocks you can jump to. So if a block contains multiple message lines (even if they are not consecutive), they will be displayed as one concatenated string.

I've also created a a formal definition of the binary format: https://github.com/AtomCrafty/TriggersTools.CatSystem2/wiki/cst.ksy

While disassembling the script compiler (mc.exe), I've discovered some more facts:

trigger-segfault commented 3 years ago

Finally got to adding the line type 0x01 prefix byte knowledge into the wiki CST Scene page. I am speed

Now to add the debug line types. Nearly forgot about those.

Edit: And done, along with the potential for uncompressed files.