Documentation
¶
Overview ¶
Package inputmap writes the keyboard bindings each standalone emulator needs so that the keys WittyPlay injects for a player's pad (see sandbox/docker/inputagent's KeyMap) press that player's buttons. Nothing else would: out of the box an emulator binds only its own default keys, or none at all.
Every emulator names keys its own way, and often differently on each host OS because it reads the OS's own keyboard backend, so each notation here was taken from the emulator's source at the version WittyPlay pins (cited at each emulator below). Where a notation couldn't be verified for an OS, Targets refuses that OS rather than guess.
Two assumptions every notation shares: the keyboard layout is US, and on X11 the keypad's keys arrive as KP_0..KP_9 (NumLock on), the way xdotool's keysyms name them.
Index ¶
- func HostKey(goos, keysym string) (code int, ok bool)
- func Players(emulator string) int
- func QtKey(goos, keysym string) (int, bool)
- func Reserved(emulator, goos string, keys KeyMap) []string
- func SDLScancode(keysym string) (int, bool)
- func Supported(emulator string) bool
- func SupportedOn(emulator, goos string) bool
- type KeyMap
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HostKey ¶
HostKey says which key code the injector for goos presses for an X keysym name, so mapping and injection agree: on "darwin" a macOS virtual key code (kVK_*), on "windows" a virtual-key code (VK_*; the keypad's Enter is 0x10D, VK_RETURN marked as extended), on "linux" the keysym's value. Only unshifted keys of a US keyboard are known: a keysym that needs Shift (an upper-case letter, "exclam") would press a modifier the emulator then sees too.
func Players ¶
Players is how many players the emulator's keyboard bindings can give keys of their own; 0 for an emulator this package doesn't know.
func QtKey ¶
QtKey is the value a Qt program reads from QKeyEvent::key() | modifiers for the key an X keysym names on goos: the Qt::Key, with Qt::KeypadModifier for the keypad's keys and, on macOS, for the arrow keys too (macOS marks arrows as keypad keys, and Qt passes that on).
func Reserved ¶
Reserved lists the keys in keys, for the players Targets maps, that the emulator takes for itself on goos before a game sees them, so binding them does nothing, or that it acts on as well as passing them on, so binding them does something else too.
func SDLScancode ¶
SDLScancode is the SDL scancode (USB HID usage) of the key an X keysym names, the same on every host since SDL reads scancodes.
func Supported ¶
Supported says whether this package maps keys for an emulator on at least one host OS.
func SupportedOn ¶
SupportedOn says whether the emulator's key notation on goos was verified, so Targets can produce bindings for it there.
Types ¶
type KeyMap ¶
KeyMap gives each of four players' RetroPad buttons an X keysym name, as inputagent.KeyMap.
type Target ¶
Target is one value to set in an emulator's settings. File is relative to the emulator's settings folder, with forward slashes. Format is ini, toml, yaml, xml or json, and Path names the value as package configfile does: ini [section, key]; toml [table..., key]; yaml [key, ...]; xml [element, ...]; json [key, ...]. Value is a string, an int64 or a bool; in JSON it may also be a whole list ([]any) or object (map[string]any) of those, which replaces what the file had there.
A Target with no Path is a whole file: Value is its complete text, to be written as it is. That is for a file that holds nothing but these bindings in a shape configfile can't edit (a list of repeated elements).
func Targets ¶
Targets is every binding for players 1 to Players(emulator) on host goos. A button a player has no key for is left out. It's an error for a key to be one this package can't name, or for two buttons to come out as the same key in the emulator's notation, since one would shadow the other.