-
Notifications
You must be signed in to change notification settings - Fork 9
HG‐3 Image
Some values unknown but still much more readable than other implementations
This header uses the same structure as HG‐2 Image's header.
Data Type | Value | Description |
---|---|---|
char[4] |
"HG-3" | File Signature |
uint32 |
HeaderSize | Size of this header, always 12 |
uint32 |
Format(?) | Some sort of format applied to the file structure, always 0x300
|
StartPosition = stream.Position
Position = StartPosition + FrameHeader.OffsetNext
StartPosition = stream.Position
do while FrameHeader.OffsetNext != 0
This always immediately precedes the start of the Frame.
Data Type | Value | Description |
---|---|---|
uint32 |
OffsetNext | Offset to the next frame |
uint32 |
ID | Identifier for the frame used in game |
This always immediately precedes the FrameHeader.
TagStartPosition = stream.Position
Data Type | Value | Description |
---|---|---|
char[8] |
"stdinfo" | Name of the data structure following this tag |
uint32 |
OffsetNext | Offset to the next tag |
uint32 |
Length | Length of this tag's data structure |
If the char[8]
field is not "stdinfo", then this file is invalid or corrupted.
This always immediately precedes Tag "stdinfo".
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 |
int32 |
OffsetX | Horizontal offset of the image from the left |
int32 |
OffsetY | Vertical offset of the image from the top |
uint32 |
TotalWidth | Total width of the image with OffsetX applied |
uint32 |
TotalHeight | Total height of the image with OffsetY applied |
bool32 |
IsTransparent | True if transparency is used in the image |
int32 |
BaseX | Horizontal center of the image, used for drawing in-game |
int32 |
BaseY | Vertical center of the image, used for drawing in-game |
Note: The IsTransparent field does not mean the BitDepth will be 24 bits. Sometimes IsTransparent is true because the pixels around the border of a solid image are slightly transparent (Observed with Grisaia Title background).
Both Tag "stdinfo" and Frame Tags are of the same structure, and are both assigned to Tag.
Position = TagStartPosition + Tag.OffsetNext
TagStartPosition = stream.Position
do while Tag.OffsetNext != 0
Data Type | Value | Description |
---|---|---|
char[8] |
TagName | Name of the data structure following this tag |
uint32 |
OffsetNext | Offset to the next tag, 0 if no more tags until next frame |
uint32 |
Length | Length of this tag's data structure |
This always immediately precedes Frame Tags.
Each tag type has a different way of reading the data. See the Tags section for a list of known tags and their structure.
Data Type | Value | Description |
---|---|---|
byte[Tag.Length] | TagName | Data for this tag |
These are all the known tag types that can appear after the Stdinfo structure of a frame. These tags are only considered part of the current frame.
Where ####
is replaced with a four digit number, padded with zeros.
A number other than 0000
has yet to be encountered, and it is unknown what this number is used for.
The binaries for reading HG-3 images don't hardcode the tag as "img0000"
so it must have some sort of use.
Specifies a standard image type that both HG-2 and HG-3 images use.
Data Type | Value | Description |
---|---|---|
uint32 |
Reserved | Seems to always be zero |
uint32 |
Height | Height of the image, same as Stdinfo.Height |
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 |
byte[CompressedDataLength] | UnrleData | Compressed unrle copy data |
byte[CompressedCmdLength] | UnrleCmd | Compressed unrle copy cmd bits |
See ProcessImage for how standard HG-2 and HG-3 images are processed.
Specifies image alpha data that is to be added to Tag "img_jpg".
This tag has yet to be encountered without a Tag "img_jpg".
Unlike the output of Tag "img####" + ProcessImage, there is no padding for the stride of the alpha bytes.
Data Type | Value | Description |
---|---|---|
uint32 |
CompressedLength | Compressed length of alpha bytes |
uint32 |
DecompressedLength | Decompressed length of alpha bytes |
byte[CompressedLength] | Compressed alpha bytes |
Specifies JPEG compressed image data, that can optionally be added to Tag "img_al".
Unlike other tag structures, this structure require's the Tag.Length field.
Data Type | Value | Description |
---|---|---|
byte[Tag.Length] | JpegData | Raw JPEG file data |
When combined with Tag "img_al", all alpha bytes for the JPEG image overwritten by Tag "img_al"'s alpha bytes.
Where ####
is replaced with a four digit number, padded with zeros.
The ####
represents the ID of the attribute which is used to reference it in-game.
Specifies an Attribute, which is a set of coordinates, size, and color for drawing sprites on top of other sprites, such as the 💢 (anger) manpu.
Data Type | Value | Description |
---|---|---|
int32 |
X | X coordinate of the attribute relative to the left of the current frame |
int32 |
Y | Y coordinate of the attribute relative to the top of the current frame |
uint32 |
Width | Width to draw the image with |
uint32 |
Height | Height to draw the image with |
uint32 |
Color | Color to draw the image with, Format: #AARRGGBB
|
It is unknown what this tag specifies, but it is always present at the end of every frame's list of tags.
Data Type | Value | Description |
---|---|---|
uint32 |
CpType | Unknown, very rarely non-zero |
It is unknown what this tag specifies. This tag is very uncommon, and may only be present in newer commercial versions of the CatSystem2 engine.
Data Type | Value | Description |
---|---|---|
uint32 |
ImageMode | Unknown |