From ca5b351eef448c52950be08580014380ff5c49de Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 25 Jun 2017 14:43:03 +0200 Subject: [PATCH] Fix saved joystick bindings being discarded when running without joystick connected --- extern/oics/ICSInputControlSystem_joystick.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extern/oics/ICSInputControlSystem_joystick.cpp b/extern/oics/ICSInputControlSystem_joystick.cpp index ab219d0745..5beaf27c4a 100644 --- a/extern/oics/ICSInputControlSystem_joystick.cpp +++ b/extern/oics/ICSInputControlSystem_joystick.cpp @@ -78,6 +78,9 @@ namespace ICS // add bindings void InputControlSystem::addJoystickAxisBinding(Control* control, int deviceID, int axis, Control::ControlChangingDirection direction) { + if (std::find(mJoystickIDList.begin(), mJoystickIDList.end(), deviceID) == mJoystickIDList.end()) + mJoystickIDList.push_back(deviceID); + ICS_LOG("\tAdding AxisBinder [axis=" + ToString(axis) + ", deviceID=" + ToString(deviceID) + ", direction=" @@ -93,6 +96,9 @@ namespace ICS void InputControlSystem::addJoystickButtonBinding(Control* control, int deviceID, unsigned int button, Control::ControlChangingDirection direction) { + if (std::find(mJoystickIDList.begin(), mJoystickIDList.end(), deviceID) == mJoystickIDList.end()) + mJoystickIDList.push_back(deviceID); // Hack: add the device to the list so bindings are saved in save() even when joystick is not connected + ICS_LOG("\tAdding JoystickButtonBinder [button=" + ToString(button) + ", deviceID=" + ToString(deviceID) + ", direction="