summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/CoreDevice.h
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-06-07 12:15:15 +0200
committerGitHub <noreply@github.com>2021-06-07 12:15:15 +0200
commit8ca6ffd908aa95ffb5c7665083463c4ea1139b0d (patch)
tree5a058d8aa001d2577f7e65d5aa44ec86737c3386 /Source/Core/InputCommon/ControllerInterface/CoreDevice.h
parentebe3fbe04c329f9bc100ded4dcf22720f375e2f4 (diff)
parent83ea16f40238fa82981221ba65061a7094b2a64b (diff)
Merge pull request #9702 from Filoppi/controller_interface_fixes
Controller Interface refactor
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/CoreDevice.h')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/CoreDevice.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/CoreDevice.h b/Source/Core/InputCommon/ControllerInterface/CoreDevice.h
index c368578949..d3312568b2 100644
--- a/Source/Core/InputCommon/ControllerInterface/CoreDevice.h
+++ b/Source/Core/InputCommon/ControllerInterface/CoreDevice.h
@@ -125,9 +125,20 @@ public:
// Currently handled on a per-backend basis but this could change.
virtual bool IsValid() const { return true; }
+ // Returns true whether this device is "virtual/emulated", not linked
+ // to any actual physical device. Mostly used by keyboard and mouse devices,
+ // and to avoid uselessly recreating the device unless really necessary.
+ // Doesn't necessarily need to be set to true if the device is virtual.
+ virtual bool IsVirtualDevice() const { return false; }
+
// (e.g. Xbox 360 controllers have controller number LEDs which should match the ID we use.)
virtual std::optional<int> GetPreferredId() const;
+ // Use this to change the order in which devices are sorted in their list.
+ // A higher priority means it will be one of the first ones (smaller index), making it more
+ // likely to be index 0, which is automatically set as the default device when there isn't one.
+ virtual int GetSortPriority() const { return 0; }
+
const std::vector<Input*>& Inputs() const { return m_inputs; }
const std::vector<Output*>& Outputs() const { return m_outputs; }
@@ -227,6 +238,7 @@ public:
std::chrono::milliseconds maximum_wait) const;
protected:
+ // Exclusively needed when reading/writing "m_devices"
mutable std::recursive_mutex m_devices_mutex;
std::vector<std::shared_ptr<Device>> m_devices;
};