Advertisement
Guest User

Stellaris Savegame Packer

a guest
Sep 25th, 2016
5,216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import sys
  4. import zipfile
  5.  
  6. gameFiles = ("meta", "gamestate")
  7. outFile = "game.sav"
  8. gfPath = "."
  9.  
  10. gameData = {}
  11. for gameFile in (gameFiles):
  12. with open(gfPath + "/" + gameFile, 'rb') as curFile:
  13. gameData[gameFile] = curFile.read()
  14.  
  15. zf = zipfile.ZipFile(outFile, mode='w')
  16.  
  17. try:
  18. for gameFile in gameFiles:
  19. info = zipfile.ZipInfo(gameFile, date_time=(1980, 0, 0, 0, 0, 0))
  20. info.compress_type=zipfile.ZIP_DEFLATED
  21. info.create_system=0
  22. info.create_version = 63
  23. info.extract_version = 20
  24. zf.writestr(info, gameData[gameFile])
  25. finally:
  26. zf.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement