HOTAS, X52 Pro and low button/axes limit in Wine

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
Patola
Level 2
Level 2
Posts: 10
Joined: Sat Mar 31, 2018 3:05 am

HOTAS, X52 Pro and low button/axes limit in Wine

Post by Patola »

Greetings, fellow linuxers! There has been a time now I have a HOTAS kit (first a Thrustmaster Warthog, now a Logitech X52 Pro) and as I have played like Elite: Dangerous and Star Citizen through wine, I noticed some controls would not work, which I first attributed to maybe linux having poor device support.

However, I came to notice that native games like X4: Foundations and X: Rebirth perfectly support all the HOTAS controls, and went to investigate why wine games wouldn't work with some of the stuff. I then realized that my HOTAS kit with 8 analog axes and 39 buttons is greater than wine's limits (which seem to be of 6 axes and 32 buttons), which are kind of hardwired in a few scattered portions of the code. Mainly: dlls/joy.cpl/joy.h, dlls/joy.cpl/main.c, dlls/winebus.sys/bus_sdl.c and dlls/winejoystick.drv/joystick_linux.c.

I have successfully changed the code and the games seem to be responding well to my patch, however I get a lot of questions on why/how should I send it to the wine project and about the code... For example:
  • in driver_joyGetPosEx (joystick_linux.c) I see a lot of hardcoded expectations of axes "types" and positions in the list. It seems you must have a defined coordinate variable and type to use the value. What would happen if I would have an unknown type (which was the case with the "mouse wheel" of the X52 Pro thruster) or had two of the same type there?
  • There is also software like https://github.com/zvxryb/Linux-Virtual-Joystick which can aggregate two or more devices in one device that might easily overflow the limit. Windows users use that too, it is useful for games that do not support HOTAS which are more than one device, like the Egosoft X3 games. So, why this limit wasn't increased until today?
  • Where should I send my patch? To the regular wine project, wine-staging, or some other? What are the steps I could take to get it tested and sent to more game-oriented flavors of wine (like Proton) as soon as possible?
  • The joystick testing dialogs in wine control are not prepared for the increased amount of buttons and axes. How can I best change them to deal with that?
User avatar
BradleyR
Newbie
Newbie
Posts: 3
Joined: Thu Jul 02, 2020 2:48 pm

Re: HOTAS, X52 Pro and low button/axes limit in Wine

Post by BradleyR »

I unfortunately cannot answer your questions as I have only recently started using my Fedora install for gaming - a final move off Windows, game support was the only thing keeping me there - and thus am not versed in Wine's joystick code or project management whatsoever. However, your post was linked to me on Reddit as a possible resolution to an issue similar to yours described above.

I use a VKBSim Gladiator MK.II, Thrustmaster TWCS and Saitek Pro Flight Rudder Pedals - the stick and pedals work fine in Wine games - Star Citizen has been my testbed for this - but one axis on the throttle is not passed through Wine control and onto a game. Interestingly, a joystick test software under Wine detects throttle just as the host system does, meaning it must be problem with Wine rather than my games or hardware. This has been independently replicated by another Reddit user who described the problem as near identical to mine and thus also yours:
I haven't been playing SC lately, but unfortunately I haven't found anything yet. I'm thinking as opening it as an issue directly with Wine though, since I'm pretty sure that's where the problem is happening.
So if you are willing and able, I'd be happy to implement and test your patch if you were to share it - I'm sure others with this issue would too.
ZarathustraDK
Newbie
Newbie
Posts: 1
Joined: Mon Oct 19, 2020 5:25 pm

Re: HOTAS, X52 Pro and low button/axes limit in Wine

Post by ZarathustraDK »

As with BradleyR I unfortunately can't answer your question either. All I can say is I'm in the same boat with my Virpil Constellation Alpha w/ WarBRD base. Seems like wine categorizes it as both a joystick and a gamepad, making it unusable in Star Citizen; probably because the Alpha grip has a thumbstick and a mousewheel on it.

Would be nice if there was a standard process for users to submit new input-devices like this for inclusion into Wine, seeing as such devices are released often.
spoon0042
Level 6
Level 6
Posts: 570
Joined: Thu Dec 24, 2009 11:00 am

Re: HOTAS, X52 Pro and low button/axes limit in Wine

Post by spoon0042 »

ZarathustraDK wrote: Mon Oct 19, 2020 5:37 pm Would be nice if there was a standard process for users to submit new input-devices like this for inclusion into Wine, seeing as such devices are released often.
afaik the issue isn't needing to add new devices; wine only has to interact with the linux driver. The problem seems to be the number of buttons exceeding whatever limit there is in wine. The OP filed a bug here: https://bugs.winehq.org/show_bug.cgi?id=48799 ... which includes their patch but unfortunately nothing seems to have happened with that since May. According to one comment on the bug wine's limits correspond to the Windows joystick driver but I assume that's out of date? So there is the patch at least for the time being but you'd have to build wine yourself.

(patch is at the bottom of this wine-devel post: https://www.winehq.org/pipermail/wine-d ... 66377.html )
spoon0042
Level 6
Level 6
Posts: 570
Joined: Thu Dec 24, 2009 11:00 am

Re: HOTAS, X52 Pro and low button/axes limit in Wine

Post by spoon0042 »

There is also bug 50066 which sounds like it could be related which is apparently fixed in wine staging 5.21 if someone wanted to give that a try.

https://bugs.winehq.org/show_bug.cgi?id=50066
scopegoa
Newbie
Newbie
Posts: 1
Joined: Sat Nov 14, 2020 7:09 pm

Re: HOTAS, X52 Pro and low button/axes limit in Wine

Post by scopegoa »

ZarathustraDK wrote: Mon Oct 19, 2020 5:37 pm As with BradleyR I unfortunately can't answer your question either. All I can say is I'm in the same boat with my Virpil Constellation Alpha w/ WarBRD base. Seems like wine categorizes it as both a joystick and a gamepad, making it unusable in Star Citizen; probably because the Alpha grip has a thumbstick and a mousewheel on it.

Would be nice if there was a standard process for users to submit new input-devices like this for inclusion into Wine, seeing as such devices are released often.
Hey ZarathustraDK,

I have found the fix for this. Turns out it's an issue with SDL. It detects the joysticks as a gamepad in Wine for some reason.

You can follow these instructions to fix it. These instructions will require you to edit the registry of your Wine environment. Lutris provides a GUI to do this from.

Note: The link also shows how to fix it for a Logitech joystick, but you can just replace the "VID_046D&PID_C215" with "VID_3344"when deleting the registry entries (this is Virpil's product code). You don't even to rebind the controls after you disable SDL. I had this same issue in Elite Dangerous, except in that game it wasn't picking up my Virpils at all because Steam thought they were gamepads. It's ironic that fixing the Steam/Elite Dangerous issue got me the answer for Star Citizen as well.

https://askubuntu.com/questions/1185679 ... ick-as-gen

This fix should work with any Wine-based game that is misbehaving with joysticks in general.
Locked