Created
November 19, 2013 09:44
-
-
Save sj26/7542852 to your computer and use it in GitHub Desktop.
Hacking Spacebase DF-9 saves
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)) |
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
You'll need to run
irb
which gives an interactive ruby prompt. Thesave
variable once loaded gives you a big hash of objects which you can manipulate, then afterward.Here's what the hash should look like (I've truncated because it's huge):