pub struct SqpkHeader {
pub file_kind: TargetFileKind,
pub header_kind: TargetHeaderKind,
pub target: SqpkHeaderTarget,
pub header_data: Vec<u8>,
}Expand description
SQPK H command body: write a 1024-byte SqPack header into a target file.
Every SqPack file (both .dat and .index) begins with one or two
1024-byte header blocks at fixed offsets. The H command replaces one of
these headers atomically as part of a patch.
§Wire format (all big-endian unless noted)
┌──────────────────────────────────────────────────────────────┐
│ file_kind : u8 b'D' = Dat, b'I' = Index │ byte 0
│ header_kind : u8 b'V' = Version, b'I' = Index, b'D' = Data │ byte 1
│ <padding> : u8 (reserved, always 0) │ byte 2
│ main_id : u16 BE SqPack category ID │ bytes 3–4
│ sub_id : u16 BE SqPack sub-category ID │ bytes 5–6
│ file_id : u32 BE dat/index file index │ bytes 7–10
│ header_data : [u8; 1024] raw header bytes │ bytes 11–1034
└──────────────────────────────────────────────────────────────┘§Apply behaviour
TargetHeaderKind::Version→ writeheader_dataat file offset 0.TargetHeaderKind::IndexorTargetHeaderKind::Data→ write at file offset 1024.
The target file is opened via the apply context’s handle cache; the write does not truncate or resize the file.
§Reference
See SqpkHeader.cs in the XIVLauncher reference implementation.
§Errors
Parsing returns crate::ZiPatchError::BinrwError if:
file_kindis notb'D'orb'I'.header_kindis notb'V',b'I', orb'D'.- The body is too short to contain a full 1024-byte
header_data.
Fields§
§file_kind: TargetFileKindWhether the operation targets a .dat or .index file.
Parsed from a single ASCII byte: b'D' → Dat, b'I' → Index.
header_kind: TargetHeaderKindWhich of the two header slots to overwrite.
Parsed from a single ASCII byte: b'V' → Version (offset 0),
b'I' → Index (offset 1024), b'D' → Data (offset 1024).
target: SqpkHeaderTargetThe target SqPack file, tagged by file_kind
so the apply layer can resolve the correct path without carrying a
separate kind value.
Preceded by 1 byte of alignment padding in the wire format.
header_data: Vec<u8>The 1024-byte block to write into the target file’s header slot.
The content follows the SqPack header structure defined by Square
Enix; this crate treats it as an opaque byte array and writes it
verbatim.
Trait Implementations§
Source§impl BinRead for SqpkHeader
impl BinRead for SqpkHeader
Source§fn read_options<R: Read + Seek>(
__binrw_generated_var_reader: &mut R,
__binrw_generated_var_endian: Endian,
__binrw_generated_var_arguments: Self::Args<'_>,
) -> BinResult<Self>
fn read_options<R: Read + Seek>( __binrw_generated_var_reader: &mut R, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>, ) -> BinResult<Self>
Source§fn read<R>(reader: &mut R) -> Result<Self, Error>
fn read<R>(reader: &mut R) -> Result<Self, Error>
Self from the reader using default arguments. Read moreSource§fn read_be<R>(reader: &mut R) -> Result<Self, Error>
fn read_be<R>(reader: &mut R) -> Result<Self, Error>
Self from the reader using default arguments and assuming
big-endian byte order. Read moreSource§fn read_le<R>(reader: &mut R) -> Result<Self, Error>
fn read_le<R>(reader: &mut R) -> Result<Self, Error>
Self from the reader using default arguments and assuming
little-endian byte order. Read moreSource§fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
T from the reader assuming native-endian byte order. Read moreSource§fn read_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Self from the reader using the given arguments. Read moreSource§fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Self from the reader, assuming big-endian byte order, using the
given arguments. Read moreSource§impl Clone for SqpkHeader
impl Clone for SqpkHeader
Source§fn clone(&self) -> SqpkHeader
fn clone(&self) -> SqpkHeader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SqpkHeader
impl Debug for SqpkHeader
Source§impl PartialEq for SqpkHeader
impl PartialEq for SqpkHeader
Source§fn eq(&self, other: &SqpkHeader) -> bool
fn eq(&self, other: &SqpkHeader) -> bool
self and other values to be equal, and is used by ==.