mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-07 18:36:26 +00:00
Added hints for more fine grained control over HIDAPI Xbox controller support
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
|
||||
#ifdef SDL_JOYSTICK_HIDAPI
|
||||
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_joystick.h"
|
||||
@@ -82,6 +81,26 @@ typedef struct {
|
||||
} SDL_DriverShield_Context;
|
||||
|
||||
|
||||
static void
|
||||
HIDAPI_DriverShield_RegisterHints(SDL_HintCallback callback, void *userdata)
|
||||
{
|
||||
SDL_AddHintCallback(SDL_HINT_JOYSTICK_HIDAPI_SHIELD, callback, userdata);
|
||||
}
|
||||
|
||||
static void
|
||||
HIDAPI_DriverShield_UnregisterHints(SDL_HintCallback callback, void *userdata)
|
||||
{
|
||||
SDL_DelHintCallback(SDL_HINT_JOYSTICK_HIDAPI_SHIELD, callback, userdata);
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
HIDAPI_DriverShield_IsEnabled(void)
|
||||
{
|
||||
return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_SHIELD,
|
||||
SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI,
|
||||
SDL_HIDAPI_DEFAULT));
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
HIDAPI_DriverShield_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)
|
||||
{
|
||||
@@ -445,7 +464,9 @@ SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverShield =
|
||||
{
|
||||
SDL_HINT_JOYSTICK_HIDAPI_SHIELD,
|
||||
SDL_TRUE,
|
||||
SDL_TRUE,
|
||||
HIDAPI_DriverShield_RegisterHints,
|
||||
HIDAPI_DriverShield_UnregisterHints,
|
||||
HIDAPI_DriverShield_IsEnabled,
|
||||
HIDAPI_DriverShield_IsSupportedDevice,
|
||||
HIDAPI_DriverShield_GetDeviceName,
|
||||
HIDAPI_DriverShield_InitDevice,
|
||||
|
Reference in New Issue
Block a user