DAT/DTT files are general containers found within the compressed .cpk files
struct Header
{
std::uint32_t Magic; // 'DAT\x00'
std::uint32_t FileCount;
std::uint32_t FileTableOffset;
std::uint32_t ExtensionTableOffset;
std::uint32_t NameTableOffset;
std::uint32_t SizeTableOffset;
std::uint32_t UnknownOffset1C;
std::uint32_t Unknown20; // Zero
};All offsets are relative to the beginning of the file.
struct FileEntry
{
std::uint32_t Offset;
};union ExtentionTableEntry
{
char Extension[4]; // 'bin\x00' , 'pak\x00', 'z\x00\x00\x00', etc
std::uint32_t u32;
};struct FileSizeEntry
{
std::uint32_t Size;
};Each table Offset has FileCount number of entries. NameTable is pre-pended with an std::uint32_t integer of the string's alignment. All strings take up alignment number of bytes including the null-terminator.
Example name table:
0000h:|16 00 00 00|71 31 37 31 5F 35 30 36 61 30 35 63 ....q171_506a05c
0010h: 30 5F 67 72 70 2E 70 61 6B 00|71 31 37 31 5F 31 0_grp.pak.q171_1
0020h: 32 66 32 39 36 33 61 5F 73 63 70 2E 62 69 6E 00| 2f2963a_scp.bin.
0030h: 71 31 37 31 5F 68 61 70 2E 70 61 6B 00 00 00 00 q171_hap.pak....
0040h: 00 00 00 00 00 00| ......
would have the alignment 0x16(22) and would have the strings q171_506a05c0_grp.pak\x00, q171_12f2963a_scp.bin\x00, and q171_hap.pak\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 all padded to 22 bytes.
DTT files are DAT files intended to store texture(.wtp) and model(.wmb) data among others(bxm,mot,sop,etc). .wtp files are regular DirectX textures(.dds) and can simply be renamed to a .dds extension. .wmb files contain model data in a deeply nested table format.
How do i use this to unpack the .dat and .dtt files? I'm not familliar with ruby so i am confused. Many thanks.