Struct rust_libretro::contexts::InitContext
source · [−]pub struct InitContext<'a> {
pub(crate) environment_callback: &'a retro_environment_t,
}Expand description
Functions that are safe to be called in Core::on_init
Fields
environment_callback: &'a retro_environment_tImplementations
sourceimpl<'a> InitContext<'a>
impl<'a> InitContext<'a>
pub fn new(environment_callback: &'a retro_environment_t) -> Self
sourceimpl InitContext<'_>
impl InitContext<'_>
sourcepub fn get_rumble_interface(&self) -> Option<retro_rumble_interface>
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.
sourceimpl InitContext<'_>
impl InitContext<'_>
sourcepub unsafe fn set_memory_maps(&self, data: retro_memory_map) -> bool
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.
sourceimpl InitContext<'_>
impl InitContext<'_>
sourcepub unsafe fn set_support_achievements(&self, value: bool) -> bool
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.
sourceimpl InitContext<'_>
impl InitContext<'_>
sourcepub fn set_serialization_quirks(&self, quirks: SerializationQuirks) -> bool
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
sourceimpl<'a> From<&'_ InitContext<'a>> for GenericContext<'a>
impl<'a> From<&'_ InitContext<'a>> for GenericContext<'a>
sourcefn from(other: &InitContext<'a>) -> GenericContext<'a>
fn from(other: &InitContext<'a>) -> GenericContext<'a>
Performs the conversion.
sourceimpl<'a> From<&'_ mut InitContext<'a>> for GenericContext<'a>
impl<'a> From<&'_ mut InitContext<'a>> for GenericContext<'a>
sourcefn from(other: &mut InitContext<'a>) -> GenericContext<'a>
fn from(other: &mut InitContext<'a>) -> GenericContext<'a>
Performs the conversion.
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
