Windows/Linux/whatever build fix.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5762 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
d0f00cedff
commit
1b5b57bff3
|
@ -327,18 +327,18 @@ void ControllerInterface::DeviceQualifier::FromDevice(const ControllerInterface:
|
|||
source= dev->GetSource();
|
||||
}
|
||||
|
||||
bool operator==(const ControllerInterface::Device* const dev, const ControllerInterface::DeviceQualifier& devq)
|
||||
bool ControllerInterface::Device::operator==(const ControllerInterface::DeviceQualifier& devq) const
|
||||
{
|
||||
if (dev->GetId() == devq.cid)
|
||||
if (dev->GetName() == devq.name)
|
||||
if (dev->GetSource() == devq.source)
|
||||
if (GetId() == devq.cid)
|
||||
if (GetName() == devq.name)
|
||||
if (GetSource() == devq.source)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator==(const ControllerInterface::Device::Control* const c, const std::string& name)
|
||||
bool ControllerInterface::Device::Control::operator==(const std::string& name) const
|
||||
{
|
||||
return c->GetName() == name;
|
||||
return GetName() == name;
|
||||
}
|
||||
|
||||
bool ControllerInterface::DeviceQualifier::operator==(const ControllerInterface::DeviceQualifier& devq) const
|
||||
|
@ -390,8 +390,9 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference*
|
|||
devq.FromString(dev_str);
|
||||
|
||||
// find device
|
||||
const std::vector<Device*>::const_iterator di =
|
||||
std::find(m_devices.begin(), m_devices.end(), devq);
|
||||
std::vector<Device*>::const_iterator di = FindDevice(m_devices, devq);
|
||||
|
||||
|
||||
if (m_devices.end() != di)
|
||||
devc.device = *di;
|
||||
|
||||
|
@ -402,8 +403,15 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference*
|
|||
// inputs or outputs, i don't like this
|
||||
if (ref->is_input)
|
||||
{
|
||||
const std::vector<Device::Input*>::const_iterator i =
|
||||
std::find(devc.device->Inputs().begin(), devc.device->Inputs().end(), ctrl_str);
|
||||
std::vector<Device::Input*>::const_iterator i;
|
||||
|
||||
// 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) {
|
||||
if(*(*i) == ctrl_str)
|
||||
break;
|
||||
}
|
||||
|
||||
if (devc.device->Inputs().end() != i)
|
||||
{
|
||||
devc.control = *i;
|
||||
|
@ -412,8 +420,16 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference*
|
|||
}
|
||||
else
|
||||
{
|
||||
const std::vector<Device::Output*>::const_iterator i =
|
||||
std::find(devc.device->Outputs().begin(), devc.device->Outputs().end(), ctrl_str);
|
||||
std::vector<Device::Output*>::const_iterator i;
|
||||
|
||||
// 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) {
|
||||
if(*(*i) == ctrl_str)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (devc.device->Outputs().end() != i)
|
||||
{
|
||||
devc.control = *i;
|
||||
|
@ -439,6 +455,21 @@ 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;
|
||||
}
|
||||
|
||||
return di;
|
||||
}
|
||||
|
||||
//
|
||||
// InputReference :: Detect
|
||||
//
|
||||
|
|
|
@ -42,6 +42,9 @@ class ControllerInterface
|
|||
{
|
||||
public:
|
||||
|
||||
// Forward declarations
|
||||
class DeviceQualifier;
|
||||
|
||||
//
|
||||
// Device
|
||||
//
|
||||
|
@ -61,6 +64,7 @@ public:
|
|||
public:
|
||||
virtual std::string GetName() const = 0;
|
||||
virtual ~Control() {}
|
||||
virtual bool operator==(const std::string& name) const;
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -100,6 +104,8 @@ 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; }
|
||||
|
||||
|
@ -213,7 +219,7 @@ public:
|
|||
bool UpdateInput();
|
||||
bool UpdateOutput();
|
||||
|
||||
const std::vector<Device*>& Devices() const { return m_devices; }
|
||||
const std::vector<Device*>& Devices() const { return m_devices; }
|
||||
|
||||
private:
|
||||
bool m_is_init;
|
||||
|
@ -221,8 +227,7 @@ private:
|
|||
void* m_hwnd;
|
||||
};
|
||||
|
||||
// used for std::find n stuff
|
||||
bool operator==(const ControllerInterface::Device* const dev, const ControllerInterface::DeviceQualifier& devq);
|
||||
bool operator==(const ControllerInterface::Device::Control* const c, const std::string& name);
|
||||
std::vector<ControllerInterface::Device*>::const_iterator FindDevice(
|
||||
const std::vector<ControllerInterface::Device*>& devices, const ControllerInterface::DeviceQualifier& devq);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -192,10 +192,8 @@ void ControlDialog::UpdateListContents()
|
|||
{
|
||||
control_lbox->Clear();
|
||||
|
||||
const std::vector<ControllerInterface::Device*>::const_iterator di =
|
||||
std::find(m_plugin.controller_interface.Devices().begin(),
|
||||
m_plugin.controller_interface.Devices().end(),
|
||||
m_devq);
|
||||
std::vector<ControllerInterface::Device*>::const_iterator di =
|
||||
FindDevice(m_plugin.controller_interface.Devices(), m_devq);
|
||||
|
||||
if (m_plugin.controller_interface.Devices().end() != di)
|
||||
{
|
||||
|
@ -413,9 +411,8 @@ void ControlDialog::DetectControl(wxCommandEvent& event)
|
|||
wxButton* const btn = (wxButton*)event.GetEventObject();
|
||||
const wxString lbl = btn->GetLabel();
|
||||
|
||||
const std::vector<ControllerInterface::Device*>::const_iterator di =
|
||||
std::find(m_plugin.controller_interface.Devices().begin(),
|
||||
m_plugin.controller_interface.Devices().end(), m_devq);
|
||||
std::vector<ControllerInterface::Device*>::const_iterator di =
|
||||
FindDevice(m_plugin.controller_interface.Devices(), m_devq);
|
||||
|
||||
if (m_plugin.controller_interface.Devices().end() != di)
|
||||
{
|
||||
|
@ -440,8 +437,7 @@ void GamepadPage::DetectControl( wxCommandEvent& event )
|
|||
|
||||
// find device :/
|
||||
const std::vector<ControllerInterface::Device*>::const_iterator di =
|
||||
std::find(m_plugin.controller_interface.Devices().begin(),
|
||||
m_plugin.controller_interface.Devices().end(), controller->default_device);
|
||||
FindDevice(m_plugin.controller_interface.Devices(), controller->default_device);
|
||||
|
||||
if (m_plugin.controller_interface.Devices().end() != di)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue