gamepaddb

package
v1.17.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gamepaddb is the model of a pad that SPEC §28.1 ports from SDL 3 (zlib; see third_party/sdl/LICENSE): the identity of a pad (its GUID, its name and its kind), the mapping format that says which button or axis of a pad is which button or axis of the standard layout, SDL's built-in table of mappings (mappings_gen.go, made by glutter-gen gamepaddb), and the two layers that turn the raw reports of a pad into the buttons and axes of the layout. It is plain Go with no OS tags and no dependency on the rest of Glutter.

The files that are ported start with a comment that names the SDL 3 file they come from; they are translated to Go and changed.

Flutter: no counterpart

Index

Constants

View Source
const (
	// BusUSB is a pad on USB.
	//
	// Flutter: no counterpart
	BusUSB uint16 = 0x03
	// BusBluetooth is a pad on Bluetooth.
	//
	// Flutter: no counterpart
	BusBluetooth uint16 = 0x05
	// BusVirtual is a pad that a program makes (SDL's number; it is not Linux's BUS_VIRTUAL).
	//
	// Flutter: no counterpart
	BusVirtual uint16 = 0xFF
	// BusUnknown is a pad whose bus is not known.
	//
	// Flutter: no counterpart
	BusUnknown uint16 = 0x00
)

The buses of a pad, as the first 16 bits of its GUID say (the values of Linux's BUS_ constants).

View Source
const (
	// AxisMin is the smallest value of an axis.
	//
	// Flutter: no counterpart
	AxisMin = -32768
	// AxisMax is the largest value of an axis.
	//
	// Flutter: no counterpart
	AxisMax = 32767
)

The range of a raw axis and of an axis of the layout.

View Source
const (
	// HatCentered is a hat that is not pushed.
	//
	// Flutter: no counterpart
	HatCentered = 0x00
	// HatUp is a hat pushed up.
	//
	// Flutter: no counterpart
	HatUp = 0x01
	// HatRight is a hat pushed right.
	//
	// Flutter: no counterpart
	HatRight = 0x02
	// HatDown is a hat pushed down.
	//
	// Flutter: no counterpart
	HatDown = 0x04
	// HatLeft is a hat pushed left.
	//
	// Flutter: no counterpart
	HatLeft = 0x08
)

The positions of a hat, as the bits of a mask.

View Source
const TagMappingInvalid = "GamepadMappingInvalid"

TagMappingInvalid is the tag of the error of a mapping line that cannot be read.

Flutter: no counterpart

Variables

View Source
var Android = []string{
	"05000000c82d000006500000ffff3f00,8BitDo M30 Gamepad,a:b1,b:b0,back:b4,guide:b17,leftshoulder:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a4,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"05000000c82d000051060000ffff3f00,8BitDo M30 Gamepad,a:b1,b:b0,back:b4,guide:b17,leftshoulder:b9,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a5,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"05000000c82d000020900000ffff3f00,8BitDo Micro gamepad,a:b1,b:b0,back:b4,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,guide:b5,leftshoulder:b9,lefttrigger:a6,rightshoulder:b10,righttrigger:a7,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"05000000c82d000015900000ffff3f00,8BitDo N30 Pro 2,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"05000000c82d000065280000ffff3f00,8BitDo N30 Pro 2,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b17,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"050000000220000000900000ffff3f00,8BitDo NES30 Pro,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"050000002038000009000000ffff3f00,8BitDo NES30 Pro,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"05000000c82d000000600000ffff3f00,8BitDo SF30 Pro,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:b15,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b16,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"05000000c82d000000610000ffff3f00,8BitDo SF30 Pro,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"05000000c82d000012900000ffff3f00,8BitDo SN30 Gamepad,a:b1,b:b0,back:b4,leftshoulder:b9,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"05000000c82d000062280000ffff3f00,8BitDo SN30 Gamepad,a:b1,b:b0,back:b4,leftshoulder:b9,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"05000000c82d000002600000ffff0f00,8BitDo SN30 Pro+,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b17,leftshoulder:b9,leftstick:b7,lefttrigger:b15,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b16,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"05000000c82d000001600000ffff3f00,8BitDo SN30 Pro,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"050000002028000009000000ffff3f00,8BitDo SNES30 Gamepad,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"050000003512000020ab000000780f00,8BitDo SNES30 Gamepad,a:b21,b:b20,back:b30,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b26,rightshoulder:b27,start:b31,x:b24,y:b23,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"05000000c82d000018900000ffff0f00,8BitDo Zero 2,a:b1,b:b0,back:b4,leftshoulder:b9,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"05000000c82d000030320000ffff0f00,8BitDo Zero 2,a:b1,b:b0,back:b4,leftshoulder:b9,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"05000000d6020000e5890000dfff3f80,GPD XD Plus,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a3,rightx:a4,righty:a5,start:b6,x:b2,y:b3,",
	"0500000031366332860c44aadfff0f00,GS Gamepad,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:b15,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b16,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"05000000bc20000000550000ffff3f00,GameSir G3w,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000005509000003720000cf7f3f00,NVIDIA Controller v01.01,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000005509000010720000ffff3f00,NVIDIA Controller v01.03,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000005509000014720000df7f3f80,NVIDIA Controller v01.04,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a3,rightx:a4,righty:a5,start:b6,x:b2,y:b3,",
	"050000007e05000009200000ffff0f00,Nintendo Switch Pro Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:b15,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b16,rightx:a2,righty:a3,start:b6,x:b2,y:b3,sdk>=:29,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"050000004c05000068020000dfff3f00,PS3 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000004c050000c405000000783f00,PS4 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000004c050000c4050000fffe3f80,PS4 Controller,a:b1,b:b17,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:+a3,rightx:a4,righty:a5,start:b16,x:b0,y:b2,",
	"050000004c050000c4050000ffff3f00,PS4 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000004c050000cc090000fffe3f80,PS4 Controller,a:b1,b:b17,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:a3,rightx:a4,righty:a5,start:b16,x:b0,y:b2,",
	"050000004c050000cc090000ffff3f00,PS4 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000004c050000e60c0000fffe3f80,PS5 Controller,a:b0,b:b1,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:a3,rightx:a4,righty:a5,start:b16,x:b2,y:b17,",
	"050000004c050000e60c0000ffff3f00,PS5 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"05000000f8270000bf0b0000ffff3f00,Razer Kishi,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000003215000005070000ffff3f00,Razer Raiju Mobile,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000003215000007070000ffff3f00,Razer Raiju Mobile,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000003215000000090000bf7f3f00,Razer Serval,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,x:b2,y:b3,",
	"050000004f0400000ed00000fffe3f00,ThrustMaster eSwap PRO Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000005e0400008e02000000783f00,Xbox 360 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000005e040000000b000000783f80,Xbox One Elite 2 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000005e040000050b0000ffff3f00,Xbox One Elite 2 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a6,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000005e040000e002000000783f00,Xbox One S Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000005e040000ea02000000783f00,Xbox One S Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000005e040000fd020000ff7f3f00,Xbox One S Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000005e040000e00200000ffe3f80,Xbox One Wireless Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b3,leftstick:b15,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b16,righttrigger:a5,rightx:a2,righty:a3,start:b10,x:b17,y:b2,",
	"050000005e040000fd020000ffff3f00,Xbox One Wireless Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000005e040000120b000000783f80,Xbox Series X Controller,a:b0,b:b1,back:b4,misc1:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000005e040000130b0000ffff3f00,Xbox Series X Controller,a:b0,b:b1,back:b4,misc1:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
	"050000001727000044310000ffff3f80,XiaoMi Game Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a6,rightx:a4,righty:a5,start:b6,x:b2,y:b3,",
	"0500000083050000602000000ffe0000,iBuffalo SNES Controller,a:b1,b:b0,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b15,rightshoulder:b16,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
}

Android are the mappings of the pads of Android (by the GUID that the Android backend makes).

Flutter: no counterpart

View Source
var Controllers = []Controller{}/* 578 elements not displayed */

Controllers is the list, sorted by vendor and then product.

Flutter: no counterpart

View Source
var DInput = []string{}/* 302 elements not displayed */

DInput are the mappings of the pads that DirectInput and the raw HID of Windows know.

Flutter: no counterpart

View Source
var Linux = []string{}/* 274 elements not displayed */

Linux are the mappings of the pads of the evdev joystick layer of Linux.

Flutter: no counterpart

View Source
var MacOS = []string{}/* 137 elements not displayed */

MacOS are the mappings of the pads that the IOKit HID layer of macOS gives (the platform "Mac OS X").

Flutter: no counterpart

View Source
var WGI = []string{
	"03000000491900001904000000007700,Amazon Luna Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b7,x:b2,y:b3,",
	"03000000d11800000094000000007700,Google Stadia Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b12,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
	"030000007e0500000920000000007701,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
	"030000004c050000c405000000007701,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
	"030000004c050000e60c000000007700,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b14,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
	"0300000032150000000a000000007703,Razer Atrox Arcade Stick,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b11,dpup:b10,leftshoulder:b4,lefttrigger:b8,rightshoulder:b5,righttrigger:b9,x:b2,y:b3,",
	"03000000de280000ff11000000007701,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:b12,dpleft:b13,dpright:b11,dpup:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a4,leftx:a1,lefty:a0~,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a2~,start:b7,x:b2,y:b3,",
}

WGI are the mappings of the pads that Windows.Gaming.Input knows.

Flutter: no counterpart

View Source
var Web = []string{
	"default,*,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
}

Web are the mappings that the browser's pads use when the browser's own mapping is not "standard".

Flutter: no counterpart

View Source
var XInput = []string{
	"xinput,*,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
}

XInput is the mapping of the XInput pads on Windows (one line, its GUID is the name "xinput").

Flutter: no counterpart

Functions

func ControllerName

func ControllerName(vendor, product uint16) string

ControllerName returns the name that the controller list gives a vendor and product ("" when it gives none).

Flutter: no counterpart

func DeviceName

func DeviceName(vendor, product uint16, vendorName, productName string) string

DeviceName makes the name of a pad out of what its bus reports, as SDL does: the vendor and the product name joined, a name from the vendor and product numbers when the bus gave none, the usual manufacturer names shortened, and the spaces tidied.

Flutter: no counterpart

func IsGameCube

func IsGameCube(vendor, product uint16) bool

IsGameCube says whether the vendor and product are a GameCube pad or adapter.

Flutter: no counterpart

Types

type Axis

type Axis uint8

Axis is an axis of the standard layout.

Flutter: no counterpart

const (
	// LeftX is the left stick from left (−32768) to right (32767).
	//
	// Flutter: no counterpart
	LeftX Axis = iota
	// LeftY is the left stick from up (−32768) to down (32767).
	//
	// Flutter: no counterpart
	LeftY
	// RightX is the right stick from left to right.
	//
	// Flutter: no counterpart
	RightX
	// RightY is the right stick from up to down.
	//
	// Flutter: no counterpart
	RightY
	// LeftTrigger is the left trigger from 0 to 32767.
	//
	// Flutter: no counterpart
	LeftTrigger
	// RightTrigger is the right trigger from 0 to 32767.
	//
	// Flutter: no counterpart
	RightTrigger
	// AxisCount is the number of axes.
	//
	// Flutter: no counterpart
	AxisCount
)

The axes of the standard layout.

func (Axis) Name

func (a Axis) Name() string

Name is the name of the axis in a mapping line.

type BindKind

type BindKind uint8

BindKind says what a binding reads from the pad or writes to the layout.

type Binding

type Binding struct {
	In  BindKind
	Out BindKind
	// InIndex is the number of the pad's button, axis or hat; HatMask the bit of the hat; InMin and InMax the values of the
	// axis that are the ends of the binding (InMin > InMax for an inverted axis, and one of them 0 for a half axis).
	InIndex      int
	HatMask      uint8
	InMin, InMax int
	// OutButton or OutAxis is the output; OutMin and OutMax the values that the ends of an axis give.
	OutButton      Button
	OutAxis        Axis
	OutMin, OutMax int
}

Binding connects one input of a pad to one output of the layout. It is a comparable value.

Flutter: no counterpart

func ParseBindings

func ParseBindings(text string) ([]Binding, error)

ParseBindings reads the part of a mapping line that follows the name ("a:b0,b:b1,leftx:a0,type:xbox360,...") into bindings. Fields that are not buttons or axes (crc:, type:, face:, platform:, hint:, sdk>=:) and names this layout does not have are skipped, as SDL does. A name that is too long is an error.

Flutter: no counterpart

type Button

type Button uint8

Button is a button of the standard layout. Its numbers are the order of the names in a mapping line.

Flutter: no counterpart

const (
	// South is the bottom face button (A on an Xbox pad, cross on a PlayStation one).
	//
	// Flutter: no counterpart
	South Button = iota
	// East is the right face button (B, circle).
	//
	// Flutter: no counterpart
	East
	// West is the left face button (X, square).
	//
	// Flutter: no counterpart
	West
	// North is the top face button (Y, triangle).
	//
	// Flutter: no counterpart
	North
	// Back is the button on the left of the middle (View, Select, Share).
	//
	// Flutter: no counterpart
	Back
	// Guide is the button in the middle (Xbox, PS, Home).
	//
	// Flutter: no counterpart
	Guide
	// Start is the button on the right of the middle (Menu, Options).
	//
	// Flutter: no counterpart
	Start
	// LeftStick is the press of the left stick.
	//
	// Flutter: no counterpart
	LeftStick
	// RightStick is the press of the right stick.
	//
	// Flutter: no counterpart
	RightStick
	// LeftShoulder is the left bumper.
	//
	// Flutter: no counterpart
	LeftShoulder
	// RightShoulder is the right bumper.
	//
	// Flutter: no counterpart
	RightShoulder
	// DPadUp is up on the D-pad.
	//
	// Flutter: no counterpart
	DPadUp
	// DPadDown is down on the D-pad.
	//
	// Flutter: no counterpart
	DPadDown
	// DPadLeft is left on the D-pad.
	//
	// Flutter: no counterpart
	DPadLeft
	// DPadRight is right on the D-pad.
	//
	// Flutter: no counterpart
	DPadRight
	// Misc1 is an extra button (Share on an Xbox Series pad, the microphone button on a DualSense).
	//
	// Flutter: no counterpart
	Misc1
	// Paddle1 is the upper right paddle on the back.
	//
	// Flutter: no counterpart
	Paddle1
	// Paddle2 is the upper left paddle on the back.
	//
	// Flutter: no counterpart
	Paddle2
	// Paddle3 is the lower right paddle on the back.
	//
	// Flutter: no counterpart
	Paddle3
	// Paddle4 is the lower left paddle on the back.
	//
	// Flutter: no counterpart
	Paddle4
	// Touchpad is the press of the touchpad.
	//
	// Flutter: no counterpart
	Touchpad
	// Misc2 is another extra button.
	//
	// Flutter: no counterpart
	Misc2
	// Misc3 is another extra button.
	//
	// Flutter: no counterpart
	Misc3
	// Misc4 is another extra button.
	//
	// Flutter: no counterpart
	Misc4
	// Misc5 is another extra button.
	//
	// Flutter: no counterpart
	Misc5
	// Misc6 is another extra button.
	//
	// Flutter: no counterpart
	Misc6
	// ButtonCount is the number of buttons.
	//
	// Flutter: no counterpart
	ButtonCount
)

The buttons of the standard layout.

func (Button) Name

func (b Button) Name() string

Name is the name of the button in a mapping line.

type Controller

type Controller struct {
	Vendor, Product uint16
	Type            ControllerType
	Name            string
}

Controller is an entry of the list: Name is empty when SDL gives none.

Flutter: no counterpart

func Lookup

func Lookup(vendor, product uint16) (Controller, bool)

Lookup finds the entry of the controller list for a vendor and product.

Flutter: no counterpart

type ControllerType

type ControllerType uint8

ControllerType is what SDL 3's controller list says a pad with a vendor and a product number is (its k_eControllerType_ names).

Flutter: no counterpart

const (
	// ControllerUnknown is a pad that is not in the list.
	//
	// Flutter: no counterpart
	ControllerUnknown ControllerType = iota
	// Controller8BitDoController is the list's 8BitDoController.
	//
	// Flutter: no counterpart
	Controller8BitDoController
	// ControllerAppleController is the list's AppleController.
	//
	// Flutter: no counterpart
	ControllerAppleController
	// ControllerHoriSteamController is the list's HoriSteamController.
	//
	// Flutter: no counterpart
	ControllerHoriSteamController
	// ControllerMobileTouch is the list's MobileTouch.
	//
	// Flutter: no counterpart
	ControllerMobileTouch
	// ControllerPS3Controller is the list's PS3Controller.
	//
	// Flutter: no counterpart
	ControllerPS3Controller
	// ControllerPS4Controller is the list's PS4Controller.
	//
	// Flutter: no counterpart
	ControllerPS4Controller
	// ControllerPS5Controller is the list's PS5Controller.
	//
	// Flutter: no counterpart
	ControllerPS5Controller
	// ControllerPS5EdgeController is the list's PS5EdgeController.
	//
	// Flutter: no counterpart
	ControllerPS5EdgeController
	// ControllerSteamController is the list's SteamController.
	//
	// Flutter: no counterpart
	ControllerSteamController
	// ControllerSteamControllerNeptune is the list's SteamControllerNeptune.
	//
	// Flutter: no counterpart
	ControllerSteamControllerNeptune
	// ControllerSteamControllerTriton is the list's SteamControllerTriton.
	//
	// Flutter: no counterpart
	ControllerSteamControllerTriton
	// ControllerSteamControllerV2 is the list's SteamControllerV2.
	//
	// Flutter: no counterpart
	ControllerSteamControllerV2
	// ControllerSwitchInputOnlyController is the list's SwitchInputOnlyController.
	//
	// Flutter: no counterpart
	ControllerSwitchInputOnlyController
	// ControllerSwitchJoyConLeft is the list's SwitchJoyConLeft.
	//
	// Flutter: no counterpart
	ControllerSwitchJoyConLeft
	// ControllerSwitchJoyConPair is the list's SwitchJoyConPair.
	//
	// Flutter: no counterpart
	ControllerSwitchJoyConPair
	// ControllerSwitchJoyConRight is the list's SwitchJoyConRight.
	//
	// Flutter: no counterpart
	ControllerSwitchJoyConRight
	// ControllerSwitchProController is the list's SwitchProController.
	//
	// Flutter: no counterpart
	ControllerSwitchProController
	// ControllerUnknownNonSteamController is the list's UnknownNonSteamController.
	//
	// Flutter: no counterpart
	ControllerUnknownNonSteamController
	// ControllerXBox360Controller is the list's XBox360Controller.
	//
	// Flutter: no counterpart
	ControllerXBox360Controller
	// ControllerXBoxEliteController is the list's XBoxEliteController.
	//
	// Flutter: no counterpart
	ControllerXBoxEliteController
	// ControllerXBoxOneController is the list's XBoxOneController.
	//
	// Flutter: no counterpart
	ControllerXBoxOneController
	// ControllerXInputPS4Controller is the list's XInputPS4Controller.
	//
	// Flutter: no counterpart
	ControllerXInputPS4Controller
	// ControllerXInputSwitchController is the list's XInputSwitchController.
	//
	// Flutter: no counterpart
	ControllerXInputSwitchController
)

type Device

type Device struct {
	// contains filtered or unexported fields
}

Device turns the raw buttons, axes and hats of one pad into the buttons and axes of the layout, by the pad's mapping. It is the two layers of SDL in one: the layer that finds the rest value of an axis and drops the first jitters, and the layer that binds the inputs to the outputs. It is not safe for use from several goroutines.

Flutter: no counterpart

func NewDevice

func NewDevice(axes, buttons, hats int, m *Mapping, sink Sink) (*Device, error)

NewDevice makes the device of a pad that has the given numbers of raw axes, buttons and hats, and the mapping that says what they are (nil makes a device with no bindings). The first report of an axis that a trigger is bound to sets its rest value.

Flutter: no counterpart

func (*Device) Axis

func (d *Device) Axis(a Axis) int16

Axis returns the value of the axis of the layout.

Flutter: no counterpart

func (*Device) Bindings

func (d *Device) Bindings() []Binding

Bindings returns the bindings of the device.

Flutter: no counterpart

func (*Device) Button

func (d *Device) Button(b Button) bool

Button returns whether the button of the layout is down.

Flutter: no counterpart

func (*Device) HasAxis

func (d *Device) HasAxis(a Axis) bool

HasAxis says whether the mapping binds the axis.

Flutter: no counterpart

func (*Device) HasButton

func (d *Device) HasButton(b Button) bool

HasButton says whether the mapping binds the button.

Flutter: no counterpart

func (*Device) RawAxis

func (d *Device) RawAxis(t int64, i int, value int)

RawAxis takes in a report of the axis i of the pad. A value that equals the last one is dropped, and so are the reports of an axis that has not moved yet beyond jitter from the value it was first read at (some pads report a value off the centre before anything is touched); the first real movement is then sent after the value the axis rests at.

Flutter: no counterpart

func (*Device) RawButton

func (d *Device) RawButton(t int64, i int, down bool)

RawButton takes in a report of the button i of the pad.

Flutter: no counterpart

func (*Device) RawHat

func (d *Device) RawHat(t int64, i int, value uint8)

RawHat takes in a report of the hat i of the pad: a mask of HatUp, HatRight, HatDown and HatLeft.

Flutter: no counterpart

func (*Device) Recenter

func (d *Device) Recenter(t int64)

Recenter lets go of every button and centres every axis that is not at rest, as a pad that is removed does: the raw layer does it by its own guess of the centre, and this one knows the idle position of the layout.

Flutter: no counterpart

type FaceStyle

type FaceStyle uint8

FaceStyle is how the four face buttons are labelled on a pad.

Flutter: no counterpart

const (
	// FaceUnknown is a style that is not known.
	//
	// Flutter: no counterpart
	FaceUnknown FaceStyle = iota
	// FaceABXY is A at the bottom, B on the right, X on the left, Y at the top (Xbox).
	//
	// Flutter: no counterpart
	FaceABXY
	// FaceAXBY is A at the bottom, X on the right, B on the left, Y at the top (GameCube).
	//
	// Flutter: no counterpart
	FaceAXBY
	// FaceBAYX is B at the bottom, A on the right, Y on the left, X at the top (Nintendo).
	//
	// Flutter: no counterpart
	FaceBAYX
	// FaceSony is cross at the bottom, circle on the right, square on the left, triangle at the top (PlayStation).
	//
	// Flutter: no counterpart
	FaceSony
)

The styles of face buttons.

func FaceStyleOf

func FaceStyleOf(k Kind) FaceStyle

FaceStyleOf is the style of the face buttons of a kind of pad.

Flutter: no counterpart

type GUID

type GUID [16]byte

GUID identifies a model of pad: 16 bytes whose layout is

16 bits bus, 16 bits CRC-16 of the name (zero when unknown), 16 bits vendor, 16 bits zero, 16 bits product, 16 bits
zero, 16 bits version, 8 bits driver signature, 8 bits driver data

all little-endian. A pad without a vendor has the first 4 bytes of this form and then up to 12 bytes of its name. A GUID written as 32 hexadecimal digits is how the community's mapping files name a pad.

Flutter: no counterpart

func NewGUID

func NewGUID(bus, vendor, product, version uint16, vendorName, productName string, driverSignature, driverData uint8) GUID

NewGUID makes the GUID of a pad from what its bus says about it. vendorName and productName are what the bus reports (either may be empty); the CRC of the GUID is made of them. driverSignature is 'h' for a pad that Glutter's own HID driver reads, 'x' for XInput and so on, and 0 for the evdev pads of Linux.

Flutter: no counterpart

func NewGUIDForName

func NewGUIDForName(name string) GUID

NewGUIDForName makes the GUID of a pad that only a name is known of.

Flutter: no counterpart

func ParseGUID

func ParseGUID(s string) GUID

ParseGUID reads the 32 hexadecimal digits of a GUID. A string that is too short is padded with zeros, one that is too long loses the rest, and a character that is not a digit counts as 0, as in the mapping files that exist.

Flutter: no counterpart

func (GUID) Info

func (g GUID) Info() GUIDInfo

Info reads the vendor, product, version and CRC out of the GUID. A GUID that does not have the standard form has zeros for the vendor, product and version (and its CRC when its bus is one of the known ones).

Flutter: no counterpart

func (GUID) String

func (g GUID) String() string

String writes the GUID as 32 lower-case hexadecimal digits.

Flutter: no counterpart

func (GUID) WithCRC

func (g GUID) WithCRC(crc uint16) GUID

WithCRC returns the GUID with the CRC set to crc.

Flutter: no counterpart

func (GUID) WithVersion

func (g GUID) WithVersion(version uint16) GUID

WithVersion returns the GUID with the version set to version.

Flutter: no counterpart

type GUIDInfo

type GUIDInfo struct {
	Vendor, Product, Version, CRC uint16
}

GUIDInfo is what a GUID says about the pad.

Flutter: no counterpart

type Kind

type Kind uint8

Kind is the model of pad that a vendor and product number say it is; it picks the picture of the buttons an app shows, and the names of the face buttons.

Flutter: no counterpart

const (
	// KindUnknown is a pad whose kind is not known; a mapping's type: field is not set either.
	//
	// Flutter: no counterpart
	KindUnknown Kind = iota
	// KindStandard is a pad with the standard layout and no known model.
	//
	// Flutter: no counterpart
	KindStandard
	// KindXbox360 is an Xbox 360 pad.
	//
	// Flutter: no counterpart
	KindXbox360
	// KindXboxOne is an Xbox One, Xbox Series or Elite pad.
	//
	// Flutter: no counterpart
	KindXboxOne
	// KindPS3 is a PlayStation 3 pad.
	//
	// Flutter: no counterpart
	KindPS3
	// KindPS4 is a PlayStation 4 pad (DualShock 4).
	//
	// Flutter: no counterpart
	KindPS4
	// KindPS5 is a PlayStation 5 pad (DualSense).
	//
	// Flutter: no counterpart
	KindPS5
	// KindSwitchPro is a Nintendo Switch Pro pad or one that copies it.
	//
	// Flutter: no counterpart
	KindSwitchPro
	// KindJoyConLeft is a left Joy-Con on its own.
	//
	// Flutter: no counterpart
	KindJoyConLeft
	// KindJoyConRight is a right Joy-Con on its own.
	//
	// Flutter: no counterpart
	KindJoyConRight
	// KindJoyConPair is a pair of Joy-Cons used as one pad.
	//
	// Flutter: no counterpart
	KindJoyConPair
	// KindGameCube is a GameCube pad.
	//
	// Flutter: no counterpart
	KindGameCube
	// KindSteam is a Steam pad.
	//
	// Flutter: no counterpart
	KindSteam
)

The kinds of pads.

func KindFromString

func KindFromString(s string) Kind

KindFromString reads the type: field of a mapping; an unknown name is KindUnknown.

Flutter: no counterpart

func KindOf

func KindOf(vendor, product uint16, name string, forUI bool) Kind

KindOf says what kind of pad a vendor and product number are. A few pads are known by their name alone (vendor and product zero), and the Joy-Cons by their names too. forUI asks for the kind to show to the user: a GameCube adapter is then a GameCube pad, and a PlayStation 4 pad that speaks XInput is a PlayStation 4 pad, where for the mapping it is a standard one.

Flutter: no counterpart

func KindOfGUID

func KindOfGUID(g GUID, name string) Kind

KindOfGUID is KindOf for the vendor and product of a GUID, as the user sees it: a pad that speaks XInput and is of no known model is an Xbox One pad.

Flutter: no counterpart

func (Kind) String

func (k Kind) String() string

String is the name of the kind as a mapping's type: field spells it.

type Mapping

type Mapping struct {
	// GUID names the pad; its CRC is kept in Text (crc:) and is zero here.
	GUID GUID
	// Name is the name that the mapping gives the pad.
	Name string
	// Text is the part after the name: "a:b0,b:b1,...".
	Text     string
	Priority Priority
}

Mapping is a line of the table: the pad it is for and the text that says which input is which button.

Flutter: no counterpart

func (*Mapping) FaceStyle

func (m *Mapping) FaceStyle() FaceStyle

FaceStyle returns the style of face buttons the mapping's face: field names, then the hints the community's files use, or FaceUnknown.

Flutter: no counterpart

func (*Mapping) Field

func (m *Mapping) Field(name string) string

Field returns the value of the field name in the mapping text ("type" gives "xbox360" for "type:xbox360"), or "".

Flutter: no counterpart

func (*Mapping) Kind

func (m *Mapping) Kind() Kind

Kind returns the kind the mapping's type: field names, or KindUnknown.

Flutter: no counterpart

type Priority

type Priority uint8

Priority says where a mapping came from; a mapping replaces one of the same GUID only when its priority is the same or higher.

Flutter: no counterpart

const (
	// PriorityDefault is a mapping of the built-in table or one made from what the pad reports.
	//
	// Flutter: no counterpart
	PriorityDefault Priority = iota
	// PriorityAPI is a mapping that the app added with AddMappings.
	//
	// Flutter: no counterpart
	PriorityAPI
	// PriorityUser is a mapping that the user gave (an environment variable).
	//
	// Flutter: no counterpart
	PriorityUser
)

type Sink

type Sink interface {
	// ButtonChanged tells that the button went down or up.
	ButtonChanged(t int64, b Button, down bool)
	// AxisChanged tells that the axis has a new value, from AxisMin to AxisMax (triggers from 0).
	AxisChanged(t int64, a Axis, v int16)
}

Sink receives the buttons and axes of the standard layout that a Device makes out of the raw reports of a pad. It is told of changes only: a value that is the same as the last one is not sent. t is the time of the report, as the backend gave it.

Flutter: no counterpart

type Table

type Table struct {

	// SDKVersion is the version of Android that the program runs on (0 elsewhere); the mappings with sdk>= and sdk<= fields
	// that it does not satisfy are skipped.
	SDKVersion int
	// Getenv reads the environment variable that a hint: field names; nil means os.Getenv.
	Getenv func(string) string
	// contains filtered or unexported fields
}

Table is the set of mappings known to the program, in the order they were added. It is not safe for use from several goroutines; the pad manager owns one and uses it on the UI thread.

Flutter: no counterpart

func NewTable

func NewTable(sections ...[]string) *Table

NewTable makes a table with the mappings of SDL's built-in table that belong to the given sections (see Builtin).

Flutter: no counterpart

func (*Table) Add

func (t *Table) Add(line string) (int, error)

Add adds the mapping line "GUID,name,a:b0,b:b1,..." with the priority of an app's mapping. It returns 1 when the mapping is new, 0 when it replaced or kept an old one for the same pad (or when its hint: field turned it off), and an error tagged GamepadMappingInvalid when the line cannot be read.

Flutter: no counterpart

func (*Table) AddText

func (t *Table) AddText(text, platform string) (int, error)

AddText adds the mappings of a text in the community's format (one line each; lines with a platform: field that is not platform are skipped, and lines without one are skipped too, as in SDL's gamecontrollerdb.txt). It returns the number of new mappings.

Flutter: no counterpart

func (*Table) Default

func (t *Table) Default() *Mapping

Default returns the mapping that a line with the GUID "default" gave, or nil.

Flutter: no counterpart

func (*Table) Find

func (t *Table) Find(guid GUID) *Mapping

Find returns the mapping for a pad's GUID, or nil. A pad that speaks XInput gets the XInput mapping when none matches.

Flutter: no counterpart

func (*Table) Len

func (t *Table) Len() int

Len returns the number of mappings.

Flutter: no counterpart

func (*Table) Mappings

func (t *Table) Mappings() []*Mapping

Mappings returns the mappings in the order they were added.

Flutter: no counterpart

func (*Table) SetAuto

func (t *Table) SetAuto(guid GUID, name, text string) *Mapping

SetAuto adds the mapping that a backend made from what a pad reports (its text only: "a:b0,..."), under the pad's GUID and name, with the lowest priority, and returns it. A mapping that is there already for the GUID is kept.

Flutter: no counterpart

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL