pub struct SqpkFile {
pub operation: SqpkFileOperation,
pub file_offset: i64,
pub file_size: i64,
pub expansion_id: u16,
pub path: String,
pub block_source_offsets: Vec<u64>,
pub blocks: Vec<SqpkCompressedBlock>,
}Expand description
SQPK F command body: a file-level operation on the game install tree.
Unlike the block-oriented commands (A, D, E) that target SqPack
archive internals, F operates on whole files in the install directory.
The operation to perform is selected by operation.
§Wire format
┌──────────────────────────────────────────────────────────────────────────┐
│ operation : u8 b'A', b'R', b'D', or b'M' │ byte 0
│ <padding> : [u8; 2] (always zero) │ bytes 1–2
│ file_offset : u64 BE destination byte offset within the target file │ bytes 3–10
│ file_size : u64 BE declared size of the target file after operation │ bytes 11–18
│ path_len : u32 BE byte length of the path field (including NUL) │ bytes 19–22
│ expansion_id : u16 BE expansion folder selector for `RemoveAll` │ bytes 23–24
│ <padding> : [u8; 2] (always zero) │ bytes 25–26
│ path : [u8; path_len] NUL-terminated UTF-8 path │ bytes 27–…
│ [blocks] : SqpkCompressedBlock… (only for `AddFile`) │
└──────────────────────────────────────────────────────────────────────────┘file_offset and file_size are stored as big-endian u64 in the wire
format but cast to i64 after parsing (negative values in file_offset
cause ZiPatchError::NegativeFileOffset at apply time).
The NUL terminator in path is stripped during parsing; path
always contains a clean UTF-8 string.
For AddFile operations the remaining bytes in the command body after the
path form a sequence of SqpkCompressedBlocks (see that type’s
documentation for the block wire format). For all other operations the block
list is empty.
§Reference
See SqpkFile.cs in the XIVLauncher reference implementation.
§Errors
Parsing returns a crate::ZiPatchError if:
- The operation byte is not
b'A',b'R',b'D', orb'M'→ZiPatchError::UnknownFileOperation. - The path bytes are not valid UTF-8 →
ZiPatchError::Utf8Error. - A block header contains a negative
header_sizeordecompressed_size, or a negative non-sentinelcompressed_size→ZiPatchError::InvalidField. - The body is too short →
ZiPatchError::Io.
Fields§
§operation: SqpkFileOperationThe file operation to perform.
file_offset: i64Destination byte offset within the target file.
For AddFile: if zero, the target file is truncated to zero before
writing (complete replacement); if positive, writing begins at this
byte offset in the existing file. Negative values (cast from the raw
u64) are rejected at apply time with ZiPatchError::NegativeFileOffset.
Unused by RemoveAll, DeleteFile, and MakeDirTree.
file_size: i64Declared total size of the target file after the operation, in bytes.
Informational; the apply layer does not use this to pre-allocate or
truncate the file (truncation is controlled by file_offset == 0).
expansion_id: u16Expansion folder selector used by RemoveAll.
0 → ffxiv (base game), n > 0 → ex<n>. Corresponds to the
high byte of sub_id in block-oriented commands.
path: StringRelative path to the target file or directory under the game install root.
NUL terminator is stripped during parsing. For AddFile / DeleteFile
this is joined with the install root via generic_path. For MakeDirTree
it is the directory tree to create.
block_source_offsets: Vec<u64>Byte offset of each block’s data payload — measured from the start of the SQPK command body slice — after skipping the block’s 16-byte header.
block_source_offsets[i] corresponds to blocks[i]. Adding the chunk’s
absolute position in the patch file to this offset gives the patch-file
byte offset where the block’s data begins, enabling IndexedZiPatch
random-access reads that do not need to decompress the full stream.
Empty for all operations other than AddFile.
blocks: Vec<SqpkCompressedBlock>Inline compressed-or-raw block payloads that make up the file content.
Only populated for AddFile; empty for RemoveAll, DeleteFile, and
MakeDirTree. Each block is decompressed in sequence into the target
file by the apply layer. See SqpkCompressedBlock for the block wire
format and DEFLATE discrimination logic.
Trait Implementations§
impl Eq for SqpkFile
impl StructuralPartialEq for SqpkFile
Auto Trait Implementations§
impl Freeze for SqpkFile
impl RefUnwindSafe for SqpkFile
impl Send for SqpkFile
impl Sync for SqpkFile
impl Unpin for SqpkFile
impl UnsafeUnpin for SqpkFile
impl UnwindSafe for SqpkFile
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