STRG (Metroid Prime): Difference between revisions
no edit summary
>Aruki mNo edit summary |
>Aruki No edit summary |
||
Line 6: | Line 6: | ||
== 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 count'' | | 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 | |||
| ''String Count'' | |||
| '''Strings Array''' | |||
| This is an array of zero-terminated UTF-16 Unicode strings. | |||
| {{check}} | |||
| {{check}} | |||
|- | |- | ||
| | | colspan=7 {{unknown|End of string table}} | ||
| | |||
|} | |} | ||