51 lines
1.5 KiB
Rust
51 lines
1.5 KiB
Rust
mod dispatch;
|
|
mod lifecycle;
|
|
#[cfg(test)]
|
|
mod tests;
|
|
mod tick;
|
|
|
|
use crate::CrashReport;
|
|
use crate::fs::{FsState, VirtualFS};
|
|
use crate::services::memcard::MemcardService;
|
|
use prometeu_hal::cartridge::AppMode;
|
|
use prometeu_hal::log::LogService;
|
|
use prometeu_hal::telemetry::{AtomicTelemetry, CertificationConfig, Certifier};
|
|
use prometeu_vm::VirtualMachine;
|
|
use std::collections::HashMap;
|
|
use std::sync::Arc;
|
|
use std::time::Instant;
|
|
|
|
pub struct VirtualMachineRuntime {
|
|
pub tick_index: u64,
|
|
pub logical_frame_index: u64,
|
|
pub logical_frame_active: bool,
|
|
pub logical_frame_remaining_cycles: u64,
|
|
pub last_frame_cpu_time_us: u64,
|
|
pub fs: VirtualFS,
|
|
pub fs_state: FsState,
|
|
pub memcard: MemcardService,
|
|
pub open_files: HashMap<u32, String>,
|
|
pub next_handle: u32,
|
|
pub log_service: LogService,
|
|
pub current_app_id: u32,
|
|
pub current_cartridge_title: String,
|
|
pub current_cartridge_app_version: String,
|
|
pub current_cartridge_app_mode: AppMode,
|
|
pub logs_written_this_frame: HashMap<u32, u32>,
|
|
pub atomic_telemetry: Arc<AtomicTelemetry>,
|
|
pub last_crash_report: Option<CrashReport>,
|
|
pub certifier: Certifier,
|
|
pub paused: bool,
|
|
pub debug_step_request: bool,
|
|
pub inspection_active: bool,
|
|
pub(crate) needs_prepare_entry_call: bool,
|
|
pub(crate) boot_time: Instant,
|
|
}
|
|
|
|
impl VirtualMachineRuntime {
|
|
pub const CYCLES_PER_LOGICAL_FRAME: u64 = 1_500_000;
|
|
pub const SLICE_PER_TICK: u64 = 1_500_000;
|
|
pub const MAX_LOG_LEN: usize = 256;
|
|
pub const MAX_LOGS_PER_FRAME: u32 = 10;
|
|
}
|