2023-10-12 13:11:38 -05:00
|
|
|
use crate::ram::RamCard;
|
2023-08-10 13:58:34 -05:00
|
|
|
use eframe::egui;
|
|
|
|
use enum_dispatch::enum_dispatch;
|
|
|
|
|
|
|
|
#[enum_dispatch(CardEnum)]
|
|
|
|
pub enum CardEnum {
|
2023-10-12 13:11:38 -05:00
|
|
|
RamCard,
|
2023-08-10 13:58:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[enum_dispatch]
|
|
|
|
pub trait Card {
|
|
|
|
fn new(_settings: ron::Value) -> CardEnum;
|
|
|
|
|
|
|
|
fn read_mem(&mut self, _address: u16) -> Option<u8> {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
fn write_mem(&mut self, _address: u16, _data: u8) -> Option<()> {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
fn read_io(&mut self, _address: u8) -> Option<u8> {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
fn write_io(&mut self, _address: u8, _data: u8) -> Option<()> {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
fn draw_settings_ui(&mut self, _ui: egui::Ui) {}
|
|
|
|
fn serialize_settings(&self) -> String;
|
|
|
|
}
|