Ejemplo n.º 1
0
void ChangeWiimoteSource(unsigned int index, int source)
{
  g_wiimote_sources[index] = source;
  {
    // kill real connection (or swap to different slot)
    std::lock_guard<std::mutex> lk(g_wiimotes_mutex);

    Wiimote* wm = g_wiimotes[index];

    if (wm)
    {
      g_wiimotes[index] = nullptr;
      // First see if we can use this real Wiimote in another slot.
      TryToConnectWiimote(wm);
    }

    // else, just disconnect the Wiimote
    HandleWiimoteDisconnect(index);
  }

  // reconnect to the emulator
  Host_ConnectWiimote(index, false);
  if (WIIMOTE_SRC_EMU & source)
    Host_ConnectWiimote(index, true);
}
Ejemplo n.º 2
0
static void CheckForDisconnectedWiimotes()
{
  std::lock_guard<std::mutex> lk(g_wiimotes_mutex);
  for (unsigned int i = 0; i < MAX_BBMOTES; ++i)
    if (g_wiimotes[i] && !g_wiimotes[i]->IsConnected())
      HandleWiimoteDisconnect(i);
}
Ejemplo n.º 3
0
void CheckForDisconnectedWiimotes()
{
	std::lock_guard<std::recursive_mutex> lk(g_refresh_lock);

	for (unsigned int i = 0; i < MAX_BBMOTES; ++i)
		if (g_wiimotes[i] && !g_wiimotes[i]->IsConnected())
			HandleWiimoteDisconnect(i);
}
Ejemplo n.º 4
0
// called when the Dolphin app exits
void Shutdown()
{
  g_wiimote_scanner.StopThread();

  NOTICE_LOG(WIIMOTE, "WiimoteReal::Shutdown");

  std::lock_guard<std::mutex> lk(g_wiimotes_mutex);
  for (unsigned int i = 0; i < MAX_BBMOTES; ++i)
    HandleWiimoteDisconnect(i);
}
Ejemplo n.º 5
0
void DoneWithWiimote(int index)
{
	std::lock_guard<std::recursive_mutex> lk(g_refresh_lock);

	Wiimote* wm = g_wiimotes[index];

	if (wm)
	{
		g_wiimotes[index] = nullptr;
		// First see if we can use this real Wiimote in another slot.
		TryToConnectWiimote(wm);
	}

	// else, just disconnect the Wiimote
	HandleWiimoteDisconnect(index);
}
Ejemplo n.º 6
0
// called when the Dolphin app exits
void Shutdown()
{
	g_wiimote_scanner.StopScanning();

	std::lock_guard<std::recursive_mutex> lk(g_refresh_lock);

	if (!g_real_wiimotes_initialized)
		return;

	NOTICE_LOG(WIIMOTE, "WiimoteReal::Shutdown");

	g_real_wiimotes_initialized = false;

	for (unsigned int i = 0; i < MAX_BBMOTES; ++i)
		HandleWiimoteDisconnect(i);
}
Ejemplo n.º 7
0
void Wiimote::Update()
{
  if (!IsConnected())
  {
    HandleWiimoteDisconnect(m_index);
    return;
  }

  // Pop through the queued reports
  const Report& rpt = ProcessReadQueue();

  // Send the report
  if (!rpt.empty() && m_channel > 0)
  {
    Core::Callback_WiimoteInterruptChannel(m_index, m_channel, rpt.data(), (u32)rpt.size());
  }
}