Difference between revisions of "MOGG File Format"
m (Add basic information about encryption) |
(added more information about the seek table. thanks Onyxite! (hopefully corrected some encryption information, too)) |
||
Line 28: | Line 28: | ||
|Version of the MOGG map. (usually 16 / 0x10) | |Version of the MOGG map. (usually 16 / 0x10) | ||
|- | |- | ||
| | |Seek Interval | ||
|Integer (LE) | |Integer (LE) | ||
|4 bytes | |4 bytes | ||
|Usually 20000 / 0x4E20 | |The interval between samples in the sample table. (Usually 20000 / 0x4E20) | ||
|- | |- | ||
|Entry Count | |Entry Count | ||
Line 38: | Line 38: | ||
|The number of entries in the MOGG header. | |The number of entries in the MOGG header. | ||
|- | |- | ||
| | |Sample Table | ||
|[[#MOGG Entry]] Array | |[[#MOGG Sample Entry]] Array | ||
|sizeof(MOGG Entry) * Entry Count | |sizeof(MOGG Entry) * Entry Count | ||
| | |A lookup table to help the game stream the OGG file from disk. | ||
|- | |- | ||
|AES Key | |AES Key | ||
Line 49: | Line 49: | ||
|} | |} | ||
===MOGG Entry=== | ===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. | |||
{| class="wikitable" | {| class="wikitable" | ||
! | !Name | ||
!Type | !Type | ||
!Size | !Size | ||
Line 72: | Line 74: | ||
===OGG File=== | ===OGG File=== | ||
Past this point is a regular OGG Vorbis format file containing multiple tracks. The tracks corresponding to instruments are defined in the [[songs.dta]] 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== | ==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. For legal reasons this wiki can not document any keys themselves, or any explicit details about 0x11 encryption. | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 83: | Line 87: | ||
|10 / 0xA | |10 / 0xA | ||
|Unencrypted. Lacks key in MOGG header. | |Unencrypted. Lacks key in MOGG header. | ||
|Used in [[Guitar Hero 2]] | |Used in [[Guitar Hero 2]] (Xbox 360) | ||
|- | |- | ||
|11 / 0xB | |11 / 0xB | ||
| | |Encryption is done with a static key. Uses key in MOGG header as IV. | ||
|Used in [[Rock Band (game)|Rock Band]] on-disc songs | |Used in [[Rock Band (game)|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. | |||
|Used in [[Rock Band 2]] on-disc songs. | |||
|- | |||
|14 / 0xE | |||
| rowspan=3 | Increases the complexity of the key derivation step. | |||
| rowspan=2 | Used in [[Rock Band 2]] DLC songs. | |||
|- | |||
|15 / 0xF | |||
|- | |||
|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 Fuser. | |||
|} | |} | ||
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. | |||
TODO: is 13/0xD ever used? 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== | ==Tools== | ||
Line 98: | Line 125: | ||
* [[ArkTool]] | * [[ArkTool]] | ||
* [[C3 CON Tools]] | * [[C3 CON Tools]] | ||
* [https://www.audacityteam.org/ Audacity] (supports reading smaller unencrypted MOGG files | * [https://www.audacityteam.org/ Audacity] (supports reading smaller unencrypted MOGG files if the header is small) | ||
==References== | ==References== | ||
* [https://rockband.scorehero.com/forum/viewtopic.php?p=85805#85805 xorloser's ScoreHero post] | * [https://rockband.scorehero.com/forum/viewtopic.php?p=85805#85805 xorloser's ScoreHero post] | ||
* [https://github.com/mtolly/onyxite-customs/blob/master/haskell/src/MoggDecrypt.chs Onyx Source Code] | * [https://github.com/mtolly/onyxite-customs/blob/master/haskell/src/MoggDecrypt.chs Onyx Toolkit Source Code] | ||
* [https://github.com/mtolly/ogg2mogg/blob/master/main.c ogg2mogg Source Code] | |||
* [https://web.archive.org/web/20201204045811/https://maxton.xyz/blog/2020/08/28/breaking-beatles-xenia "Breaking Beatles" - maxton - Archived on 4th December 2020] |
Revision as of 23:27, 27 July 2022
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. |
Sample Table | #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. 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) |
11 / 0xB | Encryption is done with a static key. Uses key 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. | Used in Rock Band 2 on-disc songs. |
14 / 0xE | Increases the complexity of the key derivation step. | Used in Rock Band 2 DLC songs. |
15 / 0xF | ||
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 Fuser. |
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.
TODO: is 13/0xD ever used? 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)
- Onyx Music Game Toolkit
- Magma
- ArkTool
- C3 CON Tools
- Audacity (supports reading smaller unencrypted MOGG files if the header is small)