From 2f25b5cb4d42f806faac8bce317b024b85b174b6 Mon Sep 17 00:00:00 2001 From: zasbu <136494048+zasbu@users.noreply.github.com> Date: Fri, 13 Nov 2026 18:28:53 +1100 Subject: [PATCH 1/3] Allow Play to reuse a saved Battle.net login --- crates/core/src/config.rs | 5 +++ crates/launcher-gui/evals/play-login.sh | 16 +++++++ crates/launcher-gui/src/tests.rs | 54 ++++++++++++++++++++++++ crates/launcher-gui/src/update/launch.rs | 16 ++++++- docs/local-play-login.md | 22 ++++++++++ 5 files changed, 111 insertions(+), 2 deletions(-) create mode 100755 crates/launcher-gui/evals/play-login.sh create mode 100644 docs/local-play-login.md diff --git a/crates/core/src/config.rs b/crates/core/src/config.rs index eda617ba..4d7607d0 100644 --- a/crates/core/src/config.rs +++ b/crates/core/src/config.rs @@ -75,6 +75,10 @@ pub struct Config { /// honoured only when [`crate::battlenet::signs_in_by_itself`]. #[serde(default = "yes")] pub battle_net_minimized: bool, + /// Route the main Play button through Battle.net to reuse its saved sign-in. + /// Direct launches remain the default for existing installations. + #[serde(default)] + pub play_via_battle_net: bool, /// Whether PLAY closes a running Battle.net first. Off by default, so /// friends and chat stay up. #[serde(default)] @@ -185,6 +189,7 @@ impl Default for Config { pause_downloads_while_playing: true, minimize_on_launch: false, battle_net_minimized: true, + play_via_battle_net: false, close_battle_net_on_play: false, battle_net_in_background: false, battle_net_tweaks: crate::tweaks::Tweaks::default(), diff --git a/crates/launcher-gui/evals/play-login.sh b/crates/launcher-gui/evals/play-login.sh new file mode 100755 index 00000000..47e9e2d3 --- /dev/null +++ b/crates/launcher-gui/evals/play-login.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Deterministic behavior evaluation. No credentials or live game launch. +set -euo pipefail +cd "$(dirname "$0")/../../.." +checks=( + play_uses_the_configured_login_path + play_login_preference_survives_saving_and_old_configs_stay_direct + saved_login_play_does_not_offer_a_loop_when_battle_net_wants_an_update + a_hand_off_waits_while_the_background_client_signs_in + a_game_lightforge_manages_is_never_updated_through_the_client + stop_asks_first_and_play_comes_back_when_the_game_is_gone +) +for check in "${checks[@]}"; do + cargo test --release --locked -p lightforge-gui "tests::$check" -- --exact +done +printf 'PASS: %s/%s saved-login behavior checks\n' "${#checks[@]}" "${#checks[@]}" diff --git a/crates/launcher-gui/src/tests.rs b/crates/launcher-gui/src/tests.rs index a8e7b5a8..f50a2850 100644 --- a/crates/launcher-gui/src/tests.rs +++ b/crates/launcher-gui/src/tests.rs @@ -2131,3 +2131,57 @@ fn a_battle_net_repair_waits_for_a_running_setup() { let _ = app.update(Message::RepairBattleNet); assert!(app.error.is_some()); } + +/// Exercise the real Play event without executing Proton: addon completion +/// holds the chosen launch intent at the same boundary as a normal launch. +#[test] +fn play_uses_the_configured_login_path() { + for via_client in [false, true] { + let (mut app, _scratch) = test_app(); + app.dirs = None; + app.queue.clear(); + app.config.play_via_battle_net = via_client; + app.addon_auto_running = true; + app.local = Local { + build_key: Some("abc".to_owned()), + version: Some("11.2.7.65000".to_owned()), + executable: Some(PathBuf::from("/nowhere/Wow.exe")), + store_files: 12, + staged: None, + portal: None, + }; + assert!(matches!(app.action(), ActionState::Play)); + let _ = app.update(Message::Primary); + assert_eq!(app.launch_after_addons, Some(if via_client { + Launch::BattleNet + } else { + Launch::Game + })); + } +} + +#[test] +fn play_login_preference_survives_saving_and_old_configs_stay_direct() { + let (app, _scratch) = test_app(); + let file = app.dirs.as_ref().unwrap().config_file(); + let legacy = std::fs::read_to_string(&file).unwrap() + .replace("play_via_battle_net = false\n", ""); + assert!(!legacy.contains("play_via_battle_net")); + std::fs::write(&file, legacy).unwrap(); + assert!(!Config::load_or_default(&file).unwrap().play_via_battle_net); + let mut config = app.config.clone(); + config.play_via_battle_net = true; + config.save(&file).unwrap(); + assert!(Config::load_or_default(&file).unwrap().play_via_battle_net); +} + +#[test] +fn saved_login_play_does_not_offer_a_loop_when_battle_net_wants_an_update() { + let (mut app, _scratch) = test_app(); + app.dirs = None; + app.config.play_via_battle_net = true; + let _ = app.update(Message::HandoffStarted(Ok(tasks::Handoff::NeedsUpdate))); + let error = app.error.as_ref().unwrap().to_string(); + assert!(error.contains("refresh Lightforge"), "{error}"); + assert!(!error.contains("press Play"), "{error}"); +} diff --git a/crates/launcher-gui/src/update/launch.rs b/crates/launcher-gui/src/update/launch.rs index 7bd6b838..48aae139 100644 --- a/crates/launcher-gui/src/update/launch.rs +++ b/crates/launcher-gui/src/update/launch.rs @@ -34,7 +34,14 @@ impl Lightforge { self.pause(&self.selected.code.clone()); Task::none() } - ActionState::Play => self.preflight(Launch::Game), + ActionState::Play => { + let launch = if self.config.play_via_battle_net { + Launch::BattleNet + } else { + Launch::Game + }; + self.preflight(launch) + }, ActionState::Unknown => Task::none(), // Nothing to download and nothing to repair: look for the // drive again, and reload the product if it came back. @@ -169,7 +176,12 @@ impl Lightforge { match (Kind::of(&code), self.config.battle_net_in_background) { // Its store is ours: Agent must not patch it. (Kind::Managed, _) => { - self.launch_failed("Battle.net wants to update this game — press Play to start it here") + let why = if self.config.play_via_battle_net { + "Battle.net requires a game update — refresh Lightforge and update the game before playing" + } else { + "Battle.net wants to update this game — press Play to start it here" + }; + self.launch_failed(why) } (Kind::HandOff, false) => { self.launch_failed("Battle.net has an update for this game — open Battle.net to install it") diff --git a/docs/local-play-login.md b/docs/local-play-login.md new file mode 100644 index 00000000..4c6613be --- /dev/null +++ b/docs/local-play-login.md @@ -0,0 +1,22 @@ +# Saved login from Play + +Set `play_via_battle_net = true` in the top level of Lightforge's +`config.toml` while Lightforge is closed. Play then uses the existing +Battle.net hand-off, including preflight, addon waits and game tracking. +Install, update, pause and Stop retain their existing actions. The default +is false; removing the setting restores direct launches. + +Battle.net must have a saved sign-in. Keep `battle_net_minimized = true` +to start it minimized when that saved sign-in is available. Authentication +expiry, two-factor challenges and Battle.net outages can still require +interaction. Lightforge does not store your password. + +Verification: the GUI tests exercise both Play routes and configuration +persistence. Existing preflight and Battle.net tests cover readiness and +session tracking. The live check is to restart Lightforge, click Play, +and confirm WoW reaches character selection without entering a password. +A package update can replace this locally built binary; the source branch +retains the change for rebuilding. + +Run the deterministic behavior evaluation with +`bash crates/launcher-gui/evals/play-login.sh`. All six checks must pass. From 655a57bf00066b14b313dad5a80c469ed4bf4c2a Mon Sep 17 00:00:00 2001 From: zasbu <136494048+zasbu@users.noreply.github.com> Date: Fri, 13 Nov 2026 18:37:40 +1100 Subject: [PATCH 2/3] Document Battle.net adoption before saved-login launches --- docs/local-play-login.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/local-play-login.md b/docs/local-play-login.md index 4c6613be..143ef9f6 100644 --- a/docs/local-play-login.md +++ b/docs/local-play-login.md @@ -20,3 +20,9 @@ retains the change for rebuilding. Run the deterministic behavior evaluation with `bash crates/launcher-gui/evals/play-login.sh`. All six checks must pass. + +If Battle.net marks a current Lightforge installation as Update, open its +WoW page and let that update finish once. Matching build numbers alone do +not mean Battle.net considers an adopted installation playable. Wait until +its state is UpToDate, then retry Play in Lightforge. Do not work around +this by skipping its update guard or falling back to a password prompt. From 92fcadef02d8c2da31619cd480f5cf7039c45fc0 Mon Sep 17 00:00:00 2001 From: zasbu <136494048+zasbu@users.noreply.github.com> Date: Fri, 13 Nov 2026 18:40:41 +1100 Subject: [PATCH 3/3] Record background client requirement for seamless saved login --- docs/local-play-login.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/local-play-login.md b/docs/local-play-login.md index 143ef9f6..fcd14ef6 100644 --- a/docs/local-play-login.md +++ b/docs/local-play-login.md @@ -6,7 +6,10 @@ Battle.net hand-off, including preflight, addon waits and game tracking. Install, update, pause and Stop retain their existing actions. The default is false; removing the setting restores direct launches. -Battle.net must have a saved sign-in. Keep `battle_net_minimized = true` +Battle.net must have a saved sign-in. Also enable +`battle_net_in_background = true` (Seamless Battle.net Mode), so hiding its +window during the hand-off sends it to the tray instead of quitting it. +Keep `battle_net_minimized = true` to start it minimized when that saved sign-in is available. Authentication expiry, two-factor challenges and Battle.net outages can still require interaction. Lightforge does not store your password.