prevnext   » SZS: Wiimms SZS Toolset » Guides » BMG: Syntax and usage of BMG text files

BMG: Syntax and usage of BMG text files

Contents

1.   Introduction

The tool wbmgt appeared in April 2011. From the beginning it supports a text representation of BMG message files. The advantage of a text file is that it can be created and modified by humans and machines (scripts) without knowledge of the internal file structure. Also many things can be made easier by using escape sequences instead of binary codes.

Wiimms SZS Tools accept binary and text BMG files as input and can convert each format to each other. Moreover BMG files of both formats can be used to patch other BMG files of both formats (see option --patch-bmg).

This pages describes the syntax of BMG text files and how to convert them to and from binary BMG files used by Nintendo. It also gives usage examples.

2.   Syntax

A valid BMG text file starts with the magic '#BMG' (4 characters). A byte-order-mark (BOM) is accepted before the magic.

A BMG text file is line oriented with support of continuation lines:

All other lines must follow one of the following line formats:

Line Format
Format Description
MID ~ ATTRIB32 MID is the Message ID (see below). Define a 32-bit attribute for the message MID without any string. Use a following text assignment to define a text.
MID / Define a message ID without any string (NULL pointer). This is different to a message with an empty string. The impact is unknown, but Mario Kart Wii use NULL pointers and emtpy strings.
MID '[' ATTRIB ']' / Define a message ID without any string (NULL pointer). ATTRIB is a attribute vector with any number of byte values. The ATTRIB must be enclosed by brackets ([..]). For more details, see below.

This line format is available since v1.40a.

MID = TEXT Define a text string for MID. An already existing string is replaced, but the attribute of an existing string is not changed. For new messages, the attribute is set to 0x01000000 ([1]).

Continuation lines are possible.

MID '[' ATTRIB ']' = TEXT Define a text string for MID. An already existing string is replaced. ATTRIB is a attribute vector with any number of byte values. The ATTRIB must be enclosed by brackets ([..]). For more details, see below.

Continuation lines are possible. This line format is available since v1.40a.

    + TEXT This is a text continuation line for a previous text assignment.

Multiple continuation can be used. Spaces and tabs before the '+' are ignored. Maximal 1 space behind the '+' is ignored. A line feed is not included on continuation and must be explicitly defined as part of TEXT.

MID1 : MID2 Message assignment: Copy attributes and text of message MID2 to message MID1. Forward and chained references are allowed. This kind of assignment is delayed after all other messages are defined.

If MID1 is a multi message ID like T12, all related messages are used as destination. If MID2 is a multi message, only the first defined message is used as source.

This assignment is available since v2.02a.

Spacing
Before the assignment character ('~', '/', '=' or '+') any number of spaces and tabs can be used. Between '='/'+' and TEXT only the first space is skipped. Additional spaces are part of the text.

On output, always 1 space is printed behind each '=' and '+'.

MID
Each message is identified by a Message ID (MID). The MID is either a hexadecimal number (without 0x prefix) or a name of:
Tct
The literal 'T' is used for a track name definition. 'c' is a cup number between 1–8 and 't' a track index between 1–4. Both messages related to the track with respect of re-ordered tracks are defined. If LE-CODE or CT-CODE is active, then a third LE/CT-CODE relevant message is also defined.
Uct
The literal 'U' is used for a battle arena name definition (an 'A' would conflict with hex numbers). 'c' is a cup number between 1–2 and 't' a track index between 1–5. Both messages related to the track with respect of re-ordered tracks are defined.
Mnn
The literal 'M' is used for a chat message. 'nn' is a decimal number between 01 and 96.
As of v2.08, each message id can be followed by a slot definition. See below.
@SLOT
As of v2.08, each message id (MID) can be followed by a slot definition. The optional definition is started by an '@' followed by a hex number. Only slot numbers up to FFFE are accepted. If defined, the message is placed at this position in binary files. Messages without slots are placed behind the last predifined slot.
TEXT
The text to assign. The text may contain escape sequences to enter special characters and Nintendo escapes.
ATTRIB32
The attribute of the message as 32-bit hex numbers.
ATTRIB
The attribute of the message with any number of 4 byte values in hexadecimal notation. This line format is available since v1.40a and the default since v1.44. On text output, the new in-line format can be disabled by option --no-bmg-inline.

