summaryrefslogtreecommitdiff
path: root/src/emulators
diff options
context:
space:
mode:
Diffstat (limited to 'src/emulators')
-rw-r--r--src/emulators/graphical_emulator.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/emulators/graphical_emulator.rs b/src/emulators/graphical_emulator.rs
index a4b07e5..7e75b61 100644
--- a/src/emulators/graphical_emulator.rs
+++ b/src/emulators/graphical_emulator.rs
@@ -9,6 +9,7 @@ pub struct GraphicalEmulator {
pub gilrs: Option<Gilrs>,
pub fullscreen: bool,
+ pub visible: bool,
pub scale: u32,
pub render_mark: Instant, // last time screen was rendered
pub frame_mark: Instant, // refreshes when clean
@@ -37,6 +38,7 @@ impl GraphicalEmulator {
render_mark: Instant::now(),
frame_mark: Instant::now(),
config,
+ visible: false,
}
}
@@ -44,7 +46,8 @@ impl GraphicalEmulator {
self.br.core.mem.load_program(bytecode);
}
- pub fn run(self, mut phosphor: Phosphor, visible: bool) {
+ pub fn run(mut self, mut phosphor: Phosphor, visible: bool) {
+ self.visible = visible;
let window = WindowBuilder {
dimensions: Some(self.dimensions()),
size_bounds: Some(self.size_bounds()),
@@ -59,7 +62,6 @@ impl GraphicalEmulator {
program: Box::new(self),
visible,
};
-
phosphor.add_window(window);
phosphor.run().unwrap();
}
@@ -233,9 +235,6 @@ impl WindowProgram for GraphicalEmulator {
if let Some(signal) = self.br.evaluate(BATCH_SIZE, self.debug.enabled) {
match signal {
Signal::Break => {
- if self.br.dev.input.accessed || self.br.dev.screen.accessed {
- requests.write(Request::SetVisible(true));
- }
}
Signal::Fork | Signal::Reset => {
self.br.reset();
@@ -260,6 +259,13 @@ impl WindowProgram for GraphicalEmulator {
}
}
+ if !self.visible {
+ if self.br.dev.input.accessed || self.br.dev.screen.accessed {
+ requests.write(Request::SetVisible(true));
+ self.visible = true;
+ }
+ }
+
if std::mem::take(&mut self.br.dev.screen.dirty_dimensions) {
requests.write(Request::SetSizeBounds(self.size_bounds()));
}