ControllerEmu: Clamp results of trigger/slider states to prevent integer overflow later on.

This commit is contained in:
Jordan Woyak
2019-10-15 15:35:07 -05:00
parent 4425d05c4a
commit b120b08726
3 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@ void MixedTriggers::GetState(u16* const digital, const u16* bitmasks, ControlSta
{
const ControlState button_value = ApplyDeadzone(controls[i]->control_ref->State(), deadzone);
ControlState analog_value =
ApplyDeadzone(controls[trigger_count + i]->control_ref->State(), deadzone);
std::min(ApplyDeadzone(controls[trigger_count + i]->control_ref->State(), deadzone), 1.0);
// Apply threshold:
if (button_value > threshold)