34 lines
1.1 KiB
Rust
34 lines
1.1 KiB
Rust
use std::cell::RefCell;
|
|
use std::rc::Rc;
|
|
use std::path::Path;
|
|
|
|
use crate::base::ControlFlow;
|
|
use crate::base::RetroComponent;
|
|
use crate::base::Result;
|
|
|
|
use ferretro_base::prelude::*;
|
|
|
|
impl<T> RetroComponent for Rc<RefCell<T>> where
|
|
T: RetroComponent,
|
|
Rc<RefCell<T>>: RetroCallbacks,
|
|
{
|
|
fn pre_init(&mut self, retro: &mut LibretroWrapper) -> Result<()> {
|
|
RefCell::try_borrow_mut(self)?.pre_init(retro)
|
|
}
|
|
fn post_init(&mut self, retro: &mut LibretroWrapper) -> Result<()> {
|
|
RefCell::try_borrow_mut(self)?.post_init(retro)
|
|
}
|
|
fn pre_load_game(&mut self, retro: &mut LibretroWrapper, rom: &Path) -> Result<()> {
|
|
RefCell::try_borrow_mut(self)?.pre_load_game(retro, rom)
|
|
}
|
|
fn post_load_game(&mut self, retro: &mut LibretroWrapper, rom: &Path) -> Result<()> {
|
|
RefCell::try_borrow_mut(self)?.post_load_game(retro, rom)
|
|
}
|
|
fn pre_run(&mut self, retro: &mut LibretroWrapper) -> ControlFlow {
|
|
RefCell::borrow_mut(self).pre_run(retro)
|
|
}
|
|
fn post_run(&mut self, retro: &mut LibretroWrapper) -> ControlFlow {
|
|
RefCell::borrow_mut(self).post_run(retro)
|
|
}
|
|
}
|