Skip to content

Instantly share code, notes, and snippets.

@sigsegv-mvm
Last active April 22, 2024 04:36
Show Gist options
  • Save sigsegv-mvm/0f07b1c6d8dd56885f74e03758c11e58 to your computer and use it in GitHub Desktop.
Save sigsegv-mvm/0f07b1c6d8dd56885f74e03758c11e58 to your computer and use it in GitHub Desktop.
Reverse-engineered EXAPUNKS ".TEX" texture file format details
TEX FILE FORMAT
Reverse engineering by sigsegv, 20180914.
All values are little-endian.
0x00 int: TEX file version / magic number [1002 = 0x000003EA]
0x04 int: data resolution [x]
0x08 int: data resolution [y]
0x0C int: color format { 0 => invalid, 1 => 8BPP, 2 => RGBA }
0x10 int: display resolution [x]
0x14 int: display resolution [y]
0x18 int: display bounds [lower x]
0x1C int: display bounds [lower y]
0x20 int: display bounds [upper x]
0x24 int: display bounds [upper y]
0x28 float: crop offset [x]
0x2C float: crop offset [y]
0x30 float: sprite linking info [x]
0x34 float: sprite linking info [y]
0x38 int: number of LZ4-compressed data bytes
0x3C 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)
@sigsegv-mvm
Copy link
Author

Okay so I actually managed to find my deobfuscated, annotated EXE of EXAPUNKS, still datestamped to Sep 2018! Which is pretty rad.

A couple things my prior post missed:

  • I failed to notice that an additional int field was added, just before the LZ4 length and data fields. Based on a quick look, it seems to be related to colorblind mode.
  • The pair of floats that were previously "sprite linking info" for EXAPUNKS are still there. At first I wasn't sure if that was just a vestigial leftover or if the fields are actually used for something else now. Well, they are used for something else by MF83. I think it's another set of bounds, that may be involved in things turning white or drawing boxes. Maybe I should fire up the game again with the debug bit flipped... because I think the level editor may have used white rectangles in some form? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment