Text Book: Difference between revisions
Created page with "'''''Text Book''''' is a file format used in Sonic the Hedgehog (2006) for storing text with friendly names and variables. These files are located in <code>cache.arc</code> and <code>text.arc</code> under the <code>./text/</code> directory from platform root as <code>*.mst</code> files. == Specification == '''Text Book''' uses a Binary Resource container. The text to be displayed is encoded as UTF-16, whereas the names and variables are encoded as Shift-JIS. =..." |
mNo edit summary |
||
| Line 87: | Line 87: | ||
</syntaxhighlight>The game should first play the sound <code>all01_a00_sn</code>, then draw something akin to the following text: | </syntaxhighlight>The game should first play the sound <code>all01_a00_sn</code>, then draw something akin to the following text: | ||
The quick <span style="color:#7F3300;">brown</span> fox jumps over the <span style="color:#FF0000;">lazy</span> dog. Press the <span style="color:#32AA00;">'''Ⓐ'''</span> button to continue. | The quick <span style="color:#7F3300;">brown</span> fox jumps over the <span style="color:#FF0000;">lazy</span> dog. Press the <span style="color:#32AA00;">'''Ⓐ'''</span> button to continue. | ||
[[Category:File Formats]] | |||
Revision as of 20:25, 2 December 2025
Text Book is a file format used in Sonic the Hedgehog (2006) for storing text with friendly names and variables.
These files are located in cache.arc and text.arc under the ./text/ directory from platform root as *.mst files.
Specification
Text Book uses a Binary Resource container. The text to be displayed is encoded as UTF-16, whereas the names and variables are encoded as Shift-JIS.
Header
The header consists of the following data structure:
| Offset | Type | Name | Description |
|---|---|---|---|
| 0x00 | Char[4] | Signature | Always "WTXT" (referring to UTF-16). |
| 0x04 | UInt32 | NameOffset | The offset of the name of this Text Book. |
| 0x08 | UInt32 | CardCount | The total number of Text Cards in this Text Book. |
Text Card
Text Cards consist of the following data structure:
| Offset | Type | Name | Description |
|---|---|---|---|
| 0x00 | UInt32 | NameOffset | The offset of the name of this Text Card. |
| 0x04 | UInt32 | TextOffset | The offset of the UTF-16 text for this Text Card. |
| 0x08 | UInt32 | VariablesOffset | The offset of the variables for this Text Card. |
Variables
Variables are stored as comma-separated values, there should be one for each '$' character in the actual text to be displayed.
| Variable | Description | Usage |
|---|---|---|
| color | Once encountered, stops colouring characters the colour that was previously set. | color
|
| picture | Once encountered, draws a picture defined in the game's Text Font Picture file. | picture(button_a)
|
| rgba | Once encountered, starts colouring characters the specified colour. | rgba(255,0,0)
|
| sound | Once encountered, the game will play the specified sound effect if the Sound Bank containing it is loaded. | sound(all01_a00_sn)
|
For example, with the following text:
$The quick $brown$ fox jumps over the $lazy$ dog.\nPress the $ button to continue.
And the following variables:
sound(all01_a00_sn),rgba(127,51,0),color,rgba(255,0,0),color,picture(button_a)
The game should first play the sound all01_a00_sn, then draw something akin to the following text:
The quick brown fox jumps over the lazy dog. Press the Ⓐ button to continue.