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;
57 info->parent =
nullptr;
58 info->first_instance =
true;
71 delete m_ifc.functions;
73 delete m_ifc.info->functions;
77 delete m_ifc.game->toAddon;
78 delete m_ifc.game->toKodi;
79 delete m_ifc.game->props;
119 explicit CGameClient(
const ADDON::AddonInfoPtr& addonInfo);
136 std::string LibPath()
const override;
137 ADDON::AddonPtr GetRunningInstance()
const override;
140 bool SupportsStandalone()
const {
return m_bSupportsStandalone; }
141 bool SupportsPath()
const;
142 bool SupportsVFS()
const {
return m_bSupportsVFS; }
143 const std::set<std::string>& GetExtensions()
const {
return m_extensions; }
144 bool SupportsAllExtensions()
const {
return m_bSupportsAllExtensions; }
145 bool IsExtensionValid(
const std::string& strExtension)
const;
146 const std::string& GetEmulatorName()
const {
return m_emulatorName; }
147 const std::string& GetPlatforms()
const {
return m_platforms; }
150 bool Initialize(
void);
158 const std::string& GetGamePath()
const {
return m_gamePath; }
161 bool RequiresGameLoop()
const {
return m_bRequiresGameLoop; }
162 bool IsPlaying()
const {
return m_bIsPlaying; }
163 size_t GetSerializeSize()
const {
return m_serializeSize; }
164 double GetFrameRate()
const {
return m_framerate; }
165 double GetSampleRate()
const {
return m_samplerate; }
169 size_t SerializeSize()
const {
return m_serializeSize; }
170 bool Serialize(uint8_t* data,
size_t size);
171 bool Deserialize(
const uint8_t* data,
size_t size);
181 bool LogError(GAME_ERROR error,
const char* strMethod)
const;
182 void LogException(
const char* strFunctionName)
const;
186 bool InitializeGameplay(
const std::string& gamePath,
190 void NotifyError(GAME_ERROR error);
191 std::string GetMissingResource();
194 void LogAddonProperties(
void)
const;
200 static void cb_close_game(KODI_HANDLE kodiInstance);
201 static KODI_GAME_STREAM_HANDLE cb_open_stream(KODI_HANDLE kodiInstance,
203 static bool cb_get_stream_buffer(KODI_HANDLE kodiInstance,
204 KODI_GAME_STREAM_HANDLE stream,
208 static void cb_add_stream_data(KODI_HANDLE kodiInstance,
209 KODI_GAME_STREAM_HANDLE stream,
211 static void cb_release_stream_buffer(KODI_HANDLE kodiInstance,
212 KODI_GAME_STREAM_HANDLE stream,
214 static void cb_close_stream(KODI_HANDLE kodiInstance, KODI_GAME_STREAM_HANDLE stream);
215 static game_proc_address_t cb_hw_get_proc_address(KODI_HANDLE kodiInstance,
const char* sym);
216 static bool cb_input_event(KODI_HANDLE kodiInstance,
const game_input_event* event);
235 static std::pair<std::string, std::string> ParseLibretroName(
const std::string& addonName);
242 bool m_bSupportsStandalone;
243 std::set<std::string> m_extensions;
244 bool m_bSupportsAllExtensions =
false;
245 std::string m_emulatorName;
246 std::string m_platforms;
249 std::atomic_bool m_bIsPlaying;
250 std::string m_gamePath;
251 bool m_bRequiresGameLoop =
false;
252 size_t m_serializeSize = 0;
254 double m_framerate = 0.0;
255 double m_samplerate = 0.0;
259 std::unique_ptr<CGameClientInGameSaves> m_inGameSaves;
261 CCriticalSection m_critSection;
Helper class to have "C" struct created before other parts becomes his pointer.
Definition: GameClient.h:46
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:229
Definition: GameClientCheevos.h:31
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:116
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:40
GAME_REGION
Game region definition
Definition: game.h:562
Definition: GameClientSubsystem.h:26
Game instance.
Definition: game.h:1228
AddonInstance_Game * GetInstanceInterface()
To get the interface table used between addon and kodi.
Definition: GameClient.h:178
Immutable stream metadata
Definition: game.h:482
Definition: GameClientStreams.h:32
Game region unknown.
Definition: game.h:565
Definition: addon_base.h:211
Represents a file on a share.
Definition: FileItem.h:102