Gamepads
Placeholder.
WIP
Controller layouts
The browsers aren't much help when it comes to determining the controller model or layout, so we've been compiling our own list of gamepad layouts.
Here's the rundown: each Gamepad has an id property that will look something like "810-3-USB Gamepad" or "Xbox Elite Series 2 Wireless Controller (STANDARD GAMEPAD Vendor: 045e Product: 0b22)", depending on your browser and gamepad model. These IDs contain both a vendor ID and a USB ID as well as (sometimes) the model name. With only the vendor IDs you can get close to knowing the base layout of the controller:
const microsoftVendorId = "045e"; // xbox layout
const sonyVendorId = "054c"; // playstation layout
const nintendoVendorId = "057e"; // nintendo layoutBut there are still many other widely used gamepads with vendor IDs not included here, as well as generic vendor IDs like 810 that early PlayStation controllers used.
We've aggregated vendor and USB product IDs from...
- The linux kernel
- Löve2D
- Unity
- Various github gists and open source files
- https://github.com/elnormous/gamepads/tree/4b84620959d6d847b6264bd530e936d68e153142
- https://github.com/mdqinc/SDL_GameControllerDB/blob/master/gamecontrollerdb.txt
- https://gist.githubusercontent.com/nondebug/aec93dff7f0f1969f4cc2291b24a3171/raw/25d6cfd6f41716f909b089558c9e4941b1726c41/known_gamepads.txt
- https://raw.githubusercontent.com/360Controller/360Controller/master/360Controller/Info.plist
...and compiled and deduplicated these into a list you can access from the identifyGamepad function in the Spud API.