Struct rustzx_core::Emulator

source ·
pub struct Emulator<H: Host> { /* private fields */ }
Expand description

Represents main Emulator structure

Implementations§

source§

impl<H: Host> Emulator<H>

source

pub fn new(settings: RustzxSettings, context: H::Context) -> Result<Self>

Constructs new emulator

Arguments

settings - emulator settings

source

pub fn set_speed(&mut self, new_speed: EmulationMode)

changes emulation speed

source

pub fn set_fast_load(&mut self, value: bool)

changes fast loading flag

source

pub fn load_snapshot( &mut self, snapshot: Snapshot<impl SnapshotAsset> ) -> Result<()>

source

pub fn save_snapshot<R>(&mut self, recorder: SnapshotRecorder<R>) -> Result<()>where R: DataRecorder,

source

pub fn load_tape(&mut self, tape: Tape<H::TapeAsset>) -> Result<()>

source

pub fn load_rom(&mut self, rom: impl RomSet) -> Result<()>

source

pub fn load_screen(&mut self, screen: Screen<impl ScreenAsset>) -> Result<()>

source

pub fn play_tape(&mut self)

source

pub fn stop_tape(&mut self)

source

pub fn rewind_tape(&mut self) -> Result<()>

Rewinds tape. May return error if underlying tape asset failed to perform seek operation to go back to the the beginning of the tape

source

pub fn screen_buffer(&self) -> &H::FrameBuffer

source

pub fn set_io_extender(&mut self, extender: H::IoExtender)

source

pub fn io_extender(&mut self) -> Option<&mut H::IoExtender>

source

pub fn set_debug_interface(&mut self, debug_interface: H::DebugInterface)

Sets Host::DebugInterface for the emulator instance

source

pub fn debug_interface(&mut self) -> Option<&mut H::DebugInterface>

Returns current Host::DebugInterface instance

source

pub fn peek(&self, addr: u16) -> u8

Reads byte from memory

source

pub fn border_color(&self) -> ZXColor

source

pub fn send_key(&mut self, key: ZXKey, pressed: bool)

source

pub fn send_compound_key(&mut self, key: CompoundKey, pressed: bool)

source

pub fn send_kempston_key(&mut self, key: KempstonKey, pressed: bool)

source

pub fn send_sinclair_key( &mut self, num: SinclairJoyNum, key: SinclairKey, pressed: bool )

source

pub fn send_mouse_button(&mut self, button: KempstonMouseButton, pressed: bool)

source

pub fn send_mouse_wheel(&mut self, dir: KempstonMouseWheelDirection)

source

pub fn send_mouse_pos_diff(&mut self, x: i8, y: i8)

source

pub fn execute_poke(&mut self, poke: impl Poke)

Execute poke::Poke action on the emulator

source

pub fn emulate_frames( &mut self, emulation_limit: Duration ) -> Result<EmulationInfo>

Perform emulatio up to emulation_limit duration, returns actual elapsed duration

Auto Trait Implementations§

§

impl<H> RefUnwindSafe for Emulator<H>where <H as Host>::DebugInterface: RefUnwindSafe, <H as Host>::FrameBuffer: RefUnwindSafe, <H as Host>::IoExtender: RefUnwindSafe, <H as Host>::TapeAsset: RefUnwindSafe,

§

impl<H> Send for Emulator<H>where <H as Host>::DebugInterface: Send, <H as Host>::FrameBuffer: Send, <H as Host>::IoExtender: Send, <H as Host>::TapeAsset: Send,

§

impl<H> Sync for Emulator<H>where <H as Host>::DebugInterface: Sync, <H as Host>::FrameBuffer: Sync, <H as Host>::IoExtender: Sync, <H as Host>::TapeAsset: Sync,

§

impl<H> Unpin for Emulator<H>where <H as Host>::DebugInterface: Unpin, <H as Host>::FrameBuffer: Unpin, <H as Host>::IoExtender: Unpin, <H as Host>::TapeAsset: Unpin,

§

impl<H> UnwindSafe for Emulator<H>where <H as Host>::DebugInterface: UnwindSafe, <H as Host>::FrameBuffer: UnwindSafe, <H as Host>::IoExtender: UnwindSafe, <H as Host>::TapeAsset: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.