diff options
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h | 155 |
1 files changed, 0 insertions, 155 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h deleted file mode 100644 index 2e6459b..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h +++ /dev/null | |||
| @@ -1,155 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2014-2018 Team Kodi | ||
| 3 | * This file is part of Kodi - https://kodi.tv | ||
| 4 | * | ||
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later | ||
| 6 | * See LICENSES/README.md for more information. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #pragma once | ||
| 10 | |||
| 11 | #include "libXBMC_addon.h" | ||
| 12 | #include "kodi_game_types.h" | ||
| 13 | |||
| 14 | #include <string> | ||
| 15 | #include <stdio.h> | ||
| 16 | |||
| 17 | #if defined(ANDROID) | ||
| 18 | #include <sys/stat.h> | ||
| 19 | #endif | ||
| 20 | |||
| 21 | class CHelper_libKODI_game | ||
| 22 | { | ||
| 23 | public: | ||
| 24 | CHelper_libKODI_game(void) : | ||
| 25 | m_handle(nullptr), | ||
| 26 | m_callbacks(nullptr) | ||
| 27 | { | ||
| 28 | } | ||
| 29 | |||
| 30 | ~CHelper_libKODI_game(void) | ||
| 31 | { | ||
| 32 | } | ||
| 33 | |||
| 34 | /*! | ||
| 35 | * @brief Resolve all callback methods | ||
| 36 | * @param handle Pointer to the add-on | ||
| 37 | * @return True when all methods were resolved, false otherwise. | ||
| 38 | */ | ||
| 39 | bool RegisterMe(void* handle) | ||
| 40 | { | ||
| 41 | m_handle = static_cast<AddonCB*>(handle); | ||
| 42 | if (m_handle) | ||
| 43 | m_callbacks = (AddonInstance_Game*)m_handle->GameLib_RegisterMe(m_handle->addonData); | ||
| 44 | if (!m_callbacks) | ||
| 45 | fprintf(stderr, "libKODI_game-ERROR: GameLib_RegisterMe can't get callback table from Kodi !!!\n"); | ||
| 46 | |||
| 47 | return m_callbacks != nullptr; | ||
| 48 | } | ||
| 49 | |||
| 50 | // --- Game callbacks -------------------------------------------------------- | ||
| 51 | |||
| 52 | /*! | ||
| 53 | * \brief Requests the frontend to stop the current game | ||
| 54 | */ | ||
| 55 | void CloseGame(void) | ||
| 56 | { | ||
| 57 | m_callbacks->toKodi.CloseGame(m_callbacks->toKodi.kodiInstance); | ||
| 58 | } | ||
| 59 | |||
| 60 | /*! | ||
| 61 | * \brief Create a stream for gameplay data | ||
| 62 | * | ||
| 63 | * \param properties The stream properties | ||
| 64 | * | ||
| 65 | * \return A stream handle, or NULL on failure | ||
| 66 | */ | ||
| 67 | void* OpenStream(const game_stream_properties &properties) | ||
| 68 | { | ||
| 69 | return m_callbacks->toKodi.OpenStream(m_callbacks->toKodi.kodiInstance, &properties); | ||
| 70 | } | ||
| 71 | |||
| 72 | /*! | ||
| 73 | * \brief Get a buffer for zero-copy stream data | ||
| 74 | * | ||
| 75 | * \param stream The stream handle | ||
| 76 | * \param width The framebuffer width, or 0 for no width specified | ||
| 77 | * \param height The framebuffer height, or 0 for no height specified | ||
| 78 | * \param[out] buffer The buffer, or unmodified if false is returned | ||
| 79 | * | ||
| 80 | * If this returns true, buffer must be freed using ReleaseStreamBuffer(). | ||
| 81 | * | ||
| 82 | * \return True if buffer was set, false otherwise | ||
| 83 | */ | ||
| 84 | bool GetStreamBuffer(void *stream, unsigned int width, unsigned int height, game_stream_buffer &buffer) | ||
| 85 | { | ||
| 86 | return m_callbacks->toKodi.GetStreamBuffer(m_callbacks->toKodi.kodiInstance, stream, width, height, &buffer); | ||
| 87 | } | ||
| 88 | |||
| 89 | /*! | ||
| 90 | * \brief Add a data packet to a stream | ||
| 91 | * | ||
| 92 | * \param stream The target stream | ||
| 93 | * \param packet The data packet | ||
| 94 | */ | ||
| 95 | void AddStreamData(void *stream, const game_stream_packet &packet) | ||
| 96 | { | ||
| 97 | m_callbacks->toKodi.AddStreamData(m_callbacks->toKodi.kodiInstance, stream, &packet); | ||
| 98 | } | ||
| 99 | |||
| 100 | /*! | ||
| 101 | * \brief Free an allocated buffer | ||
| 102 | * | ||
| 103 | * \param stream The stream handle | ||
| 104 | * \param buffer The buffer returned from GetStreamBuffer() | ||
| 105 | */ | ||
| 106 | void ReleaseStreamBuffer(void *stream, game_stream_buffer &buffer) | ||
| 107 | { | ||
| 108 | m_callbacks->toKodi.ReleaseStreamBuffer(m_callbacks->toKodi.kodiInstance, stream, &buffer); | ||
| 109 | } | ||
| 110 | |||
| 111 | /*! | ||
| 112 | * \brief Free the specified stream | ||
| 113 | * | ||
| 114 | * \param stream The stream to close | ||
| 115 | */ | ||
| 116 | void CloseStream(void *stream) | ||
| 117 | { | ||
| 118 | m_callbacks->toKodi.CloseStream(m_callbacks->toKodi.kodiInstance, stream); | ||
| 119 | } | ||
| 120 | |||
| 121 | // -- Hardware rendering callbacks ------------------------------------------- | ||
| 122 | |||
| 123 | /*! | ||
| 124 | * \brief Get a symbol from the hardware context | ||
| 125 | * | ||
| 126 | * \param sym The symbol's name | ||
| 127 | * | ||
| 128 | * \return A function pointer for the specified symbol | ||
| 129 | */ | ||
| 130 | game_proc_address_t HwGetProcAddress(const char* sym) | ||
| 131 | { | ||
| 132 | return m_callbacks->toKodi.HwGetProcAddress(m_callbacks->toKodi.kodiInstance, sym); | ||
| 133 | } | ||
| 134 | |||
| 135 | // --- Input callbacks ------------------------------------------------------- | ||
| 136 | |||
| 137 | /*! | ||
| 138 | * \brief Notify the port of an input event | ||
| 139 | * | ||
| 140 | * \param event The input event | ||
| 141 | * | ||
| 142 | * Input events can arrive for the following sources: | ||
| 143 | * - GAME_INPUT_EVENT_MOTOR | ||
| 144 | * | ||
| 145 | * \return true if the event was handled, false otherwise | ||
| 146 | */ | ||
| 147 | bool InputEvent(const game_input_event& event) | ||
| 148 | { | ||
| 149 | return m_callbacks->toKodi.InputEvent(m_callbacks->toKodi.kodiInstance, &event); | ||
| 150 | } | ||
| 151 | |||
| 152 | private: | ||
| 153 | AddonCB* m_handle; | ||
| 154 | AddonInstance_Game* m_callbacks; | ||
| 155 | }; | ||
