Difference between revisions of "STRG (Metroid Prime)"
m |
m |
||
(5 intermediate revisions by one other user not shown) | |||
Line 2: | Line 2: | ||
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. | 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. | ||
+ | |||
+ | {{todo|Could do with documentation of the formatting tags that can be found inside the strings}} | ||
__TOC__ | __TOC__ | ||
== Format == | == Format == | ||
− | |||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
! Offset | ! Offset | ||
− | ! | + | ! Type |
− | ! | + | ! Count |
+ | ! Name | ||
+ | ! Notes | ||
+ | ! MP1 | ||
+ | ! MP2 | ||
|- | |- | ||
| 0x0 | | 0x0 | ||
− | | | + | | u32 |
− | | '''Magic''' | + | | 1 |
+ | | '''Magic''' | ||
+ | | Always <code>0x87654321</code>. | ||
+ | | {{check}} | ||
+ | | {{check}} | ||
|- | |- | ||
| 0x4 | | 0x4 | ||
− | | | + | | u32 |
− | | '''Version''' | + | | 1 |
+ | | '''Version''' | ||
+ | | See [[STRG (File Format)|hub article]] for a list of possible version numbers. | ||
+ | | {{check}} | ||
+ | | {{check}} | ||
|- | |- | ||
| 0x8 | | 0x8 | ||
− | | | + | | u32 |
− | | '''Language | + | | 1 |
+ | | '''Language Count''' | ||
+ | | Number of languages that this table has strings for. | ||
+ | | {{check}} | ||
+ | | {{check}} | ||
|- | |- | ||
| 0xC | | 0xC | ||
− | | | + | | u32 |
− | | '''String | + | | 1 |
+ | | '''String Count''' | ||
+ | | Number of strings contained in the file per language. | ||
+ | | {{check}} | ||
+ | | {{check}} | ||
|- | |- | ||
| 0x10 | | 0x10 | ||
− | | colspan= | + | | [[#Language|Language]] |
+ | | ''Language Count'' | ||
+ | | '''Language Table''' | ||
+ | | Table that defines the languages that are present in the file. | ||
+ | | {{check}} | ||
+ | | {{check}} | ||
+ | |- | ||
+ | | {{none}} | ||
+ | | [[#Name Table|Name Table]] | ||
+ | | 1 | ||
+ | | '''Name Table''' | ||
+ | | Associates each string in the file with a name. | ||
+ | | {{nocheck}} | ||
+ | | {{check}} | ||
+ | |- | ||
+ | | {{none}} | ||
+ | | [[#String Table|String Table]] | ||
+ | | ''Language Count'' | ||
+ | | '''String Tables''' | ||
+ | | Contains the actual string data. There is one table per language. | ||
+ | | {{check}} | ||
+ | | {{check}} | ||
+ | |- | ||
+ | | colspan=7 {{unknown|End of file}} | ||
|} | |} | ||
− | === | + | === Language === |
− | + | ||
− | + | ||
{| class="wikitable" | {| class="wikitable" | ||
! Offset | ! Offset | ||
− | ! | + | ! Type |
− | ! | + | ! Count |
+ | ! Name | ||
+ | ! Notes | ||
+ | ! MP1 | ||
+ | ! MP2 | ||
|- | |- | ||
| 0x0 | | 0x0 | ||
+ | | char | ||
| 4 | | 4 | ||
− | | '''Language''' fourCC | + | | '''Language ID''' |
+ | | This is a fourCC that indicates which language this is. See below for a list of possible fourCCs. | ||
+ | | {{check}} | ||
+ | | {{check}} | ||
|- | |- | ||
| 0x4 | | 0x4 | ||
− | | | + | | u32 |
− | | '''Language | + | | 1 |
+ | | '''Language Strings Offset''' | ||
+ | | Offset relative to the start of the string tables array. | ||
+ | | {{check}} | ||
+ | | {{check}} | ||
|- | |- | ||
| 0x8 | | 0x8 | ||
− | | | + | | u32 |
− | | '''Language | + | | 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. | ||
+ | | {{nocheck}} | ||
+ | | {{check}} | ||
|- | |- | ||
| 0xC | | 0xC | ||
− | | colspan= | + | | colspan=7 {{unknown|Language entry end}} |
|} | |} | ||
− | + | Possible language codes: | |
− | In Echoes, strings | + | {| class="wikitable" |
+ | ! ID | ||
+ | ! Language | ||
+ | |- | ||
+ | | <code>ENGL</code> | ||
+ | | English | ||
+ | |- | ||
+ | | <code>FREN</code> | ||
+ | | French | ||
+ | |- | ||
+ | | <code>GERM</code> | ||
+ | | German | ||
+ | |- | ||
+ | | <code>SPAN</code> | ||
+ | | Spanish | ||
+ | |- | ||
+ | | <code>ITAL</code> | ||
+ | | Italian | ||
+ | |- | ||
+ | | <code>DUTC</code> | ||
+ | | Dutch | ||
+ | |- | ||
+ | | <code>JAPN</code> | ||
+ | | 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. | ||
{| class="wikitable" | {| class="wikitable" | ||
! Offset | ! Offset | ||
− | ! | + | ! Type |
− | ! | + | ! Count |
+ | ! Name | ||
+ | ! Notes | ||
|- | |- | ||
| 0x0 | | 0x0 | ||
− | | | + | | u32 |
− | | '''Name | + | | 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 | | 0x4 | ||
− | | | + | | u32 |
− | | '''Name | + | | 1 |
+ | | '''Name Table Size''' | ||
+ | | Relative to after this size value. | ||
|- | |- | ||
| 0x8 | | 0x8 | ||
− | | colspan= | + | | [[#Name Entry|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. | ||
+ | |- | ||
+ | | {{none}} | ||
+ | | 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'. | ||
+ | |- | ||
+ | | colspan=5 {{unknown|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. | ||
{| class="wikitable" | {| class="wikitable" | ||
! Offset | ! Offset | ||
− | ! | + | ! Type |
− | ! | + | ! Count |
+ | ! Name | ||
+ | ! Notes | ||
|- | |- | ||
| 0x0 | | 0x0 | ||
− | | | + | | u32 |
− | | '''Name | + | | 1 |
+ | | '''Name Offset''' | ||
+ | | Relative to after the name table size value. | ||
|- | |- | ||
| 0x4 | | 0x4 | ||
− | | | + | | u32 |
− | | '''String | + | | 1 |
+ | | '''String Index''' | ||
+ | | The index of the string that the name is associated with | ||
|- | |- | ||
| 0x8 | | 0x8 | ||
− | | colspan= | + | | colspan=5 {{unknown|End of entry}} |
|} | |} | ||
− | + | === String Table === | |
− | + | ||
− | === String | + | |
− | + | 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. | |
{| class="wikitable" | {| class="wikitable" | ||
! Offset | ! Offset | ||
− | ! | + | ! Type |
− | ! | + | ! Count |
+ | ! Name | ||
+ | ! Notes | ||
+ | ! MP1 | ||
+ | ! MP2 | ||
|- | |- | ||
| 0x0 | | 0x0 | ||
− | | | + | | u32 |
− | | '''String | + | | 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. | ||
+ | | {{check}} | ||
+ | | {{nocheck}} | ||
|- | |- | ||
| 0x4 | | 0x4 | ||
− | | | + | | u32 |
− | | '''String | + | | ''String Count'' |
+ | | '''String Offsets''' | ||
+ | | Each offset is relative to after the size value. | ||
+ | | {{check}} | ||
+ | | {{check}} | ||
|- | |- | ||
− | | | + | | {{none}} |
− | | | + | | wstring |
− | | '''UTF-16 strings | + | | ''String Count'' |
+ | | '''Strings Array''' | ||
+ | | This is an array of zero-terminated UTF-16 Unicode strings. | ||
+ | | {{check}} | ||
+ | | {{check}} | ||
+ | |- | ||
+ | | colspan=7 {{unknown|End of string table}} | ||
|} | |} | ||
+ | |||
+ | The number of bytes in Strg should be a multiple of 32. | ||
== Tools == | == Tools == | ||
− | * [https://drive.google.com/file/d/0B9MLV21H7SDvSjBIY3BKRkQyZlk/edit?usp=sharing STRG Editor] by | + | * [https://drive.google.com/file/d/0B9MLV21H7SDvSjBIY3BKRkQyZlk/edit?usp=sharing STRG Editor] by Aruki - supports creating/editing and resaving STRG files in Metroid Prime 1/2's formats |
[[Category:File Formats]] | [[Category:File Formats]] | ||
[[Category:Metroid Prime]] | [[Category:Metroid Prime]] | ||
+ | [[Category:Metroid Prime 2 Demo]] | ||
[[Category:Metroid Prime 2: Echoes]] | [[Category:Metroid Prime 2: Echoes]] | ||
− | [[Category:Metroid Prime 3 | + | [[Category:Metroid Prime 3 Prototype]] |
− | + |
Latest revision as of 01:51, 30 April 2023
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