RetroArch
retroarch.h
Go to the documentation of this file.
1 /* RetroArch - A frontend for libretro.
2  * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
3  * Copyright (C) 2011-2016 - Daniel De Matteis
4  *
5  * RetroArch is free software: you can redistribute it and/or modify it under the terms
6  * of the GNU General Public License as published by the Free Software Found-
7  * ation, either version 3 of the License, or (at your option) any later version.
8  *
9  * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  * PURPOSE. See the GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along with RetroArch.
14  * If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef __RETROARCH_H
18 #define __RETROARCH_H
19 
20 #include <stdint.h>
21 #include <stddef.h>
22 #include <stdlib.h>
23 
24 #include <retro_common_api.h>
25 #include <boolean.h>
26 
27 #include "core_type.h"
28 #include "core.h"
29 
30 #ifdef HAVE_MENU
31 #include "menu/menu_input.h"
32 #endif
33 
35 
36 #define RETRO_ENVIRONMENT_RETROARCH_START_BLOCK 0x800000
37 
38 
39 #define RETRO_ENVIRONMENT_SET_SAVE_STATE_IN_BACKGROUND (2 | RETRO_ENVIRONMENT_RETROARCH_START_BLOCK)
40  /* bool * --
41  * Boolean value that tells the front end to save states in the
42  * background or not.
43  */
44 
45 #define RETRO_ENVIRONMENT_GET_CLEAR_ALL_THREAD_WAITS_CB (3 | RETRO_ENVIRONMENT_RETROARCH_START_BLOCK)
46  /* retro_environment_t * --
47  * Provides the callback to the frontend method which will cancel
48  * all currently waiting threads. Used when coordination is needed
49  * between the core and the frontend to gracefully stop all threads.
50  */
51 
53 {
55 
56  /* Initialize all drivers. */
58 
59  /* Deinitializes RetroArch. */
61 
63 
65 
67 
69 
72 
76 
79 
82 
87 
90 
91  /* Block config read */
95 
96  /* Username */
100 
102 
104 
108 
111 
114 
118 
122 
126 
130 
134 
136 
140 
142 
145 
147 
150 
151  /* Runloop state */
153 
154  /* Performance counters */
159 
160  /* Key event */
164 
165  /* Core options */
175 
176  /* System info */
179 
180  /* HTTP server */
183 };
184 
186 {
190 };
191 
193 {
210 };
211 
213 {
216 };
217 
219 {
220  char **argv;
221  const char *content_path;
222  const char *sram_path;
223  const char *state_path;
224  const char *config_path;
225  const char *libretro_path;
226  bool verbose;
228  bool touched;
229  int argc;
230 };
231 
232 typedef struct rarch_resolution
233 {
234  unsigned idx;
235  unsigned id;
237 
238 /* All run-time- / command line flag-related globals go here. */
239 
240 typedef struct global
241 {
242  struct
243  {
244  char savefile[8192];
245  char savestate[8192];
246  char cheatfile[8192];
247  char ups[8192];
248  char bps[8192];
249  char ips[8192];
250  char label[8192];
251  char *remapfile;
252  } name;
253 
254  /* Recording. */
255  struct
256  {
258  char path[8192];
259  char config[8192];
260  char output_dir[8192];
261  char config_dir[8192];
262  unsigned width;
263  unsigned height;
264 
265  size_t gpu_width;
266  size_t gpu_height;
267  } record;
268 
269  /* Settings and/or global state that is specific to
270  * a console-style implementation. */
271  struct
272  {
275 
276  struct
277  {
280  unsigned char soft_filter_index;
282  unsigned int flicker_filter_index;
283 
284  struct
285  {
286  bool check;
287  unsigned count;
291  } resolutions;
292  } screen;
293  } console;
294  /* Settings and/or global states specific to menus */
295 #ifdef HAVE_MENU
296  struct
297  {
298  retro_time_t prev_start_time ;
299  retro_time_t noop_press_time ;
300  retro_time_t noop_start_time ;
301  retro_time_t action_start_time ;
302  retro_time_t action_press_time ;
303  enum menu_action prev_action ;
304  } menu;
305 #endif
306 } global_t;
307 
308 bool rarch_ctl(enum rarch_ctl_state state, void *data);
309 
311  char *s, size_t len);
312 
314 
316 
318 
319 bool retroarch_validate_game_options(char *s, size_t len, bool mkdir);
320 
322 
324 
325 void retroarch_set_current_core_type(enum rarch_core_type type, bool explicitly_set);
326 
327 void retroarch_set_shader_preset(const char* preset);
328 
330 
331 char* retroarch_get_shader_preset(void);
332 
334 
336 
338 
346 void retroarch_fail(int error_code, const char *error);
347 
357 bool retroarch_main_init(int argc, char *argv[]);
358 
359 bool retroarch_main_quit(void);
360 
361 global_t *global_get_ptr(void);
362 
374 int runloop_iterate(unsigned *sleep_ms);
375 
376 void runloop_msg_queue_push(const char *msg, unsigned prio,
377  unsigned duration, bool flush);
378 
379 bool runloop_msg_queue_pull(const char **ret);
380 
381 void runloop_get_status(bool *is_paused, bool *is_idle, bool *is_slowmotion,
382  bool *is_perfcnt_enable);
383 
384 void runloop_set(enum runloop_action action);
385 
386 void runloop_unset(enum runloop_action action);
387 
388 void rarch_menu_running(void);
389 
390 void rarch_menu_running_finished(void);
391 
392 bool retroarch_is_on_main_thread(void);
393 
395 
397 
398 #ifdef HAVE_THREADS
399 void runloop_msg_queue_lock(void);
400 
401 void runloop_msg_queue_unlock(void);
402 #endif
403 
404 #ifdef HAVE_DYNAMIC
405 bool retroarch_core_set_on_cmdline(void);
406 #endif
407 
409 
410 #endif
Definition: retroarch.h:64
Definition: retroarch.h:116
bool retroarch_main_quit(void)
Definition: retroarch.c:2372
Definition: retroarch.h:109
rarch_core_type
Definition: core_type.h:19
Definition: retroarch.h:117
struct rarch_resolution rarch_resolution_t
bool flickerfilter_enable
Definition: retroarch.h:273
Definition: retroarch.h:127
rarch_capabilities
Definition: retroarch.h:185
Definition: libretro.h:2189
bool retroarch_is_switching_display_mode(void)
Definition: retroarch.c:2044
struct global::@835::@836::@837 resolutions
Definition: retroarch.h:84
bool no_content
Definition: retroarch.h:227
Definition: retroarch.h:81
Definition: retroarch.h:138
#define RETRO_BEGIN_DECLS
Definition: retro_common_api.h:41
struct global::@835::@836 screen
Definition: retroarch.h:80
Definition: retroarch.h:172
struct global::@834 record
Definition: retroarch.h:133
Definition: retroarch.h:103
Definition: retroarch.h:101
GLsizei const GLchar ** path
Definition: glext.h:7901
Definition: retroarch.h:98
Definition: retroarch.h:149
bool check
Definition: retroarch.h:286
GLenum GLsizei len
Definition: glext.h:7389
bool retroarch_is_forced_fullscreen(void)
Definition: retroarch.c:2034
Definition: retroarch.h:85
Definition: retroarch.h:78
Definition: retroarch.h:113
void retroarch_override_setting_unset(enum rarch_override_setting enum_idx, void *data)
Definition: retroarch.c:2196
Definition: retroarch.h:209
struct retro_system_info * runloop_get_libretro_system_info(void)
Definition: retroarch.c:3665
size_t gpu_height
Definition: retroarch.h:266
Definition: retroarch.h:208
Definition: retroarch.h:168
GLdouble s
Definition: glext.h:6390
Definition: retroarch.h:200
rarch_resolution_t current
Definition: retroarch.h:289
bool retroarch_validate_game_options(char *s, size_t len, bool mkdir)
Definition: retroarch.c:1201
Definition: retroarch.h:120
Definition: retroarch.h:62
void retroarch_unset_shader_preset(void)
Definition: retroarch.c:2069
Definition: retroarch.h:178
Definition: retroarch.h:83
int64_t retro_time_t
Definition: libretro.h:1610
Definition: retroarch.h:137
rarch_resolution_t initial
Definition: retroarch.h:290
void retroarch_unset_forced_fullscreen(void)
Definition: retroarch.c:2039
unsigned count
Definition: retroarch.h:287
Definition: retroarch.h:132
Definition: retroarch.h:173
Definition: retroarch.h:115
Definition: retroarch.h:157
Definition: ibxm.h:9
Definition: retroarch.h:110
Definition: retroarch.h:188
void retroarch_fail(int error_code, const char *error)
Definition: retroarch.c:2361
Definition: retroarch.h:88
global_t * global_get_ptr(void)
Definition: retroarch.c:2393
Definition: retroarch.h:139
bool use_output_dir
Definition: retroarch.h:257
char * remapfile
Definition: retroarch.h:251
GLuint GLsizei const GLchar * label
Definition: glext.h:8583
unsigned char soft_filter_index
Definition: retroarch.h:280
Definition: retroarch.h:97
const char * state_path
Definition: retroarch.h:223
void runloop_set(enum runloop_action action)
Definition: retroarch.c:3437
uint32_t * list
Definition: retroarch.h:288
Definition: retroarch.h:71
Definition: retroarch.h:144
rarch_override_setting
Definition: retroarch.h:192
unsigned gamma_correction
Definition: retroarch.h:281
Definition: retroarch.h:70
Definition: retroarch.h:66
char ** argv
Definition: retroarch.h:220
Definition: retroarch.h:74
Definition: retroarch.h:124
Definition: retroarch.h:214
GLenum type
Definition: glext.h:6233
bool pal_enable
Definition: retroarch.h:278
const char * libretro_path
Definition: retroarch.h:225
Definition: retroarch.h:57
const char * config_path
Definition: retroarch.h:224
unsigned id
Definition: retroarch.h:235
Definition: retroarch.h:123
Definition: retroarch.h:161
Definition: retroarch.h:196
const char * sram_path
Definition: retroarch.h:222
struct global::@833 name
Definition: retroarch.h:152
Definition: retroarch.h:206
Definition: retroarch.h:129
rarch_ctl_state
Definition: retroarch.h:52
bool retroarch_override_setting_is_set(enum rarch_override_setting enum_idx, void *data)
Definition: retroarch.c:2088
bool touched
Definition: retroarch.h:228
Definition: retroarch.h:174
Definition: retroarch.h:155
static const unsigned char msg[]
Definition: ccm.c:375
static l_noret error(LoadState *S, const char *why)
Definition: lundump.c:39
runloop_action
Definition: retroarch.h:212
Definition: retroarch.h:106
Definition: retroarch.h:77
int argc
Definition: retroarch.h:229
static uint64_t state[MAX_PADS]
Definition: xenon360_input.c:33
Definition: retroarch.h:135
Definition: retroarch.h:207
Definition: retroarch.h:232
Definition: retroarch.h:195
Definition: retroarch.h:86
void retroarch_set_shader_preset(const char *preset)
Definition: retroarch.c:2060
void retroarch_set_switching_display_mode(void)
Definition: retroarch.c:2049
Definition: deflate.c:120
void runloop_unset(enum runloop_action action)
Definition: retroarch.c:3449
unsigned int flicker_filter_index
Definition: retroarch.h:282
Definition: retroarch.h:105
bool rarch_ctl(enum rarch_ctl_state state, void *data)
Definition: retroarch.c:1522
Definition: retroarch.h:131
Definition: retroarch.h:163
bool softfilter_enable
Definition: retroarch.h:274
bool retroarch_is_on_main_thread(void)
Definition: retroarch.c:1447
struct global::@835 console
Definition: retroarch.h:119
int retroarch_get_capabilities(enum rarch_capabilities type, char *s, size_t len)
Definition: retroarch.c:2255
size_t gpu_width
Definition: retroarch.h:265
Definition: retroarch.h:143
#define RETRO_END_DECLS
Definition: retro_common_api.h:42
Definition: retroarch.h:162
Definition: retroarch.h:94
Definition: retroarch.h:158
Definition: retroarch.h:189
rarch_system_info_t * runloop_get_system_info(void)
Definition: retroarch.c:3660
char savestate[8192]
Definition: retroarch.h:245
bool retroarch_main_init(int argc, char *argv[])
Definition: retroarch.c:1317
Definition: retroarch.h:177
Definition: retroarch.h:141
Definition: retroarch.h:148
Definition: retroarch.h:156
void retroarch_override_setting_set(enum rarch_override_setting enum_idx, void *data)
Definition: retroarch.c:2137
menu_action
Definition: menu_input.h:31
Definition: retroarch.h:167
Definition: retroarch.h:166
Definition: retroarch.h:218
Definition: retroarch.h:93
Definition: retroarch.h:146
Definition: retroarch.h:169
int runloop_iterate(unsigned *sleep_ms)
Definition: retroarch.c:3470
char config_dir[8192]
Definition: retroarch.h:261
bool verbose
Definition: retroarch.h:226
void retroarch_unset_switching_display_mode(void)
Definition: retroarch.c:2054
char output_dir[8192]
Definition: retroarch.h:260
Definition: retroarch.h:202
bool pal60_enable
Definition: retroarch.h:279
Definition: retroarch.h:89
Definition: retroarch.h:240
Definition: retroarch.h:73
Definition: retroarch.h:54
char * retroarch_get_shader_preset(void)
Definition: retroarch.c:2075
void rarch_menu_running(void)
Definition: retroarch.c:1456
void runloop_get_status(bool *is_paused, bool *is_idle, bool *is_slowmotion, bool *is_perfcnt_enable)
Definition: retroarch.c:2433
void retroarch_set_current_core_type(enum rarch_core_type type, bool explicitly_set)
Definition: retroarch.c:2342
char ips[8192]
Definition: retroarch.h:249
const char * content_path
Definition: retroarch.h:221
Definition: retroarch.h:187
Definition: retroarch.h:215
Definition: retroarch.h:121
Definition: core.h:57
Definition: retroarch.h:205
char savefile[8192]
Definition: retroarch.h:244
Definition: retroarch.h:75
Definition: retroarch.h:128
Definition: retroarch.h:92
Definition: retroarch.h:68
Definition: retroarch.h:198
Definition: retroarch.h:107
Definition: retroarch.h:182
Definition: retroarch.h:99
void runloop_msg_queue_push(const char *msg, unsigned prio, unsigned duration, bool flush)
Definition: retroarch.c:2400
Definition: retroarch.h:181
unsigned int uint32_t
Definition: stdint.h:126
char ups[8192]
Definition: retroarch.h:247
unsigned idx
Definition: retroarch.h:234
struct global global_t
Definition: retroarch.h:170
bool runloop_msg_queue_pull(const char **ret)
Definition: retroarch.c:2442
Definition: retroarch.h:194
Definition: retroarch.h:60
char cheatfile[8192]
Definition: retroarch.h:246
Definition: retroarch.h:171
Definition: retroarch.h:199
unsigned height
Definition: retroarch.h:263
unsigned width
Definition: retroarch.h:262
Definition: retroarch.h:112
void rarch_menu_running_finished(void)
Definition: retroarch.c:1472
char bps[8192]
Definition: retroarch.h:248