src/haptic/windows/SDL_xinputhaptic.c
author Ryan C. Gordon
Tue, 29 Dec 2015 01:09:58 -0500
changeset 9983 bbe9ef8c2ecb
parent 9714 e501460cb4c4
child 9998 f67cf37e9cd4
permissions -rw-r--r--
Mac: don't ignore mouse clicks on the top pixel of a window (thanks, Joshua!).

Fixes Bugzilla #3190.
slouken@8972
     1
/*
slouken@8972
     2
  Simple DirectMedia Layer
slouken@9619
     3
  Copyright (C) 1997-2015 Sam Lantinga <slouken@libsdl.org>
slouken@8972
     4
slouken@8972
     5
  This software is provided 'as-is', without any express or implied
slouken@8972
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@8972
     7
  arising from the use of this software.
slouken@8972
     8
slouken@8972
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@8972
    10
  including commercial applications, and to alter it and redistribute it
slouken@8972
    11
  freely, subject to the following restrictions:
slouken@8972
    12
slouken@8972
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@8972
    14
     claim that you wrote the original software. If you use this software
slouken@8972
    15
     in a product, an acknowledgment in the product documentation would be
slouken@8972
    16
     appreciated but is not required.
slouken@8972
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@8972
    18
     misrepresented as being the original software.
slouken@8972
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@8972
    20
*/
slouken@8972
    21
#include "../../SDL_internal.h"
slouken@8972
    22
icculus@9661
    23
#include "SDL_error.h"
icculus@9661
    24
#include "SDL_haptic.h"
icculus@9662
    25
#include "../SDL_syshaptic.h"
icculus@9661
    26
icculus@9658
    27
#if SDL_HAPTIC_XINPUT
icculus@9658
    28
slouken@8972
    29
#include "SDL_assert.h"
slouken@8972
    30
#include "SDL_hints.h"
slouken@8972
    31
#include "SDL_timer.h"
slouken@8972
    32
#include "SDL_windowshaptic_c.h"
slouken@8972
    33
#include "SDL_xinputhaptic_c.h"
slouken@8972
    34
#include "../../core/windows/SDL_xinput.h"
slouken@8972
    35
#include "../../joystick/windows/SDL_windowsjoystick_c.h"
slouken@8972
    36
slouken@8972
    37
/*
slouken@8972
    38
 * Internal stuff.
slouken@8972
    39
 */
slouken@8972
    40
static SDL_bool loaded_xinput = SDL_FALSE;
slouken@8972
    41
slouken@8972
    42
slouken@8972
    43
int
slouken@8972
    44
SDL_XINPUT_HapticInit(void)
slouken@8972
    45
{
slouken@8972
    46
    const char *env = SDL_GetHint(SDL_HINT_XINPUT_ENABLED);
slouken@8972
    47
    if (!env || SDL_atoi(env)) {
slouken@8972
    48
        loaded_xinput = (WIN_LoadXInputDLL() == 0);
slouken@8972
    49
    }
slouken@8972
    50
slouken@8972
    51
    if (loaded_xinput) {
slouken@8972
    52
        DWORD i;
slouken@8972
    53
        for (i = 0; i < XUSER_MAX_COUNT; i++) {
slouken@8972
    54
            SDL_XINPUT_MaybeAddDevice(i);
slouken@8972
    55
        }
slouken@8972
    56
    }
slouken@8972
    57
    return 0;
slouken@8972
    58
}
slouken@8972
    59
slouken@8972
    60
int
slouken@8972
    61
