Wing Commander 3 and 4
- Format Type : Archive
- Endian Order : Little Endian
A TRE resource is laid out as follows:
bytes 0-3 'XTRE' file signature bytes 4-7 unknown bytes 8-11 absolute file offset of ID table bytes 12-15 absolute file offset of optional filename table bytes 16-19 absolute file offset of file data offset table bytes 20-23 absolute file offset of start of file data [ID table] [optional filename table] [file data offset table] [file data]
The TRE resource may or may not contain a filename table. If it does not contain a filename table the offset of the optional filename table will be equal to the offset of the file data offset table.
The ID table contains a list of file IDs and offsets that index into the filename table. Each 32-bit file ID entry is actually a special checksum calculated over all of the bytes of the data file.
Each entry is laid out as:
bytes 0-3 32-bit file ID bytes 4-7 absolute file offset that points into the next table
If there is no file in the TRE resource that corresponds to a particular entry, the ID will be all 0's and the filename offset will be all 1's. If the TRE resource has a filename table the offset in bytes 4-7 will point into the filename table. Otherwise, bytes 4-7 will point into the file data offset table.
The filename table contains a list of MS-DOS-style filenames and offsets that index into the file data offset table. Each entry is laid out as:
byte 0 length (n) of filename string, including length byte bytes 1-n filename bytes n+1... absolute file offset that points into file data offset table
The file data offset table contains absolute file offsets that point to the start of individual files within the TRE resource. Each 4-byte entry is an absolute offset that points to the file's data within the main body of the TRE resource.
MultiEx BMS Script
Not written yet