dmsave.dat File format

Discuss anything about the original Dungeon Master on any of the original platforms (Amiga, Atari, etc.).
This forum may contain spoilers.

Moderator: Ameena

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
zosodk69
Novice
Posts: 13
Joined: Wed May 11, 2005 8:50 pm
Location: Michigan, US

dmsave.dat File format

Post by zosodk69 »

The reason for this endeavor is I'm making my way through the PC version of DM, but when I'm done, I would like to use my party in CSB under Amiga emulation. There seems to be no tool to do this so I thought I'd see if I could extract my character's stats from the dmsave.dat and recreate them in a CSB saved game. To do this, I have been making minor changes to my character's stats (in DMute), and doing a binary compare on the two files.

My problem is that the changes seem to be all over the place. For example; changing my first character's max health from 247 to 248 causes three bytes in three different locations of dmsave.dat to change:

Code: Select all

[dave@zeppelin dm]$> cmp -l DMSAVE.DAT.orig DMSAVE.DAT
  255  60  50
  347 321 331
 2455  14   3
It seems the programmers at FTL have implemented some sort of trickery to thwart cheaters. My quest for answers has led me to this board where I hope to be enlightened by one of you DM hackers. :D
-=[dave]=-
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

There's a checksum at the end (not sure if that's the 2455 line though) but the third one is a mystery
User avatar
ChristopheF
Encyclopedist
Posts: 1544
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Post by ChristopheF »

As far as I know, saved games are scrambled and each particular file uses a different scramble key.
You can find all the algorithms required to read the saved games in the source code of CSBuild.

So reading your champion stats will not be as easy as comparing two files in a hex editor...
zosodk69
Novice
Posts: 13
Joined: Wed May 11, 2005 8:50 pm
Location: Michigan, US

Post by zosodk69 »

Looking through the code... Good stuff. This won't be as straight forward as I thought but I will certainly be able to find what I'm looking for.

Chris, would you be interested in an analysis for the Technical Documentation section of your site?
(no promises, I may not continue to be this inspired)
-=[dave]=-
User avatar
ChristopheF
Encyclopedist
Posts: 1544
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Post by ChristopheF »

Of course I would be interested by more documentation.
Documenting the save game file format has been on my todo list for a very long time!
zosodk69
Novice
Posts: 13
Joined: Wed May 11, 2005 8:50 pm
Location: Michigan, US

Character editor started

Post by zosodk69 »

OK. This doesn't seem so hard. Paul Stevens has done all the hard work. It is actually remarkably easy to move around a DM/CSB save game (just not in a hex editor), especially if you only need character stats.

Using the CSBuild code as a guide, I've decided to write a character editor for DM and CSB. The finished product will hopefully be compatible with all versions all DM/CSB (PC, Atari, Amiga, etc). I'm writing the code in Qt to make it as portable as possible (and it's the only GUI API that I know how to use).

I started this project because I wanted to move my characters from DM on the PC to CSB on the Amiga. I want to be able to import/export characters to/from delimited XML files. A screenshot of what I've done so far is available here:
http://thekilempire.com/dmcharedit/dmcharedit02.png
Currently the program only loads PC DMSAVE.DAT files but I've just begun working on it. I'll post back here when I've got something useful to download.
-=[dave]=-
User avatar
greatstone
The data extractor
Posts: 57
Joined: Fri Feb 18, 2005 2:16 am
Location: Grenoble, France
Contact:

Post by greatstone »

Very good news! People trying to understand the internal DM/CSB resources are not all dead!
In fact, I think that Christophe has tried to understand all the existing save formats but one is missing on the Amiga (DM or CSB, don't remember): it doesn't seem to be encoded as the other ones.
So, joining your effort on this task could be interesting for all of us (particulary for people writing DM/CSB resources extractor...) in order to fully understand all possible formats.
And I will be happy to have a look at the source code or a format specification.
zosodk69
Novice
Posts: 13
Joined: Wed May 11, 2005 8:50 pm
Location: Michigan, US

Post by zosodk69 »

I think that Christophe has tried to understand all the existing save formats but one is missing on the Amiga (DM or CSB, don't remember): it doesn't seem to be encoded as the other ones.
Could someone verify this? I've been operating under the assumption that CSBuild can read every save file version, and that the only differences are:
  • 1. slight differences in hash offsets in the first block for the PC
    2. some big endian variants are compressed
-=[dave]=-
User avatar
ChristopheF
Encyclopedist
Posts: 1544
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Post by ChristopheF »

My experiments showed that all saved games files from all versions of DM and CSB share similar formats but with several slight variations. CSBuild is not currently able to open them all.

However, I noticed that the files mini.dat from CSB for Amiga and CSB for X68000 found on the utility disks do not use exactly the same file format: I am unable to decode this file. I can read a save game file made with CSB for Amiga while playing, but not the initial MINI.DAT.
Mini.dat files from other versions (Atari ST, PC-98, FM-Towns) can be decoded 'normally' like other saved game files.

Also, in DM for Apple IIGS saved games, I cannot decode all sections correctly, only some of them.

I'll publish soon the information I have gathered so far about the saved game file format.

Anyone has any info regarding the decoding of mini.dat from CSB for Amiga and X68000, and the saved games from DM Apple IIGS ?
zosodk69
Novice
Posts: 13
Joined: Wed May 11, 2005 8:50 pm
Location: Michigan, US

Post by zosodk69 »

I know I said I'd post again when I had something useful to download; I lied.

Anyway, I should be able to release some code very soon. I'm kind of excited though because I've actually been able to write data back out to a DMSAVE.DAT that DM will read (PC version):
http://thekilempire.com/dmcharedit/dmcharedit03.png

Once I create some validators for user input and an experience dialog I'll release version 0.1.
-=[dave]=-
zosodk69
Novice
Posts: 13
Joined: Wed May 11, 2005 8:50 pm
Location: Michigan, US

Post by zosodk69 »

I'm releasing v0.1 of my code:
http://www.thekilempire.com/dmcharedit/ ... _1.tar.bz2

Linux binary:
http://www.thekilempire.com/dmcharedit/ ... aredit.bz2

Anyone out there want to compile Windows binaries for me? I may have a copy of Visual Studio somewhere but it would be quite the pain in my ass to setup a Windows [virtual] machine just to compile the code.

To use the software, simply load a PC (DMSAVE.DAT) or Amiga (DMGAME.DAT) save game. You can tweak settings to your liking, then save to either a PC or Amiga save. Very crude but simple. In case you're not familiar with compiling qmake projects:

Code: Select all

qmake && make
In its current form, the program does exactly what I'd originally set out to do, which is to move my characters back and forth between PC and Amiga versions of DM. There is much in the way of functionality I'd like to add at this point:
  • Support for portraits
    Implement a dialog for editing experience levels
    Support for CSB saves
    Support for additional platforms (Atari, SNES, etc.)
    A standalone character file format to export/import individual characters to
I've only tested this program with DM for PC v3.4 and DM for Amiga v3.6. I've only tested saves with four characters. I'd be interested to know if the program works on additional save formats (different platforms, versions, etc.). Because of what little testing I've done, Backup ANY file you load into dmcharedit! I'd hate to have my programming bug hose your save-game/term-paper.
-=[dave]=-
Post Reply