SDL_XINPUT_MaybeAddDevice(const DWORD dwUserid)
slouken@8972
    62
{
slouken@8972
    63
    const Uint8 userid = (Uint8)dwUserid;
slouken@8972
    64
    SDL_hapticlist_item *item;
slouken@8972
    65
    XINPUT_VIBRATION state;
slouken@8972
    66
slouken@8972
    67
    if ((!loaded_xinput) || (dwUserid >= XUSER_MAX_COUNT)) {
slouken@8972
    68
        return -1;
slouken@8972
    69
    }
slouken@8972
    70
slouken@8972
    71
    /* Make sure we don't already have it */
slouken@8972
    72
    for (item = SDL_hapticlist; item; item = item->next) {
slouken@8972
    73
        if (item->bXInputHaptic && item->userid == userid) {
slouken@8972
    74
            return -1;  /* Already added */
slouken@8972
    75
        }
slouken@8972
    76
    }
slouken@8972
    77
slouken@8972
    78
    SDL_zero(state);
slouken@8972
    79
    if (XINPUTSETSTATE(dwUserid, &state) != ERROR_SUCCESS) {
slouken@8972
    80
        return -1;  /* no force feedback on this device. */
slouken@8972
    81
    }
slouken@8972
    82
slouken@8972
    83
    item = (SDL_hapticlist_item *)SDL_malloc(sizeof(SDL_hapticlist_item));
slouken@8972
    84
    if (item == NULL) {
slouken@8972
    85
        return SDL_OutOfMemory();
slouken@8972
    86
    }
slouken@8972
    87
slouken@8972
    88
    SDL_zerop(item);
slouken@8972
    89
slouken@8972
    90
    /* !!! FIXME: I'm not bothering to query for a real name right now (can we even?) */
slouken@8972
    91
    {
slouken@8972
    92
        char buf[64];
slouken@8972
    93
        SDL_snprintf(buf, sizeof(buf), "XInput Controller #%u", (unsigned int)(userid + 1));
slouken@8972
    94
        item->name = SDL_strdup(buf);
slouken@8972
    95
    }
slouken@8972
    96
slouken@8972
    97
    if (!item->name) {
slouken@8972
    98
        SDL_free(item);
slouken@8972
    99
        return -1;
slouken@8972
   100
    }
slouken@8972
   101
slouken@8972
   102
    /* Copy the instance over, useful for creating devices. */
slouken@8972
   103
    item->bXInputHaptic = SDL_TRUE;
slouken@8972
   104
    item->userid = userid;
slouken@8972
   105
slouken@8972
   106
    return SDL_SYS_AddHapticDevice(item);
slouken@8972
   107
}
slouken@8972
   108
slouken@8972
   109
int
slouken@8972
   110
SDL_XINPUT_MaybeRemoveDevice(const DWORD dwUserid)
slouken@8972
   111
{
slouken@8972
   112
    const Uint8 userid = (Uint8)dwUserid;
slouken@8972
   113
    SDL_hapticlist_item *item;
slouken@8972
   114
    SDL_hapticlist_item *prev = NULL;
slouken@8972
   115
slouken@8972
   116
    if ((!loaded_xinput) || (dwUserid >= XUSER_MAX_COUNT)) {
slouken@8972
   117
        return -1;
slouken@8972
   118
    }
slouken@8972
   119
slouken@8972
   120
    for (item = SDL_hapticlist; item != NULL; item = item->next) {
slouken@8972
   121
        if (item->bXInputHaptic && item->userid == userid) {
slouken@8972
   122
            /* found it, remove it. */
slouken@8972
   123
            return SDL_SYS_RemoveHapticDevice(prev, item);
slouken@8972
   124
        }
slouken@8972
   125
        prev = item;
slouken@8972
   126
    }
slouken@8972
   127
    return -1;
slouken@8972
   128
}
slouken@8972
   129
slouken@8972
   130
/* !!! FIXME: this is a hack, remove this later. */
slouken@8972
   131
/* Since XInput doesn't offer a way to vibrate for X time, we hook into
slouken@8972
   132
 *  SDL_PumpEvents() to check if it's time to stop vibrating with some
slouken@8972
   133
 *  frequency.
slouken@8972
   134
 * In practice, this works for 99% of use cases. But in an ideal world,
slouken@8972
   135
 *  we do this in a separate thread so that:
slouken@8972
   136
 *    - we aren't bound to when the app chooses to pump the event queue.
slouken@8972
   137
 *    - we aren't adding more polling to the event queue
slouken@8972
   138
 *    - we can emulate all the haptic effects correctly (start on a delay,
slouken@8972
   139
 *      mix multiple effects, etc).
slouken@8972
   140
 *
slouken@8972
   141
 * Mostly, this is here to get rumbling to work, and all the other features
slouken@8972
   142
 *  are absent in the XInput path for now.  :(
slouken@8972
   143
 */
slouken@8972
   144
static int SDLCALL
slouken@8972
   145
SDL_RunXInputHaptic(void *arg)
slouken@8972
   146
{
slouken@8972
   147
    struct haptic_hwdata *hwdata = (struct haptic_hwdata *) arg;
slouken@8972
   148
slouken@8972
   149
    while (!hwdata->stopThread) {
slouken@8972
   150
        SDL_Delay(50);
slouken@8972
   151
        SDL_LockMutex(hwdata->mutex);
slouken@8972
   152
        /* If we're currently running and need to stop... */
slouken@8972
   153
        if (hwdata->stopTicks) {
slouken@8972
   154
            if ((hwdata->stopTicks != SDL_HAPTIC_INFINITY) && SDL_TICKS_PASSED(SDL_GetTicks(), hwdata->stopTicks)) {
slouken@8972
   155
                XINPUT_VIBRATION vibration = { 0, 0 };
slouken@8972
   156
                hwdata->stopTicks = 0;
slouken@8972
   157
                XINPUTSETSTATE(hwdata->userid, &vibration);
slouken@8972
   158
            }
slouken@8972
   159
        }
slouken@8972
   160
        SDL_UnlockMutex(hwdata->mutex);
slouken@8972
   161
    }
slouken@8972
   162
slouken@8972
   163
    return 0;
slouken@8972
   164
}
slouken@8972
   165
slouken@8972
   166
static int
slouken@8972
   167
SDL_XINPUT_HapticOpenFromUserIndex(SDL_Haptic *haptic, const Uint8 userid)
slouken@8972
   168
{
slouken@8972
   169
    char threadName[32];
slouken@8972
   170
    XINPUT_VIBRATION vibration = { 0, 0 };  /* stop any current vibration */
slouken@8972
   171
    XINPUTSETSTATE(userid, &vibration);
slouken@8972
   172
slouken@8972
   173
    haptic->supported = SDL_HAPTIC_LEFTRIGHT;
slouken@8972
   174
slouken@8972
   175
    haptic->neffects = 1;
slouken@8972
   176
    haptic->nplaying = 1;
slouken@8972
   177
slouken@8972
   178
    /* Prepare effects memory. */
slouken@8972
   179
    haptic->effects = (struct haptic_effect *)
slouken@8972
   180
        SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects);
slouken@8972
   181
    if (haptic->effects == NULL) {
slouken@8972
   182
        return SDL_OutOfMemory();
slouken@8972
   183
    }
slouken@8972
   184
    /* Clear the memory */
slouken@8972
   185
    SDL_memset(haptic->effects, 0,
slouken@8972
   186
        sizeof(struct haptic_effect) * haptic->neffects);
slouken@8972
   187
slouken@8972
   188
    haptic->hwdata = (struct haptic_hwdata *) SDL_malloc(sizeof(*haptic->hwdata));
slouken@8972
   189
    if (haptic->hwdata == NULL) {
slouken@8972
   190
        SDL_free(haptic->effects);
slouken@8972
   191
        haptic->effects = NULL;
slouken@8972
   192
        return SDL_OutOfMemory();
slouken@8972
   193
    }
slouken@8972
   194
    SDL_memset(haptic->hwdata, 0, sizeof(*haptic->hwdata));
slouken@8972
   195
slouken@8972
   196
    haptic->hwdata->bXInputHaptic = 1;
slouken@8972
   197
    haptic->hwdata->userid = userid;
slouken@8972
   198
slouken@8972
   199
    haptic->hwdata->mutex = SDL_CreateMutex();
