| 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 "controllers/ControllerTypes.h" |
| 12 |
|
| 13 |
#include <future> |
| 14 |
#include <memory> |
| 15 |
#include <string> |
| 16 |
|
| 17 |
class CInputManager; |
| 18 |
class CProfileManager; |
| 19 |
|
| 20 |
namespace PERIPHERALS |
| 21 |
{ |
| 22 |
class CPeripherals; |
| 23 |
} |
| 24 |
|
| 25 |
namespace KODI |
| 26 |
{ |
| 27 |
namespace RETRO |
| 28 |
{ |
| 29 |
class CGUIGameRenderManager; |
| 30 |
} |
| 31 |
|
| 32 |
namespace GAME |
| 33 |
{ |
| 34 |
class CAgentInput; |
| 35 |
class CControllerManager; |
| 36 |
class CGameSettings; |
| 37 |
|
| 38 |
/*! |
| 39 |
* \ingroup games |
| 40 |
*/ |
| 41 |
class CGameServices |
| 42 |
{ |
| 43 |
public: |
| 44 |
CGameServices(CControllerManager& controllerManager, |
| 45 |
RETRO::CGUIGameRenderManager& renderManager, |
| 46 |
PERIPHERALS::CPeripherals& peripheralManager, |
| 47 |
const CProfileManager& profileManager, |
| 48 |
CInputManager& inputManager); |
| 49 |
~CGameServices(); |
| 50 |
|
| 51 |
ControllerPtr GetController(const std::string& controllerId); |
| 52 |
ControllerPtr GetDefaultController(); |
| 53 |
ControllerPtr GetDefaultKeyboard(); |
| 54 |
ControllerPtr GetDefaultMouse(); |
| 55 |
ControllerVector GetControllers(); |
| 56 |
|
| 57 |
/*! |
| 58 |
* \brief Translate a feature on a controller into its localized name |
| 59 |
* |
| 60 |
* \param controllerId The controller ID that the feature belongs to |
| 61 |
* \param featureName The feature name |
| 62 |
* |
| 63 |
* \return The localized feature name, or empty if the controller or feature |
| 64 |
* doesn't exist |
| 65 |
*/ |
| 66 |
std::string TranslateFeature(const std::string& controllerId, const std::string& featureName); |
| 67 |
|
| 68 |
std::string GetSavestatesFolder() const; |
| 69 |
|
| 70 |
CGameSettings& GameSettings() { return *m_gameSettings; } |
| 71 |
|
| 72 |
RETRO::CGUIGameRenderManager& GameRenderManager() { return m_gameRenderManager; } |
| 73 |
|
| 74 |
CAgentInput& AgentInput() { return *m_agentInput; } |
| 75 |
|
| 76 |
/*! |
| 77 |
* \brief Called when an add-on repo is installed |
| 78 |
* |
| 79 |
* If the repo contains game add-ons, it can introduce new file extensions |
| 80 |
* to the list of known game extensions. |
| 81 |
*/ |
| 82 |
void OnAddonRepoInstalled(); |
| 83 |
|
| 84 |
private: |
| 85 |
// Construction parameters |
| 86 |
CControllerManager& m_controllerManager; |
| 87 |
RETRO::CGUIGameRenderManager& m_gameRenderManager; |
| 88 |
const CProfileManager& m_profileManager; |
| 89 |
|
| 90 |
// Game services |
| 91 |
std::unique_ptr<CGameSettings> m_gameSettings; |
| 92 |
std::unique_ptr<CAgentInput> m_agentInput; |
| 93 |
|
| 94 |
// Game threads |
| 95 |
std::future<void> m_initializationTask; |
| 96 |
}; |
| 97 |
} // namespace GAME |
| 98 |
} // namespace KODI |