Don't always poll DI for joystick changes in the main thread. Instead, poll the HID registry value, then poll DI for 15 seconds to catch the joystick change.

This commit is contained in:
Chris Danford
2006-03-22 22:39:35 +00:00
parent 4a998771eb
commit c0dfb2453d
2 changed files with 57 additions and 31 deletions
@@ -17,21 +17,18 @@ public:
private:
RageThread m_InputThread;
RageThread m_DevicesChangedThread;
bool m_bShutdown;
// Use these to figure out if a joystick was plugged/unplugged
int m_iCurrentNumJoysticks;
int m_iLastSeenNumJoysticks;
int m_iLastSeenNumHidDevices; // This changes first on plug/unplug
int m_iNumTimesLeftToPollForJoysticksChanged;
int m_iLastSeenNumJoysticks; // This changes sometime after m_iLastSeenNumHidDevices
void UpdatePolled( DIDevice &device, const RageTimer &tm );
void UpdateBuffered( DIDevice &device, const RageTimer &tm );
void PollAndAcquireDevices( bool bBuffered );
static int InputThread_Start( void *p ) { ((InputHandler_DInput *) p)->InputThreadMain(); return 0; }
static int DevicesChangedThread_Start( void *p ) { ((InputHandler_DInput *) p)->DevicesChangedThreadMain(); return 0; }
void InputThreadMain();
void DevicesChangedThreadMain();
void StartThread();
void ShutdownThread();