feat/savestates: Add write_bin_file util function

Former-commit-id: 88e12df1d8a88ad97756e943b4b959f73bb99c35
This commit is contained in:
Michel Heily 2020-01-16 19:49:43 +02:00
parent d887602266
commit 87999122da
2 changed files with 8 additions and 1 deletions

View file

@ -65,6 +65,6 @@ pub mod prelude {
pub use super::core::{GBAError, GBAResult, GameBoyAdvance}; pub use super::core::{GBAError, GBAResult, GameBoyAdvance};
#[cfg(feature = "debugger")] #[cfg(feature = "debugger")]
pub use super::debugger::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}; pub use super::{AudioInterface, InputInterface, VideoInterface};
} }

View file

@ -11,6 +11,13 @@ pub fn read_bin_file(filename: &Path) -> io::Result<Vec<u8>> {
Ok(buf) Ok(buf)
} }
pub fn write_bin_file(filename: &Path, data: &Vec<u8>) -> io::Result<()> {
let mut f = File::create(filename)?;
f.write_all(data)?;
Ok(())
}
pub struct FpsCounter { pub struct FpsCounter {
count: u32, count: u32,
timer: time::Instant, timer: time::Instant,