Z1ni / XGP-save-extractor

Python script to extract savefiles out of Xbox Game Pass for PC games
MIT License
568 stars 36 forks source link

Possible to go the other way from steam save to xgp? #11

Open SirShaw opened 1 year ago

SirShaw commented 1 year ago

Not an issue but some folks (including myself) bought this on steam only to realize that it was included with game pass later and have some progress we want to import from steam. I dont know how easy this would be to implement or if its even possible to have this tool go the other way. So steam to xgp.

jakest commented 1 year ago

Agreed. Would love to have the other way supported.

rubensmello commented 1 year ago

Is this really necessary! A lot of people started playing the version that was pirated (steam) and now that it was released on gamepass, they want to change the version...

murder46 commented 1 year ago

I would absolutely love this if at all possible. Thanks for all your hard work

DrDoakes commented 1 year ago

Agreed would love this feature

NSFLscott commented 1 year ago

Same here would love to go from Steam to XGP!

tggoulart commented 1 year ago

I really need this feature now that I'm moving to gamepass

Mapedmaker commented 1 year ago

this would be extremely helpful

JupiterOdyssey commented 1 year ago

Need this too. Thanks for the developer!

Xmentiroso commented 1 year ago

I detect the save game folder but Gamepass use another system for store saved points. Is posible reverse the .sfs files to the model of Gamepass? Thanks!

tosziro commented 1 year ago

I think soulution i here: https://github.com/Z1ni/XGP-save-extractor/issues/5#issuecomment-1705730567 but... I dont understand it.

MiriaWeakSmile commented 1 year ago

I'm also waiting for a decision, I want to switch to game pass, but I don't want to lose the progress received in the torrent version. I will be grateful for the answer

Z1ni commented 1 year ago

I'll try to look into this later today.

alexdie commented 1 year ago

If you need any help testing the steam -> xpg conversion, I've got appropriate savegames and installations that aren't a big loss if broken.

Amnessie commented 1 year ago

Yeah I would really appreciate this too!

Whatevser commented 1 year ago

I was hoping to be able to use the 'load' command in console to load my save, I've tried putting it everywhere during the game running hoping I find some cache folder, but that did not work out for me. I hope you will be able to convert the saves, or at least that somebody else will read this post and manage to implement my idea.

z7ui commented 1 year ago

I'll try to look into this later today.

thank you, really need this feature, starfield

MoonlitWisp commented 1 year ago

You're all absolute legends, you got this!

Bcawesomer commented 1 year ago

This is not only helpful to pirates @rubensmello being able to download steam saves and use them for game pass games would be an excellent software that someone should have made a while ago. The process of getting a steam save to a game pass save is a pain and would be nice to have a software that does it especially if it works on other gamepass games😁

MrN0ss commented 1 year ago

I think the problem is that the saves are encripted (i think) and the encryption key is changed with each game, you have some tools like GPSaveConverter, i tried and wasn't able to get anywhere (no updates since January) and also another was this MollysGameSaveMule witch alow the bi-directional save transfer only for Deep Rock Galactic, but with the idea of the games on gamepass being temporary and that now with this services even your saves are not your's anymore i think this aplication would be a great thing for people who would like to have their saves... well safe Also for new game plus saves on nexus would work either if it is steam or XGP

Bcawesomer commented 1 year ago

GPSaveConverter can be helpful but not in the way it supposed to function being how it does not work you can use it to find the name of each sting and change the time modified in order to find which one is the save. Thats what im here for too i want a new game plus save.

miffril commented 1 year ago

I managed to split save file to container parts based on this comment. I tested it by converting XGP saves to nonXGP and splitting them back. They seem to be identical except for the padding part. I also tried to run it on my nonSGP 10 MB save, it created 115 parts. It would be great if someone confirms if it is okay for large saves in XGP. Now need to understand how to create index files. ps Please don't judge my code, I'm not a programmer and first time working on a byte level 😅 image

import os
import zlib

tmp_files_path = "F:\\TEMP\\saves"
save_file_path = "C:\\Users\\miffr\\Documents\\My games\\Starfield\\Saves"
save_file_name = "1.sfs"

def write_file(file_index, data):
    with open(os.path.join(tmp_files_path, f"container{file_index}"), "wb") as container_part:
        print("Writing file")
        container_part.write(bytes(data))
        print(f"File name container{file_index}")
    return

def main():

    with open(os.path.join(save_file_path, save_file_name), "rb") as save_file:
        position = 0
        byte_1 = b"x"
        byte_2 = b"^"
        tmp_bytearray = bytearray()
        files_found = 0
        while(byte := save_file.read(1)):
            if(byte == byte_1):
                position = save_file.tell()
                next_byte = save_file.read(1)
                save_file.seek(position)
                if(next_byte == byte_2):
                    if(files_found == 0):
                        write_file(files_found, tmp_bytearray)
                        files_found += 1
                        tmp_bytearray = bytearray()
                    else:
                        try:
                            print("try to decompress")
                            zlib.decompress(tmp_bytearray)
                        except zlib.error as z_exept:
                            print(f"Failed to decompress: {z_exept=}")
                        except Exception as e:
                            print (f"Failed to decompress: {e=}, {type(e)=}")
                        else:
                            write_file(files_found, tmp_bytearray)
                            files_found += 1
                            tmp_bytearray = bytearray()

            tmp_bytearray += byte
        write_file(files_found, tmp_bytearray)
        print(f"Containers found {files_found}")

if __name__ == "__main__":
    main()
berdmanus commented 1 year ago

hello, tell me what to do with this code?

EffortlessFury commented 1 year ago

@berdmanus It's not entirely complete yet.

SherbyHomes commented 1 year ago

@miffril Would it not be possible just to paste that into the containers that are already there?

I was looking into it before but staring at hex for too long hurts my brain.

SzzzAK999 commented 1 year ago

Please, someone make it happen. I like to play on XBOX Series X, but I did start game before lunch on pirate version. Now I stuck on PCMR.

jibs92 commented 1 year ago

Zencq created a great save game editor that works both ways for No Man's Sky. https://github.com/zencq/NomNom The saves in Steam and in Xbox are very similar to Starfield.

miffril commented 1 year ago

@SherbyHomes I don't know how names are generated. I guess they are just random numbers. Those names should be put inside index file. I'm trying to understand right how those indexes are working. If their only purpose is to list filenames, I think it's possible to just create a savefile from the game and then replace this XGP save files with renamed files generated using my script. Quantity of files generated from big saves is the open question right now. I generated 115 files from my save as I mentioned above. In this case you can't just replace dummy save from XGP because it have something about 10 files.

MrN0ss commented 1 year ago

Not sure if useful to cross the data but in https://github.com/Fr33dan/GPSaveConverter we can check those 10 file like in this image up is xbox game pass down is my "Steam" saves ;)

MrN0ss commented 1 year ago

starfield xgp extraction.txt heres a txt file with the container names and blob id's from my saves

MrN0ss commented 1 year ago

it seems that it has 10 copies of the same save in each set, i do only have the start of the game up until right after the char creation like you can see here image

berdmanus commented 1 year ago

image I don't understand how to run it?

miffril commented 1 year ago

@MrN0ss those aren't the same files. It is one file that split into 10 parts. You can see it by blobID.

MrN0ss commented 1 year ago

@MrN0ss those aren't the same files. It is one file that split into 10 parts. You can see it by blobID.

yeah you are right thanks for the heads up but check this wiki for gps sems to have good info haven't checked fully https://github.com/Fr33dan/GPSaveConverter/wiki/File-Translations

image I don't understand how to run it?

you got to get it from release https://github.com/Fr33dan/GPSaveConverter/releases code is broken i think

berdmanus commented 1 year ago

Thank you

MoonlitWisp commented 1 year ago

Has anyone figured Steam -> XGP yet?

SzzzAK999 commented 1 year ago

image I don't understand how to run it?

You need run this via Visual Studio or other app I guess. I did run it with VS. image I didn't figure out how to convert files from Steam to XGP.

MrN0ss commented 1 year ago

i did run it on vs but had missing files steamapi and the other one image i have a translation ready but get this error image

MrN0ss commented 1 year ago

also check the wiki for how to run it https://github.com/Fr33dan/GPSaveConverter/wiki/File-Translations

GaborKoleszar commented 1 year ago

https://github.com/HarukaMa/starfield-xgp-import/releases/tag/v0.0.2

Check this project. Download the exe, copy the .SFS save file into the same directory as the exe, open CMD and type in .\sfsconvert.exe "nameofSFSfile"

Done, it is now in the Gamepass version of Starfield.

tosziro commented 1 year ago

https://github.com/HarukaMa/starfield-xgp-import/releases/tag/v0.0.2

Check this project. Download the exe, copy the .SFS save file into the same directory as the exe, open CMD and type in .\sfsconvert.exe "nameofSFSfile"

Done, it is now in the Gamepass version of Starfield.

Thank you! Works for me

SirShaw commented 1 year ago

https://github.com/HarukaMa/starfield-xgp-import/releases/tag/v0.0.2

Check this project. Download the exe, copy the .SFS save file into the same directory as the exe, open CMD and type in .\sfsconvert.exe "nameofSFSfile"

Done, it is now in the Gamepass version of Starfield.

You are an angel. Works perfectly! Thank You!

Z1ni commented 1 year ago

https://github.com/HarukaMa/starfield-xgp-import

Locking this issue as there's now an import tool made by @HarukaMa.

I'm looking into maybe adding the conversion also to my script, but if you're converting Starfield saves from Steam to XGP, look into that project instead for now.