ControllerInterface: Don't pass m_devices to the backends

Previously, the devices vector would be passed to all backends. They
would then manually push_back to it to add new devices. This was fine
but caused issues when trying to add synchronisation.

Instead, backends now call AddDevice() to fill m_devices so that it is
not accessible from the outside.
This commit is contained in:
Léo Lam 2016-06-12 17:08:04 +02:00
parent 8a1bbaa563
commit fd29e5c4cc
24 changed files with 69 additions and 72 deletions
Source/Core/InputCommon/ControllerInterface

View file

@ -55,31 +55,31 @@ void ControllerInterface::Initialize(void* const hwnd)
m_hwnd = hwnd;
#ifdef CIFACE_USE_DINPUT
ciface::DInput::Init(m_devices, (HWND)hwnd);
ciface::DInput::Init((HWND)hwnd);
#endif
#ifdef CIFACE_USE_XINPUT
ciface::XInput::Init(m_devices);
ciface::XInput::Init();
#endif
#ifdef CIFACE_USE_XLIB
ciface::Xlib::Init(m_devices, hwnd);
ciface::Xlib::Init(hwnd);
#ifdef CIFACE_USE_X11_XINPUT2
ciface::XInput2::Init(m_devices, hwnd);
ciface::XInput2::Init(hwnd);
#endif
#endif
#ifdef CIFACE_USE_OSX
ciface::OSX::Init(m_devices, hwnd);
ciface::OSX::Init(hwnd);
#endif
#ifdef CIFACE_USE_SDL
ciface::SDL::Init(m_devices);
ciface::SDL::Init();
#endif
#ifdef CIFACE_USE_ANDROID
ciface::Android::Init(m_devices);
ciface::Android::Init();
#endif
#ifdef CIFACE_USE_EVDEV
ciface::evdev::Init(m_devices);
ciface::evdev::Init();
#endif
#ifdef CIFACE_USE_PIPES
ciface::Pipes::Init(m_devices);
ciface::Pipes::Init();
#endif
m_is_init = true;
@ -139,6 +139,11 @@ void ControllerInterface::Shutdown()
m_is_init = false;
}
void ControllerInterface::AddDevice(ciface::Core::Device* device)
{
m_devices.push_back(device);
}
//
// UpdateInput
//