Expand description
PackFile format version identification.
This module defines the different PackFile format versions used across Total War games. Each version represents a different internal format with varying capabilities and structure.
§PackFile Versions
Total War games have evolved their PackFile format over time:
- PFH6: Troy (v1.3.0+)
- PFH5: Warhammer 2, Warhammer 3, Three Kingdoms, Troy (pre-1.3.0), Pharaoh, Pharaoh Dynasties, Arena
- PFH4: Warhammer 1, Attila, Rome 2, Thrones of Britannia
- PFH3: Shogun 2 (post-patch 15)
- PFH2: Shogun 2 (pre-patch 15, before Fall of the Samurai expansion)
- PFH0: Napoleon, Empire
§Version Identification
PackFiles are identified by a 4-byte “preamble” or “magic number” at the start:
Offset 0x00: "PFH6" or "PFH5" or "PFH4" or "PFH3" or "PFH2" or "PFH0"§Format Differences
Different versions support different features:
- Compression algorithms (newer versions support more formats)
- Header structure and metadata
- File entry format
- Timestamps
- File path encoding
§Usage
ⓘ
use rpfm_lib::games::pfh_version::PFHVersion;
// Get version from preamble string
let version = PFHVersion::version("PFH5").unwrap();
assert_eq!(version, PFHVersion::PFH5);
// Get preamble string from version
assert_eq!(version.value(), "PFH5");Enums§
- PFHVersion
- PackFile format version.