mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-10-12 02:22:27 +00:00
Fixes 33ms analog smoothing being accidentally applied to controller analog stick and triggers input (#5340)
Co-authored-by: Kyoskii <[email protected]>
This commit is contained in:
@@ -689,6 +689,7 @@ void ToggleKeyInList(InputID input) {
|
||||
void ControllerOutput::ResetUpdate() {
|
||||
state_changed = false;
|
||||
new_button_state = false;
|
||||
analog_source = false;
|
||||
*new_param = 0; // bruh
|
||||
}
|
||||
void ControllerOutput::AddUpdate(InputEvent event) {
|
||||
@@ -714,6 +715,7 @@ void ControllerOutput::AddUpdate(InputEvent event) {
|
||||
|
||||
} else if (axis != SDL_GAMEPAD_AXIS_INVALID) {
|
||||
*new_param = (event.active ? event.axis_value : 0) + *new_param;
|
||||
analog_source |= event.input.type == InputType::Axis;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -840,6 +842,7 @@ void ControllerOutput::FinalizeUpdate(u8 gamepad_index) {
|
||||
}
|
||||
};
|
||||
float multiplier = 1.0;
|
||||
const bool smooth = !analog_source;
|
||||
Axis c_axis = GetAxisFromSDLAxis(axis);
|
||||
switch (c_axis) {
|
||||
case Axis::LeftX:
|
||||
@@ -854,18 +857,18 @@ void ControllerOutput::FinalizeUpdate(u8 gamepad_index) {
|
||||
break;
|
||||
case Axis::TriggerLeft:
|
||||
ApplyDeadzone(new_param, lefttrigger_deadzone[gamepad_index]);
|
||||
controller->Axis(c_axis, GetAxis(0x0, 0x7f, *new_param));
|
||||
controller->Axis(c_axis, GetAxis(0x0, 0x7f, *new_param), smooth);
|
||||
controller->Button(OrbisPadButtonDataOffset::L2, *new_param > 0x20);
|
||||
return;
|
||||
case Axis::TriggerRight:
|
||||
ApplyDeadzone(new_param, righttrigger_deadzone[gamepad_index]);
|
||||
controller->Axis(c_axis, GetAxis(0x0, 0x7f, *new_param));
|
||||
controller->Axis(c_axis, GetAxis(0x0, 0x7f, *new_param), smooth);
|
||||
controller->Button(OrbisPadButtonDataOffset::R2, *new_param > 0x20);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
controller->Axis(c_axis, GetAxis(-0x80, 0x7f, *new_param * multiplier));
|
||||
controller->Axis(c_axis, GetAxis(-0x80, 0x7f, *new_param * multiplier), smooth);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -458,6 +458,7 @@ public:
|
||||
s16 old_param;
|
||||
s16* new_param;
|
||||
bool old_button_state, new_button_state, state_changed, positive_axis;
|
||||
bool analog_source = false;
|
||||
|
||||
ControllerOutput(const u32 b, u32 a = SDL_GAMEPAD_AXIS_INVALID, bool p = true) {
|
||||
button = b;
|
||||
|
||||
Reference in New Issue
Block a user