SAV file format

Applies to:
BG1, BG1: TotS, BG2, BG2: ToB, PST, IWD, IWD:HoW, IWD:TotL, IWD2

General Description
This file format acts as a standalone compressed archive. The file is zlib compressed, and allows incremental updates to be carried out quickly and easily.

Detailed Description
Overall structure

Offset Size (data type) Description
0x0000 4 (char array) Signature ('SAV ')
0x0004 4 (char array) Version ('V1.0')

Each file entry consists of file details (e.g. filename) and the compressed file itself.

Offset Size (data type) Description
0x0000 4 (dword) Length of filename
0x0004 variable (ASCIIZ char array) Filename (length specified by previous field)
sizeof(filename)+0x0004 4 (dword) Uncompressed data length
sizeof(filename)+0x0008 4 (dword) Compressed data length
sizeof(filename)+0x000c variable (raw data) Compressed data (length in bytes specified by previous field)