jackun / USBqemu-wheel

PCSX2 usb plugin for wheels and increasingly more stuff
The Unlicense
121 stars 21 forks source link

XInput mode #59

Open dawerecat opened 4 years ago

dawerecat commented 4 years ago

Wiring a regular gamepad through this plugin may not be what it was designed for, but I think it has a use case. Steering feels more responsive and allows for very shallow turning angles without jerking the stick, and all it takes is a quick setup of linearity and dead zone. Maybe it's possible to approximate it with LilyPad and/or other software, but I'm tired of trying.

It would've already worked great if not for the infamous conjoined triggers of Microsoft controllers in DInput mode. Normally, I'd fix it with "Enable DirectInput Output" in XInputPlus, but in this case it only works until the game is booted, then the emulator stops reacting to any input from the controller, including the plugin's settings (it is possible to set up bindings before launching the game).

I thought I had an ingenious solution of only using USBqemu-wheel for steering, while the rest of the controls are set up through LilyPad, but Gran Turismo 3 stops reading buttons as pressure-sensitive when it detects a steering wheel. Doesn't happen in Gran Turismo 4, by the way, so it must be the game's fault.

I don't know if it would be easier to resolve the conflict with XInputPlus or add native XInput support to the plugin, but either one would be nice. Emulating a wheel also gives the advantage of not having to come up with awkward remapping schemes whenever a game doesn't allow moving throttle and braking onto R2 and L2.

dawerecat commented 4 years ago

FWIW, I devised a perverse solution to my GT3 problem. Throttle on right stick UP, brake on right stick LEFT, thus giving me two separate axes, and steering is still handled by USBqemu-wheel. Handles about right in-game, but thinking about it makes me feel dirty.

jackun commented 4 years ago

Oh god, XInput just lets you query arbitrary controller 0 to 3. I love button remapping! :killme:

jackun commented 4 years ago

Can test with https://ci.appveyor.com/project/jackun/usbqemu-wheel/builds/36309374 Use DInput api, triggers get translated to sliders instead single Z axis. Probably only works correctly with one XInput controller plugged in at once. Maybe I can get some rumble action going too

dawerecat commented 4 years ago

That was fast, thanks. Tried Win32 on 1.6.0 and everything seems to work as well as before, but with separated triggers. Some of the buttons appear to be marked wrong: L1 is swapped with L2, R1 with R2 (L3 and R3 are fine). I remember noticing some of it even before this build. The wheel is set to Driving Force.

Another quality of life thing would be to have a (bigger?) built-in dead zone when the plugin is listening to input in the settings. This is to account for a stick being slightly off-center, specifically when trying to bind stick presses, since it can be hard (though not impossible) not to trigger an axis while doing that.

I'll keep using this to see how it goes.

jackun commented 4 years ago

L1 is swapped with L2, R1 with R2

Have to recheck. There was something with Gran Turismo games that DF and DFPro have them swapped. Maybe not then.

L3/R3

What game uses these? I vaguely remember something but....

Lol, also if the throttle axis isn't bit-exactly 100% "pressed", GT3/4 just don't upshift :( Or lilypad/onepad interferes.

jackun commented 4 years ago

built-in dead zone when the plugin is listening to input in the settings.

Thought detection range already got changed to ~50% but apparently not, just 2000 of 65535. If math is correct, it should be 25% of "single direction" axis now: https://ci.appveyor.com/project/jackun/usbqemu-wheel/builds/36320666

dawerecat commented 4 years ago

GT3 allows binding L3/R3 to actions, so I checked them just in case.

Hot Pursuit 2 has L1/R1 and L2/R2 swapped as well, they don't behave like the input sheet in the menu would suggest. Then again, I've been having some serious issues with steering in that one, in-game calibration doesn't help.

Unrelated: when I'm setting the dead zone for axes, the preview curve is affected from both sides. Does that mean negative dead zone would cut off the maximum input? Speaking of that, I can't seem to reduce the throttle/brake dead zone in GT3 no matter what I do with the slider.

jackun commented 4 years ago

Iirc, up/y axis is the output value so it gets maxed faster, I think.

dawerecat commented 4 years ago

I set up positive dead zone for steering, so it indeed seems to max out earlier, if the curve is to be trusted. In the game itself, looking at the wheels seems to confirm it, though the difference is very small.

jackun commented 4 years ago

@ tocaedit came up with the formula but it might be possible to separate start/end dead zones

dawerecat commented 4 years ago

I'm more worried about a situation when the maximum can't be reached at all, i.e. due to a negative dead zone. But it doesn't seem to be a thing right now, because I either see no difference or very little difference between -50 and 50 dead zone for throttle and braking, though it's a problem in itself.

I do remember having an issue with upshifting on AT (it simply didn't work) when I used a very old version of the plugin from a forum thread. Unfortunately, I don't remember the circumstances, and I never figured out what I did to make it go away.

Right now it appears to be working even when I don't floor it.

jackun commented 4 years ago

L1 is swapped with L2, R1 with R2

Doh, GT4 maps gear shift itself to L2/R2 for DForce