Input/keybinds/gamepad library
Vortice for Windows + evdev-sharp for Linux? oh, CPP did this in TASEmulators/BizHawk!3702 (uses X11 via SDL2 on Linux), so I'll repurpose this issue as tracking the keybinds library idea
OpenTK 4 and 5 are .NET Core only, though IIRC OTK 4 was .NET Standard until late in beta, maybe it can still work just by adding the target and building from source? if so, sample program
thinking of tearing out EmuHawk's input spaghetti and making a NuGet package (#125) which:
- wraps Vortice/evdev-sharp
- exposes a single Key enum
- handles modifiers properly (BizHawk#2981)
- handles keybinds maybe?
- might want to make that config package first (#110), and re-use its layer mechanism for layout presets (TASEmulators/BizHawk#1636)
- prefix keyboard with '#', mouse with '@', gamepad with
$"{index}&"
, weird XR stuff with '%', and automation with '$'- steal good parts of https://wiki.dolphin-emu.org/index.php?title=Input_Syntax
- "sticky" modifiers? like sprint in MC
- keydown (positive edge), hold, keyup (negative edge), and !hold (invert)
- gamepad stick axes join and split
- gamepad stick rotate/transpose
- overhaul default keybinds at the same time
- steal this idea from Grounded changelog:
- [user cannot softlock by unbinding] critical controls such as "UI - Select" by binding the key to a conflicting control.
- abs/rel stuff, TODO restore notes from desktop FF bookmarks
- original issue re: DS touchscreen TASEmulators/BizHawk#1925
- GBA tilt https://tasvideos.org/Forum/Posts/524669
- mice and light guns are fundamentally different
- detect and list conflicts
until then, here's a Lua script for debugging gamepads when a "host deadzone" is desperately needed
local WINDOW = 100;
local concat_names = function(list)
local s = "";
local l = "";
for k, _ in pairs(list) do
l = l..k.." ";
if #l > 60 then
s = s..l.."\n";
l = "";
end
end
return s..l;
end;
local held = {};
local held_str = "";
while true do
for k, v in pairs(input.get()) do held[k] = v; end
if emu.framecount() % WINDOW == 0 then
held_str = concat_names(held);
held = {};
end
gui.text(0, 0, held_str, nil, "bottomleft");
emu.frameadvance();
end
Edited by James Groom