Difference between revisions of "MSBT (File Format)"

From MK8
Jump to navigation Jump to search
m (Added index + TXT2 formatting)
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
The MSBT File format seems to be something like BMG was in MKWii. MSBT files contain the game's text.  
+
'''MSBT files''' contains the game's text. The files have been used in many different games on the [[Wii]], [[3DS]] and [[Wii U]]. In [[Mario Kart 8]] the file has a main header (MSBT) and two sections with their own headers (NLI1 and TXT2). Each section is padded to the next multiple of 0x10 using a sequence of <code>0xAB</code> bytes.
 
 
The file has a main header (MSBT) and two data blocks with their own headers (NLI1 and TXT2). After each data block, there are the bytes "0xAB AB AB AB"
 
 
 
MSBT files are also used in some Wii games, such as Super Mario Galaxy 2.
 
  
 
== Header ==
 
== Header ==
 
 
The MSBT file format starts with a header structure.
 
The MSBT file format starts with a header structure.
  
{| class="wikitable"
+
{|class="wikitable"
 
|-
 
|-
! Offset
+
! Offset !! Type !! Description
! Size
 
! Description
 
 
|-
 
|-
| 0x00
+
| 0x00 || String || '''File magic'''. Always ''MsgStdBn'' in ASCII.
| 8
 
| '''String "MsgStdBn" in ASCII''' (file identifier).
 
 
|-
 
|-
| 0x08
+
| 0x08 || UInt16 || {{BOM}}
| 2
 
| '''Byte order mark''' (0xFEFF)
 
 
|-
 
|-
| 0x0a
+
| 0x0A || UInt16 || '''Unknown'''. Always 0x0000.
| 2
 
| ''Unknown'', always 0x0000
 
 
|-
 
|-
| 0x0c
+
| 0x0C || UInt16 || '''Unknown'''. Always 0x0103.
| 2
 
| ''Unknown'', always 0x0103
 
 
|-
 
|-
| 0x0e
+
| 0x0E || UInt16 || '''Number of sections'''.
| 2
 
| '''Number of sections'''
 
 
|-
 
|-
| 0x10
+
| 0x10 || UInt16 || '''Unknown'''. Always 0x0000.
| 2
 
| ''Unknown'', always 0x0000
 
 
|-
 
|-
| 0x12
+
| 0x12 || UInt32 || '''File size'''.
| 4
 
| '''File size'''
 
 
|-  
 
|-  
| 0x16
+
| 0x16 || Byte[10] || '''Unknown'''. Always 0.
| 10
 
| ''Unknown'', always 0x0000 0000 0000 0000 0000
 
 
|-
 
|-
| 0x20
+
| 0x20 || colspan=2 {{unknown|End of file header}}
| colspan=2 {{unknown|End of file header}}
 
 
|}
 
|}
  
 
== NLI1 ==
 
== NLI1 ==
 +
The NLI1 section starts with a section header.
  
