From c04dcc2e7d834218ef2d4194331e383402495ae1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 10 Apr 2024 20:07:22 +0200 Subject: Adding upstream version 2:20.4+dfsg. Signed-off-by: Daniel Baumann --- xbmc/games/addons/input/GameClientDevice.h | 77 ++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 xbmc/games/addons/input/GameClientDevice.h (limited to 'xbmc/games/addons/input/GameClientDevice.h') diff --git a/xbmc/games/addons/input/GameClientDevice.h b/xbmc/games/addons/input/GameClientDevice.h new file mode 100644 index 0000000..403d76c --- /dev/null +++ b/xbmc/games/addons/input/GameClientDevice.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2017-2018 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 + +#include "games/GameTypes.h" +#include "games/controllers/ControllerTypes.h" + +#include + +struct game_input_device; +struct game_input_port; + +namespace KODI +{ +namespace GAME +{ +class CPhysicalPort; + +/*! + * \ingroup games + * \brief Represents a device connected to a port + */ +class CGameClientDevice +{ +public: + /*! + * \brief Construct a device + * + * \param device The device Game API struct + */ + CGameClientDevice(const game_input_device& device); + + /*! + * \brief Construct a device from a controller add-on + * + * \param controller The controller add-on + */ + CGameClientDevice(const ControllerPtr& controller); + + /*! + * \brief Destructor + */ + ~CGameClientDevice(); + + /*! + * \brief The controller profile + */ + const ControllerPtr& Controller() const { return m_controller; } + + /*! + * \brief The ports on this device + */ + const GameClientPortVec& Ports() const { return m_ports; } + +private: + /*! + * \brief Add a controller port + * + * \param logicalPort The logical port Game API struct + * \param physicalPort The physical port definition + */ + void AddPort(const game_input_port& logicalPort, const CPhysicalPort& physicalPort); + + // Helper function + static ControllerPtr GetController(const char* controllerId); + + ControllerPtr m_controller; + GameClientPortVec m_ports; +}; +} // namespace GAME +} // namespace KODI -- cgit v1.2.3