slouken@8972
   200
    if (haptic->hwdata->mutex == NULL) {
slouken@8972
   201
        SDL_free(haptic->effects);
slouken@8972
   202
        SDL_free(haptic->hwdata);
slouken@8972
   203
        haptic->effects = NULL;
slouken@8972
   204
        return SDL_SetError("Couldn't create XInput haptic mutex");
slouken@8972
   205
    }
slouken@8972
   206
slouken@8972
   207
    SDL_snprintf(threadName, sizeof(threadName), "SDLXInputDev%d", (int)userid);
slouken@8972
   208
slouken@8972
   209
#if defined(__WIN32__) && !defined(HAVE_LIBC)  /* !!! FIXME: this is nasty. */
slouken@8972
   210
#undef SDL_CreateThread
slouken@8972
   211
#if SDL_DYNAMIC_API
slouken@8972
   212
    haptic->hwdata->thread = SDL_CreateThread_REAL(SDL_RunXInputHaptic, threadName, haptic->hwdata, NULL, NULL);
slouken@8972
   213
#else
slouken@8972
   214
    haptic->hwdata->thread = SDL_CreateThread(SDL_RunXInputHaptic, threadName, haptic->hwdata, NULL, NULL);
slouken@8972
   215
#endif
slouken@8972
   216
#else
slouken@8972
   217
    haptic->hwdata->thread = SDL_CreateThread(SDL_RunXInputHaptic, threadName, haptic->hwdata);
slouken@8972
   218
#endif
slouken@8972
   219
    if (haptic->hwdata->thread == NULL) {
slouken@8972
   220
        SDL_DestroyMutex(haptic->hwdata->mutex);
slouken@8972
   221
        SDL_free(haptic->effects);
slouken@8972
   222
        SDL_free(haptic->hwdata);
slouken@8972
   223
        haptic->effects = NULL;
slouken@8972
   224
        return SDL_SetError("Couldn't create XInput haptic thread");
slouken@8972
   225
    }
slouken@8972
   226
slouken@8972
   227
    return 0;
slouken@8972
   228
}
slouken@8972
   229
slouken@8972
   230
int
slouken@8972
   231
SDL_XINPUT_HapticOpen(SDL_Haptic * haptic, SDL_hapticlist_item *item)
slouken@8972
   232
{
slouken@8972
   233
    return SDL_XINPUT_HapticOpenFromUserIndex(haptic, item->userid);
slouken@8972
   234
}
slouken@8972
   235
slouken@8972
   236
int
slouken@8972
   237
SDL_XINPUT_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
slouken@8972
   238
{
slouken@8972
   239
    return (haptic->hwdata->userid == joystick->hwdata->userid);
slouken@8972
   240
}
slouken@8972
   241
slouken@8972
   242
int
slouken@8972
   243
SDL_XINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
slouken@8972
   244
{
slouken@8972
   245
    SDL_hapticlist_item *item;
slouken@8972
   246
    int index = 0;
slouken@8972
   247
slouken@8972
   248
    /* Since it comes from a joystick we have to try to match it with a haptic device on our haptic list. */
slouken@8972
   249
    for (item = SDL_hapticlist; item != NULL; item = item->next) {
slouken@8972
   250
        if (item->bXInputHaptic && item->userid == joystick->hwdata->userid) {
slouken@8972
   251
            haptic->index = index;
slouken@8972
   252
            return SDL_XINPUT_HapticOpenFromUserIndex(haptic, joystick->hwdata->userid);
slouken@8972
   253
        }
slouken@8972
   254
        ++index;
slouken@8972
   255
    }
slouken@8972
   256
slouken@8972
   257
    SDL_SetError("Couldn't find joystick in haptic device list");
slouken@8972
   258
    return -1;
slouken@8972
   259
}
slouken@8972
   260
slouken@8972
   261
void
slouken@8972
   262
SDL_XINPUT_HapticClose(SDL_Haptic * haptic)
slouken@8972
   263
{
slouken@8972
   264
    haptic->hwdata->stopThread = 1;
slouken@8972
   265
    SDL_WaitThread(haptic->hwdata->thread, NULL);
slouken@8972
   266
    SDL_DestroyMutex(haptic->hwdata->mutex);
slouken@8972
   267
}
slouken@8972
   268
