-
Notifications
You must be signed in to change notification settings - Fork 1
SHPI
The SHPI is a data structure used to pack together several bitmaps.
Each bitmap has 4-character identifier.
The SHPI has a 16-byte header format
Offset | Length | Type | Data |
---|---|---|---|
0x00 | 4 | String | "SHPI" |
0x04 | 4 | Number | Length of the file (bytes) |
0x08 | 4 | Number | Number of objects in the directory |
0x0C | 4 | String | Directory identifier |
This header is followed by the directory entries, each consisting of a 4-byte identifier string, and a 4-byte offset inside the SHPI structure pointing to the beginning of the corresponding data.
Each entry in the directory represents a bitmap or sometimes a color palette.
There may be gaps between the directory and the first bitmap, and between consecutive bitmaps (significance unknown).
Each directory entry points to a bitmap block with the following structure :
Offset | Length | Data |
---|---|---|
0x00 | 1 | 7Bh |
0x01 | 3 | Block size |
0x04 | 2 | Bitmap width (pixels) |
0x06 | 2 | Bitmap height (pixels) |
0x08 | 4 | Unknown |
0x0C | 2 | X position to display the bitmap |
0x0E | 2 | Y position to display the bitmap |
0x10 | w*h | Bitmap data |
The block size is: width * length + 10h
Each pixel in the bitmap data is represented by 1 byte
The value 0xFF in the bitmaps stands for the background, which is useful when a bitmap has to be drawn on top of another one.