Skip to content

Commit

Permalink
Added wait_attach() functions to emulators
Browse files Browse the repository at this point in the history
  • Loading branch information
Jujstme authored and CryZe committed Jan 20, 2024
1 parent a14e2b9 commit 8774923
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 7 deletions.
17 changes: 16 additions & 1 deletion src/emulator/gba/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use core::{
task::{Context, Poll},
};

use crate::{Address, Error, Process};
use crate::{future::retry, Address, Error, Process};
use bytemuck::CheckedBitPattern;

mod emuhawk;
Expand Down Expand Up @@ -52,6 +52,21 @@ impl Emulator {
})
}

/// Asynchronously awaits attaching to a target emulator,
/// yielding back to the runtime between each try.
///
/// Supported emulators are:
/// - VisualBoyAdvance
/// - VisualBoyAdvance-M
/// - mGBA
/// - NO$GBA
/// - BizHawk
/// - Retroarch, with one of the following cores: `vbam_libretro.dll`, `vba_next_libretro.dll`,
/// `mednafen_gba_libretro.dll`, `mgba_libretro.dll`, `gpsp_libretro.dll`
pub async fn wait_attach() -> Self {
retry(Self::attach).await
}

/// Checks whether the emulator is still open. If it is not open anymore,
/// you should drop the emulator.
pub fn is_open(&self) -> bool {
Expand Down
12 changes: 11 additions & 1 deletion src/emulator/gcn/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use core::{
task::{Context, Poll},
};

use crate::{Address, Endian, Error, FromEndian, Process};
use crate::{future::retry, Address, Endian, Error, FromEndian, Process};
use bytemuck::CheckedBitPattern;

mod dolphin;
Expand Down Expand Up @@ -46,6 +46,16 @@ impl Emulator {
})
}

/// Asynchronously awaits attaching to a target emulator,
/// yielding back to the runtime between each try.
///
/// Supported emulators are:
/// - Dolphin
/// - Retroarch (using the `dolphin_libretro.dll` core)
pub async fn wait_attach() -> Self {
retry(Self::attach).await
}

/// Checks whether the emulator is still open. If it is not open anymore,
/// you should drop the emulator.
pub fn is_open(&self) -> bool {
Expand Down
15 changes: 14 additions & 1 deletion src/emulator/genesis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use core::{
task::{Context, Poll},
};

use crate::{Address, Endian, Error, FromEndian, Process};
use crate::{future::retry, Address, Endian, Error, FromEndian, Process};
use bytemuck::CheckedBitPattern;

mod blastem;
Expand Down Expand Up @@ -53,6 +53,19 @@ impl Emulator {
})
}

/// Asynchronously awaits attaching to a target emulator,
/// yielding back to the runtime between each try.
///
/// Supported emulators are:
/// - Retroarch
/// - SEGA Classics / SEGA Game Room
/// - Fusion
/// - Gens
/// - BlastEm
pub async fn wait_attach() -> Self {
retry(Self::attach).await
}

/// Checks whether the emulator is still open. If it is not open anymore,
/// you should drop the emulator.
pub fn is_open(&self) -> bool {
Expand Down
18 changes: 17 additions & 1 deletion src/emulator/ps1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use core::{
task::{Context, Poll},
};

use crate::{Address, Error, Process};
use crate::{future::retry, Address, Error, Process};
use bytemuck::CheckedBitPattern;

mod duckstation;
Expand Down Expand Up @@ -37,6 +37,7 @@ impl Emulator {
/// - ePSXe
/// - pSX
/// - Duckstation
/// - Mednafen
/// - Retroarch (supported cores: Beetle-PSX, Swanstation, PCSX ReARMed)
/// - PCSX-redux
/// - XEBRA
Expand All @@ -52,6 +53,21 @@ impl Emulator {
})
}

/// Asynchronously awaits attaching to a target emulator,
/// yielding back to the runtime between each try.
///
/// Supported emulators are:
/// - ePSXe
/// - pSX
/// - Duckstation
/// - Mednafen
/// - Retroarch (supported cores: Beetle-PSX, Swanstation, PCSX ReARMed)
/// - PCSX-redux
/// - XEBRA
pub async fn wait_attach() -> Self {
retry(Self::attach).await
}

/// Checks whether the emulator is still open. If it is not open anymore,
/// you should drop the emulator.
pub fn is_open(&self) -> bool {
Expand Down
12 changes: 11 additions & 1 deletion src/emulator/ps2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use core::{
task::{Context, Poll},
};

use crate::{Address, Error, Process};
use crate::{future::retry, Address, Error, Process};
use bytemuck::CheckedBitPattern;

mod pcsx2;
Expand Down Expand Up @@ -43,6 +43,16 @@ impl Emulator {
})
}

/// Asynchronously awaits attaching to a target emulator,
/// yielding back to the runtime between each try.
///
/// Supported emulators are:
/// - PCSX2
/// - Retroarch (64-bit version, using the `pcsx2_libretro.dll` core)
pub async fn wait_attach() -> Self {
retry(Self::attach).await
}

/// Checks whether the emulator is still open. If it is not open anymore,
/// you should drop the emulator.
pub fn is_open(&self) -> bool {
Expand Down
14 changes: 13 additions & 1 deletion src/emulator/sms/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use core::{
task::{Context, Poll},
};

use crate::{Address, Error, Process};
use crate::{future::retry, Address, Error, Process};
use bytemuck::CheckedBitPattern;

mod blastem;
Expand Down Expand Up @@ -47,6 +47,18 @@ impl Emulator {
})
}

/// Asynchronously awaits attaching to a target emulator,
/// yielding back to the runtime between each try.
///
/// Supported emulators are:
/// - Retroarch, with one of the following cores: `genesis_plus_gx_libretro.dll`,
/// `genesis_plus_gx_wide_libretro.dll`, `picodrive_libretro.dll`, `smsplus_libretro.dll`, `gearsystem_libretro.dll`
/// - Fusion
/// - BlastEm
pub async fn wait_attach() -> Self {
retry(Self::attach).await
}

/// Checks whether the emulator is still open. If it is not open anymore,
/// you should drop the emulator.
pub fn is_open(&self) -> bool {
Expand Down
12 changes: 11 additions & 1 deletion src/emulator/wii/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use core::{
task::{Context, Poll},
};

use crate::{Address, Endian, Error, FromEndian, Process};
use crate::{future::retry, Address, Endian, Error, FromEndian, Process};
use bytemuck::CheckedBitPattern;

mod dolphin;
Expand Down Expand Up @@ -47,6 +47,16 @@ impl Emulator {
})
}

/// Asynchronously awaits attaching to a target emulator,
/// yielding back to the runtime between each try.
///
/// Supported emulators are:
/// - Dolphin
/// - Retroarch (using the `dolphin_libretro.dll` core)
pub async fn wait_attach() -> Self {
retry(Self::attach).await
}

/// Checks whether the emulator is still open. If it is not open anymore,
/// you should drop the emulator.
pub fn is_open(&self) -> bool {
Expand Down

0 comments on commit 8774923

Please sign in to comment.