diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2020-02-22 17:20:44 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-22 17:20:44 +0100 |
| commit | 2b6a1ee4d87a80418ade913e15745d78309f7f67 (patch) | |
| tree | 5989875b0c893ae1ae843a2ef6f1bad3969e39f3 /Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp | |
| parent | f3c89fd6c2e190b41e7cf3a731b1a303b78f359a (diff) | |
| parent | 70ac9ad2e6faf120c8ef4859141675c33e5f33c7 (diff) | |
Merge pull request #8575 from jordan-woyak/ciface-wiimotes
InputCommon: Add support for Wii Remotes in ControllerInterface
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index 130f0f357a..833f288da5 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -7,6 +7,7 @@ #include <algorithm> #include "Common/Logging/Log.h" +#include "Core/HW/WiimoteReal/WiimoteReal.h" #ifdef CIFACE_USE_WIN32 #include "InputCommon/ControllerInterface/Win32/Win32.h" @@ -93,7 +94,7 @@ void ControllerInterface::RefreshDevices() return; { - std::lock_guard<std::mutex> lk(m_devices_mutex); + std::lock_guard lk(m_devices_mutex); m_devices.clear(); } @@ -132,6 +133,8 @@ void ControllerInterface::RefreshDevices() ciface::DualShockUDPClient::PopulateDevices(); #endif + WiimoteReal::ProcessWiimotePool(); + m_is_populating_devices = false; InvokeDevicesChangedCallbacks(); } @@ -146,7 +149,7 @@ void ControllerInterface::Shutdown() m_is_init = false; { - std::lock_guard<std::mutex> lk(m_devices_mutex); + std::lock_guard lk(m_devices_mutex); for (const auto& d : m_devices) { @@ -193,7 +196,7 @@ void ControllerInterface::AddDevice(std::shared_ptr<ciface::Core::Device> device return; { - std::lock_guard<std::mutex> lk(m_devices_mutex); + std::lock_guard lk(m_devices_mutex); const auto is_id_in_use = [&device, this](int id) { return std::any_of(m_devices.begin(), m_devices.end(), [&device, &id](const auto& d) { @@ -229,7 +232,7 @@ void ControllerInterface::AddDevice(std::shared_ptr<ciface::Core::Device> device void ControllerInterface::RemoveDevice(std::function<bool(const ciface::Core::Device*)> callback) { { - std::lock_guard<std::mutex> lk(m_devices_mutex); + std::lock_guard lk(m_devices_mutex); auto it = std::remove_if(m_devices.begin(), m_devices.end(), [&callback](const auto& dev) { if (callback(dev.get())) { @@ -251,7 +254,7 @@ void ControllerInterface::UpdateInput() // Don't block the UI or CPU thread (to avoid a short but noticeable frame drop) if (m_devices_mutex.try_lock()) { - std::lock_guard<std::mutex> lk(m_devices_mutex, std::adopt_lock); + std::lock_guard lk(m_devices_mutex, std::adopt_lock); for (const auto& d : m_devices) d->UpdateInput(); } |
