vJoy icon indicating copy to clipboard operation
vJoy copied to clipboard

vJoy not working with Web Gamepad API

Open Miniontoby opened this issue 2 years ago • 31 comments

Hi, This issue is fixed and you will find a summary of the problem and solution below:


Original Question

The Web Gamepad API doesn't seem to be able to show/receive the Axes values: image

The buttons work fine, but the axes don't. Here is an example test URL: https://luser.github.io/gamepadtest/


Working solution

njz3 made an update that fixes this problem, but the problem is that he cannot sign the driver, so you will need to follow this guide to install this update:

  1. Install the certificate in the "Trusted Root Certification" store. (So open it, click install, [select local user if you have admin rights], click next, select 'install in the following archive', select "Trusted Root Certification", hit next, click confirm)

  2. Enable SIGNTEST mode in your windows: Open CMD (or PowerShell) AS ROOT, run Bcdedit.exe -set TESTSIGNING ON and then if it says "operation successful", you will need to reboot your computer. [If it didn't say that but it says something about Secure Boot, you will need to disable Secure Boot FIRST]. Now when you computer is booted up, you should see in the bottom right of your desktop the text "Testing Mode"

  3. Now download this testing build installer and then open it to install.

  4. To make sure it will work, open the "Configure vJoy" app and uncheck one of the axis, hit apply and then check the axis again and hit apply.

P.s. If you want the SDK, you can find that at this link


If you still cannot get it to work after trying these methods, you may add a comment to this issue.

Miniontoby avatar Feb 27 '23 16:02 Miniontoby

I'm running into the exact same issue. It looks like it only effects Chromium based browsers. Firefox is working as intended.

darkain avatar Jun 18 '23 06:06 darkain

I'm running into the exact same issue. It looks like it only effects Chromium based browsers. Firefox is working as intended.

Chromium based browsers require constant pinging for the buttons to function normally, so I guess this might also have to do something with this problem. But when using an actual controller, it works fine, but I just want to make my own!

And like every browser is based on chromium, except Firefox...

Miniontoby avatar Jun 18 '23 11:06 Miniontoby

Probably not related to vJoy (as it works in Firefox) ?

njz3 avatar Aug 17 '23 19:08 njz3

Probably not related to vJoy (as it works in Firefox) ?

No it is related! A 'normal' gamepad DOES work on chromium browsers! But vJoy doesn't work!

Miniontoby avatar Aug 18 '23 07:08 Miniontoby

Just tried with older version of vJoy and got same issue. I guess it is because the gamepad API does not perform polling of the gamepad status, it is event based. vJoy does not send any "USB" status packet like a standard joystick, which means there is no event when the internal values change.

njz3 avatar Aug 18 '23 08:08 njz3

So can that be implemented? Or do you mean that I am using an old version?

Miniontoby avatar Aug 20 '23 14:08 Miniontoby

It is difficult to tell you whether this is easy to add or not (I do not have enough knowledge to add that function). I tested v2.1.9.1 and v2.2.1.1 and both gave me the same issue.

njz3 avatar Aug 23 '23 12:08 njz3

So what do you suggest now?

Miniontoby avatar Aug 24 '23 08:08 Miniontoby

Maybe you can modify the gamepad API to perform polling of the status ?

njz3 avatar Aug 24 '23 08:08 njz3

Polling is what all these websites already are using (and what I also already am using)! But yeah still no axis data.

Update: I see https://github.com/njz3/vJoy/blob/master/driver/sys/usb.c which does seem to include some USB packet stuff, but it is mostly commented out

Miniontoby avatar Aug 25 '23 13:08 Miniontoby

Hi, I found the "bug", and it is in vjoy : vjoy uses 32bits axis values which in very unusual for HID gamepad or joystick. By changing the driver to expose a 16bits value for axis in the HID, the gamepad test you provided works perfectly in chrome.

njz3 avatar Aug 28 '23 13:08 njz3

By changing the driver to expose a 16bits value for axis in the HID

Can you make a new (github) release using that? Since my laptop is too full to install the netstandard developer thingy, so I cannot build it myself.

Or is it an 'setting' that I should change?

Miniontoby avatar Aug 28 '23 13:08 Miniontoby

I can only compile a test signed build, requiring TESTSIGNING mode to be enabled on your computer.

njz3 avatar Aug 28 '23 14:08 njz3

requiring TESTSIGNING mode to be enabled on your computer.

I believe that is still enabled, and if not, I know how to enable it.

Miniontoby avatar Aug 28 '23 14:08 Miniontoby

Found another issue with Continuous Hat Switches. They are 32 bits in the HID using 1/100th of a degree unit with range from 0..35900, but this makes a bug when going after 32767 (327,67degrees) : the value roll back to a negative value, meaning it does not display in joy.cpl or other joystick diagnostics tool. I will change it to 1/10th of a degree, limiting to 0..3599.

njz3 avatar Aug 28 '23 19:08 njz3

It didn't install!

Update: I got 1 step further, I updated the logs above

Miniontoby avatar Aug 29 '23 08:08 Miniontoby

Have you installed the certificate first ? And do you run in TESTSIGN mode ? (there should be a text watermark in the bottom right corner of your windows desktop)

njz3 avatar Aug 29 '23 08:08 njz3

I didn't install the cert in the correct place first. Now it asks me to install or not, and then it still fails. I updated the logs in the previous message.

(and yeah I dont yet have TESTSIGN enabled, will have to do that, but need to finish some documents first)

Miniontoby avatar Aug 29 '23 10:08 Miniontoby

The build CANNOT be installed without enabling TESTSIGNING mode on your windows test computer.

njz3 avatar Aug 29 '23 10:08 njz3

Oke sure, I have to disable Secure Boot first...

Miniontoby avatar Aug 29 '23 10:08 Miniontoby

Please show me screenshot of your certificate store and your watermark image

njz3 avatar Aug 29 '23 10:08 njz3

I disbled secure boot and enabled testsign and it installed! But now it seems that Gamepad API doesn't even see the controller AT ALL.

EDIT: the feeder doesn't work. As in buttons don't actually get pressed and the axis are doing strange (Need to set Y axis to 0 to let X work, and Z controls Y)

Btw, does this mode need to stay enabled for me to use this?

Miniontoby avatar Aug 29 '23 10:08 Miniontoby

The test sign mode must be enabled to use the build I do, because I do not own a valid EV code certificate to sign the driver (Microsoft constraints...). For your feeder issue, I need to see your vJoy configuration and how your perform your test with the feeder. Also, I uploaded a new version a few minutes ago (same download link). Can you download and try again?

njz3 avatar Aug 29 '23 10:08 njz3

The test sign mode must be enabled to use the build I do, because I do not own a valid EV code certificate to sign the driver (Microsoft constraints...). For your feeder issue, I need to see your vJoy configuration and how your perform your test with the feeder. Also, I uploaded a new version a few minutes ago (same download link). Can you download and try again?

Fore my feeder test, I used the feeder and the monitor programs included. I just put the monitor on AOT (AlwaysOnTop) and then I clicked the buttons and changed the sliders and then looked at the output, which didn't match input.

I will try out the new version now and let you know if the issue is changed

Miniontoby avatar Aug 29 '23 10:08 Miniontoby

I downloaded the new setup thingy and it didn't change it.

Here is a screenshot of the feeder test thingy:

image

Miniontoby avatar Aug 29 '23 10:08 Miniontoby

Also a note : I know you cannot detect the joystick on the navigator like Chrome or Edge if you are using a remote desktop to your test computer. You must be physically connected with an open session to detect the joystick. I don't know why.

njz3 avatar Aug 29 '23 10:08 njz3

It cannot find the joystick since you need to press a button for chrome to let it find the gamepad. And since the buttons are NOT working, chrome won't detect/allow detect of the gamepad

Miniontoby avatar Aug 29 '23 10:08 Miniontoby

Please send me your contact information to see what happen on your personnel setup.

njz3 avatar Aug 29 '23 10:08 njz3

Idk what contact info you mean, but I use Windows 10 Home - 10.0.19045 Build 19045

Miniontoby avatar Aug 29 '23 10:08 Miniontoby