mirror of
https://github.com/mbirth/wiki.git
synced 2024-12-27 23:24:06 +00:00
82 lines
2.7 KiB
Markdown
82 lines
2.7 KiB
Markdown
|
---
|
||
|
title: SPAZ - Space Pirates and Zombies
|
||
|
language: en
|
||
|
layout: default
|
||
|
created: 2013-08-13 02:19:14 +0200
|
||
|
updated: 2013-08-14 00:17:58 +0200
|
||
|
toc: false
|
||
|
tags:
|
||
|
- 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"
|
||
|
1. find your savegame folder, it should be: `~/.local/share/spacepiratesandzombies/b_save/`
|
||
|
1. make sure there are the files `sg_TEST.cs.dso` and `si_TEST.cs` in that folder
|
||
|
1. touch an empty file `sg_TEST.cs` and make sure its permissions allow read/write for the user
|
||
|
1. now remove the write permission from the directory (`chmod a-w b_save`)
|
||
|
1. in the game, (may load first) and save again under the same name (overwrite!)
|
||
|
1. 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/`
|
||
|
1. rename the files `spz_settings.cs` and `spz_settings.cs.dso` to something else
|
||
|
1. now copy your modified `sg_TEST.cs` into it and name it `spz_settings.cs`
|
||
|
1. run *SPAZ* from Steam, until you see the resolution/mod-pack selection screen, quit *SPAZ*
|
||
|
1. you should now find a file `spz_settings.cs.dso` in that folder - that's your compiled savegame
|
||
|
1. rename `spz_settings.cs` → `sg_TEST.cs` and `spz_settings.cs.dso` → `sg_TEST.cs.dso`
|
||
|
1. 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
|
||
|
===============
|
||
|
|
||
|
* http://www.spacepiratesandzombies.com/forums/viewtopic.php?f=27&t=2967
|
||
|
* http://www.spacepiratesandzombies.com/forums/viewtopic.php?f=5&t=2372
|