Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
KODI::GAME::CGameClient Class Reference

Interface between Kodi and Game add-ons. More...

#include <GameClient.h>

Inheritance diagram for KODI::GAME::CGameClient:
ADDON::CAddonDll KODI::GAME::CGameClientStruct ADDON::CAddon ADDON::IAddon

Public Member Functions

 CGameClient (const ADDON::AddonInfoPtr &addonInfo)
 
 ~CGameClient () override
 
const CGameClientCheevosCheevos () const
 
const CGameClientInputInput () const
 
const CGameClientPropertiesAddonProperties () const
 
const CGameClientStreamsStreams () const
 
CGameClientCheevosCheevos ()
 
CGameClientInputInput ()
 
CGameClientPropertiesAddonProperties ()
 
CGameClientStreamsStreams ()
 
std::string LibPath () const override
 
ADDON::AddonPtr GetRunningInstance () const override
 retrieve the running instance of an add-on if it persists while running.
 
bool SupportsStandalone () const
 
bool SupportsPath () const
 
bool SupportsVFS () const
 
const std::set< std::string > & GetExtensions () const
 
bool SupportsAllExtensions () const
 
bool IsExtensionValid (const std::string &strExtension) const
 
const std::string & GetEmulatorName () const
 
const std::string & GetPlatforms () const
 
bool Initialize (void)
 
void Unload ()
 
bool OpenFile (const CFileItem &file, RETRO::IStreamManager &streamManager, IGameInputCallback *input)
 
bool OpenStandalone (RETRO::IStreamManager &streamManager, IGameInputCallback *input)
 
void Reset ()
 
void CloseFile ()
 
const std::string & GetGamePath () const
 
bool RequiresGameLoop () const
 
bool IsPlaying () const
 
size_t GetSerializeSize () const
 
double GetFrameRate () const
 
double GetSampleRate () const
 
void RunFrame ()
 
size_t SerializeSize () const
 
bool Serialize (uint8_t *data, size_t size)
 
bool Deserialize (const uint8_t *data, size_t size)
 
AddonInstance_GameGetInstanceInterface ()
 To get the interface table used between addon and kodi.
 
bool LogError (GAME_ERROR error, const char *strMethod) const
 
void LogException (const char *strFunctionName) const
 
- Public Member Functions inherited from ADDON::CAddonDll
 CAddonDll (const AddonInfoPtr &addonInfo, BinaryAddonBasePtr addonBase)
 
 CAddonDll (const AddonInfoPtr &addonInfo, AddonType addonType)
 
 ~CAddonDll () override
 
bool SaveSettings (AddonInstanceId id=ADDON_SETTINGS_ID) override
 Save any user configured settings.
 
bool DllLoaded (void) const
 
CAddonVersion GetTypeVersionDll (int type) const
 Get api version of moduleType type.
 
CAddonVersion GetTypeMinVersionDll (int type) const
 Get api min version of moduleType type.
 
ADDON_STATUS CreateInstance (KODI_ADDON_INSTANCE_STRUCT *instance)
 Function to create a addon instance class.
 
void DestroyInstance (KODI_ADDON_INSTANCE_STRUCT *instance)
 Function to destroy a on addon created instance class.
 
bool IsInUse () const override
 
void RegisterInformer (CAddonDllInformer *informer)
 
void OnPreInstall () override
 
void OnPostInstall (bool update, bool modal) override
 
void OnPreUnInstall () override
 
void OnPostUnInstall () override
 
bool Initialized () const
 
- Public Member Functions inherited from ADDON::CAddon
 CAddon (const AddonInfoPtr &addonInfo, AddonType addonType)
 
 ~CAddon () override=default
 
AddonType MainType () const override
 To get the main type of this addon.
 
AddonType Type () const override
 To get the on this CAddon class processed addon type.
 
bool HasType (AddonType type) const override
 To check complete addon (not only this) contains a type.
 
