Added dummy audio device to disable audio while still simulating the devices
This commit is contained in:
parent
9e3b75f9fd
commit
82644db3fc
File diff suppressed because it is too large
Load Diff
|
@ -6,4 +6,8 @@ members = [
|
||||||
"emulator/frontends/minifb",
|
"emulator/frontends/minifb",
|
||||||
"tests/harte_tests"
|
"tests/harte_tests"
|
||||||
]
|
]
|
||||||
|
exclude = [
|
||||||
|
"emulator/frontends/pixels",
|
||||||
|
"emulator/frontends/macroquad",
|
||||||
|
]
|
||||||
default-members = ["emulator/frontends/minifb"]
|
default-members = ["emulator/frontends/minifb"]
|
||||||
|
|
|
@ -8,5 +8,5 @@ pub mod audio;
|
||||||
|
|
||||||
pub use self::keys::Key;
|
pub use self::keys::Key;
|
||||||
pub use self::controllers::{ControllerDevice, ControllerEvent};
|
pub use self::controllers::{ControllerDevice, ControllerEvent};
|
||||||
pub use self::traits::{Host, Tty, WindowUpdater, ControllerUpdater, KeyboardUpdater, Audio, BlitableSurface, HostData};
|
pub use self::traits::{Host, Tty, WindowUpdater, ControllerUpdater, KeyboardUpdater, Audio, BlitableSurface, HostData, DummyAudio};
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ use std::sync::{Arc, Mutex, MutexGuard};
|
||||||
|
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
use crate::host::keys::Key;
|
use crate::host::keys::Key;
|
||||||
|
use crate::host::gfx::Frame;
|
||||||
use crate::host::controllers::{ControllerDevice, ControllerEvent};
|
use crate::host::controllers::{ControllerDevice, ControllerEvent};
|
||||||
|
|
||||||
pub trait Host {
|
pub trait Host {
|
||||||
|
@ -36,6 +37,7 @@ pub trait Tty {
|
||||||
|
|
||||||
pub trait WindowUpdater: Send {
|
pub trait WindowUpdater: Send {
|
||||||
fn get_size(&mut self) -> (u32, u32);
|
fn get_size(&mut self) -> (u32, u32);
|
||||||
|
fn get_frame(&mut self) -> Result<Frame, Error>;
|
||||||
fn update_frame(&mut self, width: u32, height: u32, bitmap: &mut [u32]);
|
fn update_frame(&mut self, width: u32, height: u32, bitmap: &mut [u32]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,3 +87,19 @@ impl<T: Copy> HostData<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct DummyAudio();
|
||||||
|
|
||||||
|
impl Audio for DummyAudio {
|
||||||
|
fn samples_per_second(&self) -> usize {
|
||||||
|
48000
|
||||||
|
}
|
||||||
|
|
||||||
|
fn space_available(&self) -> usize {
|
||||||
|
4800
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_samples(&mut self, _buffer: &[f32]) {}
|
||||||
|
|
||||||
|
fn flush(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "moa_common"
|
name = "moa_common"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
tty = ["nix"]
|
tty = ["nix"]
|
||||||
|
@ -9,6 +9,6 @@ audio = ["cpal"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
moa_core = { path = "../../core" }
|
moa_core = { path = "../../core" }
|
||||||
nix = { version = "0.23", optional = true }
|
nix = { version = "0.25", optional = true }
|
||||||
cpal = { version = "0.13", optional = true }
|
cpal = { version = "0.14", optional = true }
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "moa_minifb"
|
name = "moa_minifb"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
default-run = "moa-genesis"
|
default-run = "moa-genesis"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
|
use std::mem;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
@ -17,20 +18,27 @@ use crate::peripherals::coprocessor::{CoprocessorCoordinator, CoprocessorBankReg
|
||||||
|
|
||||||
pub struct SegaGenesisOptions {
|
pub struct SegaGenesisOptions {
|
||||||
pub rom: String,
|
pub rom: String,
|
||||||
|
pub rom_data: Option<Vec<u8>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SegaGenesisOptions {
|
impl SegaGenesisOptions {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
rom: "".to_string(),
|
rom: "".to_string(),
|
||||||
|
rom_data: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_genesis<H: Host>(host: &mut H, options: SegaGenesisOptions) -> Result<System, Error> {
|
pub fn build_genesis<H: Host>(host: &mut H, mut options: SegaGenesisOptions) -> Result<System, Error> {
|
||||||
let mut system = System::new();
|
let mut system = System::new();
|
||||||
|
|
||||||
let rom = MemoryBlock::load(&options.rom).unwrap();
|
let rom = if options.rom_data.is_some() {
|
||||||
|
let data = mem::take(&mut options.rom_data).unwrap();
|
||||||
|
MemoryBlock::new(data)
|
||||||
|
} else {
|
||||||
|
MemoryBlock::load(&options.rom).unwrap()
|
||||||
|
};
|
||||||
//let mut rom = MemoryBlock::load("binaries/genesis/GenTestV3.0.bin").unwrap();
|
//let mut rom = MemoryBlock::load("binaries/genesis/GenTestV3.0.bin").unwrap();
|
||||||
//let mut rom = MemoryBlock::load("binaries/genesis/HDRV_Genesis_Test_v1_4.bin").unwrap();
|
//let mut rom = MemoryBlock::load("binaries/genesis/HDRV_Genesis_Test_v1_4.bin").unwrap();
|
||||||
//let mut rom = MemoryBlock::load("binaries/genesis/ComradeOj's tiny demo.bin").unwrap();
|
//let mut rom = MemoryBlock::load("binaries/genesis/ComradeOj's tiny demo.bin").unwrap();
|
||||||
|
|
Loading…
Reference in New Issue