-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlibretro-v2-ext.h
161 lines (140 loc) · 7.75 KB
/
libretro-v2-ext.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* Copyright (C) 2014-2014 The RetroArch team
*
* ---------------------------------------------------------------------------------------------
* The following license statement only applies to this libretro API header (libretro-v2-ext.h).
* ---------------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* This file is for env callbacks we're going to add after libretro v2 has
* stabilized, but do not want to add yet because it'd make v2 too big of a
* change. Some of them will deprecate other env callbacks.
*/
#define RETRO_ENVIRONMENT_SET_VARIABLES ($error)
/* const struct retro_variable * --
* Interface to acquire user-defined information from environment
* that cannot feasibly be supported in a multi-system way.
*
* The first call must be from retro_set_environment or retro_init.
* Additionally, the core may call RETRO_ENVIRONMENT_SET_VARIABLES
* again during retro_load_game, retro_run, and retro_variable::
* ::change_notify, and may have changed some of the entries.
* However, each 'name', 'values' and 'initial' must be the same
* as for the initial call.
*/
#define RETRO_ENVIRONMENT_GET_VARIABLE ($error)
/* struct retro_variable_query * --
* Asks the frontend what value a variable has.
*/
enum retro_variable_type
{
/* Tells that the variable list has ended. */
RETRO_VARIABLE_TYPE_TERMINATOR,
/* A separator in the list. Use to group similar items together.
* All other members are ignored for items of this type. */
RETRO_VARIABLE_TYPE_SEPARATOR,
/* Enumeration. 'values' is const char * const *, with one entry for each
* item; terminated by a NULL.
* 'initial' is an unsigned int * containing the index of the default value. */
RETRO_VARIABLE_TYPE_ENUM,
/* Boolean. 'values' is NULL and 'initial' is bool*. */
RETRO_VARIABLE_TYPE_BOOL,
/* Integer. 'values' is int* containing two entries: the lowest and
* highest valid values, inclusive. 'initial' is also int*, with one entry. */
RETRO_VARIABLE_TYPE_INT,
/* Floating point. Same as RETRO_VARIABLE_INT, except with 'float' instead of 'int'.
* The frontend is responsible for calculating a reasonable step size. */
RETRO_VARIABLE_TYPE_FLOAT,
/* An arbitrary string, for data that does not match any of the defined categories.
* 'values' is NULL; 'initial' is const char *.
*/
RETRO_VARIABLE_TYPE_STRING,
/* A resolution, for example output size.
* 'values' is NULL; valid sizes are between 1x1 and 65535x65535.
* The frontend should use retro_game_geometry and the monitor size to
* set reasonable bounds.
* 'initial' is unsigned int* with two entries (width and height). */
RETRO_VARIABLE_TYPE_RESOLUTION,
/* An arbitrary file path.
* 'values' is const char * const *, each entry containing a supported file extension,
* terminated with a NULL.
* 'initial' is one of the RETRO_VARIABLE_FILE_* values.
* 'value' in change_notify is const char * (null terminated). */
RETRO_VARIABLE_TYPE_FILENAME,
#define RETRO_VARIABLE_FILE_READONLY (void*)1 /* The file must exist. The core will only read it. */
#define RETRO_VARIABLE_FILE_READWRITE_OR_READ (void*)2 /* The file must exist. The core may write to it, but can handle a read-only file. */
#define RETRO_VARIABLE_FILE_READWRITE (void*)3 /* The file must exist; the core will both read and write to it. */
#define RETRO_VARIABLE_FILE_READWRITE_OR_CREATE (void*)4 /* If the file exists, the core will use it; if not, the core will create it. */
#define RETRO_VARIABLE_FILE_WRITEONLY (void*)5 /* The core will replace whatever is here, and will destroy the previous contents. */
RETRO_VARIABLE_TYPE_DUMMY = INT_MAX
};
enum retro_variable_change
{
/* Changes take effect at the next retro_run, or possibly takes a few frames
* (<= 0.1 seconds, otherwise DELAYED should be used). */
RETRO_VARIABLE_CHANGE_INSTANT,
/* Changes take effect during retro_run, but not instantly; for example,
* it may be delayed until the next level is loaded. */
RETRO_VARIABLE_CHANGE_DELAYED,
/* Only used during retro_load_game, or possibly retro_reset. */
RETRO_VARIABLE_CHANGE_RESET,
/* This variable is currently ignored; it is only usable if other options are
* changed first. If these options get changed, RETRO_ENVIRONMENT_SET_VARIABLES
* must be called again. */
RETRO_VARIABLE_CHANGE_WRONG_OPTS,
/* This variable is not applicable for this game. */
RETRO_VARIABLE_CHANGE_WRONG_GAME,
RETRO_VARIABLE_CHANGE_DUMMY = INT_MAX
};
struct retro_variable
{
/* Variable type. See above. */
enum retro_variable_type type;
/* When the implementation will acknowledge changes to this variable.
* Note that the front is allowed to change variables marked
* currently unusable. */
enum retro_variable_change change;
/* Variable name, to be used internally. Suitable for
* saving to configuration files. Example: gb_colorize */
const char *name;
/* Variable name, to show the user. Suitable for GUIs.
* Example: Game Boy colorization */
const char *pub_name;
/* Variable description. Suitable as a second line in GUIs.
* Example: Emulate fake colors on black&white games. */
const char *description;
/* Possible values. See enum retro_variable_type for what type it has.
* Example: { "Enabled", "Disabled", NULL }
* (though that one should be a BOOL instead). */
void *values;
/* Default value. Example: 1 */
void *initial;
/* Called by the frontend every time this variable changes, or NULL to ignore.
* Can be different for different variables.
* ID is the index to the array given to RETRO_ENVIRONMENT_SET_VARIABLES.
* Separators have IDs, but their value must not be set or queried.
* 'value' has the same type as 'initial'.
* Can be called during RETRO_ENVIRONMENT_SET_VARIABLES. */
void (*change_notify)(unsigned int id, void *value, struct retro_core_data *core_handle);
};
struct retro_variable_query
{
/* Same ID as in change_notify. Core sets this before calling GET_VARIABLE. */
unsigned int id;
/* Same type as initial and change_notify. Front sets this. */
void *value;
};