diff options
| author | JMC47 <JMC4789@gmail.com> | 2019-03-30 18:41:46 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-30 18:41:46 -0400 |
| commit | 735a705e4dd9f535dc529e0a7eb0d96ba5982be9 (patch) | |
| tree | f85eaff4a85ef81a6fdfd7ae078aedf6291d2772 /Source/Core/InputCommon/ControllerInterface/Device.h | |
| parent | 2dd564304efe8f0d341cf9ab9093f57f863639a0 (diff) | |
| parent | eadbdd6bc389cd89c3e3e57a31dabaeadf161865 (diff) | |
Merge pull request #7776 from jordan-woyak/wm_devicechange
Add hotplug support to DInput and XInput controller backends
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; |
