Fixed signatures for internal haptics functions

This commit is contained in:
Sam Lantinga
2024-06-05 10:09:02 -07:00
parent f879411627
commit 26fc7a8060
7 changed files with 28 additions and 33 deletions

View File

@@ -223,9 +223,7 @@ SDL_bool SDL_IsJoystickHaptic(SDL_Joystick *joystick)
/* Must be a valid joystick */
if (SDL_IsJoystickValid(joystick) &&
!SDL_IsGamepad(SDL_GetJoystickInstanceID(joystick))) {
if (SDL_SYS_JoystickIsHaptic(joystick) > 0) {
result = SDL_TRUE;
}
result = SDL_SYS_JoystickIsHaptic(joystick);
}
}
SDL_UnlockJoysticks();

View File

@@ -92,11 +92,8 @@ int SDL_SYS_HapticMouse(void);
/*
* Checks to see if the joystick has haptic capabilities.
*
* Returns >0 if haptic capabilities are detected, 0 if haptic
* capabilities aren't detected and -1 on error.
*/
extern int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick);
extern SDL_bool SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick);
/*
* Opens the haptic device for usage using the same device as
@@ -109,9 +106,9 @@ extern int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic,
/*
* Checks to see if haptic device and joystick device are the same.
*
* Returns 1 if they are the same, 0 if they aren't.
* Returns SDL_TRUE if they are the same, SDL_FALSE if they aren't.
*/
extern int SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic,
extern SDL_bool SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic,
SDL_Joystick *joystick);
/*

View File

@@ -138,9 +138,9 @@ int SDL_SYS_HapticMouse(void)
return -1;
}
int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
SDL_bool SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
{
return 0;
return SDL_FALSE;
}
int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick)
@@ -148,9 +148,9 @@ int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick)
return SDL_Unsupported();
}
int SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
SDL_bool SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
{
return 0;
return SDL_FALSE;
}
void SDL_SYS_HapticClose(SDL_Haptic *haptic)

View File

@@ -587,7 +587,7 @@ int SDL_SYS_HapticMouse(void)
/*
* Checks to see if a joystick has haptic features.
*/
int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
SDL_bool SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
{
#ifdef SDL_JOYSTICK_IOKIT
if (joystick->driver != &SDL_DARWIN_JoystickDriver) {
@@ -603,18 +603,18 @@ int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
/*
* Checks to see if the haptic device and joystick are in reality the same.
*/
int SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
SDL_bool SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
{
#ifdef SDL_JOYSTICK_IOKIT
if (joystick->driver != &SDL_DARWIN_JoystickDriver) {
return 0;
return SDL_FALSE;
}
if (IOObjectIsEqualTo((io_object_t)((size_t)haptic->hwdata->device),
joystick->hwdata->ffservice)) {
return 1;
return SDL_TRUE;
}
#endif
return 0;
return SDL_FALSE;
}
/*

View File

@@ -61,9 +61,9 @@ int SDL_SYS_HapticMouse(void)
return -1;
}
int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
SDL_bool SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
{
return 0;
return SDL_FALSE;
}
int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick)
@@ -71,9 +71,9 @@ int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick)
return SDL_SYS_LogicError();
}
int SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
SDL_bool SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
{
return 0;
return SDL_FALSE;
}
void SDL_SYS_HapticClose(SDL_Haptic *haptic)

View File

@@ -503,7 +503,7 @@ int SDL_SYS_HapticMouse(void)
/*
* Checks to see if a joystick has haptic features.
*/
int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
SDL_bool SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
{
#ifdef SDL_JOYSTICK_LINUX
SDL_AssertJoysticksLocked();
@@ -521,21 +521,21 @@ int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
/*
* Checks to see if the haptic device and joystick are in reality the same.
*/
int SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
SDL_bool SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
{
#ifdef SDL_JOYSTICK_LINUX
SDL_AssertJoysticksLocked();
if (joystick->driver != &SDL_LINUX_JoystickDriver) {
return 0;
return SDL_FALSE;
}
/* We are assuming Linux is using evdev which should trump the old
* joystick methods. */
if (SDL_strcmp(joystick->hwdata->fname, haptic->hwdata->fname) == 0) {
return 1;
return SDL_TRUE;
}
#endif
return 0;
return SDL_FALSE;
}
/*

View File

@@ -180,24 +180,24 @@ int SDL_SYS_HapticMouse(void)
/*
* Checks to see if a joystick has haptic features.
*/
int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
SDL_bool SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
{
if (joystick->driver != &SDL_WINDOWS_JoystickDriver) {
return 0;
return SDL_FALSE;
}
if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) {
return 1;
return SDL_TRUE;
}
return 0;
return SDL_FALSE;
}
/*
* Checks to see if the haptic device and joystick are in reality the same.
*/
int SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
SDL_bool SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
{
if (joystick->driver != &SDL_WINDOWS_JoystickDriver) {
return 0;
return SDL_FALSE;
}
return SDL_DINPUT_JoystickSameHaptic(haptic, joystick);
}