Change GetDevicesAndDescriptions to fill in one vector instead of 2
Ignore changes in non-joystick devices when automapping
This commit is contained in:
@@ -29,7 +29,7 @@ public:
|
||||
virtual ~InputHandler() { }
|
||||
virtual void Update() { }
|
||||
virtual bool DevicesChanged() { return false; }
|
||||
virtual void GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut ) = 0;
|
||||
virtual void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut ) = 0;
|
||||
|
||||
// Override to return a pretty string that's specific to the controller type.
|
||||
virtual RString GetDeviceSpecificInputString( const DeviceInput &di );
|
||||
|
||||
@@ -240,10 +240,10 @@ InputHandler_Carbon::InputHandler_Carbon() : m_Sem( "Input thread started" ), m_
|
||||
}
|
||||
}
|
||||
|
||||
void InputHandler_Carbon::GetDevicesAndDescriptions( vector<InputDevice>& dev, vector<RString>& desc )
|
||||
void InputHandler_Carbon::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevices )
|
||||
{
|
||||
FOREACH_CONST( HIDDevice *, m_vDevices, i )
|
||||
(*i)->GetDevicesAndDescriptions( dev, desc );
|
||||
(*i)->GetDevicesAndDescriptions( vDevices );
|
||||
}
|
||||
|
||||
RString InputHandler_Carbon::GetDeviceSpecificInputString( const DeviceInput &di )
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
~InputHandler_Carbon();
|
||||
|
||||
bool DevicesChanged() { LockMut( m_ChangeLock ); return m_bChanged; }
|
||||
void GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut );
|
||||
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
|
||||
RString GetDeviceSpecificInputString( const DeviceInput &di );
|
||||
static void QueueCallBack( void *target, int result, void *refcon, void *sender );
|
||||
|
||||
|
||||
@@ -586,13 +586,10 @@ void InputHandler_DInput::InputThreadMain()
|
||||
CloseHandle(Handle);
|
||||
}
|
||||
|
||||
void InputHandler_DInput::GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut )
|
||||
void InputHandler_DInput::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
|
||||
{
|
||||
for( unsigned i=0; i < Devices.size(); ++i )
|
||||
{
|
||||
vDevicesOut.push_back( Devices[i].dev );
|
||||
vDescriptionsOut.push_back( Devices[i].JoystickInst.tszProductName );
|
||||
}
|
||||
vDevicesOut.push_back( InputDeviceInfo(Devices[i].dev, Devices[i].JoystickInst.tszProductName) );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -10,7 +10,7 @@ class InputHandler_DInput: public InputHandler
|
||||
public:
|
||||
InputHandler_DInput();
|
||||
~InputHandler_DInput();
|
||||
void GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut );
|
||||
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
|
||||
void Update();
|
||||
bool DevicesChanged();
|
||||
void WindowReset();
|
||||
|
||||
@@ -179,15 +179,14 @@ void InputHandler_Linux_Joystick::InputThread()
|
||||
InputHandler::UpdateTimer();
|
||||
}
|
||||
|
||||
void InputHandler_Linux_Joystick::GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut)
|
||||
void InputHandler_Linux_Joystick::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
|
||||
{
|
||||
for(int i = 0; i < NUM_JOYSTICKS; ++i)
|
||||
{
|
||||
if (fds[i] < 0)
|
||||
continue;
|
||||
|
||||
vDevicesOut.push_back( InputDevice(DEVICE_JOY1+i) );
|
||||
vDescriptionsOut.push_back( m_sDescription[i] );
|
||||
vDevicesOut.push_back( InputDeviceInfo(InputDevice(DEVICE_JOY1+i), m_sDescription[i]) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
enum { NUM_JOYSTICKS = 4 };
|
||||
InputHandler_Linux_Joystick();
|
||||
~InputHandler_Linux_Joystick();
|
||||
void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut);
|
||||
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
|
||||
|
||||
private:
|
||||
static int InputThread_Start( void *p );
|
||||
|
||||
@@ -189,10 +189,9 @@ void InputHandler_Linux_tty::Update()
|
||||
InputHandler::UpdateTimer();
|
||||
}
|
||||
|
||||
void InputHandler_Linux_tty::GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut)
|
||||
void InputHandler_Linux_tty::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
|
||||
{
|
||||
vDevicesOut.push_back( InputDevice(DEVICE_KEYBOARD) );
|
||||
vDescriptionsOut.push_back( "Keyboard" );
|
||||
vDevicesOut.push_back( InputDeviceInfo(DEVICE_KEYBOARD,"Keyboard") );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
void Update();
|
||||
InputHandler_Linux_tty();
|
||||
~InputHandler_Linux_tty();
|
||||
void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut);
|
||||
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
|
||||
};
|
||||
#define USE_INPUT_HANDLER_LINUX_TTY
|
||||
|
||||
|
||||
@@ -12,10 +12,9 @@ InputHandler_MonkeyKeyboard::~InputHandler_MonkeyKeyboard()
|
||||
{
|
||||
}
|
||||
|
||||
void InputHandler_MonkeyKeyboard::GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut)
|
||||
void InputHandler_MonkeyKeyboard::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
|
||||
{
|
||||
vDevicesOut.push_back( InputDevice(DEVICE_KEYBOARD) );
|
||||
vDescriptionsOut.push_back( "MonkeyKeyboard" );
|
||||
vDevicesOut.push_back( InputDeviceInfo(DEVICE_KEYBOARD,"MonkeyKeyboard") );
|
||||
}
|
||||
|
||||
static const DeviceButton g_keys[] =
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
void Update();
|
||||
InputHandler_MonkeyKeyboard();
|
||||
~InputHandler_MonkeyKeyboard();
|
||||
void GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut );
|
||||
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
|
||||
|
||||
private:
|
||||
RageTimer m_timerPressButton;
|
||||
|
||||
@@ -248,18 +248,14 @@ void InputHandler_SDL::Update()
|
||||
}
|
||||
|
||||
|
||||
void InputHandler_SDL::GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut)
|
||||
void InputHandler_SDL::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
|
||||
{
|
||||
vDevicesOut.push_back( DEVICE_KEYBOARD );
|
||||
vDescriptionsOut.push_back( "Keyboard" );
|
||||
vDevicesOut.push_back( InputDeviceInfo(DEVICE_KEYBOARD,"Keyboard") );
|
||||
|
||||
for( int i=0; i<SDL_NumJoysticks(); i++ )
|
||||
{
|
||||
if( SDL_JoystickOpened(i) )
|
||||
{
|
||||
vDevicesOut.push_back( InputDevice(DEVICE_JOY1+i) );
|
||||
vDescriptionsOut.push_back( SDL_JoystickName(i) );
|
||||
}
|
||||
vDevicesOut.push_back( InputDeviceInfo(InputDevice(DEVICE_JOY1+i), SDL_JoystickName(i)) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
void Update();
|
||||
InputHandler_SDL();
|
||||
~InputHandler_SDL();
|
||||
void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut);
|
||||
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
|
||||
};
|
||||
#define USE_INPUT_HANDLER_SDL
|
||||
|
||||
|
||||
@@ -65,12 +65,11 @@ InputHandler_Win32_MIDI::~InputHandler_Win32_MIDI()
|
||||
}
|
||||
}
|
||||
|
||||
void InputHandler_Win32_MIDI::GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut )
|
||||
void InputHandler_Win32_MIDI::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
|
||||
{
|
||||
if( m_bFoundDevice )
|
||||
{
|
||||
vDevicesOut.push_back( InputDevice(DEVICE_MIDI) );
|
||||
vDescriptionsOut.push_back( "Win32_MIDI" );
|
||||
vDevicesOut.push_back( InputDeviceInfo(DEVICE_MIDI,"Win32_MIDI") );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ public:
|
||||
InputHandler_Win32_MIDI();
|
||||
~InputHandler_Win32_MIDI();
|
||||
|
||||
void GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut );
|
||||
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
|
||||
|
||||
void SetDev( DeviceInput key, bool pressed ) { ButtonPressed( key, pressed ); }
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ InputHandler_Win32_Para::InputHandler_Win32_Para()
|
||||
SAFE_DELETE( dev );
|
||||
}
|
||||
|
||||
void InputHandler_Win32_Para::GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut)
|
||||
void InputHandler_Win32_Para::GetDevicesAndDescriptions(vector<InputDeviceInfo>& vDevicesOut )
|
||||
{
|
||||
// The device appears as a HID joystick
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class InputHandler_Win32_Para: public InputHandler
|
||||
{
|
||||
public:
|
||||
InputHandler_Win32_Para();
|
||||
void GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut );
|
||||
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
|
||||
};
|
||||
#define USE_INPUT_HANDLER_WIN32_PARA
|
||||
|
||||
|
||||
@@ -87,14 +87,13 @@ RString InputHandler_Win32_Pump::GetDeviceSpecificInputString( const DeviceInput
|
||||
return InputHandler::GetDeviceSpecificInputString( di );
|
||||
}
|
||||
|
||||
void InputHandler_Win32_Pump::GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut)
|
||||
void InputHandler_Win32_Pump::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
|
||||
{
|
||||
for(int i = 0; i < NUM_PUMPS; ++i)
|
||||
{
|
||||
if( m_pDevice[i].IsOpen() )
|
||||
{
|
||||
vDevicesOut.push_back( InputDevice(DEVICE_PUMP1+i) );
|
||||
vDescriptionsOut.push_back( "Pump USB" );
|
||||
vDevicesOut.push_back( InputDeviceInfo(InputDevice(DEVICE_PUMP1+i),"Pump USB") );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
InputHandler_Win32_Pump();
|
||||
~InputHandler_Win32_Pump();
|
||||
RString GetDeviceSpecificInputString( const DeviceInput &di );
|
||||
void GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut );
|
||||
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
|
||||
|
||||
private:
|
||||
USBDevice *m_pDevice;
|
||||
|
||||
@@ -170,10 +170,9 @@ void InputHandler_X11::Update()
|
||||
}
|
||||
|
||||
|
||||
void InputHandler_X11::GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut )
|
||||
void InputHandler_X11::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
|
||||
{
|
||||
vDevicesOut.push_back( DEVICE_KEYBOARD );
|
||||
vDescriptionsOut.push_back( "Keyboard" );
|
||||
vDevicesOut.push_back( InputDeviceInfo(DEVICE_KEYBOARD,"Keyboard") );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
InputHandler_X11();
|
||||
~InputHandler_X11();
|
||||
void Update();
|
||||
void GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut );
|
||||
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
|
||||
};
|
||||
#define USE_INPUT_HANDLER_X11
|
||||
|
||||
|
||||
@@ -161,14 +161,13 @@ void InputHandler_Xbox::Update()
|
||||
InputHandler::UpdateTimer();
|
||||
}
|
||||
|
||||
void InputHandler_Xbox::GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut)
|
||||
void InputHandler_Xbox::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
|
||||
{
|
||||
for( int i=0; i<NUM_JOYSTICKS; i++ )
|
||||
{
|
||||
if( joysticks[i] != 0 )
|
||||
{
|
||||
vDevicesOut.push_back( InputDevice(DEVICE_JOY1+i) );
|
||||
vDescriptionsOut.push_back( "XboxGameHardware" );
|
||||
vDevicesOut.push_back( InputDeviceInfo(InputDevice(DEVICE_JOY1+i),"XboxGameHardware") );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public:
|
||||
void Update();
|
||||
InputHandler_Xbox();
|
||||
~InputHandler_Xbox();
|
||||
void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut);
|
||||
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
|
||||
|
||||
private:
|
||||
void getHandles();
|
||||
|
||||
Reference in New Issue
Block a user