Skip to main content

Save Files

This is Dead Cells' specific binary save file format. It stores multiple serialised objects in a compressed format along with hashes to prevent corruption or tampering.

note

All this information was obtained from f@34927 static tool.$Save.genSave (User, Bool) -> haxe.io.Bytes - if you'd like to help out, try looking at this function yourself!

warning

This is not complete! Although a partial reimplementation of hxbit is available in hxbit.py, this can only read - not write - save file data.

A working example of reading and writing a Dead Cells save file is available in alivecells as savetool.py.

Format

File

Size (bytes)NameStruct
59HeaderHeader
VariablePayloadPayload

Header (PC version)

Size (bytes)NameDescriptionStruct
4Magic0xDEADCE11None
1VersionCurrent format version, usually 1Unsigned 8-bit integer
20ChecksumSHA-1 raw hex digest of the file's contents, assuming these 20 bytes are 0x0 while taking the hashNone
20Git hashCurrent long commit hash of the game, as a hex digestNone
10Build dateBuild date of the game version creating this save fileUTF-8 string
4FlagsFlags and metadata about the save file - mostly unknownFlags

Header (mobile version)

Size (bytes)NameDescriptionStruct
4Magic0x20DEAD19None
1VersionCurrent format version, usually 2Unsigned 8-bit integer
20ChecksumSHA-1 raw hex digest of the file's contents, assuming these 20 bytes are 0x0 while taking the hashNone
20Git hashA value for each major version of the game, currently 0000DEADCE110000000000000000000300500000None
10Build dateBuild date of the game version creating this save fileUTF-8 string
4FlagsFlags and metadata about the save file - mostly unknownFlags

Flags

BitValue (Dec)Value (Hex)NameTypeDescription
010x1S_UserData ChunkIf set, a chunk containing persistent user progress (unlocks, cells, gold) exists.
120x2S_GameData ChunkIf set, a chunk containing an in-progress run exists. If clear, the save was made from the main menu.
240x4S_UserAndGameDataData ChunkIf set, a chunk containing general game metadata exists.
380x8S_DateData ChunkIf set, a chunk containing the 8-byte save timestamp exists.
4160x10S_ExperimentalFeature FlagIf set, the save was made while the game's experimental/beta features were enabled.
5320x20S_UsesModsFeature FlagIf set, the save was made with mods active. This is determined by checking if user.activeMods is populated.
6640x40S_HaveLoreFeature FlagIf set, indicates the save supports lore rooms. This flag is unconditionally set on all modern saves.
71280x80S_VersionNumberData ChunkIf set, a chunk containing the 4-byte float game version exists.
82560x100S_DLCMaskData ChunkIf set, a chunk containing the 4-byte integer bitmask of installed DLCs exists.
9-31--Unused-These bits are currently unused but reserved for future expansion (which is unlikely). They are always 0.

Payload

The payload is a Zlib-compressed blob that contains the actual save file - some of them are hxbit serialised data, and others are just raw bits and pieces. They follow the order of the data chunk flags that were set previously - basically, if a data chunk flag was 1, then the chunk is present in the save file. The payload is compressed with Zlib level 9 (maximum) compression. To manipulate it, read it as follows:

  • Decompress the payload (it has headers, so any stock zlib implementation can handle it)
  • Figure out how many data chunks are enabled
  • For each of those data chunks that's enabled, read a Chunk from the payload blob, seeking forward in it as you do.

Chunk

Size (bytes)NameDescriptionStruct
4SizeSize of the contentsUnsigned 32-bit integer
VariableContentsRaw bytes of the save file chunk contentsVaries, see Chunk Formats

Chunk Formats

Depending on what kind of data chunk you're reading, the format of its chunk in the save file changes. Here's a basic map:

BitNameType
0S_Userhxbit Data
1S_Gamehxbit Data
2S_UserAndGameDatahxbit Data
3S_DateDate Chunk
7S_VersionNumberVersionNumber Chunk

Date Chunk

Size (bytes)NameDescriptionStruct
8DateDate of save file creation as a unix timestampDouble

VersionNumber Chunk

Size (bytes)NameDescriptionStruct
4VersionMajor game version for this save file, eg 34 or 3532-bit float

hxbit Data

This data is serialised with help from hxbit - a Haxe library that enables serialisation of arbitrary objects to binary representations. This format has been partially reversed in hxbit.py.

See the full page for format specs.

Additional notes about saves from the mobile version

The chunks S_Game and S_UserAndGameData cannot be copied from a PC save to a mobile save, because mobile has no implementation of the Twitch integration features; those Twitch features are always referenced in those two chunks on a PC save even when they have not been activated, leading to a crash when trying to pass them on the mobile version.

However, the S_User chunk, which contains the meta progress of the save (including unlocked items), can be passed from a PC save to a mobile save.