libretro / libretro-uae

PUAE libretro
GNU General Public License v2.0
110 stars 60 forks source link

Analog stick mouse refactor + cleanup #655

Closed sonninnos closed 2 months ago

sonninnos commented 2 months ago
rsn8887 commented 2 months ago

Why are you clamping the sub pixel remainder value? This shouldn’t be necessary because it artificially limits the minimum mouse speed now. There’s already a deadzone.

if (fabs(delta) < 0.1f)
         *sub_pixel_remainder = 0;
else
         *sub_pixel_remainder += delta - mouse_axis;

if (fabs(*sub_pixel_remainder) > 1.0f)
         *sub_pixel_remainder = 0;

It should work better without the if and without the sub pixel remainder = 0 (more fine grained control), to just replace the above with this line:

*sub_pixel_remainder += delta - mouse_axis;

A possibility is that I am misunderstanding something, but the if else shenanigans above look like a hack.

sonninnos commented 2 months ago

Before it clamped even bigger values. Please try it first. That addition is only for making it a little bit easier to do straight horizontal and vertical lines, but not too much.

The adjust_analog_deadzone() refactor ultimately made a bigger impact with diagonal precision, but I changed that last and didn't try changing these after it anymore. In any case even 0.3 values went ignored before, so there is still more overall precision now.

rsn8887 commented 2 months ago

Ok I can try it later on Steamdeck, RPi and MacOS and report.