2 unstable releases
Uses new Rust 2024
| 0.2.0 | Sep 28, 2025 |
|---|---|
| 0.1.0 | Sep 26, 2025 |
#234 in Game dev
84 downloads per month
68KB
1.5K
SLoC
enfusion_pak
A library for reading Enfusion game engine .pak files.
Usage
For the CLI tool:
$ cargo install --locked enfusion_pak
$ enfusion_pak --help
A library/cli for reading Enfusion game engine `.pak` files.
Usage: enfusion_pak [OPTIONS] <FILE>
Arguments:
<FILE> Path to either a single file or a directory containing `.pak` files
Options:
-l, --long Print long file information
-m, --merged Virtually merge contents of files together so that duplicate directories across multiple `.pak` files are treated as a single filesystem entry
-h, --help Print help
-V, --version Print version
For the library:
cargo add enfusion_pak
Examples
There is currently one example of how to use this library, provided in examples/dump_file. After cloning the repo you can run it from the root repo directory with:
cargo run --release --example dump_file -- ARMA_DATA_FILES_DIR /scripts/Game/Campaign/
Support
This currently supports PAK files versioned at 0x10003. Currently older versions are not supported (although they wouldn't be difficult to add if needed).
Features
- sans-io core parser with out-of-the-box support for sync callers. Async wouldn't be too hard to add.
- VFS support through the
vfscrate. - Performant file reading operations
PAK Format
The PAK format is somewhat similar to other container file formats like MP4, but does have inter-chunk references.
The main parsing logic can be found in src/parser.rs.
The following diagram describes the general format:
Chunk format:
┌─────────────────────┬────────────────────┬──────────────────────────────┐
│ 4 byte identifier │ 4 byte data len │ Identifier-specific data... │
└─────────────────────┴────────────────────┴──────────────────────────────┘
┌───────────────────────┐
│ Header Chunk │
├───────────────────────│
│ │
│ Additional Chunks │
│ │
│ │
├───────────────────────│
│ │
│ Data Chunk │
│ │
│ │
│ │
│ Casual 1.8GiB │
┌─▶│ of data │◀─┐
│ │ │ │┌───────────┐
│ │ │ ││ File Meta │
│ │ │ ││has offset │
│ ├───────────────────────┤ ││ into data │
│ │ File Chunk │ ││ chunk │
│ │ │ ││ │
│ ├───────────┬───────────┤ │└───────────┘
│ │ File Meta │ File Meta │──┘
│ ├───────────┼───────────┤
└──│ File Meta │ File Meta │
├───────────┼───────────┤
│ File Meta │ File Meta │
└───────────┴───────────┘
Dependencies
~7–22MB
~280K SLoC