Files
fastfetch/src/detection/gamepad/gamepad_haiku.cpp
T
李通洲 e0eba8ce21 Chore: run clang-format
```bash
find . -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) ! -path "src/3rdparty/*" -print0 | xargs -0 clang-format -i
```
2026-03-29 10:03:32 +08:00

19 lines
535 B
C++

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;
}