ControllerInterface: make real Wiimote use PlatformPopulateDevices()

This commit is contained in:
Filoppi
2021-05-15 12:10:00 +03:00
parent c238e49119
commit 1d816f8f26
4 changed files with 38 additions and 13 deletions

View File

@ -185,7 +185,7 @@ void ControllerInterface::RefreshDevices(RefreshReason reason)
ciface::DualShockUDPClient::PopulateDevices();
#endif
WiimoteReal::ProcessWiimotePool();
WiimoteReal::PopulateDevices();
m_devices_mutex.unlock();

View File

@ -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;
// 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;
});
++removed_devices;
return true;
},
true);
}
Device::Device(std::unique_ptr<WiimoteReal::Wiimote> wiimote) : m_wiimote(std::move(wiimote))