=== NLI1 Header ===
+
{|class="wikitable"
 
 
{| class="wikitable"
 
 
|-
 
|-
! Offset
+
! Offset !! Type !! Description
! Size
 
! Description
 
 
|-
 
|-
| 0x00
+
| 0x00 || String || '''Section magic'''. Always ''NLI1'' in ASCII.
| 4
 
| '''String "NLI1" in ASCII''' (file identifier).
 
 
|-
 
|-
| 0x04
+
| 0x04 || UInt32 || '''Section size''' (starting from 0x10).
| 4
 
| '''Section size'''
 
 
|-
 
|-
| 0x08
+
| 0x08 || Byte[8] || '''Unknown'''. Always 0.
| 8
 
| ''unknown'' (always empty?)
 
 
|-
 
|-
| 0x0f
+
| 0x10 || UInt32 || '''Number of entries'''.
| 4
 
| '''Number of entries'''
 
 
|-
 
|-
| 0x13
+
| 0x14
 
| colspan=2 {{unknown|End of NLI1 header}}
 
| colspan=2 {{unknown|End of NLI1 header}}
 +
|}
 +
 +
After the header comes the entries. Each entry has the following structure:
 +
 +
{|class="wikitable"
 +
|-
 +
! Offset !! Type !! Description
 +
|-
 +
| 0x00 || UInt32 || '''Message index'''. The game uses this value as a key to find the relevant string.
 +
|-
 +
| 0x04 || UInt32 || Index into the [[#TXT2|TXT2 strings]].
 
|}
 
|}
  
 
== TXT2 ==
 
== TXT2 ==
 +
The TXT2 section starts with a header.
  
=== TXT2 Header ===
+
{|class="wikitable"
 
 
{| class="wikitable"
 
 
|-
 
|-
! Offset
+
! Offset !! Type !! Description
! Size
 
! Description
 
 
|-
 
|-
| 0x00
+
| 0x00 || String || '''Section magic'''. Always ''TXT2'' in ASCII.
| 4
 
| '''String "TXT2" in ASCII''' (file identifier).
 
 
|-
 
|-
| 0x04
+
| 0x04 || UInt32 || '''Section size''' (starting from 0x10).
| 4
 
| '''Section size'''
 
 
|-
 
|-
| 0x08
+
| 0x08 || Byte[8] || '''Unknown'''. Always 0.
| 8
 
| ''unknown'' (always empty?)
 
 
|-
 
|-
| 0x0f
+
| 0x10 || UInt32 || '''Number of entries'''.
| 4
 
| '''Number of entries'''
 
 
|-
 
|-
| 0x13
+
| 0x14 || colspan=2 {{unknown|End of TXT2 header}}
| colspan=2 {{unknown|End of TXT2 header}}
 
 
|}
 
|}
  
=== TXT2 data ===
+
After the TXT2 header, there are four bytes for each entry, containing the offset to the UTF16 string. This UTF16 string can contain special formatting bytes, which have an 8-byte size and start with <code>0x0E00</code>. This is used to give text a specific (usually red) colour, or to display an icon of a button (E.g. the "A" button present on controllers, or the Amiibo scan icon present on the Wii U gamepad).
 +
 
 +
== Tools ==
 +
The following tool can handle MSBT files:
 +
* [https://github.com/IcySon55/3DLandMSBTeditor/releases/tag/v0.9.7 MSBT Editor Reloaded], by [[User:IcySon55|IcySon55]]
  
After the TXT2 header, there are four bytes for each entry, containing the offset to the UTF16 string.
+
[[Category:File Format]]

Latest revision as of 15:11, 28 January 2024

MSBT files contains the game's text. The files have been used in many different games on the Wii, 3DS and Wii U. In Mario Kart 8 the file has a main header (MSBT) and two sections with their own headers (NLI1 and TXT2). Each section is padded to the next multiple of 0x10 using a sequence of 0xAB bytes.

Header

The MSBT file format starts with a header structure.

Offset Type Description
0x00 String File magic. Always MsgStdBn in ASCII.
0x08 UInt16 Byte Order Mark (BOM): 0xFEFF for big endian and 0xFFFE for little endian.
0x0A UInt16 Unknown. Always 0x0000.
0x0C UInt16 Unknown. Always 0x0103.
0x0E UInt16 Number of sections.
0x10 UInt16 Unknown. Always 0x0000.
0x12 UInt32 File size.
0x16 Byte[10] Unknown. Always 0.
0x20 End of file header

NLI1

The NLI1 section starts with a section header.

Offset Type Description
0x00 String Section magic. Always NLI1 in ASCII.
0x04 UInt32 Section size (starting from 0x10).
0x08 Byte[8] Unknown. Always 0.
0x10 UInt32 Number of entries.
0x14 End of NLI1 header

After the header comes the entries. Each entry has the following structure:

Offset Type Description
0x00 UInt32 Message index. The game uses this value as a key to find the relevant string.
0x04 UInt32 Index into the TXT2 strings.

TXT2

The TXT2 section starts with a header.

Offset Type Description
0x00 String Section magic. Always TXT2 in ASCII.
0x04 UInt32 Section size (starting from 0x10).
0x08 Byte[8] Unknown. Always 0.
0x10 UInt32 Number of entries.
0x14 End of TXT2 header

After the TXT2 header, there are four bytes for each entry, containing the offset to the UTF16 string. This UTF16 string can contain special formatting bytes, which have an 8-byte size and start with 0x0E00. This is used to give text a specific (usually red) colour, or to display an icon of a button (E.g. the "A" button present on controllers, or the Amiibo scan icon present on the Wii U gamepad).

Tools

The following tool can handle MSBT files: