Files
prometeu-runtime/crates/console/prometeu-firmware/src/firmware/firmware_step_reset.rs
T
bquarkz e0e01ed1de
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good
feat(audio): add guest voice controls and reliable lifecycle delivery
2026-10-14 09:08:27 +01:00

31 lines
1.3 KiB
Rust

use crate::firmware::boot_target::BootTarget;
use crate::firmware::firmware_state::{FirmwareState, LaunchHubStep, SplashScreenStep};
use crate::firmware::prometeu_context::PrometeuContext;
use prometeu_hal::log::{LogLevel, LogSource};
#[derive(Debug, Clone)]
pub struct ResetStep;
impl ResetStep {
pub fn on_enter(&mut self, ctx: &mut PrometeuContext) {
ctx.os.log(LogLevel::Info, LogSource::Pos, 0, "Firmware Reset".to_string());
// Reset is a cold-boot boundary. Clearing only the VM session leaves
// the lifecycle registry pointing at the old resident game, which
// rejects the next cartridge as a second resident game.
let _ = ctx.os.lifecycle().terminate_resident_game();
ctx.os.sessions().clear_vm_sessions();
ctx.os.vm().reset_global_runtime_state();
ctx.platform.audio_mut().reset();
ctx.platform.audio_mut().set_session(None);
}
pub fn on_update(&mut self, ctx: &mut PrometeuContext) -> Option<FirmwareState> {
match ctx.boot_target {
BootTarget::Hub => Some(FirmwareState::SplashScreen(SplashScreenStep { frame: 0 })),
BootTarget::Cartridge { .. } => Some(FirmwareState::LaunchHub(LaunchHubStep)),
}
}
pub fn on_exit(&mut self, _ctx: &mut PrometeuContext) {}
}