This article is about Gotcha Force MDT file format and ongoing researches on it.
This file format needs more research. Researches on headers / bodies structures are partially achieved. |
mdt files:
MDT files are same than pzz but packing only uncompressed files.
MDT header (0x800 bytes):
- 4 bytes - uint32 file count (big endian)
- 4 bytes - uint32 array: file size divided by 0x800 and upper rounded for each file
All .mdt contains 2 files:
- 000 dat file with texts used in the game
- 001 TPL including an alphanumeric alphabet used by the dat file
dat file:
header:
- 4 bytes - paragraph_offsets_blocks_list offset
- 4 bytes - symbols_count # number of symbols contained in the tpl
- 2 bytes - universal symbols ID shared between all .mdt and positional from tpl file
paragraph_offsets_blocks_list:
- 4 bytes - uint32 absolute offsets - array of paragraph_offsets_block terminated by -1 (FF FF FF FF)
paragraph_offsets_block 0:
- first paragraph_offsets_block describing all paragraph offsets in the data block 0
- 4 bytes - int32 array of absolute offsets which point to pragraphs in the data block terminated by -1 (FF FF FF FF). The first offset is the data block offset.
data_block 0:
- 2 bytes - signed int16 list <- paragraph_offsets_block 0 describe where each paragraph begins.
paragraph_offsets_block 1: ... data_block 1: ...
align:
The header length is aligned to 32 bytes and if there is no pad we add 32 bytes of pad. paragraphs_offsets_block are aligned to 16 bytes. Each paragraph is aligned to 32 bytes.
Text engine NTSC/USA
data_block contains int16 indexes relative to the tpl symbol list. First symbol in the tpl has number 0 then horizontally symbol 1, 2 ... So data block(s) contains texts.
- FFyy: <- each negative value describes something not present in the tpl
- FFFE: Appends a whitespace character to the text.
- FFFD: Appends a small whitespace character to the text.
- 10yy:
- 1000: Appends a newline character to the text.
- 1001: Marks the end of the text. All text must end with this.
- 80yy:
- 8000: Appends the Player's name to the text.
- 8001: Appends an unidentified string to the text.
- 8002 (1 param): Applies a color preset from the param index to the text. An 0xFFFF param disables it.
- 8003 (1 param): Appends an unidentified string from the param index to the text.
The text engine uses a hash table corresponding to symbols and allow to color the textures or use vars like player name. This hashtable is also used in the dol data sections for instance to encode texts.
Each paragraph begins with:
- 2 bytes - total_paragraph_len - starting after the paragraph header and uint16 count
- 2 bytes - total_lines_count
- 2 bytes - max_lines_len - including the last \x10\x01
Here is the hashtable:
81 43 , 81 44 . 81 45 ° 81 46 : 81 47 ; 81 48 ? 81 49 ! 81 51 _ 81 5e / 81 65 ` 81 66 ' 81 68 " 81 69 ( 81 6a ) 81 7b + 81 7c - 81 7e × 81 80 ÷ 81 81 = 81 83 < 81 84 > 81 93 % 81 94 # 81 95 & 81 96 * 81 97 @ 81 a5 ` 82 4f 0 82 50 1 82 51 2 82 52 3 82 53 4 82 54 5 82 55 6 82 56 7 82 57 8 82 58 9 82 60 A 82 61 B 82 62 C 82 63 D 82 64 E 82 65 F 82 66 G 82 67 H 82 68 I 82 69 J 82 6a K 82 6b L 82 6c M 82 6d N 82 6e O 82 6f P 82 70 Q 82 71 R 82 72 S 82 73 T 82 74 U 82 75 V 82 76 W 82 77 X 82 78 Y 82 79 Z 82 81 a 82 82 b 82 83 c 82 84 d 82 85 e 82 86 f 82 87 g 82 88 h 82 89 i 82 8a j 82 8b k 82 8c l 82 8d m 82 8e n 82 8f o 82 90 p 82 91 q 82 92 r 82 93 s 82 94 t 82 95 u 82 96 v 82 97 w 82 98 x 82 99 y 82 9a z 83 bf ` 89 ce ` 8c ba ` 8c d5 ` 8e e9 ` 90 9d ` 90 c2 ` 92 b4 ` 94 92 ` 95 90 ` 97 b4 `
Virtual World RE has developed the python script mdttool.py to manipulate MDT files and their internal files allowing to unpack / pack mdt files.