WSA File Format

By Ben Owen, 16/08/2009
Revision 1

The .WSA files contain short animation sequences such as those that make up the intro movie. This document details the format used by Dune II v1.07, which differs from those used by both Dune II v1.0 and Command & Conquer. They consist of a header, followed by an array of offsets, and then a series of images compressed using firstly the Format40 algorithm, and then the Format80 algorithm.

The header is:

header {
   Int16 NumFrames; // Number of frames in the sequence
   Int16 Width;     // Width and height of the images
   Int16 Height;
   Int32 Delta;     // Frames per Sec = Delta/(2^10). Seems a little slow?

This is followed by an array of image offsets:

Int32[0..NumFrames + 1] Offsets;

Each frame must first be uncompressed using Format80, and then the result must be decoded using Format40. The first frame should be XOR-ed over a black image (ie. an arrary of zeros), and then the rest of the frames should be XOR-ed over the image that preceded them in the file.

Note that for some .WSA files, the first frame should not be XOR-ed over a black image, but the last frame of the previous .WSA file. For instance, the first frame of HFINALC.WSA should be XOR-ed over the last frame of HFINALB.WSA.

STATIC.WSA appears to have a glitch in as much as when it is uncompressed with Format80, many of the frames are larger than the buffer (4096 bytes, 64 x 64 px). However, allowing a larger buffer for the decoding and then producing bitmaps from only the first 4096 bytes of each frame appears to work fine.


File Formats:

Compression PAK
Copyright © 2009 Ben Owen
Dune 2 and derived graphics © Virgin Interactive