From df43fd94725ee1abda8eb0c69efcd116c48db399 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Mon, 31 Dec 2018 07:31:11 -0600 Subject: [PATCH] ControllerEmu: Killed the Buttons group threshold setting. --- Source/Core/DolphinQt/Config/Mapping/MappingButton.cpp | 3 ++- .../Core/InputCommon/ControllerEmu/ControlGroup/Buttons.cpp | 2 +- .../Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h | 4 +++- .../ControllerEmu/ControlGroup/ModifySettingsButton.cpp | 6 +++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingButton.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingButton.cpp index 343b522704..11dfe7d924 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingButton.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingButton.cpp @@ -26,6 +26,7 @@ #include "DolphinQt/Settings.h" #include "InputCommon/ControlReference/ControlReference.h" +#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h" #include "InputCommon/ControllerEmu/ControllerEmu.h" #include "InputCommon/ControllerInterface/ControllerInterface.h" #include "InputCommon/ControllerInterface/Device.h" @@ -81,7 +82,7 @@ MappingButton::MappingButton(MappingWidget* widget, ControlReference* ref, bool QFont f = m_parent->font(); QPalette p = m_parent->palette(); - if (state != 0) + if (state > ControllerEmu::Buttons::ACTIVATION_THRESHOLD) { f.setBold(true); p.setColor(QPalette::ButtonText, Qt::red); diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.cpp index e51d4f3711..df6b06a7be 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.cpp @@ -19,6 +19,6 @@ Buttons::Buttons(const std::string& name_) : Buttons(name_, name_) Buttons::Buttons(const std::string& ini_name, const std::string& group_name) : ControlGroup(ini_name, group_name, GroupType::Buttons) { - numeric_settings.emplace_back(std::make_unique(_trans("Threshold"), 0.5)); } + } // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h index 14621f859a..c2311415e5 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h @@ -24,11 +24,13 @@ public: { for (auto& control : controls) { - if (control->control_ref->State() > numeric_settings[0]->GetValue()) // threshold + if (control->control_ref->State() > ACTIVATION_THRESHOLD) *buttons |= *bitmasks; bitmasks++; } } + + static constexpr ControlState ACTIVATION_THRESHOLD = 0.5; }; } // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp index 268d239f0b..6300a590f0 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp @@ -42,14 +42,14 @@ void ModifySettingsButton::GetState() if (!associated_settings_toggle[i]) { // not toggled - associated_settings[i] = state > numeric_settings[0]->GetValue(); + associated_settings[i] = state > ACTIVATION_THRESHOLD; } else { // toggle (loading savestates does not en-/disable toggle) // after we passed the threshold, we en-/disable. but after that, we don't change it // anymore - if (!threshold_exceeded[i] && state > numeric_settings[0]->GetValue()) + if (!threshold_exceeded[i] && state > ACTIVATION_THRESHOLD) { associated_settings[i] = !associated_settings[i]; @@ -61,7 +61,7 @@ void ModifySettingsButton::GetState() threshold_exceeded[i] = true; } - if (state < numeric_settings[0]->GetValue()) + if (state < ACTIVATION_THRESHOLD) threshold_exceeded[i] = false; } }