Difference between revisions of "Project X/Library file"
From Worms Knowledge Base
(Corrected unclear information about script item block) |
(Fix) |
||
Line 73: | Line 73: | ||
| Name | | Name | ||
| | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
Line 93: | Line 78: | ||
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: | 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). | + | * 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 | + | * 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 file block|Project X weapon block structure]]. | * 0x08: A weapon. The data follows the reused [[Project X/Weapon file block|Project X weapon block structure]]. |
Revision as of 23:29, 2 March 2014
(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, name and length.
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.