Darkstone: Difference between revisions

From XentaxWiki
Jump to navigation Jump to search
imported>Elbereth
(Completed specification with compression information)
imported>Ikskoks
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 19: Line 19:
: byte {1}&nbsp;&nbsp;&nbsp;&nbsp; - null Filename Terminator <br>  
: byte {1}&nbsp;&nbsp;&nbsp;&nbsp; - null Filename Terminator <br>  
: uint32 {4}&nbsp;&nbsp; - Data Offset <br>  
: uint32 {4}&nbsp;&nbsp; - Data Offset <br>  
: uint32 {4}&nbsp;&nbsp; - Decompressed File <br>  
: uint32 {4}&nbsp;&nbsp; - Decompressed File Length <br>  
<br>
<br>
<font color="blue"> ''' // Data can be compressed ''' </font> <br>  
<font color="blue"> ''' // Data can be compressed ''' </font> <br>  
Line 56: Line 56:
Step 6: Bit 5 of <tt><b>7F</b></tt> is 1 <tt>-></tt> <tt><b>AA BB CC DD EE FF</b></tt><br/>
Step 6: Bit 5 of <tt><b>7F</b></tt> is 1 <tt>-></tt> <tt><b>AA BB CC DD EE FF</b></tt><br/>
Step 7: Bit 6 of <tt><b>7F</b></tt> is 1 <tt>-></tt> <tt><b>AA BB CC DD EE FF 99</b></tt><br/>
Step 7: Bit 6 of <tt><b>7F</b></tt> is 1 <tt>-></tt> <tt><b>AA BB CC DD EE FF 99</b></tt><br/>
Step 8: Bit 7 of <tt><b>7F</b></tt> is 0 <tt>-></tt> <tt><b><font color="green">AA BB CC</font> DD EE FF 99 <font color=red>AA BB CC</font></b></tt><br/><br/>
Step 8: Bit 7 of <tt><b>7F</b></tt> is 0, <tt><b>07 0C</b></tt> means X = 3 and Y = 7 <tt>-></tt> <tt><b><font color="green">AA BB CC DD EE FF</font> 99 <font color=red>AA BB CC DD EE FF</font></b></tt><br/><br/>


=== MultiEx BMS Script ===  
=== MultiEx BMS Script ===  
Line 66: Line 66:
* [[Game Extractor|Game Extractor]]
* [[Game Extractor|Game Extractor]]
* [[Dragon_Unpacker|Dragon UnPACKer]]<br>
* [[Dragon_Unpacker|Dragon UnPACKer]]<br>
[[Category:File Format]]

Latest revision as of 15:12, 3 January 2021

Choose archive extension:

MTF


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

Compatible Programs