Prevent mapping mouse to input

This commit is contained in:
Luke Usher 2018-02-24 19:17:04 +00:00
parent b459843c80
commit 315c1e93fb
1 changed files with 0 additions and 111 deletions

View File

@ -418,117 +418,6 @@ bool XBController::ConfigPoll(char *szStatus)
return true;
}
}
// ******************************************************************
// * Detect Mouse Input
// ******************************************************************
else if(m_InputDevice[v].m_Flags & DEVICE_FLAG_MOUSE)
{
XTL::DIMOUSESTATE2 MouseState;
m_InputDevice[v].m_Device->GetDeviceState(sizeof(MouseState), &MouseState);
dwFlags = DEVICE_FLAG_MOUSE;
// ******************************************************************
// * Detect Button State Change
// ******************************************************************
for(int r=0;r<4;r++)
{
// 0x80 is the mask for button push
if(MouseState.rgbButtons[r] & 0x80)
{
dwHow = r;
dwFlags |= DEVICE_FLAG_MOUSE_CLICK;
break;
}
}
// ******************************************************************
// * Check for Success
// ******************************************************************
if(dwHow != -1)
{
Map(CurConfigObject, "SysMouse", dwHow, dwFlags);
printf("Cxbx-Reloaded: Detected Button %d on SysMouse\n", dwHow);
sprintf(szStatus, "Success: %s Mapped to Button %d on SysMouse", m_DeviceNameLookup[CurConfigObject], dwHow);
return true;
}
// ******************************************************************
// * Check for Mouse Movement
// ******************************************************************
else
{
LONG lAbsDeltaX=0, lAbsDeltaY=0, lAbsDeltaZ=0;
LONG lDeltaX=0, lDeltaY=0, lDeltaZ=0;
if(lPrevMouseX == -1 || lPrevMouseY == -1 || lPrevMouseZ == -1)
lDeltaX = lDeltaY = lDeltaZ = 0;
else
{
lDeltaX = MouseState.lX - lPrevMouseX;
lDeltaY = MouseState.lY - lPrevMouseY;
lDeltaZ = MouseState.lZ - lPrevMouseZ;
lAbsDeltaX = abs(lDeltaX);
lAbsDeltaY = abs(lDeltaY);
lAbsDeltaZ = abs(lDeltaZ);
}
LONG lMax = (lAbsDeltaX > lAbsDeltaY) ? lAbsDeltaX : lAbsDeltaY;
if(lAbsDeltaZ > lMax)
lMax = lAbsDeltaZ;
lPrevMouseX = MouseState.lX;
lPrevMouseY = MouseState.lY;
lPrevMouseZ = MouseState.lZ;
if(lMax > DETECT_SENSITIVITY_MOUSE)
{
dwFlags |= DEVICE_FLAG_AXIS;
if(lMax == lAbsDeltaX)
{
dwHow = FIELD_OFFSET(XTL::DIMOUSESTATE, lX);
dwFlags |= (lDeltaX > 0) ? DEVICE_FLAG_POSITIVE : DEVICE_FLAG_NEGATIVE;
}
else if(lMax == lAbsDeltaY)
{
dwHow = FIELD_OFFSET(XTL::DIMOUSESTATE, lY);
dwFlags |= (lDeltaY > 0) ? DEVICE_FLAG_POSITIVE : DEVICE_FLAG_NEGATIVE;
}
else if(lMax == lAbsDeltaZ)
{
dwHow = FIELD_OFFSET(XTL::DIMOUSESTATE, lZ);
dwFlags |= (lDeltaZ > 0) ? DEVICE_FLAG_POSITIVE : DEVICE_FLAG_NEGATIVE;
}
}
// ******************************************************************
// * Check for Success
// ******************************************************************
if(dwHow != -1)
{
const char *szDirection = (dwFlags & DEVICE_FLAG_POSITIVE) ? "Positive" : "Negative";
const char *szObjName = "Unknown";
ObjectInstance.dwSize = sizeof(ObjectInstance);
if(m_InputDevice[v].m_Device->GetObjectInfo(&ObjectInstance, dwHow, DIPH_BYOFFSET) == DI_OK)
szObjName = ObjectInstance.tszName;
Map(CurConfigObject, "SysMouse", dwHow, dwFlags);
printf("Cxbx-Reloaded: Detected Movement on the %s%s on SysMouse\n", szDirection, szObjName);
sprintf(szStatus, "Success: %s Mapped to %s%s on SysMouse", m_DeviceNameLookup[CurConfigObject], szDirection, szObjName);
return true;
}
}
}
}
return false;