New Horizons:MSBT
Message Studio Binary Text (MSBT) files contain the localized text and other rendering details for the text rendering engine.
File Structure
A MSBT file consists of a file header followed by several sections.
Header
The general MSBT file header contains information about the used byte order, version, number of sections and total file size.
Offset | Size | Data Type | Description |
---|---|---|---|
0x00 | 8 | String | File signature: must be MsgStdBn for MSBT files
|
0x08 | 2 | Unsigned Short | Byte order: 0xfeff for big endian, 0xfffe for little endian
|
0x0a | 2 | ? | ? |
0x0c | 1 | Byte | Encoding: 0x00 for UTF-8, otherwise Unicode
|
0x0d | 1 | Byte | Version |
0x0e | 4 | Unsigned Integer | Section count |
0x12 | 4 | Unsigned Integer | File size |
Sections
Sections are always aligned to 16-byte blocks. This means that the first section in a MSBT file starts at 0x20
. There are several different types of sections: label, attribute and text sections. Not all sections need to be present but at least the label and text sections must exist.
Offset | Size | Data Type | Description |
---|---|---|---|
0x00 | 4 | String | Section type: LBL1 for label sections, ATR1 for attribute sections, TXT2 for text sections
|
0x04 | 4 | Unsigned Integer | Section size |
0x08 | 4 | - | Padding |
Label Section
The label section contains unique identifiers for all messages. The header contains the number of entries.
Offset | Size | Data Type | Description |
---|---|---|---|
0x00 | 4 | Unsigned Integer | Entry count |
Following the section header, a list of label groups is provided. Each label group header contains the number of labels in the group and the offset (counting from the section header start at 0x10
) to the strings.
Offset | Size | Data Type | Description |
---|---|---|---|
0x00 | 4 | Unsigned Integer | Label count |
0x04 | 4 | Unsigned Integer | Group offset |
Each label data contains the length of the label string, the string itself and a zero-based index to the message the label is for.
Offset | Size | Data Type | Description |
---|---|---|---|
0x00 | 1 | Byte | String length |
0x01 | n | String | Label string (terminated with a \0 null-byte)
|
0xnn | 4 | Unsigned Integer | Message index |
Attribute Section
The attribute section contains additional attribute data for the messages. The header contains the number of entries and the size (in bytes) of the attributes.
Offset | Size | Data Type | Description |
---|---|---|---|
0x00 | 4 | Unsigned Integer | Entry count |
0x04 | 4 | Unsigned Integer | Attribute size |
Following the section header, a list of all attributes is provided. The exact usage and purpose of this data is not fully known at this point.
Offset | Size | Data Type | Description |
---|---|---|---|
0x00 | n | Byte | Attribute bytes |
Text Section
The text section contains the actual text strings. The header contains the number of entries.
Offset | Size | Data Type | Description |
---|---|---|---|
0x00 | 4 | Unsigned Integer | Entry count |
Following the section header, a list of string offsets (counting from the section header start at 0x10
) is provided. Each offset points to one text string.
Offset | Size | Data Type | Description |
---|---|---|---|
0x00 | 4 | Unsigned Integer | String offset |
A text string is read starting from the current string offset until the next offset is reached. For the last string, the section size is used to determine the end of the string.
Offset | Size | Data Type | Description |
---|---|---|---|
0x00 | n | String | Text string (terminated with a \0 null-byte)
|
MSBT Functions
MSBT text strings contain encoded function calls that are executed by the text rendering engine. The specific functions vary depending on the game. The start of such an encoded function is always indicated by the 0x0E
byte sequence and ends with 0x0F
. All functions have the following structure.
Offset | Size | Data Type | Description |
---|---|---|---|
0x00 | 2 | Unsigned Short | Function type |
0x02 | 2 | Unsigned Short | Function sub-type |
0x04 | 2 | Unsigned Short | Argument byte count |
Following the function header, a list of arguments is provided. The data type and purpose of these arguments depend on the function type. For more details refer to the list of all known MSBT functions.