Save game editing

General discussion about the game.
swixel
Posts: 80
Joined: Mon Sep 17, 2012 6:08 am

Re: Save game editing

Postby swixel » Tue Sep 18, 2012 9:46 am

Jessen wrote:using whats made, i can determin the experience levels for the skills of your crew, but i'm not quite sure on it myself...it may be that the numbers are in different places depending on the race of the crew member, but i'm not 100% sure.


What? No, it's the same. You get an initial stat-bound interface for the crew, then later you get the data. (Removed C# after I found a bug -- possibly unrelated given the fixed size of data, but I broke something when I started inline-parsing DAT files.)

The tricky part comes after this. I'm also near done narrowing down what that unknown it.
Frodyne
Posts: 4
Joined: Mon Sep 17, 2012 11:11 pm

Re: Save game editing

Postby Frodyne » Tue Sep 18, 2012 12:52 pm

Again on the crew section, a bit of an update here:
Frodyne wrote:

Code: Select all

Int32   X coordinate
Int32   Y coordinate
Int32   Room
Int32   Room tile (0-3)

Note how, when you tell a guy to move a small green circle pops up where he has to go? Well, this is that.

The X and Y coordinates is where the guy is right now. While the room and tile stuff is where the green circle is, so if this does not match your guy will be walking when you load the save.
Be careful with it though, I don't know exactly what I messed up, but I wound up with one guy who just stood there unable to be clicked, and even if I selected him in the name list he still would not react to commands. On the other hand, I was able to make a save with a guy walking through my craft, then I changed his green-dot-destination in the save, and when I loaded he moved to the updated location instead with no problems.
Frodyne
Posts: 4
Joined: Mon Sep 17, 2012 11:11 pm

Re: Save game editing

Postby Frodyne » Tue Sep 18, 2012 1:19 pm

swixel wrote:
Frodyne wrote:

Code: Select all

Int32   0000 0000 ? - No idea what this does
Int32   Health
Int32   X coordinate
Int32   Y coordinate
Int32   Room
Int32   Room tile (0-3)
Int32   0100 0000 ? - No idea what this does


The first unknown here is "Is it a drone?" (1 = true)

The second appears to be either a null pointer (its memory address appears to becomes one), or something to do with animations. Given the version check at the top, I'd say set it to one and assume it's one. If it's not one, store it and use it.

Thanks for figuring the first one out. :)

I had an idea that maybe it had something to do with porting to enemy ships, but after buying a teleporter and jumping on a mantis ship I realised a few things:
1) You cannot save while in combat.
2) You can save after combat, with the other ship still there and your guys on it. However, Instead of setting some flags on your guys instead they just dissapear from your ship, and then at the bottom of the save a second ship section pops up with the enemy ship, and your guys then appear on the crew list there.
Actually, now that I think about it perhaps you guys trying to figure out ship layout and stuff can use that?

And now, just for fun, I tried to change that second mystery one to 0, and lo and behold when I loaded the game it went right into "Intruder detected", and my (former) crew member had turned hostile. Amusingly enough the game also refused to save again until he was dead.
In any case, that second one appears to be the friend (1) or foe (0) indicator.
swixel
Posts: 80
Joined: Mon Sep 17, 2012 6:08 am

Re: Save game editing

Postby swixel » Tue Sep 18, 2012 7:49 pm

Frodyne wrote:And now, just for fun, I tried to change that second mystery one to 0, and lo and behold when I loaded the game it went right into "Intruder detected", and my (former) crew member had turned hostile. Amusingly enough the game also refused to save again until he was dead.
In any case, that second one appears to be the friend (1) or foe (0) indicator.


Ah, nice. Even though we can't save, it's there for some reason. The memory address is used by the game for a pointer, which is the source of my confusion, but since it's always zero it would've been null. Instead it's yet another 4-byte binary check for intrusion o.O

The hard part will be live-parsing the data to check it's functional. Which means (since I haven't found a registry key on Windows) that the test tool I'm using now needs to sit in the directory (yay). The long and short of this problem stems from the room count and door count depending on the blueprint (i.e. text file, e.g. "kestral.txt"). Though this may also enable modders to create a new "save" (i.e. a "continue") from the first sector with an entirely custom ship, without replacing the existing ones ... though it's a bit impractical to have to dump a save into place to use it.
androx87
Posts: 1
Joined: Wed Sep 19, 2012 3:15 am

Re: Save game editing

