summaryrefslogtreecommitdiffstats
path: root/xbmc/input/joysticks
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/input/joysticks')
-rw-r--r--xbmc/input/joysticks/DriverPrimitive.cpp70
-rw-r--r--xbmc/input/joysticks/DriverPrimitive.h7
-rw-r--r--xbmc/input/joysticks/JoystickEasterEgg.cpp21
-rw-r--r--xbmc/input/joysticks/generic/ButtonMapping.cpp41
4 files changed, 29 insertions, 110 deletions
diff --git a/xbmc/input/joysticks/DriverPrimitive.cpp b/xbmc/input/joysticks/DriverPrimitive.cpp
index 166e926..9540dfd 100644
--- a/xbmc/input/joysticks/DriverPrimitive.cpp
+++ b/xbmc/input/joysticks/DriverPrimitive.cpp
@@ -8,9 +8,6 @@
#include "DriverPrimitive.h"
-#include "games/controllers/ControllerTranslator.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 {}",
- GAME::CControllerTranslator::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 11d391b..abe3724 100644
--- a/xbmc/input/joysticks/DriverPrimitive.h
+++ b/xbmc/input/joysticks/DriverPrimitive.h
@@ -179,13 +179,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 b0259a6..0c63e66 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 665a233..af6bf86 100644
--- a/xbmc/input/joysticks/generic/ButtonMapping.cpp
+++ b/xbmc/input/joysticks/generic/ButtonMapping.cpp
@@ -454,34 +454,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;