pub enum PFHVersion {
PFH6,
PFH5,
PFH4,
PFH3,
PFH2,
PFH0,
}Expand description
PackFile format version.
Identifies the internal format version of a PackFile, which determines its structure, capabilities, and which games can read it.
§Version History
Each variant represents a different format evolution in Total War’s PackFile system. Newer versions generally support more features but may not be readable by older games.
§Compatibility
Games can typically read their own version and sometimes older versions, but cannot read newer versions. For maximum compatibility when creating mods, use the version matching the target game.
Variants§
PFH6
Used in Troy (v1.3.0+).
PFH5
Used in Warhammer 2, Warhammer 3, Three Kingdoms, Troy (pre-1.3.0), Pharaoh, Pharaoh Dynasties, Arena.
PFH4
Used in Warhammer 1, Attila, Rome 2, Thrones of Britannia.
PFH3
Used in Shogun 2.
PFH2
Used in Shogun 2 before patch 15 (Fall of the Samurai expansion).
PFH0
Used in Napoleon and Empire.
Implementations§
Source§impl PFHVersion
Implementation of PFHVersion.
impl PFHVersion
Implementation of PFHVersion.
Sourcepub fn value(&self) -> &str
pub fn value(&self) -> &str
Returns the 4-byte preamble string for this format version.
This is the “magic number” that appears at offset 0x00 in the PackFile header to identify its format version.
§Returns
A 4-character string like "PFH6", "PFH5", etc.
§Example
use rpfm_lib::games::pfh_version::PFHVersion;
assert_eq!(PFHVersion::PFH6.value(), "PFH6");
assert_eq!(PFHVersion::PFH5.value(), "PFH5");
assert_eq!(PFHVersion::PFH0.value(), "PFH0");Sourcepub fn version(value: &str) -> Result<Self>
pub fn version(value: &str) -> Result<Self>
Parses a preamble string into a format version.
Converts a 4-byte preamble read from a PackFile header into the corresponding
PFHVersion enum variant.
§Arguments
value- The 4-character preamble string (e.g.,"PFH5")
§Returns
Returns the matching PFHVersion, or an error if the preamble is not recognized.
§Errors
Returns RLibError::UnknownPFHVersion if the preamble doesn’t match any known version.
§Example
use rpfm_lib::games::pfh_version::PFHVersion;
let version = PFHVersion::version("PFH5").unwrap();
assert_eq!(version, PFHVersion::PFH5);
// Invalid preamble returns error
assert!(PFHVersion::version("PFH9").is_err());Trait Implementations§
Source§impl Clone for PFHVersion
impl Clone for PFHVersion
Source§fn clone(&self) -> PFHVersion
fn clone(&self) -> PFHVersion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PFHVersion
impl Debug for PFHVersion
Source§impl Default for PFHVersion
Implementation of trait Default for PFHVersion.
impl Default for PFHVersion
Implementation of trait Default for PFHVersion.
Source§impl<'de> Deserialize<'de> for PFHVersion
impl<'de> Deserialize<'de> for PFHVersion
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for PFHVersion
Display implementation of PFHVersion.
impl Display for PFHVersion
Display implementation of PFHVersion.
Source§impl PartialEq for PFHVersion
impl PartialEq for PFHVersion
Source§impl Serialize for PFHVersion
impl Serialize for PFHVersion
impl Copy for PFHVersion
impl Eq for PFHVersion
impl StructuralPartialEq for PFHVersion
Auto Trait Implementations§
impl Freeze for PFHVersion
impl RefUnwindSafe for PFHVersion
impl Send for PFHVersion
impl Sync for PFHVersion
impl Unpin for PFHVersion
impl UnsafeUnpin for PFHVersion
impl UnwindSafe for PFHVersion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.