Difference between revisions of "FTEX (File Format)"
Jump to navigation
Jump to search
(Document CompSel) |
Aboood40091 (talk | contribs) m |
||
Line 7: | Line 7: | ||
! Offset !! Size !! Type !! Description | ! Offset !! Size !! Type !! Description | ||
|- | |- | ||
− | | 0x00 || | + | | 0x00 || 0x04 || Char[4] || '''File magic'''. Always ''FTEX'' in ASCII. |
|- | |- | ||
− | | 0x04 || | + | | 0x04 || 0x9C || Struct || '''[[GTX#GX2 Surface|GX2 Surface]]'''. |
|- | |- | ||
− | | | + | | 0xA0 || 0x04 || UInt32 || '''Texture handle'''. Set at runtime. |
|- | |- | ||
− | | | + | | 0xA4 || 0x04 || UInt32 || '''Array length''' (seems to be just a byte in MK8 files, with the remaining 3 bytes being padding?). |
|- | |- | ||
− | | | + | | 0xA8 || 0x04 || Int32 || '''File name''' offset. |
|- | |- | ||
− | | | + | | 0xAC || 0x04 || Int32 || '''File path''' offset, the path of the file this data was originally created from. Stripped in [[Mario Kart 8]] files, always pointing to an empty string at the end of the BFRES [[BFRES (File Format)#String Table|string table]]. |
|- | |- | ||
− | | | + | | 0xB0 || 0x04 || Int32 || '''Data offset'''. Offset to the texture data. |
|- | |- | ||
− | | | + | | 0xB4 || 0x04 || Int32 || '''Mipmap offset'''. Offset to the mipmap texture data. |
|- | |- | ||
− | | | + | | 0xB8 || 0x04 || Int32 || '''[[User Data]] [[Index Group]]''' offset. |
|- | |- | ||
− | | | + | | 0xBC || 0x02 || UInt16 || '''[[User Data]] entry count'''. |
|- | |- | ||
− | + | | 0xBE || 0x02 || — || Padding. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | 0xBE || | ||
|- | |- | ||
| 0xC0 || colspan="3" {{Unknown|End of '''FTEX''' header}} | | 0xC0 || colspan="3" {{Unknown|End of '''FTEX''' header}} |
Revision as of 21:49, 21 July 2017
The FTEX (caFe TEXture) texture format is a format for textures which appears as a subfile of a BFRES file. It appears in the 1:st index group in a BFRES file. Unless otherwise noted, all offsets in the file are relative to themselves.
Header (FTEX)
An FTEX file begins with an 0xC0 byte header that starts with the file identifier, followed by info about the texture and mipmaps.
Offset | Size | Type | Description |
---|---|---|---|
0x00 | 0x04 | Char[4] | File magic. Always FTEX in ASCII. |
0x04 | 0x9C | Struct | GX2 Surface. |
0xA0 | 0x04 | UInt32 | Texture handle. Set at runtime. |
0xA4 | 0x04 | UInt32 | Array length (seems to be just a byte in MK8 files, with the remaining 3 bytes being padding?). |
0xA8 | 0x04 | Int32 | File name offset. |
0xAC | 0x04 | Int32 | File path offset, the path of the file this data was originally created from. Stripped in Mario Kart 8 files, always pointing to an empty string at the end of the BFRES string table. |
0xB0 | 0x04 | Int32 | Data offset. Offset to the texture data. |
0xB4 | 0x04 | Int32 | Mipmap offset. Offset to the mipmap texture data. |
0xB8 | 0x04 | Int32 | User Data Index Group offset. |
0xBC | 0x02 | UInt16 | User Data entry count. |
0xBE | 0x02 | — | Padding. |
0xC0 | End of FTEX header |
Image Data
The image and mipmap data is not present after the header. It comes after the BFRES string table instead. This seems to be a caching optimization, since the CPU generally doesn't need to handle the image data. Instead it is sent directly to the GPU.