Skip to content

Add manual-save script (closes DFHack/dfhack#5792)#1583

Open
sizzlins wants to merge 2 commits intoDFHack:masterfrom
sizzlins:feature/manual-save
Open

Add manual-save script (closes DFHack/dfhack#5792)#1583
sizzlins wants to merge 2 commits intoDFHack:masterfrom
sizzlins:feature/manual-save

Conversation

@sizzlins
Copy link
Copy Markdown

Adds a manual-save command that creates persistent, named save snapshots that won't be overwritten by autosaves. Works by triggering a native autosave and then duplicating the result into a timestamped folder. Includes a --cleanup flag to prune old snapshots. Compatible with the repeat command for rolling saves.

…ss autosaves

Adds a new 'manual-save' command that creates persistent, named save
snapshots by triggering a native autosave and then safely duplicating
the result into a timestamped folder. This bypasses the 3-slot autosave
restriction in DF v50+.

Features:
- Automatic fortress-name + timestamp naming
- Custom name support via positional argument
- --cleanup N flag to prune old snapshots (only touches -Manual- folders)
- Safe 4MB chunked file copy to avoid memory spikes
- Handles both AppData (Premium) and portable save locations
- Compatible with the 'repeat' command for rolling saves

Closes DFHack/dfhack#5792
@Bumber64
Copy link
Copy Markdown
Contributor

It may be better to use simulateInput to press the buttons required to perform a manual save. (Hopefully there's a way to set the save name on the viewscreen rather than simulating the name inputs.) It's clunky, but better than messing with the file system.

Addresses feedback from Bumber64 to use simulateInput. Bypasses file system entirely by injecting the save name directly into df.global.game.main_interface.options and simulating the 'SELECT' key to execute a native named save sequence.
@sizzlins
Copy link
Copy Markdown
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants