src/joystick/windows/SDL_mmjoystick.c
author Sam Lantinga
Fri, 08 Apr 2011 13:03:26 -0700
changeset 5535 96594ac5fd1a
parent 5262 b530ef003506
child 6138 4c64952a58fb
permissions -rw-r--r--
SDL 1.3 is now under the zlib license.
slouken@0
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@5535
     3
  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
slouken@0
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@0
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@0
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@0
    20
*/
slouken@1402
    21
#include "SDL_config.h"
slouken@0
    22
slouken@1635
    23
#ifdef SDL_JOYSTICK_WINMM
slouken@1635
    24
slouken@0
    25
/* Win32 MultiMedia Joystick driver, contributed by Andrei de A. Formiga */
slouken@0
    26
slouken@5090
    27
#include "../../core/windows/SDL_windows.h"
slouken@1358
    28
#include <mmsystem.h>
slouken@1358
    29
#include <regstr.h>
slouken@1358
    30
slouken@1330
    31
#include "SDL_events.h"
slouken@0
    32
#include "SDL_joystick.h"
slouken@1361
    33
#include "../SDL_sysjoystick.h"
slouken@1361
    34
#include "../SDL_joystick_c.h"
slouken@0
    35
slouken@531
    36
#define MAX_JOYSTICKS	16
slouken@1895
    37
#define MAX_AXES	6       /* each joystick can have up to 6 axes */
slouken@1895
    38
#define MAX_BUTTONS	32      /* and 32 buttons                      */
slouken@0
    39
#define AXIS_MIN	-32768  /* minimum value for axis coordinate */
slouken@0
    40
#define AXIS_MAX	32767   /* maximum value for axis coordinate */
slouken@834
    41
/* limit axis to 256 possible positions to filter out noise */
slouken@834
    42
#define JOY_AXIS_THRESHOLD      (((AXIS_MAX)-(AXIS_MIN))/256)
slouken@0
    43
#define JOY_BUTTON_FLAG(n)	(1<<n)
slouken@0
    44
slouken@0
    45
slouken@0
    46
/* array to hold joystick ID values */
slouken@1895
    47
static UINT SYS_JoystickID[MAX_JOYSTICKS];
slouken@1895
    48
static JOYCAPS SYS_Joystick[MAX_JOYSTICKS];
slouken@1895
    49
static char *SYS_JoystickName[MAX_JOYSTICKS];
slouken@0
    50
slouken@0
    51
/* The private structure used to keep track of a joystick */
slouken@0
    52
struct joystick_hwdata
slouken@0
    53
{
slouken@1895
    54
    /* joystick ID */
slouken@1895
    55
    UINT id;
slouken@0
    56
slouken@1895
    57
    /* values used to translate device-specific coordinates into
slouken@1895
    58
       SDL-standard ranges */
slouken@1895
    59
    struct _transaxis
slouken@1895
    60
    {
slouken@1895
    61
        int offset;
slouken@1895
    62
        float scale;
slouken@1895
    63
    } transaxis[6];
slouken@0
    64
};
slouken@0
    65
slouken@5062
    66
/* Convert a Windows Multimedia API return code to a text message */
slouken@0
    67
static void SetMMerror(char *function, int code);
slouken@0
    68
slouken@0
    69
slouken@1895
    70
static char *
slouken@1895
    71
