Skip to content

feat: auto-set Steam Launch Options after MelonLoader install#6

Open
kkorenn wants to merge 1 commit into
modlist-org:mainfrom
kkorenn:feat/auto-steam-launch-options
Open

feat: auto-set Steam Launch Options after MelonLoader install#6
kkorenn wants to merge 1 commit into
modlist-org:mainfrom
kkorenn:feat/auto-steam-launch-options

Conversation

@kkorenn

@kkorenn kkorenn commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

What

After a MelonLoader install, the app now writes the required Steam Launch Options automatically instead of only showing a guide and asking the user to paste "…/setup_helper.sh" %command% by hand. It's cleared again on uninstall.

Ported the targeted localconfig.vdf editor from the reference Swift installer (sbrothers7/UMMInstallSteamConfig.swift) to cross-platform Dart.

How

  • lib/src/core/steam_config.dart (new): finds every userdata/<id>/config/localconfig.vdf across detected Steam roots (macOS/Linux/Windows) and does a scoped, backup-first, atomic edit of apps → <appid> → LaunchOptions — no full re-serialize, so the rest of the file is preserved byte-for-byte. The scan is brace/quote-aware (handles nested blocks and \"-escaped values). clear() only blanks the value when it still references one of our wrappers, so a user's own custom launch options are never touched.
  • Game.steamLaunchOptionsValue() / isProtonOrWineInstall(): compute the correct value per game + platform — macOS native (absolute script path), Linux native (./setup_helper.sh %command%), Proton/Wine (WINEDLLOVERRIDES="winhttp=n,b" %command%), Windows (none).
  • InstallerState: applies after a successful install, clears on uninstall, and exposes flags so the UI shows an auto-set confirmation (with a "fully restart Steam" hint when Steam is running, since Steam rewrites localconfig.vdf on exit). The existing manual guide stays as a fallback.
  • Localization for ko-KR / en-US / zh-CN.

Safety / fallback

  • Best-effort: any failure (Steam not installed, no localconfig.vdf, write error) is logged and the manual guide remains the fallback — install never fails because of this.
  • A .modlist.bak backup is written before each edit.
  • Applies to all three games via their existing steamAppId (ADOFAI 977950, Rhythm Doctor 774181, Dancing Line 4395300).

Tests

test/steam_config_test.dart — 17 cases covering the pure VDF editor: replace/insert LaunchOptions, insert a missing app block, apps-scoping vs decoys, case-insensitivity, escaped-quote handling, and the clear-only-our-wrapper rule. Full suite green (flutter test, 25 passing).

Note

Heads-up for maintainers: writing into localconfig.vdf only sticks if Steam is fully quit; the code detects a running Steam and surfaces a restart hint. Worth a manual smoke-test on each platform.

🤖 Generated with Claude Code

Until now the app only showed a guide telling users to paste
"setup_helper.sh" %command% into Steam's per-game Launch Options by
hand. Port the targeted localconfig.vdf editor from the reference Swift
installer (sbrothers7/UMMInstall) to Dart so the wrapper is wired up
automatically on install and cleared on uninstall.

- steam_config.dart: cross-platform (macOS/Linux/Windows) localconfig.vdf
  reader/editor. Does a scoped, backup-first, atomic edit of the
  apps -> <appid> -> LaunchOptions value rather than re-serializing, so
  the rest of the file is preserved. Brace/quote-aware scan handles
  nested blocks and escaped quotes; clear() only removes our own wrapper
  so a user's custom launch options are left untouched.
- Game.steamLaunchOptionsValue()/isProtonOrWineInstall(): compute the
  correct value per game + platform (macOS absolute path, Linux native
  relative path, Proton/Wine WINEDLLOVERRIDES). Windows = none.
- InstallerState: apply after a successful install, clear on uninstall,
  surface an auto-set confirmation (with a "restart Steam" hint when
  Steam is running) above the existing manual guide, which stays as a
  fallback.
- Localization for ko-KR / en-US / zh-CN.
- Unit tests for the VDF editor (set/insert/scope/case/escaping/clear).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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