diff --git a/src/arch/InputHandler/InputHandler_Win32_Pump.cpp b/src/arch/InputHandler/InputHandler_Win32_Pump.cpp index 6c20ae1b5a..7dcd7f6a65 100644 --- a/src/arch/InputHandler/InputHandler_Win32_Pump.cpp +++ b/src/arch/InputHandler/InputHandler_Win32_Pump.cpp @@ -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 );