diff --git a/apps/victory/src/play.rs b/apps/victory/src/play.rs index 31bbef8..141e932 100644 --- a/apps/victory/src/play.rs +++ b/apps/victory/src/play.rs @@ -108,6 +108,11 @@ const SETTINGS: &[(&str, &str)] = &[ ("VICTORY_LEAVE_OUT", "02384a60fda6f2d0,731a39171b568298"), // Pipelines the title makes are written down, for `victory warm` ("VICTORY_PIPELINE_BOOK", "1"), + // Memory stack (skornuta): texture slots left unused are given back, old command allocators + // are taken anew, small buffers share card memory (off since .8; on again 2026-11-28) + ("VICTORY_SLOT_EVICT", "1"), + ("VICTORY_ALLOCATOR_TRIM", "1"), + ("VICTORY_BUDGET_PACK", "1"), ]; /// Path settings a start keeps from its surroundings; every other @@ -136,6 +141,11 @@ const FG_TYPES: [&str; 3] = ["auto", "dlss", "fsr"]; const RESOLUTIONS: [&str; 3] = ["1440", "1080to1440", "4k"]; const DLSS_MODES: [&str; 5] = ["off", "dlaa", "quality", "balanced", "performance"]; +/// The Series S scene heights the F1 menu offers and the DLSS mode of each: the picture +/// is 1920x1080, the scene that mode's share of it (720: the game's own size, and what +/// it stays at without DLSS: the title's own FidelityFX path from 540 stopped it at the +/// start, 0xc0000094, a division by zero in the title, 2026-11-28). +const S_SIZES: [(&str, &str); 4] = [("1080", "dlaa"), ("720", "quality"), ("626", "balanced"), ("540", "performance")]; #[derive(clap::Args, Clone, Debug)] pub(crate) struct Play { @@ -281,7 +291,19 @@ fn settings(o: &Play, menu: &[(String, String)], streamline: Option<&Path>) -> ( let saved = |k: &str| menu.iter().rev().find(|(n, _)| n == k).map(|(_, v)| v.as_str()); let series_s = saved("VICTORY_MENU_CONSOLE").map_or(o.series_s, |c| c == "series-s"); let res = saved("VICTORY_MENU_RES").filter(|r| RESOLUTIONS.contains(r)).unwrap_or(&o.res); - let dlss = saved("VICTORY_MENU_DLSS").filter(|d| DLSS_MODES.contains(d)).unwrap_or(&o.dlss); + let mut dlss = saved("VICTORY_MENU_DLSS").filter(|d| DLSS_MODES.contains(d)).unwrap_or(&o.dlss); + // Series S picture: the scene's size, which with DLSS on is its mode (the menu keeps the + // two matched); not saved yet, it is the DLSS mode's. + let s_res = saved("VICTORY_MENU_S_RES") + .and_then(|r| S_SIZES.iter().find(|(h, _)| *h == r)) + .or_else(|| S_SIZES.iter().find(|(_, m)| *m == dlss)) + .map_or("720", |(h, _)| *h); + if series_s + && dlss != "off" + && let Some((_, mode)) = S_SIZES.iter().find(|(h, _)| *h == s_res) + { + dlss = *mode; + } // 0: off; 2 to 6: that many frames shown for each one rendered (1, from an older file: 2). let (mut framegen, mut times) = (o.framegen.is_some(), o.framegen.unwrap_or(2)); if let Some(saved) = saved("VICTORY_MENU_FRAMEGEN") { @@ -362,6 +384,7 @@ fn settings(o: &Play, menu: &[(String, String)], streamline: Option<&Path>) -> ( let mut set = |k: &str, v: &str| drop(s.insert(k.to_owned(), v.to_owned())); set("VICTORY_MENU_CONSOLE", if series_s { "series-s" } else { "series-x" }); set("VICTORY_MENU_RES", res); + set("VICTORY_MENU_S_RES", if dlss_on { s_res } else { "720" }); set("VICTORY_MENU_DLSS", if dlss_on { dlss } else { "off" }); set("VICTORY_MENU_FRAMEGEN", &framegen_x.unwrap_or(0).to_string()); set("VICTORY_MENU_FG_TYPE", fg_type); @@ -1100,6 +1123,37 @@ mod tests { assert_eq!(get("VICTORY_MENU_FRAMEGEN"), Some("6")); } + #[test] + fn the_series_s_picture_sets_the_scene() { + let get = |s: &BTreeMap, k: &str| s.get(k).cloned(); + let s_menu = |more: &str| parse_menu(&format!("VICTORY_MENU_CONSOLE=series-s\r\n{more}")); + // not saved yet: the DLSS mode's size, and the mode as it was + let (s, _) = settings(&options(), &s_menu("VICTORY_MENU_DLSS=balanced\r\n"), Some(Path::new("x"))); + assert_eq!(get(&s, "VICTORY_MENU_S_RES").as_deref(), Some("626")); + assert_eq!(get(&s, "VICTORY_DLSS_MODE").as_deref(), Some("balanced")); + // 540 with DLSS: its performance mode, whatever the DLSS line held + let (s, _) = settings(&options(), &s_menu("VICTORY_MENU_DLSS=quality\r\nVICTORY_MENU_S_RES=540\r\n"), Some(Path::new("x"))); + assert_eq!(get(&s, "VICTORY_DLSS_MODE").as_deref(), Some("performance")); + assert_eq!(get(&s, "VICTORY_MENU_DLSS").as_deref(), Some("performance")); + assert_eq!(get(&s, "VICTORY_FSR_PATH"), None); + // DLAA is 1080 + let (s, _) = settings(&options(), &s_menu("VICTORY_MENU_DLSS=dlaa\r\n"), Some(Path::new("x"))); + assert_eq!((get(&s, "VICTORY_DLSS_MODE").as_deref(), get(&s, "VICTORY_MENU_S_RES").as_deref()), (Some("dlaa"), Some("1080"))); + // without DLSS (off, or no NVIDIA files): the game's 720, never the title's FidelityFX path + for (more, dir) in [("VICTORY_MENU_DLSS=off\r\nVICTORY_MENU_S_RES=540\r\n", Some(Path::new("x"))), ("VICTORY_MENU_S_RES=540\r\n", None)] { + let (s, _) = settings(&options(), &s_menu(more), dir); + assert_eq!((get(&s, "VICTORY_DLSS"), get(&s, "VICTORY_FSR_PATH"), get(&s, "VICTORY_DLSS_MODE")), (None, None, None)); + assert_eq!(get(&s, "VICTORY_MENU_S_RES").as_deref(), Some("720")); + } + // 720 without DLSS: the game as it is + let (s, _) = settings(&options(), &s_menu("VICTORY_MENU_DLSS=off\r\nVICTORY_MENU_S_RES=720\r\n"), None); + assert_eq!((get(&s, "VICTORY_FSR_PATH"), get(&s, "VICTORY_DLSS_MODE")), (None, None)); + // Series X: the Series S size changes nothing + let (s, series_s) = settings(&options(), &parse_menu("VICTORY_MENU_S_RES=540\r\n"), Some(Path::new("x"))); + assert!(!series_s); + assert_eq!((get(&s, "VICTORY_DLSS_MODE").as_deref(), get(&s, "VICTORY_FSR_PATH")), (Some("quality"), None)); + } + #[test] fn options_and_set_are_applied() { let mut o = options(); diff --git a/crates/victory-gpu/src/host/menu.rs b/crates/victory-gpu/src/host/menu.rs index bd46abb..906674e 100644 --- a/crates/victory-gpu/src/host/menu.rs +++ b/crates/victory-gpu/src/host/menu.rs @@ -111,6 +111,19 @@ const ABOUT_FRAMEGEN_RESTART: [&str; 3] = [ "AFTER THAT IT CHANGES, OR TURNS OFF, LIVE.", ]; const FRAMEGEN: &str = "VICTORY_MENU_FRAMEGEN"; +/// The console, and the picture row of each: only the one of the console picked is shown. +const CONSOLE: &str = "VICTORY_MENU_CONSOLE"; +const X_RES: &str = "VICTORY_MENU_RES"; +const S_RES: &str = "VICTORY_MENU_S_RES"; +/// The Series S scene sizes and the DLSS mode of each (the picture is 1920x1080). Only DLSS +/// changes it: the title's own FidelityFX path from 540 stopped it at the start (0xc0000094, +/// a division by zero in the title, 2026-11-28), so with DLSS off the scene stays at 720. +const S_MODES: [(&str, &str); 4] = [("1080", "dlaa"), ("720", "quality"), ("626", "balanced"), ("540", "performance")]; +const ABOUT_S_RES: [&str; 3] = [ + "THE SIZE THE GAME RENDERS AT. THE PICTURE IS 1920X1080.", + "OTHER THAN 720 NEEDS DLSS: THIS SETS ITS MODE (1080 IS", + "DLAA, 720 QUALITY, 626 BALANCED, 540 PERFORMANCE).", +]; /// The note after the first Enter on it: the second one does it. const CONFIRM_PRELOAD: &str = "ENTER AGAIN: SAVE, CLOSE THE GAME AND PRELOAD"; /// The last line of the box: where this build comes from. @@ -148,7 +161,9 @@ const ITEMS: &[Item] = &[ Item { var: "VICTORY_MOUSE_CAPTURE", label: "MOUSE CAPTURE", values: UNSET_ON, live: false }, Item { var: "VICTORY_IME_ENGLISH", label: "ENGLISH KEYBOARD", values: UNSET_ON, live: false }, Item { var: "VICTORY_MENU_CONSOLE", label: "CONSOLE", values: &[("series-x", "SERIES X"), ("series-s", "SERIES S (FASTER)")], live: false }, - Item { var: "VICTORY_MENU_RES", label: "SERIES X PICTURE", values: &[("1440", "2560X1440"), ("1080to1440", "1080P TO 1440P"), ("4k", "3840X2160")], live: false }, + Item { var: X_RES, label: "SERIES X PICTURE", values: &[("1440", "2560X1440"), ("1080to1440", "1080P TO 1440P"), ("4k", "3840X2160")], live: false }, + // In place of SERIES X PICTURE when CONSOLE is Series S. + Item { var: S_RES, label: "SERIES S PICTURE", values: &[("1080", "1920X1080 (DLAA)"), ("720", "1280X720 (THE GAME)"), ("626", "1113X626"), ("540", "960X540 (FASTEST)")], live: false }, // The layer's switches. Item { var: "VICTORY_DLSS_PRESET", label: "DLSS MODEL", values: &[("", "DEFAULT"), ("k", "K"), ("j", "J"), ("m", "M"), ("l", "L")], live: false }, Item { var: "VICTORY_AMBIENT", label: "LIGHT ESTIMATE", values: &[("0.8", "0.8"), ("1", "1"), ("0.5", "0.5"), ("", "OFF")], live: false }, @@ -483,18 +498,46 @@ impl Menu { crate::SETTINGS_MENU_OPEN.load(Ordering::Relaxed) } + /// The value of the setting `var` as the menu holds it now. + fn value(&self, var: &str) -> &str { + ITEMS.iter().position(|i| i.var == var).map_or("", |i| self.values[i].as_str()) + } + + /// Row `row` is left out: the picture row of the console not picked. + fn hidden(&self, row: usize) -> bool { + let series_s = self.value(CONSOLE) == "series-s"; + ITEMS.get(row).is_some_and(|i| if series_s { i.var == X_RES } else { i.var == S_RES }) + } + + /// The rows shown, settings then actions. + fn rows(&self) -> Vec { + (0..ITEMS.len() + ACTIONS.len()).filter(|r| !self.hidden(*r)).collect() + } + + /// The row shown `step` (+1 / -1) from the one picked, round the ends. + fn step(&self, step: isize) -> usize { + let rows = self.rows(); + let n = rows.len() as isize; + match rows.iter().position(|r| *r == self.at) { + Some(p) => rows[(p as isize + step).rem_euclid(n) as usize], + None => rows.iter().copied().find(|r| *r > self.at).unwrap_or(rows[0]), + } + } + fn lines(&self) -> Vec { if self.picking { return self.pick_lines(); } - let total = ITEMS.len() + ACTIONS.len(); - let first = self.at.saturating_sub(ROWS / 2).min(total.saturating_sub(ROWS)); + let rows = self.rows(); + let total = rows.len(); + let at = rows.iter().position(|r| *r == self.at).unwrap_or(0); + let first = at.saturating_sub(ROWS / 2).min(total.saturating_sub(ROWS)); let mut out = vec![ "SETTINGS F1 OR ESC CLOSES".to_owned(), "UP/DOWN PICK LEFT/RIGHT CHANGE ENTER DOES IT".to_owned(), String::new(), ]; - for row in first..(first + ROWS).min(total) { + for &row in &rows[first..(first + ROWS).min(total)] { let cursor = if row == self.at { '>' } else { ' ' }; let line = if let Some(item) = ITEMS.get(row) { let value = &self.values[row]; @@ -518,6 +561,8 @@ impl Menu { ABOUT_IMPORT } else if ITEMS.get(self.at).is_some_and(|i| i.var == MFG) { ABOUT_MFG + } else if ITEMS.get(self.at).is_some_and(|i| i.var == S_RES) { + ABOUT_S_RES } else if ITEMS.get(self.at).is_some_and(|i| i.var == DLSS) && !matches!(self.values[self.at].as_str(), "" | "off") && std::env::var_os("VICTORY_STREAMLINE_DIR").is_none() @@ -574,6 +619,28 @@ impl Menu { if item.var == FRAMEGEN && !live(item) && !matches!(self.values[i].as_str(), "" | "0") { "RESTART REQUIRED TO ENABLE FRAME GENERATION".clone_into(&mut self.note); } + self.match_series_s(item.var); + } + + /// On Series S the scene's size and DLSS's mode are one choice: a change of either + /// (`changed`) sets the other. DLSS off is the game's 720, and 720 picked leaves it off. + fn match_series_s(&mut self, changed: &str) { + let (Some(dlss), Some(res)) = (ITEMS.iter().position(|i| i.var == DLSS), ITEMS.iter().position(|i| i.var == S_RES)) else { + return; + }; + if self.value(CONSOLE) != "series-s" { + return; + } + let off = matches!(self.values[dlss].as_str(), "" | "off"); + if changed == DLSS { + let size = S_MODES.iter().find(|(_, m)| *m == self.values[dlss]).map_or("720", |(s, _)| *s); + size.clone_into(&mut self.values[res]); + } else if changed == S_RES + && !(off && self.values[res] == "720") + && let Some((_, mode)) = S_MODES.iter().find(|(s, _)| *s == self.values[res]) + { + (*mode).clone_into(&mut self.values[dlss]); + } } /// A setting the build reads at each use: changed in this run's environment at once. @@ -804,7 +871,6 @@ impl Menu { if pressed.is_empty() { return; } - let total = ITEMS.len() + ACTIONS.len(); for vk in pressed { let open = Self::open(); // Esc in the list of saves goes back to the settings. @@ -846,8 +912,8 @@ impl Menu { continue; } match vk { - VK_UP => self.at = (self.at + total - 1) % total, - VK_DOWN => self.at = (self.at + 1) % total, + VK_UP => self.at = self.step(-1), + VK_DOWN => self.at = self.step(1), VK_LEFT if self.at < ITEMS.len() => self.change_and_save(self.at, -1), VK_RIGHT if self.at < ITEMS.len() => self.change_and_save(self.at, 1), VK_RETURN if self.at < ITEMS.len() => self.change_and_save(self.at, 1), @@ -1029,6 +1095,8 @@ mod tests { assert_eq!(about, ABOUT_IMPORT); } else if at < ITEMS.len() && ITEMS[at].var == MFG { assert_eq!(about, ABOUT_MFG); + } else if at < ITEMS.len() && ITEMS[at].var == S_RES { + assert_eq!(about, ABOUT_S_RES); } else { assert!(about.iter().all(String::is_empty), "{about:?}"); } @@ -1076,6 +1144,50 @@ mod tests { assert!(lines[lines.len() - 5..lines.len() - 2].iter().all(String::is_empty)); } + #[test] + fn the_picture_line_is_the_consoles() { + let mut menu = Menu { values: ITEMS.iter().map(|_| String::new()).collect(), started: Vec::new(), at: 0, note: String::new(), changed: false, painted: None, buffers: None, failed: false, imports: Vec::new(), import_at: 0, picking: false }; + menu.started = menu.values.clone(); + let at = |var: &str| ITEMS.iter().position(|i| i.var == var).expect("in the menu"); + let (console, x, s, dlss) = (at(CONSOLE), at(X_RES), at(S_RES), at(DLSS)); + let shown = |menu: &Menu, label: &str| menu.lines().iter().any(|l| l.contains(label)); + "series-x".clone_into(&mut menu.values[console]); + assert!(shown(&menu, "SERIES X PICTURE") && !shown(&menu, "SERIES S PICTURE")); + // down from the console: the Series X line, never the hidden one + menu.at = console; + assert_eq!(menu.step(1), x); + assert!(!menu.rows().contains(&s)); + "series-s".clone_into(&mut menu.values[console]); + assert!(shown(&menu, "SERIES S PICTURE") && !shown(&menu, "SERIES X PICTURE")); + assert_eq!(menu.step(1), s); + assert_eq!(menu.step(-1), console - 1); + // the size and DLSS's mode follow each other on Series S + "quality".clone_into(&mut menu.values[dlss]); + "720".clone_into(&mut menu.values[s]); + menu.change(s, 1); + assert_eq!((menu.values[s].as_str(), menu.values[dlss].as_str()), ("626", "balanced")); + menu.change(s, 1); + assert_eq!((menu.values[s].as_str(), menu.values[dlss].as_str()), ("540", "performance")); + menu.change(dlss, -2); + assert_eq!((menu.values[s].as_str(), menu.values[dlss].as_str()), ("720", "quality")); + // DLSS off is 720, and 720 leaves it off; another size turns DLSS on at its mode + menu.change(dlss, -1); + assert_eq!((menu.values[s].as_str(), menu.values[dlss].as_str()), ("720", "off")); + menu.change(s, -1); + assert_eq!((menu.values[s].as_str(), menu.values[dlss].as_str()), ("1080", "dlaa")); + "off".clone_into(&mut menu.values[dlss]); + "626".clone_into(&mut menu.values[s]); + menu.change(s, -1); + assert_eq!((menu.values[s].as_str(), menu.values[dlss].as_str()), ("720", "off")); + menu.change(s, 2); + assert_eq!((menu.values[s].as_str(), menu.values[dlss].as_str()), ("540", "performance")); + menu.at = s; + assert_eq!(&menu.lines()[menu.lines().len() - 5..menu.lines().len() - 2], ABOUT_S_RES); + for line in ABOUT_S_RES { + assert!(line.len() <= COLUMNS as usize && line.bytes().all(|b| glyph(b) != glyph(b'#') || b == b'#'), "{line}"); + } + } + #[test] fn values_cycle_both_ways() { let mut menu = Menu { values: ITEMS.iter().map(|i| i.values[0].0.to_owned()).collect(), started: Vec::new(), at: 0, note: String::new(), changed: false, painted: None, buffers: None, failed: false, imports: Vec::new(), import_at: 0, picking: false }; diff --git a/scripts/play-foxhound.ps1 b/scripts/play-foxhound.ps1 index e68bbf8..2d3ed3e 100644 --- a/scripts/play-foxhound.ps1 +++ b/scripts/play-foxhound.ps1 @@ -97,6 +97,10 @@ $settings = @{ VICTORY_LEAVE_OUT = '02384a60fda6f2d0,731a39171b568298' # Pipelines the title makes are written down, so `victory warm` can make them ahead VICTORY_PIPELINE_BOOK = '1' + # Memory stack (skornuta): unused texture slots given back, old allocators taken anew, small buffers packed + VICTORY_SLOT_EVICT = '1' + VICTORY_ALLOCATOR_TRIM = '1' + VICTORY_BUDGET_PACK = '1' } if (-not $SeriesS) { if ($Res -eq '1440') { $settings.VICTORY_NATIVE_1440P = '1' }