Struct tetanes::control_deck::ControlDeck
source · pub struct ControlDeck { /* private fields */ }
Expand description
Represents an NES Control Deck
Implementations§
source§impl ControlDeck
impl ControlDeck
sourcepub fn load_rom<S: ToString, F: Read>(
&mut self,
name: S,
rom: &mut F
) -> NesResult<()>
pub fn load_rom<S: ToString, F: Read>( &mut self, name: S, rom: &mut F ) -> NesResult<()>
Loads a ROM cartridge into memory
Errors
If there is any issue loading the ROM, then an error is returned.
pub fn load_cpu(&mut self, cpu: Cpu)
pub const fn loaded_rom(&self) -> &Option<String>
pub const fn cart_battery_backed(&self) -> bool
pub fn sram(&self) -> &[u8] ⓘ
pub fn load_sram(&mut self, sram: Vec<u8>)
pub fn wram(&self) -> &[u8] ⓘ
sourcepub fn frame_buffer(&mut self) -> &[u8] ⓘ
pub fn frame_buffer(&mut self) -> &[u8] ⓘ
Get a frame worth of pixels.
sourcepub const fn frame_number(&self) -> u32
pub const fn frame_number(&self) -> u32
Get the current frame number.
sourcepub const fn sample_rate(&self) -> f32
pub const fn sample_rate(&self) -> f32
Audio sample rate.
sourcepub fn audio_samples(&self) -> &[f32]
pub fn audio_samples(&self) -> &[f32]
Get audio samples.
sourcepub fn clear_audio_samples(&mut self)
pub fn clear_audio_samples(&mut self)
Clear audio samples.
pub fn clock_rate(&mut self) -> f32
sourcepub fn clock_instr(&mut self) -> NesResult<ControlFlow<usize, usize>>
pub fn clock_instr(&mut self) -> NesResult<ControlFlow<usize, usize>>
Steps the control deck one CPU clock.
Errors
If CPU encounteres an invalid opcode, an error is returned.
sourcepub fn clock_seconds(
&mut self,
seconds: f32
) -> NesResult<ControlFlow<usize, usize>>
pub fn clock_seconds( &mut self, seconds: f32 ) -> NesResult<ControlFlow<usize, usize>>
Steps the control deck the number of seconds.
Errors
If CPU encounteres an invalid opcode, an error is returned.
sourcepub fn clock_seconds_inspect<F>(
&mut self,
seconds: f32,
inspect: F
) -> NesResult<ControlFlow<usize, usize>>
pub fn clock_seconds_inspect<F>( &mut self, seconds: f32, inspect: F ) -> NesResult<ControlFlow<usize, usize>>
Steps the control deck the number of seconds with an inspection function, executed on every CPU clock.
Errors
This function will return an error if .
sourcepub fn clock_frame(&mut self) -> NesResult<ControlFlow<usize, usize>>
pub fn clock_frame(&mut self) -> NesResult<ControlFlow<usize, usize>>
Steps the control deck an entire frame
Errors
If CPU encounteres an invalid opcode, an error is returned.
sourcepub fn clock_scanline(&mut self) -> NesResult<ControlFlow<usize, usize>>
pub fn clock_scanline(&mut self) -> NesResult<ControlFlow<usize, usize>>
Steps the control deck a single scanline.
Errors
If CPU encounteres an invalid opcode, an error is returned.
sourcepub const fn cpu_corrupted(&self) -> bool
pub const fn cpu_corrupted(&self) -> bool
Returns whether the CPU is corrupted or not.
pub const fn cpu(&self) -> &Cpu
pub fn cpu_mut(&mut self) -> &mut Cpu
pub const fn ppu(&self) -> &Ppu
pub fn ppu_mut(&mut self) -> &mut Ppu
pub const fn apu(&self) -> &Apu
pub const fn mapper(&self) -> &Mapper
pub fn mapper_mut(&mut self) -> &mut Mapper
sourcepub const fn four_player(&self) -> FourPlayer
pub const fn four_player(&self) -> FourPlayer
Returns whether Four Score is enabled.
sourcepub fn set_four_player(&mut self, four_player: FourPlayer)
pub fn set_four_player(&mut self, four_player: FourPlayer)
Enable/Disable Four Score for 4-player controllers.
sourcepub fn set_cycle_accurate(&mut self, enabled: bool)
pub fn set_cycle_accurate(&mut self, enabled: bool)
Enable/Disable cycle accurate mode
sourcepub fn joypad_mut(&mut self, slot: Slot) -> &mut Joypad
pub fn joypad_mut(&mut self, slot: Slot) -> &mut Joypad
Returns a mutable reference to a joypad.
sourcepub const fn zapper_pos(&self) -> (i32, i32)
pub const fn zapper_pos(&self) -> (i32, i32)
Returns the zapper aiming position for the given controller slot.
sourcepub fn trigger_zapper(&mut self)
pub fn trigger_zapper(&mut self)
Trigger Zapper gun for a given controller slot.
sourcepub fn aim_zapper(&mut self, x: i32, y: i32)
pub fn aim_zapper(&mut self, x: i32, y: i32)
Aim Zapper gun for a given controller slot.
sourcepub fn set_filter(&mut self, filter: VideoFilter)
pub fn set_filter(&mut self, filter: VideoFilter)
Set the image filter for video output.
sourcepub fn connect_zapper(&mut self, enabled: bool)
pub fn connect_zapper(&mut self, enabled: bool)
Enable Zapper gun.
sourcepub fn add_genie_code(&mut self, genie_code: String) -> NesResult<()>
pub fn add_genie_code(&mut self, genie_code: String) -> NesResult<()>
pub fn remove_genie_code(&mut self, genie_code: &str)
sourcepub const fn channel_enabled(&self, channel: Channel) -> bool
pub const fn channel_enabled(&self, channel: Channel) -> bool
Returns whether a given API audio channel is enabled.
sourcepub fn toggle_channel(&mut self, channel: Channel)
pub fn toggle_channel(&mut self, channel: Channel)
Toggle one of the APU audio channels.
sourcepub const fn is_running(&self) -> bool
pub const fn is_running(&self) -> bool
Is control deck running.
Trait Implementations§
source§impl Clock for ControlDeck
impl Clock for ControlDeck
source§impl Clone for ControlDeck
impl Clone for ControlDeck
source§fn clone(&self) -> ControlDeck
fn clone(&self) -> ControlDeck
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more