RetroArch/retroarch.h
2021-09-28 01:16:53 +02:00

923 lines
25 KiB
C

/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2021 - Daniel De Matteis
* Copyright (C) 2016-2019 - Brad Parker
*
* 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_H
#define __RETROARCH_H
#include <stdint.h>
#include <stddef.h>
#include <sys/types.h>
#include <stdlib.h>
#include <boolean.h>
#include <retro_inline.h>
#include <retro_common_api.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <lists/string_list.h>
#include <queues/task_queue.h>
#include <queues/message_queue.h>
#ifdef HAVE_AUDIOMIXER
#include <audio/audio_mixer.h>
#endif
#include "audio/audio_defines.h"
#include "gfx/video_driver.h"
#include "core_type.h"
#include "core.h"
#ifdef HAVE_MENU
#include "menu/menu_defines.h"
#endif
#include "runloop.h"
RETRO_BEGIN_DECLS
#define MEASURE_FRAME_TIME_SAMPLES_COUNT (2 * 1024)
#define RETRO_ENVIRONMENT_RETROARCH_START_BLOCK 0x800000
#define RETRO_ENVIRONMENT_SET_SAVE_STATE_IN_BACKGROUND (2 | RETRO_ENVIRONMENT_RETROARCH_START_BLOCK)
/* bool * --
* Boolean value that tells the front end to save states in the
* background or not.
*/
#define RETRO_ENVIRONMENT_GET_CLEAR_ALL_THREAD_WAITS_CB (3 | RETRO_ENVIRONMENT_RETROARCH_START_BLOCK)
/* retro_environment_t * --
* Provides the callback to the frontend method which will cancel
* all currently waiting threads. Used when coordination is needed
* between the core and the frontend to gracefully stop all threads.
*/
#define RETRO_ENVIRONMENT_POLL_TYPE_OVERRIDE (4 | RETRO_ENVIRONMENT_RETROARCH_START_BLOCK)
/* unsigned * --
* Tells the frontend to override the poll type behavior.
* Allows the frontend to influence the polling behavior of the
* frontend.
*
* Will be unset when retro_unload_game is called.
*
* 0 - Don't Care, no changes, frontend still determines polling type behavior.
* 1 - Early
* 2 - Normal
* 3 - Late
*/
enum rarch_ctl_state
{
RARCH_CTL_NONE = 0,
/* Deinitializes RetroArch. */
RARCH_CTL_MAIN_DEINIT,
RARCH_CTL_IS_INITED,
RARCH_CTL_IS_DUMMY_CORE,
RARCH_CTL_IS_CORE_LOADED,
#if defined(HAVE_RUNAHEAD) && (defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB))
RARCH_CTL_IS_SECOND_CORE_AVAILABLE,
RARCH_CTL_IS_SECOND_CORE_LOADED,
#endif
RARCH_CTL_IS_BPS_PREF,
RARCH_CTL_UNSET_BPS_PREF,
RARCH_CTL_IS_PATCH_BLOCKED,
RARCH_CTL_IS_UPS_PREF,
RARCH_CTL_UNSET_UPS_PREF,
RARCH_CTL_IS_IPS_PREF,
RARCH_CTL_UNSET_IPS_PREF,
#ifdef HAVE_CONFIGFILE
/* Block config read */
RARCH_CTL_SET_BLOCK_CONFIG_READ,
RARCH_CTL_UNSET_BLOCK_CONFIG_READ,
#endif
/* Username */
RARCH_CTL_HAS_SET_USERNAME,
RARCH_CTL_HAS_SET_SUBSYSTEMS,
RARCH_CTL_IS_IDLE,
RARCH_CTL_SET_IDLE,
RARCH_CTL_SET_WINDOWED_SCALE,
#ifdef HAVE_CONFIGFILE
RARCH_CTL_IS_OVERRIDES_ACTIVE,
RARCH_CTL_IS_REMAPS_CORE_ACTIVE,
RARCH_CTL_SET_REMAPS_CORE_ACTIVE,
RARCH_CTL_IS_REMAPS_CONTENT_DIR_ACTIVE,
RARCH_CTL_SET_REMAPS_CONTENT_DIR_ACTIVE,
RARCH_CTL_IS_REMAPS_GAME_ACTIVE,
RARCH_CTL_SET_REMAPS_GAME_ACTIVE,
#endif
RARCH_CTL_IS_MISSING_BIOS,
RARCH_CTL_SET_MISSING_BIOS,
RARCH_CTL_UNSET_MISSING_BIOS,
RARCH_CTL_IS_GAME_OPTIONS_ACTIVE,
RARCH_CTL_IS_FOLDER_OPTIONS_ACTIVE,
RARCH_CTL_IS_PAUSED,
RARCH_CTL_SET_PAUSED,
RARCH_CTL_SET_SHUTDOWN,
/* Runloop state */
RARCH_CTL_STATE_FREE,
/* Performance counters */
RARCH_CTL_GET_PERFCNT,
RARCH_CTL_SET_PERFCNT_ENABLE,
RARCH_CTL_UNSET_PERFCNT_ENABLE,
RARCH_CTL_IS_PERFCNT_ENABLE,
/* Core options */
RARCH_CTL_HAS_CORE_OPTIONS,
RARCH_CTL_GET_CORE_OPTION_SIZE,
RARCH_CTL_CORE_OPTIONS_LIST_GET,
RARCH_CTL_CORE_OPTION_PREV,
RARCH_CTL_CORE_OPTION_NEXT,
RARCH_CTL_CORE_OPTION_UPDATE_DISPLAY,
RARCH_CTL_CORE_IS_RUNNING,
/* BSV Movie */
RARCH_CTL_BSV_MOVIE_IS_INITED
};
enum rarch_capabilities
{
RARCH_CAPABILITIES_NONE = 0,
RARCH_CAPABILITIES_CPU,
RARCH_CAPABILITIES_COMPILER
};
enum rarch_override_setting
{
RARCH_OVERRIDE_SETTING_NONE = 0,
RARCH_OVERRIDE_SETTING_LIBRETRO,
RARCH_OVERRIDE_SETTING_VERBOSITY,
RARCH_OVERRIDE_SETTING_LIBRETRO_DIRECTORY,
RARCH_OVERRIDE_SETTING_SAVE_PATH,
RARCH_OVERRIDE_SETTING_STATE_PATH,
#ifdef HAVE_NETWORKING
RARCH_OVERRIDE_SETTING_NETPLAY_MODE,
RARCH_OVERRIDE_SETTING_NETPLAY_IP_ADDRESS,
RARCH_OVERRIDE_SETTING_NETPLAY_IP_PORT,
RARCH_OVERRIDE_SETTING_NETPLAY_STATELESS_MODE,
RARCH_OVERRIDE_SETTING_NETPLAY_CHECK_FRAMES,
#endif
RARCH_OVERRIDE_SETTING_UPS_PREF,
RARCH_OVERRIDE_SETTING_BPS_PREF,
RARCH_OVERRIDE_SETTING_IPS_PREF,
RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE,
RARCH_OVERRIDE_SETTING_LOG_TO_FILE,
RARCH_OVERRIDE_SETTING_LAST
};
enum runloop_action
{
RUNLOOP_ACTION_NONE = 0,
RUNLOOP_ACTION_AUTOSAVE
};
struct rarch_main_wrap
{
char **argv;
const char *content_path;
const char *sram_path;
const char *state_path;
const char *config_path;
const char *libretro_path;
int argc;
bool verbose;
bool no_content;
bool touched;
};
typedef struct rarch_resolution
{
unsigned idx;
unsigned id;
} rarch_resolution_t;
/* All run-time- / command line flag-related globals go here. */
typedef struct global
{
#ifdef HAVE_MENU
struct
{
retro_time_t prev_start_time;
retro_time_t noop_press_time;
retro_time_t noop_start_time;
retro_time_t action_start_time;
retro_time_t action_press_time;
} menu;
#endif
struct
{
char *remapfile;
char savefile[8192];
char savestate[8192];
char cheatfile[8192];
char ups[8192];
char bps[8192];
char ips[8192];
char label[8192];
} name;
/* Recording. */
struct
{
size_t gpu_width;
size_t gpu_height;
unsigned width;
unsigned height;
char path[8192];
char config[8192];
char output_dir[8192];
char config_dir[8192];
bool use_output_dir;
} record;
/* Settings and/or global state that is specific to
* a console-style implementation. */
struct
{
struct
{
struct
{
uint32_t *list;
unsigned count;
rarch_resolution_t current;
rarch_resolution_t initial;
bool check;
} resolutions;
unsigned gamma_correction;
unsigned int flicker_filter_index;
unsigned char soft_filter_index;
bool pal_enable;
bool pal60_enable;
} screen;
bool flickerfilter_enable;
bool softfilter_enable;
} console;
unsigned old_analog_dpad_mode[MAX_USERS];
unsigned old_libretro_device[MAX_USERS];
bool old_analog_dpad_mode_set;
bool old_libretro_device_set;
bool remapping_cache_active;
/* Settings and/or global states specific to menus */
#ifdef HAVE_MENU
enum menu_action menu_prev_action;
#endif
bool launched_from_cli;
bool cli_load_menu_on_error;
} global_t;
typedef struct content_file_override
{
char *ext;
bool need_fullpath;
bool persistent_data;
} content_file_override_t;
typedef struct content_file_info
{
char *full_path;
char *archive_path;
char *archive_file;
char *dir;
char *name;
char *ext;
char *meta; /* Unused at present */
void *data;
size_t data_size;
bool file_in_archive;
bool persistent_data;
} content_file_info_t;
typedef struct content_file_list
{
content_file_info_t *entries;
struct string_list *temporary_files;
struct retro_game_info *game_info;
struct retro_game_info_ext *game_info_ext;
size_t size;
} content_file_list_t;
typedef struct content_state
{
char *pending_subsystem_roms[RARCH_MAX_SUBSYSTEM_ROMS];
content_file_override_t *content_override_list;
content_file_list_t *content_list;
int pending_subsystem_rom_num;
int pending_subsystem_id;
unsigned pending_subsystem_rom_id;
uint32_t rom_crc;
char companion_ui_crc32[32];
char pending_subsystem_ident[255];
char pending_rom_crc_path[PATH_MAX_LENGTH];
char companion_ui_db_name[PATH_MAX_LENGTH];
bool is_inited;
bool core_does_not_need_content;
bool pending_subsystem_init;
bool pending_rom_crc;
} content_state_t;
bool rarch_ctl(enum rarch_ctl_state state, void *data);
int retroarch_get_capabilities(enum rarch_capabilities type,
char *s, size_t len);
void retroarch_override_setting_set(enum rarch_override_setting enum_idx, void *data);
void retroarch_override_setting_unset(enum rarch_override_setting enum_idx, void *data);
bool retroarch_override_setting_is_set(enum rarch_override_setting enum_idx, void *data);
bool retroarch_is_forced_fullscreen(void);
void retroarch_set_current_core_type(
enum rarch_core_type type, bool explicitly_set);
const char* retroarch_get_shader_preset(void);
bool retroarch_is_switching_display_mode(void);
/**
* retroarch_main_init:
* @argc : Count of (commandline) arguments.
* @argv : (Commandline) arguments.
*
* Initializes the program.
*
* Returns: 1 (true) on success, otherwise false (0) if there was an error.
**/
bool retroarch_main_init(int argc, char *argv[]);
bool retroarch_main_quit(void);
global_t *global_get_ptr(void);
content_state_t *content_state_get_ptr(void);
unsigned content_get_subsystem_rom_id(void);
int content_get_subsystem(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(void);
void runloop_msg_queue_push(const char *msg,
unsigned prio, unsigned duration,
bool flush,
char *title,
enum message_queue_icon icon, enum message_queue_category category);
void retroarch_menu_running(void);
void retroarch_menu_running_finished(bool quit);
enum retro_language rarch_get_language_from_iso(const char *lang);
void rarch_favorites_init(void);
void rarch_favorites_deinit(void);
/* Audio */
#ifdef HAVE_AUDIOMIXER
typedef struct audio_mixer_stream
{
audio_mixer_sound_t *handle;
audio_mixer_voice_t *voice;
audio_mixer_stop_cb_t stop_cb;
void *buf;
char *name;
size_t bufsize;
float volume;
enum audio_mixer_stream_type stream_type;
enum audio_mixer_type type;
enum audio_mixer_state state;
} audio_mixer_stream_t;
typedef struct audio_mixer_stream_params
{
void *buf;
char *basename;
audio_mixer_stop_cb_t cb;
size_t bufsize;
unsigned slot_selection_idx;
float volume;
enum audio_mixer_slot_selection_type slot_selection_type;
enum audio_mixer_stream_type stream_type;
enum audio_mixer_type type;
enum audio_mixer_state state;
} audio_mixer_stream_params_t;
#endif
typedef struct audio_driver
{
/* Creates and initializes handle to audio driver.
*
* Returns: audio driver handle on success, otherwise NULL.
**/
void *(*init)(const char *device, unsigned rate,
unsigned latency, unsigned block_frames, unsigned *new_rate);
/*
* @data : Pointer to audio data handle.
* @buf : Audio buffer data.
* @size : Size of audio buffer.
*
* Write samples to audio driver.
*
* Write data in buffer to audio driver.
* A frame here is defined as one combined sample of left and right
* channels. (I.e. 44.1kHz, 16-bit stereo has 88.2k samples/s, and
* 44.1k frames/s.)
*
* Samples are interleaved in format LRLRLRLRLR ...
* If the driver returns true in use_float(), a floating point
* format will be used, with range [-1.0, 1.0].
* If not, signed 16-bit samples in native byte ordering will be used.
*
* This function returns the number of frames successfully written.
* If an error occurs, -1 should be returned.
* Note that non-blocking behavior that cannot write at this time
* should return 0 as returning -1 will terminate the driver.
*
* Unless said otherwise with set_nonblock_state(), all writes
* are blocking, and it should block till it has written all frames.
*/
ssize_t (*write)(void *data, const void *buf, size_t size);
/* Temporarily pauses the audio driver. */
bool (*stop)(void *data);
/* Resumes audio driver from the paused state. */
bool (*start)(void *data, bool is_shutdown);
/* Is the audio driver currently running? */
bool (*alive)(void *data);
/* Should we care about blocking in audio thread? Fast forwarding.
*
* If state is true, nonblocking operation is assumed.
* This is typically used for fast-forwarding. If driver cannot
* implement nonblocking writes, this can be disregarded, but should
* log a message to stderr.
* */
void (*set_nonblock_state)(void *data, bool toggle);
/* Stops and frees driver data. */
void (*free)(void *data);
/* Defines if driver will take standard floating point samples,
* or int16_t samples.
*
* If true is returned, the audio driver is capable of using
* floating point data. This will likely increase performance as the
* resampler unit uses floating point. The sample range is
* [-1.0, 1.0].
* */
bool (*use_float)(void *data);
/* Human-readable identifier. */
const char *ident;
/* Optional. Get audio device list (allocates, caller has to free this) */
void *(*device_list_new)(void *data);
/* Optional. Frees audio device list */
void (*device_list_free)(void *data, void *data2);
/* Optional. */
size_t (*write_avail)(void *data);
size_t (*buffer_size)(void *data);
} audio_driver_t;
bool audio_driver_enable_callback(void);
bool audio_driver_disable_callback(void);
/**
* config_get_audio_driver_options:
*
* Get an enumerated list of all audio driver names, separated by '|'.
*
* Returns: string listing of all audio driver names, separated by '|'.
**/
const char* config_get_audio_driver_options(void);
bool audio_driver_mixer_extension_supported(const char *ext);
void audio_driver_dsp_filter_free(void);
bool audio_driver_dsp_filter_init(const char *device);
void audio_driver_set_buffer_size(size_t bufsize);
bool audio_driver_get_devices_list(void **ptr);
void audio_driver_setup_rewind(void);
bool audio_driver_callback(void);
bool audio_driver_has_callback(void);
void audio_driver_frame_is_reverse(void);
void audio_set_float(enum audio_action action, float val);
float *audio_get_float_ptr(enum audio_action action);
bool *audio_get_bool_ptr(enum audio_action action);
#ifdef HAVE_AUDIOMIXER
audio_mixer_stream_t *audio_driver_mixer_get_stream(unsigned i);
bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params);
void audio_driver_mixer_play_stream(unsigned i);
void audio_driver_mixer_play_menu_sound(unsigned i);
void audio_driver_mixer_play_menu_sound_looped(unsigned i);
void audio_driver_mixer_play_stream_sequential(unsigned i);
void audio_driver_mixer_play_stream_looped(unsigned i);
void audio_driver_mixer_stop_stream(unsigned i);
float audio_driver_mixer_get_stream_volume(unsigned i);
void audio_driver_mixer_set_stream_volume(unsigned i, float vol);
void audio_driver_mixer_remove_stream(unsigned i);
enum audio_mixer_state audio_driver_mixer_get_stream_state(unsigned i);
const char *audio_driver_mixer_get_stream_name(unsigned i);
void audio_driver_load_system_sounds(void);
#endif
extern audio_driver_t audio_rsound;
extern audio_driver_t audio_audioio;
extern audio_driver_t audio_oss;
extern audio_driver_t audio_alsa;
extern audio_driver_t audio_alsathread;
extern audio_driver_t audio_tinyalsa;
extern audio_driver_t audio_roar;
extern audio_driver_t audio_openal;
extern audio_driver_t audio_opensl;
extern audio_driver_t audio_jack;
extern audio_driver_t audio_sdl;
extern audio_driver_t audio_xa;
extern audio_driver_t audio_pulse;
extern audio_driver_t audio_dsound;
extern audio_driver_t audio_wasapi;
extern audio_driver_t audio_coreaudio;
extern audio_driver_t audio_coreaudio3;
extern audio_driver_t audio_xenon360;
extern audio_driver_t audio_ps3;
extern audio_driver_t audio_gx;
extern audio_driver_t audio_ax;
extern audio_driver_t audio_psp;
extern audio_driver_t audio_ps2;
extern audio_driver_t audio_ctr_csnd;
extern audio_driver_t audio_ctr_dsp;
#ifdef HAVE_THREADS
extern audio_driver_t audio_ctr_dsp_thread;
#endif
extern audio_driver_t audio_switch;
extern audio_driver_t audio_switch_thread;
extern audio_driver_t audio_switch_libnx_audren;
extern audio_driver_t audio_switch_libnx_audren_thread;
extern audio_driver_t audio_rwebaudio;
/* Recording */
enum ffemu_pix_format
{
FFEMU_PIX_RGB565 = 0,
FFEMU_PIX_BGR24,
FFEMU_PIX_ARGB8888
};
enum streaming_mode
{
STREAMING_MODE_TWITCH = 0,
STREAMING_MODE_YOUTUBE,
STREAMING_MODE_FACEBOOK,
STREAMING_MODE_LOCAL,
STREAMING_MODE_CUSTOM
};
enum record_config_type
{
RECORD_CONFIG_TYPE_RECORDING_CUSTOM = 0,
RECORD_CONFIG_TYPE_RECORDING_LOW_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_MED_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_HIGH_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_WEBM_FAST,
RECORD_CONFIG_TYPE_RECORDING_WEBM_HIGH_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_GIF,
RECORD_CONFIG_TYPE_RECORDING_APNG,
RECORD_CONFIG_TYPE_STREAMING_CUSTOM,
RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY,
RECORD_CONFIG_TYPE_STREAMING_MED_QUALITY,
RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY,
RECORD_CONFIG_TYPE_STREAMING_NETPLAY
};
/* Parameters passed to ffemu_new() */
struct record_params
{
/* Framerate per second of input video. */
double fps;
/* Sample rate of input audio. */
double samplerate;
/* Filename to dump to. */
const char *filename;
/* Path to config. Optional. */
const char *config;
const char *audio_resampler;
/* Desired output resolution. */
unsigned out_width;
unsigned out_height;
/* Total size of framebuffer used in input. */
unsigned fb_width;
unsigned fb_height;
/* Audio channels. */
unsigned channels;
unsigned video_record_scale_factor;
unsigned video_stream_scale_factor;
unsigned video_record_threads;
unsigned streaming_mode;
/* Aspect ratio of input video. Parameters are passed to the muxer,
* the video itself is not scaled.
*/
float aspect_ratio;
enum record_config_type preset;
/* Input pixel format. */
enum ffemu_pix_format pix_fmt;
bool video_gpu_record;
};
struct record_video_data
{
const void *data;
unsigned width;
unsigned height;
int pitch;
bool is_dupe;
};
struct record_audio_data
{
const void *data;
size_t frames;
};
typedef struct record_driver
{
void *(*init)(const struct record_params *params);
void (*free)(void *data);
bool (*push_video)(void *data, const struct record_video_data *video_data);
bool (*push_audio)(void *data, const struct record_audio_data *audio_data);
bool (*finalize)(void *data);
const char *ident;
} record_driver_t;
extern const record_driver_t record_ffmpeg;
/**
* config_get_record_driver_options:
*
* Get an enumerated list of all record driver names, separated by '|'.
*
* Returns: string listing of all record driver names, separated by '|'.
**/
const char* config_get_record_driver_options(void);
bool recording_is_enabled(void);
void streaming_set_state(bool state);
bool streaming_is_enabled(void);
void recording_driver_update_streaming_url(void);
/* Video */
#ifdef HAVE_OVERLAY
#include "input/input_overlay.h"
#endif
/* BSV Movie */
void bsv_movie_frame_rewind(void);
/* Camera */
typedef struct camera_driver
{
/* FIXME: params for initialization - queries for resolution,
* framerate, color format which might or might not be honored. */
void *(*init)(const char *device, uint64_t buffer_types,
unsigned width, unsigned height);
void (*free)(void *data);
bool (*start)(void *data);
void (*stop)(void *data);
/* Polls the camera driver.
* Will call the appropriate callback if a new frame is ready.
* Returns true if a new frame was handled. */
bool (*poll)(void *data,
retro_camera_frame_raw_framebuffer_t frame_raw_cb,
retro_camera_frame_opengl_texture_t frame_gl_cb);
const char *ident;
} camera_driver_t;
extern camera_driver_t camera_v4l2;
extern camera_driver_t camera_android;
extern camera_driver_t camera_rwebcam;
extern camera_driver_t camera_avfoundation;
/**
* config_get_camera_driver_options:
*
* Get an enumerated list of all camera driver names,
* separated by '|'.
*
* Returns: string listing of all camera driver names,
* separated by '|'.
**/
const char* config_get_camera_driver_options(void);
bool menu_driver_is_alive(void);
bool gfx_widgets_ready(void);
unsigned int retroarch_get_rotation(void);
void retroarch_init_task_queue(void);
/******************************************************************************
* BEGIN helper functions for input_driver refactoring
*
* These functions have similar names and signatures to functions that now require
* an input_driver_state_t pointer to be passed to them. They essentially wrap
* the newer functions by grabbing pointer to the driver state struct and the
* settings struct.
******************************************************************************/
bool input_set_rumble_state(unsigned port,
enum retro_rumble_effect effect, uint16_t strength);
bool input_set_rumble_gain(unsigned gain);
float input_get_sensor_state(unsigned port, unsigned id);
bool input_set_sensor_state(unsigned port,
enum retro_sensor_action action, unsigned rate);
void input_set_nonblock_state(void);
void input_unset_nonblock_state(void);
void *input_driver_get_data(void);
/******************************************************************************
* END helper functions for input_driver refactoring
******************************************************************************/
bool input_key_pressed(int key, bool keyboard_pressed);
bool input_mouse_grabbed(void);
const char *joypad_driver_name(unsigned i);
void joypad_driver_reinit(void *data, const char *joypad_driver_name);
void *input_driver_init_wrap(input_driver_t *input, const char *name);
/* Human readable order of input binds */
static const unsigned input_config_bind_order[] = {
RETRO_DEVICE_ID_JOYPAD_UP,
RETRO_DEVICE_ID_JOYPAD_DOWN,
RETRO_DEVICE_ID_JOYPAD_LEFT,
RETRO_DEVICE_ID_JOYPAD_RIGHT,
RETRO_DEVICE_ID_JOYPAD_A,
RETRO_DEVICE_ID_JOYPAD_B,
RETRO_DEVICE_ID_JOYPAD_X,
RETRO_DEVICE_ID_JOYPAD_Y,
RETRO_DEVICE_ID_JOYPAD_SELECT,
RETRO_DEVICE_ID_JOYPAD_START,
RETRO_DEVICE_ID_JOYPAD_L,
RETRO_DEVICE_ID_JOYPAD_R,
RETRO_DEVICE_ID_JOYPAD_L2,
RETRO_DEVICE_ID_JOYPAD_R2,
RETRO_DEVICE_ID_JOYPAD_L3,
RETRO_DEVICE_ID_JOYPAD_R3,
19, /* Left Analog Up */
18, /* Left Analog Down */
17, /* Left Analog Left */
16, /* Left Analog Right */
23, /* Right Analog Up */
22, /* Right Analog Down */
21, /* Right Analog Left */
20, /* Right Analog Right */
};
/* Creates folder and core options stub file for subsequent runs */
bool core_options_create_override(bool game_specific);
bool core_options_remove_override(bool game_specific);
void core_options_reset(void);
void core_options_flush(void);
typedef enum apple_view_type
{
APPLE_VIEW_TYPE_NONE = 0,
APPLE_VIEW_TYPE_OPENGL_ES,
APPLE_VIEW_TYPE_OPENGL,
APPLE_VIEW_TYPE_VULKAN,
APPLE_VIEW_TYPE_METAL
} apple_view_type_t;
bool retroarch_get_current_savestate_path(char *path, size_t len);
runloop_state_t *runloop_state_get_ptr(void);
RETRO_END_DECLS
#endif