implements PLN-0157
This commit is contained in:
@@ -52,45 +52,53 @@ impl HubHomeStep {
|
||||
ctx.os.windows().set_focus(id);
|
||||
return Some(FirmwareState::ShellRunning(ShellRunningStep::new(task_id)));
|
||||
}
|
||||
Some(SystemProfileAction::LaunchGame { path }) => match CartridgeLoader::load(&path) {
|
||||
Ok(cartridge) => {
|
||||
if cartridge.app_mode == AppMode::Game
|
||||
&& let Some(resident_task_id) = ctx.os.lifecycle().resident_game_task()
|
||||
{
|
||||
let resident_app_id = ctx
|
||||
.os
|
||||
.sessions()
|
||||
.vm_session_for_task(resident_task_id)
|
||||
.map(|session| session.app_id)
|
||||
.unwrap_or(0);
|
||||
Some(SystemProfileAction::LaunchGame { target }) => {
|
||||
match CartridgeLoader::load(&target.path) {
|
||||
Ok(cartridge) => {
|
||||
if cartridge.app_mode == AppMode::Game
|
||||
&& let Some(resident_task_id) = ctx.os.lifecycle().resident_game_task()
|
||||
{
|
||||
let resident_app_id = ctx
|
||||
.os
|
||||
.sessions()
|
||||
.vm_session_for_task(resident_task_id)
|
||||
.map(|session| session.app_id)
|
||||
.unwrap_or(0);
|
||||
|
||||
if resident_app_id == cartridge.app_id {
|
||||
return Some(FirmwareState::ResumeResidentGame);
|
||||
if resident_app_id == cartridge.app_id {
|
||||
return Some(FirmwareState::ResumeResidentGame);
|
||||
}
|
||||
|
||||
ctx.os.log(
|
||||
LogLevel::Warn,
|
||||
LogSource::Hub,
|
||||
0,
|
||||
format!(
|
||||
"Cannot launch Home game {} while resident game app_id {} is active",
|
||||
cartridge.title, resident_app_id
|
||||
),
|
||||
);
|
||||
return None;
|
||||
}
|
||||
|
||||
return Some(FirmwareState::LoadCartridge(LoadCartridgeStep::new(
|
||||
cartridge,
|
||||
)));
|
||||
}
|
||||
Err(error) => {
|
||||
ctx.os.log(
|
||||
LogLevel::Warn,
|
||||
LogLevel::Error,
|
||||
LogSource::Hub,
|
||||
0,
|
||||
format!(
|
||||
"Cannot launch Home game {} while resident game app_id {} is active",
|
||||
cartridge.title, resident_app_id
|
||||
"Failed to launch Home game {}: {:?}",
|
||||
target.path.display(),
|
||||
error
|
||||
),
|
||||
);
|
||||
return None;
|
||||
}
|
||||
|
||||
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 => {}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user