bool HasMainType (AddonType type) const override
 To check complete addon (not only this) has a specific type defined in its first extension point including the provided subcontent e.g. video or audio.
 
const CAddonTypeType (AddonType type) const
 The get for given addon type information and extension data.
 
std::string ID () const override
 
std::string Name () const override
 
bool IsBinary () const override
 
CAddonVersion Version () const override
 
CAddonVersion MinVersion () const override
 
std::string Summary () const override
 
std::string Description () const override
 
std::string Path () const override
 
std::string Profile () const override
 
std::string Author () const override
 
std::string ChangeLog () const override
 
std::string Icon () const override
 
ArtMap Art () const override
 
std::vector< std::string > Screenshots () const override
 
std::string Disclaimer () const override
 
AddonLifecycleState LifecycleState () const override
 
std::string LifecycleStateDescription () const override
 
CDateTime InstallDate () const override
 
CDateTime LastUpdated () const override
 
CDateTime LastUsed () const override
 
std::string Origin () const override
 
std::string OriginName () const override
 
uint64_t PackageSize () const override
 
const InfoMapExtraInfo () const override
 
const std::vector< DependencyInfo > & GetDependencies () const override
 
std::string FanArt () const override
 
bool SupportsMultipleInstances () const override
 Check add-on for support from independent work instances.
 
AddonInstanceSupport InstanceUseType () const override
 Return the used instance path type of the add-on type.
 
std::vector< AddonInstanceIdGetKnownInstanceIds () const override
 Gives active, independently working instance identifiers for this add-on.
 
bool SupportsInstanceSettings () const override
 Check whether the add-on supports individual settings per add-on instance.
 
bool DeleteInstanceSettings (AddonInstanceId instance) override
 Delete selected instance settings from storage.
 
bool CanHaveAddonOrInstanceSettings () override
 Check whether this add-on can be configured by the user.
 
bool HasSettings (AddonInstanceId id=ADDON_SETTINGS_ID) override
 Check whether this add-on can be configured by the user.
 
bool HasUserSettings (AddonInstanceId id=ADDON_SETTINGS_ID) override
 Check whether the user has configured this add-on or not.
 
void UpdateSetting (const std::string &key, const std::string &value, AddonInstanceId id=ADDON_SETTINGS_ID) override
 Update a user-configured setting with a new value.
 
bool UpdateSettingBool (const std::string &key, bool value, AddonInstanceId id=ADDON_SETTINGS_ID) override
 Update a user-configured setting with a new boolean value.
 
bool UpdateSettingInt (const std::string &key, int value, AddonInstanceId id=ADDON_SETTINGS_ID) override
 Update a user-configured setting with a new integer value.
 
bool UpdateSettingNumber (const std::string &key, double value, AddonInstanceId id=ADDON_SETTINGS_ID) override
 Update a user-configured setting with a new number value.
 
bool UpdateSettingString (const std::string &key, const std::string &value, AddonInstanceId id=ADDON_SETTINGS_ID) override
 Update a user-configured setting with a new string value.
 
std::string GetSetting (const std::string &key, AddonInstanceId id=ADDON_SETTINGS_ID) override
 Retrieve a particular settings value.
 
bool GetSettingBool (const std::string &key, bool &value, AddonInstanceId id=ADDON_SETTINGS_ID) override
 Retrieve a particular settings value as boolean.
 
bool GetSettingInt (const std::string &key, int &value, AddonInstanceId id=ADDON_SETTINGS_ID) override
 Retrieve a particular settings value as integer.
 
bool GetSettingNumber (const std::string &key, double &value, AddonInstanceId id=ADDON_SETTINGS_ID) override
 Retrieve a particular settings value as number.
 
bool GetSettingString (const std::string &key, std::string &value, AddonInstanceId id=ADDON_SETTINGS_ID) override
 Retrieve a particular settings value as string.
 
std::shared_ptr< CAddonSettingsGetSettings (AddonInstanceId id=ADDON_SETTINGS_ID) override
 
CAddonVersion GetDependencyVersion (const std::string &dependencyID) const override
 get the required version of a dependency.
 
bool MeetsVersion (const CAddonVersion &versionMin, const CAddonVersion &version) const override
 return whether or not this addon satisfies the given version requirements
 
bool ReloadSettings (AddonInstanceId id=ADDON_SETTINGS_ID) override
 
void ResetSettings (AddonInstanceId id=ADDON_SETTINGS_ID) override
 
- Public Member Functions inherited from ADDON::IAddon
virtual ~IAddon ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from ADDON::CAddon
virtual bool SettingsInitialized (AddonInstanceId id=ADDON_SETTINGS_ID) const
 Whether or not the settings have been initialized.
 
virtual bool SettingsLoaded (AddonInstanceId id=ADDON_SETTINGS_ID) const
 Whether or not the settings have been loaded.
 
bool LoadSettings (bool bForce, bool loadUserSettings, AddonInstanceId id=ADDON_SETTINGS_ID)
 Load the default settings and override these with any previously configured user settings.
 
virtual bool LoadUserSettings (AddonInstanceId id=ADDON_SETTINGS_ID)
 Load the user settings.
 
virtual bool HasSettingsToSave (AddonInstanceId id=ADDON_SETTINGS_ID) const
 Whether there are settings to be saved.
 
virtual bool SettingsFromXML (const CXBMCTinyXML &doc, bool loadDefaults, AddonInstanceId id=ADDON_SETTINGS_ID)
 Parse settings from an XML document.
 
virtual bool SettingsToXML (CXBMCTinyXML &doc, AddonInstanceId id=ADDON_SETTINGS_ID) const
 Write settings into an XML document.
 
- Static Protected Member Functions inherited from ADDON::CAddonDll
static std::string GetDllPath (const std::string &strFileName)
 
- Protected Attributes inherited from ADDON::CAddonDll
std::string m_parentLib
 
- Protected Attributes inherited from ADDON::CAddon
const AddonInfoPtr m_addonInfo
 

Detailed Description

Interface between Kodi and Game add-ons.

The game add-on system is extremely large. To make the code more manageable, a subsystem pattern has been put in place. This pattern takes functionality that would normally be placed in this class, and puts it in another class (a "subsystem").

The architecture is relatively simple. Subsystems are placed in a flat struct and accessed by calling the subsystem name. For example, historically, OpenJoystick() was a member of this class. Now, the function is called like Input().OpenJoystick().

Although this pattern adds a layer of complexity, it enforces modularity and separation of concerns by making it very clear when one subsystem becomes dependent on another. Subsystems are all given access to each other by the calling mechanism. However, calling a subsystem creates a dependency on it, and an engineering decision must be made to justify the dependency.

CONTRIBUTING

If you wish to contribute, a beneficial task would be to refactor anything in this class into a new subsystem:

Using line count as a heuristic, the subsystem pattern has shrunk the .cpp from 1,200 lines to just over 600. Reducing this further is the challenge. You must now choose whether to accept.

Constructor & Destructor Documentation

◆ CGameClient()

CGameClient::CGameClient ( const ADDON::AddonInfoPtr & addonInfo)
explicit

◆ ~CGameClient()

CGameClient::~CGameClient ( void )
override

Member Function Documentation

◆ AddonProperties() [1/2]

CGameClientProperties & KODI::GAME::CGameClient::AddonProperties ( )
inline

◆ AddonProperties() [2/2]

const CGameClientProperties & KODI::GAME::CGameClient::AddonProperties ( ) const
inline

◆ Cheevos() [1/2]

CGameClientCheevos & KODI::GAME::CGameClient::Cheevos ( )
inline

◆ Cheevos() [2/2]

