This is another simple archive format; unlike BIFF files, though, this is a standalone format, and employs compression. Moreover, it is written in such a way as to make incremental additions easy and
quick. It employs the compression of
zlib, written by Jean-loup Gailly and Mark Adler.
Included here is a quick-n-dirty C program, using zlib, to extract the components of a SAV file to their original filenames. A program to do the opposite is left as an exercise for the reader. un_sav.c
|0x0000||4 (char array)||Signature ('SAV ')|
|0x0004||4 (char array)||Version ('V1 ')|
The entries each represent one file, in its modified state, typically AREA and STOR files. They are merely concatenated. In order to seek a particular file, you read the header of the current section (i.e. all except the raw data in the below table). If the filename is the one you are looking for, decompress the section. Otherwise, skip the file stream ahead by "compressed data length" bytes and repeat.
|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)|
[ back to index ]