annotate libretro.h @ 2129:4c9e447aa25b

Pause word RAM DMA while word RAM is switched to main CPU
author Michael Pavone <pavone@retrodev.com>
date Sun, 13 Mar 2022 11:49:07 -0700
parents 6c54bb5fe3b3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1687
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1 /* Copyright (C) 2010-2017 The RetroArch team
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
3 * ---------------------------------------------------------------------------------------
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
4 * The following license statement only applies to this libretro API header (libretro.h).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
5 * ---------------------------------------------------------------------------------------
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
6 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
7 * Permission is hereby granted, free of charge,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
8 * to any person obtaining a copy of this software and associated documentation files (the "Software"),
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
9 * to deal in the Software without restriction, including without limitation the rights to
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
11 * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
12 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
13 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
14 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
16 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
19 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
21 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
22
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
23 #ifndef LIBRETRO_H__
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
24 #define LIBRETRO_H__
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
25
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
26 #include <stdint.h>
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
27 #include <stddef.h>
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
28 #include <limits.h>
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
29
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
30 #ifdef __cplusplus
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
31 extern "C" {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
32 #endif
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
33
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
34 #ifndef __cplusplus
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
35 #if defined(_MSC_VER) && _MSC_VER < 1800 && !defined(SN_TARGET_PS3)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
36 /* Hack applied for MSVC when compiling in C89 mode
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
37 * as it isn't C99-compliant. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
38 #define bool unsigned char
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
39 #define true 1
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
40 #define false 0
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
41 #else
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
42 #include <stdbool.h>
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
43 #endif
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
44 #endif
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
45
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
46 #ifndef RETRO_CALLCONV
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
47 # if defined(__GNUC__) && defined(__i386__) && !defined(__x86_64__)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
48 # define RETRO_CALLCONV __attribute__((cdecl))
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
49 # elif defined(_MSC_VER) && defined(_M_X86) && !defined(_M_X64)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
50 # define RETRO_CALLCONV __cdecl
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
51 # else
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
52 # define RETRO_CALLCONV /* all other platforms only have one calling convention each */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
53 # endif
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
54 #endif
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
55
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
56 #ifndef RETRO_API
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
57 # if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
58 # ifdef RETRO_IMPORT_SYMBOLS
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
59 # ifdef __GNUC__
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
60 # define RETRO_API RETRO_CALLCONV __attribute__((__dllimport__))
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
61 # else
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
62 # define RETRO_API RETRO_CALLCONV __declspec(dllimport)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
63 # endif
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
64 # else
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
65 # ifdef __GNUC__
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
66 # define RETRO_API RETRO_CALLCONV __attribute__((__dllexport__))
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
67 # else
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
68 # define RETRO_API RETRO_CALLCONV __declspec(dllexport)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
69 # endif
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
70 # endif
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
71 # else
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
72 # if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__CELLOS_LV2__)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
73 # define RETRO_API RETRO_CALLCONV __attribute__((__visibility__("default")))
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
74 # else
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
75 # define RETRO_API RETRO_CALLCONV
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
76 # endif
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
77 # endif
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
78 #endif
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
79
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
80 /* Used for checking API/ABI mismatches that can break libretro
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
81 * implementations.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
82 * It is not incremented for compatible changes to the API.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
83 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
84 #define RETRO_API_VERSION 1
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
85
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
86 /*
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
87 * Libretro's fundamental device abstractions.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
88 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
89 * Libretro's input system consists of some standardized device types,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
90 * such as a joypad (with/without analog), mouse, keyboard, lightgun
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
91 * and a pointer.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
92 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
93 * The functionality of these devices are fixed, and individual cores
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
94 * map their own concept of a controller to libretro's abstractions.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
95 * This makes it possible for frontends to map the abstract types to a
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
96 * real input device, and not having to worry about binding input
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
97 * correctly to arbitrary controller layouts.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
98 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
99
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
100 #define RETRO_DEVICE_TYPE_SHIFT 8
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
101 #define RETRO_DEVICE_MASK ((1 << RETRO_DEVICE_TYPE_SHIFT) - 1)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
102 #define RETRO_DEVICE_SUBCLASS(base, id) (((id + 1) << RETRO_DEVICE_TYPE_SHIFT) | base)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
103
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
104 /* Input disabled. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
105 #define RETRO_DEVICE_NONE 0
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
106
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
107 /* The JOYPAD is called RetroPad. It is essentially a Super Nintendo
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
108 * controller, but with additional L2/R2/L3/R3 buttons, similar to a
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
109 * PS1 DualShock. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
110 #define RETRO_DEVICE_JOYPAD 1
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
111
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
112 /* The mouse is a simple mouse, similar to Super Nintendo's mouse.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
113 * X and Y coordinates are reported relatively to last poll (poll callback).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
114 * It is up to the libretro implementation to keep track of where the mouse
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
115 * pointer is supposed to be on the screen.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
116 * The frontend must make sure not to interfere with its own hardware
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
117 * mouse pointer.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
118 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
119 #define RETRO_DEVICE_MOUSE 2
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
120
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
121 /* KEYBOARD device lets one poll for raw key pressed.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
122 * It is poll based, so input callback will return with the current
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
123 * pressed state.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
124 * For event/text based keyboard input, see
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
125 * RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
126 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
127 #define RETRO_DEVICE_KEYBOARD 3
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
128
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
129 /* LIGHTGUN device is similar to Guncon-2 for PlayStation 2.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
130 * It reports X/Y coordinates in screen space (similar to the pointer)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
131 * in the range [-0x8000, 0x7fff] in both axes, with zero being center.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
132 * As well as reporting on/off screen state. It features a trigger,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
133 * start/select buttons, auxiliary action buttons and a
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
134 * directional pad. A forced off-screen shot can be requested for
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
135 * auto-reloading function in some games.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
136 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
137 #define RETRO_DEVICE_LIGHTGUN 4
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
138
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
139 /* The ANALOG device is an extension to JOYPAD (RetroPad).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
140 * Similar to DualShock2 it adds two analog sticks and all buttons can
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
141 * be analog. This is treated as a separate device type as it returns
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
142 * axis values in the full analog range of [-0x8000, 0x7fff].
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
143 * Positive X axis is right. Positive Y axis is down.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
144 * Buttons are returned in the range [0, 0x7fff].
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
145 * Only use ANALOG type when polling for analog values.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
146 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
147 #define RETRO_DEVICE_ANALOG 5
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
148
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
149 /* Abstracts the concept of a pointing mechanism, e.g. touch.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
150 * This allows libretro to query in absolute coordinates where on the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
151 * screen a mouse (or something similar) is being placed.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
152 * For a touch centric device, coordinates reported are the coordinates
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
153 * of the press.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
154 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
155 * Coordinates in X and Y are reported as:
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
156 * [-0x7fff, 0x7fff]: -0x7fff corresponds to the far left/top of the screen,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
157 * and 0x7fff corresponds to the far right/bottom of the screen.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
158 * The "screen" is here defined as area that is passed to the frontend and
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
159 * later displayed on the monitor.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
160 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
161 * The frontend is free to scale/resize this screen as it sees fit, however,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
162 * (X, Y) = (-0x7fff, -0x7fff) will correspond to the top-left pixel of the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
163 * game image, etc.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
164 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
165 * To check if the pointer coordinates are valid (e.g. a touch display
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
166 * actually being touched), PRESSED returns 1 or 0.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
167 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
168 * If using a mouse on a desktop, PRESSED will usually correspond to the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
169 * left mouse button, but this is a frontend decision.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
170 * PRESSED will only return 1 if the pointer is inside the game screen.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
171 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
172 * For multi-touch, the index variable can be used to successively query
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
173 * more presses.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
174 * If index = 0 returns true for _PRESSED, coordinates can be extracted
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
175 * with _X, _Y for index = 0. One can then query _PRESSED, _X, _Y with
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
176 * index = 1, and so on.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
177 * Eventually _PRESSED will return false for an index. No further presses
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
178 * are registered at this point. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
179 #define RETRO_DEVICE_POINTER 6
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
180
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
181 /* Buttons for the RetroPad (JOYPAD).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
182 * The placement of these is equivalent to placements on the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
183 * Super Nintendo controller.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
184 * L2/R2/L3/R3 buttons correspond to the PS1 DualShock.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
185 * Also used as id values for RETRO_DEVICE_INDEX_ANALOG_BUTTON */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
186 #define RETRO_DEVICE_ID_JOYPAD_B 0
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
187 #define RETRO_DEVICE_ID_JOYPAD_Y 1
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
188 #define RETRO_DEVICE_ID_JOYPAD_SELECT 2
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
189 #define RETRO_DEVICE_ID_JOYPAD_START 3
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
190 #define RETRO_DEVICE_ID_JOYPAD_UP 4
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
191 #define RETRO_DEVICE_ID_JOYPAD_DOWN 5
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
192 #define RETRO_DEVICE_ID_JOYPAD_LEFT 6
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
193 #define RETRO_DEVICE_ID_JOYPAD_RIGHT 7
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
194 #define RETRO_DEVICE_ID_JOYPAD_A 8
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
195 #define RETRO_DEVICE_ID_JOYPAD_X 9
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
196 #define RETRO_DEVICE_ID_JOYPAD_L 10
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
197 #define RETRO_DEVICE_ID_JOYPAD_R 11
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
198 #define RETRO_DEVICE_ID_JOYPAD_L2 12
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
199 #define RETRO_DEVICE_ID_JOYPAD_R2 13
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
200 #define RETRO_DEVICE_ID_JOYPAD_L3 14
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
201 #define RETRO_DEVICE_ID_JOYPAD_R3 15
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
202
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
203 /* Index / Id values for ANALOG device. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
204 #define RETRO_DEVICE_INDEX_ANALOG_LEFT 0
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
205 #define RETRO_DEVICE_INDEX_ANALOG_RIGHT 1
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
206 #define RETRO_DEVICE_INDEX_ANALOG_BUTTON 2
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
207 #define RETRO_DEVICE_ID_ANALOG_X 0
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
208 #define RETRO_DEVICE_ID_ANALOG_Y 1
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
209
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
210 /* Id values for MOUSE. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
211 #define RETRO_DEVICE_ID_MOUSE_X 0
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
212 #define RETRO_DEVICE_ID_MOUSE_Y 1
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
213 #define RETRO_DEVICE_ID_MOUSE_LEFT 2
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
214 #define RETRO_DEVICE_ID_MOUSE_RIGHT 3
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
215 #define RETRO_DEVICE_ID_MOUSE_WHEELUP 4
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
216 #define RETRO_DEVICE_ID_MOUSE_WHEELDOWN 5
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
217 #define RETRO_DEVICE_ID_MOUSE_MIDDLE 6
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
218 #define RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP 7
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
219 #define RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN 8
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
220 #define RETRO_DEVICE_ID_MOUSE_BUTTON_4 9
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
221 #define RETRO_DEVICE_ID_MOUSE_BUTTON_5 10
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
222
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
223 /* Id values for LIGHTGUN. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
224 #define RETRO_DEVICE_ID_LIGHTGUN_SCREEN_X 13 /*Absolute Position*/
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
225 #define RETRO_DEVICE_ID_LIGHTGUN_SCREEN_Y 14 /*Absolute*/
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
226 #define RETRO_DEVICE_ID_LIGHTGUN_IS_OFFSCREEN 15 /*Status Check*/
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
227 #define RETRO_DEVICE_ID_LIGHTGUN_TRIGGER 2
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
228 #define RETRO_DEVICE_ID_LIGHTGUN_RELOAD 16 /*Forced off-screen shot*/
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
229 #define RETRO_DEVICE_ID_LIGHTGUN_AUX_A 3
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
230 #define RETRO_DEVICE_ID_LIGHTGUN_AUX_B 4
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
231 #define RETRO_DEVICE_ID_LIGHTGUN_START 6
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
232 #define RETRO_DEVICE_ID_LIGHTGUN_SELECT 7
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
233 #define RETRO_DEVICE_ID_LIGHTGUN_AUX_C 8
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
234 #define RETRO_DEVICE_ID_LIGHTGUN_DPAD_UP 9
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
235 #define RETRO_DEVICE_ID_LIGHTGUN_DPAD_DOWN 10
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
236 #define RETRO_DEVICE_ID_LIGHTGUN_DPAD_LEFT 11
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
237 #define RETRO_DEVICE_ID_LIGHTGUN_DPAD_RIGHT 12
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
238 /* deprecated */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
239 #define RETRO_DEVICE_ID_LIGHTGUN_X 0 /*Relative Position*/
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
240 #define RETRO_DEVICE_ID_LIGHTGUN_Y 1 /*Relative*/
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
241 #define RETRO_DEVICE_ID_LIGHTGUN_CURSOR 3 /*Use Aux:A*/
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
242 #define RETRO_DEVICE_ID_LIGHTGUN_TURBO 4 /*Use Aux:B*/
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
243 #define RETRO_DEVICE_ID_LIGHTGUN_PAUSE 5 /*Use Start*/
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
244
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
245 /* Id values for POINTER. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
246 #define RETRO_DEVICE_ID_POINTER_X 0
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
247 #define RETRO_DEVICE_ID_POINTER_Y 1
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
248 #define RETRO_DEVICE_ID_POINTER_PRESSED 2
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
249
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
250 /* Returned from retro_get_region(). */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
251 #define RETRO_REGION_NTSC 0
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
252 #define RETRO_REGION_PAL 1
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
253
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
254 /* Id values for LANGUAGE */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
255 enum retro_language
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
256 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
257 RETRO_LANGUAGE_ENGLISH = 0,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
258 RETRO_LANGUAGE_JAPANESE = 1,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
259 RETRO_LANGUAGE_FRENCH = 2,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
260 RETRO_LANGUAGE_SPANISH = 3,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
261 RETRO_LANGUAGE_GERMAN = 4,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
262 RETRO_LANGUAGE_ITALIAN = 5,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
263 RETRO_LANGUAGE_DUTCH = 6,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
264 RETRO_LANGUAGE_PORTUGUESE_BRAZIL = 7,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
265 RETRO_LANGUAGE_PORTUGUESE_PORTUGAL = 8,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
266 RETRO_LANGUAGE_RUSSIAN = 9,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
267 RETRO_LANGUAGE_KOREAN = 10,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
268 RETRO_LANGUAGE_CHINESE_TRADITIONAL = 11,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
269 RETRO_LANGUAGE_CHINESE_SIMPLIFIED = 12,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
270 RETRO_LANGUAGE_ESPERANTO = 13,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
271 RETRO_LANGUAGE_POLISH = 14,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
272 RETRO_LANGUAGE_VIETNAMESE = 15,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
273 RETRO_LANGUAGE_ARABIC = 16,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
274 RETRO_LANGUAGE_LAST,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
275
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
276 /* Ensure sizeof(enum) == sizeof(int) */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
277 RETRO_LANGUAGE_DUMMY = INT_MAX
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
278 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
279
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
280 /* Passed to retro_get_memory_data/size().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
281 * If the memory type doesn't apply to the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
282 * implementation NULL/0 can be returned.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
283 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
284 #define RETRO_MEMORY_MASK 0xff
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
285
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
286 /* Regular save RAM. This RAM is usually found on a game cartridge,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
287 * backed up by a battery.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
288 * If save game data is too complex for a single memory buffer,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
289 * the SAVE_DIRECTORY (preferably) or SYSTEM_DIRECTORY environment
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
290 * callback can be used. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
291 #define RETRO_MEMORY_SAVE_RAM 0
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
292
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
293 /* Some games have a built-in clock to keep track of time.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
294 * This memory is usually just a couple of bytes to keep track of time.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
295 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
296 #define RETRO_MEMORY_RTC 1
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
297
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
298 /* System ram lets a frontend peek into a game systems main RAM. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
299 #define RETRO_MEMORY_SYSTEM_RAM 2
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
300
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
301 /* Video ram lets a frontend peek into a game systems video RAM (VRAM). */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
302 #define RETRO_MEMORY_VIDEO_RAM 3
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
303
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
304 /* Keysyms used for ID in input state callback when polling RETRO_KEYBOARD. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
305 enum retro_key
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
306 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
307 RETROK_UNKNOWN = 0,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
308 RETROK_FIRST = 0,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
309 RETROK_BACKSPACE = 8,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
310 RETROK_TAB = 9,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
311 RETROK_CLEAR = 12,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
312 RETROK_RETURN = 13,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
313 RETROK_PAUSE = 19,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
314 RETROK_ESCAPE = 27,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
315 RETROK_SPACE = 32,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
316 RETROK_EXCLAIM = 33,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
317 RETROK_QUOTEDBL = 34,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
318 RETROK_HASH = 35,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
319 RETROK_DOLLAR = 36,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
320 RETROK_AMPERSAND = 38,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
321 RETROK_QUOTE = 39,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
322 RETROK_LEFTPAREN = 40,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
323 RETROK_RIGHTPAREN = 41,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
324 RETROK_ASTERISK = 42,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
325 RETROK_PLUS = 43,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
326 RETROK_COMMA = 44,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
327 RETROK_MINUS = 45,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
328 RETROK_PERIOD = 46,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
329 RETROK_SLASH = 47,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
330 RETROK_0 = 48,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
331 RETROK_1 = 49,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
332 RETROK_2 = 50,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
333 RETROK_3 = 51,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
334 RETROK_4 = 52,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
335 RETROK_5 = 53,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
336 RETROK_6 = 54,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
337 RETROK_7 = 55,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
338 RETROK_8 = 56,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
339 RETROK_9 = 57,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
340 RETROK_COLON = 58,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
341 RETROK_SEMICOLON = 59,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
342 RETROK_LESS = 60,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
343 RETROK_EQUALS = 61,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
344 RETROK_GREATER = 62,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
345 RETROK_QUESTION = 63,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
346 RETROK_AT = 64,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
347 RETROK_LEFTBRACKET = 91,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
348 RETROK_BACKSLASH = 92,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
349 RETROK_RIGHTBRACKET = 93,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
350 RETROK_CARET = 94,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
351 RETROK_UNDERSCORE = 95,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
352 RETROK_BACKQUOTE = 96,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
353 RETROK_a = 97,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
354 RETROK_b = 98,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
355 RETROK_c = 99,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
356 RETROK_d = 100,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
357 RETROK_e = 101,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
358 RETROK_f = 102,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
359 RETROK_g = 103,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
360 RETROK_h = 104,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
361 RETROK_i = 105,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
362 RETROK_j = 106,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
363 RETROK_k = 107,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
364 RETROK_l = 108,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
365 RETROK_m = 109,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
366 RETROK_n = 110,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
367 RETROK_o = 111,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
368 RETROK_p = 112,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
369 RETROK_q = 113,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
370 RETROK_r = 114,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
371 RETROK_s = 115,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
372 RETROK_t = 116,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
373 RETROK_u = 117,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
374 RETROK_v = 118,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
375 RETROK_w = 119,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
376 RETROK_x = 120,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
377 RETROK_y = 121,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
378 RETROK_z = 122,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
379 RETROK_LEFTBRACE = 123,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
380 RETROK_BAR = 124,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
381 RETROK_RIGHTBRACE = 125,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
382 RETROK_TILDE = 126,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
383 RETROK_DELETE = 127,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
384
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
385 RETROK_KP0 = 256,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
386 RETROK_KP1 = 257,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
387 RETROK_KP2 = 258,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
388 RETROK_KP3 = 259,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
389 RETROK_KP4 = 260,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
390 RETROK_KP5 = 261,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
391 RETROK_KP6 = 262,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
392 RETROK_KP7 = 263,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
393 RETROK_KP8 = 264,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
394 RETROK_KP9 = 265,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
395 RETROK_KP_PERIOD = 266,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
396 RETROK_KP_DIVIDE = 267,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
397 RETROK_KP_MULTIPLY = 268,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
398 RETROK_KP_MINUS = 269,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
399 RETROK_KP_PLUS = 270,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
400 RETROK_KP_ENTER = 271,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
401 RETROK_KP_EQUALS = 272,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
402
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
403 RETROK_UP = 273,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
404 RETROK_DOWN = 274,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
405 RETROK_RIGHT = 275,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
406 RETROK_LEFT = 276,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
407 RETROK_INSERT = 277,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
408 RETROK_HOME = 278,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
409 RETROK_END = 279,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
410 RETROK_PAGEUP = 280,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
411 RETROK_PAGEDOWN = 281,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
412
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
413 RETROK_F1 = 282,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
414 RETROK_F2 = 283,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
415 RETROK_F3 = 284,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
416 RETROK_F4 = 285,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
417 RETROK_F5 = 286,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
418 RETROK_F6 = 287,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
419 RETROK_F7 = 288,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
420 RETROK_F8 = 289,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
421 RETROK_F9 = 290,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
422 RETROK_F10 = 291,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
423 RETROK_F11 = 292,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
424 RETROK_F12 = 293,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
425 RETROK_F13 = 294,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
426 RETROK_F14 = 295,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
427 RETROK_F15 = 296,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
428
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
429 RETROK_NUMLOCK = 300,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
430 RETROK_CAPSLOCK = 301,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
431 RETROK_SCROLLOCK = 302,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
432 RETROK_RSHIFT = 303,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
433 RETROK_LSHIFT = 304,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
434 RETROK_RCTRL = 305,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
435 RETROK_LCTRL = 306,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
436 RETROK_RALT = 307,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
437 RETROK_LALT = 308,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
438 RETROK_RMETA = 309,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
439 RETROK_LMETA = 310,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
440 RETROK_LSUPER = 311,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
441 RETROK_RSUPER = 312,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
442 RETROK_MODE = 313,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
443 RETROK_COMPOSE = 314,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
444
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
445 RETROK_HELP = 315,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
446 RETROK_PRINT = 316,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
447 RETROK_SYSREQ = 317,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
448 RETROK_BREAK = 318,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
449 RETROK_MENU = 319,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
450 RETROK_POWER = 320,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
451 RETROK_EURO = 321,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
452 RETROK_UNDO = 322,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
453
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
454 RETROK_LAST,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
455
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
456 RETROK_DUMMY = INT_MAX /* Ensure sizeof(enum) == sizeof(int) */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
457 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
458
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
459 enum retro_mod
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
460 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
461 RETROKMOD_NONE = 0x0000,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
462
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
463 RETROKMOD_SHIFT = 0x01,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
464 RETROKMOD_CTRL = 0x02,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
465 RETROKMOD_ALT = 0x04,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
466 RETROKMOD_META = 0x08,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
467
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
468 RETROKMOD_NUMLOCK = 0x10,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
469 RETROKMOD_CAPSLOCK = 0x20,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
470 RETROKMOD_SCROLLOCK = 0x40,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
471
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
472 RETROKMOD_DUMMY = INT_MAX /* Ensure sizeof(enum) == sizeof(int) */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
473 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
474
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
475 /* If set, this call is not part of the public libretro API yet. It can
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
476 * change or be removed at any time. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
477 #define RETRO_ENVIRONMENT_EXPERIMENTAL 0x10000
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
478 /* Environment callback to be used internally in frontend. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
479 #define RETRO_ENVIRONMENT_PRIVATE 0x20000
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
480
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
481 /* Environment commands. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
482 #define RETRO_ENVIRONMENT_SET_ROTATION 1 /* const unsigned * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
483 * Sets screen rotation of graphics.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
484 * Is only implemented if rotation can be accelerated by hardware.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
485 * Valid values are 0, 1, 2, 3, which rotates screen by 0, 90, 180,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
486 * 270 degrees counter-clockwise respectively.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
487 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
488 #define RETRO_ENVIRONMENT_GET_OVERSCAN 2 /* bool * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
489 * Boolean value whether or not the implementation should use overscan,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
490 * or crop away overscan.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
491 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
492 #define RETRO_ENVIRONMENT_GET_CAN_DUPE 3 /* bool * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
493 * Boolean value whether or not frontend supports frame duping,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
494 * passing NULL to video frame callback.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
495 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
496
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
497 /* Environ 4, 5 are no longer supported (GET_VARIABLE / SET_VARIABLES),
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
498 * and reserved to avoid possible ABI clash.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
499 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
500
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
501 #define RETRO_ENVIRONMENT_SET_MESSAGE 6 /* const struct retro_message * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
502 * Sets a message to be displayed in implementation-specific manner
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
503 * for a certain amount of 'frames'.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
504 * Should not be used for trivial messages, which should simply be
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
505 * logged via RETRO_ENVIRONMENT_GET_LOG_INTERFACE (or as a
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
506 * fallback, stderr).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
507 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
508 #define RETRO_ENVIRONMENT_SHUTDOWN 7 /* N/A (NULL) --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
509 * Requests the frontend to shutdown.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
510 * Should only be used if game has a specific
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
511 * way to shutdown the game from a menu item or similar.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
512 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
513 #define RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL 8
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
514 /* const unsigned * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
515 * Gives a hint to the frontend how demanding this implementation
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
516 * is on a system. E.g. reporting a level of 2 means
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
517 * this implementation should run decently on all frontends
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
518 * of level 2 and up.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
519 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
520 * It can be used by the frontend to potentially warn
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
521 * about too demanding implementations.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
522 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
523 * The levels are "floating".
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
524 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
525 * This function can be called on a per-game basis,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
526 * as certain games an implementation can play might be
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
527 * particularly demanding.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
528 * If called, it should be called in retro_load_game().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
529 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
530 #define RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY 9
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
531 /* const char ** --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
532 * Returns the "system" directory of the frontend.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
533 * This directory can be used to store system specific
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
534 * content such as BIOSes, configuration data, etc.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
535 * The returned value can be NULL.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
536 * If so, no such directory is defined,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
537 * and it's up to the implementation to find a suitable directory.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
538 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
539 * NOTE: Some cores used this folder also for "save" data such as
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
540 * memory cards, etc, for lack of a better place to put it.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
541 * This is now discouraged, and if possible, cores should try to
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
542 * use the new GET_SAVE_DIRECTORY.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
543 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
544 #define RETRO_ENVIRONMENT_SET_PIXEL_FORMAT 10
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
545 /* const enum retro_pixel_format * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
546 * Sets the internal pixel format used by the implementation.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
547 * The default pixel format is RETRO_PIXEL_FORMAT_0RGB1555.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
548 * This pixel format however, is deprecated (see enum retro_pixel_format).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
549 * If the call returns false, the frontend does not support this pixel
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
550 * format.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
551 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
552 * This function should be called inside retro_load_game() or
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
553 * retro_get_system_av_info().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
554 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
555 #define RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS 11
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
556 /* const struct retro_input_descriptor * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
557 * Sets an array of retro_input_descriptors.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
558 * It is up to the frontend to present this in a usable way.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
559 * The array is terminated by retro_input_descriptor::description
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
560 * being set to NULL.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
561 * This function can be called at any time, but it is recommended
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
562 * to call it as early as possible.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
563 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
564 #define RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK 12
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
565 /* const struct retro_keyboard_callback * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
566 * Sets a callback function used to notify core about keyboard events.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
567 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
568 #define RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE 13
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
569 /* const struct retro_disk_control_callback * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
570 * Sets an interface which frontend can use to eject and insert
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
571 * disk images.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
572 * This is used for games which consist of multiple images and
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
573 * must be manually swapped out by the user (e.g. PSX).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
574 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
575 #define RETRO_ENVIRONMENT_SET_HW_RENDER 14
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
576 /* struct retro_hw_render_callback * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
577 * Sets an interface to let a libretro core render with
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
578 * hardware acceleration.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
579 * Should be called in retro_load_game().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
580 * If successful, libretro cores will be able to render to a
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
581 * frontend-provided framebuffer.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
582 * The size of this framebuffer will be at least as large as
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
583 * max_width/max_height provided in get_av_info().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
584 * If HW rendering is used, pass only RETRO_HW_FRAME_BUFFER_VALID or
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
585 * NULL to retro_video_refresh_t.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
586 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
587 #define RETRO_ENVIRONMENT_GET_VARIABLE 15
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
588 /* struct retro_variable * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
589 * Interface to acquire user-defined information from environment
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
590 * that cannot feasibly be supported in a multi-system way.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
591 * 'key' should be set to a key which has already been set by
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
592 * SET_VARIABLES.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
593 * 'data' will be set to a value or NULL.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
594 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
595 #define RETRO_ENVIRONMENT_SET_VARIABLES 16
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
596 /* const struct retro_variable * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
597 * Allows an implementation to signal the environment
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
598 * which variables it might want to check for later using
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
599 * GET_VARIABLE.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
600 * This allows the frontend to present these variables to
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
601 * a user dynamically.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
602 * This should be called as early as possible (ideally in
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
603 * retro_set_environment).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
604 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
605 * 'data' points to an array of retro_variable structs
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
606 * terminated by a { NULL, NULL } element.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
607 * retro_variable::key should be namespaced to not collide
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
608 * with other implementations' keys. E.g. A core called
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
609 * 'foo' should use keys named as 'foo_option'.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
610 * retro_variable::value should contain a human readable
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
611 * description of the key as well as a '|' delimited list
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
612 * of expected values.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
613 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
614 * The number of possible options should be very limited,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
615 * i.e. it should be feasible to cycle through options
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
616 * without a keyboard.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
617 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
618 * First entry should be treated as a default.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
619 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
620 * Example entry:
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
621 * { "foo_option", "Speed hack coprocessor X; false|true" }
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
622 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
623 * Text before first ';' is description. This ';' must be
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
624 * followed by a space, and followed by a list of possible
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
625 * values split up with '|'.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
626 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
627 * Only strings are operated on. The possible values will
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
628 * generally be displayed and stored as-is by the frontend.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
629 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
630 #define RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE 17
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
631 /* bool * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
632 * Result is set to true if some variables are updated by
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
633 * frontend since last call to RETRO_ENVIRONMENT_GET_VARIABLE.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
634 * Variables should be queried with GET_VARIABLE.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
635 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
636 #define RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME 18
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
637 /* const bool * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
638 * If true, the libretro implementation supports calls to
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
639 * retro_load_game() with NULL as argument.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
640 * Used by cores which can run without particular game data.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
641 * This should be called within retro_set_environment() only.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
642 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
643 #define RETRO_ENVIRONMENT_GET_LIBRETRO_PATH 19
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
644 /* const char ** --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
645 * Retrieves the absolute path from where this libretro
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
646 * implementation was loaded.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
647 * NULL is returned if the libretro was loaded statically
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
648 * (i.e. linked statically to frontend), or if the path cannot be
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
649 * determined.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
650 * Mostly useful in cooperation with SET_SUPPORT_NO_GAME as assets can
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
651 * be loaded without ugly hacks.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
652 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
653
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
654 /* Environment 20 was an obsolete version of SET_AUDIO_CALLBACK.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
655 * It was not used by any known core at the time,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
656 * and was removed from the API. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
657 #define RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK 22
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
658 /* const struct retro_audio_callback * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
659 * Sets an interface which is used to notify a libretro core about audio
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
660 * being available for writing.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
661 * The callback can be called from any thread, so a core using this must
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
662 * have a thread safe audio implementation.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
663 * It is intended for games where audio and video are completely
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
664 * asynchronous and audio can be generated on the fly.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
665 * This interface is not recommended for use with emulators which have
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
666 * highly synchronous audio.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
667 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
668 * The callback only notifies about writability; the libretro core still
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
669 * has to call the normal audio callbacks
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
670 * to write audio. The audio callbacks must be called from within the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
671 * notification callback.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
672 * The amount of audio data to write is up to the implementation.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
673 * Generally, the audio callback will be called continously in a loop.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
674 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
675 * Due to thread safety guarantees and lack of sync between audio and
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
676 * video, a frontend can selectively disallow this interface based on
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
677 * internal configuration. A core using this interface must also
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
678 * implement the "normal" audio interface.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
679 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
680 * A libretro core using SET_AUDIO_CALLBACK should also make use of
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
681 * SET_FRAME_TIME_CALLBACK.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
682 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
683 #define RETRO_ENVIRONMENT_SET_FRAME_TIME_CALLBACK 21
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
684 /* const struct retro_frame_time_callback * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
685 * Lets the core know how much time has passed since last
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
686 * invocation of retro_run().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
687 * The frontend can tamper with the timing to fake fast-forward,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
688 * slow-motion, frame stepping, etc.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
689 * In this case the delta time will use the reference value
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
690 * in frame_time_callback..
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
691 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
692 #define RETRO_ENVIRONMENT_GET_RUMBLE_INTERFACE 23
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
693 /* struct retro_rumble_interface * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
694 * Gets an interface which is used by a libretro core to set
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
695 * state of rumble motors in controllers.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
696 * A strong and weak motor is supported, and they can be
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
697 * controlled indepedently.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
698 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
699 #define RETRO_ENVIRONMENT_GET_INPUT_DEVICE_CAPABILITIES 24
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
700 /* uint64_t * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
701 * Gets a bitmask telling which device type are expected to be
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
702 * handled properly in a call to retro_input_state_t.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
703 * Devices which are not handled or recognized always return
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
704 * 0 in retro_input_state_t.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
705 * Example bitmask: caps = (1 << RETRO_DEVICE_JOYPAD) | (1 << RETRO_DEVICE_ANALOG).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
706 * Should only be called in retro_run().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
707 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
708 #define RETRO_ENVIRONMENT_GET_SENSOR_INTERFACE (25 | RETRO_ENVIRONMENT_EXPERIMENTAL)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
709 /* struct retro_sensor_interface * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
710 * Gets access to the sensor interface.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
711 * The purpose of this interface is to allow
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
712 * setting state related to sensors such as polling rate,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
713 * enabling/disable it entirely, etc.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
714 * Reading sensor state is done via the normal
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
715 * input_state_callback API.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
716 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
717 #define RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE (26 | RETRO_ENVIRONMENT_EXPERIMENTAL)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
718 /* struct retro_camera_callback * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
719 * Gets an interface to a video camera driver.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
720 * A libretro core can use this interface to get access to a
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
721 * video camera.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
722 * New video frames are delivered in a callback in same
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
723 * thread as retro_run().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
724 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
725 * GET_CAMERA_INTERFACE should be called in retro_load_game().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
726 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
727 * Depending on the camera implementation used, camera frames
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
728 * will be delivered as a raw framebuffer,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
729 * or as an OpenGL texture directly.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
730 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
731 * The core has to tell the frontend here which types of
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
732 * buffers can be handled properly.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
733 * An OpenGL texture can only be handled when using a
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
734 * libretro GL core (SET_HW_RENDER).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
735 * It is recommended to use a libretro GL core when
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
736 * using camera interface.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
737 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
738 * The camera is not started automatically. The retrieved start/stop
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
739 * functions must be used to explicitly
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
740 * start and stop the camera driver.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
741 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
742 #define RETRO_ENVIRONMENT_GET_LOG_INTERFACE 27
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
743 /* struct retro_log_callback * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
744 * Gets an interface for logging. This is useful for
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
745 * logging in a cross-platform way
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
746 * as certain platforms cannot use stderr for logging.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
747 * It also allows the frontend to
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
748 * show logging information in a more suitable way.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
749 * If this interface is not used, libretro cores should
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
750 * log to stderr as desired.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
751 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
752 #define RETRO_ENVIRONMENT_GET_PERF_INTERFACE 28
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
753 /* struct retro_perf_callback * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
754 * Gets an interface for performance counters. This is useful
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
755 * for performance logging in a cross-platform way and for detecting
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
756 * architecture-specific features, such as SIMD support.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
757 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
758 #define RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE 29
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
759 /* struct retro_location_callback * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
760 * Gets access to the location interface.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
761 * The purpose of this interface is to be able to retrieve
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
762 * location-based information from the host device,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
763 * such as current latitude / longitude.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
764 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
765 #define RETRO_ENVIRONMENT_GET_CONTENT_DIRECTORY 30 /* Old name, kept for compatibility. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
766 #define RETRO_ENVIRONMENT_GET_CORE_ASSETS_DIRECTORY 30
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
767 /* const char ** --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
768 * Returns the "core assets" directory of the frontend.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
769 * This directory can be used to store specific assets that the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
770 * core relies upon, such as art assets,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
771 * input data, etc etc.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
772 * The returned value can be NULL.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
773 * If so, no such directory is defined,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
774 * and it's up to the implementation to find a suitable directory.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
775 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
776 #define RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY 31
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
777 /* const char ** --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
778 * Returns the "save" directory of the frontend.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
779 * This directory can be used to store SRAM, memory cards,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
780 * high scores, etc, if the libretro core
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
781 * cannot use the regular memory interface (retro_get_memory_data()).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
782 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
783 * NOTE: libretro cores used to check GET_SYSTEM_DIRECTORY for
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
784 * similar things before.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
785 * They should still check GET_SYSTEM_DIRECTORY if they want to
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
786 * be backwards compatible.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
787 * The path here can be NULL. It should only be non-NULL if the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
788 * frontend user has set a specific save path.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
789 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
790 #define RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO 32
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
791 /* const struct retro_system_av_info * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
792 * Sets a new av_info structure. This can only be called from
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
793 * within retro_run().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
794 * This should *only* be used if the core is completely altering the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
795 * internal resolutions, aspect ratios, timings, sampling rate, etc.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
796 * Calling this can require a full reinitialization of video/audio
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
797 * drivers in the frontend,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
798 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
799 * so it is important to call it very sparingly, and usually only with
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
800 * the users explicit consent.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
801 * An eventual driver reinitialize will happen so that video and
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
802 * audio callbacks
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
803 * happening after this call within the same retro_run() call will
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
804 * target the newly initialized driver.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
805 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
806 * This callback makes it possible to support configurable resolutions
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
807 * in games, which can be useful to
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
808 * avoid setting the "worst case" in max_width/max_height.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
809 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
810 * ***HIGHLY RECOMMENDED*** Do not call this callback every time
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
811 * resolution changes in an emulator core if it's
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
812 * expected to be a temporary change, for the reasons of possible
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
813 * driver reinitialization.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
814 * This call is not a free pass for not trying to provide
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
815 * correct values in retro_get_system_av_info(). If you need to change
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
816 * things like aspect ratio or nominal width/height,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
817 * use RETRO_ENVIRONMENT_SET_GEOMETRY, which is a softer variant
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
818 * of SET_SYSTEM_AV_INFO.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
819 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
820 * If this returns false, the frontend does not acknowledge a
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
821 * changed av_info struct.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
822 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
823 #define RETRO_ENVIRONMENT_SET_PROC_ADDRESS_CALLBACK 33
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
824 /* const struct retro_get_proc_address_interface * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
825 * Allows a libretro core to announce support for the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
826 * get_proc_address() interface.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
827 * This interface allows for a standard way to extend libretro where
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
828 * use of environment calls are too indirect,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
829 * e.g. for cases where the frontend wants to call directly into the core.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
830 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
831 * If a core wants to expose this interface, SET_PROC_ADDRESS_CALLBACK
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
832 * **MUST** be called from within retro_set_environment().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
833 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
834 #define RETRO_ENVIRONMENT_SET_SUBSYSTEM_INFO 34
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
835 /* const struct retro_subsystem_info * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
836 * This environment call introduces the concept of libretro "subsystems".
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
837 * A subsystem is a variant of a libretro core which supports
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
838 * different kinds of games.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
839 * The purpose of this is to support e.g. emulators which might
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
840 * have special needs, e.g. Super Nintendo's Super GameBoy, Sufami Turbo.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
841 * It can also be used to pick among subsystems in an explicit way
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
842 * if the libretro implementation is a multi-system emulator itself.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
843 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
844 * Loading a game via a subsystem is done with retro_load_game_special(),
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
845 * and this environment call allows a libretro core to expose which
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
846 * subsystems are supported for use with retro_load_game_special().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
847 * A core passes an array of retro_game_special_info which is terminated
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
848 * with a zeroed out retro_game_special_info struct.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
849 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
850 * If a core wants to use this functionality, SET_SUBSYSTEM_INFO
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
851 * **MUST** be called from within retro_set_environment().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
852 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
853 #define RETRO_ENVIRONMENT_SET_CONTROLLER_INFO 35
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
854 /* const struct retro_controller_info * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
855 * This environment call lets a libretro core tell the frontend
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
856 * which controller types are recognized in calls to
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
857 * retro_set_controller_port_device().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
858 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
859 * Some emulators such as Super Nintendo
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
860 * support multiple lightgun types which must be specifically
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
861 * selected from.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
862 * It is therefore sometimes necessary for a frontend to be able
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
863 * to tell the core about a special kind of input device which is
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
864 * not covered by the libretro input API.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
865 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
866 * In order for a frontend to understand the workings of an input device,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
867 * it must be a specialized type
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
868 * of the generic device types already defined in the libretro API.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
869 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
870 * Which devices are supported can vary per input port.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
871 * The core must pass an array of const struct retro_controller_info which
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
872 * is terminated with a blanked out struct. Each element of the struct
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
873 * corresponds to an ascending port index to
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
874 * retro_set_controller_port_device().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
875 * Even if special device types are set in the libretro core,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
876 * libretro should only poll input based on the base input device types.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
877 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
878 #define RETRO_ENVIRONMENT_SET_MEMORY_MAPS (36 | RETRO_ENVIRONMENT_EXPERIMENTAL)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
879 /* const struct retro_memory_map * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
880 * This environment call lets a libretro core tell the frontend
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
881 * about the memory maps this core emulates.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
882 * This can be used to implement, for example, cheats in a core-agnostic way.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
883 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
884 * Should only be used by emulators; it doesn't make much sense for
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
885 * anything else.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
886 * It is recommended to expose all relevant pointers through
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
887 * retro_get_memory_* as well.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
888 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
889 * Can be called from retro_init and retro_load_game.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
890 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
891 #define RETRO_ENVIRONMENT_SET_GEOMETRY 37
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
892 /* const struct retro_game_geometry * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
893 * This environment call is similar to SET_SYSTEM_AV_INFO for changing
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
894 * video parameters, but provides a guarantee that drivers will not be
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
895 * reinitialized.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
896 * This can only be called from within retro_run().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
897 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
898 * The purpose of this call is to allow a core to alter nominal
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
899 * width/heights as well as aspect ratios on-the-fly, which can be
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
900 * useful for some emulators to change in run-time.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
901 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
902 * max_width/max_height arguments are ignored and cannot be changed
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
903 * with this call as this could potentially require a reinitialization or a
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
904 * non-constant time operation.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
905 * If max_width/max_height are to be changed, SET_SYSTEM_AV_INFO is required.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
906 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
907 * A frontend must guarantee that this environment call completes in
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
908 * constant time.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
909 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
910 #define RETRO_ENVIRONMENT_GET_USERNAME 38
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
911 /* const char **
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
912 * Returns the specified username of the frontend, if specified by the user.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
913 * This username can be used as a nickname for a core that has online facilities
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
914 * or any other mode where personalization of the user is desirable.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
915 * The returned value can be NULL.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
916 * If this environ callback is used by a core that requires a valid username,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
917 * a default username should be specified by the core.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
918 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
919 #define RETRO_ENVIRONMENT_GET_LANGUAGE 39
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
920 /* unsigned * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
921 * Returns the specified language of the frontend, if specified by the user.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
922 * It can be used by the core for localization purposes.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
923 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
924 #define RETRO_ENVIRONMENT_GET_CURRENT_SOFTWARE_FRAMEBUFFER (40 | RETRO_ENVIRONMENT_EXPERIMENTAL)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
925 /* struct retro_framebuffer * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
926 * Returns a preallocated framebuffer which the core can use for rendering
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
927 * the frame into when not using SET_HW_RENDER.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
928 * The framebuffer returned from this call must not be used
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
929 * after the current call to retro_run() returns.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
930 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
931 * The goal of this call is to allow zero-copy behavior where a core
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
932 * can render directly into video memory, avoiding extra bandwidth cost by copying
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
933 * memory from core to video memory.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
934 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
935 * If this call succeeds and the core renders into it,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
936 * the framebuffer pointer and pitch can be passed to retro_video_refresh_t.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
937 * If the buffer from GET_CURRENT_SOFTWARE_FRAMEBUFFER is to be used,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
938 * the core must pass the exact
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
939 * same pointer as returned by GET_CURRENT_SOFTWARE_FRAMEBUFFER;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
940 * i.e. passing a pointer which is offset from the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
941 * buffer is undefined. The width, height and pitch parameters
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
942 * must also match exactly to the values obtained from GET_CURRENT_SOFTWARE_FRAMEBUFFER.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
943 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
944 * It is possible for a frontend to return a different pixel format
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
945 * than the one used in SET_PIXEL_FORMAT. This can happen if the frontend
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
946 * needs to perform conversion.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
947 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
948 * It is still valid for a core to render to a different buffer
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
949 * even if GET_CURRENT_SOFTWARE_FRAMEBUFFER succeeds.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
950 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
951 * A frontend must make sure that the pointer obtained from this function is
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
952 * writeable (and readable).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
953 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
954
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
955 #define RETRO_ENVIRONMENT_SET_HW_SHARED_CONTEXT (44 | RETRO_ENVIRONMENT_EXPERIMENTAL)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
956 /* N/A (null) * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
957 * The frontend will try to use a 'shared' hardware context (mostly applicable
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
958 * to OpenGL) when a hardware context is being set up.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
959 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
960 * Returns true if the frontend supports shared hardware contexts and false
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
961 * if the frontend does not support shared hardware contexts.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
962 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
963 * This will do nothing on its own until SET_HW_RENDER env callbacks are
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
964 * being used.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
965 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
966
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
967 #define RETRO_ENVIRONMENT_GET_VFS_INTERFACE (45 | RETRO_ENVIRONMENT_EXPERIMENTAL)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
968 /* struct retro_vfs_interface_info * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
969 * Gets access to the VFS interface.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
970 * VFS presence needs to be queried prior to load_game or any
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
971 * get_system/save/other_directory being called to let front end know
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
972 * core supports VFS before it starts handing out paths.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
973 * It is recomended to do so in retro_set_environment */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
974
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
975 /* VFS functionality */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
976
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
977 /* File paths:
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
978 * File paths passed as parameters when using this api shall be well formed unix-style,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
979 * using "/" (unquoted forward slash) as directory separator regardless of the platform's native separator.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
980 * Paths shall also include at least one forward slash ("game.bin" is an invalid path, use "./game.bin" instead).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
981 * Other than the directory separator, cores shall not make assumptions about path format:
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
982 * "C:/path/game.bin", "http://example.com/game.bin", "#game/game.bin", "./game.bin" (without quotes) are all valid paths.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
983 * Cores may replace the basename or remove path components from the end, and/or add new components;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
984 * however, cores shall not append "./", "../" or multiple consecutive forward slashes ("//") to paths they request to front end.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
985 * 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.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
986 * Frontends are encouraged, but not required, to support native file system paths (modulo replacing the directory separator, if applicable).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
987 * Cores are allowed to try using them, but must remain functional if the front rejects such requests.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
988 * Cores are encouraged to use the libretro-common filestream functions for file I/O,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
989 * as they seamlessly integrate with VFS, deal with directory separator replacement as appropriate
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
990 * and provide platform-specific fallbacks in cases where front ends do not support VFS. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
991
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
992 /* Opaque file handle
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
993 * Introduced in VFS API v1 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
994 struct retro_vfs_file_handle;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
995
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
996 /* File open flags
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
997 * Introduced in VFS API v1 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
998 #define RETRO_VFS_FILE_ACCESS_READ (1 << 0) /* Read only mode */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
999 #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 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1000 #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*/
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1001 #define RETRO_VFS_FILE_ACCESS_UPDATE_EXISTING (1 << 2) /* Prevents discarding content of existing files opened for writing */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1002
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1003 /* These are only hints. The frontend may choose to ignore them. Other than RAM/CPU/etc use,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1004 and how they react to unlikely external interference (for example someone else writing to that file,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1005 or the file's server going down), behavior will not change. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1006 #define RETRO_VFS_FILE_ACCESS_HINT_NONE (0)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1007 /* Indicate that the file will be accessed many times. The frontend should aggressively cache everything. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1008 #define RETRO_VFS_FILE_ACCESS_HINT_FREQUENT_ACCESS (1 << 0)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1009
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1010 /* Seek positions */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1011 #define RETRO_VFS_SEEK_POSITION_START 0
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1012 #define RETRO_VFS_SEEK_POSITION_CURRENT 1
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1013 #define RETRO_VFS_SEEK_POSITION_END 2
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1014
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1015 /* Get path from opaque handle. Returns the exact same path passed to file_open when getting the handle
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1016 * Introduced in VFS API v1 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1017 typedef const char *(RETRO_CALLCONV *retro_vfs_get_path_t)(struct retro_vfs_file_handle *stream);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1018
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1019 /* Open a file for reading or writing. If path points to a directory, this will
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1020 * fail. Returns the opaque file handle, or NULL for error.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1021 * Introduced in VFS API v1 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1022 typedef struct retro_vfs_file_handle *(RETRO_CALLCONV *retro_vfs_open_t)(const char *path, unsigned mode, unsigned hints);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1023
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1024 /* Close the file and release its resources. Must be called if open_file returns non-NULL. Returns 0 on succes, -1 on failure.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1025 * Whether the call succeeds ot not, the handle passed as parameter becomes invalid and should no longer be used.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1026 * Introduced in VFS API v1 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1027 typedef int (RETRO_CALLCONV *retro_vfs_close_t)(struct retro_vfs_file_handle *stream);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1028
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1029 /* Return the size of the file in bytes, or -1 for error.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1030 * Introduced in VFS API v1 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1031 typedef int64_t (RETRO_CALLCONV *retro_vfs_size_t)(struct retro_vfs_file_handle *stream);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1032
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1033 /* Get the current read / write position for the file. Returns - 1 for error.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1034 * Introduced in VFS API v1 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1035 typedef int64_t (RETRO_CALLCONV *retro_vfs_tell_t)(struct retro_vfs_file_handle *stream);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1036
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1037 /* Set the current read/write position for the file. Returns the new position, -1 for error.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1038 * Introduced in VFS API v1 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1039 typedef int64_t (RETRO_CALLCONV *retro_vfs_seek_t)(struct retro_vfs_file_handle *stream, int64_t offset, int seek_position);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1040
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1041 /* Read data from a file. Returns the number of bytes read, or -1 for error.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1042 * Introduced in VFS API v1 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1043 typedef int64_t (RETRO_CALLCONV *retro_vfs_read_t)(struct retro_vfs_file_handle *stream, void *s, uint64_t len);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1044
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1045 /* Write data to a file. Returns the number of bytes written, or -1 for error.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1046 * Introduced in VFS API v1 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1047 typedef int64_t (RETRO_CALLCONV *retro_vfs_write_t)(struct retro_vfs_file_handle *stream, const void *s, uint64_t len);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1048
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1049 /* Flush pending writes to file, if using buffered IO. Returns 0 on sucess, or -1 on failure.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1050 * Introduced in VFS API v1 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1051 typedef int (RETRO_CALLCONV *retro_vfs_flush_t)(struct retro_vfs_file_handle *stream);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1052
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1053 /* Delete the specified file. Returns 0 on success, -1 on failure
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1054 * Introduced in VFS API v1 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1055 typedef int (RETRO_CALLCONV *retro_vfs_remove_t)(const char *path);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1056
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1057 /* Rename the specified file. Returns 0 on success, -1 on failure
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1058 * Introduced in VFS API v1 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1059 typedef int (RETRO_CALLCONV *retro_vfs_rename_t)(const char *old_path, const char *new_path);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1060
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1061 struct retro_vfs_interface
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1062 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1063 retro_vfs_get_path_t get_path;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1064 retro_vfs_open_t open;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1065 retro_vfs_close_t close;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1066 retro_vfs_size_t size;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1067 retro_vfs_tell_t tell;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1068 retro_vfs_seek_t seek;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1069 retro_vfs_read_t read;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1070 retro_vfs_write_t write;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1071 retro_vfs_flush_t flush;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1072 retro_vfs_remove_t remove;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1073 retro_vfs_rename_t rename;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1074 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1075
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1076 struct retro_vfs_interface_info
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1077 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1078 /* Set by core: should this be higher than the version the front end supports,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1079 * front end will return false in the RETRO_ENVIRONMENT_GET_VFS_INTERFACE call
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1080 * Introduced in VFS API v1 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1081 uint32_t required_interface_version;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1082
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1083 /* Frontend writes interface pointer here. The frontend also sets the actual
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1084 * version, must be at least required_interface_version.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1085 * Introduced in VFS API v1 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1086 struct retro_vfs_interface *iface;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1087 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1088
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1089 enum retro_hw_render_interface_type
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1090 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1091 RETRO_HW_RENDER_INTERFACE_VULKAN = 0,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1092 RETRO_HW_RENDER_INTERFACE_DUMMY = INT_MAX
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1093 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1094
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1095 /* Base struct. All retro_hw_render_interface_* types
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1096 * contain at least these fields. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1097 struct retro_hw_render_interface
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1098 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1099 enum retro_hw_render_interface_type interface_type;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1100 unsigned interface_version;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1101 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1102
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1103
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1104 #define RETRO_ENVIRONMENT_GET_LED_INTERFACE (46 | RETRO_ENVIRONMENT_EXPERIMENTAL)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1105 /* struct retro_led_interface * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1106 * Gets an interface which is used by a libretro core to set
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1107 * state of LEDs.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1108 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1109
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1110 typedef void (RETRO_CALLCONV *retro_set_led_state_t)(int led, int state);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1111 struct retro_led_interface
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1112 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1113 retro_set_led_state_t set_led_state;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1114 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1115
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1116
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1117 #define RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE (41 | RETRO_ENVIRONMENT_EXPERIMENTAL)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1118 /* const struct retro_hw_render_interface ** --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1119 * Returns an API specific rendering interface for accessing API specific data.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1120 * Not all HW rendering APIs support or need this.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1121 * The contents of the returned pointer is specific to the rendering API
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1122 * being used. See the various headers like libretro_vulkan.h, etc.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1123 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1124 * GET_HW_RENDER_INTERFACE cannot be called before context_reset has been called.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1125 * Similarly, after context_destroyed callback returns,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1126 * the contents of the HW_RENDER_INTERFACE are invalidated.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1127 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1128
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1129 #define RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS (42 | RETRO_ENVIRONMENT_EXPERIMENTAL)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1130 /* const bool * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1131 * If true, the libretro implementation supports achievements
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1132 * either via memory descriptors set with RETRO_ENVIRONMENT_SET_MEMORY_MAPS
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1133 * or via retro_get_memory_data/retro_get_memory_size.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1134 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1135 * This must be called before the first call to retro_run.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1136 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1137
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1138 enum retro_hw_render_context_negotiation_interface_type
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1139 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1140 RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN = 0,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1141 RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_DUMMY = INT_MAX
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1142 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1143
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1144 /* Base struct. All retro_hw_render_context_negotiation_interface_* types
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1145 * contain at least these fields. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1146 struct retro_hw_render_context_negotiation_interface
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1147 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1148 enum retro_hw_render_context_negotiation_interface_type interface_type;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1149 unsigned interface_version;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1150 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1151 #define RETRO_ENVIRONMENT_SET_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE (43 | RETRO_ENVIRONMENT_EXPERIMENTAL)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1152 /* const struct retro_hw_render_context_negotiation_interface * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1153 * Sets an interface which lets the libretro core negotiate with frontend how a context is created.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1154 * The semantics of this interface depends on which API is used in SET_HW_RENDER earlier.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1155 * This interface will be used when the frontend is trying to create a HW rendering context,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1156 * so it will be used after SET_HW_RENDER, but before the context_reset callback.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1157 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1158
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1159 /* Serialized state is incomplete in some way. Set if serialization is
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1160 * usable in typical end-user cases but should not be relied upon to
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1161 * implement frame-sensitive frontend features such as netplay or
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1162 * rerecording. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1163 #define RETRO_SERIALIZATION_QUIRK_INCOMPLETE (1 << 0)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1164 /* The core must spend some time initializing before serialization is
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1165 * supported. retro_serialize() will initially fail; retro_unserialize()
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1166 * and retro_serialize_size() may or may not work correctly either. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1167 #define RETRO_SERIALIZATION_QUIRK_MUST_INITIALIZE (1 << 1)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1168 /* Serialization size may change within a session. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1169 #define RETRO_SERIALIZATION_QUIRK_CORE_VARIABLE_SIZE (1 << 2)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1170 /* Set by the frontend to acknowledge that it supports variable-sized
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1171 * states. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1172 #define RETRO_SERIALIZATION_QUIRK_FRONT_VARIABLE_SIZE (1 << 3)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1173 /* Serialized state can only be loaded during the same session. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1174 #define RETRO_SERIALIZATION_QUIRK_SINGLE_SESSION (1 << 4)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1175 /* Serialized state cannot be loaded on an architecture with a different
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1176 * endianness from the one it was saved on. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1177 #define RETRO_SERIALIZATION_QUIRK_ENDIAN_DEPENDENT (1 << 5)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1178 /* Serialized state cannot be loaded on a different platform from the one it
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1179 * was saved on for reasons other than endianness, such as word size
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1180 * dependence */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1181 #define RETRO_SERIALIZATION_QUIRK_PLATFORM_DEPENDENT (1 << 6)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1182
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1183 #define RETRO_ENVIRONMENT_SET_SERIALIZATION_QUIRKS 44
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1184 /* uint64_t * --
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1185 * Sets quirk flags associated with serialization. The frontend will zero any flags it doesn't
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1186 * recognize or support. Should be set in either retro_init or retro_load_game, but not both.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1187 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1188
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1189 #define RETRO_MEMDESC_CONST (1 << 0) /* The frontend will never change this memory area once retro_load_game has returned. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1190 #define RETRO_MEMDESC_BIGENDIAN (1 << 1) /* The memory area contains big endian data. Default is little endian. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1191 #define RETRO_MEMDESC_ALIGN_2 (1 << 16) /* All memory access in this area is aligned to their own size, or 2, whichever is smaller. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1192 #define RETRO_MEMDESC_ALIGN_4 (2 << 16)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1193 #define RETRO_MEMDESC_ALIGN_8 (3 << 16)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1194 #define RETRO_MEMDESC_MINSIZE_2 (1 << 24) /* All memory in this region is accessed at least 2 bytes at the time. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1195 #define RETRO_MEMDESC_MINSIZE_4 (2 << 24)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1196 #define RETRO_MEMDESC_MINSIZE_8 (3 << 24)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1197 struct retro_memory_descriptor
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1198 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1199 uint64_t flags;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1200
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1201 /* Pointer to the start of the relevant ROM or RAM chip.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1202 * It's strongly recommended to use 'offset' if possible, rather than
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1203 * doing math on the pointer.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1204 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1205 * If the same byte is mapped my multiple descriptors, their descriptors
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1206 * must have the same pointer.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1207 * If 'start' does not point to the first byte in the pointer, put the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1208 * difference in 'offset' instead.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1209 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1210 * May be NULL if there's nothing usable here (e.g. hardware registers and
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1211 * open bus). No flags should be set if the pointer is NULL.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1212 * It's recommended to minimize the number of descriptors if possible,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1213 * but not mandatory. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1214 void *ptr;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1215 size_t offset;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1216
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1217 /* This is the location in the emulated address space
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1218 * where the mapping starts. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1219 size_t start;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1220
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1221 /* Which bits must be same as in 'start' for this mapping to apply.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1222 * The first memory descriptor to claim a certain byte is the one
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1223 * that applies.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1224 * A bit which is set in 'start' must also be set in this.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1225 * Can be zero, in which case each byte is assumed mapped exactly once.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1226 * In this case, 'len' must be a power of two. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1227 size_t select;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1228
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1229 /* If this is nonzero, the set bits are assumed not connected to the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1230 * memory chip's address pins. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1231 size_t disconnect;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1232
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1233 /* This one tells the size of the current memory area.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1234 * If, after start+disconnect are applied, the address is higher than
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1235 * this, the highest bit of the address is cleared.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1236 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1237 * If the address is still too high, the next highest bit is cleared.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1238 * Can be zero, in which case it's assumed to be infinite (as limited
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1239 * by 'select' and 'disconnect'). */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1240 size_t len;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1241
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1242 /* To go from emulated address to physical address, the following
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1243 * order applies:
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1244 * Subtract 'start', pick off 'disconnect', apply 'len', add 'offset'. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1245
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1246 /* The address space name must consist of only a-zA-Z0-9_-,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1247 * should be as short as feasible (maximum length is 8 plus the NUL),
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1248 * and may not be any other address space plus one or more 0-9A-F
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1249 * at the end.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1250 * However, multiple memory descriptors for the same address space is
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1251 * allowed, and the address space name can be empty. NULL is treated
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1252 * as empty.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1253 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1254 * Address space names are case sensitive, but avoid lowercase if possible.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1255 * The same pointer may exist in multiple address spaces.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1256 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1257 * Examples:
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1258 * blank+blank - valid (multiple things may be mapped in the same namespace)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1259 * 'Sp'+'Sp' - valid (multiple things may be mapped in the same namespace)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1260 * 'A'+'B' - valid (neither is a prefix of each other)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1261 * 'S'+blank - valid ('S' is not in 0-9A-F)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1262 * 'a'+blank - valid ('a' is not in 0-9A-F)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1263 * 'a'+'A' - valid (neither is a prefix of each other)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1264 * 'AR'+blank - valid ('R' is not in 0-9A-F)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1265 * 'ARB'+blank - valid (the B can't be part of the address either, because
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1266 * there is no namespace 'AR')
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1267 * blank+'B' - not valid, because it's ambigous which address space B1234
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1268 * would refer to.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1269 * The length can't be used for that purpose; the frontend may want
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1270 * to append arbitrary data to an address, without a separator. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1271 const char *addrspace;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1272
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1273 /* TODO: When finalizing this one, add a description field, which should be
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1274 * "WRAM" or something roughly equally long. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1275
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1276 /* TODO: When finalizing this one, replace 'select' with 'limit', which tells
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1277 * which bits can vary and still refer to the same address (limit = ~select).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1278 * TODO: limit? range? vary? something else? */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1279
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1280 /* TODO: When finalizing this one, if 'len' is above what 'select' (or
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1281 * 'limit') allows, it's bankswitched. Bankswitched data must have both 'len'
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1282 * and 'select' != 0, and the mappings don't tell how the system switches the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1283 * banks. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1284
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1285 /* TODO: When finalizing this one, fix the 'len' bit removal order.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1286 * For len=0x1800, pointer 0x1C00 should go to 0x1400, not 0x0C00.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1287 * Algorithm: Take bits highest to lowest, but if it goes above len, clear
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1288 * the most recent addition and continue on the next bit.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1289 * TODO: Can the above be optimized? Is "remove the lowest bit set in both
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1290 * pointer and 'len'" equivalent? */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1291
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1292 /* TODO: Some emulators (MAME?) emulate big endian systems by only accessing
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1293 * the emulated memory in 32-bit chunks, native endian. But that's nothing
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1294 * compared to Darek Mihocka <http://www.emulators.com/docs/nx07_vm101.htm>
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1295 * (section Emulation 103 - Nearly Free Byte Reversal) - he flips the ENTIRE
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1296 * RAM backwards! I'll want to represent both of those, via some flags.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1297 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1298 * I suspect MAME either didn't think of that idea, or don't want the #ifdef.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1299 * Not sure which, nor do I really care. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1300
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1301 /* TODO: Some of those flags are unused and/or don't really make sense. Clean
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1302 * them up. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1303 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1304
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1305 /* The frontend may use the largest value of 'start'+'select' in a
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1306 * certain namespace to infer the size of the address space.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1307 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1308 * If the address space is larger than that, a mapping with .ptr=NULL
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1309 * should be at the end of the array, with .select set to all ones for
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1310 * as long as the address space is big.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1311 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1312 * Sample descriptors (minus .ptr, and RETRO_MEMFLAG_ on the flags):
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1313 * SNES WRAM:
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1314 * .start=0x7E0000, .len=0x20000
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1315 * (Note that this must be mapped before the ROM in most cases; some of the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1316 * ROM mappers
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1317 * try to claim $7E0000, or at least $7E8000.)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1318 * SNES SPC700 RAM:
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1319 * .addrspace="S", .len=0x10000
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1320 * SNES WRAM mirrors:
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1321 * .flags=MIRROR, .start=0x000000, .select=0xC0E000, .len=0x2000
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1322 * .flags=MIRROR, .start=0x800000, .select=0xC0E000, .len=0x2000
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1323 * SNES WRAM mirrors, alternate equivalent descriptor:
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1324 * .flags=MIRROR, .select=0x40E000, .disconnect=~0x1FFF
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1325 * (Various similar constructions can be created by combining parts of
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1326 * the above two.)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1327 * SNES LoROM (512KB, mirrored a couple of times):
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1328 * .flags=CONST, .start=0x008000, .select=0x408000, .disconnect=0x8000, .len=512*1024
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1329 * .flags=CONST, .start=0x400000, .select=0x400000, .disconnect=0x8000, .len=512*1024
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1330 * SNES HiROM (4MB):
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1331 * .flags=CONST, .start=0x400000, .select=0x400000, .len=4*1024*1024
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1332 * .flags=CONST, .offset=0x8000, .start=0x008000, .select=0x408000, .len=4*1024*1024
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1333 * SNES ExHiROM (8MB):
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1334 * .flags=CONST, .offset=0, .start=0xC00000, .select=0xC00000, .len=4*1024*1024
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1335 * .flags=CONST, .offset=4*1024*1024, .start=0x400000, .select=0xC00000, .len=4*1024*1024
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1336 * .flags=CONST, .offset=0x8000, .start=0x808000, .select=0xC08000, .len=4*1024*1024
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1337 * .flags=CONST, .offset=4*1024*1024+0x8000, .start=0x008000, .select=0xC08000, .len=4*1024*1024
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1338 * Clarify the size of the address space:
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1339 * .ptr=NULL, .select=0xFFFFFF
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1340 * .len can be implied by .select in many of them, but was included for clarity.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1341 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1342
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1343 struct retro_memory_map
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1344 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1345 const struct retro_memory_descriptor *descriptors;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1346 unsigned num_descriptors;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1347 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1348
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1349 struct retro_controller_description
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1350 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1351 /* Human-readable description of the controller. Even if using a generic
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1352 * input device type, this can be set to the particular device type the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1353 * core uses. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1354 const char *desc;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1355
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1356 /* Device type passed to retro_set_controller_port_device(). If the device
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1357 * type is a sub-class of a generic input device type, use the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1358 * RETRO_DEVICE_SUBCLASS macro to create an ID.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1359 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1360 * E.g. RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 1). */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1361 unsigned id;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1362 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1363
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1364 struct retro_controller_info
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1365 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1366 const struct retro_controller_description *types;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1367 unsigned num_types;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1368 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1369
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1370 struct retro_subsystem_memory_info
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1371 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1372 /* The extension associated with a memory type, e.g. "psram". */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1373 const char *extension;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1374
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1375 /* The memory type for retro_get_memory(). This should be at
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1376 * least 0x100 to avoid conflict with standardized
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1377 * libretro memory types. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1378 unsigned type;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1379 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1380
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1381 struct retro_subsystem_rom_info
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1382 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1383 /* Describes what the content is (SGB BIOS, GB ROM, etc). */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1384 const char *desc;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1385
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1386 /* Same definition as retro_get_system_info(). */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1387 const char *valid_extensions;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1388
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1389 /* Same definition as retro_get_system_info(). */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1390 bool need_fullpath;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1391
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1392 /* Same definition as retro_get_system_info(). */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1393 bool block_extract;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1394
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1395 /* This is set if the content is required to load a game.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1396 * If this is set to false, a zeroed-out retro_game_info can be passed. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1397 bool required;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1398
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1399 /* Content can have multiple associated persistent
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1400 * memory types (retro_get_memory()). */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1401 const struct retro_subsystem_memory_info *memory;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1402 unsigned num_memory;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1403 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1404
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1405 struct retro_subsystem_info
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1406 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1407 /* Human-readable string of the subsystem type, e.g. "Super GameBoy" */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1408 const char *desc;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1409
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1410 /* A computer friendly short string identifier for the subsystem type.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1411 * This name must be [a-z].
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1412 * E.g. if desc is "Super GameBoy", this can be "sgb".
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1413 * This identifier can be used for command-line interfaces, etc.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1414 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1415 const char *ident;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1416
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1417 /* Infos for each content file. The first entry is assumed to be the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1418 * "most significant" content for frontend purposes.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1419 * E.g. with Super GameBoy, the first content should be the GameBoy ROM,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1420 * as it is the most "significant" content to a user.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1421 * If a frontend creates new file paths based on the content used
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1422 * (e.g. savestates), it should use the path for the first ROM to do so. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1423 const struct retro_subsystem_rom_info *roms;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1424
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1425 /* Number of content files associated with a subsystem. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1426 unsigned num_roms;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1427
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1428 /* The type passed to retro_load_game_special(). */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1429 unsigned id;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1430 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1431
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1432 typedef void (RETRO_CALLCONV *retro_proc_address_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1433
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1434 /* libretro API extension functions:
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1435 * (None here so far).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1436 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1437 * Get a symbol from a libretro core.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1438 * Cores should only return symbols which are actual
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1439 * extensions to the libretro API.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1440 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1441 * Frontends should not use this to obtain symbols to standard
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1442 * libretro entry points (static linking or dlsym).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1443 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1444 * The symbol name must be equal to the function name,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1445 * e.g. if void retro_foo(void); exists, the symbol must be called "retro_foo".
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1446 * The returned function pointer must be cast to the corresponding type.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1447 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1448 typedef retro_proc_address_t (RETRO_CALLCONV *retro_get_proc_address_t)(const char *sym);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1449
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1450 struct retro_get_proc_address_interface
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1451 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1452 retro_get_proc_address_t get_proc_address;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1453 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1454
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1455 enum retro_log_level
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1456 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1457 RETRO_LOG_DEBUG = 0,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1458 RETRO_LOG_INFO,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1459 RETRO_LOG_WARN,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1460 RETRO_LOG_ERROR,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1461
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1462 RETRO_LOG_DUMMY = INT_MAX
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1463 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1464
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1465 /* Logging function. Takes log level argument as well. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1466 typedef void (RETRO_CALLCONV *retro_log_printf_t)(enum retro_log_level level,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1467 const char *fmt, ...);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1468
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1469 struct retro_log_callback
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1470 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1471 retro_log_printf_t log;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1472 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1473
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1474 /* Performance related functions */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1475
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1476 /* ID values for SIMD CPU features */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1477 #define RETRO_SIMD_SSE (1 << 0)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1478 #define RETRO_SIMD_SSE2 (1 << 1)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1479 #define RETRO_SIMD_VMX (1 << 2)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1480 #define RETRO_SIMD_VMX128 (1 << 3)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1481 #define RETRO_SIMD_AVX (1 << 4)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1482 #define RETRO_SIMD_NEON (1 << 5)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1483 #define RETRO_SIMD_SSE3 (1 << 6)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1484 #define RETRO_SIMD_SSSE3 (1 << 7)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1485 #define RETRO_SIMD_MMX (1 << 8)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1486 #define RETRO_SIMD_MMXEXT (1 << 9)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1487 #define RETRO_SIMD_SSE4 (1 << 10)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1488 #define RETRO_SIMD_SSE42 (1 << 11)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1489 #define RETRO_SIMD_AVX2 (1 << 12)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1490 #define RETRO_SIMD_VFPU (1 << 13)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1491 #define RETRO_SIMD_PS (1 << 14)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1492 #define RETRO_SIMD_AES (1 << 15)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1493 #define RETRO_SIMD_VFPV3 (1 << 16)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1494 #define RETRO_SIMD_VFPV4 (1 << 17)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1495 #define RETRO_SIMD_POPCNT (1 << 18)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1496 #define RETRO_SIMD_MOVBE (1 << 19)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1497 #define RETRO_SIMD_CMOV (1 << 20)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1498 #define RETRO_SIMD_ASIMD (1 << 21)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1499
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1500 typedef uint64_t retro_perf_tick_t;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1501 typedef int64_t retro_time_t;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1502
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1503 struct retro_perf_counter
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1504 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1505 const char *ident;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1506 retro_perf_tick_t start;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1507 retro_perf_tick_t total;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1508 retro_perf_tick_t call_cnt;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1509
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1510 bool registered;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1511 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1512
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1513 /* Returns current time in microseconds.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1514 * Tries to use the most accurate timer available.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1515 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1516 typedef retro_time_t (RETRO_CALLCONV *retro_perf_get_time_usec_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1517
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1518 /* A simple counter. Usually nanoseconds, but can also be CPU cycles.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1519 * Can be used directly if desired (when creating a more sophisticated
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1520 * performance counter system).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1521 * */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1522 typedef retro_perf_tick_t (RETRO_CALLCONV *retro_perf_get_counter_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1523
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1524 /* Returns a bit-mask of detected CPU features (RETRO_SIMD_*). */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1525 typedef uint64_t (RETRO_CALLCONV *retro_get_cpu_features_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1526
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1527 /* Asks frontend to log and/or display the state of performance counters.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1528 * Performance counters can always be poked into manually as well.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1529 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1530 typedef void (RETRO_CALLCONV *retro_perf_log_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1531
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1532 /* Register a performance counter.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1533 * ident field must be set with a discrete value and other values in
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1534 * retro_perf_counter must be 0.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1535 * Registering can be called multiple times. To avoid calling to
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1536 * frontend redundantly, you can check registered field first. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1537 typedef void (RETRO_CALLCONV *retro_perf_register_t)(struct retro_perf_counter *counter);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1538
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1539 /* Starts a registered counter. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1540 typedef void (RETRO_CALLCONV *retro_perf_start_t)(struct retro_perf_counter *counter);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1541
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1542 /* Stops a registered counter. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1543 typedef void (RETRO_CALLCONV *retro_perf_stop_t)(struct retro_perf_counter *counter);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1544
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1545 /* For convenience it can be useful to wrap register, start and stop in macros.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1546 * E.g.:
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1547 * #ifdef LOG_PERFORMANCE
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1548 * #define RETRO_PERFORMANCE_INIT(perf_cb, name) static struct retro_perf_counter name = {#name}; if (!name.registered) perf_cb.perf_register(&(name))
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1549 * #define RETRO_PERFORMANCE_START(perf_cb, name) perf_cb.perf_start(&(name))
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1550 * #define RETRO_PERFORMANCE_STOP(perf_cb, name) perf_cb.perf_stop(&(name))
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1551 * #else
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1552 * ... Blank macros ...
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1553 * #endif
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1554 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1555 * These can then be used mid-functions around code snippets.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1556 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1557 * extern struct retro_perf_callback perf_cb; * Somewhere in the core.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1558 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1559 * void do_some_heavy_work(void)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1560 * {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1561 * RETRO_PERFORMANCE_INIT(cb, work_1;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1562 * RETRO_PERFORMANCE_START(cb, work_1);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1563 * heavy_work_1();
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1564 * RETRO_PERFORMANCE_STOP(cb, work_1);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1565 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1566 * RETRO_PERFORMANCE_INIT(cb, work_2);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1567 * RETRO_PERFORMANCE_START(cb, work_2);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1568 * heavy_work_2();
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1569 * RETRO_PERFORMANCE_STOP(cb, work_2);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1570 * }
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1571 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1572 * void retro_deinit(void)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1573 * {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1574 * perf_cb.perf_log(); * Log all perf counters here for example.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1575 * }
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1576 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1577
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1578 struct retro_perf_callback
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1579 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1580 retro_perf_get_time_usec_t get_time_usec;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1581 retro_get_cpu_features_t get_cpu_features;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1582
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1583 retro_perf_get_counter_t get_perf_counter;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1584 retro_perf_register_t perf_register;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1585 retro_perf_start_t perf_start;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1586 retro_perf_stop_t perf_stop;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1587 retro_perf_log_t perf_log;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1588 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1589
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1590 /* FIXME: Document the sensor API and work out behavior.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1591 * It will be marked as experimental until then.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1592 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1593 enum retro_sensor_action
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1594 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1595 RETRO_SENSOR_ACCELEROMETER_ENABLE = 0,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1596 RETRO_SENSOR_ACCELEROMETER_DISABLE,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1597
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1598 RETRO_SENSOR_DUMMY = INT_MAX
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1599 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1600
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1601 /* Id values for SENSOR types. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1602 #define RETRO_SENSOR_ACCELEROMETER_X 0
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1603 #define RETRO_SENSOR_ACCELEROMETER_Y 1
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1604 #define RETRO_SENSOR_ACCELEROMETER_Z 2
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1605
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1606 typedef bool (RETRO_CALLCONV *retro_set_sensor_state_t)(unsigned port,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1607 enum retro_sensor_action action, unsigned rate);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1608
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1609 typedef float (RETRO_CALLCONV *retro_sensor_get_input_t)(unsigned port, unsigned id);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1610
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1611 struct retro_sensor_interface
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1612 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1613 retro_set_sensor_state_t set_sensor_state;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1614 retro_sensor_get_input_t get_sensor_input;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1615 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1616
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1617 enum retro_camera_buffer
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1618 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1619 RETRO_CAMERA_BUFFER_OPENGL_TEXTURE = 0,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1620 RETRO_CAMERA_BUFFER_RAW_FRAMEBUFFER,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1621
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1622 RETRO_CAMERA_BUFFER_DUMMY = INT_MAX
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1623 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1624
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1625 /* Starts the camera driver. Can only be called in retro_run(). */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1626 typedef bool (RETRO_CALLCONV *retro_camera_start_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1627
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1628 /* Stops the camera driver. Can only be called in retro_run(). */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1629 typedef void (RETRO_CALLCONV *retro_camera_stop_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1630
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1631 /* Callback which signals when the camera driver is initialized
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1632 * and/or deinitialized.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1633 * retro_camera_start_t can be called in initialized callback.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1634 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1635 typedef void (RETRO_CALLCONV *retro_camera_lifetime_status_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1636
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1637 /* A callback for raw framebuffer data. buffer points to an XRGB8888 buffer.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1638 * Width, height and pitch are similar to retro_video_refresh_t.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1639 * First pixel is top-left origin.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1640 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1641 typedef void (RETRO_CALLCONV *retro_camera_frame_raw_framebuffer_t)(const uint32_t *buffer,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1642 unsigned width, unsigned height, size_t pitch);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1643
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1644 /* A callback for when OpenGL textures are used.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1645 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1646 * texture_id is a texture owned by camera driver.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1647 * Its state or content should be considered immutable, except for things like
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1648 * texture filtering and clamping.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1649 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1650 * texture_target is the texture target for the GL texture.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1651 * These can include e.g. GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE, and possibly
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1652 * more depending on extensions.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1653 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1654 * affine points to a packed 3x3 column-major matrix used to apply an affine
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1655 * transform to texture coordinates. (affine_matrix * vec3(coord_x, coord_y, 1.0))
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1656 * After transform, normalized texture coord (0, 0) should be bottom-left
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1657 * and (1, 1) should be top-right (or (width, height) for RECTANGLE).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1658 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1659 * GL-specific typedefs are avoided here to avoid relying on gl.h in
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1660 * the API definition.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1661 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1662 typedef void (RETRO_CALLCONV *retro_camera_frame_opengl_texture_t)(unsigned texture_id,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1663 unsigned texture_target, const float *affine);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1664
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1665 struct retro_camera_callback
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1666 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1667 /* Set by libretro core.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1668 * Example bitmask: caps = (1 << RETRO_CAMERA_BUFFER_OPENGL_TEXTURE) | (1 << RETRO_CAMERA_BUFFER_RAW_FRAMEBUFFER).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1669 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1670 uint64_t caps;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1671
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1672 /* Desired resolution for camera. Is only used as a hint. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1673 unsigned width;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1674 unsigned height;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1675
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1676 /* Set by frontend. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1677 retro_camera_start_t start;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1678 retro_camera_stop_t stop;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1679
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1680 /* Set by libretro core if raw framebuffer callbacks will be used. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1681 retro_camera_frame_raw_framebuffer_t frame_raw_framebuffer;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1682
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1683 /* Set by libretro core if OpenGL texture callbacks will be used. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1684 retro_camera_frame_opengl_texture_t frame_opengl_texture;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1685
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1686 /* Set by libretro core. Called after camera driver is initialized and
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1687 * ready to be started.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1688 * Can be NULL, in which this callback is not called.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1689 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1690 retro_camera_lifetime_status_t initialized;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1691
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1692 /* Set by libretro core. Called right before camera driver is
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1693 * deinitialized.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1694 * Can be NULL, in which this callback is not called.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1695 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1696 retro_camera_lifetime_status_t deinitialized;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1697 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1698
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1699 /* Sets the interval of time and/or distance at which to update/poll
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1700 * location-based data.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1701 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1702 * To ensure compatibility with all location-based implementations,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1703 * values for both interval_ms and interval_distance should be provided.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1704 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1705 * interval_ms is the interval expressed in milliseconds.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1706 * interval_distance is the distance interval expressed in meters.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1707 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1708 typedef void (RETRO_CALLCONV *retro_location_set_interval_t)(unsigned interval_ms,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1709 unsigned interval_distance);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1710
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1711 /* Start location services. The device will start listening for changes to the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1712 * current location at regular intervals (which are defined with
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1713 * retro_location_set_interval_t). */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1714 typedef bool (RETRO_CALLCONV *retro_location_start_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1715
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1716 /* Stop location services. The device will stop listening for changes
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1717 * to the current location. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1718 typedef void (RETRO_CALLCONV *retro_location_stop_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1719
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1720 /* Get the position of the current location. Will set parameters to
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1721 * 0 if no new location update has happened since the last time. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1722 typedef bool (RETRO_CALLCONV *retro_location_get_position_t)(double *lat, double *lon,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1723 double *horiz_accuracy, double *vert_accuracy);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1724
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1725 /* Callback which signals when the location driver is initialized
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1726 * and/or deinitialized.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1727 * retro_location_start_t can be called in initialized callback.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1728 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1729 typedef void (RETRO_CALLCONV *retro_location_lifetime_status_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1730
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1731 struct retro_location_callback
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1732 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1733 retro_location_start_t start;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1734 retro_location_stop_t stop;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1735 retro_location_get_position_t get_position;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1736 retro_location_set_interval_t set_interval;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1737
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1738 retro_location_lifetime_status_t initialized;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1739 retro_location_lifetime_status_t deinitialized;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1740 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1741
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1742 enum retro_rumble_effect
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1743 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1744 RETRO_RUMBLE_STRONG = 0,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1745 RETRO_RUMBLE_WEAK = 1,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1746
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1747 RETRO_RUMBLE_DUMMY = INT_MAX
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1748 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1749
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1750 /* Sets rumble state for joypad plugged in port 'port'.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1751 * Rumble effects are controlled independently,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1752 * and setting e.g. strong rumble does not override weak rumble.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1753 * Strength has a range of [0, 0xffff].
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1754 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1755 * Returns true if rumble state request was honored.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1756 * Calling this before first retro_run() is likely to return false. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1757 typedef bool (RETRO_CALLCONV *retro_set_rumble_state_t)(unsigned port,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1758 enum retro_rumble_effect effect, uint16_t strength);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1759
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1760 struct retro_rumble_interface
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1761 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1762 retro_set_rumble_state_t set_rumble_state;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1763 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1764
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1765 /* Notifies libretro that audio data should be written. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1766 typedef void (RETRO_CALLCONV *retro_audio_callback_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1767
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1768 /* True: Audio driver in frontend is active, and callback is
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1769 * expected to be called regularily.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1770 * False: Audio driver in frontend is paused or inactive.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1771 * Audio callback will not be called until set_state has been
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1772 * called with true.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1773 * Initial state is false (inactive).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1774 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1775 typedef void (RETRO_CALLCONV *retro_audio_set_state_callback_t)(bool enabled);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1776
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1777 struct retro_audio_callback
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1778 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1779 retro_audio_callback_t callback;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1780 retro_audio_set_state_callback_t set_state;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1781 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1782
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1783 /* Notifies a libretro core of time spent since last invocation
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1784 * of retro_run() in microseconds.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1785 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1786 * It will be called right before retro_run() every frame.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1787 * The frontend can tamper with timing to support cases like
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1788 * fast-forward, slow-motion and framestepping.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1789 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1790 * In those scenarios the reference frame time value will be used. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1791 typedef int64_t retro_usec_t;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1792 typedef void (RETRO_CALLCONV *retro_frame_time_callback_t)(retro_usec_t usec);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1793 struct retro_frame_time_callback
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1794 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1795 retro_frame_time_callback_t callback;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1796 /* Represents the time of one frame. It is computed as
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1797 * 1000000 / fps, but the implementation will resolve the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1798 * rounding to ensure that framestepping, etc is exact. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1799 retro_usec_t reference;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1800 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1801
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1802 /* Pass this to retro_video_refresh_t if rendering to hardware.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1803 * Passing NULL to retro_video_refresh_t is still a frame dupe as normal.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1804 * */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1805 #define RETRO_HW_FRAME_BUFFER_VALID ((void*)-1)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1806
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1807 /* Invalidates the current HW context.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1808 * Any GL state is lost, and must not be deinitialized explicitly.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1809 * If explicit deinitialization is desired by the libretro core,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1810 * it should implement context_destroy callback.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1811 * If called, all GPU resources must be reinitialized.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1812 * Usually called when frontend reinits video driver.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1813 * Also called first time video driver is initialized,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1814 * allowing libretro core to initialize resources.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1815 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1816 typedef void (RETRO_CALLCONV *retro_hw_context_reset_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1817
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1818 /* Gets current framebuffer which is to be rendered to.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1819 * Could change every frame potentially.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1820 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1821 typedef uintptr_t (RETRO_CALLCONV *retro_hw_get_current_framebuffer_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1822
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1823 /* Get a symbol from HW context. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1824 typedef retro_proc_address_t (RETRO_CALLCONV *retro_hw_get_proc_address_t)(const char *sym);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1825
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1826 enum retro_hw_context_type
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1827 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1828 RETRO_HW_CONTEXT_NONE = 0,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1829 /* OpenGL 2.x. Driver can choose to use latest compatibility context. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1830 RETRO_HW_CONTEXT_OPENGL = 1,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1831 /* OpenGL ES 2.0. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1832 RETRO_HW_CONTEXT_OPENGLES2 = 2,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1833 /* Modern desktop core GL context. Use version_major/
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1834 * version_minor fields to set GL version. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1835 RETRO_HW_CONTEXT_OPENGL_CORE = 3,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1836 /* OpenGL ES 3.0 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1837 RETRO_HW_CONTEXT_OPENGLES3 = 4,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1838 /* OpenGL ES 3.1+. Set version_major/version_minor. For GLES2 and GLES3,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1839 * use the corresponding enums directly. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1840 RETRO_HW_CONTEXT_OPENGLES_VERSION = 5,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1841
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1842 /* Vulkan, see RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1843 RETRO_HW_CONTEXT_VULKAN = 6,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1844
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1845 RETRO_HW_CONTEXT_DUMMY = INT_MAX
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1846 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1847
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1848 struct retro_hw_render_callback
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1849 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1850 /* Which API to use. Set by libretro core. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1851 enum retro_hw_context_type context_type;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1852
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1853 /* Called when a context has been created or when it has been reset.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1854 * An OpenGL context is only valid after context_reset() has been called.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1855 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1856 * When context_reset is called, OpenGL resources in the libretro
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1857 * implementation are guaranteed to be invalid.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1858 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1859 * It is possible that context_reset is called multiple times during an
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1860 * application lifecycle.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1861 * If context_reset is called without any notification (context_destroy),
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1862 * the OpenGL context was lost and resources should just be recreated
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1863 * without any attempt to "free" old resources.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1864 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1865 retro_hw_context_reset_t context_reset;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1866
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1867 /* Set by frontend.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1868 * TODO: This is rather obsolete. The frontend should not
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1869 * be providing preallocated framebuffers. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1870 retro_hw_get_current_framebuffer_t get_current_framebuffer;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1871
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1872 /* Set by frontend.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1873 * Can return all relevant functions, including glClear on Windows. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1874 retro_hw_get_proc_address_t get_proc_address;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1875
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1876 /* Set if render buffers should have depth component attached.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1877 * TODO: Obsolete. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1878 bool depth;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1879
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1880 /* Set if stencil buffers should be attached.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1881 * TODO: Obsolete. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1882 bool stencil;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1883
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1884 /* If depth and stencil are true, a packed 24/8 buffer will be added.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1885 * Only attaching stencil is invalid and will be ignored. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1886
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1887 /* Use conventional bottom-left origin convention. If false,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1888 * standard libretro top-left origin semantics are used.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1889 * TODO: Move to GL specific interface. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1890 bool bottom_left_origin;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1891
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1892 /* Major version number for core GL context or GLES 3.1+. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1893 unsigned version_major;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1894
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1895 /* Minor version number for core GL context or GLES 3.1+. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1896 unsigned version_minor;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1897
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1898 /* If this is true, the frontend will go very far to avoid
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1899 * resetting context in scenarios like toggling fullscreen, etc.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1900 * TODO: Obsolete? Maybe frontend should just always assume this ...
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1901 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1902 bool cache_context;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1903
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1904 /* The reset callback might still be called in extreme situations
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1905 * such as if the context is lost beyond recovery.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1906 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1907 * For optimal stability, set this to false, and allow context to be
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1908 * reset at any time.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1909 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1910
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1911 /* A callback to be called before the context is destroyed in a
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1912 * controlled way by the frontend. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1913 retro_hw_context_reset_t context_destroy;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1914
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1915 /* OpenGL resources can be deinitialized cleanly at this step.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1916 * context_destroy can be set to NULL, in which resources will
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1917 * just be destroyed without any notification.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1918 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1919 * Even when context_destroy is non-NULL, it is possible that
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1920 * context_reset is called without any destroy notification.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1921 * This happens if context is lost by external factors (such as
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1922 * notified by GL_ARB_robustness).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1923 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1924 * In this case, the context is assumed to be already dead,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1925 * and the libretro implementation must not try to free any OpenGL
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1926 * resources in the subsequent context_reset.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1927 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1928
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1929 /* Creates a debug context. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1930 bool debug_context;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1931 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1932
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1933 /* Callback type passed in RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1934 * Called by the frontend in response to keyboard events.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1935 * down is set if the key is being pressed, or false if it is being released.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1936 * keycode is the RETROK value of the char.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1937 * character is the text character of the pressed key. (UTF-32).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1938 * key_modifiers is a set of RETROKMOD values or'ed together.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1939 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1940 * The pressed/keycode state can be indepedent of the character.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1941 * It is also possible that multiple characters are generated from a
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1942 * single keypress.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1943 * Keycode events should be treated separately from character events.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1944 * However, when possible, the frontend should try to synchronize these.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1945 * If only a character is posted, keycode should be RETROK_UNKNOWN.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1946 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1947 * Similarily if only a keycode event is generated with no corresponding
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1948 * character, character should be 0.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1949 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1950 typedef void (RETRO_CALLCONV *retro_keyboard_event_t)(bool down, unsigned keycode,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1951 uint32_t character, uint16_t key_modifiers);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1952
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1953 struct retro_keyboard_callback
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1954 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1955 retro_keyboard_event_t callback;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1956 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1957
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1958 /* Callbacks for RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1959 * Should be set for implementations which can swap out multiple disk
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1960 * images in runtime.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1961 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1962 * If the implementation can do this automatically, it should strive to do so.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1963 * However, there are cases where the user must manually do so.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1964 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1965 * Overview: To swap a disk image, eject the disk image with
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1966 * set_eject_state(true).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1967 * Set the disk index with set_image_index(index). Insert the disk again
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1968 * with set_eject_state(false).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1969 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1970
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1971 /* If ejected is true, "ejects" the virtual disk tray.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1972 * When ejected, the disk image index can be set.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1973 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1974 typedef bool (RETRO_CALLCONV *retro_set_eject_state_t)(bool ejected);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1975
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1976 /* Gets current eject state. The initial state is 'not ejected'. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1977 typedef bool (RETRO_CALLCONV *retro_get_eject_state_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1978
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1979 /* Gets current disk index. First disk is index 0.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1980 * If return value is >= get_num_images(), no disk is currently inserted.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1981 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1982 typedef unsigned (RETRO_CALLCONV *retro_get_image_index_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1983
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1984 /* Sets image index. Can only be called when disk is ejected.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1985 * The implementation supports setting "no disk" by using an
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1986 * index >= get_num_images().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1987 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1988 typedef bool (RETRO_CALLCONV *retro_set_image_index_t)(unsigned index);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1989
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1990 /* Gets total number of images which are available to use. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1991 typedef unsigned (RETRO_CALLCONV *retro_get_num_images_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1992
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1993 struct retro_game_info;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1994
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1995 /* Replaces the disk image associated with index.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1996 * Arguments to pass in info have same requirements as retro_load_game().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1997 * Virtual disk tray must be ejected when calling this.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1998 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1999 * Replacing a disk image with info = NULL will remove the disk image
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2000 * from the internal list.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2001 * As a result, calls to get_image_index() can change.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2002 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2003 * E.g. replace_image_index(1, NULL), and previous get_image_index()
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2004 * returned 4 before.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2005 * Index 1 will be removed, and the new index is 3.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2006 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2007 typedef bool (RETRO_CALLCONV *retro_replace_image_index_t)(unsigned index,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2008 const struct retro_game_info *info);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2009
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2010 /* Adds a new valid index (get_num_images()) to the internal disk list.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2011 * This will increment subsequent return values from get_num_images() by 1.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2012 * This image index cannot be used until a disk image has been set
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2013 * with replace_image_index. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2014 typedef bool (RETRO_CALLCONV *retro_add_image_index_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2015
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2016 struct retro_disk_control_callback
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2017 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2018 retro_set_eject_state_t set_eject_state;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2019 retro_get_eject_state_t get_eject_state;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2020
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2021 retro_get_image_index_t get_image_index;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2022 retro_set_image_index_t set_image_index;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2023 retro_get_num_images_t get_num_images;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2024
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2025 retro_replace_image_index_t replace_image_index;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2026 retro_add_image_index_t add_image_index;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2027 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2028
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2029 enum retro_pixel_format
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2030 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2031 /* 0RGB1555, native endian.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2032 * 0 bit must be set to 0.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2033 * This pixel format is default for compatibility concerns only.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2034 * If a 15/16-bit pixel format is desired, consider using RGB565. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2035 RETRO_PIXEL_FORMAT_0RGB1555 = 0,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2036
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2037 /* XRGB8888, native endian.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2038 * X bits are ignored. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2039 RETRO_PIXEL_FORMAT_XRGB8888 = 1,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2040
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2041 /* RGB565, native endian.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2042 * This pixel format is the recommended format to use if a 15/16-bit
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2043 * format is desired as it is the pixel format that is typically
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2044 * available on a wide range of low-power devices.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2045 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2046 * It is also natively supported in APIs like OpenGL ES. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2047 RETRO_PIXEL_FORMAT_RGB565 = 2,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2048
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2049 /* Ensure sizeof() == sizeof(int). */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2050 RETRO_PIXEL_FORMAT_UNKNOWN = INT_MAX
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2051 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2052
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2053 struct retro_message
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2054 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2055 const char *msg; /* Message to be displayed. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2056 unsigned frames; /* Duration in frames of message. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2057 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2058
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2059 /* Describes how the libretro implementation maps a libretro input bind
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2060 * to its internal input system through a human readable string.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2061 * This string can be used to better let a user configure input. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2062 struct retro_input_descriptor
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2063 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2064 /* Associates given parameters with a description. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2065 unsigned port;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2066 unsigned device;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2067 unsigned index;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2068 unsigned id;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2069
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2070 /* Human readable description for parameters.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2071 * The pointer must remain valid until
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2072 * retro_unload_game() is called. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2073 const char *description;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2074 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2075
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2076 struct retro_system_info
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2077 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2078 /* All pointers are owned by libretro implementation, and pointers must
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2079 * remain valid until retro_deinit() is called. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2080
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2081 const char *library_name; /* Descriptive name of library. Should not
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2082 * contain any version numbers, etc. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2083 const char *library_version; /* Descriptive version of core. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2084
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2085 const char *valid_extensions; /* A string listing probably content
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2086 * extensions the core will be able to
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2087 * load, separated with pipe.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2088 * I.e. "bin|rom|iso".
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2089 * Typically used for a GUI to filter
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2090 * out extensions. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2091
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2092 /* If true, retro_load_game() is guaranteed to provide a valid pathname
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2093 * in retro_game_info::path.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2094 * ::data and ::size are both invalid.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2095 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2096 * If false, ::data and ::size are guaranteed to be valid, but ::path
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2097 * might not be valid.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2098 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2099 * This is typically set to true for libretro implementations that must
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2100 * load from file.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2101 * Implementations should strive for setting this to false, as it allows
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2102 * the frontend to perform patching, etc. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2103 bool need_fullpath;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2104
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2105 /* If true, the frontend is not allowed to extract any archives before
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2106 * loading the real content.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2107 * Necessary for certain libretro implementations that load games
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2108 * from zipped archives. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2109 bool block_extract;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2110 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2111
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2112 struct retro_game_geometry
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2113 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2114 unsigned base_width; /* Nominal video width of game. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2115 unsigned base_height; /* Nominal video height of game. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2116 unsigned max_width; /* Maximum possible width of game. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2117 unsigned max_height; /* Maximum possible height of game. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2118
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2119 float aspect_ratio; /* Nominal aspect ratio of game. If
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2120 * aspect_ratio is <= 0.0, an aspect ratio
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2121 * of base_width / base_height is assumed.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2122 * A frontend could override this setting,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2123 * if desired. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2124 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2125
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2126 struct retro_system_timing
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2127 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2128 double fps; /* FPS of video content. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2129 double sample_rate; /* Sampling rate of audio. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2130 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2131
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2132 struct retro_system_av_info
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2133 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2134 struct retro_game_geometry geometry;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2135 struct retro_system_timing timing;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2136 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2137
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2138 struct retro_variable
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2139 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2140 /* Variable to query in RETRO_ENVIRONMENT_GET_VARIABLE.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2141 * If NULL, obtains the complete environment string if more
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2142 * complex parsing is necessary.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2143 * The environment string is formatted as key-value pairs
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2144 * delimited by semicolons as so:
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2145 * "key1=value1;key2=value2;..."
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2146 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2147 const char *key;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2148
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2149 /* Value to be obtained. If key does not exist, it is set to NULL. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2150 const char *value;
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2151 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2152
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2153 struct retro_game_info
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2154 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2155 const char *path; /* Path to game, UTF-8 encoded.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2156 * Sometimes used as a reference for building other paths.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2157 * May be NULL if game was loaded from stdin or similar,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2158 * but in this case some cores will be unable to load `data`.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2159 * So, it is preferable to fabricate something here instead
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2160 * of passing NULL, which will help more cores to succeed.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2161 * retro_system_info::need_fullpath requires
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2162 * that this path is valid. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2163 const void *data; /* Memory buffer of loaded game. Will be NULL
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2164 * if need_fullpath was set. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2165 size_t size; /* Size of memory buffer. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2166 const char *meta; /* String of implementation specific meta-data. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2167 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2168
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2169 #define RETRO_MEMORY_ACCESS_WRITE (1 << 0)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2170 /* The core will write to the buffer provided by retro_framebuffer::data. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2171 #define RETRO_MEMORY_ACCESS_READ (1 << 1)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2172 /* The core will read from retro_framebuffer::data. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2173 #define RETRO_MEMORY_TYPE_CACHED (1 << 0)
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2174 /* The memory in data is cached.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2175 * If not cached, random writes and/or reading from the buffer is expected to be very slow. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2176 struct retro_framebuffer
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2177 {
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2178 void *data; /* The framebuffer which the core can render into.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2179 Set by frontend in GET_CURRENT_SOFTWARE_FRAMEBUFFER.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2180 The initial contents of data are unspecified. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2181 unsigned width; /* The framebuffer width used by the core. Set by core. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2182 unsigned height; /* The framebuffer height used by the core. Set by core. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2183 size_t pitch; /* The number of bytes between the beginning of a scanline,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2184 and beginning of the next scanline.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2185 Set by frontend in GET_CURRENT_SOFTWARE_FRAMEBUFFER. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2186 enum retro_pixel_format format; /* The pixel format the core must use to render into data.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2187 This format could differ from the format used in
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2188 SET_PIXEL_FORMAT.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2189 Set by frontend in GET_CURRENT_SOFTWARE_FRAMEBUFFER. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2190
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2191 unsigned access_flags; /* How the core will access the memory in the framebuffer.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2192 RETRO_MEMORY_ACCESS_* flags.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2193 Set by core. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2194 unsigned memory_flags; /* Flags telling core how the memory has been mapped.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2195 RETRO_MEMORY_TYPE_* flags.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2196 Set by frontend in GET_CURRENT_SOFTWARE_FRAMEBUFFER. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2197 };
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2198
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2199 /* Callbacks */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2200
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2201 /* Environment callback. Gives implementations a way of performing
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2202 * uncommon tasks. Extensible. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2203 typedef bool (RETRO_CALLCONV *retro_environment_t)(unsigned cmd, void *data);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2204
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2205 /* Render a frame. Pixel format is 15-bit 0RGB1555 native endian
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2206 * unless changed (see RETRO_ENVIRONMENT_SET_PIXEL_FORMAT).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2207 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2208 * Width and height specify dimensions of buffer.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2209 * Pitch specifices length in bytes between two lines in buffer.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2210 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2211 * For performance reasons, it is highly recommended to have a frame
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2212 * that is packed in memory, i.e. pitch == width * byte_per_pixel.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2213 * Certain graphic APIs, such as OpenGL ES, do not like textures
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2214 * that are not packed in memory.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2215 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2216 typedef void (RETRO_CALLCONV *retro_video_refresh_t)(const void *data, unsigned width,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2217 unsigned height, size_t pitch);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2218
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2219 /* Renders a single audio frame. Should only be used if implementation
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2220 * generates a single sample at a time.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2221 * Format is signed 16-bit native endian.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2222 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2223 typedef void (RETRO_CALLCONV *retro_audio_sample_t)(int16_t left, int16_t right);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2224
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2225 /* Renders multiple audio frames in one go.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2226 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2227 * One frame is defined as a sample of left and right channels, interleaved.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2228 * I.e. int16_t buf[4] = { l, r, l, r }; would be 2 frames.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2229 * Only one of the audio callbacks must ever be used.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2230 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2231 typedef size_t (RETRO_CALLCONV *retro_audio_sample_batch_t)(const int16_t *data,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2232 size_t frames);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2233
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2234 /* Polls input. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2235 typedef void (RETRO_CALLCONV *retro_input_poll_t)(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2236
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2237 /* Queries for input for player 'port'. device will be masked with
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2238 * RETRO_DEVICE_MASK.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2239 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2240 * Specialization of devices such as RETRO_DEVICE_JOYPAD_MULTITAP that
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2241 * have been set with retro_set_controller_port_device()
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2242 * will still use the higher level RETRO_DEVICE_JOYPAD to request input.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2243 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2244 typedef int16_t (RETRO_CALLCONV *retro_input_state_t)(unsigned port, unsigned device,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2245 unsigned index, unsigned id);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2246
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2247 /* Sets callbacks. retro_set_environment() is guaranteed to be called
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2248 * before retro_init().
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2249 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2250 * The rest of the set_* functions are guaranteed to have been called
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2251 * before the first call to retro_run() is made. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2252 RETRO_API void retro_set_environment(retro_environment_t);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2253 RETRO_API void retro_set_video_refresh(retro_video_refresh_t);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2254 RETRO_API void retro_set_audio_sample(retro_audio_sample_t);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2255 RETRO_API void retro_set_audio_sample_batch(retro_audio_sample_batch_t);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2256 RETRO_API void retro_set_input_poll(retro_input_poll_t);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2257 RETRO_API void retro_set_input_state(retro_input_state_t);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2258
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2259 /* Library global initialization/deinitialization. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2260 RETRO_API void retro_init(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2261 RETRO_API void retro_deinit(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2262
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2263 /* Must return RETRO_API_VERSION. Used to validate ABI compatibility
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2264 * when the API is revised. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2265 RETRO_API unsigned retro_api_version(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2266
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2267 /* Gets statically known system info. Pointers provided in *info
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2268 * must be statically allocated.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2269 * Can be called at any time, even before retro_init(). */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2270 RETRO_API void retro_get_system_info(struct retro_system_info *info);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2271
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2272 /* Gets information about system audio/video timings and geometry.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2273 * Can be called only after retro_load_game() has successfully completed.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2274 * NOTE: The implementation of this function might not initialize every
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2275 * variable if needed.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2276 * E.g. geom.aspect_ratio might not be initialized if core doesn't
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2277 * desire a particular aspect ratio. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2278 RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2279
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2280 /* Sets device to be used for player 'port'.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2281 * By default, RETRO_DEVICE_JOYPAD is assumed to be plugged into all
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2282 * available ports.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2283 * Setting a particular device type is not a guarantee that libretro cores
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2284 * will only poll input based on that particular device type. It is only a
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2285 * hint to the libretro core when a core cannot automatically detect the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2286 * appropriate input device type on its own. It is also relevant when a
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2287 * core can change its behavior depending on device type. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2288 RETRO_API void retro_set_controller_port_device(unsigned port, unsigned device);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2289
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2290 /* Resets the current game. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2291 RETRO_API void retro_reset(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2292
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2293 /* Runs the game for one video frame.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2294 * During retro_run(), input_poll callback must be called at least once.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2295 *
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2296 * If a frame is not rendered for reasons where a game "dropped" a frame,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2297 * this still counts as a frame, and retro_run() should explicitly dupe
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2298 * a frame if GET_CAN_DUPE returns true.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2299 * In this case, the video callback can take a NULL argument for data.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2300 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2301 RETRO_API void retro_run(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2302
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2303 /* Returns the amount of data the implementation requires to serialize
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2304 * internal state (save states).
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2305 * Between calls to retro_load_game() and retro_unload_game(), the
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2306 * returned size is never allowed to be larger than a previous returned
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2307 * value, to ensure that the frontend can allocate a save state buffer once.
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2308 */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2309 RETRO_API size_t retro_serialize_size(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2310
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2311 /* Serializes internal state. If failed, or size is lower than
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2312 * retro_serialize_size(), it should return false, true otherwise. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2313 RETRO_API bool retro_serialize(void *data, size_t size);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2314 RETRO_API bool retro_unserialize(const void *data, size_t size);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2315
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2316 RETRO_API void retro_cheat_reset(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2317 RETRO_API void retro_cheat_set(unsigned index, bool enabled, const char *code);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2318
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2319 /* Loads a game. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2320 RETRO_API bool retro_load_game(const struct retro_game_info *game);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2321
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2322 /* Loads a "special" kind of game. Should not be used,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2323 * except in extreme cases. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2324 RETRO_API bool retro_load_game_special(
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2325 unsigned game_type,
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2326 const struct retro_game_info *info, size_t num_info
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2327 );
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2328
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2329 /* Unloads a currently loaded game. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2330 RETRO_API void retro_unload_game(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2331
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2332 /* Gets region of game. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2333 RETRO_API unsigned retro_get_region(void);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2334
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2335 /* Gets region of memory. */
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2336 RETRO_API void *retro_get_memory_data(unsigned id);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2337 RETRO_API size_t retro_get_memory_size(unsigned id);
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2338
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2339 #ifdef __cplusplus
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2340 }
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2341 #endif
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2342
6c54bb5fe3b3 Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2343 #endif