Skip to content

Commit

Permalink
dump maps
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonros committed Jan 3, 2025
1 parent 9a9a5ea commit 9e78401
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libmwemu/src/maps/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1131,11 +1131,11 @@ impl Maps {
}
}

pub fn save_all(&mut self, path: String) {
pub fn save_all(&self, path: String) {
for mem in self.maps.iter() {
let mut ppath = path.clone();
ppath.push('/');
ppath.push_str(&mem.get_name());
ppath.push_str(&format!("{:x}-{}", mem.get_base(), mem.get_name()));
ppath.push_str(".bin");
mem.save(mem.get_base(), mem.size(), ppath);
}
Expand Down
4 changes: 4 additions & 0 deletions libmwemu/src/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,10 @@ impl Serialization {
file.write_all(&data).unwrap();
file.flush().unwrap();
drop(file);

// for binary analysis
std::fs::create_dir_all("./maps-dump/").unwrap();
emu.maps.save_all("./maps-dump/".to_string());
}

pub fn load_from_file(filename: &str) -> Emu {
Expand Down

0 comments on commit 9e78401

Please sign in to comment.