This commit is contained in:
Alex Janka 2023-02-09 17:32:47 +11:00
parent ad51d4173a
commit c3c02fa539
3 changed files with 14 additions and 1 deletions

View file

@ -124,7 +124,7 @@ fn main() {
};
let mut window = Window::new(
format!("{}", rom.get_title()).as_str(),
format!("{} on MBC: {}", rom.get_title(), rom.mbc_type()).as_str(),
WIDTH * FACTOR,
HEIGHT * FACTOR,
WindowOptions::default(),

View file

@ -43,4 +43,8 @@ impl ROM {
pub(super) fn set(&mut self, address: Address, data: u8) {
self.mbc.set(address, data);
}
pub fn mbc_type(&self) -> &str {
self.mbc.mbc_type()
}
}

View file

@ -3,6 +3,7 @@ use crate::processor::memory::Address;
pub(super) trait MBC {
fn get(&self, address: Address) -> u8;
fn set(&mut self, address: Address, data: u8);
fn mbc_type(&self) -> &str;
}
pub(super) struct NONE {
@ -23,6 +24,10 @@ impl MBC for NONE {
fn set(&mut self, _address: Address, _data: u8) {
return;
}
fn mbc_type(&self) -> &str {
"None"
}
}
#[derive(Clone, Copy)]
@ -108,4 +113,8 @@ impl MBC for MBC1 {
self.rom_bank = (self.rom_bank as usize % self.num_banks) as u8;
return;
}
fn mbc_type(&self) -> &str {
"MBC1"
}
}