NEW save (import/export format) editing tools

NEW save (import/export format) editing tools

Postby dragontamer8740 » Sun Dec 09, 2018 8:37 pm

Hi. A few weeks ago I wrote a couple of C programs that convert the new style save files to and from editable form. Since it seems like no one has popped up with better tools than mine yet, I figured I'd post about them here so people might actually find them instead of just sitting hidden in plain sight on gitlab.
The new format is a much more extensive and all-encompassing system, so I guess that the performance and legibility problems were the tradeoffs we had to make.
Anyway, here we go. Not much more to say. the process is not EXTREMELY user-friendly, but it works in Windows, Mac OS X, and Linux.
https://gitlab.com/dragontamer8740/fs-c ... -converter
I made binaries for all three of those platforms on the bintray URL I linked to on gitlab.

It's not particularly easy C to wade through, but it works. Just be sure you keep the text files saved in this format. Use notepad++ or similar to edit them; don't use Windows Notepad because it doesn't handle newlines the same way as my program does.

There are also pre-built binaries of the program available on the page.

Here are a couple helper unix/linux shell scripts that show you how to use them. These will work on OS X and Linux, but not in windows. It should be relatively trivial for an inclined person to write a .bat script to do this.

decode.sh (create editable files for each save file):
Code: Select all
#! /bin/bash
mkdir -p editing
for file in FS*Save; do
  csv2ascii "$file" > "editing/""$file"
done


encode.sh (convert edited files back into the format the game understands):
Code: Select all
#! /bin/bash
cd editing
for file in FS*Save; do
  ascii2csv "$file" > "../""$file"
done


These programs I wrote work because the format inside the non-decoded files is as follows:
items are separated by spaces.
a string of text is declared as starting with the capital letter 'S'. What follows is a comma separated list of numbers which represent individual ASCII characters. 65 is lowercase a, and so on.
These strings must end in a '0', or null. That happens to be the standard way to terminate a string in C as well. Then, following the 0 is a semicolon character that indicates the end of that item. A space then follows if there is more data in the entry. Another string can then start, or a plain number can be present which indicates a raw numerical value.
That's about it, really. My tools just convert this into human-readable data and back.

There are windows programs above, but if you want those convenient scripts I wrote you'll have to write .BAT equivalents. That shouldn't be hard, but I don't have a windows computer handy to test on.

I don't have a fancy-schmantzy GUI for you, because I never used one before and I'm not about to start using one now. I didn't even know FlexEdit existed until about 20 seconds ago, but that appears to be windows-only anyway.

Demo:
Here's an example FSPossessionSave file (Note: "posession" is misspelled in the game code. SIC), before and after conversion:
before:
Code: Select all
* //4DA761E4-4441-4313-BEDE-B3A78D3DABAA// FSPossessionSave
! Table of GamePossessions (22)
S65,112,111,99,97,108,121,112,115,101,32,72,111,111,100,105,101,0; 1 0 0 0
S65,112,111,99,97,108,121,112,115,101,32,83,99,97,114,102,0; 1 0 0 0
S65,112,111,99,97,108,121,112,115,101,32,83,104,111,114,116,115,0; 1 0 0 0
S65,112,111,99,97,108,121,112,115,101,32,83,107,105,114,116,0; 1 0 0 0
S98,108,97,99,107,32,116,45,115,104,105,114,116,0; 1 0 1 0
S98,114,111,119,110,32,108,111,97,102,101,114,115,0; 1 0 1 0
S99,97,116,32,107,101,121,0; 1 0 0 0
S100,105,115,116,105,108,108,101,100,32,109,105,108,107,0; 2 0 0 0
S69,83,80,80,32,98,117,110,107,101,114,32,107,101,121,99,97,114,100,0; 1 0 0 0
S101,115,116,111,115,116,101,114,111,103,101,110,32,112,105,108,108,0; 10 0 0 0
S103,114,121,112,104,111,110,32,109,105,108,107,0; 5 0 0 0
S72,105,107,105,110,103,32,66,97,99,107,112,97,99,107,0; 1 0 1 0
S106,111,117,114,110,97,108,0; 1 0 0 0
S108,105,98,105,100,111,32,112,105,108,108,0; 1 0 0 0
S109,101,100,107,105,116,0; 5 0 0 0
S115,109,105,108,111,100,111,110,32,99,117,109,0; 1 0 0 0
S115,116,117,114,100,121,32,106,101,97,110,115,0; 1 0 1 0
S116,97,105,110,116,101,100,32,119,111,111,108,0; 2 0 0 0
S116,97,110,117,107,105,32,99,111,105,110,0; 1 0 0 0
S119,104,105,116,101,32,98,114,105,101,102,115,0; 1 0 1 0
S119,121,118,101,114,110,32,103,111,111,112,0; 1 0 0 0
S98,105,114,116,104,32,99,111,110,116,114,111,108,32,112,105,108,108,0; 8 0 0 0

