PDA

View Full Version : Resource: Quotes strings.bin file format.



Tellos Athenaios
11-16-2010, 05:02
The quotes.txt.strings.bin file can be converted by alpaca's tool (as well as the CUF tool) as a “keyed”/“tagged” strings.bin file and the game will run (quotes will work). However the actual strings.bin format (data/text/quotes.txt.strings.bin) is different from some of the others in a few key aspects.

Differences are:

All entries are sorted alphabetically when the file is generated by the game. Contrast with export_units.txt.strings.bin or strat.txt.strings.bin where the items are sorted in the order you define them.
Example:


¬ data/text/quotes.txt example code:
{Quote_1} q1
{Author_1} a1
{Quote_2} q2
{Author_2} a2
{Quote_3} q3
{Author_3} a3
{trans_3} t3

The above code will be sorted as follows in the strings.bin file (key => value):


Author_1 a1
Author_2 a2
Author_3 a3
Quote_1 q1
Quote_2 q2
Quote_3 q3
trans_3 t3

Order is important: the game expects this order and generating strings.bin file otherwise appears to cause performance to deteriorate.
Erratum: it is a 4byte integer which contains the number of entries in the lookup table.
The contents of a data/descr_quotes_lookup.txt are appended to the end (after the empty string). Keys are defined one per line and in the order you want them to appear.
Example descr_quotes_lookup.txt code corresponding to the quotes.txt code above:


Quote_1
Quote_3
Author_1
Author_2
Quote_2
trans_3
Author_3

The lookup section will have these keys appear in this order in the quotes.txt.strings.bin file despite the fact that the actual strings data maintains a rigid alphabetical order. The lookup file may be empty: quotes will continue to work just fine if it is empty. The lookup section in the quotes.txt.strings.bin file may be empty as well.


Lookup file
If either data/text/quotes.txt or data/descr_quotes_lookup.txt files are modified the game appears not to (re)generate the strings.bin file accordingly if it already exists. So if you rely on the game to regenerate the strings.bin file you must delete it first.

Erratum: effects of (missing) lookup tables on performance is not specific to how the engine handles this particular file. The same effect applies to export_units.txt.strings.bin and export_buildings.txt.strings.bin.