1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-02-03 18:14:01 +00:00

Attempt to fix joystick enabled/disabled state

This commit is contained in:
fgenesis 2016-07-19 02:45:56 +02:00
parent bff072039a
commit 3de004262b
4 changed files with 10 additions and 5 deletions

View file

@ -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();
};

View file

@ -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;

View file

@ -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)

View file

@ -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);