Skip to content
Snippets Groups Projects
Verified Commit 33996d5e authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: new cartridge methods

parent 0646bbf2
No related branches found
No related tags found
No related merge requests found
......@@ -138,6 +138,10 @@ impl GameBoy {
self.frame_buffer().to_vec()
}
pub fn cartridge_eager(&mut self) -> Cartridge {
self.mmu().rom().clone()
}
pub fn registers(&mut self) -> Registers {
let ppu_registers = self.ppu().registers();
Registers {
......
......@@ -410,6 +410,31 @@ impl Cartridge {
pub fn ram_size_s(&self) -> String {
String::from(self.ram_size().description())
}
pub fn has_battery(&self) -> bool {
match self.rom_type() {
RomType::Mbc1RamBattery => true,
RomType::Mbc2Battery => true,
RomType::RomRamBattery => true,
RomType::Mmm01RamBattery => true,
RomType::Mbc3TimerBattery => true,
RomType::Mbc3TimerRamBattery => true,
RomType::Mbc3RamBattery => true,
RomType::Mbc5RamBattery => true,
RomType::Mbc5RumbleRamBattery => true,
RomType::Mbc7SensorRumbleRamBattery => true,
RomType::HuC1RamBattery => true,
_ => false,
}
}
pub fn ram_data_eager(&self) -> Vec<u8> {
self.ram_data.clone()
}
pub fn set_ram_data(&mut self, ram_data: Vec<u8>) {
self.ram_data = ram_data;
}
}
impl Default for Cartridge {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment