src/haptic/windows/SDL_xinputhaptic.c
author Sam Lantinga <slouken@libsdl.org>
Sun, 01 Jan 2017 18:33:28 -0800
changeset 10737 3406a0f8b041
parent 10499 363c1c7e7a41
child 11110 db5c09aa4fd4
permissions -rw-r--r--
Updated copyright for 2017
slouken@8972
     1
/*
slouken@8972
     2
  Simple DirectMedia Layer
slouken@10737
     3
  Copyright (C) 1997-2017 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"
icculus@10147
    36
#include "../../thread/SDL_systhread.h"
slouken@8972
    37
slouken@8972
    38
/*
slouken@8972
    39
 * Internal stuff.
slouken@8972
    40
 */
slouken@8972
    41
static SDL_bool loaded_xinput = SDL_FALSE;
slouken@8972
    42
slouken@8972
    43
slouken@8972
    44
int
slouken@8972
    45
SDL_XINPUT_HapticInit(void)
slouken@8972
    46
{
slouken@10499
    47
    if (SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, SDL_TRUE)) {
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
icculus@10003
   149
    while (!SDL_AtomicGet(&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);
icculus@10146
   208
    haptic->hwdata->thread = SDL_CreateThreadInternal(SDL_RunXInputHaptic, threadName, 64 * 1024, haptic->hwdata);
slouken@8972
   209
slouken@8972
   210
    if (haptic->hwdata->thread == NULL) {
slouken@8972
   211
        SDL_DestroyMutex(haptic->hwdata->mutex);
slouken@8972
   212
        SDL_free(haptic->effects);
slouken@8972
   213
        SDL_free(haptic->hwdata);
slouken@8972
   214
        haptic->effects = NULL;
slouken@8972
   215
        return SDL_SetError("Couldn't create XInput haptic thread");
slouken@8972
   216
    }
slouken@8972
   217
slouken@8972
   218
    return 0;
slouken@8972
   219
}
slouken@8972
   220
slouken@8972
   221
int
slouken@8972
   222
SDL_XINPUT_HapticOpen(SDL_Haptic * haptic, SDL_hapticlist_item *item)
slouken@8972
   223
{
slouken@8972
   224
    return SDL_XINPUT_HapticOpenFromUserIndex(haptic, item->userid);
slouken@8972
   225
}
slouken@8972
   226
slouken@8972
   227
int
slouken@8972
   228
SDL_XINPUT_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
slouken@8972
   229
{
slouken@8972
   230
    return (haptic->hwdata->userid == joystick->hwdata->userid);
slouken@8972
   231
}
slouken@8972
   232
slouken@8972
   233
int
slouken@8972
   234
SDL_XINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
slouken@8972
   235
{
slouken@8972
   236
    SDL_hapticlist_item *item;
slouken@8972
   237
    int index = 0;
slouken@8972
   238
slouken@8972
   239
    /* Since it comes from a joystick we have to try to match it with a haptic device on our haptic list. */
slouken@8972
   240
    for (item = SDL_hapticlist; item != NULL; item = item->next) {
slouken@8972
   241
        if (item->bXInputHaptic && item->userid == joystick->hwdata->userid) {
slouken@8972
   242
            haptic->index = index;
slouken@8972
   243
            return SDL_XINPUT_HapticOpenFromUserIndex(haptic, joystick->hwdata->userid);
slouken@8972
   244
        }
slouken@8972
   245
        ++index;
slouken@8972
   246
    }
slouken@8972
   247
slouken@8972
   248
    SDL_SetError("Couldn't find joystick in haptic device list");
slouken@8972
   249
    return -1;
slouken@8972
   250
}
slouken@8972
   251
slouken@8972
   252
void
slouken@8972
   253
SDL_XINPUT_HapticClose(SDL_Haptic * haptic)
slouken@8972
   254
{
icculus@10003
   255
    SDL_AtomicSet(&haptic->hwdata->stopThread, 1);
slouken@8972
   256
    SDL_WaitThread(haptic->hwdata->thread, NULL);
slouken@8972
   257
    SDL_DestroyMutex(haptic->hwdata->mutex);
slouken@8972
   258
}
slouken@8972
   259
slouken@8972
   260
void
slouken@8972
   261
SDL_XINPUT_HapticQuit(void)
slouken@8972
   262
{
slouken@8972
   263
    if (loaded_xinput) {
slouken@8972
   264
        WIN_UnloadXInputDLL();
slouken@8972
   265
        loaded_xinput = SDL_FALSE;
slouken@8972
   266
    }
slouken@8972
   267
}
slouken@8972
   268
slouken@8972
   269
int
slouken@8972
   270
SDL_XINPUT_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * base)
slouken@8972
   271
{
slouken@8972
   272
    SDL_assert(base->type == SDL_HAPTIC_LEFTRIGHT);  /* should catch this at higher level */
slouken@8972
   273
    return SDL_XINPUT_HapticUpdateEffect(haptic, effect, base);
slouken@8972
   274
}
slouken@8972
   275
slouken@8972
   276
int
slouken@8972
   277
SDL_XINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * data)
slouken@8972
   278
{
slouken@8972
   279
    XINPUT_VIBRATION *vib = &effect->hweffect->vibration;
slouken@8972
   280
    SDL_assert(data->type == SDL_HAPTIC_LEFTRIGHT);
slouken@8972
   281
    vib->wLeftMotorSpeed = data->leftright.large_magnitude;
slouken@8972
   282
    vib->wRightMotorSpeed = data->leftright.small_magnitude;
slouken@8972
   283
    SDL_LockMutex(haptic->hwdata->mutex);
slouken@8972
   284
    if (haptic->hwdata->stopTicks) {  /* running right now? Update it. */
slouken@8972
   285
        XINPUTSETSTATE(haptic->hwdata->userid, vib);
slouken@8972
   286
    }
slouken@8972
   287
    SDL_UnlockMutex(haptic->hwdata->mutex);
slouken@8972
   288
    return 0;
slouken@8972
   289
}
slouken@8972
   290
slouken@8972
   291
int
slouken@8972
   292
SDL_XINPUT_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, Uint32 iterations)
slouken@8972
   293
{
slouken@8972
   294
    XINPUT_VIBRATION *vib = &effect->hweffect->vibration;
slouken@8972
   295
    SDL_assert(effect->effect.type == SDL_HAPTIC_LEFTRIGHT);  /* should catch this at higher level */
slouken@8972
   296
    SDL_LockMutex(haptic->hwdata->mutex);
slouken@8972
   297
    if (effect->effect.leftright.length == SDL_HAPTIC_INFINITY || iterations == SDL_HAPTIC_INFINITY) {
slouken@8972
   298
        haptic->hwdata->stopTicks = SDL_HAPTIC_INFINITY;
slouken@8972
   299
    } else if ((!effect->effect.leftright.length) || (!iterations)) {
slouken@8972
   300
        /* do nothing. Effect runs for zero milliseconds. */
slouken@8972
   301
    } else {
slouken@8972
   302
        haptic->hwdata->stopTicks = SDL_GetTicks() + (effect->effect.leftright.length * iterations);
slouken@8972
   303
        if ((haptic->hwdata->stopTicks == SDL_HAPTIC_INFINITY) || (haptic->hwdata->stopTicks == 0)) {
slouken@8972
   304
            haptic->hwdata->stopTicks = 1;  /* fix edge cases. */
slouken@8972
   305
        }
slouken@8972
   306
    }
slouken@8972
   307
    SDL_UnlockMutex(haptic->hwdata->mutex);
slouken@8972
   308
    return (XINPUTSETSTATE(haptic->hwdata->userid, vib) == ERROR_SUCCESS) ? 0 : -1;
slouken@8972
   309
}
slouken@8972
   310
slouken@8972
   311
int
slouken@8972
   312
