#[non_exhaustive]pub enum DeviceInput {
None,
Zapper {
x: u16,
y: u16,
trigger: bool,
},
Vaus {
position: u8,
fire: bool,
},
PowerPad(u16),
FamilyTrainer(u16),
SnesMouse {
dx: i16,
dy: i16,
left: bool,
right: bool,
sensitivity: u8,
},
FamilyKeyboard([u8; 9]),
SuborKeyboard([u8; 9]),
KonamiHyperShot(u8),
BandaiHyperShot(u8),
}Expand description
What one controller port’s expansion device is doing in a movie frame.
One variant per InputDevice kind, holding exactly the fields a host
sets through that device’s Nes setter – never the device’s internal
shift registers or strobe latch, which the emulation derives. A replay
that sets these fields at the same point the host did reproduces the
device’s reads.
#[non_exhaustive]: a device added later is an additive change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
None
No expansion device: the port reads its standard controller (or the Four Score).
Zapper
NES Zapper: aim point and trigger (Nes::set_zapper). The light
sense is computed from the picture, not recorded.
Fields
Vaus
Arkanoid “Vaus” paddle (Nes::set_paddle).
PowerPad(u16)
NES Power Pad mat: the 12-button mask (Nes::set_power_pad).
FamilyTrainer(u16)
Bandai Family Trainer mat: the 12-button mask
(Nes::set_family_trainer).
SnesMouse
SNES-style mouse (Nes::set_snes_mouse).
Fields
FamilyKeyboard([u8; 9])
Family BASIC keyboard: one byte per matrix row
(Nes::set_family_keyboard).
SuborKeyboard([u8; 9])
Subor keyboard: one byte per matrix row (Nes::set_subor_keyboard).
KonamiHyperShot(u8)
Konami Hyper Shot: the 4-button mask (Nes::set_konami_hyper_shot).
BandaiHyperShot(u8)
Bandai Hyper Shot: the 8-sensor mask (Nes::set_bandai_hyper_shot).
Implementations§
Source§impl DeviceInput
impl DeviceInput
Sourcepub const fn capture(device: &Option<InputDevice>) -> Self
pub const fn capture(device: &Option<InputDevice>) -> Self
Read the host-set fields of the device attached to a port.
Sourcepub fn apply(self, nes: &mut Nes, port: usize)
pub fn apply(self, nes: &mut Nes, port: usize)
Drive port of nes to this device input.
A different device kind is attached fresh (exactly what the Nes
convenience setters do when the kind is absent); the same kind keeps
its internal state and only has its host-set fields written, as the
host’s own per-frame call did. Self::None unplugs a device.
§Panics
Panics if port is not 0 or 1.