|
@@ -1246,12 +1246,13 @@ mod host {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// Debugging aid: `VICTORY_KEYS=<seconds>:<key>,...` holds each key for
|
|
/// Debugging aid: `VICTORY_KEYS=<seconds>:<key>,...` holds each key for
|
|
|
- /// 0.2 s that long after input starts, with or without focus. A key is a
|
|
|
|
|
|
|
+ /// 0.2 s that long after input starts (`<from>-<to>:<key>`: all that
|
|
|
|
|
+ /// time), with or without focus. A key is a
|
|
|
/// letter, a digit, or `Enter`, `Esc`, `Tab`, `Back`, `Up`, `Down`,
|
|
/// letter, a digit, or `Enter`, `Esc`, `Tab`, `Back`, `Up`, `Down`,
|
|
|
/// `Left`, `Right` (the stand-in pad's table maps them to buttons).
|
|
/// `Left`, `Right` (the stand-in pad's table maps them to buttons).
|
|
|
#[cfg(feature = "diagnostics")]
|
|
#[cfg(feature = "diagnostics")]
|
|
|
fn scripted() -> Vec<u8> {
|
|
fn scripted() -> Vec<u8> {
|
|
|
- static SCRIPT: LazyLock<(Instant, Vec<(Duration, u8)>)> = LazyLock::new(|| {
|
|
|
|
|
|
|
+ static SCRIPT: LazyLock<(Instant, Vec<(Duration, Duration, u8)>)> = LazyLock::new(|| {
|
|
|
let list = std::env::var("VICTORY_KEYS").unwrap_or_default();
|
|
let list = std::env::var("VICTORY_KEYS").unwrap_or_default();
|
|
|
let keys = list.split(',').filter_map(|entry| {
|
|
let keys = list.split(',').filter_map(|entry| {
|
|
|
let (at, key) = entry.split_once(':')?;
|
|
let (at, key) = entry.split_once(':')?;
|
|
@@ -1269,18 +1270,20 @@ mod host {
|
|
|
}
|
|
}
|
|
|
_ => return None,
|
|
_ => return None,
|
|
|
};
|
|
};
|
|
|
- Some((
|
|
|
|
|
- Duration::try_from_secs_f64(at.trim().parse().ok()?).ok()?,
|
|
|
|
|
- vk,
|
|
|
|
|
- ))
|
|
|
|
|
|
|
+ let time = |t: &str| Duration::try_from_secs_f64(t.trim().parse().ok()?).ok();
|
|
|
|
|
+ let (from, to) = match at.split_once('-') {
|
|
|
|
|
+ Some((from, to)) => (time(from)?, time(to)?),
|
|
|
|
|
+ None => (time(at)?, time(at)? + Duration::from_millis(200)),
|
|
|
|
|
+ };
|
|
|
|
|
+ Some((from, to, vk))
|
|
|
});
|
|
});
|
|
|
(Instant::now(), keys.collect())
|
|
(Instant::now(), keys.collect())
|
|
|
});
|
|
});
|
|
|
let (start, keys) = &*SCRIPT;
|
|
let (start, keys) = &*SCRIPT;
|
|
|
let now = start.elapsed();
|
|
let now = start.elapsed();
|
|
|
keys.iter()
|
|
keys.iter()
|
|
|
- .filter(|&&(at, _)| (at..at + Duration::from_millis(200)).contains(&now))
|
|
|
|
|
- .map(|&(_, vk)| vk)
|
|
|
|
|
|
|
+ .filter(|&&(from, to, _)| (from..to).contains(&now))
|
|
|
|
|
+ .map(|&(_, _, vk)| vk)
|
|
|
.collect()
|
|
.collect()
|
|
|
}
|
|
}
|
|
|
|
|
|