diff options
| author | Scott Mansell <phiren@gmail.com> | 2016-06-22 01:33:53 +1200 |
|---|---|---|
| committer | Scott Mansell <phiren@gmail.com> | 2016-06-22 17:02:30 +1200 |
| commit | 2ec3a24e4ee50edc612dd6a116f12428284eb24c (patch) | |
| tree | 0732f8825886764b4d7a78c9705119c60233673a /Source/Core/InputCommon | |
| parent | ce4e6804a5f211fb407a2cc04439904b5938300a (diff) | |
analytics: Collect less data about controllers.
The name field can contain personal information, particularly in the
case of bluetooth devices on OSX which get configured with the user's
full name.
Diffstat (limited to 'Source/Core/InputCommon')
| -rw-r--r-- | Source/Core/InputCommon/InputConfig.cpp | 14 | ||||
| -rw-r--r-- | Source/Core/InputCommon/InputConfig.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/InputConfig.cpp b/Source/Core/InputCommon/InputConfig.cpp index f4a5900b96..58d46b92b6 100644 --- a/Source/Core/InputCommon/InputConfig.cpp +++ b/Source/Core/InputCommon/InputConfig.cpp @@ -117,3 +117,17 @@ bool InputConfig::ControllersNeedToBeCreated() const { return m_controllers.empty(); } + +bool InputConfig::IsControllerControlledByGamepadDevice(int index) const +{ + if (static_cast<size_t>(index) >= m_controllers.size()) + return false; + + const auto& controller = m_controllers.at(index).get()->default_device; + + // Filter out anything which obviously not a gamepad + return !((controller.source == "Keyboard") // OSX Keyboard/Mouse + || (controller.source == "XInput2") // Linux and BSD Keyboard/Mouse + || (controller.source == "Android" && controller.name == "Touchscreen") // Android Touchscreen + || (controller.source == "DInput" && controller.name == "Keyboard Mouse")); // Windows Keyboard/Mouse +} diff --git a/Source/Core/InputCommon/InputConfig.h b/Source/Core/InputCommon/InputConfig.h index d8ebdd1a7e..a1f712cc91 100644 --- a/Source/Core/InputCommon/InputConfig.h +++ b/Source/Core/InputCommon/InputConfig.h @@ -31,6 +31,7 @@ public: ControllerEmu* GetController(int index); void ClearControllers(); bool ControllersNeedToBeCreated() const; + bool IsControllerControlledByGamepadDevice(int index) const; std::string GetGUIName() const { return m_gui_name; } std::string GetProfileName() const { return m_profile_name; } |