2.1   Attributes

For each message, a string and an attribute is defined. wbmgt supports attributes of different length. Mario Kart Wii uses always a attribute size of 4 bytes (32-bit word) and Animal Crossing Wii 16 bytes.

If the attribute size is exact 4 bytes, then it can be printed as single value (ATTRIB32). Otherwise the vector format '[...]' (ATTRIB) is used. A attribute vector is always surrounded by brackets. The vector itself is a comma separated list of byte (8-bit) values in hexadecimal notation. NULL values can be omitted.
Example: [1,,A0] == [1,,A0,] == [1,0,A0,0]

If using a slash ('/') instead of a comma, the next value will be word (32-bit) aligned. The omited bytes are assumed to be NULL.
Example for an 8 byte attribute: [,B/33] == [,B,,,33] == [0,0B,0,0,33,0,0,0]

Mario Kart Wii uses 4 different attributes to select a font. Other attributes will lead into a game freeze.

Attributes used by Mario Kart Wii
ATTRIB32 ATTRIB
(full)
ATTRIB
(short)
Description
0x00000000 [0,0,0,0] [0] Value used for count down and for final race strings like "FINISH!".
0x01000000 [1,0,0,0] [1] Standard font for nearly all messages.
0x04000000 [4,0,0,0] [4] A special red font (only digits) used for battle and team points.
0x05000000 [5,0,0,0] [5] A special blue font (only digits) used for battle and team points.

2.2   Escapes for TEXT

