THP (File Format)

From Custom Mario Kart
(Redirected from THP)
Jump to navigation Jump to search
Under Construction
This article is not finished. Help improve it by adding accurate information or correcting grammar and spelling.

THP files are video files used in many Wii games.

File Format

Header

The file starts with a header.

Offset Type Description
0x00 String File magic. Always THP. in ASCII (0x54485000).
0x04 UInt32 Version number. Mario Kart Wii uses 0x11000.
0x08 UInt32 Max buffer size.
0x0C UInt32 Max audio samples.
0x10 Float Frames per second.
0x14 UInt32 Number of frames in this file.
0x18 UInt32 Length of the first frame.
0x1C UInt32 Length of all frames.
0x20 UInt32 Offset to components.
0x24 UInt32 OffsetsDataOffset. Unknown meaning.
0x28 UInt32 First frame offset.
0x2C UInt32 Last frame offset.

Component structure

Offset Type Description
0x00 UInt32 Number of components.
0x04 SByte[16] Component types (0 = video, 1 = audio, -1 = none).

Video

Offset Type Description
0x00 UInt32 Width.
0x04 UInt32 Height.
0x08 UInt32 Video format (only used in version 0x11000).

Audio

Offset Type Description
0x00 UInt32 A = Number of audio channels.
0x04 UInt32 Frequentie.
0x08 UInt32 Number of samples.
0x0C UInt32 Number of datas (only used in version 0x11000).

Frame

A frame start with a frame header.

Offset Type Description
0x00 UInt32 Next total size.
0x04 UInt32 Previous total size.
0x08 UInt32 I = Image size.
0x0C UInt32 M = Audio size (only exist if the frame contains audio).
0x0C or 0x10 Image data

Video

Video data.

Offset Type Description
0x00 Byte[I] Image data.
I End of image data

Audio

Audio data.

Offset Type Description
0x00 UInt32 Channel size.
0x04 UInt32 Number of samples.
0x08 Int16[16] Table 1.
0x28 Int16[16] Table 2.
0x48 Int16 Channel 1 previous 1.
0x4A Int16 Channel 1 previous 2.
0x4C Int16 Channel 2 previous 1.
0x4E Int16 Channel 2 previous 2.
0x50 Audio Data
Offset Type Description
0x00 Byte[M] Audio data.
M End of audio data

Tools

The following tools can handle THP files: