src/joystick/win32/SDL_mmjoystick.c
author Sam Lantinga
Thu, 12 Jul 2007 05:31:08 +0000
changeset 2176 cbe06fa842cd
parent 2061 6051761b5934
child 2859 99210400e8b9
permissions -rw-r--r--
Fixed joystick name detection - merged from revision 3226 on SDL 1.2 branch
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@1312
     3
    Copyright (C) 1997-2006 Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1312
    13
    Lesser General Public License for more details.
slouken@0
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@252
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@1402
    22
#include "SDL_config.h"
slouken@0
    23
slouken@1635
    24
#ifdef SDL_JOYSTICK_WINMM
slouken@1635
    25
slouken@0
    26
/* Win32 MultiMedia Joystick driver, contributed by Andrei de A. Formiga */
slouken@0
    27
slouken@1433
    28
#define WIN32_LEAN_AND_MEAN
slouken@1433
    29
#include <windows.h>
slouken@1358
    30
#include <mmsystem.h>
slouken@1358
    31
#include <regstr.h>
slouken@1358
    32
slouken@1330
    33
#include "SDL_events.h"
slouken@0
    34
#include "SDL_joystick.h"
slouken@1361
    35
#include "../SDL_sysjoystick.h"
slouken@1361
    36
#include "../SDL_joystick_c.h"
slouken@0
    37
slouken@531
    38
#define MAX_JOYSTICKS	16
slouken@1895
    39
#define MAX_AXES	6       /* each joystick can have up to 6 axes */
slouken@1895
    40
#define MAX_BUTTONS	32      /* and 32 buttons                      */
slouken@0
    41
#define AXIS_MIN	-32768  /* minimum value for axis coordinate */
slouken@0
    42
#define AXIS_MAX	32767   /* maximum value for axis coordinate */
slouken@834
    43
/* limit axis to 256 possible positions to filter out noise */
slouken@834
    44
#define JOY_AXIS_THRESHOLD      (((AXIS_MAX)-(AXIS_MIN))/256)
slouken@0
    45
#define JOY_BUTTON_FLAG(n)	(1<<n)
slouken@0
    46
slouken@0
    47
slouken@0
    48
/* array to hold joystick ID values */
slouken@1895
    49
static UINT SYS_JoystickID[MAX_JOYSTICKS];
slouken@1895
    50
static JOYCAPS SYS_Joystick[MAX_JOYSTICKS];
slouken@1895
    51
static char *SYS_JoystickName[MAX_JOYSTICKS];
slouken@0
    52
slouken@0
    53
/* The private structure used to keep track of a joystick */
slouken@0
    54
struct joystick_hwdata
slouken@0
    55
{
slouken@1895
    56
    /* joystick ID */
slouken@1895
    57
    UINT id;
slouken@0
    58
slouken@1895
    59
    /* values used to translate device-specific coordinates into
slouken@1895
    60
       SDL-standard ranges */
slouken@1895
    61
    struct _transaxis
slouken@1895
    62
    {
slouken@1895
    63
        int offset;
slouken@1895
    64
        float scale;
slouken@1895
    65
    } transaxis[6];
slouken@0
    66
};
slouken@0
    67
slouken@0
    68
/* Convert a win32 Multimedia API return code to a text message */
slouken@0
    69
static void SetMMerror(char *function, int code);
slouken@0
    70
slouken@0
    71
slouken@1895
    72
static char *
slouken@1895
    73
GetJoystickName(int index, const char *szRegKey)
slouken@937
    74
{
slouken@1895
    75
    /* added 7/24/2004 by Eckhard Stolberg */
slouken@1895
    76
    /*
slouken@1895
    77
       see if there is a joystick for the current
slouken@1895
    78
       index (1-16) listed in the registry
slouken@1895
    79
     */
slouken@1895
    80
    char *name = NULL;
slouken@2176
    81
    HKEY hTopKey;
slouken@1895
    82
    HKEY hKey;
slouken@1895
    83
    DWORD regsize;
slouken@1895
    84
    LONG regresult;
slouken@2176
    85
    char regkey[256];
slouken@2176
    86
    char regvalue[256];
slouken@2176
    87
    char regname[256];
slouken@2176
    88
slouken@2176
    89
    SDL_snprintf(regkey, SDL_arraysize(regkey), "%s\\%s\\%s",
slouken@2176
    90
                 REGSTR_PATH_JOYCONFIG, szRegKey, REGSTR_KEY_JOYCURR);
slouken@2176
    91
    hTopKey = HKEY_LOCAL_MACHINE;
slouken@2176
    92
    regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
slouken@2176
    93
    if (regresult != ERROR_SUCCESS) {
slouken@2176
    94
        hTopKey = HKEY_CURRENT_USER;
slouken@2176
    95
        regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
slouken@2176
    96
    }
slouken@2176
    97
    if (regresult != ERROR_SUCCESS) {
slouken@2176
    98
        return NULL;
slouken@2176
    99
    }
slouken@937
   100
slouken@2176
   101
    /* find the registry key name for the joystick's properties */
slouken@2176
   102
    regsize = sizeof(regname);
slouken@2176
   103
    SDL_snprintf(regvalue, SDL_arraysize(regvalue), "Joystick%d%s", index + 1,
slouken@2176
   104
                 REGSTR_VAL_JOYOEMNAME);
slouken@2176
   105
    regresult =
slouken@2176
   106
        RegQueryValueExA(hKey, regvalue, 0, 0, (LPBYTE) regname, &regsize);
slouken@2176
   107
    RegCloseKey(hKey);
slouken@2176
   108
slouken@2176
   109
    if (regresult != ERROR_SUCCESS) {
slouken@2176
   110
        return NULL;
slouken@2176
   111
    }
slouken@2176
   112
slouken@2176
   113
    /* open that registry key */
slouken@2176
   114
    SDL_snprintf(regkey, SDL_arraysize(regkey), "%s\\%s", REGSTR_PATH_JOYOEM,
slouken@2176
   115
                 regname);
slouken@2176
   116
    regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
slouken@2176
   117
    if (regresult != ERROR_SUCCESS) {
slouken@2176
   118
        return NULL;
slouken@2176
   119
    }
slouken@2176
   120
slouken@2176
   121
    /* find the size for the OEM name text */
slouken@2176
   122
    regsize = sizeof(regvalue);
slouken@2176
   123
    regresult =
slouken@2176
   124
        RegQueryValueExA(hKey, REGSTR_VAL_JOYOEMNAME, 0, 0, NULL, &regsize);
slouken@1895
   125
    if (regresult == ERROR_SUCCESS) {
slouken@2176
   126
        /* allocate enough memory for the OEM name text ... */
slouken@2176
   127
        name = (char *) SDL_malloc(regsize);
slouken@2176
   128
        if (name) {
slouken@2176
   129
            /* ... and read it from the registry */
slouken@2176
   130
            regresult = RegQueryValueExA(hKey,
slouken@1895
   131
                                         REGSTR_VAL_JOYOEMNAME, 0, 0,
slouken@2176
   132
                                         (LPBYTE) name, &regsize);
slouken@1895
   133
        }
slouken@1895
   134
    }
slouken@2176
   135
    RegCloseKey(hKey);
slouken@2176
   136
slouken@1895
   137
    return (name);
slouken@937
   138
}
slouken@937
   139
slouken@0
   140
/* Function to scan the system for joysticks.
slouken@0
   141
 * This function should set SDL_numjoysticks to the number of available
slouken@0
   142
 * joysticks.  Joystick 0 should be the system default joystick.
slouken@0
   143
 * It should return 0, or -1 on an unrecoverable fatal error.
slouken@0
   144
 */
slouken@1895
   145
int
slouken@1895
   146
