summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
index 700d390b92..cc80b7b234 100644
--- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
@@ -173,6 +173,28 @@ void ControllerInterface::UpdateInput()
}
//
+// RegisterHotplugCallback
+//
+// Register a callback to be called from the input backends' hotplug thread
+// when there is a new device
+//
+void ControllerInterface::RegisterHotplugCallback(std::function<void()> callback)
+{
+ m_hotplug_callbacks.emplace_back(std::move(callback));
+}
+
+//
+// InvokeHotplugCallbacks
+//
+// Invoke all callbacks that were registered
+//
+void ControllerInterface::InvokeHotplugCallbacks() const
+{
+ for (const auto& callback : m_hotplug_callbacks)
+ callback();
+}
+
+//
// InputReference :: State
//
// Gets the state of an input reference