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 |
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.
Nothing is known about this section. It’s pretty short, probably just some metadata.
Optional.
Nothing is known about this 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 |
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 |
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.
Value | Type |
---|---|
2 | CG |
5 | Compressed data (zlib DEFLATE) |
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 |
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 |
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 |