Difference between revisions of "Project X/Library file"
From Worms Knowledge Base
m (Fix) |
m (Removed dead CodePlex link (might add back later when reimplemented on new GitHub repo)) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{ParentArticle|[[Project X]]}} | {{ParentArticle|[[Project X]]}} | ||
− | A library file contains 0 to infinite (2^32) items of the type file, script or weapon. The count of the items is given at the start of the file, then, each entry is written after another, prefixed to specify its type | + | A library file contains 0 to infinite (2^32) items of the type file, script or weapon. The count of the items is given at the start of the file, then, each entry is written after another, prefixed to specify its type and name. |
+ | |||
+ | The data types are in [http://msdn.microsoft.com/en-us/library/s1ax56ch.aspx C# notation]. | ||
== Header == | == Header == |
Latest revision as of 00:04, 23 April 2017
(Up to Project X)
A library file contains 0 to infinite (2^32) items of the type file, script or weapon. The count of the items is given at the start of the file, then, each entry is written after another, prefixed to specify its type and name.
The data types are in C# notation.
Contents
Header
The header provides general information about the library file details.
Offset | Size | Type | Description | Default value | Remarks |
---|---|---|---|---|---|
0 | 4 | byte[] | Identification | 0x0201CD1B | |
4 | 1 | byte | Version | 0x00 |
Content Table
The content table simply says how many items are following in the file.
Offset | Size | Type | Description | Default value | Remarks |
---|---|---|---|---|---|
5 | 4 | int | Item Count |
Items
The item structure is repeated as often as the content table specified.
Offset | Size | Type | Description | Default value | Remarks |
---|---|---|---|---|---|
9 (first) | 1 | byte | Type | 0x02 = File, 0x04 = Script, 0x08 = Weapon | S. below how to parse each type. |
10 (first) | diff. | string | Name |
Item Types
Each item structure contains a type field which determines the type of the item and thus the format of the data following. The following three item types are valid:
- 0x02: A raw file attachment (any format and size is accepted as long as the file item start index plus length do not overflow 2^32). An integer specifies the length of the following data which is simply the file bytes.
- 0x04: A script. The data is a typical int-prefixed ASCII string consisting of the scripts source code.
- 0x08: A weapon. The data follows the reused Project X weapon block structure. The length depends on the weapon block content, so it has to be parsed to retrieve it.