2021-10-20 22:53:25 +00:00
|
|
|
|
2022-09-25 06:14:03 +00:00
|
|
|
use moa_core::Error;
|
2023-03-15 03:05:29 +00:00
|
|
|
use moa_core::host::{Host, Tty, WindowUpdater, ControllerDevice, ControllerUpdater, Audio};
|
|
|
|
|
|
|
|
use moa_common::audio::{AudioMixer, AudioSource};
|
2021-10-20 22:53:25 +00:00
|
|
|
|
|
|
|
pub struct ConsoleFrontend;
|
|
|
|
|
2021-10-22 04:55:27 +00:00
|
|
|
impl Host for ConsoleFrontend {
|
2021-12-07 03:52:04 +00:00
|
|
|
fn create_pty(&self) -> Result<Box<dyn Tty>, Error> {
|
|
|
|
use moa_common::tty::SimplePty;
|
|
|
|
Ok(Box::new(SimplePty::open()?))
|
|
|
|
}
|
|
|
|
|
2021-12-13 20:00:24 +00:00
|
|
|
fn add_window(&mut self, _updater: Box<dyn WindowUpdater>) -> Result<(), Error> {
|
2021-10-22 04:55:27 +00:00
|
|
|
println!("console: add_window() is not supported from the console; ignoring request...");
|
|
|
|
Ok(())
|
2021-10-20 22:53:25 +00:00
|
|
|
}
|
2023-03-15 03:05:29 +00:00
|
|
|
|
|
|
|
fn register_controller(&mut self, _device: ControllerDevice, _input: Box<dyn ControllerUpdater>) -> Result<(), Error> {
|
|
|
|
println!("console: register_controller() is not supported from the console; ignoring request...");
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
fn create_audio_source(&mut self) -> Result<Box<dyn Audio>, Error> {
|
|
|
|
println!("console: create_audio_source() is not supported from the console; returning dummy device...");
|
|
|
|
let source = AudioSource::new(AudioMixer::with_default_rate());
|
|
|
|
Ok(Box::new(source))
|
|
|
|
}
|
2021-10-20 22:53:25 +00:00
|
|
|
}
|
|
|
|
|