comparison src/haptic/win32/SDL_syshaptic.c @ 2587:b4b3beaea5b5 gsoc2008_force_feedback

Need to get cooperative level before acquiring.
author Edgar Simo <bobbens@gmail.com>
date Mon, 04 Aug 2008 17:03:20 +0000
parents 64fa227c01ce
children 57bd3e462138
comparison
equal deleted inserted replaced
2586:d84c99f5401e 2587:b4b3beaea5b5
226 * 226 *
227 * Steps: 227 * Steps:
228 * - Open temporary DirectInputDevice interface. 228 * - Open temporary DirectInputDevice interface.
229 * - Create DirectInputDevice2 interface. 229 * - Create DirectInputDevice2 interface.
230 * - Release DirectInputDevice interface. 230 * - Release DirectInputDevice interface.
231 * - Set cooperative level.
231 * - Acquire exclusiveness. 232 * - Acquire exclusiveness.
232 * - Reset actuators. 233 * - Reset actuators.
233 * - Get supported featuers. 234 * - Get supported featuers.
234 */ 235 */
235 static int 236 static int
265 if (FAILED(ret)) { 266 if (FAILED(ret)) {
266 DI_SetError("Querying DirectInput interface",ret); 267 DI_SetError("Querying DirectInput interface",ret);
267 goto creat_err; 268 goto creat_err;
268 } 269 }
269 270
270 /* Acquire the device. */
271 ret = IDirectInputDevice2_Acquire(haptic->hwdata->device);
272 if (FAILED(ret)) {
273 DI_SetError("Acquiring DirectInput device",ret);
274 goto query_err;
275 }
276
277 /* Grab it exclusively to use force feedback stuff. */ 271 /* Grab it exclusively to use force feedback stuff. */
278 ret =IDirectInputDevice2_SetCooperativeLevel( haptic->hwdata->device, 272 ret =IDirectInputDevice2_SetCooperativeLevel( haptic->hwdata->device,
279 SDL_HelperWindow, 273 SDL_HelperWindow,
280 DISCL_EXCLUSIVE | DISCL_BACKGROUND ); 274 DISCL_EXCLUSIVE | DISCL_BACKGROUND );
281 if (FAILED(ret)) { 275 if (FAILED(ret)) {
282 DI_SetError("Setting cooperative level to exclusive",ret); 276 DI_SetError("Setting cooperative level to exclusive",ret);
283 goto acquire_err; 277 goto acquire_err;
278 }
279
280 /* Acquire the device. */
281 ret = IDirectInputDevice2_Acquire(haptic->hwdata->device);
282 if (FAILED(ret)) {
283 DI_SetError("Acquiring DirectInput device",ret);
284 goto query_err;
284 } 285 }
285 286
286 /* Reset all actuators - just in case. */ 287 /* Reset all actuators - just in case. */
287 ret = IDirectInputDevice2_SendForceFeedbackCommand( haptic->hwdata->device, 288 ret = IDirectInputDevice2_SendForceFeedbackCommand( haptic->hwdata->device,
288 DISFFC_RESET ); 289 DISFFC_RESET );