diff --git a/radarflow/src/dma/cache.rs b/radarflow/src/dma/cache.rs index acac88e..f99825d 100644 --- a/radarflow/src/dma/cache.rs +++ b/radarflow/src/dma/cache.rs @@ -18,7 +18,7 @@ pub struct Cache { impl Cache { pub fn is_valid(&self) -> bool { if self.valid { - if self.timestamp.elapsed() > std::time::Duration::from_secs(60 * 3) { + if self.timestamp.elapsed() > std::time::Duration::from_secs(10) { log::info!("Invalidated cache! Reason: time"); return false } diff --git a/radarflow/src/dma/mod.rs b/radarflow/src/dma/mod.rs index 29cfdae..364cae8 100644 --- a/radarflow/src/dma/mod.rs +++ b/radarflow/src/dma/mod.rs @@ -19,6 +19,7 @@ pub async fn run(connector: Connector, pcileech_device: String, data_lock: Arc<R let mut last_tickcount = -1; let mut last_round = -1; let mut last_gamephase = -1; + let mut last_bomb_dropped = false; // Duration for a single tick on 128 ticks. I'm assuming 128 ticks because I don't fucking know how to read the current tickrate off cs2 memory lol let target_interval = Duration::from_nanos(SECOND_AS_NANO / 128); @@ -128,6 +129,15 @@ pub async fn run(connector: Connector, pcileech_device: String, data_lock: Arc<R continue; } + let cur_bomb_dropped = cache.gamerules().bomb_dropped(&mut ctx)?; + + if cur_bomb_dropped != last_bomb_dropped { + last_bomb_dropped = cur_bomb_dropped; + cache.invalidate(); + log::info!("Invalidated cache! Reason: bomb drop status changed"); + continue; + } + let cur_tickcount = cache.globals().tick_count(&mut ctx)?; // New tick, now we want to fetch our data