Darkstone
Choose archive extension:
Contents
MTF
- Format Type : Archive
- Endian Order : Little Endian
Format Specifications
uint32 {4} - Number Of Files
// for each file
- uint32 {4} - Filename Length (not including null)
- char {X} - Filename
- byte {1} - null Filename Terminator
- uint32 {4} - Data Offset
- uint32 {4} - Decompressed File Length
// Data can be compressed
// If compressed the start of the data contains a 12 bytes header:
- byte {1} - Magic ID for compressed data (174 or 175)
- byte {1} - Magic ID for compressed data (190)
- byte {2} - Unknown
- uint32 {1} - Number of data blocs
- uint32 {1} - Flags ?
byte {X} - File Data (compressed or not)
Decompression Pseudo-Code
Decompression code based on information by Guy Ratajczak
First byte of each chunk describes what to do with next data you read.
You need to check every bit:
- If bit=1 then just copy 1 byte from compressed buffer to decompressed buffer
- If bit=0 then read 10 bits for X and 6 bits for Y
- copy X+3 bytes from offset Y of decompressed buffer at the end of decompressed buffer
This is repeated until decompressed buffer reach the Decompressed File Length in MTF header.
Example:
Source data: 7F AA BB CC DD EE FF 99 07 0C ...
Decompressed data:
Step 1: Bit 0 of 7F is 1 -> AA
Step 2: Bit 1 of 7F is 1 -> AA BB
Step 3: Bit 2 of 7F is 1 -> AA BB CC
Step 4: Bit 3 of 7F is 1 -> AA BB CC DD
Step 5: Bit 4 of 7F is 1 -> AA BB CC DD EE
Step 6: Bit 5 of 7F is 1 -> AA BB CC DD EE FF
Step 7: Bit 6 of 7F is 1 -> AA BB CC DD EE FF 99
Step 8: Bit 7 of 7F is 0, 07 0C means X = 3 and Y = 7 -> AA BB CC DD EE FF 99 AA BB CC DD EE FF
MultiEx BMS Script
Not written yet