2 * Copyright (C) 2012-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "GameTypes.h"
22 using AddonPtr
= std::shared_ptr
<IAddon
>;
23 using VECADDONS
= std::vector
<AddonPtr
>;
33 * \brief Game related utilities.
39 * \brief Set the game client property, prompt the user for a savestate if there are any
40 * (savestates store the information of which game client created it).
41 * If there are no savestates or the user wants a new savestate, prompt the user
44 * \param item The item with or without a game client in its info tag
45 * \param savestatePath Output. The path to the savestate selected. Empty if new savestate was
48 * \return True if the item has a valid game client ID in its info tag
50 static bool FillInGameClient(CFileItem
& item
, std::string
& savestatePath
);
53 * \brief Check if the file extension is supported by an add-on in
54 * a local or remote repository
56 * \param path The path of the game file
58 * \return true if the path's extension is supported by a known game client
60 static bool HasGameExtension(const std::string
& path
);
63 * \brief Get all game extensions
65 static std::set
<std::string
> GetGameExtensions();
68 * \brief Check if game script or game add-on can be launched directly
70 * \return true if the add-on can be launched, false otherwise
72 static bool IsStandaloneGame(const ADDON::AddonPtr
& addon
);
75 static void GetGameClients(const CFileItem
& file
,
76 GameClientVector
& candidates
,
77 GameClientVector
& installable
,
78 bool& bHasVfsGameClient
);
79 static void GetGameClients(const ADDON::VECADDONS
& addons
,
80 const CURL
& translatedUrl
,
81 GameClientVector
& candidates
,
82 bool& bHasVfsGameClient
);
85 * \brief Install the specified game client
87 * If the game client is not installed, a model dialog is shown installing
88 * the game client. If the installation fails, an error dialog is shown.
90 * \param gameClient The game client to install
92 * \return True if the game client is installed, false otherwise
94 static bool Install(const std::string
& gameClient
);
97 * \brief Enable the specified game client
99 * \param gameClient the game client to enable
101 * \return True if the game client is enabled, false otherwise
103 static bool Enable(const std::string
& gameClient
);