logo
pub struct RunContext<'a> { /* private fields */ }
Expand description

Exposes callbacks that are safe to call in Core::on_run

For a description of the callbacks see [CoreWrapper].

Implementations

Polls for input if [CoreWrapper::input_poll_callback] has been set

Gets the input state for the given player and device if [CoreWrapper::input_state_callback] has been set

Queries the libretro frontend for the state of each joypad button by making an environment call for every button separately.

See also Self::get_joypad_bitmask.

Unstable Queries the frontend for the joypad state with the more efficient, but currently experimental, joypad bitmask feature. Only a single call into the frontend gets made.

This feature is unstable and guarded by the unstable-env-commands feature flag.

Please be advised that this feature might change without further noticeand no guarantees about its stability can be made.

Draws a new frame if [CoreWrapper::video_refresh_callback] has been set

Duplicates the previous frame

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 in retro_input_state_t. Example bitmask: RetroDevice::JOYPAD | RetroDevice::ANALOG.

Sets a new av_info structure.

This should only be used if the core is completely altering the internal resolutions, aspect ratios, timings, sampling rate, etc. Calling this can require a full reinitialization of video/audio drivers in the frontend,

so it is important to call it very sparingly, and usually only with the users explicit consent. An eventual driver reinitialize will happen so that video and audio callbacks happening after this call within the same Core::on_run call will target the newly initialized driver.

This callback makes it possible to support configurable resolutions in games, which can be useful to avoid setting the “worst case” in max_width/max_height.

HIGHLY RECOMMENDED Do not call this callback every time resolution changes in an emulator core if it’s expected to be a temporary change, for the reasons of possible driver reinitialization. This call is not a free pass for not trying to provide correct values in Core::on_get_av_info. If you need to change things like aspect ratio or nominal width/height, use set_game_geometry, which is a softer variant of set_system_av_info.

If this returns false, the frontend does not acknowledge a changed retro_system_av_info struct.

Sets a new game_geometry structure.

This environment call is similar to set_system_av_info for changing video parameters, but provides a guarantee that drivers will not be reinitialized.

The purpose of this call is to allow a core to alter nominal width/heights as well as aspect ratios on-the-fly, which can be useful for some emulators to change in run-time.

max_width/max_height arguments are ignored and cannot be changed with this call as this could potentially require a reinitialization or a non-constant time operation. If max_width/max_height are to be changed, set_system_av_info is required.

A frontend must guarantee that this environment call completes in constant time.

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.

  • If value is less than current frontend audio latency, callback has no effect
  • If value is zero, default frontend audio latency is set

May be used by a core to increase audio latency and therefore decrease the probability of buffer under-runs (crackling) when performing ‘intensive’ operations. A core utilising RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK to implement audio-buffer-based frame skipping may achieve optimal results by setting the audio latency to a ‘high’ (typically 6x or 8x) integer multiple of the expected frame time.

Calling this can require a full reinitialization of audio drivers in the frontend, so it is important to call it very sparingly, and usually only with the users explicit consent. An eventual driver reinitialize will happen so that audio callbacks happening after this call within the same Core::on_run call will target the newly initialized driver.

Trait Implementations

Performs the conversion.

Performs the conversion.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.