pub struct SqpkExpandData {
pub target_file: SqpackFileId,
pub block_offset: u64,
pub block_count: u32,
}Expand description
SQPK E command body: grow a .dat file by writing empty-block markers
into a previously unallocated region.
ExpandData and SqpkDeleteData produce the same
on-disk result — both write a SqPack empty-block header at block_offset
followed by zeroed bytes for the full block range. The semantic difference is
in the patch’s intent:
E(ExpandData) extends the file into space that did not previously exist, growing the archive. It typically precedes a series ofA(AddData) writes into that newly allocated space.D(DeleteData) clears existing live blocks, logically freeing them.
The apply implementation (src/apply/sqpk.rs) handles both commands with
the same write_empty_block helper.
§Wire format (all big-endian)
┌────────────────────────────────────────────────────────────────────┐
│ <padding> : [u8; 3] (reserved, always zero) │ bytes 0–2
│ main_id : u16 BE │ bytes 3–4
│ sub_id : u16 BE │ bytes 5–6
│ file_id : u32 BE │ bytes 7–10
│ block_offset_raw : u32 BE multiply by 128 to get byte offset │ bytes 11–14
│ block_count : u32 BE number of 128-byte blocks to allocate │ bytes 15–18
│ <reserved> : u32 (always zero) │ bytes 19–22
└────────────────────────────────────────────────────────────────────┘block_offset_raw is in 128-byte SqPack block units and is multiplied
by 128 (<< 7) during parsing. block_count is a direct block count (not
a byte count) and is stored as-is.
The total byte range affected by this command is block_count * 128 bytes
starting at block_offset.
§Reference
§Errors
Parsing returns crate::ParseError::Decode if the body is too
short to contain all required fields.
Fields§
§target_file: SqpackFileIdSqPack file to expand.
Preceded by 3 bytes of alignment padding in the wire format.
block_offset: u64Byte offset within the target .dat file at which the new block range
begins.
Decoded from a raw big-endian u32 by multiplying by 128 (raw << 7).
The raw wire value is in 128-byte SqPack block units.
block_count: u32Number of 128-byte SqPack blocks to allocate.
Stored directly as a big-endian u32 without any unit shift. The
total byte length of the affected region is block_count * 128.
Must be non-zero; the apply layer’s write_empty_block helper returns
an error for block_count == 0.
Followed by 4 bytes of reserved padding (pad_after = 4) in the wire format.
Trait Implementations§
Source§impl BinRead for SqpkExpandData
impl BinRead for SqpkExpandData
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 SqpkExpandData
impl Clone for SqpkExpandData
Source§fn clone(&self) -> SqpkExpandData
fn clone(&self) -> SqpkExpandData
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 SqpkExpandData
impl Debug for SqpkExpandData
Source§impl PartialEq for SqpkExpandData
impl PartialEq for SqpkExpandData
Source§fn eq(&self, other: &SqpkExpandData) -> bool
fn eq(&self, other: &SqpkExpandData) -> bool
self and other values to be equal, and is used by ==.Source§impl ReadEndian for SqpkExpandData
impl ReadEndian for SqpkExpandData
Source§const ENDIAN: EndianKind
const ENDIAN: EndianKind
impl Eq for SqpkExpandData
impl StructuralPartialEq for SqpkExpandData
Auto Trait Implementations§
impl Freeze for SqpkExpandData
impl RefUnwindSafe for SqpkExpandData
impl Send for SqpkExpandData
impl Sync for SqpkExpandData
impl Unpin for SqpkExpandData
impl UnsafeUnpin for SqpkExpandData
impl UnwindSafe for SqpkExpandData
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