Skip to content

Instantly share code, notes, and snippets.

@FiddyFive
Forked from sigsegv-mvm/TEX_file_format.txt
Last active July 18, 2024 20:05
Show Gist options
  • Save FiddyFive/ca6d110823f7dce31bc8d2884e9fdc0f to your computer and use it in GitHub Desktop.
Save FiddyFive/ca6d110823f7dce31bc8d2884e9fdc0f to your computer and use it in GitHub Desktop.
Reverse-engineered Zachtronics Solitaire Collection ".TEX" texture file format details
TEX FILE FORMAT
Reverse engineering by sigsegv, 20180914.
Updated to version 3ED by Fiddy, 20240229.
All values are little-endian.
0x00 int: TEX file version / magic number [1005 = 0x000003ED]
0x04 int: length of image array (for single images this is 1)
0x08 int: data resolution [x]
0x0C int: data resolution [y]
0x10 int: color format { 0 => invalid, 1 => 8BPP, 2 => RGBA }
0x14 int: display resolution [x]
0x18 int: display resolution [y]
0x1C int: display bounds [lower x]
0x20 int: display bounds [lower y]
0x24 int: display bounds [upper x]
0x28 int: display bounds [upper y]
0x2C float: crop offset [x]
0x30 float: crop offset [y]
0x34 float: sprite linking info [x]
0x38 float: sprite linking info [y]
0x3C float: resolution [x]
0x40 float: resolution [y]
0x44 ???: Unknown
0x48 int: number of LZ4-compressed data bytes
0x4C byte[]: LZ4-compressed data bytes...
NOTES:
- "data resolution" refers to the resolution of the data actually contained in the file
- "display resolution" refers to the nominal display resolution of the image in the game
- half-sized textures have the same display resolution and display bounds as their full-sized counterparts;
they simply have their data resolution numbers halved and contain a quarter as much image data
- "display bounds" represents a pair of min and max coordinates that the texture occupies;
typically the lower bound will be (0,0) and the upper bound will be (display_res_x,display_res_y)
- the "crop offset" data needs further investigation
- the "sprite linking info" is apparently used for player and opponent EXA sprites, to link together
different sprite parts based on a magenta mask (R=0xFF, G=0x00, B=0xFF, A=0xFF)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment