Skip to content

TGR File Format

sceadu37 edited this page May 6, 2025 · 2 revisions

The TGR file format is built on top of the IFF file format and is comprised of a FORM chunk, followed by a HEDR chunk, followed optionally by a PALT chunk, and finally one or more FRAM chunks. See the sections below for descriptions and specifications of the different chunk types.

All IFF chunks have a standard header consisting of the chunks 4-ascii-character identifier, followed by the size of the chunk minus the header, in bytes. The chunk size is stored as a big-endian uint32.

FORM

Like all FORM chunks in IFF files, the FORM chunk in a TGR file consists of a chunk header followed by the size in bytes of the rest of the file, stored as a big-endian uint32.

HEDR

Note: all coordinates are measured in pixels from the top-left corner of the sprite.

offset size name notes
0x00 4 * char Chunk Name This is always 0x00000EF0 ("HEDR")
0x04 uint32 Chunk Size size of chunk - header; big endian
0x08 uint32 Version Version number of program used to create the file. The first 16 bits contains the minor version and the second 16 bits contains the major version
0x0C uint16 Frame Count The number of FRAM chunks in the file
0x0E byte Bit Depth bits per RGB pixel, default is 16
0x0F byte File Type This will be 0x00 for game objects, 0x01 for portraits, 0x02 for terrain, and 0x03 for alpha masks
0x10 uint16 Index Mode Stores information about the encoding of the file, the nature of which is not known
0x12 uint16 Offset Flag unknown
0x14 uint16 Width Width in pixels of the sprite/image
0x16 uint16 Height Height in pixels of the image/sprite
0x18 uint16 Hotspot (X) Horizontal coordinate of sprite hotspot (point on which the sprite is centered)
0x1A uint16 Hotspot (Y) Vertical coordinate of sprite hotspot (point on which the sprite is centered)
0x1C uint16 Bounding Box (X min) Minimum X value of clickable region of sprite
0x1E uint16 Bounding Box (Y min) Minimum Y value of clickable region of sprite
0x20 uint16 Bounding Box (X max) Maximum X value of clickable region of sprite
0x22 uint16 Bounding Box (Y Max) Maximum Y value of clickable region of sprite

{{TODO}} Finish HEDR table

PALT

{{TODO}}

FRAM

{{TODO}} for 0x011 runs, if the run_length is less than 24 its RLE single-color run with alpha, taking up a total of 2 bytes plus the size of the pixel. If run_length is greater than or equal to 24, then its a single black pixel with transparency related to run_length, taking up a total of 1 byte. A run_length of 24 yields a pixel the same color as the shadow pixels.

Clone this wiki locally