Skip to content

ZT Package

Robert Jordan edited this page May 27, 2021 · 4 revisions

Unlike other CatSystem2 file formats, the .zt package format does not have a proper file header.

ztpack.exe

The CatSystem2 v4.01 toolset containing ztpack.exe fails to extract Folders or their children, even though it has the capability to create zt packages with children. Furthermore, the ability to package folders is poorly documented. In order to package folder structures with ztpack.exe, you must use wildcard paths:

ztpack.exe /d myztfile.zt ./myfiles/*

In this scenario, all files and folders within myfiles/ will be stored as:

./myfiles/myfolder               -> myfolder/
./myfiles/myfolder/mysubfile.txt -> +- mysubfile.txt
./myfiles/mypngfile.png          -> mypngfile.png

File Structure

do while FileEntryHeader.OffsetNext != 0

TODO: Document FileEntryHeader.OffsetChildren behavior. OffsetChildren points to this entry's child entries. If either OffsetNext or OffsetChildren are non-zero, then there is more to read. Offset values are always relative to the entry defining them, meaning you will need to track the positions of parent entries when following child offsets.

FileEntryHeader

Position = StartPosition + FileEntryHeader.OffsetNext
StartPosition = stream.Position

TODO: Document FileEntryHeader.OffsetChildren behavior. Behaves the same as OffsetNext.

Data Type Value Description
uint32 OffsetNext Offset to the next FileEntryHeader at current depth
uint32 OffsetChildren Offset to first child FileEntryHeader of this entry
uint32 Length Length of FileEntry after this header

FileEntry

This always immediately precedes the FileEntryHeader.

Data Type Value Description
uint32 Attributes 0 = File, 1 = Directory
(possibly bool32)
char[260] FileName The file name of the entry
uint32 CompressedSize Compressed size of file
uint32 DecompressedSize Decompressed size of file
byte[CompressedSize] FileData Zlib-compressed file data
Clone this wiki locally