use m68k::CpuType;
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MachineProfile {
pub model_id: i16,
pub gestalt_machine_type: u16,
pub system_version_bcd: u16,
pub gestalt_native_cpu_type: u32,
pub gestalt_processor_type: u32,
pub gestalt_fpu_type: u32,
pub gestalt_mmu_type: u32,
pub ram_size_bytes: u32,
pub screen_width: u16,
pub screen_height: u16,
pub screen_depth: u16,
pub vbl_hz: f64,
pub realtime_cpu_mhz: f64,
}
impl MachineProfile {
pub fn cpu_type(self) -> CpuType {
CpuType::M68040
}
pub const fn has_fpu(self) -> bool {
self.gestalt_fpu_type != 0
}
pub const fn screen_row_bytes(self) -> u32 {
self.screen_width as u32
}
}
pub const BASILISK_II_PLAY_PROFILE: MachineProfile = MachineProfile {
model_id: 14,
gestalt_machine_type: 20,
system_version_bcd: 0x0753,
gestalt_native_cpu_type: 4,
gestalt_processor_type: 5,
gestalt_fpu_type: 3,
gestalt_mmu_type: 4,
ram_size_bytes: 64 * 1024 * 1024,
screen_width: 800,
screen_height: 600,
screen_depth: 8,
vbl_hz: 60.15,
realtime_cpu_mhz: 25.0,
};
pub const ORACLE_MACHINE_PROFILE: MachineProfile = BASILISK_II_PLAY_PROFILE;
pub fn oracle_machine_profile() -> MachineProfile {
let mut p = ORACLE_MACHINE_PROFILE;
if let Ok(w) = std::env::var("SYSTEMLESS_SCREEN_WIDTH") {
if let Ok(w) = w.parse::<u16>() {
p.screen_width = w;
}
}
if let Ok(h) = std::env::var("SYSTEMLESS_SCREEN_HEIGHT") {
if let Ok(h) = h.parse::<u16>() {
p.screen_height = h;
}
}
p
}