Closed Bug 878828 Opened 11 years ago Closed 10 years ago

finalize and enable Gamepad API

Categories

(Core :: DOM: Events, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla28
Tracking Status
firefox28 --- disabled
firefox29 --- fixed
relnote-firefox --- 29+

People

(Reporter: vlad, Assigned: ted)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, feature, Whiteboard: [games:p1])

Attachments

(1 file)

We need to finalize the Gamepad API and get it enabled everywhere.  We're close, but there's a mess currently.
I have a bunch of outstanding patches and spec work I need to finish up. In no particular order, here are the ones I can remember off the top of my head:

Patches:
bug 851547 - make Gamepad API preffable. Waiting on a patch from smaug so that it can make the event types not visible to content
bug 860413 - allow setting standard mapping
bug 860409 - Allow passing both an analog and digital value for buttons
bug 690937 - XInput backend for Windows
(unfiled)  - hook up gamepad mappings from a static list

Spec work:
* Figure out how to expose analog+digital buttons
* Figure out how to expose button names
* Spec buttonpress/release events
* https://www.w3.org/Bugs/Public/show_bug.cgi?id=21434 - Spec liveness of Gamepad objects
* Might want to change spec to use navigator.gamepads.get() instead of navigator.getGamepads()
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #1)
> bug 851547 - make Gamepad API preffable. Waiting on a patch from smaug so
> that it can make the event types not visible to content
My patch to let generated events to use webidl is still waiting for review.
bug 690935 is navigator.getGamepads().
I buckled down and got a bunch of those landed. We can ship it preffed off in 24 now, which is an improvement (since people can actually test it in release builds).

I'd still like to get XInput landed, and there's another bug (maybe not filed) about how we don't currently notice DirectInput devices being connected or disconnected on Windows that we really ought to fix.

I would like to get a few of those spec issues nailed down before we commit to shipping it preffed on.
Is this still shipping prefed off in 24?
Yes, it's behind the dom.gamepad.enabled pref.
Shouldnt this be added to the release notes? Aurora release notes does not currently display this:
http://www.mozilla.org/en-US/firefox/24.0a2/auroranotes/
It's behind a pref at the moment, but we could relnote it.
Depends on: 921565
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #1)
> bug 690937 - XInput backend for Windows
> (unfiled)  - hook up gamepad mappings from a static list

