Gamepad (Haiku): add support
Some checks are pending
CI / spellcheck (push) Waiting to run
CI / No-features-test (push) Waiting to run
CI / Linux-amd64 (push) Waiting to run
CI / Linux-aarch64 (push) Waiting to run
CI / Linux-armv7l (push) Waiting to run
CI / Linux-armv6l (push) Waiting to run
CI / Linux-riscv64 (push) Waiting to run
CI / Linux-ppc64le (push) Waiting to run
CI / Linux-s390x (push) Waiting to run
CI / Musl-amd64 (push) Waiting to run
CI / macOS-universal (push) Waiting to run
CI / SunOS-amd64 (push) Waiting to run
CI / FreeBSD-amd64 (push) Waiting to run
CI / DragonFly-amd64 (push) Waiting to run
CI / OpenBSD-amd64 (push) Waiting to run
CI / NetBSD-amd64 (push) Waiting to run
CI / Windows-amd64 (push) Waiting to run
CI / Release (push) Blocked by required conditions

This commit is contained in:
Carter Li 2025-02-16 11:05:58 +08:00
parent 01d37653b0
commit 8e5c2adda3

View File

@ -0,0 +1,21 @@
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 = (FFGamepadDevice*) ffListAdd(devices);
ffStrbufInit(&device->serial);
ffStrbufInitS(&device->name, name);
device->battery = 0;
}
}
return NULL;
}