Last updated
Last updated
SqpkChunk is a 'container' chunk which executes one of several operations in SqpkOperation. These will be detailed in the following subsections.
Important to note that any fields prepended with "Block" will mean that the number is in blocks, or units of 128-bytes. e.g., BlockOffset means that the offset in bytes would be calculated by BlockOffset << 7 or BlockOffset * 128.
These operations often contain fields indicating which file the operation will apply to. These adhere to the following structure:
When referring to block headers, the following struct will be relevant:
This operation writes SqpkAddData.Data to the dat File, at BlockOffset. It will then write BlockDeleteCount blocks of empty (0x00) 128-bytes.
This operation writes BlockCount empty (0x00) 128-byte blocks at BlockOffset, with the first of those blocks containing a BlockHeader struct with:Size = 128, Type = FileSize = UsedBlocks = 0, TotalBlocks = BlockCount
If Delete Data encounters EOF while writing or seeking to BlockOffset, it will fail.
Expand Data follows the same structure as Delete Data, but the behaviour differs. When Expand Data seeks past the end of file or writes past the end of file, it does not fail, since this is its intended use.
Notes:
FilePath is a null terminated utf-8 string. Length of the string is designated by FileHeader.FilePathSize
Notes:
If blkHeader.Compressed is true then the payload is a deflated stream.
If blkHeader.Compressed is false then the payload is a raw bytes stream.
Yes, AlignedBlockSize is very dodgy. Apparently they are rounded up to next multiple of 128 except they're not.
There are no good ways to determine how many blocks are actually encoded in SqpkFileBlocks.
Usually the last block won't be compressed but keeping track of payload.remaining() and stop if it's all read will be more robust against a forged file.
This is currently no-op.
This is currently no-op.