xbmc
GameClientProperties.h
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 
40 {
41 public:
42  CGameClientProperties(const CGameClient& parent, AddonProps_Game& props);
43  ~CGameClientProperties(void) { ReleaseResources(); }
44 
45  bool InitializeProperties(void);
46 
47 private:
48  // Release mutable resources
49  void ReleaseResources(void);
50 
51  // Equal to parent's real library path
52  const char* GetLibraryPath(void);
53 
54  // List of proxy DLLs needed to load the game client
55  const char** GetProxyDllPaths(const ADDON::VECADDONS& addons);
56 
57  // Number of proxy DLLs needed to load the game client
58  unsigned int GetProxyDllCount(void) const;
59 
60  // Paths to game resources
61  const char** GetResourceDirectories(void);
62 
63  // Number of resource directories
64  unsigned int GetResourceDirectoryCount(void) const;
65 
66  // Equal to special://profile/addon_data/<parent's id>
67  const char* GetProfileDirectory(void);
68 
69  // List of extensions from addon.xml
70  const char** GetExtensions(void);
71 
72  // Number of extensions
73  unsigned int GetExtensionCount(void) const;
74 
75  // Helper functions
76  bool GetProxyAddons(ADDON::VECADDONS& addons);
77  void AddProxyDll(const GameClientPtr& gameClient);
78  bool HasProxyDll(const std::string& strLibPath) const;
79 
80  // Construction parameters
81  const CGameClient& m_parent;
82  AddonProps_Game& m_properties;
83 
84  // Buffers to hold the strings
85  std::string m_strLibraryPath;
86  std::vector<char*> m_proxyDllPaths;
87  std::vector<char*> m_resourceDirectories;
88  std::string m_strProfileDirectory;
89  std::vector<char*> m_extensions;
90 };
91 
92 } // namespace GAME
93 } // namespace KODI
Game properties.
Definition: game.h:1075
Interface between Kodi and Game add-ons.
Definition: GameClient.h:115
Controller configuration window.
Definition: AudioDecoder.h:18
C++ wrapper for properties to pass to the DLL.
Definition: GameClientProperties.h:39
Definition: Addon.cpp:39