diff --git a/Cargo.toml b/Cargo.toml index b51d643..a7bf1f3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,4 +17,4 @@ sdl2 = "0.36.0" [profile.release] strip = true -lto = true \ No newline at end of file +lto = true diff --git a/src/emu/keyboard.rs b/src/emu/keyboard.rs index aaddd02..be1fad2 100644 --- a/src/emu/keyboard.rs +++ b/src/emu/keyboard.rs @@ -19,12 +19,12 @@ impl<'a> Keyboard<'a>{ pub fn key_down(&mut self,x:u8){ self.bitflags |= 1<EmulatorResult<()>{ diff --git a/src/emu/memory.rs b/src/emu/memory.rs index 3654376..8840c7e 100644 --- a/src/emu/memory.rs +++ b/src/emu/memory.rs @@ -53,6 +53,7 @@ impl RamMemory { pub fn get_data_ref(&self) -> Ref> { self.data.borrow() } + } impl Memory for RamMemory { diff --git a/src/graphics/graphics_adapter.rs b/src/graphics/graphics_adapter.rs index ac1f7ee..49b1a16 100644 --- a/src/graphics/graphics_adapter.rs +++ b/src/graphics/graphics_adapter.rs @@ -21,7 +21,7 @@ impl<'a> Debug for SDLGraphicsAdapter<'a> { impl<'a> SDLGraphicsAdapter<'a> { pub fn new(graphics_processor: &'a GraphicsProcessor) -> SDLGraphicsAdapter<'a> { - let color_fb_vec = vec![0u8; DEVICE_FRAMEBUFFER_SIZE * 3].into_boxed_slice().try_into().expect("???"); + let color_fb_vec = vec![0u8; DEVICE_FRAMEBUFFER_SIZE * 3].into_boxed_slice().try_into().expect("Failed conversion"); SDLGraphicsAdapter { color_fb: color_fb_vec, graphics_processor, @@ -37,8 +37,8 @@ impl<'a> SDLGraphicsAdapter<'a> { let mut texture = texture_creator.create_texture(PixelFormatEnum::RGB24, TextureAccess::Streaming, 256, 256).expect("Failed to make texture"); texture.with_lock(None, |f, _i| { f.copy_from_slice(self.color_fb.as_ref()) - }).expect("TODO: panic message"); - canvas.copy(&texture, None, None).expect("Failed to write texture"); + })?; + canvas.copy(&texture, None, None)?; Ok(()) } diff --git a/src/main.rs b/src/main.rs index 8336aeb..3a35a4e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,7 +29,6 @@ fn main() -> EmulatorResult<()> { let BytePusherArgs { file_name ,draw_scale} = BytePusherArgs::parse(); SimpleLogger::new().with_level(LevelFilter::Info).env().init()?; - let (file_bytes, ..) = try_load_rom(&file_name)?; let (mut canvas, mut event_pump, audio_queue) = initiate_sdl(draw_scale); diff --git a/src/misc/error.rs b/src/misc/error.rs index 7658f86..0c79ea2 100644 --- a/src/misc/error.rs +++ b/src/misc/error.rs @@ -36,6 +36,11 @@ impl From for EmulatorError{ EmulatorError::OtherError(None,format!("Logger allocation failed! Error: {}",value)) } } +impl From for EmulatorError{ + fn from(value: String) -> Self { + EmulatorError::OtherError(None,value) + } +}