From 0c7f945407561f7c4531b2780e908bb2098551d8 Mon Sep 17 00:00:00 2001 From: Astatin Date: Thu, 22 May 2025 14:07:19 +0200 Subject: Add load/save parameters to the CLI & remove errors --- src/io.rs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/io.rs') diff --git a/src/io.rs b/src/io.rs index b26533a..89f3a3b 100644 --- a/src/io.rs +++ b/src/io.rs @@ -59,7 +59,10 @@ where fn load_rom(&self, rom: &mut [u8]) -> Result<(), Self::Error>; fn load_external_ram(&self, external_ram: &mut [u8]) -> Result<(), Self::Error>; fn save_external_ram(&self, external_ram: &[u8]) -> Result<(), Self::Error>; - fn save_state(&self, state: &GBState); + fn dump_state(&self, state: &GBState) -> Result<(), Self::Error>; + fn save_state(&self, state: &GBState) -> Result<(), Self::Error>; + fn load_state(&self, state: &mut GBState) + -> Result<(), Self::Error>; } pub struct Gameboy { @@ -81,6 +84,15 @@ impl Gameboy Result<(), LS::Error> { + self.load_save.load_state(&mut self.state)?; + Ok(()) + } + + pub fn debug(&mut self) { + self.state.is_debug = true; + } + pub fn start(self) { let Self { mut window, @@ -115,7 +127,7 @@ impl Gameboy Gameboy Gameboy