How do I recover a corrupted Prison Architect savegame?

I analyzed the structure of the PA savegame and found that some parts of a savegame can be recovered with minimal effort:

  1. Start new prison
  2. Save immediately, exit.
  3. Open corrupted savegame in a proper texteditor (e.g. atom, vi)
  4. Copy over to new savegame:
  • TimeIndex
  • RandomSeed
  • SecondsPlayed
  • Balance

complete sections:

BEGIN Cells
BEGIN Electricity
BEGIN Water
BEGIN PolicyData
BEGIN StatsTracker
BEGIN TransferData
BEGIN Finance
BEGIN Research
BEGIN Grants
BEGIN Intake
BEGIN WeatherMap

Note: The structure is, just replace all the new <data> with old data:

BEGIN Section 
    <data>
END
  1. Copying over staff and items would need adjustment of Ids (.i, .u, indices), but is possible in theory. It it even possible to copy over buildings under construction and processes. You can still make some of the manual recovery easier by using the clone-feature of the game (and granting yourself the money needed by adjusting your balance).

You can also Strg+F for specific types of objects. With some programming skills, you can actually transfer the lines of most items to a new savegame.

  1. Load your new savegame. Enjoy.

--

Achievement of this process: Buildings, utilities and most of the statistics are transferred. Items, staff and prisoners are missing. The new savegame will start with its own items and their positions (e.g. trees).

Recommendation: To automate the recovery of the savegame and to add items and staff to the recovery process, a short shell-script could be developed. If I could help someone, please consider contributing to that.