#[non_exhaustive]pub enum Platform {
Win32,
Ps3,
Ps4,
Unknown(u16),
}Expand description
Target platform for SqPack file path resolution.
FFXIV’s SqPack archive files live in platform-specific subdirectories
under the game install root. For example, a data file for the Windows
client lives at sqpack/ffxiv/000000.win32.dat0, while the PS4 equivalent
is sqpack/ffxiv/000000.ps4.dat0. The Platform value stored in an
ApplyContext selects which suffix is used when resolving chunk targets
to filesystem paths.
§Default
An ApplyContext defaults to Platform::Win32. Override this at
construction time with ApplyContext::with_platform.
§Runtime override via SqpkTargetInfo
In practice, real FFXIV patch files begin with an SQPK T chunk
(chunk::SqpkTargetInfo) that declares the target platform. When
Apply::apply is called on that chunk (see src/apply/sqpk.rs,
apply_target_info), it overwrites ApplyContext::platform with the
decoded Platform value. This means the default is only relevant for
synthetic patches or when you know the target in advance and want to assert
it before the stream starts.
§Forward compatibility
The enum is #[non_exhaustive]. The Platform::Unknown variant
preserves unrecognised platform IDs so that newer patch files do not fail
parsing when a new platform is introduced. Path resolution for SqPack
.dat/.index files refuses to guess and returns
ZiPatchError::UnsupportedPlatform carrying the raw platform_id —
silently substituting a default layout would risk writing platform-specific
data to the wrong file.
§Display
Implements std::fmt::Display: "Win32", "PS3", "PS4", or
"Unknown(N)" where N is the raw platform ID.
§Example
use zipatch_rs::{ApplyContext, Platform};
let ctx = ApplyContext::new("/opt/ffxiv/game")
.with_platform(Platform::Win32);
assert_eq!(ctx.platform(), Platform::Win32);
assert_eq!(format!("{}", Platform::Unknown(99)), "Unknown(99)");Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Win32
Windows / PC client (win32 path suffix).
This is the platform used by all current PC releases of FFXIV and is
the default for ApplyContext.
Ps3
PlayStation 3 client (ps3 path suffix).
PS3 support was discontinued after FFXIV: A Realm Reborn. Patches targeting this platform are no longer issued by Square Enix, but the variant is retained for completeness.
Ps4
PlayStation 4 client (ps4 path suffix).
Active platform alongside Windows. PS4 patches share the same chunk structure as Windows patches but target different file paths.
Unknown(u16)
Unrecognised platform ID preserved from a SqpkTargetInfo chunk.
When apply_target_info in src/apply/sqpk.rs encounters a
platform_id it does not recognise, it stores the raw u16 value
here and emits a warn! tracing event. Subsequent SqPack path
resolution returns ZiPatchError::UnsupportedPlatform carrying
the same u16 rather than silently routing writes to a default
layout — quietly substituting win32 paths for an unknown platform
would corrupt the on-disk install with platform-specific data
written to the wrong files. Non-SqPack chunks (e.g. ADIR, DELD,
or SqpkFile operations resolved via generic_path) continue to
apply, so an unknown platform only aborts at the first .dat or
.index lookup.