This commit is contained in:
@@ -97,6 +97,10 @@ fn desired_control_flow(
|
||||
}
|
||||
}
|
||||
|
||||
fn should_present_worker_frame(state: &FirmwareState) -> bool {
|
||||
matches!(state, FirmwareState::GameRunning(_))
|
||||
}
|
||||
|
||||
/// The Desktop implementation of the PROMETEU Runtime.
|
||||
///
|
||||
/// This struct acts as the physical "chassis" of the virtual console. It is
|
||||
@@ -301,9 +305,7 @@ impl ApplicationHandler for HostRunner {
|
||||
// Mutable borrow of the frame (lasts only within this block)
|
||||
let frame = pixels.frame_mut();
|
||||
|
||||
let use_worker_frame =
|
||||
matches!(self.firmware.state, FirmwareState::GameRunning(_));
|
||||
if use_worker_frame
|
||||
if should_present_worker_frame(&self.firmware.state)
|
||||
&& let Some(worker_frame) =
|
||||
self.firmware.os.vm().repeat_latest_render_worker_frame()
|
||||
{
|
||||
@@ -402,8 +404,7 @@ impl ApplicationHandler for HostRunner {
|
||||
self.stats.record_frame();
|
||||
}
|
||||
|
||||
let use_worker_frame = matches!(self.firmware.state, FirmwareState::GameRunning(_));
|
||||
if use_worker_frame
|
||||
if should_present_worker_frame(&self.firmware.state)
|
||||
&& let Some(worker_frame) = self.firmware.os.vm().latest_render_worker_frame()
|
||||
{
|
||||
self.presentation.note_published_frame(worker_frame.frame_id.get());
|
||||
@@ -449,8 +450,12 @@ impl ApplicationHandler for HostRunner {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use prometeu_firmware::BootTarget;
|
||||
use prometeu_firmware::firmware::firmware_state::{
|
||||
GameRunningStep, HubHomeStep, ShellRunningStep,
|
||||
};
|
||||
use prometeu_hal::debugger_protocol::DEVTOOLS_PROTOCOL_VERSION;
|
||||
use prometeu_hal::telemetry::{CertificationConfig, TelemetryFrame};
|
||||
use prometeu_system::task::TaskId;
|
||||
use std::io::{Read, Write};
|
||||
use std::net::TcpStream;
|
||||
|
||||
@@ -518,6 +523,17 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn worker_frame_presentation_is_game_only() {
|
||||
assert!(should_present_worker_frame(&FirmwareState::GameRunning(GameRunningStep::new(
|
||||
TaskId(1),
|
||||
))));
|
||||
assert!(!should_present_worker_frame(&FirmwareState::ShellRunning(ShellRunningStep::new(
|
||||
TaskId(2)
|
||||
),)));
|
||||
assert!(!should_present_worker_frame(&FirmwareState::HubHome(HubHomeStep)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn host_debugger_maps_cert_events_from_host_owned_sources() {
|
||||
let telemetry = TelemetryFrame {
|
||||
|
||||
Reference in New Issue
Block a user