implements PLN-0090

This commit is contained in:
2026-06-05 09:39:03 +01:00
parent d2a53d0efa
commit 84daa5fd70
6 changed files with 116 additions and 2 deletions
@@ -141,6 +141,11 @@ impl VirtualMachineRuntime {
self.update_fs(log_service, fs, fs_state);
if !self.logical_frame_active {
if self.current_cartridge_app_mode == AppMode::Game {
self.frame_scheduler
.authorize_game_frame()
.expect("logical frame cannot start while another Game frame is active");
}
self.logical_frame_active = true;
self.logical_frame_remaining_cycles = Self::CYCLES_PER_LOGICAL_FRAME;
self.begin_logical_frame(signals, hw);
@@ -317,6 +322,9 @@ impl VirtualMachineRuntime {
self.logical_frame_index += 1;
self.logical_frame_active = false;
self.logical_frame_remaining_cycles = 0;
if self.current_cartridge_app_mode == AppMode::Game {
self.frame_scheduler.complete_game_frame();
}
if run.reason == LogicalFrameEndingReason::FrameSync {
self.needs_prepare_entry_call = true;
@@ -326,6 +334,10 @@ impl VirtualMachineRuntime {
self.paused = true;
self.debug_step_request = false;
}
} else if run.reason == LogicalFrameEndingReason::BudgetExhausted
&& self.current_cartridge_app_mode == AppMode::Game
{
self.frame_scheduler.record_logical_frame_overrun();
}
}
Err(e) => {