29 lines
688 B
C
Raw Normal View History

2025-01-22 16:18:30 +01:00
#pragma once
#include <kinc/global.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/hid/IOHIDKeys.h>
#include <IOKit/hid/IOHIDManager.h>
#include "HIDGamepad.h"
// Maximum number of devices supported
// Corresponds to size of Kore::Gamepad array
static const int KINC_MAX_HID_DEVICES = 12;
// Slots to hold details on connected devices
struct HIDManagerDeviceRecord {
bool connected; // = false;
IOHIDDeviceRef device; // = NULL;
struct HIDGamepad pad;
};
struct HIDManager {
IOHIDManagerRef managerRef;
struct HIDManagerDeviceRecord devices[KINC_MAX_HID_DEVICES];
};
void HIDManager_init(struct HIDManager *manager);
void HIDManager_destroy(struct HIDManager *manager);