Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Earth Defense Force save file (MDB0)

From ReverseEngineering.wiki
Format
Magic MDB0 (after decryption)
Extensions .GST, .CFG, .DAT, .MST
Endianness little
On this wiki Facts · Code · Notes · Topics

Encrypted save files of the PC Earth Defense Force games 4.1, 5 and 6 (MAIN.GST, COMMON.CFG, TROPHY.DAT, DEFP_Mxx.MST): AES-CTR over a plaintext that starts with the magic "MDB0", a version, a body length and a checksum. The layout differs per game; this page is compiled from the open-source EDFSaveEditor and is not independently verified.

Location and files

Steam saves live in SAVE_DATA\\<SteamID64>\\saveslotNN\\ under the game's local AppData folder. One slot holds MAIN.GST (characters, armor, loadouts, colors, weapon table), COMMON.CFG (settings, key bindings), TROPHY.DAT (achievement variables, kill statistics) and DEFP_Mxx.MST (mission progress per mission pack). EDF5 uses six MST files: M00/M01 base game offline/online, M02/M03 DLC1, M04/M05 DLC2.

Encryption

  • EDF5 and EDF6: AES-256-CTR. Key and IV are derived per file from MD5 hashes of UTF-16LE strings built from a game prefix and the on-disk file name (the key appends a fixed 16-byte constant). The exact derivation is in EDFSaveEditorSave_Handler.py of the EDFSaveEditor repository.
  • EDF4.1: AES-128-CTR with one fixed key/IV for every file (CryptoPP Rijndael with CTR_ModePolicy, identified by RTTI).

CTR mode needs no padding, so ciphertext and plaintext have the same length.

Header

Offset Size Field
0x00 4 Magic MDB0
0x04 4 Version (3 in EDF6 samples)
0x08 4 Body length = file size - 0x14
0x0C 4 Checksum
0x10 4 Save generation ID (EDF6/EDF4.1; a mismatch makes the game show "Slot Corrupted")

Checksum: EDF5 and EDF6 use CRC32C (polynomial 0x82F63B78, init and xorout 0xFFFFFFFF) stored bit-inverted; EDF6 covers data[0x14:], EDF5 data[0x20:] because its header is 0x20 bytes. EDF4.1 uses plain CRC-32 (zlib) over data[0x18:]. A stored checksum of 0 is accepted by the EDF6 loader.

Owner check: EDF5 stores the owner's full SteamID64 at 0x18-0x1F; EDF4.1 stores its low 32 bits at 0x10. A slot owned by another account shows as corrupted even with a valid checksum.

EDF5 offsets

Most EDF5 body fields are the EDF6 offsets shifted by +0xC (the larger header): armor, loadouts and colors in MAIN.GST; the weapon table in MAIN.GST starts at 0x7D08 (EDF6: 0x7CFC, 2048 entries of 12 bytes); the MST mission table for player 1 starts at 0x28 and player 2 at 0xA28.

Mission table bytes are difficulty bitmasks OR-ed on clear: 0x01 Easy, 0x02 Normal, 0x04 Hard, 0x08 Hardest, 0x10 Inferno. In EDF5/EDF6 clearing Hard also sets Normal and Easy (0x07), while Hardest and Inferno are independent bits.

TROPHY.DAT holds the variables declared in ETC/Achievement.sgo (section AchievementVariable) as consecutive 4-byte slots (int or float), ordered by variable name alphabetically. EDF5 has 71 variables. EDF4.1 starts the slots at file offset 0xC8.

Unverified: these EDF5 offsets come from the editor's code and notes, partly derived by analogy with EDF6. Test by decrypting a real EDF5 slot and checking the magic, the CRC32C over data[0x20:] and plausible weapon entries at 0x7D08.

Code & repositories

  • https://github.com/FevGrave/EDFSaveEditor @ e323d37ff207be8a6069d86de10ded5a0f363f01 · license: CC0-1.0
    Python save editor for EDF 4.1/5/6: AES-CTR decrypt/encrypt, CRC32C checksum, MAIN.GST/TROPHY.DAT/COMMON.CFG/MST field maps; SAVE_FORMAT_NOTES.md documents the format with Ghidra findings.
    Tested on: Source read only (not run in this session) · checked 2026-10-17; last activity 2026-10-03; Note: the latest release ships binaries; the wiki links only the source, never the binaries