chore: reduce size of public interface
This commit is contained in:
parent
2bb8bd6d8f
commit
01278ca83f
|
@ -437,7 +437,7 @@ impl Channel1 {
|
|||
}
|
||||
|
||||
/// 0xFF12 | NR12 - Channel 1 Volume Envelope
|
||||
pub fn envelope(&self) -> u8 {
|
||||
pub(crate) fn envelope(&self) -> u8 {
|
||||
u8::from(self.envelope)
|
||||
}
|
||||
|
||||
|
|
15
src/bus.rs
15
src/bus.rs
|
@ -19,12 +19,12 @@ pub struct Bus {
|
|||
ppu: Ppu,
|
||||
work_ram: WorkRam,
|
||||
var_ram: VariableWorkRam,
|
||||
pub(crate) timer: Timer,
|
||||
timer: Timer,
|
||||
int: Interrupt,
|
||||
pub(crate) apu: Apu,
|
||||
apu: Apu,
|
||||
high_ram: HighRam,
|
||||
serial: Serial,
|
||||
pub(crate) joypad: Joypad,
|
||||
joypad: Joypad,
|
||||
}
|
||||
|
||||
impl Default for Bus {
|
||||
|
@ -103,6 +103,11 @@ impl Bus {
|
|||
self.cart.as_mut()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn apu_mut(&mut self) -> &mut Apu {
|
||||
&mut self.apu
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn ppu(&self) -> &Ppu {
|
||||
&self.ppu
|
||||
|
@ -110,7 +115,7 @@ impl Bus {
|
|||
}
|
||||
|
||||
impl Bus {
|
||||
pub fn oam_read_byte(&self, addr: u16) -> u8 {
|
||||
pub(crate) fn oam_read_byte(&self, addr: u16) -> u8 {
|
||||
match addr {
|
||||
0x0000..=0x7FFF => {
|
||||
// 16KB ROM bank 00 (ends at 0x3FFF)
|
||||
|
@ -157,7 +162,7 @@ impl Bus {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn oam_write_byte(&mut self, addr: u16, byte: u8) {
|
||||
pub(crate) fn oam_write_byte(&mut self, addr: u16, byte: u8) {
|
||||
self.ppu.oam.write_byte(addr, byte);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ impl Cpu {
|
|||
/// routine.
|
||||
///
|
||||
/// Handle HALT and interrupts.
|
||||
pub fn step(&mut self) -> Cycle {
|
||||
pub(crate) fn step(&mut self) -> Cycle {
|
||||
// Log instructions
|
||||
// if self.reg.pc > 0xFF {
|
||||
// let out = std::io::stdout();
|
||||
|
|
|
@ -90,7 +90,7 @@ impl Emulator {
|
|||
}
|
||||
|
||||
pub fn set_prod(&mut self, prod: SampleProducer<f32>) {
|
||||
self.cpu.bus_mut().apu.attach_producer(prod)
|
||||
self.cpu.bus_mut().apu_mut().attach_producer(prod)
|
||||
}
|
||||
|
||||
pub fn title(&self) -> &str {
|
||||
|
|
|
@ -1893,7 +1893,7 @@ mod table {
|
|||
}
|
||||
|
||||
impl Group1RegisterPair {
|
||||
pub fn as_register_pair(&self) -> RegisterPair {
|
||||
pub(crate) fn as_register_pair(&self) -> RegisterPair {
|
||||
use Group1RegisterPair::*;
|
||||
|
||||
match self {
|
||||
|
@ -1927,7 +1927,7 @@ mod table {
|
|||
}
|
||||
|
||||
impl Group2RegisterPair {
|
||||
pub fn as_register_pair(&self) -> RegisterPair {
|
||||
pub(crate) fn as_register_pair(&self) -> RegisterPair {
|
||||
use Group2RegisterPair::*;
|
||||
|
||||
match self {
|
||||
|
@ -1961,7 +1961,7 @@ mod table {
|
|||
}
|
||||
|
||||
impl Group3RegisterPair {
|
||||
pub fn as_register_pair(&self) -> RegisterPair {
|
||||
pub(crate) fn as_register_pair(&self) -> RegisterPair {
|
||||
use Group3RegisterPair::*;
|
||||
|
||||
match self {
|
||||
|
@ -2003,7 +2003,7 @@ mod table {
|
|||
}
|
||||
|
||||
impl Register {
|
||||
pub fn cpu_register(&self) -> CpuRegister {
|
||||
pub(crate) fn cpu_register(&self) -> CpuRegister {
|
||||
use Register::*;
|
||||
|
||||
match self {
|
||||
|
|
|
@ -111,7 +111,7 @@ impl ButtonEvent {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn handle_keyboard_input(pad: &mut Joypad, input: &WinitInputHelper) {
|
||||
pub(crate) fn handle_keyboard_input(pad: &mut Joypad, input: &WinitInputHelper) {
|
||||
use winit::event::VirtualKeyCode;
|
||||
|
||||
// TODO: What do I have to do to get a match statement here?
|
||||
|
@ -177,7 +177,7 @@ pub fn handle_keyboard_input(pad: &mut Joypad, input: &WinitInputHelper) {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn handle_gamepad_input(pad: &mut Joypad, event: GamepadEvent) {
|
||||
pub(crate) fn handle_gamepad_input(pad: &mut Joypad, event: GamepadEvent) {
|
||||
use Button::*;
|
||||
use GamepadEventType::*;
|
||||
|
||||
|
|
Loading…
Reference in New Issue