Skip to content

Conversation

@lcodes
Copy link

@lcodes lcodes commented Sep 23, 2025

still need to finish other platforms

@lcodes lcodes changed the title [wip] gamepad macos Gamepad support on all platforms Sep 27, 2025
@@ -0,0 +1 @@
--define:ssl
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure why it sees this as an addition? Got in from a rebase

@monofuel
Copy link
Contributor

testing the gamepad example on linux, i get crazy C errors:

/home/monofuel/.cache/nim/gamepad_d/@z..@ffep@fjvaql@fcyngsbezf@fyvahk@fcyngsbez.nim.c: In function ‘gamepadEvent__OOZfepZjvaqlZcyngsbezfZyvahkZcyngsbez_u143’:
/home/monofuel/.cache/nim/gamepad_d/@z..@ffep@fjvaql@fcyngsbezf@fyvahk@fcyngsbez.nim.c:1498:165: error: passing argument 1 of ‘udev_device_get_devnode’ from incompatible pointer type [-Wincompatible-pointer-types]
 1498 | Projects/Softmax/windy/src/windy/platforms/linux/gamepad.nim");        devnode_1 = udev_device_get_devnode(device_p0);
      |                                                                                                            ^~~~~~~~~
      |                                                                                                            |
      |                                                                                                            tyObject_udev_device__h9c3w7T9cp8IOvodH9c9bJ3e1Q *

In file included from /home/monofuel/.cache/nim/gamepad_d/@z..@ffep@fjvaql@fcyngsbezf@fyvahk@fcyngsbez.nim.c:10:
/nix/store/mfsa7vg8jqfa0480liz5wagpzava1sd3-systemd-minimal-libs-257.7-dev/include/libudev.h:80:57: note: expected ‘struct udev_device *’ but argument is of type ‘tyObject_udev_device__h9c3w7T9cp8IOvodH9c9bJ3e1Q *’
   80 | const char* udev_device_get_devnode(struct udev_device *udev_device);
      |                                     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
/home/monofuel/.cache/nim/gamepad_d/@z..@ffep@fjvaql@fcyngsbezf@fyvahk@fcyngsbez.nim.c:1514:77: error: passing argument 1 of ‘udev_device_get_syspath’ from incompatible pointer type [-Wincompatible-pointer-types]
 1514 |                 nimln_(40);             syspath_1 = udev_device_get_syspath(device_p0);
      |                                                                             ^~~~~~~~~
      |                                                                             |
      |                                                                             tyObject_udev_device__h9c3w7T9cp8IOvodH9c9bJ3e1Q *
/nix/store/mfsa7vg8jqfa0480liz5wagpzava1sd3-systemd-minimal-libs-257.7-dev/include/libudev.h:77:57: note: expected ‘struct udev_device *’ but argument is of type ‘tyObject_udev_device__h9c3w7T9cp8IOvodH9c9bJ3e1Q *’
   77 | const char* udev_device_get_syspath(struct udev_device *udev_device);
      |                                     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
/home/monofuel/.cache/nim/gamepad_d/@z..@ffep@fjvaql@fcyngsbezf@fyvahk@fcyngsbez.nim.c:1548:99: error: passing argument 2 of ‘libevdev_new_from_fd’ from incompatible pointer type [-Wincompatible-pointer-types]
 1548 |                                                                 T26_ = libevdev_new_from_fd(fd_1, &device_2);
      |                                                                                                   ^~~~~~~~~
      |                                                                                                   |
      |                                                                                                   tyObject_libevdev__M1xDZWWb3Zlpwnni0CL4vg **
In file included from /home/monofuel/.cache/nim/gamepad_d/@z..@ffep@fjvaql@fcyngsbezf@fyvahk@fcyngsbez.nim.c:13:
/nix/store/aii3y8mv471svmm4rd41jm4bj0xgddbz-libevdev-1.13.4/include/libevdev-1.0/libevdev/libevdev.h:810:52: note: expected ‘struct libevdev **’ but argument is of type ‘tyObject_libevdev__M1xDZWWb3Zlpwnni0CL4vg **’
  810 | int libevdev_new_from_fd(int fd, struct libevdev **dev);
      |                                  ~~~~~~~~~~~~~~~~~~^~~
compilation terminated due to -fmax-errors=3.
Error: execution of an external compiler program 'gcc -c -w -fmax-errors=3 -pthread   -I/nix/store/i4503l5qxf913s0dh61yf50bg8znzshf-nim-unwrapped-2.2.4/nim/lib -I/mnt/rhotano/home/monofuel/Documents/Projects/Softmax/windy/examples -o /home/monofuel/.cache/nim/gamepad_d/@z..@ffep@fjvaql@fcyngsbezf@fyvahk@fcyngsbez.nim.c.o /home/monofuel/.cache/nim/gamepad_d/@z..@ffep@fjvaql@fcyngsbezf@fyvahk@fcyngsbez.nim.c' failed with exit code: 1

config.nims Outdated
@@ -0,0 +1,59 @@
import strutils

if defined(linux):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if defined(linux):
if defined(linux) and not defined(emscripten):

we don't want -ludev or -levdev when building emscripten on linux

@monofuel
Copy link
Contributor

Screenshot From 2025-09-30 14-46-29 gamepads work great on emscripten!

@monofuel
Copy link
Contributor

Update: the snes-style usb gamepad at the office works on the emscripten version. However a ps2-style and an atari-style joystick at the office does not seem to be working, even after reloading.

all 3 of these controllers work fine on an html5 gamepad tester. strange that one would work and the others not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants