diff --git a/es-core/src/InputManager.cpp b/es-core/src/InputManager.cpp index a4f29bcf6..609f21556 100644 --- a/es-core/src/InputManager.cpp +++ b/es-core/src/InputManager.cpp @@ -179,7 +179,19 @@ void InputManager::deinit() 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) { diff --git a/es-core/src/guis/GuiInputConfig.cpp b/es-core/src/guis/GuiInputConfig.cpp index 0a8729129..f90d9d409 100755 --- a/es-core/src/guis/GuiInputConfig.cpp +++ b/es-core/src/guis/GuiInputConfig.cpp @@ -350,8 +350,7 @@ bool GuiInputConfig::assign(Input input, int inputId) // Input is from InputConfig* mTargetConfig. // If this input is mapped to something other than "nothing" or the current row, - // generate an error. - // (If it's the same as what it was before, allow it.) + // generate an error. (If it's the same as what it was before, allow it.) if (mTargetConfig->getMappedTo(input).size() > 0 && !mTargetConfig->isMappedTo(GUI_INPUT_CONFIG_LIST[inputId].name, input) && strcmp(GUI_INPUT_CONFIG_LIST[inputId].name, "HotKeyEnable") != 0) { diff --git a/es-core/src/guis/GuiInputConfig.h b/es-core/src/guis/GuiInputConfig.h index 151e0f8b2..0be3f1eb3 100644 --- a/es-core/src/guis/GuiInputConfig.h +++ b/es-core/src/guis/GuiInputConfig.h @@ -49,7 +49,7 @@ private: std::shared_ptr mSubtitle1; std::shared_ptr mSubtitle2; std::shared_ptr mList; - std::vector< std::shared_ptr > mMappings; + std::vector> mMappings; std::shared_ptr mButtonGrid; InputConfig* mTargetConfig;