Instant replay can be turned off from the launcher
Settings > Clips > Keep the last has Off: the engine is started with --replay 0, so it opens no encoder and keeps no buffer (nothing recorded, no cost while playing). "A save writes" greys out while it's off; its length is kept for when it's on again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
2eec6b324d
commit
7b3c42aa6d
5 files changed
+28
-12
No files matched your search
@@ -382,6 +382,8 @@ pub fn overlay_args(key: &str) -> Vec<String> { vec![format!("--overlay-key={key
|
||||
|
||||
pub fn clip_args(replay_seconds: u32, clip_seconds: u32) -> Vec<String> {
|
||||
const OK: [u32; 6] = [15, 30, 60, 180, 300, 600];
|
||||
// off: the engine records nothing (no encoder, no buffer), whatever its own settings say
|
||||
if replay_seconds == 0 { return vec!["--replay".into(), "0".into()]; }
|
||||
if !OK.contains(&replay_seconds) { return vec![]; }
|
||||
let mut a = vec!["--replay".to_string(), replay_seconds.to_string()];
|
||||
let clip = clip_seconds.min(replay_seconds);
|
||||
|
||||
@@ -24,7 +24,7 @@ pub struct UiSettings {
|
||||
/// Multiplier on top of the system scale factor.
|
||||
pub ui_scale: f32,
|
||||
/// Instant replay: how many seconds the engine keeps.
|
||||
pub replay_seconds: u32,
|
||||
pub replay_seconds: u32, // 0: off
|
||||
/// Instant replay: how many seconds a save writes. Never more than `replay_seconds`.
|
||||
pub clip_seconds: u32,
|
||||
/// The key that opens and closes Summit's overlay while playing: "Insert", "Home", "F10", "Ctrl+Shift+O"...
|
||||
@@ -75,8 +75,10 @@ impl UiSettings {
|
||||
if self.theme.trim().is_empty() { self.theme = d.theme; }
|
||||
self.anim_speed = if self.anim_speed.is_finite() { self.anim_speed.clamp(0.0, 2.0) } else { d.anim_speed };
|
||||
self.ui_scale = if self.ui_scale.is_finite() { self.ui_scale.clamp(0.8, 1.5) } else { d.ui_scale };
|
||||
self.replay_seconds = nearest_u32(self.replay_seconds, CLIP_LENGTHS);
|
||||
self.clip_seconds = nearest_u32(self.clip_seconds, CLIP_LENGTHS).min(self.replay_seconds);
|
||||
// 0: instant replay off (nothing recorded, so it costs nothing); the clip length is kept for when it's on
|
||||
if self.replay_seconds != 0 { self.replay_seconds = nearest_u32(self.replay_seconds, CLIP_LENGTHS); }
|
||||
self.clip_seconds = nearest_u32(self.clip_seconds, CLIP_LENGTHS);
|
||||
if self.replay_seconds != 0 { self.clip_seconds = self.clip_seconds.min(self.replay_seconds); }
|
||||
self.overlay_key = crate::hotkey::overlay_key(&self.overlay_key).unwrap_or(d.overlay_key);
|
||||
self
|
||||
}
|
||||
@@ -185,4 +187,11 @@ mod tests {
|
||||
assert_eq!((s.layout_index(), s.anim_style_index()), (2, 2));
|
||||
assert_eq!((clip_label(15).as_str(), clip_label(60).as_str(), clip_label(600).as_str()), ("15 s", "1 min", "10 min"));
|
||||
}
|
||||
#[test]
|
||||
fn instant_replay_can_be_off() {
|
||||
let s = UiSettings { replay_seconds: 0, clip_seconds: 60, ..Default::default() }.sanitized();
|
||||
assert_eq!((s.replay_seconds, s.clip_seconds), (0, 60)); // off, and the clip length kept for later
|
||||
assert_eq!(crate::engine::clip_args(0, 60), vec!["--replay".to_string(), "0".to_string()]);
|
||||
assert_eq!(crate::engine::clip_args(30, 60), vec!["--replay", "30", "--clip-length", "30"]);
|
||||
}
|
||||
}
|
||||
@@ -1253,7 +1253,8 @@ impl App {
|
||||
self.ui.set_anim_style(s.anim_style_index() as i32);
|
||||
let p = self.ui.global::<Prefs>();
|
||||
p.set_scale(nearest(prefs::UI_SCALES, s.ui_scale) as i32);
|
||||
p.set_replay(prefs::CLIP_LENGTHS.iter().position(|c| *c == s.replay_seconds).unwrap_or(2) as i32);
|
||||
// the row's choices: Off, then the lengths
|
||||
p.set_replay(if s.replay_seconds == 0 { 0 } else { prefs::CLIP_LENGTHS.iter().position(|c| *c == s.replay_seconds).unwrap_or(2) as i32 + 1 });
|
||||
p.set_clip(prefs::CLIP_LENGTHS.iter().position(|c| *c == s.clip_seconds).unwrap_or(1) as i32);
|
||||
p.set_clip_lengths(ModelRc::new(VecModel::from(prefs::CLIP_LENGTHS.iter().map(|c| prefs::clip_label(*c).into()).collect::<Vec<SharedString>>())));
|
||||
let keys = s.overlay_key_choices();
|
||||
@@ -1274,7 +1275,7 @@ impl App {
|
||||
anim_speed: self.ui.get_anim_speed(),
|
||||
anim_style: prefs::ANIM_STYLES[pick(self.ui.get_anim_style(), 3)].into(),
|
||||
ui_scale: prefs::UI_SCALES[pick(p.get_scale(), prefs::UI_SCALES.len())],
|
||||
replay_seconds: prefs::CLIP_LENGTHS[pick(p.get_replay(), 6)],
|
||||
replay_seconds: match pick(p.get_replay(), 7) { 0 => 0, r => prefs::CLIP_LENGTHS[r - 1] },
|
||||
clip_seconds: prefs::CLIP_LENGTHS[pick(p.get_clip(), 6)],
|
||||
// the row's choices are the usual keys, then the saved one when it was set by hand (ui.toml)
|
||||
overlay_key: { let keys = self.settings.borrow().overlay_key_choices(); keys[pick(p.get_overlay_key(), keys.len())].clone() },
|
||||
|
||||
@@ -65,8 +65,8 @@ export component SettingsView inherits Rectangle {
|
||||
else if (root.srow == 2) { Prefs.scale = Math.clamp(Prefs.scale + d, 0, Prefs.scales.length - 1); }
|
||||
else if (root.srow == 3) { Theme.speed = Math.clamp(Math.round((Theme.speed + d * 0.25) * 4) / 4, 0, 2); }
|
||||
else if (root.srow == 4) { Theme.style = Math.clamp(Theme.style + d, 0, 2); }
|
||||
else if (root.srow == 5) { Prefs.replay = Math.clamp(Prefs.replay + d, 0, 5); Prefs.clip = Math.min(Prefs.clip, Prefs.replay); }
|
||||
else if (root.srow == 6) { Prefs.clip = Math.clamp(Prefs.clip + d, 0, Prefs.replay); }
|
||||
else if (root.srow == 5) { Prefs.replay = Math.clamp(Prefs.replay + d, 0, 6); Prefs.clip = Math.max(0, Math.min(Prefs.clip, Prefs.replay - 1)); }
|
||||
else if (root.srow == 6) { if (Prefs.replay == 0) { return; } Prefs.clip = Math.clamp(Prefs.clip + d, 0, Prefs.replay - 1); }
|
||||
else if (root.srow == 7) { return; }
|
||||
else if (root.srow == 8) { Prefs.overlay-key = Math.clamp(Prefs.overlay-key + d, 0, Prefs.overlay-keys.length - 1); }
|
||||
else if (root.srow == 9) { Prefs.upscaler = Math.clamp(Prefs.upscaler + d, 0, 3); }
|
||||
@@ -128,11 +128,13 @@ export component SettingsView inherits Rectangle {
|
||||
}
|
||||
|
||||
Section { x: root.cx; y: 688px; width: root.cw; title: "CLIPS"; icon: Icons.film; }
|
||||
Row { x: root.cx; y: root.ry(5); width: root.cw; label: "Keep the last"; hint: "Instant replay buffer, passed to the engine as --replay."; focused: root.active && root.srow == 5; hit => { root.srow = 5; }
|
||||
Segmented { x: parent.width - self.width - 16px; y: 16px; width: 6 * 76px + 8px; options: Prefs.clip-lengths; value <=> Prefs.replay; changed => { root.srow = 5; Prefs.clip = Math.min(Prefs.clip, Prefs.replay); root.save(); } }
|
||||
Row { x: root.cx; y: root.ry(5); width: root.cw; label: "Keep the last";
|
||||
hint: Prefs.replay == 0 ? "Off: nothing is recorded, so it costs no performance." : "Instant replay buffer (--replay). Off records nothing.";
|
||||
focused: root.active && root.srow == 5; hit => { root.srow = 5; }
|
||||
Segmented { x: parent.width - self.width - 16px; y: 16px; width: 7 * 72px + 8px; options: Prefs.replay-options; value <=> Prefs.replay; changed => { root.srow = 5; Prefs.clip = Math.max(0, Math.min(Prefs.clip, Prefs.replay - 1)); root.save(); } }
|
||||
}
|
||||
Row { x: root.cx; y: root.ry(6); width: root.cw; label: "A save writes"; hint: "Passed as --clip-length. " + Lib.hotkey-status; focused: root.active && root.srow == 6; hit => { root.srow = 6; }
|
||||
Segmented { x: parent.width - self.width - 16px; y: 16px; width: 6 * 76px + 8px; options: Prefs.clip-lengths; limit: Prefs.replay; value <=> Prefs.clip; changed => { root.srow = 6; root.save(); } }
|
||||
Row { x: root.cx; y: root.ry(6); width: root.cw; label: "A save writes"; hint: Prefs.replay == 0 ? "Instant replay is off, so there is nothing to save." : "Passed as --clip-length. " + Lib.hotkey-status; focused: root.active && root.srow == 6; hit => { root.srow = 6; }
|
||||
Segmented { x: parent.width - self.width - 16px; y: 16px; width: 6 * 76px + 8px; options: Prefs.clip-lengths; limit: Prefs.replay - 1; value <=> Prefs.clip; changed => { root.srow = 6; root.save(); } }
|
||||
}
|
||||
|
||||
Row { x: root.cx; y: root.ry(7); width: root.cw; label: "Clips folder"; hint: Lib.clips-dir + "/<game>/ (Enter opens it)"; focused: root.active && root.srow == 7; hit => { root.srow = 7; }
|
||||
|
||||
@@ -83,9 +83,10 @@ export struct PRow { label: string, hint: string, options: [string], value: int,
|
||||
export global Prefs {
|
||||
in-out property <int> scale: 2; // index into scales
|
||||
in property <[string]> scales: ["80%", "90%", "100%", "110%", "125%", "150%"];
|
||||
in-out property <int> replay: 2; // index into clip-lengths
|
||||
in-out property <int> replay: 3; // index into replay-options: 0 off, then clip-lengths
|
||||
in-out property <int> clip: 1;
|
||||
in property <[string]> clip-lengths: ["15 s", "30 s", "1 min", "3 min", "5 min", "10 min"];
|
||||
in property <[string]> replay-options: ["Off", "15 s", "30 s", "1 min", "3 min", "5 min", "10 min"];
|
||||
in-out property <int> overlay-key: 0; // index into overlay-keys: the key that opens the in-game overlay
|
||||
in property <[string]> overlay-keys: ["Insert", "Home", "End", "Pause", "F9", "F10"];
|
||||
in-out property <int> upscaler: 0; // auto (engine setting), none, fsr, rtx-vsr
|
||||
@@ -356,6 +357,7 @@ export component Segmented inherits Rectangle {
|
||||
Rectangle {
|
||||
x: 4px + root.value * root.cell; y: 4px; width: root.cell; height: parent.height - 8px; border-radius: self.height / 2;
|
||||
background: @linear-gradient(100deg, Theme.p.accent 0%, Theme.p.accent2 100%);
|
||||
opacity: root.value > root.limit ? 0.3 : 1; // the whole row off (instant replay off): its pick dimmed too
|
||||
animate x { duration: Theme.ms(220); easing: Theme.ease; }
|
||||
}
|
||||
for o[i] in root.options: Rectangle {
|
||||
|
||||
Reference in new issue
Block a user