From 2ec3a24e4ee50edc612dd6a116f12428284eb24c Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Wed, 22 Jun 2016 01:33:53 +1200 Subject: [PATCH] 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. --- Source/Core/Core/Analytics.cpp | 8 +++----- Source/Core/InputCommon/InputConfig.cpp | 14 ++++++++++++++ Source/Core/InputCommon/InputConfig.h | 1 + 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Analytics.cpp b/Source/Core/Core/Analytics.cpp index 4a9f1f72f3..7bbe40303a 100644 --- a/Source/Core/Core/Analytics.cpp +++ b/Source/Core/Core/Analytics.cpp @@ -247,12 +247,10 @@ void DolphinAnalytics::MakePerGameBuilder() builder.AddData("movie", Movie::IsMovieActive()); // Controller information + // We grab enough to tell what percentage of our users are playing with keyboard/mouse, some kind of gamepad + // or the official gamecube adapter. builder.AddData("gcadapter-detected", GCAdapter::IsDetected()); - - // For privacy reasons, limit this to type of the first controller. - // The ControllersNeedToBeCreated() check is enough to ensure GetController(0) won't return nullptr or throw exceptions. - if (!Pad::GetConfig()->ControllersNeedToBeCreated()) - builder.AddData("controller-type", Pad::GetConfig()->GetController(0)->default_device.name); + builder.AddData("has-controller", Pad::GetConfig()->IsControllerControlledByGamepadDevice(0) || GCAdapter::IsDetected()); m_per_game_builder = builder; } 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(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; }