make sure GeorgeEmu can't be constructed without a rom
This commit is contained in:
parent
a621ec235a
commit
3856d81c47
52
src/lib.rs
52
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<NoRom, NoWindow> {
|
|||
window,
|
||||
}
|
||||
}
|
||||
// pub fn window(self, mut window: Window) -> GeorgeEmuBuilder<NoRom, SomeWindow> {
|
||||
// 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<SomeRom, NoWindow> {
|
||||
|
@ -202,26 +173,6 @@ impl GeorgeEmuBuilder<NoRom, SomeWindow> {
|
|||
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<SomeRom, SomeWindow> {
|
||||
|
@ -233,6 +184,7 @@ impl GeorgeEmuBuilder<SomeRom, SomeWindow> {
|
|||
|
||||
#[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(),
|
||||
|
|
Loading…
Reference in New Issue