diff options
| author | Filoppi <filippotarpini@hotmail.it> | 2021-05-15 12:10:00 +0300 |
|---|---|---|
| committer | Filoppi <filippotarpini@hotmail.it> | 2021-06-07 11:07:06 +0300 |
| commit | 1d816f8f267ff468478a4b8ff423b2dd0c734654 (patch) | |
| tree | a8e96d6d00f9ae3a8796a84a2dd413a90580cae5 /Source/Core/InputCommon/ControllerInterface | |
| parent | c238e4911916e2a90e2e324873e0da4907d243c3 (diff) | |
ControllerInterface: make real Wiimote use PlatformPopulateDevices()
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp | 18 |
2 files changed, 12 insertions, 8 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index b84e8af571..cb4eae1472 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -185,7 +185,7 @@ void ControllerInterface::RefreshDevices(RefreshReason reason) ciface::DualShockUDPClient::PopulateDevices(); #endif - WiimoteReal::ProcessWiimotePool(); + WiimoteReal::PopulateDevices(); m_devices_mutex.unlock(); diff --git a/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp b/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp index eaa56ef449..dfd329f5e0 100644 --- a/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp @@ -128,13 +128,17 @@ void ReleaseDevices(std::optional<u32> count) // Remove up to "count" remotes (or all of them if nullopt). // Real wiimotes will be added to the pool. - g_controller_interface.RemoveDevice([&](const Core::Device* device) { - if (device->GetSource() != SOURCE_NAME || count == removed_devices) - return false; - - ++removed_devices; - return true; - }); + // Make sure to force the device removal immediately (as they are shared ptrs and + // they could be kept alive, preventing us from re-creating the device) + g_controller_interface.RemoveDevice( + [&](const Core::Device* device) { + if (device->GetSource() != SOURCE_NAME || count == removed_devices) + return false; + + ++removed_devices; + return true; + }, + true); } Device::Device(std::unique_ptr<WiimoteReal::Wiimote> wiimote) : m_wiimote(std::move(wiimote)) |
