Commit | Line | Data |
---|---|---|
3719602c PC |
1 | /* Copyright (C) 2010-2020 The RetroArch team |
2 | * | |
3 | * --------------------------------------------------------------------------------------- | |
4 | * The following license statement only applies to this libretro API header (libretro.h). | |
5 | * --------------------------------------------------------------------------------------- | |
6 | * | |
7 | * Permission is hereby granted, free of charge, | |
8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), | |
9 | * to deal in the Software without restriction, including without limitation the rights to | |
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, | |
11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
12 | * | |
13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
14 | * | |
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |
19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
21 | */ | |
22 | ||
23 | #ifndef LIBRETRO_H__ | |
24 | #define LIBRETRO_H__ | |
25 | ||
26 | #include <stdint.h> | |
27 | #include <stddef.h> | |
28 | #include <limits.h> | |
29 | ||
30 | #ifdef __cplusplus | |
31 | extern "C" { | |
32 | #endif | |
33 | ||
34 | #ifndef __cplusplus | |
35 | #if defined(_MSC_VER) && _MSC_VER < 1800 && !defined(SN_TARGET_PS3) | |
36 | /* Hack applied for MSVC when compiling in C89 mode | |
37 | * as it isn't C99-compliant. */ | |
38 | #define bool unsigned char | |
39 | #define true 1 | |
40 | #define false 0 | |
41 | #else | |
42 | #include <stdbool.h> | |
43 | #endif | |
44 | #endif | |
45 | ||
46 | #ifndef RETRO_CALLCONV | |
47 | # if defined(__GNUC__) && defined(__i386__) && !defined(__x86_64__) | |
48 | # define RETRO_CALLCONV __attribute__((cdecl)) | |
49 | # elif defined(_MSC_VER) && defined(_M_X86) && !defined(_M_X64) | |
50 | # define RETRO_CALLCONV __cdecl | |
51 | # else | |
52 | # define RETRO_CALLCONV /* all other platforms only have one calling convention each */ | |
53 | # endif | |
54 | #endif | |
55 | ||
56 | #ifndef RETRO_API | |
57 | # if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) | |
58 | # ifdef RETRO_IMPORT_SYMBOLS | |
59 | # ifdef __GNUC__ | |
60 | # define RETRO_API RETRO_CALLCONV __attribute__((__dllimport__)) | |
61 | # else | |
62 | # define RETRO_API RETRO_CALLCONV __declspec(dllimport) | |
63 | # endif | |
64 | # else | |
65 | # ifdef __GNUC__ | |
66 | # define RETRO_API RETRO_CALLCONV __attribute__((__dllexport__)) | |
67 | # else | |
68 | # define RETRO_API RETRO_CALLCONV __declspec(dllexport) | |
69 | # endif | |
70 | # endif | |
71 | # else | |
72 | # if defined(__GNUC__) && __GNUC__ >= 4 | |
73 | # define RETRO_API RETRO_CALLCONV __attribute__((__visibility__("default"))) | |
74 | # else | |
75 | # define RETRO_API RETRO_CALLCONV | |
76 | # endif | |
77 | # endif | |
78 | #endif | |
79 | ||
80 | /* Used for checking API/ABI mismatches that can break libretro | |
81 | * implementations. | |
82 | * It is not incremented for compatible changes to the API. | |
83 | */ | |
84 | #define RETRO_API_VERSION 1 | |
85 | ||
86 | /* | |
87 | * Libretro's fundamental device abstractions. | |
88 | * | |
89 | * Libretro's input system consists of some standardized device types, | |
90 | * such as a joypad (with/without analog), mouse, keyboard, lightgun | |
91 | * and a pointer. | |
92 | * | |
93 | * The functionality of these devices are fixed, and individual cores | |
94 | * map their own concept of a controller to libretro's abstractions. | |
95 | * This makes it possible for frontends to map the abstract types to a | |
96 | * real input device, and not having to worry about binding input | |
97 | * correctly to arbitrary controller layouts. | |
98 | */ | |
99 | ||
100 | #define RETRO_DEVICE_TYPE_SHIFT 8 | |
101 | #define RETRO_DEVICE_MASK ((1 << RETRO_DEVICE_TYPE_SHIFT) - 1) | |
102 | #define RETRO_DEVICE_SUBCLASS(base, id) (((id + 1) << RETRO_DEVICE_TYPE_SHIFT) | base) | |
103 | ||
104 | /* Input disabled. */ | |
105 | #define RETRO_DEVICE_NONE 0 | |
106 | ||
107 | /* The JOYPAD is called RetroPad. It is essentially a Super Nintendo | |
108 | * controller, but with additional L2/R2/L3/R3 buttons, similar to a | |
109 | * PS1 DualShock. */ | |
110 | #define RETRO_DEVICE_JOYPAD 1 | |
111 | ||
112 | /* The mouse is a simple mouse, similar to Super Nintendo's mouse. | |
113 | * X and Y coordinates are reported relatively to last poll (poll callback). | |
114 | * It is up to the libretro implementation to keep track of where the mouse | |
115 | * pointer is supposed to be on the screen. | |
116 | * The frontend must make sure not to interfere with its own hardware | |
117 | * mouse pointer. | |
118 | */ | |
119 | #define RETRO_DEVICE_MOUSE 2 | |
120 | ||
121 | /* KEYBOARD device lets one poll for raw key pressed. | |
122 | * It is poll based, so input callback will return with the current | |
123 | * pressed state. | |
124 | * For event/text based keyboard input, see | |
125 | * RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK. | |
126 | */ | |
127 | #define RETRO_DEVICE_KEYBOARD 3 | |
128 | ||
129 | /* LIGHTGUN device is similar to Guncon-2 for PlayStation 2. | |
130 | * It reports X/Y coordinates in screen space (similar to the pointer) | |
131 | * in the range [-0x8000, 0x7fff] in both axes, with zero being center and | |
132 | * -0x8000 being out of bounds. | |
133 | * As well as reporting on/off screen state. It features a trigger, | |
134 | * start/select buttons, auxiliary action buttons and a | |
135 | * directional pad. A forced off-screen shot can be requested for | |
136 | * auto-reloading function in some games. | |
137 | */ | |
138 | #define RETRO_DEVICE_LIGHTGUN 4 | |
139 | ||
140 | /* The ANALOG device is an extension to JOYPAD (RetroPad). | |
141 | * Similar to DualShock2 it adds two analog sticks and all buttons can | |
142 | * be analog. This is treated as a separate device type as it returns | |
143 | * axis values in the full analog range of [-0x7fff, 0x7fff], | |
144 | * although some devices may return -0x8000. | |
145 | * Positive X axis is right. Positive Y axis is down. | |
146 | * Buttons are returned in the range [0, 0x7fff]. | |
147 | * Only use ANALOG type when polling for analog values. | |
148 | */ | |
149 | #define RETRO_DEVICE_ANALOG 5 | |
150 | ||
151 | /* Abstracts the concept of a pointing mechanism, e.g. touch. | |
152 | * This allows libretro to query in absolute coordinates where on the | |
153 | * screen a mouse (or something similar) is being placed. | |
154 | * For a touch centric device, coordinates reported are the coordinates | |
155 | * of the press. | |
156 | * | |
157 | * Coordinates in X and Y are reported as: | |
158 | * [-0x7fff, 0x7fff]: -0x7fff corresponds to the far left/top of the screen, | |
159 | * and 0x7fff corresponds to the far right/bottom of the screen. | |
160 | * The "screen" is here defined as area that is passed to the frontend and | |
161 | * later displayed on the monitor. | |
162 | * | |
163 | * The frontend is free to scale/resize this screen as it sees fit, however, | |
164 | * (X, Y) = (-0x7fff, -0x7fff) will correspond to the top-left pixel of the | |
165 | * game image, etc. | |
166 | * | |
167 | * To check if the pointer coordinates are valid (e.g. a touch display | |
168 | * actually being touched), PRESSED returns 1 or 0. | |
169 | * | |
170 | * If using a mouse on a desktop, PRESSED will usually correspond to the | |
171 | * left mouse button, but this is a frontend decision. | |
172 | * PRESSED will only return 1 if the pointer is inside the game screen. | |
173 | * | |
174 | * For multi-touch, the index variable can be used to successively query | |
175 | * more presses. | |
176 | * If index = 0 returns true for _PRESSED, coordinates can be extracted | |
177 | * with _X, _Y for index = 0. One can then query _PRESSED, _X, _Y with | |
178 | * index = 1, and so on. | |
179 | * Eventually _PRESSED will return false for an index. No further presses | |
180 | * are registered at this point. */ | |
181 | #define RETRO_DEVICE_POINTER 6 | |
182 | ||
183 | /* Buttons for the RetroPad (JOYPAD). | |
184 | * The placement of these is equivalent to placements on the | |
185 | * Super Nintendo controller. | |
186 | * L2/R2/L3/R3 buttons correspond to the PS1 DualShock. | |
187 | * Also used as id values for RETRO_DEVICE_INDEX_ANALOG_BUTTON */ | |
188 | #define RETRO_DEVICE_ID_JOYPAD_B 0 | |
189 | #define RETRO_DEVICE_ID_JOYPAD_Y 1 | |
190 | #define RETRO_DEVICE_ID_JOYPAD_SELECT 2 | |
191 | #define RETRO_DEVICE_ID_JOYPAD_START 3 | |
192 | #define RETRO_DEVICE_ID_JOYPAD_UP 4 | |
193 | #define RETRO_DEVICE_ID_JOYPAD_DOWN 5 | |
194 | #define RETRO_DEVICE_ID_JOYPAD_LEFT 6 | |
195 | #define RETRO_DEVICE_ID_JOYPAD_RIGHT 7 | |
196 | #define RETRO_DEVICE_ID_JOYPAD_A 8 | |
197 | #define RETRO_DEVICE_ID_JOYPAD_X 9 | |
198 | #define RETRO_DEVICE_ID_JOYPAD_L 10 | |
199 | #define RETRO_DEVICE_ID_JOYPAD_R 11 | |
200 | #define RETRO_DEVICE_ID_JOYPAD_L2 12 | |
201 | #define RETRO_DEVICE_ID_JOYPAD_R2 13 | |
202 | #define RETRO_DEVICE_ID_JOYPAD_L3 14 | |
203 | #define RETRO_DEVICE_ID_JOYPAD_R3 15 | |
204 | ||
205 | #define RETRO_DEVICE_ID_JOYPAD_MASK 256 | |
206 | ||
207 | /* Index / Id values for ANALOG device. */ | |
208 | #define RETRO_DEVICE_INDEX_ANALOG_LEFT 0 | |
209 | #define RETRO_DEVICE_INDEX_ANALOG_RIGHT 1 | |
210 | #define RETRO_DEVICE_INDEX_ANALOG_BUTTON 2 | |
211 | #define RETRO_DEVICE_ID_ANALOG_X 0 | |
212 | #define RETRO_DEVICE_ID_ANALOG_Y 1 | |
213 | ||
214 | /* Id values for MOUSE. */ | |
215 | #define RETRO_DEVICE_ID_MOUSE_X 0 | |
216 | #define RETRO_DEVICE_ID_MOUSE_Y 1 | |
217 | #define RETRO_DEVICE_ID_MOUSE_LEFT 2 | |
218 | #define RETRO_DEVICE_ID_MOUSE_RIGHT 3 | |
219 | #define RETRO_DEVICE_ID_MOUSE_WHEELUP 4 | |
220 | #define RETRO_DEVICE_ID_MOUSE_WHEELDOWN 5 | |
221 | #define RETRO_DEVICE_ID_MOUSE_MIDDLE 6 | |
222 | #define RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP 7 | |
223 | #define RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN 8 | |
224 | #define RETRO_DEVICE_ID_MOUSE_BUTTON_4 9 | |
225 | #define RETRO_DEVICE_ID_MOUSE_BUTTON_5 10 | |
226 | ||
227 | /* Id values for LIGHTGUN. */ | |
228 | #define RETRO_DEVICE_ID_LIGHTGUN_SCREEN_X 13 /*Absolute Position*/ | |
229 | #define RETRO_DEVICE_ID_LIGHTGUN_SCREEN_Y 14 /*Absolute*/ | |
230 | #define RETRO_DEVICE_ID_LIGHTGUN_IS_OFFSCREEN 15 /*Status Check*/ | |
231 | #define RETRO_DEVICE_ID_LIGHTGUN_TRIGGER 2 | |
232 | #define RETRO_DEVICE_ID_LIGHTGUN_RELOAD 16 /*Forced off-screen shot*/ | |
233 | #define RETRO_DEVICE_ID_LIGHTGUN_AUX_A 3 | |
234 | #define RETRO_DEVICE_ID_LIGHTGUN_AUX_B 4 | |
235 | #define RETRO_DEVICE_ID_LIGHTGUN_START 6 | |
236 | #define RETRO_DEVICE_ID_LIGHTGUN_SELECT 7 | |
237 | #define RETRO_DEVICE_ID_LIGHTGUN_AUX_C 8 | |
238 | #define RETRO_DEVICE_ID_LIGHTGUN_DPAD_UP 9 | |
239 | #define RETRO_DEVICE_ID_LIGHTGUN_DPAD_DOWN 10 | |
240 | #define RETRO_DEVICE_ID_LIGHTGUN_DPAD_LEFT 11 | |
241 | #define RETRO_DEVICE_ID_LIGHTGUN_DPAD_RIGHT 12 | |
242 | /* deprecated */ | |
243 | #define RETRO_DEVICE_ID_LIGHTGUN_X 0 /*Relative Position*/ | |
244 | #define RETRO_DEVICE_ID_LIGHTGUN_Y 1 /*Relative*/ | |
245 | #define RETRO_DEVICE_ID_LIGHTGUN_CURSOR 3 /*Use Aux:A*/ | |
246 | #define RETRO_DEVICE_ID_LIGHTGUN_TURBO 4 /*Use Aux:B*/ | |
247 | #define RETRO_DEVICE_ID_LIGHTGUN_PAUSE 5 /*Use Start*/ | |
248 | ||
249 | /* Id values for POINTER. */ | |
250 | #define RETRO_DEVICE_ID_POINTER_X 0 | |
251 | #define RETRO_DEVICE_ID_POINTER_Y 1 | |
252 | #define RETRO_DEVICE_ID_POINTER_PRESSED 2 | |
253 | #define RETRO_DEVICE_ID_POINTER_COUNT 3 | |
254 | ||
255 | /* Returned from retro_get_region(). */ | |
256 | #define RETRO_REGION_NTSC 0 | |
257 | #define RETRO_REGION_PAL 1 | |
258 | ||
259 | /* Id values for LANGUAGE */ | |
260 | enum retro_language | |
261 | { | |
262 | RETRO_LANGUAGE_ENGLISH = 0, | |
263 | RETRO_LANGUAGE_JAPANESE = 1, | |
264 | RETRO_LANGUAGE_FRENCH = 2, | |
265 | RETRO_LANGUAGE_SPANISH = 3, | |
266 | RETRO_LANGUAGE_GERMAN = 4, | |
267 | RETRO_LANGUAGE_ITALIAN = 5, | |
268 | RETRO_LANGUAGE_DUTCH = 6, | |
269 | RETRO_LANGUAGE_PORTUGUESE_BRAZIL = 7, | |
270 | RETRO_LANGUAGE_PORTUGUESE_PORTUGAL = 8, | |
271 | RETRO_LANGUAGE_RUSSIAN = 9, | |
272 | RETRO_LANGUAGE_KOREAN = 10, | |
273 | RETRO_LANGUAGE_CHINESE_TRADITIONAL = 11, | |
274 | RETRO_LANGUAGE_CHINESE_SIMPLIFIED = 12, | |
275 | RETRO_LANGUAGE_ESPERANTO = 13, | |
276 | RETRO_LANGUAGE_POLISH = 14, | |
277 | RETRO_LANGUAGE_VIETNAMESE = 15, | |
278 | RETRO_LANGUAGE_ARABIC = 16, | |
279 | RETRO_LANGUAGE_GREEK = 17, | |
280 | RETRO_LANGUAGE_TURKISH = 18, | |
281 | RETRO_LANGUAGE_SLOVAK = 19, | |
282 | RETRO_LANGUAGE_PERSIAN = 20, | |
283 | RETRO_LANGUAGE_HEBREW = 21, | |
284 | RETRO_LANGUAGE_ASTURIAN = 22, | |
285 | RETRO_LANGUAGE_FINNISH = 23, | |
286 | RETRO_LANGUAGE_INDONESIAN = 24, | |
287 | RETRO_LANGUAGE_SWEDISH = 25, | |
288 | RETRO_LANGUAGE_UKRAINIAN = 26, | |
289 | RETRO_LANGUAGE_CZECH = 27, | |
290 | RETRO_LANGUAGE_CATALAN_VALENCIA = 28, | |
291 | RETRO_LANGUAGE_CATALAN = 29, | |
292 | RETRO_LANGUAGE_BRITISH_ENGLISH = 30, | |
293 | RETRO_LANGUAGE_HUNGARIAN = 31, | |
294 | RETRO_LANGUAGE_LAST, | |
295 | ||
296 | /* Ensure sizeof(enum) == sizeof(int) */ | |
297 | RETRO_LANGUAGE_DUMMY = INT_MAX | |
298 | }; | |
299 | ||
300 | /* Passed to retro_get_memory_data/size(). | |
301 | * If the memory type doesn't apply to the | |
302 | * implementation NULL/0 can be returned. | |
303 | */ | |
304 | #define RETRO_MEMORY_MASK 0xff | |
305 | ||
306 | /* Regular save RAM. This RAM is usually found on a game cartridge, | |
307 | * backed up by a battery. | |
308 | * If save game data is too complex for a single memory buffer, | |
309 | * the SAVE_DIRECTORY (preferably) or SYSTEM_DIRECTORY environment | |
310 | * callback can be used. */ | |
311 | #define RETRO_MEMORY_SAVE_RAM 0 | |
312 | ||
313 | /* Some games have a built-in clock to keep track of time. | |
314 | * This memory is usually just a couple of bytes to keep track of time. | |
315 | */ | |
316 | #define RETRO_MEMORY_RTC 1 | |
317 | ||
318 | /* System ram lets a frontend peek into a game systems main RAM. */ | |
319 | #define RETRO_MEMORY_SYSTEM_RAM 2 | |
320 | ||
321 | /* Video ram lets a frontend peek into a game systems video RAM (VRAM). */ | |
322 | #define RETRO_MEMORY_VIDEO_RAM 3 | |
323 | ||
324 | /* Keysyms used for ID in input state callback when polling RETRO_KEYBOARD. */ | |
325 | enum retro_key | |
326 | { | |
327 | RETROK_UNKNOWN = 0, | |
328 | RETROK_FIRST = 0, | |
329 | RETROK_BACKSPACE = 8, | |
330 | RETROK_TAB = 9, | |
331 | RETROK_CLEAR = 12, | |
332 | RETROK_RETURN = 13, | |
333 | RETROK_PAUSE = 19, | |
334 | RETROK_ESCAPE = 27, | |
335 | RETROK_SPACE = 32, | |
336 | RETROK_EXCLAIM = 33, | |
337 | RETROK_QUOTEDBL = 34, | |
338 | RETROK_HASH = 35, | |
339 | RETROK_DOLLAR = 36, | |
340 | RETROK_AMPERSAND = 38, | |
341 | RETROK_QUOTE = 39, | |
342 | RETROK_LEFTPAREN = 40, | |
343 | RETROK_RIGHTPAREN = 41, | |
344 | RETROK_ASTERISK = 42, | |
345 | RETROK_PLUS = 43, | |
346 | RETROK_COMMA = 44, | |
347 | RETROK_MINUS = 45, | |
348 | RETROK_PERIOD = 46, | |
349 | RETROK_SLASH = 47, | |
350 | RETROK_0 = 48, | |
351 | RETROK_1 = 49, | |
352 | RETROK_2 = 50, | |
353 | RETROK_3 = 51, | |
354 | RETROK_4 = 52, | |
355 | RETROK_5 = 53, | |
356 | RETROK_6 = 54, | |
357 | RETROK_7 = 55, | |
358 | RETROK_8 = 56, | |
359 | RETROK_9 = 57, | |
360 | RETROK_COLON = 58, | |
361 | RETROK_SEMICOLON = 59, | |
362 | RETROK_LESS = 60, | |
363 | RETROK_EQUALS = 61, | |
364 | RETROK_GREATER = 62, | |
365 | RETROK_QUESTION = 63, | |
366 | RETROK_AT = 64, | |
367 | RETROK_LEFTBRACKET = 91, | |
368 | RETROK_BACKSLASH = 92, | |
369 | RETROK_RIGHTBRACKET = 93, | |
370 | RETROK_CARET = 94, | |
371 | RETROK_UNDERSCORE = 95, | |
372 | RETROK_BACKQUOTE = 96, | |
373 | RETROK_a = 97, | |
374 | RETROK_b = 98, | |
375 | RETROK_c = 99, | |
376 | RETROK_d = 100, | |
377 | RETROK_e = 101, | |
378 | RETROK_f = 102, | |
379 | RETROK_g = 103, | |
380 | RETROK_h = 104, | |
381 | RETROK_i = 105, | |
382 | RETROK_j = 106, | |
383 | RETROK_k = 107, | |
384 | RETROK_l = 108, | |
385 | RETROK_m = 109, | |
386 | RETROK_n = 110, | |
387 | RETROK_o = 111, | |
388 | RETROK_p = 112, | |
389 | RETROK_q = 113, | |
390 | RETROK_r = 114, | |
391 | RETROK_s = 115, | |
392 | RETROK_t = 116, | |
393 | RETROK_u = 117, | |
394 | RETROK_v = 118, | |
395 | RETROK_w = 119, | |
396 | RETROK_x = 120, | |
397 | RETROK_y = 121, | |
398 | RETROK_z = 122, | |
399 | RETROK_LEFTBRACE = 123, | |
400 | RETROK_BAR = 124, | |
401 | RETROK_RIGHTBRACE = 125, | |
402 | RETROK_TILDE = 126, | |
403 | RETROK_DELETE = 127, | |
404 | ||
405 | RETROK_KP0 = 256, | |
406 | RETROK_KP1 = 257, | |
407 | RETROK_KP2 = 258, | |
408 | RETROK_KP3 = 259, | |
409 | RETROK_KP4 = 260, | |
410 | RETROK_KP5 = 261, | |
411 | RETROK_KP6 = 262, | |
412 | RETROK_KP7 = 263, | |
413 | RETROK_KP8 = 264, | |
414 | RETROK_KP9 = 265, | |
415 | RETROK_KP_PERIOD = 266, | |
416 | RETROK_KP_DIVIDE = 267, | |
417 | RETROK_KP_MULTIPLY = 268, | |
418 | RETROK_KP_MINUS = 269, | |
419 | RETROK_KP_PLUS = 270, | |
420 | RETROK_KP_ENTER = 271, | |
421 | RETROK_KP_EQUALS = 272, | |
422 | ||
423 | RETROK_UP = 273, | |
424 | RETROK_DOWN = 274, | |
425 | RETROK_RIGHT = 275, | |
426 | RETROK_LEFT = 276, | |
427 | RETROK_INSERT = 277, | |
428 | RETROK_HOME = 278, | |
429 | RETROK_END = 279, | |
430 | RETROK_PAGEUP = 280, | |
431 | RETROK_PAGEDOWN = 281, | |
432 | ||
433 | RETROK_F1 = 282, | |
434 | RETROK_F2 = 283, | |
435 | RETROK_F3 = 284, | |
436 | RETROK_F4 = 285, | |
437 | RETROK_F5 = 286, | |
438 | RETROK_F6 = 287, | |
439 | RETROK_F7 = 288, | |
440 | RETROK_F8 = 289, | |
441 | RETROK_F9 = 290, | |
442 | RETROK_F10 = 291, | |
443 | RETROK_F11 = 292, | |
444 | RETROK_F12 = 293, | |
445 | RETROK_F13 = 294, | |
446 | RETROK_F14 = 295, | |
447 | RETROK_F15 = 296, | |
448 | ||
449 | RETROK_NUMLOCK = 300, | |
450 | RETROK_CAPSLOCK = 301, | |
451 | RETROK_SCROLLOCK = 302, | |
452 | RETROK_RSHIFT = 303, | |
453 | RETROK_LSHIFT = 304, | |
454 | RETROK_RCTRL = 305, | |
455 | RETROK_LCTRL = 306, | |
456 | RETROK_RALT = 307, | |
457 | RETROK_LALT = 308, | |
458 | RETROK_RMETA = 309, | |
459 | RETROK_LMETA = 310, | |
460 | RETROK_LSUPER = 311, | |
461 | RETROK_RSUPER = 312, | |
462 | RETROK_MODE = 313, | |
463 | RETROK_COMPOSE = 314, | |
464 | ||
465 | RETROK_HELP = 315, | |
466 | RETROK_PRINT = 316, | |
467 | RETROK_SYSREQ = 317, | |
468 | RETROK_BREAK = 318, | |
469 | RETROK_MENU = 319, | |
470 | RETROK_POWER = 320, | |
471 | RETROK_EURO = 321, | |
472 | RETROK_UNDO = 322, | |
473 | RETROK_OEM_102 = 323, | |
474 | ||
475 | RETROK_LAST, | |
476 | ||
477 | RETROK_DUMMY = INT_MAX /* Ensure sizeof(enum) == sizeof(int) */ | |
478 | }; | |
479 | ||
480 | enum retro_mod | |
481 | { | |
482 | RETROKMOD_NONE = 0x0000, | |
483 | ||
484 | RETROKMOD_SHIFT = 0x01, | |
485 | RETROKMOD_CTRL = 0x02, | |
486 | RETROKMOD_ALT = 0x04, | |
487 | RETROKMOD_META = 0x08, | |
488 | ||
489 | RETROKMOD_NUMLOCK = 0x10, | |
490 | RETROKMOD_CAPSLOCK = 0x20, | |
491 | RETROKMOD_SCROLLOCK = 0x40, | |
492 | ||
493 | RETROKMOD_DUMMY = INT_MAX /* Ensure sizeof(enum) == sizeof(int) */ | |
494 | }; | |
495 | ||
496 | /* If set, this call is not part of the public libretro API yet. It can | |
497 | * change or be removed at any time. */ | |
498 | #define RETRO_ENVIRONMENT_EXPERIMENTAL 0x10000 | |
499 | /* Environment callback to be used internally in frontend. */ | |
500 | #define RETRO_ENVIRONMENT_PRIVATE 0x20000 | |
501 | ||
502 | /* Environment commands. */ | |
503 | #define RETRO_ENVIRONMENT_SET_ROTATION 1 /* const unsigned * -- | |
504 | * Sets screen rotation of graphics. | |
505 | * Valid values are 0, 1, 2, 3, which rotates screen by 0, 90, 180, | |
506 | * 270 degrees counter-clockwise respectively. | |
507 | */ | |
508 | #define RETRO_ENVIRONMENT_GET_OVERSCAN 2 /* bool * -- | |
509 | * NOTE: As of 2019 this callback is considered deprecated in favor of | |
510 | * using core options to manage overscan in a more nuanced, core-specific way. | |
511 | * | |
512 | * Boolean value whether or not the implementation should use overscan, | |
513 | * or crop away overscan. | |
514 | */ | |
515 | #define RETRO_ENVIRONMENT_GET_CAN_DUPE 3 /* bool * -- | |
516 | * Boolean value whether or not frontend supports frame duping, | |
517 | * passing NULL to video frame callback. | |
518 | */ | |
519 | ||
520 | /* Environ 4, 5 are no longer supported (GET_VARIABLE / SET_VARIABLES), | |
521 | * and reserved to avoid possible ABI clash. | |
522 | */ | |
523 | ||
524 | #define RETRO_ENVIRONMENT_SET_MESSAGE 6 /* const struct retro_message * -- | |
525 | * Sets a message to be displayed in implementation-specific manner | |
526 | * for a certain amount of 'frames'. | |
527 | * Should not be used for trivial messages, which should simply be | |
528 | * logged via RETRO_ENVIRONMENT_GET_LOG_INTERFACE (or as a | |
529 | * fallback, stderr). | |
530 | */ | |
531 | #define RETRO_ENVIRONMENT_SHUTDOWN 7 /* N/A (NULL) -- | |
532 | * Requests the frontend to shutdown. | |
533 | * Should only be used if game has a specific | |
534 | * way to shutdown the game from a menu item or similar. | |
535 | */ | |
536 | #define RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL 8 | |
537 | /* const unsigned * -- | |
538 | * Gives a hint to the frontend how demanding this implementation | |
539 | * is on a system. E.g. reporting a level of 2 means | |
540 | * this implementation should run decently on all frontends | |
541 | * of level 2 and up. | |
542 | * | |
543 | * It can be used by the frontend to potentially warn | |
544 | * about too demanding implementations. | |
545 | * | |
546 | * The levels are "floating". | |
547 | * | |
548 | * This function can be called on a per-game basis, | |
549 | * as certain games an implementation can play might be | |
550 | * particularly demanding. | |
551 | * If called, it should be called in retro_load_game(). | |
552 | */ | |
553 | #define RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY 9 | |
554 | /* const char ** -- | |
555 | * Returns the "system" directory of the frontend. | |
556 | * This directory can be used to store system specific | |
557 | * content such as BIOSes, configuration data, etc. | |
558 | * The returned value can be NULL. | |
559 | * If so, no such directory is defined, | |
560 | * and it's up to the implementation to find a suitable directory. | |
561 | * | |
562 | * NOTE: Some cores used this folder also for "save" data such as | |
563 | * memory cards, etc, for lack of a better place to put it. | |
564 | * This is now discouraged, and if possible, cores should try to | |
565 | * use the new GET_SAVE_DIRECTORY. | |
566 | */ | |
567 | #define RETRO_ENVIRONMENT_SET_PIXEL_FORMAT 10 | |
568 | /* const enum retro_pixel_format * -- | |
569 | * Sets the internal pixel format used by the implementation. | |
570 | * The default pixel format is RETRO_PIXEL_FORMAT_0RGB1555. | |
571 | * This pixel format however, is deprecated (see enum retro_pixel_format). | |
572 | * If the call returns false, the frontend does not support this pixel | |
573 | * format. | |
574 | * | |
575 | * This function should be called inside retro_load_game() or | |
576 | * retro_get_system_av_info(). | |
577 | */ | |
578 | #define RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS 11 | |
579 | /* const struct retro_input_descriptor * -- | |
580 | * Sets an array of retro_input_descriptors. | |
581 | * It is up to the frontend to present this in a usable way. | |
582 | * The array is terminated by retro_input_descriptor::description | |
583 | * being set to NULL. | |
584 | * This function can be called at any time, but it is recommended | |
585 | * to call it as early as possible. | |
586 | */ | |
587 | #define RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK 12 | |
588 | /* const struct retro_keyboard_callback * -- | |
589 | * Sets a callback function used to notify core about keyboard events. | |
590 | */ | |
591 | #define RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE 13 | |
592 | /* const struct retro_disk_control_callback * -- | |
593 | * Sets an interface which frontend can use to eject and insert | |
594 | * disk images. | |
595 | * This is used for games which consist of multiple images and | |
596 | * must be manually swapped out by the user (e.g. PSX). | |
597 | */ | |
598 | #define RETRO_ENVIRONMENT_SET_HW_RENDER 14 | |
599 | /* struct retro_hw_render_callback * -- | |
600 | * Sets an interface to let a libretro core render with | |
601 | * hardware acceleration. | |
602 | * Should be called in retro_load_game(). | |
603 | * If successful, libretro cores will be able to render to a | |
604 | * frontend-provided framebuffer. | |
605 | * The size of this framebuffer will be at least as large as | |
606 | * max_width/max_height provided in get_av_info(). | |
607 | * If HW rendering is used, pass only RETRO_HW_FRAME_BUFFER_VALID or | |
608 | * NULL to retro_video_refresh_t. | |
609 | */ | |
610 | #define RETRO_ENVIRONMENT_GET_VARIABLE 15 | |
611 | /* struct retro_variable * -- | |
612 | * Interface to acquire user-defined information from environment | |
613 | * that cannot feasibly be supported in a multi-system way. | |
614 | * 'key' should be set to a key which has already been set by | |
615 | * SET_VARIABLES. | |
616 | * 'data' will be set to a value or NULL. | |
617 | */ | |
618 | #define RETRO_ENVIRONMENT_SET_VARIABLES 16 | |
619 | /* const struct retro_variable * -- | |
620 | * Allows an implementation to signal the environment | |
621 | * which variables it might want to check for later using | |
622 | * GET_VARIABLE. | |
623 | * This allows the frontend to present these variables to | |
624 | * a user dynamically. | |
625 | * This should be called the first time as early as | |
626 | * possible (ideally in retro_set_environment). | |
627 | * Afterward it may be called again for the core to communicate | |
628 | * updated options to the frontend, but the number of core | |
629 | * options must not change from the number in the initial call. | |
630 | * | |
631 | * 'data' points to an array of retro_variable structs | |
632 | * terminated by a { NULL, NULL } element. | |
633 | * retro_variable::key should be namespaced to not collide | |
634 | * with other implementations' keys. E.g. A core called | |
635 | * 'foo' should use keys named as 'foo_option'. | |
636 | * retro_variable::value should contain a human readable | |
637 | * description of the key as well as a '|' delimited list | |
638 | * of expected values. | |
639 | * | |
640 | * The number of possible options should be very limited, | |
641 | * i.e. it should be feasible to cycle through options | |
642 | * without a keyboard. | |
643 | * | |
644 | * First entry should be treated as a default. | |
645 | * | |
646 | * Example entry: | |
647 | * { "foo_option", "Speed hack coprocessor X; false|true" } | |
648 | * | |
649 | * Text before first ';' is description. This ';' must be | |
650 | * followed by a space, and followed by a list of possible | |
651 | * values split up with '|'. | |
652 | * | |
653 | * Only strings are operated on. The possible values will | |
654 | * generally be displayed and stored as-is by the frontend. | |
655 | */ | |
656 | #define RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE 17 | |
657 | /* bool * -- | |
658 | * Result is set to true if some variables are updated by | |
659 | * frontend since last call to RETRO_ENVIRONMENT_GET_VARIABLE. | |
660 | * Variables should be queried with GET_VARIABLE. | |
661 | */ | |
662 | #define RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME 18 | |
663 | /* const bool * -- | |
664 | * If true, the libretro implementation supports calls to | |
665 | * retro_load_game() with NULL as argument. | |
666 | * Used by cores which can run without particular game data. | |
667 | * This should be called within retro_set_environment() only. | |
668 | */ | |
669 | #define RETRO_ENVIRONMENT_GET_LIBRETRO_PATH 19 | |
670 | /* const char ** -- | |
671 | * Retrieves the absolute path from where this libretro | |
672 | * implementation was loaded. | |
673 | * NULL is returned if the libretro was loaded statically | |
674 | * (i.e. linked statically to frontend), or if the path cannot be | |
675 | * determined. | |
676 | * Mostly useful in cooperation with SET_SUPPORT_NO_GAME as assets can | |
677 | * be loaded without ugly hacks. | |
678 | */ | |
679 | ||
680 | /* Environment 20 was an obsolete version of SET_AUDIO_CALLBACK. | |
681 | * It was not used by any known core at the time, | |
682 | * and was removed from the API. */ | |
683 | #define RETRO_ENVIRONMENT_SET_FRAME_TIME_CALLBACK 21 | |
684 | /* const struct retro_frame_time_callback * -- | |
685 | * Lets the core know how much time has passed since last | |
686 | * invocation of retro_run(). | |
687 | * The frontend can tamper with the timing to fake fast-forward, | |
688 | * slow-motion, frame stepping, etc. | |
689 | * In this case the delta time will use the reference value | |
690 | * in frame_time_callback.. | |
691 | */ | |
692 | #define RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK 22 | |
693 | /* const struct retro_audio_callback * -- | |
694 | * Sets an interface which is used to notify a libretro core about audio | |
695 | * being available for writing. | |
696 | * The callback can be called from any thread, so a core using this must | |
697 | * have a thread safe audio implementation. | |
698 | * It is intended for games where audio and video are completely | |
699 | * asynchronous and audio can be generated on the fly. | |
700 | * This interface is not recommended for use with emulators which have | |
701 | * highly synchronous audio. | |
702 | * | |
703 | * The callback only notifies about writability; the libretro core still | |
704 | * has to call the normal audio callbacks | |
705 | * to write audio. The audio callbacks must be called from within the | |
706 | * notification callback. | |
707 | * The amount of audio data to write is up to the implementation. | |
708 | * Generally, the audio callback will be called continously in a loop. | |
709 | * | |
710 | * Due to thread safety guarantees and lack of sync between audio and | |
711 | * video, a frontend can selectively disallow this interface based on | |
712 | * internal configuration. A core using this interface must also | |
713 | * implement the "normal" audio interface. | |
714 | * | |
715 | * A libretro core using SET_AUDIO_CALLBACK should also make use of | |
716 | * SET_FRAME_TIME_CALLBACK. | |
717 | */ | |
718 | #define RETRO_ENVIRONMENT_GET_RUMBLE_INTERFACE 23 | |
719 | /* struct retro_rumble_interface * -- | |
720 | * Gets an interface which is used by a libretro core to set | |
721 | * state of rumble motors in controllers. | |
722 | * A strong and weak motor is supported, and they can be | |
723 | * controlled indepedently. | |
724 | * Should be called from either retro_init() or retro_load_game(). | |
725 | * Should not be called from retro_set_environment(). | |
726 | * Returns false if rumble functionality is unavailable. | |
727 | */ | |
728 | #define RETRO_ENVIRONMENT_GET_INPUT_DEVICE_CAPABILITIES 24 | |
729 | /* uint64_t * -- | |
730 | * Gets a bitmask telling which device type are expected to be | |
731 | * handled properly in a call to retro_input_state_t. | |
732 | * Devices which are not handled or recognized always return | |
733 | * 0 in retro_input_state_t. | |
734 | * Example bitmask: caps = (1 << RETRO_DEVICE_JOYPAD) | (1 << RETRO_DEVICE_ANALOG). | |
735 | * Should only be called in retro_run(). | |
736 | */ | |
737 | #define RETRO_ENVIRONMENT_GET_SENSOR_INTERFACE (25 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
738 | /* struct retro_sensor_interface * -- | |
739 | * Gets access to the sensor interface. | |
740 | * The purpose of this interface is to allow | |
741 | * setting state related to sensors such as polling rate, | |
742 | * enabling/disable it entirely, etc. | |
743 | * Reading sensor state is done via the normal | |
744 | * input_state_callback API. | |
745 | */ | |
746 | #define RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE (26 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
747 | /* struct retro_camera_callback * -- | |
748 | * Gets an interface to a video camera driver. | |
749 | * A libretro core can use this interface to get access to a | |
750 | * video camera. | |
751 | * New video frames are delivered in a callback in same | |
752 | * thread as retro_run(). | |
753 | * | |
754 | * GET_CAMERA_INTERFACE should be called in retro_load_game(). | |
755 | * | |
756 | * Depending on the camera implementation used, camera frames | |
757 | * will be delivered as a raw framebuffer, | |
758 | * or as an OpenGL texture directly. | |
759 | * | |
760 | * The core has to tell the frontend here which types of | |
761 | * buffers can be handled properly. | |
762 | * An OpenGL texture can only be handled when using a | |
763 | * libretro GL core (SET_HW_RENDER). | |
764 | * It is recommended to use a libretro GL core when | |
765 | * using camera interface. | |
766 | * | |
767 | * The camera is not started automatically. The retrieved start/stop | |
768 | * functions must be used to explicitly | |
769 | * start and stop the camera driver. | |
770 | */ | |
771 | #define RETRO_ENVIRONMENT_GET_LOG_INTERFACE 27 | |
772 | /* struct retro_log_callback * -- | |
773 | * Gets an interface for logging. This is useful for | |
774 | * logging in a cross-platform way | |
775 | * as certain platforms cannot use stderr for logging. | |
776 | * It also allows the frontend to | |
777 | * show logging information in a more suitable way. | |
778 | * If this interface is not used, libretro cores should | |
779 | * log to stderr as desired. | |
780 | */ | |
781 | #define RETRO_ENVIRONMENT_GET_PERF_INTERFACE 28 | |
782 | /* struct retro_perf_callback * -- | |
783 | * Gets an interface for performance counters. This is useful | |
784 | * for performance logging in a cross-platform way and for detecting | |
785 | * architecture-specific features, such as SIMD support. | |
786 | */ | |
787 | #define RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE 29 | |
788 | /* struct retro_location_callback * -- | |
789 | * Gets access to the location interface. | |
790 | * The purpose of this interface is to be able to retrieve | |
791 | * location-based information from the host device, | |
792 | * such as current latitude / longitude. | |
793 | */ | |
794 | #define RETRO_ENVIRONMENT_GET_CONTENT_DIRECTORY 30 /* Old name, kept for compatibility. */ | |
795 | #define RETRO_ENVIRONMENT_GET_CORE_ASSETS_DIRECTORY 30 | |
796 | /* const char ** -- | |
797 | * Returns the "core assets" directory of the frontend. | |
798 | * This directory can be used to store specific assets that the | |
799 | * core relies upon, such as art assets, | |
800 | * input data, etc etc. | |
801 | * The returned value can be NULL. | |
802 | * If so, no such directory is defined, | |
803 | * and it's up to the implementation to find a suitable directory. | |
804 | */ | |
805 | #define RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY 31 | |
806 | /* const char ** -- | |
807 | * Returns the "save" directory of the frontend, unless there is no | |
808 | * save directory available. The save directory should be used to | |
809 | * store SRAM, memory cards, high scores, etc, if the libretro core | |
810 | * cannot use the regular memory interface (retro_get_memory_data()). | |
811 | * | |
812 | * If the frontend cannot designate a save directory, it will return | |
813 | * NULL to indicate that the core should attempt to operate without a | |
814 | * save directory set. | |
815 | * | |
816 | * NOTE: early libretro cores used the system directory for save | |
817 | * files. Cores that need to be backwards-compatible can still check | |
818 | * GET_SYSTEM_DIRECTORY. | |
819 | */ | |
820 | #define RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO 32 | |
821 | /* const struct retro_system_av_info * -- | |
822 | * Sets a new av_info structure. This can only be called from | |
823 | * within retro_run(). | |
824 | * This should *only* be used if the core is completely altering the | |
825 | * internal resolutions, aspect ratios, timings, sampling rate, etc. | |
826 | * Calling this can require a full reinitialization of video/audio | |
827 | * drivers in the frontend, | |
828 | * | |
829 | * so it is important to call it very sparingly, and usually only with | |
830 | * the users explicit consent. | |
831 | * An eventual driver reinitialize will happen so that video and | |
832 | * audio callbacks | |
833 | * happening after this call within the same retro_run() call will | |
834 | * target the newly initialized driver. | |
835 | * | |
836 | * This callback makes it possible to support configurable resolutions | |
837 | * in games, which can be useful to | |
838 | * avoid setting the "worst case" in max_width/max_height. | |
839 | * | |
840 | * ***HIGHLY RECOMMENDED*** Do not call this callback every time | |
841 | * resolution changes in an emulator core if it's | |
842 | * expected to be a temporary change, for the reasons of possible | |
843 | * driver reinitialization. | |
844 | * This call is not a free pass for not trying to provide | |
845 | * correct values in retro_get_system_av_info(). If you need to change | |
846 | * things like aspect ratio or nominal width/height, | |
847 | * use RETRO_ENVIRONMENT_SET_GEOMETRY, which is a softer variant | |
848 | * of SET_SYSTEM_AV_INFO. | |
849 | * | |
850 | * If this returns false, the frontend does not acknowledge a | |
851 | * changed av_info struct. | |
852 | */ | |
853 | #define RETRO_ENVIRONMENT_SET_PROC_ADDRESS_CALLBACK 33 | |
854 | /* const struct retro_get_proc_address_interface * -- | |
855 | * Allows a libretro core to announce support for the | |
856 | * get_proc_address() interface. | |
857 | * This interface allows for a standard way to extend libretro where | |
858 | * use of environment calls are too indirect, | |
859 | * e.g. for cases where the frontend wants to call directly into the core. | |
860 | * | |
861 | * If a core wants to expose this interface, SET_PROC_ADDRESS_CALLBACK | |
862 | * **MUST** be called from within retro_set_environment(). | |
863 | */ | |
864 | #define RETRO_ENVIRONMENT_SET_SUBSYSTEM_INFO 34 | |
865 | /* const struct retro_subsystem_info * -- | |
866 | * This environment call introduces the concept of libretro "subsystems". | |
867 | * A subsystem is a variant of a libretro core which supports | |
868 | * different kinds of games. | |
869 | * The purpose of this is to support e.g. emulators which might | |
870 | * have special needs, e.g. Super Nintendo's Super GameBoy, Sufami Turbo. | |
871 | * It can also be used to pick among subsystems in an explicit way | |
872 | * if the libretro implementation is a multi-system emulator itself. | |
873 | * | |
874 | * Loading a game via a subsystem is done with retro_load_game_special(), | |
875 | * and this environment call allows a libretro core to expose which | |
876 | * subsystems are supported for use with retro_load_game_special(). | |
877 | * A core passes an array of retro_game_special_info which is terminated | |
878 | * with a zeroed out retro_game_special_info struct. | |
879 | * | |
880 | * If a core wants to use this functionality, SET_SUBSYSTEM_INFO | |
881 | * **MUST** be called from within retro_set_environment(). | |
882 | */ | |
883 | #define RETRO_ENVIRONMENT_SET_CONTROLLER_INFO 35 | |
884 | /* const struct retro_controller_info * -- | |
885 | * This environment call lets a libretro core tell the frontend | |
886 | * which controller subclasses are recognized in calls to | |
887 | * retro_set_controller_port_device(). | |
888 | * | |
889 | * Some emulators such as Super Nintendo support multiple lightgun | |
890 | * types which must be specifically selected from. It is therefore | |
891 | * sometimes necessary for a frontend to be able to tell the core | |
892 | * about a special kind of input device which is not specifcally | |
893 | * provided by the Libretro API. | |
894 | * | |
895 | * In order for a frontend to understand the workings of those devices, | |
896 | * they must be defined as a specialized subclass of the generic device | |
897 | * types already defined in the libretro API. | |
898 | * | |
899 | * The core must pass an array of const struct retro_controller_info which | |
900 | * is terminated with a blanked out struct. Each element of the | |
901 | * retro_controller_info struct corresponds to the ascending port index | |
902 | * that is passed to retro_set_controller_port_device() when that function | |
903 | * is called to indicate to the core that the frontend has changed the | |
904 | * active device subclass. SEE ALSO: retro_set_controller_port_device() | |
905 | * | |
906 | * The ascending input port indexes provided by the core in the struct | |
907 | * are generally presented by frontends as ascending User # or Player #, | |
908 | * such as Player 1, Player 2, Player 3, etc. Which device subclasses are | |
909 | * supported can vary per input port. | |
910 | * | |
911 | * The first inner element of each entry in the retro_controller_info array | |
912 | * is a retro_controller_description struct that specifies the names and | |
913 | * codes of all device subclasses that are available for the corresponding | |
914 | * User or Player, beginning with the generic Libretro device that the | |
915 | * subclasses are derived from. The second inner element of each entry is the | |
916 | * total number of subclasses that are listed in the retro_controller_description. | |
917 | * | |
918 | * NOTE: Even if special device types are set in the libretro core, | |
919 | * libretro should only poll input based on the base input device types. | |
920 | */ | |
921 | #define RETRO_ENVIRONMENT_SET_MEMORY_MAPS (36 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
922 | /* const struct retro_memory_map * -- | |
923 | * This environment call lets a libretro core tell the frontend | |
924 | * about the memory maps this core emulates. | |
925 | * This can be used to implement, for example, cheats in a core-agnostic way. | |
926 | * | |
927 | * Should only be used by emulators; it doesn't make much sense for | |
928 | * anything else. | |
929 | * It is recommended to expose all relevant pointers through | |
930 | * retro_get_memory_* as well. | |
931 | */ | |
932 | #define RETRO_ENVIRONMENT_SET_GEOMETRY 37 | |
933 | /* const struct retro_game_geometry * -- | |
934 | * This environment call is similar to SET_SYSTEM_AV_INFO for changing | |
935 | * video parameters, but provides a guarantee that drivers will not be | |
936 | * reinitialized. | |
937 | * This can only be called from within retro_run(). | |
938 | * | |
939 | * The purpose of this call is to allow a core to alter nominal | |
940 | * width/heights as well as aspect ratios on-the-fly, which can be | |
941 | * useful for some emulators to change in run-time. | |
942 | * | |
943 | * max_width/max_height arguments are ignored and cannot be changed | |
944 | * with this call as this could potentially require a reinitialization or a | |
945 | * non-constant time operation. | |
946 | * If max_width/max_height are to be changed, SET_SYSTEM_AV_INFO is required. | |
947 | * | |
948 | * A frontend must guarantee that this environment call completes in | |
949 | * constant time. | |
950 | */ | |
951 | #define RETRO_ENVIRONMENT_GET_USERNAME 38 | |
952 | /* const char ** | |
953 | * Returns the specified username of the frontend, if specified by the user. | |
954 | * This username can be used as a nickname for a core that has online facilities | |
955 | * or any other mode where personalization of the user is desirable. | |
956 | * The returned value can be NULL. | |
957 | * If this environ callback is used by a core that requires a valid username, | |
958 | * a default username should be specified by the core. | |
959 | */ | |
960 | #define RETRO_ENVIRONMENT_GET_LANGUAGE 39 | |
961 | /* unsigned * -- | |
962 | * Returns the specified language of the frontend, if specified by the user. | |
963 | * It can be used by the core for localization purposes. | |
964 | */ | |
965 | #define RETRO_ENVIRONMENT_GET_CURRENT_SOFTWARE_FRAMEBUFFER (40 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
966 | /* struct retro_framebuffer * -- | |
967 | * Returns a preallocated framebuffer which the core can use for rendering | |
968 | * the frame into when not using SET_HW_RENDER. | |
969 | * The framebuffer returned from this call must not be used | |
970 | * after the current call to retro_run() returns. | |
971 | * | |
972 | * The goal of this call is to allow zero-copy behavior where a core | |
973 | * can render directly into video memory, avoiding extra bandwidth cost by copying | |
974 | * memory from core to video memory. | |
975 | * | |
976 | * If this call succeeds and the core renders into it, | |
977 | * the framebuffer pointer and pitch can be passed to retro_video_refresh_t. | |
978 | * If the buffer from GET_CURRENT_SOFTWARE_FRAMEBUFFER is to be used, | |
979 | * the core must pass the exact | |
980 | * same pointer as returned by GET_CURRENT_SOFTWARE_FRAMEBUFFER; | |
981 | * i.e. passing a pointer which is offset from the | |
982 | * buffer is undefined. The width, height and pitch parameters | |
983 | * must also match exactly to the values obtained from GET_CURRENT_SOFTWARE_FRAMEBUFFER. | |
984 | * | |
985 | * It is possible for a frontend to return a different pixel format | |
986 | * than the one used in SET_PIXEL_FORMAT. This can happen if the frontend | |
987 | * needs to perform conversion. | |
988 | * | |
989 | * It is still valid for a core to render to a different buffer | |
990 | * even if GET_CURRENT_SOFTWARE_FRAMEBUFFER succeeds. | |
991 | * | |
992 | * A frontend must make sure that the pointer obtained from this function is | |
993 | * writeable (and readable). | |
994 | */ | |
995 | #define RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE (41 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
996 | /* const struct retro_hw_render_interface ** -- | |
997 | * Returns an API specific rendering interface for accessing API specific data. | |
998 | * Not all HW rendering APIs support or need this. | |
999 | * The contents of the returned pointer is specific to the rendering API | |
1000 | * being used. See the various headers like libretro_vulkan.h, etc. | |
1001 | * | |
1002 | * GET_HW_RENDER_INTERFACE cannot be called before context_reset has been called. | |
1003 | * Similarly, after context_destroyed callback returns, | |
1004 | * the contents of the HW_RENDER_INTERFACE are invalidated. | |
1005 | */ | |
1006 | #define RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS (42 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
1007 | /* const bool * -- | |
1008 | * If true, the libretro implementation supports achievements | |
1009 | * either via memory descriptors set with RETRO_ENVIRONMENT_SET_MEMORY_MAPS | |
1010 | * or via retro_get_memory_data/retro_get_memory_size. | |
1011 | * | |
1012 | * This must be called before the first call to retro_run. | |
1013 | */ | |
1014 | #define RETRO_ENVIRONMENT_SET_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE (43 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
1015 | /* const struct retro_hw_render_context_negotiation_interface * -- | |
1016 | * Sets an interface which lets the libretro core negotiate with frontend how a context is created. | |
1017 | * The semantics of this interface depends on which API is used in SET_HW_RENDER earlier. | |
1018 | * This interface will be used when the frontend is trying to create a HW rendering context, | |
1019 | * so it will be used after SET_HW_RENDER, but before the context_reset callback. | |
1020 | */ | |
1021 | #define RETRO_ENVIRONMENT_SET_SERIALIZATION_QUIRKS 44 | |
1022 | /* uint64_t * -- | |
1023 | * Sets quirk flags associated with serialization. The frontend will zero any flags it doesn't | |
1024 | * recognize or support. Should be set in either retro_init or retro_load_game, but not both. | |
1025 | */ | |
1026 | #define RETRO_ENVIRONMENT_SET_HW_SHARED_CONTEXT (44 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
1027 | /* N/A (null) * -- | |
1028 | * The frontend will try to use a 'shared' hardware context (mostly applicable | |
1029 | * to OpenGL) when a hardware context is being set up. | |
1030 | * | |
1031 | * Returns true if the frontend supports shared hardware contexts and false | |
1032 | * if the frontend does not support shared hardware contexts. | |
1033 | * | |
1034 | * This will do nothing on its own until SET_HW_RENDER env callbacks are | |
1035 | * being used. | |
1036 | */ | |
1037 | #define RETRO_ENVIRONMENT_GET_VFS_INTERFACE (45 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
1038 | /* struct retro_vfs_interface_info * -- | |
1039 | * Gets access to the VFS interface. | |
1040 | * VFS presence needs to be queried prior to load_game or any | |
1041 | * get_system/save/other_directory being called to let front end know | |
1042 | * core supports VFS before it starts handing out paths. | |
1043 | * It is recomended to do so in retro_set_environment | |
1044 | */ | |
1045 | #define RETRO_ENVIRONMENT_GET_LED_INTERFACE (46 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
1046 | /* struct retro_led_interface * -- | |
1047 | * Gets an interface which is used by a libretro core to set | |
1048 | * state of LEDs. | |
1049 | */ | |
1050 | #define RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE (47 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
1051 | /* int * -- | |
1052 | * Tells the core if the frontend wants audio or video. | |
1053 | * If disabled, the frontend will discard the audio or video, | |
1054 | * so the core may decide to skip generating a frame or generating audio. | |
1055 | * This is mainly used for increasing performance. | |
1056 | * Bit 0 (value 1): Enable Video | |
1057 | * Bit 1 (value 2): Enable Audio | |
1058 | * Bit 2 (value 4): Use Fast Savestates. | |
1059 | * Bit 3 (value 8): Hard Disable Audio | |
1060 | * Other bits are reserved for future use and will default to zero. | |
1061 | * If video is disabled: | |
1062 | * * The frontend wants the core to not generate any video, | |
1063 | * including presenting frames via hardware acceleration. | |
1064 | * * The frontend's video frame callback will do nothing. | |
1065 | * * After running the frame, the video output of the next frame should be | |
1066 | * no different than if video was enabled, and saving and loading state | |
1067 | * should have no issues. | |
1068 | * If audio is disabled: | |
1069 | * * The frontend wants the core to not generate any audio. | |
1070 | * * The frontend's audio callbacks will do nothing. | |
1071 | * * After running the frame, the audio output of the next frame should be | |
1072 | * no different than if audio was enabled, and saving and loading state | |
1073 | * should have no issues. | |
1074 | * Fast Savestates: | |
1075 | * * Guaranteed to be created by the same binary that will load them. | |
1076 | * * Will not be written to or read from the disk. | |
1077 | * * Suggest that the core assumes loading state will succeed. | |
1078 | * * Suggest that the core updates its memory buffers in-place if possible. | |
1079 | * * Suggest that the core skips clearing memory. | |
1080 | * * Suggest that the core skips resetting the system. | |
1081 | * * Suggest that the core may skip validation steps. | |
1082 | * Hard Disable Audio: | |
1083 | * * Used for a secondary core when running ahead. | |
1084 | * * Indicates that the frontend will never need audio from the core. | |
1085 | * * Suggests that the core may stop synthesizing audio, but this should not | |
1086 | * compromise emulation accuracy. | |
1087 | * * Audio output for the next frame does not matter, and the frontend will | |
1088 | * never need an accurate audio state in the future. | |
1089 | * * State will never be saved when using Hard Disable Audio. | |
1090 | */ | |
1091 | #define RETRO_ENVIRONMENT_GET_MIDI_INTERFACE (48 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
1092 | /* struct retro_midi_interface ** -- | |
1093 | * Returns a MIDI interface that can be used for raw data I/O. | |
1094 | */ | |
1095 | ||
1096 | #define RETRO_ENVIRONMENT_GET_FASTFORWARDING (49 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
1097 | /* bool * -- | |
1098 | * Boolean value that indicates whether or not the frontend is in | |
1099 | * fastforwarding mode. | |
1100 | */ | |
1101 | ||
1102 | #define RETRO_ENVIRONMENT_GET_TARGET_REFRESH_RATE (50 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
1103 | /* float * -- | |
1104 | * Float value that lets us know what target refresh rate | |
1105 | * is curently in use by the frontend. | |
1106 | * | |
1107 | * The core can use the returned value to set an ideal | |
1108 | * refresh rate/framerate. | |
1109 | */ | |
1110 | ||
1111 | #define RETRO_ENVIRONMENT_GET_INPUT_BITMASKS (51 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
1112 | /* bool * -- | |
1113 | * Boolean value that indicates whether or not the frontend supports | |
1114 | * input bitmasks being returned by retro_input_state_t. The advantage | |
1115 | * of this is that retro_input_state_t has to be only called once to | |
1116 | * grab all button states instead of multiple times. | |
1117 | * | |
1118 | * If it returns true, you can pass RETRO_DEVICE_ID_JOYPAD_MASK as 'id' | |
1119 | * to retro_input_state_t (make sure 'device' is set to RETRO_DEVICE_JOYPAD). | |
1120 | * It will return a bitmask of all the digital buttons. | |
1121 | */ | |
1122 | ||
1123 | #define RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION 52 | |
1124 | /* unsigned * -- | |
1125 | * Unsigned value is the API version number of the core options | |
1126 | * interface supported by the frontend. If callback return false, | |
1127 | * API version is assumed to be 0. | |
1128 | * | |
1129 | * In legacy code, core options are set by passing an array of | |
1130 | * retro_variable structs to RETRO_ENVIRONMENT_SET_VARIABLES. | |
1131 | * This may be still be done regardless of the core options | |
1132 | * interface version. | |
1133 | * | |
1134 | * If version is >= 1 however, core options may instead be set by | |
1135 | * passing an array of retro_core_option_definition structs to | |
1136 | * RETRO_ENVIRONMENT_SET_CORE_OPTIONS, or a 2D array of | |
1137 | * retro_core_option_definition structs to RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL. | |
1138 | * This allows the core to additionally set option sublabel information | |
1139 | * and/or provide localisation support. | |
1140 | * | |
1141 | * If version is >= 2, core options may instead be set by passing | |
1142 | * a retro_core_options_v2 struct to RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2, | |
1143 | * or an array of retro_core_options_v2 structs to | |
1144 | * RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL. This allows the core | |
1145 | * to additionally set optional core option category information | |
1146 | * for frontends with core option category support. | |
1147 | */ | |
1148 | ||
1149 | #define RETRO_ENVIRONMENT_SET_CORE_OPTIONS 53 | |
1150 | /* const struct retro_core_option_definition ** -- | |
1151 | * Allows an implementation to signal the environment | |
1152 | * which variables it might want to check for later using | |
1153 | * GET_VARIABLE. | |
1154 | * This allows the frontend to present these variables to | |
1155 | * a user dynamically. | |
1156 | * This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION | |
1157 | * returns an API version of >= 1. | |
1158 | * This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES. | |
1159 | * This should be called the first time as early as | |
1160 | * possible (ideally in retro_set_environment). | |
1161 | * Afterwards it may be called again for the core to communicate | |
1162 | * updated options to the frontend, but the number of core | |
1163 | * options must not change from the number in the initial call. | |
1164 | * | |
1165 | * 'data' points to an array of retro_core_option_definition structs | |
1166 | * terminated by a { NULL, NULL, NULL, {{0}}, NULL } element. | |
1167 | * retro_core_option_definition::key should be namespaced to not collide | |
1168 | * with other implementations' keys. e.g. A core called | |
1169 | * 'foo' should use keys named as 'foo_option'. | |
1170 | * retro_core_option_definition::desc should contain a human readable | |
1171 | * description of the key. | |
1172 | * retro_core_option_definition::info should contain any additional human | |
1173 | * readable information text that a typical user may need to | |
1174 | * understand the functionality of the option. | |
1175 | * retro_core_option_definition::values is an array of retro_core_option_value | |
1176 | * structs terminated by a { NULL, NULL } element. | |
1177 | * > retro_core_option_definition::values[index].value is an expected option | |
1178 | * value. | |
1179 | * > retro_core_option_definition::values[index].label is a human readable | |
1180 | * label used when displaying the value on screen. If NULL, | |
1181 | * the value itself is used. | |
1182 | * retro_core_option_definition::default_value is the default core option | |
1183 | * setting. It must match one of the expected option values in the | |
1184 | * retro_core_option_definition::values array. If it does not, or the | |
1185 | * default value is NULL, the first entry in the | |
1186 | * retro_core_option_definition::values array is treated as the default. | |
1187 | * | |
1188 | * The number of possible option values should be very limited, | |
1189 | * and must be less than RETRO_NUM_CORE_OPTION_VALUES_MAX. | |
1190 | * i.e. it should be feasible to cycle through options | |
1191 | * without a keyboard. | |
1192 | * | |
1193 | * Example entry: | |
1194 | * { | |
1195 | * "foo_option", | |
1196 | * "Speed hack coprocessor X", | |
1197 | * "Provides increased performance at the expense of reduced accuracy", | |
1198 | * { | |
1199 | * { "false", NULL }, | |
1200 | * { "true", NULL }, | |
1201 | * { "unstable", "Turbo (Unstable)" }, | |
1202 | * { NULL, NULL }, | |
1203 | * }, | |
1204 | * "false" | |
1205 | * } | |
1206 | * | |
1207 | * Only strings are operated on. The possible values will | |
1208 | * generally be displayed and stored as-is by the frontend. | |
1209 | */ | |
1210 | ||
1211 | #define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL 54 | |
1212 | /* const struct retro_core_options_intl * -- | |
1213 | * Allows an implementation to signal the environment | |
1214 | * which variables it might want to check for later using | |
1215 | * GET_VARIABLE. | |
1216 | * This allows the frontend to present these variables to | |
1217 | * a user dynamically. | |
1218 | * This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION | |
1219 | * returns an API version of >= 1. | |
1220 | * This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES. | |
1221 | * This should be called instead of RETRO_ENVIRONMENT_SET_CORE_OPTIONS. | |
1222 | * This should be called the first time as early as | |
1223 | * possible (ideally in retro_set_environment). | |
1224 | * Afterwards it may be called again for the core to communicate | |
1225 | * updated options to the frontend, but the number of core | |
1226 | * options must not change from the number in the initial call. | |
1227 | * | |
1228 | * This is fundamentally the same as RETRO_ENVIRONMENT_SET_CORE_OPTIONS, | |
1229 | * with the addition of localisation support. The description of the | |
1230 | * RETRO_ENVIRONMENT_SET_CORE_OPTIONS callback should be consulted | |
1231 | * for further details. | |
1232 | * | |
1233 | * 'data' points to a retro_core_options_intl struct. | |
1234 | * | |
1235 | * retro_core_options_intl::us is a pointer to an array of | |
1236 | * retro_core_option_definition structs defining the US English | |
1237 | * core options implementation. It must point to a valid array. | |
1238 | * | |
1239 | * retro_core_options_intl::local is a pointer to an array of | |
1240 | * retro_core_option_definition structs defining core options for | |
1241 | * the current frontend language. It may be NULL (in which case | |
1242 | * retro_core_options_intl::us is used by the frontend). Any items | |
1243 | * missing from this array will be read from retro_core_options_intl::us | |
1244 | * instead. | |
1245 | * | |
1246 | * NOTE: Default core option values are always taken from the | |
1247 | * retro_core_options_intl::us array. Any default values in | |
1248 | * retro_core_options_intl::local array will be ignored. | |
1249 | */ | |
1250 | ||
1251 | #define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY 55 | |
1252 | /* struct retro_core_option_display * -- | |
1253 | * | |
1254 | * Allows an implementation to signal the environment to show | |
1255 | * or hide a variable when displaying core options. This is | |
1256 | * considered a *suggestion*. The frontend is free to ignore | |
1257 | * this callback, and its implementation not considered mandatory. | |
1258 | * | |
1259 | * 'data' points to a retro_core_option_display struct | |
1260 | * | |
1261 | * retro_core_option_display::key is a variable identifier | |
1262 | * which has already been set by SET_VARIABLES/SET_CORE_OPTIONS. | |
1263 | * | |
1264 | * retro_core_option_display::visible is a boolean, specifying | |
1265 | * whether variable should be displayed | |
1266 | * | |
1267 | * Note that all core option variables will be set visible by | |
1268 | * default when calling SET_VARIABLES/SET_CORE_OPTIONS. | |
1269 | */ | |
1270 | ||
1271 | #define RETRO_ENVIRONMENT_GET_PREFERRED_HW_RENDER 56 | |
1272 | /* unsigned * -- | |
1273 | * | |
1274 | * Allows an implementation to ask frontend preferred hardware | |
1275 | * context to use. Core should use this information to deal | |
1276 | * with what specific context to request with SET_HW_RENDER. | |
1277 | * | |
1278 | * 'data' points to an unsigned variable | |
1279 | */ | |
1280 | ||
1281 | #define RETRO_ENVIRONMENT_GET_DISK_CONTROL_INTERFACE_VERSION 57 | |
1282 | /* unsigned * -- | |
1283 | * Unsigned value is the API version number of the disk control | |
1284 | * interface supported by the frontend. If callback return false, | |
1285 | * API version is assumed to be 0. | |
1286 | * | |
1287 | * In legacy code, the disk control interface is defined by passing | |
1288 | * a struct of type retro_disk_control_callback to | |
1289 | * RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE. | |
1290 | * This may be still be done regardless of the disk control | |
1291 | * interface version. | |
1292 | * | |
1293 | * If version is >= 1 however, the disk control interface may | |
1294 | * instead be defined by passing a struct of type | |
1295 | * retro_disk_control_ext_callback to | |
1296 | * RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE. | |
1297 | * This allows the core to provide additional information about | |
1298 | * disk images to the frontend and/or enables extra | |
1299 | * disk control functionality by the frontend. | |
1300 | */ | |
1301 | ||
1302 | #define RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE 58 | |
1303 | /* const struct retro_disk_control_ext_callback * -- | |
1304 | * Sets an interface which frontend can use to eject and insert | |
1305 | * disk images, and also obtain information about individual | |
1306 | * disk image files registered by the core. | |
1307 | * This is used for games which consist of multiple images and | |
1308 | * must be manually swapped out by the user (e.g. PSX, floppy disk | |
1309 | * based systems). | |
1310 | */ | |
1311 | ||
1312 | #define RETRO_ENVIRONMENT_GET_MESSAGE_INTERFACE_VERSION 59 | |
1313 | /* unsigned * -- | |
1314 | * Unsigned value is the API version number of the message | |
1315 | * interface supported by the frontend. If callback returns | |
1316 | * false, API version is assumed to be 0. | |
1317 | * | |
1318 | * In legacy code, messages may be displayed in an | |
1319 | * implementation-specific manner by passing a struct | |
1320 | * of type retro_message to RETRO_ENVIRONMENT_SET_MESSAGE. | |
1321 | * This may be still be done regardless of the message | |
1322 | * interface version. | |
1323 | * | |
1324 | * If version is >= 1 however, messages may instead be | |
1325 | * displayed by passing a struct of type retro_message_ext | |
1326 | * to RETRO_ENVIRONMENT_SET_MESSAGE_EXT. This allows the | |
1327 | * core to specify message logging level, priority and | |
1328 | * destination (OSD, logging interface or both). | |
1329 | */ | |
1330 | ||
1331 | #define RETRO_ENVIRONMENT_SET_MESSAGE_EXT 60 | |
1332 | /* const struct retro_message_ext * -- | |
1333 | * Sets a message to be displayed in an implementation-specific | |
1334 | * manner for a certain amount of 'frames'. Additionally allows | |
1335 | * the core to specify message logging level, priority and | |
1336 | * destination (OSD, logging interface or both). | |
1337 | * Should not be used for trivial messages, which should simply be | |
1338 | * logged via RETRO_ENVIRONMENT_GET_LOG_INTERFACE (or as a | |
1339 | * fallback, stderr). | |
1340 | */ | |
1341 | ||
1342 | #define RETRO_ENVIRONMENT_GET_INPUT_MAX_USERS 61 | |
1343 | /* unsigned * -- | |
1344 | * Unsigned value is the number of active input devices | |
1345 | * provided by the frontend. This may change between | |
1346 | * frames, but will remain constant for the duration | |
1347 | * of each frame. | |
1348 | * If callback returns true, a core need not poll any | |
1349 | * input device with an index greater than or equal to | |
1350 | * the number of active devices. | |
1351 | * If callback returns false, the number of active input | |
1352 | * devices is unknown. In this case, all input devices | |
1353 | * should be considered active. | |
1354 | */ | |
1355 | ||
1356 | #define RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK 62 | |
1357 | /* const struct retro_audio_buffer_status_callback * -- | |
1358 | * Lets the core know the occupancy level of the frontend | |
1359 | * audio buffer. Can be used by a core to attempt frame | |
1360 | * skipping in order to avoid buffer under-runs. | |
1361 | * A core may pass NULL to disable buffer status reporting | |
1362 | * in the frontend. | |
1363 | */ | |
1364 | ||
1365 | #define RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY 63 | |
1366 | /* const unsigned * -- | |
1367 | * Sets minimum frontend audio latency in milliseconds. | |
1368 | * Resultant audio latency may be larger than set value, | |
1369 | * or smaller if a hardware limit is encountered. A frontend | |
1370 | * is expected to honour requests up to 512 ms. | |
1371 | * | |
1372 | * - If value is less than current frontend | |
1373 | * audio latency, callback has no effect | |
1374 | * - If value is zero, default frontend audio | |
1375 | * latency is set | |
1376 | * | |
1377 | * May be used by a core to increase audio latency and | |
1378 | * therefore decrease the probability of buffer under-runs | |
1379 | * (crackling) when performing 'intensive' operations. | |
1380 | * A core utilising RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK | |
1381 | * to implement audio-buffer-based frame skipping may achieve | |
1382 | * optimal results by setting the audio latency to a 'high' | |
1383 | * (typically 6x or 8x) integer multiple of the expected | |
1384 | * frame time. | |
1385 | * | |
1386 | * WARNING: This can only be called from within retro_run(). | |
1387 | * Calling this can require a full reinitialization of audio | |
1388 | * drivers in the frontend, so it is important to call it very | |
1389 | * sparingly, and usually only with the users explicit consent. | |
1390 | * An eventual driver reinitialize will happen so that audio | |
1391 | * callbacks happening after this call within the same retro_run() | |
1392 | * call will target the newly initialized driver. | |
1393 | */ | |
1394 | ||
1395 | #define RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE 64 | |
1396 | /* const struct retro_fastforwarding_override * -- | |
1397 | * Used by a libretro core to override the current | |
1398 | * fastforwarding mode of the frontend. | |
1399 | * If NULL is passed to this function, the frontend | |
1400 | * will return true if fastforwarding override | |
1401 | * functionality is supported (no change in | |
1402 | * fastforwarding state will occur in this case). | |
1403 | */ | |
1404 | ||
1405 | #define RETRO_ENVIRONMENT_SET_CONTENT_INFO_OVERRIDE 65 | |
1406 | /* const struct retro_system_content_info_override * -- | |
1407 | * Allows an implementation to override 'global' content | |
1408 | * info parameters reported by retro_get_system_info(). | |
1409 | * Overrides also affect subsystem content info parameters | |
1410 | * set via RETRO_ENVIRONMENT_SET_SUBSYSTEM_INFO. | |
1411 | * This function must be called inside retro_set_environment(). | |
1412 | * If callback returns false, content info overrides | |
1413 | * are unsupported by the frontend, and will be ignored. | |
1414 | * If callback returns true, extended game info may be | |
1415 | * retrieved by calling RETRO_ENVIRONMENT_GET_GAME_INFO_EXT | |
1416 | * in retro_load_game() or retro_load_game_special(). | |
1417 | * | |
1418 | * 'data' points to an array of retro_system_content_info_override | |
1419 | * structs terminated by a { NULL, false, false } element. | |
1420 | * If 'data' is NULL, no changes will be made to the frontend; | |
1421 | * a core may therefore pass NULL in order to test whether | |
1422 | * the RETRO_ENVIRONMENT_SET_CONTENT_INFO_OVERRIDE and | |
1423 | * RETRO_ENVIRONMENT_GET_GAME_INFO_EXT callbacks are supported | |
1424 | * by the frontend. | |
1425 | * | |
1426 | * For struct member descriptions, see the definition of | |
1427 | * struct retro_system_content_info_override. | |
1428 | * | |
1429 | * Example: | |
1430 | * | |
1431 | * - struct retro_system_info: | |
1432 | * { | |
1433 | * "My Core", // library_name | |
1434 | * "v1.0", // library_version | |
1435 | * "m3u|md|cue|iso|chd|sms|gg|sg", // valid_extensions | |
1436 | * true, // need_fullpath | |
1437 | * false // block_extract | |
1438 | * } | |
1439 | * | |
1440 | * - Array of struct retro_system_content_info_override: | |
1441 | * { | |
1442 | * { | |
1443 | * "md|sms|gg", // extensions | |
1444 | * false, // need_fullpath | |
1445 | * true // persistent_data | |
1446 | * }, | |
1447 | * { | |
1448 | * "sg", // extensions | |
1449 | * false, // need_fullpath | |
1450 | * false // persistent_data | |
1451 | * }, | |
1452 | * { NULL, false, false } | |
1453 | * } | |
1454 | * | |
1455 | * Result: | |
1456 | * - Files of type m3u, cue, iso, chd will not be | |
1457 | * loaded by the frontend. Frontend will pass a | |
1458 | * valid path to the core, and core will handle | |
1459 | * loading internally | |
1460 | * - Files of type md, sms, gg will be loaded by | |
1461 | * the frontend. A valid memory buffer will be | |
1462 | * passed to the core. This memory buffer will | |
1463 | * remain valid until retro_deinit() returns | |
1464 | * - Files of type sg will be loaded by the frontend. | |
1465 | * A valid memory buffer will be passed to the core. | |
1466 | * This memory buffer will remain valid until | |
1467 | * retro_load_game() (or retro_load_game_special()) | |
1468 | * returns | |
1469 | * | |
1470 | * NOTE: If an extension is listed multiple times in | |
1471 | * an array of retro_system_content_info_override | |
1472 | * structs, only the first instance will be registered | |
1473 | */ | |
1474 | ||
1475 | #define RETRO_ENVIRONMENT_GET_GAME_INFO_EXT 66 | |
1476 | /* const struct retro_game_info_ext ** -- | |
1477 | * Allows an implementation to fetch extended game | |
1478 | * information, providing additional content path | |
1479 | * and memory buffer status details. | |
1480 | * This function may only be called inside | |
1481 | * retro_load_game() or retro_load_game_special(). | |
1482 | * If callback returns false, extended game information | |
1483 | * is unsupported by the frontend. In this case, only | |
1484 | * regular retro_game_info will be available. | |
1485 | * RETRO_ENVIRONMENT_GET_GAME_INFO_EXT is guaranteed | |
1486 | * to return true if RETRO_ENVIRONMENT_SET_CONTENT_INFO_OVERRIDE | |
1487 | * returns true. | |
1488 | * | |
1489 | * 'data' points to an array of retro_game_info_ext structs. | |
1490 | * | |
1491 | * For struct member descriptions, see the definition of | |
1492 | * struct retro_game_info_ext. | |
1493 | * | |
1494 | * - If function is called inside retro_load_game(), | |
1495 | * the retro_game_info_ext array is guaranteed to | |
1496 | * have a size of 1 - i.e. the returned pointer may | |
1497 | * be used to access directly the members of the | |
1498 | * first retro_game_info_ext struct, for example: | |
1499 | * | |
1500 | * struct retro_game_info_ext *game_info_ext; | |
1501 | * if (environ_cb(RETRO_ENVIRONMENT_GET_GAME_INFO_EXT, &game_info_ext)) | |
1502 | * printf("Content Directory: %s\n", game_info_ext->dir); | |
1503 | * | |
1504 | * - If the function is called inside retro_load_game_special(), | |
1505 | * the retro_game_info_ext array is guaranteed to have a | |
1506 | * size equal to the num_info argument passed to | |
1507 | * retro_load_game_special() | |
1508 | */ | |
1509 | ||
1510 | #define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2 67 | |
1511 | /* const struct retro_core_options_v2 * -- | |
1512 | * Allows an implementation to signal the environment | |
1513 | * which variables it might want to check for later using | |
1514 | * GET_VARIABLE. | |
1515 | * This allows the frontend to present these variables to | |
1516 | * a user dynamically. | |
1517 | * This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION | |
1518 | * returns an API version of >= 2. | |
1519 | * This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES. | |
1520 | * This should be called instead of RETRO_ENVIRONMENT_SET_CORE_OPTIONS. | |
1521 | * This should be called the first time as early as | |
1522 | * possible (ideally in retro_set_environment). | |
1523 | * Afterwards it may be called again for the core to communicate | |
1524 | * updated options to the frontend, but the number of core | |
1525 | * options must not change from the number in the initial call. | |
1526 | * If RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION returns an API | |
1527 | * version of >= 2, this callback is guaranteed to succeed | |
1528 | * (i.e. callback return value does not indicate success) | |
1529 | * If callback returns true, frontend has core option category | |
1530 | * support. | |
1531 | * If callback returns false, frontend does not have core option | |
1532 | * category support. | |
1533 | * | |
1534 | * 'data' points to a retro_core_options_v2 struct, containing | |
1535 | * of two pointers: | |
1536 | * - retro_core_options_v2::categories is an array of | |
1537 | * retro_core_option_v2_category structs terminated by a | |
1538 | * { NULL, NULL, NULL } element. If retro_core_options_v2::categories | |
1539 | * is NULL, all core options will have no category and will be shown | |
1540 | * at the top level of the frontend core option interface. If frontend | |
1541 | * does not have core option category support, categories array will | |
1542 | * be ignored. | |
1543 | * - retro_core_options_v2::definitions is an array of | |
1544 | * retro_core_option_v2_definition structs terminated by a | |
1545 | * { NULL, NULL, NULL, NULL, NULL, NULL, {{0}}, NULL } | |
1546 | * element. | |
1547 | * | |
1548 | * >> retro_core_option_v2_category notes: | |
1549 | * | |
1550 | * - retro_core_option_v2_category::key should contain string | |
1551 | * that uniquely identifies the core option category. Valid | |
1552 | * key characters are [a-z, A-Z, 0-9, _, -] | |
1553 | * Namespace collisions with other implementations' category | |
1554 | * keys are permitted. | |
1555 | * - retro_core_option_v2_category::desc should contain a human | |
1556 | * readable description of the category key. | |
1557 | * - retro_core_option_v2_category::info should contain any | |
1558 | * additional human readable information text that a typical | |
1559 | * user may need to understand the nature of the core option | |
1560 | * category. | |
1561 | * | |
1562 | * Example entry: | |
1563 | * { | |
1564 | * "advanced_settings", | |
1565 | * "Advanced", | |
1566 | * "Options affecting low-level emulation performance and accuracy." | |
1567 | * } | |
1568 | * | |
1569 | * >> retro_core_option_v2_definition notes: | |
1570 | * | |
1571 | * - retro_core_option_v2_definition::key should be namespaced to not | |
1572 | * collide with other implementations' keys. e.g. A core called | |
1573 | * 'foo' should use keys named as 'foo_option'. Valid key characters | |
1574 | * are [a-z, A-Z, 0-9, _, -]. | |
1575 | * - retro_core_option_v2_definition::desc should contain a human readable | |
1576 | * description of the key. Will be used when the frontend does not | |
1577 | * have core option category support. Examples: "Aspect Ratio" or | |
1578 | * "Video > Aspect Ratio". | |
1579 | * - retro_core_option_v2_definition::desc_categorized should contain a | |
1580 | * human readable description of the key, which will be used when | |
1581 | * frontend has core option category support. Example: "Aspect Ratio", | |
1582 | * where associated retro_core_option_v2_category::desc is "Video". | |
1583 | * If empty or NULL, the string specified by | |
1584 | * retro_core_option_v2_definition::desc will be used instead. | |
1585 | * retro_core_option_v2_definition::desc_categorized will be ignored | |
1586 | * if retro_core_option_v2_definition::category_key is empty or NULL. | |
1587 | * - retro_core_option_v2_definition::info should contain any additional | |
1588 | * human readable information text that a typical user may need to | |
1589 | * understand the functionality of the option. | |
1590 | * - retro_core_option_v2_definition::info_categorized should contain | |
1591 | * any additional human readable information text that a typical user | |
1592 | * may need to understand the functionality of the option, and will be | |
1593 | * used when frontend has core option category support. This is provided | |
1594 | * to accommodate the case where info text references an option by | |
1595 | * name/desc, and the desc/desc_categorized text for that option differ. | |
1596 | * If empty or NULL, the string specified by | |
1597 | * retro_core_option_v2_definition::info will be used instead. | |
1598 | * retro_core_option_v2_definition::info_categorized will be ignored | |
1599 | * if retro_core_option_v2_definition::category_key is empty or NULL. | |
1600 | * - retro_core_option_v2_definition::category_key should contain a | |
1601 | * category identifier (e.g. "video" or "audio") that will be | |
1602 | * assigned to the core option if frontend has core option category | |
1603 | * support. A categorized option will be shown in a subsection/ | |
1604 | * submenu of the frontend core option interface. If key is empty | |
1605 | * or NULL, or if key does not match one of the | |
1606 | * retro_core_option_v2_category::key values in the associated | |
1607 | * retro_core_option_v2_category array, option will have no category | |
1608 | * and will be shown at the top level of the frontend core option | |
1609 | * interface. | |
1610 | * - retro_core_option_v2_definition::values is an array of | |
1611 | * retro_core_option_value structs terminated by a { NULL, NULL } | |
1612 | * element. | |
1613 | * --> retro_core_option_v2_definition::values[index].value is an | |
1614 | * expected option value. | |
1615 | * --> retro_core_option_v2_definition::values[index].label is a | |
1616 | * human readable label used when displaying the value on screen. | |
1617 | * If NULL, the value itself is used. | |
1618 | * - retro_core_option_v2_definition::default_value is the default | |
1619 | * core option setting. It must match one of the expected option | |
1620 | * values in the retro_core_option_v2_definition::values array. If | |
1621 | * it does not, or the default value is NULL, the first entry in the | |
1622 | * retro_core_option_v2_definition::values array is treated as the | |
1623 | * default. | |
1624 | * | |
1625 | * The number of possible option values should be very limited, | |
1626 | * and must be less than RETRO_NUM_CORE_OPTION_VALUES_MAX. | |
1627 | * i.e. it should be feasible to cycle through options | |
1628 | * without a keyboard. | |
1629 | * | |
1630 | * Example entries: | |
1631 | * | |
1632 | * - Uncategorized: | |
1633 | * | |
1634 | * { | |
1635 | * "foo_option", | |
1636 | * "Speed hack coprocessor X", | |
1637 | * NULL, | |
1638 | * "Provides increased performance at the expense of reduced accuracy.", | |
1639 | * NULL, | |
1640 | * NULL, | |
1641 | * { | |
1642 | * { "false", NULL }, | |
1643 | * { "true", NULL }, | |
1644 | * { "unstable", "Turbo (Unstable)" }, | |
1645 | * { NULL, NULL }, | |
1646 | * }, | |
1647 | * "false" | |
1648 | * } | |
1649 | * | |
1650 | * - Categorized: | |
1651 | * | |
1652 | * { | |
1653 | * "foo_option", | |
1654 | * "Advanced > Speed hack coprocessor X", | |
1655 | * "Speed hack coprocessor X", | |
1656 | * "Setting 'Advanced > Speed hack coprocessor X' to 'true' or 'Turbo' provides increased performance at the expense of reduced accuracy", | |
1657 | * "Setting 'Speed hack coprocessor X' to 'true' or 'Turbo' provides increased performance at the expense of reduced accuracy", | |
1658 | * "advanced_settings", | |
1659 | * { | |
1660 | * { "false", NULL }, | |
1661 | * { "true", NULL }, | |
1662 | * { "unstable", "Turbo (Unstable)" }, | |
1663 | * { NULL, NULL }, | |
1664 | * }, | |
1665 | * "false" | |
1666 | * } | |
1667 | * | |
1668 | * Only strings are operated on. The possible values will | |
1669 | * generally be displayed and stored as-is by the frontend. | |
1670 | */ | |
1671 | ||
1672 | #define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL 68 | |
1673 | /* const struct retro_core_options_v2_intl * -- | |
1674 | * Allows an implementation to signal the environment | |
1675 | * which variables it might want to check for later using | |
1676 | * GET_VARIABLE. | |
1677 | * This allows the frontend to present these variables to | |
1678 | * a user dynamically. | |
1679 | * This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION | |
1680 | * returns an API version of >= 2. | |
1681 | * This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES. | |
1682 | * This should be called instead of RETRO_ENVIRONMENT_SET_CORE_OPTIONS. | |
1683 | * This should be called instead of RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL. | |
1684 | * This should be called instead of RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2. | |
1685 | * This should be called the first time as early as | |
1686 | * possible (ideally in retro_set_environment). | |
1687 | * Afterwards it may be called again for the core to communicate | |
1688 | * updated options to the frontend, but the number of core | |
1689 | * options must not change from the number in the initial call. | |
1690 | * If RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION returns an API | |
1691 | * version of >= 2, this callback is guaranteed to succeed | |
1692 | * (i.e. callback return value does not indicate success) | |
1693 | * If callback returns true, frontend has core option category | |
1694 | * support. | |
1695 | * If callback returns false, frontend does not have core option | |
1696 | * category support. | |
1697 | * | |
1698 | * This is fundamentally the same as RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2, | |
1699 | * with the addition of localisation support. The description of the | |
1700 | * RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2 callback should be consulted | |
1701 | * for further details. | |
1702 | * | |
1703 | * 'data' points to a retro_core_options_v2_intl struct. | |
1704 | * | |
1705 | * - retro_core_options_v2_intl::us is a pointer to a | |
1706 | * retro_core_options_v2 struct defining the US English | |
1707 | * core options implementation. It must point to a valid struct. | |
1708 | * | |
1709 | * - retro_core_options_v2_intl::local is a pointer to a | |
1710 | * retro_core_options_v2 struct defining core options for | |
1711 | * the current frontend language. It may be NULL (in which case | |
1712 | * retro_core_options_v2_intl::us is used by the frontend). Any items | |
1713 | * missing from this struct will be read from | |
1714 | * retro_core_options_v2_intl::us instead. | |
1715 | * | |
1716 | * NOTE: Default core option values are always taken from the | |
1717 | * retro_core_options_v2_intl::us struct. Any default values in | |
1718 | * the retro_core_options_v2_intl::local struct will be ignored. | |
1719 | */ | |
1720 | ||
1721 | #define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_UPDATE_DISPLAY_CALLBACK 69 | |
1722 | /* const struct retro_core_options_update_display_callback * -- | |
1723 | * Allows a frontend to signal that a core must update | |
1724 | * the visibility of any dynamically hidden core options, | |
1725 | * and enables the frontend to detect visibility changes. | |
1726 | * Used by the frontend to update the menu display status | |
1727 | * of core options without requiring a call of retro_run(). | |
1728 | * Must be called in retro_set_environment(). | |
1729 | */ | |
1730 | ||
1731 | #define RETRO_ENVIRONMENT_SET_VARIABLE 70 | |
1732 | /* const struct retro_variable * -- | |
1733 | * Allows an implementation to notify the frontend | |
1734 | * that a core option value has changed. | |
1735 | * | |
1736 | * retro_variable::key and retro_variable::value | |
1737 | * must match strings that have been set previously | |
1738 | * via one of the following: | |
1739 | * | |
1740 | * - RETRO_ENVIRONMENT_SET_VARIABLES | |
1741 | * - RETRO_ENVIRONMENT_SET_CORE_OPTIONS | |
1742 | * - RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL | |
1743 | * - RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2 | |
1744 | * - RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL | |
1745 | * | |
1746 | * After changing a core option value via this | |
1747 | * callback, RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE | |
1748 | * will return true. | |
1749 | * | |
1750 | * If data is NULL, no changes will be registered | |
1751 | * and the callback will return true; an | |
1752 | * implementation may therefore pass NULL in order | |
1753 | * to test whether the callback is supported. | |
1754 | */ | |
1755 | ||
1756 | #define RETRO_ENVIRONMENT_GET_THROTTLE_STATE (71 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
1757 | /* struct retro_throttle_state * -- | |
1758 | * Allows an implementation to get details on the actual rate | |
1759 | * the frontend is attempting to call retro_run(). | |
1760 | */ | |
1761 | ||
1762 | #define RETRO_ENVIRONMENT_GET_SAVESTATE_CONTEXT (72 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
1763 | /* int * -- | |
1764 | * Tells the core about the context the frontend is asking for savestate. | |
1765 | * (see enum retro_savestate_context) | |
1766 | */ | |
1767 | ||
1768 | #define RETRO_ENVIRONMENT_GET_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_SUPPORT (73 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
1769 | /* struct retro_hw_render_context_negotiation_interface * -- | |
1770 | * Before calling SET_HW_RNEDER_CONTEXT_NEGOTIATION_INTERFACE, a core can query | |
1771 | * which version of the interface is supported. | |
1772 | * | |
1773 | * Frontend looks at interface_type and returns the maximum supported | |
1774 | * context negotiation interface version. | |
1775 | * If the interface_type is not supported or recognized by the frontend, a version of 0 | |
1776 | * must be returned in interface_version and true is returned by frontend. | |
1777 | * | |
1778 | * If this environment call returns true with interface_version greater than 0, | |
1779 | * a core can always use a negotiation interface version larger than what the frontend returns, but only | |
1780 | * earlier versions of the interface will be used by the frontend. | |
1781 | * A frontend must not reject a negotiation interface version that is larger than | |
1782 | * what the frontend supports. Instead, the frontend will use the older entry points that it recognizes. | |
1783 | * If this is incompatible with a particular core's requirements, it can error out early. | |
1784 | * | |
1785 | * Backwards compatibility note: | |
1786 | * This environment call was introduced after Vulkan v1 context negotiation. | |
1787 | * If this environment call is not supported by frontend - i.e. the environment call returns false - | |
1788 | * only Vulkan v1 context negotiation is supported (if Vulkan HW rendering is supported at all). | |
1789 | * If a core uses Vulkan negotiation interface with version > 1, negotiation may fail unexpectedly. | |
1790 | * All future updates to the context negotiation interface implies that frontend must support | |
1791 | * this environment call to query support. | |
1792 | */ | |
1793 | ||
1794 | #define RETRO_ENVIRONMENT_GET_JIT_CAPABLE 74 | |
1795 | /* bool * -- | |
1796 | * Result is set to true if the frontend has already verified JIT can be | |
1797 | * used, mainly for use iOS/tvOS. On other platforms the result is true. | |
1798 | */ | |
1799 | ||
1800 | #define RETRO_ENVIRONMENT_GET_MICROPHONE_INTERFACE (75 | RETRO_ENVIRONMENT_EXPERIMENTAL) | |
1801 | /* struct retro_microphone_interface * -- | |
1802 | * Returns an interface that can be used to receive input from the microphone driver. | |
1803 | * | |
1804 | * Returns true if microphone support is available, | |
1805 | * even if no microphones are plugged in. | |
1806 | * Returns false if mic support is disabled or unavailable. | |
1807 | * | |
1808 | * This callback can be invoked at any time, | |
1809 | * even before the microphone driver is ready. | |
1810 | */ | |
1811 | ||
1812 | /* VFS functionality */ | |
1813 | ||
1814 | /* File paths: | |
1815 | * File paths passed as parameters when using this API shall be well formed UNIX-style, | |
1816 | * using "/" (unquoted forward slash) as directory separator regardless of the platform's native separator. | |
1817 | * Paths shall also include at least one forward slash ("game.bin" is an invalid path, use "./game.bin" instead). | |
1818 | * Other than the directory separator, cores shall not make assumptions about path format: | |
1819 | * "C:/path/game.bin", "http://example.com/game.bin", "#game/game.bin", "./game.bin" (without quotes) are all valid paths. | |
1820 | * Cores may replace the basename or remove path components from the end, and/or add new components; | |
1821 | * however, cores shall not append "./", "../" or multiple consecutive forward slashes ("//") to paths they request to front end. | |
1822 | * The frontend is encouraged to make such paths work as well as it can, but is allowed to give up if the core alters paths too much. | |
1823 | * Frontends are encouraged, but not required, to support native file system paths (modulo replacing the directory separator, if applicable). | |
1824 | * Cores are allowed to try using them, but must remain functional if the front rejects such requests. | |
1825 | * Cores are encouraged to use the libretro-common filestream functions for file I/O, | |
1826 | * as they seamlessly integrate with VFS, deal with directory separator replacement as appropriate | |
1827 | * and provide platform-specific fallbacks in cases where front ends do not support VFS. */ | |
1828 | ||
1829 | /* Opaque file handle | |
1830 | * Introduced in VFS API v1 */ | |
1831 | struct retro_vfs_file_handle; | |
1832 | ||
1833 | /* Opaque directory handle | |
1834 | * Introduced in VFS API v3 */ | |
1835 | struct retro_vfs_dir_handle; | |
1836 | ||
1837 | /* File open flags | |
1838 | * Introduced in VFS API v1 */ | |
1839 | #define RETRO_VFS_FILE_ACCESS_READ (1 << 0) /* Read only mode */ | |
1840 | #define RETRO_VFS_FILE_ACCESS_WRITE (1 << 1) /* Write only mode, discard contents and overwrites existing file unless RETRO_VFS_FILE_ACCESS_UPDATE is also specified */ | |
1841 | #define RETRO_VFS_FILE_ACCESS_READ_WRITE (RETRO_VFS_FILE_ACCESS_READ | RETRO_VFS_FILE_ACCESS_WRITE) /* Read-write mode, discard contents and overwrites existing file unless RETRO_VFS_FILE_ACCESS_UPDATE is also specified*/ | |
1842 | #define RETRO_VFS_FILE_ACCESS_UPDATE_EXISTING (1 << 2) /* Prevents discarding content of existing files opened for writing */ | |
1843 | ||
1844 | /* These are only hints. The frontend may choose to ignore them. Other than RAM/CPU/etc use, | |
1845 | and how they react to unlikely external interference (for example someone else writing to that file, | |
1846 | or the file's server going down), behavior will not change. */ | |
1847 | #define RETRO_VFS_FILE_ACCESS_HINT_NONE (0) | |
1848 | /* Indicate that the file will be accessed many times. The frontend should aggressively cache everything. */ | |
1849 | #define RETRO_VFS_FILE_ACCESS_HINT_FREQUENT_ACCESS (1 << 0) | |
1850 | ||
1851 | /* Seek positions */ | |
1852 | #define RETRO_VFS_SEEK_POSITION_START 0 | |
1853 | #define RETRO_VFS_SEEK_POSITION_CURRENT 1 | |
1854 | #define RETRO_VFS_SEEK_POSITION_END 2 | |
1855 | ||
1856 | /* stat() result flags | |
1857 | * Introduced in VFS API v3 */ | |
1858 | #define RETRO_VFS_STAT_IS_VALID (1 << 0) | |
1859 | #define RETRO_VFS_STAT_IS_DIRECTORY (1 << 1) | |
1860 | #define RETRO_VFS_STAT_IS_CHARACTER_SPECIAL (1 << 2) | |
1861 | ||
1862 | /* Get path from opaque handle. Returns the exact same path passed to file_open when getting the handle | |
1863 | * Introduced in VFS API v1 */ | |
1864 | typedef const char *(RETRO_CALLCONV *retro_vfs_get_path_t)(struct retro_vfs_file_handle *stream); | |
1865 | ||
1866 | /* Open a file for reading or writing. If path points to a directory, this will | |
1867 | * fail. Returns the opaque file handle, or NULL for error. | |
1868 | * Introduced in VFS API v1 */ | |
1869 | typedef struct retro_vfs_file_handle *(RETRO_CALLCONV *retro_vfs_open_t)(const char *path, unsigned mode, unsigned hints); | |
1870 | ||
1871 | /* Close the file and release its resources. Must be called if open_file returns non-NULL. Returns 0 on success, -1 on failure. | |
1872 | * Whether the call succeeds ot not, the handle passed as parameter becomes invalid and should no longer be used. | |
1873 | * Introduced in VFS API v1 */ | |
1874 | typedef int (RETRO_CALLCONV *retro_vfs_close_t)(struct retro_vfs_file_handle *stream); | |
1875 | ||
1876 | /* Return the size of the file in bytes, or -1 for error. | |
1877 | * Introduced in VFS API v1 */ | |
1878 | typedef int64_t (RETRO_CALLCONV *retro_vfs_size_t)(struct retro_vfs_file_handle *stream); | |
1879 | ||
1880 | /* Truncate file to specified size. Returns 0 on success or -1 on error | |
1881 | * Introduced in VFS API v2 */ | |
1882 | typedef int64_t (RETRO_CALLCONV *retro_vfs_truncate_t)(struct retro_vfs_file_handle *stream, int64_t length); | |
1883 | ||
1884 | /* Get the current read / write position for the file. Returns -1 for error. | |
1885 | * Introduced in VFS API v1 */ | |
1886 | typedef int64_t (RETRO_CALLCONV *retro_vfs_tell_t)(struct retro_vfs_file_handle *stream); | |
1887 | ||
1888 | /* Set the current read/write position for the file. Returns the new position, -1 for error. | |
1889 | * Introduced in VFS API v1 */ | |
1890 | typedef int64_t (RETRO_CALLCONV *retro_vfs_seek_t)(struct retro_vfs_file_handle *stream, int64_t offset, int seek_position); | |
1891 | ||
1892 | /* Read data from a file. Returns the number of bytes read, or -1 for error. | |
1893 | * Introduced in VFS API v1 */ | |
1894 | typedef int64_t (RETRO_CALLCONV *retro_vfs_read_t)(struct retro_vfs_file_handle *stream, void *s, uint64_t len); | |
1895 | ||
1896 | /* Write data to a file. Returns the number of bytes written, or -1 for error. | |
1897 | * Introduced in VFS API v1 */ | |
1898 | typedef int64_t (RETRO_CALLCONV *retro_vfs_write_t)(struct retro_vfs_file_handle *stream, const void *s, uint64_t len); | |
1899 | ||
1900 | /* Flush pending writes to file, if using buffered IO. Returns 0 on sucess, or -1 on failure. | |
1901 | * Introduced in VFS API v1 */ | |
1902 | typedef int (RETRO_CALLCONV *retro_vfs_flush_t)(struct retro_vfs_file_handle *stream); | |
1903 | ||
1904 | /* Delete the specified file. Returns 0 on success, -1 on failure | |
1905 | * Introduced in VFS API v1 */ | |
1906 | typedef int (RETRO_CALLCONV *retro_vfs_remove_t)(const char *path); | |
1907 | ||
1908 | /* Rename the specified file. Returns 0 on success, -1 on failure | |
1909 | * Introduced in VFS API v1 */ | |
1910 | typedef int (RETRO_CALLCONV *retro_vfs_rename_t)(const char *old_path, const char *new_path); | |
1911 | ||
1912 | /* Stat the specified file. Retruns a bitmask of RETRO_VFS_STAT_* flags, none are set if path was not valid. | |
1913 | * Additionally stores file size in given variable, unless NULL is given. | |
1914 | * Introduced in VFS API v3 */ | |
1915 | typedef int (RETRO_CALLCONV *retro_vfs_stat_t)(const char *path, int32_t *size); | |
1916 | ||
1917 | /* Create the specified directory. Returns 0 on success, -1 on unknown failure, -2 if already exists. | |
1918 | * Introduced in VFS API v3 */ | |
1919 | typedef int (RETRO_CALLCONV *retro_vfs_mkdir_t)(const char *dir); | |
1920 | ||
1921 | /* Open the specified directory for listing. Returns the opaque dir handle, or NULL for error. | |
1922 | * Support for the include_hidden argument may vary depending on the platform. | |
1923 | * Introduced in VFS API v3 */ | |
1924 | typedef struct retro_vfs_dir_handle *(RETRO_CALLCONV *retro_vfs_opendir_t)(const char *dir, bool include_hidden); | |
1925 | ||
1926 | /* Read the directory entry at the current position, and move the read pointer to the next position. | |
1927 | * Returns true on success, false if already on the last entry. | |
1928 | * Introduced in VFS API v3 */ | |
1929 | typedef bool (RETRO_CALLCONV *retro_vfs_readdir_t)(struct retro_vfs_dir_handle *dirstream); | |
1930 | ||
1931 | /* Get the name of the last entry read. Returns a string on success, or NULL for error. | |
1932 | * The returned string pointer is valid until the next call to readdir or closedir. | |
1933 | * Introduced in VFS API v3 */ | |
1934 | typedef const char *(RETRO_CALLCONV *retro_vfs_dirent_get_name_t)(struct retro_vfs_dir_handle *dirstream); | |
1935 | ||
1936 | /* Check if the last entry read was a directory. Returns true if it was, false otherwise (or on error). | |
1937 | * Introduced in VFS API v3 */ | |
1938 | typedef bool (RETRO_CALLCONV *retro_vfs_dirent_is_dir_t)(struct retro_vfs_dir_handle *dirstream); | |
1939 | ||
1940 | /* Close the directory and release its resources. Must be called if opendir returns non-NULL. Returns 0 on success, -1 on failure. | |
1941 | * Whether the call succeeds ot not, the handle passed as parameter becomes invalid and should no longer be used. | |
1942 | * Introduced in VFS API v3 */ | |
1943 | typedef int (RETRO_CALLCONV *retro_vfs_closedir_t)(struct retro_vfs_dir_handle *dirstream); | |
1944 | ||
1945 | struct retro_vfs_interface | |
1946 | { | |
1947 | /* VFS API v1 */ | |
1948 | retro_vfs_get_path_t get_path; | |
1949 | retro_vfs_open_t open; | |
1950 | retro_vfs_close_t close; | |
1951 | retro_vfs_size_t size; | |
1952 | retro_vfs_tell_t tell; | |
1953 | retro_vfs_seek_t seek; | |
1954 | retro_vfs_read_t read; | |
1955 | retro_vfs_write_t write; | |
1956 | retro_vfs_flush_t flush; | |
1957 | retro_vfs_remove_t remove; | |
1958 | retro_vfs_rename_t rename; | |
1959 | /* VFS API v2 */ | |
1960 | retro_vfs_truncate_t truncate; | |
1961 | /* VFS API v3 */ | |
1962 | retro_vfs_stat_t stat; | |
1963 | retro_vfs_mkdir_t mkdir; | |
1964 | retro_vfs_opendir_t opendir; | |
1965 | retro_vfs_readdir_t readdir; | |
1966 | retro_vfs_dirent_get_name_t dirent_get_name; | |
1967 | retro_vfs_dirent_is_dir_t dirent_is_dir; | |
1968 | retro_vfs_closedir_t closedir; | |
1969 | }; | |
1970 | ||
1971 | struct retro_vfs_interface_info | |
1972 | { | |
1973 | /* Set by core: should this be higher than the version the front end supports, | |
1974 | * front end will return false in the RETRO_ENVIRONMENT_GET_VFS_INTERFACE call | |
1975 | * Introduced in VFS API v1 */ | |
1976 | uint32_t required_interface_version; | |
1977 | ||
1978 | /* Frontend writes interface pointer here. The frontend also sets the actual | |
1979 | * version, must be at least required_interface_version. | |
1980 | * Introduced in VFS API v1 */ | |
1981 | struct retro_vfs_interface *iface; | |
1982 | }; | |
1983 | ||
1984 | enum retro_hw_render_interface_type | |
1985 | { | |
1986 | RETRO_HW_RENDER_INTERFACE_VULKAN = 0, | |
1987 | RETRO_HW_RENDER_INTERFACE_D3D9 = 1, | |
1988 | RETRO_HW_RENDER_INTERFACE_D3D10 = 2, | |
1989 | RETRO_HW_RENDER_INTERFACE_D3D11 = 3, | |
1990 | RETRO_HW_RENDER_INTERFACE_D3D12 = 4, | |
1991 | RETRO_HW_RENDER_INTERFACE_GSKIT_PS2 = 5, | |
1992 | RETRO_HW_RENDER_INTERFACE_DUMMY = INT_MAX | |
1993 | }; | |
1994 | ||
1995 | /* Base struct. All retro_hw_render_interface_* types | |
1996 | * contain at least these fields. */ | |
1997 | struct retro_hw_render_interface | |
1998 | { | |
1999 | enum retro_hw_render_interface_type interface_type; | |
2000 | unsigned interface_version; | |
2001 | }; | |
2002 | ||
2003 | typedef void (RETRO_CALLCONV *retro_set_led_state_t)(int led, int state); | |
2004 | struct retro_led_interface | |
2005 | { | |
2006 | retro_set_led_state_t set_led_state; | |
2007 | }; | |
2008 | ||
2009 | /* Retrieves the current state of the MIDI input. | |
2010 | * Returns true if it's enabled, false otherwise. */ | |
2011 | typedef bool (RETRO_CALLCONV *retro_midi_input_enabled_t)(void); | |
2012 | ||
2013 | /* Retrieves the current state of the MIDI output. | |
2014 | * Returns true if it's enabled, false otherwise */ | |
2015 | typedef bool (RETRO_CALLCONV *retro_midi_output_enabled_t)(void); | |
2016 | ||
2017 | /* Reads next byte from the input stream. | |
2018 | * Returns true if byte is read, false otherwise. */ | |
2019 | typedef bool (RETRO_CALLCONV *retro_midi_read_t)(uint8_t *byte); | |
2020 | ||
2021 | /* Writes byte to the output stream. | |
2022 | * 'delta_time' is in microseconds and represent time elapsed since previous write. | |
2023 | * Returns true if byte is written, false otherwise. */ | |
2024 | typedef bool (RETRO_CALLCONV *retro_midi_write_t)(uint8_t byte, uint32_t delta_time); | |
2025 | ||
2026 | /* Flushes previously written data. | |
2027 | * Returns true if successful, false otherwise. */ | |
2028 | typedef bool (RETRO_CALLCONV *retro_midi_flush_t)(void); | |
2029 | ||
2030 | struct retro_midi_interface | |
2031 | { | |
2032 | retro_midi_input_enabled_t input_enabled; | |
2033 | retro_midi_output_enabled_t output_enabled; | |
2034 | retro_midi_read_t read; | |
2035 | retro_midi_write_t write; | |
2036 | retro_midi_flush_t flush; | |
2037 | }; | |
2038 | ||
2039 | enum retro_hw_render_context_negotiation_interface_type | |
2040 | { | |
2041 | RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN = 0, | |
2042 | RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_DUMMY = INT_MAX | |
2043 | }; | |
2044 | ||
2045 | /* Base struct. All retro_hw_render_context_negotiation_interface_* types | |
2046 | * contain at least these fields. */ | |
2047 | struct retro_hw_render_context_negotiation_interface | |
2048 | { | |
2049 | enum retro_hw_render_context_negotiation_interface_type interface_type; | |
2050 | unsigned interface_version; | |
2051 | }; | |
2052 | ||
2053 | /* Serialized state is incomplete in some way. Set if serialization is | |
2054 | * usable in typical end-user cases but should not be relied upon to | |
2055 | * implement frame-sensitive frontend features such as netplay or | |
2056 | * rerecording. */ | |
2057 | #define RETRO_SERIALIZATION_QUIRK_INCOMPLETE (1 << 0) | |
2058 | /* The core must spend some time initializing before serialization is | |
2059 | * supported. retro_serialize() will initially fail; retro_unserialize() | |
2060 | * and retro_serialize_size() may or may not work correctly either. */ | |
2061 | #define RETRO_SERIALIZATION_QUIRK_MUST_INITIALIZE (1 << 1) | |
2062 | /* Serialization size may change within a session. */ | |
2063 | #define RETRO_SERIALIZATION_QUIRK_CORE_VARIABLE_SIZE (1 << 2) | |
2064 | /* Set by the frontend to acknowledge that it supports variable-sized | |
2065 | * states. */ | |
2066 | #define RETRO_SERIALIZATION_QUIRK_FRONT_VARIABLE_SIZE (1 << 3) | |
2067 | /* Serialized state can only be loaded during the same session. */ | |
2068 | #define RETRO_SERIALIZATION_QUIRK_SINGLE_SESSION (1 << 4) | |
2069 | /* Serialized state cannot be loaded on an architecture with a different | |
2070 | * endianness from the one it was saved on. */ | |
2071 | #define RETRO_SERIALIZATION_QUIRK_ENDIAN_DEPENDENT (1 << 5) | |
2072 | /* Serialized state cannot be loaded on a different platform from the one it | |
2073 | * was saved on for reasons other than endianness, such as word size | |
2074 | * dependence */ | |
2075 | #define RETRO_SERIALIZATION_QUIRK_PLATFORM_DEPENDENT (1 << 6) | |
2076 | ||
2077 | #define RETRO_MEMDESC_CONST (1 << 0) /* The frontend will never change this memory area once retro_load_game has returned. */ | |
2078 | #define RETRO_MEMDESC_BIGENDIAN (1 << 1) /* The memory area contains big endian data. Default is little endian. */ | |
2079 | #define RETRO_MEMDESC_SYSTEM_RAM (1 << 2) /* The memory area is system RAM. This is main RAM of the gaming system. */ | |
2080 | #define RETRO_MEMDESC_SAVE_RAM (1 << 3) /* The memory area is save RAM. This RAM is usually found on a game cartridge, backed up by a battery. */ | |
2081 | #define RETRO_MEMDESC_VIDEO_RAM (1 << 4) /* The memory area is video RAM (VRAM) */ | |
2082 | #define RETRO_MEMDESC_ALIGN_2 (1 << 16) /* All memory access in this area is aligned to their own size, or 2, whichever is smaller. */ | |
2083 | #define RETRO_MEMDESC_ALIGN_4 (2 << 16) | |
2084 | #define RETRO_MEMDESC_ALIGN_8 (3 << 16) | |
2085 | #define RETRO_MEMDESC_MINSIZE_2 (1 << 24) /* All memory in this region is accessed at least 2 bytes at the time. */ | |
2086 | #define RETRO_MEMDESC_MINSIZE_4 (2 << 24) | |
2087 | #define RETRO_MEMDESC_MINSIZE_8 (3 << 24) | |
2088 | struct retro_memory_descriptor | |
2089 | { | |
2090 | uint64_t flags; | |
2091 | ||
2092 | /* Pointer to the start of the relevant ROM or RAM chip. | |
2093 | * It's strongly recommended to use 'offset' if possible, rather than | |
2094 | * doing math on the pointer. | |
2095 | * | |
2096 | * If the same byte is mapped my multiple descriptors, their descriptors | |
2097 | * must have the same pointer. | |
2098 | * If 'start' does not point to the first byte in the pointer, put the | |
2099 | * difference in 'offset' instead. | |
2100 | * | |
2101 | * May be NULL if there's nothing usable here (e.g. hardware registers and | |
2102 | * open bus). No flags should be set if the pointer is NULL. | |
2103 | * It's recommended to minimize the number of descriptors if possible, | |
2104 | * but not mandatory. */ | |
2105 | void *ptr; | |
2106 | size_t offset; | |
2107 | ||
2108 | /* This is the location in the emulated address space | |
2109 | * where the mapping starts. */ | |
2110 | size_t start; | |
2111 | ||
2112 | /* Which bits must be same as in 'start' for this mapping to apply. | |
2113 | * The first memory descriptor to claim a certain byte is the one | |
2114 | * that applies. | |
2115 | * A bit which is set in 'start' must also be set in this. | |
2116 | * Can be zero, in which case each byte is assumed mapped exactly once. | |
2117 | * In this case, 'len' must be a power of two. */ | |
2118 | size_t select; | |
2119 | ||
2120 | /* If this is nonzero, the set bits are assumed not connected to the | |
2121 | * memory chip's address pins. */ | |
2122 | size_t disconnect; | |
2123 | ||
2124 | /* This one tells the size of the current memory area. | |
2125 | * If, after start+disconnect are applied, the address is higher than | |
2126 | * this, the highest bit of the address is cleared. | |
2127 | * | |
2128 | * If the address is still too high, the next highest bit is cleared. | |
2129 | * Can be zero, in which case it's assumed to be infinite (as limited | |
2130 | * by 'select' and 'disconnect'). */ | |
2131 | size_t len; | |
2132 | ||
2133 | /* To go from emulated address to physical address, the following | |
2134 | * order applies: | |
2135 | * Subtract 'start', pick off 'disconnect', apply 'len', add 'offset'. */ | |
2136 | ||
2137 | /* The address space name must consist of only a-zA-Z0-9_-, | |
2138 | * should be as short as feasible (maximum length is 8 plus the NUL), | |
2139 | * and may not be any other address space plus one or more 0-9A-F | |
2140 | * at the end. | |
2141 | * However, multiple memory descriptors for the same address space is | |
2142 | * allowed, and the address space name can be empty. NULL is treated | |
2143 | * as empty. | |
2144 | * | |
2145 | * Address space names are case sensitive, but avoid lowercase if possible. | |
2146 | * The same pointer may exist in multiple address spaces. | |
2147 | * | |
2148 | * Examples: | |
2149 | * blank+blank - valid (multiple things may be mapped in the same namespace) | |
2150 | * 'Sp'+'Sp' - valid (multiple things may be mapped in the same namespace) | |
2151 | * 'A'+'B' - valid (neither is a prefix of each other) | |
2152 | * 'S'+blank - valid ('S' is not in 0-9A-F) | |
2153 | * 'a'+blank - valid ('a' is not in 0-9A-F) | |
2154 | * 'a'+'A' - valid (neither is a prefix of each other) | |
2155 | * 'AR'+blank - valid ('R' is not in 0-9A-F) | |
2156 | * 'ARB'+blank - valid (the B can't be part of the address either, because | |
2157 | * there is no namespace 'AR') | |
2158 | * blank+'B' - not valid, because it's ambigous which address space B1234 | |
2159 | * would refer to. | |
2160 | * The length can't be used for that purpose; the frontend may want | |
2161 | * to append arbitrary data to an address, without a separator. */ | |
2162 | const char *addrspace; | |
2163 | ||
2164 | /* TODO: When finalizing this one, add a description field, which should be | |
2165 | * "WRAM" or something roughly equally long. */ | |
2166 | ||
2167 | /* TODO: When finalizing this one, replace 'select' with 'limit', which tells | |
2168 | * which bits can vary and still refer to the same address (limit = ~select). | |
2169 | * TODO: limit? range? vary? something else? */ | |
2170 | ||
2171 | /* TODO: When finalizing this one, if 'len' is above what 'select' (or | |
2172 | * 'limit') allows, it's bankswitched. Bankswitched data must have both 'len' | |
2173 | * and 'select' != 0, and the mappings don't tell how the system switches the | |
2174 | * banks. */ | |
2175 | ||
2176 | /* TODO: When finalizing this one, fix the 'len' bit removal order. | |
2177 | * For len=0x1800, pointer 0x1C00 should go to 0x1400, not 0x0C00. | |
2178 | * Algorithm: Take bits highest to lowest, but if it goes above len, clear | |
2179 | * the most recent addition and continue on the next bit. | |
2180 | * TODO: Can the above be optimized? Is "remove the lowest bit set in both | |
2181 | * pointer and 'len'" equivalent? */ | |
2182 | ||
2183 | /* TODO: Some emulators (MAME?) emulate big endian systems by only accessing | |
2184 | * the emulated memory in 32-bit chunks, native endian. But that's nothing | |
2185 | * compared to Darek Mihocka <http://www.emulators.com/docs/nx07_vm101.htm> | |
2186 | * (section Emulation 103 - Nearly Free Byte Reversal) - he flips the ENTIRE | |
2187 | * RAM backwards! I'll want to represent both of those, via some flags. | |
2188 | * | |
2189 | * I suspect MAME either didn't think of that idea, or don't want the #ifdef. | |
2190 | * Not sure which, nor do I really care. */ | |
2191 | ||
2192 | /* TODO: Some of those flags are unused and/or don't really make sense. Clean | |
2193 | * them up. */ | |
2194 | }; | |
2195 | ||
2196 | /* The frontend may use the largest value of 'start'+'select' in a | |
2197 | * certain namespace to infer the size of the address space. | |
2198 | * | |
2199 | * If the address space is larger than that, a mapping with .ptr=NULL | |
2200 | * should be at the end of the array, with .select set to all ones for | |
2201 | * as long as the address space is big. | |
2202 | * | |
2203 | * Sample descriptors (minus .ptr, and RETRO_MEMFLAG_ on the flags): | |
2204 | * SNES WRAM: | |
2205 | * .start=0x7E0000, .len=0x20000 | |
2206 | * (Note that this must be mapped before the ROM in most cases; some of the | |
2207 | * ROM mappers | |
2208 | * try to claim $7E0000, or at least $7E8000.) | |
2209 | * SNES SPC700 RAM: | |
2210 | * .addrspace="S", .len=0x10000 | |
2211 | * SNES WRAM mirrors: | |
2212 | * .flags=MIRROR, .start=0x000000, .select=0xC0E000, .len=0x2000 | |
2213 | * .flags=MIRROR, .start=0x800000, .select=0xC0E000, .len=0x2000 | |
2214 | * SNES WRAM mirrors, alternate equivalent descriptor: | |
2215 | * .flags=MIRROR, .select=0x40E000, .disconnect=~0x1FFF | |
2216 | * (Various similar constructions can be created by combining parts of | |
2217 | * the above two.) | |
2218 | * SNES LoROM (512KB, mirrored a couple of times): | |
2219 | * .flags=CONST, .start=0x008000, .select=0x408000, .disconnect=0x8000, .len=512*1024 | |
2220 | * .flags=CONST, .start=0x400000, .select=0x400000, .disconnect=0x8000, .len=512*1024 | |
2221 | * SNES HiROM (4MB): | |
2222 | * .flags=CONST, .start=0x400000, .select=0x400000, .len=4*1024*1024 | |
2223 | * .flags=CONST, .offset=0x8000, .start=0x008000, .select=0x408000, .len=4*1024*1024 | |
2224 | * SNES ExHiROM (8MB): | |
2225 | * .flags=CONST, .offset=0, .start=0xC00000, .select=0xC00000, .len=4*1024*1024 | |
2226 | * .flags=CONST, .offset=4*1024*1024, .start=0x400000, .select=0xC00000, .len=4*1024*1024 | |
2227 | * .flags=CONST, .offset=0x8000, .start=0x808000, .select=0xC08000, .len=4*1024*1024 | |
2228 | * .flags=CONST, .offset=4*1024*1024+0x8000, .start=0x008000, .select=0xC08000, .len=4*1024*1024 | |
2229 | * Clarify the size of the address space: | |
2230 | * .ptr=NULL, .select=0xFFFFFF | |
2231 | * .len can be implied by .select in many of them, but was included for clarity. | |
2232 | */ | |
2233 | ||
2234 | struct retro_memory_map | |
2235 | { | |
2236 | const struct retro_memory_descriptor *descriptors; | |
2237 | unsigned num_descriptors; | |
2238 | }; | |
2239 | ||
2240 | struct retro_controller_description | |
2241 | { | |
2242 | /* Human-readable description of the controller. Even if using a generic | |
2243 | * input device type, this can be set to the particular device type the | |
2244 | * core uses. */ | |
2245 | const char *desc; | |
2246 | ||
2247 | /* Device type passed to retro_set_controller_port_device(). If the device | |
2248 | * type is a sub-class of a generic input device type, use the | |
2249 | * RETRO_DEVICE_SUBCLASS macro to create an ID. | |
2250 | * | |
2251 | * E.g. RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 1). */ | |
2252 | unsigned id; | |
2253 | }; | |
2254 | ||
2255 | struct retro_controller_info | |
2256 | { | |
2257 | const struct retro_controller_description *types; | |
2258 | unsigned num_types; | |
2259 | }; | |
2260 | ||
2261 | struct retro_subsystem_memory_info | |
2262 | { | |
2263 | /* The extension associated with a memory type, e.g. "psram". */ | |
2264 | const char *extension; | |
2265 | ||
2266 | /* The memory type for retro_get_memory(). This should be at | |
2267 | * least 0x100 to avoid conflict with standardized | |
2268 | * libretro memory types. */ | |
2269 | unsigned type; | |
2270 | }; | |
2271 | ||
2272 | struct retro_subsystem_rom_info | |
2273 | { | |
2274 | /* Describes what the content is (SGB BIOS, GB ROM, etc). */ | |
2275 | const char *desc; | |
2276 | ||
2277 | /* Same definition as retro_get_system_info(). */ | |
2278 | const char *valid_extensions; | |
2279 | ||
2280 | /* Same definition as retro_get_system_info(). */ | |
2281 | bool need_fullpath; | |
2282 | ||
2283 | /* Same definition as retro_get_system_info(). */ | |
2284 | bool block_extract; | |
2285 | ||
2286 | /* This is set if the content is required to load a game. | |
2287 | * If this is set to false, a zeroed-out retro_game_info can be passed. */ | |
2288 | bool required; | |
2289 | ||
2290 | /* Content can have multiple associated persistent | |
2291 | * memory types (retro_get_memory()). */ | |
2292 | const struct retro_subsystem_memory_info *memory; | |
2293 | unsigned num_memory; | |
2294 | }; | |
2295 | ||
2296 | struct retro_subsystem_info | |
2297 | { | |
2298 | /* Human-readable string of the subsystem type, e.g. "Super GameBoy" */ | |
2299 | const char *desc; | |
2300 | ||
2301 | /* A computer friendly short string identifier for the subsystem type. | |
2302 | * This name must be [a-z]. | |
2303 | * E.g. if desc is "Super GameBoy", this can be "sgb". | |
2304 | * This identifier can be used for command-line interfaces, etc. | |
2305 | */ | |
2306 | const char *ident; | |
2307 | ||
2308 | /* Infos for each content file. The first entry is assumed to be the | |
2309 | * "most significant" content for frontend purposes. | |
2310 | * E.g. with Super GameBoy, the first content should be the GameBoy ROM, | |
2311 | * as it is the most "significant" content to a user. | |
2312 | * If a frontend creates new file paths based on the content used | |
2313 | * (e.g. savestates), it should use the path for the first ROM to do so. */ | |
2314 | const struct retro_subsystem_rom_info *roms; | |
2315 | ||
2316 | /* Number of content files associated with a subsystem. */ | |
2317 | unsigned num_roms; | |
2318 | ||
2319 | /* The type passed to retro_load_game_special(). */ | |
2320 | unsigned id; | |
2321 | }; | |
2322 | ||
2323 | typedef void (RETRO_CALLCONV *retro_proc_address_t)(void); | |
2324 | ||
2325 | /* libretro API extension functions: | |
2326 | * (None here so far). | |
2327 | * | |
2328 | * Get a symbol from a libretro core. | |
2329 | * Cores should only return symbols which are actual | |
2330 | * extensions to the libretro API. | |
2331 | * | |
2332 | * Frontends should not use this to obtain symbols to standard | |
2333 | * libretro entry points (static linking or dlsym). | |
2334 | * | |
2335 | * The symbol name must be equal to the function name, | |
2336 | * e.g. if void retro_foo(void); exists, the symbol must be called "retro_foo". | |
2337 | * The returned function pointer must be cast to the corresponding type. | |
2338 | */ | |
2339 | typedef retro_proc_address_t (RETRO_CALLCONV *retro_get_proc_address_t)(const char *sym); | |
2340 | ||
2341 | struct retro_get_proc_address_interface | |
2342 | { | |
2343 | retro_get_proc_address_t get_proc_address; | |
2344 | }; | |
2345 | ||
2346 | enum retro_log_level | |
2347 | { | |
2348 | RETRO_LOG_DEBUG = 0, | |
2349 | RETRO_LOG_INFO, | |
2350 | RETRO_LOG_WARN, | |
2351 | RETRO_LOG_ERROR, | |
2352 | ||
2353 | RETRO_LOG_DUMMY = INT_MAX | |
2354 | }; | |
2355 | ||
2356 | /* Logging function. Takes log level argument as well. */ | |
2357 | typedef void (RETRO_CALLCONV *retro_log_printf_t)(enum retro_log_level level, | |
2358 | const char *fmt, ...); | |
2359 | ||
2360 | struct retro_log_callback | |
2361 | { | |
2362 | retro_log_printf_t log; | |
2363 | }; | |
2364 | ||
2365 | /* Performance related functions */ | |
2366 | ||
2367 | /* ID values for SIMD CPU features */ | |
2368 | #define RETRO_SIMD_SSE (1 << 0) | |
2369 | #define RETRO_SIMD_SSE2 (1 << 1) | |
2370 | #define RETRO_SIMD_VMX (1 << 2) | |
2371 | #define RETRO_SIMD_VMX128 (1 << 3) | |
2372 | #define RETRO_SIMD_AVX (1 << 4) | |
2373 | #define RETRO_SIMD_NEON (1 << 5) | |
2374 | #define RETRO_SIMD_SSE3 (1 << 6) | |
2375 | #define RETRO_SIMD_SSSE3 (1 << 7) | |
2376 | #define RETRO_SIMD_MMX (1 << 8) | |
2377 | #define RETRO_SIMD_MMXEXT (1 << 9) | |
2378 | #define RETRO_SIMD_SSE4 (1 << 10) | |
2379 | #define RETRO_SIMD_SSE42 (1 << 11) | |
2380 | #define RETRO_SIMD_AVX2 (1 << 12) | |
2381 | #define RETRO_SIMD_VFPU (1 << 13) | |
2382 | #define RETRO_SIMD_PS (1 << 14) | |
2383 | #define RETRO_SIMD_AES (1 << 15) | |
2384 | #define RETRO_SIMD_VFPV3 (1 << 16) | |
2385 | #define RETRO_SIMD_VFPV4 (1 << 17) | |
2386 | #define RETRO_SIMD_POPCNT (1 << 18) | |
2387 | #define RETRO_SIMD_MOVBE (1 << 19) | |
2388 | #define RETRO_SIMD_CMOV (1 << 20) | |
2389 | #define RETRO_SIMD_ASIMD (1 << 21) | |
2390 | ||
2391 | typedef uint64_t retro_perf_tick_t; | |
2392 | typedef int64_t retro_time_t; | |
2393 | ||
2394 | struct retro_perf_counter | |
2395 | { | |
2396 | const char *ident; | |
2397 | retro_perf_tick_t start; | |
2398 | retro_perf_tick_t total; | |
2399 | retro_perf_tick_t call_cnt; | |
2400 | ||
2401 | bool registered; | |
2402 | }; | |
2403 | ||
2404 | /* Returns current time in microseconds. | |
2405 | * Tries to use the most accurate timer available. | |
2406 | */ | |
2407 | typedef retro_time_t (RETRO_CALLCONV *retro_perf_get_time_usec_t)(void); | |
2408 | ||
2409 | /* A simple counter. Usually nanoseconds, but can also be CPU cycles. | |
2410 | * Can be used directly if desired (when creating a more sophisticated | |
2411 | * performance counter system). | |
2412 | * */ | |
2413 | typedef retro_perf_tick_t (RETRO_CALLCONV *retro_perf_get_counter_t)(void); | |
2414 | ||
2415 | /* Returns a bit-mask of detected CPU features (RETRO_SIMD_*). */ | |
2416 | typedef uint64_t (RETRO_CALLCONV *retro_get_cpu_features_t)(void); | |
2417 | ||
2418 | /* Asks frontend to log and/or display the state of performance counters. | |
2419 | * Performance counters can always be poked into manually as well. | |
2420 | */ | |
2421 | typedef void (RETRO_CALLCONV *retro_perf_log_t)(void); | |
2422 | ||
2423 | /* Register a performance counter. | |
2424 | * ident field must be set with a discrete value and other values in | |
2425 | * retro_perf_counter must be 0. | |
2426 | * Registering can be called multiple times. To avoid calling to | |
2427 | * frontend redundantly, you can check registered field first. */ | |
2428 | typedef void (RETRO_CALLCONV *retro_perf_register_t)(struct retro_perf_counter *counter); | |
2429 | ||
2430 | /* Starts a registered counter. */ | |
2431 | typedef void (RETRO_CALLCONV *retro_perf_start_t)(struct retro_perf_counter *counter); | |
2432 | ||
2433 | /* Stops a registered counter. */ | |
2434 | typedef void (RETRO_CALLCONV *retro_perf_stop_t)(struct retro_perf_counter *counter); | |
2435 | ||
2436 | /* For convenience it can be useful to wrap register, start and stop in macros. | |
2437 | * E.g.: | |
2438 | * #ifdef LOG_PERFORMANCE | |
2439 | * #define RETRO_PERFORMANCE_INIT(perf_cb, name) static struct retro_perf_counter name = {#name}; if (!name.registered) perf_cb.perf_register(&(name)) | |
2440 | * #define RETRO_PERFORMANCE_START(perf_cb, name) perf_cb.perf_start(&(name)) | |
2441 | * #define RETRO_PERFORMANCE_STOP(perf_cb, name) perf_cb.perf_stop(&(name)) | |
2442 | * #else | |
2443 | * ... Blank macros ... | |
2444 | * #endif | |
2445 | * | |
2446 | * These can then be used mid-functions around code snippets. | |
2447 | * | |
2448 | * extern struct retro_perf_callback perf_cb; * Somewhere in the core. | |
2449 | * | |
2450 | * void do_some_heavy_work(void) | |
2451 | * { | |
2452 | * RETRO_PERFORMANCE_INIT(cb, work_1; | |
2453 | * RETRO_PERFORMANCE_START(cb, work_1); | |
2454 | * heavy_work_1(); | |
2455 | * RETRO_PERFORMANCE_STOP(cb, work_1); | |
2456 | * | |
2457 | * RETRO_PERFORMANCE_INIT(cb, work_2); | |
2458 | * RETRO_PERFORMANCE_START(cb, work_2); | |
2459 | * heavy_work_2(); | |
2460 | * RETRO_PERFORMANCE_STOP(cb, work_2); | |
2461 | * } | |
2462 | * | |
2463 | * void retro_deinit(void) | |
2464 | * { | |
2465 | * perf_cb.perf_log(); * Log all perf counters here for example. | |
2466 | * } | |
2467 | */ | |
2468 | ||
2469 | struct retro_perf_callback | |
2470 | { | |
2471 | retro_perf_get_time_usec_t get_time_usec; | |
2472 | retro_get_cpu_features_t get_cpu_features; | |
2473 | ||
2474 | retro_perf_get_counter_t get_perf_counter; | |
2475 | retro_perf_register_t perf_register; | |
2476 | retro_perf_start_t perf_start; | |
2477 | retro_perf_stop_t perf_stop; | |
2478 | retro_perf_log_t perf_log; | |
2479 | }; | |
2480 | ||
2481 | /* FIXME: Document the sensor API and work out behavior. | |
2482 | * It will be marked as experimental until then. | |
2483 | */ | |
2484 | enum retro_sensor_action | |
2485 | { | |
2486 | RETRO_SENSOR_ACCELEROMETER_ENABLE = 0, | |
2487 | RETRO_SENSOR_ACCELEROMETER_DISABLE, | |
2488 | RETRO_SENSOR_GYROSCOPE_ENABLE, | |
2489 | RETRO_SENSOR_GYROSCOPE_DISABLE, | |
2490 | RETRO_SENSOR_ILLUMINANCE_ENABLE, | |
2491 | RETRO_SENSOR_ILLUMINANCE_DISABLE, | |
2492 | ||
2493 | RETRO_SENSOR_DUMMY = INT_MAX | |
2494 | }; | |
2495 | ||
2496 | /* Id values for SENSOR types. */ | |
2497 | #define RETRO_SENSOR_ACCELEROMETER_X 0 | |
2498 | #define RETRO_SENSOR_ACCELEROMETER_Y 1 | |
2499 | #define RETRO_SENSOR_ACCELEROMETER_Z 2 | |
2500 | #define RETRO_SENSOR_GYROSCOPE_X 3 | |
2501 | #define RETRO_SENSOR_GYROSCOPE_Y 4 | |
2502 | #define RETRO_SENSOR_GYROSCOPE_Z 5 | |
2503 | #define RETRO_SENSOR_ILLUMINANCE 6 | |
2504 | ||
2505 | typedef bool (RETRO_CALLCONV *retro_set_sensor_state_t)(unsigned port, | |
2506 | enum retro_sensor_action action, unsigned rate); | |
2507 | ||
2508 | typedef float (RETRO_CALLCONV *retro_sensor_get_input_t)(unsigned port, unsigned id); | |
2509 | ||
2510 | struct retro_sensor_interface | |
2511 | { | |
2512 | retro_set_sensor_state_t set_sensor_state; | |
2513 | retro_sensor_get_input_t get_sensor_input; | |
2514 | }; | |
2515 | ||
2516 | enum retro_camera_buffer | |
2517 | { | |
2518 | RETRO_CAMERA_BUFFER_OPENGL_TEXTURE = 0, | |
2519 | RETRO_CAMERA_BUFFER_RAW_FRAMEBUFFER, | |
2520 | ||
2521 | RETRO_CAMERA_BUFFER_DUMMY = INT_MAX | |
2522 | }; | |
2523 | ||
2524 | /* Starts the camera driver. Can only be called in retro_run(). */ | |
2525 | typedef bool (RETRO_CALLCONV *retro_camera_start_t)(void); | |
2526 | ||
2527 | /* Stops the camera driver. Can only be called in retro_run(). */ | |
2528 | typedef void (RETRO_CALLCONV *retro_camera_stop_t)(void); | |
2529 | ||
2530 | /* Callback which signals when the camera driver is initialized | |
2531 | * and/or deinitialized. | |
2532 | * retro_camera_start_t can be called in initialized callback. | |
2533 | */ | |
2534 | typedef void (RETRO_CALLCONV *retro_camera_lifetime_status_t)(void); | |
2535 | ||
2536 | /* A callback for raw framebuffer data. buffer points to an XRGB8888 buffer. | |
2537 | * Width, height and pitch are similar to retro_video_refresh_t. | |
2538 | * First pixel is top-left origin. | |
2539 | */ | |
2540 | typedef void (RETRO_CALLCONV *retro_camera_frame_raw_framebuffer_t)(const uint32_t *buffer, | |
2541 | unsigned width, unsigned height, size_t pitch); | |
2542 | ||
2543 | /* A callback for when OpenGL textures are used. | |
2544 | * | |
2545 | * texture_id is a texture owned by camera driver. | |
2546 | * Its state or content should be considered immutable, except for things like | |
2547 | * texture filtering and clamping. | |
2548 | * | |
2549 | * texture_target is the texture target for the GL texture. | |
2550 | * These can include e.g. GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE, and possibly | |
2551 | * more depending on extensions. | |
2552 | * | |
2553 | * affine points to a packed 3x3 column-major matrix used to apply an affine | |
2554 | * transform to texture coordinates. (affine_matrix * vec3(coord_x, coord_y, 1.0)) | |
2555 | * After transform, normalized texture coord (0, 0) should be bottom-left | |
2556 | * and (1, 1) should be top-right (or (width, height) for RECTANGLE). | |
2557 | * | |
2558 | * GL-specific typedefs are avoided here to avoid relying on gl.h in | |
2559 | * the API definition. | |
2560 | */ | |
2561 | typedef void (RETRO_CALLCONV *retro_camera_frame_opengl_texture_t)(unsigned texture_id, | |
2562 | unsigned texture_target, const float *affine); | |
2563 | ||
2564 | struct retro_camera_callback | |
2565 | { | |
2566 | /* Set by libretro core. | |
2567 | * Example bitmask: caps = (1 << RETRO_CAMERA_BUFFER_OPENGL_TEXTURE) | (1 << RETRO_CAMERA_BUFFER_RAW_FRAMEBUFFER). | |
2568 | */ | |
2569 | uint64_t caps; | |
2570 | ||
2571 | /* Desired resolution for camera. Is only used as a hint. */ | |
2572 | unsigned width; | |
2573 | unsigned height; | |
2574 | ||
2575 | /* Set by frontend. */ | |
2576 | retro_camera_start_t start; | |
2577 | retro_camera_stop_t stop; | |
2578 | ||
2579 | /* Set by libretro core if raw framebuffer callbacks will be used. */ | |
2580 | retro_camera_frame_raw_framebuffer_t frame_raw_framebuffer; | |
2581 | ||
2582 | /* Set by libretro core if OpenGL texture callbacks will be used. */ | |
2583 | retro_camera_frame_opengl_texture_t frame_opengl_texture; | |
2584 | ||
2585 | /* Set by libretro core. Called after camera driver is initialized and | |
2586 | * ready to be started. | |
2587 | * Can be NULL, in which this callback is not called. | |
2588 | */ | |
2589 | retro_camera_lifetime_status_t initialized; | |
2590 | ||
2591 | /* Set by libretro core. Called right before camera driver is | |
2592 | * deinitialized. | |
2593 | * Can be NULL, in which this callback is not called. | |
2594 | */ | |
2595 | retro_camera_lifetime_status_t deinitialized; | |
2596 | }; | |
2597 | ||
2598 | /* Sets the interval of time and/or distance at which to update/poll | |
2599 | * location-based data. | |
2600 | * | |
2601 | * To ensure compatibility with all location-based implementations, | |
2602 | * values for both interval_ms and interval_distance should be provided. | |
2603 | * | |
2604 | * interval_ms is the interval expressed in milliseconds. | |
2605 | * interval_distance is the distance interval expressed in meters. | |
2606 | */ | |
2607 | typedef void (RETRO_CALLCONV *retro_location_set_interval_t)(unsigned interval_ms, | |
2608 | unsigned interval_distance); | |
2609 | ||
2610 | /* Start location services. The device will start listening for changes to the | |
2611 | * current location at regular intervals (which are defined with | |
2612 | * retro_location_set_interval_t). */ | |
2613 | typedef bool (RETRO_CALLCONV *retro_location_start_t)(void); | |
2614 | ||
2615 | /* Stop location services. The device will stop listening for changes | |
2616 | * to the current location. */ | |
2617 | typedef void (RETRO_CALLCONV *retro_location_stop_t)(void); | |
2618 | ||
2619 | /* Get the position of the current location. Will set parameters to | |
2620 | * 0 if no new location update has happened since the last time. */ | |
2621 | typedef bool (RETRO_CALLCONV *retro_location_get_position_t)(double *lat, double *lon, | |
2622 | double *horiz_accuracy, double *vert_accuracy); | |
2623 | ||
2624 | /* Callback which signals when the location driver is initialized | |
2625 | * and/or deinitialized. | |
2626 | * retro_location_start_t can be called in initialized callback. | |
2627 | */ | |
2628 | typedef void (RETRO_CALLCONV *retro_location_lifetime_status_t)(void); | |
2629 | ||
2630 | struct retro_location_callback | |
2631 | { | |
2632 | retro_location_start_t start; | |
2633 | retro_location_stop_t stop; | |
2634 | retro_location_get_position_t get_position; | |
2635 | retro_location_set_interval_t set_interval; | |
2636 | ||
2637 | retro_location_lifetime_status_t initialized; | |
2638 | retro_location_lifetime_status_t deinitialized; | |
2639 | }; | |
2640 | ||
2641 | enum retro_rumble_effect | |
2642 | { | |
2643 | RETRO_RUMBLE_STRONG = 0, | |
2644 | RETRO_RUMBLE_WEAK = 1, | |
2645 | ||
2646 | RETRO_RUMBLE_DUMMY = INT_MAX | |
2647 | }; | |
2648 | ||
2649 | /* Sets rumble state for joypad plugged in port 'port'. | |
2650 | * Rumble effects are controlled independently, | |
2651 | * and setting e.g. strong rumble does not override weak rumble. | |
2652 | * Strength has a range of [0, 0xffff]. | |
2653 | * | |
2654 | * Returns true if rumble state request was honored. | |
2655 | * Calling this before first retro_run() is likely to return false. */ | |
2656 | typedef bool (RETRO_CALLCONV *retro_set_rumble_state_t)(unsigned port, | |
2657 | enum retro_rumble_effect effect, uint16_t strength); | |
2658 | ||
2659 | struct retro_rumble_interface | |
2660 | { | |
2661 | retro_set_rumble_state_t set_rumble_state; | |
2662 | }; | |
2663 | ||
2664 | /* Notifies libretro that audio data should be written. */ | |
2665 | typedef void (RETRO_CALLCONV *retro_audio_callback_t)(void); | |
2666 | ||
2667 | /* True: Audio driver in frontend is active, and callback is | |
2668 | * expected to be called regularily. | |
2669 | * False: Audio driver in frontend is paused or inactive. | |
2670 | * Audio callback will not be called until set_state has been | |
2671 | * called with true. | |
2672 | * Initial state is false (inactive). | |
2673 | */ | |
2674 | typedef void (RETRO_CALLCONV *retro_audio_set_state_callback_t)(bool enabled); | |
2675 | ||
2676 | struct retro_audio_callback | |
2677 | { | |
2678 | retro_audio_callback_t callback; | |
2679 | retro_audio_set_state_callback_t set_state; | |
2680 | }; | |
2681 | ||
2682 | /* Notifies a libretro core of time spent since last invocation | |
2683 | * of retro_run() in microseconds. | |
2684 | * | |
2685 | * It will be called right before retro_run() every frame. | |
2686 | * The frontend can tamper with timing to support cases like | |
2687 | * fast-forward, slow-motion and framestepping. | |
2688 | * | |
2689 | * In those scenarios the reference frame time value will be used. */ | |
2690 | typedef int64_t retro_usec_t; | |
2691 | typedef void (RETRO_CALLCONV *retro_frame_time_callback_t)(retro_usec_t usec); | |
2692 | struct retro_frame_time_callback | |
2693 | { | |
2694 | retro_frame_time_callback_t callback; | |
2695 | /* Represents the time of one frame. It is computed as | |
2696 | * 1000000 / fps, but the implementation will resolve the | |
2697 | * rounding to ensure that framestepping, etc is exact. */ | |
2698 | retro_usec_t reference; | |
2699 | }; | |
2700 | ||
2701 | /* Notifies a libretro core of the current occupancy | |
2702 | * level of the frontend audio buffer. | |
2703 | * | |
2704 | * - active: 'true' if audio buffer is currently | |
2705 | * in use. Will be 'false' if audio is | |
2706 | * disabled in the frontend | |
2707 | * | |
2708 | * - occupancy: Given as a value in the range [0,100], | |
2709 | * corresponding to the occupancy percentage | |
2710 | * of the audio buffer | |
2711 | * | |
2712 | * - underrun_likely: 'true' if the frontend expects an | |
2713 | * audio buffer underrun during the | |
2714 | * next frame (indicates that a core | |
2715 | * should attempt frame skipping) | |
2716 | * | |
2717 | * It will be called right before retro_run() every frame. */ | |
2718 | typedef void (RETRO_CALLCONV *retro_audio_buffer_status_callback_t)( | |
2719 | bool active, unsigned occupancy, bool underrun_likely); | |
2720 | struct retro_audio_buffer_status_callback | |
2721 | { | |
2722 | retro_audio_buffer_status_callback_t callback; | |
2723 | }; | |
2724 | ||
2725 | /* Pass this to retro_video_refresh_t if rendering to hardware. | |
2726 | * Passing NULL to retro_video_refresh_t is still a frame dupe as normal. | |
2727 | * */ | |
2728 | #define RETRO_HW_FRAME_BUFFER_VALID ((void*)-1) | |
2729 | ||
2730 | /* Invalidates the current HW context. | |
2731 | * Any GL state is lost, and must not be deinitialized explicitly. | |
2732 | * If explicit deinitialization is desired by the libretro core, | |
2733 | * it should implement context_destroy callback. | |
2734 | * If called, all GPU resources must be reinitialized. | |
2735 | * Usually called when frontend reinits video driver. | |
2736 | * Also called first time video driver is initialized, | |
2737 | * allowing libretro core to initialize resources. | |
2738 | */ | |
2739 | typedef void (RETRO_CALLCONV *retro_hw_context_reset_t)(void); | |
2740 | ||
2741 | /* Gets current framebuffer which is to be rendered to. | |
2742 | * Could change every frame potentially. | |
2743 | */ | |
2744 | typedef uintptr_t (RETRO_CALLCONV *retro_hw_get_current_framebuffer_t)(void); | |
2745 | ||
2746 | /* Get a symbol from HW context. */ | |
2747 | typedef retro_proc_address_t (RETRO_CALLCONV *retro_hw_get_proc_address_t)(const char *sym); | |
2748 | ||
2749 | enum retro_hw_context_type | |
2750 | { | |
2751 | RETRO_HW_CONTEXT_NONE = 0, | |
2752 | /* OpenGL 2.x. Driver can choose to use latest compatibility context. */ | |
2753 | RETRO_HW_CONTEXT_OPENGL = 1, | |
2754 | /* OpenGL ES 2.0. */ | |
2755 | RETRO_HW_CONTEXT_OPENGLES2 = 2, | |
2756 | /* Modern desktop core GL context. Use version_major/ | |
2757 | * version_minor fields to set GL version. */ | |
2758 | RETRO_HW_CONTEXT_OPENGL_CORE = 3, | |
2759 | /* OpenGL ES 3.0 */ | |
2760 | RETRO_HW_CONTEXT_OPENGLES3 = 4, | |
2761 | /* OpenGL ES 3.1+. Set version_major/version_minor. For GLES2 and GLES3, | |
2762 | * use the corresponding enums directly. */ | |
2763 | RETRO_HW_CONTEXT_OPENGLES_VERSION = 5, | |
2764 | ||
2765 | /* Vulkan, see RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE. */ | |
2766 | RETRO_HW_CONTEXT_VULKAN = 6, | |
2767 | ||
2768 | /* Direct3D11, see RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE */ | |
2769 | RETRO_HW_CONTEXT_D3D11 = 7, | |
2770 | ||
2771 | /* Direct3D10, see RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE */ | |
2772 | RETRO_HW_CONTEXT_D3D10 = 8, | |
2773 | ||
2774 | /* Direct3D12, see RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE */ | |
2775 | RETRO_HW_CONTEXT_D3D12 = 9, | |
2776 | ||
2777 | /* Direct3D9, see RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE */ | |
2778 | RETRO_HW_CONTEXT_D3D9 = 10, | |
2779 | ||
2780 | RETRO_HW_CONTEXT_DUMMY = INT_MAX | |
2781 | }; | |
2782 | ||
2783 | struct retro_hw_render_callback | |
2784 | { | |
2785 | /* Which API to use. Set by libretro core. */ | |
2786 | enum retro_hw_context_type context_type; | |
2787 | ||
2788 | /* Called when a context has been created or when it has been reset. | |
2789 | * An OpenGL context is only valid after context_reset() has been called. | |
2790 | * | |
2791 | * When context_reset is called, OpenGL resources in the libretro | |
2792 | * implementation are guaranteed to be invalid. | |
2793 | * | |
2794 | * It is possible that context_reset is called multiple times during an | |
2795 | * application lifecycle. | |
2796 | * If context_reset is called without any notification (context_destroy), | |
2797 | * the OpenGL context was lost and resources should just be recreated | |
2798 | * without any attempt to "free" old resources. | |
2799 | */ | |
2800 | retro_hw_context_reset_t context_reset; | |
2801 | ||
2802 | /* Set by frontend. | |
2803 | * TODO: This is rather obsolete. The frontend should not | |
2804 | * be providing preallocated framebuffers. */ | |
2805 | retro_hw_get_current_framebuffer_t get_current_framebuffer; | |
2806 | ||
2807 | /* Set by frontend. | |
2808 | * Can return all relevant functions, including glClear on Windows. */ | |
2809 | retro_hw_get_proc_address_t get_proc_address; | |
2810 | ||
2811 | /* Set if render buffers should have depth component attached. | |
2812 | * TODO: Obsolete. */ | |
2813 | bool depth; | |
2814 | ||
2815 | /* Set if stencil buffers should be attached. | |
2816 | * TODO: Obsolete. */ | |
2817 | bool stencil; | |
2818 | ||
2819 | /* If depth and stencil are true, a packed 24/8 buffer will be added. | |
2820 | * Only attaching stencil is invalid and will be ignored. */ | |
2821 | ||
2822 | /* Use conventional bottom-left origin convention. If false, | |
2823 | * standard libretro top-left origin semantics are used. | |
2824 | * TODO: Move to GL specific interface. */ | |
2825 | bool bottom_left_origin; | |
2826 | ||
2827 | /* Major version number for core GL context or GLES 3.1+. */ | |
2828 | unsigned version_major; | |
2829 | ||
2830 | /* Minor version number for core GL context or GLES 3.1+. */ | |
2831 | unsigned version_minor; | |
2832 | ||
2833 | /* If this is true, the frontend will go very far to avoid | |
2834 | * resetting context in scenarios like toggling fullscreen, etc. | |
2835 | * TODO: Obsolete? Maybe frontend should just always assume this ... | |
2836 | */ | |
2837 | bool cache_context; | |
2838 | ||
2839 | /* The reset callback might still be called in extreme situations | |
2840 | * such as if the context is lost beyond recovery. | |
2841 | * | |
2842 | * For optimal stability, set this to false, and allow context to be | |
2843 | * reset at any time. | |
2844 | */ | |
2845 | ||
2846 | /* A callback to be called before the context is destroyed in a | |
2847 | * controlled way by the frontend. */ | |
2848 | retro_hw_context_reset_t context_destroy; | |
2849 | ||
2850 | /* OpenGL resources can be deinitialized cleanly at this step. | |
2851 | * context_destroy can be set to NULL, in which resources will | |
2852 | * just be destroyed without any notification. | |
2853 | * | |
2854 | * Even when context_destroy is non-NULL, it is possible that | |
2855 | * context_reset is called without any destroy notification. | |
2856 | * This happens if context is lost by external factors (such as | |
2857 | * notified by GL_ARB_robustness). | |
2858 | * | |
2859 | * In this case, the context is assumed to be already dead, | |
2860 | * and the libretro implementation must not try to free any OpenGL | |
2861 | * resources in the subsequent context_reset. | |
2862 | */ | |
2863 | ||
2864 | /* Creates a debug context. */ | |
2865 | bool debug_context; | |
2866 | }; | |
2867 | ||
2868 | /* Callback type passed in RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK. | |
2869 | * Called by the frontend in response to keyboard events. | |
2870 | * down is set if the key is being pressed, or false if it is being released. | |
2871 | * keycode is the RETROK value of the char. | |
2872 | * character is the text character of the pressed key. (UTF-32). | |
2873 | * key_modifiers is a set of RETROKMOD values or'ed together. | |
2874 | * | |
2875 | * The pressed/keycode state can be indepedent of the character. | |
2876 | * It is also possible that multiple characters are generated from a | |
2877 | * single keypress. | |
2878 | * Keycode events should be treated separately from character events. | |
2879 | * However, when possible, the frontend should try to synchronize these. | |
2880 | * If only a character is posted, keycode should be RETROK_UNKNOWN. | |
2881 | * | |
2882 | * Similarily if only a keycode event is generated with no corresponding | |
2883 | * character, character should be 0. | |
2884 | */ | |
2885 | typedef void (RETRO_CALLCONV *retro_keyboard_event_t)(bool down, unsigned keycode, | |
2886 | uint32_t character, uint16_t key_modifiers); | |
2887 | ||
2888 | struct retro_keyboard_callback | |
2889 | { | |
2890 | retro_keyboard_event_t callback; | |
2891 | }; | |
2892 | ||
2893 | /* Callbacks for RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE & | |
2894 | * RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE. | |
2895 | * Should be set for implementations which can swap out multiple disk | |
2896 | * images in runtime. | |
2897 | * | |
2898 | * If the implementation can do this automatically, it should strive to do so. | |
2899 | * However, there are cases where the user must manually do so. | |
2900 | * | |
2901 | * Overview: To swap a disk image, eject the disk image with | |
2902 | * set_eject_state(true). | |
2903 | * Set the disk index with set_image_index(index). Insert the disk again | |
2904 | * with set_eject_state(false). | |
2905 | */ | |
2906 | ||
2907 | /* If ejected is true, "ejects" the virtual disk tray. | |
2908 | * When ejected, the disk image index can be set. | |
2909 | */ | |
2910 | typedef bool (RETRO_CALLCONV *retro_set_eject_state_t)(bool ejected); | |
2911 | ||
2912 | /* Gets current eject state. The initial state is 'not ejected'. */ | |
2913 | typedef bool (RETRO_CALLCONV *retro_get_eject_state_t)(void); | |
2914 | ||
2915 | /* Gets current disk index. First disk is index 0. | |
2916 | * If return value is >= get_num_images(), no disk is currently inserted. | |
2917 | */ | |
2918 | typedef unsigned (RETRO_CALLCONV *retro_get_image_index_t)(void); | |
2919 | ||
2920 | /* Sets image index. Can only be called when disk is ejected. | |
2921 | * The implementation supports setting "no disk" by using an | |
2922 | * index >= get_num_images(). | |
2923 | */ | |
2924 | typedef bool (RETRO_CALLCONV *retro_set_image_index_t)(unsigned index); | |
2925 | ||
2926 | /* Gets total number of images which are available to use. */ | |
2927 | typedef unsigned (RETRO_CALLCONV *retro_get_num_images_t)(void); | |
2928 | ||
2929 | struct retro_game_info; | |
2930 | ||
2931 | /* Replaces the disk image associated with index. | |
2932 | * Arguments to pass in info have same requirements as retro_load_game(). | |
2933 | * Virtual disk tray must be ejected when calling this. | |
2934 | * | |
2935 | * Replacing a disk image with info = NULL will remove the disk image | |
2936 | * from the internal list. | |
2937 | * As a result, calls to get_image_index() can change. | |
2938 | * | |
2939 | * E.g. replace_image_index(1, NULL), and previous get_image_index() | |
2940 | * returned 4 before. | |
2941 | * Index 1 will be removed, and the new index is 3. | |
2942 | */ | |
2943 | typedef bool (RETRO_CALLCONV *retro_replace_image_index_t)(unsigned index, | |
2944 | const struct retro_game_info *info); | |
2945 | ||
2946 | /* Adds a new valid index (get_num_images()) to the internal disk list. | |
2947 | * This will increment subsequent return values from get_num_images() by 1. | |
2948 | * This image index cannot be used until a disk image has been set | |
2949 | * with replace_image_index. */ | |
2950 | typedef bool (RETRO_CALLCONV *retro_add_image_index_t)(void); | |
2951 | ||
2952 | /* Sets initial image to insert in drive when calling | |
2953 | * core_load_game(). | |
2954 | * Since we cannot pass the initial index when loading | |
2955 | * content (this would require a major API change), this | |
2956 | * is set by the frontend *before* calling the core's | |
2957 | * retro_load_game()/retro_load_game_special() implementation. | |
2958 | * A core should therefore cache the index/path values and handle | |
2959 | * them inside retro_load_game()/retro_load_game_special(). | |
2960 | * - If 'index' is invalid (index >= get_num_images()), the | |
2961 | * core should ignore the set value and instead use 0 | |
2962 | * - 'path' is used purely for error checking - i.e. when | |
2963 | * content is loaded, the core should verify that the | |
2964 | * disk specified by 'index' has the specified file path. | |
2965 | * This is to guard against auto selecting the wrong image | |
2966 | * if (for example) the user should modify an existing M3U | |
2967 | * playlist. We have to let the core handle this because | |
2968 | * set_initial_image() must be called before loading content, | |
2969 | * i.e. the frontend cannot access image paths in advance | |
2970 | * and thus cannot perform the error check itself. | |
2971 | * If set path and content path do not match, the core should | |
2972 | * ignore the set 'index' value and instead use 0 | |
2973 | * Returns 'false' if index or 'path' are invalid, or core | |
2974 | * does not support this functionality | |
2975 | */ | |
2976 | typedef bool (RETRO_CALLCONV *retro_set_initial_image_t)(unsigned index, const char *path); | |
2977 | ||
2978 | /* Fetches the path of the specified disk image file. | |
2979 | * Returns 'false' if index is invalid (index >= get_num_images()) | |
2980 | * or path is otherwise unavailable. | |
2981 | */ | |
2982 | typedef bool (RETRO_CALLCONV *retro_get_image_path_t)(unsigned index, char *path, size_t len); | |
2983 | ||
2984 | /* Fetches a core-provided 'label' for the specified disk | |
2985 | * image file. In the simplest case this may be a file name | |
2986 | * (without extension), but for cores with more complex | |
2987 | * content requirements information may be provided to | |
2988 | * facilitate user disk swapping - for example, a core | |
2989 | * running floppy-disk-based content may uniquely label | |
2990 | * save disks, data disks, level disks, etc. with names | |
2991 | * corresponding to in-game disk change prompts (so the | |
2992 | * frontend can provide better user guidance than a 'dumb' | |
2993 | * disk index value). | |
2994 | * Returns 'false' if index is invalid (index >= get_num_images()) | |
2995 | * or label is otherwise unavailable. | |
2996 | */ | |
2997 | typedef bool (RETRO_CALLCONV *retro_get_image_label_t)(unsigned index, char *label, size_t len); | |
2998 | ||
2999 | struct retro_disk_control_callback | |
3000 | { | |
3001 | retro_set_eject_state_t set_eject_state; | |
3002 | retro_get_eject_state_t get_eject_state; | |
3003 | ||
3004 | retro_get_image_index_t get_image_index; | |
3005 | retro_set_image_index_t set_image_index; | |
3006 | retro_get_num_images_t get_num_images; | |
3007 | ||
3008 | retro_replace_image_index_t replace_image_index; | |
3009 | retro_add_image_index_t add_image_index; | |
3010 | }; | |
3011 | ||
3012 | struct retro_disk_control_ext_callback | |
3013 | { | |
3014 | retro_set_eject_state_t set_eject_state; | |
3015 | retro_get_eject_state_t get_eject_state; | |
3016 | ||
3017 | retro_get_image_index_t get_image_index; | |
3018 | retro_set_image_index_t set_image_index; | |
3019 | retro_get_num_images_t get_num_images; | |
3020 | ||
3021 | retro_replace_image_index_t replace_image_index; | |
3022 | retro_add_image_index_t add_image_index; | |
3023 | ||
3024 | /* NOTE: Frontend will only attempt to record/restore | |
3025 | * last used disk index if both set_initial_image() | |
3026 | * and get_image_path() are implemented */ | |
3027 | retro_set_initial_image_t set_initial_image; /* Optional - may be NULL */ | |
3028 | ||
3029 | retro_get_image_path_t get_image_path; /* Optional - may be NULL */ | |
3030 | retro_get_image_label_t get_image_label; /* Optional - may be NULL */ | |
3031 | }; | |
3032 | ||
3033 | enum retro_pixel_format | |
3034 | { | |
3035 | /* 0RGB1555, native endian. | |
3036 | * 0 bit must be set to 0. | |
3037 | * This pixel format is default for compatibility concerns only. | |
3038 | * If a 15/16-bit pixel format is desired, consider using RGB565. */ | |
3039 | RETRO_PIXEL_FORMAT_0RGB1555 = 0, | |
3040 | ||
3041 | /* XRGB8888, native endian. | |
3042 | * X bits are ignored. */ | |
3043 | RETRO_PIXEL_FORMAT_XRGB8888 = 1, | |
3044 | ||
3045 | /* RGB565, native endian. | |
3046 | * This pixel format is the recommended format to use if a 15/16-bit | |
3047 | * format is desired as it is the pixel format that is typically | |
3048 | * available on a wide range of low-power devices. | |
3049 | * | |
3050 | * It is also natively supported in APIs like OpenGL ES. */ | |
3051 | RETRO_PIXEL_FORMAT_RGB565 = 2, | |
3052 | ||
3053 | /* Ensure sizeof() == sizeof(int). */ | |
3054 | RETRO_PIXEL_FORMAT_UNKNOWN = INT_MAX | |
3055 | }; | |
3056 | ||
3057 | enum retro_savestate_context | |
3058 | { | |
3059 | /* Standard savestate written to disk. */ | |
3060 | RETRO_SAVESTATE_CONTEXT_NORMAL = 0, | |
3061 | ||
3062 | /* Savestate where you are guaranteed that the same instance will load the save state. | |
3063 | * You can store internal pointers to code or data. | |
3064 | * It's still a full serialization and deserialization, and could be loaded or saved at any time. | |
3065 | * It won't be written to disk or sent over the network. | |
3066 | */ | |
3067 | RETRO_SAVESTATE_CONTEXT_RUNAHEAD_SAME_INSTANCE = 1, | |
3068 | ||
3069 | /* Savestate where you are guaranteed that the same emulator binary will load that savestate. | |
3070 | * You can skip anything that would slow down saving or loading state but you can not store internal pointers. | |
3071 | * It won't be written to disk or sent over the network. | |
3072 | * Example: "Second Instance" runahead | |
3073 | */ | |
3074 | RETRO_SAVESTATE_CONTEXT_RUNAHEAD_SAME_BINARY = 2, | |
3075 | ||
3076 | /* Savestate used within a rollback netplay feature. | |
3077 | * You should skip anything that would unnecessarily increase bandwidth usage. | |
3078 | * It won't be written to disk but it will be sent over the network. | |
3079 | */ | |
3080 | RETRO_SAVESTATE_CONTEXT_ROLLBACK_NETPLAY = 3, | |
3081 | ||
3082 | /* Ensure sizeof() == sizeof(int). */ | |
3083 | RETRO_SAVESTATE_CONTEXT_UNKNOWN = INT_MAX | |
3084 | }; | |
3085 | ||
3086 | struct retro_message | |
3087 | { | |
3088 | const char *msg; /* Message to be displayed. */ | |
3089 | unsigned frames; /* Duration in frames of message. */ | |
3090 | }; | |
3091 | ||
3092 | enum retro_message_target | |
3093 | { | |
3094 | RETRO_MESSAGE_TARGET_ALL = 0, | |
3095 | RETRO_MESSAGE_TARGET_OSD, | |
3096 | RETRO_MESSAGE_TARGET_LOG | |
3097 | }; | |
3098 | ||
3099 | enum retro_message_type | |
3100 | { | |
3101 | RETRO_MESSAGE_TYPE_NOTIFICATION = 0, | |
3102 | RETRO_MESSAGE_TYPE_NOTIFICATION_ALT, | |
3103 | RETRO_MESSAGE_TYPE_STATUS, | |
3104 | RETRO_MESSAGE_TYPE_PROGRESS | |
3105 | }; | |
3106 | ||
3107 | struct retro_message_ext | |
3108 | { | |
3109 | /* Message string to be displayed/logged */ | |
3110 | const char *msg; | |
3111 | /* Duration (in ms) of message when targeting the OSD */ | |
3112 | unsigned duration; | |
3113 | /* Message priority when targeting the OSD | |
3114 | * > When multiple concurrent messages are sent to | |
3115 | * the frontend and the frontend does not have the | |
3116 | * capacity to display them all, messages with the | |
3117 | * *highest* priority value should be shown | |
3118 | * > There is no upper limit to a message priority | |
3119 | * value (within the bounds of the unsigned data type) | |
3120 | * > In the reference frontend (RetroArch), the same | |
3121 | * priority values are used for frontend-generated | |
3122 | * notifications, which are typically assigned values | |
3123 | * between 0 and 3 depending upon importance */ | |
3124 | unsigned priority; | |
3125 | /* Message logging level (info, warn, error, etc.) */ | |
3126 | enum retro_log_level level; | |
3127 | /* Message destination: OSD, logging interface or both */ | |
3128 | enum retro_message_target target; | |
3129 | /* Message 'type' when targeting the OSD | |
3130 | * > RETRO_MESSAGE_TYPE_NOTIFICATION: Specifies that a | |
3131 | * message should be handled in identical fashion to | |
3132 | * a standard frontend-generated notification | |
3133 | * > RETRO_MESSAGE_TYPE_NOTIFICATION_ALT: Specifies that | |
3134 | * message is a notification that requires user attention | |
3135 | * or action, but that it should be displayed in a manner | |
3136 | * that differs from standard frontend-generated notifications. | |
3137 | * This would typically correspond to messages that should be | |
3138 | * displayed immediately (independently from any internal | |
3139 | * frontend message queue), and/or which should be visually | |
3140 | * distinguishable from frontend-generated notifications. | |
3141 | * For example, a core may wish to inform the user of | |
3142 | * information related to a disk-change event. It is | |
3143 | * expected that the frontend itself may provide a | |
3144 | * notification in this case; if the core sends a | |
3145 | * message of type RETRO_MESSAGE_TYPE_NOTIFICATION, an | |
3146 | * uncomfortable 'double-notification' may occur. A message | |
3147 | * of RETRO_MESSAGE_TYPE_NOTIFICATION_ALT should therefore | |
3148 | * be presented such that visual conflict with regular | |
3149 | * notifications does not occur | |
3150 | * > RETRO_MESSAGE_TYPE_STATUS: Indicates that message | |
3151 | * is not a standard notification. This typically | |
3152 | * corresponds to 'status' indicators, such as a core's | |
3153 | * internal FPS, which are intended to be displayed | |
3154 | * either permanently while a core is running, or in | |
3155 | * a manner that does not suggest user attention or action | |
3156 | * is required. 'Status' type messages should therefore be | |
3157 | * displayed in a different on-screen location and in a manner | |
3158 | * easily distinguishable from both standard frontend-generated | |
3159 | * notifications and messages of type RETRO_MESSAGE_TYPE_NOTIFICATION_ALT | |
3160 | * > RETRO_MESSAGE_TYPE_PROGRESS: Indicates that message reports | |
3161 | * the progress of an internal core task. For example, in cases | |
3162 | * where a core itself handles the loading of content from a file, | |
3163 | * this may correspond to the percentage of the file that has been | |
3164 | * read. Alternatively, an audio/video playback core may use a | |
3165 | * message of type RETRO_MESSAGE_TYPE_PROGRESS to display the current | |
3166 | * playback position as a percentage of the runtime. 'Progress' type | |
3167 | * messages should therefore be displayed as a literal progress bar, | |
3168 | * where: | |
3169 | * - 'retro_message_ext.msg' is the progress bar title/label | |
3170 | * - 'retro_message_ext.progress' determines the length of | |
3171 | * the progress bar | |
3172 | * NOTE: Message type is a *hint*, and may be ignored | |
3173 | * by the frontend. If a frontend lacks support for | |
3174 | * displaying messages via alternate means than standard | |
3175 | * frontend-generated notifications, it will treat *all* | |
3176 | * messages as having the type RETRO_MESSAGE_TYPE_NOTIFICATION */ | |
3177 | enum retro_message_type type; | |
3178 | /* Task progress when targeting the OSD and message is | |
3179 | * of type RETRO_MESSAGE_TYPE_PROGRESS | |
3180 | * > -1: Unmetered/indeterminate | |
3181 | * > 0-100: Current progress percentage | |
3182 | * NOTE: Since message type is a hint, a frontend may ignore | |
3183 | * progress values. Where relevant, a core should therefore | |
3184 | * include progress percentage within the message string, | |
3185 | * such that the message intent remains clear when displayed | |
3186 | * as a standard frontend-generated notification */ | |
3187 | int8_t progress; | |
3188 | }; | |
3189 | ||
3190 | /* Describes how the libretro implementation maps a libretro input bind | |
3191 | * to its internal input system through a human readable string. | |
3192 | * This string can be used to better let a user configure input. */ | |
3193 | struct retro_input_descriptor | |
3194 | { | |
3195 | /* Associates given parameters with a description. */ | |
3196 | unsigned port; | |
3197 | unsigned device; | |
3198 | unsigned index; | |
3199 | unsigned id; | |
3200 | ||
3201 | /* Human readable description for parameters. | |
3202 | * The pointer must remain valid until | |
3203 | * retro_unload_game() is called. */ | |
3204 | const char *description; | |
3205 | }; | |
3206 | ||
3207 | struct retro_system_info | |
3208 | { | |
3209 | /* All pointers are owned by libretro implementation, and pointers must | |
3210 | * remain valid until it is unloaded. */ | |
3211 | ||
3212 | const char *library_name; /* Descriptive name of library. Should not | |
3213 | * contain any version numbers, etc. */ | |
3214 | const char *library_version; /* Descriptive version of core. */ | |
3215 | ||
3216 | const char *valid_extensions; /* A string listing probably content | |
3217 | * extensions the core will be able to | |
3218 | * load, separated with pipe. | |
3219 | * I.e. "bin|rom|iso". | |
3220 | * Typically used for a GUI to filter | |
3221 | * out extensions. */ | |
3222 | ||
3223 | /* Libretro cores that need to have direct access to their content | |
3224 | * files, including cores which use the path of the content files to | |
3225 | * determine the paths of other files, should set need_fullpath to true. | |
3226 | * | |
3227 | * Cores should strive for setting need_fullpath to false, | |
3228 | * as it allows the frontend to perform patching, etc. | |
3229 | * | |
3230 | * If need_fullpath is true and retro_load_game() is called: | |
3231 | * - retro_game_info::path is guaranteed to have a valid path | |
3232 | * - retro_game_info::data and retro_game_info::size are invalid | |
3233 | * | |
3234 | * If need_fullpath is false and retro_load_game() is called: | |
3235 | * - retro_game_info::path may be NULL | |
3236 | * - retro_game_info::data and retro_game_info::size are guaranteed | |
3237 | * to be valid | |
3238 | * | |
3239 | * See also: | |
3240 | * - RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY | |
3241 | * - RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY | |
3242 | */ | |
3243 | bool need_fullpath; | |
3244 | ||
3245 | /* If true, the frontend is not allowed to extract any archives before | |
3246 | * loading the real content. | |
3247 | * Necessary for certain libretro implementations that load games | |
3248 | * from zipped archives. */ | |
3249 | bool block_extract; | |
3250 | }; | |
3251 | ||
3252 | /* Defines overrides which modify frontend handling of | |
3253 | * specific content file types. | |
3254 | * An array of retro_system_content_info_override is | |
3255 | * passed to RETRO_ENVIRONMENT_SET_CONTENT_INFO_OVERRIDE | |
3256 | * NOTE: In the following descriptions, references to | |
3257 | * retro_load_game() may be replaced with | |
3258 | * retro_load_game_special() */ | |
3259 | struct retro_system_content_info_override | |
3260 | { | |
3261 | /* A list of file extensions for which the override | |
3262 | * should apply, delimited by a 'pipe' character | |
3263 | * (e.g. "md|sms|gg") | |
3264 | * Permitted file extensions are limited to those | |
3265 | * included in retro_system_info::valid_extensions | |
3266 | * and/or retro_subsystem_rom_info::valid_extensions */ | |
3267 | const char *extensions; | |
3268 | ||
3269 | /* Overrides the need_fullpath value set in | |
3270 | * retro_system_info and/or retro_subsystem_rom_info. | |
3271 | * To reiterate: | |
3272 | * | |
3273 | * If need_fullpath is true and retro_load_game() is called: | |
3274 | * - retro_game_info::path is guaranteed to contain a valid | |
3275 | * path to an existent file | |
3276 | * - retro_game_info::data and retro_game_info::size are invalid | |
3277 | * | |
3278 | * If need_fullpath is false and retro_load_game() is called: | |
3279 | * - retro_game_info::path may be NULL | |
3280 | * - retro_game_info::data and retro_game_info::size are guaranteed | |
3281 | * to be valid | |
3282 | * | |
3283 | * In addition: | |
3284 | * | |
3285 | * If need_fullpath is true and retro_load_game() is called: | |
3286 | * - retro_game_info_ext::full_path is guaranteed to contain a valid | |
3287 | * path to an existent file | |
3288 | * - retro_game_info_ext::archive_path may be NULL | |
3289 | * - retro_game_info_ext::archive_file may be NULL | |
3290 | * - retro_game_info_ext::dir is guaranteed to contain a valid path | |
3291 | * to the directory in which the content file exists | |
3292 | * - retro_game_info_ext::name is guaranteed to contain the | |
3293 | * basename of the content file, without extension | |
3294 | * - retro_game_info_ext::ext is guaranteed to contain the | |
3295 | * extension of the content file in lower case format | |
3296 | * - retro_game_info_ext::data and retro_game_info_ext::size | |
3297 | * are invalid | |
3298 | * | |
3299 | * If need_fullpath is false and retro_load_game() is called: | |
3300 | * - If retro_game_info_ext::file_in_archive is false: | |
3301 | * - retro_game_info_ext::full_path is guaranteed to contain | |
3302 | * a valid path to an existent file | |
3303 | * - retro_game_info_ext::archive_path may be NULL | |
3304 | * - retro_game_info_ext::archive_file may be NULL | |
3305 | * - retro_game_info_ext::dir is guaranteed to contain a | |
3306 | * valid path to the directory in which the content file exists | |
3307 | * - retro_game_info_ext::name is guaranteed to contain the | |
3308 | * basename of the content file, without extension | |
3309 | * - retro_game_info_ext::ext is guaranteed to contain the | |
3310 | * extension of the content file in lower case format | |
3311 | * - If retro_game_info_ext::file_in_archive is true: | |
3312 | * - retro_game_info_ext::full_path may be NULL | |
3313 | * - retro_game_info_ext::archive_path is guaranteed to | |
3314 | * contain a valid path to an existent compressed file | |
3315 | * inside which the content file is located | |
3316 | * - retro_game_info_ext::archive_file is guaranteed to | |
3317 | * contain a valid path to an existent content file | |
3318 | * inside the compressed file referred to by | |
3319 | * retro_game_info_ext::archive_path | |
3320 | * e.g. for a compressed file '/path/to/foo.zip' | |
3321 | * containing 'bar.sfc' | |
3322 | * > retro_game_info_ext::archive_path will be '/path/to/foo.zip' | |
3323 | * > retro_game_info_ext::archive_file will be 'bar.sfc' | |
3324 | * - retro_game_info_ext::dir is guaranteed to contain a | |
3325 | * valid path to the directory in which the compressed file | |
3326 | * (containing the content file) exists | |
3327 | * - retro_game_info_ext::name is guaranteed to contain | |
3328 | * EITHER | |
3329 | * 1) the basename of the compressed file (containing | |
3330 | * the content file), without extension | |
3331 | * OR | |
3332 | * 2) the basename of the content file inside the | |
3333 | * compressed file, without extension | |
3334 | * In either case, a core should consider 'name' to | |
3335 | * be the canonical name/ID of the the content file | |
3336 | * - retro_game_info_ext::ext is guaranteed to contain the | |
3337 | * extension of the content file inside the compressed file, | |
3338 | * in lower case format | |
3339 | * - retro_game_info_ext::data and retro_game_info_ext::size are | |
3340 | * guaranteed to be valid */ | |
3341 | bool need_fullpath; | |
3342 | ||
3343 | /* If need_fullpath is false, specifies whether the content | |
3344 | * data buffer available in retro_load_game() is 'persistent' | |
3345 | * | |
3346 | * If persistent_data is false and retro_load_game() is called: | |
3347 | * - retro_game_info::data and retro_game_info::size | |
3348 | * are valid only until retro_load_game() returns | |
3349 | * - retro_game_info_ext::data and retro_game_info_ext::size | |
3350 | * are valid only until retro_load_game() returns | |
3351 | * | |
3352 | * If persistent_data is true and retro_load_game() is called: | |
3353 | * - retro_game_info::data and retro_game_info::size | |
3354 | * are valid until retro_deinit() returns | |
3355 | * - retro_game_info_ext::data and retro_game_info_ext::size | |
3356 | * are valid until retro_deinit() returns */ | |
3357 | bool persistent_data; | |
3358 | }; | |
3359 | ||
3360 | /* Similar to retro_game_info, but provides extended | |
3361 | * information about the source content file and | |
3362 | * game memory buffer status. | |
3363 | * And array of retro_game_info_ext is returned by | |
3364 | * RETRO_ENVIRONMENT_GET_GAME_INFO_EXT | |
3365 | * NOTE: In the following descriptions, references to | |
3366 | * retro_load_game() may be replaced with | |
3367 | * retro_load_game_special() */ | |
3368 | struct retro_game_info_ext | |
3369 | { | |
3370 | /* - If file_in_archive is false, contains a valid | |
3371 | * path to an existent content file (UTF-8 encoded) | |
3372 | * - If file_in_archive is true, may be NULL */ | |
3373 | const char *full_path; | |
3374 | ||
3375 | /* - If file_in_archive is false, may be NULL | |
3376 | * - If file_in_archive is true, contains a valid path | |
3377 | * to an existent compressed file inside which the | |
3378 | * content file is located (UTF-8 encoded) */ | |
3379 | const char *archive_path; | |
3380 | ||
3381 | /* - If file_in_archive is false, may be NULL | |
3382 | * - If file_in_archive is true, contain a valid path | |
3383 | * to an existent content file inside the compressed | |
3384 | * file referred to by archive_path (UTF-8 encoded) | |
3385 | * e.g. for a compressed file '/path/to/foo.zip' | |
3386 | * containing 'bar.sfc' | |
3387 | * > archive_path will be '/path/to/foo.zip' | |
3388 | * > archive_file will be 'bar.sfc' */ | |
3389 | const char *archive_file; | |
3390 | ||
3391 | /* - If file_in_archive is false, contains a valid path | |
3392 | * to the directory in which the content file exists | |
3393 | * (UTF-8 encoded) | |
3394 | * - If file_in_archive is true, contains a valid path | |
3395 | * to the directory in which the compressed file | |
3396 | * (containing the content file) exists (UTF-8 encoded) */ | |
3397 | const char *dir; | |
3398 | ||
3399 | /* Contains the canonical name/ID of the content file | |
3400 | * (UTF-8 encoded). Intended for use when identifying | |
3401 | * 'complementary' content named after the loaded file - | |
3402 | * i.e. companion data of a different format (a CD image | |
3403 | * required by a ROM), texture packs, internally handled | |
3404 | * save files, etc. | |
3405 | * - If file_in_archive is false, contains the basename | |
3406 | * of the content file, without extension | |
3407 | * - If file_in_archive is true, then string is | |
3408 | * implementation specific. A frontend may choose to | |
3409 | * set a name value of: | |
3410 | * EITHER | |
3411 | * 1) the basename of the compressed file (containing | |
3412 | * the content file), without extension | |
3413 | * OR | |
3414 | * 2) the basename of the content file inside the | |
3415 | * compressed file, without extension | |
3416 | * RetroArch sets the 'name' value according to (1). | |
3417 | * A frontend that supports routine loading of | |
3418 | * content from archives containing multiple unrelated | |
3419 | * content files may set the 'name' value according | |
3420 | * to (2). */ | |
3421 | const char *name; | |
3422 | ||
3423 | /* - If file_in_archive is false, contains the extension | |
3424 | * of the content file in lower case format | |
3425 | * - If file_in_archive is true, contains the extension | |
3426 | * of the content file inside the compressed file, | |
3427 | * in lower case format */ | |
3428 | const char *ext; | |
3429 | ||
3430 | /* String of implementation specific meta-data. */ | |
3431 | const char *meta; | |
3432 | ||
3433 | /* Memory buffer of loaded game content. Will be NULL: | |
3434 | * IF | |
3435 | * - retro_system_info::need_fullpath is true and | |
3436 | * retro_system_content_info_override::need_fullpath | |
3437 | * is unset | |
3438 | * OR | |
3439 | * - retro_system_content_info_override::need_fullpath | |
3440 | * is true */ | |
3441 | const void *data; | |
3442 | ||
3443 | /* Size of game content memory buffer, in bytes */ | |
3444 | size_t size; | |
3445 | ||
3446 | /* True if loaded content file is inside a compressed | |
3447 | * archive */ | |
3448 | bool file_in_archive; | |
3449 | ||
3450 | /* - If data is NULL, value is unset/ignored | |
3451 | * - If data is non-NULL: | |
3452 | * - If persistent_data is false, data and size are | |
3453 | * valid only until retro_load_game() returns | |
3454 | * - If persistent_data is true, data and size are | |
3455 | * are valid until retro_deinit() returns */ | |
3456 | bool persistent_data; | |
3457 | }; | |
3458 | ||
3459 | struct retro_game_geometry | |
3460 | { | |
3461 | unsigned base_width; /* Nominal video width of game. */ | |
3462 | unsigned base_height; /* Nominal video height of game. */ | |
3463 | unsigned max_width; /* Maximum possible width of game. */ | |
3464 | unsigned max_height; /* Maximum possible height of game. */ | |
3465 | ||
3466 | float aspect_ratio; /* Nominal aspect ratio of game. If | |
3467 | * aspect_ratio is <= 0.0, an aspect ratio | |
3468 | * of base_width / base_height is assumed. | |
3469 | * A frontend could override this setting, | |
3470 | * if desired. */ | |
3471 | }; | |
3472 | ||
3473 | struct retro_system_timing | |
3474 | { | |
3475 | double fps; /* FPS of video content. */ | |
3476 | double sample_rate; /* Sampling rate of audio. */ | |
3477 | }; | |
3478 | ||
3479 | struct retro_system_av_info | |
3480 | { | |
3481 | struct retro_game_geometry geometry; | |
3482 | struct retro_system_timing timing; | |
3483 | }; | |
3484 | ||
3485 | struct retro_variable | |
3486 | { | |
3487 | /* Variable to query in RETRO_ENVIRONMENT_GET_VARIABLE. | |
3488 | * If NULL, obtains the complete environment string if more | |
3489 | * complex parsing is necessary. | |
3490 | * The environment string is formatted as key-value pairs | |
3491 | * delimited by semicolons as so: | |
3492 | * "key1=value1;key2=value2;..." | |
3493 | */ | |
3494 | const char *key; | |
3495 | ||
3496 | /* Value to be obtained. If key does not exist, it is set to NULL. */ | |
3497 | const char *value; | |
3498 | }; | |
3499 | ||
3500 | struct retro_core_option_display | |
3501 | { | |
3502 | /* Variable to configure in RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY */ | |
3503 | const char *key; | |
3504 | ||
3505 | /* Specifies whether variable should be displayed | |
3506 | * when presenting core options to the user */ | |
3507 | bool visible; | |
3508 | }; | |
3509 | ||
3510 | /* Maximum number of values permitted for a core option | |
3511 | * > Note: We have to set a maximum value due the limitations | |
3512 | * of the C language - i.e. it is not possible to create an | |
3513 | * array of structs each containing a variable sized array, | |
3514 | * so the retro_core_option_definition values array must | |
3515 | * have a fixed size. The size limit of 128 is a balancing | |
3516 | * act - it needs to be large enough to support all 'sane' | |
3517 | * core options, but setting it too large may impact low memory | |
3518 | * platforms. In practise, if a core option has more than | |
3519 | * 128 values then the implementation is likely flawed. | |
3520 | * To quote the above API reference: | |
3521 | * "The number of possible options should be very limited | |
3522 | * i.e. it should be feasible to cycle through options | |
3523 | * without a keyboard." | |
3524 | */ | |
3525 | #define RETRO_NUM_CORE_OPTION_VALUES_MAX 128 | |
3526 | ||
3527 | struct retro_core_option_value | |
3528 | { | |
3529 | /* Expected option value */ | |
3530 | const char *value; | |
3531 | ||
3532 | /* Human-readable value label. If NULL, value itself | |
3533 | * will be displayed by the frontend */ | |
3534 | const char *label; | |
3535 | }; | |
3536 | ||
3537 | struct retro_core_option_definition | |
3538 | { | |
3539 | /* Variable to query in RETRO_ENVIRONMENT_GET_VARIABLE. */ | |
3540 | const char *key; | |
3541 | ||
3542 | /* Human-readable core option description (used as menu label) */ | |
3543 | const char *desc; | |
3544 | ||
3545 | /* Human-readable core option information (used as menu sublabel) */ | |
3546 | const char *info; | |
3547 | ||
3548 | /* Array of retro_core_option_value structs, terminated by NULL */ | |
3549 | struct retro_core_option_value values[RETRO_NUM_CORE_OPTION_VALUES_MAX]; | |
3550 | ||
3551 | /* Default core option value. Must match one of the values | |
3552 | * in the retro_core_option_value array, otherwise will be | |
3553 | * ignored */ | |
3554 | const char *default_value; | |
3555 | }; | |
3556 | ||
3557 | #ifdef __PS3__ | |
3558 | #undef local | |
3559 | #endif | |
3560 | ||
3561 | struct retro_core_options_intl | |
3562 | { | |
3563 | /* Pointer to an array of retro_core_option_definition structs | |
3564 | * - US English implementation | |
3565 | * - Must point to a valid array */ | |
3566 | struct retro_core_option_definition *us; | |
3567 | ||
3568 | /* Pointer to an array of retro_core_option_definition structs | |
3569 | * - Implementation for current frontend language | |
3570 | * - May be NULL */ | |
3571 | struct retro_core_option_definition *local; | |
3572 | }; | |
3573 | ||
3574 | struct retro_core_option_v2_category | |
3575 | { | |
3576 | /* Variable uniquely identifying the | |
3577 | * option category. Valid key characters | |
3578 | * are [a-z, A-Z, 0-9, _, -] */ | |
3579 | const char *key; | |
3580 | ||
3581 | /* Human-readable category description | |
3582 | * > Used as category menu label when | |
3583 | * frontend has core option category | |
3584 | * support */ | |
3585 | const char *desc; | |
3586 | ||
3587 | /* Human-readable category information | |
3588 | * > Used as category menu sublabel when | |
3589 | * frontend has core option category | |
3590 | * support | |
3591 | * > Optional (may be NULL or an empty | |
3592 | * string) */ | |
3593 | const char *info; | |
3594 | }; | |
3595 | ||
3596 | struct retro_core_option_v2_definition | |
3597 | { | |
3598 | /* Variable to query in RETRO_ENVIRONMENT_GET_VARIABLE. | |
3599 | * Valid key characters are [a-z, A-Z, 0-9, _, -] */ | |
3600 | const char *key; | |
3601 | ||
3602 | /* Human-readable core option description | |
3603 | * > Used as menu label when frontend does | |
3604 | * not have core option category support | |
3605 | * e.g. "Video > Aspect Ratio" */ | |
3606 | const char *desc; | |
3607 | ||
3608 | /* Human-readable core option description | |
3609 | * > Used as menu label when frontend has | |
3610 | * core option category support | |
3611 | * e.g. "Aspect Ratio", where associated | |
3612 | * retro_core_option_v2_category::desc | |
3613 | * is "Video" | |
3614 | * > If empty or NULL, the string specified by | |
3615 | * desc will be used as the menu label | |
3616 | * > Will be ignored (and may be set to NULL) | |
3617 | * if category_key is empty or NULL */ | |
3618 | const char *desc_categorized; | |
3619 | ||
3620 | /* Human-readable core option information | |
3621 | * > Used as menu sublabel */ | |
3622 | const char *info; | |
3623 | ||
3624 | /* Human-readable core option information | |
3625 | * > Used as menu sublabel when frontend | |
3626 | * has core option category support | |
3627 | * (e.g. may be required when info text | |
3628 | * references an option by name/desc, | |
3629 | * and the desc/desc_categorized text | |
3630 | * for that option differ) | |
3631 | * > If empty or NULL, the string specified by | |
3632 | * info will be used as the menu sublabel | |
3633 | * > Will be ignored (and may be set to NULL) | |
3634 | * if category_key is empty or NULL */ | |
3635 | const char *info_categorized; | |
3636 | ||
3637 | /* Variable specifying category (e.g. "video", | |
3638 | * "audio") that will be assigned to the option | |
3639 | * if frontend has core option category support. | |
3640 | * > Categorized options will be displayed in a | |
3641 | * subsection/submenu of the frontend core | |
3642 | * option interface | |
3643 | * > Specified string must match one of the | |
3644 | * retro_core_option_v2_category::key values | |
3645 | * in the associated retro_core_option_v2_category | |
3646 | * array; If no match is not found, specified | |
3647 | * string will be considered as NULL | |
3648 | * > If specified string is empty or NULL, option will | |
3649 | * have no category and will be shown at the top | |
3650 | * level of the frontend core option interface */ | |
3651 | const char *category_key; | |
3652 | ||
3653 | /* Array of retro_core_option_value structs, terminated by NULL */ | |
3654 | struct retro_core_option_value values[RETRO_NUM_CORE_OPTION_VALUES_MAX]; | |
3655 | ||
3656 | /* Default core option value. Must match one of the values | |
3657 | * in the retro_core_option_value array, otherwise will be | |
3658 | * ignored */ | |
3659 | const char *default_value; | |
3660 | }; | |
3661 | ||
3662 | struct retro_core_options_v2 | |
3663 | { | |
3664 | /* Array of retro_core_option_v2_category structs, | |
3665 | * terminated by NULL | |
3666 | * > If NULL, all entries in definitions array | |
3667 | * will have no category and will be shown at | |
3668 | * the top level of the frontend core option | |
3669 | * interface | |
3670 | * > Will be ignored if frontend does not have | |
3671 | * core option category support */ | |
3672 | struct retro_core_option_v2_category *categories; | |
3673 | ||
3674 | /* Array of retro_core_option_v2_definition structs, | |
3675 | * terminated by NULL */ | |
3676 | struct retro_core_option_v2_definition *definitions; | |
3677 | }; | |
3678 | ||
3679 | struct retro_core_options_v2_intl | |
3680 | { | |
3681 | /* Pointer to a retro_core_options_v2 struct | |
3682 | * > US English implementation | |
3683 | * > Must point to a valid struct */ | |
3684 | struct retro_core_options_v2 *us; | |
3685 | ||
3686 | /* Pointer to a retro_core_options_v2 struct | |
3687 | * - Implementation for current frontend language | |
3688 | * - May be NULL */ | |
3689 | struct retro_core_options_v2 *local; | |
3690 | }; | |
3691 | ||
3692 | /* Used by the frontend to monitor changes in core option | |
3693 | * visibility. May be called each time any core option | |
3694 | * value is set via the frontend. | |
3695 | * - On each invocation, the core must update the visibility | |
3696 | * of any dynamically hidden options using the | |
3697 | * RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY environment | |
3698 | * callback. | |
3699 | * - On the first invocation, returns 'true' if the visibility | |
3700 | * of any core option has changed since the last call of | |
3701 | * retro_load_game() or retro_load_game_special(). | |
3702 | * - On each subsequent invocation, returns 'true' if the | |
3703 | * visibility of any core option has changed since the last | |
3704 | * time the function was called. */ | |
3705 | typedef bool (RETRO_CALLCONV *retro_core_options_update_display_callback_t)(void); | |
3706 | struct retro_core_options_update_display_callback | |
3707 | { | |
3708 | retro_core_options_update_display_callback_t callback; | |
3709 | }; | |
3710 | ||
3711 | struct retro_game_info | |
3712 | { | |
3713 | const char *path; /* Path to game, UTF-8 encoded. | |
3714 | * Sometimes used as a reference for building other paths. | |
3715 | * May be NULL if game was loaded from stdin or similar, | |
3716 | * but in this case some cores will be unable to load `data`. | |
3717 | * So, it is preferable to fabricate something here instead | |
3718 | * of passing NULL, which will help more cores to succeed. | |
3719 | * retro_system_info::need_fullpath requires | |
3720 | * that this path is valid. */ | |
3721 | const void *data; /* Memory buffer of loaded game. Will be NULL | |
3722 | * if need_fullpath was set. */ | |
3723 | size_t size; /* Size of memory buffer. */ | |
3724 | const char *meta; /* String of implementation specific meta-data. */ | |
3725 | }; | |
3726 | ||
3727 | #define RETRO_MEMORY_ACCESS_WRITE (1 << 0) | |
3728 | /* The core will write to the buffer provided by retro_framebuffer::data. */ | |
3729 | #define RETRO_MEMORY_ACCESS_READ (1 << 1) | |
3730 | /* The core will read from retro_framebuffer::data. */ | |
3731 | #define RETRO_MEMORY_TYPE_CACHED (1 << 0) | |
3732 | /* The memory in data is cached. | |
3733 | * If not cached, random writes and/or reading from the buffer is expected to be very slow. */ | |
3734 | struct retro_framebuffer | |
3735 | { | |
3736 | void *data; /* The framebuffer which the core can render into. | |
3737 | Set by frontend in GET_CURRENT_SOFTWARE_FRAMEBUFFER. | |
3738 | The initial contents of data are unspecified. */ | |
3739 | unsigned width; /* The framebuffer width used by the core. Set by core. */ | |
3740 | unsigned height; /* The framebuffer height used by the core. Set by core. */ | |
3741 | size_t pitch; /* The number of bytes between the beginning of a scanline, | |
3742 | and beginning of the next scanline. | |
3743 | Set by frontend in GET_CURRENT_SOFTWARE_FRAMEBUFFER. */ | |
3744 | enum retro_pixel_format format; /* The pixel format the core must use to render into data. | |
3745 | This format could differ from the format used in | |
3746 | SET_PIXEL_FORMAT. | |
3747 | Set by frontend in GET_CURRENT_SOFTWARE_FRAMEBUFFER. */ | |
3748 | ||
3749 | unsigned access_flags; /* How the core will access the memory in the framebuffer. | |
3750 | RETRO_MEMORY_ACCESS_* flags. | |
3751 | Set by core. */ | |
3752 | unsigned memory_flags; /* Flags telling core how the memory has been mapped. | |
3753 | RETRO_MEMORY_TYPE_* flags. | |
3754 | Set by frontend in GET_CURRENT_SOFTWARE_FRAMEBUFFER. */ | |
3755 | }; | |
3756 | ||
3757 | /* Used by a libretro core to override the current | |
3758 | * fastforwarding mode of the frontend */ | |
3759 | struct retro_fastforwarding_override | |
3760 | { | |
3761 | /* Specifies the runtime speed multiplier that | |
3762 | * will be applied when 'fastforward' is true. | |
3763 | * For example, a value of 5.0 when running 60 FPS | |
3764 | * content will cap the fast-forward rate at 300 FPS. | |
3765 | * Note that the target multiplier may not be achieved | |
3766 | * if the host hardware has insufficient processing | |
3767 | * power. | |
3768 | * Setting a value of 0.0 (or greater than 0.0 but | |
3769 | * less than 1.0) will result in an uncapped | |
3770 | * fast-forward rate (limited only by hardware | |
3771 | * capacity). | |
3772 | * If the value is negative, it will be ignored | |
3773 | * (i.e. the frontend will use a runtime speed | |
3774 | * multiplier of its own choosing) */ | |
3775 | float ratio; | |
3776 | ||
3777 | /* If true, fastforwarding mode will be enabled. | |
3778 | * If false, fastforwarding mode will be disabled. */ | |
3779 | bool fastforward; | |
3780 | ||
3781 | /* If true, and if supported by the frontend, an | |
3782 | * on-screen notification will be displayed while | |
3783 | * 'fastforward' is true. | |
3784 | * If false, and if supported by the frontend, any | |
3785 | * on-screen fast-forward notifications will be | |
3786 | * suppressed */ | |
3787 | bool notification; | |
3788 | ||
3789 | /* If true, the core will have sole control over | |
3790 | * when fastforwarding mode is enabled/disabled; | |
3791 | * the frontend will not be able to change the | |
3792 | * state set by 'fastforward' until either | |
3793 | * 'inhibit_toggle' is set to false, or the core | |
3794 | * is unloaded */ | |
3795 | bool inhibit_toggle; | |
3796 | }; | |
3797 | ||
3798 | /* During normal operation. Rate will be equal to the core's internal FPS. */ | |
3799 | #define RETRO_THROTTLE_NONE 0 | |
3800 | ||
3801 | /* While paused or stepping single frames. Rate will be 0. */ | |
3802 | #define RETRO_THROTTLE_FRAME_STEPPING 1 | |
3803 | ||
3804 | /* During fast forwarding. | |
3805 | * Rate will be 0 if not specifically limited to a maximum speed. */ | |
3806 | #define RETRO_THROTTLE_FAST_FORWARD 2 | |
3807 | ||
3808 | /* During slow motion. Rate will be less than the core's internal FPS. */ | |
3809 | #define RETRO_THROTTLE_SLOW_MOTION 3 | |
3810 | ||
3811 | /* While rewinding recorded save states. Rate can vary depending on the rewind | |
3812 | * speed or be 0 if the frontend is not aiming for a specific rate. */ | |
3813 | #define RETRO_THROTTLE_REWINDING 4 | |
3814 | ||
3815 | /* While vsync is active in the video driver and the target refresh rate is | |
3816 | * lower than the core's internal FPS. Rate is the target refresh rate. */ | |
3817 | #define RETRO_THROTTLE_VSYNC 5 | |
3818 | ||
3819 | /* When the frontend does not throttle in any way. Rate will be 0. | |
3820 | * An example could be if no vsync or audio output is active. */ | |
3821 | #define RETRO_THROTTLE_UNBLOCKED 6 | |
3822 | ||
3823 | struct retro_throttle_state | |
3824 | { | |
3825 | /* The current throttling mode. Should be one of the values above. */ | |
3826 | unsigned mode; | |
3827 | ||
3828 | /* How many times per second the frontend aims to call retro_run. | |
3829 | * Depending on the mode, it can be 0 if there is no known fixed rate. | |
3830 | * This won't be accurate if the total processing time of the core and | |
3831 | * the frontend is longer than what is available for one frame. */ | |
3832 | float rate; | |
3833 | }; | |
3834 | ||
3835 | /** | |
3836 | * Opaque handle to a microphone that's been opened for use. | |
3837 | * The underlying object is accessed or created with \c retro_microphone_interface_t. | |
3838 | */ | |
3839 | typedef struct retro_microphone retro_microphone_t; | |
3840 | ||
3841 | /** | |
3842 | * Parameters for configuring a microphone. | |
3843 | * Some of these might not be honored, | |
3844 | * depending on the available hardware and driver configuration. | |
3845 | */ | |
3846 | typedef struct retro_microphone_params | |
3847 | { | |
3848 | /** | |
3849 | * The desired sample rate of the microphone's input, in Hz. | |
3850 | * The microphone's input will be resampled, | |
3851 | * so cores can ask for whichever frequency they need. | |
3852 | * | |
3853 | * If zero, some reasonable default will be provided by the frontend | |
3854 | * (usually from its config file). | |
3855 | * | |
3856 | * @see retro_get_mic_rate_t | |
3857 | */ | |
3858 | unsigned rate; | |
3859 | } retro_microphone_params_t; | |
3860 | ||
3861 | /** | |
3862 | * @copydoc retro_microphone_interface::open_mic | |
3863 | */ | |
3864 | typedef retro_microphone_t *(RETRO_CALLCONV *retro_open_mic_t)(const retro_microphone_params_t *params); | |
3865 | ||
3866 | /** | |
3867 | * @copydoc retro_microphone_interface::close_mic | |
3868 | */ | |
3869 | typedef void (RETRO_CALLCONV *retro_close_mic_t)(retro_microphone_t *microphone); | |
3870 | ||
3871 | /** | |
3872 | * @copydoc retro_microphone_interface::get_params | |
3873 | */ | |
3874 | typedef bool (RETRO_CALLCONV *retro_get_mic_params_t)(const retro_microphone_t *microphone, retro_microphone_params_t *params); | |
3875 | ||
3876 | /** | |
3877 | * @copydoc retro_microphone_interface::set_mic_state | |
3878 | */ | |
3879 | typedef bool (RETRO_CALLCONV *retro_set_mic_state_t)(retro_microphone_t *microphone, bool state); | |
3880 | ||
3881 | /** | |
3882 | * @copydoc retro_microphone_interface::get_mic_state | |
3883 | */ | |
3884 | typedef bool (RETRO_CALLCONV *retro_get_mic_state_t)(const retro_microphone_t *microphone); | |
3885 | ||
3886 | /** | |
3887 | * @copydoc retro_microphone_interface::read_mic | |
3888 | */ | |
3889 | typedef int (RETRO_CALLCONV *retro_read_mic_t)(retro_microphone_t *microphone, int16_t* samples, size_t num_samples); | |
3890 | ||
3891 | /** | |
3892 | * The current version of the microphone interface. | |
3893 | * Will be incremented whenever \c retro_microphone_interface or \c retro_microphone_params_t | |
3894 | * receive new fields. | |
3895 | * | |
3896 | * Frontends using cores built against older mic interface versions | |
3897 | * should not access fields introduced in newer versions. | |
3898 | */ | |
3899 | #define RETRO_MICROPHONE_INTERFACE_VERSION 1 | |
3900 | ||
3901 | /** | |
3902 | * An interface for querying the microphone and accessing data read from it. | |
3903 | * | |
3904 | * @see RETRO_ENVIRONMENT_GET_MICROPHONE_INTERFACE | |
3905 | */ | |
3906 | struct retro_microphone_interface | |
3907 | { | |
3908 | /** | |
3909 | * The version of this microphone interface. | |
3910 | * Set by the core to request a particular version, | |
3911 | * and set by the frontend to indicate the returned version. | |
3912 | * 0 indicates that the interface is invalid or uninitialized. | |
3913 | */ | |
3914 | unsigned interface_version; | |
3915 | ||
3916 | /** | |
3917 | * Initializes a new microphone. | |
3918 | * Assuming that microphone support is enabled and provided by the frontend, | |
3919 | * cores may call this function whenever necessary. | |
3920 | * A microphone could be opened throughout a core's lifetime, | |
3921 | * or it could wait until a microphone is plugged in to the emulated device. | |
3922 | * | |
3923 | * The returned handle will be valid until it's freed, | |
3924 | * even if the audio driver is reinitialized. | |
3925 | * | |
3926 | * This function is not guaranteed to be thread-safe. | |
3927 | * | |
3928 | * @param args[in] Parameters used to create the microphone. | |
3929 | * May be \c NULL, in which case the default value of each parameter will be used. | |
3930 | * | |
3931 | * @returns Pointer to the newly-opened microphone, | |
3932 | * or \c NULL if one couldn't be opened. | |
3933 | * This likely means that no microphone is plugged in and recognized, | |
3934 | * or the maximum number of supported microphones has been reached. | |
3935 | * | |
3936 | * @note Microphones are \em inactive by default; | |
3937 | * to begin capturing audio, call \c set_mic_state. | |
3938 | * @see retro_microphone_params_t | |
3939 | */ | |
3940 | retro_open_mic_t open_mic; | |
3941 | ||
3942 | /** | |
3943 | * Closes a microphone that was initialized with \c open_mic. | |
3944 | * Calling this function will stop all microphone activity | |
3945 | * and free up the resources that it allocated. | |
3946 | * Afterwards, the handle is invalid and must not be used. | |
3947 | * | |
3948 | * A frontend may close opened microphones when unloading content, | |
3949 | * but this behavior is not guaranteed. | |
3950 | * Cores should close their microphones when exiting, just to be safe. | |
3951 | * | |
3952 | * @param microphone Pointer to the microphone that was allocated by \c open_mic. | |
3953 | * If \c NULL, this function does nothing. | |
3954 | * | |
3955 | * @note The handle might be reused if another microphone is opened later. | |
3956 | */ | |
3957 | retro_close_mic_t close_mic; | |
3958 | ||
3959 | /** | |
3960 | * Returns the configured parameters of this microphone. | |
3961 | * These may differ from what was requested depending on | |
3962 | * the driver and device configuration. | |
3963 | * | |
3964 | * Cores should check these values before they start fetching samples. | |
3965 | * | |
3966 | * Will not change after the mic was opened. | |
3967 | * | |
3968 | * @param microphone[in] Opaque handle to the microphone | |
3969 | * whose parameters will be retrieved. | |
3970 | * @param params[out] The parameters object that the | |
3971 | * microphone's parameters will be copied to. | |
3972 | * | |
3973 | * @return \c true if the parameters were retrieved, | |
3974 | * \c false if there was an error. | |
3975 | */ | |
3976 | retro_get_mic_params_t get_params; | |
3977 | ||
3978 | /** | |
3979 | * Enables or disables the given microphone. | |
3980 | * Microphones are disabled by default | |
3981 | * and must be explicitly enabled before they can be used. | |
3982 | * Disabled microphones will not process incoming audio samples, | |
3983 | * and will therefore have minimal impact on overall performance. | |
3984 | * Cores may enable microphones throughout their lifetime, | |
3985 | * or only for periods where they're needed. | |
3986 | * | |
3987 | * Cores that accept microphone input should be able to operate without it; | |
3988 | * we suggest substituting silence in this case. | |
3989 | * | |
3990 | * @param microphone Opaque handle to the microphone | |
3991 | * whose state will be adjusted. | |
3992 | * This will have been provided by \c open_mic. | |
3993 | * @param state \c true if the microphone should receive audio input, | |
3994 | * \c false if it should be idle. | |
3995 | * @returns \c true if the microphone's state was successfully set, | |
3996 | * \c false if \c microphone is invalid | |
3997 | * or if there was an error. | |
3998 | */ | |
3999 | retro_set_mic_state_t set_mic_state; | |
4000 | ||
4001 | /** | |
4002 | * Queries the active state of a microphone at the given index. | |
4003 | * Will return whether the microphone is enabled, | |
4004 | * even if the driver is paused. | |
4005 | * | |
4006 | * @param microphone Opaque handle to the microphone | |
4007 | * whose state will be queried. | |
4008 | * @return \c true if the provided \c microphone is valid and active, | |
4009 | * \c false if not or if there was an error. | |
4010 | */ | |
4011 | retro_get_mic_state_t get_mic_state; | |
4012 | ||
4013 | /** | |
4014 | * Retrieves the input processed by the microphone since the last call. | |
4015 | * \em Must be called every frame unless \c microphone is disabled, | |
4016 | * similar to how \c retro_audio_sample_batch_t works. | |
4017 | * | |
4018 | * @param[in] microphone Opaque handle to the microphone | |
4019 | * whose recent input will be retrieved. | |
4020 | * @param[out] samples The buffer that will be used to store the microphone's data. | |
4021 | * Microphone input is in mono (i.e. one number per sample). | |
4022 | * Should be large enough to accommodate the expected number of samples per frame; | |
4023 | * for example, a 44.1kHz sample rate at 60 FPS would require space for 735 samples. | |
4024 | * @param[in] num_samples The size of the data buffer in samples (\em not bytes). | |
4025 | * Microphone input is in mono, so a "frame" and a "sample" are equivalent in length here. | |
4026 | * | |
4027 | * @return The number of samples that were copied into \c samples. | |
4028 | * If \c microphone is pending driver initialization, | |
4029 | * this function will copy silence of the requested length into \c samples. | |
4030 | * | |
4031 | * Will return -1 if the microphone is disabled, | |
4032 | * the audio driver is paused, | |
4033 | * or there was an error. | |
4034 | */ | |
4035 | retro_read_mic_t read_mic; | |
4036 | }; | |
4037 | ||
4038 | /* Callbacks */ | |
4039 | ||
4040 | /* Environment callback. Gives implementations a way of performing | |
4041 | * uncommon tasks. Extensible. */ | |
4042 | typedef bool (RETRO_CALLCONV *retro_environment_t)(unsigned cmd, void *data); | |
4043 | ||
4044 | /* Render a frame. Pixel format is 15-bit 0RGB1555 native endian | |
4045 | * unless changed (see RETRO_ENVIRONMENT_SET_PIXEL_FORMAT). | |
4046 | * | |
4047 | * Width and height specify dimensions of buffer. | |
4048 | * Pitch specifices length in bytes between two lines in buffer. | |
4049 | * | |
4050 | * For performance reasons, it is highly recommended to have a frame | |
4051 | * that is packed in memory, i.e. pitch == width * byte_per_pixel. | |
4052 | * Certain graphic APIs, such as OpenGL ES, do not like textures | |
4053 | * that are not packed in memory. | |
4054 | */ | |
4055 | typedef void (RETRO_CALLCONV *retro_video_refresh_t)(const void *data, unsigned width, | |
4056 | unsigned height, size_t pitch); | |
4057 | ||
4058 | /* Renders a single audio frame. Should only be used if implementation | |
4059 | * generates a single sample at a time. | |
4060 | * Format is signed 16-bit native endian. | |
4061 | */ | |
4062 | typedef void (RETRO_CALLCONV *retro_audio_sample_t)(int16_t left, int16_t right); | |
4063 | ||
4064 | /* Renders multiple audio frames in one go. | |
4065 | * | |
4066 | * One frame is defined as a sample of left and right channels, interleaved. | |
4067 | * I.e. int16_t buf[4] = { l, r, l, r }; would be 2 frames. | |
4068 | * Only one of the audio callbacks must ever be used. | |
4069 | */ | |
4070 | typedef size_t (RETRO_CALLCONV *retro_audio_sample_batch_t)(const int16_t *data, | |
4071 | size_t frames); | |
4072 | ||
4073 | /* Polls input. */ | |
4074 | typedef void (RETRO_CALLCONV *retro_input_poll_t)(void); | |
4075 | ||
4076 | /* Queries for input for player 'port'. device will be masked with | |
4077 | * RETRO_DEVICE_MASK. | |
4078 | * | |
4079 | * Specialization of devices such as RETRO_DEVICE_JOYPAD_MULTITAP that | |
4080 | * have been set with retro_set_controller_port_device() | |
4081 | * will still use the higher level RETRO_DEVICE_JOYPAD to request input. | |
4082 | */ | |
4083 | typedef int16_t (RETRO_CALLCONV *retro_input_state_t)(unsigned port, unsigned device, | |
4084 | unsigned index, unsigned id); | |
4085 | ||
4086 | /* Sets callbacks. retro_set_environment() is guaranteed to be called | |
4087 | * before retro_init(). | |
4088 | * | |
4089 | * The rest of the set_* functions are guaranteed to have been called | |
4090 | * before the first call to retro_run() is made. */ | |
4091 | RETRO_API void retro_set_environment(retro_environment_t); | |
4092 | RETRO_API void retro_set_video_refresh(retro_video_refresh_t); | |
4093 | RETRO_API void retro_set_audio_sample(retro_audio_sample_t); | |
4094 | RETRO_API void retro_set_audio_sample_batch(retro_audio_sample_batch_t); | |
4095 | RETRO_API void retro_set_input_poll(retro_input_poll_t); | |
4096 | RETRO_API void retro_set_input_state(retro_input_state_t); | |
4097 | ||
4098 | /* Library global initialization/deinitialization. */ | |
4099 | RETRO_API void retro_init(void); | |
4100 | RETRO_API void retro_deinit(void); | |
4101 | ||
4102 | /* Must return RETRO_API_VERSION. Used to validate ABI compatibility | |
4103 | * when the API is revised. */ | |
4104 | RETRO_API unsigned retro_api_version(void); | |
4105 | ||
4106 | /* Gets statically known system info. Pointers provided in *info | |
4107 | * must be statically allocated. | |
4108 | * Can be called at any time, even before retro_init(). */ | |
4109 | RETRO_API void retro_get_system_info(struct retro_system_info *info); | |
4110 | ||
4111 | /* Gets information about system audio/video timings and geometry. | |
4112 | * Can be called only after retro_load_game() has successfully completed. | |
4113 | * NOTE: The implementation of this function might not initialize every | |
4114 | * variable if needed. | |
4115 | * E.g. geom.aspect_ratio might not be initialized if core doesn't | |
4116 | * desire a particular aspect ratio. */ | |
4117 | RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info); | |
4118 | ||
4119 | /* Sets device to be used for player 'port'. | |
4120 | * By default, RETRO_DEVICE_JOYPAD is assumed to be plugged into all | |
4121 | * available ports. | |
4122 | * Setting a particular device type is not a guarantee that libretro cores | |
4123 | * will only poll input based on that particular device type. It is only a | |
4124 | * hint to the libretro core when a core cannot automatically detect the | |
4125 | * appropriate input device type on its own. It is also relevant when a | |
4126 | * core can change its behavior depending on device type. | |
4127 | * | |
4128 | * As part of the core's implementation of retro_set_controller_port_device, | |
4129 | * the core should call RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS to notify the | |
4130 | * frontend if the descriptions for any controls have changed as a | |
4131 | * result of changing the device type. | |
4132 | */ | |
4133 | RETRO_API void retro_set_controller_port_device(unsigned port, unsigned device); | |
4134 | ||
4135 | /* Resets the current game. */ | |
4136 | RETRO_API void retro_reset(void); | |
4137 | ||
4138 | /* Runs the game for one video frame. | |
4139 | * During retro_run(), input_poll callback must be called at least once. | |
4140 | * | |
4141 | * If a frame is not rendered for reasons where a game "dropped" a frame, | |
4142 | * this still counts as a frame, and retro_run() should explicitly dupe | |
4143 | * a frame if GET_CAN_DUPE returns true. | |
4144 | * In this case, the video callback can take a NULL argument for data. | |
4145 | */ | |
4146 | RETRO_API void retro_run(void); | |
4147 | ||
4148 | /* Returns the amount of data the implementation requires to serialize | |
4149 | * internal state (save states). | |
4150 | * Between calls to retro_load_game() and retro_unload_game(), the | |
4151 | * returned size is never allowed to be larger than a previous returned | |
4152 | * value, to ensure that the frontend can allocate a save state buffer once. | |
4153 | */ | |
4154 | RETRO_API size_t retro_serialize_size(void); | |
4155 | ||
4156 | /* Serializes internal state. If failed, or size is lower than | |
4157 | * retro_serialize_size(), it should return false, true otherwise. */ | |
4158 | RETRO_API bool retro_serialize(void *data, size_t size); | |
4159 | RETRO_API bool retro_unserialize(const void *data, size_t size); | |
4160 | ||
4161 | RETRO_API void retro_cheat_reset(void); | |
4162 | RETRO_API void retro_cheat_set(unsigned index, bool enabled, const char *code); | |
4163 | ||
4164 | /* Loads a game. | |
4165 | * Return true to indicate successful loading and false to indicate load failure. | |
4166 | */ | |
4167 | RETRO_API bool retro_load_game(const struct retro_game_info *game); | |
4168 | ||
4169 | /* Loads a "special" kind of game. Should not be used, | |
4170 | * except in extreme cases. */ | |
4171 | RETRO_API bool retro_load_game_special( | |
4172 | unsigned game_type, | |
4173 | const struct retro_game_info *info, size_t num_info | |
4174 | ); | |
4175 | ||
4176 | /* Unloads the currently loaded game. Called before retro_deinit(void). */ | |
4177 | RETRO_API void retro_unload_game(void); | |
4178 | ||
4179 | /* Gets region of game. */ | |
4180 | RETRO_API unsigned retro_get_region(void); | |
4181 | ||
4182 | /* Gets region of memory. */ | |
4183 | RETRO_API void *retro_get_memory_data(unsigned id); | |
4184 | RETRO_API size_t retro_get_memory_size(unsigned id); | |
4185 | ||
4186 | #ifdef __cplusplus | |
4187 | } | |
4188 | #endif | |
4189 | ||
4190 | #endif |