fix options for main emu
This commit is contained in:
parent
7dc6295ee8
commit
5f2a6ed14d
|
@ -9,7 +9,9 @@ use cpal::{
|
||||||
};
|
};
|
||||||
use futures::executor;
|
use futures::executor;
|
||||||
use gb_emu_lib::{
|
use gb_emu_lib::{
|
||||||
connect::{AudioOutput, DownsampleType, EmulatorMessage, JoypadState, Renderer, RomFile},
|
connect::{
|
||||||
|
AudioOutput, DownsampleType, EmulatorMessage, JoypadState, Renderer, RomFile, SerialTarget,
|
||||||
|
},
|
||||||
util::scale_buffer,
|
util::scale_buffer,
|
||||||
EmulatorCore,
|
EmulatorCore,
|
||||||
};
|
};
|
||||||
|
@ -75,14 +77,16 @@ fn main() {
|
||||||
3
|
3
|
||||||
};
|
};
|
||||||
|
|
||||||
let options = gb_emu_lib::Options {
|
let options = gb_emu_lib::Options::new(RomFile::Path(args.rom))
|
||||||
rom: RomFile::Path(args.rom),
|
.with_save_path(args.save)
|
||||||
save_path: args.save,
|
.with_serial_target(if args.connect_serial {
|
||||||
no_save: args.no_save,
|
SerialTarget::Stdout
|
||||||
bootrom: args.bootrom.map(RomFile::Path),
|
} else {
|
||||||
connect_serial: args.connect_serial,
|
SerialTarget::None
|
||||||
verbose: args.verbose,
|
})
|
||||||
};
|
.with_bootrom(args.bootrom.map(RomFile::Path))
|
||||||
|
.with_no_save(args.no_save)
|
||||||
|
.with_verbose(args.verbose);
|
||||||
|
|
||||||
let tile_window: Option<Box<dyn Renderer<u32>>> = if args.tile_window {
|
let tile_window: Option<Box<dyn Renderer<u32>>> = if args.tile_window {
|
||||||
Some(Box::new(WindowRenderer::new(factor, None)))
|
Some(Box::new(WindowRenderer::new(factor, None)))
|
||||||
|
|
|
@ -44,8 +44,8 @@ impl Options {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_save_path(mut self, path: String) -> Self {
|
pub fn with_save_path(mut self, path: Option<String>) -> Self {
|
||||||
self.save_path = Some(path);
|
self.save_path = path;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,16 @@ impl Options {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn with_no_save(mut self, no_save: bool) -> Self {
|
||||||
|
self.no_save = no_save;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_verbose(mut self, verbose: bool) -> Self {
|
||||||
|
self.verbose = verbose;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn with_bootrom(mut self, bootrom: Option<RomFile>) -> Self {
|
pub fn with_bootrom(mut self, bootrom: Option<RomFile>) -> Self {
|
||||||
self.bootrom = bootrom;
|
self.bootrom = bootrom;
|
||||||
self
|
self
|
||||||
|
@ -69,7 +79,7 @@ impl Options {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_verbose(mut self) -> Self {
|
pub fn verbose(mut self) -> Self {
|
||||||
self.verbose = true;
|
self.verbose = true;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue