1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-03 00:38:44 +00:00

Get rid of input_mouse_grabbed - move retroarch types to

retroarch_types.h
This commit is contained in:
twinaphex 2021-09-30 23:22:50 +02:00
parent 878ad88e5b
commit 49fbed2423
17 changed files with 833 additions and 807 deletions

View File

@ -19,6 +19,7 @@
#include "../configuration.h"
#include "../paths.h"
#include "../retroarch.h"
#include "../version.h"
#include <string/stdstring.h>
@ -34,8 +35,6 @@
#include "../deps/rcheevos/include/rc_api_runtime.h"
/* Define this macro to log URLs. */
#undef CHEEVOS_LOG_URLS

View File

@ -29,9 +29,10 @@
#include <streams/interface_stream.h>
#include "retroarch.h"
#include "retroarch_types.h"
#include "input/input_defines.h"
#include "configuration.h"
RETRO_BEGIN_DECLS

122
core.h
View File

@ -23,130 +23,10 @@
#include <retro_common_api.h>
#include "core_type.h"
#include "input/input_defines.h"
#include "disk_control_interface.h"
#include "retroarch_types.h"
RETRO_BEGIN_DECLS
enum
{
/* Polling is performed before
* call to retro_run. */
POLL_TYPE_EARLY = 0,
/* Polling is performed when requested. */
POLL_TYPE_NORMAL,
/* Polling is performed on first call to
* retro_input_state per frame. */
POLL_TYPE_LATE
};
typedef struct rarch_memory_descriptor
{
struct retro_memory_descriptor core; /* uint64_t alignment */
size_t disconnect_mask;
} rarch_memory_descriptor_t;
typedef struct rarch_memory_map
{
rarch_memory_descriptor_t *descriptors;
unsigned num_descriptors;
} rarch_memory_map_t;
typedef struct rarch_system_info
{
struct retro_location_callback location_cb; /* ptr alignment */
disk_control_interface_t disk_control; /* ptr alignment */
struct retro_system_info info; /* ptr alignment */
rarch_memory_map_t mmaps; /* ptr alignment */
const char *input_desc_btn[MAX_USERS][RARCH_FIRST_META_KEY];
struct
{
struct retro_subsystem_info *data;
unsigned size;
} subsystem;
struct
{
struct retro_controller_info *data;
unsigned size;
} ports;
unsigned rotation;
unsigned performance_level;
char valid_extensions[255];
bool load_no_content;
bool supports_vfs;
} rarch_system_info_t;
typedef struct retro_ctx_input_state_info
{
retro_input_state_t cb;
} retro_ctx_input_state_info_t;
typedef struct retro_ctx_cheat_info
{
const char *code;
unsigned index;
bool enabled;
} retro_ctx_cheat_info_t;
typedef struct retro_ctx_api_info
{
unsigned version;
} retro_ctx_api_info_t;
typedef struct retro_ctx_region_info
{
unsigned region;
} retro_ctx_region_info_t;
typedef struct retro_ctx_controller_info
{
unsigned port;
unsigned device;
} retro_ctx_controller_info_t;
typedef struct retro_ctx_memory_info
{
void *data;
size_t size;
unsigned id;
} retro_ctx_memory_info_t;
typedef struct retro_ctx_load_content_info
{
struct retro_game_info *info;
const struct string_list *content;
const struct retro_subsystem_info *special;
} retro_ctx_load_content_info_t;
typedef struct retro_ctx_serialize_info
{
const void *data_const;
void *data;
size_t size;
} retro_ctx_serialize_info_t;
typedef struct retro_ctx_size_info
{
size_t size;
} retro_ctx_size_info_t;
typedef struct retro_ctx_environ_info
{
retro_environment_t env;
} retro_ctx_environ_info_t;
typedef struct retro_callbacks
{
retro_video_refresh_t frame_cb;
retro_audio_sample_t sample_cb;
retro_audio_sample_batch_t sample_batch_cb;
retro_input_state_t state_cb;
retro_input_poll_t poll_cb;
} retro_callbacks_t;
#ifdef HAVE_REWIND
bool core_set_rewind_callbacks(void);
#endif

View File

