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 <[email protected]> (cherry picked from commit 9f05995e1752dcd5a4e2698c0ea54d523df83940)
This commit is contained in:
1 parent
9fed8976af
commit
ed81cb9ee0
1 file changed
+17
@@ -113,7 +113,16 @@ const SETTINGS: &[(&str, &str)] = &[
|
|||||||
/// Path settings a start keeps from its surroundings; every other
|
/// Path settings a start keeps from its surroundings; every other
|
||||||
/// `VICTORY_...` variable is cleared before the settings are put in (a
|
/// `VICTORY_...` variable is cleared before the settings are put in (a
|
||||||
/// restart from the menu inherits the last run's).
|
/// 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] = &[
|
const KEPT: &[&str] = &[
|
||||||
|
"VICTORY_HOME",
|
||||||
|
"VICTORY_ADAPTER",
|
||||||
"VICTORY_CONFIG",
|
"VICTORY_CONFIG",
|
||||||
"VICTORY_GAME_DIR",
|
"VICTORY_GAME_DIR",
|
||||||
"VICTORY_CACHE_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(""));
|
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]
|
#[test]
|
||||||
fn stamps_are_dates() {
|
fn stamps_are_dates() {
|
||||||
assert_eq!(stamp(0), "19700101-000000");
|
assert_eq!(stamp(0), "19700101-000000");
|
||||||
|
|||||||
Reference in new issue
Block a user