diff options
| author | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
|---|---|---|
| committer | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
| commit | 76424950e373d3b04ac3dd13019151bfba3e8423 (patch) | |
| tree | 4c3cfdbda039e592b9186be3e28f8d7cfd439e8a /src/detection/gamepad/gamepad_haiku.cpp | |
Add the files
Diffstat (limited to 'src/detection/gamepad/gamepad_haiku.cpp')
| -rw-r--r-- | src/detection/gamepad/gamepad_haiku.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/detection/gamepad/gamepad_haiku.cpp b/src/detection/gamepad/gamepad_haiku.cpp new file mode 100644 index 0000000..50b43a0 --- /dev/null +++ b/src/detection/gamepad/gamepad_haiku.cpp @@ -0,0 +1,18 @@ +extern "C" { +#include "gamepad.h" +} +#include <Joystick.h> + +const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) { + BJoystick js; + for (int32 i = 0, n = js.CountDevices(); i < n; ++i) { + char name[B_OS_NAME_LENGTH]; + if (js.GetDeviceName(i, name) == B_OK) { + FFGamepadDevice* device = FF_LIST_ADD(FFGamepadDevice, *devices); + ffStrbufInit(&device->serial); + ffStrbufInitS(&device->name, name); + device->battery = 0; + } + } + return NULL; +} |