after running "csv2ascii FSPossessionSave > FSPossessionSave-decoded.txt"
Code: Select all
* //4DA761E4-4441-4313-BEDE-B3A78D3DABAA// FSPossessionSave
! Table of GamePossessions (22)
"Apocalypse Hoodie"; 1 0 0 0
"Apocalypse Scarf"; 1 0 0 0
"Apocalypse Shorts"; 1 0 0 0
"Apocalypse Skirt"; 1 0 0 0
"black t-shirt"; 1 0 1 0
"brown loafers"; 1 0 1 0
"cat key"; 1 0 0 0
"distilled milk"; 2 0 0 0
"ESPP bunker keycard"; 1 0 0 0
"estosterogen pill"; 10 0 0 0
"gryphon milk"; 5 0 0 0
"Hiking Backpack"; 1 0 1 0
"journal"; 1 0 0 0
"libido pill"; 1 0 0 0
"medkit"; 5 0 0 0
"smilodon cum"; 1 0 0 0
"sturdy jeans"; 1 0 1 0
"tainted wool"; 2 0 0 0
"tanuki coin"; 1 0 0 0
"white briefs"; 1 0 1 0
"wyvern goop"; 1 0 0 0
"birth control pill"; 8 0 0 0


If you wanted to add an item that wasn't already in that list, say, 'Awesomest Fruit,' you could use the 'str2csv' tool to generate a correct name on the fly:
Code: Select all
str2csv "Awesomest Fruit"
S65,119,101,115,111,109,101,115,116,32,70,114,117,105,116,0;

Then, you would add that item anywhere to the list above, followed by the four data elements. I happen to know the first number is the quantity you have. If you wanted to have ten of them, you'd make that whole line read:
Code: Select all
S65,119,101,115,111,109,101,115,116,32,70,114,117,105,116,0; 10 0 0 0


ALTERNATIVELY, you could just put a new line at the end of the decoded file which reads:
Code: Select all
"Awesomest Fruit"; 10 0 0 0

and then run the encoder (ascii2csv) to make it back into a format the game can recognize.

It might be a good idea to rename 'ascii2csv' to 'encode' and 'csv2ascii' to 'decode'. Just thought of that, though, so the names will stay for now.
dragontamer8740
 
Posts: 8
Joined: Thu May 22, 2014 8:23 pm

Re: NEW save (import/export format) editing tools

Postby dragontamer8740 » Sun Dec 09, 2018 8:59 pm

P.S. - if anyone wants to take this code and improve it or rewrite it, feel free. It's licensed under MIT, so do whatever you want with it. I understand that this is a lot more technical than that point-and click graphical editor, but I figured maybe somebody would be able to use it, which is better than no one. I don't usually post here, or indeed look here, so I might not be here to answer many questions. I'll try to remember, though. I want to help.

Also, lol, I just realized I could probably have written a macro in some spreadsheet program to do this.
This is lighter weight by an order of magnitude, though.
dragontamer8740
 
Posts: 8
Joined: Thu May 22, 2014 8:23 pm

Re: NEW save (import/export format) editing tools

Postby meemo » Sat Feb 02, 2019 7:50 am

dragontamer8740 wrote:P.S. - if anyone wants to take this code and improve it or rewrite it, feel free. It's licensed under MIT, so do whatever you want with it. I understand that this is a lot more technical than that point-and click graphical editor, but I figured maybe somebody would be able to use it, which is better than no one. I don't usually post here, or indeed look here, so I might not be here to answer many questions. I'll try to remember, though. I want to help.

Also, lol, I just realized I could probably have written a macro in some spreadsheet program to do this.
This is lighter weight by an order of magnitude, though.


I appreciate the effort dragontamer8740. I don't really know how to use this myself, but it's nice to see people are working to assist people in figuring out this new save system.
meemo
 
Posts: 6
Joined: Thu Feb 04, 2016 8:36 am

Re: NEW save (import/export format) editing tools

Postby BadgerMushroom » Sat Feb 09, 2019 9:27 pm

I love that you done this, but I haven't the faintest idea how to use this.
BadgerMushroom
 
Posts: 8
Joined: Sat Sep 17, 2016 1:53 pm

Re: NEW save (import/export format) editing tools

Postby dragontamer8740 » Fri Apr 19, 2019 2:08 am

BadgerMushroom wrote:I love that you done this, but I haven't the faintest idea how to use this.

Ah, yeah, that's understandable.
I sort of intend to make a video demo at some point, but real life duties have prevented it.

Also, I had to put the download links on the gitlab page, since the forum software didn't want me to post it here.
dragontamer8740
 
Posts: 8
Joined: Thu May 22, 2014 8:23 pm

Re: NEW save (import/export format) editing tools

Postby darkoraclegirl » Sun Jun 09, 2019 10:26 am

Hoping this thread isn't dead, as I really would like to know how this tool you created works.
darkoraclegirl
 
Posts: 9
Joined: Fri Nov 09, 2018 10:17 pm

Re: NEW save (import/export format) editing tools

Postby jllllll » Thu Jul 18, 2019 11:53 pm

After messing around with your tool on windows, I came up with these bat files:

decode.bat
Code: Select all
@echo off
mkdir Editing
FORFILES /M FS*Save.glkdata /c "cmd /c csv2ascii "@file" > ".\Editing\@fname.txt""


encode.bat
Code: Select all
@echo off
FORFILES /P .\Editing /M FS*Save.txt /c "cmd /c ..\ascii2csv "@file" > "..\@fname.glkdata""


For those wanting to know how to use this: Download the program from here. Extract just the exe files to your game folder. Afterwords create the 2 files that I described above in the same folder. Then after exporting your game, run decode.bat. Your decoded save files will now be in a new "Editing" folder. When done editing the files, run encode.bat and your save will now be ready for import.

NOTE: Currently the program adds empty lines to the files. You must delete all empty lines in the final encoded files in order to import the save.
jllllll
 
Posts: 1
Joined: Thu Jul 18, 2019 10:42 pm


Return to General Chat

Who is online

Users browsing this forum: No registered users and 64 guests