The FLAT file format

The .flat file format is used for animations. It stores CGs alongisde the data used to compose and animate them.

.flat files are organized into sections. Each section begins with a 4-byte magic word, followed by the length of the section, and then the data for that section.

Size (Bytes) Name Notes
4 section_magic Section name
4 section_size Size of section_data
section_size section_data The data

ELNA Section

Optional. This seems to have been added in Rance 03, but all of the files I’ve seen in the wild have a section length of 0.

FLAT Section

Nothing is known about this section. It’s pretty short, probably just some metadata.

TMNL Section

Optional.

Nothing is known about this section.

MTLC Section

This section contains a single zlib compressed blob. Otherwise nothing is known about it.

Size (Bytes) Name Notes
4 uncompressed_size
Varies compressed_data Occupies the remainder of the section

LIBL Section

This section serves as an embedded file archive. Presumably the other sections reference the files stored here.

Size (Bytes) Name Notes
4 file_count Number of files in this section
Varies files List of LIBL file entries

LIBL File Entry

Size (Bytes) Name Notes
4 unknown_size Size of following field
~unknown_size unknown Size is aligned to 4-byte boundary
4 file_type Type of the file
4 file_size Size of the file
Varies file_data The contents of the file

Note: Sometimes there is an extra dword prepended to CG file data. I’m not sure why.

LIBL File Types

Value Type
2 CG
5 Compressed data (zlib DEFLATE)

TALT Section

This section contains a list of .ajp files with a variable amount of metadata associated with each file.

This section is optional.

Size (Bytes) Name Notes
4 file_count Number of .ajp files in this section
Varies files List of TALT file entries

TALT File Entry

Size (Bytes) Name Notes
4 file_size Size of the file
~file_size file_data Size is aligned to 4-byte boundary
4 meta_count Number of metadata entries
Varies metadata List of metadata entries

TALT Metadata Entry

Size (Bytes) Name Notes
4 unknown1_size Size of following field
~unknown1_size unknown1 Size is aligned to 4-byte boundary
4 unknown2
4 unknown3
4 unknown4
4 unknown5