Libretro: Enable frame skipping during fast forward
This commit is contained in:
parent
d76921e9ce
commit
5101ad4d05
5 changed files with 683 additions and 179 deletions
|
@ -1448,6 +1448,7 @@ void Ppu::SendFrame()
|
||||||
_console->GetNotificationManager()->SendNotification(ConsoleNotificationType::PpuFrameDone);
|
_console->GetNotificationManager()->SendNotification(ConsoleNotificationType::PpuFrameDone);
|
||||||
|
|
||||||
bool isRewinding = _console->GetRewindManager()->IsRewinding();
|
bool isRewinding = _console->GetRewindManager()->IsRewinding();
|
||||||
|
|
||||||
#ifdef LIBRETRO
|
#ifdef LIBRETRO
|
||||||
_console->GetVideoDecoder()->UpdateFrameSync(_currentBuffer, width, height, _frameCount, isRewinding);
|
_console->GetVideoDecoder()->UpdateFrameSync(_currentBuffer, width, height, _frameCount, isRewinding);
|
||||||
#else
|
#else
|
||||||
|
@ -1456,11 +1457,11 @@ void Ppu::SendFrame()
|
||||||
} else {
|
} else {
|
||||||
_console->GetVideoDecoder()->UpdateFrame(_currentBuffer, width, height, _frameCount);
|
_console->GetVideoDecoder()->UpdateFrame(_currentBuffer, width, height, _frameCount);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if(!_skipRender) {
|
if(!_skipRender) {
|
||||||
_frameSkipTimer.Reset();
|
_frameSkipTimer.Reset();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@ extern "C" {
|
||||||
_messageManager.reset(new LibretroMessageManager(logCallback, retroEnv));
|
_messageManager.reset(new LibretroMessageManager(logCallback, retroEnv));
|
||||||
|
|
||||||
AudioConfig audioConfig = _console->GetSettings()->GetAudioConfig();
|
AudioConfig audioConfig = _console->GetSettings()->GetAudioConfig();
|
||||||
|
audioConfig.DisableDynamicSampleRate = true;
|
||||||
audioConfig.SampleRate = 32000;
|
audioConfig.SampleRate = 32000;
|
||||||
_console->GetSettings()->SetAudioConfig(audioConfig);
|
_console->GetSettings()->SetAudioConfig(audioConfig);
|
||||||
|
|
||||||
|
@ -422,6 +423,16 @@ extern "C" {
|
||||||
update_settings();
|
update_settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isFastForward = false;
|
||||||
|
EmulationConfig cfg = _console->GetSettings()->GetEmulationConfig();
|
||||||
|
if(retroEnv(RETRO_ENVIRONMENT_GET_FASTFORWARDING, &isFastForward) && isFastForward) {
|
||||||
|
//Allow core to skip frame rendering during fast forwarding
|
||||||
|
cfg.EmulationSpeed = 0;
|
||||||
|
} else {
|
||||||
|
cfg.EmulationSpeed = 100;
|
||||||
|
}
|
||||||
|
_console->GetSettings()->SetEmulationConfig(cfg);
|
||||||
|
|
||||||
_console->RunSingleFrame();
|
_console->RunSingleFrame();
|
||||||
|
|
||||||
if(updated) {
|
if(updated) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2010-2017 The RetroArch team
|
/* Copyright (C) 2010-2020 The RetroArch team
|
||||||
*
|
*
|
||||||
* ---------------------------------------------------------------------------------------
|
* ---------------------------------------------------------------------------------------
|
||||||
* The following license statement only applies to this libretro API header (libretro.h).
|
* The following license statement only applies to this libretro API header (libretro.h).
|
||||||
|
@ -32,7 +32,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
#if defined(_MSC_VER) && !defined(SN_TARGET_PS3)
|
#if defined(_MSC_VER) && _MSC_VER < 1800 && !defined(SN_TARGET_PS3)
|
||||||
/* Hack applied for MSVC when compiling in C89 mode
|
/* Hack applied for MSVC when compiling in C89 mode
|
||||||
* as it isn't C99-compliant. */
|
* as it isn't C99-compliant. */
|
||||||
#define bool unsigned char
|
#define bool unsigned char
|
||||||
|
@ -128,7 +128,8 @@ extern "C" {
|
||||||
|
|
||||||
/* LIGHTGUN device is similar to Guncon-2 for PlayStation 2.
|
/* LIGHTGUN device is similar to Guncon-2 for PlayStation 2.
|
||||||
* It reports X/Y coordinates in screen space (similar to the pointer)
|
* It reports X/Y coordinates in screen space (similar to the pointer)
|
||||||
* in the range [-0x8000, 0x7fff] in both axes, with zero being center.
|
* in the range [-0x8000, 0x7fff] in both axes, with zero being center and
|
||||||
|
* -0x8000 being out of bounds.
|
||||||
* As well as reporting on/off screen state. It features a trigger,
|
* As well as reporting on/off screen state. It features a trigger,
|
||||||
* start/select buttons, auxiliary action buttons and a
|
* start/select buttons, auxiliary action buttons and a
|
||||||
* directional pad. A forced off-screen shot can be requested for
|
* directional pad. A forced off-screen shot can be requested for
|
||||||
|
@ -139,7 +140,8 @@ extern "C" {
|
||||||
/* The ANALOG device is an extension to JOYPAD (RetroPad).
|
/* The ANALOG device is an extension to JOYPAD (RetroPad).
|
||||||
* Similar to DualShock2 it adds two analog sticks and all buttons can
|
* Similar to DualShock2 it adds two analog sticks and all buttons can
|
||||||
* be analog. This is treated as a separate device type as it returns
|
* be analog. This is treated as a separate device type as it returns
|
||||||
* axis values in the full analog range of [-0x8000, 0x7fff].
|
* axis values in the full analog range of [-0x7fff, 0x7fff],
|
||||||
|
* although some devices may return -0x8000.
|
||||||
* Positive X axis is right. Positive Y axis is down.
|
* Positive X axis is right. Positive Y axis is down.
|
||||||
* Buttons are returned in the range [0, 0x7fff].
|
* Buttons are returned in the range [0, 0x7fff].
|
||||||
* Only use ANALOG type when polling for analog values.
|
* Only use ANALOG type when polling for analog values.
|
||||||
|
@ -200,6 +202,8 @@ extern "C" {
|
||||||
#define RETRO_DEVICE_ID_JOYPAD_L3 14
|
#define RETRO_DEVICE_ID_JOYPAD_L3 14
|
||||||
#define RETRO_DEVICE_ID_JOYPAD_R3 15
|
#define RETRO_DEVICE_ID_JOYPAD_R3 15
|
||||||
|
|
||||||
|
#define RETRO_DEVICE_ID_JOYPAD_MASK 256
|
||||||
|
|
||||||
/* Index / Id values for ANALOG device. */
|
/* Index / Id values for ANALOG device. */
|
||||||
#define RETRO_DEVICE_INDEX_ANALOG_LEFT 0
|
#define RETRO_DEVICE_INDEX_ANALOG_LEFT 0
|
||||||
#define RETRO_DEVICE_INDEX_ANALOG_RIGHT 1
|
#define RETRO_DEVICE_INDEX_ANALOG_RIGHT 1
|
||||||
|
@ -246,6 +250,7 @@ extern "C" {
|
||||||
#define RETRO_DEVICE_ID_POINTER_X 0
|
#define RETRO_DEVICE_ID_POINTER_X 0
|
||||||
#define RETRO_DEVICE_ID_POINTER_Y 1
|
#define RETRO_DEVICE_ID_POINTER_Y 1
|
||||||
#define RETRO_DEVICE_ID_POINTER_PRESSED 2
|
#define RETRO_DEVICE_ID_POINTER_PRESSED 2
|
||||||
|
#define RETRO_DEVICE_ID_POINTER_COUNT 3
|
||||||
|
|
||||||
/* Returned from retro_get_region(). */
|
/* Returned from retro_get_region(). */
|
||||||
#define RETRO_REGION_NTSC 0
|
#define RETRO_REGION_NTSC 0
|
||||||
|
@ -270,6 +275,9 @@ enum retro_language
|
||||||
RETRO_LANGUAGE_ESPERANTO = 13,
|
RETRO_LANGUAGE_ESPERANTO = 13,
|
||||||
RETRO_LANGUAGE_POLISH = 14,
|
RETRO_LANGUAGE_POLISH = 14,
|
||||||
RETRO_LANGUAGE_VIETNAMESE = 15,
|
RETRO_LANGUAGE_VIETNAMESE = 15,
|
||||||
|
RETRO_LANGUAGE_ARABIC = 16,
|
||||||
|
RETRO_LANGUAGE_GREEK = 17,
|
||||||
|
RETRO_LANGUAGE_TURKISH = 18,
|
||||||
RETRO_LANGUAGE_LAST,
|
RETRO_LANGUAGE_LAST,
|
||||||
|
|
||||||
/* Ensure sizeof(enum) == sizeof(int) */
|
/* Ensure sizeof(enum) == sizeof(int) */
|
||||||
|
@ -375,6 +383,10 @@ enum retro_key
|
||||||
RETROK_x = 120,
|
RETROK_x = 120,
|
||||||
RETROK_y = 121,
|
RETROK_y = 121,
|
||||||
RETROK_z = 122,
|
RETROK_z = 122,
|
||||||
|
RETROK_LEFTBRACE = 123,
|
||||||
|
RETROK_BAR = 124,
|
||||||
|
RETROK_RIGHTBRACE = 125,
|
||||||
|
RETROK_TILDE = 126,
|
||||||
RETROK_DELETE = 127,
|
RETROK_DELETE = 127,
|
||||||
|
|
||||||
RETROK_KP0 = 256,
|
RETROK_KP0 = 256,
|
||||||
|
@ -445,6 +457,7 @@ enum retro_key
|
||||||
RETROK_POWER = 320,
|
RETROK_POWER = 320,
|
||||||
RETROK_EURO = 321,
|
RETROK_EURO = 321,
|
||||||
RETROK_UNDO = 322,
|
RETROK_UNDO = 322,
|
||||||
|
RETROK_OEM_102 = 323,
|
||||||
|
|
||||||
RETROK_LAST,
|
RETROK_LAST,
|
||||||
|
|
||||||
|
@ -476,11 +489,13 @@ enum retro_mod
|
||||||
/* Environment commands. */
|
/* Environment commands. */
|
||||||
#define RETRO_ENVIRONMENT_SET_ROTATION 1 /* const unsigned * --
|
#define RETRO_ENVIRONMENT_SET_ROTATION 1 /* const unsigned * --
|
||||||
* Sets screen rotation of graphics.
|
* Sets screen rotation of graphics.
|
||||||
* Is only implemented if rotation can be accelerated by hardware.
|
|
||||||
* Valid values are 0, 1, 2, 3, which rotates screen by 0, 90, 180,
|
* Valid values are 0, 1, 2, 3, which rotates screen by 0, 90, 180,
|
||||||
* 270 degrees counter-clockwise respectively.
|
* 270 degrees counter-clockwise respectively.
|
||||||
*/
|
*/
|
||||||
#define RETRO_ENVIRONMENT_GET_OVERSCAN 2 /* bool * --
|
#define RETRO_ENVIRONMENT_GET_OVERSCAN 2 /* bool * --
|
||||||
|
* NOTE: As of 2019 this callback is considered deprecated in favor of
|
||||||
|
* using core options to manage overscan in a more nuanced, core-specific way.
|
||||||
|
*
|
||||||
* Boolean value whether or not the implementation should use overscan,
|
* Boolean value whether or not the implementation should use overscan,
|
||||||
* or crop away overscan.
|
* or crop away overscan.
|
||||||
*/
|
*/
|
||||||
|
@ -594,8 +609,11 @@ enum retro_mod
|
||||||
* GET_VARIABLE.
|
* GET_VARIABLE.
|
||||||
* This allows the frontend to present these variables to
|
* This allows the frontend to present these variables to
|
||||||
* a user dynamically.
|
* a user dynamically.
|
||||||
* This should be called as early as possible (ideally in
|
* This should be called the first time as early as
|
||||||
* retro_set_environment).
|
* possible (ideally in retro_set_environment).
|
||||||
|
* Afterward it may be called again for the core to communicate
|
||||||
|
* updated options to the frontend, but the number of core
|
||||||
|
* options must not change from the number in the initial call.
|
||||||
*
|
*
|
||||||
* 'data' points to an array of retro_variable structs
|
* 'data' points to an array of retro_variable structs
|
||||||
* terminated by a { NULL, NULL } element.
|
* terminated by a { NULL, NULL } element.
|
||||||
|
@ -649,6 +667,15 @@ enum retro_mod
|
||||||
/* Environment 20 was an obsolete version of SET_AUDIO_CALLBACK.
|
/* Environment 20 was an obsolete version of SET_AUDIO_CALLBACK.
|
||||||
* It was not used by any known core at the time,
|
* It was not used by any known core at the time,
|
||||||
* and was removed from the API. */
|
* and was removed from the API. */
|
||||||
|
#define RETRO_ENVIRONMENT_SET_FRAME_TIME_CALLBACK 21
|
||||||
|
/* const struct retro_frame_time_callback * --
|
||||||
|
* Lets the core know how much time has passed since last
|
||||||
|
* invocation of retro_run().
|
||||||
|
* The frontend can tamper with the timing to fake fast-forward,
|
||||||
|
* slow-motion, frame stepping, etc.
|
||||||
|
* In this case the delta time will use the reference value
|
||||||
|
* in frame_time_callback..
|
||||||
|
*/
|
||||||
#define RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK 22
|
#define RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK 22
|
||||||
/* const struct retro_audio_callback * --
|
/* const struct retro_audio_callback * --
|
||||||
* Sets an interface which is used to notify a libretro core about audio
|
* Sets an interface which is used to notify a libretro core about audio
|
||||||
|
@ -675,15 +702,6 @@ enum retro_mod
|
||||||
* A libretro core using SET_AUDIO_CALLBACK should also make use of
|
* A libretro core using SET_AUDIO_CALLBACK should also make use of
|
||||||
* SET_FRAME_TIME_CALLBACK.
|
* SET_FRAME_TIME_CALLBACK.
|
||||||
*/
|
*/
|
||||||
#define RETRO_ENVIRONMENT_SET_FRAME_TIME_CALLBACK 21
|
|
||||||
/* const struct retro_frame_time_callback * --
|
|
||||||
* Lets the core know how much time has passed since last
|
|
||||||
* invocation of retro_run().
|
|
||||||
* The frontend can tamper with the timing to fake fast-forward,
|
|
||||||
* slow-motion, frame stepping, etc.
|
|
||||||
* In this case the delta time will use the reference value
|
|
||||||
* in frame_time_callback..
|
|
||||||
*/
|
|
||||||
#define RETRO_ENVIRONMENT_GET_RUMBLE_INTERFACE 23
|
#define RETRO_ENVIRONMENT_GET_RUMBLE_INTERFACE 23
|
||||||
/* struct retro_rumble_interface * --
|
/* struct retro_rumble_interface * --
|
||||||
* Gets an interface which is used by a libretro core to set
|
* Gets an interface which is used by a libretro core to set
|
||||||
|
@ -770,17 +788,18 @@ enum retro_mod
|
||||||
*/
|
*/
|
||||||
#define RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY 31
|
#define RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY 31
|
||||||
/* const char ** --
|
/* const char ** --
|
||||||
* Returns the "save" directory of the frontend.
|
* Returns the "save" directory of the frontend, unless there is no
|
||||||
* This directory can be used to store SRAM, memory cards,
|
* save directory available. The save directory should be used to
|
||||||
* high scores, etc, if the libretro core
|
* store SRAM, memory cards, high scores, etc, if the libretro core
|
||||||
* cannot use the regular memory interface (retro_get_memory_data()).
|
* cannot use the regular memory interface (retro_get_memory_data()).
|
||||||
*
|
*
|
||||||
* NOTE: libretro cores used to check GET_SYSTEM_DIRECTORY for
|
* If the frontend cannot designate a save directory, it will return
|
||||||
* similar things before.
|
* NULL to indicate that the core should attempt to operate without a
|
||||||
* They should still check GET_SYSTEM_DIRECTORY if they want to
|
* save directory set.
|
||||||
* be backwards compatible.
|
*
|
||||||
* The path here can be NULL. It should only be non-NULL if the
|
* NOTE: early libretro cores used the system directory for save
|
||||||
* frontend user has set a specific save path.
|
* files. Cores that need to be backwards-compatible can still check
|
||||||
|
* GET_SYSTEM_DIRECTORY.
|
||||||
*/
|
*/
|
||||||
#define RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO 32
|
#define RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO 32
|
||||||
/* const struct retro_system_av_info * --
|
/* const struct retro_system_av_info * --
|
||||||
|
@ -848,26 +867,39 @@ enum retro_mod
|
||||||
#define RETRO_ENVIRONMENT_SET_CONTROLLER_INFO 35
|
#define RETRO_ENVIRONMENT_SET_CONTROLLER_INFO 35
|
||||||
/* const struct retro_controller_info * --
|
/* const struct retro_controller_info * --
|
||||||
* This environment call lets a libretro core tell the frontend
|
* This environment call lets a libretro core tell the frontend
|
||||||
* which controller types are recognized in calls to
|
* which controller subclasses are recognized in calls to
|
||||||
* retro_set_controller_port_device().
|
* retro_set_controller_port_device().
|
||||||
*
|
*
|
||||||
* Some emulators such as Super Nintendo
|
* Some emulators such as Super Nintendo support multiple lightgun
|
||||||
* support multiple lightgun types which must be specifically
|
* types which must be specifically selected from. It is therefore
|
||||||
* selected from.
|
* sometimes necessary for a frontend to be able to tell the core
|
||||||
* It is therefore sometimes necessary for a frontend to be able
|
* about a special kind of input device which is not specifcally
|
||||||
* to tell the core about a special kind of input device which is
|
* provided by the Libretro API.
|
||||||
* not covered by the libretro input API.
|
|
||||||
*
|
*
|
||||||
* In order for a frontend to understand the workings of an input device,
|
* In order for a frontend to understand the workings of those devices,
|
||||||
* it must be a specialized type
|
* they must be defined as a specialized subclass of the generic device
|
||||||
* of the generic device types already defined in the libretro API.
|
* types already defined in the libretro API.
|
||||||
*
|
*
|
||||||
* Which devices are supported can vary per input port.
|
|
||||||
* The core must pass an array of const struct retro_controller_info which
|
* The core must pass an array of const struct retro_controller_info which
|
||||||
* is terminated with a blanked out struct. Each element of the struct
|
* is terminated with a blanked out struct. Each element of the
|
||||||
* corresponds to an ascending port index to
|
* retro_controller_info struct corresponds to the ascending port index
|
||||||
* retro_set_controller_port_device().
|
* that is passed to retro_set_controller_port_device() when that function
|
||||||
* Even if special device types are set in the libretro core,
|
* is called to indicate to the core that the frontend has changed the
|
||||||
|
* active device subclass. SEE ALSO: retro_set_controller_port_device()
|
||||||
|
*
|
||||||
|
* The ascending input port indexes provided by the core in the struct
|
||||||
|
* are generally presented by frontends as ascending User # or Player #,
|
||||||
|
* such as Player 1, Player 2, Player 3, etc. Which device subclasses are
|
||||||
|
* supported can vary per input port.
|
||||||
|
*
|
||||||
|
* The first inner element of each entry in the retro_controller_info array
|
||||||
|
* is a retro_controller_description struct that specifies the names and
|
||||||
|
* codes of all device subclasses that are available for the corresponding
|
||||||
|
* User or Player, beginning with the generic Libretro device that the
|
||||||
|
* subclasses are derived from. The second inner element of each entry is the
|
||||||
|
* total number of subclasses that are listed in the retro_controller_description.
|
||||||
|
*
|
||||||
|
* NOTE: Even if special device types are set in the libretro core,
|
||||||
* libretro should only poll input based on the base input device types.
|
* libretro should only poll input based on the base input device types.
|
||||||
*/
|
*/
|
||||||
#define RETRO_ENVIRONMENT_SET_MEMORY_MAPS (36 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
#define RETRO_ENVIRONMENT_SET_MEMORY_MAPS (36 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||||
|
@ -946,7 +978,37 @@ enum retro_mod
|
||||||
* A frontend must make sure that the pointer obtained from this function is
|
* A frontend must make sure that the pointer obtained from this function is
|
||||||
* writeable (and readable).
|
* writeable (and readable).
|
||||||
*/
|
*/
|
||||||
|
#define RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE (41 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||||
|
/* const struct retro_hw_render_interface ** --
|
||||||
|
* Returns an API specific rendering interface for accessing API specific data.
|
||||||
|
* Not all HW rendering APIs support or need this.
|
||||||
|
* The contents of the returned pointer is specific to the rendering API
|
||||||
|
* being used. See the various headers like libretro_vulkan.h, etc.
|
||||||
|
*
|
||||||
|
* GET_HW_RENDER_INTERFACE cannot be called before context_reset has been called.
|
||||||
|
* Similarly, after context_destroyed callback returns,
|
||||||
|
* the contents of the HW_RENDER_INTERFACE are invalidated.
|
||||||
|
*/
|
||||||
|
#define RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS (42 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||||
|
/* const bool * --
|
||||||
|
* If true, the libretro implementation supports achievements
|
||||||
|
* either via memory descriptors set with RETRO_ENVIRONMENT_SET_MEMORY_MAPS
|
||||||
|
* or via retro_get_memory_data/retro_get_memory_size.
|
||||||
|
*
|
||||||
|
* This must be called before the first call to retro_run.
|
||||||
|
*/
|
||||||
|
#define RETRO_ENVIRONMENT_SET_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE (43 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||||
|
/* const struct retro_hw_render_context_negotiation_interface * --
|
||||||
|
* Sets an interface which lets the libretro core negotiate with frontend how a context is created.
|
||||||
|
* The semantics of this interface depends on which API is used in SET_HW_RENDER earlier.
|
||||||
|
* This interface will be used when the frontend is trying to create a HW rendering context,
|
||||||
|
* so it will be used after SET_HW_RENDER, but before the context_reset callback.
|
||||||
|
*/
|
||||||
|
#define RETRO_ENVIRONMENT_SET_SERIALIZATION_QUIRKS 44
|
||||||
|
/* uint64_t * --
|
||||||
|
* Sets quirk flags associated with serialization. The frontend will zero any flags it doesn't
|
||||||
|
* recognize or support. Should be set in either retro_init or retro_load_game, but not both.
|
||||||
|
*/
|
||||||
#define RETRO_ENVIRONMENT_SET_HW_SHARED_CONTEXT (44 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
#define RETRO_ENVIRONMENT_SET_HW_SHARED_CONTEXT (44 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||||
/* N/A (null) * --
|
/* N/A (null) * --
|
||||||
* The frontend will try to use a 'shared' hardware context (mostly applicable
|
* The frontend will try to use a 'shared' hardware context (mostly applicable
|
||||||
|
@ -958,19 +1020,277 @@ enum retro_mod
|
||||||
* This will do nothing on its own until SET_HW_RENDER env callbacks are
|
* This will do nothing on its own until SET_HW_RENDER env callbacks are
|
||||||
* being used.
|
* being used.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define RETRO_ENVIRONMENT_GET_VFS_INTERFACE (45 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
#define RETRO_ENVIRONMENT_GET_VFS_INTERFACE (45 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||||
/* struct retro_vfs_interface_info * --
|
/* struct retro_vfs_interface_info * --
|
||||||
* Gets access to the VFS interface.
|
* Gets access to the VFS interface.
|
||||||
* VFS presence needs to be queried prior to load_game or any
|
* VFS presence needs to be queried prior to load_game or any
|
||||||
* get_system/save/other_directory being called to let front end know
|
* get_system/save/other_directory being called to let front end know
|
||||||
* core supports VFS before it starts handing out paths.
|
* core supports VFS before it starts handing out paths.
|
||||||
* It is recomended to do so in retro_set_environment */
|
* It is recomended to do so in retro_set_environment
|
||||||
|
*/
|
||||||
|
#define RETRO_ENVIRONMENT_GET_LED_INTERFACE (46 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||||
|
/* struct retro_led_interface * --
|
||||||
|
* Gets an interface which is used by a libretro core to set
|
||||||
|
* state of LEDs.
|
||||||
|
*/
|
||||||
|
#define RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE (47 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||||
|
/* int * --
|
||||||
|
* Tells the core if the frontend wants audio or video.
|
||||||
|
* If disabled, the frontend will discard the audio or video,
|
||||||
|
* so the core may decide to skip generating a frame or generating audio.
|
||||||
|
* This is mainly used for increasing performance.
|
||||||
|
* Bit 0 (value 1): Enable Video
|
||||||
|
* Bit 1 (value 2): Enable Audio
|
||||||
|
* Bit 2 (value 4): Use Fast Savestates.
|
||||||
|
* Bit 3 (value 8): Hard Disable Audio
|
||||||
|
* Other bits are reserved for future use and will default to zero.
|
||||||
|
* If video is disabled:
|
||||||
|
* * The frontend wants the core to not generate any video,
|
||||||
|
* including presenting frames via hardware acceleration.
|
||||||
|
* * The frontend's video frame callback will do nothing.
|
||||||
|
* * After running the frame, the video output of the next frame should be
|
||||||
|
* no different than if video was enabled, and saving and loading state
|
||||||
|
* should have no issues.
|
||||||
|
* If audio is disabled:
|
||||||
|
* * The frontend wants the core to not generate any audio.
|
||||||
|
* * The frontend's audio callbacks will do nothing.
|
||||||
|
* * After running the frame, the audio output of the next frame should be
|
||||||
|
* no different than if audio was enabled, and saving and loading state
|
||||||
|
* should have no issues.
|
||||||
|
* Fast Savestates:
|
||||||
|
* * Guaranteed to be created by the same binary that will load them.
|
||||||
|
* * Will not be written to or read from the disk.
|
||||||
|
* * Suggest that the core assumes loading state will succeed.
|
||||||
|
* * Suggest that the core updates its memory buffers in-place if possible.
|
||||||
|
* * Suggest that the core skips clearing memory.
|
||||||
|
* * Suggest that the core skips resetting the system.
|
||||||
|
* * Suggest that the core may skip validation steps.
|
||||||
|
* Hard Disable Audio:
|
||||||
|
* * Used for a secondary core when running ahead.
|
||||||
|
* * Indicates that the frontend will never need audio from the core.
|
||||||
|
* * Suggests that the core may stop synthesizing audio, but this should not
|
||||||
|
* compromise emulation accuracy.
|
||||||
|
* * Audio output for the next frame does not matter, and the frontend will
|
||||||
|
* never need an accurate audio state in the future.
|
||||||
|
* * State will never be saved when using Hard Disable Audio.
|
||||||
|
*/
|
||||||
|
#define RETRO_ENVIRONMENT_GET_MIDI_INTERFACE (48 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||||
|
/* struct retro_midi_interface ** --
|
||||||
|
* Returns a MIDI interface that can be used for raw data I/O.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define RETRO_ENVIRONMENT_GET_FASTFORWARDING (49 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||||
|
/* bool * --
|
||||||
|
* Boolean value that indicates whether or not the frontend is in
|
||||||
|
* fastforwarding mode.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define RETRO_ENVIRONMENT_GET_TARGET_REFRESH_RATE (50 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||||
|
/* float * --
|
||||||
|
* 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
|
||||||
|
* refresh rate/framerate.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define RETRO_ENVIRONMENT_GET_INPUT_BITMASKS (51 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||||
|
/* 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
|
||||||
|
* grab all button states instead of multiple times.
|
||||||
|
*
|
||||||
|
* If it returns true, you can pass RETRO_DEVICE_ID_JOYPAD_MASK as 'id'
|
||||||
|
* to retro_input_state_t (make sure 'device' is set to RETRO_DEVICE_JOYPAD).
|
||||||
|
* It will return a bitmask of all the digital buttons.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION 52
|
||||||
|
/* unsigned * --
|
||||||
|
* Unsigned value is the API version number of the core options
|
||||||
|
* interface supported by the frontend. If callback return false,
|
||||||
|
* API version is assumed to be 0.
|
||||||
|
*
|
||||||
|
* In legacy code, core options are set by passing an array of
|
||||||
|
* retro_variable structs to RETRO_ENVIRONMENT_SET_VARIABLES.
|
||||||
|
* This may be still be done regardless of the core options
|
||||||
|
* interface version.
|
||||||
|
*
|
||||||
|
* If version is >= 1 however, core options may instead be set by
|
||||||
|
* passing an array of retro_core_option_definition structs to
|
||||||
|
* RETRO_ENVIRONMENT_SET_CORE_OPTIONS, or a 2D array of
|
||||||
|
* retro_core_option_definition structs to RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL.
|
||||||
|
* This allows the core to additionally set option sublabel information
|
||||||
|
* and/or provide localisation support.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS 53
|
||||||
|
/* const struct retro_core_option_definition ** --
|
||||||
|
* Allows an implementation to signal the environment
|
||||||
|
* which variables it might want to check for later using
|
||||||
|
* GET_VARIABLE.
|
||||||
|
* This allows the frontend to present these variables to
|
||||||
|
* a user dynamically.
|
||||||
|
* This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION
|
||||||
|
* returns an API version of >= 1.
|
||||||
|
* This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES.
|
||||||
|
* This should be called the first time as early as
|
||||||
|
* possible (ideally in retro_set_environment).
|
||||||
|
* Afterwards it may be called again for the core to communicate
|
||||||
|
* updated options to the frontend, but the number of core
|
||||||
|
* options must not change from the number in the initial call.
|
||||||
|
*
|
||||||
|
* 'data' points to an array of retro_core_option_definition structs
|
||||||
|
* terminated by a { NULL, NULL, NULL, {{0}}, NULL } element.
|
||||||
|
* retro_core_option_definition::key should be namespaced to not collide
|
||||||
|
* with other implementations' keys. e.g. A core called
|
||||||
|
* 'foo' should use keys named as 'foo_option'.
|
||||||
|
* retro_core_option_definition::desc should contain a human readable
|
||||||
|
* description of the key.
|
||||||
|
* retro_core_option_definition::info should contain any additional human
|
||||||
|
* readable information text that a typical user may need to
|
||||||
|
* understand the functionality of the option.
|
||||||
|
* retro_core_option_definition::values is an array of retro_core_option_value
|
||||||
|
* structs terminated by a { NULL, NULL } element.
|
||||||
|
* > retro_core_option_definition::values[index].value is an expected option
|
||||||
|
* value.
|
||||||
|
* > retro_core_option_definition::values[index].label is a human readable
|
||||||
|
* label used when displaying the value on screen. If NULL,
|
||||||
|
* the value itself is used.
|
||||||
|
* retro_core_option_definition::default_value is the default core option
|
||||||
|
* setting. It must match one of the expected option values in the
|
||||||
|
* retro_core_option_definition::values array. If it does not, or the
|
||||||
|
* default value is NULL, the first entry in the
|
||||||
|
* retro_core_option_definition::values array is treated as the default.
|
||||||
|
*
|
||||||
|
* The number of possible options should be very limited,
|
||||||
|
* and must be less than RETRO_NUM_CORE_OPTION_VALUES_MAX.
|
||||||
|
* i.e. it should be feasible to cycle through options
|
||||||
|
* without a keyboard.
|
||||||
|
*
|
||||||
|
* Example entry:
|
||||||
|
* {
|
||||||
|
* "foo_option",
|
||||||
|
* "Speed hack coprocessor X",
|
||||||
|
* "Provides increased performance at the expense of reduced accuracy",
|
||||||
|
* {
|
||||||
|
* { "false", NULL },
|
||||||
|
* { "true", NULL },
|
||||||
|
* { "unstable", "Turbo (Unstable)" },
|
||||||
|
* { NULL, NULL },
|
||||||
|
* },
|
||||||
|
* "false"
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* Only strings are operated on. The possible values will
|
||||||
|
* generally be displayed and stored as-is by the frontend.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL 54
|
||||||
|
/* const struct retro_core_options_intl * --
|
||||||
|
* Allows an implementation to signal the environment
|
||||||
|
* which variables it might want to check for later using
|
||||||
|
* GET_VARIABLE.
|
||||||
|
* This allows the frontend to present these variables to
|
||||||
|
* a user dynamically.
|
||||||
|
* This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION
|
||||||
|
* returns an API version of >= 1.
|
||||||
|
* This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES.
|
||||||
|
* This should be called the first time as early as
|
||||||
|
* possible (ideally in retro_set_environment).
|
||||||
|
* Afterwards it may be called again for the core to communicate
|
||||||
|
* updated options to the frontend, but the number of core
|
||||||
|
* options must not change from the number in the initial call.
|
||||||
|
*
|
||||||
|
* This is fundamentally the same as RETRO_ENVIRONMENT_SET_CORE_OPTIONS,
|
||||||
|
* with the addition of localisation support. The description of the
|
||||||
|
* RETRO_ENVIRONMENT_SET_CORE_OPTIONS callback should be consulted
|
||||||
|
* for further details.
|
||||||
|
*
|
||||||
|
* 'data' points to a retro_core_options_intl struct.
|
||||||
|
*
|
||||||
|
* retro_core_options_intl::us is a pointer to an array of
|
||||||
|
* retro_core_option_definition structs defining the US English
|
||||||
|
* core options implementation. It must point to a valid array.
|
||||||
|
*
|
||||||
|
* retro_core_options_intl::local is a pointer to an array of
|
||||||
|
* retro_core_option_definition structs defining core options for
|
||||||
|
* the current frontend language. It may be NULL (in which case
|
||||||
|
* retro_core_options_intl::us is used by the frontend). Any items
|
||||||
|
* missing from this array will be read from retro_core_options_intl::us
|
||||||
|
* instead.
|
||||||
|
*
|
||||||
|
* NOTE: Default core option values are always taken from the
|
||||||
|
* retro_core_options_intl::us array. Any default values in
|
||||||
|
* retro_core_options_intl::local array will be ignored.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY 55
|
||||||
|
/* struct retro_core_option_display * --
|
||||||
|
*
|
||||||
|
* Allows an implementation to signal the environment to show
|
||||||
|
* or hide a variable when displaying core options. This is
|
||||||
|
* considered a *suggestion*. The frontend is free to ignore
|
||||||
|
* this callback, and its implementation not considered mandatory.
|
||||||
|
*
|
||||||
|
* 'data' points to a retro_core_option_display struct
|
||||||
|
*
|
||||||
|
* retro_core_option_display::key is a variable identifier
|
||||||
|
* which has already been set by SET_VARIABLES/SET_CORE_OPTIONS.
|
||||||
|
*
|
||||||
|
* retro_core_option_display::visible is a boolean, specifying
|
||||||
|
* whether variable should be displayed
|
||||||
|
*
|
||||||
|
* Note that all core option variables will be set visible by
|
||||||
|
* 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).
|
||||||
|
*/
|
||||||
|
|
||||||
/* VFS functionality */
|
/* VFS functionality */
|
||||||
|
|
||||||
/* File paths:
|
/* File paths:
|
||||||
* File paths passed as parameters when using this api shall be well formed unix-style,
|
* File paths passed as parameters when using this API shall be well formed UNIX-style,
|
||||||
* using "/" (unquoted forward slash) as directory separator regardless of the platform's native separator.
|
* using "/" (unquoted forward slash) as directory separator regardless of the platform's native separator.
|
||||||
* Paths shall also include at least one forward slash ("game.bin" is an invalid path, use "./game.bin" instead).
|
* Paths shall also include at least one forward slash ("game.bin" is an invalid path, use "./game.bin" instead).
|
||||||
* Other than the directory separator, cores shall not make assumptions about path format:
|
* Other than the directory separator, cores shall not make assumptions about path format:
|
||||||
|
@ -988,6 +1308,10 @@ enum retro_mod
|
||||||
* Introduced in VFS API v1 */
|
* Introduced in VFS API v1 */
|
||||||
struct retro_vfs_file_handle;
|
struct retro_vfs_file_handle;
|
||||||
|
|
||||||
|
/* Opaque directory handle
|
||||||
|
* Introduced in VFS API v3 */
|
||||||
|
struct retro_vfs_dir_handle;
|
||||||
|
|
||||||
/* File open flags
|
/* File open flags
|
||||||
* Introduced in VFS API v1 */
|
* Introduced in VFS API v1 */
|
||||||
#define RETRO_VFS_FILE_ACCESS_READ (1 << 0) /* Read only mode */
|
#define RETRO_VFS_FILE_ACCESS_READ (1 << 0) /* Read only mode */
|
||||||
|
@ -1007,6 +1331,12 @@ struct retro_vfs_file_handle;
|
||||||
#define RETRO_VFS_SEEK_POSITION_CURRENT 1
|
#define RETRO_VFS_SEEK_POSITION_CURRENT 1
|
||||||
#define RETRO_VFS_SEEK_POSITION_END 2
|
#define RETRO_VFS_SEEK_POSITION_END 2
|
||||||
|
|
||||||
|
/* stat() result flags
|
||||||
|
* Introduced in VFS API v3 */
|
||||||
|
#define RETRO_VFS_STAT_IS_VALID (1 << 0)
|
||||||
|
#define RETRO_VFS_STAT_IS_DIRECTORY (1 << 1)
|
||||||
|
#define RETRO_VFS_STAT_IS_CHARACTER_SPECIAL (1 << 2)
|
||||||
|
|
||||||
/* Get path from opaque handle. Returns the exact same path passed to file_open when getting the handle
|
/* Get path from opaque handle. Returns the exact same path passed to file_open when getting the handle
|
||||||
* Introduced in VFS API v1 */
|
* Introduced in VFS API v1 */
|
||||||
typedef const char *(RETRO_CALLCONV *retro_vfs_get_path_t)(struct retro_vfs_file_handle *stream);
|
typedef const char *(RETRO_CALLCONV *retro_vfs_get_path_t)(struct retro_vfs_file_handle *stream);
|
||||||
|
@ -1016,7 +1346,7 @@ typedef const char *(RETRO_CALLCONV *retro_vfs_get_path_t)(struct retro_vfs_file
|
||||||
* Introduced in VFS API v1 */
|
* Introduced in VFS API v1 */
|
||||||
typedef struct retro_vfs_file_handle *(RETRO_CALLCONV *retro_vfs_open_t)(const char *path, unsigned mode, unsigned hints);
|
typedef struct retro_vfs_file_handle *(RETRO_CALLCONV *retro_vfs_open_t)(const char *path, unsigned mode, unsigned hints);
|
||||||
|
|
||||||
/* Close the file and release its resources. Must be called if open_file returns non-NULL. Returns 0 on succes, -1 on failure.
|
/* Close the file and release its resources. Must be called if open_file returns non-NULL. Returns 0 on success, -1 on failure.
|
||||||
* Whether the call succeeds ot not, the handle passed as parameter becomes invalid and should no longer be used.
|
* Whether the call succeeds ot not, the handle passed as parameter becomes invalid and should no longer be used.
|
||||||
* Introduced in VFS API v1 */
|
* Introduced in VFS API v1 */
|
||||||
typedef int (RETRO_CALLCONV *retro_vfs_close_t)(struct retro_vfs_file_handle *stream);
|
typedef int (RETRO_CALLCONV *retro_vfs_close_t)(struct retro_vfs_file_handle *stream);
|
||||||
|
@ -1025,7 +1355,11 @@ typedef int (RETRO_CALLCONV *retro_vfs_close_t)(struct retro_vfs_file_handle *st
|
||||||
* Introduced in VFS API v1 */
|
* Introduced in VFS API v1 */
|
||||||
typedef int64_t (RETRO_CALLCONV *retro_vfs_size_t)(struct retro_vfs_file_handle *stream);
|
typedef int64_t (RETRO_CALLCONV *retro_vfs_size_t)(struct retro_vfs_file_handle *stream);
|
||||||
|
|
||||||
/* Get the current read / write position for the file. Returns - 1 for error.
|
/* Truncate file to specified size. Returns 0 on success or -1 on error
|
||||||
|
* Introduced in VFS API v2 */
|
||||||
|
typedef int64_t (RETRO_CALLCONV *retro_vfs_truncate_t)(struct retro_vfs_file_handle *stream, int64_t length);
|
||||||
|
|
||||||
|
/* Get the current read / write position for the file. Returns -1 for error.
|
||||||
* Introduced in VFS API v1 */
|
* Introduced in VFS API v1 */
|
||||||
typedef int64_t (RETRO_CALLCONV *retro_vfs_tell_t)(struct retro_vfs_file_handle *stream);
|
typedef int64_t (RETRO_CALLCONV *retro_vfs_tell_t)(struct retro_vfs_file_handle *stream);
|
||||||
|
|
||||||
|
@ -1053,8 +1387,42 @@ typedef int (RETRO_CALLCONV *retro_vfs_remove_t)(const char *path);
|
||||||
* Introduced in VFS API v1 */
|
* Introduced in VFS API v1 */
|
||||||
typedef int (RETRO_CALLCONV *retro_vfs_rename_t)(const char *old_path, const char *new_path);
|
typedef int (RETRO_CALLCONV *retro_vfs_rename_t)(const char *old_path, const char *new_path);
|
||||||
|
|
||||||
|
/* Stat the specified file. Retruns a bitmask of RETRO_VFS_STAT_* flags, none are set if path was not valid.
|
||||||
|
* Additionally stores file size in given variable, unless NULL is given.
|
||||||
|
* Introduced in VFS API v3 */
|
||||||
|
typedef int (RETRO_CALLCONV *retro_vfs_stat_t)(const char *path, int32_t *size);
|
||||||
|
|
||||||
|
/* Create the specified directory. Returns 0 on success, -1 on unknown failure, -2 if already exists.
|
||||||
|
* Introduced in VFS API v3 */
|
||||||
|
typedef int (RETRO_CALLCONV *retro_vfs_mkdir_t)(const char *dir);
|
||||||
|
|
||||||
|
/* Open the specified directory for listing. Returns the opaque dir handle, or NULL for error.
|
||||||
|
* Support for the include_hidden argument may vary depending on the platform.
|
||||||
|
* Introduced in VFS API v3 */
|
||||||
|
typedef struct retro_vfs_dir_handle *(RETRO_CALLCONV *retro_vfs_opendir_t)(const char *dir, bool include_hidden);
|
||||||
|
|
||||||
|
/* Read the directory entry at the current position, and move the read pointer to the next position.
|
||||||
|
* Returns true on success, false if already on the last entry.
|
||||||
|
* Introduced in VFS API v3 */
|
||||||
|
typedef bool (RETRO_CALLCONV *retro_vfs_readdir_t)(struct retro_vfs_dir_handle *dirstream);
|
||||||
|
|
||||||
|
/* Get the name of the last entry read. Returns a string on success, or NULL for error.
|
||||||
|
* The returned string pointer is valid until the next call to readdir or closedir.
|
||||||
|
* Introduced in VFS API v3 */
|
||||||
|
typedef const char *(RETRO_CALLCONV *retro_vfs_dirent_get_name_t)(struct retro_vfs_dir_handle *dirstream);
|
||||||
|
|
||||||
|
/* Check if the last entry read was a directory. Returns true if it was, false otherwise (or on error).
|
||||||
|
* Introduced in VFS API v3 */
|
||||||
|
typedef bool (RETRO_CALLCONV *retro_vfs_dirent_is_dir_t)(struct retro_vfs_dir_handle *dirstream);
|
||||||
|
|
||||||
|
/* Close the directory and release its resources. Must be called if opendir returns non-NULL. Returns 0 on success, -1 on failure.
|
||||||
|
* Whether the call succeeds ot not, the handle passed as parameter becomes invalid and should no longer be used.
|
||||||
|
* Introduced in VFS API v3 */
|
||||||
|
typedef int (RETRO_CALLCONV *retro_vfs_closedir_t)(struct retro_vfs_dir_handle *dirstream);
|
||||||
|
|
||||||
struct retro_vfs_interface
|
struct retro_vfs_interface
|
||||||
{
|
{
|
||||||
|
/* VFS API v1 */
|
||||||
retro_vfs_get_path_t get_path;
|
retro_vfs_get_path_t get_path;
|
||||||
retro_vfs_open_t open;
|
retro_vfs_open_t open;
|
||||||
retro_vfs_close_t close;
|
retro_vfs_close_t close;
|
||||||
|
@ -1066,6 +1434,16 @@ struct retro_vfs_interface
|
||||||
retro_vfs_flush_t flush;
|
retro_vfs_flush_t flush;
|
||||||
retro_vfs_remove_t remove;
|
retro_vfs_remove_t remove;
|
||||||
retro_vfs_rename_t rename;
|
retro_vfs_rename_t rename;
|
||||||
|
/* VFS API v2 */
|
||||||
|
retro_vfs_truncate_t truncate;
|
||||||
|
/* VFS API v3 */
|
||||||
|
retro_vfs_stat_t stat;
|
||||||
|
retro_vfs_mkdir_t mkdir;
|
||||||
|
retro_vfs_opendir_t opendir;
|
||||||
|
retro_vfs_readdir_t readdir;
|
||||||
|
retro_vfs_dirent_get_name_t dirent_get_name;
|
||||||
|
retro_vfs_dirent_is_dir_t dirent_is_dir;
|
||||||
|
retro_vfs_closedir_t closedir;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct retro_vfs_interface_info
|
struct retro_vfs_interface_info
|
||||||
|
@ -1084,6 +1462,11 @@ struct retro_vfs_interface_info
|
||||||
enum retro_hw_render_interface_type
|
enum retro_hw_render_interface_type
|
||||||
{
|
{
|
||||||
RETRO_HW_RENDER_INTERFACE_VULKAN = 0,
|
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
|
RETRO_HW_RENDER_INTERFACE_DUMMY = INT_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1094,26 +1477,42 @@ struct retro_hw_render_interface
|
||||||
enum retro_hw_render_interface_type interface_type;
|
enum retro_hw_render_interface_type interface_type;
|
||||||
unsigned interface_version;
|
unsigned interface_version;
|
||||||
};
|
};
|
||||||
#define RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE (41 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
|
||||||
/* const struct retro_hw_render_interface ** --
|
|
||||||
* Returns an API specific rendering interface for accessing API specific data.
|
|
||||||
* Not all HW rendering APIs support or need this.
|
|
||||||
* The contents of the returned pointer is specific to the rendering API
|
|
||||||
* being used. See the various headers like libretro_vulkan.h, etc.
|
|
||||||
*
|
|
||||||
* GET_HW_RENDER_INTERFACE cannot be called before context_reset has been called.
|
|
||||||
* Similarly, after context_destroyed callback returns,
|
|
||||||
* the contents of the HW_RENDER_INTERFACE are invalidated.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS (42 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
typedef void (RETRO_CALLCONV *retro_set_led_state_t)(int led, int state);
|
||||||
/* const bool * --
|
struct retro_led_interface
|
||||||
* If true, the libretro implementation supports achievements
|
{
|
||||||
* either via memory descriptors set with RETRO_ENVIRONMENT_SET_MEMORY_MAPS
|
retro_set_led_state_t set_led_state;
|
||||||
* or via retro_get_memory_data/retro_get_memory_size.
|
};
|
||||||
*
|
|
||||||
* This must be called before the first call to retro_run.
|
/* Retrieves the current state of the MIDI input.
|
||||||
*/
|
* Returns true if it's enabled, false otherwise. */
|
||||||
|
typedef bool (RETRO_CALLCONV *retro_midi_input_enabled_t)(void);
|
||||||
|
|
||||||
|
/* Retrieves the current state of the MIDI output.
|
||||||
|
* Returns true if it's enabled, false otherwise */
|
||||||
|
typedef bool (RETRO_CALLCONV *retro_midi_output_enabled_t)(void);
|
||||||
|
|
||||||
|
/* Reads next byte from the input stream.
|
||||||
|
* Returns true if byte is read, false otherwise. */
|
||||||
|
typedef bool (RETRO_CALLCONV *retro_midi_read_t)(uint8_t *byte);
|
||||||
|
|
||||||
|
/* Writes byte to the output stream.
|
||||||
|
* 'delta_time' is in microseconds and represent time elapsed since previous write.
|
||||||
|
* Returns true if byte is written, false otherwise. */
|
||||||
|
typedef bool (RETRO_CALLCONV *retro_midi_write_t)(uint8_t byte, uint32_t delta_time);
|
||||||
|
|
||||||
|
/* Flushes previously written data.
|
||||||
|
* Returns true if successful, false otherwise. */
|
||||||
|
typedef bool (RETRO_CALLCONV *retro_midi_flush_t)(void);
|
||||||
|
|
||||||
|
struct retro_midi_interface
|
||||||
|
{
|
||||||
|
retro_midi_input_enabled_t input_enabled;
|
||||||
|
retro_midi_output_enabled_t output_enabled;
|
||||||
|
retro_midi_read_t read;
|
||||||
|
retro_midi_write_t write;
|
||||||
|
retro_midi_flush_t flush;
|
||||||
|
};
|
||||||
|
|
||||||
enum retro_hw_render_context_negotiation_interface_type
|
enum retro_hw_render_context_negotiation_interface_type
|
||||||
{
|
{
|
||||||
|
@ -1128,13 +1527,6 @@ struct retro_hw_render_context_negotiation_interface
|
||||||
enum retro_hw_render_context_negotiation_interface_type interface_type;
|
enum retro_hw_render_context_negotiation_interface_type interface_type;
|
||||||
unsigned interface_version;
|
unsigned interface_version;
|
||||||
};
|
};
|
||||||
#define RETRO_ENVIRONMENT_SET_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE (43 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
|
||||||
/* const struct retro_hw_render_context_negotiation_interface * --
|
|
||||||
* Sets an interface which lets the libretro core negotiate with frontend how a context is created.
|
|
||||||
* The semantics of this interface depends on which API is used in SET_HW_RENDER earlier.
|
|
||||||
* This interface will be used when the frontend is trying to create a HW rendering context,
|
|
||||||
* so it will be used after SET_HW_RENDER, but before the context_reset callback.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Serialized state is incomplete in some way. Set if serialization is
|
/* Serialized state is incomplete in some way. Set if serialization is
|
||||||
* usable in typical end-user cases but should not be relied upon to
|
* usable in typical end-user cases but should not be relied upon to
|
||||||
|
@ -1160,14 +1552,11 @@ struct retro_hw_render_context_negotiation_interface
|
||||||
* dependence */
|
* dependence */
|
||||||
#define RETRO_SERIALIZATION_QUIRK_PLATFORM_DEPENDENT (1 << 6)
|
#define RETRO_SERIALIZATION_QUIRK_PLATFORM_DEPENDENT (1 << 6)
|
||||||
|
|
||||||
#define RETRO_ENVIRONMENT_SET_SERIALIZATION_QUIRKS 44
|
|
||||||
/* uint64_t * --
|
|
||||||
* Sets quirk flags associated with serialization. The frontend will zero any flags it doesn't
|
|
||||||
* recognize or support. Should be set in either retro_init or retro_load_game, but not both.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define RETRO_MEMDESC_CONST (1 << 0) /* The frontend will never change this memory area once retro_load_game has returned. */
|
#define RETRO_MEMDESC_CONST (1 << 0) /* The frontend will never change this memory area once retro_load_game has returned. */
|
||||||
#define RETRO_MEMDESC_BIGENDIAN (1 << 1) /* The memory area contains big endian data. Default is little endian. */
|
#define RETRO_MEMDESC_BIGENDIAN (1 << 1) /* The memory area contains big endian data. Default is little endian. */
|
||||||
|
#define RETRO_MEMDESC_SYSTEM_RAM (1 << 2) /* The memory area is system RAM. This is main RAM of the gaming system. */
|
||||||
|
#define RETRO_MEMDESC_SAVE_RAM (1 << 3) /* The memory area is save RAM. This RAM is usually found on a game cartridge, backed up by a battery. */
|
||||||
|
#define RETRO_MEMDESC_VIDEO_RAM (1 << 4) /* The memory area is video RAM (VRAM) */
|
||||||
#define RETRO_MEMDESC_ALIGN_2 (1 << 16) /* All memory access in this area is aligned to their own size, or 2, whichever is smaller. */
|
#define RETRO_MEMDESC_ALIGN_2 (1 << 16) /* All memory access in this area is aligned to their own size, or 2, whichever is smaller. */
|
||||||
#define RETRO_MEMDESC_ALIGN_4 (2 << 16)
|
#define RETRO_MEMDESC_ALIGN_4 (2 << 16)
|
||||||
#define RETRO_MEMDESC_ALIGN_8 (3 << 16)
|
#define RETRO_MEMDESC_ALIGN_8 (3 << 16)
|
||||||
|
@ -1574,6 +1963,10 @@ enum retro_sensor_action
|
||||||
{
|
{
|
||||||
RETRO_SENSOR_ACCELEROMETER_ENABLE = 0,
|
RETRO_SENSOR_ACCELEROMETER_ENABLE = 0,
|
||||||
RETRO_SENSOR_ACCELEROMETER_DISABLE,
|
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
|
RETRO_SENSOR_DUMMY = INT_MAX
|
||||||
};
|
};
|
||||||
|
@ -1582,6 +1975,10 @@ enum retro_sensor_action
|
||||||
#define RETRO_SENSOR_ACCELEROMETER_X 0
|
#define RETRO_SENSOR_ACCELEROMETER_X 0
|
||||||
#define RETRO_SENSOR_ACCELEROMETER_Y 1
|
#define RETRO_SENSOR_ACCELEROMETER_Y 1
|
||||||
#define RETRO_SENSOR_ACCELEROMETER_Z 2
|
#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,
|
typedef bool (RETRO_CALLCONV *retro_set_sensor_state_t)(unsigned port,
|
||||||
enum retro_sensor_action action, unsigned rate);
|
enum retro_sensor_action action, unsigned rate);
|
||||||
|
@ -1822,6 +2219,10 @@ enum retro_hw_context_type
|
||||||
/* Vulkan, see RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE. */
|
/* Vulkan, see RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE. */
|
||||||
RETRO_HW_CONTEXT_VULKAN = 6,
|
RETRO_HW_CONTEXT_VULKAN = 6,
|
||||||
|
|
||||||
|
/* Direct3D, set version_major to select the type of interface
|
||||||
|
* returned by RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE */
|
||||||
|
RETRO_HW_CONTEXT_DIRECT3D = 7,
|
||||||
|
|
||||||
RETRO_HW_CONTEXT_DUMMY = INT_MAX
|
RETRO_HW_CONTEXT_DUMMY = INT_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1935,7 +2336,8 @@ struct retro_keyboard_callback
|
||||||
retro_keyboard_event_t 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
|
* Should be set for implementations which can swap out multiple disk
|
||||||
* images in runtime.
|
* images in runtime.
|
||||||
*
|
*
|
||||||
|
@ -1993,6 +2395,53 @@ typedef bool (RETRO_CALLCONV *retro_replace_image_index_t)(unsigned index,
|
||||||
* with replace_image_index. */
|
* with replace_image_index. */
|
||||||
typedef bool (RETRO_CALLCONV *retro_add_image_index_t)(void);
|
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
|
struct retro_disk_control_callback
|
||||||
{
|
{
|
||||||
retro_set_eject_state_t set_eject_state;
|
retro_set_eject_state_t set_eject_state;
|
||||||
|
@ -2006,6 +2455,27 @@ struct retro_disk_control_callback
|
||||||
retro_add_image_index_t add_image_index;
|
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
|
enum retro_pixel_format
|
||||||
{
|
{
|
||||||
/* 0RGB1555, native endian.
|
/* 0RGB1555, native endian.
|
||||||
|
@ -2069,17 +2539,26 @@ struct retro_system_info
|
||||||
* Typically used for a GUI to filter
|
* Typically used for a GUI to filter
|
||||||
* out extensions. */
|
* out extensions. */
|
||||||
|
|
||||||
/* If true, retro_load_game() is guaranteed to provide a valid pathname
|
/* Libretro cores that need to have direct access to their content
|
||||||
* in retro_game_info::path.
|
* files, including cores which use the path of the content files to
|
||||||
* ::data and ::size are both invalid.
|
* determine the paths of other files, should set need_fullpath to true.
|
||||||
*
|
*
|
||||||
* If false, ::data and ::size are guaranteed to be valid, but ::path
|
* Cores should strive for setting need_fullpath to false,
|
||||||
* might not be valid.
|
* as it allows the frontend to perform patching, etc.
|
||||||
*
|
*
|
||||||
* This is typically set to true for libretro implementations that must
|
* If need_fullpath is true and retro_load_game() is called:
|
||||||
* load from file.
|
* - retro_game_info::path is guaranteed to have a valid path
|
||||||
* Implementations should strive for setting this to false, as it allows
|
* - retro_game_info::data and retro_game_info::size are invalid
|
||||||
* the frontend to perform patching, etc. */
|
*
|
||||||
|
* If need_fullpath is false and retro_load_game() is called:
|
||||||
|
* - retro_game_info::path may be NULL
|
||||||
|
* - retro_game_info::data and retro_game_info::size are guaranteed
|
||||||
|
* to be valid
|
||||||
|
*
|
||||||
|
* See also:
|
||||||
|
* - RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY
|
||||||
|
* - RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY
|
||||||
|
*/
|
||||||
bool need_fullpath;
|
bool need_fullpath;
|
||||||
|
|
||||||
/* If true, the frontend is not allowed to extract any archives before
|
/* If true, the frontend is not allowed to extract any archives before
|
||||||
|
@ -2130,6 +2609,76 @@ struct retro_variable
|
||||||
const char *value;
|
const char *value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct retro_core_option_display
|
||||||
|
{
|
||||||
|
/* Variable to configure in RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY */
|
||||||
|
const char *key;
|
||||||
|
|
||||||
|
/* Specifies whether variable should be displayed
|
||||||
|
* when presenting core options to the user */
|
||||||
|
bool visible;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Maximum number of values permitted for a core option
|
||||||
|
* > Note: We have to set a maximum value due the limitations
|
||||||
|
* of the C language - i.e. it is not possible to create an
|
||||||
|
* array of structs each containing a variable sized array,
|
||||||
|
* so the retro_core_option_definition values array must
|
||||||
|
* have a fixed size. The size limit of 128 is a balancing
|
||||||
|
* act - it needs to be large enough to support all 'sane'
|
||||||
|
* core options, but setting it too large may impact low memory
|
||||||
|
* platforms. In practise, if a core option has more than
|
||||||
|
* 128 values then the implementation is likely flawed.
|
||||||
|
* To quote the above API reference:
|
||||||
|
* "The number of possible options should be very limited
|
||||||
|
* i.e. it should be feasible to cycle through options
|
||||||
|
* without a keyboard."
|
||||||
|
*/
|
||||||
|
#define RETRO_NUM_CORE_OPTION_VALUES_MAX 128
|
||||||
|
|
||||||
|
struct retro_core_option_value
|
||||||
|
{
|
||||||
|
/* Expected option value */
|
||||||
|
const char *value;
|
||||||
|
|
||||||
|
/* Human-readable value label. If NULL, value itself
|
||||||
|
* will be displayed by the frontend */
|
||||||
|
const char *label;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct retro_core_option_definition
|
||||||
|
{
|
||||||
|
/* Variable to query in RETRO_ENVIRONMENT_GET_VARIABLE. */
|
||||||
|
const char *key;
|
||||||
|
|
||||||
|
/* Human-readable core option description (used as menu label) */
|
||||||
|
const char *desc;
|
||||||
|
|
||||||
|
/* Human-readable core option information (used as menu sublabel) */
|
||||||
|
const char *info;
|
||||||
|
|
||||||
|
/* Array of retro_core_option_value structs, terminated by NULL */
|
||||||
|
struct retro_core_option_value values[RETRO_NUM_CORE_OPTION_VALUES_MAX];
|
||||||
|
|
||||||
|
/* Default core option value. Must match one of the values
|
||||||
|
* in the retro_core_option_value array, otherwise will be
|
||||||
|
* ignored */
|
||||||
|
const char *default_value;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct retro_core_options_intl
|
||||||
|
{
|
||||||
|
/* Pointer to an array of retro_core_option_definition structs
|
||||||
|
* - US English implementation
|
||||||
|
* - Must point to a valid array */
|
||||||
|
struct retro_core_option_definition *us;
|
||||||
|
|
||||||
|
/* Pointer to an array of retro_core_option_definition structs
|
||||||
|
* - Implementation for current frontend language
|
||||||
|
* - May be NULL */
|
||||||
|
struct retro_core_option_definition *local;
|
||||||
|
};
|
||||||
|
|
||||||
struct retro_game_info
|
struct retro_game_info
|
||||||
{
|
{
|
||||||
const char *path; /* Path to game, UTF-8 encoded.
|
const char *path; /* Path to game, UTF-8 encoded.
|
||||||
|
@ -2264,7 +2813,13 @@ RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info);
|
||||||
* will only poll input based on that particular device type. It is only a
|
* will only poll input based on that particular device type. It is only a
|
||||||
* hint to the libretro core when a core cannot automatically detect the
|
* hint to the libretro core when a core cannot automatically detect the
|
||||||
* appropriate input device type on its own. It is also relevant when a
|
* appropriate input device type on its own. It is also relevant when a
|
||||||
* core can change its behavior depending on device type. */
|
* core can change its behavior depending on device type.
|
||||||
|
*
|
||||||
|
* As part of the core's implementation of retro_set_controller_port_device,
|
||||||
|
* the core should call RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS to notify the
|
||||||
|
* frontend if the descriptions for any controls have changed as a
|
||||||
|
* result of changing the device type.
|
||||||
|
*/
|
||||||
RETRO_API void retro_set_controller_port_device(unsigned port, unsigned device);
|
RETRO_API void retro_set_controller_port_device(unsigned port, unsigned device);
|
||||||
|
|
||||||
/* Resets the current game. */
|
/* Resets the current game. */
|
||||||
|
@ -2296,7 +2851,9 @@ RETRO_API bool retro_unserialize(const void *data, size_t size);
|
||||||
RETRO_API void retro_cheat_reset(void);
|
RETRO_API void retro_cheat_reset(void);
|
||||||
RETRO_API void retro_cheat_set(unsigned index, bool enabled, const char *code);
|
RETRO_API void retro_cheat_set(unsigned index, bool enabled, const char *code);
|
||||||
|
|
||||||
/* Loads a game. */
|
/* Loads a game.
|
||||||
|
* Return true to indicate successful loading and false to indicate load failure.
|
||||||
|
*/
|
||||||
RETRO_API bool retro_load_game(const struct retro_game_info *game);
|
RETRO_API bool retro_load_game(const struct retro_game_info *game);
|
||||||
|
|
||||||
/* Loads a "special" kind of game. Should not be used,
|
/* Loads a "special" kind of game. Should not be used,
|
||||||
|
@ -2306,7 +2863,7 @@ RETRO_API bool retro_load_game_special(
|
||||||
const struct retro_game_info *info, size_t num_info
|
const struct retro_game_info *info, size_t num_info
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Unloads a currently loaded game. */
|
/* Unloads the currently loaded game. Called before retro_deinit(void). */
|
||||||
RETRO_API void retro_unload_game(void);
|
RETRO_API void retro_unload_game(void);
|
||||||
|
|
||||||
/* Gets region of game. */
|
/* Gets region of game. */
|
||||||
|
|
|
@ -1,42 +1,10 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
|
||||||
#ifndef LIBRETRO
|
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
#ifdef _WIN32
|
using namespace std::chrono;
|
||||||
#include <Windows.h>
|
|
||||||
|
|
||||||
Timer::Timer()
|
|
||||||
{
|
|
||||||
LARGE_INTEGER li;
|
|
||||||
if(!QueryPerformanceFrequency(&li)) {
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
_frequency = double(li.QuadPart) / 1000.0;
|
|
||||||
|
|
||||||
QueryPerformanceCounter(&li);
|
|
||||||
_start = li.QuadPart;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Timer::Reset()
|
|
||||||
{
|
|
||||||
LARGE_INTEGER li;
|
|
||||||
QueryPerformanceCounter(&li);
|
|
||||||
_start = li.QuadPart;
|
|
||||||
}
|
|
||||||
|
|
||||||
double Timer::GetElapsedMS()
|
|
||||||
{
|
|
||||||
LARGE_INTEGER li;
|
|
||||||
QueryPerformanceCounter(&li);
|
|
||||||
return double(li.QuadPart - _start) / _frequency;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
Timer::Timer()
|
Timer::Timer()
|
||||||
{
|
{
|
||||||
|
@ -45,24 +13,16 @@ Timer::Timer()
|
||||||
|
|
||||||
void Timer::Reset()
|
void Timer::Reset()
|
||||||
{
|
{
|
||||||
timespec start;
|
_start = high_resolution_clock::now();
|
||||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
|
||||||
|
|
||||||
_start = start.tv_sec * 1000000000 + start.tv_nsec;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double Timer::GetElapsedMS()
|
double Timer::GetElapsedMS()
|
||||||
{
|
{
|
||||||
timespec end;
|
high_resolution_clock::time_point end = high_resolution_clock::now();
|
||||||
clock_gettime(CLOCK_MONOTONIC, &end);
|
duration<double> span = duration_cast<duration<double>>(end - _start);
|
||||||
|
return span.count() * 1000.0;
|
||||||
uint64_t currentTime = end.tv_sec * 1000000000 + end.tv_nsec;
|
|
||||||
|
|
||||||
return (double)(currentTime - _start) / 1000000.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void Timer::WaitUntil(double targetMillisecond)
|
void Timer::WaitUntil(double targetMillisecond)
|
||||||
{
|
{
|
||||||
if(targetMillisecond > 0) {
|
if(targetMillisecond > 0) {
|
||||||
|
@ -72,26 +32,3 @@ void Timer::WaitUntil(double targetMillisecond)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
//This is not used by Libretro port, remove its dependencies
|
|
||||||
|
|
||||||
Timer::Timer()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Timer::Reset()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
double Timer::GetElapsedMS()
|
|
||||||
{
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Timer::WaitUntil(double targetMillisecond)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,16 +1,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include <chrono>
|
||||||
|
using namespace std::chrono;
|
||||||
|
|
||||||
class Timer
|
class Timer
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
#ifndef LIBRETRO
|
high_resolution_clock::time_point _start;
|
||||||
#ifdef WIN32
|
|
||||||
double _frequency = 0.0;
|
public:
|
||||||
#endif
|
|
||||||
uint64_t _start;
|
|
||||||
#endif
|
|
||||||
public:
|
|
||||||
Timer();
|
Timer();
|
||||||
void Reset();
|
void Reset();
|
||||||
double GetElapsedMS();
|
double GetElapsedMS();
|
||||||
|
|
Loading…
Add table
Reference in a new issue