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.

Sections
Sections are always aligned to 16-byte blocks. This means that the first section in a MSBT file starts at. 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.

Label Section
The label section contains unique identifiers for all messages. The header contains the number of entries. 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 ) to the strings. 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.

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. 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.

Text Section
The text section contains the actual text strings. The header contains the number of entries. Following the section header, a list of string offsets (counting from the section header start at ) is provided. Each offset points to one text string. 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.

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  byte sequence and ends with. All functions have the following structure. 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.