pub trait RetroCore {
const SUPPORT_NO_GAME: bool = false;
Show 16 methods
// Required methods
fn init(env: &RetroEnvironment) -> Self;
fn get_system_info() -> RetroSystemInfo;
fn reset(&mut self, env: &RetroEnvironment);
fn run(&mut self, env: &RetroEnvironment, runtime: &RetroRuntime);
fn load_game(
&mut self,
env: &RetroEnvironment,
game: RetroGame<'_>,
) -> RetroLoadGameResult;
// Provided methods
fn set_controller_port_device(
&mut self,
env: &RetroEnvironment,
port: u32,
device: RetroDevice,
) { ... }
fn serialize_size(&self, env: &RetroEnvironment) -> usize { ... }
fn serialize(
&self,
env: &RetroEnvironment,
data: *mut (),
size: usize,
) -> bool { ... }
fn unserialize(
&mut self,
env: &RetroEnvironment,
data: *const (),
size: usize,
) -> bool { ... }
fn cheat_reset(&mut self, env: &RetroEnvironment) { ... }
fn cheat_set(
&mut self,
env: &RetroEnvironment,
index: u32,
enabled: bool,
code: *const c_char,
) { ... }
fn load_game_special(
&mut self,
env: &RetroEnvironment,
game_type: u32,
info: RetroGame<'_>,
num_info: usize,
) -> bool { ... }
fn unload_game(&mut self, env: &RetroEnvironment) { ... }
fn get_region(&self, env: &RetroEnvironment) -> RetroRegion { ... }
fn get_memory_data(&mut self, env: &RetroEnvironment, id: u32) -> *mut () { ... }
fn get_memory_size(&self, env: &RetroEnvironment, id: u32) -> usize { ... }
}
Provided Associated Constants§
const SUPPORT_NO_GAME: bool = false
Required Methods§
Sourcefn init(env: &RetroEnvironment) -> Self
fn init(env: &RetroEnvironment) -> Self
Called when a new instance of the core is needed. The env
parameter can be used to set-up and/or query values
required for the core to function properly.
Sourcefn get_system_info() -> RetroSystemInfo
fn get_system_info() -> RetroSystemInfo
Called to get information about the core. This information can then be displayed in a frontend, or used to construct core-specific paths.
Sourcefn reset(&mut self, env: &RetroEnvironment)
fn reset(&mut self, env: &RetroEnvironment)
Called when a player resets their game.
Sourcefn run(&mut self, env: &RetroEnvironment, runtime: &RetroRuntime)
fn run(&mut self, env: &RetroEnvironment, runtime: &RetroRuntime)
Called continuously once the core is initialized and a game is loaded. The core is expected to advance emulation by a single frame before returning.
fn load_game( &mut self, env: &RetroEnvironment, game: RetroGame<'_>, ) -> RetroLoadGameResult
Provided Methods§
Sourcefn set_controller_port_device(
&mut self,
env: &RetroEnvironment,
port: u32,
device: RetroDevice,
)
fn set_controller_port_device( &mut self, env: &RetroEnvironment, port: u32, device: RetroDevice, )
Called to associate a particular device with a particular port. A core is allowed to ignore this request.
Sourcefn serialize_size(&self, env: &RetroEnvironment) -> usize
fn serialize_size(&self, env: &RetroEnvironment) -> usize
Called to determine the size of the save state buffer. This is only ever called once per run, and the core must not exceed the size returned here for subsequent saves.
Sourcefn serialize(&self, env: &RetroEnvironment, data: *mut (), size: usize) -> bool
fn serialize(&self, env: &RetroEnvironment, data: *mut (), size: usize) -> bool
Allows a core to save its internal state into the specified buffer. The buffer is guaranteed to be at least size
bytes, where size
is the value returned from serialize_size
.
Sourcefn unserialize(
&mut self,
env: &RetroEnvironment,
data: *const (),
size: usize,
) -> bool
fn unserialize( &mut self, env: &RetroEnvironment, data: *const (), size: usize, ) -> bool
Allows a core to load its internal state from the specified buffer. The buffer is guaranteed to be at least size
bytes, where size
is the value returned from serialize_size
.
fn cheat_reset(&mut self, env: &RetroEnvironment)
fn cheat_set( &mut self, env: &RetroEnvironment, index: u32, enabled: bool, code: *const c_char, )
fn load_game_special( &mut self, env: &RetroEnvironment, game_type: u32, info: RetroGame<'_>, num_info: usize, ) -> bool
fn unload_game(&mut self, env: &RetroEnvironment)
fn get_region(&self, env: &RetroEnvironment) -> RetroRegion
fn get_memory_data(&mut self, env: &RetroEnvironment, id: u32) -> *mut ()
fn get_memory_size(&self, env: &RetroEnvironment, id: u32) -> usize
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.