Postby androx87 » Wed Sep 19, 2012 3:20 am

arhimmel wrote:
ChickenBandit wrote:
Scratch wrote:Very nice work.

Anyone found the data for resources?


As in fuel, missiles, scrap, etc.? Nope, going to get to that one eventually though.


yeah i found them. they are right before the listing of all the crew members and theirs skills.


thye appear in the following order

Code: Select all

Int32 HP
Int32 Fuel
Int32 Drone Parts
Int32 Missiles
Int32 Spare Parts


Just wanted to say thanks for all the work you guys have put into this. Using this, I was able to give myself 99 Fuel and get myself out of a tricky situation. I also gave myself 255 scrap and pimped out my reactor.
Jessen
Posts: 14
Joined: Sat Sep 15, 2012 2:30 am

Re: Save game editing

Postby Jessen » Thu Sep 20, 2012 8:23 pm

huh...very interesting, i just managed to edit the prof.sav myself, and changed one achievement i had unlocked on the stealth ship, to another.
swixel
Posts: 80
Joined: Mon Sep 17, 2012 6:08 am

Re: Save game editing

Postby swixel » Thu Sep 20, 2012 8:41 pm

Jessen wrote:huh...very interesting, i just managed to edit the prof.sav myself, and changed one achievement i had unlocked on the stealth ship, to another.


Mmm? We're talking about continue.sav in here. I already put the full specification of prof.sav on the wiki if you wanted more information on that.
wolfling
Posts: 2
Joined: Sat Sep 22, 2012 4:22 am

Re: Save game editing

Postby wolfling » Sat Sep 22, 2012 4:42 am

I've put twelve save games into a zip file... that I made progressively in one play through. Sorry that I don't have the attention span to actually document each save, but I am using my excuse of "having ADD".

Anyhow, they are all pretty linear so you should be able to continue each and see a trend as the save info changes from levelling up and stuff.

I tried to edit number 12 in notepad and change LASER_BURST_3 to LASER_BURST_4 and it crashed. I haven't tried anything else; when that didn't work I came straight here.

I hope this helps.

http://wolfling.info/ftlsaves.zip is the location of the save files.
Frodyne
Posts: 4
Joined: Mon Sep 17, 2012 11:11 pm

Re: Save game editing

Postby Frodyne » Sat Sep 22, 2012 2:01 pm

wolfling wrote:I tried to edit number 12 in notepad and change LASER_BURST_3 to LASER_BURST_4 and it crashed. I haven't tried anything else; when that didn't work I came straight here.

Don't edit binary files in notepad (or any other straight text editor), it does not play well with binary files.

An ASCII text file (what notepad was made to edit) is a binary file with a specific interpretation filter on top - for example, reading the byte value 77 is interpreted as "M" and 109 is "m". But it also contains a bunch of non-character or control codes, such as 8 (backspace) or 11 (tab).
Specifically, what goes wrong here (or at least when I test with notepad on my computer) is that it reads a file which is full of 0's, interprets them as spaces, and then saves them again using the space control code (32). Since the game saves its numbers as 32 bit integers (4 bytes long), this means that if the game saved the value "1" as "01 00 00 00", then this has now been changed to "01 20 20 20" (32 in hexdecimal is 20), and the value of the resulting integer has jumped to 538976257 - which is a bit far from the intended 1.

If you want to play around with editing files like this, then get a proper hex editor - that link should have a few suggestions.


... Also, there is no LASER_BURST_4 in the game :) , though putting it in your save does not crash the game - you just get a blank dummy weapon. There are:
LASER_BURST_1 = Defense Laser Mark I
LASER_BURST_2 = Dual Shot Laser
LASER_BURST_2_A = Burst Laser Mark I
LASER_BURST_3 = Burst Laser Mark II
LASER_BURST_5 =Burst Laser Mark III
wolfling
Posts: 2
Joined: Sat Sep 22, 2012 4:22 am

Re: Save game editing

Postby wolfling » Sat Sep 22, 2012 3:36 pm

Frodyne wrote:
wolfling wrote:

Don't edit binary files in notepad (or any other straight text editor), it does not play well with binary files.

Yeah, I know, I just didn't have an editor installed at the time and had to go to work within the hour. I used to have a hex editor for messing with games like Battle Isle, XCom and AD&D games, but that was on my old PC. I've installed one now... so here goes the fun.

Well, later today; it's now 1:37am here.