|
@@ -522,11 +522,23 @@ bool DInputManager::isXInputEnabled()
|
|
|
//------------------------------------------------------------------------------
|
|
|
bool DInputManager::isXInputConnected(int controllerID)
|
|
|
{
|
|
|
+ if (controllerID >= XINPUT_MAX_CONTROLLERS || controllerID < 0)
|
|
|
+ {
|
|
|
+ Con::warnf("Invalid device index: %d. Index should be between 0 and %d.", controllerID, XINPUT_MAX_CONTROLLERS - 1);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
return( mXInputStateNew[controllerID].bConnected );
|
|
|
}
|
|
|
|
|
|
int DInputManager::getXInputState(int controllerID, int property, bool current)
|
|
|
{
|
|
|
+ if (controllerID >= XINPUT_MAX_CONTROLLERS || controllerID < 0)
|
|
|
+ {
|
|
|
+ Con::warnf("Invalid device index: %d. Index should be between 0 and %d.", controllerID, XINPUT_MAX_CONTROLLERS - 1);
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
int retVal;
|
|
|
|
|
|
switch(property)
|
|
@@ -848,4 +860,4 @@ void DInputManager::processXInput( void )
|
|
|
if ( mXInputStateReset )
|
|
|
mXInputStateReset = false;
|
|
|
}
|
|
|
-}
|
|
|
+}
|