This commit is contained in:
bQUARKz 2026-01-16 06:36:40 +00:00
parent bcc5930f65
commit 3fd2574be7
Signed by: bquarkz
SSH Key Fingerprint: SHA256:Z7dgqoglWwoK6j6u4QC87OveEq74WOhFN+gitsxtkf8
2 changed files with 11 additions and 6 deletions

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;
}

View File

@ -147,7 +147,9 @@ impl PrometeuApp {
impl ApplicationHandler for PrometeuApp {
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
let attrs = WindowAttributes::default()
.with_title(format!("PROMETEU | GFX: {:.1} KB | FPS: {:.1} | Load: {}% | Frame: {}", 0.0, 0.0, 0.0, 0))
.with_title(format!(
"PROMETEU | GFX: {:.1} KB | FPS: {:.1} | Load: {:.1}% (C) + {:.1}% (A) | Frame: tick {} logical {}",
0.0, 0.0, 0.0, 0, 0, 0))
.with_inner_size(LogicalSize::new(960.0, 540.0))
.with_min_inner_size(LogicalSize::new(320.0, 180.0));
@ -308,8 +310,8 @@ impl ApplicationHandler for PrometeuApp {
};
let title = format!(
"PROMETEU | GFX: {:.1} KB | FPS: {:.1} | Load: {:.1}% (C) + {:.1}% (A) | Frame: {}",
kb, fps, cpu_load_core, cpu_load_audio, self.logical_hardware.frame_index
"PROMETEU | GFX: {:.1} KB | FPS: {:.1} | Load: {:.1}% (C) + {:.1}% (A) | Frame: tick {} logical {}",
kb, fps, cpu_load_core, cpu_load_audio, self.logical_hardware.tick_index, self.logical_hardware.logical_frame_index
);
window.set_title(&title);
}