Have a corrupted save? Want to fix or, better yet, prevent it? How about just an automatic way to backup your save as you play?
CORRUPTION PREVENTION
Do all the following steps and live a full, Dredmor life… at least until you portal yourself smack dab into a monster zoo juiced up on acid drink.
- Disable Steam Cloud.
- Right click the game in your Steam library
- Click “Properties”
- Click the “Updates” tab
- Uncheck the box at the bottom that says “Enable Steam Cloud synchronization for Dungeons of Dredmor”
- DO NOT add/remove mods to an existing save. Ever. Always start fresh if you change anything mod-related. I don’t care what so-and-so told you, it’s not worth the risk.
- As soon as you make a new character save and backup the copied mod files. If a save gets corrupted, the majority of the time it’s actually because the save-specific copy of the mod files broke. Replacing the broken ones with a backup will fix it without rolling back your actual save data.If you’re using the auto backup script at the bottom of this guide you can do the “first backup of a session” (aka a “full” backup) after saving your new character to have this process done for you… just make sure you do it ASAP so that you have a working copy of the mod files right away.
To do it manually:
- Go into your save folder (on windows it is at “C:\Users\<yourusername>\Documents\Gaslamp Games\Dungeons of Dredmor\<yourcharactername>.dredmorsave”)
- Make a backup somewhere else of all the “mod<numberhere>.dat” files
- Make frequent backups of the entire “C:\Users\<yourusername>\Documents\Gaslamp Games\Dungeons of Dredmor\” folder, or at the very least your specific character’s subfolder.
Again, I HIGHLY recommend using the auto backup script at the bottom of this guide.
ALREADY CORRUPTED?
There is a chance you can fix a corrupted save even if you don’t have “mod<numberhere>.dat” backups. It may seem convoluted, but it’s easy to do. NOTE: this assumes you’re subscribed to (and have enabled/disabled) the same mods now as you do with the save you’re trying to fix. If not you’ll have to do some extra sleuthing, but this should give you the general idea of what to do.
First things first: go to your save location at “C:\Users\<yourusername>\Documents\Gaslamp Games\Dungeons of Dredmor\<yourcharactername>.dredmorsave”. Inside that folder you need to check if any of the “mod<numberhere>.dat” files are 0 bytes in size, or really anything less than 1 KB.
If so…
- Make a note of the number of the file (i.e. the number in “mod<numberhere>.dat”)
- Open Dungeons of Dredmor and go into the “Mods” menu. From the top of the mod list (going downwards), start counting from zero (NOT one!) until you reach the number you took note of
- Look up that mod on the Steam Workshop to get the ID number at the end of the Workshop page URL (i.e. https://steamcommunity.com/sharedfiles/filedetails/?id=<numberhere> ). It’s easiest if you have the Steam URL bar enabled (in Steam go to View->Settings->Interface and check “Display Steam URL adress bar when available”)
- Go into your “C:\Users\<yourusername>\Documents\Gaslamp Games\Dungeons of Dredmor\steam_workshop\subscribed\” folder, and look for the .dat file inside that corresponds to the mod in question. The first part of the name will be the Workshop ID (i.e. “<idishere>-<anotherlongnumber>.dat”… you should be looking at the “idishere” part).
- Copy that .dat file and paste it inside your save folder (the same spot as your 0 byte “mod<numberhere>.dat” file)
- Rename the .dat you just pasted to match the empty “mod<numberhere>.dat” file. You’ll have to move or delete the 0 byte file first, naturally
If you did it right you have now replaced the corrupted mod file with a fresh copy and your save should work!
If you DIDN’T find any 0 byte “mod<numberhere>.dat” files…
- If you got a specific error relating to which mod is impacted follow the same general steps to investigate which mod file to replace.
- If no error or if that didn’t fix it you can try opening each “mod<numberhere>.dat” file with 7zip (those .dat files are just renamed .zip files) until you find the one that doesn’t work. Corrupted zips will usually show an error in 7zip.
- If even after that nothing seems obvious, you’ll need to go through each mod one by one OR create a brand new save with the same mod selections and copy over the fresh mod .dat files to the old save.
- If THAT doesn’t work, you may have a truly corrupted save (opposed to corrupted mod files). In that case a backup is likely your only solution… if only there was some kind of easy, automatic script to do it for you. Hmm…
AUTOMATIC BACKUPS?!
So you got everything all setup to keep your saves safe, but you’re sick of doing it manually, right? Well here’s a quick-and-dirty solution for you. Below is a script you can (and should) run while playing the game that will automatically backup your saves every X minutes.
On the first run of each session it will immediately backup everything in the overall save folder. That includes every copy of mods! After that (i.e. subsequent backups while playing that same session) it will only backup the save files themselves. Why? Well, there’s no reason to constantly backup the mod copies as they don’t change.
I highly recommend keeping known-working versions of the “full” backups around as they will contain what you need should your mod files corrupt. The minimal backups are purely for if the actual save file(s) get corrupted or lost.
- Download and install 7-zip if you don’t already have it. https://www.7-zip.org/ This is what will be bundling up the save folder.
- Copy the code below into a text document. I suggest using something like Notepad++ https://notepad-plus-plus.org/
- Change the following variables at the top of the script to meet your needs (see the code for an example of how it should look).
- ZIPLOCATION = the full location of your 7zip executable. Leaving this as default is probably fine if you have a standard setup and chose to install the 64bit version.
- ZIPQUALITY = the level of compression to use. The value can be 0,1,3,5,7, or 9. 0 = store (ie no compression), 5 = normal, 9 = ultra, etc. Whatever your computer can handle without lagging the game will be fine. The minimal saves are very, very small, so 0 is what I’d recommend.
- FOLDERTOBACKUP = the full location of the folder to actually backup. In this case you will want to use the “\Gaslamp Games\Dungeons of Dredmor\” folder in your My Documents.
- TIMER = How often to make a backup while the script is running, in minutes. Default is every 15 minutes.
- Save the file as “<whateveryouwant>.bat” The important part is the “.bat” extension.
- Run by double clicking it. A command prompt will open up, an initial “full” backup will occur, then the timer for subsequent “minimal” backups will start running.
@SETLOCAL ENABLEDELAYEDEXPANSION @ECHO OFF:: —- STUFF YOU NEED TO CHANGE FOR YOUR SETUP —–
set “ZIPLOCATION=C:\Program Files\7-Zip\7z.exe”
set “ZIPQUALITY=0”
set “FOLDERTOBACKUP=C:\Users\yourusernamehere\Documents\Gaslamp Games\Dungeons of Dredmor\”
set “TIMER=15”
:: —- ————————————— —–:: —— DO NOT CHANGE ANYTHING BELOW UNLESS ——
:: —– YOU KNOW WHAT YOU’RE DOING, SERIOUSLY! —-set “FIRSTTIME=TRUE”
:: start it up!
goto :DoTimer:DoBackup
:: get the time
for /F “skip=1 tokens=1-6” %%A IN (‘WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table’) do (
if not “%%~F”==”” (
set /A SortDate = 10000 * %%F + 100 * %%D + %%A
set YEAR=!SortDate:~0,4!
set MON=!SortDate:~4,2!
set DAY=!SortDate:~6,2!
set /A SortTime = 1000000 + 10000 * %%B + 100 * %%C + %%E
set HOUR=!SortTime:~1,2!
set MIN=!SortTime:~3,2!
set SEC=!SortTime:~5,2!
)
)if !FIRSTTIME!==TRUE (
set “TEMPFILENAME=!YEAR!!MON!!DAY!-!HOUR!!MIN!!SEC!-IncludesModData.7z”
“!ZIPLOCATION!” a -mx!ZIPQUALITY! “!TEMPFILENAME!” “!FOLDERTOBACKUP!”
set “FIRSTTIME=FALSE”
) else (
set “TEMPFILENAME=!YEAR!!MON!!DAY!-!HOUR!!MIN!!SEC!.7z”
“!ZIPLOCATION!” a -mx!ZIPQUALITY! “!TEMPFILENAME!” “!FOLDERTOBACKUP!” -xr^^!steam_workshop -xr^^!mods -xr^^!mod*.dat
)
echo.
echo ——————————-
echo Backup made: !TEMPFILENAME!
echo ——————————-
echo.
echo ####################################################
echo ############ Minimal backup starting… ############
echo ####################################################
goto :DoTimer
exit /B:DoTimer
:: repeat on a loop, in seconds
if !FIRSTTIME!==TRUE (
echo ####################################################
echo ############ DOING FULL BACKUP FIRST… ############
echo ####################################################
) else (
echo Starting timer…
set /A “temptimeout=!TIMER! * 60”
timeout /t !temptimeout!
)
goto :DoBackup
exit /B
By SB