Mercurial > sdl-ios-xcode
comparison 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 |
comparison
equal
deleted
inserted
replaced
1658:e49147870aac | 1659:14717b52abc0 |
---|---|
152 int numdevs; | 152 int numdevs; |
153 JOYINFOEX joyinfo; | 153 JOYINFOEX joyinfo; |
154 JOYCAPS joycaps; | 154 JOYCAPS joycaps; |
155 MMRESULT result; | 155 MMRESULT result; |
156 | 156 |
157 /* Reset the joystick ID & name mapping tables */ | |
158 for ( i = 0; i < MAX_JOYSTICKS; ++i ) { | |
159 SYS_JoystickID[i] = 0; | |
160 SYS_JoystickName[i] = NULL; | |
161 } | |
162 | |
163 /* Loop over all potential joystick devices */ | |
157 numdevs = 0; | 164 numdevs = 0; |
158 maxdevs = joyGetNumDevs(); | 165 maxdevs = joyGetNumDevs(); |
159 | 166 for ( i = JOYSTICKID1; i < maxdevs && numdevs < MAX_JOYSTICKS; ++i ) { |
160 if ( maxdevs > MAX_JOYSTICKS ) { | |
161 maxdevs = MAX_JOYSTICKS; | |
162 } | |
163 | |
164 | |
165 for ( i = 0; i < MAX_JOYSTICKS; i++ ) { | |
166 SYS_JoystickID[i] = JOYSTICKID1 + i; | |
167 SYS_JoystickName[i] = NULL; | |
168 } | |
169 | |
170 | |
171 for ( i = 0; (i < maxdevs); ++i ) { | |
172 | 167 |
173 /* added 8/31/2001 By Vitaliy Mikitchenko */ | |
174 joyinfo.dwSize = sizeof(joyinfo); | 168 joyinfo.dwSize = sizeof(joyinfo); |
175 joyinfo.dwFlags = JOY_RETURNALL; | 169 joyinfo.dwFlags = JOY_RETURNALL; |
176 /* end addition */ | |
177 | |
178 result = joyGetPosEx(SYS_JoystickID[i], &joyinfo); | 170 result = joyGetPosEx(SYS_JoystickID[i], &joyinfo); |
179 if ( result == JOYERR_NOERROR ) { | 171 if ( result == JOYERR_NOERROR ) { |
180 result = joyGetDevCaps(SYS_JoystickID[i], &joycaps, sizeof(joycaps)); | 172 result = joyGetDevCaps(i, &joycaps, sizeof(joycaps)); |
181 if ( result == JOYERR_NOERROR ) { | 173 if ( result == JOYERR_NOERROR ) { |
182 SYS_JoystickID[numdevs] = SYS_JoystickID[i]; | 174 SYS_JoystickID[numdevs] = i; |
183 SYS_Joystick[numdevs] = joycaps; | 175 SYS_Joystick[numdevs] = joycaps; |
184 SYS_JoystickName[numdevs] = GetJoystickName(numdevs, joycaps.szRegKey); | 176 SYS_JoystickName[numdevs] = GetJoystickName(i, joycaps.szRegKey); |
185 numdevs++; | 177 numdevs++; |
186 } | 178 } |
187 } | 179 } |
188 } | 180 } |
189 return(numdevs); | 181 return(numdevs); |