libretro / stella2014-libretro

Port of Stella to libretro.
24 stars 36 forks source link

Add support for Stelladaptor-like physical paddle devices #76

Closed jdgleaver closed 3 years ago

jdgleaver commented 3 years ago

At present, the core supports analog paddle input when using gamepads (#71), with relative paddle motion corresponding to analog stick displacement.

Unfortunately, this is incompatible with real, physical paddles (Stelladaptor, iCode, etc.) , which require absolute positioning to function correctly.

This PR enables support for these devices by adding a new virtual controller type. In Quick Menu > Controls > Port x Controls, Device Type can be set to Gamepad for regular input, or Paddles (Stelladaptor) for real paddle input.

When Paddles (Stelladaptor) is selected, inputs are mapped as follows (this is the normal convention for Atari controller adaptors):

Port 1:

Port 2:

Note that 4-player games are thus supported.

alijani1 commented 3 years ago

@jdgleaver thanks for working on this. Some great progress!

There seems to be one issue though.

To get things to work very well, I had to rig the range as it seems you only use a portions of the range of x and y axis. For example if the x axis range is -32,767 t0 32,767, only the segment from -2,000 to 30,000 seems to map to the games thus it made the paddles very sensitive. If you load breakout for example, just moving ~25% of the way to the left, the game screen paddle moves all the way to the left of the screen. basically it appears the negative areas (left and up) are not used. I had to compensate for this in my firmware which should not be needed. I tried changing the sensitivity settings in Retroarch settings but they had no effect.

If you can look into this as to why the negative portions of the x and y do not get used, I would be grateful. Let me know if this makes sense or if you need more details and i can create a quick video if needed.

Thanks again and let me know.

jdgleaver commented 3 years ago

@alijani1 Ah, I see what's happening. We're using the regular 'internal' stella code here:

https://github.com/libretro/stella2014-libretro/blob/7be813894574c75b16d53f0e8fb86f6e8f06afc0/stella/src/emucore/Paddles.cxx#L261-L284

...but I see in upstream 'latest' Stella, they've added sensitivity and centre offset options:

https://github.com/stella-emu/stella/blob/ac26a6f3610c80cbfa60629fd1d44d29eb01f84f/src/emucore/Paddles.cxx#L228-L258

...so the user can manually scale the input to make use of the full range.

I will try to backport these settings later in the week (it's a little time consuming, since it means I need to wire up core option hiding as well - it doesn't matter so much at present, but when we have two sets of options for the different controller types, it gets confusing to show all of them all the time)

jdgleaver commented 3 years ago

@alijani1 I finally found some time to work on this: #78

I am sorry that it took so long. Once the PR is merged, you should be able to adjust the sensitivity/offset values to make full use of your controller's input range.