diff options
-rw-r--r-- | ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index a132f472..66138e90 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -183,14 +183,14 @@ bool FTNoIR_Tracker::GiveHeadPoseData(double *data) if( !g_pDI || !g_pJoystick) return false; -start: auto hr = g_pJoystick->Poll(); if( FAILED( hr )) { hr = g_pJoystick->Acquire(); - while( hr == DIERR_INPUTLOST ) + for (int i = 0; hr == DIERR_INPUTLOST && i < 200; i++) hr = g_pJoystick->Acquire(); - goto start; + if (hr != DI_OK) + return false; } if( FAILED( hr = g_pJoystick->GetDeviceState( sizeof( js ), &js ) ) ) |