njz3 / vJoy

Virtual Joystick
http://vjoystick.sourceforge.net
MIT License
310 stars 40 forks source link

Ability to name devices #10

Open voshond opened 1 year ago

voshond commented 1 year ago

Currently facing the issue with Joystick Gremlin and Star Citizen, that the devices are randomly resorted when restarting the game.

VJoy1 seems to be always ok, however vJoy2 and vJoy11 always get mixed up.

My assumption is, that Star citizen initialises the Joysticks based on their name as well? And should the name match, they just rewrite the UUID of the device and map them to it.

However since vJoy is named the same for each device, games that rely on the name gonna have that issue. It would be great to name the devices separately maybe, so they would be unique in both name and id.

Best

voshond commented 1 year ago

@cyberluke since i wasn't able to comment in your fork but you seem to be the person with the latest efforts on this, i thought i could comment on you, as i don't posses the skills to do it myself.

njz3 commented 1 year ago

I am not sure how it can be implemented in current vJoy with minimal effort.

SciFi-Bob commented 3 months ago

I would also really like this feature, do we know where the 'vJoy Device' name that windows sees comes from?

@voshond - If you make sure that each vJoy device has a different number of axis or buttons (even if they are something you do not plan to map with gremlin) then they do not get mixed up by windows and therefore Star Citizen. That's the only advice I have for you but I know that my5 devices are all different and they are reliably the same across 3 alpha version now.. Hope this helps

Tsudico commented 1 month ago

I have used the same technique as @SciFi-Bob to make sure my vjoy aren't shuffled as a valid workaround. That's not to say I wouldn't appreciate being able to name vjoy devices or at least have individual HID product IDs since Star Citizen seems to use a GUID based on the hardware information so either the HID display name or product ID would be the best choice of differentiating them:

  <options type="joystick" instance="1" Product="vJoy Device  {BEAD1234-0000-0000-0000-504944564944}">
  <options type="joystick" instance="2" Product="vJoy Device  {BEAD1234-0000-0000-0000-504944564944}">

As you can see, as far as Star Citizen's configuration is concerned, both vJoy devices use the same display name, vendor ID "1234", and product ID "BEAD".

If I remember correctly the Thrustmaster T.16000M switches display name depending on whether you set the stick to left or right handed using the switch on the bottom. VIRPIL allows changing the display name and product ID in their software so you can differentiate the sticks. That means there must be a way for hardware to alter the device information so the same should be possible with virtual hardware.

I do not know how simple it would be to change either the name or the product ID within vJoy because it appears to be hard coded. The product ID appears throughout the code but appears to be set within the same file as the device name which appears to be determined at the following location: https://github.com/njz3/vJoy/blob/42007bb1d27ade4f0630a114910c627dd3ede6cf/driver/sys/vjoy.inx#L235

njz3 commented 3 weeks ago

Today the name is hardcoded and burned into the driver. A solution would be to use a registry key (string) and report it backs to the HID layer when the joystick ID is enabled in the vJoyConf application. That's still a huge change as it touches a lot of different files.