This commit is contained in:
lifning 2021-11-09 21:36:55 -08:00
parent aa33f331f0
commit 82b9cba976
8 changed files with 11 additions and 9 deletions

View File

@ -7,7 +7,7 @@ use libloading;
use super::ffi::*;
pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
pub struct LibretroApi {
_lib: libloading::Library, // for tying our lifetime to its own

View File

@ -108,7 +108,7 @@ impl<D> TryFrom<(D, c_uint)> for InputDeviceId
where D: TryInto<DeviceType>,
<D as std::convert::TryInto<DeviceType>>::Error: std::error::Error + Send + Sync + 'static,
{
type Error = Box<dyn std::error::Error>;
type Error = Box<dyn std::error::Error + Send + Sync>;
fn try_from(pair: (D, c_uint)) -> Result<Self, Self::Error> {
let (device, id) = pair;

View File

@ -40,13 +40,15 @@ pub struct RetroComponentBase {
_temp_dir: tempfile::TempDir,
}
unsafe impl Send for RetroComponentBase {}
// TODO: replace with std::ops::ControlFlow when it becomes stable
pub enum ControlFlow {
Continue,
Break,
}
pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
#[rustfmt::skip]
#[allow(unused_variables)]

View File

@ -61,7 +61,7 @@ impl RetroCallbacks for SimpleSdl2AudioComponent {
}
impl RetroComponent for SimpleSdl2AudioComponent {
fn post_load_game(&mut self, retro: &mut LibretroWrapper, _rom: &Path) -> Result<(), Box<dyn Error>> {
fn post_load_game(&mut self, retro: &mut LibretroWrapper, _rom: &Path) -> Result<(), Box<dyn Error + Send + Sync>> {
self.src_freq = retro.get_system_av_info().timing.sample_rate;
self.queue.resume();
self.started = false;
@ -83,7 +83,7 @@ impl RetroComponent for SimpleSdl2AudioComponent {
}
impl SimpleSdl2AudioComponent {
pub fn new(sdl_context: &mut Sdl) -> Result<Self, Box<dyn std::error::Error>> {
pub fn new(sdl_context: &mut Sdl) -> Result<Self, Box<dyn std::error::Error + Send + Sync>> {
let audio = sdl_context.audio().unwrap();
let desired_spec = AudioSpecDesired {
freq: None,

View File

@ -33,7 +33,7 @@ impl RetroCallbacks for Sdl2RateControlledAudioComponent {
}
impl RetroComponent for Sdl2RateControlledAudioComponent {
fn post_load_game(&mut self, _retro: &mut LibretroWrapper, _rom: &Path) -> Result<(), Box<dyn Error>> {
fn post_load_game(&mut self, _retro: &mut LibretroWrapper, _rom: &Path) -> Result<(), Box<dyn Error + Send + Sync>> {
self.queue.resume();
Ok(())
}

View File

@ -98,7 +98,7 @@ impl RetroComponent for SimpleSdl2GamepadComponent {
ControlFlow::Continue
}
fn post_load_game(&mut self, retro: &mut LibretroWrapper, _rom: &Path) -> Result<(), Box<dyn Error>> {
fn post_load_game(&mut self, retro: &mut LibretroWrapper, _rom: &Path) -> Result<(), Box<dyn Error + Send + Sync>> {
if let Some(device) = self.preferred_pad {
for port in 0..self.gamepads.len() as u32 {
retro.set_controller_port_device(port, device);

View File

@ -28,7 +28,7 @@ pub struct SimpleSdl2OpenglComponent {
}
impl SimpleSdl2OpenglComponent {
pub fn new(sdl_context: &mut Sdl, retro: &LibretroWrapper) -> Result<Self, Box<dyn std::error::Error>> {
pub fn new(sdl_context: &mut Sdl, retro: &LibretroWrapper) -> Result<Self, Box<dyn std::error::Error + Send + Sync>> {
let sys_info = retro.get_system_info();
let title = format!(
"{} - ferretro SDL GL",

View File

@ -9,7 +9,7 @@ pub struct Sdl2SurfaceComponent {
}
impl Sdl2SurfaceComponent {
pub fn new() -> Result<Self, Box<dyn std::error::Error>> {
pub fn new() -> Result<Self, Box<dyn std::error::Error + Send + Sync>> {
let pixel_format = sdl2::pixels::PixelFormatEnum::ARGB1555;
// automatically replaced in video_refresh whenever size doesn't match