Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vJoy not working with Web Gamepad API #12

Open
Miniontoby opened this issue Feb 27, 2023 · 31 comments
Open

vJoy not working with Web Gamepad API #12

Miniontoby opened this issue Feb 27, 2023 · 31 comments

Comments

@Miniontoby
Copy link

Miniontoby commented Feb 27, 2023

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.

@darkain
Copy link

darkain commented Jun 18, 2023

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

@Miniontoby
Copy link
Author

Miniontoby commented Jun 18, 2023

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...

@njz3
Copy link
Owner

njz3 commented Aug 17, 2023

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

@Miniontoby
Copy link
Author

Miniontoby commented Aug 18, 2023

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!

@njz3
Copy link
Owner

njz3 commented Aug 18, 2023

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.

@Miniontoby
Copy link
Author

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

@njz3
Copy link
Owner

njz3 commented Aug 23, 2023

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.

@Miniontoby
Copy link
Author

So what do you suggest now?

@njz3
Copy link
Owner

njz3 commented Aug 24, 2023

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

@Miniontoby
Copy link
Author

Miniontoby commented Aug 25, 2023

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

@njz3
Copy link
Owner

njz3 commented Aug 28, 2023

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.

@Miniontoby
Copy link
Author

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?

@njz3
Copy link
Owner

njz3 commented Aug 28, 2023

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

@Miniontoby
Copy link
Author

Miniontoby commented Aug 28, 2023

requiring TESTSIGNING mode to be enabled on your computer.

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

@njz3
Copy link
Owner

njz3 commented Aug 28, 2023

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 pushed a commit that referenced this issue Aug 28, 2023
@njz3
Copy link
Owner

njz3 commented Aug 28, 2023

@Miniontoby
Copy link
Author

Miniontoby commented Aug 29, 2023

It didn't install!

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

@njz3
Copy link
Owner

njz3 commented Aug 29, 2023

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)

@Miniontoby
Copy link
Author

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)

@njz3
Copy link
Owner

njz3 commented Aug 29, 2023

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

@Miniontoby
Copy link
Author

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

@njz3
Copy link
Owner

njz3 commented Aug 29, 2023

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

@Miniontoby
Copy link
Author

Miniontoby commented Aug 29, 2023

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?

@njz3
Copy link
Owner

njz3 commented Aug 29, 2023

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?

@Miniontoby
Copy link
Author

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
Copy link
Author

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

Here is a screenshot of the feeder test thingy:

image

@njz3
Copy link
Owner

njz3 commented Aug 29, 2023

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.

@Miniontoby
Copy link
Author

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

@njz3
Copy link
Owner

njz3 commented Aug 29, 2023

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

@Miniontoby
Copy link
Author

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

@Miniontoby
Copy link
Author

After changing the enabled axis (and the amount of buttons) and apply that and then changing it back and applying again, It Now Works!!!

Thanks!

I will be doing more tests first before I close this issue and I will edit the original message to tell everyone how it is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants