Kodi Development  20.0
for Binary and Script based Add-Ons

Detailed Description

Game operations

These are mandatory functions for using this addon to get the available channels.


Game operation parts in interface:
Copy this to your project and extend with your parts or leave functions complete away where not used or supported.

Header parts:

GAME_ERROR LoadGame(const std::string& url) override;
GAME_ERROR LoadGameSpecial(SPECIAL_GAME_TYPE type, const std::vector<std::string>& urls) override;
bool RequiresGameLoop() override;
GAME_ERROR RunFrame() override;
GAME_ERROR Reset() override;
Game system timing.
Definition: game.h:1050
GAME_REGION
Game reguin definition
Definition: game.h:563
SPECIAL_GAME_TYPE
Special game types passed into game_load_game_special().
Definition: game.h:581
GAME_ERROR
Game add-on error codes
Definition: game.h:34
virtual GAME_ERROR LoadGameSpecial(SPECIAL_GAME_TYPE type, const std::vector< std::string > &urls)
Load a game that requires multiple files.
Definition: Game.h:321
virtual GAME_ERROR UnloadGame()
Unload the current game.
Definition: Game.h:350
virtual GAME_ERROR GetGameTiming(game_system_timing &timing_info)
Get timing information about the loaded game.
Definition: Game.h:363
virtual GAME_ERROR RunFrame()
Run a single frame for add-ons that use a game loop.
Definition: Game.h:399
virtual bool RequiresGameLoop()
Return true if the client requires the frontend to provide a game loop.
Definition: Game.h:388
virtual GAME_ERROR Reset()
Reset the current game.
Definition: Game.h:410
virtual GAME_ERROR LoadStandalone()
Begin playing without a game file.
Definition: Game.h:337
virtual GAME_ERROR LoadGame(const std::string &url)
Load a game.
Definition: Game.h:308
virtual GAME_REGION GetRegion()
Get region of the loaded game.
Definition: Game.h:374

Source parts:

GAME_ERROR CMyInstance::LoadGame(const std::string& url)
{
}
GAME_ERROR CMyInstance::LoadGameSpecial(SPECIAL_GAME_TYPE type, const std::vector<std::string>& urls)
{
}
GAME_ERROR CMyInstance::LoadStandalone()
{
}
GAME_ERROR CMyInstance::UnloadGame()
{
}
GAME_ERROR CMyInstance::GetGameTiming(game_system_timing& timing_info)
{
}
{
}
bool CMyInstance::RequiresGameLoop()
{
return false;
}
GAME_ERROR CMyInstance::RunFrame()
{
}
GAME_ERROR CMyInstance::Reset()
{
}
@ GAME_REGION_UNKNOWN
Game region unknown.
Definition: game.h:565
@ GAME_ERROR_NOT_IMPLEMENTED
the method that the frontend called is not implemented
Definition: game.h:42
std::string ATTRIBUTE_HIDDEN GetRegion(const std::string &id)
Returns your regions setting as a string for the specified id.
Definition: General.h:478

Modules

 Group header include
 
 Group source include
 
 Class: CStream
 

Class: kodi::addon::CInstanceGame::CStream

Game stream handler
 

Function Documentation

◆ LoadGame()

virtual GAME_ERROR LoadGame ( const std::string &  url)
inlinevirtual

Load a game.

Parameters
[in]urlThe URL to load
Returns
the error, or GAME_ERROR_NO_ERROR if the game was loaded

◆ LoadGameSpecial()

virtual GAME_ERROR LoadGameSpecial ( SPECIAL_GAME_TYPE  type,
const std::vector< std::string > &  urls 
)
inlinevirtual

Load a game that requires multiple files.

Parameters
[in]typeThe game type
[in]urlsAn array of urls
Returns
the error, or GAME_ERROR_NO_ERROR if the game was loaded

◆ LoadStandalone()

virtual GAME_ERROR LoadStandalone ( )
inlinevirtual

Begin playing without a game file.

If the add-on supports standalone mode, it must add the <supports_standalone> tag to the extension point in addon.xml:

<supports_no_game>false</supports_no_game>
Returns
the error, or GAME_ERROR_NO_ERROR if the game add-on was loaded

◆ UnloadGame()

virtual GAME_ERROR UnloadGame ( )
inlinevirtual

Unload the current game.

Unloads a currently loaded game

Returns
the error, or GAME_ERROR_NO_ERROR if the game was unloaded

◆ GetGameTiming()

virtual GAME_ERROR GetGameTiming ( game_system_timing timing_info)
inlinevirtual

Get timing information about the loaded game.

Parameters
[out]timing_infoThe info structure to fill
Returns
the error, or GAME_ERROR_NO_ERROR if info was filled

◆ GetRegion()

virtual GAME_REGION GetRegion ( )
inlinevirtual

Get region of the loaded game.

Returns
the region, or GAME_REGION_UNKNOWN if unknown or no game is loaded

◆ RequiresGameLoop()

virtual bool RequiresGameLoop ( )
inlinevirtual

Return true if the client requires the frontend to provide a game loop.

The game loop is a thread that calls RunFrame() in a loop at a rate determined by the playback speed and the client's FPS.

Returns
true if the frontend should provide a game loop, false otherwise

◆ RunFrame()

virtual GAME_ERROR RunFrame ( )
inlinevirtual

Run a single frame for add-ons that use a game loop.

Returns
the error, or GAME_ERROR_NO_ERROR if there was no error

◆ Reset()

virtual GAME_ERROR Reset ( )
inlinevirtual

Reset the current game.

Returns
the error, or GAME_ERROR_NO_ERROR if the game was reset

◆ CloseGame()

void CloseGame ( void  )
inline

Callback to Kodi Function
Requests the frontend to stop the current game

Remarks
Only called from addon itself