Save game editing

General discussion about the game.
arhimmel
Posts: 9
Joined: Mon Sep 17, 2012 11:25 pm

Re: Save game editing

Postby arhimmel » Mon Sep 17, 2012 11:43 pm

ChickenBandit wrote:
arhimmel wrote:I have started working on an editor, well right now all it does is read some values from the sav files.

Code: Select all

07 00 00 00 56 69 6E 63 65 6E 74


this is from the first information about the crew. the first 4 bytes are the length of the string that follows, which is the name of a crew member. all of the info stated like that. with the length of the field and then the field. before first crew member there is another number which is the number of crew member.

figuring out what each little area of code is a bit more hard because so little of it is actually legible.

ps. I wouldn't worry about the offsets as they change if have a different length field that precedes it.


So then is the 64 00 00 00 in front of all of the positional data the length of the positional data value that follows?


it should be. i think there is only one time when i found this not to be true but im not sure why, im investigating it. once i get a more complete picture of the data structure of the sav file ill share the code. all of the data is encoded in little-endian and the lengths are longs.

so far i can only read the crew memeber information. so what i said might change.
ChickenBandit
Posts: 15
Joined: Mon Sep 17, 2012 4:40 pm

Re: Save game editing

Postby ChickenBandit » Mon Sep 17, 2012 11:50 pm

arhimmel wrote:
ChickenBandit wrote:
arhimmel wrote:I have started working on an editor, well right now all it does is read some values from the sav files.

Code: Select all

07 00 00 00 56 69 6E 63 65 6E 74


this is from the first information about the crew. the first 4 bytes are the length of the string that follows, which is the name of a crew member. all of the info stated like that. with the length of the field and then the field. before first crew member there is another number which is the number of crew member.

figuring out what each little area of code is a bit more hard because so little of it is actually legible.

ps. I wouldn't worry about the offsets as they change if have a different length field that precedes it.


So then is the 64 00 00 00 in front of all of the positional data the length of the positional data value that follows?


it should be. i think there is only one time when i found this not to be true but im not sure why, im investigating it. once i get a more complete picture of the data structure of the sav file ill share the code. all of the data is encoded in little-endian and the lengths are longs.

so far i can only read the crew memeber information. so what i said might change.


I'll keep you up to date on what I find as well. I can change crew members' locations now without issue, but I tried adding an extra crew member and it just hangs when I click continue. I made changes everywhere I thought I would need to, but didn't seem to work.
swixel
Posts: 80
Joined: Mon Sep 17, 2012 6:08 am

Re: Save game editing

Postby swixel » Mon Sep 17, 2012 11:54 pm

I haven't started on crew stuff ... I'm sequentially pushing through it. So far there isn't much of interest to report. Anyway, longs? The profile.sav file was all 32bit integers (including the booleans, ugh). I'll see what I can dig up of worth to post here now that I've got my desktop access again.

To be clear, we're all talking about continue.sav, right?
ChickenBandit
Posts: 15
Joined: Mon Sep 17, 2012 4:40 pm

Re: Save game editing

Postby ChickenBandit » Mon Sep 17, 2012 11:58 pm

swixel wrote:I haven't started on crew stuff ... I'm sequentially pushing through it. So far there isn't much of interest to report. Anyway, longs? The profile.sav file was all 32bit integers (including the booleans, ugh). I'll see what I can dig up of worth to post here now that I've got my desktop access again.

To be clear, we're all talking about continue.sav, right?


Yes.

Also, I found door states! They're in between the final crew member and the series of FF FF FF FF over and over. I'll let you know exactly what I find.

EDIT: False alarm. For some reason, the very first action you take on your ship alters a bunch of stuff in the save.
raskolnik
Posts: 13
Joined: Sun Sep 16, 2012 8:28 pm

Re: Save game editing

Postby raskolnik » Tue Sep 18, 2012 12:08 am

ChickenBandit wrote:
EDIT: False alarm. For some reason, the very first action you take on your ship alters a bunch of stuff in the save.


