2015-01-09 17:40:33 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2016-01-10 03:06:50 +00:00
|
|
|
* Copyright (C) 2011-2016 - Daniel De Matteis
|
2015-01-09 17:40:33 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
2016-09-05 16:31:32 +00:00
|
|
|
#include <boolean.h>
|
2016-06-03 01:22:35 +00:00
|
|
|
#include <retro_common_api.h>
|
2015-12-06 18:31:47 +00:00
|
|
|
|
2016-09-12 14:36:27 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2016-09-05 16:31:32 +00:00
|
|
|
#include "input/input_defines.h"
|
2015-03-15 01:47:23 +00:00
|
|
|
|
2016-06-03 01:22:35 +00:00
|
|
|
RETRO_BEGIN_DECLS
|
2015-01-09 17:40:33 +00:00
|
|
|
|
2015-11-30 20:42:59 +00:00
|
|
|
enum runloop_ctl_state
|
2015-09-26 10:57:52 +00:00
|
|
|
{
|
2015-12-07 13:13:07 +00:00
|
|
|
RUNLOOP_CTL_NONE = 0,
|
2016-05-16 10:21:38 +00:00
|
|
|
|
2015-12-07 13:13:07 +00:00
|
|
|
RUNLOOP_CTL_SET_FRAME_LIMIT,
|
2015-12-04 08:54:12 +00:00
|
|
|
RUNLOOP_CTL_UNSET_FRAME_LIMIT,
|
|
|
|
RUNLOOP_CTL_SHOULD_SET_FRAME_LIMIT,
|
2016-05-16 10:21:38 +00:00
|
|
|
|
|
|
|
RUNLOOP_CTL_TASK_INIT,
|
|
|
|
|
2016-04-05 23:29:32 +00:00
|
|
|
RUNLOOP_CTL_FRAME_TIME_FREE,
|
2015-12-04 11:26:39 +00:00
|
|
|
RUNLOOP_CTL_SET_FRAME_TIME_LAST,
|
|
|
|
RUNLOOP_CTL_UNSET_FRAME_TIME_LAST,
|
|
|
|
RUNLOOP_CTL_IS_FRAME_TIME_LAST,
|
2016-05-16 10:21:38 +00:00
|
|
|
RUNLOOP_CTL_SET_FRAME_TIME,
|
|
|
|
|
2015-12-04 08:54:12 +00:00
|
|
|
RUNLOOP_CTL_IS_IDLE,
|
2016-05-16 10:21:38 +00:00
|
|
|
RUNLOOP_CTL_SET_IDLE,
|
|
|
|
|
2015-12-01 02:46:56 +00:00
|
|
|
RUNLOOP_CTL_GET_WINDOWED_SCALE,
|
2015-11-30 20:35:50 +00:00
|
|
|
RUNLOOP_CTL_SET_WINDOWED_SCALE,
|
2016-05-16 10:21:38 +00:00
|
|
|
|
2015-12-10 20:43:44 +00:00
|
|
|
RUNLOOP_CTL_IS_OVERRIDES_ACTIVE,
|
|
|
|
RUNLOOP_CTL_SET_OVERRIDES_ACTIVE,
|
|
|
|
RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE,
|
2016-05-16 10:21:38 +00:00
|
|
|
|
2015-12-17 22:24:40 +00:00
|
|
|
RUNLOOP_CTL_IS_GAME_OPTIONS_ACTIVE,
|
|
|
|
RUNLOOP_CTL_SET_GAME_OPTIONS_ACTIVE,
|
|
|
|
RUNLOOP_CTL_UNSET_GAME_OPTIONS_ACTIVE,
|
2016-05-16 10:21:38 +00:00
|
|
|
|
2016-03-04 18:20:00 +00:00
|
|
|
RUNLOOP_CTL_IS_NONBLOCK_FORCED,
|
|
|
|
RUNLOOP_CTL_SET_NONBLOCK_FORCED,
|
|
|
|
RUNLOOP_CTL_UNSET_NONBLOCK_FORCED,
|
2016-05-16 10:21:38 +00:00
|
|
|
|
2015-11-30 20:35:50 +00:00
|
|
|
RUNLOOP_CTL_SET_LIBRETRO_PATH,
|
2016-05-16 10:21:38 +00:00
|
|
|
|
2015-11-30 20:35:50 +00:00
|
|
|
RUNLOOP_CTL_IS_SLOWMOTION,
|
|
|
|
RUNLOOP_CTL_SET_SLOWMOTION,
|
2016-05-27 14:35:21 +00:00
|
|
|
|
2015-11-30 20:35:50 +00:00
|
|
|
RUNLOOP_CTL_IS_PAUSED,
|
|
|
|
RUNLOOP_CTL_SET_PAUSED,
|
|
|
|
RUNLOOP_CTL_SET_MAX_FRAMES,
|
|
|
|
RUNLOOP_CTL_GLOBAL_FREE,
|
2016-05-16 10:21:38 +00:00
|
|
|
|
2015-11-30 20:35:50 +00:00
|
|
|
RUNLOOP_CTL_SET_CORE_SHUTDOWN,
|
2015-12-04 07:00:51 +00:00
|
|
|
RUNLOOP_CTL_UNSET_CORE_SHUTDOWN,
|
|
|
|
RUNLOOP_CTL_IS_CORE_SHUTDOWN,
|
2016-05-16 10:21:38 +00:00
|
|
|
|
2015-12-04 11:44:12 +00:00
|
|
|
RUNLOOP_CTL_SET_SHUTDOWN,
|
|
|
|
RUNLOOP_CTL_UNSET_SHUTDOWN,
|
|
|
|
RUNLOOP_CTL_IS_SHUTDOWN,
|
2016-05-16 10:21:38 +00:00
|
|
|
|
2015-11-30 20:35:50 +00:00
|
|
|
RUNLOOP_CTL_SET_EXEC,
|
2015-12-04 02:01:48 +00:00
|
|
|
RUNLOOP_CTL_UNSET_EXEC,
|
|
|
|
RUNLOOP_CTL_IS_EXEC,
|
2016-05-16 10:21:38 +00:00
|
|
|
|
2016-05-27 14:35:21 +00:00
|
|
|
/* Runloop state */
|
|
|
|
RUNLOOP_CTL_CLEAR_STATE,
|
|
|
|
RUNLOOP_CTL_STATE_FREE,
|
|
|
|
|
|
|
|
/* Performance counters */
|
2015-12-10 11:37:24 +00:00
|
|
|
RUNLOOP_CTL_GET_PERFCNT,
|
2015-11-30 20:56:35 +00:00
|
|
|
RUNLOOP_CTL_SET_PERFCNT_ENABLE,
|
|
|
|
RUNLOOP_CTL_UNSET_PERFCNT_ENABLE,
|
|
|
|
RUNLOOP_CTL_IS_PERFCNT_ENABLE,
|
2016-05-16 10:21:38 +00:00
|
|
|
|
2016-05-27 14:35:21 +00:00
|
|
|
/* Key event */
|
2016-01-21 00:52:02 +00:00
|
|
|
RUNLOOP_CTL_FRONTEND_KEY_EVENT_GET,
|
2015-12-13 13:31:06 +00:00
|
|
|
RUNLOOP_CTL_KEY_EVENT_GET,
|
2015-11-30 22:29:46 +00:00
|
|
|
RUNLOOP_CTL_DATA_DEINIT,
|
2016-02-04 19:56:22 +00:00
|
|
|
|
2016-05-27 14:35:21 +00:00
|
|
|
/* Message queue */
|
2015-11-30 20:35:50 +00:00
|
|
|
RUNLOOP_CTL_MSG_QUEUE_INIT,
|
|
|
|
RUNLOOP_CTL_MSG_QUEUE_DEINIT,
|
2016-02-03 16:48:01 +00:00
|
|
|
RUNLOOP_CTL_MSG_QUEUE_PULL,
|
2016-02-03 16:50:53 +00:00
|
|
|
RUNLOOP_CTL_MSG_QUEUE_CLEAR,
|
2016-05-15 08:14:23 +00:00
|
|
|
|
2016-05-27 14:35:21 +00:00
|
|
|
/* Core options */
|
2015-12-09 08:34:19 +00:00
|
|
|
RUNLOOP_CTL_HAS_CORE_OPTIONS,
|
2015-12-09 08:37:54 +00:00
|
|
|
RUNLOOP_CTL_GET_CORE_OPTION_SIZE,
|
2015-12-07 13:13:07 +00:00
|
|
|
RUNLOOP_CTL_IS_CORE_OPTION_UPDATED,
|
2016-05-15 08:09:41 +00:00
|
|
|
RUNLOOP_CTL_CORE_OPTIONS_LIST_GET,
|
2015-12-09 08:21:49 +00:00
|
|
|
RUNLOOP_CTL_CORE_OPTION_PREV,
|
|
|
|
RUNLOOP_CTL_CORE_OPTION_NEXT,
|
2015-12-07 13:13:07 +00:00
|
|
|
RUNLOOP_CTL_CORE_OPTIONS_GET,
|
2015-12-07 13:16:34 +00:00
|
|
|
RUNLOOP_CTL_CORE_OPTIONS_INIT,
|
2015-12-07 13:13:07 +00:00
|
|
|
RUNLOOP_CTL_CORE_OPTIONS_DEINIT,
|
2016-04-06 00:30:20 +00:00
|
|
|
RUNLOOP_CTL_CORE_OPTIONS_FREE,
|
2016-05-15 08:14:23 +00:00
|
|
|
|
2016-05-27 14:35:21 +00:00
|
|
|
/* System info */
|
2016-09-06 06:38:26 +00:00
|
|
|
RUNLOOP_CTL_SYSTEM_INFO_GET,
|
2016-05-12 07:37:21 +00:00
|
|
|
RUNLOOP_CTL_SYSTEM_INFO_INIT,
|
2016-07-31 21:45:01 +00:00
|
|
|
RUNLOOP_CTL_SYSTEM_INFO_FREE,
|
|
|
|
|
|
|
|
/* HTTP server */
|
|
|
|
RUNLOOP_CTL_HTTPSERVER_INIT,
|
2016-09-04 19:31:50 +00:00
|
|
|
RUNLOOP_CTL_HTTPSERVER_DESTROY
|
2015-09-26 10:57:52 +00:00
|
|
|
};
|
|
|
|
|
2015-08-03 18:15:46 +00:00
|
|
|
typedef struct rarch_resolution
|
|
|
|
{
|
|
|
|
unsigned idx;
|
|
|
|
unsigned id;
|
|
|
|
} rarch_resolution_t;
|
2015-03-15 01:47:23 +00:00
|
|
|
|
2015-08-03 18:15:46 +00:00
|
|
|
/* All run-time- / command line flag-related globals go here. */
|
|
|
|
|
|
|
|
typedef struct global
|
2015-03-15 01:47:23 +00:00
|
|
|
{
|
2016-09-29 19:07:10 +00:00
|
|
|
#ifdef HAVE_NETWORKING
|
2015-03-21 00:59:47 +00:00
|
|
|
/* Netplay. */
|
2015-07-27 15:18:10 +00:00
|
|
|
struct
|
|
|
|
{
|
2016-03-17 23:32:02 +00:00
|
|
|
bool enable;
|
2015-07-27 15:18:10 +00:00
|
|
|
bool is_client;
|
|
|
|
bool is_spectate;
|
|
|
|
unsigned sync_frames;
|
2016-09-15 03:54:18 +00:00
|
|
|
unsigned check_frames;
|
2015-07-27 15:18:10 +00:00
|
|
|
unsigned port;
|
|
|
|
} netplay;
|
2015-03-21 00:59:47 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
2016-02-03 16:56:40 +00:00
|
|
|
typedef struct runloop_ctx_msg_info
|
|
|
|
{
|
|
|
|
const char *msg;
|
|
|
|
unsigned prio;
|
|
|
|
unsigned duration;
|
|
|
|
bool flush;
|
|
|
|
} runloop_ctx_msg_info_t;
|
|
|
|
|
2015-03-21 00:59:47 +00:00
|
|
|
global_t *global_get_ptr(void);
|
|
|
|
|
2015-01-09 17:40:33 +00:00
|
|
|
/**
|
2015-12-07 14:22:36 +00:00
|
|
|
* runloop_iterate:
|
2015-01-09 17:40:33 +00:00
|
|
|
*
|
2015-01-09 23:59:05 +00:00
|
|
|
* Run Libretro core in RetroArch for one frame.
|
2015-01-09 17:40:33 +00:00
|
|
|
*
|
2016-01-28 17:53:25 +00:00
|
|
|
* Returns: 0 on successful run,
|
|
|
|
* Returns 1 if we have to wait until button input in order
|
|
|
|
* to wake up the loop.
|
2016-02-04 19:56:22 +00:00
|
|
|
* Returns -1 if we forcibly quit out of the
|
|
|
|
* RetroArch iteration loop.
|
2015-01-09 17:40:33 +00:00
|
|
|
**/
|
2015-12-07 14:22:36 +00:00
|
|
|
int runloop_iterate(unsigned *sleep_ms);
|
2015-01-09 17:40:33 +00:00
|
|
|
|
2015-12-07 14:32:14 +00:00
|
|
|
void runloop_msg_queue_push(const char *msg, unsigned prio,
|
2015-03-15 01:47:23 +00:00
|
|
|
unsigned duration, bool flush);
|
|
|
|
|
2016-05-08 03:21:31 +00:00
|
|
|
char* runloop_msg_queue_pull(void);
|
2016-05-08 00:47:20 +00:00
|
|
|
|
2016-09-05 05:04:15 +00:00
|
|
|
bool runloop_is_quit_confirm(void);
|
2016-09-30 05:46:58 +00:00
|
|
|
|
2016-09-05 05:04:15 +00:00
|
|
|
void runloop_set_quit_confirm(bool on);
|
|
|
|
|
2016-05-12 07:25:52 +00:00
|
|
|
bool runloop_ctl(enum runloop_ctl_state state, void *data);
|
2015-11-30 14:35:57 +00:00
|
|
|
|
2016-06-03 01:22:35 +00:00
|
|
|
RETRO_END_DECLS
|
2015-01-09 17:40:33 +00:00
|
|
|
|
|
|
|
#endif
|