STRG (Metroid Prime)
See STRG (File Format) for the other revisions of this format.
The STRG format is used to store string tables. Each STRG file can contain any number of strings, as well as variations for different languages; the Prime series supports English, French, German, Spanish, Italian, Dutch, and Japanese.
To do: Could do with documentation of the formatting tags that can be found inside the strings |
Format
Offset | Type | Count | Name | Notes | MP1 | MP2 |
---|---|---|---|---|---|---|
0x0 | u32 | 1 | Magic | Always 0x87654321 .
|
✔ | ✔ |
0x4 | u32 | 1 | Version | See hub article for a list of possible version numbers. | ✔ | ✔ |
0x8 | u32 | 1 | Language Count | Number of languages that this table has strings for. | ✔ | ✔ |
0xC | u32 | 1 | String Count | Number of strings contained in the file per language. | ✔ | ✔ |
0x10 | Language | Language Count | Language Table | Table that defines the languages that are present in the file. | ✔ | ✔ |
Name Table | 1 | Name Table | Associates each string in the file with a name. | ✖ | ✔ | |
String Table | Language Count | String Tables | Contains the actual string data. There is one table per language. | ✔ | ✔ | |
End of file |
Language
Offset | Type | Count | Name | Notes | MP1 | MP2 | |
---|---|---|---|---|---|---|---|
0x0 | char | 4 | Language ID | This is a fourCC that indicates which language this is. See below for a list of possible fourCCs. | ✔ | ✔ | |
0x4 | u32 | 1 | Language Strings Offset | Offset relative to the start of the string tables array. | ✔ | ✔ | |
0x8 | u32 | 1 | Language Strings Size | Size of the string table for this language. In Prime 1 this value is at the beginning of each string table instead of being part of the language definition. | ✖ | ✔ | |
0xC | Language entry end |
Possible language codes:
ID | Language |
---|---|
ENGL
|
English |
FREN
|
French |
GERM
|
German |
SPAN
|
Spanish |
ITAL
|
Italian |
DUTC
|
Dutch |
JAPN
|
Japanese |
Note that while Dutch doesn't actually appear in any STRG files, the fourCC for it can be found in the dol alongside the other language codes, so the game probably supports it.
Name Table
In Echoes, this table is used to attach a name to the strings in the file. The names are used internally to allow the game to look up a particular string from a file using its name rather than having to hardcode a string index to find it. This table only appears in the Echoes STRG format; for Prime 1, skip ahead to the string tables.
Offset | Type | Count | Name | Notes |
---|---|---|---|---|
0x0 | u32 | 1 | Name Count | Number of string names in the table. Note this does not necessarily equal the regular string count! It's possible to have a STRG file where some strings have names and some don't. |
0x4 | u32 | 1 | Name Table Size | Relative to after this size value. |
0x8 | Name Entry | Name Count | String Name Entries | This array doesn't contain the names themselves, but it defines each one and associates it with one of the strings. |
string | Name Count | String Name Array | This is an array of zero-terminated ASCII strings. The names are sorted in alphabetical order; the sorting is case-sensitive, so 'Z' will appear before 'a'. | |
End of name table |
Name Entry
This structure is used to point to a name in the String Name Array and associate it with one of the strings from the file.
Offset | Type | Count | Name | Notes | |
---|---|---|---|---|---|
0x0 | u32 | 1 | Name Offset | Relative to after the name table size value. | |
0x4 | u32 | 1 | String Index | The index of the string that the name is associated with | |
0x8 | End of entry |
String Table
The file contains one string table per language. Each table contains some metadata followed by a series of UTF-16 strings. The number of strings included in each table is determined by the String Count value in the header, which is consistent across every language in the file.
Offset | Type | Count | Name | Notes | MP1 | MP2 |
---|---|---|---|---|---|---|
0x0 | u32 | 1 | String Table Size | Size of the string table, not including the size value itself. In Echoes this value was moved inside the language definitions earlier in the file. | ✔ | ✖ |
0x4 | u32 | String Count | String Offsets | Each offset is relative to after the size value. | ✔ | ✔ |
wstring | String Count | Strings Array | This is an array of zero-terminated UTF-16 Unicode strings. | ✔ | ✔ | |
End of string table |
The number of bytes in Strg should be a multiple of 32.
Tools
- STRG Editor by Aruki - supports creating/editing and resaving STRG files in Metroid Prime 1/2's formats