source: doc/Dune 2 SHP specification.txt

Last change on this file was 5, checked in by chronos, 8 years ago
  • Added: Various data format descriptions.
File size: 2.6 KB
Line 
1======================
2Dune 2 SHP file format
3======================
4Sourced from Red Horizon Utilities by Emanuel Rabina
5http://www.ultraq.net.nz/redhorizon/
6
7The Dune 2 SHP file, is a multiple image filetype, where each image can have
8it's own set of dimensions. The file is structured as follows:
9
10File header:
11 NumImages (2 bytes) - the number of images in the file
12 Offsets[NumImages + 1] - offset to the image header for an image. The last
13 (2 or 4 bytes each) offset points to the end of the file. The offsets
14 don't take into account the NumImages bytes at the
15 beginning, so add 2 bytes to the offset value to
16 get the actual position of an image header in the
17 file
18
19The size of the offsets can be either 2 or 4 bytes. There is no simple way
20to determine which it will be, but checking the file's 4th byte to see if
21it's 0, seems to be a commonly accepted practice amongst existing Dune 2 SHP
22file readers:
23
24eg: A 2-byte offset file: 01 00 06 00 EC 00 45 0A ...
25 A 4-byte offset file: 01 00 08 00 00 00 EC 00 ...
26 ^^
27The marked byte will be 0 in 4-byte offset files, non 0 in 2-byte offset
28files.
29Lastly, like C&C SHP files, there is an extra offset, pointing to the end of
30the file (or what would have been the position of another image header/data
31pair).
32
33Following the file header, are a series of image header & image data pairs.
34The image header is structured as follows:
35
36Image header:
37 Flags (2 bytes) - flags to identify the type of data following the
38 Datasize field, and/or the compression schemes used
39 Slices (1 byte) - number of Format2 slices used to encode the image
40 data. Often this is the same as the height of the
41 image
42 Width (2 bytes) - width of the image
43 Height (1 byte) - height of the image
44 Filesize (2 bytes) - size of the image data in the file
45 Datasize (2 bytes) - size of the image data when Format2 encoded/compressed
46
47Regarding the flags, there seem to be 4 values:
48 - 00000000 (0) = Decompress with Format80, then Format2
49 - 00000001 (1) = (see 3)
50 - 00000010 (2) = Decompress with Format2
51 - 00000011 (3) = A small 16-byte lookup table follows, and the image data
52 should be decompressed with Format80 then Format2.
53 - 00000101 (5) = The first byte gives the size of the lookup table that
54 follows, and the image data should be decompressed with
55 Format80 then Format2.
56
57And after this image header is the image data.
Note: See TracBrowser for help on using the repository browser.