morkt / GARbro

Visual Novels resource browser
MIT License
2.34k stars 247 forks source link

implemented '.zt' archives. #481

Open trigger-segfault opened 3 years ago

trigger-segfault commented 3 years ago

Add CatSystem2 .zt extension archive format (CatSystem2 pack file).

I wasn't sure what the best course of action for the copyright on a new file was - so the date/time/name info has been filled in, while retaining the copyright to morkt. :)

New Format: ZT/PACK

About fields referenced

The following entry structure is all that exists for the .zt format. It appears at the beginning of the file, and at every following offset.

Note that when UnpackedSize == 0, CS2 takes liberties to skip attempting decompression altogether. However the Size field is still specified, and the minimal Zlib compression RFC header and data is present.

Entry structure fields referenced ### Entry Structure |Type |Value |Description| |-----------:|:-----------|:----------| |`uint32` |OffsetNext |Offset to the next entry in current directory (relative to this entry)| |`uint32` |OffsetChild |Offset to first child entry of this folder (relative to this entry)| |`uint32` |EntryLength |Remaining entry length (after this field)| | | | | |`uint32` |Attributes |`0` = File, `1` = Folder| |`char[260]` |FileName |Base file name (no parent directory names)| |`uint32` |Size |Compressed size of FileData| |`uint32` |UnpackedSize|Decompressed size of FileData| |`byte[Size]`|FileData |Zlib-compressed file data|

Additional references