The text is scanned char by char assuming UTF-8. Invalid UTF-8 characters are interpreted as ISO LATIN-15 character as fallback. The backslash ('\' ) is a special character that starts an escape sequence. The meaning depends on the following characters:

Escape Sequences
Syntax Description
\\ The backslash itself.
\a ASCII 7 = 0x07 = BEL (bell)
\b ASCII 8 = 0x08 = BS (back space)
\f ASCII 12 = 0x0c = FF (form feed)
\n ASCII 10 = 0x0a = LF (line feed)
\r ASCII 13 = 0x0d = CR (carriage return)
\t ASCII 9 = 0x09 = HT (horizontal tabulator)
\v ASCII 11 = 0x0b = VT (vertical tabulator)
\nnn Insert a character (16-bit) defined by the octal number 'nnn' with 1–3 digits. Only characters with code 0–511 (–0x1ff) are possible.
\m{a,b,...} Each parameter is interpreted as message id (MID). If a message with given MID exists (must be defined before and must not have an assigned value), then insert the text of the message.

If the message does not exist, the macro library is searched as fallback. If this fails too, text »\m{MID}« is inserted.

This escape sequence is available since v2.02a.

\M{a,b,...} Each parameter is interpreted as message id (MID). The message is searched in the macro library. If found, then insert the text of the message. If the message does not exist, text »\M{MID}« is inserted.

This escape sequence is available since v2.03a.

\x{nnnn} Insert a character (16-bit) defined by the hexadecimal number 'nnnn' with any number of hexadecimal digits. Only the lowest 16 bits of the number are used.
\x{a,b,...} Since v1.44, \x{} supports also a comma separated lists of parameters. Each parameter is interpreted as hexadecimal number and defines exact one 16-bit character.
\z{xyy,a} This is a short cut for Nintendos escape sequences up to 12 bytes:
  • 'x' is usually one of '6', '8', 'a' or 'c' and defines the byte length of the whole sequence. Odd values are only used on byte encodings like CP1252 or UTF-8. In this case, a padding 0 is appended on UTF-16 encodings.
  • 'y' is any byte code to identify the main functionality.
  • 'a' is a hexadecimal number of any length. Only the lowest 16-bit (on x=6), 32-bit (on x=8), 48-bit (on x=a) or 64-bit (on x=c) of the number are used.
The data is stored as \x{1a}\x{xyy} followed by the integer zzzz (1–4 values of 16-bit; most significant first).
\z{xyy,a,b,c,...} Since v1.44, the tools support also Nintendos escape sequences from 14 to 254 bytes:
  • 'x' is usually one of '6', '8', 'a' or 'c' and defines the byte length of the whole sequence. Odd values are only used on byte encodings like CP1252 or UTF-8. In this case, a padding 0 is appended on UTF-16 encodings.
  • 'y' is any byte code to identify the main functionality.
  • 'a' is a hexadecimal number of any length. Only the lowest 16-bit, 32-bit, 48-bit or 64-bit of the number are used.
  • 'b,c,...' are 64-bit hexadecimal numbers and each represents four 16-bit characters.
The data is stored as \x{1a}\x{xyy} followed by the integers a, b, ... (5 or more characters of each 16-bit; most significant first).
\u{zzzzzzzz} Insert the 32-bit unicode character U+zzzzzzzz. It's a short cut for \z{801,zzzzzzzz}.
\u{a,b,...} Since v1.44, \u{} supports also a comma separated lists of parameters. Each parameter is interpreted as 32-bit unicode character U+x and inserted as \z{801,x}.
\c{zzzz} Insert the 16-bit color zzzz. It's a short cut for: \z{800,1zzzz}.

If zzzz is not a number, but a known color name, then the related color number is used.

2.3   Colors

Mario Kart Wii supports colored texts. To change a color, a Nintendo Escape Sequence is used.

The tools accept escape sequences of format \c{num_or_name} to change the current color. The following table lists the color names and the related color codes. The examples are made by capturing a video. So the example colors are inaccurare and depending of the used TV system, but give a good overview.

Colors used by Mario Kart Wii
Names Number Info Examples
OFF
NONE
GRAY
GREY
0x00 No special color defined. Often grey is used. Only this color is blinking on track selection. 123 Abc 123 Abc 123 Abc
TRANSP
CLEAR
0x08 Characters are invisible and only space is reserved.
WHITE 0x02 123 Abc 123 Abc 123 Abc
RED1
RED
0x40 123 Abc 123 Abc 123 Abc
RED2 0x20 123 Abc 123 Abc 123 Abc
RED3 0x32 123 Abc 123 Abc 123 Abc
RED4 0x01 123 Abc 123 Abc 123 Abc
YELLOW 0x30 123 Abc 123 Abc 123 Abc
GREEN 0x33 123 Abc 123 Abc 123 Abc
BLUE1
BLUE
0x21 123 Abc 123 Abc 123 Abc
BLUE2 0x31 123 Abc 123 Abc 123 Abc
YOR0 0x10 Begin of yellow-orange-red (YOR) series. 123 Abc 123 Abc 123 Abc
YOR1 0x11 123 Abc 123 Abc 123 Abc
YOR2 0x12 123 Abc 123 Abc 123 Abc
YOR3 0x13 123 Abc 123 Abc 123 Abc
YOR4 0x14 123 Abc 123 Abc 123 Abc
YOR5 0x15 123 Abc 123 Abc 123 Abc
YOR6 0x16 123 Abc 123 Abc 123 Abc
YOR7 0x17 End of yellow-orange-red series. 123 Abc 123 Abc 123 Abc

2.4   Examples

#BMG  <<<  The first 4 characters '#BMG' are the magic for a BMG text file.
#     <<<  Don't remove them!

# Set the Message ID (MID) a234 to "Hello"
 a234 = Hello

# Standard C escape sequences are allowed:
 a234 = Hello\nWiimm

# Continuation lines and colors are also possible
 a234 = Hello\n
      + \c{blue}Wiimm\c{off}

# Attributes are specified with ~
 a234 ~ 0x01000000

# For track names use the MID alternative 'Tct'
# Both related messages will be defined.
 T11 = name of first track

# Points for battles; use blue special font (in-line mode for attribute)
 76d [5] = \z{a02,1000000000}

3.   Decode and Encode

For all SZS tools, DECODE means: Convert data to an external file format. And ENCODE means: Convert data to an internal file format.

A BMG file is decoded into a human and machine readable text file. And encoding means: Create a new BMG binary file from scratch. The source may be a binary or text BMG file.

Commands to decode (examples without options):

wbmgt decode FILE.bmg
wbmgt cat FILE.bmg
wbmgt mix FILE.bmg
wszst bmg FILE.szs
wctct bmg CT-FILE

Command to encode (examples without options):

wbmgt encode FILE.txt

4.   -P mode[cond][=param]   |   --patch-bmg mode[cond][=param]

This option specifies a BMG patch mode. Some of the modes need a parameter or a file name of a BMG patch file (raw or text BMG), both separated by an equal sign. Modes with required file names are PRINT, REPLACE, INSERT, OVERWRITE, DELETE, MASK, EQUAL and NOTEQUAL. Modes with text parameter are FORMAT, REGEXP and RM-REGEXP. Standalone modes are ID, ID-ALL, UNICODE, RM-ESCAPES, RM-CUPS, CT-COPY, CT-FORCE-COPY, CT-FILL, LE-COPY, LE-FORCE-COPY, LE-FILL, X-COPY, X-FORCE-COPY and X-FILL. Unique abbreviations are allowed. The optional condition COND is either '?MID' or '!MID'. In case of '?MID', the patch is only applied if the message id MID already exists. In case of '!MID', the patch is only applied if the message id MID does not exists. If this option is used multiple times, all patch files will be processed in the entered order. --patch is a short cut.
For each appereance of this option, the mode and the patch file combination is appended to an internal patching list. All source files are patched by all files of this patching list in the entered order.

The mode describes how to patch the source file by the current patch file. wbmgt supports 8 patching modes with source files, abbreviations are allowed:

Patching Modes with source files
Mode Copy ... if
only
in
source
only
in
patch
source
!=
patch
source
==
patch
REPLACE source patch both
INSERT source patch source both
OVERWRITE source patch patch both
DELETE source
MASK source both
EQUAL both
NOT-EQUAL source
PRINT source print print

There are some more modes, that do not use any source file.

FORMAT=string acts like PRINT=file, but us the same format string for all printings. REGEX replace parts of strings matched by regular expressions. ID and ID-ALL insert the MID of each message to identifiy it while playing.

Modes RM-CUPS, CT-COPY, CT-FORCE-COPY and CT-FILL support CT-CODE.

4.1   REPLACE=file

The patch file will only replace strings that are already defined in the source. Other strings are ignored.

This is the standard usage.

4.2   INSERT=file

Insert only new strings into the source. Already existing strings are untouched.

4.3   OVERWRITE=file

All strings of the patch file will overwrite the string in the source file. Non exisintg strings are created.

4.4   DELETE=file

Remove strings from the source that are defined in the patch file. The content of the single string in the patch file is ignored.

4.5   MASK=file

Remove strings from the source that are not defined in the patch file. The content of the single string in the patch file is ignored.

4.6   EQUAL=file

Remove strings from the source that are not defined in the patch file or that are different. Leave equal strings only.

4.7   NOT-EQUAL=file

Remove strings from the source that are defined in the patch file and that are equal.

4.8   PRINT=file

The patch file will only change (not replace) strings that are already defined in the source. Other strings are ignored.

The new string is created like a printf function call. Is a escape sequence is found, it is replaced by its (calculated content). The format of escape sequences is one of:

'%' CONV_LETTER
'%' LEN CONV_LETTER
'%' BEGIN ':' END CONV_LETTER
An escape sequence starts always with a percent sign and ends with a conversion letter (CONV_LETTER). In between a length (LEN) or an index range (BEGIN:END) can be specified to select a sub string.

The following conversion letters are supported:

%s or %S
Copy the source string.
%i
Insert the hexadecimal message ID.
%I
Insert the hexadecimal message ID with at least 4 digits.
%n or %N
Insert the name of the source file. This helps to identify the relevant source SZS.
%m
Set a marker at the current place. This marker can be used by %M and %L.
%M
%#M works like %L, but don't insert anything to the output. If the line # is empty, then all characters behind the last marker set by %m are removed.
%l or %L
The source is split into lines at LF characters. The lines are numbered from 0 to N-1. %#l and also %#L selects line # and copies it to the destination. Non-existing lines are interpreted as blank lines.

%#L has an additional feature: If the line is empty, then all characters behind the last marker set by %m are removed.

4.9   FORMAT=string

Syntax: format=string

Mode FORMAT works like mode PRINT. The only difference is, that FORMAT defines exact one format string, which is used for every source string of the current message set.

4.10   REGEX=list

Syntax: regex=list

LIST is a semicolon separated list of expressions of format »/PATTERN/REPLACEMENT/options«. Instead of »/« you can use any character except of white spaces and semicolons.

PATTERN is a POSIX Extended Regular Expression.

REPLACEMENT is the replacement string. The special escapes \1 through \9 ( or $1 through $9) refer to the corresponding matching sub-expressions in the PATTERN. The special escapes \0 and $0 refer to the complete matching expression.

2 OPTIONS are supported: »i« for ignore case, and »g« for global (instead of only first) replacements.

4.11   ID

The mode ID is a standalone mode without filename.

Each defined and non empty message is prefixed by a letter representing the SZS filename (examples: T=Titel, E=Event, S=MenuSingle, ...) and the message id as hex number and a colon.

Example: 'Hello' of Event_E.szs becomes 'E1194:Hello'.

This mode helps to identify the messages while running the game.

4.12   ID-ALL

The mode ID-ALL is a standalone mode without filename.

Each defined message including empty messages is prefixed by a letter representing the SZS filename (examples: T=Titel, E=Event, S=MenuSingle, ...) and the message id as hex number and a colon.

Example: 'Hello' of Event_E.szs becomes 'E1194:Hello' and an empty message becomes 'E1200'.

4.13   RM-CUPS

The mode RM-CUPS is a standalone mode without filename and supports the CT-CODE extension of +Wiimms SZS Tools+.

All defined racing cup names in the MID range 23F0–23F7 are removed.

4.14   CT-COPY

The mode CT-COPY is a standalone mode without filename and supports the CT-CODE extension of +Wiimms SZS Tools+.

All defined track and arena name message are copied to the messages in the MID range 4000–4029, but only, if the destinaton message is not defined or empty.

4.15   CT-FORCE-COPY

The mode CT-FORCE-COPY is a standalone mode without filename and supports the CT-CODE extension of +Wiimms SZS Tools+.

All defined track and arena name message are copied to the messages in the MID range 4000–4029. Existing messages are overwritten.

4.16   CT-FILL

The mode CT-FILL is a standalone mode without filename and supports the CT-CODE extension of +Wiimms SZS Tools+.

All messages of MID range 4000–40ff, that are not defined or empty, will be defined and set to the message 'Slot xx', where xx is the right 2 letters of the message id. Additionally, message 4100 is set to '???', if not already defined or empty.

The definitions will only be done, if at least one track or arena name message is alrrady defined.

Command reference

»wbmgt cat«,   »wbmgt decode«,   »wbmgt diff«,   »wbmgt encode«,   »wbmgt list«,   »wbmgt mix«,   »wbmgt patch«,   »wbmgt slots«,   »wctct bmg«,   »wctct cat«,   »wctct create«,   »wctct decode«,   »wctct dump«,   »wctct patch«,   »wctct tracks«,   »wszst check«,   »wszst compress«,   »wszst copy«,   »wszst create«,   »wszst decompress«,   »wszst encode«,   »wszst extract«,   »wszst kcl«,   »wszst kmp«,   »wszst normalize«,   »wszst patch«,   »wszst slots«,   »wszst update«,   »wszst xall«,   »wszst xdecode«,   »wszst xexport«.

5.   --filter-bmg list

If this option is set, the BMG messages are filtered by this list. Only enabled messages are exported to the output BMG file (binary or text). The parameter is a list of message ids (short MID, 'Txx' or 'Uxx' or Mxx' or hex number) or message ranges (MID:MID) or one of the keywords NONE, IDENT (=ID), PARAM, CUPS, TRACKS, ARENAS, CHAT, CTCODE (=CT), CTUPS, CTTRACKS, CTARENAS, CTREFS, LECODE (=LE), LEUPS, LETRACKS, LEARENAS, LEREFS, XCODE (=X), XUPS, XTRACKS, XARENAS, XREF, GENERIC or ALL. If an element is preceded by a minus sign, it is removed from the filter list (disabled). With v2.01a, this option was renamed from --msg to the more meaningful name --filter-bmg. The old name is still available.
Before v2.01a, this option was named --msg. This old name is still available. Anyway, new scripts should use --filter-bmg.

This option activates an output filter for BMG messages. Only messages explicitly enabled will reach the output. All other messages are ignored for the output.

Filter Ranges
Name MID Range Description
NONE all Clear the filter at deny all messages.
ALL all Allow all messages.
IDENT 3DEF This modifier is available since v2.00a.

A message to identify the MID ranges of cups and tracks.See next section for details.

PARAM 3FF0:3FFF
IDENT
A range to submit settings to other tools like mkw-ana. PARAM includes IDENT since v.2.00a.
CUPS 23F0:23F7
2489:248A
XCUPS
XREFS
Names of racing and battle cups. CUPS includes XCUPS and XREFS.
TRACKS 2454:2473
2490:24AF
XTRACKS
XREFS
Names of racing tracks. TRACKS includes XTRACKS and XREFS.
ARENAS 24B8:24c1
24CC:24d5
XARENAS
Names of battle arenas. ARENAS includes XARENAS.
CHAT 1194:11f3 96 messages for the online chat.
CTCODE 4000:44FD All messages used by CT-CODE. It overlaps other ranges.
CTCUPS 4200:423F This modifier is available since v2.01a.

All cup names used by CT-CODE.

CTTRACKS 4000:41FE All racing track and battle arena names used by CT-CODE.
CTARENAS 4020:4029 This modifier is available since v2.01a.

All battle arena names used by CT-CODE. The range is part of CTTRACKS.

CTREFS 4300:44FE This modifier is available since v2.01a.

All cup references (Format CUP.INDEX) of all tracks used by CT-CODE.

LECODE 6800:8FF0 This modifier is available since v2.00a.

All messages used by LE-CODE. It overlaps other ranges.

LECUPS 6800:6BFF This modifier is available since v2.01a.

All cup names used by LE-CODE.

LETRACKS 7000:7FFF This modifier is available since v2.00a.

All racing track and battle arena names used by LE-CODE.

LEARENAS 7020:7029 This modifier is available since v2.01a.

All battle arena names used by LE-CODE. The range is part of LETRACKS.

LEREFS 8000:8FFF This modifier is available since v2.01a.

All cup references (Format CUP.INDEX) of all tracks used by LE-CODE.

XCODE LECODE
or
CTCODE
This modifier is available since v2.00a.

If option --le-code is set, it is the same as LECODE. Otherwise if option --ct-code is set, it is the same as CTCODE. Otherwise it does nothing.

XCUPS LECUPS
or
CTCUPS
This modifier is available since v2.01a.

If option --le-code is set, it is the same as LECUPS. Otherwise if option --ct-code is set, it is the same as CTCUPS. Otherwise it does nothing.

XTRACKS LETRACKS
or
CTTRACKS
This modifier is available since v2.00a.

If option --le-code is set, it is the same as LETRACKS. Otherwise if option --ct-code is set, it is the same as CTTRACKS. Otherwise it does nothing.

XARENAS LEARENAS
or
CTARENAS
This modifier is available since v2.01a.

If option --le-code is set, it is the same as LEARENAS. Otherwise if option --ct-code is set, it is the same as CTARENAS. Otherwise it does nothing.

XREFS LEREFS
or
CTREFS
This modifier is available since v2.01a.

If option --le-code is set, it is the same as LEREFS. Otherwise if option --ct-code is set, it is the same as CTREFS. Otherwise it does nothing.

6.   Other BMG Options

The following options change the output format of text files. The text scanner accepts all formats:

Options
Option Param Description
-H --no-header Suppress the syntax information section in BMG text files.
-B --brief If set, the information header in decoded text files is suppressed (for historical reasons same as --no-header). If set at least twice, all comments are suppressed and the output is packed without empty lines. If set 3 times, the #BMG file indentification is also suppressed.
--encoding name Force a BMG encoding for new BMG files. Accepted encoding names are: CP-1252, UTF-16BE (or UTF-16), SHIFT-JIS, UTF-8 and AUTO for automatic detection (default). Same keywords without minus signs are accepted too.

Mario Kart Wii uses encoding UTF-16BE; the default if no other encoding is defined.

--inf-size size Defines the 'INF1' size of new BMG files between 4 and 1000. The first 4 bytes of a INF1 record is an offset into the string pool and the remaining bytes the attributes. Maximal 40 attribute bytes are supported and additional bytes are assumed to be NULL. All BMG files of MKW have a size of 8.
--bmg-mid [mode] Control the creation of BMG section MID1. Suppress the creation, if mode is OFF. Force the creation, if mode is ON. On mode AUTO (default), the source is analysed for the decision.
--force-attrib attrib Forces, that all attributes are set to this vector.
--def-attrib attrib Define the default attributes for BMG files. If not set, the default attributes are estimated. On text output, strings with default attributes are printed without attribute vector. The usual default attribute for MKW is [1].
--no-attrib Suppress the output of any BMG attributes if creating BMG text files.
--x-escapes Use \x{} escapes instead of \z{} escapes.
--old-escapes To be compatible with v1.43 and earlier, print 1A escape sequences with total size of >12 bytes as single words using \x{}. Also don't use \x{} and \u{} with parameter lists.
-1 --single-line If set, don't print continuation lines for BMG text output. If set twice, print only single text lines and suppress attributes like option --no-attrib does it.
-l --long Print long numeric message IDs instead of alternative message names like Txx, Uxx or Mxx.
-X --export Enable the export mode and create small and machine readable text files for easy post processing. The option works similar like -HBl11 for BMG text files.
--no-bmg-colors If set, suppress the output of '\c{color}' escape sequences for colors definitions in BMG text output to be compatible with old versions of the tools.
--bmg-colors Force output of '\c{color}' escape sequences with names, even for foreign (not MKWii) BMG files.
--no-bmg-inline Print BMG attributes as separate line before the message definition to be compatible with versions until v1.39. The output for the standard value 0x01000000 is always suppressed. This was the default until v1.43.
--compatible vers The option expects a version number (format '#.##' or 'v#.##') or a revision number (format 'r#') as parameter. If set, the tools try to create BMG and KMP text files, that are compatible to the entered version of the tools. This may override other legacy options.

7.   Identification by 3DEF

Message with ID 3DEF defines modes and ranges for external tools like mkw-ana. 3DEF is a concatenation of »3« for 3 variants (Nintendo, CT-CODE, LE-CODE) and »DEF« for definition.

A 3DEF message is a comma separated list of terms.
Example (line breaks added for readability):

	21, LE-CODE, v=1,
	ct=0, le=1, par=3ff0+10, rcup=6800+3fe, bcup=6bfe+2,
	t1=7000+1000, t2=0+0, a1=7020+a, a2=0+0, ref=8000+1000
All numbers are printed in hex.

Internal ID (21)
The first value is always an internal id for an fast identification by the tools without need to parse the complete string.
Name (LE-CODE)
The second value is always the name of the MKW extension. At the moment it is either Nintendo, CT-CODE or LE-CODE.
NAME=VALUE, ...
A list of name and value pairs. Tools should scan these list elements only, if an equal sign exists.

The following table lists all NAME=VALUE pairs. A scanner should ignore unknown names. All numbers are printed in hex. The format is either NAME=VALUE or NAME=START+COUNT.

NameExampleDescription
ct0 1, if CT-CODE is enabled.
le1 >0, if LE-CODE is enabled. The number tells the LE-CODE version.
par3ff0+10 Message ID range of the parameter block for mkw-ana.
rcup6800+3fe Message ID range of the names of the racing cups.
bcup6bfe+2 Message ID range of the names of the battle cups.
t17000+1000 Message ID range of the racing track names (first set).
t20+0 Message ID range of the racing track names (second set). Empty for CT-CODE and LE-CODE.
a17020+a Message ID range of the battle arena names (first set).
a20+0 Message ID range of the battle arena names (second set). Empty for CT-CODE and LE-CODE.
ref8000+1000 Message ID range of the track-to-cup references.