summaryrefslogtreecommitdiffstats
path: root/xbmc
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc')
-rw-r--r--xbmc/addons/addon-bindings.mk5
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h161
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_dll.h287
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_types.h487
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h2
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h11
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h3
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h238
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h6
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h96
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h43
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h211
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h2
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h6
-rw-r--r--xbmc/input/XBMC_vkeys.h286
15 files changed, 1616 insertions, 228 deletions
diff --git a/xbmc/addons/addon-bindings.mk b/xbmc/addons/addon-bindings.mk
index 6bfed36..788b50e 100644
--- a/xbmc/addons/addon-bindings.mk
+++ b/xbmc/addons/addon-bindings.mk
@@ -13,6 +13,9 @@ BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h
13BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h 13BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h
14BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h 14BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h
15BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h 15BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h
16BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h
17BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_dll.h
18BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_types.h
16BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h 19BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h
17BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h 20BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h
18BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_callbacks.h 21BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_callbacks.h
@@ -30,6 +33,7 @@ BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h
30BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h 33BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h
31BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h 34BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h
32BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h 35BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h
36BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h
33BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h 37BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h
34BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h 38BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h
35BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h 39BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h
@@ -38,3 +42,4 @@ BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h
38BINDINGS+=xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h 42BINDINGS+=xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h
39BINDINGS+=xbmc/cores/AudioEngine/Utils/AEChannelData.h 43BINDINGS+=xbmc/cores/AudioEngine/Utils/AEChannelData.h
40BINDINGS+=xbmc/filesystem/IFileTypes.h 44BINDINGS+=xbmc/filesystem/IFileTypes.h
45BINDINGS+=xbmc/input/XBMC_vkeys.h
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h
new file mode 100644
index 0000000..6057f46
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h
@@ -0,0 +1,161 @@
1/*
2 * Copyright (C) 2014-2016 Team Kodi
3 * http://kodi.tv
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this Program; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20#ifndef KODI_GAME_CALLBACKS_H_
21#define KODI_GAME_CALLBACKS_H_
22
23#include "kodi_game_types.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29typedef struct CB_GameLib
30{
31 // --- Game callbacks --------------------------------------------------------
32
33 /*!
34 * \brief Requests the frontend to stop the current game
35 */
36 void (*CloseGame)(void* addonData);
37
38 /*!
39 * \brief Create a video stream for pixel data
40 *
41 * \param format The type of pixel data accepted by this stream
42 * \param width The frame width
43 * \param height The frame height
44 * \param rotation The rotation (counter-clockwise) of the video frames
45 *
46 * \return 0 on success or -1 if a video stream is already created
47 */
48 int (*OpenPixelStream)(void* addonData, GAME_PIXEL_FORMAT format, unsigned int width, unsigned int height, GAME_VIDEO_ROTATION rotation);
49
50 /*!
51 * \brief Create a video stream for encoded video data
52 *
53 * \param codec The video format accepted by this stream
54 *
55 * \return 0 on success or -1 if a video stream is already created
56 */
57 int (*OpenVideoStream)(void* addonData, GAME_VIDEO_CODEC codec);
58
59 /*!
60 * \brief Create an audio stream for PCM audio data
61 *
62 * \param format The type of audio data accepted by this stream
63 * \param channel_map The channel layout terminated by GAME_CH_NULL
64 *
65 * \return 0 on success or -1 if an audio stream is already created
66 */
67 int (*OpenPCMStream)(void* addonData, GAME_PCM_FORMAT format, const GAME_AUDIO_CHANNEL* channel_map);
68
69 /*!
70 * \brief Create an audio stream for encoded audio data
71 *
72 * \param codec The audio format accepted by this stream
73 * \param channel_map The channel layout terminated by GAME_CH_NULL
74 *
75 * \return 0 on success or -1 if an audio stream is already created
76 */
77 int(*OpenAudioStream)(void* addonData, GAME_AUDIO_CODEC codec, const GAME_AUDIO_CHANNEL* channel_map);
78
79 /*!
80 * \brief Add a data packet to an audio or video stream
81 *
82 * \param stream The target stream
83 * \param data The data packet
84 * \param size The size of the data
85 */
86 void (*AddStreamData)(void* addonData, GAME_STREAM_TYPE stream, const uint8_t* data, unsigned int size);
87
88 /*!
89 * \brief Free the specified stream
90 *
91 * \param stream The stream to close
92 */
93 void (*CloseStream)(void* addonData, GAME_STREAM_TYPE stream);
94
95 // -- Hardware rendering callbacks -------------------------------------------
96
97 /*!
98 * \brief Enable hardware rendering
99 *
100 * \param hw_info A struct of properties for the hardware rendering system
101 */
102 void (*EnableHardwareRendering)(void* addonData, const game_hw_info* hw_info);
103
104 /*!
105 * \brief Get the framebuffer for rendering
106 *
107 * \return The framebuffer
108 */
109 uintptr_t (*HwGetCurrentFramebuffer)(void* addonData);
110
111 /*!
112 * \brief Get a symbol from the hardware context
113 *
114 * \param symbol The symbol's name
115 *
116 * \return A function pointer for the specified symbol
117 */
118 game_proc_address_t (*HwGetProcAddress)(void* addonData, const char* symbol);
119
120 /*!
121 * \brief Called when a frame is being rendered
122 */
123 void (*RenderFrame)(void* addonData);
124
125 // --- Input callbacks -------------------------------------------------------
126
127 /*!
128 * \brief Begin reporting events for the specified joystick port
129 *
130 * \param port The zero-indexed port number
131 *
132 * \return true if the port was opened, false otherwise
133 */
134 bool (*OpenPort)(void* addonData, unsigned int port);
135
136 /*!
137 * \brief End reporting events for the specified port
138 *
139 * \param port The port number passed to OpenPort()
140 */
141 void (*ClosePort)(void* addonData, unsigned int port);
142
143 /*!
144 * \brief Notify the port of an input event
145 *
146 * \param event The input event
147 *
148 * Input events can arrive for the following sources:
149 * - GAME_INPUT_EVENT_MOTOR
150 *
151 * \return true if the event was handled, false otherwise
152 */
153 bool (*InputEvent)(void* addonData, const game_input_event* event);
154
155} CB_GameLib;
156
157#ifdef __cplusplus
158}
159#endif
160
161#endif // KODI_GAME_CALLBACKS_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
new file mode 100644
index 0000000..247f24b
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_dll.h
@@ -0,0 +1,287 @@
1/*
2 * Copyright (C) 2014-2016 Team Kodi
3 * http://kodi.tv
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this Program; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20#ifndef KODI_GAME_DLL_H_
21#define KODI_GAME_DLL_H_
22
23#include "kodi_game_types.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29// --- Game API operations -----------------------------------------------------
30
31/*!
32 * \brief Return GAME_API_VERSION_STRING
33 *
34 * The add-on is backwards compatible with the frontend if this API version is
35 * is at least the frontend's minimum API version.
36 *
37 * \return Must be GAME_API_VERSION_STRING
38 */
39const char* GetGameAPIVersion(void);
40
41/*!
42 * \brief Return GAME_MIN_API_VERSION_STRING
43 *
44 * The add-on is forwards compatible with the frontend if this minimum version
45 * is no more than the frontend's API version.
46 *
47 * \return Must be GAME_MIN_API_VERSION_STRING
48 */
49const char* GetMininumGameAPIVersion(void);
50
51// --- Game operations ---------------------------------------------------------
52
53/*!
54 * \brief Load a game
55 *
56 * \param url The URL to load
57 *
58 * return the error, or GAME_ERROR_NO_ERROR if the game was loaded
59 */
60GAME_ERROR LoadGame(const char* url);
61
62/*!
63 * \brief Load a game that requires multiple files
64 *
65 * \param type The game stype
66 * \param urls An array of urls
67 * \param urlCount The number of urls in the array
68 *
69 * \return the error, or GAME_ERROR_NO_ERROR if the game was loaded
70 */
71GAME_ERROR LoadGameSpecial(SPECIAL_GAME_TYPE type, const char** urls, size_t urlCount);
72
73/*!
74 * \brief Begin playing without a game file
75 *
76 * If the add-on supports standalone mode, it must add the <supports_standalone>
77 * tag to the extension point in addon.xml:
78 *
79 * <supports_no_game>false</supports_no_game>
80 *
81 * \return the error, or GAME_ERROR_NO_ERROR if the game add-on was loaded
82 */
83GAME_ERROR LoadStandalone(void);
84
85/*!
86 * \brief Unload the current game
87 *
88 * \return the error, or GAME_ERROR_NO_ERROR if the game was unloaded
89 */
90/*! Unloads a currently loaded game */
91GAME_ERROR UnloadGame(void);
92
93/*!
94 * \brief Get information about the loaded game
95 *
96 * \param info The info structure to fill
97 *
98 * \return the error, or GAME_ERROR_NO_ERROR if info was filled
99 */
100GAME_ERROR GetGameInfo(game_system_av_info* info);
101
102/*!
103 * \brief Get region of the loaded game
104 *
105 * \return the region, or GAME_REGION_UNKNOWN if unknown or no game is loaded
106 */
107GAME_REGION GetRegion(void);
108
109/*!
110 * \brief Return true if the client requires the frontend to provide a game loop
111 *
112 * The game loop is a thread that calls RunFrame() in a loop at a rate
113 * determined by the playback speed and the client's FPS.
114 *
115 * \return true if the frontend should provide a game loop, false otherwise
116 */
117bool RequiresGameLoop(void);
118
119/*!
120 * \brief Run a single frame for add-ons that use a game loop
121 *
122 * \return the error, or GAME_ERROR_NO_ERROR if there was no error
123 */
124GAME_ERROR RunFrame(void);
125
126/*!
127 * \brief Reset the current game
128 *
129 * \return the error, or GAME_ERROR_NO_ERROR if the game was reset
130 */
131GAME_ERROR Reset(void);
132
133// --- Hardware rendering operations -------------------------------------------
134
135/*!
136 * \brief Invalidates the current HW context and reinitializes GPU resources
137 *
138 * Any GL state is lost, and must not be deinitialized explicitly.
139 *
140 * \return the error, or GAME_ERROR_NO_ERROR if the HW context was reset
141 */
142GAME_ERROR HwContextReset(void);
143
144/*!
145 * \brief Called before the context is destroyed
146 *
147 * Resources can be deinitialized at this step.
148 *
149 * \return the error, or GAME_ERROR_NO_ERROR if the HW context was destroyed
150 */
151GAME_ERROR HwContextDestroy(void);
152
153// --- Input operations --------------------------------------------------------
154
155/*!
156 * \brief Notify the add-on of a status change on an open port
157 *
158 * Ports can be opened using the OpenPort() callback
159 *
160 * \param port Non-negative for a joystick port, or GAME_INPUT_PORT value otherwise
161 * \param collected True if a controller was connected, false if disconnected
162 * \param controller The connected controller
163 */
164void UpdatePort(int port, bool connected, const game_controller* controller);
165
166/*!
167 * \brief Check if input is accepted for a feature on the controller
168 *
169 * If only a subset of the controller profile is used, this can return false
170 * for unsupported features to not absorb their input.
171 *
172 * If the entire controller profile is used, this should always return true.
173 *
174 * \param controller_id The ID of the controller profile
175 * \param feature_name The name of a feature in that profile
176 * \return true if input is accepted for the feature, false otherwise
177 */
178bool HasFeature(const char* controller_id, const char* feature_name);
179
180/*!
181 * \brief Notify the add-on of an input event
182 *
183 * \param event The input event
184 *
185 * \return true if the event was handled, false otherwise
186 */
187bool InputEvent(const game_input_event* event);
188
189// --- Serialization operations ------------------------------------------------
190
191/*!
192 * \brief Get the number of bytes required to serialize the game
193 *
194 * \return the number of bytes, or 0 if serialization is not supported
195 */
196size_t SerializeSize(void);
197
198/*!
199 * \brief Serialize the state of the game
200 *
201 * \param data The buffer receiving the serialized game data
202 * \param size The size of the buffer
203 *
204 * \return the error, or GAME_ERROR_NO_ERROR if the game was serialized into the buffer
205 */
206GAME_ERROR Serialize(uint8_t* data, size_t size);
207
208/*!
209 * \brief Deserialize the game from the given state
210 *
211 * \param data A buffer containing the game's new state
212 * \param size The size of the buffer
213 *
214 * \return the error, or GAME_ERROR_NO_ERROR if the game deserialized
215 */
216GAME_ERROR Deserialize(const uint8_t* data, size_t size);
217
218// --- Cheat operations --------------------------------------------------------
219
220/*!
221 * \brief Reset the cheat system
222 *
223 * \return the error, or GAME_ERROR_NO_ERROR if the cheat system was reset
224 */
225GAME_ERROR CheatReset(void);
226
227/*!
228 * \brief Get a region of memory
229 *
230 * \param type The type of memory to retrieve
231 * \param data Set to the region of memory; must remain valid until UnloadGame() is called
232 * \param size Set to the size of the region of memory
233 *
234 * \return the error, or GAME_ERROR_NO_ERROR if data was set to a valid buffer
235 */
236GAME_ERROR GetMemory(GAME_MEMORY type, const uint8_t** data, size_t* size);
237
238/*!
239 * \brief Set a cheat code
240 *
241 * \param index
242 * \param enabled
243 * \param code
244 *
245 * \return the error, or GAME_ERROR_NO_ERROR if the cheat was set
246 */
247GAME_ERROR SetCheat(unsigned int index, bool enabled, const char* code);
248
249// --- Add-on helper implementation --------------------------------------------
250
251/*!
252 * \brief Called by Kodi to assign the function pointers of this add-on to pClient
253 *
254 * Note that get_addon() is defined here, so it will be available in all
255 * compiled game clients.
256 */
257void __declspec(dllexport) get_addon(GameClient* pClient)
258{
259 pClient->GetGameAPIVersion = GetGameAPIVersion;
260 pClient->GetMininumGameAPIVersion = GetMininumGameAPIVersion;
261 pClient->LoadGame = LoadGame;
262 pClient->LoadGameSpecial = LoadGameSpecial;
263 pClient->LoadStandalone = LoadStandalone;
264 pClient->UnloadGame = UnloadGame;
265 pClient->GetGameInfo = GetGameInfo;
266 pClient->GetRegion = GetRegion;
267 pClient->RequiresGameLoop = RequiresGameLoop;
268 pClient->RunFrame = RunFrame;
269 pClient->Reset = Reset;
270 pClient->HwContextReset = HwContextReset;
271 pClient->HwContextDestroy = HwContextDestroy;
272 pClient->UpdatePort = UpdatePort;
273 pClient->HasFeature = HasFeature;
274 pClient->InputEvent = InputEvent;
275 pClient->SerializeSize = SerializeSize;
276 pClient->Serialize = Serialize;
277 pClient->Deserialize = Deserialize;
278 pClient->CheatReset = CheatReset;
279 pClient->GetMemory = GetMemory;
280 pClient->SetCheat = SetCheat;
281}
282
283#ifdef __cplusplus
284}
285#endif
286
287#endif // KODI_GAME_DLL_H_
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_types.h
new file mode 100644
index 0000000..fa2762d
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_types.h
@@ -0,0 +1,487 @@
1/*
2 * Copyright (C) 2014-2016 Team Kodi
3 * http://kodi.tv
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this Program; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20#ifndef KODI_GAME_TYPES_H_
21#define KODI_GAME_TYPES_H_
22
23/* current game API version */
24#define GAME_API_VERSION "1.0.28"
25
26/* min. game API version */
27#define GAME_MIN_API_VERSION "1.0.28"
28
29#include <stddef.h>
30#include <stdint.h>
31
32#ifdef TARGET_WINDOWS
33 #include <windows.h>
34#else
35 #ifndef __cdecl
36 #define __cdecl
37 #endif
38 #ifndef __declspec
39 #define __declspec(X)
40 #endif
41#endif
42
43#undef ATTRIBUTE_PACKED
44#undef PRAGMA_PACK_BEGIN
45#undef PRAGMA_PACK_END
46
47#if defined(__GNUC__)
48 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
49 #define ATTRIBUTE_PACKED __attribute__ ((packed))
50 #define PRAGMA_PACK 0
51 #endif
52#endif
53
54#if !defined(ATTRIBUTE_PACKED)
55 #define ATTRIBUTE_PACKED
56 #define PRAGMA_PACK 1
57#endif
58
59#ifdef BUILD_KODI_ADDON
60#include "XBMC_vkeys.h"
61#else
62#include "input/XBMC_vkeys.h"
63#endif
64
65#ifdef __cplusplus
66extern "C" {
67#endif
68
69/*! Game add-on error codes */
70typedef enum GAME_ERROR
71{
72 GAME_ERROR_NO_ERROR, // no error occurred
73 GAME_ERROR_UNKNOWN, // an unknown error occurred
74 GAME_ERROR_NOT_IMPLEMENTED, // the method that the frontend called is not implemented
75 GAME_ERROR_REJECTED, // the command was rejected by the game client
76 GAME_ERROR_INVALID_PARAMETERS, // the parameters of the method that was called are invalid for this operation
77 GAME_ERROR_FAILED, // the command failed
78 GAME_ERROR_NOT_LOADED, // no game is loaded
79 GAME_ERROR_RESTRICTED, // game requires restricted resources
80} GAME_ERROR;
81
82typedef enum GAME_STREAM_TYPE
83{
84 GAME_STREAM_UNKNOWN,
85 GAME_STREAM_AUDIO,
86 GAME_STREAM_VIDEO,
87} GAME_STREAM_TYPE;
88
89typedef enum GAME_PIXEL_FORMAT
90{
91 GAME_PIXEL_FORMAT_UNKNOWN,
92 GAME_PIXEL_FORMAT_YUV420P,
93 GAME_PIXEL_FORMAT_0RGB8888,
94 GAME_PIXEL_FORMAT_RGB565,
95 GAME_PIXEL_FORMAT_0RGB1555,
96} GAME_PIXEL_FORMAT;
97
98typedef enum GAME_VIDEO_CODEC
99{
100 GAME_VIDEO_CODEC_UNKNOWN,
101 GAME_VIDEO_CODEC_H264,
102 GAME_VIDEO_CODEC_THEORA,
103} GAME_VIDEO_CODEC;
104
105typedef enum GAME_VIDEO_ROTATION // Counter-clockwise
106{
107 GAME_VIDEO_ROTATION_0,
108 GAME_VIDEO_ROTATION_90,
109 GAME_VIDEO_ROTATION_180,
110 GAME_VIDEO_ROTATION_270,
111} GAME_VIDEO_ROTATION;
112
113typedef enum GAME_PCM_FORMAT
114{
115 GAME_PCM_FORMAT_UNKNOWN,
116 GAME_PCM_FORMAT_S16NE,
117} GAME_PCM_FORMAT;
118
119typedef enum GAME_AUDIO_CODEC
120{
121 GAME_AUDIO_CODEC_UNKNOWN,
122 GAME_AUDIO_CODEC_OPUS,
123} GAME_AUDIO_CODEC;
124
125typedef enum GAME_AUDIO_CHANNEL
126{
127 GAME_CH_NULL, // Channel list terminator
128 GAME_CH_FL,
129 GAME_CH_FR,
130 GAME_CH_FC,
131 GAME_CH_LFE,
132 GAME_CH_BL,
133 GAME_CH_BR,
134 GAME_CH_FLOC,
135 GAME_CH_FROC,
136 GAME_CH_BC,
137 GAME_CH_SL,
138 GAME_CH_SR,
139 GAME_CH_TFL,
140 GAME_CH_TFR,
141 GAME_CH_TFC,
142 GAME_CH_TC,
143 GAME_CH_TBL,
144 GAME_CH_TBR,
145 GAME_CH_TBC,
146 GAME_CH_BLOC,
147 GAME_CH_BROC,
148} GAME_AUDIO_CHANNEL;
149
150// TODO
151typedef enum GAME_HW_FRAME_BUFFER
152{
153 GAME_HW_FRAME_BUFFER_VALID, // Pass this to game_video_refresh if rendering to hardware
154 GAME_HW_FRAME_BUFFER_DUPLICATE, // Passing NULL to game_video_refresh is still a frame dupe as normal
155 GAME_HW_FRAME_BUFFER_RENDER,
156} GAME_HW_FRAME_BUFFER;
157
158typedef enum GAME_HW_CONTEXT_TYPE
159{
160 GAME_HW_CONTEXT_NONE,
161 GAME_HW_CONTEXT_OPENGL, // OpenGL 2.x. Latest version available before 3.x+. Driver can choose to use latest compatibility context
162 GAME_HW_CONTEXT_OPENGLES2, // GLES 2.0
163 GAME_HW_CONTEXT_OPENGL_CORE, // Modern desktop core GL context. Use major/minor fields to set GL version
164 GAME_HW_CONTEXT_OPENGLES3, // GLES 3.0
165} GAME_HW_CONTEXT_TYPE;
166
167typedef enum GAME_INPUT_PORT
168{
169 GAME_INPUT_PORT_JOYSTICK_START = 0, // Non-negative values are for joystick ports
170 GAME_INPUT_PORT_KEYBOARD = -1,
171 GAME_INPUT_PORT_MOUSE = -2,
172} GAME_INPUT_PORT;
173
174typedef enum GAME_INPUT_EVENT_SOURCE
175{
176 GAME_INPUT_EVENT_DIGITAL_BUTTON,
177 GAME_INPUT_EVENT_ANALOG_BUTTON,
178 GAME_INPUT_EVENT_ANALOG_STICK,
179 GAME_INPUT_EVENT_ACCELEROMETER,
180 GAME_INPUT_EVENT_KEY,
181 GAME_INPUT_EVENT_RELATIVE_POINTER,
182 GAME_INPUT_EVENT_ABSOLUTE_POINTER,
183 GAME_INPUT_EVENT_MOTOR,
184} GAME_INPUT_EVENT_SOURCE;
185
186typedef enum GAME_KEY_MOD
187{
188 GAME_KEY_MOD_NONE = 0x00,
189
190 GAME_KEY_MOD_SHIFT = 0x01,
191 GAME_KEY_MOD_CTRL = 0x02,
192 GAME_KEY_MOD_ALT = 0x04,
193 GAME_KEY_MOD_RALT = 0x08,
194 GAME_KEY_MOD_META = 0x10,
195
196 GAME_KEY_MOD_NUMLOCK = 0x20,
197 GAME_KEY_MOD_CAPSLOCK = 0x40,
198 GAME_KEY_MOD_SCROLLOCK = 0x80,
199} GAME_KEY_MOD;
200
201/*! Returned from game_get_region() */
202typedef enum GAME_REGION
203{
204 GAME_REGION_UNKNOWN,
205 GAME_REGION_NTSC,
206 GAME_REGION_PAL,
207} GAME_REGION;
208
209/*!
210* Special game types passed into game_load_game_special(). Only used when
211* multiple ROMs are required.
212*/
213typedef enum SPECIAL_GAME_TYPE
214{
215 SPECIAL_GAME_TYPE_BSX,
216 SPECIAL_GAME_TYPE_BSX_SLOTTED,
217 SPECIAL_GAME_TYPE_SUFAMI_TURBO,
218 SPECIAL_GAME_TYPE_SUPER_GAME_BOY,
219} SPECIAL_GAME_TYPE;
220
221typedef enum GAME_MEMORY
222{
223 /*!
224 * Passed to game_get_memory_data/size(). If the memory type doesn't apply
225 * to the implementation NULL/0 can be returned.
226 */
227 GAME_MEMORY_MASK = 0xff,
228
229 /*!
230 * Regular save ram. This ram is usually found on a game cartridge, backed
231 * up by a battery. If save game data is too complex for a single memory
232 * buffer, the SYSTEM_DIRECTORY environment callback can be used.
233 */
234 GAME_MEMORY_SAVE_RAM = 0,
235
236 /*!
237 * Some games have a built-in clock to keep track of time. This memory is
238 * usually just a couple of bytes to keep track of time.
239 */
240 GAME_MEMORY_RTC = 1,
241
242 /*! System ram lets a frontend peek into a game systems main RAM */
243 GAME_MEMORY_SYSTEM_RAM = 2,
244
245 /*! Video ram lets a frontend peek into a game systems video RAM (VRAM) */
246 GAME_MEMORY_VIDEO_RAM = 3,
247
248 /*! Special memory types */
249 GAME_MEMORY_SNES_BSX_RAM = ((1 << 8) | GAME_MEMORY_SAVE_RAM),
250 GAME_MEMORY_SNES_BSX_PRAM = ((2 << 8) | GAME_MEMORY_SAVE_RAM),
251 GAME_MEMORY_SNES_SUFAMI_TURBO_A_RAM= ((3 << 8) | GAME_MEMORY_SAVE_RAM),
252 GAME_MEMORY_SNES_SUFAMI_TURBO_B_RAM= ((4 << 8) | GAME_MEMORY_SAVE_RAM),
253 GAME_MEMORY_SNES_GAME_BOY_RAM = ((5 << 8) | GAME_MEMORY_SAVE_RAM),
254 GAME_MEMORY_SNES_GAME_BOY_RTC = ((6 << 8) | GAME_MEMORY_RTC),
255} GAME_MEMORY;
256
257/*! ID values for SIMD CPU features */
258typedef enum GAME_SIMD
259{
260 GAME_SIMD_SSE = (1 << 0),
261 GAME_SIMD_SSE2 = (1 << 1),
262 GAME_SIMD_VMX = (1 << 2),
263 GAME_SIMD_VMX128 = (1 << 3),
264 GAME_SIMD_AVX = (1 << 4),
265 GAME_SIMD_NEON = (1 << 5),
266 GAME_SIMD_SSE3 = (1 << 6),
267 GAME_SIMD_SSSE3 = (1 << 7),
268 GAME_SIMD_MMX = (1 << 8),
269 GAME_SIMD_MMXEXT = (1 << 9),
270 GAME_SIMD_SSE4 = (1 << 10),
271 GAME_SIMD_SSE42 = (1 << 11),
272 GAME_SIMD_AVX2 = (1 << 12),
273 GAME_SIMD_VFPU = (1 << 13),
274} GAME_SIMD;
275
276typedef enum GAME_ROTATION
277{
278 GAME_ROTATION_0_CW,
279 GAME_ROTATION_90_CW,
280 GAME_ROTATION_180_CW,
281 GAME_ROTATION_270_CW,
282} GAME_ROTATION;
283
284typedef struct game_controller
285{
286 const char* controller_id;
287 unsigned int digital_button_count;
288 unsigned int analog_button_count;
289 unsigned int analog_stick_count;
290 unsigned int accelerometer_count;
291 unsigned int key_count;
292 unsigned int rel_pointer_count;
293 unsigned int abs_pointer_count;
294 unsigned int motor_count;
295} ATTRIBUTE_PACKED game_controller;
296
297typedef struct game_digital_button_event
298{
299 bool pressed;
300} ATTRIBUTE_PACKED game_digital_button_event;
301
302typedef struct game_analog_button_event
303{
304 float magnitude;
305} ATTRIBUTE_PACKED game_analog_button_event;
306
307typedef struct game_analog_stick_event
308{
309 float x;
310 float y;
311} ATTRIBUTE_PACKED game_analog_stick_event;
312
313typedef struct game_accelerometer_event
314{
315 float x;
316 float y;
317 float z;
318} ATTRIBUTE_PACKED game_accelerometer_event;
319
320typedef struct game_key_event
321{
322 bool pressed;
323 XBMCVKey character;
324 GAME_KEY_MOD modifiers;
325} ATTRIBUTE_PACKED game_key_event;
326
327typedef struct game_rel_pointer_event
328{
329 int x;
330 int y;
331} ATTRIBUTE_PACKED game_rel_pointer_event;
332
333typedef struct game_abs_pointer_event
334{
335 bool pressed;
336 float x;
337 float y;
338} ATTRIBUTE_PACKED game_abs_pointer_event;
339
340typedef struct game_motor_event
341{
342 float magnitude;
343} ATTRIBUTE_PACKED game_motor_event;
344
345typedef struct game_input_event
346{
347 GAME_INPUT_EVENT_SOURCE type;
348 int port;
349 const char* controller_id;
350 const char* feature_name;
351 union
352 {
353 struct game_digital_button_event digital_button;
354 struct game_analog_button_event analog_button;
355 struct game_analog_stick_event analog_stick;
356 struct game_accelerometer_event accelerometer;
357 struct game_key_event key;
358 struct game_rel_pointer_event rel_pointer;
359 struct game_abs_pointer_event abs_pointer;
360 struct game_motor_event motor;
361 };
362} ATTRIBUTE_PACKED game_input_event;
363
364struct game_geometry
365{
366 unsigned base_width; // Nominal video width of game
367 unsigned base_height; // Nominal video height of game
368 unsigned max_width; // Maximum possible width of game
369 unsigned max_height; // Maximum possible height of game
370 float aspect_ratio; // Nominal aspect ratio of game. If aspect_ratio is <= 0.0,
371 // an aspect ratio of base_width / base_height is assumed.
372 // A frontend could override this setting if desired.
373};
374
375struct game_system_timing
376{
377 double fps; // FPS of video content.
378 double sample_rate; // Sampling rate of audio.
379};
380
381struct game_system_av_info
382{
383 struct game_geometry geometry;
384 struct game_system_timing timing;
385};
386
387typedef void (*game_proc_address_t)(void);
388
389struct game_hw_info
390{
391 GAME_HW_CONTEXT_TYPE context_type; // Which API to use. Set by game client
392 bool depth; // Set if render buffers should have depth component attached
393 bool stencil; // Set if stencil buffers should be attached
394 // If depth and stencil are true, a packed 24/8 buffer will be added. Only attaching stencil is invalid and will be ignored
395 bool bottom_left_origin; // Use conventional bottom-left origin convention. Is false, standard top-left origin semantics are used
396 unsigned version_major; // Major version number for core GL context
397 unsigned version_minor; // Minor version number for core GL context
398 bool cache_context; // If this is true, the frontend will go very far to avoid resetting context in scenarios like toggling fullscreen, etc.
399 // The reset callback might still be called in extreme situations such as if the context is lost beyond recovery
400 // For optimal stability, set this to false, and allow context to be reset at any time
401 bool debug_context; // Creates a debug context
402};
403
404/*! Properties passed to the ADDON_Create() method of a game client */
405typedef struct game_client_properties
406{
407 /*!
408 * The path of the game client being loaded.
409 */
410 const char* game_client_dll_path;
411
412 /*!
413 * Paths to proxy DLLs used to load the game client.
414 */
415 const char** proxy_dll_paths;
416
417 /*!
418 * Number of proxy DLL paths provided.
419 */
420 unsigned int proxy_dll_count;
421
422 /*!
423 * The "system" directories of the frontend. These directories can be used to
424 * store system-specific ROMs such as BIOSes, configuration data, etc.
425 */
426 const char** resource_directories;
427
428 /*!
429 * Number of resource directories provided
430 */
431 unsigned int resource_directory_count;
432
433 /*!
434 * The writable directory of the frontend. This directory can be used to store
435 * SRAM, memory cards, high scores, etc, if the game client cannot use the
436 * regular memory interface, GetMemoryData().
437 */
438 const char* profile_directory;
439
440 /*!
441 * The value of the <supports_vfs> property from addon.xml
442 */
443 bool supports_vfs;
444
445 /*!
446 * The extensions in the <extensions> property from addon.xml
447 */
448 const char** extensions;
449
450 /*!
451 * Number of extensions provided
452 */
453 unsigned int extension_count;
454} game_client_properties;
455
456/*! Structure to transfer the methods from kodi_game_dll.h to Kodi */
457typedef struct GameClient
458{
459 const char* (__cdecl* GetGameAPIVersion)(void);
460 const char* (__cdecl* GetMininumGameAPIVersion)(void);
461 GAME_ERROR (__cdecl* LoadGame)(const char*);
462 GAME_ERROR (__cdecl* LoadGameSpecial)(SPECIAL_GAME_TYPE, const char**, size_t);
463 GAME_ERROR (__cdecl* LoadStandalone)(void);
464 GAME_ERROR (__cdecl* UnloadGame)(void);
465 GAME_ERROR (__cdecl* GetGameInfo)(game_system_av_info*);
466 GAME_REGION (__cdecl* GetRegion)(void);
467 bool (__cdecl* RequiresGameLoop)(void);
468 GAME_ERROR (__cdecl* RunFrame)(void);
469 GAME_ERROR (__cdecl* Reset)(void);
470 GAME_ERROR (__cdecl* HwContextReset)(void);
471 GAME_ERROR (__cdecl* HwContextDestroy)(void);
472 void (__cdecl* UpdatePort)(int, bool, const game_controller*);
473 bool (__cdecl* HasFeature)(const char* controller_id, const char* feature_name);
474 bool (__cdecl* InputEvent)(const game_input_event*);
475 size_t (__cdecl* SerializeSize)(void);
476 GAME_ERROR (__cdecl* Serialize)(uint8_t*, size_t);
477 GAME_ERROR (__cdecl* Deserialize)(const uint8_t*, size_t);
478 GAME_ERROR (__cdecl* CheatReset)(void);
479 GAME_ERROR (__cdecl* GetMemory)(GAME_MEMORY, const uint8_t**, size_t*);
480 GAME_ERROR (__cdecl* SetCheat)(unsigned int, bool, const char*);
481} GameClient;
482
483#ifdef __cplusplus
484}
485#endif
486
487#endif // KODI_GAME_TYPES_H_
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h
index 3721971..8dc49c0 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h
@@ -122,7 +122,7 @@ extern "C"
122 * @return True if the seek operation was possible 122 * @return True if the seek operation was possible
123 * @remarks Optional, and only used if addon has its own demuxer. 123 * @remarks Optional, and only used if addon has its own demuxer.
124 */ 124 */
125 bool DemuxSeekTime(int time, bool backwards, double *startpts); 125 bool DemuxSeekTime(double time, bool backwards, double *startpts);
126 126
127 /*! 127 /*!
128 * Notify the InputStream addon/demuxer that XBMC wishes to change playback speed 128 * Notify the InputStream addon/demuxer that XBMC wishes to change playback speed
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h
index ad47bb5..46e9d03 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h
@@ -20,9 +20,16 @@
20 * 20 *
21 */ 21 */
22 22
23#ifdef TARGET_WINDOWS
24#include <windows.h>
25#else
23#ifndef __cdecl 26#ifndef __cdecl
24#define __cdecl 27#define __cdecl
25#endif 28#endif
29#ifndef __declspec
30#define __declspec(X)
31#endif
32#endif
26 33
27#ifdef BUILD_KODI_ADDON 34#ifdef BUILD_KODI_ADDON
28#include "DVDDemuxPacket.h" 35#include "DVDDemuxPacket.h"
@@ -31,7 +38,7 @@
31#endif 38#endif
32 39
33/* current API version */ 40/* current API version */
34#define INPUTSTREAM_API_VERSION "1.0.5" 41#define INPUTSTREAM_API_VERSION "1.0.6"
35 42
36extern "C" { 43extern "C" {
37 44
@@ -140,7 +147,7 @@ extern "C" {
140 void (__cdecl* DemuxAbort)(void); 147 void (__cdecl* DemuxAbort)(void);
141 void (__cdecl* DemuxFlush)(void); 148 void (__cdecl* DemuxFlush)(void);
142 DemuxPacket* (__cdecl* DemuxRead)(void); 149 DemuxPacket* (__cdecl* DemuxRead)(void);
143 bool (__cdecl* DemuxSeekTime)(int, bool, double*); 150 bool (__cdecl* DemuxSeekTime)(double, bool, double*);
144 void (__cdecl* DemuxSetSpeed)(int); 151 void (__cdecl* DemuxSetSpeed)(int);
145 void (__cdecl* SetVideoResolution)(int, int); 152 void (__cdecl* SetVideoResolution)(int, int);
146 153
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h
index 2df5622..d7c4282 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h
@@ -51,7 +51,7 @@
51#endif 51#endif
52 52
53/* current Peripheral API version */ 53/* current Peripheral API version */
54#define PERIPHERAL_API_VERSION "1.2.0" 54#define PERIPHERAL_API_VERSION "1.2.1"
55 55
56/* min. Peripheral API version */ 56/* min. Peripheral API version */
57#define PERIPHERAL_MIN_API_VERSION "1.2.0" 57#define PERIPHERAL_MIN_API_VERSION "1.2.0"
@@ -84,6 +84,7 @@ extern "C"
84 { 84 {
85 PERIPHERAL_TYPE_UNKNOWN, 85 PERIPHERAL_TYPE_UNKNOWN,
86 PERIPHERAL_TYPE_JOYSTICK, 86 PERIPHERAL_TYPE_JOYSTICK,
87 PERIPHERAL_TYPE_KEYBOARD,
87 } PERIPHERAL_TYPE; 88 } PERIPHERAL_TYPE;
88 89
89 typedef struct PERIPHERAL_INFO 90 typedef struct PERIPHERAL_INFO
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
new file mode 100644
index 0000000..b5a46dd
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h
@@ -0,0 +1,238 @@
1/*
2 * Copyright (C) 2014-2016 Team Kodi
3 * http://kodi.tv
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this Program; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20#pragma once
21
22#include "libXBMC_addon.h"
23#include "kodi_game_callbacks.h"
24
25#include <string>
26#include <stdio.h>
27
28#if defined(ANDROID)
29 #include <sys/stat.h>
30#endif
31
32#ifdef _WIN32
33 #define GAME_HELPER_DLL "\\library.kodi.game\\libKODI_game" ADDON_HELPER_EXT
34#else
35 #define GAME_HELPER_DLL_NAME "libKODI_game-" ADDON_HELPER_ARCH ADDON_HELPER_EXT
36 #define GAME_HELPER_DLL "/library.kodi.game/" GAME_HELPER_DLL_NAME
37#endif
38
39#define GAME_REGISTER_SYMBOL(dll, functionPtr) \
40 CHelper_libKODI_game::RegisterSymbol(dll, functionPtr, #functionPtr)
41
42class CHelper_libKODI_game
43{
44public:
45 CHelper_libKODI_game(void) :
46 GAME_register_me(nullptr),
47 GAME_unregister_me(nullptr),
48 GAME_close_game(nullptr),
49 GAME_open_pixel_stream(nullptr),
50 GAME_open_video_stream(nullptr),
51 GAME_open_pcm_stream(nullptr),
52 GAME_open_audio_stream(nullptr),
53 GAME_add_stream_data(nullptr),
54 GAME_close_stream(nullptr),
55 GAME_enable_hardware_rendering(nullptr),
56 GAME_hw_get_current_framebuffer(nullptr),
57 GAME_hw_get_proc_address(nullptr),
58 GAME_render_frame(nullptr),
59 GAME_open_port(nullptr),
60 GAME_close_port(nullptr),
61 GAME_input_event(nullptr),
62 m_handle(nullptr),
63 m_callbacks(nullptr),
64 m_libKODI_game(nullptr)
65 {
66 }
67
68 ~CHelper_libKODI_game(void)
69 {
70 if (m_libKODI_game)
71 {
72 GAME_unregister_me(m_handle, m_callbacks);
73 dlclose(m_libKODI_game);
74 }
75 }
76
77 template <typename T>
78 static bool RegisterSymbol(void* dll, T& functionPtr, const char* strFunctionPtr)
79 {
80 return (functionPtr = (T)dlsym(dll, strFunctionPtr)) != NULL;
81 }
82
83 /*!
84 * @brief Resolve all callback methods
85 * @param handle Pointer to the add-on
86 * @return True when all methods were resolved, false otherwise.
87 */
88 bool RegisterMe(void* handle)
89 {
90 m_handle = handle;
91
92 std::string libBasePath;
93 libBasePath = ((cb_array*)m_handle)->libBasePath;
94 libBasePath += GAME_HELPER_DLL;
95
96#if defined(ANDROID)
97 struct stat st;
98 if (stat(libBasePath.c_str(),&st) != 0)
99 {
100 std::string tempbin = getenv("XBMC_ANDROID_LIBS");
101 libBasePath = tempbin + "/" + GAME_HELPER_DLL_NAME;
102 }
103#endif
104
105 m_libKODI_game = dlopen(libBasePath.c_str(), RTLD_LAZY);
106 if (m_libKODI_game == NULL)
107 {
108 fprintf(stderr, "Unable to load %s\n", dlerror());
109 return false;
110 }
111
112 try
113 {
114 if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_register_me)) throw false;
115 if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_unregister_me)) throw false;
116 if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_close_game)) throw false;
117 if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_open_pixel_stream)) throw false;
118 if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_open_video_stream)) throw false;
119 if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_open_pcm_stream)) throw false;
120 if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_open_audio_stream)) throw false;
121 if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_add_stream_data)) throw false;
122 if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_close_stream)) throw false;
123 if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_enable_hardware_rendering)) throw false;
124 if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_hw_get_current_framebuffer)) throw false;
125 if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_hw_get_proc_address)) throw false;
126 if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_render_frame)) throw false;
127 if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_open_port)) throw false;
128 if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_close_port)) throw false;
129 if (!GAME_REGISTER_SYMBOL(m_libKODI_game, GAME_input_event)) throw false;
130 }
131 catch (const bool& bSuccess)
132 {
133 fprintf(stderr, "ERROR: Unable to assign function %s\n", dlerror());
134 return bSuccess;
135 }
136
137 m_callbacks = GAME_register_me(m_handle);
138 return m_callbacks != NULL;
139 }
140
141 void CloseGame(void)
142 {
143 return GAME_close_game(m_handle, m_callbacks);
144 }
145
146 bool OpenPixelStream(GAME_PIXEL_FORMAT format, unsigned int width, unsigned int height, GAME_VIDEO_ROTATION rotation)
147 {
148 return GAME_open_pixel_stream(m_handle, m_callbacks, format, width, height, rotation) == 0;
149 }
150
151 bool OpenVideoStream(GAME_VIDEO_CODEC codec)
152 {
153 return GAME_open_video_stream(m_handle, m_callbacks, codec) == 0;
154 }
155
156 bool OpenPCMStream(GAME_PCM_FORMAT format, const GAME_AUDIO_CHANNEL* channel_map)
157 {
158 return GAME_open_pcm_stream(m_handle, m_callbacks, format, channel_map) == 0;
159 }
160
161 bool OpenAudioStream(GAME_AUDIO_CODEC codec, const GAME_AUDIO_CHANNEL* channel_map)
162 {
163 return GAME_open_audio_stream(m_handle, m_callbacks, codec, channel_map) == 0;
164 }
165
166 void AddStreamData(GAME_STREAM_TYPE stream, const uint8_t* data, unsigned int size)
167 {
168 GAME_add_stream_data(m_handle, m_callbacks, stream, data, size);
169 }
170
171 void CloseStream(GAME_STREAM_TYPE stream)
172 {
173 GAME_close_stream(m_handle, m_callbacks, stream);
174 }
175
176 void EnableHardwareRendering(const struct game_hw_info* hw_info)
177 {
178 return GAME_enable_hardware_rendering(m_handle, m_callbacks, hw_info);
179 }
180
181 uintptr_t HwGetCurrentFramebuffer(void)
182 {
183 return GAME_hw_get_current_framebuffer(m_handle, m_callbacks);
184 }
185
186 game_proc_address_t HwGetProcAddress(const char* sym)
187 {
188 return GAME_hw_get_proc_address(m_handle, m_callbacks, sym);
189 }
190
191 void RenderFrame()
192 {
193 return GAME_render_frame(m_handle, m_callbacks);
194 }
195
196 bool OpenPort(unsigned int port)
197 {
198 return GAME_open_port(m_handle, m_callbacks, port);
199 }
200
201 void ClosePort(unsigned int port)
202 {
203 return GAME_close_port(m_handle, m_callbacks, port);
204 }
205
206 bool InputEvent(const game_input_event& event)
207 {
208 return GAME_input_event(m_handle, m_callbacks, &event);
209 }
210
211protected:
212 CB_GameLib* (*GAME_register_me)(void* handle);
213 void (*GAME_unregister_me)(void* handle, CB_GameLib* cb);
214 void (*GAME_close_game)(void* handle, CB_GameLib* cb);
215 int (*GAME_open_pixel_stream)(void* handle, CB_GameLib* cb, GAME_PIXEL_FORMAT, unsigned int, unsigned int, GAME_VIDEO_ROTATION);
216 int (*GAME_open_video_stream)(void* handle, CB_GameLib* cb, GAME_VIDEO_CODEC);
217 int (*GAME_open_pcm_stream)(void* handle, CB_GameLib* cb, GAME_PCM_FORMAT, const GAME_AUDIO_CHANNEL*);
218 int (*GAME_open_audio_stream)(void* handle, CB_GameLib* cb, GAME_AUDIO_CODEC, const GAME_AUDIO_CHANNEL*);
219 int (*GAME_add_stream_data)(void* handle, CB_GameLib* cb, GAME_STREAM_TYPE, const uint8_t*, unsigned int);
220 int (*GAME_close_stream)(void* handle, CB_GameLib* cb, GAME_STREAM_TYPE);
221 void (*GAME_enable_hardware_rendering)(void* handle, CB_GameLib* cb, const struct game_hw_info*);
222 uintptr_t (*GAME_hw_get_current_framebuffer)(void* handle, CB_GameLib* cb);
223 game_proc_address_t (*GAME_hw_get_proc_address)(void* handle, CB_GameLib* cb, const char*);
224 void (*GAME_render_frame)(void* handle, CB_GameLib* cb);
225 bool (*GAME_open_port)(void* handle, CB_GameLib* cb, unsigned int);
226 void (*GAME_close_port)(void* handle, CB_GameLib* cb, unsigned int);
227 bool (*GAME_input_event)(void* handle, CB_GameLib* cb, const game_input_event* event);
228
229private:
230 void* m_handle;
231 CB_GameLib* m_callbacks;
232 void* m_libKODI_game;
233
234 struct cb_array
235 {
236 const char* libBasePath;
237 };
238};
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h
index 3fe12c9..b699fa0 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h
@@ -615,7 +615,6 @@ public:
615 615
616private: 616private:
617 CAddonGUIWindow *m_Window; 617 CAddonGUIWindow *m_Window;
618 int m_ControlId;
619 GUIHANDLE m_SpinHandle; 618 GUIHANDLE m_SpinHandle;
620 void *m_Handle; 619 void *m_Handle;
621 void *m_cb; 620 void *m_cb;
@@ -634,7 +633,6 @@ public:
634 633
635private: 634private:
636 CAddonGUIWindow *m_Window; 635 CAddonGUIWindow *m_Window;
637 int m_ControlId;
638 GUIHANDLE m_ButtonHandle; 636 GUIHANDLE m_ButtonHandle;
639 void *m_Handle; 637 void *m_Handle;
640 void *m_cb; 638 void *m_cb;
@@ -654,7 +652,6 @@ public:
654 652
655private: 653private:
656 CAddonGUIWindow *m_Window; 654 CAddonGUIWindow *m_Window;
657 int m_ControlId;
658 GUIHANDLE m_ProgressHandle; 655 GUIHANDLE m_ProgressHandle;
659 void *m_Handle; 656 void *m_Handle;
660 void *m_cb; 657 void *m_cb;
@@ -684,7 +681,6 @@ public:
684 681
685private: 682private:
686 CAddonGUIWindow *m_Window; 683 CAddonGUIWindow *m_Window;
687 int m_ControlId;
688 GUIHANDLE m_SliderHandle; 684 GUIHANDLE m_SliderHandle;
689 void *m_Handle; 685 void *m_Handle;
690 void *m_cb; 686 void *m_cb;
@@ -715,7 +711,6 @@ public:
715 711
716private: 712private:
717 CAddonGUIWindow *m_Window; 713 CAddonGUIWindow *m_Window;
718 int m_ControlId;
719 GUIHANDLE m_SettingsSliderHandle; 714 GUIHANDLE m_SettingsSliderHandle;
720 void *m_Handle; 715 void *m_Handle;
721 void *m_cb; 716 void *m_cb;
@@ -825,7 +820,6 @@ public:
825 820
826private: 821private:
827 CAddonGUIWindow *m_Window; 822 CAddonGUIWindow *m_Window;
828 int m_ControlId;
829 GUIHANDLE m_RenderingHandle; 823 GUIHANDLE m_RenderingHandle;
830 void *m_Handle; 824 void *m_Handle;
831 void *m_cb; 825 void *m_cb;
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h
index a6e83cb..c55a42b 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h
@@ -33,27 +33,40 @@
33#include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h" 33#include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h"
34#endif 34#endif
35 35
36#define INPUTSTREAM_HELPER_DLL KODI_DLL("inputstream")
37#define INPUTSTREAM_HELPER_DLL_NAME KODI_DLL_NAME("inputstream")
38
39/* current input stream API version */ 36/* current input stream API version */
40#define KODI_INPUTSTREAM_API_VERSION "1.0.0" 37#define KODI_INPUTSTREAM_API_VERSION "1.0.0"
41 38
39namespace KodiAPI
40{
41namespace V1
42{
43namespace InputStream
44{
45
46typedef struct CB_INPUTSTREAMLib
47{
48 void (*FreeDemuxPacket)(void *addonData, DemuxPacket* pPacket);
49 DemuxPacket* (*AllocateDemuxPacket)(void *addonData, int iDataSize);
50} CB_INPUTSTREAMLib;
51
52} /* namespace InputStream */
53} /* namespace V1 */
54} /* namespace KodiAPI */
55
42class CHelper_libKODI_inputstream 56class CHelper_libKODI_inputstream
43{ 57{
44public: 58public:
45 CHelper_libKODI_inputstream(void) 59 CHelper_libKODI_inputstream(void)
46 { 60 {
47 m_libKODI_inputstream = nullptr;
48 m_Handle = nullptr; 61 m_Handle = nullptr;
62 m_Callbacks = nullptr;
49 } 63 }
50 64
51 ~CHelper_libKODI_inputstream(void) 65 ~CHelper_libKODI_inputstream(void)
52 { 66 {
53 if (m_libKODI_inputstream) 67 if (m_Handle && m_Callbacks)
54 { 68 {
55 INPUTSTREAM_unregister_me(m_Handle, m_Callbacks); 69 m_Handle->INPUTSTREAMLib_UnRegisterMe(m_Handle->addonData, m_Callbacks);
56 dlclose(m_libKODI_inputstream);
57 } 70 }
58 } 71 }
59 72
@@ -64,52 +77,12 @@ public:
64 */ 77 */
65 bool RegisterMe(void* handle) 78 bool RegisterMe(void* handle)
66 { 79 {
67 m_Handle = handle; 80 m_Handle = static_cast<AddonCB*>(handle);
68 81 if (m_Handle)
69 std::string libBasePath; 82 m_Callbacks = (KodiAPI::V1::InputStream::CB_INPUTSTREAMLib*)m_Handle->INPUTSTREAMLib_RegisterMe(m_Handle->addonData);
70 libBasePath = ((cb_array*)m_Handle)->libPath; 83 if (!m_Callbacks)
71 libBasePath += INPUTSTREAM_HELPER_DLL; 84 fprintf(stderr, "libKODI_inputstream-ERROR: InputStream_RegisterMe can't get callback table from Kodi !!!\n");
72
73 m_libKODI_inputstream = dlopen(libBasePath.c_str(), RTLD_LAZY);
74 if (m_libKODI_inputstream == nullptr)
75 {
76 fprintf(stderr, "Unable to load %s\n", dlerror());
77 return false;
78 }
79
80 INPUTSTREAM_register_me = (void* (*)(void *HANDLE))
81 dlsym(m_libKODI_inputstream, "INPUTSTREAM_register_me");
82 if (INPUTSTREAM_register_me == nullptr)
83 {
84 fprintf(stderr, "Unable to assign function %s\n", dlerror());
85 return false;
86 }
87 85
88 INPUTSTREAM_unregister_me = (void (*)(void* HANDLE, void* CB))
89 dlsym(m_libKODI_inputstream, "INPUTSTREAM_unregister_me");
90 if (INPUTSTREAM_unregister_me == nullptr)
91 {
92 fprintf(stderr, "Unable to assign function %s\n", dlerror());
93 return false;
94 }
95
96 INPUTSTREAM_free_demux_packet = (void (*)(void* HANDLE, void* CB, DemuxPacket* pPacket))
97 dlsym(m_libKODI_inputstream, "INPUTSTREAM_free_demux_packet");
98 if (INPUTSTREAM_free_demux_packet == NULL)
99 {
100 fprintf(stderr, "Unable to assign function %s\n", dlerror());
101 return false;
102 }
103
104 INPUTSTREAM_allocate_demux_packet = (DemuxPacket* (*)(void* HANDLE, void* CB, int iDataSize))
105 dlsym(m_libKODI_inputstream, "INPUTSTREAM_allocate_demux_packet");
106 if (INPUTSTREAM_allocate_demux_packet == NULL)
107 {
108 fprintf(stderr, "Unable to assign function %s\n", dlerror());
109 return false;
110 }
111
112 m_Callbacks = INPUTSTREAM_register_me(m_Handle);
113 return m_Callbacks != nullptr; 86 return m_Callbacks != nullptr;
114 } 87 }
115 88
@@ -120,7 +93,7 @@ public:
120 */ 93 */
121 DemuxPacket* AllocateDemuxPacket(int iDataSize) 94 DemuxPacket* AllocateDemuxPacket(int iDataSize)
122 { 95 {
123 return INPUTSTREAM_allocate_demux_packet(m_Handle, m_Callbacks, iDataSize); 96 return m_Callbacks->AllocateDemuxPacket(m_Handle->addonData, iDataSize);
124 } 97 }
125 98
126 /*! 99 /*!
@@ -129,21 +102,10 @@ public:
129 */ 102 */
130 void FreeDemuxPacket(DemuxPacket* pPacket) 103 void FreeDemuxPacket(DemuxPacket* pPacket)
131 { 104 {
132 return INPUTSTREAM_free_demux_packet(m_Handle, m_Callbacks, pPacket); 105 return m_Callbacks->FreeDemuxPacket(m_Handle->addonData, pPacket);
133 } 106 }
134 107
135protected:
136 void* (*INPUTSTREAM_register_me)(void*);
137 void (*INPUTSTREAM_unregister_me)(void*, void*);
138 void (*INPUTSTREAM_free_demux_packet)(void*, void*, DemuxPacket*);
139 DemuxPacket* (*INPUTSTREAM_allocate_demux_packet)(void*, void*, int);
140
141private: 108private:
142 void* m_libKODI_inputstream; 109 AddonCB* m_Handle;
143 void* m_Handle; 110 KodiAPI::V1::InputStream::CB_INPUTSTREAMLib* m_Callbacks;
144 void* m_Callbacks;
145 struct cb_array
146 {
147 const char* libPath;
148 };
149}; 111};
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h
index 70bd19b..d9f72c1 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h
@@ -116,6 +116,49 @@ typedef intptr_t ssize_t;
116/* current addon API version */ 116/* current addon API version */
117#define KODI_ADDON_API_VERSION "1.0.0" 117#define KODI_ADDON_API_VERSION "1.0.0"
118 118
119typedef void* (*KODIAddOnLib_RegisterMe)(void *addonData);
120typedef void (*KODIAddOnLib_UnRegisterMe)(void *addonData, void *cbTable);
121typedef void* (*KODIAudioEngineLib_RegisterMe)(void *addonData);
122typedef void (*KODIAudioEngineLib_UnRegisterMe)(void *addonData, void *cbTable);
123typedef void* (*KODIGUILib_RegisterMe)(void *addonData);
124typedef void (*KODIGUILib_UnRegisterMe)(void *addonData, void *cbTable);
125typedef void* (*KODIPVRLib_RegisterMe)(void *addonData);
126typedef void (*KODIPVRLib_UnRegisterMe)(void *addonData, void *cbTable);
127typedef void* (*KODIADSPLib_RegisterMe)(void *addonData);
128typedef void (*KODIADSPLib_UnRegisterMe)(void *addonData, void *cbTable);
129typedef void* (*KODICodecLib_RegisterMe)(void *addonData);
130typedef void (*KODICodecLib_UnRegisterMe)(void *addonData, void *cbTable);
131typedef void* (*KODIINPUTSTREAMLib_RegisterMe)(void *addonData);
132typedef void (*KODIINPUTSTREAMLib_UnRegisterMe)(void *addonData, void *cbTable);
133typedef void* (*KODIPeripheralLib_RegisterMe)(void *addonData);
134typedef void (*KODIPeripheralLib_UnRegisterMe)(void *addonData, void *cbTable);
135typedef void* (*KODIGameLib_RegisterMe)(void *addonData);
136typedef void (*KODIGameLib_UnRegisterMe)(void *addonData, void *cbTable);
137
138typedef struct AddonCB
139{
140 const char* libBasePath; ///< Never, never change this!!!
141 void* addonData;
142 KODIAddOnLib_RegisterMe AddOnLib_RegisterMe;
143 KODIAddOnLib_UnRegisterMe AddOnLib_UnRegisterMe;
144 KODIAudioEngineLib_RegisterMe AudioEngineLib_RegisterMe;
145 KODIAudioEngineLib_UnRegisterMe AudioEngineLib_UnRegisterMe;
146 KODICodecLib_RegisterMe CodecLib_RegisterMe;
147 KODICodecLib_UnRegisterMe CodecLib_UnRegisterMe;
148 KODIGUILib_RegisterMe GUILib_RegisterMe;
149 KODIGUILib_UnRegisterMe GUILib_UnRegisterMe;
150 KODIPVRLib_RegisterMe PVRLib_RegisterMe;
151 KODIPVRLib_UnRegisterMe PVRLib_UnRegisterMe;
152 KODIADSPLib_RegisterMe ADSPLib_RegisterMe;
153 KODIADSPLib_UnRegisterMe ADSPLib_UnRegisterMe;
154 KODIINPUTSTREAMLib_RegisterMe INPUTSTREAMLib_RegisterMe;
155 KODIINPUTSTREAMLib_UnRegisterMe INPUTSTREAMLib_UnRegisterMe;
156 KODIPeripheralLib_RegisterMe PeripheralLib_RegisterMe;
157 KODIPeripheralLib_UnRegisterMe PeripheralLib_UnRegisterMe;
158 KODIGameLib_RegisterMe GameLib_RegisterMe;
159 KODIGameLib_UnRegisterMe GameLib_UnRegisterMe;
160} AddonCB;
161
119namespace ADDON 162namespace ADDON
120{ 163{
121 typedef enum addon_log 164 typedef enum addon_log
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h
index a769328..3ae30a7 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h
@@ -27,29 +27,60 @@
27#include "xbmc_pvr_types.h" 27#include "xbmc_pvr_types.h"
28#include "libXBMC_addon.h" 28#include "libXBMC_addon.h"
29 29
30#define PVR_HELPER_DLL_NAME XBMC_DLL_NAME("pvr")
31#define PVR_HELPER_DLL XBMC_DLL("pvr")
32
33#define DVD_TIME_BASE 1000000 30#define DVD_TIME_BASE 1000000
34 31
35//! @todo original definition is in DVDClock.h 32//! @todo original definition is in DVDClock.h
36#define DVD_NOPTS_VALUE 0xFFF0000000000000 33#define DVD_NOPTS_VALUE 0xFFF0000000000000
37 34
35namespace KodiAPI
36{
37namespace V1
38{
39namespace PVR
40{
41
42typedef struct CB_PVRLib
43{
44 void (*TransferEpgEntry)(void *userData, const ADDON_HANDLE handle, const EPG_TAG *epgentry);
45 void (*TransferChannelEntry)(void *userData, const ADDON_HANDLE handle, const PVR_CHANNEL *chan);
46 void (*TransferTimerEntry)(void *userData, const ADDON_HANDLE handle, const PVR_TIMER *timer);
47 void (*TransferRecordingEntry)(void *userData, const ADDON_HANDLE handle, const PVR_RECORDING *recording);
48 void (*AddMenuHook)(void *addonData, PVR_MENUHOOK *hook);
49 void (*Recording)(void *addonData, const char *Name, const char *FileName, bool On);
50 void (*TriggerChannelUpdate)(void *addonData);
51 void (*TriggerTimerUpdate)(void *addonData);
52 void (*TriggerRecordingUpdate)(void *addonData);
53 void (*TriggerChannelGroupsUpdate)(void *addonData);
54 void (*TriggerEpgUpdate)(void *addonData, unsigned int iChannelUid);
55
56 void (*TransferChannelGroup)(void *addonData, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP *group);
57 void (*TransferChannelGroupMember)(void *addonData, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP_MEMBER *member);
58
59 void (*FreeDemuxPacket)(void *addonData, DemuxPacket* pPacket);
60 DemuxPacket* (*AllocateDemuxPacket)(void *addonData, int iDataSize);
61
62 void (*ConnectionStateChange)(void* addonData, const char* strConnectionString, PVR_CONNECTION_STATE newState, const char *strMessage);
63 void (*EpgEventStateChange)(void* addonData, EPG_TAG* tag, unsigned int iUniqueChannelId, EPG_EVENT_STATE newState);
64} CB_PVRLib;
65
66} /* namespace PVR */
67} /* namespace V1 */
68} /* namespace KodiAPI */
69
38class CHelper_libXBMC_pvr 70class CHelper_libXBMC_pvr
39{ 71{
40public: 72public:
41 CHelper_libXBMC_pvr(void) 73 CHelper_libXBMC_pvr(void)
42 { 74 {
43 m_libXBMC_pvr = NULL; 75 m_Handle = nullptr;
44 m_Handle = NULL; 76 m_Callbacks = nullptr;
45 } 77 }
46 78
47 ~CHelper_libXBMC_pvr(void) 79 ~CHelper_libXBMC_pvr(void)
48 { 80 {
49 if (m_libXBMC_pvr) 81 if (m_Handle && m_Callbacks)
50 { 82 {
51 PVR_unregister_me(m_Handle, m_Callbacks); 83 m_Handle->PVRLib_UnRegisterMe(m_Handle->addonData, m_Callbacks);
52 dlclose(m_libXBMC_pvr);
53 } 84 }
54 } 85 }
55 86
@@ -60,98 +91,12 @@ public:
60 */ 91 */
61 bool RegisterMe(void* handle) 92 bool RegisterMe(void* handle)
62 { 93 {
63 m_Handle = handle; 94 m_Handle = static_cast<AddonCB*>(handle);
64 95 if (m_Handle)
65 std::string libBasePath; 96 m_Callbacks = (KodiAPI::V1::PVR::CB_PVRLib*)m_Handle->PVRLib_RegisterMe(m_Handle->addonData);
66 libBasePath = ((cb_array*)m_Handle)->libPath; 97 if (!m_Callbacks)
67 libBasePath += PVR_HELPER_DLL; 98 fprintf(stderr, "libXBMC_pvr-ERROR: PVRLib_register_me can't get callback table from Kodi !!!\n");
68 99
69 m_libXBMC_pvr = dlopen(libBasePath.c_str(), RTLD_LAZY);
70 if (m_libXBMC_pvr == NULL)
71 {
72 fprintf(stderr, "Unable to load %s\n", dlerror());
73 return false;
74 }
75
76 PVR_register_me = (void* (*)(void *HANDLE))
77 dlsym(m_libXBMC_pvr, "PVR_register_me");
78 if (PVR_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
79
80 PVR_unregister_me = (void (*)(void* HANDLE, void* CB))
81 dlsym(m_libXBMC_pvr, "PVR_unregister_me");
82 if (PVR_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
83
84 PVR_transfer_epg_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const EPG_TAG *epgentry))
85 dlsym(m_libXBMC_pvr, "PVR_transfer_epg_entry");
86 if (PVR_transfer_epg_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
87
88 PVR_transfer_channel_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL *chan))
89 dlsym(m_libXBMC_pvr, "PVR_transfer_channel_entry");
90 if (PVR_transfer_channel_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
91
92 PVR_transfer_timer_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_TIMER *timer))
93 dlsym(m_libXBMC_pvr, "PVR_transfer_timer_entry");
94 if (PVR_transfer_timer_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
95
96 PVR_transfer_recording_entry = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_RECORDING *recording))
97 dlsym(m_libXBMC_pvr, "PVR_transfer_recording_entry");
98 if (PVR_transfer_recording_entry == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
99
100 PVR_add_menu_hook = (void (*)(void* HANDLE, void* CB, PVR_MENUHOOK *hook))
101 dlsym(m_libXBMC_pvr, "PVR_add_menu_hook");
102 if (PVR_add_menu_hook == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
103
104 PVR_recording = (void (*)(void* HANDLE, void* CB, const char *Name, const char *FileName, bool On))
105 dlsym(m_libXBMC_pvr, "PVR_recording");
106 if (PVR_recording == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
107
108 PVR_trigger_timer_update = (void (*)(void* HANDLE, void* CB))
109 dlsym(m_libXBMC_pvr, "PVR_trigger_timer_update");
110 if (PVR_trigger_timer_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
111
112 PVR_trigger_recording_update = (void (*)(void* HANDLE, void* CB))
113 dlsym(m_libXBMC_pvr, "PVR_trigger_recording_update");
114 if (PVR_trigger_recording_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
115
116 PVR_trigger_channel_update = (void (*)(void* HANDLE, void* CB))
117 dlsym(m_libXBMC_pvr, "PVR_trigger_channel_update");
118 if (PVR_trigger_channel_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
119
120 PVR_trigger_channel_groups_update = (void (*)(void* HANDLE, void* CB))
121 dlsym(m_libXBMC_pvr, "PVR_trigger_channel_groups_update");
122 if (PVR_trigger_channel_groups_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
123
124 PVR_trigger_epg_update = (void (*)(void* HANDLE, void* CB, unsigned int iChannelUid))
125 dlsym(m_libXBMC_pvr, "PVR_trigger_epg_update");
126 if (PVR_trigger_epg_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
127
128 PVR_transfer_channel_group = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP *group))
129 dlsym(m_libXBMC_pvr, "PVR_transfer_channel_group");
130 if (PVR_transfer_channel_group == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
131
132 PVR_transfer_channel_group_member = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP_MEMBER *member))
133 dlsym(m_libXBMC_pvr, "PVR_transfer_channel_group_member");
134 if (PVR_transfer_channel_group_member == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
135
136#ifdef USE_DEMUX
137 PVR_free_demux_packet = (void (*)(void* HANDLE, void* CB, DemuxPacket* pPacket))
138 dlsym(m_libXBMC_pvr, "PVR_free_demux_packet");
139 if (PVR_free_demux_packet == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
140
141 PVR_allocate_demux_packet = (DemuxPacket* (*)(void* HANDLE, void* CB, int iDataSize))
142 dlsym(m_libXBMC_pvr, "PVR_allocate_demux_packet");
143 if (PVR_allocate_demux_packet == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
144#endif
145
146 PVR_connection_state_change = (void (*)(void* HANDLE, void* CB, const char *strConnectionString, PVR_CONNECTION_STATE newState, const char *strMessage))
147 dlsym(m_libXBMC_pvr, "PVR_connection_state_change");
148 if (PVR_connection_state_change == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
149
150 PVR_epg_event_state_change = (void (*)(void* HANDLE, void* CB, EPG_TAG* tag, unsigned int iUniqueChannelId, EPG_EVENT_STATE newState))
151 dlsym(m_libXBMC_pvr, "PVR_epg_event_state_change");
152 if (PVR_epg_event_state_change == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
153
154 m_Callbacks = PVR_register_me(m_Handle);
155 return m_Callbacks != NULL; 100 return m_Callbacks != NULL;
156 } 101 }
157 102
@@ -162,7 +107,7 @@ public:
162 */ 107 */
163 void TransferEpgEntry(const ADDON_HANDLE handle, const EPG_TAG* entry) 108 void TransferEpgEntry(const ADDON_HANDLE handle, const EPG_TAG* entry)
164 { 109 {
165 return PVR_transfer_epg_entry(m_Handle, m_Callbacks, handle, entry); 110 return m_Callbacks->TransferEpgEntry(m_Handle->addonData, handle, entry);
166 } 111 }
167 112
168 /*! 113 /*!
@@ -172,7 +117,7 @@ public:
172 */ 117 */
173 void TransferChannelEntry(const ADDON_HANDLE handle, const PVR_CHANNEL* entry) 118 void TransferChannelEntry(const ADDON_HANDLE handle, const PVR_CHANNEL* entry)
174 { 119 {
175 return PVR_transfer_channel_entry(m_Handle, m_Callbacks, handle, entry); 120 return m_Callbacks->TransferChannelEntry(m_Handle->addonData, handle, entry);
176 } 121 }
177 122
178 /*! 123 /*!
@@ -182,7 +127,7 @@ public:
182 */ 127 */
183 void TransferTimerEntry(const ADDON_HANDLE handle, const PVR_TIMER* entry) 128 void TransferTimerEntry(const ADDON_HANDLE handle, const PVR_TIMER* entry)
184 { 129 {
185 return PVR_transfer_timer_entry(m_Handle, m_Callbacks, handle, entry); 130 return m_Callbacks->TransferTimerEntry(m_Handle->addonData, handle, entry);
186 } 131 }
187 132
188 /*! 133 /*!
@@ -192,7 +137,7 @@ public:
192 */ 137 */
193 void TransferRecordingEntry(const ADDON_HANDLE handle, const PVR_RECORDING* entry) 138 void TransferRecordingEntry(const ADDON_HANDLE handle, const PVR_RECORDING* entry)
194 { 139 {
195 return PVR_transfer_recording_entry(m_Handle, m_Callbacks, handle, entry); 140 return m_Callbacks->TransferRecordingEntry(m_Handle->addonData, handle, entry);
196 } 141 }
197 142
198 /*! 143 /*!
@@ -202,7 +147,7 @@ public:
202 */ 147 */
203 void TransferChannelGroup(const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP* entry) 148 void TransferChannelGroup(const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP* entry)
204 { 149 {
205 return PVR_transfer_channel_group(m_Handle, m_Callbacks, handle, entry); 150 return m_Callbacks->TransferChannelGroup(m_Handle->addonData, handle, entry);
206 } 151 }
207 152
208 /*! 153 /*!
@@ -212,7 +157,7 @@ public:
212 */ 157 */
213 void TransferChannelGroupMember(const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP_MEMBER* entry) 158 void TransferChannelGroupMember(const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP_MEMBER* entry)
214 { 159 {
215 return PVR_transfer_channel_group_member(m_Handle, m_Callbacks, handle, entry); 160 return m_Callbacks->TransferChannelGroupMember(m_Handle->addonData, handle, entry);
216 } 161 }
217 162
218 /*! 163 /*!
@@ -221,7 +166,7 @@ public:
221 */ 166 */
222 void AddMenuHook(PVR_MENUHOOK* hook) 167 void AddMenuHook(PVR_MENUHOOK* hook)
223 { 168 {
224 return PVR_add_menu_hook(m_Handle, m_Callbacks, hook); 169 return m_Callbacks->AddMenuHook(m_Handle->addonData, hook);
225 } 170 }
226 171
227 /*! 172 /*!
@@ -232,7 +177,7 @@ public:
232 */ 177 */
233 void Recording(const char* strRecordingName, const char* strFileName, bool bOn) 178 void Recording(const char* strRecordingName, const char* strFileName, bool bOn)
234 { 179 {
235 return PVR_recording(m_Handle, m_Callbacks, strRecordingName, strFileName, bOn); 180 return m_Callbacks->Recording(m_Handle->addonData, strRecordingName, strFileName, bOn);
236 } 181 }
237 182
238 /*! 183 /*!
@@ -240,7 +185,7 @@ public:
240 */ 185 */
241 void TriggerTimerUpdate(void) 186 void TriggerTimerUpdate(void)
242 { 187 {
243 return PVR_trigger_timer_update(m_Handle, m_Callbacks); 188 return m_Callbacks->TriggerTimerUpdate(m_Handle->addonData);
244 } 189 }
245 190
246 /*! 191 /*!
@@ -248,7 +193,7 @@ public:
248 */ 193 */
249 void TriggerRecordingUpdate(void) 194 void TriggerRecordingUpdate(void)
250 { 195 {
251 return PVR_trigger_recording_update(m_Handle, m_Callbacks); 196 return m_Callbacks->TriggerRecordingUpdate(m_Handle->addonData);
252 } 197 }
253 198
254 /*! 199 /*!
@@ -256,7 +201,7 @@ public:
256 */ 201 */
257 void TriggerChannelUpdate(void) 202 void TriggerChannelUpdate(void)
258 { 203 {
259 return PVR_trigger_channel_update(m_Handle, m_Callbacks); 204 return m_Callbacks->TriggerChannelUpdate(m_Handle->addonData);
260 } 205 }
261 206
262 /*! 207 /*!
@@ -265,7 +210,7 @@ public:
265 */ 210 */
266 void TriggerEpgUpdate(unsigned int iChannelUid) 211 void TriggerEpgUpdate(unsigned int iChannelUid)
267 { 212 {
268 return PVR_trigger_epg_update(m_Handle, m_Callbacks, iChannelUid); 213 return m_Callbacks->TriggerEpgUpdate(m_Handle->addonData, iChannelUid);
269 } 214 }
270 215
271 /*! 216 /*!
@@ -273,7 +218,7 @@ public:
273 */ 218 */
274 void TriggerChannelGroupsUpdate(void) 219 void TriggerChannelGroupsUpdate(void)
275 { 220 {
276 return PVR_trigger_channel_groups_update(m_Handle, m_Callbacks); 221 return m_Callbacks->TriggerChannelGroupsUpdate(m_Handle->addonData);
277 } 222 }
278 223
279#ifdef USE_DEMUX 224#ifdef USE_DEMUX
@@ -283,7 +228,7 @@ public:
283 */ 228 */
284 void FreeDemuxPacket(DemuxPacket* pPacket) 229 void FreeDemuxPacket(DemuxPacket* pPacket)
285 { 230 {
286 return PVR_free_demux_packet(m_Handle, m_Callbacks, pPacket); 231 return m_Callbacks->FreeDemuxPacket(m_Handle->addonData, pPacket);
287 } 232 }
288 233
289 /*! 234 /*!
@@ -293,7 +238,7 @@ public:
293 */ 238 */
294 DemuxPacket* AllocateDemuxPacket(int iDataSize) 239 DemuxPacket* AllocateDemuxPacket(int iDataSize)
295 { 240 {
296 return PVR_allocate_demux_packet(m_Handle, m_Callbacks, iDataSize); 241 return m_Callbacks->AllocateDemuxPacket(m_Handle->addonData, iDataSize);
297 } 242 }
298#endif 243#endif
299 244
@@ -306,7 +251,7 @@ public:
306 */ 251 */
307 void ConnectionStateChange(const char *strConnectionString, PVR_CONNECTION_STATE newState, const char *strMessage) 252 void ConnectionStateChange(const char *strConnectionString, PVR_CONNECTION_STATE newState, const char *strMessage)
308 { 253 {
309 return PVR_connection_state_change(m_Handle, m_Callbacks, strConnectionString, newState, strMessage); 254 return m_Callbacks->ConnectionStateChange(m_Handle->addonData, strConnectionString, newState, strMessage);
310 } 255 }
311 256
312 /*! 257 /*!
@@ -318,38 +263,10 @@ public:
318 */ 263 */
319 void EpgEventStateChange(EPG_TAG *tag, unsigned int iUniqueChannelId, EPG_EVENT_STATE newState) 264 void EpgEventStateChange(EPG_TAG *tag, unsigned int iUniqueChannelId, EPG_EVENT_STATE newState)
320 { 265 {
321 return PVR_epg_event_state_change(m_Handle, m_Callbacks, tag, iUniqueChannelId, newState); 266 return m_Callbacks->EpgEventStateChange(m_Handle->addonData, tag, iUniqueChannelId, newState);
322 } 267 }
323 268
324protected:
325 void* (*PVR_register_me)(void*);
326 void (*PVR_unregister_me)(void*, void*);
327 void (*PVR_transfer_epg_entry)(void*, void*, const ADDON_HANDLE, const EPG_TAG*);
328 void (*PVR_transfer_channel_entry)(void*, void*, const ADDON_HANDLE, const PVR_CHANNEL*);
329 void (*PVR_transfer_timer_entry)(void*, void*, const ADDON_HANDLE, const PVR_TIMER*);
330 void (*PVR_transfer_recording_entry)(void*, void*, const ADDON_HANDLE, const PVR_RECORDING*);
331 void (*PVR_add_menu_hook)(void*, void*, PVR_MENUHOOK*);
332 void (*PVR_recording)(void*, void*, const char*, const char*, bool);
333 void (*PVR_trigger_channel_update)(void*, void*);
334 void (*PVR_trigger_channel_groups_update)(void*, void*);
335 void (*PVR_trigger_timer_update)(void*, void*);
336 void (*PVR_trigger_recording_update)(void* , void*);
337 void (*PVR_trigger_epg_update)(void*, void*, unsigned int);
338 void (*PVR_transfer_channel_group)(void*, void*, const ADDON_HANDLE, const PVR_CHANNEL_GROUP*);
339 void (*PVR_transfer_channel_group_member)(void*, void*, const ADDON_HANDLE, const PVR_CHANNEL_GROUP_MEMBER*);
340#ifdef USE_DEMUX
341 void (*PVR_free_demux_packet)(void*, void*, DemuxPacket*);
342 DemuxPacket* (*PVR_allocate_demux_packet)(void*, void*, int);
343#endif
344 void (*PVR_connection_state_change)(void*, void*, const char*, PVR_CONNECTION_STATE, const char*);
345 void (*PVR_epg_event_state_change)(void*, void*, EPG_TAG*, unsigned int, EPG_EVENT_STATE);
346
347private: 269private:
348 void* m_libXBMC_pvr; 270 AddonCB* m_Handle;
349 void* m_Handle; 271 KodiAPI::V1::PVR::CB_PVRLib *m_Callbacks;
350 void* m_Callbacks;
351 struct cb_array
352 {
353 const char* libPath;
354 };
355}; 272};
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h
index 2cf558a..57bb129 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h
@@ -589,7 +589,7 @@ extern "C"
589 * @return True if the seek operation was possible 589 * @return True if the seek operation was possible
590 * @remarks Optional, and only used if addon has its own demuxer. Return False if this add-on won't provide this function. 590 * @remarks Optional, and only used if addon has its own demuxer. Return False if this add-on won't provide this function.
591 */ 591 */
592 bool SeekTime(int time, bool backwards, double *startpts); 592 bool SeekTime(double time, bool backwards, double *startpts);
593 593
594 /*! 594 /*!
595 * Notify the pvr addon/demuxer that XBMC wishes to change playback speed 595 * Notify the pvr addon/demuxer that XBMC wishes to change playback speed
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h
index 08ae183..dbc7217 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h
@@ -78,10 +78,10 @@ struct DemuxPacket;
78#define PVR_STREAM_MAX_STREAMS 20 78#define PVR_STREAM_MAX_STREAMS 20
79 79
80/* current PVR API version */ 80/* current PVR API version */
81#define XBMC_PVR_API_VERSION "5.2.0" 81#define XBMC_PVR_API_VERSION "5.2.1"
82 82
83/* min. PVR API version */ 83/* min. PVR API version */
84#define XBMC_PVR_MIN_API_VERSION "5.2.0" 84#define XBMC_PVR_MIN_API_VERSION "5.2.1"
85 85
86#ifdef __cplusplus 86#ifdef __cplusplus
87extern "C" { 87extern "C" {
@@ -594,7 +594,7 @@ extern "C" {
594 bool (__cdecl* CanPauseStream)(void); 594 bool (__cdecl* CanPauseStream)(void);
595 void (__cdecl* PauseStream)(bool); 595 void (__cdecl* PauseStream)(bool);
596 bool (__cdecl* CanSeekStream)(void); 596 bool (__cdecl* CanSeekStream)(void);
597 bool (__cdecl* SeekTime)(int, bool, double*); 597 bool (__cdecl* SeekTime)(double, bool, double*);
598 void (__cdecl* SetSpeed)(int); 598 void (__cdecl* SetSpeed)(int);
599 time_t (__cdecl* GetPlayingTime)(void); 599 time_t (__cdecl* GetPlayingTime)(void);
600 time_t (__cdecl* GetBufferTimeStart)(void); 600 time_t (__cdecl* GetBufferTimeStart)(void);
diff --git a/xbmc/input/XBMC_vkeys.h b/xbmc/input/XBMC_vkeys.h
new file mode 100644
index 0000000..4e3787c
--- /dev/null
+++ b/xbmc/input/XBMC_vkeys.h
@@ -0,0 +1,286 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2009 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with XBMC; see the file COPYING. If not, see
17 <http://www.gnu.org/licenses/>.
18
19 Sam Lantinga
20 slouken@libsdl.org
21*/
22
23#ifndef XBMC_vkeys_h
24#define XBMC_vkeys_h
25
26// The XBMC_vkey identifies a key that is mapped to an action or function.
27// The keysym.sym generated by SDL_KEYDOWN is mapped to a vkey and the vkey
28// is used to lookup an action in the global mapping table.
29// The vkey values are the ASCII code of the character where this is possible.
30// Non-printing keypresses get a value in the range 0x80 - 0xFF.
31// Note that the vkey is a byte value so it cannot be greater than 0xFF.
32
33typedef enum {
34 XBMCVK_BACK = 0x08,
35 XBMCVK_TAB = 0x09,
36 XBMCVK_RETURN = 0x0D,
37 XBMCVK_ESCAPE = 0x1B,
38
39 XBMCVK_SPACE = 0x20,
40 XBMCVK_EXCLAIM = 0x21,
41 XBMCVK_QUOTEDBL = 0x22,
42 XBMCVK_HASH = 0x23,
43 XBMCVK_DOLLAR = 0x24,
44 XBMCVK_PERCENT = 0x25,
45 XBMCVK_AMPERSAND = 0x26,
46 XBMCVK_QUOTE = 0x27,
47 XBMCVK_LEFTPAREN = 0x28,
48 XBMCVK_RIGHTPAREN = 0x29,
49 XBMCVK_ASTERISK = 0x2A,
50 XBMCVK_PLUS = 0x2B,
51 XBMCVK_COMMA = 0x2C,
52 XBMCVK_MINUS = 0x2D,
53 XBMCVK_PERIOD = 0x2E,
54 XBMCVK_SLASH = 0x2F,
55
56 XBMCVK_0 = 0x30,
57 XBMCVK_1 = 0x31,
58 XBMCVK_2 = 0x32,
59 XBMCVK_3 = 0x33,
60 XBMCVK_4 = 0x34,
61 XBMCVK_5 = 0x35,
62 XBMCVK_6 = 0x36,
63 XBMCVK_7 = 0x37,
64 XBMCVK_8 = 0x38,
65 XBMCVK_9 = 0x39,
66
67 XBMCVK_COLON = 0x3A,
68 XBMCVK_SEMICOLON = 0x3B,
69 XBMCVK_LESS = 0x3C,
70 XBMCVK_EQUALS = 0x3D,
71 XBMCVK_GREATER = 0x3E,
72 XBMCVK_QUESTION = 0x3F,
73 XBMCVK_AT = 0x40,
74
75 XBMCVK_A = 0x41,
76 XBMCVK_B = 0x42,
77 XBMCVK_C = 0x43,
78 XBMCVK_D = 0x44,
79 XBMCVK_E = 0x45,
80 XBMCVK_F = 0x46,
81 XBMCVK_G = 0x47,
82 XBMCVK_H = 0x48,
83 XBMCVK_I = 0x49,
84 XBMCVK_J = 0x4A,
85 XBMCVK_K = 0x4B,
86 XBMCVK_L = 0x4C,
87 XBMCVK_M = 0x4D,
88 XBMCVK_N = 0x4E,
89 XBMCVK_O = 0x4F,
90 XBMCVK_P = 0x50,
91 XBMCVK_Q = 0x51,
92 XBMCVK_R = 0x52,
93 XBMCVK_S = 0x53,
94 XBMCVK_T = 0x54,
95 XBMCVK_U = 0x55,
96 XBMCVK_V = 0x56,
97 XBMCVK_W = 0x57,
98 XBMCVK_X = 0x58,
99 XBMCVK_Y = 0x59,
100 XBMCVK_Z = 0x5A,
101
102 XBMCVK_LEFTBRACKET = 0x5B,
103 XBMCVK_BACKSLASH = 0x5C,
104 XBMCVK_RIGHTBRACKET = 0x5D,
105 XBMCVK_CARET = 0x5E,
106 XBMCVK_UNDERSCORE = 0x5F,
107 XBMCVK_BACKQUOTE = 0x60,
108
109// Lowercase letters 0x61 - 0x7a have the same vkey as uppercase, so
110// use this block for the numpad keys
111 XBMCVK_NUMPADDIVIDE = 0x61,
112 XBMCVK_NUMPADTIMES = 0x62,
113 XBMCVK_NUMPADMINUS = 0x63,
114 XBMCVK_NUMPADPLUS = 0x64,
115 XBMCVK_NUMPADENTER = 0x65,
116 XBMCVK_NUMPADPERIOD = 0x66,
117 XBMCVK_NUMPAD0 = 0x70,
118 XBMCVK_NUMPAD1 = 0x71,
119 XBMCVK_NUMPAD2 = 0x72,
120 XBMCVK_NUMPAD3 = 0x73,
121 XBMCVK_NUMPAD4 = 0x74,
122 XBMCVK_NUMPAD5 = 0x75,
123 XBMCVK_NUMPAD6 = 0x76,
124 XBMCVK_NUMPAD7 = 0x77,
125 XBMCVK_NUMPAD8 = 0x78,
126 XBMCVK_NUMPAD9 = 0x79,
127
128 XBMCVK_LEFTBRACE = 0x7B,
129 XBMCVK_PIPE = 0x7C,
130 XBMCVK_RIGHTBRACE = 0x7D,
131 XBMCVK_TILDE = 0x7E,
132
133// Non-printing characters
134
135 XBMCVK_UP = 0x80,
136 XBMCVK_DOWN = 0x81,
137 XBMCVK_LEFT = 0x82,
138 XBMCVK_RIGHT = 0x83,
139 XBMCVK_PAGEUP = 0x84,
140 XBMCVK_PAGEDOWN = 0x85,
141 XBMCVK_INSERT = 0x86,
142 XBMCVK_DELETE = 0x87,
143 XBMCVK_HOME = 0x88,
144 XBMCVK_END = 0x89,
145
146 XBMCVK_F1 = 0x90,
147 XBMCVK_F2 = 0x91,
148 XBMCVK_F3 = 0x92,
149 XBMCVK_F4 = 0x93,
150 XBMCVK_F5 = 0x94,
151 XBMCVK_F6 = 0x95,
152 XBMCVK_F7 = 0x96,
153 XBMCVK_F8 = 0x97,
154 XBMCVK_F9 = 0x98,
155 XBMCVK_F10 = 0x99,
156 XBMCVK_F11 = 0x9A,
157 XBMCVK_F12 = 0x9B,
158 XBMCVK_F13 = 0x9C,
159 XBMCVK_F14 = 0x9D,
160 XBMCVK_F15 = 0x9E,
161 XBMCVK_F16 = 0x9F,
162 XBMCVK_F17 = 0xA0,
163 XBMCVK_F18 = 0xA1,
164 XBMCVK_F19 = 0xA2,
165 XBMCVK_F20 = 0xA3,
166 XBMCVK_F21 = 0xA4,
167 XBMCVK_F22 = 0xA5,
168 XBMCVK_F23 = 0xA6,
169 XBMCVK_F24 = 0xA7,
170
171 XBMCVK_BROWSER_BACK = 0xB0,
172 XBMCVK_BROWSER_FORWARD = 0xB1,
173 XBMCVK_BROWSER_REFRESH = 0xB2,
174 XBMCVK_BROWSER_STOP = 0xB3,
175 XBMCVK_BROWSER_SEARCH = 0xB4,
176 XBMCVK_BROWSER_FAVORITES = 0xB5,
177 XBMCVK_BROWSER_HOME = 0xB6,
178 XBMCVK_VOLUME_MUTE = 0xB7,
179 XBMCVK_VOLUME_DOWN = 0xB8,
180 XBMCVK_VOLUME_UP = 0xB9,
181 XBMCVK_MEDIA_NEXT_TRACK = 0xBA,
182 XBMCVK_MEDIA_PREV_TRACK = 0xBB,
183 XBMCVK_MEDIA_STOP = 0xBC,
184 XBMCVK_MEDIA_PLAY_PAUSE = 0xBD,
185 XBMCVK_LAUNCH_MAIL = 0xBE,
186 XBMCVK_LAUNCH_MEDIA_SELECT = 0xBF,
187 XBMCVK_LAUNCH_APP1 = 0xC0,
188 XBMCVK_LAUNCH_APP2 = 0xC1,
189 XBMCVK_LAUNCH_FILE_BROWSER = 0xC2,
190 XBMCVK_LAUNCH_MEDIA_CENTER = 0xC3,
191 XBMCVK_MEDIA_REWIND = 0xC4,
192 XBMCVK_MEDIA_FASTFORWARD = 0xC5,
193 XBMCVK_MEDIA_RECORD = 0xC6,
194
195 XBMCVK_LCONTROL = 0xD0,
196 XBMCVK_RCONTROL = 0xD1,
197 XBMCVK_LSHIFT = 0xD2,
198 XBMCVK_RSHIFT = 0xD3,
199 XBMCVK_LMENU = 0xD4,
200 XBMCVK_RMENU = 0xD5,
201 XBMCVK_LWIN = 0xD6,
202 XBMCVK_RWIN = 0xD7,
203 XBMCVK_MENU = 0xD8,
204 XBMCVK_CAPSLOCK = 0xD9,
205 XBMCVK_NUMLOCK = 0xDA,
206
207 XBMCVK_PRINTSCREEN = 0xDB,
208 XBMCVK_SCROLLLOCK = 0xDC,
209 XBMCVK_PAUSE = 0XDD,
210 XBMCVK_POWER = 0XDE,
211 XBMCVK_SLEEP = 0XDF,
212 XBMCVK_GUIDE = 0xE0,
213 XBMCVK_SETTINGS = 0xE1,
214 XBMCVK_INFO = 0xE2,
215 XBMCVK_RED = 0xE3,
216 XBMCVK_GREEN = 0xE4,
217 XBMCVK_YELLOW = 0xE5,
218 XBMCVK_BLUE = 0xE6,
219 XBMCVK_ZOOM = 0xE7,
220 XBMCVK_TEXT = 0xE8,
221 XBMCVK_FAVORITES = 0xE9,
222 XBMCVK_HOMEPAGE = 0xEA,
223 XBMCVK_CONFIG = 0xEB,
224 XBMCVK_EPG = 0xEC,
225
226 XBMCVK_LAST = 0xFF
227} XBMCVKey;
228
229// These should be in winuser.h. Not sure why they have been defined here
230#ifndef VK_0
231#define VK_0 '0'
232#define VK_1 '1'
233#define VK_2 '2'
234#define VK_3 '3'
235#define VK_4 '4'
236#define VK_5 '5'
237#define VK_6 '6'
238#define VK_7 '7'
239#define VK_8 '8'
240#define VK_9 '9'
241#define VK_A 'A'
242#define VK_B 'B'
243#define VK_C 'C'
244#define VK_D 'D'
245#define VK_E 'E'
246#define VK_F 'F'
247#define VK_G 'G'
248#define VK_H 'H'
249#define VK_I 'I'
250#define VK_J 'J'
251#define VK_K 'K'
252#define VK_L 'L'
253#define VK_M 'M'
254#define VK_N 'N'
255#define VK_O 'O'
256#define VK_P 'P'
257#define VK_Q 'Q'
258#define VK_R 'R'
259#define VK_S 'S'
260#define VK_T 'T'
261#define VK_U 'U'
262#define VK_V 'V'
263#define VK_W 'W'
264#define VK_X 'X'
265#define VK_Y 'Y'
266#define VK_Z 'Z'
267#endif /* VK_0 */
268
269/* These keys haven't been defined, but were experimentally determined */
270#ifndef VK_SEMICOLON
271#define VK_SEMICOLON 0xBA
272#define VK_EQUALS 0xBB
273#define VK_COMMA 0xBC
274#define VK_MINUS 0xBD
275#define VK_PERIOD 0xBE
276#define VK_SLASH 0xBF
277#define VK_GRAVE 0xC0
278#define VK_LBRACKET 0xDB
279#define VK_BACKSLASH 0xDC
280#define VK_RBRACKET 0xDD
281#define VK_APOSTROPHE 0xDE
282#define VK_BACKTICK 0xDF
283#define VK_OEM_102 0xE2
284#endif
285
286#endif // XBMC_vkeys_h