RetroArch
core.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  * Copyright (C) 2012-2015 - Michael Lelli
5  *
6  * RetroArch is free software: you can redistribute it and/or modify it under the terms
7  * of the GNU General Public License as published by the Free Software Found-
8  * ation, either version 3 of the License, or (at your option) any later version.
9  *
10  * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  * PURPOSE. See the GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along with RetroArch.
15  * If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef _LIBRETRO_CORE_IMPL_H
19 #define _LIBRETRO_CORE_IMPL_H
20 
21 #include <boolean.h>
22 #include <libretro.h>
23 
24 #include <retro_common_api.h>
25 
26 #include "core_type.h"
27 #include "input/input_defines.h"
28 
30 
31 enum
32 {
33  /* Polling is performed before
34  * call to retro_run. */
36 
37  /* Polling is performed when requested. */
39 
40  /* Polling is performed on first call to
41  * retro_input_state per frame. */
43 };
44 
46 {
50 
51 typedef struct rarch_memory_map
52 {
54  unsigned num_descriptors;
56 
57 typedef struct rarch_system_info
58 {
60 
61  unsigned rotation;
64 
66  char valid_extensions[255];
67 
70 
71  struct
72  {
74  unsigned size;
75  } subsystem;
76 
77  struct
78  {
80  unsigned size;
81  } ports;
82 
85 
87 {
90 
91 typedef struct retro_ctx_cheat_info
92 {
93  unsigned index;
94  bool enabled;
95  const char *code;
97 
98 typedef struct retro_ctx_api_info
99 {
100  unsigned version;
102 
103 typedef struct retro_ctx_region_info
104 {
105  unsigned region;
107 
109 {
110  unsigned port;
111  unsigned device;
113 
114 typedef struct retro_ctx_memory_info
115 {
116  void *data;
117  size_t size;
118  unsigned id;
120 
122 {
124  const struct string_list *content;
127 
129 {
130  const void *data_const;
131  void *data;
132  size_t size;
134 
135 typedef struct retro_ctx_size_info
136 {
137  size_t size;
139 
141 {
144 
145 typedef struct retro_callbacks
146 {
153 
154 bool core_load(unsigned poll_type_behavior);
155 
156 bool core_unload(void);
157 
159 
160 bool core_set_rewind_callbacks(void);
161 
162 #ifdef HAVE_NETWORKING
163 bool core_set_netplay_callbacks(void);
164 
165 bool core_unset_netplay_callbacks(void);
166 #endif
167 
168 bool core_set_poll_type(unsigned *type);
169 
170 /* Runs the core for one frame. */
171 bool core_run(void);
172 
173 /* Runs the core for one frame, but does not trigger any input polling */
174 bool core_run_no_input_polling(void);
175 
176 bool core_init(void);
177 
178 bool core_deinit(void *data);
179 
180 bool core_unload_game(void);
181 
182 bool core_reset(void);
183 
185 
187 
189 
191 
193 
195 
197 
199 
200 bool core_reset_cheat(void);
201 
203 
204 /* Compare libretro core API version against API version
205  * used by RetroArch.
206  *
207  * TODO - when libretro v2 gets added, allow for switching
208  * between libretro version backend dynamically.
209  */
210 bool core_verify_api_version(void);
211 
213 
215 
216 /* Initialize system A/V information. */
217 bool core_get_system_av_info(struct retro_system_av_info *av_info);
218 
219 /* Get system A/V information. */
220 bool core_get_system_info(struct retro_system_info *system);
221 
223 
225 
227 
228 void core_set_input_descriptors(void);
229 
231 
233 
234 void core_uninit_symbols(void);
235 
237 
238 bool core_is_symbols_inited(void);
239 
240 bool core_is_inited(void);
241 
242 bool core_is_game_loaded(void);
243 
244 extern struct retro_callbacks retro_ctx;
245 
247 
248 #endif
#define RARCH_FIRST_META_KEY
Definition: input_defines.h:36
struct rarch_memory_map rarch_memory_map_t
rarch_core_type
Definition: core_type.h:19
bool core_unload(void)
Definition: core_impl.c:395
retro_input_state_t state_cb
Definition: core.h:150
bool core_set_cheat(retro_ctx_cheat_info_t *info)
Definition: core_impl.c:224
Definition: libretro.h:2189
Definition: core.h:42
struct retro_ctx_cheat_info retro_ctx_cheat_info_t
Definition: core.h:145
const struct retro_subsystem_info * special
Definition: core.h:125
Definition: core.h:128
bool core_set_default_callbacks(struct retro_callbacks *cbs)
Definition: core_impl.c:126
struct rarch_system_info::@23 ports
#define RETRO_BEGIN_DECLS
Definition: retro_common_api.h:41
Definition: core.h:108
bool core_run(void)
Definition: core_impl.c:423
size_t(RETRO_CALLCONV * retro_audio_sample_batch_t)(const int16_t *data, size_t frames)
Definition: libretro.h:2353
const char * code
Definition: core.h:95
bool core_set_environment(retro_ctx_environ_info_t *info)
Definition: core_impl.c:362
bool core_load_game(retro_ctx_load_content_info_t *load_info)
Definition: core_impl.c:289
bool core_set_rewind_callbacks(void)
Definition: core_impl.c:167
struct retro_location_callback location_cb
Definition: core.h:69
struct rarch_memory_descriptor rarch_memory_descriptor_t
size_t size
Definition: core.h:132
retro_video_refresh_t frame_cb
Definition: core.h:147
Definition: libretro.h:2275
size_t disconnect_mask
Definition: core.h:48
bool core_is_inited(void)
Definition: core_impl.c:521
bool core_is_symbols_inited(void)
Definition: core_impl.c:526
bool core_serialize(retro_ctx_serialize_info_t *info)
Definition: core_impl.c:337
unsigned rotation
Definition: core.h:61
Definition: core.h:140
static tesseract::TessBaseAPI * api
Definition: tess_get_text.cpp:7
rarch_memory_descriptor_t * descriptors
Definition: core.h:53
bool(RETRO_CALLCONV * retro_environment_t)(unsigned cmd, void *data)
Definition: libretro.h:2325
unsigned port
Definition: core.h:110
Definition: libretro.h:2129
void(RETRO_CALLCONV * retro_video_refresh_t)(const void *data, unsigned width, unsigned height, size_t pitch)
Definition: libretro.h:2338
void core_unset_input_descriptors(void)
Definition: core_impl.c:516
Definition: ibxm.h:9
unsigned region
Definition: core.h:105
unsigned index
Definition: core.h:93
bool core_api_version(retro_ctx_api_info_t *api)
Definition: core_impl.c:236
uint64_t core_serialization_quirks(void)
Definition: core_impl.c:352
struct retro_callbacks retro_ctx
Definition: core_impl.c:53
retro_input_poll_t poll_cb
Definition: core.h:151
struct retro_callbacks retro_callbacks_t
struct rarch_system_info::@22 subsystem
bool core_reset(void)
Definition: core_impl.c:378
void core_uninit_symbols(void)
Definition: core_impl.c:250
struct retro_subsystem_info * data
Definition: core.h:73
struct retro_ctx_region_info retro_ctx_region_info_t
bool core_set_poll_type(unsigned *type)
Definition: core_impl.c:244
bool core_uninit_libretro_callbacks(void)
Definition: core_impl.c:156
struct retro_ctx_memory_info retro_ctx_memory_info_t
void(RETRO_CALLCONV * retro_audio_sample_t)(int16_t left, int16_t right)
Definition: libretro.h:2345
GLenum type
Definition: glext.h:6233
struct retro_ctx_load_content_info retro_ctx_load_content_info_t
struct retro_ctx_serialize_info retro_ctx_serialize_info_t
bool load_no_content
Definition: core.h:63
bool core_is_game_loaded(void)
Definition: core_impl.c:531
bool core_verify_api_version(void)
Definition: core_impl.c:480
bool core_run_no_input_polling(void)
Definition: core_impl.c:460
Definition: core.h:51
bool core_init(void)
Definition: core_impl.c:386
struct retro_ctx_size_info retro_ctx_size_info_t
retro_audio_sample_t sample_cb
Definition: core.h:148
struct retro_ctx_input_state_info retro_ctx_input_state_info_t
Definition: libretro.h:1514
Definition: libretro.h:1473
Definition: core.h:91
Definition: core.h:35
Definition: libretro.h:2254
Definition: libretro.h:1306
struct retro_memory_descriptor core
Definition: core.h:47
retro_input_state_t cb
Definition: core.h:88
#define RETRO_END_DECLS
Definition: retro_common_api.h:42
unsigned performance_level
Definition: core.h:62
unsigned device
Definition: core.h:111
bool core_reset_cheat(void)
Definition: core_impl.c:230
unsigned size
Definition: core.h:74
bool core_deinit(void *data)
Definition: core_impl.c:138
Definition: core.h:121
retro_environment_t env
Definition: core.h:142
void core_set_input_state(retro_ctx_input_state_info_t *info)
Definition: core_impl.c:88
struct retro_controller_info * data
Definition: core.h:79
bool core_get_system_av_info(struct retro_system_av_info *av_info)
Definition: core_impl.c:370
bool core_unserialize(retro_ctx_serialize_info_t *info)
Definition: core_impl.c:325
size_t size
Definition: core.h:137
struct retro_game_info * info
Definition: core.h:123
void * data
Definition: core.h:116
struct rarch_system_info rarch_system_info_t
unsigned num_descriptors
Definition: core.h:54
Definition: libretro.h:1840
size_t size
Definition: core.h:117
bool enabled
Definition: core.h:94
Definition: core.h:45
bool core_load(unsigned poll_type_behavior)
Definition: core_impl.c:466
const char * input_desc_btn[MAX_USERS][RARCH_FIRST_META_KEY]
Definition: core.h:65
char valid_extensions[255]
Definition: core.h:66
bool core_unload_game(void)
Definition: core_impl.c:406
bool core_set_controller_port_device(retro_ctx_controller_info_t *pad)
Definition: core_impl.c:267
struct retro_ctx_environ_info retro_ctx_environ_info_t
bool core_get_system_info(struct retro_system_info *system)
Definition: core_impl.c:317
const struct string_list * content
Definition: core.h:124
bool core_get_region(retro_ctx_region_info_t *info)
Definition: core_impl.c:498
#define MAX_USERS
Definition: input_defines.h:27
rarch_memory_map_t mmaps
Definition: core.h:83
Definition: core.h:103
unsigned id
Definition: core.h:118
unsigned version
Definition: core.h:100
bool core_init_symbols(enum rarch_core_type *type)
Definition: core_impl.c:256
bool core_get_memory(retro_ctx_memory_info_t *info)
Definition: core_impl.c:280
Definition: core.h:86
void * data
Definition: core.h:131
void core_set_input_descriptors(void)
Definition: core_impl.c:511
Definition: core.h:57
const void * data_const
Definition: core.h:130
Definition: core.h:38
void(RETRO_CALLCONV * retro_input_poll_t)(void)
Definition: libretro.h:2357
void core_set_serialization_quirks(uint64_t quirks)
Definition: core_impl.c:357
struct retro_ctx_api_info retro_ctx_api_info_t
unsigned __int64 uint64_t
Definition: stdint.h:136
bool core_serialize_size(retro_ctx_size_info_t *info)
Definition: core_impl.c:344
struct retro_ctx_controller_info retro_ctx_controller_info_t
bool core_has_set_input_descriptor(void)
Definition: core_impl.c:506
Definition: core.h:135
struct retro_disk_control_callback disk_control_cb
Definition: core.h:68
Definition: string_list.h:47
Definition: core.h:114
retro_audio_sample_batch_t sample_batch_cb
Definition: core.h:149
int16_t(RETRO_CALLCONV * retro_input_state_t)(unsigned port, unsigned device, unsigned index, unsigned id)
Definition: libretro.h:2366
Definition: core.h:98