21 #include "../../SDL_internal.h"
23 #if SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT
31 #include "../SDL_syshaptic.h"
33 #include "../../joystick/SDL_sysjoystick.h"
34 #include "../../joystick/windows/SDL_windowsjoystick_c.h"
35 #include "../../joystick/windows/SDL_xinputjoystick_c.h"
47 static int numhaptics = 0;
68 if (SDL_hapticlist_tail ==
NULL) {
69 SDL_hapticlist = SDL_hapticlist_tail = item;
71 SDL_hapticlist_tail->
next = item;
72 SDL_hapticlist_tail = item;
89 SDL_hapticlist = item->
next;
91 if (item == SDL_hapticlist_tail) {
92 SDL_hapticlist_tail = prev;
107 HapticByDevIndex(
int device_index)
111 if ((device_index < 0) || (device_index >= numhaptics)) {
115 while (device_index > 0) {
154 #if SDL_HAPTIC_DINPUT
159 for (item = SDL_hapticlist; item !=
NULL; item = item->
next) {
160 if (item->capabilities.dwDevType == DI8DEVCLASS_POINTER) {
176 if (joystick->driver != &SDL_WINDOWS_JoystickDriver) {
179 #if SDL_HAPTIC_XINPUT
180 if (joystick->hwdata->bXInputHaptic) {
184 #if SDL_HAPTIC_DINPUT
185 if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) {
198 if (joystick->driver != &SDL_WINDOWS_JoystickDriver) {
201 if (joystick->hwdata->bXInputHaptic != haptic->hwdata->bXInputHaptic) {
203 }
else if (joystick->hwdata->bXInputHaptic) {
216 SDL_assert(joystick->driver == &SDL_WINDOWS_JoystickDriver);
218 if (joystick->hwdata->bXInputDevice) {
231 if (haptic->hwdata) {
235 haptic->effects =
NULL;
236 haptic->neffects = 0;
239 if (haptic->hwdata->bXInputHaptic) {
247 haptic->hwdata =
NULL;
259 SDL_Haptic *hapticitem =
NULL;
262 for (hapticitem = SDL_haptics; hapticitem; hapticitem = hapticitem->next) {
263 if ((hapticitem->hwdata->bXInputHaptic) && (hapticitem->hwdata->thread)) {
267 hapticitem->hwdata->thread =
NULL;
271 for (item = SDL_hapticlist; item; item =
next) {
284 SDL_hapticlist =
NULL;
285 SDL_hapticlist_tail =
NULL;
306 if (haptic->hwdata->bXInputHaptic) {
326 if (haptic->hwdata->bXInputHaptic) {
340 if (haptic->hwdata->bXInputHaptic) {
353 if (haptic->hwdata->bXInputHaptic) {
366 if (haptic->hwdata->bXInputHaptic) {
382 if (haptic->hwdata->bXInputHaptic) {
395 if (haptic->hwdata->bXInputHaptic) {
408 if (haptic->hwdata->bXInputHaptic) {
421 if (haptic->hwdata->bXInputHaptic) {
434 if (haptic->hwdata->bXInputHaptic) {
447 if (haptic->hwdata->bXInputHaptic) {