benilla-re systems structs docs

s_texturePixelTypeToFormat

global · gx

Address
0x835258 · 32 bytes, up to 0x835277
Type
uint32_t[8]
Meaning
Maps a pixel type code 0 to 7 to its GxTex format: 5, 6, 1, 3, 2, 4, 0, 7
Confidence
verified, proof one
Finding
gx/textures#format-choice

Finding: Format choice in gx: textures

0x4489a0 opens BLP bytes and decides two values from the colour encoding byte and the alpha depth: the GxTex format and the pixel type code. Alpha encoding 0 (DXT1) gives Dxt1 when the device block 0x58a230 has +0x40 set, otherwise Rgb565 for alpha depth 0 and Argb1555 for more; encoding 1 gives Dxt3 when +0x44 is set, otherwise Argb4444; encoding 7 gives Dxt5 when +0x48 is set, otherwise Argb4444; a colour encoding other than 2 gives Argb8888. The size it returns is the one 0x448b60 leaves (texturesize.md). The file callback 0x44a560 chooses through 0x44a790 instead.

The derivation is in the doc.