fix native shell ticking resident game
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use crate::firmware::firmware_state::{AppCrashesStep, FirmwareState, HubHomeStep};
|
||||
use crate::firmware::prometeu_context::PrometeuContext;
|
||||
use prometeu_hal::log::LogSource;
|
||||
use prometeu_system::process::ProcessKind;
|
||||
use prometeu_system::task::{TaskId, TaskState};
|
||||
use prometeu_system::{CrashReport, SystemProfileAction};
|
||||
|
||||
@@ -59,14 +60,53 @@ impl ShellRunningStep {
|
||||
}
|
||||
}
|
||||
|
||||
let outcome = ctx.hub.update_shell_profile(ctx.os, ctx.vm, ctx.signals, ctx.platform);
|
||||
let process_kind = match ctx.os.lifecycle().process_kind_for_task(self.task_id) {
|
||||
Ok(process_kind) => process_kind,
|
||||
Err(error) => {
|
||||
let report = CrashReport::VmPanic {
|
||||
message: format!(
|
||||
"ShellRunningStep cannot resolve process for {:?}: {:?}",
|
||||
self.task_id, error,
|
||||
),
|
||||
pc: None,
|
||||
};
|
||||
return Some(FirmwareState::AppCrashes(AppCrashesStep { report }));
|
||||
}
|
||||
};
|
||||
|
||||
if let Some(report) = outcome.crash {
|
||||
let _ = ctx.os.lifecycle().crash_task(self.task_id, Some(&report));
|
||||
return Some(FirmwareState::AppCrashes(AppCrashesStep { report }));
|
||||
}
|
||||
let action = match process_kind {
|
||||
ProcessKind::VmShell => {
|
||||
let outcome =
|
||||
ctx.hub.update_shell_profile(ctx.os, ctx.vm, ctx.signals, ctx.platform);
|
||||
|
||||
if outcome.action == Some(SystemProfileAction::CloseShell) {
|
||||
if let Some(report) = outcome.crash {
|
||||
let _ = ctx.os.lifecycle().crash_task(self.task_id, Some(&report));
|
||||
return Some(FirmwareState::AppCrashes(AppCrashesStep { report }));
|
||||
}
|
||||
|
||||
outcome.action
|
||||
}
|
||||
ProcessKind::NativeShell => {
|
||||
let mut action = ctx.hub.gui_update(ctx.os, ctx.platform);
|
||||
if ctx.platform.input().pad().start().down {
|
||||
action = Some(SystemProfileAction::CloseShell);
|
||||
}
|
||||
ctx.hub.render(ctx.os, ctx.platform);
|
||||
action
|
||||
}
|
||||
ProcessKind::VmGame => {
|
||||
let report = CrashReport::VmPanic {
|
||||
message: format!(
|
||||
"ShellRunningStep expected shell process for {:?}, got VmGame",
|
||||
self.task_id,
|
||||
),
|
||||
pc: None,
|
||||
};
|
||||
return Some(FirmwareState::AppCrashes(AppCrashesStep { report }));
|
||||
}
|
||||
};
|
||||
|
||||
if action == Some(SystemProfileAction::CloseShell) {
|
||||
self.close_current_shell(ctx);
|
||||
return Some(FirmwareState::HubHome(HubHomeStep));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user