1
0
mirror of https://github.com/mbirth/wiki.git synced 2024-12-26 23:14:06 +00:00
wiki.mbirth.de/know-how/software/games/_posts/2013-08-14-spaz.md

2.7 KiB

title language layout created updated toc tags
SPAZ - Space Pirates and Zombies en default 2013-08-13 02:19:14 +0200 2013-08-14 00:17:58 +0200 false
know-how
software
games

Get decompiled savegame

Savegames are actually written to disk in a plaintext form and then compiled by the engine. The source file is deleted afterwards. To obtain it under Linux:

  1. save your game, name it e.g. "TEST"
  2. find your savegame folder, it should be: ~/.local/share/spacepiratesandzombies/b_save/
  3. make sure there are the files sg_TEST.cs.dso and si_TEST.cs in that folder
  4. touch an empty file sg_TEST.cs and make sure its permissions allow read/write for the user
  5. now remove the write permission from the directory (chmod a-w b_save)
  6. in the game, (may load first) and save again under the same name (overwrite!)
  7. the sg_TEST.cs should now contain the full savegame

Compile after modifications

To make SPAZ load the modified file, you have to compile it first. SPAZ won't compile it on its own. But we can trick it:

  1. find your SPAZ settings folder, it should be ~/.local/share/spacepiratesandzombies/b_settings/
  2. rename the files spz_settings.cs and spz_settings.cs.dso to something else
  3. now copy your modified sg_TEST.cs into it and name it spz_settings.cs
  4. run SPAZ from Steam, until you see the resolution/mod-pack selection screen, quit SPAZ
  5. you should now find a file spz_settings.cs.dso in that folder - that's your compiled savegame
  6. rename spz_settings.cssg_TEST.cs and spz_settings.cs.dsosg_TEST.cs.dso
  7. rename the original files back to spz_settings.cs and spz_settings.cs.dso

Calculate Checksum

SPAZ does a primitive checksum validation on its savegames. If you take a look at the si_TEST.cs, you'll find something like this:

TEST
2013 08 12 22 42 01
1
3
6
THE SOL SYSTEM
1.605
0
371866351
TEST2013 08 12 22 42 01136THE SOL SYSTEM1.6050371866351

The number in the last but one line is a decimal CRC32 checksum with its bytes negated (signed 4-byte integer). The number occurs a second time at the end of the last line.

To calculate the number from our new file, first calculate the CRC32:

$ crc32 sg_TEST.cs.dso
e9d5c510

Now negate that value, so we get: ffffffff162a3aef. We only use the last 8 nibbles (last 4 bytes): 162a3aef.

Finally, turn that into a signed decimal number: 371866351. Done. This is our new checksum which goes right into the si_TEST.cs file. Now you're able to load the modified savegame.

Further Reading