1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
|
/********************************************************
* *
* Copyright (C) Microsoft. All rights reserved. *
* *
********************************************************/
// Sentient Client UGC Leaderboard API
//
// Include this to get access to all UGC Leaderboard features
#pragma once
#include "SenClientUGCTypes.h"
#include "SenClientSys.h"
namespace Sentient
{
// This system does not rely on existing XBox Leaderboards, but runs completely in parallel.
/********************************************
***** Leaderboard Creation Functions *****
********************************************/
/// @brief Creates a dynamic Leaderboard based on a given definition.
///
/// @param[in] userIndex
/// The index of the initiating user on the console.
/// Note: This is NOT a XUID.
///
/// @param[in] definition
/// Leaderboard definition that describes the behavior for the to be created Leaderboard.
///
/// @param[in] metadataBlob
/// Binary metadata blob that is associated to the created Leaderboard.
/// Can be used to store information about the Leaderboard being created.
/// This information can be re-uploaded at any time.
///
/// @param[in] metadataBlobSize
/// Used to indelicate the size of the buffer pointed to by @a metadataBlob.
///
/// @param[out] out_leaderboardId
/// The Leaderboard Id that has been created by the service.
///
/// @param[in] userCallback
/// If this call returns a success code,
/// the userCallback will be called at the end of the
/// asynchronous process.
///
/// @param[in] userCallbackData
/// Data to be passed to the @a userCallback on completion.
///
/// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success.
/// Specific values include:
///
/// @details Creates a new Leaderboard based on the supplied Leaderboard Definition.
///
/// @related SenCreateLeaderboard()
HRESULT SenCreateLeaderboard(
int userIndex,
const SenLeaderboardDefinition &definition,
const void *metadataBlob,
size_t metadataBlobSize,
SenLeaderboardId *out_leaderboardId,
SenSysCompletedCallback callback,
void *callbackData );
/********************************************
***** Leaderboard Set Score Functions *****
********************************************/
/// @brief Set a specific Leaderboard entry value.
///
/// @param[in] userIndex
/// The index of the initiating user on the console.
/// Note: This is NOT a XUID.
///
/// @param[in] leaderboardId
/// Leaderboard Id to set a value on.
///
/// @param[in] value
/// Value of the Leaderboard entry.
///
/// @param[in] userCallback
/// If this call returns a success code,
/// the userCallback will be called at the end of the
/// asynchronous process.
///
/// @param[in] userCallbackData
/// Data to be passed to the @a userCallback on completion.
///
/// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success.
/// Specific values include:
///
/// @details The Leaderboard entry value will be set for the given Leaderboard.
/// The actor or owner of the value will be the XUID of user
/// logged in at the specified index.
///
/// @related SenSetUserLeaderboardValue()
__declspec(deprecated("This function is deprecated, and should not be used"))
HRESULT SenSetUserLeaderboardValue(
int userIndex,
SenLeaderboardId leaderboardId,
SenLeaderboardEntryValue value,
SenSysCompletedCallback callback,
void *callbackData );
HRESULT SenSetUserLeaderboardValue(
int userIndex,
SenLeaderboardId leaderboardId,
SenLeaderboardEntryValue value,
LONGLONG descriptor,
SenSysCompletedCallback callback,
void *callbackData );
/// @brief Set a specific Leaderboard entry value and metadata.
///
/// @param[in] userIndex
/// The index of the initiating user on the console.
/// Note: This is NOT a XUID.
///
/// @param[in] leaderboardId
/// Leaderboard Id to set a value on.
///
/// @param[in] value
/// Value of the Leaderboard entry.
///
/// @param[in] metadataBlob
/// Binary metadata blob that is associated to the created Leaderboard Entry.
/// Can be used to store information about the Leaderboard Entry being created.
/// This information can be re-uploaded at any time.
///
/// @param[in] metadataBlobSize
/// Used to indicate the size of the buffer pointed to by @a metadataBlob.
/// If the actual size of the data exceeds this, you will receive an error.
///
/// @param[in] userCallback
/// If this call returns a success code,
/// the userCallback will be called at the end of the
/// asynchronous process.
///
/// @param[in] userCallbackData
/// Data to be passed to the @a userCallback on completion.
///
/// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success.
/// Specific values include:
///
/// @details The Leaderboard entry value will be set for the given Leaderboard.
/// The actor or owner of the value will be the XUID of user
/// logged in at the specified index.
///
/// @related SenSetUserLeaderboardValue()
__declspec(deprecated("This function is deprecated, and should not be used"))
HRESULT SenSetUserLeaderboardValue(
int userIndex,
SenLeaderboardId leaderboardId,
SenLeaderboardEntryValue value,
const void *metadataBlob,
size_t metadataBlobSize,
SenSysCompletedCallback callback,
void *callbackData );
HRESULT SenSetUserLeaderboardValue(
int userIndex,
SenLeaderboardId leaderboardId,
SenLeaderboardEntryValue value,
LONGLONG descriptor,
const void *metadataBlob,
size_t metadataBlobSize,
SenSysCompletedCallback callback,
void *callbackData );
/********************************************
***** Leaderboard Retrieval Functions *****
********************************************/
/*For documentation: the output structure contains a pointer to a buffer that is allocated by Sentient (specifically the transport layer). The pointer is only valid during the callback. If title developers want to hold on to the metadata they'll need to copy the data into a buffer of their own before execution leaves the completion callback.
It's definitely an ugly pattern which is why we strongly prefer to avoid it (and use title-allocated buffers), but I don't see a way round it in this case.*/
/// @brief Retrieves a single Leaderboard Entry.
///
/// @param[in] userIndex
/// The index of the initiating user on the console.
/// Note: This is NOT a XUID.
///
/// @param[in] leaderboardId
/// Leaderboard Id where the entry being retrieved is stored.
///
/// @param[in] leaderboardFlag
/// Flag for determining how Leaderboard specific Metadata should be retrieved.
///
/// @param[in] entryFlag
/// Flag for determining how Leaderboard Entry specific Metadata should be retrieved.
///
/// @param[out] out_leaderboardEntry
/// Leaderboard Entry being retrieved.
///
/// @param[in] maxLeaderboardMetadataBlobSize
/// Used to indicate the size of the buffer pointed to by @a out_leaderboardMetadataBlob.
/// If the actual size of the data exceeds this, you will receive an error.
///
/// @param[out] out_leaderboardMetadataBlob
/// Metadata buffer associated to the Leaderboard.
///
/// @param[out] out_leaderboardMetadataBlobSize
/// Used to return the actual size of the Leaderboard Metadata being returned.
///
/// @param[in] userCallback
/// If this call returns a success code,
/// the userCallback will be called at the end of the
/// asynchronous process.
///
/// @param[in] userCallbackData
/// Data to be passed to the @a userCallback on completion.
///
/// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success.
/// Specific values include:
///
/// @details Retrieves a single Leaderboard Entry.
/// The actor or owner of the value will be the XUID of user
/// logged in at the specified index.
///
/// @related SenGetLeaderboardEntry()
HRESULT SenGetLeaderboardEntry(
int userIndex,
SenLeaderboardId leaderboardId,
SenLeaderboardMetadataFlag leaderboardFlag,
SenLeaderboardMetadataFlag entryFlag,
SenLeaderboardEntry *out_leaderboardEntry,
size_t maxLeaderboardMetadataBlobSize, // LB
void *out_leaderboardMetadataBlob, // LB
size_t *out_leaderboardMetadataBlobSize, // LB
SenSysCompletedCallback callback,
void *callbackData );
/// @brief Retrieves a single Leaderboard Entry for any given actor (XUID).
///
/// @param[in] userIndex
/// The index of the initiating user on the console.
/// Note: This is NOT a XUID.
///
/// @param[in] actorId
/// Actor Id for the Leaderboard Entry being retrieved.
///
/// @param[in] leaderboardId
/// Leaderboard Id where the entry being retrieved is stored.
///
/// @param[in] leaderboardFlag
/// Flag for determining how Leaderboard specific Metadata should be retrieved.
///
/// @param[in] entryFlag
/// Flag for determining how Leaderboard Entry specific Metadata should be retrieved.
///
/// @param[out] out_leaderboardEntry
/// Leaderboard Entry being retrieved.
///
/// @param[in] maxLeaderboardMetadataBlobSize
/// Used to indicate the size of the buffer pointed to by @a out_leaderboardMetadataBlob.
/// If the actual size of the data exceeds this, you will receive an error.
///
/// @param[out] out_leaderboardMetadataBlob
/// Metadata buffer associated to the Leaderboard.
///
/// @param[out] out_leaderboardMetadataBlobSize
/// Used to return the actual size of the Leaderboard Metadata being returned.
///
/// @param[in] userCallback
/// If this call returns a success code,
/// the userCallback will be called at the end of the
/// asynchronous process.
///
/// @param[in] userCallbackData
/// Data to be passed to the @a userCallback on completion.
///
/// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success.
/// Specific values include:
///
/// @details Retrieves a single Leaderboard Entry for a given actor.
///
/// @related SenGetLeaderboardEntry()
HRESULT SenGetLeaderboardEntry(
int userIndex,
SenLeaderboardActorId actorId,
SenLeaderboardId leaderboardId,
SenLeaderboardMetadataFlag leaderboardFlag,
SenLeaderboardMetadataFlag entryFlag,
SenLeaderboardEntry *out_leaderboardEntry,
size_t maxLeaderboardMetadataBlobSize, // LB
void *out_leaderboardMetadataBlob, // LB
size_t *out_leaderboardMetadataBlobSize, // LB
SenSysCompletedCallback callback,
void *callbackData );
/// @brief Retrieve a specific Leaderboard that is ranked by Xbox Live Friends.
///
/// @param[in] userIndex
/// The index of the initiating user on the console.
/// Note: This is NOT a XUID.
///
/// @param[in] leaderboardId
/// Leaderboard Id where the entry being retrieved is stored.
///
/// @param[in] leaderboardFlag
/// Flag for determining how Leaderboard specific Metadata should be retrieved.
///
/// @param[in] entryFlag
/// Flag for determining how Leaderboard Entry specific Metadata should be retrieved.
///
/// @param[in] maxLeaderboardEntries
/// Used to indicate the number of Leaderboard Entries to be returned by @a out_leaderboardEntries.
/// If the actual number of items exceeds this, you will receive an error.
///
/// @param[out] out_leaderboardEntries
/// Collection of Leaderboard Entries being retrieved.
///
/// @param[out] out_leaderboardEntriesSize
/// Actual size of the returned Leaderboard Entry collection.
///
/// @param[in] maxLeaderboardMetadataBlobSize
/// Used to indicate the size of the buffer pointed to by @a out_leaderboardMetadataBlob.
/// If the actual size of the data exceeds this, you will receive an error.
///
/// @param[out] out_leaderboardMetadataBlob
/// Metadata buffer associated to the Leaderboard.
///
/// @param[out] out_leaderboardMetadataBlobSize
/// Used to return the actual size of the Leaderboard Metadata being returned.
///
/// @param[in] userCallback
/// If this call returns a success code,
/// the userCallback will be called at the end of the
/// asynchronous process.
///
/// @param[in] userCallbackData
/// Data to be passed to the @a userCallback on completion.
///
/// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success.
/// Specific values include:
///
/// @details Returns a ranked Leaderboard.
HRESULT SenGetLeaderboardFriends(
int userIndex,
SenLeaderboardId leaderboardId,
SenLeaderboardMetadataFlag leaderboardFlag,
SenLeaderboardMetadataFlag entryFlag,
size_t maxLeaderboardEntries,
SenLeaderboardEntry *out_leaderboardEntries,
size_t *out_leaderboardEntriesSize,
size_t maxLeaderboardMetadataBlobSize, // LB
void *out_leaderboardMetadataBlob, // LB
size_t *out_leaderboardMetadataBlobSize, // LB
SenSysCompletedCallback callback,
void *callbackData );
/// @brief Retrieve a specific Leaderboard that is ranked by the top Leaderboard Entries.
///
/// @param[in] userIndex
/// The index of the initiating user on the console.
/// Note: This is NOT a XUID.
///
/// @param[in] leaderboardId
/// Leaderboard Id where the entry being retrieved is stored.
///
/// @param[in] maxLeaderboardEntries
/// Used to indicate the number of Leaderboard Entries to be returned by @a out_leaderboardEntries.
/// If the actual number of items exceeds this, you will receive an error.
///
/// @param[out] out_leaderboardEntries
/// Collection of Leaderboard Entries being retrieved.
///
/// @param[out] out_leaderboardEntriesSize
/// Actual size of the returned Leaderboard Entry collection.
///
/// @param[in] userCallback
/// If this call returns a success code,
/// the userCallback will be called at the end of the
/// asynchronous process.
///
/// @param[in] userCallbackData
/// Data to be passed to the @a userCallback on completion.
///
/// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success.
/// Specific values include:
///
/// @details Returns a ranked Leaderboard of all the top Leaderboard Entries.
HRESULT SenGetLeaderboardTop(
int userIndex,
SenLeaderboardId leaderboardId,
size_t maxLeaderboardEntries,
SenLeaderboardEntry *out_leaderboardEntries,
size_t *out_leaderboardEntriesSize,
SenSysCompletedCallback callback,
void *callbackData );
} // namespace Sentient
|