From 0d783f0869eaef163a318ab4d79744f592ed1cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Mon, 13 Jun 2016 11:11:47 +0200 Subject: ControllerInterface: Add a way to register callbacks This adds RegisterHotplugCallback() to register a callback which will be invoked by the input backends' hotplug threads when there is a new device, so that Core (GCKeyboard, GCPad, Wiimote, Hotkey) can reload the configuration without adding a dependency to Core from InputCommon. --- Source/Core/InputCommon/ControllerInterface/ControllerInterface.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Source/Core/InputCommon/ControllerInterface/ControllerInterface.h') diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h index 2f4212ba85..24f92fd3c1 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h @@ -127,7 +127,11 @@ public: const ciface::Core::DeviceQualifier& default_device) const; void UpdateInput(); + void RegisterHotplugCallback(std::function callback); + void InvokeHotplugCallbacks() const; + private: + std::vector> m_hotplug_callbacks; bool m_is_init; void* m_hwnd; }; -- cgit v1.2.3 From 93f5df419521171c11e16d6a8ff84b9d0d8fd6c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Thu, 14 Jul 2016 17:45:59 +0200 Subject: ControllerInterface: Add RemoveDevice() This adds RemoveDevice() to ControllerInterface, fixes ExpressionParser and some other code to support device removals without crashing, and adds an IsValid() method to Device, to prepare for hotplugging. --- Source/Core/InputCommon/ControllerInterface/ControllerInterface.h | 1 + 1 file changed, 1 insertion(+) (limited to 'Source/Core/InputCommon/ControllerInterface/ControllerInterface.h') diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h index 24f92fd3c1..198a2c180b 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h @@ -122,6 +122,7 @@ public: void Reinitialize(); void Shutdown(); void AddDevice(std::shared_ptr device); + void RemoveDevice(std::function callback); bool IsInit() const { return m_is_init; } void UpdateReference(ControlReference* control, const ciface::Core::DeviceQualifier& default_device) const; -- cgit v1.2.3