CoreWrapper

Struct CoreWrapper 

Source
pub(crate) struct CoreWrapper {
Show 16 fields pub(crate) environment_set: bool, pub(crate) environment_callback: retro_environment_t, pub(crate) video_refresh_callback: retro_video_refresh_t, pub(crate) audio_sample_callback: retro_audio_sample_t, pub(crate) audio_sample_batch_callback: retro_audio_sample_batch_t, pub(crate) input_poll_callback: retro_input_poll_t, pub(crate) input_state_callback: retro_input_state_t, pub(crate) can_dupe: bool, pub(crate) had_frame: bool, pub(crate) last_width: u32, pub(crate) last_height: u32, pub(crate) last_pitch: usize, pub(crate) supports_bitmasks: bool, pub(crate) frame_delta: Option<i64>, pub(crate) interfaces: Arc<RwLock<InterfaceList>>, pub(crate) core: Box<dyn Core>,
}
Expand description

Holds the core instance as well as runtime information from the libretro frontend.

This struct gets used in the code generated by the retro_core!()-macro.

Fields§

§environment_set: bool§environment_callback: retro_environment_t§video_refresh_callback: retro_video_refresh_t

Render a frame. Pixel format is 15-bit 0RGB1555 native endian unless changed (see RETRO_ENVIRONMENT_SET_PIXEL_FORMAT).

Width and height specify dimensions of buffer. Pitch specifices length in bytes between two lines in buffer.

For performance reasons, it is highly recommended to have a frame that is packed in memory, i.e. pitch == width * byte_per_pixel. Certain graphic APIs, such as OpenGL ES, do not like textures that are not packed in memory.

§audio_sample_callback: retro_audio_sample_t

Renders a single audio frame. Should only be used if implementation generates a single sample at a time. Format is signed 16-bit native endian.

§audio_sample_batch_callback: retro_audio_sample_batch_t

Renders multiple audio frames in one go.

One frame is defined as a sample of left and right channels, interleaved. I.e. int16_t buf[4] = { l, r, l, r }; would be 2 frames. Only one of the audio callbacks must ever be used.

§input_poll_callback: retro_input_poll_t

Polls input.

§input_state_callback: retro_input_state_t

Queries for input for player port. device will be masked with RETRO_DEVICE_MASK.

Specialization of devices such as RETRO_DEVICE_JOYPAD_MULTITAP that have been set with Core::on_set_controller_port_device will still use the higher level RETRO_DEVICE_JOYPAD to request input.

§can_dupe: bool§had_frame: bool§last_width: u32§last_height: u32§last_pitch: usize§supports_bitmasks: bool§frame_delta: Option<i64>§interfaces: Arc<RwLock<InterfaceList>>§core: Box<dyn Core>

The wrapped Core implementation.

Implementations§

Source§

impl CoreWrapper

Source

pub(crate) fn new<C: 'static + Core>(core: C) -> Self

Source

pub(crate) fn on_set_video_refresh(&mut self, arg1: retro_video_refresh_t)

Source

pub(crate) fn on_set_audio_sample(&mut self, arg1: retro_audio_sample_t)

Source

pub(crate) fn on_set_audio_sample_batch( &mut self, arg1: retro_audio_sample_batch_t, )

Source

pub(crate) fn on_set_input_poll(&mut self, arg1: retro_input_poll_t)

Source

pub(crate) fn on_set_input_state(&mut self, arg1: retro_input_state_t)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.