Skip to content

Instantly share code, notes, and snippets.

@EhsanKia
Created March 21, 2022 08:46
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save EhsanKia/232943e8ab8fad2ee99d33aa57c168ff to your computer and use it in GitHub Desktop.
Save EhsanKia/232943e8ab8fad2ee99d33aa57c168ff to your computer and use it in GitHub Desktop.
Unpacks Game Pass SAVEDATA for Tunic into individual Steam format
import re
with open('5E113D5F383749AEB72703486DD8247B', 'rb') as fp:
data = fp.read()
filenames = re.findall(rb'\d+\.txt', data)
contents = re.findall(rb'(true\|1[^\0]+)', data, re.DOTALL)
for name, content in zip(filenames, contents):
with open(name.replace(b'.txt', b'.tunic'), 'wb') as fp:
fp.write(content.strip())
@EhsanKia
Copy link
Author

Some more detail

  1. Navigate to %LOCALAPPDATA%\Packages\Finji.TUNIC_tys0ffscxatjj\SystemAppData\wgs\[HASH]\[HASH]
  2. You should see two files, the bigger one is likely SAVEDATA, though you can verify by putting the container.## file in this tool.
  3. Paste the python3 script above into the same folder, and replace the hash on line 3 with the filename of your SAVEDATA.
  4. Run the script with Python 3
  5. Copy the individual ######.tunic files into %USERPROFILE%\AppData\LocalLow\Andrew Shouldice\Secret Legend\SAVES\

This script wasn't tested very thoroughly, let me know if you file any bugs.

@kostasvl
Copy link

Thanks! <3

I found I was getting some strange results in the Load Game screen (something like 13 save files instead of the expected ....(ahem, spoilers)). It's something to do with the file names, I think. I changed your regex to include the first part of the names (before the '~'), and that worked. To be clear, I replaced line 6 above with:

filenames = re.findall(rb'\d+~\d+.txt', data)

I'm at the endgame. From about 2 minutes of checking, everything seems to have made it across (from Game Pass to GOG in my case). I manually diffed the variables inside the save files, and everything seems identical.

The only problem is that the blue hexagon is missing from the inventory screen, for some reason :(. I went and checked that it's still placed in the right place in the world, and it was. It's just not showing in its slot at the top of the inventory screen. The other two hexagons are. The save file shows:

inventory quantity Hexagon Blue|0
Placed Hexagon 3 Blue|1
Placed Hexagons ALL|1

...which is what I would expect in my case. I actually changed the above 3 variables like this:

inventory quantity Hexagon Blue|1
Placed Hexagon 3 Blue|0
Placed Hexagons ALL|0

...and then went in-game and placed the blue hexagon in its proper place again (saw the cutscene again and everything), but it's STILL not shown in my intentory. Arghhh :). Maybe it's harmless, but I'm slightly worried that other important things didn't transfer correctly. Oh well, that will teach me for not buying this awesome game earlier. Now I'm thinking I might finish it on Game Pass, and do the save conversion again at the end, as backup.

Thanks again! You did all the hard work 👍

@thegriffindude
Copy link

I pray that your hoes are plentiful and that you receive the sloppiest top on the regular for this sir, thank you

@CelesteGH
Copy link

Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment