mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
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
This commit is contained in:
@ -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 );
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ protected:
|
||||
{
|
||||
friend class Device;
|
||||
protected:
|
||||
virtual ControlState GetState( const XINPUT_GAMEPAD* const gamepad ) = 0;
|
||||
virtual ControlState GetState( const XINPUT_GAMEPAD* const gamepad ) const = 0;
|
||||
};
|
||||
|
||||
class Output : public ControllerInterface::Device::Output
|
||||
@ -42,7 +42,7 @@ protected:
|
||||
std::string GetName() const;
|
||||
protected:
|
||||
Button( const unsigned int index ) : m_index(index) {}
|
||||
ControlState GetState( const XINPUT_GAMEPAD* const gamepad );
|
||||
ControlState GetState( const XINPUT_GAMEPAD* const gamepad ) const;
|
||||
private:
|
||||
const unsigned int m_index;
|
||||
};
|
||||
@ -54,7 +54,7 @@ protected:
|
||||
std::string GetName() const;
|
||||
protected:
|
||||
Axis( const unsigned int index, const SHORT range ) : m_index(index), m_range(range) {}
|
||||
ControlState GetState( const XINPUT_GAMEPAD* const gamepad );
|
||||
ControlState GetState( const XINPUT_GAMEPAD* const gamepad ) const;
|
||||
private:
|
||||
const unsigned int m_index;
|
||||
const SHORT m_range;
|
||||
@ -67,7 +67,7 @@ protected:
|
||||
std::string GetName() const;
|
||||
protected:
|
||||
Trigger( const unsigned int index, const BYTE range ) : m_index(index), m_range(range) {}
|
||||
ControlState GetState( const XINPUT_GAMEPAD* const gamepad );
|
||||
ControlState GetState( const XINPUT_GAMEPAD* const gamepad ) const;
|
||||
private:
|
||||
const unsigned int m_index;
|
||||
const BYTE m_range;
|
||||
@ -89,7 +89,7 @@ protected:
|
||||
bool UpdateInput();
|
||||
bool UpdateOutput();
|
||||
|
||||
ControlState GetInputState( const ControllerInterface::Device::Input* const input );
|
||||
ControlState GetInputState( const ControllerInterface::Device::Input* const input ) const;
|
||||
void SetOutputState( const ControllerInterface::Device::Output* const input, const ControlState state );
|
||||
|
||||
void ClearInputState();
|
||||
|
Reference in New Issue
Block a user