GetJoystickName(int index, const char *szRegKey)
slouken@937
    72
{
slouken@1895
    73
    /* added 7/24/2004 by Eckhard Stolberg */
slouken@1895
    74
    /*
slouken@1895
    75
       see if there is a joystick for the current
slouken@1895
    76
       index (1-16) listed in the registry
slouken@1895
    77
     */
slouken@1895
    78
    char *name = NULL;
slouken@2176
    79
    HKEY hTopKey;
slouken@1895
    80
    HKEY hKey;
slouken@1895
    81
    DWORD regsize;
slouken@1895
    82
    LONG regresult;
slouken@2176
    83
    char regkey[256];
slouken@2176
    84
    char regvalue[256];
slouken@2176
    85
    char regname[256];
slouken@2176
    86
slouken@2176
    87
    SDL_snprintf(regkey, SDL_arraysize(regkey), "%s\\%s\\%s",
slouken@2176
    88
                 REGSTR_PATH_JOYCONFIG, szRegKey, REGSTR_KEY_JOYCURR);
slouken@2176
    89
    hTopKey = HKEY_LOCAL_MACHINE;
slouken@2176
    90
    regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
slouken@2176
    91
    if (regresult != ERROR_SUCCESS) {
slouken@2176
    92
        hTopKey = HKEY_CURRENT_USER;
slouken@2176
    93
        regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
slouken@2176
    94
    }
slouken@2176
    95
    if (regresult != ERROR_SUCCESS) {
slouken@2176
    96
        return NULL;
slouken@2176
    97
    }
slouken@937
    98
slouken@2176
    99
    /* find the registry key name for the joystick's properties */
slouken@2176
   100
    regsize = sizeof(regname);
slouken@2176
   101
    SDL_snprintf(regvalue, SDL_arraysize(regvalue), "Joystick%d%s", index + 1,
slouken@2176
   102
                 REGSTR_VAL_JOYOEMNAME);
slouken@2176
   103
    regresult =
slouken@2176
   104
        RegQueryValueExA(hKey, regvalue, 0, 0, (LPBYTE) regname, &regsize);
slouken@2176
   105
    RegCloseKey(hKey);
slouken@2176
   106
slouken@2176
   107
    if (regresult != ERROR_SUCCESS) {
slouken@2176
   108
        return NULL;
slouken@2176
   109
    }
slouken@2176
   110
slouken@2176
   111
    /* open that registry key */
slouken@2176
   112
    SDL_snprintf(regkey, SDL_arraysize(regkey), "%s\\%s", REGSTR_PATH_JOYOEM,
slouken@2176
   113
                 regname);
slouken@2176
   114
    regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
slouken@2176
   115
    if (regresult != ERROR_SUCCESS) {
slouken@2176
   116
        return NULL;
slouken@2176
   117
    }
slouken@2176
   118
slouken@2176
   119
    /* find the size for the OEM name text */
slouken@2176
   120
    regsize = sizeof(regvalue);
slouken@2176
   121
    regresult =
slouken@2176
   122
        RegQueryValueExA(hKey, REGSTR_VAL_JOYOEMNAME, 0, 0, NULL, &regsize);
slouken@1895
   123
    if (regresult == ERROR_SUCCESS) {
slouken@2176
   124
        /* allocate enough memory for the OEM name text ... */
slouken@2176
   125
        name = (char *) SDL_malloc(regsize);
slouken@2176
   126
        if (name) {
slouken@2176
   127
            /* ... and read it from the registry */
slouken@2176
   128
            regresult = RegQueryValueExA(hKey,
slouken@1895
   129
                                         REGSTR_VAL_JOYOEMNAME, 0, 0,
slouken@2176
   130
                                         (LPBYTE) name, &regsize);
slouken@1895
   131
        }
slouken@1895
   132
    }
slouken@2176
   133
    RegCloseKey(hKey);
slouken@2176
   134
slouken@1895
   135
    return (name);
slouken@937
   136
}
slouken@937
   137
slouken@0
   138
/* Function to scan the system for joysticks.
slouken@0
   139
 * This function should set SDL_numjoysticks to the number of available
slouken@0
   140
 * joysticks.  Joystick 0 should be the system default joystick.
slouken@0
   141
 * It should return 0, or -1 on an unrecoverable fatal error.
slouken@0
   142
 */
slouken@1895
   143
int
slouken@1895
   144
