Project X/Library file

From Worms Knowledge Base

Revision as of 22:58, 2 March 2014 by Pac-Man (Talk | contribs) (Corrected unclear information about script item block)

Jump to: navigation, search
(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.

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
diff. 4 int Length The length of the following data without this item description
diff. s. Length byte[] Data

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). The data are simply the file bytes.
  • 0x04: A script. The data is a string with the length specified in the item description (combined with this, it is the typical int-prefixed ASCII string) consisting of the scripts source code.
  • 0x08: A weapon. The data follows the reused Project X weapon block structure.
Personal tools