- C 95.3%
- Makefile 4.7%
| src | add license | |
| .gitignore | Init commit | |
| LICENSE | add license | |
| Makefile | Add release builds | |
| README.md | Fixed some mistakes in readme | |
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.