Skinning games in Kodi Leia
Kodi Leia adds the ability to play games. This is a major feature, so I'll document all the changes and additions I made to allow game support.

New windows
  • FullscreenGame (VideoFullScreen.xml) - This window is analogous to FullscreenVideo, but doesn't use any controls.
  • Games (MyGames.xml) - The game library window. Incredibly limited, just files and add-ons, I could use some help improving this.
  • GameSettings (SettingsCategory.xml) - The settings category window for game settings (details)

New dialogs (for in-game OSD)
  • GameOSD (GameOSD.xml) - The root OSD for games. You can find some pictures here: Game playback controls (wiki)
  • GameVideoFilter (DialogSelect.xml) - The dialog for selecting video filters (a.k.a. shaders)
  • GameStretchMode (DialogSelect.xml) - The dialog for selecting stretch modes (e.g. normal, 4:3, fullscreen, original size)
  • GameVideoRotation (DialogSelect.xml) - The dialog for rotating the game's video output
  • GameVolume (DialogSlider.xml) - The dialog for changing the volume. Game plays in the background.
  • GameControllers (DialogGameControllers.xml) - Added in v17, heavily modified for v18. Only shows controllers for the current game, or all controllers if no game is playing
  • GameAdvancedSettings - Virtual window that opens AddonSettings (DialogAddonSettings.xml) for the current game client (e.g. ActivateWindow(GameAdvancedSettings))

New controls
  • gamewindow - A thumbnail view of the FullscreenGame window, analogous to the videowindow control
  • gamecontroller - A game controller image set by core. Added in v17, aspect ratio set to square in v18

New content types
New add-on sources
  • game - Python scripts and standalone game clients (e.g. addons://sources/game/)

New plugin sources
  • game - Provides games (e.g. <provides>game</provides>)

New add-on categories
  • category.gameaddons - Python scripts and standalone game clients (e.g. addons://all/category.gameaddons)
  • category.emulators - Game add-ons that can be used to emulate a file
  • category.standalonegames - Game add-ons that can be launched standalone
  • category.gameproviders - Game plugins
  • category.gameresources - Not used yet
  • category.gamesupport - Add-ons that offer additional game features, such as Libretro support or shader support

New settings
  • gamesgeneral.enable - Whether games are enabled or not. True by default
  • gamesgeneral.showosdhelp - True if the help dialog should be shown in the GameOSD dialog
  • gamesgeneral.enableautosave- True if autosave is enabled
  • gamesgeneral.enablerewind - True if rewind is enabled
  • gamesgeneral.rewindtime - Rewind buffer time, in seconds
  • input.asknewcontrollers - True if Kodi will ask about configuring new controllers
  • input.controllerpoweroff - True if Kodi will power off controllers (only supported on Windows)

New settings category
  • gamesettings

New builtin actions
  • PlayerControl(Reset) - Action to do a virtual reset on the emulator, analogous to pushing "Reset" on a game console

New infolabels
  • RetroPlayer.VideoFilter - The filter/shader used for the fullscreen game window. Values are:
    • nearest - Filter using nearest-neighbor (a.k.a. pixelate)
    • linear - Filter using bilinear filtering (a.k.a. smooth blur)
  • RetroPlayer.StretchMode - The stretch mode for the fullscreen game window. Values are:
    • normal - Show the game normally
    • 4:3 - Stretch to 4:3 aspect ratio
    • fullscreen - Stretch to fullscreen
    • original - Show game at original size
  • RetroPlayer.VideoRotation - The COUNTER-CLOCKWISE rotation used in the fullscreen game window. Values are:
    • 0
    • 90 (Shown in the GUI as 270°)
    • 180
    • 270 (Shown in the GUI as 90°)
  • ListItem.Title - The game title - (infolabel extended to support game types)
  • ListItem.Platform - The game platform
  • ListItem.Genres - The game genres
  • ListItem.Publisher - The game publisher
  • ListItem.Developer - The game developer
  • ListItem.Overview - The game overview/summary
  • ListItem.Year - The game release year (infolabel extended to support game types)
  • ListItem.GameClient - The add-on ID of the game client (a.k.a. emulator) to use for playing the game
  • Listitem.Property(Game.VideoFilter) - The filter/shader used for the gamewindow control. Values match RetroPlayer.VideoFilter
  • Listitem.Property(Game.StretchMode) - The stretch mode used for the gamewindow control. Values match RetroPlayer.StretchMode
  • Listitem.Property(Game.VideoRotation) - The COUNTER-CLOCKWISE rotation used for the gamewindow control. Values match RetroPlayer.VideoRotation

New infobools
New default icons
  • DefaultAddonGame.png - Used for game controllers, game clients, Python game add-ons, game resources, and "game" add-on sources
RetroPlayer releases:

Donations: eigendude.eth
Skinning guide for the game OSD

Because we lack a useful game library (help wanted!), the in-game menu is the heart of games in Kodi. It allows the user to control the game, exposes button combos, and tweak the video/audio/input/emulator settings. This guide explains the reference game OSD we ship in Estuary.

The guide is broken into the individual dialogs:

GameOSD (GameOSD.xml)


This dialog is tied to the gameplay speed. The goal is to never occlude a playing game, and to always pause an occluded game. This means that play/pause will toggle the OSD as if the action were an OSD show/hide command.

Currently, the skin is almost entirely responsible for the main OSD - very little happens in core. The skin only needs to send the related player commands and open the various settings windows.

Here are some player commands the skin might want to allow:
  • Play - closes the OSD
  • OSD - equivalent to Play
  • PlayerControl(Reset) - sends a virtual "reset" command to the emulator
  • Stop - Exits the game

The button combos for these commands are specified by the <FullscreenGame> tag in joystick.xml. NOTE: The button combo labels in Estuary are currently HARDCODED. In the future the label will be dynamically set by core.

The only aspect of the Game OSD controller by cores is the gamesgeneral.showosdhelp setting. If this is set, a help dialog should be shown, possibly instead of the actual OSD. This can be tested for using System.GetBool(gamesgeneral.showosdhelp).

In Estuary, the help dialog looks like this:


The following control IDs are used by core:
  • ID 1101 - The help text (string ID 35235) containing the button combo to open/close the menu
  • ID 1102 - A gamecontroller control. The controller ID is currently set to game.controller.snes in core. In the future, skins can override the controller ID.

The skin can also use string ID 35236.

If (and ONLY IF) these control IDs are visible, then when the OSD is closed, gamesgeneral.showosdhelp is set to false instead of closing the dialog.

Window 1101 (Custom_1101_SettingsList.xml)


To achieve a root OSD as simple as possible, the various settings have been grouped into a custom window. This is optional.

The custom settings window opens the game settings dialogs with the following commands:
  • ActivateWindow(GameVideoFilter)
  • ActivateWindow(GameStretchMode)
  • ActivateWindow(GameVideoRotation)
  • ActivateWindow(GameVolume)
  • ActivateWindow(GameControllers)
  • ActivateWindow(GameAdvancedSettings)

GameVideoFilter, GameStretchMode, GameVideoRotation (DialogSelect.xml)

These dialogs function similar to the normal select dialog, but can be overridden by the skin by checking the active window ID. For example, Estuary uses Includes_DialogSelect.xml to show a selection of gamewindow controls with the active game in the background.

The game OSD dialogs to select video settings use the following control IDs:
  • ID 11 - Panel of game video thumbnails
  • ID 12 - Description of the currently-selected video filter, or empty for stretch mode/rotation dialogs

The gamewindow control allows for the video settings to be controlled. These settings are:
  • <videofilter> - The video filter. The following values are available:
    • nearest - Nearest neighbor filtering (pixelate)
    • linear - Bilinear filtering (smooth blur)
  • <stretchmode> - The video stretch mode. The following values are available:
    • normal - Show the game at the correct aspect ratio
    • 4:3 - Stretch to 4:3 aspect ratio
    • fullscreen - Stretch to fill the view area
    • original - Show game at original size
  • <videorotation> - The video rotation, in degrees COUNTER CLOCKWISE. The following values are available:
    • 0
    • 90 (Shown in the GUI as 270°)
    • 180
    • 270 (Shown in the GUI as 90°)

The three video selection dialogs can give a live preview of the thumb's video settings using listitem properties:
<control type="gamewindow">

If one of these tags is left empty, then the gamewindow control will use the global setting used by the fullscreen window.

GameVolume (DialogSlider.xml)

This dialog reuses DialogSlider.xml. No control IDs are used, with one exception:
  • ID 12 - This control is always hidden

GameControllers (DialogGameControllers.xml)

This dialog is used to configure the controller mappings. It has a list of controllers, and a list of features for the active controller. A wizard allows the user to select a controller, and then walks the user through mapping each feature on that controller.

If a game is being played, only compatible controllers (and its compatible features) are shown. If no game is played (e.g. the dialog is opened from settings), then all installed controllers are shown.

The following control IDs are used:
  • ID 3 - The controller list
  • ID 5 - The feature list
  • ID 7 - The feature button template
  • ID 8 - The feature group title template
  • ID 9 - The feature group separator template
  • ID 10 - The controller button template
  • ID 31 - The gamecontroller control showing the controller layout (changed from 547x343 to square in v18)
  • ID 32 - Controller description (new in v18)
  • ID 17 - The "Help" button
  • ID 18 - The "Close" button
  • ID 19 - The "Reset" button
  • ID 20 - The "Get more..." button
  • ID 21 - The "Ignore input" button
  • ID 22 - The "Get all" button (new in v18)

GameAdvancedSettings (no XML file)

This is a virtual window ID. When the skin calls ActivateWindow(GameAdvancedSettings), the AddonSettings dialog (DialogAddonSettings.xml) is opened for the currently-active game client.
RetroPlayer releases:

Donations: eigendude.eth
How do i recall fastly games add-ons?
I used for videos/audio etc...

Can i use "kodi.gameclient"?
I do have a question for the game add-ons addition. A Python game addon is the a literal game? Or a game provider?
Assumeing the game plugin is a provider what benfit is it to using this over a video plugin it should just provide a list correct?
Shield TV | Windows 10 | Mariadb | Mii Box
Evolve Ecosystem Repo | TV Melodies | Madnox Holiday Mod
I've tried to keep Metropolis as current as I can with games features and have temporarily been giving poster art support by using the following.
                        <control type="image">
                            <aspectratio scalediffuse="false">stretch</aspectratio>
                            <visible>!String.IsEmpty(ListItem.FileExtension) + Window.IsActive(games)</visible>
                        <control type="image">
                            <aspectratio scalediffuse="false">stretch</aspectratio>
                            <visible>!String.IsEmpty(ListItem.FileExtension) + Window.IsActive(games)</visible>

and naming supporting image files with double extensions such as "Donkey Kong.nes.jpg"
This has worked well in listviews for the time being.

Do you know when game image support will be coming to the database?

[EDIT: I had originally posted another question but figured it out, but still curious about proper game image support.]
Using a NUC7PJYHN and a 2820FYKH0 Intel NUC running LibreELEC, and two FireTVs.:)

Logout Mark Read Team Forum Stats Members Help
Skinning games in Kodi Leia0
This forum uses Lukasz Tkacz MyBB addons.