-
Notifications
You must be signed in to change notification settings - Fork 12
HG‐2 Image
All values and versions are known, with exception to the 8 bytes before compressed length. The same as with HG-3 Image's img#### tag.
This header uses the same structure as HG-3 Image's header.
| Data Type | Value | Description |
|---|---|---|
char[4] |
"HG-2" | File Signature |
uint32 |
HeaderSize | Size of this header, always 12 |
uint32 |
Version | HG-2 version number: 0x10, 0x20, or 0x25
|
The Version field is likely formatted as hex digits, but represented as a decimal version number.
| Hex | Dec | Includes |
|---|---|---|
0x10 |
v1.0 | Single frame, no ID |
0x20 |
v2.0 | Multiple frames, ID, Total Size, Offset XY, Transparent fields |
0x25 |
v2.5 | Base XY fields |
StartPosition = stream.Position
Version 0x10 HG-2 images have only one frame, and no ID. These have never been seen in the wild, but discovered in the assembly instructions for reading HG-2 images.
Position = StartPosition + Frame.OffsetNext
StartPosition = stream.Position
do while Frame.OffsetNext != 0
| Data Type | Value | Description |
|---|---|---|
uint32 |
Width | Condensed width of the image (without transparency) |
uint32 |
Height | Condensed height of the image (without transparency) |
uint32 |
BitDepth | Number of bits per pixel, 24 or 32 |
uint32 |
Reserved1 | Unknown 4-byte value 1, seems to always be zero |
uint32 |
Reserved2 | Unknown 4-byte value 2, seems to always be zero |
uint32 |
CompressedDataLength | Compressed length of unrle copy data |
uint32 |
DecompressedDataLength | Decompressed length of unrle copy data |
uint32 |
CompressedCmdLength | Compressed length of unrle copy cmd bits |
uint32 |
DecompressedCmdLength | Decompressed length of unrle copy cmd bits |
Frame versions 0x20 and up include Version 0x10 data for every frame in the HG-2 image.
| Data Type | Value | Description |
|---|---|---|
uint32 |
OffsetData | Offset from start of Version 0x20 to Image Data Can also be additional length of Frame structure Always >= 0x40
|
uint32 |
ID | Identifier for the frame used in game |
uint32 |
TotalWidth | Total width of the image with OffsetX applied |
uint32 |
TotalHeight | Total height of the image with OffsetY applied |
int32 |
OffsetX | Horizontal offset of the image from the left |
int32 |
OffsetY | Vertical offset of the image from the top |
bool32 |
IsTransparent | True if transparency is used in the image |
uint32 |
OffsetNext | Offset from start of Version 0x10 to next frame Value is 0 if no more frames |
| Data Type | Value | Description |
|---|---|---|
int32 |
BaseX | Horizontal center of the image, used for drawing in-game |
int32 |
BaseY | Vertical center of the image, used for drawing in-game |
This always immediately precedes the Frame structure for Version == 0x10, otherwise it has an additional offset of Frame.OffsetData.
Position = StartPosition + 0x24 + Frame.OffsetData
| Data Type | Value | Description |
|---|---|---|
| byte[CompressedDataLength] | UnrleData | Compressed unrle copy data |
| byte[CompressedCmdLength] | UnrleCmd | Compressed unrle copy cmd bits |
See HG‐X ProcessImage for how standard HG-2 and HG-3 image data is made readable.