Skip to content

Commit

Permalink
chore: more efficient RAM data retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Jul 23, 2023
1 parent 9f90a83 commit 10c2966
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontends/sdl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ impl Emulator {
// then we've reached the time to re-save the battery backed RAM
// into a *.sav file in the file system
if counter % store_count == 0 && self.system.rom().has_battery() {
let ram_data = self.system.ram_data_eager();
write_file(&self.ram_path, &ram_data);
let ram_data = self.system.rom().ram_data();
write_file(&self.ram_path, ram_data);
}

// obtains an event from the SDL sub-system to be
Expand Down
10 changes: 10 additions & 0 deletions src/rom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,16 @@ impl Cartridge {
}
}

impl Cartridge {
pub fn rom_data(&self) -> &Vec<u8> {
&self.rom_data
}

pub fn ram_data(&self) -> &Vec<u8> {
&self.ram_data
}
}

impl Default for Cartridge {
fn default() -> Self {
Self::new()
Expand Down

0 comments on commit 10c2966

Please sign in to comment.