SDL_XINPUT_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
slouken@8972
   313
{
slouken@8972
   314
    XINPUT_VIBRATION vibration = { 0, 0 };
slouken@8972
   315
    SDL_LockMutex(haptic->hwdata->mutex);
slouken@8972
   316
    haptic->hwdata->stopTicks = 0;
slouken@8972
   317
    SDL_UnlockMutex(haptic->hwdata->mutex);
slouken@8972
   318
    return (XINPUTSETSTATE(haptic->hwdata->userid, &vibration) == ERROR_SUCCESS) ? 0 : -1;
slouken@8972
   319
}
slouken@8972
   320
slouken@8972
   321
void
slouken@8972
   322
SDL_XINPUT_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
slouken@8972
   323
{
slouken@8972
   324
    SDL_XINPUT_HapticStopEffect(haptic, effect);
slouken@8972
   325
}
slouken@8972
   326
slouken@8972
   327
int
slouken@8972
   328
SDL_XINPUT_HapticGetEffectStatus(SDL_Haptic * haptic, struct haptic_effect *effect)
slouken@8972
   329
{
slouken@8972
   330
    return SDL_Unsupported();
slouken@8972
   331
}
slouken@8972
   332
slouken@8972
   333
int
slouken@8972
   334
SDL_XINPUT_HapticSetGain(SDL_Haptic * haptic, int gain)
slouken@8972
   335
{
slouken@8972
   336
    return SDL_Unsupported();
slouken@8972
   337
}
slouken@8972
   338
slouken@8972
   339
int
slouken@8972
   340
SDL_XINPUT_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
slouken@8972
   341
{
slouken@8972
   342
    return SDL_Unsupported();
slouken@8972
   343
}
slouken@8972
   344
slouken@8972
   345
int
slouken@8972
   346
SDL_XINPUT_HapticPause(SDL_Haptic * haptic)
slouken@8972
   347
{
slouken@8972
   348
    return SDL_Unsupported();
slouken@8972
   349
}
slouken@8972
   350
slouken@8972
   351
int
slouken@8972
   352
SDL_XINPUT_HapticUnpause(SDL_Haptic * haptic)
slouken@8972
   353
{
slouken@8972
   354
    return SDL_Unsupported();
slouken@8972
   355
}
slouken@8972
   356
slouken@8972
   357
int
slouken@8972
   358
SDL_XINPUT_HapticStopAll(SDL_Haptic * haptic)
slouken@8972
   359
{
slouken@8972
   360
    XINPUT_VIBRATION vibration = { 0, 0 };
slouken@8972
   361
    SDL_LockMutex(haptic->hwdata->mutex);
slouken@8972
   362
    haptic->hwdata->stopTicks = 0;
slouken@8972
   363
    SDL_UnlockMutex(haptic->hwdata->mutex);
slouken@8972
   364
    return (XINPUTSETSTATE(haptic->hwdata->userid, &vibration) == ERROR_SUCCESS) ? 0 : -1;
slouken@8972
   365
}
slouken@8972
   366
slouken@8972
   367
#else /* !SDL_HAPTIC_XINPUT */
slouken@8972
   368
icculus@9714
   369
#include "../../core/windows/SDL_windows.h"
icculus@9714
   370
icculus@9663
   371
typedef struct SDL_hapticlist_item SDL_hapticlist_item;
slouken@8972
   372
slouken@8972
   373
int
slouken@8972
   374
SDL_XINPUT_HapticInit(void)
slouken@8972
   375
{
slouken@8972
   376
    return 0;
slouken@8972
   377
}
slouken@8972
   378
slouken@8972
   379
int
slouken@8972
   380
SDL_XINPUT_MaybeAddDevice(const DWORD dwUserid)
slouken@8972
   381
{
slouken@8972
   382
    return SDL_Unsupported();
slouken@8972
   383
}
slouken@8972
   384
slouken@8972
   385
int
slouken@8972
   386
SDL_XINPUT_MaybeRemoveDevice(const DWORD dwUserid)
slouken@8972
   387
{
slouken@8972
   388
    return SDL_Unsupported();
slouken@8972
   389
}
slouken@8972
   390
slouken@8972
   391
int
slouken@8972
   392
