Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implemented '.zt' archives. #481

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

trigger-segfault
Copy link

@trigger-segfault trigger-segfault commented May 26, 2021

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

  • Usage: Extras/export pack files for CatSystem2 - often used to save wallpapers, wav files, or other extras to the user's computer.
  • Tag: ZT/PACK (chosen over just ZT, based on the devkit tool name: ztpack.exe, which also describes it as a "pack file").
  • Extension: *.zt (found in export.int archive).
  • Signature: No file signature of any kind, immediately starts with an entry structure. A lot of sanity checks have been added.
  • Hierarchic: Yes, although this is rarely used, and CS2's implementation is rather buggy.
  • Archive layout is the standard offset-next approach seen in other CS2 formats. But there's two offset-next fields: One for subdirectory entries, and one for the next flat (current) directory entry.
    • Folders have their own entries, which are what point to child file entries.

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

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

* Usage: Extras/export pack files for CatSystem2 - often used to save wallpapers, wav files, or other extras to the user's computer.
* Tag: `ZT/PACK` (chosen over *just* `ZT`, based on the devkit tool name: `ztpack.exe`, which also describes it as a *"pack file"*).
* Extension: `*.zt` (found in `export.int` archive).
* Signature: No file signature of any kind, immediately starts with an entry structure. A lot of sanity checks have been added.
* Hierarchic: Yes, although this is rarely used, and CS2's implementation is rather buggy.
    * Buggy enough that Frontwing gave up and started putting zip files **into** zt files!
	* The specification at least, is still well defined.
* Archive layout is the standard offset-next approach seen in other CS2 formats. But there's two offset-next fields, one for subdirectory entries, and one for the next flat (current) directory entry.
    * Folders have their own entries, which are what point to child file entries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant