Msbt: Difference between revisions

6,209 bytes added ,  2 months ago
m
→‎Five Flags Flags: Section title typo
m (formatting + a typo)
m (→‎Five Flags Flags: Section title typo)
 
(15 intermediate revisions by 2 users not shown)
Line 3: Line 3:
'''Message Studio Binary Text'''  
'''Message Studio Binary Text'''  
<code>MSBT</code> is a binary file format belonging to LibMessageStudio (LMS). These files store the game's text and can contain "tags" that define how said text is displayed/interacted with.</onlyinclude>
<code>MSBT</code> is a binary file format belonging to LibMessageStudio (LMS). These files store the game's text and can contain "tags" that define how said text is displayed/interacted with.</onlyinclude>
== File Layout ==
== File Layout ==
<code>MSBT</code> files are composed of a file header followed by blocks (each with their own block header). All sections/blocks must be aligned to 0x10 (16) bytes. In BotW, the file layout is as follows:
<code>MSBT</code> files are composed of a file header followed by blocks (each with their own block header). All sections/blocks must be aligned to 0x10 (16) bytes. In BotW, the file layout is as follows:
Line 269: Line 270:
|Signature (<code>00 0e</code> or <code>00 0f</code>)
|Signature (<code>00 0e</code> or <code>00 0f</code>)
|-
|-
| 0x02
|0x02
| 2
|2
| u16
|u16
| Tag Group
|Tag Group
|-
|-
|0x04
|0x04
Line 283: Line 284:
|u16
|u16
|Extra Data Size (this value is ignored for <code>00 0f</code> tags which have no data)
|Extra Data Size (this value is ignored for <code>00 0f</code> tags which have no data)
|-
|0x08
|?
|?
|Extra data (size is dependent on Extra Data Size, type is dependent on Group and Type)
|}
|}
In Nintendo EPD games, tag group 0 tags are system tags, group 1 is <code>eui</code> tags, group 2 is app (game) specific tags, and group 201 is grammar tags. The other groups are currently unknown. In BotW, group 4 appears to be for animations and group 5 appears to be for delays.
In Nintendo EPD games, tag group 0 tags are system tags, group 1 is <code>eui</code> tags, group 2 is app (game) specific tags, and group 201 is grammar tags. The other groups are currently unknown. In BotW, group 4 appears to be for animations and group 5 appears to be for delays.
Line 313: Line 319:
|Ruby (extra data is a u16 display span followed by the ruby text)
|Ruby (extra data is a u16 display span followed by the ruby text)
|-
|-
| 0
|0
| 1
|1
| Font (extra data is a u16 font type)
|Font (extra data is a u16 font type)
|-
|-
| 0
|0
| 2
|2
|Font Size (extra data is a u16 font size)
|Font Size (extra data is a u16 font size)
|-
|-
| 0
|0
| 3
|3
|Font Color (extra data is a u16 color type)
|Font Color (extra data is a u16 color type)
|-
|-
| 0
|0
| 4
|4
| Page Break (no extra data)  
|Page Break (no extra data)  
|}
The available colors in BotW are listed in [[#Font Color]]. These colors are generally either hardcoded in the game's executable or defined in a separate MSBP file if present. If defined in a MSBP file, the color type instead acts as an index into the colors in the MSBP file.
 
===== Font =====
{| class="wikitable"
!Value
!Font
!Notes
|-
|0
|Hylian
|Stylized Hylian font (Unofficially known as Hylian Serif)
|-
|4
|Unknown
|
|-
|65535
|Normal
|Standard text font
|}
 
===== Font Color =====
{| class="wikitable"
!Value
!Color (h)
!Color
|-
|0
|0xff0a1aff
|Red
|-
|1
|0x64ff00ff
|Green
|-
|2
|0x00ffffff
|Cyan
|-
|3
|0xffffff40
|Grey (partly transparent white)
|-
|4
|0x007fffff
|Azure
|-
|5
|0xff4800ff
|Orange
|-
|6
|0x7f794aff
|Dull Gold
|-
|65535
|
|Reset to white or black, depending on background
|}
|}
The available colors are red, green, blue, gray, and orange in that order. 0xffff indicates a reset to the default white text color.


==== EUI Tags ====
==== EUI Tags ====
Line 355: Line 419:
|1
|1
|4
|4
|Two Choices (extra data is an array of u16 label indices for each choice followed by a u8 selected index and u8 cancel index)
|Two Choices (See [[#Choices]])
|-
|-
|1
|1
|5
|5
|Three Choices
|Three Choices (See [[#Choices]])
|-
|-
|1
|1
|6
|6
|Four Choices
|Four Choices (See [[#Choices]])
|-
|-
|1
|1
Line 371: Line 435:
|1
|1
|8
|8
|Three Choices based on flags (See [[#Choices Based on Flags]])
|-
|1
|9
|Five Flags (See [[#Five Flags]])
|-
|1
|10
|One Choice (See [[#Choices]])
|}
===== Choices =====
{| class="wikitable"
!Offset (h)
!Size
!Data Type
!Description
|-
|0x00
|2
|Unsigned Short
|First choice
|-
|0x02
|2
|Unsigned Short
|Second choice
|-
|0x04
|1
|Byte
|Default option (option highlighted when the choices are first shown)
|-
|0x05
|1
|Byte
|Cancel option (option chosen when the B button is pressed)
|}
Each choice type is a group of choices, whose text corresponds to the string conversion of the label indices in the current file. For example, if the label is <code>00 04</code> then the displayed choice will be the text corresponding to the <code>"0004"</code> key.
For ChoiceThree there is an additional choice at 0x04, and the default and cancel options are at 0x06 and 0x07, respectively.
For ChoiceFour there are additional choices at 0x04 and 0x06, and the default and cancel options are at 0x08 and 0x09, respectively.
For ChoiceOne, there is no choice at 0x02. Instead, the default option is always 1 and is located at 0x02, and the cancel option is always 0xCD and is located at 0x03.
===== Choices Based on Flags =====
{{expand section}}
{| class="wikitable"
!Unofficial Name
!Size
!Data Type
!Description
|-
|ParamSize
|2
|Unsigned short
|Number of bytes in the parameter, starting after the ParamSize
|-
|VarType
|2
|Unsigned short
|Type of the variable. Seems to use the same variable types as the Variable tag.{{check}} All flags are of the same type.
|-
|FlagOne
|?
|C-String
|u16 number of bytes in string, UTF-16 representation of the string (letters equal to number of bytes / 2)
|-
|ChoiceOne
|2
|Unsigned short
|First choice
|-
|FlagTwo
|?
|C-String
|u16 number of bytes in string, UTF-16 representation of the string (letters equal to number of bytes / 2)
|-
|ChoiceTwo
|2
|Unsigned short
|Second choice
|-
|FlagThree
|?
|C-String
|u16 number of bytes in string, UTF-16 representation of the string (letters equal to number of bytes / 2)
|-
|ChoiceThree
|2
|Unsigned short
|Third choice
|-
|DefaultIndex
|2
|Unsigned short
|Index of the choices that the cursor starts on
|-
|CancelIndex
|2
|Unsigned short
|Index of the choice that is chosen if the player presses B while selecting an option
|}
===== Five Flags =====
{{expand section}}
{| class="wikitable"
!Unofficial Name
!Size
!Data Type
!Description
|-
|ParamSize
|2
|Unsigned short
|Number of bytes in the parameter, starting after the ParamSize
|-
|FlagIndexOne
|2
|Unsigned short
|u16 that seems to correspond to some kind of index. There is always one number each of 0-4, for each flag {{check}}
|-
|FlagOne
|?
|C-String
|u16 number of bytes in string, UTF-16 representation of the string (letters equal to number of bytes / 2)
|-
|FlagIndexTwo
|2
|Unsigned short
|u16 that seems to correspond to some kind of index. There is always one number each of 0-4, for each flag {{check}}
|-
|FlagTwo
|?
|C-String
|u16 number of bytes in string, UTF-16 representation of the string (letters equal to number of bytes / 2)
|-
|FlagIndexThree
|2
|Unsigned short
|u16 that seems to correspond to some kind of index. There is always one number each of 0-4, for each flag {{check}}
|-
|FlagThree
|?
|C-String
|u16 number of bytes in string, UTF-16 representation of the string (letters equal to number of bytes / 2)
|-
|FlagIndexFour
|2
|Unsigned short
|u16 that seems to correspond to some kind of index. There is always one number each of 0-4, for each flag {{check}}
|-
|FlagFour
|?
|C-String
|u16 number of bytes in string, UTF-16 representation of the string (letters equal to number of bytes / 2)
|-
|FlagValueOne
|2
|Unsigned short
|Unknown{{check}}
|-
|FlagValueTwo
|2
|Unsigned short
|Unknown{{check}}
|-
|FlagValueThree
|2
|Unsigned short
|Unknown{{check}}
|-
|FlagValueFour
|2
|Unsigned short
|Unknown{{check}}
|-
|UnknownArray
|?
|byte[]
|Unknown purpose. Length is the remainder of the ParamSize that has not already been taken up by previous values
|}
==== App Tags ====
In BotW, the AppTag type is repurposed as a way to display the current value of a data flag. The Extra Data is the name of the data flag.
It is currently unknown what differentiates the various types that retrieve from the same data flag file.
{| class="wikitable"
!Group
!Type
!Variable Type
|-
|2
|0
|
|
|-
|-
|2
|1
|1
|
|-
|2
|2
|
|-
|2
|3
|
|-
|2
|4
|
|-
|2
|5
|
|-
|2
|6
|
|-
|2
|7
|
|-
|2
|8
|
|-
|2
|9
|9
|
|
|-
|-
|1
|2
|10
|10
|
|
|-
|2
|11
|String64 (defined in <code>string64_data_%d.bgdata</code>)
|-
|2
|12
|
|-
|2
|13
|
|-
|2
|14
|Integer (defined in <code>s32_data_%d.bgdata</code>)
|-
|2
|15
|Integer (defined in <code>s32_data_%d.bgdata</code>)
|-
|2
|16
|
|-
|2
|17
|Integer (defined in <code>s32_data_%d.bgdata</code>)
|-
|2
|18
|Integer (defined in <code>s32_data_%d.bgdata</code>)
|-
|2
|19
|Integer (defined in <code>s32_data_%d.bgdata</code>)
|-
|}
|}
==== App Tags ====
// TODO


==== Group 3 Tags ====
==== Group 3 Tags ====
// TODO
{| class="wikitable"
!Group
!Type
!Notes
|-
|3
|1
|Sound (Extra data is 2 byte values of unknown purpose)
|}
It is currently unknown if there are other group 3 tags


==== Group 4 Tags ====
==== Group 4 Tags ====
// TODO
{| class="wikitable"
!Group
!Type
!Notes
|-
|4
|1
|Sound (Extra data is 2 byte values: 1 of unknown purpose, and 0xCD)
|-
|4
|2
|Animation (Extra data is a C style string denoting the name of an animation for the controlling actor to play)
|}
It is currently unknown if there are other group 4 tags
 
==== Group 5 Tags ====
Group 5 is used a more general form of the Delay tag. Exact durations have not been tested.
{| class="wikitable"
!Group
!Type
!Pause Duration
|-
|5
|0
|Short
|-
|5
|1
|Long
|-
|5
|2
|Longer
|}


==== Grammar Tags ====
==== Grammar Tags ====
autopatrol, editnews
229

edits