RetroArch
rcheevos.h
Go to the documentation of this file.
1 #ifndef RCHEEVOS_H
2 #define RCHEEVOS_H
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 typedef struct lua_State lua_State;
9 
10 /*****************************************************************************\
11 | Return values |
12 \*****************************************************************************/
13 
14 enum {
15  RC_OK = 0,
33 };
34 
35 /*****************************************************************************\
36 | Console identifiers |
37 \*****************************************************************************/
38 
39 enum {
71 };
72 
73 /*****************************************************************************\
74 | Callbacks |
75 \*****************************************************************************/
76 
82 typedef unsigned (*rc_peek_t)(unsigned address, unsigned num_bytes, void* ud);
83 
84 /*****************************************************************************\
85 | Operands |
86 \*****************************************************************************/
87 
88 /* Sizes. */
89 enum {
104 };
105 
106 /* types */
107 enum {
108  RC_OPERAND_ADDRESS, /* Compare to the value of a live address in RAM. */
109  RC_OPERAND_DELTA, /* The value last known at this address. */
110  RC_OPERAND_CONST, /* A 32-bit unsigned integer. */
111  RC_OPERAND_FP, /* A floating point value. */
112  RC_OPERAND_LUA /* A Lua function that provides the value. */
113 };
114 
115 typedef struct {
116  union {
117  /* A value read from memory. */
118  struct {
119  /* The memory address or constant value of this variable. */
120  unsigned value;
121  /* The previous memory contents if RC_OPERAND_DELTA. */
122  unsigned previous;
123 
124  /* The size of the variable. */
125  char size;
126  /* True if the value is in BCD. */
127  char is_bcd;
128  /* The type of the variable. */
129  };
130 
131  /* A floating point value. */
132  double fp_value;
133 
134  /* A reference to the Lua function that provides the value. */
136  };
137 
138  char type;
139 }
141 
142 /*****************************************************************************\
143 | Conditions |
144 \*****************************************************************************/
145 
146 /* types */
147 enum {
154 };
155 
156 /* operators */
157 enum {
164 };
165 
167 
169  /* The next condition in the chain. */
171 
172  /* The condition's operands. */
175 
176  /* Required hits to fire this condition. */
177  unsigned required_hits;
178  /* Number of hits so far. */
179  unsigned current_hits;
180 
185  char pause;
186 
187  /* The type of the condition. */
188  char type;
189  /* The comparison operator to use. */
190  char oper; /* operator is a reserved word in C++. */
191 };
192 
193 /*****************************************************************************\
194 | Condition sets |
195 \*****************************************************************************/
196 
197 typedef struct rc_condset_t rc_condset_t;
198 
199 struct rc_condset_t {
200  /* The next condition set in the chain. */
202 
203  /* The list of conditions in this condition set. */
205 
206  /* True if any condition in the set is a pause condition. */
207  char has_pause;
208 };
209 
210 /*****************************************************************************\
211 | Trigger |
212 \*****************************************************************************/
213 
214 typedef struct {
215  /* The main condition set. */
217 
218  /* The list of sub condition sets in this test. */
220 }
222 
223 int rc_trigger_size(const char* memaddr);
224 rc_trigger_t* rc_parse_trigger(void* buffer, const char* memaddr, lua_State* L, int funcs_ndx);
225 int rc_test_trigger(rc_trigger_t* trigger, rc_peek_t peek, void* ud, lua_State* L);
226 void rc_reset_trigger(rc_trigger_t* self);
227 
228 /*****************************************************************************\
229 | Expressions and values |
230 \*****************************************************************************/
231 
232 typedef struct rc_term_t rc_term_t;
233 
234 struct rc_term_t {
235  /* The next term in this chain. */
237 
238  /* The first operand. */
240  /* The second operand. */
242 
243  /* A value that is applied to the second variable to invert its bits. */
244  unsigned invert;
245 };
246 
248 
250  /* The next expression in this chain. */
252 
253  /* The list of terms in this expression. */
255 };
256 
257 typedef struct {
258  /* The list of expression to evaluate. */
260 }
261 rc_value_t;
262 
263 int rc_value_size(const char* memaddr);
264 rc_value_t* rc_parse_value(void* buffer, const char* memaddr, lua_State* L, int funcs_ndx);
265 unsigned rc_evaluate_value(rc_value_t* value, rc_peek_t peek, void* ud, lua_State* L);
266 
267 /*****************************************************************************\
268 | Leaderboards |
269 \*****************************************************************************/
270 
271 /* Return values for rc_evaluate_lboard. */
272 enum {
278 };
279 
280 typedef struct {
286 
287  char started;
288  char submitted;
289 }
291 
292 int rc_lboard_size(const char* memaddr);
293 rc_lboard_t* rc_parse_lboard(void* buffer, const char* memaddr, lua_State* L, int funcs_ndx);
294 int rc_evaluate_lboard(rc_lboard_t* lboard, unsigned* value, rc_peek_t peek, void* peek_ud, lua_State* L);
295 void rc_reset_lboard(rc_lboard_t* lboard);
296 
297 /*****************************************************************************\
298 | Value formatting |
299 \*****************************************************************************/
300 
301 /* Supported formats. */
302 enum {
309 };
310 
311 int rc_parse_format(const char* format_str);
312 void rc_format_value(char* buffer, int size, unsigned value, int format);
313 
314 #ifdef __cplusplus
315 }
316 #endif
317 
318 #endif /* RCHEEVOS_H */
Definition: rcheevos.h:53
Definition: rcheevos.h:63
Definition: rcheevos.h:100
rc_expression_t * expressions
Definition: rcheevos.h:259
Definition: rcheevos.h:110
int rc_evaluate_lboard(rc_lboard_t *lboard, unsigned *value, rc_peek_t peek, void *peek_ud, lua_State *L)
Definition: lboard.c:156
int rc_trigger_size(const char *memaddr)
Definition: trigger.c:38
rc_operand_t operand1
Definition: rcheevos.h:173
Definition: rcheevos.h:59
Definition: rcheevos.h:101
Definition: rcheevos.h:91
Definition: rcheevos.h:67
Definition: rcheevos.h:158
Definition: rcheevos.h:308
unsigned previous
Definition: rcheevos.h:122
Definition: rcheevos.h:95
unsigned current_hits
Definition: rcheevos.h:179
Definition: rcheevos.h:152
char type
Definition: rcheevos.h:138
Definition: rcheevos.h:58
Definition: rcheevos.h:50
Definition: rcheevos.h:46
Definition: rcheevos.h:93
Definition: rcheevos.h:51
Definition: rcheevos.h:273
Definition: rcheevos.h:32
Definition: rcheevos.h:29
Definition: rcheevos.h:163
rc_value_t * progress
Definition: rcheevos.h:285
GLuint address
Definition: glext.h:10300
char is_bcd
Definition: rcheevos.h:127
int rc_test_trigger(rc_trigger_t *trigger, rc_peek_t peek, void *ud, lua_State *L)
Definition: trigger.c:60
Definition: rcheevos.h:305
Definition: rcheevos.h:108
Definition: rcheevos.h:28
Definition: rcheevos.h:43
Definition: rcheevos.h:149
GLsizeiptr size
Definition: glext.h:6559
Definition: rcheevos.h:115
Definition: rcheevos.h:274
unsigned value
Definition: rcheevos.h:120
Definition: rcheevos.h:52
Definition: rcheevos.h:55
char has_pause
Definition: rcheevos.h:207
Definition: rcheevos.h:64
char type
Definition: rcheevos.h:188
Definition: rcheevos.h:276
Definition: rcheevos.h:45
Definition: rcheevos.h:62
Definition: rcheevos.h:111
char started
Definition: rcheevos.h:287
Definition: rcheevos.h:153
Definition: rcheevos.h:26
Definition: rcheevos.h:22
Definition: rcheevos.h:159
rc_operand_t operand1
Definition: rcheevos.h:239
Definition: rcheevos.h:21
char pause
Definition: rcheevos.h:185
Definition: rcheevos.h:199
Definition: rcheevos.h:61
void rc_reset_lboard(rc_lboard_t *lboard)
Definition: lboard.c:227
char size
Definition: rcheevos.h:125
Definition: rcheevos.h:307
Definition: rcheevos.h:148
Definition: rcheevos.h:90
Definition: rcheevos.h:27
rc_condition_t * next
Definition: rcheevos.h:170
Definition: rcheevos.h:25
Definition: rcheevos.h:92
unsigned required_hits
Definition: rcheevos.h:177
Definition: rcheevos.h:304
Definition: rcheevos.h:41
Definition: rcheevos.h:96
Definition: rcheevos.h:69
rc_term_t * terms
Definition: rcheevos.h:254
int rc_lboard_size(const char *memaddr)
Definition: lboard.c:134
unsigned invert
Definition: rcheevos.h:244
Definition: rcheevos.h:280
unsigned(* rc_peek_t)(unsigned address, unsigned num_bytes, void *ud)
Definition: rcheevos.h:82
int rc_value_size(const char *memaddr)
Definition: value.c:27
Definition: rcheevos.h:18
double fp_value
Definition: rcheevos.h:132
rc_trigger_t submit
Definition: rcheevos.h:282
rc_trigger_t start
Definition: rcheevos.h:281
Definition: rcheevos.h:275
Definition: rcheevos.h:94
Definition: rcheevos.h:24
Definition: rcheevos.h:98
Definition: rcheevos.h:31
Definition: rcheevos.h:17
rc_condset_t * next
Definition: rcheevos.h:201
Definition: rcheevos.h:99
Definition: rcheevos.h:102
Definition: rcheevos.h:16
rc_term_t * next
Definition: rcheevos.h:236
Definition: rcheevos.h:303
rc_trigger_t cancel
Definition: rcheevos.h:283
rc_expression_t * next
Definition: rcheevos.h:251
Definition: rcheevos.h:44
rc_operand_t operand2
Definition: rcheevos.h:241
rc_condition_t * conditions
Definition: rcheevos.h:204
Definition: rcheevos.h:60
Definition: rcheevos.h:234
unsigned rc_evaluate_value(rc_value_t *value, rc_peek_t peek, void *ud, lua_State *L)
Definition: value.c:49
char oper
Definition: rcheevos.h:190
Definition: rcheevos.h:168
int rc_parse_format(const char *format_str)
Definition: format.c:6
Definition: rcheevos.h:161
Definition: rcheevos.h:151
rc_condset_t * requirement
Definition: rcheevos.h:216
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: glext.h:6293
Definition: rcheevos.h:48
Ιστορικό Εικόνα Πληροφορίες Όλοι Οι Χρήστες Χειρίζονται Το Μενού Αριστερό Αναλογικό Αριστερό Αναλογικό Αριστερό Αναλογικό Y Αριστερό Αναλογικό Δεξί Αναλογικό X Δεξί Αναλογικό Δεξί Αναλογικό Y Δεξί Αναλογικό Σκανδάλη Όπλου Όπλο Aux A Όπλο Aux C Όπλο Select Όπλο D pad Κάτω Όπλο D pad Δεξιά Νεκρή Ζώνη Αναλογικού Σύνδεση Όλων Λήξη Χρόνου Σύνδεσης Hide Unbound Core Input Descriptors Κατάλογος Συσκευών Κατάλογος Ποντικιού Duty Cycle Keyboard Gamepad Mapping Enable Κουμπί D pad κάτω Κουμπί Κουμπί L(πίσω)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_LEFT
Definition: rcheevos.h:70
Definition: rcheevos.h:19
Definition: rcheevos.h:257
Definition: rcheevos.h:306
Definition: rcheevos.h:65
rc_trigger_t * rc_parse_trigger(void *buffer, const char *memaddr, lua_State *L, int funcs_ndx)
Definition: trigger.c:49
GLsizei const GLfloat * value
Definition: glext.h:6709
Definition: rcheevos.h:112
Definition: rcheevos.h:49
Definition: rcheevos.h:214
static unsigned peek(unsigned address, unsigned num_bytes, void *ud)
Definition: test.c:24
void rc_reset_trigger(rc_trigger_t *self)
Definition: trigger.c:87
Definition: rcheevos.h:20
Definition: rcheevos.h:160
Definition: rcheevos.h:40
rc_value_t value
Definition: rcheevos.h:284
rc_value_t * rc_parse_value(void *buffer, const char *memaddr, lua_State *L, int funcs_ndx)
Definition: value.c:38
Definition: rcheevos.h:66
Definition: rcheevos.h:162
Definition: video4linux2.c:51
char submitted
Definition: rcheevos.h:288
Definition: rcheevos.h:30
Definition: rcheevos.h:277
Definition: rcheevos.h:97
Definition: lstate.h:178
Definition: rcheevos.h:109
Definition: rcheevos.h:15
int function_ref
Definition: rcheevos.h:135
Definition: rcheevos.h:54
Definition: rcheevos.h:103
Definition: rcheevos.h:150
Definition: rcheevos.h:56
Definition: rcheevos.h:249
Definition: rcheevos.h:23
Definition: rcheevos.h:42
Definition: rcheevos.h:68
rc_condset_t * alternative
Definition: rcheevos.h:219
rc_lboard_t * rc_parse_lboard(void *buffer, const char *memaddr, lua_State *L, int funcs_ndx)
Definition: lboard.c:145
void rc_format_value(char *buffer, int size, unsigned value, int format)
Definition: format.c:67
rc_operand_t operand2
Definition: rcheevos.h:174
Definition: rcheevos.h:57
Definition: rcheevos.h:47