From ed81cb9ee09d65a6192540f999b8aacd303365a4 Mon Sep 17 00:00:00 2001 From: victory-contributor Date: Fri, 27 Nov 2026 23:41:57 +0000 Subject: [PATCH] play: keep VICTORY_HOME and VICTORY_ADAPTER through prepare (#472) `prepare` clears every VICTORY_ variable not in KEPT before putting the play settings in. VICTORY_HOME and VICTORY_ADAPTER were not in KEPT, but both are read again after the clearing: - Config::load in run resolves the cache and save folders, so with VICTORY_HOME set they still went to %LOCALAPPDATA%\victory (#472). - The F1 menu's restart and the warm-up restart inherit this process's environment, so the next start read victory-settings.txt from %LOCALAPPDATA% instead of VICTORY_HOME, and its saved choices seemed lost. - hardware_adapter reads VICTORY_ADAPTER when the host device is made, so a named card was passed over for the one with the most memory. Adds both to KEPT, with a test. Co-Authored-By: Claude Opus 5.5 (cherry picked from commit 9f05995e1752dcd5a4e2698c0ea54d523df83940) --- apps/victory/src/play.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/apps/victory/src/play.rs b/apps/victory/src/play.rs index db9b5f4..562d078 100644 --- a/apps/victory/src/play.rs +++ b/apps/victory/src/play.rs @@ -113,7 +113,16 @@ const SETTINGS: &[(&str, &str)] = &[ /// Path settings a start keeps from its surroundings; every other /// `VICTORY_...` variable is cleared before the settings are put in (a /// restart from the menu inherits the last run's). +/// +/// `VICTORY_HOME` and `VICTORY_ADAPTER` are read again after the clearing: +/// the cache and save folders (`Config::load` in `run`), the restart the F1 +/// menu or the warm-up starts (which inherits this environment), and the +/// card the host device is made on. Cleared, the caches and saves went to +/// `%LOCALAPPDATA%` with `VICTORY_HOME` set (#472), and a named card was +/// passed over for the one with the most memory. const KEPT: &[&str] = &[ + "VICTORY_HOME", + "VICTORY_ADAPTER", "VICTORY_CONFIG", "VICTORY_GAME_DIR", "VICTORY_CACHE_DIR", @@ -1102,6 +1111,14 @@ mod tests { assert!(!older_rtx("NVIDIA RTX A2000") && !older_rtx("AMD Radeon RX 7900 XTX") && !older_rtx("")); } + /// Settings read again after `prepare` clears the others survive it. + #[test] + fn paths_and_the_named_card_are_kept() { + for k in ["VICTORY_HOME", "VICTORY_ADAPTER", "VICTORY_CACHE_DIR", "VICTORY_DATA_DIR"] { + assert!(KEPT.contains(&k), "{k}"); + } + } + #[test] fn stamps_are_dates() { assert_eq!(stamp(0), "19700101-000000");