slouken@8972
   269
void
slouken@8972
   270
SDL_XINPUT_HapticQuit(void)
slouken@8972
   271
{
slouken@8972
   272
    if (loaded_xinput) {
slouken@8972
   273
        WIN_UnloadXInputDLL();
slouken@8972
   274
        loaded_xinput = SDL_FALSE;
slouken@8972
   275
    }
slouken@8972
   276
}
slouken@8972
   277
slouken@8972
   278
int
slouken@8972
   279
SDL_XINPUT_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * base)
slouken@8972
   280
{
slouken@8972
   281
    SDL_assert(base->type == SDL_HAPTIC_LEFTRIGHT);  /* should catch this at higher level */
slouken@8972
   282
    return SDL_XINPUT_HapticUpdateEffect(haptic, effect, base);
slouken@8972
   283
}
slouken@8972
   284
slouken@8972
   285
int
slouken@8972
   286
SDL_XINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * data)
slouken@8972
   287
{
slouken@8972
   288
    XINPUT_VIBRATION *vib = &effect->hweffect->vibration;
slouken@8972
   289
    SDL_assert(data->type == SDL_HAPTIC_LEFTRIGHT);
slouken@8972
   290
    vib->wLeftMotorSpeed = data->leftright.large_magnitude;
slouken@8972
   291
    vib->wRightMotorSpeed = data->leftright.small_magnitude;
slouken@8972
   292
    SDL_LockMutex(haptic->hwdata->mutex);
slouken@8972
   293
    if (haptic->hwdata->stopTicks) {  /* running right now? Update it. */
slouken@8972
   294
        XINPUTSETSTATE(haptic->hwdata->userid, vib);
slouken@8972
   295
    }
slouken@8972
   296
    SDL_UnlockMutex(haptic->hwdata->mutex);
slouken@8972
   297
    return 0;
slouken@8972
   298
}
slouken@8972
   299
slouken@8972
   300
int
slouken@8972
   301
SDL_XINPUT_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, Uint32 iterations)
slouken@8972
   302
{
slouken@8972
   303
    XINPUT_VIBRATION *vib = &effect->hweffect->vibration;
slouken@8972
   304
    SDL_assert(effect->effect.type == SDL_HAPTIC_LEFTRIGHT);  /* should catch this at higher level */
slouken@8972
   305
    SDL_LockMutex(haptic->hwdata->mutex);
slouken@8972
   306
    if (effect->effect.leftright.length == SDL_HAPTIC_INFINITY || iterations == SDL_HAPTIC_INFINITY) {
slouken@8972
   307
        haptic->hwdata->stopTicks = SDL_HAPTIC_INFINITY;
slouken@8972
   308
    } else if ((!effect->effect.leftright.length) || (!iterations)) {
slouken@8972
   309
        /* do nothing. Effect runs for zero milliseconds. */
slouken@8972
   310
    } else {
slouken@8972
   311
        haptic->hwdata->stopTicks = SDL_GetTicks() + (effect->effect.leftright.length * iterations);
slouken@8972
   312
        if ((haptic->hwdata->stopTicks == SDL_HAPTIC_INFINITY) || (haptic->hwdata->stopTicks == 0)) {
slouken@8972
   313
            haptic->hwdata->stopTicks = 1;  /* fix edge cases. */
slouken@8972
   314
        }
slouken@8972
   315
    }
slouken@8972
   316
    SDL_UnlockMutex(haptic->hwdata->mutex);
slouken@8972
   317
    return (XINPUTSETSTATE(haptic->hwdata->userid, vib) == ERROR_SUCCESS) ? 0 : -1;
slouken@8972
   318
}
slouken@8972
   319
slouken@8972
   320
int
slouken@8972
   321
