RetroArch/retroarch_types.h

351 lines
7.8 KiB
C
Raw Normal View History

#ifndef _RETROARCH_TYPES_H
#define _RETROARCH_TYPES_H
#include <setjmp.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
};
enum rarch_ctl_state
{
RARCH_CTL_NONE = 0,
/* Deinitializes RetroArch. */
RARCH_CTL_MAIN_DEINIT,
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_UNSET_BPS_PREF,
RARCH_CTL_UNSET_UPS_PREF,
RARCH_CTL_UNSET_IPS_PREF,
XDelta patch support (Take 2) (#15915) * Add xdelta in deps * Include <assert.h> in xdelta3.h - Otherwise the static_assert calls can fail * Build xdelta3 in Makefile.common * Add xdelta support to the softpatching infrastructure - The patching itself isn't fully implemented yet * Adjust how xdelta3.h checks the sizes of some types - Now checks max values instead of relying on autotools * Add some enums that were excluded by the cherry-pick * Remove stray whitespace * Adjust SIZE macros in xdelta3.h - Move them outside the XD3_USE_LARGEFILE64 block - Add more SIZE declarations - Make SIZEOF_UNSIGNED_LONG_LONG contingent on the presence of ULLONG_MAX * Reintegrate xdelta support * Enable support for xdelta's secondary compressors - Necessary for some patches * Fix some format specifiers * Remove unnecessary files from xdelta * Include xdelta3.h with a relative path * Add xdelta3 headers to HEADERS variable * Gate Xdelta support behind HAVE_XDELTA - HAVE_XDELTA is on by default - HAVE_PATCH is still required for HAVE_XDELTA to be meaningful - Support is mostly contingent on the availability of LZMA - Anything modern should be okay - Legacy platforms (e.g. DOS) may need to have Xdelta support disabled - At least until some other solution can be found * Disable HAVE_XDELTA on platforms where the build recently failed - These come from looking at the failed builds on GitHub - These are guesses, and may turn out to be wrong * Fix a potential memory leak - Whoops, looks like I need to call two cleanup functions - xd3_close_stream exists separately from xd3_free_stream * Split the --help printout for --xdelta into its own strlcat call - GCC was complaining about #ifdefs within macro arguments being non-portable * Fix some incorrect printf format specifiers * Modify Xdelta to adhere to C89 - It's mostly using RetroArch's INLINE macro instead of the inline keyword * Slight cleanups * Remove a stray comma that was hindering C89 builds * Add XDelta support to CHANGES.md * Change how the xdelta patch's name is computed - To be in line with other recent refactoring * Fix an incorrect merge - Whoops, this part was from before I figured out how to get the size of a patched file * Explain the song-and-dance behind computing a patched file's size * Define some XDelta3-related constants to 0 on 32-bit platforms * Adjust some Xdelta-related macro definitions - Exclude the encoder, since we're not making patches - Move some #defines to after inclusion of <stdint.h>, to fix undefined behavior - Remove _WIN32_WINNT overrides, since they were for code that we're not using * Fix Xdelta support * Wrap an encoder-only function in `#if XD3_ENCODER`
2023-11-23 20:19:07 -08:00
RARCH_CTL_UNSET_XDELTA_PREF,
#ifdef HAVE_CONFIGFILE
/* Block config read */
RARCH_CTL_SET_BLOCK_CONFIG_READ,
RARCH_CTL_UNSET_BLOCK_CONFIG_READ,
#endif
RARCH_CTL_SET_WINDOWED_SCALE,
#ifdef HAVE_CONFIGFILE
RARCH_CTL_SET_REMAPS_CORE_ACTIVE,
RARCH_CTL_SET_REMAPS_CONTENT_DIR_ACTIVE,
RARCH_CTL_SET_REMAPS_GAME_ACTIVE,
#endif
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_CORE_OPTIONS_LIST_GET,
RARCH_CTL_CORE_OPTION_PREV,
RARCH_CTL_CORE_OPTION_NEXT,
RARCH_CTL_CORE_OPTION_UPDATE_DISPLAY,
/* 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_CHECK_FRAMES,
#endif
RARCH_OVERRIDE_SETTING_UPS_PREF,
RARCH_OVERRIDE_SETTING_BPS_PREF,
RARCH_OVERRIDE_SETTING_IPS_PREF,
XDelta patch support (Take 2) (#15915) * Add xdelta in deps * Include <assert.h> in xdelta3.h - Otherwise the static_assert calls can fail * Build xdelta3 in Makefile.common * Add xdelta support to the softpatching infrastructure - The patching itself isn't fully implemented yet * Adjust how xdelta3.h checks the sizes of some types - Now checks max values instead of relying on autotools * Add some enums that were excluded by the cherry-pick * Remove stray whitespace * Adjust SIZE macros in xdelta3.h - Move them outside the XD3_USE_LARGEFILE64 block - Add more SIZE declarations - Make SIZEOF_UNSIGNED_LONG_LONG contingent on the presence of ULLONG_MAX * Reintegrate xdelta support * Enable support for xdelta's secondary compressors - Necessary for some patches * Fix some format specifiers * Remove unnecessary files from xdelta * Include xdelta3.h with a relative path * Add xdelta3 headers to HEADERS variable * Gate Xdelta support behind HAVE_XDELTA - HAVE_XDELTA is on by default - HAVE_PATCH is still required for HAVE_XDELTA to be meaningful - Support is mostly contingent on the availability of LZMA - Anything modern should be okay - Legacy platforms (e.g. DOS) may need to have Xdelta support disabled - At least until some other solution can be found * Disable HAVE_XDELTA on platforms where the build recently failed - These come from looking at the failed builds on GitHub - These are guesses, and may turn out to be wrong * Fix a potential memory leak - Whoops, looks like I need to call two cleanup functions - xd3_close_stream exists separately from xd3_free_stream * Split the --help printout for --xdelta into its own strlcat call - GCC was complaining about #ifdefs within macro arguments being non-portable * Fix some incorrect printf format specifiers * Modify Xdelta to adhere to C89 - It's mostly using RetroArch's INLINE macro instead of the inline keyword * Slight cleanups * Remove a stray comma that was hindering C89 builds * Add XDelta support to CHANGES.md * Change how the xdelta patch's name is computed - To be in line with other recent refactoring * Fix an incorrect merge - Whoops, this part was from before I figured out how to get the size of a patched file * Explain the song-and-dance behind computing a patched file's size * Define some XDelta3-related constants to 0 on 32-bit platforms * Adjust some Xdelta-related macro definitions - Exclude the encoder, since we're not making patches - Move some #defines to after inclusion of <stdint.h>, to fix undefined behavior - Remove _WIN32_WINNT overrides, since they were for code that we're not using * Fix Xdelta support * Wrap an encoder-only function in `#if XD3_ENCODER`
2023-11-23 20:19:07 -08:00
RARCH_OVERRIDE_SETTING_XDELTA_PREF,
RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE,
RARCH_OVERRIDE_SETTING_LOG_TO_FILE,
2023-05-03 11:15:42 -07:00
RARCH_OVERRIDE_SETTING_DATABASE_SCAN,
RARCH_OVERRIDE_SETTING_LAST
};
enum runloop_action
{
RUNLOOP_ACTION_NONE = 0,
RUNLOOP_ACTION_AUTOSAVE
};
2023-01-05 14:34:46 -08:00
enum rarch_main_wrap_flags
{
RARCH_MAIN_WRAP_FLAG_VERBOSE = (1 << 0),
RARCH_MAIN_WRAP_FLAG_NO_CONTENT = (1 << 1),
RARCH_MAIN_WRAP_FLAG_TOUCHED = (1 << 2)
};
enum content_state_flags
{
CONTENT_ST_FLAG_IS_INITED = (1 << 0),
CONTENT_ST_FLAG_CORE_DOES_NOT_NEED_CONTENT = (1 << 1),
CONTENT_ST_FLAG_PENDING_SUBSYSTEM_INIT = (1 << 2),
CONTENT_ST_FLAG_PENDING_ROM_CRC = (1 << 3)
};
typedef struct rarch_memory_descriptor
{
struct retro_memory_descriptor core; /* uint64_t alignment */
/* Retroarch can have additional context here */
} 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;
Shader Preset - Wildcard Replacement in Paths on Load (#15023) When a simple preset loads, wildcards which are found in paths inside the presets will be replaced with values coming from the current RetroArch context. This will operate on both texture paths and reference paths. This would allow you to do things like have one preset which could be used with the entire list of images from the Bezel Project E.G. "/shaders/MyBackground_$VID-DRV$ _$CORE$.png" would be replaced with "/shaders/MyBackground_glcore_YabaSanshiro.png" If no file found at that path, the path will revert to the original path, so operates as a fallback "/shaders/MyBackground_$VID-DRV$ _$CORE$.png" * Possible wildcards/tokens to be replaced: * * $CONTENT-DIR$ -> Content Directory of the game rom * * $CORE$ -> Core name * * $GAME$ -> Game ROM's name * * $VID-DRV$ -> Video Driver: Currently active driver, possible replacement values: * glcore * gl * vulkan * d3d11 * d3d9_hlsl * "N/A" * * $VID-DRV-SHADER-EXT$ -> Video Driver Shader File Extension: The extension of shaders type supported by the current video driver: * cg * glsl * slang * * $VID-DRV-PRESET-EXT$ -> Video Driver Preset File Extension: The extension of shaders type supported by the current video driver: * cgp * glslp * slangp * * $CORE-REQ-ROT$ -> Core Requested Rotation: Rotation the core is requesting, possible replacement values: * CORE-REQ-ROT-0 * CORE-REQ-ROT-90 * CORE-REQ-ROT-180 * CORE-REQ-ROT-270 * * $VID-ALLOW-CORE-ROT$ -> Video Allow Core Rotation: Reflects Retroarch's setting allowing the core requested rotation to affect the final rotation: * VID-ALLOW-CORE-ROT-OFF * VID-ALLOW-CORE-ROT-ON * * $VID-USER-ROT$ -> Video User Rotation: Rotation the core is requesting, possible replacement values, does not affect the UI: * VID-USER-ROT-0 * VID-USER-ROT-90 * VID-USER-ROT-180 * VID-USER-ROT-270 * * $VID-FINAL-ROT$ -> Video Final Rotation: Rotation which is the sum of the user rotation and the core rotation if it has been allowed, does not affect the UI: * VID-FINAL-ROT-0 * VID-FINAL-ROT-90 * VID-FINAL-ROT-180 * VID-FINAL-ROT-270 * * $SCREEN-ORIENT$ -> Screen Orientation: User adjusted screen orientation, will change windows from landscape to portrait, including the Retroarch UI: * SCREEN-ORIENT-0 * SCREEN-ORIENT-90 * SCREEN-ORIENT-180 * SCREEN-ORIENT-270 * * $VIEW-ASPECT-ORIENT$ -> Viewport Aspect Orientation: Orientation of the aspect ratio of the RetroArch viewport * VIEW-ASPECT-ORIENT-HORZ * VIEW-ASPECT-ORIENT-VERT * * $CORE-ASPECT-ORIENT$ -> Core Aspect Orientation: Orientation of the aspect ratio requested by the core * CORE-ASPECT-ORIENT-HORZ * CORE-ASPECT-ORIENT-VERT * * $PRESET_DIR$ -> Preset directory's name * * $PRESET$ -> Preset's name * * If no wildcards are found within the path, or the path * after replacing the wildcards does not exist on disk, * the path returned will be unaffected.
2023-02-26 10:06:57 -08:00
unsigned core_requested_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_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_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;
uint8_t flags;
};
/* All run-time- / command line flag-related globals go here. */
typedef struct global
{
jmp_buf error_sjlj_context; /* 4-byte alignment,
put it right before long */
/* Settings and/or global state that is specific to
* a console-style implementation. */
struct
{
struct
{
struct
{
uint32_t *list;
unsigned count;
2023-01-05 14:34:46 -08:00
struct
{
unsigned idx;
unsigned id;
} current;
struct
{
unsigned idx;
unsigned id;
} 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;
char error_string[255];
bool launched_from_cli;
bool cli_load_menu_on_error;
bool error_on_init;
} 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;
uint8_t flags;
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];
} content_state_t;
RETRO_END_DECLS
#endif