muchimi / JoystickGremlinEx

Modified version of Joystick Gremlin to add features I wanted to have but were difficult to do as just a plugin, plus I wanted to run this as 64 bit and on a more current version of Python/QT.
GNU General Public License v3.0
35 stars 6 forks source link

vJoy axes wrong #170

Open Lucarrrrr opened 1 week ago

Lucarrrrr commented 1 week ago

With v13.40.16m10 or earlier one of my vJoy axes were identified wrong: x,y,z and rx instead of x,y,rx and ry. Ry was assigned as y. The only workaround was to change the vJoy axe from ry to z (Image 1. For consistency I want to correct it (Image 2) because it's defined as those by the device (Image ICP). It's not recognized after the change (Image 3) and reboot. In the Settings the axes are shown correct (Image 4), but cant be choosen. Any idea to reread the axes information?

1 2 3 ICP 4

muchimi commented 6 days ago

In GremlinEx, which uses DirectInput, the axes are read in the sequence they appear in DirectInput, up to 8 axes. I've looked and it doesn't appear that the axis usage is read by DirectInput as it doesn't expose that information (I spend some time today looking at the API documentation and the C++ header). That data does exist at the USB descriptor level but not apparently in DirectInput, and GremlinEx does not read USB devices, it uses DirectX to do this, so we're limited by what DirectX provides, which is the count of devices. I'm going to look into this some more because there is an axis mapping structure returned, and I need to see if it skips an index which we can then use).

So when you say the axis name is wrong, you are completely correct in that the name is based on the sequence, and the "normal" sequence is X, Y Z, RX, RY, RZ, S1, S2 for the 8 axes. If you skip a sequence, GremlinEx won't be the wiser.

This said, I need to understand why it matters. Looks like you're using a winwing control panel - I don't have one of those so not sure how the mapping works but for now, use the sequence (number) of the axis rather than the name as the name is essentially arbitary and not used is any mapping, the index of the axis however is.

I'll do some more digging but yes, the name is based, for now, on no gaps in the sequence. It only looks for the first eight axes.

muchimi commented 6 days ago

I configured a device similar to yours with a skipped axis and I think I have a way to get the name by comparing the axis sequence number to the mapping slot. That may be the trick needed here.

muchimi commented 6 days ago

Here's a first go at this. Using the mapping data returned, GremlinEx will attempt to derive the correct usage type for the axis as reported by DirectInput's mapping data. I wish it was possible to get the actual usage flag as coded into the USB device descriptor but that doesn't appear to be feasible, and the other option is to grab that data from the USB descriptor but it could require GremlinEx to have elevated rights and add one more library to the mix - so this is a good compromise and it seems to work based on my testing.

I duplicated your JVOY device and GremlinEx only presented the axes as named in the VJOY configurator. See if this helps any.

https://github.com/muchimi/JoystickGremlinEx/releases/download/13.40.16ex_m/joystick_gremlin_13_40_16_m18.zip

muchimi commented 17 hours ago

Please advise if resolved. Current patch: https://github.com/muchimi/JoystickGremlinEx/releases/download/13.40.16ex_m/joystick_gremlin_13_40_16_m25.zip