Merge pull request #7664 from jordan-woyak/kill-button-threshold

ControllerEmu: Killed the button group threshold setting.
This commit is contained in:
Léo Lam
2019-01-16 21:33:05 +01:00
committed by GitHub
4 changed files with 9 additions and 6 deletions

View File

@ -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<NumericSetting>(_trans("Threshold"), 0.5));
}
} // namespace ControllerEmu

View File

@ -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

View File

@ -41,14 +41,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];
@ -60,7 +60,7 @@ void ModifySettingsButton::GetState()
threshold_exceeded[i] = true;
}
if (state < numeric_settings[0]->GetValue())
if (state < ACTIVATION_THRESHOLD)
threshold_exceeded[i] = false;
}
}