SDL_XINPUT_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
slouken@8972
   322
{
slouken@8972
   323
    XINPUT_VIBRATION vibration = { 0, 0 };
slouken@8972
   324
    SDL_LockMutex(haptic->hwdata->mutex);
slouken@8972
   325
    haptic->hwdata->stopTicks = 0;
slouken@8972
   326
    SDL_UnlockMutex(haptic->hwdata->mutex);
slouken@8972
   327
    return (XINPUTSETSTATE(haptic->hwdata->userid, &vibration) == ERROR_SUCCESS) ? 0 : -1;
slouken@8972
   328
}
slouken@8972
   329
slouken@8972
   330
void
slouken@8972
   331
SDL_XINPUT_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
slouken@8972
   332
{
slouken@8972
   333
    SDL_XINPUT_HapticStopEffect(haptic, effect);
slouken@8972
   334
}
slouken@8972
   335
slouken@8972
   336
int
slouken@8972
   337
SDL_XINPUT_HapticGetEffectStatus(SDL_Haptic * haptic, struct haptic_effect *effect)
slouken@8972
   338
{
slouken@8972
   339
    return SDL_Unsupported();
slouken@8972
   340
}
slouken@8972
   341
slouken@8972
   342
int
slouken@8972
   343
SDL_XINPUT_HapticSetGain(SDL_Haptic * haptic, int gain)
slouken@8972
   344
{
slouken@8972
   345
    return SDL_Unsupported();
slouken@8972
   346
}
slouken@8972
   347
slouken@8972
   348
int
slouken@8972
   349
SDL_XINPUT_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
slouken@8972
   350
{
slouken@8972
   351
    return SDL_Unsupported();
slouken@8972
   352
}
slouken@8972
   353
slouken@8972
   354
int
slouken@8972
   355
SDL_XINPUT_HapticPause(SDL_Haptic * haptic)
slouken@8972
   356
{
slouken@8972
   357
    return SDL_Unsupported();
slouken@8972
   358
}
slouken@8972
   359
slouken@8972
   360
int
slouken@8972
   361
SDL_XINPUT_HapticUnpause(SDL_Haptic * haptic)
slouken@8972
   362
{
slouken@8972
   363
    return SDL_Unsupported();
slouken@8972
   364
}
slouken@8972
   365
slouken@8972
   366
int
slouken@8972
   367
SDL_XINPUT_HapticStopAll(SDL_Haptic * haptic)
slouken@8972
   368
{
slouken@8972
   369
    XINPUT_VIBRATION vibration = { 0, 0 };
slouken@8972
   370
    SDL_LockMutex(haptic->hwdata->mutex);
slouken@8972
   371
    haptic->hwdata->stopTicks = 0;
slouken@8972
   372
    SDL_UnlockMutex(haptic->hwdata->mutex);
slouken@8972
   373
    return (XINPUTSETSTATE(haptic->hwdata->userid, &vibration) == ERROR_SUCCESS) ? 0 : -1;
slouken@8972
   374
}
slouken@8972
   375
slouken@8972
   376
#else /* !SDL_HAPTIC_XINPUT */
slouken@8972
   377
icculus@9714
   378
#include "../../core/windows/SDL_windows.h"
icculus@9714
   379
icculus@9663
   380
typedef struct SDL_hapticlist_item SDL_hapticlist_item;
slouken@8972
   381
slouken@8972
   382
int
slouken@8972
   383
SDL_XINPUT_HapticInit(void)
slouken@8972
   384
{
slouken@8972
   385
    return 0;
slouken@8972
   386
}
slouken@8972
   387
slouken@8972
   388
int
slouken@8972
   389
SDL_XINPUT_MaybeAddDevice(const DWORD dwUserid)
slouken@8972
   390
{
slouken@8972
   391
    return SDL_Unsupported();
slouken@8972
   392
}
slouken@8972
   393
slouken@8972
   394
int
slouken@8972
   395
SDL_XINPUT_MaybeRemoveDevice(const DWORD dwUserid)
slouken@8972
   396
{
slouken@8972
   397
    return SDL_Unsupported();
slouken@8972
   398
}
slouken@8972
   399
slouken@8972
   400
int
slouken@8972
   401
