diff options
author | fuzzard <fuzzard@users.noreply.github.com> | 2024-02-15 17:53:47 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-15 17:53:47 +1000 |
commit | 987f2d028255115d6c9ae4ed73ffdcd66777d873 (patch) | |
tree | 22d950f1f19ab90a7bea60f839f39874d095f744 | |
parent | 1de048630cec0cb9f190fb3e1e9d3c90c669b1bf (diff) | |
parent | 26f508f88c4cb3e6b0508386e300385f7e977317 (diff) |
Merge pull request #24707 from garbear/revert-android
Revert Android joystick fixes
27 files changed, 172 insertions, 946 deletions
diff --git a/xbmc/games/controllers/CMakeLists.txt b/xbmc/games/controllers/CMakeLists.txt index b54f5c0604..b00e1caa4a 100644 --- a/xbmc/games/controllers/CMakeLists.txt +++ b/xbmc/games/controllers/CMakeLists.txt @@ -1,9 +1,7 @@ set(SOURCES Controller.cpp ControllerLayout.cpp ControllerManager.cpp - ControllerTranslator.cpp - DefaultController.cpp -) + ControllerTranslator.cpp) set(HEADERS Controller.h ControllerDefinitions.h @@ -11,8 +9,6 @@ set(HEADERS Controller.h ControllerLayout.h ControllerManager.h ControllerTranslator.h - ControllerTypes.h - DefaultController.h -) + ControllerTypes.h) core_add_library(games_controller) diff --git a/xbmc/games/controllers/DefaultController.cpp b/xbmc/games/controllers/DefaultController.cpp deleted file mode 100644 index 58bb464e3d..0000000000 --- a/xbmc/games/controllers/DefaultController.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2024 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#include "DefaultController.h" - -using namespace KODI; -using namespace GAME; - -const char* CDefaultController::FEATURE_A = "a"; -const char* CDefaultController::FEATURE_B = "b"; -const char* CDefaultController::FEATURE_X = "x"; -const char* CDefaultController::FEATURE_Y = "y"; -const char* CDefaultController::FEATURE_START = "start"; -const char* CDefaultController::FEATURE_BACK = "back"; -const char* CDefaultController::FEATURE_GUIDE = "guide"; -const char* CDefaultController::FEATURE_UP = "up"; -const char* CDefaultController::FEATURE_RIGHT = "right"; -const char* CDefaultController::FEATURE_DOWN = "down"; -const char* CDefaultController::FEATURE_LEFT = "left"; -const char* CDefaultController::FEATURE_LEFT_THUMB = "leftthumb"; -const char* CDefaultController::FEATURE_RIGHT_THUMB = "rightthumb"; -const char* CDefaultController::FEATURE_LEFT_BUMPER = "leftbumper"; -const char* CDefaultController::FEATURE_RIGHT_BUMPER = "rightbumper"; -const char* CDefaultController::FEATURE_LEFT_TRIGGER = "lefttrigger"; -const char* CDefaultController::FEATURE_RIGHT_TRIGGER = "righttrigger"; -const char* CDefaultController::FEATURE_LEFT_STICK = "leftstick"; -const char* CDefaultController::FEATURE_RIGHT_STICK = "rightstick"; -const char* CDefaultController::FEATURE_LEFT_MOTOR = "leftmotor"; -const char* CDefaultController::FEATURE_RIGHT_MOTOR = "rightmotor"; diff --git a/xbmc/games/controllers/DefaultController.h b/xbmc/games/controllers/DefaultController.h deleted file mode 100644 index f82ce49748..0000000000 --- a/xbmc/games/controllers/DefaultController.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2024 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -namespace KODI -{ -namespace GAME -{ -class CDefaultController -{ -public: - // Face buttons - static const char* FEATURE_A; - static const char* FEATURE_B; - static const char* FEATURE_X; - static const char* FEATURE_Y; - static const char* FEATURE_START; - static const char* FEATURE_BACK; - static const char* FEATURE_GUIDE; - static const char* FEATURE_UP; - static const char* FEATURE_RIGHT; - static const char* FEATURE_DOWN; - static const char* FEATURE_LEFT; - static const char* FEATURE_LEFT_THUMB; - static const char* FEATURE_RIGHT_THUMB; - - // Shoulder buttons - static const char* FEATURE_LEFT_BUMPER; - static const char* FEATURE_RIGHT_BUMPER; - - // Triggers - static const char* FEATURE_LEFT_TRIGGER; - static const char* FEATURE_RIGHT_TRIGGER; - - // Analog sticks - static const char* FEATURE_LEFT_STICK; - static const char* FEATURE_RIGHT_STICK; - - // Haptics - static const char* FEATURE_LEFT_MOTOR; - static const char* FEATURE_RIGHT_MOTOR; -}; -} // namespace GAME -} // namespace KODI diff --git a/xbmc/games/controllers/windows/GUIConfigurationWizard.cpp b/xbmc/games/controllers/windows/GUIConfigurationWizard.cpp index ce980cf7c3..e2c7130c58 100644 --- a/xbmc/games/controllers/windows/GUIConfigurationWizard.cpp +++ b/xbmc/games/controllers/windows/GUIConfigurationWizard.cpp @@ -293,8 +293,8 @@ bool CGUIConfigurationWizard::MapPrimitive(JOYSTICK::IButtonMap* buttonMap, } else { - CLog::Log(LOGDEBUG, "{}: mapping feature \"{}\" for device {} to \"{}\"", - m_strControllerId, feature.Name(), buttonMap->Location(), primitive.ToString()); + CLog::Log(LOGDEBUG, "{}: mapping feature \"{}\" for device {}", m_strControllerId, + feature.Name(), buttonMap->Location()); switch (feature.Type()) { diff --git a/xbmc/input/joysticks/DriverPrimitive.cpp b/xbmc/input/joysticks/DriverPrimitive.cpp index 3f1a5ab895..fa8f7c9592 100644 --- a/xbmc/input/joysticks/DriverPrimitive.cpp +++ b/xbmc/input/joysticks/DriverPrimitive.cpp @@ -8,9 +8,6 @@ #include "DriverPrimitive.h" -#include "input/keyboard/KeyboardTranslator.h" -#include "utils/StringUtils.h" - #include <utility> using namespace KODI; @@ -202,70 +199,3 @@ bool CDriverPrimitive::IsValid(void) const return false; } - -std::string CDriverPrimitive::ToString() const -{ - switch (m_type) - { - case PRIMITIVE_TYPE::BUTTON: - return StringUtils::Format("button {}", m_driverIndex); - case PRIMITIVE_TYPE::MOTOR: - return StringUtils::Format("motor {}", m_driverIndex); - case PRIMITIVE_TYPE::MOUSE_BUTTON: - return StringUtils::Format("mouse button {}", m_driverIndex); - case PRIMITIVE_TYPE::HAT: - { - switch (m_hatDirection) - { - case HAT_DIRECTION::UP: - return StringUtils::Format("hat {} up", m_driverIndex); - case HAT_DIRECTION::DOWN: - return StringUtils::Format("hat {} down", m_driverIndex); - case HAT_DIRECTION::RIGHT: - return StringUtils::Format("hat {} right", m_driverIndex); - case HAT_DIRECTION::LEFT: - return StringUtils::Format("hat {} left", m_driverIndex); - default: - break; - } - break; - } - case PRIMITIVE_TYPE::SEMIAXIS: - { - switch (m_semiAxisDirection) - { - case SEMIAXIS_DIRECTION::POSITIVE: - return StringUtils::Format("semiaxis +{}", m_driverIndex); - case SEMIAXIS_DIRECTION::NEGATIVE: - return StringUtils::Format("semiaxis -{}", m_driverIndex); - default: - break; - } - break; - } - case PRIMITIVE_TYPE::KEY: - return StringUtils::Format("key {}", - KEYBOARD::CKeyboardTranslator::TranslateKeycode(m_keycode)); - case PRIMITIVE_TYPE::RELATIVE_POINTER: - { - switch (m_pointerDirection) - { - case RELATIVE_POINTER_DIRECTION::UP: - return StringUtils::Format("pointer {} up", m_driverIndex); - case RELATIVE_POINTER_DIRECTION::DOWN: - return StringUtils::Format("pointer {} down", m_driverIndex); - case RELATIVE_POINTER_DIRECTION::RIGHT: - return StringUtils::Format("pointer {} right", m_driverIndex); - case RELATIVE_POINTER_DIRECTION::LEFT: - return StringUtils::Format("pointer {} left", m_driverIndex); - default: - break; - } - break; - } - default: - break; - } - - return ""; -} diff --git a/xbmc/input/joysticks/DriverPrimitive.h b/xbmc/input/joysticks/DriverPrimitive.h index e4edea9f26..2d8b153fe0 100644 --- a/xbmc/input/joysticks/DriverPrimitive.h +++ b/xbmc/input/joysticks/DriverPrimitive.h @@ -180,13 +180,6 @@ public: */ bool IsValid(void) const; - /*! - * \brief Convert primitive to a string suitable for logging - * - * \return The primitive as described by a short string, or empty if invalid - */ - std::string ToString() const; - private: PRIMITIVE_TYPE m_type = PRIMITIVE_TYPE::UNKNOWN; unsigned int m_driverIndex = 0; diff --git a/xbmc/input/joysticks/JoystickEasterEgg.cpp b/xbmc/input/joysticks/JoystickEasterEgg.cpp index a25c4baf78..ab02ba0bde 100644 --- a/xbmc/input/joysticks/JoystickEasterEgg.cpp +++ b/xbmc/input/joysticks/JoystickEasterEgg.cpp @@ -12,7 +12,6 @@ #include "games/GameServices.h" #include "games/GameSettings.h" #include "games/controllers/ControllerIDs.h" -#include "games/controllers/DefaultController.h" #include "guilib/GUIAudioManager.h" #include "guilib/WindowIDs.h" @@ -23,16 +22,16 @@ const std::map<std::string, std::vector<FeatureName>> CJoystickEasterEgg::m_sequ { DEFAULT_CONTROLLER_ID, { - GAME::CDefaultController::FEATURE_UP, - GAME::CDefaultController::FEATURE_UP, - GAME::CDefaultController::FEATURE_DOWN, - GAME::CDefaultController::FEATURE_DOWN, - GAME::CDefaultController::FEATURE_LEFT, - GAME::CDefaultController::FEATURE_RIGHT, - GAME::CDefaultController::FEATURE_LEFT, - GAME::CDefaultController::FEATURE_RIGHT, - GAME::CDefaultController::FEATURE_B, - GAME::CDefaultController::FEATURE_A, + "up", + "up", + "down", + "down", + "left", + "right", + "left", + "right", + "b", + "a", }, }, { diff --git a/xbmc/input/joysticks/generic/ButtonMapping.cpp b/xbmc/input/joysticks/generic/ButtonMapping.cpp index 03faf73926..4b5dd8aca5 100644 --- a/xbmc/input/joysticks/generic/ButtonMapping.cpp +++ b/xbmc/input/joysticks/generic/ButtonMapping.cpp @@ -451,34 +451,31 @@ bool CButtonMapping::MapPrimitive(const CDriverPrimitive& primitive) { bool bHandled = false; - if (m_buttonMap->IsIgnored(primitive)) + auto now = std::chrono::steady_clock::now(); + + bool bTimeoutElapsed = true; + + if (m_buttonMapper->NeedsCooldown()) + bTimeoutElapsed = (now >= m_lastAction + std::chrono::milliseconds(MAPPING_COOLDOWN_MS)); + + if (bTimeoutElapsed) + { + bHandled = m_buttonMapper->MapPrimitive(m_buttonMap, m_keymap, primitive); + + if (bHandled) + m_lastAction = std::chrono::steady_clock::now(); + } + else if (m_buttonMap->IsIgnored(primitive)) { bHandled = true; } else { - auto now = std::chrono::steady_clock::now(); - - bool bTimeoutElapsed = true; - - if (m_buttonMapper->NeedsCooldown()) - bTimeoutElapsed = (now >= m_lastAction + std::chrono::milliseconds(MAPPING_COOLDOWN_MS)); + auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now - m_lastAction); - if (bTimeoutElapsed) - { - bHandled = m_buttonMapper->MapPrimitive(m_buttonMap, m_keymap, primitive); - - if (bHandled) - m_lastAction = std::chrono::steady_clock::now(); - } - else - { - auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now - m_lastAction); - - CLog::Log(LOGDEBUG, "Button mapping: rapid input after {}ms dropped for profile \"{}\"", - duration.count(), m_buttonMapper->ControllerID()); - bHandled = true; - } + CLog::Log(LOGDEBUG, "Button mapping: rapid input after {}ms dropped for profile \"{}\"", + duration.count(), m_buttonMapper->ControllerID()); + bHandled = true; } return bHandled; diff --git a/xbmc/input/keyboard/KeyboardStat.cpp b/xbmc/input/keyboard/KeyboardStat.cpp index d6784c920c..5e390ee562 100644 --- a/xbmc/input/keyboard/KeyboardStat.cpp +++ b/xbmc/input/keyboard/KeyboardStat.cpp @@ -14,7 +14,6 @@ #include "KeyboardStat.h" #include "ServiceBroker.h" -#include "input/keyboard/KeyboardTranslator.h" #include "input/keyboard/KeyboardTypes.h" #include "input/keyboard/XBMC_keytable.h" #include "input/keyboard/XBMC_vkeys.h" @@ -92,9 +91,8 @@ CKey CKeyboardStat::TranslateKey(XBMC_keysym& keysym) const lockingModifiers |= CKey::MODIFIER_SCROLLLOCK; CLog::Log(LOGDEBUG, - "Keyboard: scancode: {:#02x}, sym: {:#04x} ({}), unicode: {:#04x}, modifier: 0x{:x}", - keysym.scancode, keysym.sym, CKeyboardTranslator::TranslateKeycode(keysym.sym), - keysym.unicode, keysym.mod); + "Keyboard: scancode: {:#02x}, sym: {:#04x}, unicode: {:#04x}, modifier: 0x{:x}", + keysym.scancode, keysym.sym, keysym.unicode, keysym.mod); // The keysym.unicode is usually valid, even if it is zero. A zero // unicode just means this is a non-printing keypress. The ascii and diff --git a/xbmc/input/keyboard/KeyboardTranslator.cpp b/xbmc/input/keyboard/KeyboardTranslator.cpp index 0cbb4871bb..fd79632bbb 100644 --- a/xbmc/input/keyboard/KeyboardTranslator.cpp +++ b/xbmc/input/keyboard/KeyboardTranslator.cpp @@ -491,5 +491,5 @@ const char* CKeyboardTranslator::TranslateKeycode(XBMCKey keycode) break; } - return "unknown"; + return ""; } diff --git a/xbmc/peripherals/Peripherals.cpp b/xbmc/peripherals/Peripherals.cpp index 1276cf52d6..e282fbf700 100644 --- a/xbmc/peripherals/Peripherals.cpp +++ b/xbmc/peripherals/Peripherals.cpp @@ -917,7 +917,7 @@ void CPeripherals::ResetButtonMaps(const std::string& controllerId) PeripheralAddonPtr addon; if (addonBus->GetAddonWithButtonMap(peripheral.get(), addon)) { - CAddonButtonMap buttonMap(peripheral.get(), addon, controllerId, *this); + CAddonButtonMap buttonMap(peripheral.get(), addon, controllerId); buttonMap.Reset(); } } diff --git a/xbmc/peripherals/addons/AddonButtonMap.cpp b/xbmc/peripherals/addons/AddonButtonMap.cpp index 0471d293eb..e9764ba81c 100644 --- a/xbmc/peripherals/addons/AddonButtonMap.cpp +++ b/xbmc/peripherals/addons/AddonButtonMap.cpp @@ -10,7 +10,6 @@ #include "PeripheralAddonTranslator.h" #include "input/joysticks/JoystickUtils.h" -#include "peripherals/Peripherals.h" #include "peripherals/devices/Peripheral.h" #include "utils/log.h" @@ -25,9 +24,8 @@ using namespace PERIPHERALS; CAddonButtonMap::CAddonButtonMap(CPeripheral* device, const std::weak_ptr<CPeripheralAddon>& addon, - const std::string& strControllerId, - CPeripherals& manager) - : m_device(device), m_addon(addon), m_strControllerId(strControllerId), m_manager(manager) + const std::string& strControllerId) + : m_device(device), m_addon(addon), m_strControllerId(strControllerId) { auto peripheralAddon = m_addon.lock(); assert(peripheralAddon != nullptr); @@ -61,29 +59,6 @@ bool CAddonButtonMap::Load(void) bSuccess |= addon->GetIgnoredPrimitives(m_device, ignoredPrimitives); } - if (features.empty()) - { - // Check if we can initialize a buttonmap from the peripheral bus - PeripheralBusPtr peripheralBus = m_manager.GetBusByType(m_device->GetBusType()); - if (peripheralBus) - { - CLog::Log(LOGDEBUG, - "Buttonmap not found for {}, attempting to initialize from peripheral bus", - m_device->Location()); - if (peripheralBus->InitializeButtonMap(*m_device, *this)) - { - bSuccess = true; - - if (auto addon = m_addon.lock()) - { - addon->GetAppearance(m_device, controllerAppearance); - addon->GetFeatures(m_device, m_strControllerId, features); - addon->GetIgnoredPrimitives(m_device, ignoredPrimitives); - } - } - } - } - // GetFeatures() was changed to always return false if no features were // retrieved. Check here, just in case its contract is changed or violated in // the future. diff --git a/xbmc/peripherals/addons/AddonButtonMap.h b/xbmc/peripherals/addons/AddonButtonMap.h index 7bbc91947f..b4b6463fee 100644 --- a/xbmc/peripherals/addons/AddonButtonMap.h +++ b/xbmc/peripherals/addons/AddonButtonMap.h @@ -18,7 +18,6 @@ namespace PERIPHERALS { class CPeripheral; -class CPeripherals; /*! * \ingroup peripherals @@ -28,8 +27,7 @@ class CAddonButtonMap : public KODI::JOYSTICK::IButtonMap public: CAddonButtonMap(CPeripheral* device, const std::weak_ptr<CPeripheralAddon>& addon, - const std::string& strControllerId, - CPeripherals& manager); + const std::string& strControllerId); ~CAddonButtonMap(void) override; @@ -135,7 +133,6 @@ private: CPeripheral* const m_device; const std::weak_ptr<CPeripheralAddon> m_addon; const std::string m_strControllerId; - CPeripherals& m_manager; // Button map state std::string m_controllerAppearance; diff --git a/xbmc/peripherals/addons/AddonButtonMapping.cpp b/xbmc/peripherals/addons/AddonButtonMapping.cpp index 0da424ab27..3be55df3f6 100644 --- a/xbmc/peripherals/addons/AddonButtonMapping.cpp +++ b/xbmc/peripherals/addons/AddonButtonMapping.cpp @@ -33,7 +33,7 @@ CAddonButtonMapping::CAddonButtonMapping(CPeripherals& manager, else { const std::string controllerId = mapper->ControllerID(); - m_buttonMap = std::make_unique<CAddonButtonMap>(peripheral, addon, controllerId, manager); + m_buttonMap = std::make_unique<CAddonButtonMap>(peripheral, addon, controllerId); if (m_buttonMap->Load()) { KEYMAP::IKeymap* keymap = peripheral->GetKeymap(controllerId); diff --git a/xbmc/peripherals/addons/AddonInputHandling.cpp b/xbmc/peripherals/addons/AddonInputHandling.cpp index 4643e84e3f..088d01a2f1 100644 --- a/xbmc/peripherals/addons/AddonInputHandling.cpp +++ b/xbmc/peripherals/addons/AddonInputHandling.cpp @@ -24,38 +24,28 @@ using namespace KODI; using namespace JOYSTICK; using namespace PERIPHERALS; -CAddonInputHandling::CAddonInputHandling(CPeripherals& manager, - CPeripheral* peripheral, +CAddonInputHandling::CAddonInputHandling(CPeripheral* peripheral, std::shared_ptr<CPeripheralAddon> addon, IInputHandler* handler, IDriverReceiver* receiver) - : m_manager(manager), - m_peripheral(peripheral), + : m_peripheral(peripheral), m_addon(std::move(addon)), m_joystickInputHandler(handler), m_joystickDriverReceiver(receiver) { } -CAddonInputHandling::CAddonInputHandling(CPeripherals& manager, - CPeripheral* peripheral, +CAddonInputHandling::CAddonInputHandling(CPeripheral* peripheral, std::shared_ptr<CPeripheralAddon> addon, KEYBOARD::IKeyboardInputHandler* handler) - : m_manager(manager), - m_peripheral(peripheral), - m_addon(std::move(addon)), - m_keyboardInputHandler(handler) + : m_peripheral(peripheral), m_addon(std::move(addon)), m_keyboardInputHandler(handler) { } -CAddonInputHandling::CAddonInputHandling(CPeripherals& manager, - CPeripheral* peripheral, +CAddonInputHandling::CAddonInputHandling(CPeripheral* peripheral, std::shared_ptr<CPeripheralAddon> addon, MOUSE::IMouseInputHandler* handler) - : m_manager(manager), - m_peripheral(peripheral), - m_addon(std::move(addon)), - m_mouseInputHandler(handler) + : m_peripheral(peripheral), m_addon(std::move(addon)), m_mouseInputHandler(handler) { } @@ -79,7 +69,7 @@ bool CAddonInputHandling::Load() controllerId = m_mouseInputHandler->ControllerID(); if (!controllerId.empty()) - m_buttonMap = std::make_unique<CAddonButtonMap>(m_peripheral, m_addon, controllerId, m_manager); + m_buttonMap = std::make_unique<CAddonButtonMap>(m_peripheral, m_addon, controllerId); if (m_buttonMap && m_buttonMap->Load()) { diff --git a/xbmc/peripherals/addons/AddonInputHandling.h b/xbmc/peripherals/addons/AddonInputHandling.h index 19816a6ca5..e5c98e3748 100644 --- a/xbmc/peripherals/addons/AddonInputHandling.h +++ b/xbmc/peripherals/addons/AddonInputHandling.h @@ -38,7 +38,6 @@ class IMouseInputHandler; namespace PERIPHERALS { class CPeripheral; -class CPeripherals; class CPeripheralAddon; /*! @@ -50,19 +49,16 @@ class CAddonInputHandling : public KODI::JOYSTICK::IDriverHandler, public KODI::MOUSE::IMouseDriverHandler { public: - CAddonInputHandling(CPeripherals& manager, - CPeripheral* peripheral, + CAddonInputHandling(CPeripheral* peripheral, std::shared_ptr<CPeripheralAddon> addon, KODI::JOYSTICK::IInputHandler* handler, KODI::JOYSTICK::IDriverReceiver* receiver); - CAddonInputHandling(CPeripherals& manager, - CPeripheral* peripheral, + CAddonInputHandling(CPeripheral* peripheral, std::shared_ptr<CPeripheralAddon> addon, KODI::KEYBOARD::IKeyboardInputHandler* handler); - CAddonInputHandling(CPeripherals& manager, - CPeripheral* peripheral, + CAddonInputHandling(CPeripheral* peripheral, std::shared_ptr<CPeripheralAddon> addon, KODI::MOUSE::IMouseInputHandler* handler); @@ -93,7 +89,6 @@ public: private: // Construction parameters - CPeripherals& m_manager; CPeripheral* const m_peripheral; const std::shared_ptr<CPeripheralAddon> m_addon; KODI::JOYSTICK::IInputHandler* const m_joystickInputHandler{nullptr}; diff --git a/xbmc/peripherals/bus/PeripheralBus.h b/xbmc/peripherals/bus/PeripheralBus.h index 33594a0faa..424d012d9f 100644 --- a/xbmc/peripherals/bus/PeripheralBus.h +++ b/xbmc/peripherals/bus/PeripheralBus.h @@ -17,14 +17,6 @@ class CFileItemList; -namespace KODI -{ -namespace JOYSTICK -{ -class IButtonMap; -} // namespace JOYSTICK -} // namespace KODI - namespace PERIPHERALS { class CPeripheral; @@ -68,15 +60,6 @@ public: virtual bool InitializeProperties(CPeripheral& peripheral); /*! - * \brief Initialize a joystick buttonmap, if possible - */ - virtual bool InitializeButtonMap(const CPeripheral& peripheral, - KODI::JOYSTICK::IButtonMap& buttonMap) const - { - return false; - } - - /*! * @brief Get the instance of the peripheral at the given location. * @param strLocation The location. * @return The peripheral or NULL if it wasn't found. diff --git a/xbmc/peripherals/devices/Peripheral.cpp b/xbmc/peripherals/devices/Peripheral.cpp index bb00d516a3..ff9910c2ef 100644 --- a/xbmc/peripherals/devices/Peripheral.cpp +++ b/xbmc/peripherals/devices/Peripheral.cpp @@ -597,7 +597,7 @@ void CPeripheral::RegisterInputHandler(IInputHandler* handler, bool bPromiscuous if (addon) { std::unique_ptr<CAddonInputHandling> addonInput = std::make_unique<CAddonInputHandling>( - m_manager, this, std::move(addon), handler, GetDriverReceiver()); + this, std::move(addon), handler, GetDriverReceiver()); if (addonInput->Load()) { RegisterJoystickDriverHandler(addonInput.get(), bPromiscuous); @@ -638,7 +638,7 @@ void CPeripheral::RegisterKeyboardHandler(KEYBOARD::IKeyboardInputHandler* handl if (addon) { std::unique_ptr<CAddonInputHandling> addonInput = - std::make_unique<CAddonInputHandling>(m_manager, this, std::move(addon), handler); + std::make_unique<CAddonInputHandling>(this, std::move(addon), handler); if (addonInput->Load()) keyboardDriverHandler = std::move(addonInput); } @@ -689,7 +689,7 @@ void CPeripheral::RegisterMouseHandler(MOUSE::IMouseInputHandler* handler, if (addon) { std::unique_ptr<CAddonInputHandling> addonInput = - std::make_unique<CAddonInputHandling>(m_manager, this, std::move(addon), handler); + std::make_unique<CAddonInputHandling>(this, std::move(addon), handler); if (addonInput->Load()) mouseDriverHandler = std::move(addonInput); } diff --git a/xbmc/peripherals/devices/PeripheralJoystick.cpp b/xbmc/peripherals/devices/PeripheralJoystick.cpp index c5285c245e..a6029561d6 100644 --- a/xbmc/peripherals/devices/PeripheralJoystick.cpp +++ b/xbmc/peripherals/devices/PeripheralJoystick.cpp @@ -92,8 +92,7 @@ bool CPeripheralJoystick::InitialiseFeature(const PeripheralFeature feature) if (bSuccess) { - m_buttonMap = - std::make_unique<CAddonButtonMap>(this, addon, DEFAULT_CONTROLLER_ID, m_manager); + m_buttonMap = std::make_unique<CAddonButtonMap>(this, addon, DEFAULT_CONTROLLER_ID); if (m_buttonMap->Load()) { InitializeDeadzoneFiltering(*m_buttonMap); diff --git a/xbmc/platform/android/activity/AndroidKey.cpp b/xbmc/platform/android/activity/AndroidKey.cpp index 3467ed6420..13e23b80a4 100644 --- a/xbmc/platform/android/activity/AndroidKey.cpp +++ b/xbmc/platform/android/activity/AndroidKey.cpp @@ -13,8 +13,6 @@ #include "input/keyboard/XBMC_keysym.h" #include "windowing/android/WinSystemAndroid.h" -#include "platform/android/peripherals/AndroidJoystickTranslator.h" - #include <androidjni/KeyCharacterMap.h> typedef struct { @@ -263,46 +261,38 @@ bool CAndroidKey::onKeyboardEvent(AInputEvent *event) switch (action) { case AKEY_EVENT_ACTION_DOWN: - CXBMCApp::android_printf("CAndroidKey: key down (dev: %d; src: %d; code: %d (%s); repeat: " - "%d; flags: 0x%0X; alt: %s; shift: %s; sym: %s)", - deviceId, source, keycode, - PERIPHERALS::CAndroidJoystickTranslator::TranslateKeyCode(keycode), - repeat, flags, (state & AMETA_ALT_ON) ? "yes" : "no", - (state & AMETA_SHIFT_ON) ? "yes" : "no", - (state & AMETA_SYM_ON) ? "yes" : "no"); + CXBMCApp::android_printf( + "CAndroidKey: key down (dev: %d; src: %d; code: %d; repeat: %d; flags: 0x%0X; alt: %s; " + "shift: %s; sym: %s)", + deviceId, source, keycode, repeat, flags, (state & AMETA_ALT_ON) ? "yes" : "no", + (state & AMETA_SHIFT_ON) ? "yes" : "no", (state & AMETA_SYM_ON) ? "yes" : "no"); XBMC_Key((uint8_t)keycode, sym, modifiers, unicode, false); break; case AKEY_EVENT_ACTION_UP: - CXBMCApp::android_printf("CAndroidKey: key up (dev: %d; src: %d; code: %d (%s); repeat: %d; " - "flags: 0x%0X; alt: %s; shift: %s; sym: %s)", - deviceId, source, keycode, - PERIPHERALS::CAndroidJoystickTranslator::TranslateKeyCode(keycode), - repeat, flags, (state & AMETA_ALT_ON) ? "yes" : "no", - (state & AMETA_SHIFT_ON) ? "yes" : "no", - (state & AMETA_SYM_ON) ? "yes" : "no"); + CXBMCApp::android_printf( + "CAndroidKey: key up (dev: %d; src: %d; code: %d; repeat: %d; flags: 0x%0X; alt: %s; " + "shift: %s; sym: %s)", + deviceId, source, keycode, repeat, flags, (state & AMETA_ALT_ON) ? "yes" : "no", + (state & AMETA_SHIFT_ON) ? "yes" : "no", (state & AMETA_SYM_ON) ? "yes" : "no"); XBMC_Key((uint8_t)keycode, sym, modifiers, unicode, true); break; case AKEY_EVENT_ACTION_MULTIPLE: - CXBMCApp::android_printf("CAndroidKey: key multiple (dev: %d; src: %d; code: %d (%s); " - "repeat: %d; flags: 0x%0X; alt: %s; shift: %s; sym: %s)", - deviceId, source, keycode, - PERIPHERALS::CAndroidJoystickTranslator::TranslateKeyCode(keycode), - repeat, flags, (state & AMETA_ALT_ON) ? "yes" : "no", - (state & AMETA_SHIFT_ON) ? "yes" : "no", - (state & AMETA_SYM_ON) ? "yes" : "no"); + CXBMCApp::android_printf( + "CAndroidKey: key multiple (dev: %d; src: %d; code: %d; repeat: %d; flags: 0x%0X; alt: " + "%s; shift: %s; sym: %s)", + deviceId, source, keycode, repeat, flags, (state & AMETA_ALT_ON) ? "yes" : "no", + (state & AMETA_SHIFT_ON) ? "yes" : "no", (state & AMETA_SYM_ON) ? "yes" : "no"); return false; break; default: - CXBMCApp::android_printf("CAndroidKey: unknown key (dev: %d; src: %d; code: %d (%s); repeat: " - "%d; flags: 0x%0X; alt: %s; shift: %s; sym: %s)", - deviceId, source, keycode, - PERIPHERALS::CAndroidJoystickTranslator::TranslateKeyCode(keycode), - repeat, flags, (state & AMETA_ALT_ON) ? "yes" : "no", - (state & AMETA_SHIFT_ON) ? "yes" : "no", - (state & AMETA_SYM_ON) ? "yes" : "no"); + CXBMCApp::android_printf( + "CAndroidKey: unknown key (dev: %d; src: %d; code: %d; repeat: %d; flags: 0x%0X; alt: " + "%s; shift: %s; sym: %s)", + deviceId, source, keycode, repeat, flags, (state & AMETA_ALT_ON) ? "yes" : "no", + (state & AMETA_SHIFT_ON) ? "yes" : "no", (state & AMETA_SYM_ON) ? "yes" : "no"); return false; break; } diff --git a/xbmc/platform/android/activity/EventLoop.cpp b/xbmc/platform/android/activity/EventLoop.cpp index 28af5ec056..ac5fc61565 100644 --- a/xbmc/platform/android/activity/EventLoop.cpp +++ b/xbmc/platform/android/activity/EventLoop.cpp @@ -127,9 +127,7 @@ int32_t CEventLoop::processInput(AInputEvent* event) int32_t source = AInputEvent_getSource(event); // handle joystick input - if (IS_FROM_SOURCE(source, AINPUT_SOURCE_GAMEPAD) || - IS_FROM_SOURCE(source, AINPUT_SOURCE_JOYSTICK) || - IS_FROM_SOURCE(source, AINPUT_SOURCE_KEYBOARD)) + if (IS_FROM_SOURCE(source, AINPUT_SOURCE_GAMEPAD) || IS_FROM_SOURCE(source, AINPUT_SOURCE_JOYSTICK)) { if (m_inputHandler->onJoyStickEvent(event)) return true; diff --git a/xbmc/platform/android/peripherals/AndroidJoystickState.cpp b/xbmc/platform/android/peripherals/AndroidJoystickState.cpp index dcbd569c53..5d898698fc 100644 --- a/xbmc/platform/android/peripherals/AndroidJoystickState.cpp +++ b/xbmc/platform/android/peripherals/AndroidJoystickState.cpp @@ -9,11 +9,6 @@ #include "AndroidJoystickState.h" #include "AndroidJoystickTranslator.h" -#include "games/controllers/ControllerIDs.h" -#include "games/controllers/DefaultController.h" -#include "input/joysticks/DriverPrimitive.h" -#include "input/joysticks/JoystickTypes.h" -#include "input/joysticks/interfaces/IButtonMap.h" #include "utils/StringUtils.h" #include "utils/log.h" @@ -24,97 +19,30 @@ #include <android/input.h> #include <androidjni/View.h> -using namespace KODI; using namespace PERIPHERALS; -namespace +static std::string PrintAxisIds(const std::vector<int>& axisIds) { -// Used to set the appearance of PlayStation controllers -constexpr const char* CONTROLLER_ID_PLAYSTATION = "game.controller.ps.dualanalog"; - -// clang-format off -static const std::vector<int> ButtonKeycodes{ - // add the usual suspects - AKEYCODE_HOME, - AKEYCODE_BACK, - AKEYCODE_DPAD_UP, - AKEYCODE_DPAD_DOWN, - AKEYCODE_DPAD_LEFT, - AKEYCODE_DPAD_RIGHT, - AKEYCODE_DPAD_CENTER, - AKEYCODE_MENU, - AKEYCODE_BUTTON_A, - AKEYCODE_BUTTON_B, - AKEYCODE_BUTTON_C, - AKEYCODE_BUTTON_X, - AKEYCODE_BUTTON_Y, - AKEYCODE_BUTTON_Z, - AKEYCODE_BUTTON_L1, - AKEYCODE_BUTTON_R1, - AKEYCODE_BUTTON_L2, - AKEYCODE_BUTTON_R2, - AKEYCODE_BUTTON_THUMBL, - AKEYCODE_BUTTON_THUMBR, - AKEYCODE_BUTTON_START, - AKEYCODE_BUTTON_SELECT, - AKEYCODE_BUTTON_MODE, - // add generic gamepad buttons for controllers that Android doesn't know - // how to map - AKEYCODE_BUTTON_1, - AKEYCODE_BUTTON_2, - AKEYCODE_BUTTON_3, - AKEYCODE_BUTTON_4, - AKEYCODE_BUTTON_5, - AKEYCODE_BUTTON_6, - AKEYCODE_BUTTON_7, - AKEYCODE_BUTTON_8, - AKEYCODE_BUTTON_9, - AKEYCODE_BUTTON_10, - AKEYCODE_BUTTON_11, - AKEYCODE_BUTTON_12, - AKEYCODE_BUTTON_13, - AKEYCODE_BUTTON_14, - AKEYCODE_BUTTON_15, - AKEYCODE_BUTTON_16, - // only add additional buttons at the end of the list -}; -// clang-format on - -// clang-format off -static const std::vector<int> AxisIDs{ - AMOTION_EVENT_AXIS_HAT_X, - AMOTION_EVENT_AXIS_HAT_Y, - AMOTION_EVENT_AXIS_X, - AMOTION_EVENT_AXIS_Y, - AMOTION_EVENT_AXIS_Z, - AMOTION_EVENT_AXIS_RX, - AMOTION_EVENT_AXIS_RY, - AMOTION_EVENT_AXIS_RZ, - AMOTION_EVENT_AXIS_LTRIGGER, - AMOTION_EVENT_AXIS_RTRIGGER, - AMOTION_EVENT_AXIS_GAS, - AMOTION_EVENT_AXIS_BRAKE, - AMOTION_EVENT_AXIS_THROTTLE, - AMOTION_EVENT_AXIS_RUDDER, - AMOTION_EVENT_AXIS_WHEEL, - AMOTION_EVENT_AXIS_GENERIC_1, - AMOTION_EVENT_AXIS_GENERIC_2, - AMOTION_EVENT_AXIS_GENERIC_3, - AMOTION_EVENT_AXIS_GENERIC_4, - AMOTION_EVENT_AXIS_GENERIC_5, - AMOTION_EVENT_AXIS_GENERIC_6, - AMOTION_EVENT_AXIS_GENERIC_7, - AMOTION_EVENT_AXIS_GENERIC_8, - AMOTION_EVENT_AXIS_GENERIC_9, - AMOTION_EVENT_AXIS_GENERIC_10, - AMOTION_EVENT_AXIS_GENERIC_11, - AMOTION_EVENT_AXIS_GENERIC_12, - AMOTION_EVENT_AXIS_GENERIC_13, - AMOTION_EVENT_AXIS_GENERIC_14, - AMOTION_EVENT_AXIS_GENERIC_15, - AMOTION_EVENT_AXIS_GENERIC_16, -}; -// clang-format on + if (axisIds.empty()) + return ""; + + if (axisIds.size() == 1) + return std::to_string(axisIds.front()); + + std::string strAxisIds; + for (const auto& axisId : axisIds) + { + if (strAxisIds.empty()) + strAxisIds = "["; + else + strAxisIds += " | "; + + strAxisIds += std::to_string(axisId); + } + strAxisIds += "]"; + + return strAxisIds; +} static void MapAxisIds(int axisId, int primaryAxisId, @@ -126,19 +54,18 @@ static void MapAxisIds(int axisId, if (axisIds.empty()) { - axisIds.emplace_back(primaryAxisId); - axisIds.emplace_back(secondaryAxisId); + axisIds.push_back(primaryAxisId); + axisIds.push_back(secondaryAxisId); } if (axisIds.size() > 1) return; if (axisId == primaryAxisId) - axisIds.emplace_back(secondaryAxisId); + axisIds.push_back(secondaryAxisId); else if (axisId == secondaryAxisId) axisIds.insert(axisIds.begin(), primaryAxisId); } -} // namespace CAndroidJoystickState::CAndroidJoystickState(CAndroidJoystickState&& other) noexcept : m_deviceId(other.m_deviceId), @@ -173,9 +100,10 @@ bool CAndroidJoystickState::Initialize(const CJNIViewInputDevice& inputDevice) !motionRange.isFromSource(CJNIViewInputDevice::SOURCE_GAMEPAD)) { CLog::Log(LOGDEBUG, - "CAndroidJoystickState: axis {} has unexpected source {} for input device \"{}\" " + "CAndroidJoystickState: ignoring axis {} from source {} for input device \"{}\" " "with ID {}", motionRange.getAxis(), motionRange.getSource(), deviceName, m_deviceId); + continue; } int axisId = motionRange.getAxis(); @@ -187,16 +115,24 @@ bool CAndroidJoystickState::Initialize(const CJNIViewInputDevice& inputDevice) motionRange.getRange(), motionRange.getResolution()}; - // check if the axis ID belongs to a D-pad, analogue stick, trigger or - // generic axis - if (std::find(AxisIDs.begin(), AxisIDs.end(), axisId) != AxisIDs.end()) + // check if the axis ID belongs to a D-pad, analogue stick or trigger + if (axisId == AMOTION_EVENT_AXIS_HAT_X || axisId == AMOTION_EVENT_AXIS_HAT_Y || + axisId == AMOTION_EVENT_AXIS_X || axisId == AMOTION_EVENT_AXIS_Y || + axisId == AMOTION_EVENT_AXIS_Z || axisId == AMOTION_EVENT_AXIS_RX || + axisId == AMOTION_EVENT_AXIS_RY || axisId == AMOTION_EVENT_AXIS_RZ || + axisId == AMOTION_EVENT_AXIS_LTRIGGER || axisId == AMOTION_EVENT_AXIS_RTRIGGER || + axisId == AMOTION_EVENT_AXIS_GAS || axisId == AMOTION_EVENT_AXIS_BRAKE || + axisId == AMOTION_EVENT_AXIS_THROTTLE || axisId == AMOTION_EVENT_AXIS_RUDDER || + axisId == AMOTION_EVENT_AXIS_WHEEL) { - CLog::Log(LOGDEBUG, "CAndroidJoystickState: axis found: {} ({})", - CAndroidJoystickTranslator::TranslateAxis(axisId), axisId); - // check if this axis is already known if (ContainsAxis(axisId, m_axes)) + { + CLog::Log(LOGWARNING, + "CAndroidJoystickState: duplicate axis {} on input device \"{}\" with ID {}", + PrintAxisIds(axis.ids), deviceName, m_deviceId); continue; + } // map AMOTION_EVENT_AXIS_GAS to AMOTION_EVENT_AXIS_RTRIGGER and // AMOTION_EVENT_AXIS_BRAKE to AMOTION_EVENT_AXIS_LTRIGGER @@ -204,7 +140,10 @@ bool CAndroidJoystickState::Initialize(const CJNIViewInputDevice& inputDevice) MapAxisIds(axisId, AMOTION_EVENT_AXIS_LTRIGGER, AMOTION_EVENT_AXIS_BRAKE, axis.ids); MapAxisIds(axisId, AMOTION_EVENT_AXIS_RTRIGGER, AMOTION_EVENT_AXIS_GAS, axis.ids); - m_axes.emplace_back(std::move(axis)); + m_axes.push_back(axis); + CLog::Log(LOGDEBUG, + "CAndroidJoystickState: axis {} on input device \"{}\" with ID {} detected", + PrintAxisIds(axis.ids), deviceName, m_deviceId); } else CLog::Log(LOGWARNING, @@ -212,27 +151,30 @@ bool CAndroidJoystickState::Initialize(const CJNIViewInputDevice& inputDevice) axisId, deviceName, m_deviceId); } - // check for presence of buttons - auto results = inputDevice.hasKeys(ButtonKeycodes); - - if (results.size() != ButtonKeycodes.size()) - { - CLog::Log(LOGERROR, "CAndroidJoystickState: failed to get key status for {} buttons", - ButtonKeycodes.size()); - return false; - } - - // log positive results and assign results to buttons - for (unsigned int i = 0; i < ButtonKeycodes.size(); ++i) - { - if (results[i]) - { - const int buttonKeycode = ButtonKeycodes[i]; - CLog::Log(LOGDEBUG, "CAndroidJoystickState: button found: {} ({})", - CAndroidJoystickTranslator::TranslateKeyCode(buttonKeycode), buttonKeycode); - m_buttons.emplace_back(JoystickAxis{{buttonKeycode}}); - } - } + // add the usual suspects + m_buttons.push_back({{AKEYCODE_BUTTON_A}}); + m_buttons.push_back({{AKEYCODE_BUTTON_B}}); + m_buttons.push_back({{AKEYCODE_BUTTON_C}}); + m_buttons.push_back({{AKEYCODE_BUTTON_X}}); + m_buttons.push_back({{AKEYCODE_BUTTON_Y}}); + m_buttons.push_back({{AKEYCODE_BUTTON_Z}}); + m_buttons.push_back({{AKEYCODE_BACK}}); + m_buttons.push_back({{AKEYCODE_MENU}}); + m_buttons.push_back({{AKEYCODE_HOME}}); + m_buttons.push_back({{AKEYCODE_BUTTON_SELECT}}); + m_buttons.push_back({{AKEYCODE_BUTTON_MODE}}); + m_buttons.push_back({{AKEYCODE_BUTTON_START}}); + m_buttons.push_back({{AKEYCODE_BUTTON_L1}}); + m_buttons.push_back({{AKEYCODE_BUTTON_R1}}); + m_buttons.push_back({{AKEYCODE_BUTTON_L2}}); + m_buttons.push_back({{AKEYCODE_BUTTON_R2}}); + m_buttons.push_back({{AKEYCODE_BUTTON_THUMBL}}); + m_buttons.push_back({{AKEYCODE_BUTTON_THUMBR}}); + m_buttons.push_back({{AKEYCODE_DPAD_UP}}); + m_buttons.push_back({{AKEYCODE_DPAD_RIGHT}}); + m_buttons.push_back({{AKEYCODE_DPAD_DOWN}}); + m_buttons.push_back({{AKEYCODE_DPAD_LEFT}}); + m_buttons.push_back({{AKEYCODE_DPAD_CENTER}}); // check if there are no buttons or axes at all if (GetButtonCount() == 0 && GetAxisCount() == 0) @@ -258,70 +200,6 @@ void CAndroidJoystickState::Deinitialize(void) m_digitalEvents.clear(); } -bool CAndroidJoystickState::InitializeButtonMap(KODI::JOYSTICK::IButtonMap& buttonMap) const -{ - // We only map the default controller - if (buttonMap.ControllerID() != DEFAULT_CONTROLLER_ID) - return false; - - bool success = false; - - // Map buttons - for (auto it = ButtonKeycodes.begin(); it != ButtonKeycodes.end(); ++it) - { - const int buttonKeycode = *it; - success |= MapButton(buttonMap, buttonKeycode); - } - - // Map D-pad - success |= MapDpad(buttonMap, AMOTION_EVENT_AXIS_HAT_X, AMOTION_EVENT_AXIS_HAT_Y); - - // Map triggers - // Note: This should come after buttons, because the PS4 controller uses - // both a digital button and an analog axis for the triggers, and we want - // the analog axis to override the button for full range of motion. - success |= MapTrigger(buttonMap, AMOTION_EVENT_AXIS_LTRIGGER, - GAME::CDefaultController::FEATURE_LEFT_TRIGGER); - success |= MapTrigger(buttonMap, AMOTION_EVENT_AXIS_RTRIGGER, - GAME::CDefaultController::FEATURE_RIGHT_TRIGGER); - - // Map analog sticks - success |= MapAnalogStick(buttonMap, AMOTION_EVENT_AXIS_X, AMOTION_EVENT_AXIS_Y, - GAME::CDefaultController::FEATURE_LEFT_STICK); - success |= MapAnalogStick(buttonMap, AMOTION_EVENT_AXIS_Z, AMOTION_EVENT_AXIS_RZ, - GAME::CDefaultController::FEATURE_RIGHT_STICK); - - if (success) - { - // If the controller has both L2/R2 buttons and LTRIGGER/RTRIGGER axes, it's - // probably a PS controller - size_t indexL2 = 0; - size_t indexR2 = 0; - size_t indexLTrigger = 0; - size_t indexRTrigger = 0; - if (GetAxesIndex({AKEYCODE_BUTTON_L2}, m_buttons, indexL2) && - GetAxesIndex({AKEYCODE_BUTTON_R2}, m_buttons, indexR2) && - GetAxesIndex({AMOTION_EVENT_AXIS_LTRIGGER}, m_axes, indexLTrigger) && - GetAxesIndex({AMOTION_EVENT_AXIS_RTRIGGER}, m_axes, indexRTrigger)) - { - CLog::Log(LOGDEBUG, "Detected dual-input triggers, ignoring digital buttons"); - std::vector<JOYSTICK::CDriverPrimitive> ignoredPrimitives{ - {JOYSTICK::PRIMITIVE_TYPE::BUTTON, static_cast<unsigned int>(indexL2)}, - {JOYSTICK::PRIMITIVE_TYPE::BUTTON, static_cast<unsigned int>(indexR2)}, - }; - buttonMap.SetIgnoredPrimitives(ignoredPrimitives); - - CLog::Log(LOGDEBUG, "Setting appearance to {}", CONTROLLER_ID_PLAYSTATION); - buttonMap.SetAppearance(CONTROLLER_ID_PLAYSTATION); - } - - // Save the buttonmap - buttonMap.SaveButtonMap(); - } - - return success; -} - bool CAndroidJoystickState::ProcessEvent(const AInputEvent* event) { int32_t type = AInputEvent_getType(event); @@ -343,25 +221,6 @@ bool CAndroidJoystickState::ProcessEvent(const AInputEvent* event) bool result = SetButtonValue(keycode, buttonState); - if (!result) - { - // Try shoehorning keys into buttons - switch (keycode) - { - case AKEYCODE_MENU: - result = SetButtonValue(AKEYCODE_BUTTON_START, buttonState); - break; - case AKEYCODE_BACK: - result = SetButtonValue(AKEYCODE_BUTTON_SELECT, buttonState); - break; - case AKEYCODE_HOME: - result = SetButtonValue(AKEYCODE_BUTTON_MODE, buttonState); - break; - default: - break; - } - } - return result; } @@ -378,7 +237,7 @@ bool CAndroidJoystickState::ProcessEvent(const AInputEvent* event) // get all potential values std::vector<float> values; for (const auto& axisId : axis.ids) - values.emplace_back(AMotionEvent_getAxisValue(event, axisId, pointer)); + values.push_back(AMotionEvent_getAxisValue(event, axisId, pointer)); // remove all zero values values.erase(std::remove(values.begin(), values.end(), 0.0f), values.end()); @@ -474,145 +333,6 @@ bool CAndroidJoystickState::SetAxisValue(const std::vector<int>& axisIds, return true; } -bool CAndroidJoystickState::MapButton(KODI::JOYSTICK::IButtonMap& buttonMap, - int buttonKeycode) const -{ - size_t buttonIndex = 0; - std::string featureName; - - if (!GetAxesIndex({buttonKeycode}, m_buttons, buttonIndex)) - return false; - - // Check if button is already mapped - JOYSTICK::CDriverPrimitive buttonPrimitive{JOYSTICK::PRIMITIVE_TYPE::BUTTON, - static_cast<unsigned int>(buttonIndex)}; - if (buttonMap.GetFeature(buttonPrimitive, featureName)) - return false; - - // Translate the button - std::string controllerButton = CAndroidJoystickTranslator::TranslateJoystickButton(buttonKeycode); - if (controllerButton.empty()) - return false; - - // Map the button - CLog::Log(LOGDEBUG, "Automatically mapping {} to {}", controllerButton, - buttonPrimitive.ToString()); - buttonMap.AddScalar(controllerButton, buttonPrimitive); - - return true; -} - -bool CAndroidJoystickState::MapTrigger(KODI::JOYSTICK::IButtonMap& buttonMap, - int axisId, - const std::string& triggerName) const -{ - size_t axisIndex = 0; - std::string featureName; - - if (!GetAxesIndex({axisId}, m_axes, axisIndex)) - return false; - - const JOYSTICK::CDriverPrimitive semiaxis{static_cast<unsigned int>(axisIndex), 0, - JOYSTICK::SEMIAXIS_DIRECTION::POSITIVE, 1}; - if (buttonMap.GetFeature(semiaxis, featureName)) - return false; - - CLog::Log(LOGDEBUG, "Automatically mapping {} to {}", triggerName, semiaxis.ToString()); - buttonMap.AddScalar(triggerName, semiaxis); - - return true; -} - -bool CAndroidJoystickState::MapDpad(KODI::JOYSTICK::IButtonMap& buttonMap, - int horizAxisId, - int vertAxisId) const -{ - bool success = false; - - size_t axisIndex = 0; - std::string featureName; - - // Map horizontal axis - if (GetAxesIndex({horizAxisId}, m_axes, axisIndex)) - { - const JOYSTICK::CDriverPrimitive positiveSemiaxis{static_cast<unsigned int>(axisIndex), 0, - JOYSTICK::SEMIAXIS_DIRECTION::POSITIVE, 1}; - const JOYSTICK::CDriverPrimitive negativeSemiaxis{static_cast<unsigned int>(axisIndex), 0, - JOYSTICK::SEMIAXIS_DIRECTION::NEGATIVE, 1}; - if (!buttonMap.GetFeature(positiveSemiaxis, featureName) && - !buttonMap.GetFeature(negativeSemiaxis, featureName)) - { - CLog::Log(LOGDEBUG, "Automatically mapping {} to {}", GAME::CDefaultController::FEATURE_LEFT, - negativeSemiaxis.ToString()); - CLog::Log(LOGDEBUG, "Automatically mapping {} to {}", GAME::CDefaultController::FEATURE_RIGHT, - positiveSemiaxis.ToString()); - buttonMap.AddScalar(GAME::CDefaultController::FEATURE_LEFT, negativeSemiaxis); - buttonMap.AddScalar(GAME::CDefaultController::FEATURE_RIGHT, positiveSemiaxis); - success |= true; - } - } - - // Map vertical axis - if (GetAxesIndex({vertAxisId}, m_axes, axisIndex)) - { - const JOYSTICK::CDriverPrimitive positiveSemiaxis{static_cast<unsigned int>(axisIndex), 0, - JOYSTICK::SEMIAXIS_DIRECTION::POSITIVE, 1}; - const JOYSTICK::CDriverPrimitive negativeSemiaxis{static_cast<unsigned int>(axisIndex), 0, - JOYSTICK::SEMIAXIS_DIRECTION::NEGATIVE, 1}; - if (!buttonMap.GetFeature(positiveSemiaxis, featureName) && - !buttonMap.GetFeature(negativeSemiaxis, featureName)) - { - CLog::Log(LOGDEBUG, "Automatically mapping {} to {}", GAME::CDefaultController::FEATURE_UP, - negativeSemiaxis.ToString()); - CLog::Log(LOGDEBUG, "Automatically mapping {} to {}", GAME::CDefaultController::FEATURE_DOWN, - positiveSemiaxis.ToString()); - buttonMap.AddScalar(GAME::CDefaultController::FEATURE_DOWN, positiveSemiaxis); - buttonMap.AddScalar(GAME::CDefaultController::FEATURE_UP, negativeSemiaxis); - success |= true; - } - } - - return success; -} - -bool CAndroidJoystickState::MapAnalogStick(KODI::JOYSTICK::IButtonMap& buttonMap, - int horizAxisId, - int vertAxisId, - const std::string& analogStickName) const -{ - size_t axisIndex1 = 0; - size_t axisIndex2 = 0; - std::string featureName; - - if (!GetAxesIndex({horizAxisId}, m_axes, axisIndex1) || - !GetAxesIndex({vertAxisId}, m_axes, axisIndex2)) - return false; - - const JOYSTICK::CDriverPrimitive upSemiaxis{static_cast<unsigned int>(axisIndex2), 0, - JOYSTICK::SEMIAXIS_DIRECTION::NEGATIVE, 1}; - const JOYSTICK::CDriverPrimitive downSemiaxis{static_cast<unsigned int>(axisIndex2), 0, - JOYSTICK::SEMIAXIS_DIRECTION::POSITIVE, 1}; - const JOYSTICK::CDriverPrimitive leftSemiaxis{static_cast<unsigned int>(axisIndex1), 0, - JOYSTICK::SEMIAXIS_DIRECTION::NEGATIVE, 1}; - const JOYSTICK::CDriverPrimitive rightSemiaxis{static_cast<unsigned int>(axisIndex1), 0, - JOYSTICK::SEMIAXIS_DIRECTION::POSITIVE, 1}; - if (buttonMap.GetFeature(upSemiaxis, featureName) || - buttonMap.GetFeature(downSemiaxis, featureName) || - buttonMap.GetFeature(leftSemiaxis, featureName) || - buttonMap.GetFeature(rightSemiaxis, featureName)) - return false; - - CLog::Log(LOGDEBUG, "Automatically mapping {} to [{}, {}, {}, {}]", analogStickName, - upSemiaxis.ToString(), downSemiaxis.ToString(), leftSemiaxis.ToString(), - rightSemiaxis.ToString()); - buttonMap.AddAnalogStick(analogStickName, JOYSTICK::ANALOG_STICK_DIRECTION::UP, upSemiaxis); - buttonMap.AddAnalogStick(analogStickName, JOYSTICK::ANALOG_STICK_DIRECTION::DOWN, downSemiaxis); - buttonMap.AddAnalogStick(analogStickName, JOYSTICK::ANALOG_STICK_DIRECTION::LEFT, leftSemiaxis); - buttonMap.AddAnalogStick(analogStickName, JOYSTICK::ANALOG_STICK_DIRECTION::RIGHT, rightSemiaxis); - - return true; -} - float CAndroidJoystickState::Contain(float value, float min, float max) { if (value < min) diff --git a/xbmc/platform/android/peripherals/AndroidJoystickState.h b/xbmc/platform/android/peripherals/AndroidJoystickState.h index 550222d6f7..33ff953a46 100644 --- a/xbmc/platform/android/peripherals/AndroidJoystickState.h +++ b/xbmc/platform/android/peripherals/AndroidJoystickState.h @@ -18,14 +18,6 @@ struct AInputEvent; class CJNIViewInputDevice; -namespace KODI -{ -namespace JOYSTICK -{ -class IButtonMap; -} // namespace JOYSTICK -} // namespace KODI - namespace PERIPHERALS { class CAndroidJoystickState @@ -41,39 +33,25 @@ public: unsigned int GetAxisCount() const { return static_cast<unsigned int>(m_axes.size()); } /*! - * \brief Initialize the joystick object - * - * Joystick will be initialized before the first call to GetEvents(). - */ + * Initialize the joystick object. Joystick will be initialized before the + * first call to GetEvents(). + */ bool Initialize(const CJNIViewInputDevice& inputDevice); /*! - * \brief Initialize a joystick buttonmap, if possible - * - * Android has a large database of buttonmaps, which it uses to provide - * mapped button keycodes such as AKEYCODE_BUTTON_A. We can take advantage of - * this to initialize a default buttonmap based on these mappings. - * - * If Android can't map the buttons, it will use generic button keycodes such - * as AKEYCODE_BUTTON_1, in which case we can't initialize the buttonmap. - */ - bool InitializeButtonMap(KODI::JOYSTICK::IButtonMap& buttonMap) const; - - /*! - * \brief Deinitialize the joystick object - * - * GetEvents() will not be called after deinitialization. - */ + * Deinitialize the joystick object. GetEvents() will not be called after + * deinitialization. + */ void Deinitialize(); /*! - * \brief Processes the given input event. - */ + * Processes the given input event. + */ bool ProcessEvent(const AInputEvent* event); /*! - * \brief Get events that have occurred since the last call to GetEvents() - */ + * Get events that have occurred since the last call to GetEvents() + */ void GetEvents(std::vector<kodi::addon::PeripheralEvent>& events); private: @@ -83,16 +61,6 @@ private: void GetButtonEvents(std::vector<kodi::addon::PeripheralEvent>& events); void GetAxisEvents(std::vector<kodi::addon::PeripheralEvent>& events) const; - bool MapButton(KODI::JOYSTICK::IButtonMap& buttonMap, int buttonKeycode) const; - bool MapTrigger(KODI::JOYSTICK::IButtonMap& buttonMap, - int axisId, - const std::string& triggerName) const; - bool MapDpad(KODI::JOYSTICK::IButtonMap& buttonMap, int horizAxisId, int vertAxisId) const; - bool MapAnalogStick(KODI::JOYSTICK::IButtonMap& buttonMap, - int horizAxisId, - int vertAxisId, - const std::string& analogStickName) const; - static float Contain(float value, float min, float max); static float Scale(float value, float max, float scaledMax); static float Deadzone(float value, float deadzone); diff --git a/xbmc/platform/android/peripherals/AndroidJoystickTranslator.cpp b/xbmc/platform/android/peripherals/AndroidJoystickTranslator.cpp index e39050a0c4..be919ab70e 100644 --- a/xbmc/platform/android/peripherals/AndroidJoystickTranslator.cpp +++ b/xbmc/platform/android/peripherals/AndroidJoystickTranslator.cpp @@ -8,12 +8,9 @@ #include "AndroidJoystickTranslator.h" -#include "games/controllers/DefaultController.h" - #include <android/input.h> #include <android/keycodes.h> -using namespace KODI; using namespace PERIPHERALS; const char* CAndroidJoystickTranslator::TranslateAxis(int axisId) @@ -633,115 +630,7 @@ const char* CAndroidJoystickTranslator::TranslateKeyCode(int keyCode) return "AKEYCODE_TV_TIMER_PROGRAMMING"; case AKEYCODE_HELP: return "AKEYCODE_HELP"; - case AKEYCODE_NAVIGATE_PREVIOUS: - return "AKEYCODE_NAVIGATE_PREVIOUS"; - case AKEYCODE_NAVIGATE_NEXT: - return "AKEYCODE_NAVIGATE_NEXT"; - case AKEYCODE_NAVIGATE_IN: - return "AKEYCODE_NAVIGATE_IN"; - case AKEYCODE_NAVIGATE_OUT: - return "AKEYCODE_NAVIGATE_OUT"; - case AKEYCODE_STEM_PRIMARY: - return "AKEYCODE_STEM_PRIMARY"; - case AKEYCODE_STEM_1: - return "AKEYCODE_STEM_1"; - case AKEYCODE_STEM_2: - return "AKEYCODE_STEM_2"; - case AKEYCODE_STEM_3: - return "AKEYCODE_STEM_3"; - case AKEYCODE_DPAD_UP_LEFT: - return "AKEYCODE_DPAD_UP_LEFT"; - case AKEYCODE_DPAD_DOWN_LEFT: - return "AKEYCODE_DPAD_DOWN_LEFT"; - case AKEYCODE_DPAD_UP_RIGHT: - return "AKEYCODE_DPAD_UP_RIGHT"; - case AKEYCODE_DPAD_DOWN_RIGHT: - return "AKEYCODE_DPAD_DOWN_RIGHT"; - case AKEYCODE_MEDIA_SKIP_FORWARD: - return "AKEYCODE_MEDIA_SKIP_FORWARD"; - case AKEYCODE_MEDIA_SKIP_BACKWARD: - return "AKEYCODE_MEDIA_SKIP_BACKWARD"; - case AKEYCODE_MEDIA_STEP_FORWARD: - return "AKEYCODE_MEDIA_STEP_FORWARD"; - case AKEYCODE_MEDIA_STEP_BACKWARD: - return "AKEYCODE_MEDIA_STEP_BACKWARD"; - case AKEYCODE_SOFT_SLEEP: - return "AKEYCODE_SOFT_SLEEP"; - case AKEYCODE_CUT: - return "AKEYCODE_CUT"; - case AKEYCODE_COPY: - return "AKEYCODE_COPY"; - case AKEYCODE_PASTE: - return "AKEYCODE_PASTE"; - case AKEYCODE_SYSTEM_NAVIGATION_UP: - return "AKEYCODE_SYSTEM_NAVIGATION_UP"; - case AKEYCODE_SYSTEM_NAVIGATION_DOWN: - return "AKEYCODE_SYSTEM_NAVIGATION_DOWN"; - case AKEYCODE_SYSTEM_NAVIGATION_LEFT: - return "AKEYCODE_SYSTEM_NAVIGATION_LEFT"; - case AKEYCODE_SYSTEM_NAVIGATION_RIGHT: - return "AKEYCODE_SYSTEM_NAVIGATION_RIGHT"; - case AKEYCODE_ALL_APPS: - return "AKEYCODE_ALL_APPS"; - case AKEYCODE_REFRESH: - return "AKEYCODE_REFRESH"; - case AKEYCODE_THUMBS_UP: - return "AKEYCODE_THUMBS_UP"; - case AKEYCODE_THUMBS_DOWN: - return "AKEYCODE_THUMBS_DOWN"; - case AKEYCODE_PROFILE_SWITCH: - return "AKEYCODE_PROFILE_SWITCH"; - default: - break; } return "unknown"; } - -const char* CAndroidJoystickTranslator::TranslateJoystickButton(int buttonKeycode) -{ - switch (buttonKeycode) - { - case AKEYCODE_BUTTON_A: - return GAME::CDefaultController::FEATURE_A; - case AKEYCODE_BUTTON_B: - return GAME::CDefaultController::FEATURE_B; - case AKEYCODE_BUTTON_X: - return GAME::CDefaultController::FEATURE_X; - case AKEYCODE_BUTTON_Y: - return GAME::CDefaultController::FEATURE_Y; - case AKEYCODE_BUTTON_START: - case AKEYCODE_MENU: - return GAME::CDefaultController::FEATURE_START; - case AKEYCODE_BUTTON_SELECT: - case AKEYCODE_BACK: - return GAME::CDefaultController::FEATURE_BACK; - case AKEYCODE_BUTTON_MODE: - case AKEYCODE_HOME: - return GAME::CDefaultController::FEATURE_GUIDE; - case AKEYCODE_DPAD_UP: - return GAME::CDefaultController::FEATURE_UP; - case AKEYCODE_DPAD_RIGHT: - return GAME::CDefaultController::FEATURE_RIGHT; - case AKEYCODE_DPAD_DOWN: - return GAME::CDefaultController::FEATURE_DOWN; - case AKEYCODE_DPAD_LEFT: - return GAME::CDefaultController::FEATURE_LEFT; - case AKEYCODE_BUTTON_L1: - return GAME::CDefaultController::FEATURE_LEFT_BUMPER; - case AKEYCODE_BUTTON_R1: - return GAME::CDefaultController::FEATURE_RIGHT_BUMPER; - case AKEYCODE_BUTTON_L2: - return GAME::CDefaultController::FEATURE_LEFT_TRIGGER; - case AKEYCODE_BUTTON_R2: - return GAME::CDefaultController::FEATURE_RIGHT_TRIGGER; - case AKEYCODE_BUTTON_THUMBL: - return GAME::CDefaultController::FEATURE_LEFT_THUMB; - case AKEYCODE_BUTTON_THUMBR: - return GAME::CDefaultController::FEATURE_RIGHT_THUMB; - default: - break; - } - - return ""; -} diff --git a/xbmc/platform/android/peripherals/AndroidJoystickTranslator.h b/xbmc/platform/android/peripherals/AndroidJoystickTranslator.h index 8681de0c12..53a953f0ac 100644 --- a/xbmc/platform/android/peripherals/AndroidJoystickTranslator.h +++ b/xbmc/platform/android/peripherals/AndroidJoystickTranslator.h @@ -14,30 +14,21 @@ class CAndroidJoystickTranslator { public: /*! - * \brief Translate an axis ID to an Android enum suitable for logging - * - * \param axisId The axis ID given in <android/input.h> - * - * \return The translated enum label, or "unknown" if unknown - */ + * \brief Translate an axis ID to an Android enum suitable for logging + * + * \param axisId The axis ID given in <android/input.h> + * + * \return The translated enum label, or "unknown" if unknown + */ static const char* TranslateAxis(int axisId); /*! - * \brief Translate a key code to an Android enum suitable for logging - * - * \param keyCode The key code given in <android/keycodes.h> - * - * \return The translated enum label, or "unknown" if unknown - */ + * \brief Translate a key code to an Android enum suitable for logging + * + * \param keyCode The key code given in <android/keycodes.h> + * + * \return The translated enum label, or "unknown" if unknown + */ static const char* TranslateKeyCode(int keyCode); - - /*! - * \brief Translate a button key code to a feature on the default controller - * - * \param buttonKeycode The key code given in <android/keycodes.h> - * - * \return The translated feature, or "" if unknown - */ - static const char* TranslateJoystickButton(int buttonKeycode); }; } // namespace PERIPHERALS diff --git a/xbmc/platform/android/peripherals/PeripheralBusAndroid.cpp b/xbmc/platform/android/peripherals/PeripheralBusAndroid.cpp index 3f269472ec..74b78849e5 100644 --- a/xbmc/platform/android/peripherals/PeripheralBusAndroid.cpp +++ b/xbmc/platform/android/peripherals/PeripheralBusAndroid.cpp @@ -16,7 +16,6 @@ #include "utils/log.h" #include "platform/android/activity/XBMCApp.h" -#include "platform/android/peripherals/AndroidJoystickState.h" #include <algorithm> #include <mutex> @@ -32,7 +31,7 @@ using namespace PERIPHERALS; #define JOYSTICK_PROVIDER_ANDROID "android" // Set this to the final key code in android/keycodes.h -const unsigned int KEY_CODE_FINAL = AKEYCODE_PROFILE_SWITCH; +const unsigned int KEY_CODE_FINAL = AKEYCODE_HELP; static const std::string DeviceLocationPrefix = "android/inputdevice/"; @@ -121,50 +120,6 @@ bool CPeripheralBusAndroid::InitializeProperties(CPeripheral& peripheral) return true; } -bool CPeripheralBusAndroid::InitializeButtonMap(const CPeripheral& peripheral, - KODI::JOYSTICK::IButtonMap& buttonMap) const -{ - int deviceId; - if (!GetDeviceId(peripheral.Location(), deviceId)) - { - CLog::Log(LOGWARNING, - "CPeripheralBusAndroid: failed to initialize buttonmap due to unknown device ID for " - "peripheral \"{}\"", - peripheral.Location()); - return false; - } - - // get the joystick state - auto it = m_joystickStates.find(deviceId); - if (it == m_joystickStates.end()) - { - CLog::Log(LOGWARNING, - "CPeripheralBusAndroid: joystick with device ID {} not found for peripheral \"{}\"", - deviceId, peripheral.Location()); - return false; - } - - const CAndroidJoystickState& joystick = it->second; - if (joystick.GetButtonCount() == 0 && joystick.GetAxisCount() == 0) - { - CLog::Log(LOGDEBUG, - "CPeripheralBusAndroid: joystick has no buttons or axes for peripheral \"{}\"", - peripheral.Location()); - return false; - } - - if (!joystick.InitializeButtonMap(buttonMap)) - { - CLog::Log( - LOGDEBUG, - "CPeripheralBusAndroid: failed to initialize joystick buttonmap for peripheral \"{}\"", - peripheral.Location()); - return false; - } - - return true; -} - void CPeripheralBusAndroid::Initialise(void) { CPeripheralBus::Initialise(); @@ -253,7 +208,7 @@ void CPeripheralBusAndroid::OnInputDeviceAdded(int deviceId) PeripheralScanResult result; if (!ConvertToPeripheralScanResult(device, result)) return; - m_scanResults.m_results.emplace_back(std::move(result)); + m_scanResults.m_results.push_back(result); } CLog::Log(LOGDEBUG, "CPeripheralBusAndroid: input device with ID {} added", deviceId); @@ -390,7 +345,7 @@ PeripheralScanResults CPeripheralBusAndroid::GetInputDevices() continue; CLog::Log(LOGINFO, "CPeripheralBusAndroid: added input device"); - results.m_results.emplace_back(std::move(result)); + results.m_results.push_back(result); } return results; @@ -427,59 +382,8 @@ bool CPeripheralBusAndroid::ConvertToPeripheralScanResult( if (!inputDevice.supportsSource(CJNIViewInputDevice::SOURCE_JOYSTICK) && !inputDevice.supportsSource(CJNIViewInputDevice::SOURCE_GAMEPAD)) { - // Observed an anomylous PS4 controller with only SOURCE_MOUSE - if (!inputDevice.supportsSource(CJNIViewInputDevice::SOURCE_MOUSE)) - { - CLog::Log(LOGDEBUG, "CPeripheralBusAndroid: ignoring non-joystick device"); - return false; - } - - // Make sure the anomylous controller has buttons - // clang-format off - std::vector<int> buttons{ - AKEYCODE_BUTTON_A, - AKEYCODE_BUTTON_B, - AKEYCODE_BUTTON_C, - AKEYCODE_BUTTON_X, - AKEYCODE_BUTTON_Y, - AKEYCODE_BUTTON_Z, - AKEYCODE_BUTTON_L1, - AKEYCODE_BUTTON_R1, - AKEYCODE_BUTTON_L2, - AKEYCODE_BUTTON_R2, - AKEYCODE_BUTTON_THUMBL, - AKEYCODE_BUTTON_THUMBR, - AKEYCODE_BUTTON_START, - AKEYCODE_BUTTON_SELECT, - AKEYCODE_BUTTON_MODE, - AKEYCODE_BUTTON_1, - AKEYCODE_BUTTON_2, - AKEYCODE_BUTTON_3, - AKEYCODE_BUTTON_4, - AKEYCODE_BUTTON_5, - AKEYCODE_BUTTON_6, - AKEYCODE_BUTTON_7, - AKEYCODE_BUTTON_8, - AKEYCODE_BUTTON_9, - AKEYCODE_BUTTON_10, - AKEYCODE_BUTTON_11, - AKEYCODE_BUTTON_12, - AKEYCODE_BUTTON_13, - AKEYCODE_BUTTON_14, - AKEYCODE_BUTTON_15, - AKEYCODE_BUTTON_16, - }; - // clang-format on - - auto result = inputDevice.hasKeys(buttons); - - if (std::find(result.begin(), result.end(), true) == result.end()) - { - CLog::Log(LOGDEBUG, "CPeripheralBusAndroid: ignoring non-joystick device with mouse source"); - return false; - } - - CLog::Log(LOGDEBUG, "CPeripheralBusAndroid: adding non-joystick device with mouse source"); + CLog::Log(LOGDEBUG, "CPeripheralBusAndroid: ignoring non-joystick device"); + return false; } peripheralScanResult.m_type = PERIPHERAL_JOYSTICK; diff --git a/xbmc/platform/android/peripherals/PeripheralBusAndroid.h b/xbmc/platform/android/peripherals/PeripheralBusAndroid.h index 5ee9480970..c3c42aa730 100644 --- a/xbmc/platform/android/peripherals/PeripheralBusAndroid.h +++ b/xbmc/platform/android/peripherals/PeripheralBusAndroid.h @@ -35,8 +35,6 @@ public: // specialisation of CPeripheralBus bool InitializeProperties(CPeripheral& peripheral) override; - bool InitializeButtonMap(const CPeripheral& peripheral, - KODI::JOYSTICK::IButtonMap& buttonMap) const override; void Initialise(void) override; void ProcessEvents() override; |