I'm not surprised. I know little about all this, but even I could tell there was something weird happening, given the differences between two save games with the same ship in the very first system. For one thing, there's bound to be data that isn't user-facing, and who knows when things like the sector map are generated?
ChickenBandit
Posts: 15
Joined: Mon Sep 17, 2012 4:40 pm

Re: Save game editing

Postby ChickenBandit » Tue Sep 18, 2012 12:11 am

raskolnik wrote:
ChickenBandit wrote:
EDIT: False alarm. For some reason, the very first action you take on your ship alters a bunch of stuff in the save.


I'm not surprised. I know little about all this, but even I could tell there was something weird happening, given the differences between two save games with the same ship in the very first system. For one thing, there's bound to be data that isn't user-facing, and who knows when things like the sector map are generated?


Oddly enough, the moment you take your first action (i.e. moving a crew member or opening a door) it stays consistent from then on (or at least it seems so). That said, I couldn't find any difference in my two save files where one had a door open and the other didn't. I'll check again.
swixel
Posts: 80
Joined: Mon Sep 17, 2012 6:08 am

Re: Save game editing

Postby swixel » Tue Sep 18, 2012 12:13 am

ChickenBandit wrote:Oddly enough, the moment you take your first action (i.e. moving a crew member or opening a door) it stays consistent from then on (or at least it seems so). That said, I couldn't find any difference in my two save files where one had a door open and the other didn't. I'll check again.


It's achievement related information. Precisely what, I don't know yet.
arhimmel
Posts: 9
Joined: Mon Sep 17, 2012 11:25 pm

Re: Save game editing

Postby arhimmel » Tue Sep 18, 2012 12:14 am

swixel wrote:I haven't started on crew stuff ... I'm sequentially pushing through it. So far there isn't much of interest to report. Anyway, longs? The profile.sav file was all 32bit integers (including the booleans, ugh). I'll see what I can dig up of worth to post here now that I've got my desktop access again.

To be clear, we're all talking about continue.sav, right?


32 bit integers are longs. they are "long" bc integers used to be 16 bit. of course things have changed.

ive done a bit more digging and there is a stats area that is between the two times the ship name and type appear. this messed up my program but im working on fixing it right now.

https://github.com/arhimmel/FTLGameEditor

ill update the code once it works.
ChickenBandit
Posts: 15
Joined: Mon Sep 17, 2012 4:40 pm

Re: Save game editing

Postby ChickenBandit » Tue Sep 18, 2012 12:17 am

ChickenBandit wrote:
raskolnik wrote:
ChickenBandit wrote:
EDIT: False alarm. For some reason, the very first action you take on your ship alters a bunch of stuff in the save.


I'm not surprised. I know little about all this, but even I could tell there was something weird happening, given the differences between two save games with the same ship in the very first system. For one thing, there's bound to be data that isn't user-facing, and who knows when things like the sector map are generated?


Oddly enough, the moment you take your first action (i.e. moving a crew member or opening a door) it stays consistent from then on (or at least it seems so). That said, I couldn't find any difference in my two save files where one had a door open and the other didn't. I'll check again.


Ok, I actually did find the door status info this time. It's just a little bit after the FF FF FF FF segment. I'll be analyzing it now for real this time.

BTW, I would recommend Notepad+ +, there's a Hex editor plugin and a comparison plugin, which is how I was able to find the difference.
swixel
Posts: 80
Joined: Mon Sep 17, 2012 6:08 am

Re: Save game editing

Postby swixel » Tue Sep 18, 2012 12:20 am

arhimmel wrote:32 bit integers are longs. they are "long" bc integers used to be 16 bit. of course things have changed.


Oh, right. I was calibrating around words (32bits), assuming you meant a 64bit (too much modern C++ work where 'long' indicates 64bit for me now).. I haven't/don't tend to use 16bit-based syntax and just work around words, so my bad. I'm also working on this in C# to get some practice in it (adding to my confusion, an 'int' is 32 bits here too :P). Haven't looked into your code yet, but will release my C# stuff once I'm done getting the structure variant flags out of the way so we can at least pull data in a sane way.

I think I've identified types if nothing else ...



And I'm using Sublime Text 2, but it's commercial.