Save editor

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
glyn_ie
Posts: 120
Joined: Mon Mar 05, 2012 4:19 am

Re: Save editor

Post by glyn_ie »

Drew8898 wrote:/facepalm

I literally just did this to fix an issue with Diablo 2. I can't believe I didn't think to try this first. That worked, thanks.
It's easily forgotten. No worries. ;)
sdweimer
Posts: 7
Joined: Sat Apr 21, 2012 3:40 am

Re: Save editor

Post by sdweimer »

Thanks for this, works good for me. :D
seebs
Posts: 268
Joined: Sat Apr 14, 2012 8:58 pm

Re: Save editor

Post by seebs »

Dej wrote:
I'm in the middle of tackling a bizarre number system employed by the save files
If talking about the 0x3FF0, 0x4000, 0x4008, 0x4010, etc. numbers used to identify the characters, to index the items in the inventory and in fact for most of numerical values in the game (such as strength, vitality, dexterity,...) they are in fact standard 64-bit floating-point values, in little-endian format (as seems to be the cardinal rule for all integer/fp values in the file.)

Those made me scratch my head for a while! :)

Hope this helps.
This is because Lua does all math in 64-bit floats, and x86 is little-endian.
User avatar
zeltak
Posts: 119
Joined: Fri May 04, 2012 2:33 am

Re: Save editor

Post by zeltak »

I've encountered the following. While trying to edit one of my save games, the editor informs the following: "This data is missing one or more headers. Please reload the save."
This happens on every save for that party. And even if I don't edit anything, just opening and closing the save data is enough. While checking on the editor I noticed that everything below the last character's information is scrambled. After the last character's rune header there is the following:
Header =CIMG
Double =1
Double =2470327646
Double =128
Double =128
String =KF"ÿOJ#ÿNI#ÿOI...
And that string thing is long..

I'm using two imported custom portraits on that party, does it matter?
User avatar
glyn_ie
Posts: 120
Joined: Mon Mar 05, 2012 4:19 am

Re: Save editor

Post by glyn_ie »

zeltak wrote:I've encountered the following. While trying to edit one of my save games, the editor informs the following: "This data is missing one or more headers. Please reload the save."
This happens on every save for that party. And even if I don't edit anything, just opening and closing the save data is enough. While checking on the editor I noticed that everything below the last character's information is scrambled. After the last character's rune header there is the following:
Header =CIMG
Double =1
Double =2470327646
Double =128
Double =128
String =KF"ÿOJ#ÿNI#ÿOI...
And that string thing is long..

I'm using two imported custom portraits on that party, does it matter?
Interesting. Email the save files (before you edit them). I'll PM you my address and report back here.
User avatar
glyn_ie
Posts: 120
Joined: Mon Mar 05, 2012 4:19 am

Re: Save editor

Post by glyn_ie »

Thanks for your email. I checked the save file which you sent me.

Basically, what you've got there is a very unusual save. It's something I've not encountered before. This is how a normal save is structured (after it's been decompressed):

DESC/[DESC Length]/[DESC Data]
OPTS/[OPTS Length]/[OPTS Data]
CHAR/[CHAR Length]/[CHAR Data] (Contains multiple headers/nested headers)
CHAR/[CHAR Length]/[CHAR Data] (Contains multiple headers/nested headers)
CHAR/[CHAR Length]/[CHAR Data] (Contains multiple headers/nested headers)
CHAR/[CHAR Length]/[CHAR Data] (Contains multiple headers/nested headers)
PRTY/[PRTY Length]/[PRTY Data] (Contains multiple headers)
- Dungeon Data follows -
[HEADER]/[HEADER Length]/[HEADER Data] (Sometimes contains multiple headers/nested headers)
[HEADER]/[HEADER Length]/[HEADER Data] (Sometimes contains multiple headers/nested headers)
...until end of file.

That save file you sent me looks like this:

