implements PLN-0134
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
use crate::firmware::firmware_state::{AppCrashesStep, FirmwareState, ShellRunningStep};
|
||||
use crate::firmware::firmware_state::{
|
||||
AppCrashesStep, FirmwareState, LoadCartridgeStep, ShellRunningStep,
|
||||
};
|
||||
use crate::firmware::prometeu_context::PrometeuContext;
|
||||
use prometeu_hal::cartridge_loader::CartridgeLoader;
|
||||
use prometeu_hal::log::{LogLevel, LogSource};
|
||||
use prometeu_hal::primitives::Rect;
|
||||
use prometeu_system::SystemProfileAction;
|
||||
@@ -21,16 +24,32 @@ impl HubHomeStep {
|
||||
return Some(FirmwareState::AppCrashes(AppCrashesStep { report }));
|
||||
}
|
||||
|
||||
if let Some(SystemProfileAction::LaunchNativeShell(app)) = outcome.action {
|
||||
let task_id = ctx.os.sessions().create_native_shell_task(app.app_id(), app.title());
|
||||
let id = ctx.os.windows().add_window(
|
||||
app.title().to_string(),
|
||||
WindowOwner::Task(task_id),
|
||||
Rect { x: 40, y: 20, w: 400, h: 220 },
|
||||
app.color(),
|
||||
);
|
||||
ctx.os.windows().set_focus(id);
|
||||
return Some(FirmwareState::ShellRunning(ShellRunningStep::new(task_id)));
|
||||
match outcome.action {
|
||||
Some(SystemProfileAction::LaunchNativeShell(app)) => {
|
||||
let task_id = ctx.os.sessions().create_native_shell_task(app.app_id(), app.title());
|
||||
let id = ctx.os.windows().add_window(
|
||||
app.title().to_string(),
|
||||
WindowOwner::Task(task_id),
|
||||
Rect { x: 40, y: 20, w: 400, h: 220 },
|
||||
app.color(),
|
||||
);
|
||||
ctx.os.windows().set_focus(id);
|
||||
return Some(FirmwareState::ShellRunning(ShellRunningStep::new(task_id)));
|
||||
}
|
||||
Some(SystemProfileAction::LaunchGame { path }) => match CartridgeLoader::load(&path) {
|
||||
Ok(cartridge) => {
|
||||
return Some(FirmwareState::LoadCartridge(LoadCartridgeStep::new(cartridge)));
|
||||
}
|
||||
Err(error) => {
|
||||
ctx.os.log(
|
||||
LogLevel::Error,
|
||||
LogSource::Hub,
|
||||
0,
|
||||
format!("Failed to launch Home game {}: {:?}", path.display(), error),
|
||||
);
|
||||
}
|
||||
},
|
||||
Some(SystemProfileAction::CloseShell) | None => {}
|
||||
}
|
||||
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user