Skip to content

CSTL Scene Languages

Robert Jordan edited this page Aug 15, 2022 · 5 revisions

Format specification discovered thanks to marcussacana/CatSceneEditor.

🚧 This page is a work in progress

File Structure

Data Type Value Description
char[4] "CSTL" File Signature
uint32 Reserved? Second half of char[8] signature?
FFInt LangCount Number of languages in the Language Table table.
FFString[LangCount] Languages Table of Languages present in Messages
FFInt Count Number of localized message entries.
Message[Count] Messages Entries for every localizable message in a scene(?)

FF Encoded Structures

FF Encoded Uint

This is a universal code for storing unsigned integer values. It optimizes for values that are rarely larger than one byte. (larger than 254)

Dec Hex Encoded
0 0x0 0x00
254 0xFE 0xFE
255 0xFF 0xFF 00
256 0x100 0xFF 01
513 0x201 0xFF FF 03

Formula for number of bytes: (Value / 255) + 1

uint ReadFFEncodedInt(BinaryReader reader) {
  // UInt64 storage is also valid, but
  // likely unsupported by CatSystem2.
  uint value = 0;

  // Read first byte and add to value
  byte current;
  do {
    current = reader.ReadByte();
    value += current;
    // While code is 0xFF, read & add next byte, repeat
  } while (current == 0xFF);

  return value;
}

FF Encoded String

A UTF-8 string with a prefixed FF Encoded Int length (in bytes).

Data Type Value Description
FFInt Length Length of String in bytes
char[Length] String A UTF8 string of Length bytes.

Language Table

Data Type Value Description
FFInt Count Number of Languages
FFString[Count] Languages List of language names (i.e "en", "jp", "ch")

Message Table

Data Type Value Description
FFInt Count Number of message entries.
Message[Count] Messages Entries for every localizable message in a scene(?)

Message

A single scene message (speaker/content) with definitions for each language in the Languages table.

The index of the message in Localizations uses the language of the same index in the Language Table.

Data Type Value Description
MsgLang[LangCount] Localizations Localizations of this message for each language

Message Language

Defines a Name (speaker) and content of the message for a specific language.

Data Type Value Description
FFString Name Message speaker, or empty string
FFString Content Message content

See Also

Clone this wiki locally