| 1 |
/* |
| 2 |
* Copyright (C) 2012-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 "addons/kodi-dev-kit/include/kodi/addon-instance/Game.h" |
| 12 |
#include "games/GameTypes.h" |
| 13 |
|
| 14 |
#include <string> |
| 15 |
#include <vector> |
| 16 |
|
| 17 |
struct AddonProps_Game; |
| 18 |
|
| 19 |
namespace ADDON |
| 20 |
{ |
| 21 |
class IAddon; |
| 22 |
using AddonPtr = std::shared_ptr<IAddon>; |
| 23 |
using VECADDONS = std::vector<AddonPtr>; |
| 24 |
} // namespace ADDON |
| 25 |
|
| 26 |
namespace KODI |
| 27 |
{ |
| 28 |
namespace GAME |
| 29 |
{ |
| 30 |
|
| 31 |
class CGameClient; |
| 32 |
|
| 33 |
/** |
| 34 |
* \ingroup games |
| 35 |
* |
| 36 |
* \brief C++ wrapper for properties to pass to the DLL |
| 37 |
* |
| 38 |
* Game client properties declared in addon-instance/Game.h. |
| 39 |
*/ |
| 40 |
class CGameClientProperties |
| 41 |
{ |
| 42 |
public: |
| 43 |
CGameClientProperties(const CGameClient& parent, AddonProps_Game& props); |
| 44 |
~CGameClientProperties(void) { ReleaseResources(); } |
| 45 |
|
| 46 |
bool InitializeProperties(void); |
| 47 |
|
| 48 |
private: |
| 49 |
// Release mutable resources |
| 50 |
void ReleaseResources(void); |
| 51 |
|
| 52 |
// Equal to parent's real library path |
| 53 |
const char* GetLibraryPath(void); |
| 54 |
|
| 55 |
// List of proxy DLLs needed to load the game client |
| 56 |
const char** GetProxyDllPaths(const ADDON::VECADDONS& addons); |
| 57 |
|
| 58 |
// Number of proxy DLLs needed to load the game client |
| 59 |
unsigned int GetProxyDllCount(void) const; |
| 60 |
|
| 61 |
// Paths to game resources |
| 62 |
const char** GetResourceDirectories(void); |
| 63 |
|
| 64 |
// Number of resource directories |
| 65 |
unsigned int GetResourceDirectoryCount(void) const; |
| 66 |
|
| 67 |
// Equal to special://profile/addon_data/<parent's id> |
| 68 |
const char* GetProfileDirectory(void); |
| 69 |
|
| 70 |
// List of extensions from addon.xml |
| 71 |
const char** GetExtensions(void); |
| 72 |
|
| 73 |
// Number of extensions |
| 74 |
unsigned int GetExtensionCount(void) const; |
| 75 |
|
| 76 |
// Helper functions |
| 77 |
bool GetProxyAddons(ADDON::VECADDONS& addons); |
| 78 |
void AddProxyDll(const GameClientPtr& gameClient); |
| 79 |
bool HasProxyDll(const std::string& strLibPath) const; |
| 80 |
|
| 81 |
// Construction parameters |
| 82 |
const CGameClient& m_parent; |
| 83 |
AddonProps_Game& m_properties; |
| 84 |
|
| 85 |
// Buffers to hold the strings |
| 86 |
std::string m_strLibraryPath; |
| 87 |
std::vector<char*> m_proxyDllPaths; |
| 88 |
std::vector<char*> m_resourceDirectories; |
| 89 |
std::string m_strProfileDirectory; |
| 90 |
std::vector<char*> m_extensions; |
| 91 |
}; |
| 92 |
|
| 93 |
} // namespace GAME |
| 94 |
} // namespace KODI |