diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2010-06-22 08:30:33 +0000 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2010-06-22 08:30:33 +0000 |
| commit | 25aca8cc4a7bfa764d1381dd57fd6e75d7039c26 (patch) | |
| tree | 71233403fade2f7a1dbc29618d8062559dddb5ca /Source/Core/InputCommon/Src/ControllerInterface | |
| parent | 1b670a982594672a6590b45728f2a1d59e6d7959 (diff) | |
GCPad/New Wiimote: Fixed issue 2848 (profiles not saving). Renamed DInput mouse axes to "Axis [XYZ][-+]" from "Mouse XYZ...". Minor cleanup/warning removal.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5767 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface')
3 files changed, 21 insertions, 34 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp index 88571b5a41..2888465487 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp @@ -327,11 +327,11 @@ void ControllerInterface::DeviceQualifier::FromDevice(const ControllerInterface: source= dev->GetSource(); } -bool ControllerInterface::Device::operator==(const ControllerInterface::DeviceQualifier& devq) const +bool ControllerInterface::DeviceQualifier::operator==(const ControllerInterface::Device* const dev) const { - if (GetId() == devq.cid) - if (GetName() == devq.name) - if (GetSource() == devq.source) + if (dev->GetId() == cid) + if (dev->GetName() == name) + if (dev->GetSource() == source) return true; return false; } @@ -390,11 +390,7 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference* devq.FromString(dev_str); // find device - std::vector<Device*>::const_iterator di = FindDevice(m_devices, devq); - - - if (m_devices.end() != di) - devc.device = *di; + devc.device = FindDevice(devq); if (devc.device) { @@ -407,10 +403,9 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference* // FIXME: Use std::find instead of a for loop // i = std::find(devc.device->Inputs().begin(), devc.device->Inputs().end(), ctrl_str); - for(i = devc.device->Inputs().begin(); i < devc.device->Inputs().end(); ++i) { + for(i = devc.device->Inputs().begin(); i < devc.device->Inputs().end(); ++i) if(*(*i) == ctrl_str) break; - } if (devc.device->Inputs().end() != i) { @@ -424,11 +419,9 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference* // FIXME: Use std::find instead of a for loop // i = std::find(devc.device->Outputs().begin(), devc.device->Outputs().end(), ctrl_str); - for(i = devc.device->Outputs().begin(); i < devc.device->Outputs().end(); ++i) { + for(i = devc.device->Outputs().begin(); i < devc.device->Outputs().end(); ++i) if(*(*i) == ctrl_str) break; - } - if (devc.device->Outputs().end() != i) { @@ -455,19 +448,16 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference* } } -std::vector<ControllerInterface::Device*>::const_iterator FindDevice( - const std::vector<ControllerInterface::Device*>& devices, const ControllerInterface::DeviceQualifier& devq) { - - std::vector<ControllerInterface::Device*>::const_iterator di; - - // FIXME: Use std::find instead of a for loop - // di = std::find(m_devices.begin(), m_devices.end(), devq); - for(di = devices.begin(); di < devices.end(); ++di) { - if(*(*di) == devq) - break; - } +ControllerInterface::Device* ControllerInterface::FindDevice(const ControllerInterface::DeviceQualifier& devq) const +{ + std::vector<ControllerInterface::Device*>::const_iterator + di = m_devices.begin(), + de = m_devices.end(); + for (; di!=de; ++di) + if (devq == *di) + return *di; - return di; + return NULL; } // diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h index 68db45fa4a..15e7ab6180 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h @@ -64,7 +64,7 @@ public: public: virtual std::string GetName() const = 0; virtual ~Control() {} - virtual bool operator==(const std::string& name) const; + bool operator==(const std::string& name) const; }; // @@ -104,8 +104,6 @@ public: virtual void ClearInputState(); - virtual bool operator==(const DeviceQualifier& devq) const; - const std::vector<Input*>& Inputs() const { return m_inputs; } const std::vector<Output*>& Outputs() const { return m_outputs; } @@ -135,6 +133,7 @@ public: void FromString(const std::string& str); std::string ToString() const; bool operator==(const DeviceQualifier& devq) const; + bool operator==(const Device* const dev) const; std::string source; int cid; @@ -219,7 +218,8 @@ public: bool UpdateInput(); bool UpdateOutput(); - const std::vector<Device*>& Devices() const { return m_devices; } + const std::vector<Device*>& Devices() const { return m_devices; } + Device* FindDevice(const DeviceQualifier& devq) const; private: bool m_is_init; @@ -227,7 +227,4 @@ private: void* m_hwnd; }; -std::vector<ControllerInterface::Device*>::const_iterator FindDevice( - const std::vector<ControllerInterface::Device*>& devices, const ControllerInterface::DeviceQualifier& devq); - #endif diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DirectInput/DirectInputMouse.cpp b/Source/Core/InputCommon/Src/ControllerInterface/DirectInput/DirectInputMouse.cpp index 122582bf4f..acf762386c 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/DirectInput/DirectInputMouse.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/DirectInput/DirectInputMouse.cpp @@ -153,7 +153,7 @@ std::string Mouse::Button::GetName() const std::string Mouse::Axis::GetName() const
{
- std::string tmpstr("Mouse ");
+ std::string tmpstr("Axis ");
tmpstr += "XYZ"[m_index]; tmpstr += ( m_range>0 ? '+' : '-' );
return tmpstr;
}
|
