diff --git a/Aquaria/DSQ.h b/Aquaria/DSQ.h index f687377..6983dc2 100644 --- a/Aquaria/DSQ.h +++ b/Aquaria/DSQ.h @@ -554,11 +554,11 @@ protected: void modifyDt(float &dt); - void fixupJoysticks(); virtual void onJoystickAdded(int deviceID); virtual void onJoystickRemoved(int instanceID); public: + void fixupJoysticks(); void initActionButtons(); void importActionButtons(); }; diff --git a/Aquaria/UserSettings.cpp b/Aquaria/UserSettings.cpp index 9f016b9..fafd619 100644 --- a/Aquaria/UserSettings.cpp +++ b/Aquaria/UserSettings.cpp @@ -595,10 +595,9 @@ void UserSettings::apply() j->deadZone1 = as.joycfg.s1dead; j->deadZone2 = as.joycfg.s2dead; } - as.updateJoystick(); } - dsq->initActionButtons(); + dsq->fixupJoysticks(); core->debugLogActive = system.debugLogOn; diff --git a/BBGE/ActionSet.cpp b/BBGE/ActionSet.cpp index 7077b9f..9ad06cc 100644 --- a/BBGE/ActionSet.cpp +++ b/BBGE/ActionSet.cpp @@ -122,9 +122,13 @@ void ActionSet::updateJoystick() if(reassign) assignJoystickByName(true); + // Enable joystick if used by this ActionSet. + // There might be other ActionSets that are also set to this + // joystick but disabled, so we can't just do + // j->setEnabled(enabled) here. Joystick *j = core->getJoystick(joystickID); - if(j) - j->setEnabled(enabled); + if(j && enabled) + j->setEnabled(true); } ActionInput *ActionSet::getActionInputByName(const std::string &name) diff --git a/BBGE/ActionSet.h b/BBGE/ActionSet.h index f40683f..49d9929 100644 --- a/BBGE/ActionSet.h +++ b/BBGE/ActionSet.h @@ -52,6 +52,8 @@ public: void clearActions(); int assignJoystickByName(bool force); // -1 if no such joystick found void assignJoystickIdx(int idx, bool updateValues); + + // note: this only ENABLES joysticks if they are needed, but never disables any void updateJoystick(); ActionInput *addActionInput(const std::string &name);