use crate::{
cpu::Cpu,
platform::{PlatformProvider, WindowConfig},
trace::TraceHandler,
};
use instant::Duration;
use std::sync::Arc;
pub mod basic;
pub mod c64;
pub mod easy;
pub mod klaus;
pub mod pet;
pub mod vic;
pub trait BuildableSystem<RomRegistry, SystemConfig> {
fn build(
roms: RomRegistry,
config: SystemConfig,
platform: Arc<dyn PlatformProvider>,
) -> Box<dyn System>;
}
pub trait System {
fn get_cpu_mut(&mut self) -> Box<&mut dyn Cpu>;
fn attach_trace_handler(&mut self, handler: Box<dyn TraceHandler>) {
self.get_cpu_mut().attach_trace_handler(handler);
}
fn tick(&mut self) -> Duration;
fn reset(&mut self);
fn render(&mut self, framebuffer: &mut [u8], window: WindowConfig);
fn cleanup(&mut self) -> Result<(), &str> {
self.get_cpu_mut().cleanup()
}
}