DESC/[DESC Length]/[DESC Data]
OPTS/[OPTS Length]/[OPTS Data]
CHAR/[CHAR Length]/[CHAR Data] (Contains multiple headers/nested headers)
CHAR/[CHAR Length]/[CHAR Data] (Contains multiple headers/nested headers)
CHAR/[CHAR Length]/[CHAR Data] (Contains multiple headers/nested headers)
CHAR/[CHAR Length]/[CHAR Data] (Contains multiple headers/nested headers)
CIMG/[CIMG Length (Unexpected value)]/[CIMG Data (Partial)] (Ends with a STRING which length's variable overlaps the new data - allowing some of it to be scanned)
[Unrecognized header-less data - 131,136 bytes of it]
PRTY/[PRTY Length]/[PRTY Data] (Contains multiple headers)
- Dungeon Data follows -
[HEADER]/[HEADER Length]/[HEADER Data] (Sometimes contains multiple headers/nested headers)
[HEADER]/[HEADER Length]/[HEADER Data] (Sometimes contains multiple headers/nested headers)
...until end of file.

This is how it looks in a hex editor, not the editor. I can confirm that the new CIMG data and onwards is definitely not part of the last CHAR section (even though the editor doesn't place the usual '- End of Section -' marker in there). The editor has actually got some flexibility when it comes to dealing with unrecognized headers but the additional data there is in a format completely inconsistent with the rest of the entire save file (it doesn't have a header or any variables informing of it's length). I'd say the save is corrupted. The reason I think it may not be is because of the presence of this header I haven't seen before (CIMG) and because the data fits perfectly before the header after it (there are other irregularities however, such as the CIMG Length value. If read as a byte, it again fits perfectly around the bizarre stream. If read as normal however (4 byte long), it reaches pretty much exactly up to the half way point of this data. It's rare for such patterns to turn out to be completely random).

Anyway, as for that additional data, I would have to consider how to manage it. Without further testing (being able to reproduce the effect) I would have to write a version of the editor for modifying this one particular save file. For now, I'd just suggest avoiding that file or reverting to an earlier one. Alternatively, you can use the save editor to decompress/re-compress the data and hex edit it yourself if you really need to (set DebugShowDump=True in the config file).

It would be interesting however to know just what exactly happened (like what was done in-game) before the save mutated into this.
User avatar
zeltak
Posts: 119
Joined: Fri May 04, 2012 2:33 am

Re: Save editor

Post by zeltak »

glyn_ie wrote:For now, I'd just suggest avoiding that file or reverting to an earlier one. It would be interesting however to know just what exactly happened (like what was done in-game) before the save mutated into this.
Every savegame for that party (that I still have) have that "mutation". Unluckily I cleaned my savegames from old saves some time ago, so I can't say if it has been from the beginning :(

As a sidenote, Gazza's editor doesn't have problem dealing with those save files, but it isn't so versatile as yours :|
User avatar
glyn_ie
Posts: 120
Joined: Mon Mar 05, 2012 4:19 am

Re: Save editor

Post by glyn_ie »

zeltak wrote:
glyn_ie wrote:For now, I'd just suggest avoiding that file or reverting to an earlier one. It would be interesting however to know just what exactly happened (like what was done in-game) before the save mutated into this.
Every savegame for that party (that I still have) have that "mutation". Unluckily I cleaned my savegames from old saves some time ago, so I can't say if it has been from the beginning :(

As a sidenote, Gazza's editor doesn't have problem dealing with those save files, but it isn't so versatile as yours :|
I'm not surprised. Gazza's editor scans for specific areas in the file, so it should always work. Mine attempts to decode the entire thing, regardless of content. Mine makes it harder to read and understand, but basically gives you the ability to edit anything (apart from the Dungeon data and sections which I've screwed up - like the bags and treasure chests :D).

Like I say, you do have the option of just decoding the data with the editor and then using a HEX editor to make your changes (I recommend Hex Workshop), but that's pretty hardcore.

It may be the case that all CIMG headers carry this information with them. If so, I can just modify the editor to put this data aside or something until it's understood a little better. But I would need more of these saves to work with and I really need to know if the pattern is consistent.

To be honest though, I think the save editor will outlive it's usefulness when the dungeon editor is released. I primarily made the editor as an experiment (to see if any secret features or places could be accessed) and to give people the ability to either make the game much harder or easier, which is pretty doable, especially with new saves. Of course, none of that will matter when you can just design your own maps and set your own rules. ;)
User avatar
zeltak
Posts: 119
Joined: Fri May 04, 2012 2:33 am

Re: Save editor

Post by zeltak »

glyn_ie wrote: To be honest though, I think the save editor will outlive it's usefulness when the dungeon editor is released. I primarily made the editor as an experiment (to see if any secret features or places could be accessed) and to give people the ability to either make the game much harder or easier, which is pretty doable, especially with new saves. Of course, none of that will matter when you can just design your own maps and set your own rules. ;)
I don't think so. For example I tried to respec one of my characters, when I realized that my mage had skill points in skill where I didn't need them (of course that's one of the charms of the game, that you have to be careful when leveling you characters). And another one was, that I've been playing with two characters and wanted to erase the other two dead bodies that kept dragging with me.. :roll: So I think the save editor have still it's uses after the map editor is released.

btw. your avatar disturbs me.. don't ever change it! Chriss Morris ftw.
zugzang
Posts: 1
Joined: Tue Jul 10, 2012 12:28 am

Re: Save editor

Post by zugzang »

I am having difficulty with adding skill points with this editor. If I directly add the skillpoints to the skill, the bonuses for those skills don't show up in the stats. If I add unused skillpoints (I add the same value to both double values below it) it says I need to level up, but there aren't any skillpoints to distribute in the skills section ingame. Effectively it tells me I need to level up my 0 available skill points. Am I doing something wrong, or is this functionality not available with this editor?
Post Reply