const CGameClientCheevos & KODI::GAME::CGameClient::Cheevos ( ) const
inline

◆ CloseFile()

void CGameClient::CloseFile ( )

◆ Deserialize()

bool CGameClient::Deserialize ( const uint8_t * data,
size_t size )

◆ GetEmulatorName()

const std::string & KODI::GAME::CGameClient::GetEmulatorName ( ) const
inline

◆ GetExtensions()

const std::set< std::string > & KODI::GAME::CGameClient::GetExtensions ( ) const
inline

◆ GetFrameRate()

double KODI::GAME::CGameClient::GetFrameRate ( ) const
inline

◆ GetGamePath()

const std::string & KODI::GAME::CGameClient::GetGamePath ( ) const
inline

◆ GetInstanceInterface()

AddonInstance_Game * KODI::GAME::CGameClient::GetInstanceInterface ( )
inline

To get the interface table used between addon and kodi.

Todo
This function becomes removed after old callback library system is removed.

◆ GetPlatforms()

const std::string & KODI::GAME::CGameClient::GetPlatforms ( ) const
inline

◆ GetRunningInstance()

ADDON::AddonPtr CGameClient::GetRunningInstance ( ) const
overridevirtual

retrieve the running instance of an add-on if it persists while running.

Reimplemented from ADDON::CAddonDll.

◆ GetSampleRate()

double KODI::GAME::CGameClient::GetSampleRate ( ) const
inline

◆ GetSerializeSize()

size_t KODI::GAME::CGameClient::GetSerializeSize ( ) const
inline

◆ Initialize()

bool CGameClient::Initialize ( void )

◆ Input() [1/2]

CGameClientInput & KODI::GAME::CGameClient::Input ( )
inline

◆ Input() [2/2]

const CGameClientInput & KODI::GAME::CGameClient::Input ( ) const
inline

◆ IsExtensionValid()

bool CGameClient::IsExtensionValid ( const std::string & strExtension) const

◆ IsPlaying()

bool KODI::GAME::CGameClient::IsPlaying ( ) const
inline

◆ LibPath()

std::string CGameClient::LibPath ( ) const
overridevirtual

Reimplemented from ADDON::CAddonDll.

◆ LogError()

bool CGameClient::LogError ( GAME_ERROR error,
const char * strMethod ) const

◆ LogException()

void CGameClient::LogException ( const char * strFunctionName) const

◆ OpenFile()

bool CGameClient::OpenFile ( const CFileItem & file,
RETRO::IStreamManager & streamManager,
IGameInputCallback * input )

◆ OpenStandalone()

bool CGameClient::OpenStandalone ( RETRO::IStreamManager & streamManager,
IGameInputCallback * input )

◆ RequiresGameLoop()

bool KODI::GAME::CGameClient::RequiresGameLoop ( ) const
inline

◆ Reset()

void CGameClient::Reset ( )

◆ RunFrame()

void CGameClient::RunFrame ( )

◆ Serialize()

bool CGameClient::Serialize ( uint8_t * data,
size_t size )

◆ SerializeSize()

size_t KODI::GAME::CGameClient::SerializeSize ( ) const
inline

◆ Streams() [1/2]

CGameClientStreams & KODI::GAME::CGameClient::Streams ( )
inline

◆ Streams() [2/2]

const CGameClientStreams & KODI::GAME::CGameClient::Streams ( ) const
inline

◆ SupportsAllExtensions()

bool KODI::GAME::CGameClient::SupportsAllExtensions ( ) const
inline

◆ SupportsPath()

bool CGameClient::SupportsPath ( ) const

◆ SupportsStandalone()

bool KODI::GAME::CGameClient::SupportsStandalone ( ) const
inline

◆ SupportsVFS()

bool KODI::GAME::CGameClient::SupportsVFS ( ) const
inline

◆ Unload()

void CGameClient::Unload ( )

The documentation for this class was generated from the following files: