Chris Danford changed galopin's code for handling Pump mats with different IDs.

This commit is contained in:
AJ Kelly
2010-06-10 14:25:24 -05:00
parent 53c69088e2
commit 7fc755456f
@@ -13,33 +13,30 @@ REGISTER_INPUT_HANDLER_CLASS2( Pump, Win32_Pump );
InputHandler_Win32_Pump::InputHandler_Win32_Pump()
{
m_bShutdown = false;
const int pump_usb_vid = 0x0d2f, pump_usb_pid = 0x0001, pump_usb_pid_alt = 0x0003;
const int pump_usb_vid = 0x0d2f;
const int pump_usb_pids[2] = {
0x0001 /* older model */,
0x0003 /* shipped with Exceed */
};
m_pDevice = new USBDevice[NUM_PUMPS];
// (thanks to galopin)
int pump1 = 0;
int pump3 = 0;
bool bFoundOnePad = false;
for( int i = 0; i < NUM_PUMPS; ++i )
int iNumFound = 0;
for( int p = 0; p < ARRAYSIZE(pump_usb_pids); ++p )
{
if( m_pDevice[i].Open(pump_usb_vid, pump_usb_pid, sizeof(long), pump1, NULL) )
const int pump_usb_pid = pump_usb_pids[p];
for( int i = 0; i < NUM_PUMPS; ++i )
{
pump1++;
bFoundOnePad = true;
LOG->Info( "Found Pump pad %i", pump1 );
}
else if( m_pDevice[i].Open(pump_usb_vid, pump_usb_pid_alt, sizeof(long), pump3, NULL) )
{
pump3++;
bFoundOnePad = true;
LOG->Info( "Found Pump pad (Exceed PS2) %i", pump3 );
if( m_pDevice[i].Open(pump_usb_vid, pump_usb_pid, sizeof(long), i, NULL) )
{
iNumFound++;
LOG->Info( "Found Pump pad %i", iNumFound );
}
}
}
/* Don't start a thread if we have no pads. */
if( bFoundOnePad && PREFSMAN->m_bThreadedInput )
if( iNumFound > 0 && PREFSMAN->m_bThreadedInput )
{
InputThread.SetName( "Pump thread" );
InputThread.Create( InputThread_Start, this );