/GAMEDATA/TEXT/*.TPK General Filestructure.
Uncompressing a .tpk file will reveal a script binary.
The .bin file consists of 2 parts
TPK Header
BIN File:
1) script offset data
2) Script data
Example file: H_SPC_00_C00.tpk
Quote (Header)
0x00: 9A84 0400 0100 0000 3000 0000 485F 5350
0x10: 435F 3030 5F43 3030 2E42 494E 0000 0000
0x20: 0000 0000 0000 0000 0000 0000 0000 0000
0x00: file signature [4-bytes] it seems to always be 9A84 0400
0x04: Number of files (Hex) [4-bytes]
0x08: File start address [4-bytes]
0x0C: Filename [n-bytes]
[0x08 - 0x0n] pattern repeats for as many times as there are files in the .bin
there usually is only one file, but several archives, such as the font container have multiple files inside.
Quote (Script Offset data)
0x30: D401 0000 0C00 0000 0000 0000 0000 0000
0x40: 6024 4577 501D 0000 0000 0000 0000 0000
0x50: 6124 4577 681D 0000 0000 0000 0000 0000
0x60: 6224 4577 841D 0000 0000 0000 0000 0000
...
...
...
0x30: Number of entries
0x34: Unknown value (doesn't need to be modified)
0x40: Script index [4-bytes] i dont know the function but it does not need to be modified. !
0x44: String start address [4-bytes] !!!
Each entry is 16 bytes long, but only uses 8 bytes per entry, the remaining 8 bytes are zeroes.
! I believe this is a pointer to reference the script to the associated graphic and configuration data of the event.
!!! This offset is misaligned by size of the BIN header
Pattern: offset + size of header.
Quote (Script data)
...
...
...
0x1D60: 834C E805 AC95 0000 0000 0000 0000 0000
0x1D70: 844C E805 F495 0000 0000 0000 0000 0000
-- last entry of Script offset data.
0x1D80: E5AB 81E3 8395 E383 A9E3 82B0 EFBC 9AE3
0x1D90: 82A8 E383 9E00 0000 E5AB 81E3 8395 E383
0x1DA0: A9E3 82B0 EFBC 9AE3 82BD E383 95E3 82A3
0x1D80: script String [n-bytes] !!!
!!! Length is not defined, script offsets only consist of start address and are being read until reaching 00(hex)
Proof of concept:
Pay no attention to bad inaccuracies, this is ran through google translator only to illustrate the functionality
of above data.
Note: i am aware that the monospaced font is rather unpleasant.
the game's font is a bitmap .fnt file which is rebuildable.
i will examine it on a later date.
Original Script // Test file.