mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-03 12:12:06 +00:00
UI: Add small deadzone for analog speed.
This commit is contained in:
parent
e159cb2b91
commit
0179da6f36
@ -388,6 +388,9 @@ void ControlMapper::processAxis(const AxisInput &axis, int direction) {
|
||||
}
|
||||
|
||||
void ControlMapper::ProcessAnalogSpeed(const AxisInput &axis, bool opposite) {
|
||||
static constexpr float DEADZONE_THRESHOLD = 0.15f;
|
||||
static constexpr float DEADZONE_SCALE = 1.0f / (1.0f - DEADZONE_THRESHOLD);
|
||||
|
||||
FPSLimit &limitMode = PSP_CoreParameter().fpsLimit;
|
||||
// If we're using an alternate speed already, let that win.
|
||||
if (limitMode != FPSLimit::NORMAL && limitMode != FPSLimit::ANALOG)
|
||||
@ -431,6 +434,9 @@ void ControlMapper::ProcessAnalogSpeed(const AxisInput &axis, bool opposite) {
|
||||
value = 0.5f - value * 0.5f;
|
||||
}
|
||||
|
||||
// Apply a small deadzone (against the resting position.)
|
||||
value = std::max(0.0f, (value - DEADZONE_THRESHOLD) * DEADZONE_SCALE);
|
||||
|
||||
// If target is above 60, value is how much to speed up over 60. Otherwise, it's how much slower.
|
||||
// So normalize the target.
|
||||
int target = g_Config.iAnalogFpsLimit - 60;
|
||||
|
Loading…
x
Reference in New Issue
Block a user