Remove mutability from Mapper get_mirroring
This commit is contained in:
parent
4be3570c85
commit
b0b25247ce
|
@ -33,7 +33,7 @@ impl Mapper for Cnrom {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_mirroring(&mut self) -> Mirror {
|
fn get_mirroring(&self) -> Mirror {
|
||||||
self.cart.mirroring
|
self.cart.mirroring
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ impl Mapper for Mmc1 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_mirroring(&mut self) -> Mirror {
|
fn get_mirroring(&self) -> Mirror {
|
||||||
self.mirroring
|
self.mirroring
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ impl Mapper for Mmc3 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_mirroring(&mut self) -> Mirror {
|
fn get_mirroring(&self) -> Mirror {
|
||||||
if self.cart.four_screen_vram {
|
if self.cart.four_screen_vram {
|
||||||
Mirror::FourScreen
|
Mirror::FourScreen
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -17,7 +17,7 @@ use std::io::Read;
|
||||||
pub trait Mapper {
|
pub trait Mapper {
|
||||||
fn read(&self, address: usize) -> u8;
|
fn read(&self, address: usize) -> u8;
|
||||||
fn write(&mut self, address: usize, value: u8);
|
fn write(&mut self, address: usize, value: u8);
|
||||||
fn get_mirroring(&mut self) -> Mirror;
|
fn get_mirroring(&self) -> Mirror;
|
||||||
fn load_battery_backed_ram(&mut self);
|
fn load_battery_backed_ram(&mut self);
|
||||||
fn save_battery_backed_ram(&self);
|
fn save_battery_backed_ram(&self);
|
||||||
fn clock(&mut self);
|
fn clock(&mut self);
|
||||||
|
|
|
@ -49,7 +49,7 @@ impl Mapper for Nrom {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_mirroring(&mut self) -> Mirror {
|
fn get_mirroring(&self) -> Mirror {
|
||||||
self.cart.mirroring
|
self.cart.mirroring
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ impl Mapper for Uxrom {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_mirroring(&mut self) -> Mirror {
|
fn get_mirroring(&self) -> Mirror {
|
||||||
self.cart.mirroring
|
self.cart.mirroring
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ impl super::Ppu {
|
||||||
fn read_nametable(&mut self, address: usize) -> u8 {
|
fn read_nametable(&mut self, address: usize) -> u8 {
|
||||||
let base = address % 0x1000;
|
let base = address % 0x1000;
|
||||||
let offset = base % 0x0400;
|
let offset = base % 0x0400;
|
||||||
match self.mapper.borrow_mut().get_mirroring() {
|
match self.mapper.borrow().get_mirroring() {
|
||||||
Mirror::LowBank => self.nametable_A[offset],
|
Mirror::LowBank => self.nametable_A[offset],
|
||||||
Mirror::HighBank => self.nametable_B[offset],
|
Mirror::HighBank => self.nametable_B[offset],
|
||||||
Mirror::Horizontal => {
|
Mirror::Horizontal => {
|
||||||
|
@ -85,7 +85,7 @@ impl super::Ppu {
|
||||||
fn write_nametable(&mut self, address: usize, value: u8) {
|
fn write_nametable(&mut self, address: usize, value: u8) {
|
||||||
let base = address % 0x1000;
|
let base = address % 0x1000;
|
||||||
let offset = base % 0x0400;
|
let offset = base % 0x0400;
|
||||||
match self.mapper.borrow_mut().get_mirroring() {
|
match self.mapper.borrow().get_mirroring() {
|
||||||
Mirror::LowBank => self.nametable_A[offset] = value,
|
Mirror::LowBank => self.nametable_A[offset] = value,
|
||||||
Mirror::HighBank => self.nametable_B[offset] = value,
|
Mirror::HighBank => self.nametable_B[offset] = value,
|
||||||
Mirror::Horizontal => {
|
Mirror::Horizontal => {
|
||||||
|
|
Loading…
Reference in New Issue