SDL_SYS_JoystickInit(void)
slouken@0
   145
{
slouken@1895
   146
    int i;
slouken@1895
   147
    int maxdevs;
slouken@1895
   148
    int numdevs;
slouken@1895
   149
    JOYINFOEX joyinfo;
slouken@1895
   150
    JOYCAPS joycaps;
slouken@1895
   151
    MMRESULT result;
slouken@0
   152
slouken@1895
   153
    /* Reset the joystick ID & name mapping tables */
slouken@1895
   154
    for (i = 0; i < MAX_JOYSTICKS; ++i) {
slouken@1895
   155
        SYS_JoystickID[i] = 0;
slouken@1895
   156
        SYS_JoystickName[i] = NULL;
slouken@1895
   157
    }
slouken@531
   158
slouken@1895
   159
    /* Loop over all potential joystick devices */
slouken@1895
   160
    numdevs = 0;
slouken@1895
   161
    maxdevs = joyGetNumDevs();
slouken@1895
   162
    for (i = JOYSTICKID1; i < maxdevs && numdevs < MAX_JOYSTICKS; ++i) {
slouken@1895
   163
slouken@1895
   164
        joyinfo.dwSize = sizeof(joyinfo);
slouken@1895
   165
        joyinfo.dwFlags = JOY_RETURNALL;
icculus@2061
   166
        result = joyGetPosEx(i, &joyinfo);
slouken@1895
   167
        if (result == JOYERR_NOERROR) {
slouken@1895
   168
            result = joyGetDevCaps(i, &joycaps, sizeof(joycaps));
slouken@1895
   169
            if (result == JOYERR_NOERROR) {
slouken@1895
   170
                SYS_JoystickID[numdevs] = i;
slouken@1895
   171
                SYS_Joystick[numdevs] = joycaps;
slouken@1895
   172
                SYS_JoystickName[numdevs] =
slouken@1895
   173
                    GetJoystickName(i, joycaps.szRegKey);
slouken@1895
   174
                numdevs++;
slouken@1895
   175
            }
slouken@1895
   176
        }
slouken@1895
   177
    }
slouken@1895
   178
    return (numdevs);
slouken@0
   179
}
slouken@0
   180
slouken@0
   181
/* Function to get the device-dependent name of a joystick */
slouken@1895
   182
const char *
slouken@1895
   183
SDL_SYS_JoystickName(int index)
slouken@0
   184
{
slouken@1895
   185
    if (SYS_JoystickName[index] != NULL) {
slouken@1895
   186
        return (SYS_JoystickName[index]);
slouken@1895
   187
    } else {
slouken@1895
   188
        return (SYS_Joystick[index].szPname);
slouken@1895
   189
    }
slouken@0
   190
}
slouken@0
   191
slouken@0
   192
/* Function to open a joystick for use.
slouken@0
   193
   The joystick to open is specified by the index field of the joystick.
slouken@0
   194
   This should fill the nbuttons and naxes fields of the joystick structure.
slouken@0
   195
   It returns 0, or -1 if there is an error.
slouken@0
   196
 */
slouken@1895
   197
int
slouken@1895
   198
