From 3856d81c475de2dc84c32e1163226a7b37a37830 Mon Sep 17 00:00:00 2001 From: august kline Date: Thu, 26 Sep 2024 21:13:57 -0400 Subject: [PATCH] make sure GeorgeEmu can't be constructed without a rom --- src/lib.rs | 52 ++-------------------------------------------------- 1 file changed, 2 insertions(+), 50 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e37b4c0..5186edd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,7 @@ pub mod cpu; mod instructions; mod keyboard; -mod memory; +pub mod memory; mod platform; pub mod video; @@ -91,35 +91,6 @@ impl GeorgeEmuBuilder { window, } } - // pub fn window(self, mut window: Window) -> GeorgeEmuBuilder { - // let Self { - // rom, - // cpu, - // ref cpu_controller, - // ref memory_handle, - // keyboard, - // .. - // } = self; - - // let renderer = Renderer::new( - // self.cpu_controller.clone().unwrap(), - // self.memory_handle.clone().unwrap(), - // ); - - // window.set_input_callback(Box::new(Keyboard::new( - // self.memory_handle.as_ref().unwrap().clone(), - // ))); - - // GeorgeEmuBuilder { - // cpu, - // rom, - // keyboard, - // renderer: Some(renderer), - // cpu_controller: cpu_controller.clone(), - // memory_handle: memory_handle.clone(), - // window: SomeWindow(window), - // } - // } } impl GeorgeEmuBuilder { @@ -202,26 +173,6 @@ impl GeorgeEmuBuilder { self.cpu.as_mut().unwrap().debug = true; self } - - #[cfg(not(target_arch = "wasm32"))] - pub fn build(self) -> GeorgeEmu { - let keyboard = Keyboard::new(self.memory_handle.clone().unwrap()); - GeorgeEmu(imp::GeorgeEmu::new( - self.cpu.unwrap(), - self.renderer.unwrap(), - Some(keyboard), - None, - )) - } - - #[cfg(target_arch = "wasm32")] - pub fn build(self) -> GeorgeEmu { - GeorgeEmu(imp::GeorgeEmu::new( - self.cpu.unwrap(), - self.renderer.unwrap(), - self.window.0, - )) - } } impl GeorgeEmuBuilder { @@ -233,6 +184,7 @@ impl GeorgeEmuBuilder { #[cfg(not(target_arch = "wasm32"))] pub fn build(self) -> GeorgeEmu { + let keyboard = Keyboard::new(self.memory_handle.clone().unwrap()); GeorgeEmu(imp::GeorgeEmu::new( self.cpu.unwrap(), self.renderer.unwrap(),