csflow:
 - Create structs for gamerules and global vars

radarflow:
 - new dma loop with less frequent cache invalidation
 - The new loop tries to run at a fixed 128 hz. Thats the max tickrate in cs2. The data is also only updated when a tick change is detected, so that should keep data fetching to a minimum.
 - todo: more testing for cache invalidation
This commit is contained in:
Janek
2023-12-31 04:32:12 +01:00
parent 0f0f7232fb
commit 7c652cb984
15 changed files with 305 additions and 175 deletions

View File

@@ -4,7 +4,6 @@ use clap::{Parser, ValueEnum};
use csflow::{Connector, memflow::Inventory};
const PORT_RANGE: std::ops::RangeInclusive<usize> = 8000..=65535;
const POLL_RANGE: std::ops::RangeInclusive<usize> = 1..=1000;
#[derive(Parser)]
#[command(author, version = version(), about, long_about = None)]
@@ -25,10 +24,6 @@ pub struct Cli {
#[arg(short, long, default_value = "./webradar", value_parser = valid_path)]
pub web_path: PathBuf,
/// Polling frequency in times per second for the DMA thread
#[arg(short = 'r', long, default_value_t = 60, value_parser = poll_in_range)]
pub poll_rate: u16,
/// Verbosity level for logging to the console
#[arg(value_enum, long, short, ignore_case = true, default_value_t = Loglevel::Warn)]
pub loglevel: Loglevel,
@@ -75,21 +70,6 @@ fn valid_path(s: &str) -> Result<PathBuf, String> {
Ok(path)
}
fn poll_in_range(s: &str) -> Result<u16, String> {
let port: usize = s
.parse()
.map_err(|_| format!("`{s}` isn't a valid number"))?;
if POLL_RANGE.contains(&port) {
Ok(port as u16)
} else {
Err(format!(
"not in range {}-{}",
POLL_RANGE.start(),
POLL_RANGE.end()
))
}
}
/// Wrapper because log::LevelFilter doesn't implement ValueEnum
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum, Default)]
pub enum Loglevel {