InputCommon: Allow controller settings specified with input expresions.

This commit is contained in:
Jordan Woyak
2019-10-18 14:54:02 -05:00
parent 6a857df219
commit e8152b700f
13 changed files with 172 additions and 28 deletions

View File

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