TR4 and TR5 use a file format with the extension PAK
for certain files (mostly pictures). This file format is actually a container for raw binary content, compressed using zlib.
struct pak_file { uint32_t UncompressedSize; // Uncompressed size of data (4 bytes) uint8_t CompressedData[]; // zlib-compressed data (read until EOF) }
UncompressedSize
field is used by the game to allocate the buffer for uncompressed data. Do not put a wrong value here, or it’ll result in unexpected and wrong behaviour.