This commit is contained in:
2026-03-24 13:40:12 +00:00
parent bcc5930f65
commit 3fd2574be7
2 changed files with 11 additions and 6 deletions
+6 -3
View File
@@ -10,7 +10,8 @@ pub struct LogicalHardware {
pub audio: Audio,
pub pad: Pad,
pub touch: Touch,
pub frame_index: u64,
pub tick_index: u64,
pub logical_frame_index: u64,
pub last_frame_cpu_time_us: u64,
pub vm: VirtualMachine,
pub cartridge: Option<Cartridge>,
@@ -35,7 +36,8 @@ impl LogicalHardware {
audio: Audio::new(),
pad: Pad::default(),
touch: Touch::default(),
frame_index: 0,
tick_index: 0,
logical_frame_index: 0,
last_frame_cpu_time_us: 0,
vm: VirtualMachine::default(),
cartridge: None,
@@ -116,6 +118,7 @@ impl LogicalHardware {
/// O Host controla tempo/event loop; o Core define a sequência do frame.
pub fn step_frame(&mut self, signals: &InputSignals) {
let start = std::time::Instant::now();
self.tick_index += 1; // não importa o frame lógico, o tick sempre incrementa
// Se um frame logica estiver aberto evita limpar o input
if !self.logical_frame_open {
@@ -134,7 +137,7 @@ impl LogicalHardware {
if run.reason == crate::vm::LogicalFrameEndingReason::FrameSync {
self.gfx.render_all();
self.end_frame();
self.frame_index += 1; // conta frames lógicos apresentados
self.logical_frame_index += 1; // conta frames lógicos apresentados
self.logical_frame_open = false;
}