src/io/controller.cc
/*
 * Reads from the specified controller port, shifting it.
 */
Reads from the specified controller port, shifting it.
Reads from the specified controller port shifting it .
DataWord Controller::Read(DoubleWord addr) {
  if (joy_strobe_) {
    joy1_shift_ = input_->Poll();
    joy2_shift_ = 0x00U; 
  }
  DataWord press = 0xFFU;
  if (addr == IO_JOY1_ADDR) {
    press = (joy1_shift_ & 1);
    joy1_shift_ = 0x80U | (joy1_shift_ >> 1);
  } else if (addr == IO_JOY2_ADDR) {
    press = (joy2_shift_ & 1);
    joy2_shift_ = 0x80U | (joy2_shift_ >> 1);
  }
  return press;
}
DataWord Controller :: Read ( DoubleWord addr ) { if ( joy_strobe_ ) { joy1_shift_ = input_ -> Poll ( ) ; joy2_shift_ = 0x00U ; } DataWord press = 0xFFU ; if ( addr == IO_JOY1_ADDR ) { press = ( joy1_shift_ & 1 ) ; joy1_shift_ = 0x80U | ( joy1_shift_ >> 1 ) ; } else if ( addr == IO_JOY2_ADDR ) { press = ( joy2_shift_ & 1 ) ; joy2_shift_ = 0x80U | ( joy2_shift_ >> 1 ) ; } return press ; }
Reads from the specified controller port, shifting it.
Reads from the specified controller port shifting it .
// Poll for SDL inputs, if strobe is active. // No P2 Emulation. // Get the button being pressed for the requested controller and shift // its register to the next button. // Return the requested button press.