mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Fixed an issue where the keyboard was counted as a joystick.
This commit is contained in:
parent
1550c48187
commit
d9f00ec582
|
@ -179,7 +179,19 @@ void InputManager::deinit()
|
||||||
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InputManager::getNumJoysticks() { return (int)mJoysticks.size(); }
|
int InputManager::getNumJoysticks()
|
||||||
|
{
|
||||||
|
int numJoysticks = 0;
|
||||||
|
|
||||||
|
// This is a workaround to exclude the keyboard (ID -1) from the total joystick count.
|
||||||
|
// It's incorrectly added when configuring the keyboard in GuiInputConfig, but I've
|
||||||
|
// been unable to find a proper fix to not having it added to mJoysticks.
|
||||||
|
for (auto it = mJoysticks.cbegin(); it != mJoysticks.cend(); it++) {
|
||||||
|
if ((*it).first >= 0)
|
||||||
|
numJoysticks += 1;
|
||||||
|
}
|
||||||
|
return numJoysticks;
|
||||||
|
}
|
||||||
|
|
||||||
int InputManager::getAxisCountByDevice(SDL_JoystickID id)
|
int InputManager::getAxisCountByDevice(SDL_JoystickID id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -350,8 +350,7 @@ bool GuiInputConfig::assign(Input input, int inputId)
|
||||||
// Input is from InputConfig* mTargetConfig.
|
// Input is from InputConfig* mTargetConfig.
|
||||||
|
|
||||||
// If this input is mapped to something other than "nothing" or the current row,
|
// If this input is mapped to something other than "nothing" or the current row,
|
||||||
// generate an error.
|
// generate an error. (If it's the same as what it was before, allow it.)
|
||||||
// (If it's the same as what it was before, allow it.)
|
|
||||||
if (mTargetConfig->getMappedTo(input).size() > 0 &&
|
if (mTargetConfig->getMappedTo(input).size() > 0 &&
|
||||||
!mTargetConfig->isMappedTo(GUI_INPUT_CONFIG_LIST[inputId].name, input) &&
|
!mTargetConfig->isMappedTo(GUI_INPUT_CONFIG_LIST[inputId].name, input) &&
|
||||||
strcmp(GUI_INPUT_CONFIG_LIST[inputId].name, "HotKeyEnable") != 0) {
|
strcmp(GUI_INPUT_CONFIG_LIST[inputId].name, "HotKeyEnable") != 0) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ private:
|
||||||
std::shared_ptr<TextComponent> mSubtitle1;
|
std::shared_ptr<TextComponent> mSubtitle1;
|
||||||
std::shared_ptr<TextComponent> mSubtitle2;
|
std::shared_ptr<TextComponent> mSubtitle2;
|
||||||
std::shared_ptr<ComponentList> mList;
|
std::shared_ptr<ComponentList> mList;
|
||||||
std::vector< std::shared_ptr<TextComponent> > mMappings;
|
std::vector<std::shared_ptr<TextComponent>> mMappings;
|
||||||
std::shared_ptr<ComponentGrid> mButtonGrid;
|
std::shared_ptr<ComponentGrid> mButtonGrid;
|
||||||
|
|
||||||
InputConfig* mTargetConfig;
|
InputConfig* mTargetConfig;
|
||||||
|
|
Loading…
Reference in a new issue