Expand description
Unsafe functions related to the libretro environment callback.
For safe versions have a look at the contexts module and
the context types you get in your core callbacks.
Functions§
- can_
dupe ⚠ - Boolean value whether or not frontend supports frame duping, passing NULL to video frame callback.
- get⚠
- Gets a value from an environment callback.
- get_
audio_ ⚠video_ enable - Unstable 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.
- get_
camera_ ⚠interface - Unstable
Gets an interface to a video camera driver.
A libretro core can use this interface to get access to a
video camera.
New video frames are delivered in a callback in same
thread as
Core::on_run. - get_
core_ ⚠assets_ directory - Returns the “core assets” directory of the frontend.
This directory can be used to store specific assets that the
core relies upon, such as art assets,
input data, etc etc.
The returned value can be
None. If so, no such directory is defined, and it’s up to the implementation to find a suitable directory. - get_
core_ ⚠options_ version - The returned value is the API version number of the core options interface supported by the frontend. If the underlying callback failed, API version is assumed to be 0.
- get_
current_ ⚠software_ framebuffer - Unstable
Returns a preallocated framebuffer which the core can use for rendering
the frame into when not using
set_hw_render. The framebuffer returned from this call must not be used after the current call toCore::on_runreturns. - get_
disk_ ⚠control_ interface_ version - 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.
- get_
fastforwarding ⚠ - Unstable Boolean value that indicates whether or not the frontend is in fastforwarding mode.
- get_
game_ ⚠info_ ext - Allows an implementation to fetch extended game
information, providing additional content path
and memory buffer status details.
This function may only be called inside
Core::on_load_gameorCore::on_load_game_special. - get_
hw_ ⚠render_ interface - Unstable 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_ vulkan - Unstable
See
get_hw_render_interface. - get_
input_ ⚠bitmasks - Unstable
Boolean value that indicates whether or not the frontend supports
input bitmasks being returned by
retro_input_state_t. The advantage of this is thatretro_input_state_thas to be only called once to grab all button states instead of multiple times. - get_
input_ ⚠device_ capabilities - Gets a bitmask telling which device type are expected to be
handled properly in a call to
retro_input_state_t. Devices which are not handled or recognized always return 0 inretro_input_state_t. Example bitmask:RetroDevice::JOYPAD | RetroDevice::ANALOG. - get_
input_ ⚠max_ users - The first returned 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.
- get_
language ⚠ - Returns the language of the frontend, if specified by the user. It can be used by the core for localization purposes.
- get_
led_ ⚠interface - Unstable Gets an interface which is used by a libretro core to set state of LEDs.
- get_
libretro_ ⚠path - Retrieves the absolute path from where this libretro
implementation was loaded.
Noneis returned if the libretro was loaded statically (i.e. linked statically to frontend), or if the path cannot be determined. Mostly useful in cooperation withset_support_no_gameas assets can be loaded without ugly hacks. - get_
location_ ⚠callback - Gets access to the location interface. The purpose of this interface is to be able to retrieve location-based information from the host device, such as current latitude / longitude.
- get_
log_ ⚠callback - Gets an interface for logging. This is useful for
logging in a cross-platform way
as certain platforms cannot use
stderrfor logging. It also allows the frontend to show logging information in a more suitable way. If this interface is not used, libretro cores should log tostderras desired. - get_
message_ ⚠interface_ version - The returned value is the API version number of the message interface supported by the frontend. If the underlying callback failed, API version is assumed to be 0.
- get_
midi_ ⚠interface - Unstable Returns a MIDI interface that can be used for raw data I/O.
- get_mut⚠
- Passes a value to the environment callback and returns the modified value.
- get_
overscan ⚠Deprecated - Boolean value whether or not the implementation should use overscan, or crop away overscan.
- get_
path ⚠ - Helper function to query a string pointer and convert it into a
Path. - get_
perf_ ⚠interface - Gets an interface for performance counters. This is useful for performance logging in a cross-platform way and for detecting architecture-specific features, such as SIMD support.
- get_
preferred_ ⚠hw_ render - 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.
- get_
rumble_ ⚠interface - Gets an interface which is used by a libretro core to set
state of rumble motors in controllers.
A strong and weak motor is supported, and they can be
controlled indepedently.
Should be called from either
Core::on_initorCore::on_load_game. Should not be called fromCore::on_set_environment. Returns false if rumble functionality is unavailable. - get_
save_ ⚠directory - Returns the “save” directory of the frontend, unless there is no
save directory available. The save directory should be used to
store SRAM, memory cards, high scores, etc, if the libretro core
cannot use the regular memory interface (
Core::get_memory_data). - get_
savestate_ ⚠context - Unstable Tells the core about the context the frontend is asking for savestate.
- get_
sensor_ ⚠interface - Unstable Gets access to the sensor interface. The purpose of this interface is to allow setting state related to sensors such as polling rate, enabling/disable it entirely, etc. Reading sensor state is done via the normal input_state_callback API.
- get_
system_ ⚠directory - Returns the “system” directory of the frontend.
This directory can be used to store system specific
content such as BIOSes, configuration data, etc.
The returned value can be
NULL. If so, no such directory is defined, and it’s up to the implementation to find a suitable directory. - get_
target_ ⚠refresh_ rate - Unstable Float value that lets us know what target refresh rate is curently in use by the frontend.
- get_
throttle_ ⚠state - Unstable
Allows an implementation to get details on the actual rate
the frontend is attempting to call
Core::on_run. - get_
unchecked ⚠ - Similar to
getbut uses uninitialized memory instead of theDefaulttrait. - get_
username ⚠ - Returns the specified username of the frontend, if specified by the user.
This username can be used as a nickname for a core that has online facilities
or any other mode where personalization of the user is desirable.
The returned value can be
None. If this environment callback is used by a core that requires a valid username, a default username should be specified by the core. - get_
variable ⚠ - Interface to acquire user-defined information from environment that cannot feasibly be supported in a multi-system way.
- get_
variable_ ⚠update - Result is set to
trueif some variables are updated by frontend since last call toget_variable. - get_
vfs_ ⚠interface - Unstable
Gets access to the VFS interface.
VFS presence needs to be queried prior to load_game or any
get_system/save/other_directory being called to let front end know
core supports VFS before it starts handing out paths.
It is recomended to do so in
Core::on_set_environment. - set⚠
- Passes a value to the environment callback.
- set_
audio_ ⚠buffer_ status_ callback - Lets the core know the occupancy level of the frontend
audio buffer. Can be used by a core to attempt frame
skipping in order to avoid buffer under-runs.
A core may pass
NULLto disable buffer status reporting in the frontend. - set_
audio_ ⚠callback - Sets an interface which is used to notify a libretro core about audio being available for writing. The callback can be called from any thread, so a core using this must have a thread safe audio implementation.
- set_
content_ ⚠info_ override - Allows an implementation to override ‘global’ content
info parameters reported by
Core::get_info. Overrides also affect subsystem content info parameters set viaset_subsystem_info. This function must be called insideCore::on_set_environment. If callback returnsfalse, content info overrides are unsupported by the frontend, and will be ignored. If callback returnstrue, extended game info may be retrieved by callingget_game_info_extinCore::on_load_gameorCore::on_load_game_special. - set_
controller_ ⚠info - This environment call lets a libretro core tell the frontend
which controller subclasses are recognized in calls to
Core::on_set_controller_port_device. - set_
core_ ⚠options - 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 ifget_core_options_versionreturns an API version of >= 1. This should be called instead ofset_variables. This should be called the first time as early as possible (ideally inCore::on_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. - set_
core_ ⚠options_ 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.
- set_
core_ ⚠options_ intl - Allows an implementation to signal the environment
which variables it might want to check for later using
get_variable. - set_
core_ ⚠options_ update_ display_ callback - Allows a frontend to signal that a core must update the visibility of any dynamically hidden core options, and enables the frontend to detect visibility changes.
- set_
core_ ⚠options_ v2 - 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. - set_
core_ ⚠options_ v2_ intl - Allows an implementation to signal the environment
which variables it might want to check for later using
get_variable. - set_
disk_ ⚠control_ ext_ interface - 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).
- set_
disk_ ⚠control_ interface - Sets an interface which frontend can use to eject and insert disk images. This is used for games which consist of multiple images and must be manually swapped out by the user (e.g. PSX).
- set_
fastforwarding_ ⚠override - Used by a libretro core to override the current fastforwarding mode of the frontend.
- set_
frame_ ⚠time_ callback - Lets the core know how much time has passed since last
invocation of
Core::on_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 inretro_frame_time_callback. - set_
game_ ⚠geometry - Sets a new game_geometry structure.
- set_
hw_ ⚠render - Sets an interface to let a libretro core render with hardware acceleration.
- set_
hw_ ⚠render_ context_ negotiation_ interface - Unstable
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_renderearlier. This interface will be used when the frontend is trying to create a HW rendering context, so it will be used afterset_hw_render, but before the context_reset callback. - set_
hw_ ⚠shared_ context - Unstable The frontend will try to use a ‘shared’ hardware context (mostly applicable to OpenGL) when a hardware context is being set up.
- set_
input_ ⚠descriptors - Sets an array of retro_input_descriptors.
It is up to the frontend to present this in a usable way.
The array is terminated by retro_input_descriptor::description
being set to
NULL. This function can be called at any time, but it is recommended to call it as early as possible. - set_
keyboard_ ⚠callback - Sets a callback function used to notify core about keyboard events.
- set_
memory_ ⚠maps - Unstable This environment call lets a libretro core tell the frontend about the memory maps this core emulates. This can be used to implement, for example, cheats in a core-agnostic way.
- set_
message ⚠ - Sets a message to be displayed in implementation-specific manner
for a certain amount of ‘frames’.
Should not be used for trivial messages, which should simply be
logged via
RETRO_ENVIRONMENT_GET_LOG_INTERFACE(or as a fallback, stderr). - set_
message_ ⚠ext - Sets a message to be displayed in an implementation-specific
manner for a certain duration of milliseconds.
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). - set_
minimum_ ⚠audio_ latency - Sets minimum frontend audio latency in milliseconds. Resultant audio latency may be larger than set value, or smaller if a hardware limit is encountered. A frontend is expected to honour requests up to 512 ms.
- set_
performance_ ⚠level - Gives a hint to the frontend how demanding this implementation is on a system. E.g. reporting a level of 2 means this implementation should run decently on all frontends of level 2 and up.
- set_
pixel_ ⚠format - Sets the internal pixel format used by the implementation.
The default pixel format is
retro_pixel_format::RETRO_PIXEL_FORMAT_0RGB1555. This pixel format however, is deprecated (see enumretro_pixel_format). If the call returnsfalse, the frontend does not support this pixel format. - set_
proc_ ⚠address_ callback - Allows a libretro core to announce support for the
retro_get_proc_address_interfaceinterface. This interface allows for a standard way to extend libretro where use of environment calls are too indirect, e.g. for cases where the frontend wants to call directly into the core. - set_ptr⚠
- Passes a value (by a raw const pointer) to the environment callback.
- set_
rotation ⚠ - Sets screen rotation of graphics.
- set_
serialization_ ⚠quirks - Sets quirk flags associated with serialization. The frontend will zero any flags it doesn’t recognize or support.
- set_
subsystem_ ⚠info - This environment call introduces the concept of libretro “subsystems”. A subsystem is a variant of a libretro core which supports different kinds of games. The purpose of this is to support e.g. emulators which might have special needs, e.g. Super Nintendo’s Super GameBoy, Sufami Turbo. It can also be used to pick among subsystems in an explicit way if the libretro implementation is a multi-system emulator itself.
- set_
support_ ⚠achievements - Unstable If true, the Core implementation supports achievements.
- set_
support_ ⚠no_ game - Tell the frontend whether this Core can run without particular game data.
- set_
system_ ⚠av_ info - Sets a new av_info structure.
- set_
variable ⚠ - Allows an implementation to notify the frontend that a core option value has changed.
- set_
variables ⚠ - 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 be called the first time as early as possible (ideally inCore::on_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. - shutdown⚠
- Requests the frontend to shutdown. Should only be used if game has a specific way to shutdown the game from a menu item or similar.
- supports_
fastforwarding_ ⚠override - Checks whether the frontend supports the
set_fastforwarding_overrideinterface. - supports_
set_ ⚠core_ options - Checks whether the frontend supports the
set_core_optionsinterface. - supports_
set_ ⚠core_ options_ v2 - Checks whether the frontend supports the
set_core_options_v2interface.