| 1 |
/* |
| 2 |
* Copyright (C) 2017-2018 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include "games/ports/input/PhysicalPort.h" |
| 12 |
|
| 13 |
#include <vector> |
| 14 |
|
| 15 |
namespace tinyxml2 |
| 16 |
{ |
| 17 |
class XMLElement; |
| 18 |
} |
| 19 |
|
| 20 |
namespace KODI |
| 21 |
{ |
| 22 |
namespace GAME |
| 23 |
{ |
| 24 |
|
| 25 |
/*! |
| 26 |
* \ingroup games |
| 27 |
* |
| 28 |
* \brief Represents the physical topology of controller add-ons |
| 29 |
* |
| 30 |
* The physical topology of a controller defines how many ports it has and |
| 31 |
* whether it can provide player input (hubs like the Super Multitap don't |
| 32 |
* provide input). |
| 33 |
*/ |
| 34 |
class CPhysicalTopology |
| 35 |
{ |
| 36 |
public: |
| 37 |
CPhysicalTopology() = default; |
| 38 |
CPhysicalTopology(bool bProvidesInput, std::vector<CPhysicalPort> ports); |
| 39 |
|
| 40 |
void Reset(); |
| 41 |
|
| 42 |
/*! |
| 43 |
* \brief Check if the controller can provide player input |
| 44 |
* |
| 45 |
* This allows hubs to specify that they provide no input |
| 46 |
* |
| 47 |
* \return True if the controller can provide player input, false otherwise |
| 48 |
*/ |
| 49 |
bool ProvidesInput() const { return m_bProvidesInput; } |
| 50 |
|
| 51 |
/*! |
| 52 |
* \brief Get a list of ports provided by this controller |
| 53 |
* |
| 54 |
* \return The ports |
| 55 |
*/ |
| 56 |
const std::vector<CPhysicalPort>& Ports() const { return m_ports; } |
| 57 |
|
| 58 |
bool Deserialize(const tinyxml2::XMLElement* pElement); |
| 59 |
|
| 60 |
private: |
| 61 |
bool m_bProvidesInput = true; |
| 62 |
std::vector<CPhysicalPort> m_ports; |
| 63 |
}; |
| 64 |
|
| 65 |
} // namespace GAME |
| 66 |
} // namespace KODI |