Opened 5 years ago

Closed 5 years ago

Last modified 5 years 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
Version: Keywords:
Cc: Game:


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 by rophel, 5 years ago

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

comment:2 by lotharsm, 5 years ago

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

comment:3 by dafioram, 5 years ago

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 by rophel, 5 years ago

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 by bgK, 5 years ago

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 by bgK, 5 years ago

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 5 years ago by bgK (previous) (diff)
Note: See TracTickets for help on using tickets.