Skip to content

Instantly share code, notes, and snippets.

@sj26
Created November 19, 2013 09:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sj26/7542852 to your computer and use it in GitHub Desktop.
Save sj26/7542852 to your computer and use it in GitHub Desktop.
Hacking Spacebase DF-9 saves
# They're just deflated messagepack dumps of lua data.
require "zlib"
require "msgpack" # gem install msgpack
# **BACK IT UP FIRST**
save = MessagePack.unpack(Zlib::Inflate.new(-15).inflate(IO.read("#{ENV["HOME"]}/Documents/SpacebaseDF9/Saves/SpacebaseDF9AutoSave.sav")))
# ... do things to `save` ...
IO.binwrite("#{ENV["HOME"]}/Documents/SpacebaseDF9/Saves/SpacebaseDF9AutoSave.sav", Zlib::Deflate.new(9, -15).deflate(save.to_msgpack))
@Artoria2e5
Copy link

Artoria2e5 commented Jul 31, 2017

The copy of zlib in Ubuntu on Windows doesn't seem to always flush streams properly, causing premature ends. Some explicit instruction with .deflate(save.to_msgpack , Zlib::FINISH) is required for it to work.

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