mirror of
https://github.com/libretro/beetle-wswan-libretro.git
synced 2024-11-23 07:59:40 +00:00
Update libretro-common
This commit is contained in:
parent
d840a1e9f1
commit
9a77bd35af
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (compat_snprintf.c).
|
||||
@ -23,10 +23,7 @@
|
||||
/* THIS FILE HAS NOT BEEN VALIDATED ON PLATFORMS BESIDES MSVC */
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#include <retro_common.h>
|
||||
#if _MSC_VER >= 1800
|
||||
#include <stdio.h> /* added for _vsnprintf_s and _vscprintf on VS2015 and VS2017 */
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if _MSC_VER < 1800
|
||||
@ -36,12 +33,12 @@
|
||||
#if _MSC_VER < 1300
|
||||
#define _vscprintf c89_vscprintf_retro__
|
||||
|
||||
static int c89_vscprintf_retro__(const char *format, va_list pargs)
|
||||
static int c89_vscprintf_retro__(const char *fmt, va_list pargs)
|
||||
{
|
||||
int retval;
|
||||
va_list argcopy;
|
||||
va_copy(argcopy, pargs);
|
||||
retval = vsnprintf(NULL, 0, format, argcopy);
|
||||
retval = vsnprintf(NULL, 0, fmt, argcopy);
|
||||
va_end(argcopy);
|
||||
return retval;
|
||||
}
|
||||
@ -49,35 +46,36 @@ static int c89_vscprintf_retro__(const char *format, va_list pargs)
|
||||
|
||||
/* http://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010 */
|
||||
|
||||
int c99_vsnprintf_retro__(char *outBuf, size_t size, const char *format, va_list ap)
|
||||
int c99_vsnprintf_retro__(char *s, size_t len, const char *fmt, va_list ap)
|
||||
{
|
||||
int count = -1;
|
||||
|
||||
if (size != 0)
|
||||
#if (_MSC_VER <= 1310)
|
||||
count = _vsnprintf(outBuf, size - 1, format, ap);
|
||||
#else
|
||||
count = _vsnprintf_s(outBuf, size, size - 1, format, ap);
|
||||
#endif
|
||||
if (count == -1)
|
||||
count = _vscprintf(format, ap);
|
||||
|
||||
if (count == size)
|
||||
if (len != 0)
|
||||
{
|
||||
/* there was no room for a NULL, so truncate the last character */
|
||||
outBuf[size - 1] = '\0';
|
||||
#if (_MSC_VER <= 1310)
|
||||
count = _vsnprintf(s, len - 1, fmt, ap);
|
||||
#else
|
||||
count = _vsnprintf_s(s, len, len - 1, fmt, ap);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (count == -1)
|
||||
count = _vscprintf(fmt, ap);
|
||||
|
||||
/* there was no room for a NULL, so truncate the last character */
|
||||
if (count == len && len)
|
||||
s[len - 1] = '\0';
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
int c99_snprintf_retro__(char *outBuf, size_t size, const char *format, ...)
|
||||
int c99_snprintf_retro__(char *s, size_t len, const char *fmt, ...)
|
||||
{
|
||||
int count;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
count = c99_vsnprintf_retro__(outBuf, size, format, ap);
|
||||
va_start(ap, fmt);
|
||||
count = c99_vsnprintf_retro__(s, len, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return count;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (compat_strl.c).
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (boolean.h).
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (apple_compat.h).
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (fnmatch.h).
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (getopt.h).
|
||||
@ -72,4 +72,3 @@ RETRO_END_DECLS
|
||||
|
||||
/* pragma once */
|
||||
#endif
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (intrinsics.h).
|
||||
@ -41,7 +41,7 @@ RETRO_BEGIN_DECLS
|
||||
/* Count Leading Zero, unsigned 16bit input value */
|
||||
static INLINE unsigned compat_clz_u16(uint16_t val)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__)
|
||||
return __builtin_clz(val << 16 | 0x8000);
|
||||
#else
|
||||
unsigned ret = 0;
|
||||
@ -61,7 +61,7 @@ static INLINE int compat_ctz(unsigned x)
|
||||
{
|
||||
#if defined(__GNUC__) && !defined(RARCH_CONSOLE)
|
||||
return __builtin_ctz(x);
|
||||
#elif _MSC_VER >= 1400 && !defined(_XBOX)
|
||||
#elif _MSC_VER >= 1400 && !defined(_XBOX) && !defined(__WINRT__)
|
||||
unsigned long r = 0;
|
||||
_BitScanReverse((unsigned long*)&r, x);
|
||||
return (int)r;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (msvc.h).
|
||||
@ -29,20 +29,17 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Pre-MSVC 2015 compilers don't implement snprintf in a cross-platform manner. */
|
||||
/* Pre-MSVC 2015 compilers don't implement snprintf, vsnprintf in a cross-platform manner. */
|
||||
#if _MSC_VER < 1900
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef snprintf
|
||||
#define snprintf c99_snprintf_retro__
|
||||
#endif
|
||||
|
||||
int c99_snprintf_retro__(char *outBuf, size_t size, const char *format, ...);
|
||||
#endif
|
||||
|
||||
/* Pre-MSVC 2010 compilers don't implement vsnprintf in a cross-platform manner? Not sure about this one. */
|
||||
#if _MSC_VER < 1600
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef vsnprintf
|
||||
#define vsnprintf c99_vsnprintf_retro__
|
||||
#endif
|
||||
@ -56,6 +53,8 @@ extern "C" {
|
||||
#undef UNICODE /* Do not bother with UNICODE at this time. */
|
||||
#include <direct.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
|
||||
/* Python headers defines ssize_t and sets HAVE_SSIZE_T.
|
||||
@ -125,4 +124,3 @@ typedef int ssize_t;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -67,7 +67,6 @@ extern "C" {
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* 7.18.1 Integer types. */
|
||||
|
||||
/* 7.18.1.1 Exact-width integer types. */
|
||||
@ -94,7 +93,6 @@ extern "C" {
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
|
||||
/* 7.18.1.2 Minimum-width integer types. */
|
||||
typedef int8_t int_least8_t;
|
||||
typedef int16_t int_least16_t;
|
||||
@ -255,4 +253,3 @@ typedef uint64_t uintmax_t;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (posix_string.h).
|
||||
@ -55,7 +55,6 @@ int isblank(int c);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (strcasestr.h).
|
||||
@ -46,4 +46,3 @@ RETRO_END_DECLS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (strl.h).
|
||||
@ -57,4 +57,3 @@ char *strldup(const char *s, size_t n);
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this libretro API header (libretro.h).
|
||||
@ -278,6 +278,10 @@ enum retro_language
|
||||
RETRO_LANGUAGE_ARABIC = 16,
|
||||
RETRO_LANGUAGE_GREEK = 17,
|
||||
RETRO_LANGUAGE_TURKISH = 18,
|
||||
RETRO_LANGUAGE_SLOVAK = 19,
|
||||
RETRO_LANGUAGE_PERSIAN = 20,
|
||||
RETRO_LANGUAGE_HEBREW = 21,
|
||||
RETRO_LANGUAGE_ASTURIAN = 22,
|
||||
RETRO_LANGUAGE_LAST,
|
||||
|
||||
/* Ensure sizeof(enum) == sizeof(int) */
|
||||
@ -1087,10 +1091,10 @@ enum retro_mod
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_TARGET_REFRESH_RATE (50 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* float * --
|
||||
* Float value that lets us know what target refresh rate
|
||||
* Float value that lets us know what target refresh rate
|
||||
* is curently in use by the frontend.
|
||||
*
|
||||
* The core can use the returned value to set an ideal
|
||||
* The core can use the returned value to set an ideal
|
||||
* refresh rate/framerate.
|
||||
*/
|
||||
|
||||
@ -1098,7 +1102,7 @@ enum retro_mod
|
||||
/* bool * --
|
||||
* Boolean value that indicates whether or not the frontend supports
|
||||
* input bitmasks being returned by retro_input_state_t. The advantage
|
||||
* of this is that retro_input_state_t has to be only called once to
|
||||
* of this is that retro_input_state_t has to be only called once to
|
||||
* grab all button states instead of multiple times.
|
||||
*
|
||||
* If it returns true, you can pass RETRO_DEVICE_ID_JOYPAD_MASK as 'id'
|
||||
@ -1174,7 +1178,7 @@ enum retro_mod
|
||||
* "foo_option",
|
||||
* "Speed hack coprocessor X",
|
||||
* "Provides increased performance at the expense of reduced accuracy",
|
||||
* {
|
||||
* {
|
||||
* { "false", NULL },
|
||||
* { "true", NULL },
|
||||
* { "unstable", "Turbo (Unstable)" },
|
||||
@ -1246,6 +1250,91 @@ enum retro_mod
|
||||
* default when calling SET_VARIABLES/SET_CORE_OPTIONS.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_PREFERRED_HW_RENDER 56
|
||||
/* unsigned * --
|
||||
*
|
||||
* Allows an implementation to ask frontend preferred hardware
|
||||
* context to use. Core should use this information to deal
|
||||
* with what specific context to request with SET_HW_RENDER.
|
||||
*
|
||||
* 'data' points to an unsigned variable
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_DISK_CONTROL_INTERFACE_VERSION 57
|
||||
/* unsigned * --
|
||||
* Unsigned value is the API version number of the disk control
|
||||
* interface supported by the frontend. If callback return false,
|
||||
* API version is assumed to be 0.
|
||||
*
|
||||
* In legacy code, the disk control interface is defined by passing
|
||||
* a struct of type retro_disk_control_callback to
|
||||
* RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE.
|
||||
* This may be still be done regardless of the disk control
|
||||
* interface version.
|
||||
*
|
||||
* If version is >= 1 however, the disk control interface may
|
||||
* instead be defined by passing a struct of type
|
||||
* retro_disk_control_ext_callback to
|
||||
* RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE.
|
||||
* This allows the core to provide additional information about
|
||||
* disk images to the frontend and/or enables extra
|
||||
* disk control functionality by the frontend.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE 58
|
||||
/* const struct retro_disk_control_ext_callback * --
|
||||
* Sets an interface which frontend can use to eject and insert
|
||||
* disk images, and also obtain information about individual
|
||||
* disk image files registered by the core.
|
||||
* This is used for games which consist of multiple images and
|
||||
* must be manually swapped out by the user (e.g. PSX, floppy disk
|
||||
* based systems).
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_MESSAGE_INTERFACE_VERSION 59
|
||||
/* unsigned * --
|
||||
* Unsigned value is the API version number of the message
|
||||
* interface supported by the frontend. If callback returns
|
||||
* false, API version is assumed to be 0.
|
||||
*
|
||||
* In legacy code, messages may be displayed in an
|
||||
* implementation-specific manner by passing a struct
|
||||
* of type retro_message to RETRO_ENVIRONMENT_SET_MESSAGE.
|
||||
* This may be still be done regardless of the message
|
||||
* interface version.
|
||||
*
|
||||
* If version is >= 1 however, messages may instead be
|
||||
* displayed by passing a struct of type retro_message_ext
|
||||
* to RETRO_ENVIRONMENT_SET_MESSAGE_EXT. This allows the
|
||||
* core to specify message logging level, priority and
|
||||
* destination (OSD, logging interface or both).
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_SET_MESSAGE_EXT 60
|
||||
/* const struct retro_message_ext * --
|
||||
* Sets a message to be displayed in an implementation-specific
|
||||
* manner for a certain amount of 'frames'. Additionally allows
|
||||
* the core to specify message logging level, priority and
|
||||
* destination (OSD, logging interface or both).
|
||||
* Should not be used for trivial messages, which should simply be
|
||||
* logged via RETRO_ENVIRONMENT_GET_LOG_INTERFACE (or as a
|
||||
* fallback, stderr).
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_INPUT_MAX_USERS 61
|
||||
/* unsigned * --
|
||||
* Unsigned value is the number of active input devices
|
||||
* provided by the frontend. This may change between
|
||||
* frames, but will remain constant for the duration
|
||||
* of each frame.
|
||||
* If callback returns true, a core need not poll any
|
||||
* input device with an index greater than or equal to
|
||||
* the number of active devices.
|
||||
* If callback returns false, the number of active input
|
||||
* devices is unknown. In this case, all input devices
|
||||
* should be considered active.
|
||||
*/
|
||||
|
||||
/* VFS functionality */
|
||||
|
||||
/* File paths:
|
||||
@ -1382,17 +1471,17 @@ typedef int (RETRO_CALLCONV *retro_vfs_closedir_t)(struct retro_vfs_dir_handle *
|
||||
struct retro_vfs_interface
|
||||
{
|
||||
/* VFS API v1 */
|
||||
retro_vfs_get_path_t get_path;
|
||||
retro_vfs_open_t open;
|
||||
retro_vfs_close_t close;
|
||||
retro_vfs_size_t size;
|
||||
retro_vfs_tell_t tell;
|
||||
retro_vfs_seek_t seek;
|
||||
retro_vfs_read_t read;
|
||||
retro_vfs_write_t write;
|
||||
retro_vfs_flush_t flush;
|
||||
retro_vfs_remove_t remove;
|
||||
retro_vfs_rename_t rename;
|
||||
retro_vfs_get_path_t get_path;
|
||||
retro_vfs_open_t open;
|
||||
retro_vfs_close_t close;
|
||||
retro_vfs_size_t size;
|
||||
retro_vfs_tell_t tell;
|
||||
retro_vfs_seek_t seek;
|
||||
retro_vfs_read_t read;
|
||||
retro_vfs_write_t write;
|
||||
retro_vfs_flush_t flush;
|
||||
retro_vfs_remove_t remove;
|
||||
retro_vfs_rename_t rename;
|
||||
/* VFS API v2 */
|
||||
retro_vfs_truncate_t truncate;
|
||||
/* VFS API v3 */
|
||||
@ -1420,11 +1509,11 @@ struct retro_vfs_interface_info
|
||||
|
||||
enum retro_hw_render_interface_type
|
||||
{
|
||||
RETRO_HW_RENDER_INTERFACE_VULKAN = 0,
|
||||
RETRO_HW_RENDER_INTERFACE_D3D9 = 1,
|
||||
RETRO_HW_RENDER_INTERFACE_D3D10 = 2,
|
||||
RETRO_HW_RENDER_INTERFACE_D3D11 = 3,
|
||||
RETRO_HW_RENDER_INTERFACE_D3D12 = 4,
|
||||
RETRO_HW_RENDER_INTERFACE_VULKAN = 0,
|
||||
RETRO_HW_RENDER_INTERFACE_D3D9 = 1,
|
||||
RETRO_HW_RENDER_INTERFACE_D3D10 = 2,
|
||||
RETRO_HW_RENDER_INTERFACE_D3D11 = 3,
|
||||
RETRO_HW_RENDER_INTERFACE_D3D12 = 4,
|
||||
RETRO_HW_RENDER_INTERFACE_GSKIT_PS2 = 5,
|
||||
RETRO_HW_RENDER_INTERFACE_DUMMY = INT_MAX
|
||||
};
|
||||
@ -1922,6 +2011,10 @@ enum retro_sensor_action
|
||||
{
|
||||
RETRO_SENSOR_ACCELEROMETER_ENABLE = 0,
|
||||
RETRO_SENSOR_ACCELEROMETER_DISABLE,
|
||||
RETRO_SENSOR_GYROSCOPE_ENABLE,
|
||||
RETRO_SENSOR_GYROSCOPE_DISABLE,
|
||||
RETRO_SENSOR_ILLUMINANCE_ENABLE,
|
||||
RETRO_SENSOR_ILLUMINANCE_DISABLE,
|
||||
|
||||
RETRO_SENSOR_DUMMY = INT_MAX
|
||||
};
|
||||
@ -1930,6 +2023,10 @@ enum retro_sensor_action
|
||||
#define RETRO_SENSOR_ACCELEROMETER_X 0
|
||||
#define RETRO_SENSOR_ACCELEROMETER_Y 1
|
||||
#define RETRO_SENSOR_ACCELEROMETER_Z 2
|
||||
#define RETRO_SENSOR_GYROSCOPE_X 3
|
||||
#define RETRO_SENSOR_GYROSCOPE_Y 4
|
||||
#define RETRO_SENSOR_GYROSCOPE_Z 5
|
||||
#define RETRO_SENSOR_ILLUMINANCE 6
|
||||
|
||||
typedef bool (RETRO_CALLCONV *retro_set_sensor_state_t)(unsigned port,
|
||||
enum retro_sensor_action action, unsigned rate);
|
||||
@ -2287,7 +2384,8 @@ struct retro_keyboard_callback
|
||||
retro_keyboard_event_t callback;
|
||||
};
|
||||
|
||||
/* Callbacks for RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE.
|
||||
/* Callbacks for RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE &
|
||||
* RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE.
|
||||
* Should be set for implementations which can swap out multiple disk
|
||||
* images in runtime.
|
||||
*
|
||||
@ -2345,6 +2443,53 @@ typedef bool (RETRO_CALLCONV *retro_replace_image_index_t)(unsigned index,
|
||||
* with replace_image_index. */
|
||||
typedef bool (RETRO_CALLCONV *retro_add_image_index_t)(void);
|
||||
|
||||
/* Sets initial image to insert in drive when calling
|
||||
* core_load_game().
|
||||
* Since we cannot pass the initial index when loading
|
||||
* content (this would require a major API change), this
|
||||
* is set by the frontend *before* calling the core's
|
||||
* retro_load_game()/retro_load_game_special() implementation.
|
||||
* A core should therefore cache the index/path values and handle
|
||||
* them inside retro_load_game()/retro_load_game_special().
|
||||
* - If 'index' is invalid (index >= get_num_images()), the
|
||||
* core should ignore the set value and instead use 0
|
||||
* - 'path' is used purely for error checking - i.e. when
|
||||
* content is loaded, the core should verify that the
|
||||
* disk specified by 'index' has the specified file path.
|
||||
* This is to guard against auto selecting the wrong image
|
||||
* if (for example) the user should modify an existing M3U
|
||||
* playlist. We have to let the core handle this because
|
||||
* set_initial_image() must be called before loading content,
|
||||
* i.e. the frontend cannot access image paths in advance
|
||||
* and thus cannot perform the error check itself.
|
||||
* If set path and content path do not match, the core should
|
||||
* ignore the set 'index' value and instead use 0
|
||||
* Returns 'false' if index or 'path' are invalid, or core
|
||||
* does not support this functionality
|
||||
*/
|
||||
typedef bool (RETRO_CALLCONV *retro_set_initial_image_t)(unsigned index, const char *path);
|
||||
|
||||
/* Fetches the path of the specified disk image file.
|
||||
* Returns 'false' if index is invalid (index >= get_num_images())
|
||||
* or path is otherwise unavailable.
|
||||
*/
|
||||
typedef bool (RETRO_CALLCONV *retro_get_image_path_t)(unsigned index, char *path, size_t len);
|
||||
|
||||
/* Fetches a core-provided 'label' for the specified disk
|
||||
* image file. In the simplest case this may be a file name
|
||||
* (without extension), but for cores with more complex
|
||||
* content requirements information may be provided to
|
||||
* facilitate user disk swapping - for example, a core
|
||||
* running floppy-disk-based content may uniquely label
|
||||
* save disks, data disks, level disks, etc. with names
|
||||
* corresponding to in-game disk change prompts (so the
|
||||
* frontend can provide better user guidance than a 'dumb'
|
||||
* disk index value).
|
||||
* Returns 'false' if index is invalid (index >= get_num_images())
|
||||
* or label is otherwise unavailable.
|
||||
*/
|
||||
typedef bool (RETRO_CALLCONV *retro_get_image_label_t)(unsigned index, char *label, size_t len);
|
||||
|
||||
struct retro_disk_control_callback
|
||||
{
|
||||
retro_set_eject_state_t set_eject_state;
|
||||
@ -2358,6 +2503,27 @@ struct retro_disk_control_callback
|
||||
retro_add_image_index_t add_image_index;
|
||||
};
|
||||
|
||||
struct retro_disk_control_ext_callback
|
||||
{
|
||||
retro_set_eject_state_t set_eject_state;
|
||||
retro_get_eject_state_t get_eject_state;
|
||||
|
||||
retro_get_image_index_t get_image_index;
|
||||
retro_set_image_index_t set_image_index;
|
||||
retro_get_num_images_t get_num_images;
|
||||
|
||||
retro_replace_image_index_t replace_image_index;
|
||||
retro_add_image_index_t add_image_index;
|
||||
|
||||
/* NOTE: Frontend will only attempt to record/restore
|
||||
* last used disk index if both set_initial_image()
|
||||
* and get_image_path() are implemented */
|
||||
retro_set_initial_image_t set_initial_image; /* Optional - may be NULL */
|
||||
|
||||
retro_get_image_path_t get_image_path; /* Optional - may be NULL */
|
||||
retro_get_image_label_t get_image_label; /* Optional - may be NULL */
|
||||
};
|
||||
|
||||
enum retro_pixel_format
|
||||
{
|
||||
/* 0RGB1555, native endian.
|
||||
@ -2388,6 +2554,104 @@ struct retro_message
|
||||
unsigned frames; /* Duration in frames of message. */
|
||||
};
|
||||
|
||||
enum retro_message_target
|
||||
{
|
||||
RETRO_MESSAGE_TARGET_ALL = 0,
|
||||
RETRO_MESSAGE_TARGET_OSD,
|
||||
RETRO_MESSAGE_TARGET_LOG
|
||||
};
|
||||
|
||||
enum retro_message_type
|
||||
{
|
||||
RETRO_MESSAGE_TYPE_NOTIFICATION = 0,
|
||||
RETRO_MESSAGE_TYPE_NOTIFICATION_ALT,
|
||||
RETRO_MESSAGE_TYPE_STATUS,
|
||||
RETRO_MESSAGE_TYPE_PROGRESS
|
||||
};
|
||||
|
||||
struct retro_message_ext
|
||||
{
|
||||
/* Message string to be displayed/logged */
|
||||
const char *msg;
|
||||
/* Duration (in ms) of message when targeting the OSD */
|
||||
unsigned duration;
|
||||
/* Message priority when targeting the OSD
|
||||
* > When multiple concurrent messages are sent to
|
||||
* the frontend and the frontend does not have the
|
||||
* capacity to display them all, messages with the
|
||||
* *highest* priority value should be shown
|
||||
* > There is no upper limit to a message priority
|
||||
* value (within the bounds of the unsigned data type)
|
||||
* > In the reference frontend (RetroArch), the same
|
||||
* priority values are used for frontend-generated
|
||||
* notifications, which are typically assigned values
|
||||
* between 0 and 3 depending upon importance */
|
||||
unsigned priority;
|
||||
/* Message logging level (info, warn, error, etc.) */
|
||||
enum retro_log_level level;
|
||||
/* Message destination: OSD, logging interface or both */
|
||||
enum retro_message_target target;
|
||||
/* Message 'type' when targeting the OSD
|
||||
* > RETRO_MESSAGE_TYPE_NOTIFICATION: Specifies that a
|
||||
* message should be handled in identical fashion to
|
||||
* a standard frontend-generated notification
|
||||
* > RETRO_MESSAGE_TYPE_NOTIFICATION_ALT: Specifies that
|
||||
* message is a notification that requires user attention
|
||||
* or action, but that it should be displayed in a manner
|
||||
* that differs from standard frontend-generated notifications.
|
||||
* This would typically correspond to messages that should be
|
||||
* displayed immediately (independently from any internal
|
||||
* frontend message queue), and/or which should be visually
|
||||
* distinguishable from frontend-generated notifications.
|
||||
* For example, a core may wish to inform the user of
|
||||
* information related to a disk-change event. It is
|
||||
* expected that the frontend itself may provide a
|
||||
* notification in this case; if the core sends a
|
||||
* message of type RETRO_MESSAGE_TYPE_NOTIFICATION, an
|
||||
* uncomfortable 'double-notification' may occur. A message
|
||||
* of RETRO_MESSAGE_TYPE_NOTIFICATION_ALT should therefore
|
||||
* be presented such that visual conflict with regular
|
||||
* notifications does not occur
|
||||
* > RETRO_MESSAGE_TYPE_STATUS: Indicates that message
|
||||
* is not a standard notification. This typically
|
||||
* corresponds to 'status' indicators, such as a core's
|
||||
* internal FPS, which are intended to be displayed
|
||||
* either permanently while a core is running, or in
|
||||
* a manner that does not suggest user attention or action
|
||||
* is required. 'Status' type messages should therefore be
|
||||
* displayed in a different on-screen location and in a manner
|
||||
* easily distinguishable from both standard frontend-generated
|
||||
* notifications and messages of type RETRO_MESSAGE_TYPE_NOTIFICATION_ALT
|
||||
* > RETRO_MESSAGE_TYPE_PROGRESS: Indicates that message reports
|
||||
* the progress of an internal core task. For example, in cases
|
||||
* where a core itself handles the loading of content from a file,
|
||||
* this may correspond to the percentage of the file that has been
|
||||
* read. Alternatively, an audio/video playback core may use a
|
||||
* message of type RETRO_MESSAGE_TYPE_PROGRESS to display the current
|
||||
* playback position as a percentage of the runtime. 'Progress' type
|
||||
* messages should therefore be displayed as a literal progress bar,
|
||||
* where:
|
||||
* - 'retro_message_ext.msg' is the progress bar title/label
|
||||
* - 'retro_message_ext.progress' determines the length of
|
||||
* the progress bar
|
||||
* NOTE: Message type is a *hint*, and may be ignored
|
||||
* by the frontend. If a frontend lacks support for
|
||||
* displaying messages via alternate means than standard
|
||||
* frontend-generated notifications, it will treat *all*
|
||||
* messages as having the type RETRO_MESSAGE_TYPE_NOTIFICATION */
|
||||
enum retro_message_type type;
|
||||
/* Task progress when targeting the OSD and message is
|
||||
* of type RETRO_MESSAGE_TYPE_PROGRESS
|
||||
* > -1: Unmetered/indeterminate
|
||||
* > 0-100: Current progress percentage
|
||||
* NOTE: Since message type is a hint, a frontend may ignore
|
||||
* progress values. Where relevant, a core should therefore
|
||||
* include progress percentage within the message string,
|
||||
* such that the message intent remains clear when displayed
|
||||
* as a standard frontend-generated notification */
|
||||
int8_t progress;
|
||||
};
|
||||
|
||||
/* Describes how the libretro implementation maps a libretro input bind
|
||||
* to its internal input system through a human readable string.
|
||||
* This string can be used to better let a user configure input. */
|
||||
@ -2408,7 +2672,7 @@ struct retro_input_descriptor
|
||||
struct retro_system_info
|
||||
{
|
||||
/* All pointers are owned by libretro implementation, and pointers must
|
||||
* remain valid until retro_deinit() is called. */
|
||||
* remain valid until it is unloaded. */
|
||||
|
||||
const char *library_name; /* Descriptive name of library. Should not
|
||||
* contain any version numbers, etc. */
|
||||
@ -2759,4 +3023,4 @@ RETRO_API size_t retro_get_memory_size(unsigned id);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (retro_common.h).
|
||||
@ -34,4 +34,3 @@ in a public API, you may need this.
|
||||
#include <compat/msvc.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (retro_common_api.h).
|
||||
@ -89,7 +89,9 @@ typedef int ssize_t;
|
||||
/* C++11 says this one isn't needed, but apparently (some versions of) mingw require it anyways */
|
||||
/* https://stackoverflow.com/questions/8132399/how-to-printf-uint64-t-fails-with-spurious-trailing-in-format */
|
||||
/* https://github.com/libretro/RetroArch/issues/6009 */
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS 1
|
||||
#endif
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#ifndef PRId64
|
||||
@ -113,6 +115,5 @@ Of course, another school of thought is that you should do as little damage as p
|
||||
in as few places as possible...
|
||||
*/
|
||||
|
||||
|
||||
/* _LIBRETRO_COMMON_RETRO_COMMON_API_H */
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (retro_environment.h).
|
||||
@ -101,6 +101,14 @@ printf("This is C++, version %d.\n", __cplusplus);
|
||||
#define __WINRT__ 1
|
||||
#endif
|
||||
|
||||
/* MSVC obviously has to have some non-standard constants... */
|
||||
#if _M_IX86_FP == 1
|
||||
#define __SSE__ 1
|
||||
#elif _M_IX86_FP == 2 || (defined(_M_AMD64) || defined(_M_X64))
|
||||
#define __SSE__ 1
|
||||
#define __SSE2__ 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (retro_inline.h).
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (retro_math.h).
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (retro_miscellaneous.h).
|
||||
@ -30,16 +30,20 @@
|
||||
#include <boolean.h>
|
||||
#include <retro_inline.h>
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(_WIN32)
|
||||
|
||||
#if defined(_XBOX)
|
||||
#include <Xtl.h>
|
||||
#else
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#elif defined(_WIN32) && defined(_XBOX)
|
||||
#include <Xtl.h>
|
||||
#endif
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#endif
|
||||
|
||||
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
|
||||
#include <sys/fs_external.h>
|
||||
#endif
|
||||
|
||||
@ -75,9 +79,9 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
|
||||
}
|
||||
|
||||
#ifndef PATH_MAX_LENGTH
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
|
||||
#define PATH_MAX_LENGTH CELL_FS_MAX_FS_PATH_LENGTH
|
||||
#elif defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(GEKKO)|| defined(WIIU)
|
||||
#elif defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(PS2) || defined(GEKKO)|| defined(WIIU) || defined(ORBIS)
|
||||
#define PATH_MAX_LENGTH 512
|
||||
#else
|
||||
#define PATH_MAX_LENGTH 4096
|
||||
@ -106,8 +110,8 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
|
||||
#define BIT16_GET(a, bit) (((a) >> ((bit) & 15)) & 1)
|
||||
#define BIT16_CLEAR_ALL(a) ((a) = 0)
|
||||
|
||||
#define BIT32_SET(a, bit) ((a) |= (1 << ((bit) & 31)))
|
||||
#define BIT32_CLEAR(a, bit) ((a) &= ~(1 << ((bit) & 31)))
|
||||
#define BIT32_SET(a, bit) ((a) |= (UINT32_C(1) << ((bit) & 31)))
|
||||
#define BIT32_CLEAR(a, bit) ((a) &= ~(UINT32_C(1) << ((bit) & 31)))
|
||||
#define BIT32_GET(a, bit) (((a) >> ((bit) & 31)) & 1)
|
||||
#define BIT32_CLEAR_ALL(a) ((a) = 0)
|
||||
|
||||
@ -116,8 +120,8 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
|
||||
#define BIT64_GET(a, bit) (((a) >> ((bit) & 63)) & 1)
|
||||
#define BIT64_CLEAR_ALL(a) ((a) = 0)
|
||||
|
||||
#define BIT128_SET(a, bit) ((a).data[(bit) >> 5] |= (1 << ((bit) & 31)))
|
||||
#define BIT128_CLEAR(a, bit) ((a).data[(bit) >> 5] &= ~(1 << ((bit) & 31)))
|
||||
#define BIT128_SET(a, bit) ((a).data[(bit) >> 5] |= (UINT32_C(1) << ((bit) & 31)))
|
||||
#define BIT128_CLEAR(a, bit) ((a).data[(bit) >> 5] &= ~(UINT32_C(1) << ((bit) & 31)))
|
||||
#define BIT128_GET(a, bit) (((a).data[(bit) >> 5] >> ((bit) & 31)) & 1)
|
||||
#define BIT128_CLEAR_ALL(a) memset(&(a), 0, sizeof(a))
|
||||
|
||||
@ -159,14 +163,24 @@ typedef struct
|
||||
# ifdef _WIN64
|
||||
# define PRI_SIZET PRIu64
|
||||
# else
|
||||
#if _MSC_VER == 1800
|
||||
# define PRI_SIZET PRIu32
|
||||
#else
|
||||
# define PRI_SIZET "u"
|
||||
#endif
|
||||
# if _MSC_VER == 1800
|
||||
# define PRI_SIZET PRIu32
|
||||
# else
|
||||
# define PRI_SIZET "u"
|
||||
# endif
|
||||
# endif
|
||||
#elif defined(PS2)
|
||||
# define PRI_SIZET "u"
|
||||
#else
|
||||
# define PRI_SIZET "zu"
|
||||
# if (SIZE_MAX == 0xFFFF)
|
||||
# define PRI_SIZET "hu"
|
||||
# elif (SIZE_MAX == 0xFFFFFFFF)
|
||||
# define PRI_SIZET "u"
|
||||
# elif (SIZE_MAX == 0xFFFFFFFFFFFFFFFF)
|
||||
# define PRI_SIZET "lu"
|
||||
# else
|
||||
# error PRI_SIZET: unknown SIZE_MAX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user