These are not in the dependancy list (others as well, but they're fixed now). Can somebody add them, please (and file the missing bug)?

Also, are there still changes expected for the API (i.e. how stable is the API)? I'm asking because of Bug 802882 and I may file a bug for HTML5Test.com to exclude the API from the current (upcoming) set of tests (at least exclude it from counting towards the total score).
The two open blockers are the only things we need to fix to ship this. Anything else is just gravy.
Depends on: 926091
Depends on: 936104
I landed a patch for 936104, so I think I'd be pretty comfortable with enabling the Gamepad API by default in Firefox 28.
(In reply to Florian Bender from comment #10)
> Also, are there still changes expected for the API (i.e. how stable is the
> API)? I'm asking because of Bug 802882 and I may file a bug for
> HTML5Test.com to exclude the API from the current (upcoming) set of tests
> (at least exclude it from counting towards the total score).

bug 926091 was the last breaking change I intend to make to the spec, it changed Gamepad.buttons[] to be an array of GamepadButton instead of just double. Any future spec changes should be backwards-compatible.
Here's the simple patch that enables the Gamepad API by default.
Assignee: nobody → ted
Status: NEW → ASSIGNED
I posted an intent to ship message to dev.platform:
https://groups.google.com/forum/#!topic/mozilla.dev.platform/JjuTCr2VYUA
Comment on attachment 8343701 [details] [diff] [review]
Enable Gamepad API by default

smaug suggested that this might want a superreview? I'm not sure what the current policy is.
Attachment #8343701 - Flags: review?(bugs)
Alright, thanks for the info!
relnote-firefox: --- → ?
Keywords: feature
Comment on attachment 8343701 [details] [diff] [review]
Enable Gamepad API by default

I was thinking this kind of sr :)

As far as I know, we could enable the API.
Attachment #8343701 - Flags: superreview+
Attachment #8343701 - Flags: review?(bugs)
Attachment #8343701 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/3bc9cffda68a
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
We already have this:

https://developer.mozilla.org/en-US/docs/API/Gamepad/Using_Gamepad_API

Not sure how up to date it is.
It's a bit out of date, but it could be fixed to be useful. The events are now just "gamepadconnected" and "gamepaddisconnected". The button/axis events are not currently in the spec. The Gamepad object has a few more properties, and the buttons property is slightly different. The whole "DOM implementation" section is no longer accurate (and of questionable utility anyway).

You can refer to the latest editor's draft of the spec for more:
https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html
I also have a draft Hacks article that's 95% complete that we should be publishing this week.
Thanks for the info Ted; I'll start working on the guide update and API reference pages for this straight away.

For testing purposes, I've found out my old PS2 controller, and now I'm guessing I just need to buy a PS2 -> USB adaptor. None of them mention Mac support - will they 'just work' on Mac? Are some of them better than others?

(In reply to Ted Mielczarek [:ted.mielczarek] from comment #22)
> It's a bit out of date, but it could be fixed to be useful. The events are
> now just "gamepadconnected" and "gamepaddisconnected". The button/axis
> events are not currently in the spec. The Gamepad object has a few more
> properties, and the buttons property is slightly different. The whole "DOM
> implementation" section is no longer accurate (and of questionable utility
> anyway).
> 
> You can refer to the latest editor's draft of the spec for more:
> https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html
Almost any USB controller will "just work" on Mac, Windows or Linux. The biggest current exception is the PS3 DualShock 3 controller, which doesn't have a driver for Windows, and may not work out of the box on Mac. Wired Xbox 360 controllers work fine everywhere, wireless ones need an adapter (that you can still buy but isn't manufactured anymore, AFAIK). Any dirt-cheap USB gamepad you can buy anywhere has a high probability of working fine.
I have updated the Gamepad API guide to be more up to date:

https://developer.mozilla.org/en-US/docs/Web/Guide/API/Gamepad

Quite a bit of it is stolen out of your MDN article, because the examples there are very concise and nicely written ;-) My PS2 controller was giving some funny results, but I think it might be slightly dodgy; I have ordered a new Wired XBox 360 controller so I can do a comparison and check what's going on.

Let me know if these is anything obviously wrong. I'll be adding some more examples soon.

Next step will be to create a proper API reference. I'll keep going.
Draft landing page for the whole API:

https://developer.mozilla.org/en-US/docs/Gamepad
Depends on: 963053
Tested Gamepad feature for pre-beta sign off on latest Aurora (Build ID: 20140122004004) on: Windows 7 64bit, Windows XP 64bit, Mac OSX 10.9 and Ubuntu 13.10 32bit.
Status: RESOLVED → VERIFIED
QA Contact: alexandra.lucinet
Depends on: 980876
(In reply to Anthony Hughes, QA Mentor (:ashughes) from comment #29)
> Updating status flags as per:
> http://hg.mozilla.org/releases/mozilla-release/file/c6c843644fbf

Not sure whether relnote should be changed in kind.
Flags: needinfo?(lsblakk)
Gamepad API reference docs need a technical review:

https://developer.mozilla.org/en-US/docs/Gamepad

Could someone check these out for me? thanks in advance ;-)
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0
Mozilla/5.0 (X11; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:28.0) Gecko/20100101 Firefox/28.0

Gamepad API is properly disabled on Firefox 28 RC (Build ID: 20140310174439): dom.gamepad.enabled is set to false by default.
We're going to remove the Gamepad API note as it has been disabled, so this will go back to FF29
Flags: needinfo?(lsblakk)
Depends on: 985967
You need to log in before you can comment on or make changes to this bug.