SDL_XINPUT_HapticOpen(SDL_Haptic * haptic, SDL_hapticlist_item *item)
slouken@8972
   393
{
slouken@8972
   394
    return SDL_Unsupported();
slouken@8972
   395
}
slouken@8972
   396
slouken@8972
   397
int
slouken@8972
   398
SDL_XINPUT_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
slouken@8972
   399
{
slouken@8972
   400
    return SDL_Unsupported();
slouken@8972
   401
}
slouken@8972
   402
slouken@8972
   403
int
slouken@8972
   404
SDL_XINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
slouken@8972
   405
{
slouken@8972
   406
    return SDL_Unsupported();
slouken@8972
   407
}
slouken@8972
   408
slouken@8972
   409
void
slouken@8972
   410
SDL_XINPUT_HapticClose(SDL_Haptic * haptic)
slouken@8972
   411
{
slouken@8972
   412
}
slouken@8972
   413
slouken@8972
   414
void
slouken@8972
   415
SDL_XINPUT_HapticQuit(void)
slouken@8972
   416
{
slouken@8972
   417
}
slouken@8972
   418
slouken@8972
   419
int
slouken@8972
   420
SDL_XINPUT_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * base)
slouken@8972
   421
{
slouken@8972
   422
    return SDL_Unsupported();
slouken@8972
   423
}
slouken@8972
   424
slouken@8972
   425
int
slouken@8972
   426
SDL_XINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * data)
slouken@8972
   427
{
slouken@8972
   428
    return SDL_Unsupported();
slouken@8972
   429
}
slouken@8972
   430
slouken@8972
   431
int
slouken@8972
   432
SDL_XINPUT_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, Uint32 iterations)
slouken@8972
   433
{
slouken@8972
   434
    return SDL_Unsupported();
slouken@8972
   435
}
slouken@8972
   436
slouken@8972
   437
int
slouken@8972
   438
SDL_XINPUT_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
slouken@8972
   439
{
slouken@8972
   440
    return SDL_Unsupported();
slouken@8972
   441
}
slouken@8972
   442
slouken@8972
   443
void
slouken@8972
   444
SDL_XINPUT_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
slouken@8972
   445
{
slouken@8972
   446
}
slouken@8972
   447
slouken@8972
   448
int
slouken@8972
   449
SDL_XINPUT_HapticGetEffectStatus(SDL_Haptic * haptic, struct haptic_effect *effect)
slouken@8972
   450
{
slouken@8972
   451
    return SDL_Unsupported();
slouken@8972
   452
}
slouken@8972
   453
slouken@8972
   454
int
slouken@8972
   455
SDL_XINPUT_HapticSetGain(SDL_Haptic * haptic, int gain)
slouken@8972
   456
{
slouken@8972
   457
    return SDL_Unsupported();
slouken@8972
   458
}
slouken@8972
   459
slouken@8972
   460
int
slouken@8972
   461
SDL_XINPUT_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
slouken@8972
   462
{
slouken@8972
   463
    return SDL_Unsupported();
slouken@8972
   464
}
slouken@8972
   465
slouken@8972
   466
int
slouken@8972
   467
SDL_XINPUT_HapticPause(SDL_Haptic * haptic)
slouken@8972
   468
{
slouken@8972
   469
    return SDL_Unsupported();
slouken@8972
   470
}
slouken@8972
   471
slouken@8972
   472
int
slouken@8972
   473
SDL_XINPUT_HapticUnpause(SDL_Haptic * haptic)
slouken@8972
   474
{
slouken@8972
   475
    return SDL_Unsupported();
slouken@8972
   476
}
slouken@8972
   477
slouken@8972
   478
int
slouken@8972
   479
SDL_XINPUT_HapticStopAll(SDL_Haptic * haptic)
slouken@8972
   480
{
slouken@8972
   481
    return SDL_Unsupported();
slouken@8972
   482
}
slouken@8972
   483
slouken@8972
   484
#endif /* SDL_HAPTIC_XINPUT */
icculus@9658
   485
slouken@8972
   486
/* vi: set ts=4 sw=4 expandtab: */