Skip to content

Gamepadactyl#1814

Closed
glacambre wants to merge 1 commit intomasterfrom
gamepadactyl
Closed

Gamepadactyl#1814
glacambre wants to merge 1 commit intomasterfrom
gamepadactyl

Conversation

@glacambre
Copy link
Member

@glacambre glacambre commented Aug 21, 2019

As bovine3dom said on matrix,
Tridactyl needs gamepad support in order to expand and be able to reach
new users. This is the first step on the road to Tridactyl becoming the
true google-stadia enabled, gamer-oriented, billion-dollars making
service as a software it can be.

Note that I wouldn't actually recommend merging this for the following reasons:

  • You have to use requestAnimationFrame() in the content script every time a gamepad is detected, even if it isn't actually used by the user (this is rather inefficient).

  • It doesn't actually work 100% of the time. Sometimes we don't get the gamepadconnected event and users have to disconnect/reconnect their gamepad in order for tridactyl to detect the gamepad again.

  • Because we do our processing in the content script, pressing any button that changes the current tab also triggers the command in the new tab (because Tridactyl detects that the button is pressed in the new tab before the user has any chance to release it).

  • Not every gamepad button is supported by the gamepad API. For example, there isn't any way to check for the state of an xbox 360 controller's dirrectional pad.

  • I didn't implement joystick support. This could probably be done by using angles for bindings but I couldn't be bothered.

  • For some reason, bindings do not work for the command line. The normal-mode ones are used instead. I didn't check what happened for other modes.

There probably are other reasons not to merge this but these are the ones I can think of right now.

"<SA-ArrowUp><SA-ArrowUp><SA-ArrowDown><SA-ArrowDown><SA-ArrowLeft><SA-ArrowRight><SA-ArrowLeft><SA-ArrowRight>ba":
"open https://www.youtube.com/watch?v=M3iOROuTuMA",
// Mappings for an xbox 360 controller
"<G-0>": "fillcmdline", // A button
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"<G-0>": "fillcmdline", // A button
"<G-0>": "fillcmdline_notrail", // A button

As [bovine3dom said on matrix](https://matrix.to/#/!xmubtggllUtLrQiGyn:matrix.org/$1566330020150744QfSIq:matrix.org?via=matrix.org&via=arcn.mx&via=yuri.im),
Tridactyl needs gamepad support in order to expand and be able to reach
new users. This is the first step on the road to Tridactyl becoming the
true google-stadia enabled, gamer-oriented, billion-dollars making
service as a software it can be.
@bovine3dom
Copy link
Member

I can't quite believe that the D-Pad isn't supported. It seems like it wouldn't be a very useful API with it.

Rather than asking people to guess which number is which button, might we use a library such as https://github.com/samiare/Controller.js?

If the polling hurts performance we can just gate it behind a setting (or perhaps check for "stadia" in user-agent).

@glacambre
Copy link
Member Author

I can't quite believe that the D-Pad isn't supported. It seems like it wouldn't be a very useful API with it.

There does seem to be two axes values that I can't get to change no matter what I do to my controller and the library you linked to seems to know what a d-pad is so perhaps my controller is broken/the linux driver I have doesn't work (I've never used my controller on linux).

@@ -52,10 +55,26 @@ export class MinimalKey {
/** Does this key match a given MinimalKey extending object? */
public match(keyevent) {
// 'in' doesn't include prototypes, so it's safe for this object.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 'in' doesn't include prototypes, so it's safe for this object.

:)

@glacambre
Copy link
Member Author

This will become painfully unmergeable with #2566 and unusable with https://hacks.mozilla.org/2020/07/securing-gamepad-api/ so let's close this.

@glacambre glacambre closed this Jul 2, 2020
@glacambre glacambre deleted the gamepadactyl branch July 2, 2020 05:07
@bovine3dom
Copy link
Member

Mozilla keeps taking away our toys : (

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

Successfully merging this pull request may close these issues.

2 participants