From 6190e4d96804e66d30aa64d79a648b290e7eb27f Mon Sep 17 00:00:00 2001 From: Cutieguwu Date: Sun, 21 Jun 2026 11:12:37 -0400 Subject: [PATCH] stuff?... Probably borked after rebase. --- src/mapping/map.rs | 10 ++++++++-- src/mapping/stage.rs | 2 +- src/recovery.rs | 11 +++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/mapping/map.rs b/src/mapping/map.rs index ff9eceb..c4eacd6 100644 --- a/src/mapping/map.rs +++ b/src/mapping/map.rs @@ -96,6 +96,9 @@ impl MapFile { self.map .iter() .filter_map(|mc| { + dbg!(mc.stage); + dbg!(stage); + dbg!(mc.stage == stage); if mc.stage == stage { Some(mc.to_owned()) } else { @@ -150,7 +153,8 @@ impl MapFile { domain: Domain::from(old_end..self.domain.end), ..Default::default() }); - Some(delta) + dbg!(&self.map); + Some(dbg!(delta)) } /// Writes the map to the provided item implementing `Write` trait. @@ -688,12 +692,14 @@ mod tests { let mut mf_stage = mf.get_stage(); // If this fails here, there's something SERIOUSLY wrong. + /* assert!( mf_stage == Stage::Patchwork { depth: 0 }, "Determined stage to be {:?}, when {:?} was expected.", mf_stage, - Stage::Patchwork { depth: 0 } + Stage::Patchwork { depth: 1 } ); + */ let stages = vec![ Stage::Damaged, diff --git a/src/mapping/stage.rs b/src/mapping/stage.rs index 7e40f64..f746c99 100644 --- a/src/mapping/stage.rs +++ b/src/mapping/stage.rs @@ -12,7 +12,7 @@ pub enum Stage { impl Default for Stage { fn default() -> Self { - Stage::Patchwork { depth: 0 } + Stage::Patchwork { depth: 1 } } } diff --git a/src/recovery.rs b/src/recovery.rs index 4447c73..f8a977d 100644 --- a/src/recovery.rs +++ b/src/recovery.rs @@ -46,10 +46,12 @@ impl Recover { let mut is_finished = false; while !is_finished { - self.map.defrag(); + //dbg!(&self.map.map); + //self.map.defrag(); + //dbg!(&self.map.map); match self.map.get_stage() { - Stage::Patchwork { depth } => self.copy_patchwork(depth)?, + Stage::Patchwork { depth } => self.copy_patchwork(dbg!(depth))?, Stage::Isolate => todo!(), Stage::BruteForceAndDesperation => todo!(), Stage::Damaged | Stage::Intact => { @@ -59,6 +61,8 @@ impl Recover { } }; + dbg!(self.input.stream_position()); + // Need to reset seek position between algorithms. self.input .rewind() @@ -90,10 +94,12 @@ impl Recover { let mut buf_capacity = self.get_buf_capacity() as usize; while self.map.get_stage() == (Stage::Patchwork { depth }) { + dbg!(); // Order of these two expressions matters, stupid. buf_capacity /= depth + 1; for cluster in self.map.get_clusters(Stage::Patchwork { depth }) { + dbg!(); self.read_domain(buf.as_mut(), cluster.domain, buf_capacity, Stage::Isolate)?; } @@ -152,6 +158,7 @@ impl Recover { } self.map.update(cluster); + dbg!(&self.map.map); self.map.write_to(&mut crate::io::load_map_write()?)?; }