SDL_SYS_JoystickOpen(SDL_Joystick * joystick)
slouken@0
   199
{
slouken@1895
   200
    int index, i;
slouken@1895
   201
    int caps_flags[MAX_AXES - 2] =
slouken@1895
   202
        { JOYCAPS_HASZ, JOYCAPS_HASR, JOYCAPS_HASU, JOYCAPS_HASV };
slouken@1895
   203
    int axis_min[MAX_AXES], axis_max[MAX_AXES];
slouken@0
   204
slouken@0
   205
slouken@1895
   206
    /* shortcut */
slouken@1895
   207
    index = joystick->index;
slouken@1895
   208
    axis_min[0] = SYS_Joystick[index].wXmin;
slouken@1895
   209
    axis_max[0] = SYS_Joystick[index].wXmax;
slouken@1895
   210
    axis_min[1] = SYS_Joystick[index].wYmin;
slouken@1895
   211
    axis_max[1] = SYS_Joystick[index].wYmax;
slouken@1895
   212
    axis_min[2] = SYS_Joystick[index].wZmin;
slouken@1895
   213
    axis_max[2] = SYS_Joystick[index].wZmax;
slouken@1895
   214
    axis_min[3] = SYS_Joystick[index].wRmin;
slouken@1895
   215
    axis_max[3] = SYS_Joystick[index].wRmax;
slouken@1895
   216
    axis_min[4] = SYS_Joystick[index].wUmin;
slouken@1895
   217
    axis_max[4] = SYS_Joystick[index].wUmax;
slouken@1895
   218
    axis_min[5] = SYS_Joystick[index].wVmin;
slouken@1895
   219
    axis_max[5] = SYS_Joystick[index].wVmax;
slouken@0
   220
slouken@1895
   221
    /* allocate memory for system specific hardware data */
slouken@1895
   222
    joystick->hwdata =
slouken@1895
   223
        (struct joystick_hwdata *) SDL_malloc(sizeof(*joystick->hwdata));
slouken@1895
   224
    if (joystick->hwdata == NULL) {
slouken@1895
   225
        SDL_OutOfMemory();
slouken@1895
   226
        return (-1);
slouken@1895
   227
    }
slouken@1895
   228
    SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
slouken@0
   229
slouken@1895
   230
    /* set hardware data */
slouken@1895
   231
    joystick->hwdata->id = SYS_JoystickID[index];
slouken@1895
   232
    for (i = 0; i < MAX_AXES; ++i) {
slouken@1895
   233
        if ((i < 2) || (SYS_Joystick[index].wCaps & caps_flags[i - 2])) {
slouken@1895
   234
            joystick->hwdata->transaxis[i].offset = AXIS_MIN - axis_min[i];
slouken@1895
   235
            joystick->hwdata->transaxis[i].scale =
slouken@1895
   236
                (float) (AXIS_MAX - AXIS_MIN) / (axis_max[i] - axis_min[i]);
slouken@1895
   237
        } else {
slouken@1895
   238
            joystick->hwdata->transaxis[i].offset = 0;
slouken@1895
   239
            joystick->hwdata->transaxis[i].scale = 1.0; /* Just in case */
slouken@1895
   240
        }
slouken@1895
   241
    }
slouken@1895
   242
slouken@1895
   243
    /* fill nbuttons, naxes, and nhats fields */
slouken@1895
   244
    joystick->nbuttons = SYS_Joystick[index].wNumButtons;
slouken@1895
   245
    joystick->naxes = SYS_Joystick[index].wNumAxes;
slouken@1895
   246
    if (SYS_Joystick[index].wCaps & JOYCAPS_HASPOV) {
slouken@1895
   247
        joystick->nhats = 1;
slouken@1895
   248
    } else {
slouken@1895
   249
        joystick->nhats = 0;
slouken@1895
   250
    }
slouken@1895
   251
    return (0);
slouken@0
   252
}
slouken@0
   253
slouken@1895
   254
static Uint8
slouken@1895
   255
TranslatePOV(DWORD value)
slouken@0
   256
{
slouken@1895
   257
    Uint8 pos;
slouken@0
   258
slouken@1895
   259
    pos = SDL_HAT_CENTERED;
slouken@1895
   260
    if (value != JOY_POVCENTERED) {
slouken@1895
   261
        if ((value > JOY_POVLEFT) || (value < JOY_POVRIGHT)) {
slouken@1895
   262
            pos |= SDL_HAT_UP;
slouken@1895
   263
        }
slouken@1895
   264
        if ((value > JOY_POVFORWARD) && (value < JOY_POVBACKWARD)) {
slouken@1895
   265
            pos |= SDL_HAT_RIGHT;
slouken@1895
   266
        }
slouken@1895
   267
        if ((value > JOY_POVRIGHT) && (value < JOY_POVLEFT)) {
slouken@1895
   268
            pos |= SDL_HAT_DOWN;
slouken@1895
   269
        }
slouken@1895
   270
        if (value > JOY_POVBACKWARD) {
slouken@1895
   271
            pos |= SDL_HAT_LEFT;
slouken@1895
   272
        }
slouken@1895
   273
    }
slouken@1895
   274
    return (pos);
slouken@0
   275
}
slouken@0
   276
slouken@0
   277
/* Function to update the state of a joystick - called as a device poll.
slouken@0
   278
 * This function shouldn't update the joystick structure directly,
slouken@0
   279
 * but instead should call SDL_PrivateJoystick*() to deliver events
slouken@0
   280
 * and update joystick device state.
slouken@0
   281
 */
