11 #include "GameClientSubsystem.h" 12 #include "addons/binary-addons/AddonDll.h" 13 #include "addons/kodi-dev-kit/include/kodi/addon-instance/Game.h" 14 #include "threads/CriticalSection.h" 35 class CGameClientCheevos;
36 class CGameClientInGameSaves;
37 class CGameClientInput;
38 class CGameClientProperties;
39 class IGameInputCallback;
56 info->parent =
nullptr;
57 info->first_instance =
true;
70 delete m_ifc.functions;
72 delete m_ifc.info->functions;
76 delete m_ifc.game->toAddon;
77 delete m_ifc.game->toKodi;
78 delete m_ifc.game->props;
118 explicit CGameClient(
const ADDON::AddonInfoPtr& addonInfo);
135 std::string LibPath()
const override;
136 ADDON::AddonPtr GetRunningInstance()
const override;
139 bool SupportsStandalone()
const {
return m_bSupportsStandalone; }
140 bool SupportsPath()
const;
141 bool SupportsVFS()
const {
return m_bSupportsVFS; }
142 const std::set<std::string>& GetExtensions()
const {
return m_extensions; }
143 bool SupportsAllExtensions()
const {
return m_bSupportsAllExtensions; }
144 bool IsExtensionValid(
const std::string& strExtension)
const;
145 const std::string& GetEmulatorName()
const {
return m_emulatorName; }
146 const std::string& GetPlatforms()
const {
return m_platforms; }
149 bool Initialize(
void);
157 const std::string& GetGamePath()
const {
return m_gamePath; }
160 bool RequiresGameLoop()
const {
return m_bRequiresGameLoop; }
161 bool IsPlaying()
const {
return m_bIsPlaying; }
162 size_t GetSerializeSize()
const {
return m_serializeSize; }
163 double GetFrameRate()
const {
return m_framerate; }
164 double GetSampleRate()
const {
return m_samplerate; }
168 size_t SerializeSize()
const {
return m_serializeSize; }
169 bool Serialize(uint8_t* data,
size_t size);
170 bool Deserialize(
const uint8_t* data,
size_t size);
180 bool LogError(GAME_ERROR error,
const char* strMethod)
const;
181 void LogException(
const char* strFunctionName)
const;
185 bool InitializeGameplay(
const std::string& gamePath,
189 void NotifyError(GAME_ERROR error);
190 std::string GetMissingResource();
193 void LogAddonProperties(
void)
const;
199 static void cb_close_game(KODI_HANDLE kodiInstance);
200 static KODI_GAME_STREAM_HANDLE cb_open_stream(KODI_HANDLE kodiInstance,
202 static bool cb_get_stream_buffer(KODI_HANDLE kodiInstance,
203 KODI_GAME_STREAM_HANDLE stream,
207 static void cb_add_stream_data(KODI_HANDLE kodiInstance,
208 KODI_GAME_STREAM_HANDLE stream,
210 static void cb_release_stream_buffer(KODI_HANDLE kodiInstance,
211 KODI_GAME_STREAM_HANDLE stream,
213 static void cb_close_stream(KODI_HANDLE kodiInstance, KODI_GAME_STREAM_HANDLE stream);
214 static game_proc_address_t cb_hw_get_proc_address(KODI_HANDLE kodiInstance,
const char* sym);
215 static bool cb_input_event(KODI_HANDLE kodiInstance,
const game_input_event* event);
234 static std::pair<std::string, std::string> ParseLibretroName(
const std::string& addonName);
241 bool m_bSupportsStandalone;
242 std::set<std::string> m_extensions;
243 bool m_bSupportsAllExtensions;
244 std::string m_emulatorName;
245 std::string m_platforms;
248 std::atomic_bool m_bIsPlaying;
249 std::string m_gamePath;
250 bool m_bRequiresGameLoop =
false;
251 size_t m_serializeSize;
253 double m_framerate = 0.0;
254 double m_samplerate = 0.0;
258 std::unique_ptr<CGameClientInGameSaves> m_inGameSaves;
260 CCriticalSection m_critSection;
Helper class to have "C" struct created before other parts becomes his pointer.
Definition: GameClient.h:45
Definition: AddonDll.h:51
Game callbacks.
Definition: game.h:1137
Game properties.
Definition: game.h:1075
Game instance, see kodi::addon::CInstanceGame.
Definition: versions.h:224
Definition: GameClientCheevos.h:28
void(* game_proc_address_t)(void)
Hardware framebuffer process function address
Definition: game.h:406
Definition: addon_base.h:219
Definition: IStreamManager.h:18
Stream packet and ephemeral metadata
Definition: game.h:528
Definition: addon_base.h:267
Interface between Kodi and Game add-ons.
Definition: GameClient.h:115
Controller configuration window.
Definition: AudioDecoder.h:18
Game function hooks.
Definition: game.h:1160
Stream buffers for hardware rendering and zero-copy support
Definition: game.h:506
Definition: addon_base.h:254
C++ wrapper for properties to pass to the DLL.
Definition: GameClientProperties.h:39
GAME_REGION
Game reguin definition
Definition: game.h:562
Definition: GameClientSubsystem.h:26
Game instance.
Definition: game.h:1223
AddonInstance_Game * GetInstanceInterface()
To get the interface table used between addon and kodi.
Definition: GameClient.h:177
Immutable stream metadata
Definition: game.h:482
Definition: GameClientStreams.h:29
Definition: addon_base.h:211
Represents a file on a share.
Definition: FileItem.h:102