Struct InitContext

Source
pub struct InitContext<'a> {
    pub(crate) environment_callback: &'a retro_environment_t,
    pub(crate) interfaces: Arc<RwLock<InterfaceList>>,
}
Expand description

Functions that are safe to be called in Core::on_init

Fields§

§environment_callback: &'a retro_environment_t§interfaces: Arc<RwLock<InterfaceList>>

Implementations§

Source§

impl<'a> InitContext<'a>

Source

pub(crate) fn new( environment_callback: &'a retro_environment_t, interfaces: Arc<RwLock<InterfaceList>>, ) -> Self

Source§

impl InitContext<'_>

Source

pub fn get_rumble_interface(&self) -> Option<retro_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_init or Core::on_load_game. Should not be called from Core::on_set_environment. Returns false if rumble functionality is unavailable.

Source§

impl InitContext<'_>

Source

pub unsafe fn set_memory_maps(&self, data: retro_memory_map) -> bool

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.

Should only be used by emulators; it doesn’t make much sense for anything else. It is recommended to expose all relevant pointers through retro_get_memory_* as well.

Can be called from Core::on_init and Core::on_load_game.

§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.

Source§

impl InitContext<'_>

Source

pub unsafe fn set_support_achievements(&self, value: bool) -> bool

Unstable If true, the Core implementation supports achievements.

Either via memory descriptors set with RETRO_ENVIRONMENT_SET_MEMORY_MAPS or via Core::get_memory_data / Core::get_memory_size.

§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.

Source§

impl InitContext<'_>

Source

pub fn set_serialization_quirks(&self, quirks: SerializationQuirks) -> bool

Sets quirk flags associated with serialization. The frontend will zero any flags it doesn’t recognize or support.

Should be set in either Core::on_init or Core::on_load_game, but not both.

Trait Implementations§

Source§

impl<'a> From<&InitContext<'a>> for GenericContext<'a>

Source§

fn from(other: &InitContext<'a>) -> GenericContext<'a>

Converts to this type from the input type.
Source§

impl<'a> From<&mut InitContext<'a>> for GenericContext<'a>

Source§

fn from(other: &mut InitContext<'a>) -> GenericContext<'a>

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for InitContext<'a>

§

impl<'a> RefUnwindSafe for InitContext<'a>

§

impl<'a> !Send for InitContext<'a>

§

impl<'a> !Sync for InitContext<'a>

§

impl<'a> Unpin for InitContext<'a>

§

impl<'a> UnwindSafe for InitContext<'a>

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.