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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319
|
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2016 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __RETROARCH_RUNLOOP_H
#define __RETROARCH_RUNLOOP_H
#include <retro_miscellaneous.h>
#include <retro_common_api.h>
#include "configuration.h"
RETRO_BEGIN_DECLS
enum runloop_ctl_state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,
RUNLOOP_CTL_UNSET_SHUTDOWN,
RUNLOOP_CTL_IS_SHUTDOWN,
RUNLOOP_CTL_SET_EXEC,
RUNLOOP_CTL_UNSET_EXEC,
RUNLOOP_CTL_IS_EXEC,
/* Runloop state */
RUNLOOP_CTL_CLEAR_STATE,
RUNLOOP_CTL_STATE_FREE,
/* Performance counters */
RUNLOOP_CTL_GET_PERFCNT,
RUNLOOP_CTL_SET_PERFCNT_ENABLE,
RUNLOOP_CTL_UNSET_PERFCNT_ENABLE,
RUNLOOP_CTL_IS_PERFCNT_ENABLE,
/* Key event */
RUNLOOP_CTL_FRONTEND_KEY_EVENT_GET,
RUNLOOP_CTL_KEY_EVENT_GET,
RUNLOOP_CTL_DATA_DEINIT,
/* Message queue */
RUNLOOP_CTL_MSG_QUEUE_INIT,
RUNLOOP_CTL_MSG_QUEUE_DEINIT,
RUNLOOP_CTL_MSG_QUEUE_FREE,
RUNLOOP_CTL_MSG_QUEUE_PULL,
RUNLOOP_CTL_MSG_QUEUE_CLEAR,
/* Core options */
RUNLOOP_CTL_HAS_CORE_OPTIONS,
RUNLOOP_CTL_GET_CORE_OPTION_SIZE,
RUNLOOP_CTL_IS_CORE_OPTION_UPDATED,
RUNLOOP_CTL_CORE_OPTIONS_LIST_GET,
RUNLOOP_CTL_CORE_OPTION_PREV,
RUNLOOP_CTL_CORE_OPTION_NEXT,
RUNLOOP_CTL_CORE_OPTIONS_GET,
RUNLOOP_CTL_CORE_OPTIONS_INIT,
RUNLOOP_CTL_CORE_OPTIONS_DEINIT,
RUNLOOP_CTL_CORE_OPTIONS_FREE,
/* Shader dir */
RUNLOOP_CTL_SHADER_DIR_DEINIT,
RUNLOOP_CTL_SHADER_DIR_INIT,
/* System info */
RUNLOOP_CTL_SYSTEM_INFO_GET,
RUNLOOP_CTL_SYSTEM_INFO_INIT,
RUNLOOP_CTL_SYSTEM_INFO_FREE
};
typedef struct rarch_dir_list rarch_dir_list_t;
typedef struct rarch_dir
{
/* Used on reentrancy to use a savestate dir. */
char savefile[PATH_MAX_LENGTH];
char savestate[PATH_MAX_LENGTH];
char systemdir[PATH_MAX_LENGTH];
#ifdef HAVE_OVERLAY
char osk_overlay[PATH_MAX_LENGTH];
#endif
} rarch_dir_t;
typedef struct rarch_path
{
char gb_rom[PATH_MAX_LENGTH];
char bsx_rom[PATH_MAX_LENGTH];
char sufami_rom[2][PATH_MAX_LENGTH];
/* Config associated with global "default" config. */
char config[PATH_MAX_LENGTH];
char append_config[PATH_MAX_LENGTH];
char input_config[PATH_MAX_LENGTH];
#ifdef HAVE_FILE_LOGGER
char default_log[PATH_MAX_LENGTH];
#endif
/* Config file associated with per-core configs. */
char core_specific_config[PATH_MAX_LENGTH];
char core_options_path[PATH_MAX_LENGTH];
} rarch_path_t;
typedef struct rarch_resolution
{
unsigned idx;
unsigned id;
} rarch_resolution_t;
/* All run-time- / command line flag-related globals go here. */
typedef struct global
{
rarch_path_t path;
rarch_dir_t dir;
struct
{
bool save_path;
bool state_path;
bool verbosity;
bool libretro_device[MAX_USERS];
bool libretro;
bool libretro_directory;
bool netplay_mode;
bool netplay_ip_address;
bool netplay_delay_frames;
bool netplay_ip_port;
bool ups_pref;
bool bps_pref;
bool ips_pref;
} has_set;
struct
{
char base[PATH_MAX_LENGTH];
char savefile[PATH_MAX_LENGTH];
char savestate[PATH_MAX_LENGTH];
char cheatfile[PATH_MAX_LENGTH];
char ups[PATH_MAX_LENGTH];
char bps[PATH_MAX_LENGTH];
char ips[PATH_MAX_LENGTH];
char remapfile[PATH_MAX_LENGTH];
} name;
/* A list of save types and associated paths for all content. */
struct string_list *savefiles;
/* For --subsystem content. */
char subsystem[PATH_MAX_LENGTH];
struct string_list *subsystem_fullpaths;
struct
{
bool block_patch;
bool ups_pref;
bool bps_pref;
bool ips_pref;
} patch;
struct
{
bool load_disable;
bool save_disable;
bool use;
} sram;
#ifdef HAVE_NETPLAY
/* Netplay. */
struct
{
char server[PATH_MAX_LENGTH];
bool enable;
bool is_client;
bool is_spectate;
unsigned sync_frames;
unsigned port;
} netplay;
#endif
/* Recording. */
struct
{
char path[PATH_MAX_LENGTH];
char config[PATH_MAX_LENGTH];
unsigned width;
unsigned height;
size_t gpu_width;
size_t gpu_height;
char output_dir[PATH_MAX_LENGTH];
char config_dir[PATH_MAX_LENGTH];
bool use_output_dir;
} record;
/* Settings and/or global state that is specific to
* a console-style implementation. */
struct
{
struct
{
struct
{
rarch_resolution_t current;
rarch_resolution_t initial;
uint32_t *list;
unsigned count;
bool check;
} resolutions;
unsigned gamma_correction;
unsigned char flicker_filter_index;
unsigned char soft_filter_index;
bool pal_enable;
bool pal60_enable;
} screen;
struct
{
bool system_bgm_enable;
} sound;
bool flickerfilter_enable;
bool softfilter_enable;
} console;
} global_t;
typedef struct runloop_ctx_msg_info
{
const char *msg;
unsigned prio;
unsigned duration;
bool flush;
} runloop_ctx_msg_info_t;
global_t *global_get_ptr(void);
/**
* runloop_iterate:
*
* Run Libretro core in RetroArch for one frame.
*
* Returns: 0 on successful run,
* Returns 1 if we have to wait until button input in order
* to wake up the loop.
* Returns -1 if we forcibly quit out of the
* RetroArch iteration loop.
**/
int runloop_iterate(unsigned *sleep_ms);
void runloop_msg_queue_push(const char *msg, unsigned prio,
unsigned duration, bool flush);
char* runloop_msg_queue_pull(void);
bool runloop_ctl(enum runloop_ctl_state state, void *data);
RETRO_END_DECLS
#endif
|