diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2019-10-18 14:54:02 -0500 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2020-02-08 14:01:55 -0600 |
| commit | e8152b700f76da97d346b93662ef8492bc93190c (patch) | |
| tree | 919fd82b5383987bc39fcafc9a152ea8225072de /Source/Core/InputCommon/ControllerEmu/ControlGroup | |
| parent | 6a857df219f32a6b29683f54100e4cd92edd18e3 (diff) | |
InputCommon: Allow controller settings specified with input expresions.
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu/ControlGroup')
| -rw-r--r-- | Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h | 4 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp | 8 |
2 files changed, 5 insertions, 7 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h index c2311415e5..9560a37843 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h @@ -24,13 +24,11 @@ public: { for (auto& control : controls) { - if (control->control_ref->State() > ACTIVATION_THRESHOLD) + if (control->control_ref->GetState<bool>()) *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 908de81a96..a902034795 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp @@ -35,19 +35,19 @@ void ModifySettingsButton::GetState() { for (size_t i = 0; i < controls.size(); ++i) { - ControlState state = controls[i]->control_ref->State(); + const bool state = controls[i]->control_ref->GetState<bool>(); if (!associated_settings_toggle[i]) { // not toggled - associated_settings[i] = state > ACTIVATION_THRESHOLD; + associated_settings[i] = state; } 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 > ACTIVATION_THRESHOLD) + if (!threshold_exceeded[i] && state) { associated_settings[i] = !associated_settings[i]; @@ -59,7 +59,7 @@ void ModifySettingsButton::GetState() threshold_exceeded[i] = true; } - if (state < ACTIVATION_THRESHOLD) + if (!state) threshold_exceeded[i] = false; } } |
