Added hints for more fine grained control over HIDAPI Xbox controller support

This commit is contained in:
Sam Lantinga
2022-08-19 11:11:23 -07:00
parent bf327b52bd
commit 52b6899a6b
15 changed files with 402 additions and 64 deletions

View File

@@ -24,6 +24,7 @@
#define SDL_JOYSTICK_HIDAPI_H
#include "SDL_atomic.h"
#include "SDL_hints.h"
#include "SDL_mutex.h"
#include "SDL_joystick.h"
#include "SDL_gamecontroller.h"
@@ -46,6 +47,9 @@
#define SDL_JOYSTICK_HIDAPI_STEAM
#endif
/* Whether HIDAPI is enabled by default */
#define SDL_HIDAPI_DEFAULT SDL_TRUE
/* The maximum size of a USB packet for HID devices */
#define USB_PACKET_LENGTH 64
@@ -91,9 +95,11 @@ typedef struct _SDL_HIDAPI_Device
typedef struct _SDL_HIDAPI_DeviceDriver
{
const char *hint;
const char *name;
SDL_bool enabled;
SDL_bool enabled_default;
void (*RegisterHints)(SDL_HintCallback callback, void *userdata);
void (*UnregisterHints)(SDL_HintCallback callback, void *userdata);
SDL_bool (*IsEnabled)(void);
SDL_bool (*IsSupportedDevice)(const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol);
const char *(*GetDeviceName)(const char *name, Uint16 vendor_id, Uint16 product_id);
SDL_bool (*InitDevice)(SDL_HIDAPI_Device *device);