1
0
Fork
You've already forked pack
0
Simple archive format inspired by tar.
  • C 95.3%
  • Makefile 4.7%
2026年06月04日 18:39:20 +03:00
src add license 2026年05月15日 19:31:20 +03:00
.gitignore Init commit 2026年04月03日 16:42:11 +03:00
LICENSE add license 2026年05月15日 19:31:20 +03:00
Makefile Add release builds 2026年05月02日 17:19:00 +03:00
README.md Fixed some mistakes in readme 2026年06月04日 18:39:20 +03:00

PACK

This library? is an easy way to pack multiple files into one archive file. I made this project to store assets for my future games..

The format

The format is simple. There's a header around 9bytes large.

Size (bytes) Name Description
4 Magic Contains string "PZCK"
1 Major version Major version
1 Minor version Minor version
2 Reserved Probably for future use?
4 File count The number of files in the archive

After this the file data begins. This archive is very simple and not well optimized. Eeach file begins with a file header:

Size (bytes) Name Description
4 Id The id of the file. Should be unique
8 Tags Tags of the file.
8 Size The size in bytes of the file
8 Offset Offset from the beggining for the archive where file data is located

Why Id and Tags? This archive format is mostly optimized for games. Tags can be whatever you decide. For example you can have tag: 3 for maps. If you have many maps their Id should be unique. In short you can have repeating tags but not repeating ids for the same tag. (You can have same id for diferent tags).

Working with the library.

You can probably figure out how the library works if you look into pack.h

The only thing not explained in there is the commit stuff.

Instead of deleting/adding file to archive when you call pack_append / pack_delete these functions create commits (a linked list of operations). When you call pack_commit the changes will be written.