[Patch] Mouse speed in the emulator is too high #150

Post new patches here!
Post Reply
User avatar
ruben_balea
Posts: 191
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

[Patch] Mouse speed in the emulator is too high #150

Post by ruben_balea »

A patch for the github issue #150 "Mouse speed in the emulator is too high"

:arrow: This is still a simple and incomplete solution but it may help some users.

My intention is to try to set the mouse cursor speed according to the screen output scaling and maybe also for high DPI screens.
For now I'm hardcoding the correction factors for my Full-HD monitor, that won't work for all PCem users, might work well enough on 16:9 and 16:10 displays like 1280x800, 1280x720, 1366x768, 1440x900, 1600x900, 1680x1050, 1920x1200, just faster as the resolution goes down, but on 5:4 and 4:3 displays the mouse will move noticeably faster in the Y axis than in the X axis and it will make it weird to play some games...
I don't have any of higher resolution to test if they can be calculated with the same formula and to see what happens with DPI scaling

In addition, it would be necessary to obtain the resolution of the physical display, I still don't know if it is already done in some other part of the code or how it can be done.

:!: I think I've tried it quite a bit without finding problems but I don't recommend using it without making a backup of disc images hat will be used in case PCem crashes

mouse_speed#150.patch
(2.7 KiB) Downloaded 197 times
JosepMa
Posts: 202
Joined: Tue 20 Jun, 2017 6:25 pm

Re: [Patch] Mouse speed in the emulator is too high #150

Post by JosepMa »

I had tried it on wx-sdl-mouse instead, which seems like a better place.

My experience with this change wasn't much better.

Maybe you could try mixing your patch and mine (i.e. apply your patch into wx-sdl-mouse) and see if it is better or not than your patch.

Also, this solution only takes the scaling into account, but I still think we need to track the window size.
Also, the mouse on Text mode MS-DOS tends to be too fast anyway. I believe we need to understand better the mouse movements and correctly translate it to column and row movements.
Attachments
test-mousescale.patch
test-mousescale
(645 Bytes) Downloaded 204 times
User avatar
ruben_balea
Posts: 191
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

Re: [Patch] Mouse speed in the emulator is too high #150

Post by ruben_balea »

Yeah wx-sdl-mouse is a better place, I didn't really test it in MS-DOS, not even in graphics modes, I used Windows 95 to try to match the movement of the emulated mouse and that of the physical machine.
User avatar
ruben_balea
Posts: 191
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

Re: [Patch] Mouse speed in the emulator is too high #150

Post by ruben_balea »

Apart from moving the code to wx-sdl-mouse.c I have slightly modified it and now it seems to work better with Windows guests, inlcuding MS-DOS programs that can run in windowed mode within Windows.
But I get the feeling that for MS-DOS and other OS's that use text modes or low resolution graphics, a custom correction will have to be made for each resolution supported by the video cards.

:arrow: I still have the horizontal resolution hardcoded to 1920 for my FullHD (1920x1080) monitor on line 13 of wx-sdl-mouse.c so you will have to change it if the resolution of your monitor is different.
:!: If you applied my previous patch the changes made to mouse.c must be undone, you will find the original mouse.c in the zip file along with the new patch.

Here's the new patch:
mouse_speed#150_2nd_try.zip
(1.53 KiB) Downloaded 223 times
Post Reply