Apply and restore Steam Launch Options
Status and delivery scope
Section titled “Status and delivery scope”Released in v0.2.9 on 2026-10-07; scoped local, public delivery and exact-public-installer acceptance passed. Earlier public v0.2.8 saves profiles, prepares stable Runner and generates/copies Launch Options. Its selected-AppID restoration clears recognized generated commands across local accounts; it cannot reconstruct arguments overwritten by manual pasting. v0.2.9 adds explicit single-account application and original-value restoration. Existing Windows design and P4 gates continue to apply.
Target the existing Windows 11 24H2 x64 support scope, using the Windows account normally used for Steam. No broader account, hardware, game, cloud or achievement guarantee follows from writing a setting. Product versions are coordinated at 0.2.9; future releases still require the relevant delivery gates below.
Player flow
Section titled “Player flow”- Save and apply to Steam first validates and saves the profile, then prepares/verifies stable Runner. Save only keeps the profile without applying Steam settings; a separate Copy Launch Options action remains available.
- Show one confirmation with game name/AppID, Steam account, current Launch Options and proposed command. Display the sole readable local account; multiple accounts require an explicit choice, with no silent default. No readable account means automatic application is unavailable, with guidance to open/sign in to Steam once and a manual-copy alternative.
- If Steam is running, explain that the player must exit it normally and provide Check again. Do not terminate Steam or games. Returning from the wait requires a fresh inspection; changed options invalidate the previous confirmation.
- Back up, apply and read back the selected setting. Only then report Configuration saved; Launch Options written. This verifies the disk value, not the Steam client’s in-memory setting. Keep profile-save success distinct from an application failure: Configuration saved; Steam settings were not applied is appropriate only when no mutation occurred. After an uncertain replacement, say Application could not be confirmed; recovery copies were retained. Review before retrying or restoring.
- Offer Open Steam, opening the client rather than launching a game. The player can check the selected game’s Properties using the Steam account from the confirmation. The application does not need to remain open during normal Steam play.
The confirmation explains that nonempty old options are replaced and retained for restoration. Do not guess their meaning, append them to %command%, or silently copy them into Runner arguments. Canceling application leaves the saved profile available and Steam untouched. Use ordinary English/Simplified Chinese labels; storage formats, hashes and transaction identifiers belong in developer diagnostics, not the normal confirmation.
Accounts and setting ownership
Section titled “Accounts and setting ownership”- Add bounded, read-only account discovery to Application, using local
userdataand display fields fromconfig/loginusers.vdfwhere available. Verify SteamID/account-directory mapping with fixtures; fall back to an account-directory identifier when the display name is unavailable. A “most recent” flag is a hint, never permission to write. Do not use account-service network requests or report credentials. - Require an existing, readable account
localconfig.vdf, an unambiguous canonical numeric AppID, the saved profile and a verified shared stable Runner location. A manually entered AppID must resolve unambiguously to a local installation before automatic application; otherwise keep the manual path. Installed-game discovery does not prove that every local account owns that game, so the confirmation must identify the account. - Change only
UserLocalConfigStore/Software/Valve/Steam/apps/<appid>/LaunchOptionsin that account. Support inserting a missing game node or option inside an otherwise supported existingappshierarchy. Do not fabricate an account file or missing top-level Steam hierarchy. - Preserve comments, whitespace, BOM, line endings, unknown fields and all other game/account bytes. Extend the bounded syntax reader with insertion spans and correct quoted-value escaping; do not introduce whole-VDF serialization. Ambiguous/duplicate keys, unsupported encoding/structure, unsafe paths, reparse points, read-only or locked files stop the operation.
- Keep the generated contract exactly
"<stable-runner-path>" --appid "<appid>" -- %command%. Applying Steam settings changes neither TOML serialization nor Runner’s launch/wait behavior.
Steam’s official player instructions describe the Properties → General → Launch Options field. Local VDF files are private implementation details; the target path and client behavior must be verified against the actual Steam version used for acceptance.
Reuse and code boundaries
Section titled “Reuse and code boundaries”Keep discovery/profile/Runner readiness in SteamWrapper.Application, and dialogs, clipboard and the explicit Open Steam action in SteamWrapper.Manager. Extend the GUI-independent Steam setting service in SteamWrapper.Deployment, shared with uninstall. Extract only the VDF span editing and guarded file mutation needed by apply/restore from SteamLaunchRestoration; keep existing legacy-clear tests and exact-command rules. Do not add a general transaction framework, Rust bridge, management process, background watcher or service.
Use a prepared inspection bound to account, AppID, data root, saved-profile revision and current file bytes. Confirmation alone is not authority to overwrite a changed snapshot. Under the existing data lock, revalidate the profile, shared Runner readiness/location, account paths, Steam process state and file snapshot immediately before mutation. Agree on one lock order with saves, removal, Runner preparation and uninstall; do not reacquire a lock held by the caller. Never hold a mutation lock while waiting for the player to close Steam or confirm a dialog.
Backup and recovery record
Section titled “Backup and recovery record”Use the existing private backups/steam-launch-options/<operation-id>/ area for a small versioned operation record and original file snapshot. Record the validated Steam/account/AppID/data-root identity, original value/token and whether the key existed, applied value, bounded snapshot hashes and operation phase. Validate the original token against its snapshot before reusing it. Keep the first recoverable original for an active integration. Repeated application is an idempotent success only when the current target still equals the authoritative recorded applied value and no pending/conflicting operation exists; it must not replace the original with the Runner command or overwrite an external edit. A manually pasted identical command without an original record is recognized integration with an unknown original, not authority to create a historical restore record. Unknown or ambiguous record versions block automatic writes and remain preserved. Bound record/file sizes and inventory scans; do not silently prune restoration backups.
The record and snapshot must be written, flushed and verified before replacing Steam’s file. Record temporary/adjacent backup identities before mutation so an interrupted operation can locate them without guessing. These are local recovery data, not new Release attachments. Full real Steam snapshots stay on the local machine, protected by the user’s filesystem permissions; never commit them, upload them in CI artifacts or expose their contents in diagnostics.
Use a minimal operation lifecycle: prepared → applied → restoring → restored, with canceled/conflict outcomes and pending work recoverable from the recorded bytes. Restoration takes its own current-file snapshot. On Manager startup or an explicit retry, inspect pending records without changing Steam; recovery writes require Steam to be stopped and the same conflict checks. Exact unchanged before/after snapshots can resolve a completed or unstarted step. Anything inconsistent remains a reviewable conflict, rather than an automatic overwrite.
Reopening Manager or selecting a profile rereads the target and records; an applied flag or cached UI label is not current-state evidence. Distinguish a verified disk write from verification in the Steam client. Do not add a permanent watcher to keep that distinction up to date.
Write and restore rules
Section titled “Write and restore rules”- Build the replacement from the confirmed current snapshot, flush a unique same-directory temporary file and verify it. Keep temporary and replacement-backup files on Steam’s volume; archive the actual replaced file into the data backup area only after verifying that copy. Steam and LocalAppData may be on different drives.
- Reserve/recheck the source, recheck Steam immediately before replacement, replace with a unique adjacent backup, and verify both the actual replaced bytes and the resulting target. Recheck Steam again before committing
appliedand reporting success; if it has started, retain the operation and backups as unconfirmed for review. These checks narrow the race rather than prevent Steam from starting atomically. Flush the operation record before claiming success. Preserve existing data/installation locks and cancellation checks; cancellation after replacement cannot be reported as “nothing changed.” - Do not equate replacement with an atomic compare-and-swap. A non-cooperating rename or Steam startup can race the last check. If actual replaced bytes differ from the snapshot, or post-write verification fails, retain all recovery copies, stop further writes and report an unresolved operation. Do not automatically put a whole old file over a later edit. File.Replace and ReplaceFileW define replacement/backup behavior, not a conditional expected-content API.
- Restore previous Launch Options operates on the recorded account/AppID only. Read the latest file and restore the original value only if the current target still exactly equals the recorded applied value. Preserve later changes to other games. If the original key was absent, remove only the owned inserted key; do not delete a game node containing later data. Empty and absent original values remain distinct.
- If the target was edited externally, show the current and recorded values and stop automatic restoration. If already restored, report a no-op; do not rewrite the file. If the command was pasted manually and there is no authoritative original record, retain the separately labeled legacy Restore normal Steam launch action that clears only an exact recognized command, without claiming to restore unknown old arguments.
Before-write parse/backup/conflict failures preserve the original file. After-mutation failures preserve verified recovery material and explain the uncertain state. Ordinary file replacement is not a guarantee against every physical power-loss, disk-failure or future Steam format change.
Removal, uninstall and compatibility
Section titled “Removal, uninstall and compatibility”The new release’s explicit uninstall Steam-restoration choice must share the recorded original-value restoration rules; default uninstall still leaves Steam and user data alone. Preserve the existing seven cleanup choices and legacy recognized-command clearing. Conflicts, unknown records and unresolved adjacent backups are retained and reported. They block relevant profile/Runner cleanup when safety cannot be established; a complete all-account reference scan remains mandatory, including profile Key and AppID aliases. Existing restoration backups and update trust state never become general cleanup targets.
The shared uninstall path holds the data lock across inspection, restoration, final reference checks and selected profile/Runner deletion. An internal already-locked cleanup entry point avoids recursive lock acquisition, retaining the installation and Runner locks in the agreed order. Historical segmented scan/cleanup does not establish this continuous lock.
Repeated save/apply, program relocation, portable movement, upgrade/rollback and an older Manager encountering the new data must preserve recovery material. Moving Manager must not change the stable Runner command. Frozen historical helpers are not silently upgraded into provenance-aware restorers: their observed clears are detected as changed state, with no invented historical original or blind replay. The agent guide now defines the implemented Steam-write boundary; design requirements and dated acceptance evidence retain their separate scope.
Implementation order and acceptance
Section titled “Implementation order and acceptance”| Step | Deliverable | Required evidence before proceeding |
|---|---|---|
| 1. Inspect and prepare | Account discovery, selected-setting inspection, insertion-capable bounded VDF editor and prepared preview | Red-then-green focused tests for missing/present values/nodes, account identity, escaping and exact unrelated-byte preservation; no Steam mutation |
| 2. Apply and restore | Durable backup/record, guarded mutation, idempotency and pending-operation recovery | Fault injection before/after replacement and record writes; concurrency/Steam-start/lock/readonly/unsafe-path and same-/cross-volume cases; source tests alone do not prove Steam UI persistence |
| 3. Native player flow | Save/apply confirmation, normal-exit retry, accurate partial-success/conflict messages, restore and manual-copy alternative | Real compiled WinUI fixture tests in both languages, cancel/keyboard/layout, restart of Manager and preserved unsaved/custom input; no false applied status |
| 4. Shared cleanup | Record-aware selected restoration, uninstall and removal guards | Existing legacy-clear and installer-option regressions plus new record/conflict/default-preservation/upgrade/rollback cases; unknown files and games preserved |
| 5. Actual Steam and delivery | Separately scoped single-galgame acceptance, then a new coordinated numeric release | Exact Steam Properties value after reopening and after a second restart; original/nonempty/absent restoration and later-edit protection; normal Steam Play with Manager closed; unchanged non-save game files and protected saves/cloud; full tag gates and public asset/update-feed verification |
Automated cases use disposable Steam/user-data fixtures and deterministic process/failure hooks. Add each behavioral regression and observe its intended failure before implementing it. Start with focused Deployment/Application tests; run WinUI tests and cross-language contracts when their paths change, relevant installer/handoff gates for shared cleanup, and bilingual documentation checks. Merge CI runs relevant tests/compilation; only version-tag publication builds release Setup/ZIP. Do not add duplicate long-running jobs or weaken release gates.
The authorized real-library galgame session requires checking the current desktop/game state before any operation, recording/restoring exact original Launch Options and local file integrity, and stopping on unresolved cloud/save conflicts. Start Manager from ordinary Explorer in the Steam user’s Windows account and verify actual shared AppData/Runner file locations; a development host’s private file view is not proof that Steam can access them. The local candidate passed the scoped Episode 1 application, two-client-restart persistence, closed-Manager launch and recorded-nonempty-original restoration checks; Testing records unchanged non-save files, natural engine save updates and the user’s exact command reset. This establishes the tested client’s persistence, not a guarantee for every future client. The final local publication’s isolated installer/options, all bilingual native cleanup selections, actual update handoff and 18-step clean Sandbox upgrade also passed. The exact-tag public assets/four signed feeds, two downloaded NativeAOT Host cases and the 18-step exact public 0.2.8 → 0.2.9 clean Sandbox upgrade passed separately. Public and local candidate binaries are distinct artifacts; the public installer fixture does not add live-game, fresh standard-account, two-user or hardware coverage. Retain manual copying and the existing safety fallback.