# hunpak
Utility for handling [Heaps](https://heaps.io/) PAK files.
Contained are both a [library](https://crates.io/crates/hunpak) and a command line utility.
> [!caution]
> Be careful when modifying game files, especially when playing online.
The functionality is currently only tested with Northgard and does not support
a fixed alignment.
## Installation
Prebuild binaries for Linux and Windows (untested) are available under
[the releases](https://gitlab.com/SolidTux/hunpak/-/releases).
Alternatively, [install Rust](https://rustup.rs/) and install the command
from source with
```sh
cargo install hunpak
```
## Patching PAK files
The utility also allows for patching PAK files.
For this, patches have to be provided either as a directory or an equivalent ZIP file.
The contents of the folder or archive are added to the PAK file contents,
overwriting existing files with the exception of a required metadata file.
This has to be named `hunpak-patch.json` and follow the schema provided in
`patch-metadata.schema.json`.
An example for Northgard can be found under `examples/patch`,
which replaces the main menu background.
To apply this patch, make a backup copy of the `res.client.pak` file in the Northgard folder
and then apply the patch with
```sh
hunpak repack res.client.pak new.pak -p my-ng-bg.zip
```
Afterwards, copy `new.pak` into the Northgard folder and rename it back to `res.client.pak`.