BMG (File Format)
| This page is in progress and may contain incomplete information or editor's notes. |
|---|
BMG is a file format used to hold text in SMG1. This was replaced by the MSBT file format in SMG2. Unlike the messages in SMG2, SMG1 uses a single, region specific BMG file (Region/message.arc/message.bmg) to hold ALL text.
Format Specifications
Below you'll find helpful tables on how this file is structured in SMG1 and 3D All Stars, other games that use BMG might be different.
All char[] types are in ASCII encoding.
Header
| Offset | Type | Description |
|---|---|---|
| 0x0 | char[4] | File magic. "MESG" for SMG1, "GSEM" for 3D All Stars. |
| 0x4 | char[4] | File magic. "bmg1" for SMG1. "1gmb" for 3D All Stars. |
| 0x8 | u32 | FLW1 Section offset. |
| 0x0C | u32 | Section count. |
| 0x10 | u8 | Unknown. Believed to be a definition of encoding in some games. |
| 0x11 | u8[15] | Padding. |
Sections
All sections start with a section identifier.
| Offset | Type | Description |
|---|---|---|
| 0x0 | char[4] | Magic. Relates to the Section Type it is. |
| 0x4 | u32 | Section Size. |
Depending on the Magic, the section can be one of the following types below.
INF1 Section
This section holds message information.
| Offset | Type | Description |
|---|---|---|
| 0x0 | u16 | Entry count. |
| 0x2 | u16 | Entry size. |
| 0x4 | u8[4] | Padding. |
Entries are structured as following:
| Offset | Type | Description |
|---|---|---|
| 0x0 | u32 | Message data offset. |
| 0x4 | u16 | Camera ID. |
| 0x6 | u8 | Sound ID. |
| 0x7 | u8 | Camera type. (Normal = 0, Event = 1, None = 2) |
| 0x8 | u8 | Talk type. (Normal = 0, Short = 1, Event = 2, Composite = 3, Flow = 4, Null = 5) |
| 0x9 | u8 | Balloon type. (Normal = 0, Unk = 1, Call = 2, Fixed = 3, Signboard = 4, Info = 5, Icon = 6) |
| 0xA | u8 | Area ID. |
| 0xB | u8 | Index into the MessageAlreadyRead GameEventValue.
|
DAT1
This section contains null-terminated message data, encoded in BE UTF-16. These messages have custom tags, which the game interprets and replaces with the correct text/visuals.
| Offset | Type | Description |
|---|---|---|
| 0x0 | wchar_t | Tag identifier. (Always 0x14) |
| 0x2 | u8 | Tag size. (Including the identifier) |
| 0x3 | u8 | Padding. |
| 0x4 | u16 | Tag type. |
Todo: Document tag types.
FLW1
This section holds flow information.
| Offset | Type | Description |
|---|---|---|
| 0x0 | u16 | Flow node count. |
| 0x2 | u16 | Branch node count. |
| 0x4 | u8[4] | Padding. |
All flow nodes have 8 bytes in total. The 1st byte defines flow type.
| Offset | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0x0 | u8 | Node type. (Text = 1, Condition = 2, Event = 3) | |||||||||||||||||||||||||||||||||||||||||||||
| 0x1 | u8[7] | Text node data:
Condition node data:
Event node data:
|
This is followed by branch node IDs, an array of u16s that point to flow indices.
FLI1
The purpose of this section is unknown. This is not used/supported in SMG1/3D All Stars.
| Offset | Type | Description |
|---|---|---|
| 0x0 | u16 | Entry count. |
| 0x2 | u8 | Entry size. (Always 8) |
| 0x3 | u8[5] | Padding. |
This is followed by entries with the following structure:
| Offset | Type | Description |
|---|---|---|
| 0x0 | u16 | Unknown. |
| 0x2 | u8[2] | Padding. |
| 0x4 | u16 | Unknown. |
| 0x6 | u8[2] | Padding. |
Labels
SMG1/3D All Stars BMGs do not have labels inside them. Instead, message labels are set through messageid.tbl, a sorted BCSV file.
This .tbl file contains 2 fields:
- The
MessageId(STRINGOFF) field that contains a label name. - The
Index(LONG) field that contains the label's respective message index.
Tools
The following tools can handle SMG1's BMG (some may have 3D All Stars support, but most don't.)
- Tomato (Can convert a BMG + the TBL file to a XML file and vise versa. Has 3D All Stars Support)
- Wiimms SZS Tools (wbmgt) (Can convert a BMG to a TXT file. High chance of crashing if you edit with this.)