|
1
|
1 /*
|
|
|
2 Simple DirectMedia Layer
|
|
|
3 Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
|
4
|
|
|
5 This software is provided 'as-is', without any express or implied
|
|
|
6 warranty. In no event will the authors be held liable for any damages
|
|
|
7 arising from the use of this software.
|
|
|
8
|
|
|
9 Permission is granted to anyone to use this software for any purpose,
|
|
|
10 including commercial applications, and to alter it and redistribute it
|
|
|
11 freely, subject to the following restrictions:
|
|
|
12
|
|
|
13 1. The origin of this software must not be misrepresented; you must not
|
|
|
14 claim that you wrote the original software. If you use this software
|
|
|
15 in a product, an acknowledgment in the product documentation would be
|
|
|
16 appreciated but is not required.
|
|
|
17 2. Altered source versions must be plainly marked as such, and must not be
|
|
|
18 misrepresented as being the original software.
|
|
|
19 3. This notice may not be removed or altered from any source distribution.
|
|
|
20 */
|
|
|
21
|
|
|
22 /* WIKI CATEGORY: GUID */
|
|
|
23
|
|
|
24 /**
|
|
|
25 * # CategoryGUID
|
|
|
26 *
|
|
|
27 * A GUID is a 128-bit value that represents something that is uniquely
|
|
|
28 * identifiable by this value: "globally unique."
|
|
|
29 *
|
|
|
30 * SDL provides functions to convert a GUID to/from a string.
|
|
|
31 */
|
|
|
32
|
|
|
33 #ifndef SDL_guid_h_
|
|
|
34 #define SDL_guid_h_
|
|
|
35
|
|
|
36 #include <SDL3/SDL_stdinc.h>
|
|
|
37
|
|
|
38 #include <SDL3/SDL_begin_code.h>
|
|
|
39 /* Set up for C function definitions, even when using C++ */
|
|
|
40 #ifdef __cplusplus
|
|
|
41 extern "C" {
|
|
|
42 #endif
|
|
|
43
|
|
|
44 /**
|
|
|
45 * An SDL_GUID is a 128-bit identifier for an input device that identifies
|
|
|
46 * that device across runs of SDL programs on the same platform.
|
|
|
47 *
|
|
|
48 * If the device is detached and then re-attached to a different port, or if
|
|
|
49 * the base system is rebooted, the device should still report the same GUID.
|
|
|
50 *
|
|
|
51 * GUIDs are as precise as possible but are not guaranteed to distinguish
|
|
|
52 * physically distinct but equivalent devices. For example, two game
|
|
|
53 * controllers from the same vendor with the same product ID and revision may
|
|
|
54 * have the same GUID.
|
|
|
55 *
|
|
|
56 * GUIDs may be platform-dependent (i.e., the same device may report different
|
|
|
57 * GUIDs on different operating systems).
|
|
|
58 *
|
|
|
59 * \since This struct is available since SDL 3.2.0.
|
|
|
60 */
|
|
|
61 typedef struct SDL_GUID {
|
|
|
62 Uint8 data[16];
|
|
|
63 } SDL_GUID;
|
|
|
64
|
|
|
65 /* Function prototypes */
|
|
|
66
|
|
|
67 /**
|
|
|
68 * Get an ASCII string representation for a given SDL_GUID.
|
|
|
69 *
|
|
|
70 * \param guid the SDL_GUID you wish to convert to string.
|
|
|
71 * \param pszGUID buffer in which to write the ASCII string.
|
|
|
72 * \param cbGUID the size of pszGUID, should be at least 33 bytes.
|
|
|
73 *
|
|
|
74 * \threadsafety It is safe to call this function from any thread.
|
|
|
75 *
|
|
|
76 * \since This function is available since SDL 3.2.0.
|
|
|
77 *
|
|
|
78 * \sa SDL_StringToGUID
|
|
|
79 */
|
|
|
80 extern SDL_DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID);
|
|
|
81
|
|
|
82 /**
|
|
|
83 * Convert a GUID string into a SDL_GUID structure.
|
|
|
84 *
|
|
|
85 * Performs no error checking. If this function is given a string containing
|
|
|
86 * an invalid GUID, the function will silently succeed, but the GUID generated
|
|
|
87 * will not be useful.
|
|
|
88 *
|
|
|
89 * \param pchGUID string containing an ASCII representation of a GUID.
|
|
|
90 * \returns a SDL_GUID structure.
|
|
|
91 *
|
|
|
92 * \threadsafety It is safe to call this function from any thread.
|
|
|
93 *
|
|
|
94 * \since This function is available since SDL 3.2.0.
|
|
|
95 *
|
|
|
96 * \sa SDL_GUIDToString
|
|
|
97 */
|
|
|
98 extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_StringToGUID(const char *pchGUID);
|
|
|
99
|
|
|
100 /* Ends C function definitions when using C++ */
|
|
|
101 #ifdef __cplusplus
|
|
|
102 }
|
|
|
103 #endif
|
|
|
104 #include <SDL3/SDL_close_code.h>
|
|
|
105
|
|
|
106 #endif /* SDL_guid_h_ */
|