Return -1 if no InputDevice numbers can be assigned to logical devices.
This commit is contained in:
@@ -165,11 +165,8 @@ void JoystickDevice::GetButtonPresses( vector<pair<DeviceInput, bool> >& vPresse
|
||||
|
||||
int JoystickDevice::AssignIDs( InputDevice startID )
|
||||
{
|
||||
if( startID < DEVICE_JOY1 )
|
||||
{
|
||||
m_vSticks.clear();
|
||||
return 0;
|
||||
}
|
||||
if( startID < DEVICE_JOY1 || startID > DEVICE_JOY16 )
|
||||
return -1;
|
||||
FOREACH( Joystick, m_vSticks, i )
|
||||
{
|
||||
if( startID > DEVICE_JOY16 )
|
||||
|
||||
@@ -48,33 +48,32 @@ void PumpDevice::GetButtonPresses( vector<pair<DeviceInput, bool> >& vPresses, i
|
||||
}
|
||||
if( db1 != DeviceButton_Invalid )
|
||||
{
|
||||
DeviceInput di( id, db1, pressed1 ? 1.0f : 0.0f , now );
|
||||
DeviceInput di( m_Id, db1, pressed1 ? 1.0f : 0.0f , now );
|
||||
vPresses.push_back( pair<DeviceInput, bool>(di, pressed1) );
|
||||
}
|
||||
if( db2 != DeviceButton_Invalid )
|
||||
{
|
||||
DeviceInput di( id, db2, pressed2 ? 1.0f : 0.0f , now );
|
||||
DeviceInput di( m_Id, db2, pressed2 ? 1.0f : 0.0f , now );
|
||||
vPresses.push_back( pair<DeviceInput, bool>(di, pressed2) );
|
||||
}
|
||||
}
|
||||
|
||||
int PumpDevice::AssignIDs( InputDevice startID )
|
||||
{
|
||||
id = DEVICE_NONE;
|
||||
if( startID < DEVICE_PUMP1 || startID > DEVICE_PUMP2 )
|
||||
return 0;
|
||||
id = startID;
|
||||
return -1;
|
||||
m_Id = startID;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void PumpDevice::GetDevicesAndDescriptions( vector<InputDevice>& dev, vector<RString>& desc ) const
|
||||
{
|
||||
dev.push_back( id );
|
||||
dev.push_back( m_Id );
|
||||
desc.push_back( "Pump USB" );
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2005-2006 Steve Checkoway
|
||||
* (c) 2006 Steve Checkoway
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
||||
@@ -6,14 +6,15 @@
|
||||
class PumpDevice : public HIDDevice
|
||||
{
|
||||
private:
|
||||
InputDevice id;
|
||||
InputDevice m_Id;
|
||||
|
||||
protected:
|
||||
bool AddLogicalDevice( int usagePage, int usage ) { return true; }
|
||||
void AddElement( int usagePage, int usage, int cookie,
|
||||
const CFDictionaryRef properties ) { }
|
||||
void Open();
|
||||
bool SupportsVidPid( int vid, int pid ) { return vid == 0x0d2f && pid == 0x0001; }
|
||||
|
||||
|
||||
public:
|
||||
void GetButtonPresses( vector<pair<DeviceInput, bool> >& vPresses, int cookie,
|
||||
int value, const RageTimer& now ) const;
|
||||
|
||||
Reference in New Issue
Block a user