Opened 4 weeks ago

Closed 3 weeks ago

Last modified 3 weeks ago

#10996 closed defect (fixed)

Gamepad cursor jumps to the far left when you move it to the right side in Fullscreen mode

Reported by: rophel Owned by: bgK
Priority: normal Component: Common
Keywords: Cc:


Repro steps:
1 Start latest daily snapshot
2 Edit scummvm.ini to enable gamepad (add "joystick_num=0")
3 Make sure you have a gamepad on and plugged in, then Launch ScummVM.
4 Select Options > enable option "fullscreen mode" and click apply.
5 Using gamepad, move left stick to the right.


Cursor will move to the right, but then 15% from the edge of the window it will jump to the far left. This makes it impossible to play games via gamepad since part of the screen can not be selected.

Issue is not present in 2.0.0 or old stable build found on the downloads page. It also seems to only be present in builds using SDL 2.0. The issue is resolved when playing in windowed mode, or when playing with fullscreen centered mode.

Change History (6)

comment:1 Changed 4 weeks ago by rophel

Note: If you resize the ScummVM window to be larger, the issue is still present even in windowed mode.

comment:2 Changed 4 weeks ago by lotharsm

I can't replicate this using the latest snapshot and a Playstation 4 controller.

comment:3 Changed 4 weeks ago by dafioram

I can't repo with xbox 360 controller either.

Which ScummVM binary are you using, which OS, which SDL version, and which controller?

comment:4 Changed 4 weeks ago by rophel

Big find: This only occurs when my resolution is set to 2560x1440, 1920x1080 works fine.

I am using Windows 10 1903 64 bit, SDL is 2.0, the one included with latest snapshot. Controller is Xbox One.

comment:5 Changed 3 weeks ago by bgK

Looks like you put your finger on something interesting indeed. The gamepad -> mouse code uses 16-bits integers for some computations, and a 16x multiplier. 2560 * 16 overflows a signed 16 bits integer, while 1920 * 16 does not.

comment:6 Changed 3 weeks ago by bgK

Owner: set to bgK
Resolution: fixed
Status: newclosed

In 0a8049e:

SDL: Fix gamepad mouse cursor wrapping on hi-res screens

The cursor position was overflowing a signed 16-bits integer once
multiplied with MULTIPLIER when using a resolution such as 2560x1440.

It would be nice changing this code to make more sense, sadly it is
thightly coupled with platform specific subclasses.

Fixes #10996.

Last edited 3 weeks ago by bgK (previous) (diff)
Note: See TracTickets for help on using tickets.