CTPK

CTPK

CTPK - CTR Texture PacKage

CTPK is a container file for one or multiple textures that are in various formats readable by the 3ds system. Offsets are relative to the beginning of the header section unless specified.

CTPK Header #

OffsetLengthDescription
0x00x4Magic “CTPK”
0x40x2Version?
0x60x2Number of Texture Entries
0x80x4Texture Data section offset
0xC0x4Texture Data section size
0x100x4Hash section offset
0x140x4Conversion Info section offset
0x180x8Padding

Texture Info Entry #

The Header block is followed by a texture info entry for each texture in the container. This block is usually followed by the bitmap size arrays and then the file paths. 0x20 byte aligned.

OffsetLengthDescription
0x00x4File path Offset
0x40x4Texture Data Size
0x80x4Texture Data Offset (Relative to texture data block offset)
0xC0x4Texture Format
0x100x2Width
0x120x2Height
0x140x1Mip Level
0x150x1Type (0: Cube Map, 1: 1D, 2: 2D)
0x160x2Cube Map Related
0x180x4Bitmap Size Array Offset (Relative to to this block)
0x1C0x4Unix Timestamp

Hash Block Entry #

The texture info block is followed by a hash entry for each texture entry. 0x8 byte aligned.

OffsetLengthDescription
0x00x4Crc32 of the file path
0x40x4Index

Conversion Info Block Entry #

The hash block is followed by a conversion info entry for each texture entry. 0x4 byte aligned.

OffsetLengthDescription
0x00x1Texture Format
0x10x1Unknown
0x20x1Compressed
0x30x1ETC1 Related (Quality?)

Texture Data Block #

This block and all it’s texture entries are 0x80 byte aligned.

Texture Formats #

ValueDescription
0x0RGBA8888
0x1RGB888
0x2RGBA5551
0x3RGB565
0x4RGBA4444
0xCETC1
0xDETC1 + Alpha

Category:File formats