Cool update:
The editor can now fix game-saves using the method I explain here. :)
Cooler update:
The editor can now recover all of your (salvageable) quest progress! :)
Update 2: I tried reducing the size of the text boxes, but now they're too small. I'll make some time to make the images more clear (crop them to make them larger) soon. Please bear with it for now, but please let me know if it is hard to follow the tutorial.
Update 3: I'll try to figure out how the quest progress data works when I have time, so that you're less likely to lose all of your quest progress, or at least less likely to get stuck without being able to do any quests. I realized that even if your save works after fixing it, maybe your current location could prevent you from completing earlier quests (since your later ones were cleared). In that case, maybe simply changing your spawn point could help. Of course, I'll implement that in my editor some time as well.
If your game-save was corrupted for real (because you had too many items in your inventory, perhaps), chances are that you will lose some data, and especially your quest progress. If you want to try fixing your game-save manually, I'll attempt to explain what I have been doing. Sometimes, the result is very successful!
Note: This tutorial is now considered outdated until I update it!
You'll be able to try this by yourself with a game-save I made. In the end, you should have a working game-save (even if quest progress is lost).
If you simply want to see that the game corrupts your game-save, you can download the game-save, load the game, then quit the game (to save). You should then have the same corrupted game-save as you can also download here.
What you need
- Hex editor (I use Hex Workshop, but there are free alternatives)
- Corrupted game-save
- gzip (de)compressor (7-Zip)
Make a backup copy
You probably know this already, but please backup your game-saves as well as your corrupted one, just in case. :)
Let's get started!
The game-save is compressed with gzip, so you need to extract the file inside. If you use 7-Zip, you should be able to simply right-click the .sav file and extract it.
Now that you have your save_0 file, it's time for some hex-editing!
The hex editor
Here we have the hex editor with save_0 loaded and ready. Make sure to use Little Endian byte order (1).
Note the section size (AF 00 00 00 as hexadecimal, or 175 as decimal). If you use the hex value, you have to swap/reverse the byte order. It means that AF 00 00 00 backwards, becomes 00 00 00 AF, and you can remove the leading zeros so that you have just AF in the end.
Skip the selection, so that the caret is on the right place where we'll jump from (1). We'll jump from the current position (2). As you saw in the last step, the decimal (3) value was 175 (4). You can choose "Hex" as well and just type in "af".
We land on the next section. All of the player state data is stored here. We'll skip this section as well, so do the same as in the last step.
We are now close to the end of the file, and this is also where the problem usually resides.
If you're not on section 67, then this tutorial will unfortunately not work for you, as the player state data is also corrupted, and requires a lot more work to repair. :(
You can try to skip this section as well. If you end up on section 68, then you're lucky, and your quest progress should also be salvageable! In this case, we end up at the end of the file, so parts of the data about quests is missing. You may not even be able to jump to that offset, and your quest data is damaged in this case as well.
Section 67 stores main/side quest progress. The first uint32 value (1) in this section is the size of the (only chunk of) data in this section. The size is 385 bytes, however, the file does not have that much more data. It's gone! :(
If you skipped this section and ended up on section 68, please work with it instead of 67 from now on.
Make a new game-save
Update: I came over someone saying that you should start the game from an earlier chapter. I have no idea at the moment.
Start a new game from the same chapter as you were on (maybe it makes a difference, or maybe not), and then quit the game. We'll copy data from this new game-save, so please extract the new .sav file and open it in the hex editor. Please don't lose track of which file is the old and new one.
Fixing the corrupted game-save
Delete this section from the corrupted save (remember to work with section 68 if you have it, or even 69 if you're that lucky).
Switch to the newly made save-game and locate the same section.
Select and copy everything in the file from this point and onwards.
Switch back to your corrupted save, then paste at the end of the file. Save it and then re-compress it (name it save_0.sav, and remember to use the gzip format).
Testing
You can now try the fixed game-save in-game, and sell the items you don't need. Alternatively, you can remove items with the editor.