pub struct RunContext<'a> {
Show 13 fields pub(crate) environment_callback: &'a retro_environment_t, pub(crate) interfaces: Arc<RwLock<InterfaceList>>, pub(crate) audio_sample_batch_callback: &'a retro_audio_sample_batch_t, pub(crate) audio_sample_callback: &'a retro_audio_sample_t, pub(crate) input_poll_callback: &'a retro_input_poll_t, pub(crate) input_state_callback: &'a retro_input_state_t, pub(crate) video_refresh_callback: &'a retro_video_refresh_t, pub(crate) can_dupe: bool, pub(crate) had_frame: &'a mut bool, pub(crate) last_width: &'a mut u32, pub(crate) last_height: &'a mut u32, pub(crate) last_pitch: &'a mut usize, pub(crate) supports_bitmasks: bool,
}
Expand description

Functions that are safe to be called in Core::on_run.

For a description of the callbacks see CoreWrapper.

Fields§

§environment_callback: &'a retro_environment_t§interfaces: Arc<RwLock<InterfaceList>>§audio_sample_batch_callback: &'a retro_audio_sample_batch_t§audio_sample_callback: &'a retro_audio_sample_t§input_poll_callback: &'a retro_input_poll_t§input_state_callback: &'a retro_input_state_t§video_refresh_callback: &'a retro_video_refresh_t§can_dupe: bool§had_frame: &'a mut bool§last_width: &'a mut u32§last_height: &'a mut u32§last_pitch: &'a mut usize§supports_bitmasks: bool

Implementations§

Polls for input if RunContext::input_poll_callback has been set

Gets the input state for the given player and device if RunContext::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 notice and no guarantees about its stability can be made.

Unstable

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

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

Unstable

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

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

Draws a new frame if RunContext::video_refresh_callback has been set

Duplicates the previous frame

Unstable

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

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

Unstable

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

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

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§

Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.