SDL_XINPUT_HapticOpen(SDL_Haptic * haptic, SDL_hapticlist_item *item)
slouken@8972
   402
{
slouken@8972
   403
    return SDL_Unsupported();
slouken@8972
   404
}
slouken@8972
   405
slouken@8972
   406
int
slouken@8972
   407
SDL_XINPUT_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
slouken@8972
   408
{
slouken@8972
   409
    return SDL_Unsupported();
slouken@8972
   410
}
slouken@8972
   411
slouken@8972
   412
int
slouken@8972
   413
SDL_XINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
slouken@8972
   414
{
slouken@8972
   415
    return SDL_Unsupported();
slouken@8972
   416
}
slouken@8972
   417
slouken@8972
   418
void
slouken@8972
   419
SDL_XINPUT_HapticClose(SDL_Haptic * haptic)
slouken@8972
   420
{
slouken@8972
   421
}
slouken@8972
   422
slouken@8972
   423
void
slouken@8972
   424
SDL_XINPUT_HapticQuit(void)
slouken@8972
   425
{
slouken@8972
   426
}
slouken@8972
   427
slouken@8972
   428
int
slouken@8972
   429
SDL_XINPUT_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * base)
slouken@8972
   430
{
slouken@8972
   431
    return SDL_Unsupported();
slouken@8972
   432
}
slouken@8972
   433
slouken@8972
   434
int
slouken@8972
   435
SDL_XINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * data)
slouken@8972
   436
{
slouken@8972
   437
    return SDL_Unsupported();
slouken@8972
   438
}
slouken@8972
   439
slouken@8972
   440
int
slouken@8972
   441
SDL_XINPUT_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, Uint32 iterations)
slouken@8972
   442
{
slouken@8972
   443
    return SDL_Unsupported();
slouken@8972
   444
}
slouken@8972
   445
slouken@8972
   446
int
slouken@8972
   447
SDL_XINPUT_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
slouken@8972
   448
{
slouken@8972
   449
    return SDL_Unsupported();
slouken@8972
   450
}
slouken@8972
   451
slouken@8972
   452
void
slouken@8972
   453
SDL_XINPUT_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
slouken@8972
   454
{
slouken@8972
   455
}
slouken@8972
   456
slouken@8972
   457
int
slouken@8972
   458
SDL_XINPUT_HapticGetEffectStatus(SDL_Haptic * haptic, struct haptic_effect *effect)
slouken@8972
   459
{
slouken@8972
   460
    return SDL_Unsupported();
slouken@8972
   461
}
slouken@8972
   462
slouken@8972
   463
int
slouken@8972
   464
SDL_XINPUT_HapticSetGain(SDL_Haptic * haptic, int gain)
slouken@8972
   465
{
slouken@8972
   466
    return SDL_Unsupported();
slouken@8972
   467
}
slouken@8972
   468
slouken@8972
   469
int
slouken@8972
   470
SDL_XINPUT_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
slouken@8972
   471
{
slouken@8972
   472
    return SDL_Unsupported();
slouken@8972
   473
}
slouken@8972
   474
slouken@8972
   475
int
slouken@8972
   476
SDL_XINPUT_HapticPause(SDL_Haptic * haptic)
slouken@8972
   477
{
slouken@8972
   478
    return SDL_Unsupported();
slouken@8972
   479
}
slouken@8972
   480
slouken@8972
   481
int
slouken@8972
   482
SDL_XINPUT_HapticUnpause(SDL_Haptic * haptic)
slouken@8972
   483
{
slouken@8972
   484
    return SDL_Unsupported();
slouken@8972
   485
}
slouken@8972
   486
slouken@8972
   487
int
slouken@8972
   488
SDL_XINPUT_HapticStopAll(SDL_Haptic * haptic)
slouken@8972
   489
{
slouken@8972
   490
    return SDL_Unsupported();
slouken@8972
   491
}
slouken@8972
   492
slouken@8972
   493
#endif /* SDL_HAPTIC_XINPUT */
icculus@9658
   494
slouken@8972
   495
/* vi: set ts=4 sw=4 expandtab: */