Skip to main content

ExtraInput

Struct ExtraInput 

Source
#[non_exhaustive]
pub struct ExtraInput { pub devices: [DeviceInput; 2], pub microphone: bool, pub vs_coin: u8, pub vs_service: bool, pub disk_side: Option<u8>, pub barcode: Option<Barcode>, }
Expand description

Every non-controller input of one movie frame. See the module docs.

Default is the neutral machine: no device on either port, microphone released, no coin, service released, disk ejected, no scan. It is the baseline the on-disk changes are taken against, not “nothing recorded” (that is crate::FrameInput::extra being None).

#[non_exhaustive]: build one with Self::capture or Default and set fields.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§devices: [DeviceInput; 2]

The expansion device on port 0 ($4016) and port 1 ($4017).

§microphone: bool

Famicom microphone asserted ($4016 bit 2).

§vs_coin: u8

Vs. System coin acceptors latched: bit 0 = #1, bit 1 = #2.

§vs_service: bool

Vs. System service button held.

§disk_side: Option<u8>

The inserted FDS disk side (0-based), or None when ejected – and always None on a cartridge, which has no disk. Side 255 cannot be stored (its byte means “ejected”); no FDS image comes near it.

§barcode: Option<Barcode>

A Datach barcode swiped just before this frame (an event: set on the one frame the scan was made before, None on every other).

Implementations§

Source§

impl ExtraInput

Source

pub fn capture(nes: &Nes) -> Self

Read every non-controller input nes holds now. Called by crate::FrameInput::held_on, after the host’s input calls and before the frame.

A disk side beyond 254 cannot be stored; no FDS image has that many (a side is 65,500 bytes), and such a side records as ejected.

Source

pub fn apply(&self, nes: &mut Nes)

Drive nes to these inputs, before the frame runs.

Levels the host sets every frame (devices, microphone, coin, service) are written every frame, as the host wrote them. The disk is changed only when it differs, because inserting a side is an act with consequences (it resets the head and opens the drive’s not-ready window), and a host only does it once. A barcode is swiped when present.

A scan the machine cannot take (no reader) is ignored: the movie’s board check (crate::Movie::seek_to_start) already refused a machine without the cartridge it was recorded on.

Source

pub const fn held(self) -> Self

This frame’s inputs with the barcode event removed: what the next frame starts from when it records no change.

Trait Implementations§

Source§

impl Clone for ExtraInput

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ExtraInput

Source§

impl Debug for ExtraInput

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ExtraInput

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for ExtraInput

Source§

impl Hash for ExtraInput

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ExtraInput

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ExtraInput

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.