AVF

From MultimediaWiki
Revision as of 05:39, 20 July 2021 by Kostya (talk | contribs) (fill information from ScummVM code)
Jump to navigation Jump to search

AVF is suspected to be a multimedia format used in the game Nancy Drew: Stay Tuned For Danger. It may be used in other games in the Nancy Drew series.

Header

Old format:

 3 bytes - "ALG"
 7 bytes - unknown
 2 bytes - major version
 2 bytes - minor version

New format:

 15 bytes - "AVF WayneSikes"
 2 bytes  - major version
 2 bytes  - minor version
 1 byte   - unknown

Known versions are 1.0 and 2.0.

Common header:

 2 bytes - number of frames
 2 bytes - width
 2 bytes - height
 1 byte  - depth
 4 bytes - frame time
 1 byte  - compression (should be 2)
 1 byte (version 1.0 only) - unknown

Table of contents entries format

Table of contents entry for version 1.0:

 9 bytes - name
 4 bytes - index
 4 bytes - unknown
 4 bytes - offset
 4 bytes - compressed size

Table of contents entry for version 2.0:

 2 bytes - index
 4 bytes - offset
 4 bytes - compressed size
 4 bytes - uncompressed size
 1 byte  - type
 4 bytes - unknown

Frame compression

Compression type 2 means that frame data is first compressed with LZSS scheme that groups flags into bytes and has spaces as the window fill value.

Type 0 is raw data. Types 1 and 2 employ additional RLE-based compression (or can be empty frames).

The compression method works by issuing one-byte commands for skipping or writing pixel pairs:

  • 0x20 - read 32-bit skip value and 32-bit length value, skip skip * 2 pixels and read length * 2 new pixels
  • 0x40 - read a pixel pair (2 bytes), 32-bit skip value and 32-bit length value, skip skip * 2 pixels and output pixel pair length times
  • 0x80 - read 8-bit length value, read 32-bit number of skip+put operations, read length * 2 new pixels into buffer, and then for the number of skip+put operations read 32-bit skip value, skip skip * 2 pixels and output length * 2 pixels from the buffer