From b3d195f0188758a14875a5a2f270e4fd190a679f Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 17 Apr 2018 00:15:38 +0200 Subject: sync with upstream --- .../include/kodi/kodi_game_dll.h | 99 +++++++++++++++++++--- 1 file changed, 87 insertions(+), 12 deletions(-) (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_dll.h') diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_dll.h index 4ce5bbc..79ca778 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_dll.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_dll.h @@ -130,17 +130,6 @@ GAME_ERROR HwContextDestroy(void); // --- Input operations -------------------------------------------------------- -/*! - * \brief Notify the add-on of a status change on an open port - * - * Ports can be opened using the OpenPort() callback - * - * \param port Non-negative for a joystick port, or GAME_INPUT_PORT value otherwise - * \param collected True if a controller was connected, false if disconnected - * \param controller The connected controller - */ -void UpdatePort(int port, bool connected, const game_controller* controller); - /*! * \brief Check if input is accepted for a feature on the controller * @@ -155,6 +144,88 @@ void UpdatePort(int port, bool connected, const game_controller* controller); */ bool HasFeature(const char* controller_id, const char* feature_name); +/*! + * \brief Get the input topolgy that specifies which controllers can be connected + * + * \return The input topology, or null to use the default + * + * If this returns non-null, topology must be freed using FreeTopology(). + * + * If this returns null, the topology will default to a single port that can + * accept all controllers imported by addon.xml. The port ID is set to + * the DEFAULT_PORT_ID constant. + */ +game_input_topology* GetTopology(); + +/*! + * \brief Free the topology's resources + * + * \param topology The topology returned by GetTopology() + */ +void FreeTopology(game_input_topology* topology); + +/*! + * \brief Enable/disable keyboard input using the specified controller + * + * \param enable True to enable input, false otherwise + * \param controller The controller info if enabling, or unused if disabling + * + * \return True if keyboard input was enabled, false otherwise + */ +bool EnableKeyboard(bool enable, const game_controller* controller); + +/*! + * \brief Enable/disable mouse input using the specified controller + * + * \param enable True to enable input, false otherwise + * \param controller The controller info if enabling, or unused if disabling + * + * \return True if mouse input was enabled, false otherwise + */ +bool EnableMouse(bool enable, const game_controller* controller); + +/*! + * \brief Connect/disconnect a controller to a port on the virtual game console + * + * \param connect True to connect a controller, false to disconnect + * \param address The address of the port + * \param controller The controller info if connecting, or unused if disconnecting + * + * The address is a string that allows traversal of the controller topology. + * It is formed by alternating port IDs and controller IDs separated by "/". + * + * For example, assume that the topology represented in XML for Snes9x is: + * + * + * + * + * + * + * + * + * + * + * + * ... + * + * + * + * + * To connect a multitap to the console's first port, the multitap's controller + * info is set using the port address: + * + * 1 + * + * To connect a SNES controller to the second port of the multitap, the + * controller info is next set using the address: + * + * 1/game.controller.multitap/2 + * + * Any attempts to connect a controller to a port on a disconnected multitap + * will return false. + */ +bool ConnectController(bool connect, const char* port_address, const game_controller* controller); + /*! * \brief Notify the add-on of an input event * @@ -247,8 +318,12 @@ void __declspec(dllexport) get_addon(void* ptr) pClient->toAddon.Reset = Reset; pClient->toAddon.HwContextReset = HwContextReset; pClient->toAddon.HwContextDestroy = HwContextDestroy; - pClient->toAddon.UpdatePort = UpdatePort; pClient->toAddon.HasFeature = HasFeature; + pClient->toAddon.GetTopology = GetTopology; + pClient->toAddon.FreeTopology = FreeTopology; + pClient->toAddon.EnableKeyboard = EnableKeyboard; + pClient->toAddon.EnableMouse = EnableMouse; + pClient->toAddon.ConnectController = ConnectController; pClient->toAddon.InputEvent = InputEvent; pClient->toAddon.SerializeSize = SerializeSize; pClient->toAddon.Serialize = Serialize; -- cgit v1.2.3