All Dogs Archive format
The Polarware game All Dogs Go To Heaven stores its graphics in two sets of seven archive files with the names MRH_DOG?.DB?. There are two sets of graphics, one for the CGA version of the game and the other for the EGA and TGA versions. Both sets of archive use the same format to store the graphics (and text) chunks used by the game.
Each file is divided into two sections, a header giving the location, size and decompressed size of graphics chunks, and the chunks themselves. Chunks may or may not be compressed; the game decides this by checking to see if the decompressed data size is the same as that of the actual chunk size. All text chunks are uncompressed but only a few graphics chunks are as well. The chunks that are compressed are done so using All Dogs RLE compression which is very inefficient.
The graphics data is either CGA or EGA (With the TGA graphics being based on the EGA data) in linear (rather than planar) format. As such the raw data can simply be given a bitmap header to convert it into a 2bpp or 4bpp image.
Number of images: 0 2 NumImages The total number of images in the file. The header's total size will be this multiplied by 8 plus 2 bytes long. List: 0 2 DeCmpSize Size of the chunk when decompressed, in bytes. 2 2 CmpSize Size of the chunk in the file. 12 4 DataStart Where in the file the chunk starts
Each graphic chunk contains six bytes giving the graphic width (in data bytes, not pixels), height and total size when decompressed (again in bytes).
Some chunks have a corresponding 'mask' chunk used by the game to give the graphic some transparency. This is a black and white image. Other chunks simply set black as the transparent color.
Some (but far from all) of the game's text is stored as 32-byte chunks. Specifically the strings used in the 'hangman' type minigame. These chunks are always uncompressed and nul-padded. They also lack the size size bytes at the start.
The first four bytes of a chunk are not compressed but the next two are, despite bytes 5&6 being metadata (The image size) rather than graphics data.