@antha/gamepad-type 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -10,14 +10,12 @@ Detects the following per gamepad:
|
|
|
10
10
|
|
|
11
11
|
based on hardcoded, pre-collected data. You are also able to define new values for each in case any data is missing.
|
|
12
12
|
|
|
13
|
-
If you notice incorrect mappings, please enter updated information [on the demo page](https://
|
|
13
|
+
If you notice incorrect mappings, please enter updated information [on the demo page](https://antha-engine.github.io/gamepad/). Every browser, browser version, operating system, and operating system version combination produces different values so it's impossible for me to single-handedly account for them all.
|
|
14
14
|
|
|
15
15
|
It is encouraged that you use the package [`input-device-handler`](https://www.npmjs.com/package/input-device-handler) in conjunction with this one, but it is not required.
|
|
16
16
|
|
|
17
|
-
- [demo page](https://
|
|
18
|
-
- [full API docs](https://electrovir.github.io/
|
|
19
|
-
- [GitHub repo](https://github.com/electrovir/gamepad-type) (please open issues for gamepad mapping updates)
|
|
20
|
-
- [npm package](https://www.npmjs.com/package/gamepad-type)
|
|
17
|
+
- [demo page](https://antha-engine.github.io/gamepad/) (allows submitting gamepad mapping fixes)
|
|
18
|
+
- [full API docs](https://electrovir.github.io/antha/docs)
|
|
21
19
|
|
|
22
20
|
# install
|
|
23
21
|
|
|
@@ -29,8 +27,8 @@ npm i @antha/gamepad-type
|
|
|
29
27
|
|
|
30
28
|
The primary exports of this package are the following:
|
|
31
29
|
|
|
32
|
-
- [`findMatchingGamepadModel`](https://electrovir.github.io/
|
|
33
|
-
- [`findMatchingGamepadLayout`](https://electrovir.github.io/
|
|
30
|
+
- [`findMatchingGamepadModel`](https://electrovir.github.io/antha/docs): given the system-level gamepad id, determines the gamepad's model and brand. Also includes a model description string. Allows custom model and brand map inputs to handle edge cases that this package doesn't cover. (If you find those edge cases, please either [open a ticket in the GitHub repo](https://github.com/electrovir/gamepad-type/issues/new) or submit your fixed data on [the demo page](https://antha-engine.github.io/gamepad/).)
|
|
31
|
+
- [`findMatchingGamepadLayout`](https://electrovir.github.io/antha/docs): given the system-level gamepad id, determines the gamepad's button and axe names (based on gamepad model and user operating system). Allows custom model and input map inputs to handle edge cases that this package doesn't cover. (If you find those edge cases please either [open a ticket in the GitHub repo](https://github.com/electrovir/gamepad-type/issues/new) or submit your fixed data on [the demo page](https://antha-engine.github.io/gamepad/).)
|
|
34
32
|
|
|
35
33
|
## examples
|
|
36
34
|
|
package/dist/default-layouts.js
CHANGED
|
@@ -336,4 +336,145 @@ export const defaultGamepadLayouts = [
|
|
|
336
336
|
],
|
|
337
337
|
notes: undefined,
|
|
338
338
|
},
|
|
339
|
+
{
|
|
340
|
+
gamepadModels: [PredefinedGamepadModel.Xbox360],
|
|
341
|
+
inputMappings: {
|
|
342
|
+
'axe-0': KnownInput.LeftStickX,
|
|
343
|
+
'axe-1': KnownInput.LeftStickY,
|
|
344
|
+
'axe-2': KnownInput.RightStickX,
|
|
345
|
+
'axe-3': KnownInput.RightStickY,
|
|
346
|
+
'button-0': KnownInput.FaceAccept,
|
|
347
|
+
'button-1': KnownInput.FaceCancel,
|
|
348
|
+
'button-2': KnownInput.FaceAlt1,
|
|
349
|
+
'button-3': KnownInput.FaceAlt2,
|
|
350
|
+
'button-4': KnownInput.L1,
|
|
351
|
+
'button-5': KnownInput.R1,
|
|
352
|
+
'button-6': KnownInput.L2,
|
|
353
|
+
'button-7': KnownInput.R2,
|
|
354
|
+
'button-8': KnownInput.Select,
|
|
355
|
+
'button-9': KnownInput.Start,
|
|
356
|
+
'button-10': KnownInput.L3,
|
|
357
|
+
'button-11': KnownInput.R3,
|
|
358
|
+
'button-12': KnownInput.DPadUp,
|
|
359
|
+
'button-13': KnownInput.DPadDown,
|
|
360
|
+
'button-14': KnownInput.DPadLeft,
|
|
361
|
+
'button-15': KnownInput.DPadRight,
|
|
362
|
+
'button-16': KnownInput.Logo,
|
|
363
|
+
},
|
|
364
|
+
systemVersions: [
|
|
365
|
+
{
|
|
366
|
+
browserVersion: 'unknown',
|
|
367
|
+
browserName: 'Chrome',
|
|
368
|
+
osName: 'Linux',
|
|
369
|
+
osVersion: '',
|
|
370
|
+
},
|
|
371
|
+
],
|
|
372
|
+
notes: undefined,
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
gamepadModels: [PredefinedGamepadModel.Xbox360],
|
|
376
|
+
inputMappings: {
|
|
377
|
+
'axe-0': KnownInput.LeftStickX,
|
|
378
|
+
'axe-1': KnownInput.LeftStickY,
|
|
379
|
+
'axe-2': KnownInput.RightStickX,
|
|
380
|
+
'axe-3': KnownInput.RightStickY,
|
|
381
|
+
'button-0': KnownInput.FaceAccept,
|
|
382
|
+
'button-1': KnownInput.FaceCancel,
|
|
383
|
+
'button-2': KnownInput.FaceAlt1,
|
|
384
|
+
'button-3': KnownInput.FaceAlt2,
|
|
385
|
+
'button-4': KnownInput.L1,
|
|
386
|
+
'button-5': KnownInput.R1,
|
|
387
|
+
'button-6': KnownInput.L2,
|
|
388
|
+
'button-7': KnownInput.R2,
|
|
389
|
+
'button-8': KnownInput.Select,
|
|
390
|
+
'button-9': KnownInput.Start,
|
|
391
|
+
'button-10': KnownInput.L3,
|
|
392
|
+
'button-11': KnownInput.R3,
|
|
393
|
+
'button-12': KnownInput.DPadUp,
|
|
394
|
+
'button-13': KnownInput.DPadDown,
|
|
395
|
+
'button-14': KnownInput.DPadLeft,
|
|
396
|
+
'button-15': KnownInput.DPadRight,
|
|
397
|
+
'button-16': KnownInput.Logo,
|
|
398
|
+
},
|
|
399
|
+
systemVersions: [
|
|
400
|
+
{
|
|
401
|
+
browserVersion: '154.0',
|
|
402
|
+
browserName: 'Firefox',
|
|
403
|
+
osName: 'Linux',
|
|
404
|
+
osVersion: '',
|
|
405
|
+
},
|
|
406
|
+
],
|
|
407
|
+
notes: undefined,
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
gamepadModels: [PredefinedGamepadModel.SteamDeck],
|
|
411
|
+
inputMappings: {
|
|
412
|
+
'axe-0': KnownInput.LeftStickX,
|
|
413
|
+
'axe-1': KnownInput.LeftStickY,
|
|
414
|
+
'axe-2': KnownInput.RightStickX,
|
|
415
|
+
'axe-3': KnownInput.RightStickY,
|
|
416
|
+
'button-0': KnownInput.FaceAccept,
|
|
417
|
+
'button-1': KnownInput.FaceCancel,
|
|
418
|
+
'button-2': KnownInput.FaceAlt1,
|
|
419
|
+
'button-3': KnownInput.FaceAlt2,
|
|
420
|
+
'button-4': KnownInput.L1,
|
|
421
|
+
'button-5': KnownInput.R1,
|
|
422
|
+
'button-6': KnownInput.L2,
|
|
423
|
+
'button-7': KnownInput.R2,
|
|
424
|
+
'button-8': KnownInput.Select,
|
|
425
|
+
'button-9': KnownInput.Start,
|
|
426
|
+
'button-10': KnownInput.L3,
|
|
427
|
+
'button-11': KnownInput.R3,
|
|
428
|
+
'button-12': KnownInput.DPadUp,
|
|
429
|
+
'button-13': KnownInput.DPadDown,
|
|
430
|
+
'button-14': KnownInput.DPadLeft,
|
|
431
|
+
'button-15': KnownInput.DPadRight,
|
|
432
|
+
},
|
|
433
|
+
systemVersions: [
|
|
434
|
+
{
|
|
435
|
+
browserVersion: 'unknown',
|
|
436
|
+
browserName: 'Chrome',
|
|
437
|
+
osName: 'Linux',
|
|
438
|
+
osVersion: '',
|
|
439
|
+
},
|
|
440
|
+
],
|
|
441
|
+
notes: undefined,
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
gamepadModels: [PredefinedGamepadModel.SteamDeck],
|
|
445
|
+
inputMappings: {
|
|
446
|
+
'axe-0': KnownInput.LeftStickX,
|
|
447
|
+
'axe-1': KnownInput.LeftStickY,
|
|
448
|
+
'axe-2': KnownInput.RightStickX,
|
|
449
|
+
'axe-3': KnownInput.RightStickY,
|
|
450
|
+
'button-0': KnownInput.FaceAccept, // A
|
|
451
|
+
'button-1': KnownInput.FaceCancel, // B
|
|
452
|
+
'button-2': KnownInput.FaceAlt2, // Y
|
|
453
|
+
'button-3': KnownInput.FaceAlt1, // X
|
|
454
|
+
'button-4': KnownInput.L1,
|
|
455
|
+
'button-5': KnownInput.R1,
|
|
456
|
+
'button-6': KnownInput.L2,
|
|
457
|
+
'button-7': KnownInput.R2,
|
|
458
|
+
'button-8': KnownInput.Select,
|
|
459
|
+
'button-9': KnownInput.Start,
|
|
460
|
+
'button-10': KnownInput.L3,
|
|
461
|
+
'button-11': KnownInput.R3,
|
|
462
|
+
'button-12': KnownInput.DPadUp,
|
|
463
|
+
'button-13': KnownInput.DPadDown,
|
|
464
|
+
'button-14': KnownInput.DPadLeft,
|
|
465
|
+
'button-15': KnownInput.DPadRight,
|
|
466
|
+
},
|
|
467
|
+
systemVersions: [
|
|
468
|
+
{
|
|
469
|
+
browserVersion: '154.0',
|
|
470
|
+
browserName: 'Firefox',
|
|
471
|
+
osName: 'Linux',
|
|
472
|
+
osVersion: '',
|
|
473
|
+
},
|
|
474
|
+
],
|
|
475
|
+
notes: {
|
|
476
|
+
info: "Button 16 exists but can't be triggered. Back bumpers do not show up. Start / Menu button cannot be held.",
|
|
477
|
+
warning: 'This gamepad only registers on Firefox.',
|
|
478
|
+
},
|
|
479
|
+
},
|
|
339
480
|
];
|
package/dist/default-models.js
CHANGED
|
@@ -18,12 +18,20 @@ export const defaultGamepadModelMap = {
|
|
|
18
18
|
'54c-ce6-Wireless Controller': PredefinedGamepadModel.PlaystationDualSense,
|
|
19
19
|
/** Firefox detected OEM Xbox Wireless gamepad name. */
|
|
20
20
|
'45e-b13-Xbox Wireless Controller': PredefinedGamepadModel.XboxWireless,
|
|
21
|
+
/** Firefox detected Xbox 360 gamepad name. */
|
|
22
|
+
'045e-02a1-Xbox 360 Wireless Receiver': PredefinedGamepadModel.Xbox360,
|
|
23
|
+
/** Firefox detected Steam Deck gamepad name. */
|
|
24
|
+
'28de-11ff-Microsoft X-Box 360 pad 0': PredefinedGamepadModel.SteamDeck,
|
|
21
25
|
/** Chrome detected OEM Switch Pro gamepad name. */
|
|
22
26
|
'Pro Controller (STANDARD GAMEPAD Vendor: 057e Product: 2009)': PredefinedGamepadModel.SwitchPro,
|
|
23
27
|
/** Chrome detected OEM DualSense gamepad name. */
|
|
24
28
|
'Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 0ce6)': PredefinedGamepadModel.PlaystationDualSense,
|
|
25
29
|
/** Chrome detected OEM Xbox Wireless gamepad name. */
|
|
26
30
|
'Xbox Series X Controller (STANDARD GAMEPAD Vendor: 045e Product: 0b12)': PredefinedGamepadModel.XboxWireless,
|
|
31
|
+
/** Chrome detected Steam Deck gamepad name. */
|
|
32
|
+
'Microsoft X-Box 360 pad 0 (STANDARD GAMEPAD Vendor: 28de Product: 11ff)': PredefinedGamepadModel.SteamDeck,
|
|
33
|
+
/** Chrome detected Xbox 360 gamepad name. */
|
|
34
|
+
'Xbox 360 Wireless Receiver (STANDARD GAMEPAD Vendor: 045e Product: 02a1)': PredefinedGamepadModel.Xbox360,
|
|
27
35
|
/** Inputs from external users. */
|
|
28
36
|
'DUALSHOCK 4 Wireless Controller Extended Gamepad': PredefinedGamepadModel.PlaystationDualShock4, // e9ed532bca264299849b10d076040798
|
|
29
37
|
'DUALSHOCK 4 Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 09cc)': PredefinedGamepadModel.PlaystationDualShock4, // 9e8343773463416683ac7501d766e682
|
|
@@ -386,9 +386,7 @@ export const VirDemo = defineElement()({
|
|
|
386
386
|
</p>
|
|
387
387
|
<ul>
|
|
388
388
|
<li>
|
|
389
|
-
<a href="https://electrovir.github.io/
|
|
390
|
-
Full API docs
|
|
391
|
-
</a>
|
|
389
|
+
<a href="https://electrovir.github.io/antha/docs">Full API docs</a>
|
|
392
390
|
</li>
|
|
393
391
|
<li>
|
|
394
392
|
<a href="https://github.com/electrovir/gamepad-type">
|
package/dist/system-versions.js
CHANGED
|
@@ -8,12 +8,15 @@ const bowser = Bowser.getParser(navigator.userAgent);
|
|
|
8
8
|
* @category Util
|
|
9
9
|
*/
|
|
10
10
|
export function getSystemVersions() {
|
|
11
|
+
/** Bowser lies about the type here. */
|
|
12
|
+
const osVersion = bowser.getOSVersion();
|
|
11
13
|
return {
|
|
12
14
|
/* node:coverage ignore next: supported browser user agents include a browser version. */
|
|
13
15
|
browserVersion: bowser.getBrowserVersion() || 'unknown',
|
|
14
16
|
browserName: bowser.getBrowserName(),
|
|
15
17
|
osName: bowser.getOSName(),
|
|
16
|
-
|
|
18
|
+
/* node:coverage ignore next: Linux user agents omit the OS version. */
|
|
19
|
+
osVersion: osVersion || '',
|
|
17
20
|
};
|
|
18
21
|
}
|
|
19
22
|
/**
|