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 ==.Source§impl ReadEndian for SqpkHeader
impl ReadEndian for SqpkHeader
Source§const ENDIAN: EndianKind
const ENDIAN: EndianKind
impl Eq for SqpkHeader
impl StructuralPartialEq for SqpkHeader
Auto Trait Implementations§
impl Freeze for SqpkHeader
impl RefUnwindSafe for SqpkHeader
impl Send for SqpkHeader
impl Sync for SqpkHeader
impl Unpin for SqpkHeader
impl UnsafeUnpin for SqpkHeader
impl UnwindSafe for SqpkHeader
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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