Skip to content

ASCR format

Gong Xian edited this page Mar 17, 2024 · 8 revisions

ASCR is the primary script format in Sakura Wars 3. They are most commonly found in SBN and SBX files, which contain exactly one ASCR chunk. SBX files are PRS-compressed and used for primary adventure segments. SBN files are uncompressed and used in SRPG stages.

Information on this format is based on findings from this Chief-Net forum thread (archived).

Header

Offset Length Description
0x0 4 The signature 41 53 43 52, or ASCR in ASCII
0x4 4 The size of this file after the first 8 bytes
0x8 4 The signature ba af 55 cc (most common) or 24 f7 01 65
0xc 4 Pointer to text offset table
0x10 4 Number of lines of text in this script
0x14 4 Pointer to offset table for data related to subroutines, purpose currently unknown
0x18 4 Number of entries in the above table
0x1c 4 00

Pointers are replaced with memory locations during execution.

Binary Data Region

Immediately following the header is a data area containing script-specific bytecode. A number of subroutines with ASCII names are contained at the bottom of the text area, with the same number of null-terminated byte arrays in this region. The purpose of these byte arrays is currently unknown.

Text Format

Text is encoded in Shift-JIS and null terminated. It is preceded with a table of offsets. The first string is always blank.

For voiced lines of dialogue, text in ASCR is ignored in favor of corresponding dialogue from the LIPSYNC*.LIP file on the disc. Changing the text in ASCR is not reflected in the game.

The list of strings ends with a number of subroutine calls, and this amount matches the number of entries of the table of binary data. Each set of 4-byte values follows this format:

  1. An index, strictly increasing by 1
  2. An unknown value
  3. A data type, most commonly 0—if this value is 0, value 2 is also 0. Otherwise, this value denotes a relationship between values 2 and 4.
  4. An unknown value

The file ends with at least 1 byte 40 as padding to a 4-byte alignment.

CTPA Format

The CTPA format, found in ESM files, is similar to ASCR, except without a signature after the first 8 bytes. These are used for smaller tables of text within SRPG stages, not dialogue.

Header

Offset Length Description
0x0 4 The signature 43 54 50 41, or CTPA in ASCII
0x4 4 The size of this file after the first 8 bytes
0x8 4 Number of lines of text in this script
0xc 4 Pointer to text offset table
0x10 4 Unknown value, equal to number of lines of text
0x14 4 Pointer to a secondary table
0x18 4 Unknown value
0x1c 4 Unknown value

The text offset table may contain some 00 entries. The text area itself has the same format as ASCR. All strings are located on 4-byte alignments, with up to 3 00 bytes after the null-terminating byte where necessary.