How to Fish
Install

Details

Last Updated
First Uploaded
Downloads
36
Likes
0
Size
22KB
Dependency string
hiccup-SaveBackups-1.1.0
Dependants

Categories

SaveBackups

Modded games break saves sometimes. This keeps rolling copies of yours and lets you put one back from inside the game.

A Backups button appears on the Save Info panel in the Load Game screen. It lists every backup of that save with when it was taken and what is in it, and each row has Restore and Delete.

Aug 23  18:44  (manual)   2877 money, island 4, 4h 45m played   [Restore] [Delete]
Aug 23  18:44             2677 money, island 4, 4h 46m played   [Restore] [Delete]
Aug 23  18:43             2877 money, island 4, 4h 45m played   [Restore] [Delete]

The money, island and playtime are read out of each backup file, so you can tell which one you actually want instead of guessing from a timestamp.

When backups happen

Automatically every time the game saves, which includes the five minute autosave, and again when you pick a save to load, so you always have the state you started a session with. You can also take one on demand with Back up now.

Identical saves are skipped, so sitting idle does not fill your history with copies of the same thing. That means the slots you keep hold genuinely different states.

Restoring is safe

Restoring takes a backup of the current file first, marked manual, so restoring is itself undoable. If you pick the wrong one you have not lost anything.

Manual backups are never deleted automatically. Only automatic ones rotate, keeping the newest few. This matters: if manual backups were pruned too, a handful of autosaves after something went wrong could quietly delete the good copy you were relying on.

The mod also refuses to back up or restore an empty file, since an empty save is what corruption usually looks like and copying it over your history would destroy the thing you need.

Mod data is included too

Some mods keep their own save data in a separate file. If only the vanilla save were rolled back, you would end up with a mismatched world: base state from the snapshot, mod state from now.

A snapshot therefore holds the save and any registered mod files together, and restores them as one unit. Rows carrying mod data are marked with a + and a count.

If you restore a snapshot whose mod is no longer installed, the save is restored anyway and the panel tells you which data was skipped.

For mod authors

If your mod writes its own per save file, two lines make it part of every snapshot.

Add a soft dependency so your mod still runs without SaveBackups:

[BepInDependency("dazed.howtofish.savebackups", BepInDependency.DependencyFlags.SoftDependency)]

Then register in Awake, returning the absolute path for a given save name, or null if that save has no file:

SaveBackups.Companions.Register(
    "yourmodid",
    "Your Mod Name",
    saveName => Path.Combine(Paths.ConfigPath, "YourMod", "Saves", Sanitise(saveName) + ".json"));

That is the whole integration. SaveBackups copies the file when it snapshots and writes it back when you restore, creating directories as needed. A missing file is normal and is not an error.

If you would rather not reference SaveBackups at all, the same call works through reflection against the SaveBackups.Companions type.

Where the files live

%USERPROFILE%\AppData\LocalLow\Dazed Games\How to Fish\SaveBackups\<save name>\<timestamp>\
    save.txt
    companion.<modid>.json
    snapshot.json

They are plain copies of the real files, so you can also just copy one back by hand if you prefer. Open folder in the menu takes you straight there.

Backups made before version 1.1.0 were single files rather than folders. Those are still listed and still restore, as save only snapshots. Nothing is migrated or rewritten.

Configuration

BepInEx/config/dazed.howtofish.savebackups.cfg

Setting Default What it does
BackupOnSave true Back up on every save, including the autosave
BackupOnLoad true Back up when a save is selected to load
SkipUnchanged true Do not store a copy identical to the newest one
MaxAutomaticBackups 10 Automatic backups kept per save. 0 keeps everything
MaxRowsShown 7 Rows listed at once, so the panel does not overflow
OpenButtonWidth 240 Width of the Backups button
OpenButtonBottomMargin 22 Gap between the Backups button and the panel edge
DeferCapture true Copy files at the end of the frame so mod data is captured in step with the save

Disk use is modest. Save files are small, and 10 backups of a save is still well under a megabyte.

Notes

Singleplayer and hosted saves both work, since these are the server save files. Only the host has them, so joining someone else's game has nothing to back up.

Nothing is overwritten without being copied first, and no game files are modified. Removing the mod leaves your saves exactly as they are, and the backup folder can be deleted freely.

Thunderstore development is made possible with ads. Please consider making an exception to your adblock.