Skip to content

Add one-time backup + Revert to vanilla Steam - #49

Open
MR-1124 wants to merge 1 commit into
madoiscool:mainfrom
MR-1124:feature/revert-to-vanilla
Open

MR-1124 wants to merge 1 commit into
madoiscool:mainfrom
MR-1124:feature/revert-to-vanilla

Conversation

@MR-1124

@MR-1124 MR-1124 commented Sep 10, 2026

Copy link
Copy Markdown

What

Adds a safe, explicit way to undo a mode install and return Steam to its pre-LuaTools state.

Backup (automatic, one-time)

  • The first time any mode install writes to the Steam root, the pre-existing files (dwmapi.dll, xinput1_4.dll, opensteamtool.toml) are snapshotted to %AppData%\LuaToolsGui\backups\ with a manifest.json recording each file's SHA-256.
  • The snapshot is never overwritten by later installs — it always preserves the oldest observed state.
  • Backup failure never blocks an install; it's a safety net, not a gate.

Revert (manual, explicit)

  • New "Revert to vanilla Steam" card at the bottom of the Mode page, with a confirmation overlay and optional checkboxes for also cleaning game luas (config/stplug-in/*.lua) and pinned manifests (config/depotcache/*.manifest).
  • On confirm: close Steam → restore backed-up files (SHA-256 verified before landing in the Steam root; a mismatch deletes the copy rather than propagating corruption) → remove mode payloads (OpenSteamTool.dll, cloud_redirect.dll, opensteamtool.toml — only where no backup covers them) → clear the selected mode → restart Steam → toast with the result.

No-backup path (installs made before this feature existed)

  • The proxy DLLs were placed by the mode, so deleting them is the revert: with the proxies absent, steam.exe loads the real system DLLs from System32. The card's status line explains which path applies.

Why

Switching modes is covered today, but there's no way to fully opt out again. This gives users a clean exit ramp, and the one-time snapshot means even a botched first install can be undone byte-for-byte.

Testing

  • dotnet build — 0 warnings, 0 errors
  • dotnet test — 238/238 passed (on top of the current main)
  • Manually exercised: revert with no backup (deletes mode-placed proxies), revert with backup (hash-verified restore), lua/manifest cleanup checkboxes, locked-file reporting in the failure list.

Happy to adjust UX (card placement, wording, whether the optional cleanups should default on) or split the backup into its own commit if you prefer.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff noreply@codebuff.com

Before the first mode install writes to the Steam root, snapshot the
pre-existing files (dwmapi.dll, xinput1_4.dll, opensteamtool.toml) into
%AppData%\LuaToolsGui\backups with a SHA-256 manifest; the snapshot is
never overwritten by later installs.

A "Revert to vanilla Steam" card on the Mode page then undoes every
mode artifact: closes Steam, restores backed-up files (hash-verified,
corrupt copies are discarded rather than propagated), removes mode
payloads (OpenSteamTool.dll, cloud_redirect.dll, opensteamtool.toml),
optionally cleans game luas and pinned manifests, clears the selected
mode, and restarts Steam.

Installs made before backups existed (no snapshot available) revert by
deleting the mode-placed proxy DLLs — steam.exe falls back to the real
system DLLs, so removal is the correct revert there. Revert is offered
whenever mode artifacts are present, backup or not.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
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.

1 participant