1 anno2205_save.py Tool Reference
Leon Schmidt edited this page 2026-03-31 13:13:07 +02:00

Tool Reference (anno2205_save.py)

Usage:
  python3 anno2205_save.py <savefile> dump            # human-readable output
  python3 anno2205_save.py <savefile> dump --csv      # CSV output (section,field,value)
  python3 anno2205_save.py <savefile> set <field> <value>  # patch a difficulty field

The set command creates a .bak backup of the original file before writing.

Key functions

Function Description
load_save(path) Read file, locate and decompress zlib stream. Returns (raw, dec, zlib_offset).
parse_metadata(raw, dec, zlib_offset) Parse header fields and corporation metadata. Returns SaveMetadata with _difficulty_offset set.
parse_difficulty(dec, start) Parse the DifficultySettings block. Returns DifficultySettings.
_patch_difficulty(dec, settings, start) Write modified difficulty values back into the decompressed buffer.
save_file(path, raw, dec, zlib_offset) Recompress and write to disk.

Important constants

Constant Value Description
HASH_OFFSET 0x008 Start of header hash in raw file
HASH_SIZE 0x020 Length of header hash (32 bytes)
ZLIB_SEARCH_START 0x028 Search for 78 DA from this offset
DIFFICULTY_BLOCK_START 0x08A Fallback offset; always computed dynamically