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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.