cge_nes 0.1.2

Cycle-accurate NES (Nintendo Entertainment System) emulator library: CPU, PPU, cartridge, input, and iNES ROM loading.
Documentation
//! Host system input interface module
//!
//! Defines the interface for host systems to provide input state to the emulator.
//! This allows different frontends to implement their own input handling while
//! maintaining a consistent interface with the emulator core.

use super::ConnectedSocket;
use crate::input::input_register::InputDeviceState;

/// Interface for host systems to provide controller input state
///
/// This trait must be implemented by the host system to provide input state
/// for the emulated NES controllers. The implementation should translate
/// the host's input method (keyboard, gamepad, etc.) into NES controller states.
pub trait HostInput {
    /// Returns the current state of the input device for the specified player
    ///
    /// # Arguments
    /// * `player` - The controller port to query (Player1 or Player2)
    ///
    /// # Returns
    /// The current state of the specified input device
    fn input_device_state(&mut self, player: ConnectedSocket) -> InputDeviceState;
}