From dec7875a6e23212021e4d9080330a42832dfe02a Mon Sep 17 00:00:00 2001
From: Edward Rudd <urkle@outoforder.cc>
Date: Tue, 15 Jun 2021 01:40:19 +0000
Subject: [PATCH] update SDL soruce to 2.0.14
---
source/src/haptic/darwin/SDL_syshaptic.c | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/source/src/haptic/darwin/SDL_syshaptic.c b/source/src/haptic/darwin/SDL_syshaptic.c
index ecbd2bd..f8a2af5 100644
--- a/source/src/haptic/darwin/SDL_syshaptic.c
+++ b/source/src/haptic/darwin/SDL_syshaptic.c
@@ -22,13 +22,12 @@
#ifdef SDL_HAPTIC_IOKIT
-#include "SDL_assert.h"
#include "SDL_stdinc.h"
#include "SDL_haptic.h"
#include "../SDL_syshaptic.h"
#include "SDL_joystick.h"
#include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */
-#include "../../joystick/darwin/SDL_sysjoystick_c.h" /* For joystick hwdata */
+#include "../../joystick/darwin/SDL_iokitjoystick_c.h" /* For joystick hwdata */
#include "SDL_syshaptic_c.h"
#include <IOKit/IOKitLib.h>
@@ -599,12 +598,14 @@
int
SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
{
+#ifdef SDL_JOYSTICK_IOKIT
if (joystick->driver != &SDL_DARWIN_JoystickDriver) {
return SDL_FALSE;
}
if (joystick->hwdata->ffservice != 0) {
return SDL_TRUE;
}
+#endif
return SDL_FALSE;
}
@@ -615,6 +616,7 @@
int
SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
{
+#ifdef SDL_JOYSTICK_IOKIT
if (joystick->driver != &SDL_DARWIN_JoystickDriver) {
return 0;
}
@@ -622,6 +624,7 @@
joystick->hwdata->ffservice)) {
return 1;
}
+#endif
return 0;
}
@@ -632,6 +635,7 @@
int
SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
{
+#ifdef SDL_JOYSTICK_IOKIT
int device_index = 0;
SDL_hapticlist_item *item;
@@ -648,6 +652,9 @@
}
return SDL_SYS_HapticOpenFromService(haptic, joystick->hwdata->ffservice);
+#else
+ return -1;
+#endif
}
@@ -765,6 +772,10 @@
rglDir[2] = dir->dir[2];
}
return 0;
+ case SDL_HAPTIC_STEERING_AXIS:
+ effect->dwFlags |= FFEFF_CARTESIAN;
+ rglDir[0] = 0;
+ return 0;
default:
return SDL_SetError("Haptic: Unknown direction type.");
@@ -813,7 +824,11 @@
envelope->dwSize = sizeof(FFENVELOPE); /* Always should be this. */
/* Axes. */
- dest->cAxes = haptic->naxes;
+ if (src->constant.direction.type == SDL_HAPTIC_STEERING_AXIS) {
+ dest->cAxes = 1;
+ } else {
+ dest->cAxes = haptic->naxes;
+ }
if (dest->cAxes > 0) {
axes = SDL_malloc(sizeof(DWORD) * dest->cAxes);
if (axes == NULL) {
--
Gitblit v1.9.3