Mercurial > sdl-ios-xcode
diff src/joystick/win32/SDL_mmjoystick.c @ 1659:14717b52abc0 SDL-1.3
Merge trunk-1.3-3
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 17 May 2006 08:18:28 +0000 |
parents | 92947e3a18db |
children | 782fd950bd46 c121d94672cb 36f155ec8133 |
line wrap: on
line diff
--- a/src/joystick/win32/SDL_mmjoystick.c Mon May 01 06:58:33 2006 +0000 +++ b/src/joystick/win32/SDL_mmjoystick.c Wed May 17 08:18:28 2006 +0000 @@ -154,34 +154,26 @@ JOYCAPS joycaps; MMRESULT result; - numdevs = 0; - maxdevs = joyGetNumDevs(); - - if ( maxdevs > MAX_JOYSTICKS ) { - maxdevs = MAX_JOYSTICKS; - } - - - for ( i = 0; i < MAX_JOYSTICKS; i++ ) { - SYS_JoystickID[i] = JOYSTICKID1 + i; + /* Reset the joystick ID & name mapping tables */ + for ( i = 0; i < MAX_JOYSTICKS; ++i ) { + SYS_JoystickID[i] = 0; SYS_JoystickName[i] = NULL; } - - for ( i = 0; (i < maxdevs); ++i ) { + /* Loop over all potential joystick devices */ + numdevs = 0; + maxdevs = joyGetNumDevs(); + for ( i = JOYSTICKID1; i < maxdevs && numdevs < MAX_JOYSTICKS; ++i ) { - /* added 8/31/2001 By Vitaliy Mikitchenko */ joyinfo.dwSize = sizeof(joyinfo); joyinfo.dwFlags = JOY_RETURNALL; - /* end addition */ - result = joyGetPosEx(SYS_JoystickID[i], &joyinfo); if ( result == JOYERR_NOERROR ) { - result = joyGetDevCaps(SYS_JoystickID[i], &joycaps, sizeof(joycaps)); + result = joyGetDevCaps(i, &joycaps, sizeof(joycaps)); if ( result == JOYERR_NOERROR ) { - SYS_JoystickID[numdevs] = SYS_JoystickID[i]; + SYS_JoystickID[numdevs] = i; SYS_Joystick[numdevs] = joycaps; - SYS_JoystickName[numdevs] = GetJoystickName(numdevs, joycaps.szRegKey); + SYS_JoystickName[numdevs] = GetJoystickName(i, joycaps.szRegKey); numdevs++; } }