SDL_SYS_JoystickInit(void)
slouken@0
   147
{
slouken@1895
   148
    int i;
slouken@1895
   149
    int maxdevs;
slouken@1895
   150
    int numdevs;
slouken@1895
   151
    JOYINFOEX joyinfo;
slouken@1895
   152
    JOYCAPS joycaps;
slouken@1895
   153
    MMRESULT result;
slouken@0
   154
slouken@1895
   155
    /* Reset the joystick ID & name mapping tables */
slouken@1895
   156
    for (i = 0; i < MAX_JOYSTICKS; ++i) {
slouken@1895
   157
        SYS_JoystickID[i] = 0;
slouken@1895
   158
        SYS_JoystickName[i] = NULL;
slouken@1895
   159
    }
slouken@531
   160
slouken@1895
   161
    /* Loop over all potential joystick devices */
slouken@1895
   162
    numdevs = 0;
slouken@1895
   163
    maxdevs = joyGetNumDevs();
slouken@1895
   164
    for (i = JOYSTICKID1; i < maxdevs && numdevs < MAX_JOYSTICKS; ++i) {
slouken@1895
   165
slouken@1895
   166
        joyinfo.dwSize = sizeof(joyinfo);
slouken@1895
   167
        joyinfo.dwFlags = JOY_RETURNALL;
icculus@2061
   168
        result = joyGetPosEx(i, &joyinfo);
slouken@1895
   169
        if (result == JOYERR_NOERROR) {
slouken@1895
   170
            result = joyGetDevCaps(i, &joycaps, sizeof(joycaps));
slouken@1895
   171
            if (result == JOYERR_NOERROR) {
slouken@1895
   172
                SYS_JoystickID[numdevs] = i;
slouken@1895
   173
                SYS_Joystick[numdevs] = joycaps;
slouken@1895
   174
                SYS_JoystickName[numdevs] =
slouken@1895
   175
                    GetJoystickName(i, joycaps.szRegKey);
slouken@1895
   176
                numdevs++;
slouken@1895
   177
            }
slouken@1895
   178
        }
slouken@1895
   179
    }
slouken@1895
   180
    return (numdevs);
slouken@0
   181
}
slouken@0
   182
slouken@0
   183
/* Function to get the device-dependent name of a joystick */
slouken@1895
   184
const char *
slouken@1895
   185
SDL_SYS_JoystickName(int index)
slouken@0
   186
{
slouken@1895
   187
    if (SYS_JoystickName[index] != NULL) {
slouken@1895
   188
        return (SYS_JoystickName[index]);
slouken@1895
   189
    } else {
slouken@1895
   190
        return (SYS_Joystick[index].szPname);
slouken@1895
   191
    }
slouken@0
   192
}
slouken@0
   193
slouken@0
   194
/* Function to open a joystick for use.
slouken@0
   195
   The joystick to open is specified by the index field of the joystick.
slouken@0
   196
   This should fill the nbuttons and naxes fields of the joystick structure.
slouken@0
   197
   It returns 0, or -1 if there is an error.
slouken@0
   198
 */
slouken@1895
   199
int
slouken@1895
   200
SDL_SYS_JoystickOpen(SDL_Joystick * joystick)
slouken@0
   201
{
slouken@1895
   202
    int index, i;
slouken@1895
   203
    int caps_flags[MAX_AXES - 2] =
slouken@1895
   204
        { JOYCAPS_HASZ, JOYCAPS_HASR, JOYCAPS_HASU, JOYCAPS_HASV };
slouken@1895
   205
    int axis_min[MAX_AXES], axis_max[MAX_AXES];
slouken@0
   206
slouken@0
   207
slouken@1895
   208
    /* shortcut */
slouken@1895
   209
    index = joystick->index;
slouken@1895
   210
    axis_min[0] = SYS_Joystick[index].wXmin;
slouken@1895
   211
    axis_max[0] = SYS_Joystick[index].wXmax;
slouken@1895
   212
    axis_min[1] = SYS_Joystick[index].wYmin;
slouken@1895
   213
    axis_max[1] = SYS_Joystick[index].wYmax;
slouken@1895
   214
    axis_min[2] = SYS_Joystick[index].wZmin;
slouken@1895
   215
    axis_max[2] = SYS_Joystick[index].wZmax;
slouken@1895
   216
    axis_min[3] = SYS_Joystick[index].wRmin;
slouken@1895
   217
    axis_max[3] = SYS_Joystick[index].wRmax;
slouken@1895
   218
    axis_min[4] = SYS_Joystick[index].wUmin;
slouken@1895
   219
    axis_max[4] = SYS_Joystick[index].wUmax;
slouken@1895
   220
    axis_min[5] = SYS_Joystick[index].wVmin;
slouken@1895
   221
    axis_max[5] = SYS_Joystick[index].wVmax;
slouken@0
   222
slouken@1895
   223
    /* allocate memory for system specific hardware data */
slouken@1895
   224
    joystick->hwdata =
slouken@1895
   225
        (struct joystick_hwdata *) SDL_malloc(sizeof(*joystick->hwdata));
slouken@1895
   226
    if (joystick->hwdata == NULL) {
slouken@1895
   227
        SDL_OutOfMemory();
slouken@1895
   228
        return (-1);
slouken@1895
   229
    }
slouken@1895
   230
    SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
slouken@0
   231
slouken@1895
   232
    /* set hardware data */
slouken@1895
   233
    joystick->hwdata->id = SYS_JoystickID[index];
slouken@1895
   234
    for (i = 0; i < MAX_AXES; ++i) {
slouken@1895
   235
        if ((i < 2) || (SYS_Joystick[index].wCaps & caps_flags[i - 2])) {
slouken@1895
   236
            joystick->hwdata->transaxis[i].offset = AXIS_MIN - axis_min[i];
slouken@1895
   237
            joystick->hwdata->transaxis[i].scale =
slouken@1895
   238
                (float) (AXIS_MAX - AXIS_MIN) / (axis_max[i] - axis_min[i]);
slouken@1895
   239
        } else {
slouken@1895
   240
            joystick->hwdata->transaxis[i].offset = 0;
slouken@1895
   241
            joystick->hwdata->transaxis[i].scale = 1.0; /* Just in case */
slouken@1895
   242
        }
slouken@1895
   243
    }
slouken@1895
   244
slouken@1895
   245
    /* fill nbuttons, naxes, and nhats fields */
slouken@1895
   246
    joystick->nbuttons = SYS_Joystick[index].wNumButtons;
slouken@1895
   247
    joystick->naxes = SYS_Joystick[index].wNumAxes;
slouken@1895
   248
    if (SYS_Joystick[index].wCaps & JOYCAPS_HASPOV) {
slouken@1895
   249
        joystick->nhats = 1;
slouken@1895
   250
    } else {
slouken@1895
   251
        joystick->nhats = 0;
slouken@1895
   252
    }
slouken@1895
   253
    return (0);
slouken@0
   254
}
slouken@0
   255
