pub struct Emulator { /* private fields */ }
Implementations§
Source§impl Emulator
impl Emulator
Sourcepub fn create(core_path: &Path, rom_path: &Path) -> Emulator
pub fn create(core_path: &Path, rom_path: &Path) -> Emulator
§Panics
If the platform is not Windows, Mac, or Linux; if the dylib fails to load successfully; if any Emulator has been created on this thread but not yet dropped.
pub fn get_library(&mut self) -> &Library
pub fn get_symbol<'a, T>(&'a self, symbol: &[u8]) -> Option<Symbol<'a, T>>
pub fn run(&mut self, inputs: [Buttons; 2])
pub fn reset(&mut self)
pub fn get_video_ram_size(&self) -> usize
pub fn get_system_ram_size(&self) -> usize
pub fn get_save_ram_size(&self) -> usize
pub fn video_ram_ref(&self) -> &[u8] ⓘ
pub fn system_ram_ref(&self) -> &[u8] ⓘ
pub fn system_ram_mut(&mut self) -> &mut [u8] ⓘ
pub fn save_ram(&self) -> &[u8] ⓘ
pub fn memory_regions(&self) -> Vec<MemoryRegion>
Sourcepub fn memory_ref(&self, start: usize) -> Result<&[u8], RetroRsError>
pub fn memory_ref(&self, start: usize) -> Result<&[u8], RetroRsError>
§Errors
RetroRsError::RAMCopyNotMappedIntoMemoryRegionError
: Returns an error if the desired address is not mapped into memory regions
Sourcepub fn memory_ref_mut(
&self,
mr: &MemoryRegion,
start: usize,
) -> Result<&mut [u8], RetroRsError>
pub fn memory_ref_mut( &self, mr: &MemoryRegion, start: usize, ) -> Result<&mut [u8], RetroRsError>
§Errors
RetroRsError::RAMMapOutOfRangeError
: The desired address is out of mapped range
RetroRsError::RAMCopySrcOutOfBoundsError
: The desired range is not in the requested region
pub fn pixel_format(&self) -> retro_pixel_format
pub fn framebuffer_size(&self) -> (usize, usize)
pub fn framebuffer_pitch(&self) -> usize
pub fn peek_audio_sample<AudioPeek, AudioPeekRet>( &self, f: AudioPeek, ) -> AudioPeekRet
pub fn get_audio_sample_rate(&self) -> f64
pub fn get_video_fps(&self) -> f64
pub fn save(&self, bytes: &mut [u8]) -> bool
pub fn load(&mut self, bytes: &[u8]) -> bool
pub fn save_size(&self) -> usize
pub fn clear_cheats(&mut self)
Sourcepub fn get_pixel(
&self,
x: usize,
y: usize,
) -> Result<(u8, u8, u8), RetroRsError>
pub fn get_pixel( &self, x: usize, y: usize, ) -> Result<(u8, u8, u8), RetroRsError>
§Panics
Panics if the pixel format used by the core is not supported for reads.
§Errors
RetroRsError::NoFramebufferError
: Emulator has not created a framebuffer.
Sourcepub fn for_each_pixel(
&self,
f: impl FnMut(usize, usize, u8, u8, u8),
) -> Result<(), RetroRsError>
pub fn for_each_pixel( &self, f: impl FnMut(usize, usize, u8, u8, u8), ) -> Result<(), RetroRsError>
§Panics
Panics if the pixel format used by the core is not supported for reads.
§Errors
RetroRsError::NoFramebufferError
: Emulator has not created a framebuffer.
Sourcepub fn copy_framebuffer_rgb888(
&self,
slice: &mut [u8],
) -> Result<(), RetroRsError>
pub fn copy_framebuffer_rgb888( &self, slice: &mut [u8], ) -> Result<(), RetroRsError>
§Panics
Panics if the pixel format used by the core is not supported for reads.
§Errors
RetroRsError::NoFramebufferError
: Emulator has not created a framebuffer.
Sourcepub fn copy_framebuffer_rgba8888(
&self,
slice: &mut [u8],
) -> Result<(), RetroRsError>
pub fn copy_framebuffer_rgba8888( &self, slice: &mut [u8], ) -> Result<(), RetroRsError>
§Panics
Panics if the pixel format used by the core is not supported for reads.
§Errors
RetroRsError::NoFramebufferError
: Emulator has not created a framebuffer.
Sourcepub fn copy_framebuffer_rgb332(
&self,
slice: &mut [u8],
) -> Result<(), RetroRsError>
pub fn copy_framebuffer_rgb332( &self, slice: &mut [u8], ) -> Result<(), RetroRsError>
§Panics
Panics if the pixel format used by the core is not supported for reads.
§Errors
RetroRsError::NoFramebufferError
: Emulator has not created a framebuffer.
Sourcepub fn copy_framebuffer_argb32(
&self,
slice: &mut [u32],
) -> Result<(), RetroRsError>
pub fn copy_framebuffer_argb32( &self, slice: &mut [u32], ) -> Result<(), RetroRsError>
§Panics
Panics if the pixel format used by the core is not supported for reads.
§Errors
RetroRsError::NoFramebufferError
: Emulator has not created a framebuffer.
Sourcepub fn copy_framebuffer_rgba32(
&self,
slice: &mut [u32],
) -> Result<(), RetroRsError>
pub fn copy_framebuffer_rgba32( &self, slice: &mut [u32], ) -> Result<(), RetroRsError>
§Panics
Panics if the pixel format used by the core is not supported for reads.
§Errors
RetroRsError::NoFramebufferError
: Emulator has not created a framebuffer.
Sourcepub fn copy_framebuffer_rgba_f32x4(
&self,
slice: &mut [f32],
) -> Result<(), RetroRsError>
pub fn copy_framebuffer_rgba_f32x4( &self, slice: &mut [f32], ) -> Result<(), RetroRsError>
§Panics
Panics if the pixel format used by the core is not supported for reads.
§Errors
RetroRsError::NoFramebufferError
: Emulator has not created a framebuffer.
Trait Implementations§
Source§impl FramebufferToImageBuffer for Emulator
impl FramebufferToImageBuffer for Emulator
Source§fn create_imagebuffer(
&self,
) -> Result<ImageBuffer<Rgb<u8>, Vec<u8>>, RetroRsError>
fn create_imagebuffer( &self, ) -> Result<ImageBuffer<Rgb<u8>, Vec<u8>>, RetroRsError>
Auto Trait Implementations§
impl Freeze for Emulator
impl RefUnwindSafe for Emulator
impl !Send for Emulator
impl !Sync for Emulator
impl Unpin for Emulator
impl UnwindSafe for Emulator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more