From fd29e5c4cc26cd853a03ac7b0e08b367b7070c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 12 Jun 2016 17:08:04 +0200 Subject: 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. --- .../Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp index bf2c1f3e7e..ea059fde73 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp @@ -6,6 +6,7 @@ #include #include +#include "InputCommon/ControllerInterface/ControllerInterface.h" #include "InputCommon/ControllerInterface/DInput/DInput.h" #include "InputCommon/ControllerInterface/DInput/DInputJoystick.h" #include "InputCommon/ControllerInterface/DInput/XInputFilter.h" @@ -16,7 +17,7 @@ namespace DInput { #define DATA_BUFFER_SIZE 32 -void InitJoystick(IDirectInput8* const idi8, std::vector& devices, HWND hwnd) +void InitJoystick(IDirectInput8* const idi8, HWND hwnd) { std::list joysticks; idi8->EnumDevices(DI8DEVCLASS_GAMECTRL, DIEnumDevicesCallback, (LPVOID)&joysticks, @@ -60,7 +61,7 @@ void InitJoystick(IDirectInput8* const idi8, std::vector& devices Joystick* js = new Joystick(/*&*i, */ js_device, name_counts[joystick.tszInstanceName]++); // only add if it has some inputs/outputs if (js->Inputs().size() || js->Outputs().size()) - devices.push_back(js); + g_controller_interface.AddDevice(js); else delete js; } -- cgit v1.2.3