summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/emulator.rs11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/emulator.rs b/src/emulator.rs
index 195b8c8..b0f2d51 100644
--- a/src/emulator.rs
+++ b/src/emulator.rs
@@ -21,7 +21,6 @@ pub struct BedrockEmulator {
sleeping: bool,
pixel_scale: u32,
start_of_process: Instant,
- end_of_process: Instant,
end_of_render: Instant,
debug_mark: Instant,
cycles_elapsed: usize,
@@ -41,7 +40,6 @@ impl BedrockEmulator {
sleeping: false,
pixel_scale: 3,
start_of_process: Instant::now(),
- end_of_process: Instant::now(),
end_of_render: Instant::now(),
debug_mark: Instant::now(),
cycles_elapsed: 0,
@@ -208,7 +206,6 @@ impl WindowController for BedrockEmulator {
// prevents the current frame from being overdrawn before rendering.
if self.vm.dev.screen.dirty {
sleep(FRAME);
- self.end_of_process = Instant::now();
return;
}
// Ensure a minimum delay of FRAME between the start of consecutive
@@ -221,13 +218,11 @@ impl WindowController for BedrockEmulator {
None => time_to_frame_start,
};
sleep(time_to_sleep);
- self.end_of_process = Instant::now();
return;
}
// Stay asleep if there are no pending wake events.
if !self.vm.dev.can_wake() {
sleep(FRAME);
- self.end_of_process = Instant::now();
return;
}
}
@@ -235,7 +230,7 @@ impl WindowController for BedrockEmulator {
// Run the processor for the remainder of the frame.
self.start_of_process = Instant::now();
self.sleeping = false;
- let frame_end = self.end_of_process + FRAME;
+ let frame_end = Instant::now() + FRAME;
while Instant::now() < frame_end {
if let Some(signal) = self.vm.evaluate(1000) {
@@ -243,9 +238,6 @@ impl WindowController for BedrockEmulator {
Signal::Debug(var) => self.debug(var),
Signal::Sleep => {
self.sleeping = true;
- // Sleep for the remainer of the frame.
- sleep(frame_end.duration_since(Instant::now()));
- self.end_of_process = Instant::now();
break;
},
Signal::Halt => {
@@ -258,7 +250,6 @@ impl WindowController for BedrockEmulator {
}
self.vm.dev.stream.flush_local();
self.vm.dev.file.flush_entry();
- self.end_of_process = Instant::now();
}
fn render_request(&mut self) -> RenderRequest {