| 1 |
/* |
| 2 |
* Copyright (C) 2015-2021 Team Kodi (https://kodi.tv) |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 5 |
* See LICENSE.md for more information. |
| 6 |
*/ |
| 7 |
|
| 8 |
#pragma once |
| 9 |
|
| 10 |
#include "InputTypes.h" |
| 11 |
|
| 12 |
#include <vector> |
| 13 |
#include <string> |
| 14 |
|
| 15 |
// TODO: Make this class generic and move XML-specific stuff to xml subfolder |
| 16 |
class TiXmlElement; |
| 17 |
|
| 18 |
namespace LIBRETRO |
| 19 |
{ |
| 20 |
class CButtonMapper |
| 21 |
{ |
| 22 |
private: |
| 23 |
CButtonMapper(void); |
| 24 |
|
| 25 |
public: |
| 26 |
static CButtonMapper& Get(void); |
| 27 |
|
| 28 |
bool LoadButtonMap(void); |
| 29 |
|
| 30 |
libretro_device_t GetLibretroType(const std::string& strControllerId); |
| 31 |
|
| 32 |
libretro_subclass_t GetSubclass(const std::string& strControllerId); |
| 33 |
|
| 34 |
int GetLibretroIndex(const std::string& strControllerId, const std::string& strFeatureName); |
| 35 |
libretro_device_t GetLibretroDevice(const std::string& strControllerId, const std::string& strFeatureName) const; |
| 36 |
int GetAxisID(const std::string& strControllerId, const std::string& strFeatureName) const; |
| 37 |
|
| 38 |
std::string GetControllerFeature(const std::string& strControllerId, const std::string& strLibretroFeature); |
| 39 |
|
| 40 |
private: |
| 41 |
bool HasController(const std::string& strControllerId) const; |
| 42 |
std::string GetFeature(const std::string& strControllerId, const std::string& strFeatureName) const; |
| 43 |
std::string GetAxis(const std::string& strControllerId, const std::string& strFeatureName) const; |
| 44 |
|
| 45 |
bool Deserialize(TiXmlElement* pElement); |
| 46 |
|
| 47 |
using DeviceVector = std::vector<DevicePtr>; |
| 48 |
using DeviceIt = DeviceVector::const_iterator; |
| 49 |
|
| 50 |
static DeviceIt GetDevice(const DeviceVector &devices, |
| 51 |
const std::string &controllerId); |
| 52 |
|
| 53 |
bool m_bLoadAttempted; |
| 54 |
DeviceVector m_devices; |
| 55 |
}; |
| 56 |
} |