aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett Brown <themagnificentmrb@gmail.com>2021-10-22 22:42:00 -0700
committerGarrett Brown <themagnificentmrb@gmail.com>2021-11-09 07:22:29 -0800
commitef90aeeefc38003a37b2616ef23e20024b1fe526 (patch)
tree4ed1a23daee6ee5f1c08122b35cf289b1fac69a1
parent7b347ded65975cb72e42cfe147601de9c0d196ab (diff)
Controllers: Refactor input code into new subdir
-rw-r--r--cmake/treedata/common/games.txt2
-rw-r--r--xbmc/games/addons/input/GameClientController.cpp6
-rw-r--r--xbmc/games/addons/input/GameClientController.h1
-rw-r--r--xbmc/games/addons/input/GameClientDevice.cpp4
-rw-r--r--xbmc/games/addons/input/GameClientDevice.h4
-rw-r--r--xbmc/games/addons/input/GameClientInput.cpp2
-rw-r--r--xbmc/games/addons/input/GameClientJoystick.cpp8
-rw-r--r--xbmc/games/addons/input/GameClientJoystick.h4
-rw-r--r--xbmc/games/addons/input/GameClientPort.cpp4
-rw-r--r--xbmc/games/addons/input/GameClientPort.h4
-rw-r--r--xbmc/games/controllers/CMakeLists.txt6
-rw-r--r--xbmc/games/controllers/Controller.cpp14
-rw-r--r--xbmc/games/controllers/Controller.h12
-rw-r--r--xbmc/games/controllers/ControllerLayout.cpp12
-rw-r--r--xbmc/games/controllers/ControllerLayout.h10
-rw-r--r--xbmc/games/controllers/guicontrols/GUICardinalFeatureButton.cpp2
-rw-r--r--xbmc/games/controllers/guicontrols/GUICardinalFeatureButton.h2
-rw-r--r--xbmc/games/controllers/guicontrols/GUIFeatureButton.cpp2
-rw-r--r--xbmc/games/controllers/guicontrols/GUIFeatureButton.h8
-rw-r--r--xbmc/games/controllers/guicontrols/GUIFeatureFactory.cpp2
-rw-r--r--xbmc/games/controllers/guicontrols/GUIFeatureFactory.h4
-rw-r--r--xbmc/games/controllers/guicontrols/GUIScalarFeatureButton.cpp2
-rw-r--r--xbmc/games/controllers/guicontrols/GUIScalarFeatureButton.h2
-rw-r--r--xbmc/games/controllers/guicontrols/GUISelectKeyButton.cpp8
-rw-r--r--xbmc/games/controllers/guicontrols/GUISelectKeyButton.h10
-rw-r--r--xbmc/games/controllers/guicontrols/GUIThrottleButton.cpp2
-rw-r--r--xbmc/games/controllers/guicontrols/GUIThrottleButton.h2
-rw-r--r--xbmc/games/controllers/guicontrols/GUIWheelButton.cpp2
-rw-r--r--xbmc/games/controllers/guicontrols/GUIWheelButton.h2
-rw-r--r--xbmc/games/controllers/input/CMakeLists.txt15
-rw-r--r--xbmc/games/controllers/input/InputSink.cpp (renamed from xbmc/games/ports/InputSink.cpp)0
-rw-r--r--xbmc/games/controllers/input/InputSink.h (renamed from xbmc/games/ports/InputSink.h)0
-rw-r--r--xbmc/games/controllers/input/PhysicalFeature.cpp (renamed from xbmc/games/controllers/ControllerFeature.cpp)28
-rw-r--r--xbmc/games/controllers/input/PhysicalFeature.h (renamed from xbmc/games/controllers/ControllerFeature.h)12
-rw-r--r--xbmc/games/controllers/input/PhysicalPort.cpp (renamed from xbmc/games/controllers/ControllerPort.cpp)14
-rw-r--r--xbmc/games/controllers/input/PhysicalPort.h (renamed from xbmc/games/controllers/ControllerPort.h)6
-rw-r--r--xbmc/games/controllers/input/PhysicalTopology.cpp (renamed from xbmc/games/controllers/ControllerTopology.cpp)14
-rw-r--r--xbmc/games/controllers/input/PhysicalTopology.h (renamed from xbmc/games/controllers/ControllerTopology.h)12
-rw-r--r--xbmc/games/controllers/input/PortInput.cpp (renamed from xbmc/games/ports/Port.cpp)42
-rw-r--r--xbmc/games/controllers/input/PortInput.h (renamed from xbmc/games/ports/Port.h)6
-rw-r--r--xbmc/games/controllers/types/ControllerNode.cpp2
-rw-r--r--xbmc/games/controllers/types/PortNode.cpp10
-rw-r--r--xbmc/games/controllers/types/PortNode.h4
-rw-r--r--xbmc/games/controllers/windows/GUIConfigurationWizard.cpp8
-rw-r--r--xbmc/games/controllers/windows/GUIConfigurationWizard.h6
-rw-r--r--xbmc/games/controllers/windows/GUIFeatureList.cpp18
-rw-r--r--xbmc/games/controllers/windows/GUIFeatureList.h10
-rw-r--r--xbmc/games/controllers/windows/IConfigurationWindow.h8
-rw-r--r--xbmc/games/ports/CMakeLists.txt7
-rw-r--r--xbmc/input/joysticks/generic/ButtonMapping.cpp2
50 files changed, 188 insertions, 179 deletions
diff --git a/cmake/treedata/common/games.txt b/cmake/treedata/common/games.txt
index 7ae2d35ae5..e72c9de9f9 100644
--- a/cmake/treedata/common/games.txt
+++ b/cmake/treedata/common/games.txt
@@ -5,10 +5,10 @@ xbmc/games/addons/streams games/addons/streams
xbmc/games/controllers games/controllers
xbmc/games/controllers/dialogs games/controllers/dialogs
xbmc/games/controllers/guicontrols games/controllers/guicontrols
+xbmc/games/controllers/input games/controllers/input
xbmc/games/controllers/types games/controllers/types
xbmc/games/controllers/windows games/controllers/windows
xbmc/games/dialogs games/dialogs
xbmc/games/dialogs/osd games/dialogs/osd
-xbmc/games/ports games/ports
xbmc/games/tags games/tags
xbmc/games/windows games/windows
diff --git a/xbmc/games/addons/input/GameClientController.cpp b/xbmc/games/addons/input/GameClientController.cpp
index 24a09862f3..435e277e2a 100644
--- a/xbmc/games/addons/input/GameClientController.cpp
+++ b/xbmc/games/addons/input/GameClientController.cpp
@@ -22,9 +22,9 @@
#include "GameClientInput.h"
#include "games/controllers/Controller.h"
-#include "games/controllers/ControllerFeature.h"
#include "games/controllers/ControllerLayout.h"
-#include "games/controllers/ControllerTopology.h"
+#include "games/controllers/input/PhysicalFeature.h"
+#include "games/controllers/input/PhysicalTopology.h"
#include <algorithm>
#include <vector>
@@ -36,7 +36,7 @@ CGameClientController::CGameClientController(CGameClientInput& input, Controller
: m_input(input), m_controller(std::move(controller)), m_controllerId(m_controller->ID())
{
// Generate arrays of features
- for (const CControllerFeature& feature : m_controller->Features())
+ for (const CPhysicalFeature& feature : m_controller->Features())
{
// Skip feature if not supported by the game client
if (!m_input.HasFeature(m_controller->ID(), feature.Name()))
diff --git a/xbmc/games/addons/input/GameClientController.h b/xbmc/games/addons/input/GameClientController.h
index ef39e20031..5445868ef7 100644
--- a/xbmc/games/addons/input/GameClientController.h
+++ b/xbmc/games/addons/input/GameClientController.h
@@ -23,6 +23,7 @@
#include "addons/kodi-dev-kit/include/kodi/addon-instance/Game.h"
#include "games/controllers/ControllerTypes.h"
+#include <string>
#include <vector>
namespace KODI
diff --git a/xbmc/games/addons/input/GameClientDevice.cpp b/xbmc/games/addons/input/GameClientDevice.cpp
index 317447da50..9918f7b2ca 100644
--- a/xbmc/games/addons/input/GameClientDevice.cpp
+++ b/xbmc/games/addons/input/GameClientDevice.cpp
@@ -13,7 +13,7 @@
#include "addons/kodi-dev-kit/include/kodi/addon-instance/Game.h"
#include "games/GameServices.h"
#include "games/controllers/Controller.h"
-#include "games/controllers/ControllerTopology.h"
+#include "games/controllers/input/PhysicalTopology.h"
#include "utils/StringUtils.h"
#include <algorithm>
@@ -51,7 +51,7 @@ CGameClientDevice::CGameClientDevice(const ControllerPtr& controller) : m_contro
CGameClientDevice::~CGameClientDevice() = default;
void CGameClientDevice::AddPort(const game_input_port& logicalPort,
- const CControllerPort& physicalPort)
+ const CPhysicalPort& physicalPort)
{
std::unique_ptr<CGameClientPort> port(new CGameClientPort(logicalPort, physicalPort));
m_ports.emplace_back(std::move(port));
diff --git a/xbmc/games/addons/input/GameClientDevice.h b/xbmc/games/addons/input/GameClientDevice.h
index 778f595d68..403d76c853 100644
--- a/xbmc/games/addons/input/GameClientDevice.h
+++ b/xbmc/games/addons/input/GameClientDevice.h
@@ -20,7 +20,7 @@ namespace KODI
{
namespace GAME
{
-class CControllerPort;
+class CPhysicalPort;
/*!
* \ingroup games
@@ -65,7 +65,7 @@ private:
* \param logicalPort The logical port Game API struct
* \param physicalPort The physical port definition
*/
- void AddPort(const game_input_port& logicalPort, const CControllerPort& physicalPort);
+ void AddPort(const game_input_port& logicalPort, const CPhysicalPort& physicalPort);
// Helper function
static ControllerPtr GetController(const char* controllerId);
diff --git a/xbmc/games/addons/input/GameClientInput.cpp b/xbmc/games/addons/input/GameClientInput.cpp
index c399bd6a00..56b71ca318 100644
--- a/xbmc/games/addons/input/GameClientInput.cpp
+++ b/xbmc/games/addons/input/GameClientInput.cpp
@@ -21,7 +21,7 @@
#include "games/addons/GameClient.h"
#include "games/addons/GameClientCallbacks.h"
#include "games/controllers/Controller.h"
-#include "games/controllers/ControllerTopology.h"
+#include "games/controllers/input/PhysicalTopology.h"
#include "input/joysticks/JoystickTypes.h"
#include "peripherals/EventLockHandle.h"
#include "peripherals/Peripherals.h"
diff --git a/xbmc/games/addons/input/GameClientJoystick.cpp b/xbmc/games/addons/input/GameClientJoystick.cpp
index 6c1a77fc74..291dc6755b 100644
--- a/xbmc/games/addons/input/GameClientJoystick.cpp
+++ b/xbmc/games/addons/input/GameClientJoystick.cpp
@@ -11,7 +11,7 @@
#include "GameClientInput.h"
#include "games/addons/GameClient.h"
#include "games/controllers/Controller.h"
-#include "games/ports/Port.h"
+#include "games/controllers/input/PortInput.h"
#include "input/joysticks/interfaces/IInputReceiver.h"
#include "utils/log.h"
@@ -26,7 +26,7 @@ CGameClientJoystick::CGameClientJoystick(CGameClient& gameClient,
: m_gameClient(gameClient),
m_portAddress(portAddress),
m_controller(controller),
- m_port(new CPort(this))
+ m_portInput(new CPortInput(this))
{
assert(m_controller.get() != NULL);
}
@@ -35,12 +35,12 @@ CGameClientJoystick::~CGameClientJoystick() = default;
void CGameClientJoystick::RegisterInput(JOYSTICK::IInputProvider* inputProvider)
{
- m_port->RegisterInput(inputProvider);
+ m_portInput->RegisterInput(inputProvider);
}
void CGameClientJoystick::UnregisterInput(JOYSTICK::IInputProvider* inputProvider)
{
- m_port->UnregisterInput(inputProvider);
+ m_portInput->UnregisterInput(inputProvider);
}
std::string CGameClientJoystick::ControllerID(void) const
diff --git a/xbmc/games/addons/input/GameClientJoystick.h b/xbmc/games/addons/input/GameClientJoystick.h
index a43746ba72..fc1a1c4edd 100644
--- a/xbmc/games/addons/input/GameClientJoystick.h
+++ b/xbmc/games/addons/input/GameClientJoystick.h
@@ -23,7 +23,7 @@ class IInputProvider;
namespace GAME
{
class CGameClient;
-class CPort;
+class CPortInput;
/*!
* \ingroup games
@@ -80,7 +80,7 @@ private:
const ControllerPtr m_controller;
// Input parameters
- std::unique_ptr<CPort> m_port;
+ std::unique_ptr<CPortInput> m_portInput;
};
} // namespace GAME
} // namespace KODI
diff --git a/xbmc/games/addons/input/GameClientPort.cpp b/xbmc/games/addons/input/GameClientPort.cpp
index edce03a16a..df78efce92 100644
--- a/xbmc/games/addons/input/GameClientPort.cpp
+++ b/xbmc/games/addons/input/GameClientPort.cpp
@@ -12,7 +12,7 @@
#include "addons/kodi-dev-kit/include/kodi/addon-instance/Game.h"
#include "games/addons/GameClientTranslator.h"
#include "games/controllers/Controller.h"
-#include "games/controllers/ControllerTopology.h"
+#include "games/controllers/input/PhysicalTopology.h"
#include "utils/StringUtils.h"
#include <algorithm>
@@ -44,7 +44,7 @@ CGameClientPort::CGameClientPort(const ControllerVector& controllers)
}
CGameClientPort::CGameClientPort(const game_input_port& logicalPort,
- const CControllerPort& physicalPort)
+ const CPhysicalPort& physicalPort)
: m_type(PORT_TYPE::CONTROLLER), m_portId(physicalPort.ID())
{
if (logicalPort.accepted_devices != nullptr)
diff --git a/xbmc/games/addons/input/GameClientPort.h b/xbmc/games/addons/input/GameClientPort.h
index 728236b0d9..435565e876 100644
--- a/xbmc/games/addons/input/GameClientPort.h
+++ b/xbmc/games/addons/input/GameClientPort.h
@@ -20,7 +20,7 @@ namespace KODI
{
namespace GAME
{
-class CControllerPort;
+class CPhysicalPort;
/*!
* \ingroup games
@@ -60,7 +60,7 @@ public:
* Obviously, the controllers specified by the logical port must be a subset
* of the controllers supported by the physical port.
*/
- CGameClientPort(const game_input_port& logicalPort, const CControllerPort& physicalPort);
+ CGameClientPort(const game_input_port& logicalPort, const CPhysicalPort& physicalPort);
/*!
* \brief Destructor
diff --git a/xbmc/games/controllers/CMakeLists.txt b/xbmc/games/controllers/CMakeLists.txt
index 400b25b9f8..b00e1caa4a 100644
--- a/xbmc/games/controllers/CMakeLists.txt
+++ b/xbmc/games/controllers/CMakeLists.txt
@@ -1,19 +1,13 @@
set(SOURCES Controller.cpp
- ControllerFeature.cpp
ControllerLayout.cpp
ControllerManager.cpp
- ControllerPort.cpp
- ControllerTopology.cpp
ControllerTranslator.cpp)
set(HEADERS Controller.h
ControllerDefinitions.h
- ControllerFeature.h
ControllerIDs.h
ControllerLayout.h
ControllerManager.h
- ControllerPort.h
- ControllerTopology.h
ControllerTranslator.h
ControllerTypes.h)
diff --git a/xbmc/games/controllers/Controller.cpp b/xbmc/games/controllers/Controller.cpp
index 6d1ff9333c..178a131f66 100644
--- a/xbmc/games/controllers/Controller.cpp
+++ b/xbmc/games/controllers/Controller.cpp
@@ -10,8 +10,8 @@
#include "ControllerDefinitions.h"
#include "ControllerLayout.h"
-#include "ControllerTopology.h"
#include "URL.h"
+#include "games/controllers/input/PhysicalTopology.h"
#include "utils/XBMCTinyXML.h"
#include "utils/XMLUtils.h"
#include "utils/log.h"
@@ -30,7 +30,7 @@ struct FeatureTypeEqual
{
}
- bool operator()(const CControllerFeature& feature) const
+ bool operator()(const CPhysicalFeature& feature) const
{
if (type == FEATURE_TYPE::UNKNOWN)
return true; // Match all feature types
@@ -61,16 +61,16 @@ CController::CController(const ADDON::AddonInfoPtr& addonInfo)
CController::~CController() = default;
-const CControllerFeature& CController::GetFeature(const std::string& name) const
+const CPhysicalFeature& CController::GetFeature(const std::string& name) const
{
auto it =
std::find_if(m_features.begin(), m_features.end(),
- [&name](const CControllerFeature& feature) { return name == feature.Name(); });
+ [&name](const CPhysicalFeature& feature) { return name == feature.Name(); });
if (it != m_features.end())
return *it;
- static const CControllerFeature invalid{};
+ static const CPhysicalFeature invalid{};
return invalid;
}
@@ -86,7 +86,7 @@ unsigned int CController::FeatureCount(
void CController::GetFeatures(std::vector<std::string>& features,
FEATURE_TYPE type /* = FEATURE_TYPE::UNKNOWN */) const
{
- for (const CControllerFeature& feature : m_features)
+ for (const CPhysicalFeature& feature : m_features)
{
if (type == FEATURE_TYPE::UNKNOWN || type == feature.Type())
features.push_back(feature.Name());
@@ -150,7 +150,7 @@ bool CController::LoadLayout(void)
return m_bLoaded;
}
-const CControllerTopology& CController::Topology() const
+const CPhysicalTopology& CController::Topology() const
{
return m_layout->Topology();
}
diff --git a/xbmc/games/controllers/Controller.h b/xbmc/games/controllers/Controller.h
index 532e4dc2a0..2dd7c18b4f 100644
--- a/xbmc/games/controllers/Controller.h
+++ b/xbmc/games/controllers/Controller.h
@@ -8,9 +8,9 @@
#pragma once
-#include "ControllerFeature.h"
#include "ControllerTypes.h"
#include "addons/Addon.h"
+#include "games/controllers/input/PhysicalFeature.h"
#include "input/joysticks/JoystickTypes.h"
#include <map>
@@ -23,7 +23,7 @@ namespace KODI
namespace GAME
{
class CControllerLayout;
-class CControllerTopology;
+class CPhysicalTopology;
using JOYSTICK::FEATURE_TYPE;
@@ -41,7 +41,7 @@ public:
*
* \return The features
*/
- const std::vector<CControllerFeature>& Features(void) const { return m_features; }
+ const std::vector<CPhysicalFeature>& Features(void) const { return m_features; }
/*!
* \brief Get a feature by its name
@@ -50,7 +50,7 @@ public:
*
* \return The feature, or a feature of type FEATURE_TYPE::UNKNOWN if the name is invalid
*/
- const CControllerFeature& GetFeature(const std::string& name) const;
+ const CPhysicalFeature& GetFeature(const std::string& name) const;
/*!
* \brief Get the count of controller features matching the specified types
@@ -108,11 +108,11 @@ public:
*
* \return The physical topology of the controller
*/
- const CControllerTopology& Topology() const;
+ const CPhysicalTopology& Topology() const;
private:
std::unique_ptr<CControllerLayout> m_layout;
- std::vector<CControllerFeature> m_features;
+ std::vector<CPhysicalFeature> m_features;
bool m_bLoaded = false;
};
diff --git a/xbmc/games/controllers/ControllerLayout.cpp b/xbmc/games/controllers/ControllerLayout.cpp
index d0e793ea88..85816c1c71 100644
--- a/xbmc/games/controllers/ControllerLayout.cpp
+++ b/xbmc/games/controllers/ControllerLayout.cpp
@@ -10,8 +10,8 @@
#include "Controller.h"
#include "ControllerDefinitions.h"
-#include "ControllerTopology.h"
#include "ControllerTranslator.h"
+#include "games/controllers/input/PhysicalTopology.h"
#include "guilib/LocalizeStrings.h"
#include "utils/URIUtils.h"
#include "utils/XMLUtils.h"
@@ -22,7 +22,7 @@
using namespace KODI;
using namespace GAME;
-CControllerLayout::CControllerLayout() : m_topology(new CControllerTopology)
+CControllerLayout::CControllerLayout() : m_topology(new CPhysicalTopology)
{
}
@@ -31,7 +31,7 @@ CControllerLayout::CControllerLayout(const CControllerLayout& other)
m_labelId(other.m_labelId),
m_icon(other.m_icon),
m_strImage(other.m_strImage),
- m_topology(new CControllerTopology(*other.m_topology))
+ m_topology(new CPhysicalTopology(*other.m_topology))
{
}
@@ -89,7 +89,7 @@ std::string CControllerLayout::ImagePath(void) const
void CControllerLayout::Deserialize(const TiXmlElement* pElement,
const CController* controller,
- std::vector<CControllerFeature>& features)
+ std::vector<CPhysicalFeature>& features)
{
if (pElement == nullptr || controller == nullptr)
return;
@@ -138,7 +138,7 @@ void CControllerLayout::Deserialize(const TiXmlElement* pElement,
for (const TiXmlElement* pFeature = pChild->FirstChildElement(); pFeature != nullptr;
pFeature = pFeature->NextSiblingElement())
{
- CControllerFeature feature;
+ CPhysicalFeature feature;
if (feature.Deserialize(pFeature, controller, category, categoryLabelId))
features.push_back(feature);
@@ -147,7 +147,7 @@ void CControllerLayout::Deserialize(const TiXmlElement* pElement,
else if (pChild->ValueStr() == LAYOUT_XML_ELM_TOPOLOGY)
{
// Topology
- CControllerTopology topology;
+ CPhysicalTopology topology;
if (topology.Deserialize(pChild))
*m_topology = std::move(topology);
}
diff --git a/xbmc/games/controllers/ControllerLayout.h b/xbmc/games/controllers/ControllerLayout.h
index 4b78b872b5..1589837483 100644
--- a/xbmc/games/controllers/ControllerLayout.h
+++ b/xbmc/games/controllers/ControllerLayout.h
@@ -19,8 +19,8 @@ namespace KODI
namespace GAME
{
class CController;
-class CControllerFeature;
-class CControllerTopology;
+class CPhysicalFeature;
+class CPhysicalTopology;
class CControllerLayout
{
@@ -67,7 +67,7 @@ public:
*
* \return The physical topology of the controller
*/
- const CControllerTopology& Topology(void) const { return *m_topology; }
+ const CPhysicalTopology& Topology(void) const { return *m_topology; }
/*!
* \brief Deserialize the specified XML element
@@ -78,14 +78,14 @@ public:
*/
void Deserialize(const TiXmlElement* pLayoutElement,
const CController* controller,
- std::vector<CControllerFeature>& features);
+ std::vector<CPhysicalFeature>& features);
private:
const CController* m_controller = nullptr;
int m_labelId = -1;
std::string m_icon;
std::string m_strImage;
- std::unique_ptr<CControllerTopology> m_topology;
+ std::unique_ptr<CPhysicalTopology> m_topology;
};
} // namespace GAME
diff --git a/xbmc/games/controllers/guicontrols/GUICardinalFeatureButton.cpp b/xbmc/games/controllers/guicontrols/GUICardinalFeatureButton.cpp
index f78bcfb1c7..3c8732cbae 100644
--- a/xbmc/games/controllers/guicontrols/GUICardinalFeatureButton.cpp
+++ b/xbmc/games/controllers/guicontrols/GUICardinalFeatureButton.cpp
@@ -17,7 +17,7 @@ using namespace GAME;
CGUICardinalFeatureButton::CGUICardinalFeatureButton(const CGUIButtonControl& buttonTemplate,
IConfigurationWizard* wizard,
- const CControllerFeature& feature,
+ const CPhysicalFeature& feature,
unsigned int index)
: CGUIFeatureButton(buttonTemplate, wizard, feature, index)
{
diff --git a/xbmc/games/controllers/guicontrols/GUICardinalFeatureButton.h b/xbmc/games/controllers/guicontrols/GUICardinalFeatureButton.h
index 70c544e342..48eb0e885d 100644
--- a/xbmc/games/controllers/guicontrols/GUICardinalFeatureButton.h
+++ b/xbmc/games/controllers/guicontrols/GUICardinalFeatureButton.h
@@ -19,7 +19,7 @@ class CGUICardinalFeatureButton : public CGUIFeatureButton
public:
CGUICardinalFeatureButton(const CGUIButtonControl& buttonTemplate,
IConfigurationWizard* wizard,
- const CControllerFeature& feature,
+ const CPhysicalFeature& feature,
unsigned int index);
~CGUICardinalFeatureButton() override = default;
diff --git a/xbmc/games/controllers/guicontrols/GUIFeatureButton.cpp b/xbmc/games/controllers/guicontrols/GUIFeatureButton.cpp
index f128fa5f33..688f3c29df 100644
--- a/xbmc/games/controllers/guicontrols/GUIFeatureButton.cpp
+++ b/xbmc/games/controllers/guicontrols/GUIFeatureButton.cpp
@@ -21,7 +21,7 @@ using namespace std::chrono_literals;
CGUIFeatureButton::CGUIFeatureButton(const CGUIButtonControl& buttonTemplate,
IConfigurationWizard* wizard,
- const CControllerFeature& feature,
+ const CPhysicalFeature& feature,
unsigned int index)
: CGUIButtonControl(buttonTemplate), m_feature(feature), m_wizard(wizard)
{
diff --git a/xbmc/games/controllers/guicontrols/GUIFeatureButton.h b/xbmc/games/controllers/guicontrols/GUIFeatureButton.h
index 4f0e4a920a..b69f521b7f 100644
--- a/xbmc/games/controllers/guicontrols/GUIFeatureButton.h
+++ b/xbmc/games/controllers/guicontrols/GUIFeatureButton.h
@@ -8,7 +8,7 @@
#pragma once
-#include "games/controllers/ControllerFeature.h"
+#include "games/controllers/input/PhysicalFeature.h"
#include "games/controllers/windows/IConfigurationWindow.h"
#include "guilib/GUIButtonControl.h"
@@ -23,7 +23,7 @@ class CGUIFeatureButton : public CGUIButtonControl, public IFeatureButton
public:
CGUIFeatureButton(const CGUIButtonControl& buttonTemplate,
IConfigurationWizard* wizard,
- const CControllerFeature& feature,
+ const CPhysicalFeature& feature,
unsigned int index);
~CGUIFeatureButton() override = default;
@@ -32,7 +32,7 @@ public:
void OnUnFocus() override;
// partial implementation of IFeatureButton
- const CControllerFeature& Feature() const override { return m_feature; }
+ const CPhysicalFeature& Feature() const override { return m_feature; }
INPUT::CARDINAL_DIRECTION GetCardinalDirection() const override
{
return INPUT::CARDINAL_DIRECTION::NONE;
@@ -59,7 +59,7 @@ protected:
return static_cast<T>(static_cast<int>(state) + 1);
}
- const CControllerFeature m_feature;
+ const CPhysicalFeature m_feature;
private:
IConfigurationWizard* const m_wizard;
diff --git a/xbmc/games/controllers/guicontrols/GUIFeatureFactory.cpp b/xbmc/games/controllers/guicontrols/GUIFeatureFactory.cpp
index dfba9a1205..2cce0337b2 100644
--- a/xbmc/games/controllers/guicontrols/GUIFeatureFactory.cpp
+++ b/xbmc/games/controllers/guicontrols/GUIFeatureFactory.cpp
@@ -20,7 +20,7 @@ using namespace GAME;
CGUIButtonControl* CGUIFeatureFactory::CreateButton(BUTTON_TYPE type,
const CGUIButtonControl& buttonTemplate,
IConfigurationWizard* wizard,
- const CControllerFeature& feature,
+ const CPhysicalFeature& feature,
unsigned int index)
{
switch (type)
diff --git a/xbmc/games/controllers/guicontrols/GUIFeatureFactory.h b/xbmc/games/controllers/guicontrols/GUIFeatureFactory.h
index 69d7df9f74..e35070dbae 100644
--- a/xbmc/games/controllers/guicontrols/GUIFeatureFactory.h
+++ b/xbmc/games/controllers/guicontrols/GUIFeatureFactory.h
@@ -16,7 +16,7 @@ namespace KODI
{
namespace GAME
{
-class CControllerFeature;
+class CPhysicalFeature;
class IConfigurationWizard;
class CGUIFeatureFactory
@@ -30,7 +30,7 @@ public:
static CGUIButtonControl* CreateButton(BUTTON_TYPE type,
const CGUIButtonControl& buttonTemplate,
IConfigurationWizard* wizard,
- const CControllerFeature& feature,
+ const CPhysicalFeature& feature,
unsigned int index);
};
} // namespace GAME
diff --git a/xbmc/games/controllers/guicontrols/GUIScalarFeatureButton.cpp b/xbmc/games/controllers/guicontrols/GUIScalarFeatureButton.cpp
index c61945b18e..5358aea90f 100644
--- a/xbmc/games/controllers/guicontrols/GUIScalarFeatureButton.cpp
+++ b/xbmc/games/controllers/guicontrols/GUIScalarFeatureButton.cpp
@@ -17,7 +17,7 @@ using namespace GAME;
CGUIScalarFeatureButton::CGUIScalarFeatureButton(const CGUIButtonControl& buttonTemplate,
IConfigurationWizard* wizard,
- const CControllerFeature& feature,
+ const CPhysicalFeature& feature,
unsigned int index)
: CGUIFeatureButton(buttonTemplate, wizard, feature, index)
{
diff --git a/xbmc/games/controllers/guicontrols/GUIScalarFeatureButton.h b/xbmc/games/controllers/guicontrols/GUIScalarFeatureButton.h
index 8881225d0e..6505684fb9 100644
--- a/xbmc/games/controllers/guicontrols/GUIScalarFeatureButton.h
+++ b/xbmc/games/controllers/guicontrols/GUIScalarFeatureButton.h
@@ -19,7 +19,7 @@ class CGUIScalarFeatureButton : public CGUIFeatureButton
public:
CGUIScalarFeatureButton(const CGUIButtonControl& buttonTemplate,
IConfigurationWizard* wizard,
- const CControllerFeature& feature,
+ const CPhysicalFeature& feature,
unsigned int index);
~CGUIScalarFeatureButton() override = default;
diff --git a/xbmc/games/controllers/guicontrols/GUISelectKeyButton.cpp b/xbmc/games/controllers/guicontrols/GUISelectKeyButton.cpp
index 0ad3640b48..ea4a65622e 100644
--- a/xbmc/games/controllers/guicontrols/GUISelectKeyButton.cpp
+++ b/xbmc/games/controllers/guicontrols/GUISelectKeyButton.cpp
@@ -22,7 +22,7 @@ CGUISelectKeyButton::CGUISelectKeyButton(const CGUIButtonControl& buttonTemplate
{
}
-const CControllerFeature& CGUISelectKeyButton::Feature(void) const
+const CPhysicalFeature& CGUISelectKeyButton::Feature(void) const
{
if (m_state == STATE::NEED_INPUT)
return m_selectedKey;
@@ -70,7 +70,7 @@ bool CGUISelectKeyButton::IsFinished(void) const
return m_state >= STATE::FINISHED;
}
-void CGUISelectKeyButton::SetKey(const CControllerFeature& key)
+void CGUISelectKeyButton::SetKey(const CPhysicalFeature& key)
{
m_selectedKey = key;
}
@@ -81,7 +81,7 @@ void CGUISelectKeyButton::Reset(void)
m_selectedKey.Reset();
}
-CControllerFeature CGUISelectKeyButton::GetFeature()
+CPhysicalFeature CGUISelectKeyButton::GetFeature()
{
- return CControllerFeature(35168); // "Select key"
+ return CPhysicalFeature(35168); // "Select key"
}
diff --git a/xbmc/games/controllers/guicontrols/GUISelectKeyButton.h b/xbmc/games/controllers/guicontrols/GUISelectKeyButton.h
index 9232886ae7..e96f78b005 100644
--- a/xbmc/games/controllers/guicontrols/GUISelectKeyButton.h
+++ b/xbmc/games/controllers/guicontrols/GUISelectKeyButton.h
@@ -9,7 +9,7 @@
#pragma once
#include "GUIFeatureButton.h"
-#include "games/controllers/ControllerFeature.h"
+#include "games/controllers/input/PhysicalFeature.h"
namespace KODI
{
@@ -25,16 +25,16 @@ public:
~CGUISelectKeyButton() override = default;
// implementation of IFeatureButton
- const CControllerFeature& Feature(void) const override;
+ const CPhysicalFeature& Feature(void) const override;
bool AllowWizard() const override { return false; }
bool PromptForInput(CEvent& waitEvent) override;
bool IsFinished() const override;
bool NeedsKey() const override { return m_state == STATE::NEED_KEY; }
- void SetKey(const CControllerFeature& key) override;
+ void SetKey(const CPhysicalFeature& key) override;
void Reset() override;
private:
- static CControllerFeature GetFeature();
+ static CPhysicalFeature GetFeature();
enum class STATE
{
@@ -45,7 +45,7 @@ private:
STATE m_state = STATE::NEED_KEY;
- CControllerFeature m_selectedKey;
+ CPhysicalFeature m_selectedKey;
};
} // namespace GAME
} // namespace KODI
diff --git a/xbmc/games/controllers/guicontrols/GUIThrottleButton.cpp b/xbmc/games/controllers/guicontrols/GUIThrottleButton.cpp
index 02c7d18fbc..69f32a166c 100644
--- a/xbmc/games/controllers/guicontrols/GUIThrottleButton.cpp
+++ b/xbmc/games/controllers/guicontrols/GUIThrottleButton.cpp
@@ -17,7 +17,7 @@ using namespace GAME;
CGUIThrottleButton::CGUIThrottleButton(const CGUIButtonControl& buttonTemplate,
IConfigurationWizard* wizard,
- const CControllerFeature& feature,
+ const CPhysicalFeature& feature,
unsigned int index)
: CGUIFeatureButton(buttonTemplate, wizard, feature, index)
{
diff --git a/xbmc/games/controllers/guicontrols/GUIThrottleButton.h b/xbmc/games/controllers/guicontrols/GUIThrottleButton.h
index effc98f689..72b7ee39e7 100644
--- a/xbmc/games/controllers/guicontrols/GUIThrottleButton.h
+++ b/xbmc/games/controllers/guicontrols/GUIThrottleButton.h
@@ -19,7 +19,7 @@ class CGUIThrottleButton : public CGUIFeatureButton
public:
CGUIThrottleButton(const CGUIButtonControl& buttonTemplate,
IConfigurationWizard* wizard,
- const CControllerFeature& feature,
+ const CPhysicalFeature& feature,
unsigned int index);
~CGUIThrottleButton() override = default;
diff --git a/xbmc/games/controllers/guicontrols/GUIWheelButton.cpp b/xbmc/games/controllers/guicontrols/GUIWheelButton.cpp
index 9df07fb568..63c3819802 100644
--- a/xbmc/games/controllers/guicontrols/GUIWheelButton.cpp
+++ b/xbmc/games/controllers/guicontrols/GUIWheelButton.cpp
@@ -17,7 +17,7 @@ using namespace GAME;
CGUIWheelButton::CGUIWheelButton(const CGUIButtonControl& buttonTemplate,
IConfigurationWizard* wizard,
- const CControllerFeature& feature,
+ const CPhysicalFeature& feature,
unsigned int index)
: CGUIFeatureButton(buttonTemplate, wizard, feature, index)
{
diff --git a/xbmc/games/controllers/guicontrols/GUIWheelButton.h b/xbmc/games/controllers/guicontrols/GUIWheelButton.h
index b099c17c8d..937703aac3 100644
--- a/xbmc/games/controllers/guicontrols/GUIWheelButton.h
+++ b/xbmc/games/controllers/guicontrols/GUIWheelButton.h
@@ -19,7 +19,7 @@ class CGUIWheelButton : public CGUIFeatureButton
public:
CGUIWheelButton(const CGUIButtonControl& buttonTemplate,
IConfigurationWizard* wizard,
- const CControllerFeature& feature,
+ const CPhysicalFeature& feature,
unsigned int index);
~CGUIWheelButton() override = default;
diff --git a/xbmc/games/controllers/input/CMakeLists.txt b/xbmc/games/controllers/input/CMakeLists.txt
new file mode 100644
index 0000000000..a6bb1ecb14
--- /dev/null
+++ b/xbmc/games/controllers/input/CMakeLists.txt
@@ -0,0 +1,15 @@
+set(SOURCES InputSink.cpp
+ PhysicalFeature.cpp
+ PhysicalPort.cpp
+ PhysicalTopology.cpp
+ PortInput.cpp
+)
+
+set(HEADERS InputSink.h
+ PhysicalFeature.h
+ PhysicalPort.h
+ PhysicalTopology.h
+ PortInput.h
+)
+
+core_add_library(games_controller_input)
diff --git a/xbmc/games/ports/InputSink.cpp b/xbmc/games/controllers/input/InputSink.cpp
index a48b4b9880..a48b4b9880 100644
--- a/xbmc/games/ports/InputSink.cpp
+++ b/xbmc/games/controllers/input/InputSink.cpp
diff --git a/xbmc/games/ports/InputSink.h b/xbmc/games/controllers/input/InputSink.h
index bd2d629dc3..bd2d629dc3 100644
--- a/xbmc/games/ports/InputSink.h
+++ b/xbmc/games/controllers/input/InputSink.h
diff --git a/xbmc/games/controllers/ControllerFeature.cpp b/xbmc/games/controllers/input/PhysicalFeature.cpp
index d6d6a4369f..24e0c41030 100644
--- a/xbmc/games/controllers/ControllerFeature.cpp
+++ b/xbmc/games/controllers/input/PhysicalFeature.cpp
@@ -6,11 +6,11 @@
* See LICENSES/README.md for more information.
*/
-#include "ControllerFeature.h"
+#include "PhysicalFeature.h"
-#include "Controller.h"
-#include "ControllerDefinitions.h"
-#include "ControllerTranslator.h"
+#include "games/controllers/Controller.h"
+#include "games/controllers/ControllerDefinitions.h"
+#include "games/controllers/ControllerTranslator.h"
#include "guilib/LocalizeStrings.h"
#include "utils/XMLUtils.h"
#include "utils/log.h"
@@ -21,18 +21,18 @@ using namespace KODI;
using namespace GAME;
using namespace JOYSTICK;
-CControllerFeature::CControllerFeature(int labelId)
+CPhysicalFeature::CPhysicalFeature(int labelId)
{
Reset();
m_labelId = labelId;
}
-void CControllerFeature::Reset(void)
+void CPhysicalFeature::Reset(void)
{
- *this = CControllerFeature();
+ *this = CPhysicalFeature();
}
-CControllerFeature& CControllerFeature::operator=(const CControllerFeature& rhs)
+CPhysicalFeature& CPhysicalFeature::operator=(const CPhysicalFeature& rhs)
{
if (this != &rhs)
{
@@ -48,7 +48,7 @@ CControllerFeature& CControllerFeature::operator=(const CControllerFeature& rhs)
return *this;
}
-std::string CControllerFeature::CategoryLabel() const
+std::string CPhysicalFeature::CategoryLabel() const
{
std::string categoryLabel;
@@ -61,7 +61,7 @@ std::string CControllerFeature::CategoryLabel() const
return categoryLabel;
}
-std::string CControllerFeature::Label() const
+std::string CPhysicalFeature::Label() const
{
std::string label;
@@ -74,10 +74,10 @@ std::string CControllerFeature::Label() const
return label;
}
-bool CControllerFeature::Deserialize(const TiXmlElement* pElement,
- const CController* controller,
- FEATURE_CATEGORY category,
- int categoryLabelId)
+bool CPhysicalFeature::Deserialize(const TiXmlElement* pElement,
+ const CController* controller,
+ FEATURE_CATEGORY category,
+ int categoryLabelId)
{
Reset();
diff --git a/xbmc/games/controllers/ControllerFeature.h b/xbmc/games/controllers/input/PhysicalFeature.h
index fd81a71bf3..6319a63a5e 100644
--- a/xbmc/games/controllers/ControllerFeature.h
+++ b/xbmc/games/controllers/input/PhysicalFeature.h
@@ -8,7 +8,7 @@
#pragma once
-#include "ControllerTypes.h"
+#include "games/controllers/ControllerTypes.h"
#include "input/joysticks/JoystickTypes.h"
#include "input/keyboard/KeyboardTypes.h"
@@ -21,16 +21,16 @@ namespace KODI
namespace GAME
{
-class CControllerFeature
+class CPhysicalFeature
{
public:
- CControllerFeature() = default;
- CControllerFeature(int labelId);
- CControllerFeature(const CControllerFeature& other) { *this = other; }
+ CPhysicalFeature() = default;
+ CPhysicalFeature(int labelId);
+ CPhysicalFeature(const CPhysicalFeature& other) { *this = other; }
void Reset(void);
- CControllerFeature& operator=(const CControllerFeature& rhs);
+ CPhysicalFeature& operator=(const CPhysicalFeature& rhs);
JOYSTICK::FEATURE_TYPE Type(void) const { return m_type; }
JOYSTICK::FEATURE_CATEGORY Category(void) const { return m_category; }
diff --git a/xbmc/games/controllers/ControllerPort.cpp b/xbmc/games/controllers/input/PhysicalPort.cpp
index 9db20a6c6c..9c53c76199 100644
--- a/xbmc/games/controllers/ControllerPort.cpp
+++ b/xbmc/games/controllers/input/PhysicalPort.cpp
@@ -6,9 +6,9 @@
* See LICENSES/README.md for more information.
*/
-#include "ControllerPort.h"
+#include "PhysicalPort.h"
-#include "ControllerDefinitions.h"
+#include "games/controllers/ControllerDefinitions.h"
#include "utils/XMLUtils.h"
#include "utils/log.h"
@@ -18,23 +18,23 @@
using namespace KODI;
using namespace GAME;
-CControllerPort::CControllerPort(std::string portId, std::vector<std::string> accepts)
+CPhysicalPort::CPhysicalPort(std::string portId, std::vector<std::string> accepts)
: m_portId(std::move(portId)), m_accepts(std::move(accepts))
{
}
-void CControllerPort::Reset()
+void CPhysicalPort::Reset()
{
- CControllerPort defaultPort;
+ CPhysicalPort defaultPort;
*this = std::move(defaultPort);
}
-bool CControllerPort::IsCompatible(const std::string& controllerId) const
+bool CPhysicalPort::IsCompatible(const std::string& controllerId) const
{
return std::find(m_accepts.begin(), m_accepts.end(), controllerId) != m_accepts.end();
}
-bool CControllerPort::Deserialize(const TiXmlElement* pElement)
+bool CPhysicalPort::Deserialize(const TiXmlElement* pElement)
{
if (pElement == nullptr)
return false;
diff --git a/xbmc/games/controllers/ControllerPort.h b/xbmc/games/controllers/input/PhysicalPort.h
index 1bb87ed3f4..83fe3a503c 100644
--- a/xbmc/games/controllers/ControllerPort.h
+++ b/xbmc/games/controllers/input/PhysicalPort.h
@@ -18,10 +18,10 @@ namespace KODI
namespace GAME
{
-class CControllerPort
+class CPhysicalPort
{
public:
- CControllerPort() = default;
+ CPhysicalPort() = default;
/*!
* \brief Create a controller port
@@ -29,7 +29,7 @@ public:
* \param portId The port's ID
* \param accepts A list of controller IDs that this port accepts
*/
- CControllerPort(std::string portId, std::vector<std::string> accepts);
+ CPhysicalPort(std::string portId, std::vector<std::string> accepts);
void Reset();
diff --git a/xbmc/games/controllers/ControllerTopology.cpp b/xbmc/games/controllers/input/PhysicalTopology.cpp
index 826aa3ac2f..2fecb5ac11 100644
--- a/xbmc/games/controllers/ControllerTopology.cpp
+++ b/xbmc/games/controllers/input/PhysicalTopology.cpp
@@ -6,9 +6,9 @@
* See LICENSES/README.md for more information.
*/
-#include "ControllerTopology.h"
+#include "PhysicalTopology.h"
-#include "ControllerDefinitions.h"
+#include "games/controllers/ControllerDefinitions.h"
#include "utils/XMLUtils.h"
#include "utils/log.h"
@@ -17,18 +17,18 @@
using namespace KODI;
using namespace GAME;
-CControllerTopology::CControllerTopology(bool bProvidesInput, std::vector<CControllerPort> ports)
+CPhysicalTopology::CPhysicalTopology(bool bProvidesInput, std::vector<CPhysicalPort> ports)
: m_bProvidesInput(bProvidesInput), m_ports(std::move(ports))
{
}
-void CControllerTopology::Reset()
+void CPhysicalTopology::Reset()
{
- CControllerTopology defaultTopology;
+ CPhysicalTopology defaultTopology;
*this = std::move(defaultTopology);
}
-bool CControllerTopology::Deserialize(const TiXmlElement* pElement)
+bool CPhysicalTopology::Deserialize(const TiXmlElement* pElement)
{
Reset();
@@ -42,7 +42,7 @@ bool CControllerTopology::Deserialize(const TiXmlElement* pElement)
{
if (pChild->ValueStr() == LAYOUT_XML_ELM_PORT)
{
- CControllerPort port;
+ CPhysicalPort port;
if (port.Deserialize(pChild))
m_ports.emplace_back(std::move(port));
}
diff --git a/xbmc/games/controllers/ControllerTopology.h b/xbmc/games/controllers/input/PhysicalTopology.h
index 6ab42ad101..bc76bb91b2 100644
--- a/xbmc/games/controllers/ControllerTopology.h
+++ b/xbmc/games/controllers/input/PhysicalTopology.h
@@ -8,7 +8,7 @@
#pragma once
-#include "ControllerPort.h"
+#include "PhysicalPort.h"
#include <vector>
@@ -26,11 +26,11 @@ namespace GAME
* whether it can provide player input (hubs like the Super Multitap don't
* provide input).
*/
-class CControllerTopology
+class CPhysicalTopology
{
public:
- CControllerTopology() = default;
- CControllerTopology(bool bProvidesInput, std::vector<CControllerPort> ports);
+ CPhysicalTopology() = default;
+ CPhysicalTopology(bool bProvidesInput, std::vector<CPhysicalPort> ports);
void Reset();
@@ -48,13 +48,13 @@ public:
*
* \return The ports
*/
- const std::vector<CControllerPort>& Ports() const { return m_ports; }
+ const std::vector<CPhysicalPort>& Ports() const { return m_ports; }
bool Deserialize(const TiXmlElement* pElement);
private:
bool m_bProvidesInput = true;
- std::vector<CControllerPort> m_ports;
+ std::vector<CPhysicalPort> m_ports;
};
} // namespace GAME
diff --git a/xbmc/games/ports/Port.cpp b/xbmc/games/controllers/input/PortInput.cpp
index 855d5d2492..dffd39a2c7 100644
--- a/xbmc/games/ports/Port.cpp
+++ b/xbmc/games/controllers/input/PortInput.cpp
@@ -6,7 +6,7 @@
* See LICENSES/README.md for more information.
*/
-#include "Port.h"
+#include "PortInput.h"
#include "InputSink.h"
#include "games/addons/GameClient.h"
@@ -17,14 +17,14 @@
using namespace KODI;
using namespace GAME;
-CPort::CPort(JOYSTICK::IInputHandler* gameInput)
+CPortInput::CPortInput(JOYSTICK::IInputHandler* gameInput)
: m_gameInput(gameInput), m_inputSink(new CInputSink(gameInput))
{
}
-CPort::~CPort() = default;
+CPortInput::~CPortInput() = default;
-void CPort::RegisterInput(JOYSTICK::IInputProvider* provider)
+void CPortInput::RegisterInput(JOYSTICK::IInputProvider* provider)
{
// Give input sink the lowest priority by registering it before the other
// input handlers
@@ -37,7 +37,7 @@ void CPort::RegisterInput(JOYSTICK::IInputProvider* provider)
m_appInput.reset(new JOYSTICK::CKeymapHandling(provider, false, this));
}
-void CPort::UnregisterInput(JOYSTICK::IInputProvider* provider)
+void CPortInput::UnregisterInput(JOYSTICK::IInputProvider* provider)
{
// Unregister in reverse order
if (provider == nullptr)
@@ -51,17 +51,17 @@ void CPort::UnregisterInput(JOYSTICK::IInputProvider* provider)
}
}
-std::string CPort::ControllerID() const
+std::string CPortInput::ControllerID() const
{
return m_gameInput->ControllerID();
}
-bool CPort::AcceptsInput(const std::string& feature) const
+bool CPortInput::AcceptsInput(const std::string& feature) const
{
return m_gameInput->AcceptsInput(feature);
}
-bool CPort::OnButtonPress(const std::string& feature, bool bPressed)
+bool CPortInput::OnButtonPress(const std::string& feature, bool bPressed)
{
if (bPressed && !m_gameInput->AcceptsInput(feature))
return false;
@@ -69,12 +69,14 @@ bool CPort::OnButtonPress(const std::string& feature, bool bPressed)
return m_gameInput->OnButtonPress(feature, bPressed);
}
-void CPort::OnButtonHold(const std::string& feature, unsigned int holdTimeMs)
+void CPortInput::OnButtonHold(const std::string& feature, unsigned int holdTimeMs)
{
m_gameInput->OnButtonHold(feature, holdTimeMs);
}
-bool CPort::OnButtonMotion(const std::string& feature, float magnitude, unsigned int motionTimeMs)
+bool CPortInput::OnButtonMotion(const std::string& feature,
+ float magnitude,
+ unsigned int motionTimeMs)
{
if (magnitude > 0.0f && !m_gameInput->AcceptsInput(feature))
return false;
@@ -82,10 +84,10 @@ bool CPort::OnButtonMotion(const std::string& feature, float magnitude, unsigned
return m_gameInput->OnButtonMotion(feature, magnitude, motionTimeMs);
}
-bool CPort::OnAnalogStickMotion(const std::string& feature,
- float x,
- float y,
- unsigned int motionTimeMs)
+bool CPortInput::OnAnalogStickMotion(const std::string& feature,
+ float x,
+ float y,
+ unsigned int motionTimeMs)
{
if ((x != 0.0f || y != 0.0f) && !m_gameInput->AcceptsInput(feature))
return false;
@@ -93,7 +95,7 @@ bool CPort::OnAnalogStickMotion(const std::string& feature,
return m_gameInput->OnAnalogStickMotion(feature, x, y, motionTimeMs);
}
-bool CPort::OnAccelerometerMotion(const std::string& feature, float x, float y, float z)
+bool CPortInput::OnAccelerometerMotion(const std::string& feature, float x, float y, float z)
{
if (!m_gameInput->AcceptsInput(feature))
return false;
@@ -101,7 +103,9 @@ bool CPort::OnAccelerometerMotion(const std::string& feature, float x, float y,
return m_gameInput->OnAccelerometerMotion(feature, x, y, z);
}
-bool CPort::OnWheelMotion(const std::string& feature, float position, unsigned int motionTimeMs)
+bool CPortInput::OnWheelMotion(const std::string& feature,
+ float position,
+ unsigned int motionTimeMs)
{
if ((position != 0.0f) && !m_gameInput->AcceptsInput(feature))
return false;
@@ -109,7 +113,9 @@ bool CPort::OnWheelMotion(const std::string& feature, float position, unsigned i
return m_gameInput->OnWheelMotion(feature, position, motionTimeMs);
}
-bool CPort::OnThrottleMotion(const std::string& feature, float position, unsigned int motionTimeMs)
+bool CPortInput::OnThrottleMotion(const std::string& feature,
+ float position,
+ unsigned int motionTimeMs)
{
if ((position != 0.0f) && !m_gameInput->AcceptsInput(feature))
return false;
@@ -117,7 +123,7 @@ bool CPort::OnThrottleMotion(const std::string& feature, float position, unsigne
return m_gameInput->OnThrottleMotion(feature, position, motionTimeMs);
}
-int CPort::GetWindowID() const
+int CPortInput::GetWindowID() const
{
return WINDOW_FULLSCREEN_GAME;
}
diff --git a/xbmc/games/ports/Port.h b/xbmc/games/controllers/input/PortInput.h
index a65ce9e28e..4e296a376c 100644
--- a/xbmc/games/ports/Port.h
+++ b/xbmc/games/controllers/input/PortInput.h
@@ -23,11 +23,11 @@ class IInputProvider;
namespace GAME
{
-class CPort : public JOYSTICK::IInputHandler, public IKeymapEnvironment
+class CPortInput : public JOYSTICK::IInputHandler, public IKeymapEnvironment
{
public:
- CPort(JOYSTICK::IInputHandler* gameInput);
- ~CPort() override;
+ CPortInput(JOYSTICK::IInputHandler* gameInput);
+ ~CPortInput() override;
void RegisterInput(JOYSTICK::IInputProvider* provider);
void UnregisterInput(JOYSTICK::IInputProvider* provider);
diff --git a/xbmc/games/controllers/types/ControllerNode.cpp b/xbmc/games/controllers/types/ControllerNode.cpp
index 50530d2642..c147ddc644 100644
--- a/xbmc/games/controllers/types/ControllerNode.cpp
+++ b/xbmc/games/controllers/types/ControllerNode.cpp
@@ -11,7 +11,7 @@
#include "ControllerHub.h"
#include "PortNode.h"
#include "games/controllers/Controller.h"
-#include "games/controllers/ControllerTopology.h"
+#include "games/controllers/input/PhysicalTopology.h"
#include <algorithm>
#include <utility>
diff --git a/xbmc/games/controllers/types/PortNode.cpp b/xbmc/games/controllers/types/PortNode.cpp
index b3df64764d..12a560f37f 100644
--- a/xbmc/games/controllers/types/PortNode.cpp
+++ b/xbmc/games/controllers/types/PortNode.cpp
@@ -9,7 +9,7 @@
#include "PortNode.h"
#include "games/controllers/Controller.h"
-#include "games/controllers/ControllerPort.h"
+#include "games/controllers/input/PhysicalPort.h"
#include "games/controllers/types/ControllerHub.h"
#include <algorithm>
@@ -87,7 +87,7 @@ void CPortNode::SetCompatibleControllers(ControllerNodeVec controllers)
bool CPortNode::IsControllerAccepted(const std::string& controllerId) const
{
// Base case
- CControllerPort port;
+ CPhysicalPort port;
GetPort(port);
if (port.IsCompatible(controllerId))
return true;
@@ -107,7 +107,7 @@ bool CPortNode::IsControllerAccepted(const std::string& portAddress,
if (m_address == portAddress)
{
// Base case
- CControllerPort port;
+ CPhysicalPort port;
GetPort(port);
if (port.IsCompatible(controllerId))
bAccepted = true;
@@ -127,11 +127,11 @@ bool CPortNode::IsControllerAccepted(const std::string& portAddress,
return bAccepted;
}
-void CPortNode::GetPort(CControllerPort& port) const
+void CPortNode::GetPort(CPhysicalPort& port) const
{
std::vector<std::string> accepts;
for (const CControllerNode& node : m_controllers)
accepts.emplace_back(node.Controller()->ID());
- port = CControllerPort(m_portId, std::move(accepts));
+ port = CPhysicalPort(m_portId, std::move(accepts));
}
diff --git a/xbmc/games/controllers/types/PortNode.h b/xbmc/games/controllers/types/PortNode.h
index 7104c7b9e4..3935fd9810 100644
--- a/xbmc/games/controllers/types/PortNode.h
+++ b/xbmc/games/controllers/types/PortNode.h
@@ -18,7 +18,7 @@ namespace KODI
{
namespace GAME
{
-class CControllerPort;
+class CPhysicalPort;
/*!
* \brief Collection of nodes that can be connected to this port
@@ -102,7 +102,7 @@ public:
bool IsControllerAccepted(const std::string& portAddress, const std::string& controllerId) const;
private:
- void GetPort(CControllerPort& port) const;
+ void GetPort(CPhysicalPort& port) const;
bool m_bConnected = false;
unsigned int m_active = 0;
diff --git a/xbmc/games/controllers/windows/GUIConfigurationWizard.cpp b/xbmc/games/controllers/windows/GUIConfigurationWizard.cpp
index 7d319a5bc5..c3cad36f8a 100644
--- a/xbmc/games/controllers/windows/GUIConfigurationWizard.cpp
+++ b/xbmc/games/controllers/windows/GUIConfigurationWizard.cpp
@@ -10,9 +10,9 @@
#include "ServiceBroker.h"
#include "games/controllers/Controller.h"
-#include "games/controllers/ControllerFeature.h"
#include "games/controllers/dialogs/GUIDialogAxisDetection.h"
#include "games/controllers/guicontrols/GUIFeatureButton.h"
+#include "games/controllers/input/PhysicalFeature.h"
#include "input/IKeymap.h"
#include "input/InputManager.h"
#include "input/joysticks/JoystickUtils.h"
@@ -104,7 +104,7 @@ bool CGUIConfigurationWizard::Abort(bool bWait /* = true */)
return bWasRunning;
}
-void CGUIConfigurationWizard::RegisterKey(const CControllerFeature& key)
+void CGUIConfigurationWizard::RegisterKey(const CPhysicalFeature& key)
{
if (key.Keycode() != XBMCK_UNKNOWN)
m_keyMap[key.Keycode()] = key;
@@ -266,7 +266,7 @@ bool CGUIConfigurationWizard::MapPrimitive(JOYSTICK::IButtonMap* buttonMap,
auto it = m_keyMap.find(primitive.Keycode());
if (it != m_keyMap.end())
{
- const CControllerFeature& key = it->second;
+ const CPhysicalFeature& key = it->second;
currentButton->SetKey(key);
m_inputEvent.Set();
}
@@ -279,7 +279,7 @@ bool CGUIConfigurationWizard::MapPrimitive(JOYSTICK::IButtonMap* buttonMap,
}
else
{
- const CControllerFeature& feature = currentButton->Feature();
+ const CPhysicalFeature& feature = currentButton->Feature();
if (primitive.Type() == PRIMITIVE_TYPE::RELATIVE_POINTER &&
feature.Type() != FEATURE_TYPE::RELPOINTER)
diff --git a/xbmc/games/controllers/windows/GUIConfigurationWizard.h b/xbmc/games/controllers/windows/GUIConfigurationWizard.h
index a9bc9de4bc..b69badf5c9 100644
--- a/xbmc/games/controllers/windows/GUIConfigurationWizard.h
+++ b/xbmc/games/controllers/windows/GUIConfigurationWizard.h
@@ -9,7 +9,7 @@
#pragma once
#include "IConfigurationWindow.h"
-#include "games/controllers/ControllerFeature.h"
+#include "games/controllers/input/PhysicalFeature.h"
#include "input/XBMC_keysym.h"
#include "input/joysticks/DriverPrimitive.h"
#include "input/joysticks/interfaces/IButtonMapper.h"
@@ -50,7 +50,7 @@ public:
const std::vector<IFeatureButton*>& buttons) override;
void OnUnfocus(IFeatureButton* button) override;
bool Abort(bool bWait = true) override;
- void RegisterKey(const CControllerFeature& key) override;
+ void RegisterKey(const CPhysicalFeature& key) override;
void UnregisterKeys() override;
// implementation of IButtonMapper
@@ -111,7 +111,7 @@ private:
// Keyboard handling
std::unique_ptr<KEYBOARD::IActionMap> m_actionMap;
- std::map<XBMCKey, CControllerFeature> m_keyMap; // Keycode -> feature
+ std::map<XBMCKey, CPhysicalFeature> m_keyMap; // Keycode -> feature
};
} // namespace GAME
} // namespace KODI
diff --git a/xbmc/games/controllers/windows/GUIFeatureList.cpp b/xbmc/games/controllers/windows/GUIFeatureList.cpp
index 617b83a977..d43c16d1ee 100644
--- a/xbmc/games/controllers/windows/GUIFeatureList.cpp
+++ b/xbmc/games/controllers/windows/GUIFeatureList.cpp
@@ -13,11 +13,11 @@
#include "games/addons/GameClient.h"
#include "games/addons/input/GameClientInput.h"
#include "games/controllers/Controller.h"
-#include "games/controllers/ControllerFeature.h"
#include "games/controllers/guicontrols/GUIFeatureButton.h"
#include "games/controllers/guicontrols/GUIFeatureControls.h"
#include "games/controllers/guicontrols/GUIFeatureFactory.h"
#include "games/controllers/guicontrols/GUIFeatureTranslator.h"
+#include "games/controllers/input/PhysicalFeature.h"
#include "guilib/GUIButtonControl.h"
#include "guilib/GUIControlGroupList.h"
#include "guilib/GUIImage.h"
@@ -87,7 +87,7 @@ void CGUIFeatureList::Load(const ControllerPtr& controller)
m_controller = controller;
// Get features
- const std::vector<CControllerFeature>& features = controller->Features();
+ const std::vector<CPhysicalFeature>& features = controller->Features();
// Split into groups
auto featureGroups = GetFeatureGroups(features);
@@ -184,13 +184,13 @@ void CGUIFeatureList::CleanupButtons(void)
}
std::vector<CGUIFeatureList::FeatureGroup> CGUIFeatureList::GetFeatureGroups(
- const std::vector<CControllerFeature>& features) const
+ const std::vector<CPhysicalFeature>& features) const
{
std::vector<FeatureGroup> groups;
// Get group names
std::vector<std::string> groupNames;
- for (const CControllerFeature& feature : features)
+ for (const CPhysicalFeature& feature : features)
{
// Skip features not supported by the game client
if (m_gameClient)
@@ -258,13 +258,13 @@ bool CGUIFeatureList::HasButton(JOYSTICK::FEATURE_TYPE type) const
}
std::vector<CGUIButtonControl*> CGUIFeatureList::GetButtons(
- const std::vector<CControllerFeature>& features, unsigned int startIndex)
+ const std::vector<CPhysicalFeature>& features, unsigned int startIndex)
{
std::vector<CGUIButtonControl*> buttons;
// Create buttons
unsigned int buttonIndex = startIndex;
- for (const CControllerFeature& feature : features)
+ for (const CPhysicalFeature& feature : features)
{
BUTTON_TYPE buttonType = CGUIFeatureTranslator::GetButtonType(feature.Type());
@@ -283,15 +283,15 @@ std::vector<CGUIButtonControl*> CGUIFeatureList::GetButtons(
}
CGUIButtonControl* CGUIFeatureList::GetSelectKeyButton(
- const std::vector<CControllerFeature>& features, unsigned int buttonIndex)
+ const std::vector<CPhysicalFeature>& features, unsigned int buttonIndex)
{
// Expose keycodes to the wizard
- for (const CControllerFeature& feature : features)
+ for (const CPhysicalFeature& feature : features)
{
if (feature.Type() == JOYSTICK::FEATURE_TYPE::KEY)
m_wizard->RegisterKey(feature);
}
return CGUIFeatureFactory::CreateButton(BUTTON_TYPE::SELECT_KEY, *m_guiButtonTemplate, m_wizard,
- CControllerFeature(), buttonIndex);
+ CPhysicalFeature(), buttonIndex);
}
diff --git a/xbmc/games/controllers/windows/GUIFeatureList.h b/xbmc/games/controllers/windows/GUIFeatureList.h
index c01f07ff70..c7df54f09f 100644
--- a/xbmc/games/controllers/windows/GUIFeatureList.h
+++ b/xbmc/games/controllers/windows/GUIFeatureList.h
@@ -10,8 +10,8 @@
#include "IConfigurationWindow.h"
#include "games/GameTypes.h"
-#include "games/controllers/ControllerFeature.h"
#include "games/controllers/ControllerTypes.h"
+#include "games/controllers/input/PhysicalFeature.h"
#include "input/joysticks/JoystickTypes.h"
class CGUIButtonControl;
@@ -47,17 +47,17 @@ private:
struct FeatureGroup
{
std::string groupName;
- std::vector<CControllerFeature> features;
+ std::vector<CPhysicalFeature> features;
/*!
* True if this group is a button that allows the user to map a key of
* their choosing.
*/
bool bIsVirtualKey = false;
};
- std::vector<FeatureGroup> GetFeatureGroups(const std::vector<CControllerFeature>& features) const;
- std::vector<CGUIButtonControl*> GetButtons(const std::vector<CControllerFeature>& features,
+ std::vector<FeatureGroup> GetFeatureGroups(const std::vector<CPhysicalFeature>& features) const;
+ std::vector<CGUIButtonControl*> GetButtons(const std::vector<CPhysicalFeature>& features,
unsigned int startIndex);
- CGUIButtonControl* GetSelectKeyButton(const std::vector<CControllerFeature>& features,
+ CGUIButtonControl* GetSelectKeyButton(const std::vector<CPhysicalFeature>& features,
unsigned int buttonIndex);
// GUI stuff
diff --git a/xbmc/games/controllers/windows/IConfigurationWindow.h b/xbmc/games/controllers/windows/IConfigurationWindow.h
index 6620de39be..017adf0f87 100644
--- a/xbmc/games/controllers/windows/IConfigurationWindow.h
+++ b/xbmc/games/controllers/windows/IConfigurationWindow.h
@@ -40,7 +40,7 @@ namespace KODI
{
namespace GAME
{
-class CControllerFeature;
+class CPhysicalFeature;
/*!
* \brief A list populated by installed controllers
@@ -151,7 +151,7 @@ public:
/*!
* \brief Get the feature represented by this button
*/
- virtual const CControllerFeature& Feature(void) const = 0;
+ virtual const CPhysicalFeature& Feature(void) const = 0;
/*!
* \brief Allow the wizard to include this feature in a list of buttons
@@ -207,7 +207,7 @@ public:
*
* \param key The key that was pressed
*/
- virtual void SetKey(const CControllerFeature& key) {}
+ virtual void SetKey(const CPhysicalFeature& key) {}
/*!
* \brief Reset button after prompting for input has finished
@@ -251,7 +251,7 @@ public:
* This should be called before Run(). It allows the user to choose a key
* to map instead of scrolling through a long list.
*/
- virtual void RegisterKey(const CControllerFeature& key) = 0;
+ virtual void RegisterKey(const CPhysicalFeature& key) = 0;
/*!
* \brief Unregister all registered keys
diff --git a/xbmc/games/ports/CMakeLists.txt b/xbmc/games/ports/CMakeLists.txt
deleted file mode 100644
index d9c6db3045..0000000000
--- a/xbmc/games/ports/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-set(SOURCES InputSink.cpp
- Port.cpp)
-
-set(HEADERS InputSink.h
- Port.h)
-
-core_add_library(gameports)
diff --git a/xbmc/input/joysticks/generic/ButtonMapping.cpp b/xbmc/input/joysticks/generic/ButtonMapping.cpp
index b3ca8a4505..5ef4cc30ed 100644
--- a/xbmc/input/joysticks/generic/ButtonMapping.cpp
+++ b/xbmc/input/joysticks/generic/ButtonMapping.cpp
@@ -10,8 +10,8 @@
#include "ServiceBroker.h"
#include "games/controllers/Controller.h"
-#include "games/controllers/ControllerFeature.h"
#include "games/controllers/ControllerManager.h"
+#include "games/controllers/input/PhysicalFeature.h"
#include "input/IKeymap.h"
#include "input/InputTranslator.h"
#include "input/Key.h"