RetroArch/command.h

256 lines
7.4 KiB
C
Raw Normal View History

2012-07-28 05:47:35 +00:00
/* RetroArch - A frontend for libretro.
2014-01-01 00:50:59 +00:00
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
2016-01-10 03:06:50 +00:00
* Copyright (C) 2011-2016 - Daniel De Matteis
2012-07-28 05:47:35 +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/>.
*/
2015-04-13 09:39:40 +00:00
#ifndef COMMAND_H__
#define COMMAND_H__
2012-07-28 05:47:35 +00:00
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdint.h>
#include <boolean.h>
#include <retro_common_api.h>
2012-07-28 05:47:35 +00:00
RETRO_BEGIN_DECLS
2013-04-21 08:05:12 +00:00
2016-05-09 18:10:08 +00:00
typedef struct command command_t;
2012-07-28 05:47:35 +00:00
2016-05-09 19:23:53 +00:00
typedef struct command_handle
{
command_t *handle;
unsigned id;
} command_handle_t;
2016-05-09 18:30:47 +00:00
enum event_command
{
2016-05-09 18:51:53 +00:00
CMD_EVENT_NONE = 0,
2016-05-09 18:30:47 +00:00
/* Resets RetroArch. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_RESET,
CMD_EVENT_SET_PER_GAME_RESOLUTION,
CMD_EVENT_SET_FRAME_LIMIT,
2016-05-09 18:30:47 +00:00
/* Loads core. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_LOAD_CORE,
CMD_EVENT_LOAD_CORE_PERSIST,
CMD_EVENT_UNLOAD_CORE,
CMD_EVENT_LOAD_STATE,
/* Swaps the current state with what's on the undo load buffer */
CMD_EVENT_UNDO_LOAD_STATE,
/* Rewrites a savestate on disk */
2016-06-04 19:34:06 +00:00
CMD_EVENT_UNDO_SAVE_STATE,
2016-05-09 18:51:53 +00:00
CMD_EVENT_SAVE_STATE,
CMD_EVENT_SAVE_STATE_DECREMENT,
CMD_EVENT_SAVE_STATE_INCREMENT,
2016-05-09 18:30:47 +00:00
/* Takes screenshot. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_TAKE_SCREENSHOT,
2016-05-09 18:30:47 +00:00
/* Quits RetroArch. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_QUIT,
CMD_EVENT_QUIT_CONFIRM,
2016-05-09 18:30:47 +00:00
/* Reinitialize all drivers. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_REINIT,
2016-05-09 18:30:47 +00:00
/* Toggles cheevos hardcore mode. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_CHEEVOS_HARDCORE_MODE_TOGGLE,
2016-05-09 18:30:47 +00:00
/* Deinitialize rewind. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_REWIND_DEINIT,
2016-05-09 18:30:47 +00:00
/* Initializes rewind. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_REWIND_INIT,
2016-05-09 18:30:47 +00:00
/* Toggles rewind. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_REWIND_TOGGLE,
2016-05-09 18:30:47 +00:00
/* Deinitializes autosave. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_AUTOSAVE_DEINIT,
2016-05-09 18:30:47 +00:00
/* Initializes autosave. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_AUTOSAVE_INIT,
CMD_EVENT_AUTOSAVE_STATE,
2016-05-09 18:30:47 +00:00
/* Stops audio. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_AUDIO_STOP,
2016-05-09 18:30:47 +00:00
/* Starts audio. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_AUDIO_START,
2016-05-09 18:30:47 +00:00
/* Mutes audio. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_AUDIO_MUTE_TOGGLE,
2016-05-09 18:30:47 +00:00
/* Initializes overlay. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_OVERLAY_INIT,
2016-05-09 18:30:47 +00:00
/* Deinitializes overlay. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_OVERLAY_DEINIT,
2016-05-09 18:30:47 +00:00
/* Sets current scale factor for overlay. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_OVERLAY_SET_SCALE_FACTOR,
2016-05-09 18:30:47 +00:00
/* Sets current alpha modulation for overlay. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_OVERLAY_SET_ALPHA_MOD,
2016-05-09 18:30:47 +00:00
/* Cycle to next overlay. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_OVERLAY_NEXT,
2016-05-09 18:30:47 +00:00
/* Deinitializes overlay. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_DSP_FILTER_INIT,
2016-05-09 18:30:47 +00:00
/* Deinitializes graphics filter. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_DSP_FILTER_DEINIT,
2016-05-09 18:30:47 +00:00
/* Deinitializes GPU recoring. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_GPU_RECORD_DEINIT,
2016-05-09 18:30:47 +00:00
/* Initializes recording system. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_RECORD_INIT,
2016-05-09 18:30:47 +00:00
/* Deinitializes recording system. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_RECORD_DEINIT,
2016-05-09 18:30:47 +00:00
/* Deinitializes history playlist. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_HISTORY_DEINIT,
2016-05-09 18:30:47 +00:00
/* Initializes history playlist. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_HISTORY_INIT,
2016-05-09 18:30:47 +00:00
/* Deinitializes core information. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_CORE_INFO_DEINIT,
2016-05-09 18:30:47 +00:00
/* Initializes core information. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_CORE_INFO_INIT,
2016-05-09 18:30:47 +00:00
/* Deinitializes core. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_CORE_DEINIT,
2016-05-09 18:30:47 +00:00
/* Initializes core. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_CORE_INIT,
2016-05-09 18:30:47 +00:00
/* Set audio blocking state. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_AUDIO_SET_BLOCKING_STATE,
2016-05-09 18:30:47 +00:00
/* Set audio nonblocking state. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_AUDIO_SET_NONBLOCKING_STATE,
2016-05-09 18:30:47 +00:00
/* Apply video state changes. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_VIDEO_APPLY_STATE_CHANGES,
2016-05-09 18:30:47 +00:00
/* Set video blocking state. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_VIDEO_SET_BLOCKING_STATE,
2016-05-09 18:30:47 +00:00
/* Set video nonblocking state. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_VIDEO_SET_NONBLOCKING_STATE,
2016-05-09 18:30:47 +00:00
/* Sets current aspect ratio index. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_VIDEO_SET_ASPECT_RATIO,
CMD_EVENT_RESET_CONTEXT,
2016-05-09 18:30:47 +00:00
/* Restarts RetroArch. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_RESTART_RETROARCH,
2016-05-09 18:30:47 +00:00
/* Shutdown the OS */
2016-05-09 18:51:53 +00:00
CMD_EVENT_SHUTDOWN,
2016-05-09 18:30:47 +00:00
/* Reboot the OS */
2016-05-09 18:51:53 +00:00
CMD_EVENT_REBOOT,
2016-05-09 18:30:47 +00:00
/* Resume RetroArch when in menu. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_RESUME,
2016-05-09 18:30:47 +00:00
/* Toggles pause. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_PAUSE_TOGGLE,
2016-05-09 18:30:47 +00:00
/* Pauses RetroArch. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_UNPAUSE,
2016-05-09 18:30:47 +00:00
/* Unpauses retroArch. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_PAUSE,
CMD_EVENT_PAUSE_CHECKS,
CMD_EVENT_MENU_SAVE_CURRENT_CONFIG,
2016-08-26 14:43:29 +00:00
CMD_EVENT_MENU_SAVE_CURRENT_CONFIG_OVERRIDE_CORE,
CMD_EVENT_MENU_SAVE_CURRENT_CONFIG_OVERRIDE_GAME,
2016-05-09 18:51:53 +00:00
CMD_EVENT_MENU_SAVE_CONFIG,
CMD_EVENT_MENU_PAUSE_LIBRETRO,
2016-05-09 18:30:47 +00:00
/* Toggles menu on/off. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_MENU_TOGGLE,
CMD_EVENT_MENU_REFRESH,
2016-05-09 18:30:47 +00:00
/* Applies shader changes. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_SHADERS_APPLY_CHANGES,
2016-05-09 18:30:47 +00:00
/* Initializes shader directory. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_SHADER_DIR_INIT,
2016-05-09 18:30:47 +00:00
/* Deinitializes shader directory. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_SHADER_DIR_DEINIT,
2016-05-09 18:30:47 +00:00
/* Initializes controllers. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_CONTROLLERS_INIT,
CMD_EVENT_SAVEFILES,
2016-05-09 18:30:47 +00:00
/* Initializes savefiles. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_SAVEFILES_INIT,
2016-05-09 18:30:47 +00:00
/* Deinitializes savefiles. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_SAVEFILES_DEINIT,
2016-05-09 18:30:47 +00:00
/* Initializes cheats. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_CHEATS_INIT,
2016-05-09 18:30:47 +00:00
/* Deinitializes cheats. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_CHEATS_DEINIT,
2016-05-09 18:30:47 +00:00
/* Apply cheats. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_CHEATS_APPLY,
2016-05-09 18:30:47 +00:00
/* Deinitializes network system. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_NETWORK_DEINIT,
2016-05-09 18:30:47 +00:00
/* Initializes network system. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_NETWORK_INIT,
2016-05-09 18:30:47 +00:00
/* Initializes netplay system. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_NETPLAY_INIT,
2016-05-09 18:30:47 +00:00
/* Deinitializes netplay system. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_NETPLAY_DEINIT,
2016-05-09 18:30:47 +00:00
/* Flip netplay players. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_NETPLAY_FLIP_PLAYERS,
2016-05-09 18:30:47 +00:00
/* Initializes BSV movie. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_BSV_MOVIE_INIT,
2016-05-09 18:30:47 +00:00
/* Deinitializes BSV movie. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_BSV_MOVIE_DEINIT,
2016-05-09 18:30:47 +00:00
/* Initializes command interface. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_COMMAND_INIT,
2016-05-09 18:30:47 +00:00
/* Deinitialize command interface. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_COMMAND_DEINIT,
2016-05-09 18:30:47 +00:00
/* Initializes remote gamepad interface. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_REMOTE_INIT,
2016-05-09 18:30:47 +00:00
/* Deinitializes remote gamepad interface. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_REMOTE_DEINIT,
2016-05-09 18:30:47 +00:00
/* Reinitializes audio driver. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_AUDIO_REINIT,
2016-05-09 18:30:47 +00:00
/* Resizes windowed scale. Will reinitialize video driver. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_RESIZE_WINDOWED_SCALE,
2016-05-09 18:30:47 +00:00
/* Deinitializes temporary content. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_TEMPORARY_CONTENT_DEINIT,
CMD_EVENT_SUBSYSTEM_FULLPATHS_DEINIT,
CMD_EVENT_LOG_FILE_DEINIT,
2016-05-09 18:30:47 +00:00
/* Toggles disk eject. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_DISK_EJECT_TOGGLE,
2016-05-09 18:30:47 +00:00
/* Cycle to next disk. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_DISK_NEXT,
2016-05-09 18:30:47 +00:00
/* Cycle to previous disk. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_DISK_PREV,
2016-05-09 18:30:47 +00:00
/* Appends disk image to disk image list. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_DISK_APPEND_IMAGE,
2016-05-09 18:30:47 +00:00
/* Stops rumbling. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_RUMBLE_STOP,
2016-05-09 18:30:47 +00:00
/* Toggles mouse grab. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_GRAB_MOUSE_TOGGLE,
2016-05-09 18:30:47 +00:00
/* Toggles fullscreen mode. */
2016-05-09 18:51:53 +00:00
CMD_EVENT_FULLSCREEN_TOGGLE,
CMD_EVENT_PERFCNT_REPORT_FRONTEND_LOG,
CMD_EVENT_VOLUME_UP,
2016-05-20 22:54:29 +00:00
CMD_EVENT_VOLUME_DOWN,
2016-07-30 19:36:01 +00:00
CMD_EVENT_DISABLE_OVERRIDES,
CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET
2016-05-09 18:30:47 +00:00
};
#ifdef HAVE_COMMAND
2016-05-07 22:25:04 +00:00
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
2016-05-09 19:23:53 +00:00
bool command_network_send(const char *cmd_);
#endif
2016-05-07 22:25:04 +00:00
#endif
2016-05-09 19:23:53 +00:00
bool command_network_new(
command_t *handle,
bool stdin_enable,
bool network_enable,
uint16_t port);
2016-05-07 22:25:04 +00:00
2016-05-09 19:25:37 +00:00
command_t *command_new(bool local_enable);
2016-05-09 19:23:53 +00:00
bool command_poll(command_t *handle);
2016-05-07 22:25:04 +00:00
2016-05-09 18:10:08 +00:00
bool command_get(command_handle_t *handle);
2016-05-07 22:25:04 +00:00
2016-05-09 19:23:53 +00:00
bool command_set(command_handle_t *handle);
2016-05-09 18:10:08 +00:00
bool command_free(command_t *handle);
2016-05-09 18:30:47 +00:00
/**
2016-05-09 18:51:53 +00:00
* command_event:
2016-05-09 18:30:47 +00:00
* @cmd : Command index.
*
* Performs RetroArch command with index @cmd.
*
* Returns: true (1) on success, otherwise false (0).
**/
bool command_event(enum event_command action, void *data);
2016-02-13 06:19:21 +00:00
RETRO_END_DECLS
2013-04-21 08:05:12 +00:00
2012-07-28 05:47:35 +00:00
#endif