diff --git a/src/lib.rs b/src/lib.rs index 3c2214a..307f0a9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -65,6 +65,6 @@ pub mod prelude { pub use super::core::{GBAError, GBAResult, GameBoyAdvance}; #[cfg(feature = "debugger")] pub use super::debugger::Debugger; - pub use super::util::read_bin_file; + pub use super::util::{read_bin_file, write_bin_file}; pub use super::{AudioInterface, InputInterface, VideoInterface}; } diff --git a/src/util.rs b/src/util.rs index bc5732b..a7bd21a 100644 --- a/src/util.rs +++ b/src/util.rs @@ -11,6 +11,13 @@ pub fn read_bin_file(filename: &Path) -> io::Result> { Ok(buf) } +pub fn write_bin_file(filename: &Path, data: &Vec) -> io::Result<()> { + let mut f = File::create(filename)?; + f.write_all(data)?; + + Ok(()) +} + pub struct FpsCounter { count: u32, timer: time::Instant,