Esempio n. 1
0
// called from ---NETPLAY--- thread
void NetPlayClient::UpdateDevices()
{
  u8 local_pad = 0;
  u8 pad = 0;

  for (auto player_id : m_pad_map)
  {
    // Use local controller types for local controllers if they are compatible
    // Only GCController-like controllers are supported, GBA and similar
    // exotic devices are not supported on netplay.
    if (player_id == m_local_player->pid)
    {
      if (SIDevice_IsGCController(SConfig::GetInstance().m_SIDevice[local_pad]))
      {
        SerialInterface::AddDevice(SConfig::GetInstance().m_SIDevice[local_pad], pad);
      }
      else
      {
        SerialInterface::AddDevice(SIDEVICE_GC_CONTROLLER, pad);
      }
      local_pad++;
    }
    else if (player_id > 0)
    {
      SerialInterface::AddDevice(SIDEVICE_GC_CONTROLLER, pad);
    }
    else
    {
      SerialInterface::AddDevice(SIDEVICE_NONE, pad);
    }
    pad++;
  }
}
void CFrame::OnRecord(wxCommandEvent& WXUNUSED(event))
{
  if ((!Core::IsRunningAndStarted() && Core::IsRunning()) || Movie::IsRecordingInput() ||
      Movie::IsPlayingInput())
    return;

  int controllers = 0;

  if (Movie::IsReadOnly())
  {
    // The user just chose to record a movie, so that should take precedence
    Movie::SetReadOnly(false);
    GetMenuBar()->FindItem(IDM_RECORD_READ_ONLY)->Check(false);
  }

  for (int i = 0; i < 4; i++)
  {
    if (SIDevice_IsGCController(SConfig::GetInstance().m_SIDevice[i]))
      controllers |= (1 << i);

    if (g_wiimote_sources[i] != WIIMOTE_SRC_NONE)
      controllers |= (1 << (i + 4));
  }

  if (Movie::BeginRecordingInput(controllers))
    BootGame("");
}
void CSIDevice_GCController::Rumble(int pad_num, ControlState strength)
{
  SIDevices device = SConfig::GetInstance().m_SIDevice[pad_num];
  if (device == SIDEVICE_WIIU_ADAPTER)
    GCAdapter::Output(pad_num, static_cast<u8>(strength));
  else if (SIDevice_IsGCController(device))
    Pad::Rumble(pad_num, strength);
}