Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
stenzek
GitHub Repository: stenzek/duckstation
Path: blob/master/dep/rcheevos/include/rc_api_editor.h
4246 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
/* --- Fetch Badge Range --- */
190
191
/**
192
* API parameters for a fetch badge range request.
193
*/
194
typedef struct rc_api_fetch_badge_range_request_t {
195
/* Unused */
196
uint32_t unused;
197
}
198
rc_api_fetch_badge_range_request_t;
199
200
/**
201
* Response data for a fetch badge range request.
202
*/
203
typedef struct rc_api_fetch_badge_range_response_t {
204
/* The numeric identifier of the first valid badge ID */
205
uint32_t first_badge_id;
206
/* The numeric identifier of the first unassigned badge ID */
207
uint32_t next_badge_id;
208
209
/* Common server-provided response information */
210
rc_api_response_t response;
211
}
212
rc_api_fetch_badge_range_response_t;
213
214
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);
215
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);
216
/* [deprecated] use rc_api_process_fetch_badge_range_server_response instead */
217
RC_EXPORT int RC_CCONV rc_api_process_fetch_badge_range_response(rc_api_fetch_badge_range_response_t* response, const char* server_response);
218
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);
219
RC_EXPORT void RC_CCONV rc_api_destroy_fetch_badge_range_response(rc_api_fetch_badge_range_response_t* response);
220
221
/* --- Add Game Hash --- */
222
223
/**
224
* API parameters for an add game hash request.
225
*/
226
typedef struct rc_api_add_game_hash_request_t {
227
/* The username of the developer */
228
const char* username;
229
/* The API token from the login request */
230
const char* api_token;
231
/* The unique identifier of the game (0 to create a new game entry) */
232
uint32_t game_id;
233
/* The unique identifier of the console for the game */
234
uint32_t console_id;
235
/* The title of the game */
236
const char* title;
237
/* The hash being added */
238
const char* hash;
239
/* A description of the hash being added (usually the normalized ROM name) */
240
const char* hash_description;
241
}
242
rc_api_add_game_hash_request_t;
243
244
/**
245
* Response data for an update code note request.
246
*/
247
typedef struct rc_api_add_game_hash_response_t {
248
/* The unique identifier of the game */
249
uint32_t game_id;
250
251
/* Common server-provided response information */
252
rc_api_response_t response;
253
}
254
rc_api_add_game_hash_response_t;
255
256
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);
257
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);
258
/* [deprecated] use rc_api_process_add_game_hash_server_response instead */
259
RC_EXPORT int RC_CCONV rc_api_process_add_game_hash_response(rc_api_add_game_hash_response_t* response, const char* server_response);
260
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);
261
RC_EXPORT void RC_CCONV rc_api_destroy_add_game_hash_response(rc_api_add_game_hash_response_t* response);
262
263
RC_END_C_DECLS
264
265
#endif /* RC_EDITOR_H */
266
267