DISE for Riptide: Things that do not work well yet: weapon proficiency skills, maps, and possibly more.

Live chat: Sorry, I don't have the capacity to answer everyone timely at the moment. Please send e-mail instead.

If DISE is stuck trying to update, run this command in Command Prompt.

Thursday, May 17, 2012

This is how I study game-saves

I'll try to roughly explain the whole process of understanding game-saves' file structure without getting into great detail, and without making this post very lengthy. This may apply for any file, assuming you have the right tools for the job. This is my own way but there aren't that many different ways to do it. :)

Looking at the file with a hex editor
The first thing I do is open the save in a hex editor. I would say his is a must-have tool for any hacker. Believe it or not, I often open files in a hex editor to peek, just for fun :)

After loading the save, save_0.sav, the data looks garbled; totally unrecognizable!

Lucky me, someone had already figured out that the file was simply GZipped (you may know file names ending with .zip, .rar and .7z; this is .gzip). After unpacking the file (with 7-Zip, WinRAR or something else), it looks much better!

At this point, I'm not really looking for anything specific; just looking around for anything that makes sense. Just by doing this, one can get an idea about how some parts works.

You can for example search for the amount of money you have or the character's level. If you get multiple of results, you can change values and see how it affects the game. If you get lots of results, earn or lose money in-game and search again, then compare the saves. A hex editor can compare them and show you the differences. When you know where that value is stored, it will be possible to make a very simple save editor that changes e.g. your money.

Doing it this way also means that you can't really add or remove anything from the save without corrupting it, unless you fix other things like values keeping track of how long an item's name is, the size of the player state data, etc.

Since DISE doesn't do it this way, it can do so much more!

Analyzing the game while it's running, in a debugger
The next thing I do is to study the game under a debugger on the PC, and checking exactly how the game reads the saves. If you're not familiar with debugging, here's a page on Wikipedia. Had the game been released only for game consoles, debugging would unfortunately not have been an option.

In this screenshot, I've set a few breakpoints where the game reads inventory items. There was actually a lot of pre-work before I even knew that the game read items here. I won't go too much into that but it's tedious work. :)

This is of course just a small portion of all the reads in the file.

Writing the code
After I know how the game reads a part of the file, I write my code to do the same thing.

Of course, there's way more behind this code. Most of the code is just processing the data, and all that is something I have to figure out on my own by experimenting and studying the game's internal files (Inventory.scr, for example). If I'm lucky, some of you may give me tips as well. :)

While I'm at it, why don't I just show you how the attributes are processed as well..

In the above code, item->LoadAttributes() is defined like this...

It basically processes the raw attributes value into something more meaningful.

You can see Color and RequiredLevel here, which are extracted from the raw attributes value. For now, those two are the only values I can really make sense of right now.

In the next piece of code, you can see that there are lots of reads I have yet to figure out.

Final words
I explained my own process for understanding game-saves for Dead Island, and how the game reads inventory items. I won't say it's the best method, but it has helped me understand how it works. I didn't explain how to reach the point where inventory items are read, but that would make this post quite lengthy. I also didn't show you exactly how DISE modifies values, but it's just a matter of reversing the read process to make it write the values instead.

I hope you enjoyed the read, and I hope you liked seeing my code. :)


  1. Are you using Sublime Text Editor ? =)

    1. Hello! :)

      It sounds familiar but I don't use it. :)
      I use Visual Studio 2010 with a color scheme (can't remember exactly which one). :)