Langband has been inspired by the ARFC002 penned by Andrew Sidwell, but has done some modifications. This document describes the Langband savefile format in v0.1.2:
The savefile is constructed of a "savefile header", then followed by blocks. Little endian is used for this savefile format.
The file header has a four-byte "magic number". This magic number differs from "83.97.118.101" in ARFC002 and is "83.97.118.102". (This spoils some of the magic number pun, but this is an iteration :-) This can easily be used to check if indeed this is a langband savefile. The magic number is followed by two u16b version numbers; a version number for the engine used and a version number for the variant. Langband is split in engine and variant and both of these numbers are relevant. Regular angbands may eventually need both numbers if lua-scripting expands and lua "mods" written by users change from a released version but needs savefile access.
104 bytes in total.Format of file header | |
byte | Fake major: 83 |
byte | Fake minor: 97 |
byte | Fake patch: 118 |
byte | Fake extra: 102 |
u16b | Major/Engine version |
u16b | Minor/Variant version |
24 bytes | Id that identifies variant/mod/patchset to use |
u16b | Savefile status, a code of 0 means the character is dead |
64 bytes | Description of the savegame, useful for a savebrowser or when selecting one of many saves. |
u16b | Number of saveblocks in the file |
This header may be extended with a savedate, and other info at a later date. Input appreciated.
Format of a saveblock | |
u32b (4 bytes) | Vendor of block, eg- personal "key" (Langband uses 1337) |
u16b (2 bytes) | Type of block |
u16b (2 bytes) | Block version number |
u32b (4 bytes) | Length of data-field in the block |
u128b (16 bytes) | Checksum for the savebuffer |
xxx | The actual data (Length specified earlier in header) |