Opened 4 years ago
Closed 17 months ago
#12032 closed defect (fixed)
BACKENDS: SDL: cursor drifting for game controller
Reported by: | beaumanvienna | Owned by: | tag2015 |
---|---|---|---|
Priority: | high | Component: | --Other-- |
Version: | Keywords: | ||
Cc: | Game: |
Description
scummvm version: upstream
where: main screen
This is fixing the issue for me: backends/events/sdl/sdl-events.cpp
bool SdlEventSource::handleJoyAxisMotion(SDL_Event &ev, Common::Event &event) {
event.type = Common::EVENT_JOYAXIS_MOTION;
event.joystick.axis = ev.jaxis.axis;
if (abs(ev.jaxis.value) > 4000)
event.joystick.position = ev.jaxis.value >> 1;
else
event.joystick.position = 0;
return true;
}
Change History (10)
comment:1 by , 4 years ago
Summary: | cursor drifting for game controller → SDL: cursor drifting for game controller |
---|
comment:2 by , 4 years ago
Summary: | SDL: cursor drifting for game controller → BACKENDS: SDL: cursor drifting for game controller |
---|
comment:3 by , 3 years ago
Priority: | normal → high |
---|
comment:4 by , 2 years ago
Component: | --Unset-- → --Other-- |
---|
comment:5 by , 2 years ago
I think reading this code that it is implementing a fixed "deadband" for the joystick axis to prevent small zero offsets on the hardware causing drifts.
This would be applied at https://github.com/scummvm/scummvm/blob/master/backends/events/sdl/sdl-events.cpp#L823
However, I think that this is very hardware dependent and if this is implemented, it will be necessary to allow the deadband to be configured between 0 i.e. disabled and up to say around 4000. It is also usual to offset the deadband to avoid the startup jerk i.e. sudden 0 to 4000 transition with current code.
P.S. Had to do this kind of code for my "day job" a fair bit..
comment:7 by , 2 years ago
https://wiki.libsdl.org/SDL_JoyAxisEvent and https://wiki.libsdl.org/SDL_JoystickGetAxis have some notes on this i.e. "The value returned by SDL_JoystickGetAxis() is a signed integer (-32768 to 32767) representing the current position of the axis. It may be necessary to impose certain tolerances on these values to account for jitter."
comment:8 by , 22 months ago
There's already an option for adjusting the joystick deadzone, so this should just be a case of increasing the maximum value.
comment:9 by , 18 months ago
I don't remember how the situation was 2 years ago when the bugreport was opened, but now, as ccawley correctly stated, there's already a deadzone setting (that's the Control tab in Options, but it's shown only if there is a compatible controller available).
The deadzone setting goes from 1000 to 10000 which should be more than enough for most devices.
To be sure, I checked the pointer behavior using a PS5 controller and the deadzone setting works great.
This could be closed, unless I'm missing something.
comment:10 by , 17 months ago
Owner: | set to |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Closing as there is no reply on previous statement.
This bug would be nice to get fixed before the release.