User:Widgeon/Data File Format
From Drunkapedia
This describes the Throne of Destiny file format.
- Cell blocksize is 256
- Portal blocksize is 1024
Directory Node
- The directory nodes are 1740 bytes long
- 1740 / (256 - 4) = 7 blocks
- 1740 / (1024 - 4) = 2 blocks
- 1740 = (62 * 4) + 4 + (62 * 6 * 4)
Each directory node has up to 62 subnodes and 61 keys. t=31. At most 2t-1 = 2*31-1 = 61 keys. At least t-1=30 keys.
- 000: 62 subnode offsets. Offsets are 4 bytes each. Only use the first count+1
- 248: count (4 bytes)
- 252: 62 file entries. File entries are 6x4=24 bytes long. Only use the first count entries.
- The subnode offsets must not be zero, must not be 0xcdcdcdcd, and should be an exact multiple of the blocksize.
File Entry
- 0: version (4 bytes)
- 4: identifier (4 bytes)
- 8: file offset (4 bytes)
- 12: file size (4 bytes)
- 16: modification date (4 bytes). Number of seconds since 1970. This is when the client added the this to the data file.
- 20: unknown (4 bytes)
- Ignore the file entry if the version is zero.