repak/README.md

74 lines
3.9 KiB
Markdown
Raw Normal View History

2023-02-01 23:44:57 +00:00
# repak
2023-01-14 18:32:06 +00:00
2023-02-12 16:00:57 +00:00
Library and CLI tool for working with Unreal Engine .pak files.
- Supports reading and writing a wide range of versions
- Easy to use API while providing low level control:
- Only parses index initially and reads file data upon request
- Can rewrite index in place to perform append or delete operations without rewriting entire pak
`repak` CLI
- Sane handling of mount points: defaults to `../../../` but can be configured via flag
- 2x faster unpacking over `UnrealPak`. As much as 30x faster has been observed (on Linux unpacked to ramdisk)
- Unpacking is guarded against malicious pak that attempt to write to parent directories
2023-01-14 18:32:06 +00:00
2023-10-06 21:14:08 +00:00
## cli
```
Usage: repak [OPTIONS] <COMMAND>
Commands:
info Print .pak info
list List .pak files
2023-10-06 21:15:15 +00:00
hash-list List .pak files and the SHA256 of their contents. Useful for finding differences between paks
2023-10-06 21:14:08 +00:00
unpack Unpack .pak file
pack Pack directory into .pak file
get Reads a single file to stdout
help Print this message or the help of the given subcommand(s)
Options:
-a, --aes-key <AES_KEY> 256 bit AES encryption key as base64 or hex string if the pak is encrypted
-h, --help Print help
-V, --version Print version
```
2023-02-01 23:44:57 +00:00
## compatibility
| UE Version | Version | Version Feature | Read | Write |
|------------|---------|-----------------------|--------------------|--------------------|
2023-02-08 04:54:04 +00:00
| | 1 | Initial | :grey_question: | :grey_question: |
| 4.0-4.2 | 2 | NoTimestamps | :heavy_check_mark: | :heavy_check_mark: |
| 4.3-4.15 | 3 | CompressionEncryption | :heavy_check_mark: | :heavy_check_mark: |
| 4.16-4.19 | 4 | IndexEncryption | :heavy_check_mark: | :heavy_check_mark: |
| 4.20 | 5 | RelativeChunkOffsets | :heavy_check_mark: | :heavy_check_mark: |
| | 6 | DeleteRecords | :grey_question: | :grey_question: |
| 4.21 | 7 | EncryptionKeyGuid | :heavy_check_mark: | :heavy_check_mark: |
| 4.22 | 8A | FNameBasedCompression | :heavy_check_mark: | :heavy_check_mark: |
2023-02-01 23:44:57 +00:00
| 4.23-4.24 | 8B | FNameBasedCompression | :heavy_check_mark: | :heavy_check_mark: |
2023-02-08 04:54:04 +00:00
| 4.25 | 9 | FrozenIndex | :heavy_check_mark: | :heavy_check_mark: |
| | 10 | PathHashIndex | :grey_question: | :grey_question: |
| 4.26-4.27 | 11 | Fnv64BugFix | :heavy_check_mark: | :heavy_check_mark: |
| Feature | Read | Write |
|-----------------|--------------------|-------|
| Compression | :heavy_check_mark: | :x: |
| Encrypted Index | :heavy_check_mark: | :x: |
| Encrypted Data | :heavy_check_mark: | :x: |
2023-02-01 23:44:57 +00:00
Supports reading encrypted (both index and/or data) and compressed paks.
2023-02-08 04:54:04 +00:00
Writing does not support compression or encryption yet.
2023-02-12 16:00:57 +00:00
## notes
### determinism
As far as I can tell, the index is not necessarily written deterministically by `UnrealPak`. `repak` uses `BTreeMap` in place of `HashMap` to deterministically write the index and *happens* to rewrite the test paks in the same order, but this more likely than not stops happening on larger pak files.
### full directory index
`UnrealPak` includes a directory entry in the full directory index for all parent directories back to the pak root for a given file path regardless of whether those directories contain any files or just other directories. `repak` only includes directories that contain files. So far no functional differences have been observed as a result.
## acknowledgements
- [unpak](https://github.com/bananaturtlesandwich/unpak): original crate featuring read-only pak operations
- [rust-u4pak](https://github.com/panzi/rust-u4pak)'s README detailing the pak file layout
- [jieyouxu](https://github.com/jieyouxu) for serialization implementation of the significantly more complex V11 index