slouken@1895
   256
static Uint8
slouken@1895
   257
TranslatePOV(DWORD value)
slouken@0
   258
{
slouken@1895
   259
    Uint8 pos;
slouken@0
   260
slouken@1895
   261
    pos = SDL_HAT_CENTERED;
slouken@1895
   262
    if (value != JOY_POVCENTERED) {
slouken@1895
   263
        if ((value > JOY_POVLEFT) || (value < JOY_POVRIGHT)) {
slouken@1895
   264
            pos |= SDL_HAT_UP;
slouken@1895
   265
        }
slouken@1895
   266
        if ((value > JOY_POVFORWARD) && (value < JOY_POVBACKWARD)) {
slouken@1895
   267
            pos |= SDL_HAT_RIGHT;
slouken@1895
   268
        }
slouken@1895
   269
        if ((value > JOY_POVRIGHT) && (value < JOY_POVLEFT)) {
slouken@1895
   270
            pos |= SDL_HAT_DOWN;
slouken@1895
   271
        }
slouken@1895
   272
        if (value > JOY_POVBACKWARD) {
slouken@1895
   273
            pos |= SDL_HAT_LEFT;
slouken@1895
   274
        }
slouken@1895
   275
    }
slouken@1895
   276
    return (pos);
slouken@0
   277
}
slouken@0
   278
slouken@0
   279
/* Function to update the state of a joystick - called as a device poll.
slouken@0
   280
 * This function shouldn't update the joystick structure directly,
slouken@0
   281
 * but instead should call SDL_PrivateJoystick*() to deliver events
slouken@0
   282
 * and update joystick device state.
slouken@0
   283
 */
slouken@1895
   284
void
slouken@1895
   285
SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
slouken@0
   286
{
slouken@1895
   287
    MMRESULT result;
slouken@1895
   288
    int i;
slouken@1895
   289
    DWORD flags[MAX_AXES] = { JOY_RETURNX, JOY_RETURNY, JOY_RETURNZ,
slouken@1895
   290
        JOY_RETURNR, JOY_RETURNU, JOY_RETURNV
slouken@1895
   291
    };
slouken@1895
   292
    DWORD pos[MAX_AXES];
slouken@1895
   293
    struct _transaxis *transaxis;
slouken@1895
   294
    int value, change;
slouken@1895
   295
    JOYINFOEX joyinfo;
slouken@0
   296
slouken@1895
   297
    joyinfo.dwSize = sizeof(joyinfo);
slouken@1895
   298
    joyinfo.dwFlags = JOY_RETURNALL | JOY_RETURNPOVCTS;
slouken@1895
   299
    if (!joystick->hats) {
slouken@1895
   300
        joyinfo.dwFlags &= ~(JOY_RETURNPOV | JOY_RETURNPOVCTS);
slouken@1895
   301
    }
slouken@1895
   302
    result = joyGetPosEx(joystick->hwdata->id, &joyinfo);
slouken@1895
   303
    if (result != JOYERR_NOERROR) {
slouken@1895
   304
        SetMMerror("joyGetPosEx", result);
slouken@1895
   305
        return;
slouken@1895
   306
    }
slouken@0
   307
slouken@1895
   308
    /* joystick motion events */
slouken@1895
   309
    pos[0] = joyinfo.dwXpos;
slouken@1895
   310
    pos[1] = joyinfo.dwYpos;
slouken@1895
   311
    pos[2] = joyinfo.dwZpos;
slouken@1895
   312
    pos[3] = joyinfo.dwRpos;
slouken@1895
   313
    pos[4] = joyinfo.dwUpos;
slouken@1895
   314
    pos[5] = joyinfo.dwVpos;
slouken@0
   315
slouken@1895
   316
    transaxis = joystick->hwdata->transaxis;
slouken@1895
   317
    for (i = 0; i < joystick->naxes; i++) {
slouken@1895
   318
        if (joyinfo.dwFlags & flags[i]) {
slouken@1895
   319
            value =
slouken@1895
   320
                (int) (((float) pos[i] +
slouken@1895
   321
                        transaxis[i].offset) * transaxis[i].scale);
slouken@1895
   322
            change = (value - joystick->axes[i]);
slouken@1895
   323
            if ((change < -JOY_AXIS_THRESHOLD)
slouken@1895
   324
                || (change > JOY_AXIS_THRESHOLD)) {
slouken@1895
   325
                SDL_PrivateJoystickAxis(joystick, (Uint8) i, (Sint16) value);
slouken@1895
   326
            }
slouken@1895
   327
        }
slouken@1895
   328
    }
slouken@0
   329
slouken@1895
   330
    /* joystick button events */
slouken@1895
   331
    if (joyinfo.dwFlags & JOY_RETURNBUTTONS) {
slouken@1895
   332
        for (i = 0; i < joystick->nbuttons; ++i) {
slouken@1895
   333
            if (joyinfo.dwButtons & JOY_BUTTON_FLAG(i)) {
slouken@1895
   334
                if (!joystick->buttons[i]) {
slouken@1895
   335
                    SDL_PrivateJoystickButton(joystick, (Uint8) i,
slouken@1895
   336
                                              SDL_PRESSED);
slouken@1895
   337
                }
slouken@1895
   338
            } else {
slouken@1895
   339
                if (joystick->buttons[i]) {
slouken@1895
   340
                    SDL_PrivateJoystickButton(joystick, (Uint8) i,
slouken@1895
   341
                                              SDL_RELEASED);
slouken@1895
   342
                }
slouken@1895
   343
            }
slouken@1895
   344
        }
slouken@1895
   345
    }
slouken@0
   346
slouken@1895
   347
    /* joystick hat events */
slouken@1895
   348
    if (joyinfo.dwFlags & JOY_RETURNPOV) {
slouken@1895
   349
        Uint8 pos;
slouken@0
   350
slouken@1895
   351
        pos = TranslatePOV(joyinfo.dwPOV);
slouken@1895
   352
        if (pos != joystick->hats[0]) {
slouken@1895
   353
            SDL_PrivateJoystickHat(joystick, 0, pos);
slouken@1895
   354
        }
slouken@1895
   355
    }
slouken@0
   356
}
slouken@0
   357
slouken@0
   358
/* Function to close a joystick after use */
slouken@1895
   359
void
slouken@1895
   360
SDL_SYS_JoystickClose(SDL_Joystick * joystick)
slouken@0
   361
{
slouken@1895
   362
    if (joystick->hwdata != NULL) {
slouken@1895
   363
        /* free system specific hardware data */
slouken@1895
   364
        SDL_free(joystick->hwdata);
slouken@1895
   365
    }
slouken@0
   366
}
slouken@0
   367
slouken@0
   368
/* Function to perform any system-specific joystick related cleanup */
slouken@1895
   369
void
slouken@1895
   370
SDL_SYS_JoystickQuit(void)
slouken@0
   371
{
slouken@1895
   372
    int i;
slouken@1895
   373
    for (i = 0; i < MAX_JOYSTICKS; i++) {
slouken@1895
   374
        if (SYS_JoystickName[i] != NULL) {
slouken@1895
   375
            SDL_free(SYS_JoystickName[i]);
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: */