early-access version 1617

This commit is contained in:
pineappleEA
2021-04-20 21:40:33 +02:00
parent 242b6f6b49
commit f46563104f
510 changed files with 141726 additions and 62846 deletions

View File

@@ -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 @@ SDL_SYS_HapticMouse(void)
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 @@ SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
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 @@ SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
joystick->hwdata->ffservice)) {
return 1;
}
#endif
return 0;
}
@@ -632,6 +635,7 @@ SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
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 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
}
return SDL_SYS_HapticOpenFromService(haptic, joystick->hwdata->ffservice);
#else
return -1;
#endif
}
@@ -765,6 +772,10 @@ SDL_SYS_SetDirection(FFEFFECT * effect, SDL_HapticDirection * dir, int naxes)
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 @@ SDL_SYS_ToFFEFFECT(SDL_Haptic * haptic, FFEFFECT * dest, SDL_HapticEffect * src)
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) {