THP

From Super Mario Galaxy wiki
Jump to navigation Jump to search


This page contains content/info from the Revolution SDK. This is to be considered 100% true.

THP does not stand for anything unlike other file formats. It's mainly used for prerendered cutscenes and other prerendered videos. This format was also used on the Nintendo GameCube.

Format Specifications

Below you'll find helpful tables on how the file is structured

Header

Each THP starts with a header

Offset Type Description
0x00 String "THP0" in ASCII
0x04 UInt32 Version Number. SMG uses 0x1048832
0x08 UInt32 The Maximum Frame data size
0x0C UInt32 Max no. of Audio Samples. SMG uses 0x570556416
0x10 Float Frame Rate. Defaults to 29.97 in THPConv.exe. SMG uses 59.97 (the max value)
0x14 UInt32 Total number of frames
0x18 UInt32 The length of the first frame
0x1C UInt32 The length of ALL frames
0x20 UInt32 Offset to components
0x24 UInt32 Offset to FrameOffsetData
0x28 UInt32 First frame offset
0x2C UInt32 Last frame offset

Frame Comp Info

This section is for the Component structure

Offset Type Description
0x00 UInt32 Number of components in this frame. Max is 16
0x04 UInt8[16] Component types (0 = video, 1 = audio, -1 = none)

Video

This section contains the video data.

Offset Type Description
0x00 UInt32 Width. SMG uses 640
0x04 UInt32 Height. SMG uses 368
0x08 UInt32 Video format (Only used in certain versions)

Audio

This sections contains the audio data.

Offset Type Description
0x00 UInt32 Number of Audio Channels (Min is 0, Max is 2)
0x04 UInt32 Frequency
0x08 UInt32 Number of samples played
0x0C UInt32 Number of tracks (Only used in certain versions)

Frame

A frame starts with a frame header

Offset Type Description
0x00 UInt32 Total size of the next frame
0x04 UInt32 Total size of previous frame
0x08 UInt32 Total size of the current frame
0x0C UInt32 Audio size (Only if there is audio in the current frame)
0x0C or 0x10 Image Data

Video

Video data

Offset Type Description
0x00 Int8[I] Image Data
I End of Image Data

Audio

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 Int8[M] Audio Data
M End of Audio Data

Tools

The following tools can handle THP files: