Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
stenzek
GitHub Repository: stenzek/duckstation
Path: blob/master/dep/rcheevos/include/rc_api_editor.h
4804 views
1
#ifndef RC_API_EDITOR_H
2
#define RC_API_EDITOR_H
3
4
#include "rc_api_request.h"
5
6
#include <stdint.h>
7
8
RC_BEGIN_C_DECLS
9
10
/* --- Fetch Code Notes --- */
11
12
/**
13
* API parameters for a fetch code notes request.
14
*/
15
typedef struct rc_api_fetch_code_notes_request_t {
16
/* The unique identifier of the game */
17
uint32_t game_id;
18
}
19
rc_api_fetch_code_notes_request_t;
20
21
/* A code note definiton */
22
typedef struct rc_api_code_note_t {
23
/* The address the note is associated to */
24
uint32_t address;
25
/* The name of the use who last updated the note */
26
const char* author;
27
/* The contents of the note */
28
const char* note;
29
} rc_api_code_note_t;
30
31
/**
32
* Response data for a fetch code notes request.
33
*/
34
typedef struct rc_api_fetch_code_notes_response_t {
35
/* An array of code notes for the game */
36
rc_api_code_note_t* notes;
37
/* The number of items in the notes array */
38
uint32_t num_notes;
39
40
/* Common server-provided response information */
41
rc_api_response_t response;
42
}
43
rc_api_fetch_code_notes_response_t;
44
45
RC_EXPORT int RC_CCONV rc_api_init_fetch_code_notes_request(rc_api_request_t* request, const rc_api_fetch_code_notes_request_t* api_params);
46
RC_EXPORT int RC_CCONV rc_api_init_fetch_code_notes_request_hosted(rc_api_request_t* request, const rc_api_fetch_code_notes_request_t* api_params, const rc_api_host_t* host);
47
/* [deprecated] use rc_api_process_fetch_code_notes_server_response instead */
48
RC_EXPORT int RC_CCONV rc_api_process_fetch_code_notes_response(rc_api_fetch_code_notes_response_t* response, const char* server_response);
49
RC_EXPORT int RC_CCONV rc_api_process_fetch_code_notes_server_response(rc_api_fetch_code_notes_response_t* response, const rc_api_server_response_t* server_response);
50
RC_EXPORT void RC_CCONV rc_api_destroy_fetch_code_notes_response(rc_api_fetch_code_notes_response_t* response);
51
52
/* --- Update Code Note --- */
53
54
/**
55
* API parameters for an update code note request.
56
*/
57
typedef struct rc_api_update_code_note_request_t {
58
/* The username of the developer */
59
const char* username;
60
/* The API token from the login request */
61
const char* api_token;
62
/* The unique identifier of the game */
63
uint32_t game_id;
64
/* The address the note is associated to */
65
uint32_t address;
66
/* The contents of the note (NULL or empty to delete a note) */
67
const char* note;
68
}
69
rc_api_update_code_note_request_t;
70
71
/**
72
* Response data for an update code note request.
73
*/
74
typedef struct rc_api_update_code_note_response_t {
75
/* Common server-provided response information */
76
rc_api_response_t response;
77
}
78
rc_api_update_code_note_response_t;
79
80
RC_EXPORT int RC_CCONV rc_api_init_update_code_note_request(rc_api_request_t* request, const rc_api_update_code_note_request_t* api_params);
81
RC_EXPORT int RC_CCONV rc_api_init_update_code_note_request_hosted(rc_api_request_t* request, const rc_api_update_code_note_request_t* api_params, const rc_api_host_t* host);
82
/* [deprecated] use rc_api_process_update_code_note_server_response instead */
83
RC_EXPORT int RC_CCONV rc_api_process_update_code_note_response(rc_api_update_code_note_response_t* response, const char* server_response);
84
RC_EXPORT int RC_CCONV rc_api_process_update_code_note_server_response(rc_api_update_code_note_response_t* response, const rc_api_server_response_t* server_response);
85
RC_EXPORT void RC_CCONV rc_api_destroy_update_code_note_response(rc_api_update_code_note_response_t* response);
86
87
/* --- Update Achievement --- */
88
89
/**
90
* API parameters for an update achievement request.
91
*/
92
typedef struct rc_api_update_achievement_request_t {
93
/* The username of the developer */
94
const char* username;
95
/* The API token from the login request */
96
const char* api_token;
97
/* The unique identifier of the achievement (0 to create a new achievement) */
98
uint32_t achievement_id;
99
/* The unique identifier of the game */
100
uint32_t game_id;
101
/* The name of the achievement */
102
const char* title;
103
/* The description of the achievement */
104
const char* description;
105
/* The badge name for the achievement */
106
const char* badge;
107
/* The serialized trigger for the achievement */
108
const char* trigger;
109
/* The number of points the achievement is worth */
110
uint32_t points;
111
/* The category of the achievement */
112
uint32_t category;
113
/* The type of the achievement */
114
uint32_t type;
115
}
116
rc_api_update_achievement_request_t;
117
118
/**
119
* Response data for an update achievement request.
120
*/
121
typedef struct rc_api_update_achievement_response_t {
122
/* The unique identifier of the achievement */
123
uint32_t achievement_id;
124
125
/* Common server-provided response information */
126
rc_api_response_t response;
127
}
128
rc_api_update_achievement_response_t;
129
130
RC_EXPORT int RC_CCONV rc_api_init_update_achievement_request(rc_api_request_t* request, const rc_api_update_achievement_request_t* api_params);
131
RC_EXPORT int RC_CCONV rc_api_init_update_achievement_request_hosted(rc_api_request_t* request, const rc_api_update_achievement_request_t* api_params, const rc_api_host_t* host);
132
/* [deprecated] use rc_api_process_update_achievement_server_response instead */
133
RC_EXPORT int RC_CCONV rc_api_process_update_achievement_response(rc_api_update_achievement_response_t* response, const char* server_response);
134
RC_EXPORT int RC_CCONV rc_api_process_update_achievement_server_response(rc_api_update_achievement_response_t* response, const rc_api_server_response_t* server_response);
135
RC_EXPORT void RC_CCONV rc_api_destroy_update_achievement_response(rc_api_update_achievement_response_t* response);
136
137
/* --- Update Leaderboard --- */
138
139
/**
140
* API parameters for an update leaderboard request.
141
*/
142
typedef struct rc_api_update_leaderboard_request_t {
143
/* The username of the developer */
144
const char* username;
145
/* The API token from the login request */
146
const char* api_token;
147
/* The unique identifier of the leaderboard (0 to create a new leaderboard) */
148
uint32_t leaderboard_id;
149
/* The unique identifier of the game */
150
uint32_t game_id;
151
/* The name of the leaderboard */
152
const char* title;
153
/* The description of the leaderboard */
154
const char* description;
155
/* The start trigger for the leaderboard */
156
const char* start_trigger;
157
/* The submit trigger for the leaderboard */
158
const char* submit_trigger;
159
/* The cancel trigger for the leaderboard */
160
const char* cancel_trigger;
161
/* The value definition for the leaderboard */
162
const char* value_definition;
163
/* The format of leaderboard values */
164
const char* format;
165
/* Whether or not lower scores are better for the leaderboard */
166
uint32_t lower_is_better;
167
}
168
rc_api_update_leaderboard_request_t;
169
170
/**
171
* Response data for an update leaderboard request.
172
*/
173
typedef struct rc_api_update_leaderboard_response_t {
174
/* The unique identifier of the leaderboard */
175
uint32_t leaderboard_id;
176
177
/* Common server-provided response information */
178
rc_api_response_t response;
179
}
180
rc_api_update_leaderboard_response_t;
181
182
RC_EXPORT int RC_CCONV rc_api_init_update_leaderboard_request(rc_api_request_t* request, const rc_api_update_leaderboard_request_t* api_params);
183
RC_EXPORT int RC_CCONV rc_api_init_update_leaderboard_request_hosted(rc_api_request_t* request, const rc_api_update_leaderboard_request_t* api_params, const rc_api_host_t* host);
184
/* [deprecated] use rc_api_process_update_leaderboard_server_response instead */
185
RC_EXPORT int RC_CCONV rc_api_process_update_leaderboard_response(rc_api_update_leaderboard_response_t* response, const char* server_response);
186
RC_EXPORT int RC_CCONV rc_api_process_update_leaderboard_server_response(rc_api_update_leaderboard_response_t* response, const rc_api_server_response_t* server_response);
187
RC_EXPORT void RC_CCONV rc_api_destroy_update_leaderboard_response(rc_api_update_leaderboard_response_t* response);
188
189
/* --- Update Rich Presence --- */
190
191
/**
192
* API parameters for an update rich presence request.
193
*/
194
typedef struct rc_api_update_rich_presence_request_t {
195
/* The username of the developer */
196
const char* username;
197
/* The API token from the login request */
198
const char* api_token;
199
/* The unique identifier of the game */
200
uint32_t game_id;
201
/* The script for the rich_presence */
202
const char* script;
203
}
204
rc_api_update_rich_presence_request_t;
205
206
/**
207
* Response data for an update rich presence request.
208
*/
209
typedef struct rc_api_update_rich_presence_response_t {
210
/* Common server-provided response information */
211
rc_api_response_t response;
212
}
213
rc_api_update_rich_presence_response_t;
214
215
RC_EXPORT int RC_CCONV rc_api_init_update_rich_presence_request(rc_api_request_t* request, const rc_api_update_rich_presence_request_t* api_params);
216
RC_EXPORT int RC_CCONV rc_api_init_update_rich_presence_request_hosted(rc_api_request_t* request, const rc_api_update_rich_presence_request_t* api_params, const rc_api_host_t* host);
217
RC_EXPORT int RC_CCONV rc_api_process_update_rich_presence_server_response(rc_api_update_rich_presence_response_t* response, const rc_api_server_response_t* server_response);
218
RC_EXPORT void RC_CCONV rc_api_destroy_update_rich_presence_response(rc_api_update_rich_presence_response_t* response);
219
220
/* --- Fetch Badge Range --- */
221
222
/**
223
* API parameters for a fetch badge range request.
224
*/
225
typedef struct rc_api_fetch_badge_range_request_t {
226
/* Unused */
227
uint32_t unused;
228
}
229
rc_api_fetch_badge_range_request_t;
230
231
/**
232
* Response data for a fetch badge range request.
233
*/
234
typedef struct rc_api_fetch_badge_range_response_t {
235
/* The numeric identifier of the first valid badge ID */
236
uint32_t first_badge_id;
237
/* The numeric identifier of the first unassigned badge ID */
238
uint32_t next_badge_id;
239
240
/* Common server-provided response information */
241
rc_api_response_t response;
242
}
243
rc_api_fetch_badge_range_response_t;
244
245
RC_EXPORT int RC_CCONV rc_api_init_fetch_badge_range_request(rc_api_request_t* request, const rc_api_fetch_badge_range_request_t* api_params);
246
RC_EXPORT int RC_CCONV rc_api_init_fetch_badge_range_request_hosted(rc_api_request_t* request, const rc_api_fetch_badge_range_request_t* api_params, const rc_api_host_t* host);
247
/* [deprecated] use rc_api_process_fetch_badge_range_server_response instead */
248
RC_EXPORT int RC_CCONV rc_api_process_fetch_badge_range_response(rc_api_fetch_badge_range_response_t* response, const char* server_response);
249
RC_EXPORT int RC_CCONV rc_api_process_fetch_badge_range_server_response(rc_api_fetch_badge_range_response_t* response, const rc_api_server_response_t* server_response);
250
RC_EXPORT void RC_CCONV rc_api_destroy_fetch_badge_range_response(rc_api_fetch_badge_range_response_t* response);
251
252
/* --- Add Game Hash --- */
253
254
/**
255
* API parameters for an add game hash request.
256
*/
257
typedef struct rc_api_add_game_hash_request_t {
258
/* The username of the developer */
259
const char* username;
260
/* The API token from the login request */
261
const char* api_token;
262
/* The unique identifier of the game (0 to create a new game entry) */
263
uint32_t game_id;
264
/* The unique identifier of the console for the game */
265
uint32_t console_id;
266
/* The title of the game */
267
const char* title;
268
/* The hash being added */
269
const char* hash;
270
/* A description of the hash being added (usually the normalized ROM name) */
271
const char* hash_description;
272
}
273
rc_api_add_game_hash_request_t;
274
275
/**
276
* Response data for an update code note request.
277
*/
278
typedef struct rc_api_add_game_hash_response_t {
279
/* The unique identifier of the game */
280
uint32_t game_id;
281
282
/* Common server-provided response information */
283
rc_api_response_t response;
284
}
285
rc_api_add_game_hash_response_t;
286
287
RC_EXPORT int RC_CCONV rc_api_init_add_game_hash_request(rc_api_request_t* request, const rc_api_add_game_hash_request_t* api_params);
288
RC_EXPORT int RC_CCONV rc_api_init_add_game_hash_request_hosted(rc_api_request_t* request, const rc_api_add_game_hash_request_t* api_params, const rc_api_host_t* host);
289
/* [deprecated] use rc_api_process_add_game_hash_server_response instead */
290
RC_EXPORT int RC_CCONV rc_api_process_add_game_hash_response(rc_api_add_game_hash_response_t* response, const char* server_response);
291
RC_EXPORT int RC_CCONV rc_api_process_add_game_hash_server_response(rc_api_add_game_hash_response_t* response, const rc_api_server_response_t* server_response);
292
RC_EXPORT void RC_CCONV rc_api_destroy_add_game_hash_response(rc_api_add_game_hash_response_t* response);
293
294
RC_END_C_DECLS
295
296
#endif /* RC_EDITOR_H */
297
298