Difference between revisions of "FTEX (File Format)"

From MK8
Jump to navigation Jump to search
m (Added better links.)
Line 5: Line 5:
 
== Header (FTEX) ==
 
== Header (FTEX) ==
  
Every FTEX file begins with an 0xC0 byte '''FTEX''' header.
+
Every FTEX file begins with an 0xC0 byte '''FTEX''' header that starts with the file identifier, followed by info about the image.
 
{| class="wikitable"
 
{| class="wikitable"
 
! Offset
 
! Offset
Line 17: Line 17:
 
| 0x04
 
| 0x04
 
| 4
 
| 4
| '''Dim'''. Indicates the "shape" of a given surface or texture (see [https://decaf-emu.github.io/wut/group__gx2__enum.html#gabedadb9f5051baad71365a011a02618e this page]).
+
| '''Dimension'''. Indicates the "shape" of a given surface or texture (see line 849 [http://pastebin.com/DCrP1w9x here]).
 
|-
 
|-
 
| 0x08
 
| 0x08
Line 29: Line 29:
 
| 0x10
 
| 0x10
 
| 4
 
| 4
| '''Depth'''
+
| '''Depth'''.
 
|-
 
|-
 
| 0x14
 
| 0x14
 
| 4
 
| 4
| '''numMips'''
+
| '''Number of Mipmaps'''.
 
|-
 
|-
 
| 0x18
 
| 0x18
Line 45: Line 45:
 
| 0x20
 
| 0x20
 
| 4
 
| 4
| '''Usage'''. Indicates how the given surface may be used (see [https://decaf-emu.github.io/wut/group__gx2__enum.html#gafe1ebff6752df098313c3a3c587e3114 this page]).
+
| '''Usage'''. Indicates how the given surface may be used (see line 823 [http://pastebin.com/DCrP1w9x here]).
 
|-
 
|-
 
| 0x24
 
| 0x24
Line 53: Line 53:
 
| 0x28
 
| 0x28
 
| 4
 
| 4
| {{Unknown}}
+
| '''Data Pointer?'''
 
|-
 
|-
 
| 0x2C
 
| 0x2C
 
| 4
 
| 4
| '''mipSize'''
+
| '''Mipmaps Data Length'''. Length of mipmaps data in bytes.
 
|-
 
|-
 
| 0x30
 
| 0x30
 
| 4
 
| 4
| {{Unknown}}
+
| '''Mipmaps Pointer?'''
 
|-
 
|-
 
| 0x34
 
| 0x34
 
| 4
 
| 4
| '''Tile Mode'''. Indicates the desired tiling mode for the surface (see [https://decaf-emu.github.io/wut/group__gx2__enum.html#gaf27a80e22355f92a687c0452642fd4c1 this page]).
+
| '''Tile Mode'''. Indicates the desired tiling mode for the surface (see line 795 [http://pastebin.com/DCrP1w9x here]).
 
|-
 
|-
 
| 0x38
 
| 0x38
 
| 4
 
| 4
| '''Swizzle Value'''
+
| '''Swizzle Value'''.
 
|-
 
|-
 
| 0x3C
 
| 0x3C
 
| 4
 
| 4
| '''Alignment'''
+
| '''Alignment'''. Always 512 * bytes per pixel.
 
|-
 
|-
 
| 0x40
 
| 0x40
 
| 4
 
| 4
| '''Pitch'''
+
| '''Pitch'''.
 
|-
 
|-
 
| 0x44
 
| 0x44
| 0x6C
+
| 0x0D
| {{Unknown}}
+
| '''Mip Offset'''. Offset for each mipmap?
 +
|-
 +
| 0x51
 +
| 0x2B
 +
| Unknown. Mipmaps related. (Always 0 in textures with no mipmaps)
 +
|-
 +
| 0x7C
 +
| 4
 +
| '''Number of Mipmaps'''. Again...
 +
|-
 +
| 0x80
 +
| 4
 +
| Unknown. Always 0.
 +
|-
 +
| 0x84
 +
| 4
 +
| Unknown. Always 1.
 +
|-
 +
| 0x88
 +
| 4
 +
| Unknown. Always 0x00010203. (Is this some kind of a pattern? 00->01->02->03)
 +
|-
 +
| 0x8C
 +
| 0X24
 +
| Unknown.
 
|-
 
|-
 
| 0xB0
 
| 0xB0

Revision as of 07:45, 8 April 2017

Under Construction
This article is not finished. Help improve it by adding accurate information or correcting grammar and spelling. Please do not add speculation here.

The FTEX texture format is a format for textures which appears as a subfile of a BFRES file.

Header (FTEX)

Every FTEX file begins with an 0xC0 byte FTEX header that starts with the file identifier, followed by info about the image.

Offset Size Description
0x00 4 "FTEX" File identifier, ASCII string.
0x04 4 Dimension. Indicates the "shape" of a given surface or texture (see line 849 here).
0x08 4 Texture Width. Width of the texture in pixels.
0x0C 4 Texture Height. Height of the texture in pixels.
0x10 4 Depth.
0x14 4 Number of Mipmaps.
0x18 4 Texture Format. Go to line 589 on this page for explanation and format values.
0x1C 4 AA Mode. Indicates the AA mode (number of samples) for the surface (see line 865 here).
0x20 4 Usage. Indicates how the given surface may be used (see line 823 here).
0x24 4 Data Length. Length of texture data in bytes.
0x28 4 Data Pointer?
0x2C 4 Mipmaps Data Length. Length of mipmaps data in bytes.
0x30 4 Mipmaps Pointer?
0x34 4 Tile Mode. Indicates the desired tiling mode for the surface (see line 795 here).
0x38 4 Swizzle Value.
0x3C 4 Alignment. Always 512 * bytes per pixel.
0x40 4 Pitch.
0x44 0x0D Mip Offset. Offset for each mipmap?
0x51 0x2B Unknown. Mipmaps related. (Always 0 in textures with no mipmaps)
0x7C 4 Number of Mipmaps. Again...
0x80 4 Unknown. Always 0.
0x84 4 Unknown. Always 1.
0x88 4 Unknown. Always 0x00010203. (Is this some kind of a pattern? 00->01->02->03)
0x8C 0X24 Unknown.
0xB0 4 Data Offset. Offset to the texture data. Relative to this field.
0xB4 4 Mipmap Offset. Offset to the mipmap texture data. Relative to this field. 0 if not present.
0xB8 8 unknown
0xC0 End of FTEX header

Incomplete header documentation. Last 8 words (32 bytes) seem to change per file. Offset 160 (dec) from FTEX header always seems to be zero, followed by a single byte (value of 1), 3 padding bytes, then a relative offset to the string table, then a relative offset to UnknownDataA, a relative offset to UnknownDataB, a relative offset to unknown DataC, and then two more unknowns (usually zero).