slouken@1895
   282
void
slouken@1895
   283
SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
slouken@0
   284
{
slouken@1895
   285
    MMRESULT result;
slouken@1895
   286
    int i;
slouken@1895
   287
    DWORD flags[MAX_AXES] = { JOY_RETURNX, JOY_RETURNY, JOY_RETURNZ,
slouken@1895
   288
        JOY_RETURNR, JOY_RETURNU, JOY_RETURNV
slouken@1895
   289
    };
slouken@1895
   290
    DWORD pos[MAX_AXES];
slouken@1895
   291
    struct _transaxis *transaxis;
slouken@1895
   292
    int value, change;
slouken@1895
   293
    JOYINFOEX joyinfo;
slouken@0
   294
slouken@1895
   295
    joyinfo.dwSize = sizeof(joyinfo);
slouken@1895
   296
    joyinfo.dwFlags = JOY_RETURNALL | JOY_RETURNPOVCTS;
slouken@1895
   297
    if (!joystick->hats) {
slouken@1895
   298
        joyinfo.dwFlags &= ~(JOY_RETURNPOV | JOY_RETURNPOVCTS);
slouken@1895
   299
    }
slouken@1895
   300
    result = joyGetPosEx(joystick->hwdata->id, &joyinfo);
slouken@1895
   301
    if (result != JOYERR_NOERROR) {
slouken@1895
   302
        SetMMerror("joyGetPosEx", result);
slouken@1895
   303
        return;
slouken@1895
   304
    }
slouken@0
   305
slouken@1895
   306
    /* joystick motion events */
slouken@1895
   307
    pos[0] = joyinfo.dwXpos;
slouken@1895
   308
    pos[1] = joyinfo.dwYpos;
slouken@1895
   309
    pos[2] = joyinfo.dwZpos;
slouken@1895
   310
    pos[3] = joyinfo.dwRpos;
slouken@1895
   311
    pos[4] = joyinfo.dwUpos;
slouken@1895
   312
    pos[5] = joyinfo.dwVpos;
slouken@0
   313
slouken@1895
   314
    transaxis = joystick->hwdata->transaxis;
slouken@1895
   315
    for (i = 0; i < joystick->naxes; i++) {
slouken@1895
   316
        if (joyinfo.dwFlags & flags[i]) {
slouken@1895
   317
            value =
slouken@1895
   318
                (int) (((float) pos[i] +
slouken@1895
   319
                        transaxis[i].offset) * transaxis[i].scale);
slouken@1895
   320
            change = (value - joystick->axes[i]);
slouken@1895
   321
            if ((change < -JOY_AXIS_THRESHOLD)
slouken@1895
   322
                || (change > JOY_AXIS_THRESHOLD)) {
slouken@1895
   323
                SDL_PrivateJoystickAxis(joystick, (Uint8) i, (Sint16) value);
slouken@1895
   324
            }
slouken@1895
   325
        }
slouken@1895
   326
    }
slouken@0
   327
slouken@1895
   328
    /* joystick button events */
slouken@1895
   329
    if (joyinfo.dwFlags & JOY_RETURNBUTTONS) {
slouken@1895
   330
        for (i = 0; i < joystick->nbuttons; ++i) {
slouken@1895
   331
            if (joyinfo.dwButtons & JOY_BUTTON_FLAG(i)) {
slouken@1895
   332
                if (!joystick->buttons[i]) {
slouken@1895
   333
                    SDL_PrivateJoystickButton(joystick, (Uint8) i,
slouken@1895
   334
                                              SDL_PRESSED);
slouken@1895
   335
                }
slouken@1895
   336
            } else {
slouken@1895
   337
                if (joystick->buttons[i]) {
slouken@1895
   338
                    SDL_PrivateJoystickButton(joystick, (Uint8) i,
slouken@1895
   339
                                              SDL_RELEASED);
slouken@1895
   340
                }
slouken@1895
   341
            }
slouken@1895
   342
        }
slouken@1895
   343
    }
slouken@0
   344
slouken@1895
   345
    /* joystick hat events */
slouken@1895
   346
    if (joyinfo.dwFlags & JOY_RETURNPOV) {
slouken@1895
   347
        Uint8 pos;
slouken@0
   348
slouken@1895
   349
        pos = TranslatePOV(joyinfo.dwPOV);
slouken@1895
   350
        if (pos != joystick->hats[0]) {
slouken@1895
   351
            SDL_PrivateJoystickHat(joystick, 0, pos);
slouken@1895
   352
        }
slouken@1895
   353
    }
slouken@0
   354
}
slouken@0
   355
