diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2019-03-09 09:57:37 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2019-03-29 09:04:16 -0500 |
| commit | eadbdd6bc389cd89c3e3e57a31dabaeadf161865 (patch) | |
| tree | e64941bcb188067cf5355a9cee1a74b42a5ae6ab /Source/Core/InputCommon/ControllerInterface/Device.h | |
| parent | d26c1ce24d9108114d7eab97cfc2ab4f3eea28ee (diff) | |
ControllerInterface/Win32: Prevent devcies from losing their "id" on a hotplug event.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/Device.h')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/Device.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/Device.h b/Source/Core/InputCommon/ControllerInterface/Device.h index 7d7623ba03..defbb6cd4a 100644 --- a/Source/Core/InputCommon/ControllerInterface/Device.h +++ b/Source/Core/InputCommon/ControllerInterface/Device.h @@ -6,6 +6,7 @@ #include <memory> #include <mutex> +#include <optional> #include <string> #include <vector> @@ -82,7 +83,7 @@ public: class Output : public Control { public: - virtual ~Output() {} + virtual ~Output() = default; virtual void SetState(ControlState state) = 0; Output* ToOutput() override { return this; } }; @@ -95,9 +96,17 @@ public: virtual std::string GetSource() const = 0; std::string GetQualifiedName() const; virtual void UpdateInput() {} + + // May be overridden to implement hotplug removal. + // Currently handled on a per-backend basis but this could change. virtual bool IsValid() const { return true; } + + // (e.g. Xbox 360 controllers have controller number LEDs which should match the ID we use.) + virtual std::optional<int> GetPreferredId() const; + const std::vector<Input*>& Inputs() const { return m_inputs; } const std::vector<Output*>& Outputs() const { return m_outputs; } + Input* FindInput(const std::string& name) const; Output* FindOutput(const std::string& name) const; |
