joystick: Convert HasLED() into a generic GetCapabilities() function

This commit is contained in:
Cameron Gutman
2021-11-11 11:13:08 -06:00
committed by Sam Lantinga
parent 1ba695dc94
commit 1ccfbf963e
34 changed files with 156 additions and 114 deletions

View File

@@ -924,6 +924,12 @@ SDL_DINPUT_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble,
return 0;
}
Uint32
SDL_DINPUT_JoystickGetCapabilities(SDL_Joystick * joystick)
{
return 0;
}
static Uint8
TranslatePOV(DWORD value)
{
@@ -1168,6 +1174,12 @@ SDL_DINPUT_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble,
return SDL_Unsupported();
}
Uint32
SDL_DINPUT_JoystickGetCapabilities(SDL_Joystick * joystick)
{
return 0;
}
void
SDL_DINPUT_JoystickUpdate(SDL_Joystick * joystick)
{

View File

@@ -25,6 +25,7 @@ extern void SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext);
extern SDL_bool SDL_DINPUT_JoystickPresent(Uint16 vendor, Uint16 product, Uint16 version);
extern int SDL_DINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickdevice);
extern int SDL_DINPUT_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble);
extern Uint32 SDL_DINPUT_JoystickGetCapabilities(SDL_Joystick * joystick);
extern void SDL_DINPUT_JoystickUpdate(SDL_Joystick * joystick);
extern void SDL_DINPUT_JoystickClose(SDL_Joystick * joystick);
extern void SDL_DINPUT_JoystickQuit(void);

View File

@@ -334,9 +334,9 @@ WINMM_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16
return SDL_Unsupported();
}
static SDL_bool WINMM_JoystickHasLED(SDL_Joystick *joystick)
static Uint32 WINMM_JoystickGetCapabilities(SDL_Joystick *joystick)
{
return SDL_FALSE;
return 0;
}
static int
@@ -500,7 +500,7 @@ SDL_JoystickDriver SDL_WINMM_JoystickDriver =
WINMM_JoystickOpen,
WINMM_JoystickRumble,
WINMM_JoystickRumbleTriggers,
WINMM_JoystickHasLED,
WINMM_JoystickGetCapabilities,
WINMM_JoystickSetLED,
WINMM_JoystickSendEffect,
WINMM_JoystickSetSensorsEnabled,

View File

@@ -1277,10 +1277,10 @@ RAWINPUT_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint
#endif
}
static SDL_bool
RAWINPUT_JoystickHasLED(SDL_Joystick *joystick)
static Uint32
RAWINPUT_JoystickGetCapabilities(SDL_Joystick *joystick)
{
return SDL_FALSE;
return 0;
}
static int
@@ -1928,7 +1928,7 @@ SDL_JoystickDriver SDL_RAWINPUT_JoystickDriver =
RAWINPUT_JoystickOpen,
RAWINPUT_JoystickRumble,
RAWINPUT_JoystickRumbleTriggers,
RAWINPUT_JoystickHasLED,
RAWINPUT_JoystickGetCapabilities,
RAWINPUT_JoystickSetLED,
RAWINPUT_JoystickSendEffect,
RAWINPUT_JoystickSetSensorsEnabled,

View File

@@ -665,10 +665,10 @@ WGI_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 ri
}
}
static SDL_bool
WGI_JoystickHasLED(SDL_Joystick *joystick)
static Uint32
WGI_JoystickGetCapabilities(SDL_Joystick *joystick)
{
return SDL_FALSE;
return 0;
}
static int
@@ -876,7 +876,7 @@ SDL_JoystickDriver SDL_WGI_JoystickDriver =
WGI_JoystickOpen,
WGI_JoystickRumble,
WGI_JoystickRumbleTriggers,
WGI_JoystickHasLED,
WGI_JoystickGetCapabilities,
WGI_JoystickSetLED,
WGI_JoystickSendEffect,
WGI_JoystickSetSensorsEnabled,

View File

@@ -658,10 +658,14 @@ WINDOWS_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint1
return SDL_Unsupported();
}
static SDL_bool
WINDOWS_JoystickHasLED(SDL_Joystick *joystick)
static Uint32
WINDOWS_JoystickGetCapabilities(SDL_Joystick *joystick)
{
return SDL_FALSE;
if (joystick->hwdata->bXInputDevice) {
return SDL_XINPUT_JoystickGetCapabilities(joystick);
} else {
return SDL_DINPUT_JoystickGetCapabilities(joystick);
}
}
static int
@@ -758,7 +762,7 @@ SDL_JoystickDriver SDL_WINDOWS_JoystickDriver =
WINDOWS_JoystickOpen,
WINDOWS_JoystickRumble,
WINDOWS_JoystickRumbleTriggers,
WINDOWS_JoystickHasLED,
WINDOWS_JoystickGetCapabilities,
WINDOWS_JoystickSetLED,
WINDOWS_JoystickSendEffect,
WINDOWS_JoystickSetSensorsEnabled,

View File

@@ -503,6 +503,12 @@ SDL_XINPUT_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble,
return 0;
}
Uint32
SDL_XINPUT_JoystickGetCapabilities(SDL_Joystick * joystick)
{
return 0;
}
void
SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick)
{
@@ -579,6 +585,12 @@ SDL_XINPUT_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble,
return SDL_Unsupported();
}
Uint32
SDL_XINPUT_JoystickGetCapabilities(SDL_Joystick * joystick)
{
return 0;
}
void
SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick)
{

View File

@@ -27,6 +27,7 @@ extern int SDL_XINPUT_JoystickInit(void);
extern void SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext);
extern int SDL_XINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickdevice);
extern int SDL_XINPUT_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble);
extern Uint32 SDL_XINPUT_JoystickGetCapabilities(SDL_Joystick * joystick);
extern void SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick);
extern void SDL_XINPUT_JoystickClose(SDL_Joystick * joystick);
extern void SDL_XINPUT_JoystickQuit(void);