Difference between revisions of "MOGG File Format"

From Milo Modding Wiki
Jump to navigation Jump to search
(bits of updated infos)
m (the games do actually call it an OggMap from what I can see)
Line 38: Line 38:
|The number of entries in the MOGG header.
|The number of entries in the MOGG header.
|-
|-
|Sample Table
|OggMap
|[[#MOGG Sample Entry]] Array
|[[#MOGG Sample Entry]] Array
|sizeof(MOGG Entry) * Entry Count
|sizeof(MOGG Entry) * Entry Count

Revision as of 01:02, 28 June 2023

MOGG files are often used in Harmonix games for all platforms except for PS2 and DS. They are an extension of the OGG Vorbis container with an extra header prepending it, and almost all official MOGGs starting with Rock Band shipped on-disk and as DLC are encrypted.

The version value in the MOGG header is used to indicate which encryption key and format should be used for decryption.

Structure

MOGG Header

Name Type Size Function
Version Integer (LE) 4 bytes Version of the MOGG file. Related to encryption (10 / 0xA = unencrypted)
Header Size Integer (LE) 4 bytes Length of the MOGG header / offset in the file where the OGG begins.
Map Version Integer (LE) 4 bytes Version of the MOGG map. (usually 16 / 0x10)
Seek Interval Integer (LE) 4 bytes The interval between samples in the sample table. (Usually 20000 / 0x4E20)
Entry Count Integer (LE) 4 bytes The number of entries in the MOGG header.
OggMap #MOGG Sample Entry Array sizeof(MOGG Entry) * Entry Count A lookup table to help the game stream the OGG file from disk.
AES Key Byte Array 16 bytes An AES key used to encrypt the file. Only present if MOGG version is >= 11 / 0xB.

MOGG Sample Entry

To help the game seek in an OGG file (rewinding after pausing, practice mode, etc), a lookup table is used to locate the byte offset in the file to look for a sample.

When the game wants to seek to sample N, it looks up entry (N / Seek Interval) in the table, that gives a byte offset and sample offset. It then seeks the file over to the byte offset and skips (N - Sample Offset) samples.

Name Type Size Function
Byte Offset Integer (LE) 4 bytes Offset into the file that the entry starts.
Sample Integer (LE) 4 bytes The sample in the OGG stream that corresponds to the byte offset.

OGG File

Past this point is a regular (optionally encrypted) OGG Vorbis format file containing multiple tracks. The tracks corresponding to instruments are defined in the songs.dta file.

Encryption

At its core, files are encrypted with a 128-bit AES EBC cipher. Each "generation" of MOGG files changes the encryption keys and scheme used. There is also an additional bit-shuffling obfuscation step prior to encryption or after decryption. For legal reasons this wiki can not document any keys themselves, or any explicit details about 0x11 encryption.

Generation Info Games
10 / 0xA Unencrypted. Lacks key in MOGG header. Used in Guitar Hero 2 (Xbox 360). Also used throughout the games for unimportant MOGGs. Notably, does not work on PS3.
11 / 0xB Encryption is done with a static key. Uses nonce stored in MOGG header as IV. Used in Rock Band on-disc and DLC songs.
12 / 0xC The true decryption key is derived through a custom algorithm. Changes the format of the header. Treated as exactly the same by all games that support at least this version of encryption. Used in Rock Band 2 on-disc songs. Delivered to RB1 via title update.
13 / 0xD Used in encrypted C3 songs.
14 / 0xE Increases the complexity of the key derivation step. Used in Rock Band 2 DLC songs.
15 / 0xF Used in Rock Band Network. Delivered to RB2 via title update.
16 / 0x10 Used in Rock Band 3, Rock Band 4 and Rock Band VR on-disc and DLC until November 2018.
17 / 0x11 A new value is added in the header and a new set of keys are used for a more complex key derivation step. Used in Rock Band 4 DLC after November 2018, as well as DropMix, Dance Central VR, Audica, and Fuser. The non-RB games each have their own keyset, and only support their own variant of 0x11, as well as unencrypted 0xA.

Keys in Rock Band 2 (Xbox 360) and later are additionally protected behind the console's native XeKeys functions (XeKeysAesCbc). This was likely to prevent those with development kits from reverse engineering the new algorithm, as XeKeys uses different keys depending on the console's key vault. Rock Band 4 on PlayStation 4 also seems to follow the Xbox 360 key path.

TODO: Validate if the games and descriptions are correct.

The Beatles: Rock Band used version 16/0x10 behind a Cloakware's white-box crypto algorithm in order to protect the original keyset.

Tools

Several tools are available for working with MOGG files (creation/extraction, encryption, etc)

References