Beispiel #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);
}
Beispiel #2
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);
}