MiSTer-devel / Main_MiSTer

Main MiSTer binary and Wiki
GNU General Public License v3.0
3.03k stars 329 forks source link

Feature request: Add analog trigger polling for future Saturn support #823

Open YLFAndy opened 1 year ago

YLFAndy commented 1 year ago

Currently analog triggers are not polled as full byte values. They can be mapped as digital but cannot be read for xinput byte value. This is (currently) specifically an issue for the Saturn core, which has a number of emulated controllers with analog inputs apart from the L and R sticks (perhaps analog trigger quirk could be added?)

NOTE: The core currently can write values to the emulated Saturn pad for the inputs, but it is not hooked up because an appropriate analog read source is non existent. See: https://github.com/srg320/Saturn_MiSTer/blob/master/rtl/hps2pad.sv Applying value to the Z1/Z2 inputs in-core will work, but cannot be read from any analog currently apart from L and R sticks A test core has been created that maps Y2 up to Z1 and Y2 down to Z2 to verify this.

Two known xinput cases: Modern console trigger/8bitDo ultimate controller - both triggers map in Xinput as Z. RT as 0-255, LT as -255-0. Reflex Adapt using Saturn 3D pad - R maps to 'Throttle' L maps to 'Brake' both 0-255.

In-menu work arounds failed - attempting to map triggers to analog stick 2 inputs causes the mapper module to hang after stick 2 down is entered on a number of controllers with analog trigger support. The mapper graphical menu shows up and hangs on dpad R assignment - tested with multiple controllers with analog triggers. Repro steps: Using a controller with analog triggers, launch Define Joystick Buttons in the main MiSTer OSD Map the first set to D pad Map stick 1 to stick 1 When "Press right on Stick 2" is displayed, pull the right trigger. When "Press down on Stick 2" is displayed, pull the left trigger.

Result: This hangs the remainder of the controller mapping.

If this is an issue that can be solved per-core, please close (thought if it was mappable for racing games in general as throttle/brake, that would be a bonus).

sorgelig commented 1 year ago

I will think about implementation.

dazzer69 commented 6 months ago

Any update on implementation?

thorr2 commented 5 months ago

I keep running into this. I would really appreciate analog trigger support. Spy Hunter is another one where I would like to use the analog triggers, along with any other driving game that has foot pedals such as Outrun. Triggers are the logical choice for gas and brake which are separate functions, unlike up/down. I hope this can be implemented soon. Also, the gear button in Spy Hunter is backwards from how I need it to work. I have a real arcade shifter, but up/down is backwards in Spy Hunter. Can a reverse gear (logical not) function be added to Spy Hunter's core menu? I can't find a github issues area for Spy Hunter.

tonytoon commented 3 months ago

I will think about implementation.

I'd like to take a stab at this if you have any ideas or guidance. I've already been mucking around input.cpp and want to learn more about input handling in general.

birdybro commented 3 months ago

I can't find a github issues area for Spy Hunter.

https://github.com/MiSTer-devel/Arcade-MCR3Scroll_MiSTer/issues

gleek12 commented 1 month ago

Hello! Has there been any luck in getting analog triggers to work?