Commit Graph

102 Commits

Author SHA1 Message Date
Hajime Hoshi
4267e5d22e internal/gamepad: bug fix: do not call GetRawInputDeviceList with the count 0
Updates #2696
2023-07-08 19:18:05 +09:00
Hajime Hoshi
22dfdfc418 internal/gamepad: bug fix: possible crash at iterating gamepads
Closes #2603
2023-03-17 11:40:24 +09:00
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
Hajime Hoshi
7998e4d31d update purego to v0.3.0-alpha
There are breaking changes between purego v0.2.0 and v0.3.0-alpha.
2023-03-04 01:22:54 +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
Hajime Hoshi
b278e5521f internal/gamepad: rename variables 2023-03-03 21:17:47 +09:00
Hajime Hoshi
f4371991fe internal/gamepad: refactoring 2023-02-02 22:33:01 +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
Hajime Hoshi
afbd1aebf1 internal/ui: use -overlay to provide the implementation for Nintendo Switch
Updates #2372
2023-01-01 01:35:05 +09:00
Hajime Hoshi
58692f6d85 internal/gamepad: refactoring 2023-01-01 00:58:42 +09:00
Hajime Hoshi
77f32bd088 internal/gamepad: use -overlay to provide the implementation for Nintendo Switch
Updates #2372
2022-12-31 18:08:28 +09:00
TotallyGamerJet
f09c4a624e
internal/gamepad: use RegisterLibFunc (#2465)
RegisterLibFunction is typesafe and now supports float arguments.

Updates #1162
2022-11-21 00:24:27 +09:00
TotallyGamerJet
56ec19caa1
all: use RTLD_LAZY in dlopen for darwin (#2453)
dlopen requires either RTLD_LAZY or RTLD_NOW but there was neither.

Updates #1162
2022-11-14 04:44:51 +09:00
Artem Yadelskyi
10415d417a
all: replace interface{} with any (#2430)
Closes #2429
2022-11-03 15:33:09 +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
8a7d860632 all: unify Windows error handlings for Windows HANDLE
Updates #2366
2022-10-02 02:22:06 +09:00
Hajime Hoshi
cd9477491d internal/gamepad: refactoring 2022-09-18 20:09:10 +09:00
Hajime Hoshi
963eb2756a all: fix TODO comments 2022-09-16 02:02:02 +09:00
Hajime Hoshi
b13fa2817c internal/gamepad: clean up codes for Darwin
* Removes redundant assignments.
* Fixes types for the Apple libraries.

Updates #1162
2022-09-16 00:25:51 +09:00
TotallyGamerJet
4a569be6f6
internal/gamepad: remove Cgo on darwin (#2330)
Updates #1162
2022-09-16 00:11:59 +09:00
Hajime Hoshi
5404e4d68a all: replace io/ioutil with io and os
Closes #1770
2022-09-15 02:54:25 +09:00
Hajime Hoshi
655cd4bf68 all: remove the build tag
Updates #1415
2022-09-15 00:23:40 +09:00
Hajime Hoshi
7d6ee39c15 internal/gamepad: bug fix: a wireless Xbox controller didn't work correctly on macOS
The button and hat values must be adjusted by their minimum values.
See also GLFW's implementation.

Closes #266
2022-09-12 01:55:05 +09:00
Hajime Hoshi
89598df520 internal/gamepad: refactoring
Updates #2311
2022-09-11 22:44:06 +09:00
Hajime Hoshi
4629306f4b internal/gamepad: bug fix: wrong SDL ID on iOS
The gamepad database already worked well with this fix.

Closes #2311
2022-09-11 22:29:38 +09:00
Hajime Hoshi
b5acb1e53d internal/gamepad: remove .errcheck_excludes_windows
Updates #2287
2022-09-10 02:11:08 +09:00
Terra Brown
a1cc44833d
add errcheck static analysis (#2293)
Closes #2287
2022-09-10 01:52:46 +09:00
Hajime Hoshi
4c76356803 internal/gamepad: refactoring 2022-09-09 22:31:47 +09:00
Hajime Hoshi
47558d20c5 internal/gamepaddb: enable the database for Android
Before this fix, the button and axis IDs are from the OS. These
didn't match with the SDL game controller databaes unfortunately.

This fix changes the assignments of the buttons and the axes to match
with the database.

Closes #2312
2022-09-09 22:20:39 +09:00
Hajime Hoshi
d66c599938 cmd/ebitenmobile: remove counting buttons and use a constant instead
Updates #2309
2022-09-07 15:43:11 +09:00
Hajime Hoshi
db1255cdf8 internal/gamepad: rename ButtonNum -> ButtonCount 2022-09-07 15:40:52 +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
8081d0636a internal/cbackend: rename to nintendosdk
Updates #2242
2022-08-12 17:19:37 +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
72d5002e72 remove go2cpp support
Closes #2126
2022-08-07 22:17:53 +09:00
Hajime Hoshi
abcacc26d8 internal/glfwwin: update for GLFW v3.3.8
Closes #2214
2022-08-07 15:03:33 +09:00
mattn
2bacecca24
fix typos (#2227) 2022-08-03 22:40:39 +09:00
Hajime Hoshi
356c625601 internal/gamepad: improve resetting vibrations 2022-07-16 02:44:54 +09:00
Hajime Hoshi
9e1a2bcb30 internal/gamepad: reorder function implements 2022-07-15 21:52:26 +09:00
Hajime Hoshi
d6547f12c6 internal/gamepad: implement gamepad vibrations for Xbox
Updates #2084
2022-07-15 21:33:23 +09:00
Hajime Hoshi
d231a35d3b internal/gamepad: bug fix: release IDirectInputDevice8W on disconnecting
Closes #2205
2022-07-15 15:44:40 +09:00
Hajime Hoshi
520a30f3c7 internal/gamepad: bug fix: memory leak on Xbox
Updates #2084
2022-07-15 15:12:56 +09:00
Hajime Hoshi
c14403f195 internal/gamepad: bug fix: Y axis values are opposite on Xbox
Updates #2084
2022-07-15 14:55:38 +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
ac5c48f575 internal/gamepad: support Xbox
Updates #2084
2022-07-02 01:02:24 +09:00