2026-05-14 18:27:25 +01:00

52 lines
1.8 KiB
Rust

use crate::VirtualMachineRuntime;
use crate::process::ProcessManager;
use crate::services::window_manager::WindowManager;
use crate::task::TaskId;
use crate::task::TaskManager;
use prometeu_hal::telemetry::CertificationConfig;
pub struct SystemOS {
pub vm_runtime: VirtualMachineRuntime,
pub process_manager: ProcessManager,
pub task_manager: TaskManager,
pub window_manager: WindowManager,
}
impl SystemOS {
pub fn new(cap_config: Option<CertificationConfig>) -> Self {
Self {
vm_runtime: VirtualMachineRuntime::new(cap_config),
process_manager: ProcessManager::new(),
task_manager: TaskManager::new(),
window_manager: WindowManager::new(),
}
}
pub fn create_vm_game_task(&mut self, app_id: u32, title: impl Into<String>) -> TaskId {
let title = title.into();
let process_id = self.process_manager.spawn_vm_game(app_id, title.clone());
let task_id = self.task_manager.create_game_task(process_id, app_id, title);
self.task_manager.set_foreground(task_id);
task_id
}
pub fn create_vm_shell_task(&mut self, app_id: u32, title: impl Into<String>) -> TaskId {
let title = title.into();
let process_id = self.process_manager.spawn_vm_shell(app_id, title.clone());
let task_id = self.task_manager.create_shell_task(process_id, app_id, title);
self.task_manager.set_foreground(task_id);
task_id
}
pub fn create_native_shell_task(&mut self, app_id: u32, title: impl Into<String>) -> TaskId {
let title = title.into();
let process_id = self.process_manager.spawn_native_shell(app_id, title.clone());
let task_id = self.task_manager.create_shell_task(process_id, app_id, title);
self.task_manager.set_foreground(task_id);
task_id
}
}