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:
Jordan Woyak
2010-06-21 03:12:16 +00:00
parent fde15c1bc6
commit 9e3b653688
30 changed files with 1232 additions and 1163 deletions

View File

@ -19,7 +19,7 @@ protected:
{
friend class Keyboard;
protected:
virtual ControlState GetState(IOHIDDeviceRef device) = 0;
virtual ControlState GetState(IOHIDDeviceRef device) const = 0;
};
class Key : public Input
@ -29,7 +29,7 @@ protected:
std::string GetName() const;
protected:
Key( IOHIDElementRef element );
ControlState GetState(IOHIDDeviceRef device);
ControlState GetState(IOHIDDeviceRef device) const;
private:
IOHIDElementRef m_element;
std::string m_name;
@ -38,7 +38,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 output, const ControlState state );
public:

View File

@ -50,7 +50,7 @@ Keyboard::Keyboard(IOHIDDeviceRef device)
IOHIDElementRef e = (IOHIDElementRef)CFArrayGetValueAtIndex(elements, i);
//DeviceElementDebugPrint(e, NULL);
try { inputs.push_back(new Key(e)); }
try { AddInput(new Key(e)); }
catch (std::bad_alloc&) { /*Thrown if the key is reserved*/ }
}
CFRelease(elements);
@ -59,7 +59,7 @@ Keyboard::Keyboard(IOHIDDeviceRef device)
[pool release];
}
ControlState Keyboard::GetInputState( const ControllerInterface::Device::Input* const input )
ControlState Keyboard::GetInputState( const ControllerInterface::Device::Input* const input ) const
{
return ((Input*)input)->GetState(m_device);
}
@ -110,7 +110,7 @@ Keyboard::Key::Key(IOHIDElementRef element)
NSLog(@"Got key 0x%x of type RESERVED", IOHIDElementGetUsage(m_element));
}
ControlState Keyboard::Key::GetState(IOHIDDeviceRef device)
ControlState Keyboard::Key::GetState(IOHIDDeviceRef device) const
{
IOHIDValueRef value;
if (IOHIDDeviceGetValue(device, m_element, &value) == kIOReturnSuccess)

View File

@ -19,7 +19,7 @@ protected:
{
friend class Mouse;
protected:
virtual ControlState GetState(IOHIDDeviceRef device) = 0;
virtual ControlState GetState(IOHIDDeviceRef device) const = 0;
};
class Button : public Input
@ -29,7 +29,7 @@ protected:
std::string GetName() const;
protected:
Button( IOHIDElementRef element );
ControlState GetState(IOHIDDeviceRef device);
ControlState GetState(IOHIDDeviceRef device) const;
private:
IOHIDElementRef m_element;
std::string m_name;
@ -46,7 +46,7 @@ protected:
std::string GetName() const;
protected:
Axis( IOHIDElementRef element, direction dir );
ControlState GetState(IOHIDDeviceRef device);
ControlState GetState(IOHIDDeviceRef device) const;
private:
IOHIDElementRef m_element;
std::string m_name;
@ -57,7 +57,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 output, const ControlState state );
public:

View File

@ -38,7 +38,7 @@ Mouse::Mouse(IOHIDDeviceRef device)
IOHIDElementRef e = (IOHIDElementRef)CFArrayGetValueAtIndex(buttons, i);
//DeviceElementDebugPrint(e, NULL);
inputs.push_back(new Button(e));
AddInput(new Button(e));
}
CFRelease(buttons);
}
@ -59,8 +59,8 @@ Mouse::Mouse(IOHIDDeviceRef device)
IOHIDElementRef e = (IOHIDElementRef)CFArrayGetValueAtIndex(axes, i);
//DeviceElementDebugPrint(e, NULL);
inputs.push_back(new Axis(e, Axis::negative));
inputs.push_back(new Axis(e, Axis::positive));
AddInput(new Axis(e, Axis::negative));
AddInput(new Axis(e, Axis::positive));
}
CFRelease(axes);
}
@ -68,7 +68,7 @@ Mouse::Mouse(IOHIDDeviceRef device)
[pool release];
}
ControlState Mouse::GetInputState( const ControllerInterface::Device::Input* const input )
ControlState Mouse::GetInputState( const ControllerInterface::Device::Input* const input ) const
{
return ((Input*)input)->GetState(m_device);
}
@ -111,7 +111,7 @@ Mouse::Button::Button(IOHIDElementRef element)
m_name = std::string("Button ") + s.str();
}
ControlState Mouse::Button::GetState(IOHIDDeviceRef device)
ControlState Mouse::Button::GetState(IOHIDDeviceRef device) const
{
IOHIDValueRef value;
if (IOHIDDeviceGetValue(device, m_element, &value) == kIOReturnSuccess)