benilla-re systems structs docs

SFile::SetFilePointer

function · storm · orchestration

Address
0x648a60 · 359 bytes, up to 0x648bc6
Signature
uint32_t __stdcall (SFileObject *file, int32_t distance, int32_t *distanceHigh, uint32_t method)
Meaning
Moves an open file's position by its kind; a .bz file skips by reading and restarts its stream to go back
Confidence
verified, proof one
Finding
storm/bz#size-and-seeking
Test
storm::bz_seek_difftest, storm::bz_damaged_difftest

Finding: Size and seeking in storm: compressed loose files

SFile::GetFileSize answers kind 1 with the header's size and leaves the high word unwritten. SetFilePointer's &high is neither read nor written for kind 1. SFile::SetFilePointer(file, distance, &high, method) for kind 1: method 0 below the position ends the inflate, starts it again, empties the input, seeks the file to offset 24 and skips distance bytes, and at or above it skips distance - position; method 1 skips distance; any other method moves nothing. A skip of 0 or less does nothing. Skipping reads through a 4 KiB stack buffer, at most 0x1000 bytes a read; a failed read returns 0, else the function returns the position.

The derivation is in the doc.

Callers 7

Callees 10

Calls and jumps by a bare address, from tables/calls.tsv.