Commit Graph

23 Commits

Author SHA1 Message Date
divVerent
06c141475c
internal/gamepad: native standard layout for Linux (#2587)
Implements native standard layout for Linux gamepads by using the kernel-provided button IDs, thereby expanding
support to gamepads not listed in gamecontrollerdb.txt.

Linux's docs: https://www.kernel.org/doc/Documentation/input/gamepad.txt
SDL2's source: https://fossies.org/linux/SDL2/src/joystick/linux/SDL_sysjoystick.c#l_1740

Note that I am NOT 100% convinced about the X/Y swap between Xbox and PlayStation controllers - the Xbox
compatible pad I have however does have BTN_NORTH and BTN_WEST swapped (and thus BTN_X and BTN_Y
assigned right), which confirms SDL's logic and opposes the kernel docs.

Tested with this gamepad: "20d6:2802 BDA Xbox ONE Core controller", label says "PowerA Model 1508491-02" - even
after clearing out gamecontrollerdb.txt, examples/gamepad shows a 100% correct mapping.

Closes #2052
2023-03-04 01:47:24 +09:00
divVerent
809ad991c2
internal/gamepad: refactor standard layout support to allow remapping in the per-platform implementations. (#2588)
Refactors native standard layout so standard axes and buttons can be implemented using any of axes, buttons or hats.

This is required to be able to implement a native standard layout mapping for Linux, as e.g. shoulder buttons can be
backed either by an analog or digital input.

Precedes #2587

Updates #2052
2023-03-03 23:29:04 +09:00
Pierre Curto
4de807cc44
all: fix typos (#2558)
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-01-28 19:06:38 +09:00
Artem Yadelskyi
5b53cef59e
all: remove old // +build comments (#2431)
Closes #2325
2022-11-03 12:55:14 +09:00
Hajime Hoshi
ee595659e7 Revert "internal/gamepad: remove dependency on golang.org/x/sys/unix"
This reverts commit 046f7e52a3.

Reason: As we drop Go 1.16, we no longer have to remove this dependency.

Updates #2421
2022-10-29 23:23:13 +09:00
Hajime Hoshi
046f7e52a3 internal/gamepad: remove dependency on golang.org/x/sys/unix 2022-10-29 21:42:08 +09:00
Hajime Hoshi
5404e4d68a all: replace io/ioutil with io and os
Closes #1770
2022-09-15 02:54:25 +09:00
Terra Brown
a1cc44833d
add errcheck static analysis (#2293)
Closes #2287
2022-09-10 01:52:46 +09:00
divVerent
34a500c305
internal/gamepad: ignore EPERM when opening gamepads (#2308)
This seems required for the Snap sandbox when probing a non-gamepad device node.

Closes #2307
2022-09-06 21:29:32 +09:00
divVerent
9bc571af5e
internal/gamepad: fix a typo that caused oddly cut off gamepad names. (#2300)
This change allows gamepad names up to 256 characters, which is usually
enough. Before, names were cut off after 7 characters, matching the string
"Unknown" that is used if querying the name fails.

Closes #2300
2022-09-03 20:44:03 +09:00
Hajime Hoshi
e7c0a121c4 all: remove the build tag 'ebitencbackend'
This also automatically enables 'egl' when 'nintendosdk' is specified.

Updates #2242
2022-08-12 13:15:39 +09:00
Hajime Hoshi
dac6548c0c all: rename ebitenginecbackend to nintendosdk
Updates #2242
2022-08-12 02:05:29 +09:00
Hajime Hoshi
094726915b
ebiten: add IsStandardGamepadAxisAvailable and IsStandardGamepadButtonAvailable (#2241)
Closes #2040
2022-08-11 12:35:20 +09:00
Hajime Hoshi
428b1263d9 add ebitenginecbackend build tag besides ebitencbackend
Updates #2111
Updates #2190
2022-07-09 15:23:52 +09:00
Hajime Hoshi
847c4f067a internal/gamepad: make nativeGamepad(s) interfaces
This is a preparation to switch the gamepad implementation for Xbox.

Updates #2084
2022-06-24 21:52:48 +09:00
Hajime Hoshi
0cd43bd081 internal/gamepad: stop embedding a member into a struct
This is a preparation to switch the gamepad implementation for Xbox.

Updates #2084
2022-06-24 19:01:50 +09:00
Hajime Hoshi
51fe48fb76 internal/gamepad: bug fix: wrong offset especially on 32bit Linux
Closes #2122
2022-06-05 12:48:47 +09:00
divVerent
1de1bfef55
internal/gamepad: fix uint16 underflow handling in gamepads. (#2030)
Fixes crash where Ebiten considers a keyboard a gamepad with way too many buttons.

Updates #2027
2022-03-26 15:41:59 +09:00
Hajime Hoshi
e4d0050452 internal/gamepad: bug fix: compile error
Updates #2027
2022-03-25 14:35:03 +09:00
Hajime Hoshi
b985689010 internal/gamepad: bug fix: crash when a too big button code is reported on Linux
Updates #2027
2022-03-25 14:28:09 +09:00
Hajime Hoshi
bf1cb035eb internal/gamepad: port the gamepad part for c-backend 2022-02-05 19:11:57 +09:00
Hajime Hoshi
f6d8f42c36 internal/gamepad: refactoring: use unix.InotifyEvent 2022-02-04 04:59:40 +09:00
Hajime Hoshi
ef45058037 internal/gamepad: implement for Linux
Updates #1452
2022-02-04 04:26:33 +09:00