summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/Src/ControllerInterface/XInput/XInput.cpp
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2010-06-21 03:12:16 +0000
committerJordan Woyak <jordan.woyak@gmail.com>2010-06-21 03:12:16 +0000
commit9e3b65368873fd26f21e2568b2c67d00ec96d6a5 (patch)
treeb5eff0d77ae7e4327069116f6440dcc2a70a1a5f /Source/Core/InputCommon/Src/ControllerInterface/XInput/XInput.cpp
parentfde15c1bc633792bead817b2f87faf54477765b5 (diff)
GCPad/New Wiimote Plugin: Individual keyboard and mouse devices are now listed on Windows(2 player with 2 keyboards possible). Improved the ability to map multiple inputs to the same control. Inputs from different devices can be mapped to the same button (example: Mouse Left and XInput A). More advanced mappings such as "Button 1 or 2 and NOT button 3" are possible. I hope the GUI after right clicking a button isn't too confusing(may change it to be a bit more user friendly). Hopefully, I didn't break OSX stuff by 'const'ing a few functions.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5757 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface/XInput/XInput.cpp')
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/XInput/XInput.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/XInput/XInput.cpp b/Source/Core/InputCommon/Src/ControllerInterface/XInput/XInput.cpp
index a2b6c638c9..5523e7cfa8 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/XInput/XInput.cpp
+++ b/Source/Core/InputCommon/Src/ControllerInterface/XInput/XInput.cpp
@@ -72,14 +72,14 @@ Device::Device( const XINPUT_CAPABILITIES* const caps, const unsigned int index
// get supported buttons
for ( int i = 0; i < sizeof(named_buttons)/sizeof(*named_buttons); ++i )
if ( named_buttons[i].bitmask & caps->Gamepad.wButtons )
- inputs.push_back( new Button( /*xinput_named_buttons[i].bitmask, */i ) );
+ AddInput( new Button( /*xinput_named_buttons[i].bitmask, */i ) );
// get supported triggers
for ( int i = 0; i < sizeof(named_triggers)/sizeof(*named_triggers); ++i )
{
//BYTE val = (&caps->Gamepad.bLeftTrigger)[i]; // should be max value / msdn lies
if ( (&caps->Gamepad.bLeftTrigger)[i] )
- inputs.push_back( new Trigger( i, 255 ) );
+ AddInput( new Trigger( i, 255 ) );
}
// get supported axes
@@ -89,8 +89,8 @@ Device::Device( const XINPUT_CAPABILITIES* const caps, const unsigned int index
if ( (&caps->Gamepad.sThumbLX)[i] )
{
// each axis gets a negative and a positive input instance associated with it
- inputs.push_back( new Axis( i, -32768 ) );
- inputs.push_back( new Axis( i, 32767 ) );
+ AddInput( new Axis( i, -32768 ) );
+ AddInput( new Axis( i, 32767 ) );
}
}
@@ -99,7 +99,7 @@ Device::Device( const XINPUT_CAPABILITIES* const caps, const unsigned int index
{
//WORD val = (&caps->Vibration.wLeftMotorSpeed)[i]; // should be max value / nope, more lies
if ( (&caps->Vibration.wLeftMotorSpeed)[i] )
- outputs.push_back( new Motor(i, 65535 ) );
+ AddOutput( new Motor(i, 65535 ) );
}
ClearInputState();
@@ -185,7 +185,7 @@ std::string Device::Motor::GetName() const
// get/set control state
-ControlState Device::GetInputState( const ControllerInterface::Device::Input* const input )
+ControlState Device::GetInputState( const ControllerInterface::Device::Input* const input ) const
{
return ((Input*)input)->GetState( &m_state_in.Gamepad );
}
@@ -197,17 +197,17 @@ void Device::SetOutputState( const ControllerInterface::Device::Output* const ou
// GET / SET STATES
-ControlState Device::Button::GetState( const XINPUT_GAMEPAD* const gamepad )
+ControlState Device::Button::GetState( const XINPUT_GAMEPAD* const gamepad ) const
{
return (gamepad->wButtons & named_buttons[m_index].bitmask) > 0;
}
-ControlState Device::Trigger::GetState( const XINPUT_GAMEPAD* const gamepad )
+ControlState Device::Trigger::GetState( const XINPUT_GAMEPAD* const gamepad ) const
{
return ControlState((&gamepad->bLeftTrigger)[m_index]) / m_range;
}
-ControlState Device::Axis::GetState( const XINPUT_GAMEPAD* const gamepad )
+ControlState Device::Axis::GetState( const XINPUT_GAMEPAD* const gamepad ) const
{
return std::max( 0.0f, ControlState((&gamepad->sThumbLX)[m_index]) / m_range );
}