EAW_str_files_structure_explained

This document explains the structure of .str files used in EAW (European Air War)

The header structure

The first 8 bytes is @ a header, broken down into 2 x 4 byte sections that is to say the first 4 bytes of that header contain a number that is
the size of the file (records) in bytes
- 8 byte header
= the number

example 1a

Example; textmap1.str from EAW1.3stuff02.zip/EAW1.3stuff02/savedata folder is 58,743 bytes
in which the header first bytes contains the number (hexidecimal notation in this explaination will have the 0x prefix) 0xE56F

which is in decimal the number: 58735
so 58,743
- 58735
= 8 , the size of the header

TMS-1exx.jpg

header nodes section

Following the first 4 bytes of the header the next 4 bytes have a number which is the number of records or 'nodes'
in the case of same file above the number is 0x0DED which in decimal is 3565
the file contains 3565 records
these records (you can find in the bottom half of the file with a hex editor) are simply ascii text in this case names of various

.tpc files, .ter files, .spt files
each text record is followed by a null 00 byte
including the last record. So the last byte in the file EOF byte is also a null 00

example 1b

in the case of same file above the number is 0x0DED which in decimal is 3565
the file contains 3565 records
these records (you can find in the bottom half of the file with a hex editor) are simply ascii text in this case names of various

.tpc files, .ter files, .spt files
each text record is followed by a null 00 byte
including the last record. So the last byte in the file EOF byte is also a null 00

The node structure

after the 8 header bytes (2 x 4 bytes sections, including the header nodes section) as previously described), a series of 4 bytes for records or node pointers are found
each of these individual 4 byte nodes contain a number
the number is the jump location to the text record (always from the beginning of the file after the header)

TMS-ex-nodessectionstart.jpg

example 1c

in the case of textmap1.str file example above; the first node contains 0x37B4 which in decimal is 14260
If you set your cursor on the first byte there (B4) and jump 14260 down the file you are at the first text record byte the
TMS-textrecordssection.jpg
B(ascii 42) of BNcloud0.ter
Each node thereafter follows this same structure,
but note that since text length of the text records that they point to can vary
so do will the number
so in other words; the text records are not ex: a series of same length say; 8 bytes, and the file is not broken up into
ex: a series of i * 8 bytes
(however each text record is terminated by a 0x '00' or 'null' byte)
follow along in a hex editor:
next node: 0x37CE (aka decimal# 14286)
if you jump down 14286 (always from the beginning of the file after the 8 header bytes):
you find: clouds.tpc
next 0x37D9 or 14297 jump down you find gun.spt
next 0x37E1 aka 14305 jump down to HWExplos.spt
- you notice those numbers?
14305
- 14297 = 8
??? you might think.. yes! gun.spt = 7 bytes + a null 00 byte = 8 bytes..
So now you see the structure
other than the 8 header bytes the node pointers uses this structure
Examining the last node right before the first record text BNcloud0.ter the number is 0xE563 or 58723 jump down (again;

always from beginning) you get to last record tgf255s.tpc

nodes section review

the nodes aka 'nodes pointer' structure has been explained, but to be clear;
the entire section of the file (before the text records) contains
a series of nodes of 4 bytes each
there should be a node for each text record it points to

example 1d

in the case of the file the nodes header section has a number; 3565
3565 x 4 (4 btyes for each node)
= 14260
as explained in the example above that is where the text records start
so the entire nodes section containing the individual 4 byte nodes in the textmap1.str example is
14260 bytes
if we jump down from the first node as we did, to the first text record byte the B(ascii 42) of BNcloud0.ter, (which is of course the start of the text records section) and then count the remaining bytes in the file, (that is the entire text record section), in this case is the number we get is 44 44,475 bytes
TMS-countbytes-texttoEOF.jpg
44475
+ 14260
= 58735 bytes
exactly the number as listed in the first header bytes
so in this case the entire nodes section as explained is 14260 bytes
it contains 3565 individual nodes of 4 bytes each
which is exactly the same as the number of text records
(each text record is as many bytes as it takes to contain the ascii characters code for the letter,etc)
we can confirm this by jumping (as above) to the beginning of the text records then count the number of null (00)
bytes to the EOF which is: 3,565
TMS-bytesfromtexttoEOF.jpg

The text records section

following the entire node pointers section of individual nodes of 4 bytes each is the text records they point to
These are simple text ascii records you can view in a text editor like notepad, however they are terminated by a 0x '00' or

'null' byte

example 1e

3565 individual text records as indicated by examples above

The end of the file (EOF) byte

following the last text record text (the EOF byte) the file terminated by a 0x '00' or 'null' byte

TMS-at-EOF.jpg

example 1f

so in the case of the textmap1.str file example above in a hex editor the last (12 bytes) record with EOF looks like this:
74 67 66 32 35 35 73 2E 74 70 63 00 which in the ascii or text section of a hex editor would be
t g f 2 5 5 s . t p c (null)
in a simple text edior like notepad it looks like this:
tgf255s.tpc (a space would follow since notepad doesn't know how to render a null byte, but that space is not the same as

the ascii character code for space which is 20)
some other editors might render the null as . or other oddities

Making .str files

You can't use notepad or a simple text editor to make a string file but with the old tools made by Paulo Morais like

BUILDSTR.EXE and DUMPSTR.EXE you can dump and make .str files from text files.
Tony (MrJelly) West made some tools like like StrEdit128Vxx (various versions) DirSet maker (.set files - as of this writing

- are just .str files just using the .set extension), OAW for 1.3 tools with PDir and FMdir.set maker.
I may have some tools package made available soon also.

Comments

That's it, the EAW .str files are explained.
Why these odd files? Has to do with easily using the same system with a program to access .str data records like an array.

with pointers

Author

RAF_Roy
3/14/2012
Southern California, USA

Version

Version 1 - dated 3/15/2012