Difference between revisions of "Project X/Library file"

From Worms Knowledge Base

Jump to: navigation, search
(Created page)
 
m (Fixed linking)
Line 95: Line 95:
 
* 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.
 
* 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 simply the typical int-prefixed ASCII string consisting of the scripts source code.
 
* 0x04: A script. The data is simply the typical int-prefixed ASCII string consisting of the scripts source code.
* 0x08: A weapon. The data follows the reused [[User:Pac-Man/Project X weapon 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 22:13, 11 January 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.

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 simply 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