God of Thunder Music Format
Format type | Music |
---|---|
Notation type | OPL |
Instruments | OPL |
Max channel count | 9 or 11 |
Max track count | 1 |
Max pattern count | 1 |
Max order count | 0 |
Tags? | None |
Games |
God of Thunder stores its music in this format. It is a raw Adlib format, containing the exact register and data pairs to send to the OPL chip.
File format
The file begins with a header specifying the offset (in words) of the beginning of loop, that is, where to start playing the song after it finishes. By default it is set to 0x0001 and the song will restart from the very beginning.
Data type | Description |
---|---|
UINT16LE header | Loop start offset from beginning of file (in words) |
This is then immediately followed by a variable number of three byte chunks.
Data type | Description |
---|---|
BYTE delay | Number of ticks to wait *after* the data has been sent |
BYTE reg | OPL register to write to |
BYTE val | Value to write |
In order to use delays larger than roughly 1 second, the format accepts a second delay byte when setting the MSB to 1 (it resembles MIDI lengths). For example,
50 // Hex value 0x50 80 D0 // Hex value 0xD0 ((0x80 & 0x7F) << 8) | 0xD0 81 50 // Hex value 0x150 ((0x81 & 0x7F) << 8) | 0x50 FF FF // Hex value 0x7FFF (0xFF & 0x7F) << 8) | 0xFF
This allows a maximum delay of about 273 seconds (at 120 Hz).
The very last chunk has all values set to zero, plus a final 0x00 byte. The zero register/data pair designates the end of the song, so a footer metadata is possible but currently unused.
Timing
Songs are played at a different tempo (i.e. each delay tick lasts a different length of time): menu.got plays at 140 Hz, all other songs plays at 120 Hz. Known song lengths (based on Teppic's PCM recordings of in-game Adlib playback) are:
Song | Length | Notes |
---|---|---|
menu | 1:15,759 | in got.exe, not in gotres.dat |
song11 | 1:41,457 | |
song12 | 2:07,676 | |
song13 | 1:07,647 | |
song14 | 0:59,884 | |
song21 | 1:19,258 | |
song22 | 1:27,120 | |
song23 | 0:34,845 | |
song24 | 1:06,350 | |
song25 | 1:39,959 | |
song31 | 0:55,890 | |
song32 | 0:58,659 | |
opensong | 1:19,821 | Story song - slow version of song33 |
song33 | 1:13,730 | in-game version of the story song |
song34 | 1:11,795 | |
song35 | 1:19,315 | |
song36 | 0:47,887 | |
winsong | 0:32,918 | |
bosssong | 0:26,169 |
Tools
The following tools are able to work with files in this format.
Name | Platform | Play? | Create new? | Modify? | Convert/export to other? | Import from other? | Access hidden data? | Edit metadata? | Notes |
---|---|---|---|---|---|---|---|---|---|
Camoto | Linux/Win | Yes | No | No | Yes; many | Yes; many | N/A | N/A | Incorrect tempo |
GromPE's GoT unpacker | Windows | No | No | No | Yes; .imf | No | N/A | N/A | Incorrect tempo |
GromPE's OPL2WAV | Windows | No | No | No | Yes; .wav | No | N/A | N/A | Incorrect tempo |
Wombat | Windows | No | No | No | Yes; .imf | No | N/A | N/A | Incorrect tempo |
Credits
This file format was reverse engineered by Malvineous. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)