slouken@0
   356
/* Function to close a joystick after use */
slouken@1895
   357
void
slouken@1895
   358
SDL_SYS_JoystickClose(SDL_Joystick * joystick)
slouken@0
   359
{
slouken@1895
   360
    if (joystick->hwdata != NULL) {
slouken@1895
   361
        /* free system specific hardware data */
slouken@1895
   362
        SDL_free(joystick->hwdata);
icculus@3610
   363
        joystick->hwdata = NULL;
slouken@1895
   364
    }
slouken@0
   365
}
slouken@0
   366
slouken@0
   367
/* Function to perform any system-specific joystick related cleanup */
slouken@1895
   368
void
slouken@1895
   369
SDL_SYS_JoystickQuit(void)
slouken@0
   370
{
slouken@1895
   371
    int i;
slouken@1895
   372
    for (i = 0; i < MAX_JOYSTICKS; i++) {
slouken@1895
   373
        if (SYS_JoystickName[i] != NULL) {
slouken@1895
   374
            SDL_free(SYS_JoystickName[i]);
icculus@3610
   375
            SYS_JoystickName[i] = NULL;
slouken@1895
   376
        }
slouken@1895
   377
    }
slouken@0
   378
}
slouken@0
   379
slouken@0
   380
slouken@0
   381
/* implementation functions */
slouken@1895
   382
void
slouken@1895
   383
SetMMerror(char *function, int code)
slouken@0
   384
{
slouken@1895
   385
    static char *error;
slouken@1895
   386
    static char errbuf[1024];
slouken@0
   387
slouken@1895
   388
    errbuf[0] = 0;
slouken@1895
   389
    switch (code) {
slouken@1895
   390
    case MMSYSERR_NODRIVER:
slouken@1895
   391
        error = "Joystick driver not present";
slouken@1895
   392
        break;
slouken@1895
   393
slouken@1895
   394
    case MMSYSERR_INVALPARAM:
slouken@1895
   395
    case JOYERR_PARMS:
slouken@1895
   396
        error = "Invalid parameter(s)";
slouken@1895
   397
        break;
slouken@1895
   398
slouken@1895
   399
    case MMSYSERR_BADDEVICEID:
slouken@1895
   400
        error = "Bad device ID";
slouken@1895
   401
        break;
slouken@0
   402
slouken@1895
   403
    case JOYERR_UNPLUGGED:
slouken@1895
   404
        error = "Joystick not attached";
slouken@1895
   405
        break;
slouken@0
   406
slouken@1895
   407
    case JOYERR_NOCANDO:
slouken@1895
   408
        error = "Can't capture joystick input";
slouken@1895
   409
        break;
slouken@0
   410
slouken@1895
   411
    default:
slouken@1895
   412
        SDL_snprintf(errbuf, SDL_arraysize(errbuf),
slouken@1895
   413
                     "%s: Unknown Multimedia system error: 0x%x",
slouken@1895
   414
                     function, code);
slouken@1895
   415
        break;
slouken@1895
   416
    }
slouken@0
   417
slouken@1895
   418
    if (!errbuf[0]) {
slouken@1895
   419
        SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function,
slouken@1895
   420
                     error);
slouken@1895
   421
    }
slouken@1895
   422
    SDL_SetError("%s", errbuf);
slouken@0
   423
}
slouken@1635
   424
slouken@1635
   425
#endif /* SDL_JOYSTICK_WINMM */
slouken@1895
   426
/* vi: set ts=4 sw=4 expandtab: */