@ -1,32 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2017 - 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 __CORE_TYPE_H
#define __CORE_TYPE_H
enum rarch_core_type
{
CORE_TYPE_PLAIN = 0,
CORE_TYPE_DUMMY,
CORE_TYPE_FFMPEG,
CORE_TYPE_MPV,
CORE_TYPE_IMAGEVIEWER,
CORE_TYPE_NETRETROPAD,
CORE_TYPE_VIDEO_PROCESSOR,
CORE_TYPE_GONG
};
#endif

View File

@ -22,7 +22,7 @@
#include <retro_common_api.h>
#include <libretro.h>
#include "core_type.h"
#include "retroarch_types.h"
RETRO_BEGIN_DECLS

View File

@ -1053,11 +1053,11 @@ static LRESULT CALLBACK wnd_proc_common_internal(HWND hwnd,
break;
#ifdef HAVE_CLIP_WINDOW
case WM_SETFOCUS:
if (input_mouse_grabbed())
if (input_state_get_ptr()->grab_mouse_state)
win32_clip_window(true);
break;
case WM_KILLFOCUS:
if (input_mouse_grabbed())
if (input_state_get_ptr()->grab_mouse_state)
win32_clip_window(false);
break;
#endif
@ -1128,7 +1128,7 @@ static LRESULT CALLBACK wnd_proc_winraw_common_internal(HWND hwnd,
break;
case WM_SETFOCUS:
#ifdef HAVE_CLIP_WINDOW
if (input_mouse_grabbed())
if (input_state_get_ptr()->grab_mouse_state)
win32_clip_window(true);
#endif
#if !defined(_XBOX)
@ -1138,7 +1138,7 @@ static LRESULT CALLBACK wnd_proc_winraw_common_internal(HWND hwnd,
break;
case WM_KILLFOCUS:
#ifdef HAVE_CLIP_WINDOW
if (input_mouse_grabbed())
if (input_state_get_ptr()->grab_mouse_state)
win32_clip_window(false);
#endif
#if !defined(_XBOX)
@ -1264,11 +1264,11 @@ static LRESULT CALLBACK wnd_proc_common_dinput_internal(HWND hwnd,
break;
#ifdef HAVE_CLIP_WINDOW
case WM_SETFOCUS:
if (input_mouse_grabbed())
if (input_state_get_ptr()->grab_mouse_state)
win32_clip_window(true);
break;
case WM_KILLFOCUS:
if (input_mouse_grabbed())
if (input_state_get_ptr()->grab_mouse_state)
win32_clip_window(false);
break;
#endif

View File

@ -45,6 +45,10 @@
#include "../configuration.h"
#include "../performance_counters.h"
#ifdef HAVE_COMMAND
#include "../command.h"
#endif
RETRO_BEGIN_DECLS
/**
@ -294,19 +298,37 @@ struct rarch_joypad_driver
typedef struct
{
/**
* Array of timers, one for each entry in enum input_combo_type.
*/
rarch_timer_t combo_timers[INPUT_COMBO_LAST];
/* pointers */
input_driver_t *current_driver;
void *current_data;
const input_device_driver_t *primary_joypad; /* ptr alignment */
const input_device_driver_t *secondary_joypad; /* ptr alignment */
#ifdef HAVE_COMMAND
command_t *command[MAX_CMD_DRIVERS];
#endif
#ifdef HAVE_NETWORKGAMEPAD
input_remote_t *remote;
#endif
turbo_buttons_t turbo_btns; /* int32_t alignment */
input_mapper_t mapper; /* uint32_t alignment */
/* primitives */
bool nonblocking_flag;
bool keyboard_linefeed_enable;
bool block_hotkey;
bool block_libretro_input;
bool grab_mouse_state;
bool analog_requested[MAX_USERS];
bool keyboard_mapping_blocked;
/**
* Array of timers, one for each entry in enum input_combo_type.
*/
rarch_timer_t combo_timers[INPUT_COMBO_LAST];
} input_driver_state_t;
@ -802,8 +824,6 @@ float input_get_sensor_state(unsigned port, unsigned id);
bool input_set_sensor_state(unsigned port,
enum retro_sensor_action action, unsigned rate);
bool input_mouse_grabbed(void);
void *input_driver_init_wrap(input_driver_t *input, const char *name);
const struct retro_keybind *input_config_get_bind_auto(unsigned port, unsigned id);

View File

@ -26,18 +26,6 @@
#include "input_defines.h"
#include "input_types.h"
typedef struct input_mapper
{
/* Left X, Left Y, Right X, Right Y */
int16_t analog_value[MAX_USERS][8];
/* The whole keyboard state */
uint32_t keys[RETROK_LAST / 32 + 1];
/* RetroPad button state of remapped keyboard keys */
unsigned key_button[RETROK_LAST];
/* This is a bitmask of (1 << key_bind_id). */
input_bits_t buttons[MAX_USERS];
} input_mapper_t;
RETRO_BEGIN_DECLS
/**

View File

@ -27,6 +27,16 @@ enum input_auto_game_focus_type
AUTO_GAME_FOCUS_LAST
};
/* Turbo support. */
struct turbo_buttons
{
int32_t turbo_pressed[MAX_USERS];
unsigned count;
uint16_t enable[MAX_USERS];
bool frame_enable[MAX_USERS];
bool mode1_enable[MAX_USERS];
};
struct retro_keybind
{
/* Human-readable label for the control. */
@ -65,6 +75,18 @@ typedef struct
uint16_t analog_buttons[16];
} input_bits_t;
typedef struct input_mapper
{
/* Left X, Left Y, Right X, Right Y */
int16_t analog_value[MAX_USERS][8];
/* The whole keyboard state */
uint32_t keys[RETROK_LAST / 32 + 1];
/* RetroPad button state of remapped keyboard keys */
unsigned key_button[RETROK_LAST];
/* This is a bitmask of (1 << key_bind_id). */
input_bits_t buttons[MAX_USERS];
} input_mapper_t;
typedef struct rarch_joypad_driver input_device_driver_t;
typedef struct input_keyboard_line input_keyboard_line_t;
typedef struct rarch_joypad_info rarch_joypad_info_t;
@ -73,5 +95,6 @@ typedef struct input_keyboard_ctx_wait input_keyboard_ctx_wait_t;
typedef struct joypad_connection joypad_connection_t;
typedef struct pad_connection_listener_interface pad_connection_listener_t;
typedef struct turbo_buttons turbo_buttons_t;
#endif /* __INPUT_TYPES__H */

View File

@ -416,7 +416,6 @@
05A8E23920A63CED0084ABDA /* IOSurface.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOSurface.framework; path = System/Library/Frameworks/IOSurface.framework; sourceTree = SDKROOT; };
05A8E23B20A63CF50084ABDA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
05B5F90D20ED6A03009C521F /* content.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = content.h; path = ../../content.h; sourceTree = "<group>"; };
05B5F90E20ED6A03009C521F /* core_type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = core_type.h; path = ../../core_type.h; sourceTree = "<group>"; };
05B5F90F20ED6A03009C521F /* command.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = command.c; path = ../../command.c; sourceTree = "<group>"; };
05B5F91120ED6AAE009C521F /* retroarch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = retroarch.c; path = ../../retroarch.c; sourceTree = "<group>"; };
05B5F91220ED6AAF009C521F /* retroarch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = retroarch.h; path = ../../retroarch.h; sourceTree = "<group>"; };
@ -1180,7 +1179,6 @@
05BF821520ED69D100D95B19 /* core_impl.c */,
05BF821820ED69D100D95B19 /* core_info.c */,
05BF821B20ED69D100D95B19 /* core_info.h */,
05B5F90E20ED6A03009C521F /* core_type.h */,
05BF821920ED69D100D95B19 /* core.h */,
0548E2B220F976E10094A083 /* driver.c */,
0548E2B520F976E20094A083 /* driver.h */,

View File

@ -254,7 +254,6 @@
92B9EC9824E0537500E6CFB2 /* config.def.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = config.def.h; path = ../../config.def.h; sourceTree = "<group>"; };
92B9EC9924E0537500E6CFB2 /* config.features.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = config.features.h; path = ../../config.features.h; sourceTree = "<group>"; };
92B9EC9A24E0537500E6CFB2 /* content.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = content.h; path = ../../content.h; sourceTree = "<group>"; };
92B9EC9B24E0539000E6CFB2 /* core_type.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = core_type.h; path = ../../core_type.h; sourceTree = "<group>"; };
92B9EC9C24E0539000E6CFB2 /* core_info.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = core_info.c; path = ../../core_info.c; sourceTree = "<group>"; };
92B9EC9D24E0539000E6CFB2 /* core_info.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = core_info.h; path = ../../core_info.h; sourceTree = "<group>"; };
92B9EC9E24E0539000E6CFB2 /* core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = core.h; path = ../../core.h; sourceTree = "<group>"; };
@ -847,7 +846,6 @@
92B9ECBF24E054B500E6CFB2 /* core_backup.h */,
92B9EC9C24E0539000E6CFB2 /* core_info.c */,
92B9EC9D24E0539000E6CFB2 /* core_info.h */,
92B9EC9B24E0539000E6CFB2 /* core_type.h */,
92B9ECB024E054B400E6CFB2 /* core_updater_list.c */,
92B9ECB624E054B500E6CFB2 /* core_updater_list.h */,
92B9EC9E24E0539000E6CFB2 /* core.h */,

File diff suppressed because it is too large Load Diff

View File

@ -41,14 +41,10 @@
#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"
#include "retroarch_types.h"
RETRO_BEGIN_DECLS
@ -83,285 +79,6 @@ RETRO_BEGIN_DECLS
* 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 retroarch_ctl(enum rarch_ctl_state state, void *data);
int retroarch_get_capabilities(enum rarch_capabilities type,
@ -650,101 +367,6 @@ 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);

View File

@ -765,18 +765,6 @@ typedef struct my_list_t
int size;
} my_list;
typedef struct turbo_buttons turbo_buttons_t;
/* Turbo support. */
struct turbo_buttons
{
int32_t turbo_pressed[MAX_USERS];
unsigned count;
uint16_t enable[MAX_USERS];
bool frame_enable[MAX_USERS];
bool mode1_enable[MAX_USERS];
};
typedef struct input_game_focus_state
{
bool enabled;
@ -946,12 +934,6 @@ struct rarch_state
void *keyboard_press_data;
#ifdef HAVE_COMMAND
command_t *input_driver_command[MAX_CMD_DRIVERS];
#endif
#ifdef HAVE_NETWORKGAMEPAD
input_remote_t *input_driver_remote;
#endif
#ifdef HAVE_HID
const void *hid_data;
@ -1054,8 +1036,6 @@ struct rarch_state
jmp_buf error_sjlj_context; /* 4-byte alignment,
put it right before long */
turbo_buttons_t input_driver_turbo_btns; /* int32_t alignment */
int osk_ptr;
#if defined(HAVE_COMMAND)
#ifdef HAVE_NETWORK_CMD
@ -1157,8 +1137,6 @@ struct rarch_state
*/
gfx_ctx_flags_t deferred_flag_data; /* uint32_t alignment */
retro_bits_t has_set_libretro_device; /* uint32_t alignment */
input_mapper_t input_driver_mapper; /* uint32_t alignment */
#ifdef HAVE_BSV_MOVIE
struct bsv_state bsv_movie_state; /* char alignment */
@ -1328,21 +1306,11 @@ struct rarch_state
bool has_set_netplay_check_frames;
#endif
bool input_driver_keyboard_linefeed_enable;
bool input_driver_block_hotkey;
bool input_driver_block_libretro_input;
bool input_driver_grab_mouse_state;
bool input_driver_analog_requested[MAX_USERS];
input_game_focus_state_t game_focus_state; /* bool alignment */
bool recording_enable;
bool streaming_enable;
bool main_ui_companion_is_on_foreground;
bool keyboard_mapping_blocked;
retro_bits_512_t keyboard_mapping_bits;
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)

528
retroarch_types.h Normal file
View File

@ -0,0 +1,528 @@
#ifndef _RETROARCH_TYPES_H
#define _RETROARCH_TYPES_H
#include <boolean.h>
#include <retro_inline.h>
#include <retro_common_api.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_MENU
#include "menu/menu_defines.h"
#endif
#include "input/input_defines.h"
#include "disk_control_interface.h"
RETRO_BEGIN_DECLS
enum
{
/* Polling is performed before
* call to retro_run. */
POLL_TYPE_EARLY = 0,
/* Polling is performed when requested. */
POLL_TYPE_NORMAL,
/* Polling is performed on first call to
* retro_input_state per frame. */
POLL_TYPE_LATE
};
enum rarch_core_type
{
CORE_TYPE_PLAIN = 0,
CORE_TYPE_DUMMY,
CORE_TYPE_FFMPEG,
CORE_TYPE_MPV,
CORE_TYPE_IMAGEVIEWER,
CORE_TYPE_NETRETROPAD,
CORE_TYPE_VIDEO_PROCESSOR,
CORE_TYPE_GONG
};
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
};
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
};
typedef struct rarch_memory_descriptor
{
struct retro_memory_descriptor core; /* uint64_t alignment */
size_t disconnect_mask;
} rarch_memory_descriptor_t;
typedef struct rarch_memory_map
{
rarch_memory_descriptor_t *descriptors;
unsigned num_descriptors;
} rarch_memory_map_t;
typedef struct rarch_system_info
{
struct retro_location_callback location_cb; /* ptr alignment */
disk_control_interface_t disk_control; /* ptr alignment */
struct retro_system_info info; /* ptr alignment */
rarch_memory_map_t mmaps; /* ptr alignment */
const char *input_desc_btn[MAX_USERS][RARCH_FIRST_META_KEY];
struct
{
struct retro_subsystem_info *data;
unsigned size;
} subsystem;
struct
{
struct retro_controller_info *data;
unsigned size;
} ports;
unsigned rotation;
unsigned performance_level;
char valid_extensions[255];
bool load_no_content;
bool supports_vfs;
} rarch_system_info_t;
typedef struct retro_ctx_input_state_info
{
retro_input_state_t cb;
} retro_ctx_input_state_info_t;
typedef struct retro_ctx_cheat_info
{
const char *code;
unsigned index;
bool enabled;
} retro_ctx_cheat_info_t;
typedef struct retro_ctx_api_info
{
unsigned version;
} retro_ctx_api_info_t;
typedef struct retro_ctx_region_info
{
unsigned region;
} retro_ctx_region_info_t;
typedef struct retro_ctx_controller_info
{
unsigned port;
unsigned device;
} retro_ctx_controller_info_t;
typedef struct retro_ctx_memory_info
{
void *data;
size_t size;
unsigned id;
} retro_ctx_memory_info_t;
typedef struct retro_ctx_load_content_info
{
struct retro_game_info *info;
const struct string_list *content;
const struct retro_subsystem_info *special;
} retro_ctx_load_content_info_t;
typedef struct retro_ctx_serialize_info
{
const void *data_const;
void *data;
size_t size;
} retro_ctx_serialize_info_t;
typedef struct retro_ctx_size_info
{
size_t size;
} retro_ctx_size_info_t;
typedef struct retro_ctx_environ_info
{
retro_environment_t env;
} retro_ctx_environ_info_t;
typedef struct retro_callbacks
{
retro_video_refresh_t frame_cb;
retro_audio_sample_t sample_cb;
retro_audio_sample_batch_t sample_batch_cb;
retro_input_state_t state_cb;
retro_input_poll_t poll_cb;
} retro_callbacks_t;
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;
/* 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;
};
RETRO_END_DECLS
#endif

View File

@ -29,7 +29,7 @@
#endif
#include "../content.h"
#include "../core_type.h"
#include "../retroarch_types.h"
RETRO_BEGIN_DECLS

View File

@ -4943,7 +4943,7 @@ static void ui_companion_qt_toggle(void *data, bool force)
settings_t *settings = config_get_ptr();
bool ui_companion_toggle = settings->bools.ui_companion_toggle;
bool video_fullscreen = settings->bools.video_fullscreen;
bool mouse_grabbed = input_mouse_grabbed();
bool mouse_grabbed = input_state_get_ptr()->grab_mouse_state;
if (ui_companion_toggle || force)
{