implements PLN-0157

This commit is contained in:
2026-07-05 01:07:54 +01:00
parent 0ffb3467b1
commit dcd3479b1d
6 changed files with 103 additions and 37 deletions
@@ -1,12 +1,11 @@
use crate::task::TaskId;
use crate::{CrashReport, GameLibrary, SystemOS};
use crate::{CrashReport, GameLibrary, GameSwitchTarget, SystemOS};
use prometeu_hal::color::Color;
use prometeu_hal::primitives::Rect;
use prometeu_hal::{
FrameId, GfxUiCommand, InputPlatform, InputSignals, RenderSubmission, RuntimePlatform,
ShellUiFramePacket,
};
use std::path::PathBuf;
const SHELL_A_BUTTON: Rect = Rect { x: 112, y: 172, w: 112, h: 32 };
const SHELL_B_BUTTON: Rect = Rect { x: 256, y: 172, w: 112, h: 32 };
@@ -83,7 +82,7 @@ impl NativeShellApp {
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SystemProfileAction {
LaunchNativeShell(NativeShellApp),
LaunchGame { path: PathBuf },
LaunchGame { target: GameSwitchTarget },
CloseShell,
}
@@ -249,7 +248,7 @@ fn action_for_click(
.find(|(index, _entry)| rect_contains(game_row_rect(*index), x, y))
.map(|(_index, entry)| entry)
{
return Some(SystemProfileAction::LaunchGame { path: entry.path.clone() });
return Some(SystemProfileAction::LaunchGame { target: entry.switch_target() });
}
HOME_BUTTONS
@@ -434,6 +433,7 @@ mod tests {
use crate::windows::WindowOwner;
use prometeu_drivers::TestPlatform;
use prometeu_hal::{InputSignals, RuntimePlatform};
use std::path::PathBuf;
fn focused_native_shell_fixture(
signals: &InputSignals,
@@ -535,9 +535,19 @@ mod tests {
discovered_at: std::time::SystemTime::UNIX_EPOCH,
};
let action =
action_for_click(false, GAME_ROW_X, GAME_ROW_Y, true, std::slice::from_ref(&entry));
assert_eq!(
action_for_click(false, GAME_ROW_X, GAME_ROW_Y, true, std::slice::from_ref(&entry)),
Some(SystemProfileAction::LaunchGame { path: entry.path.clone() })
action,
Some(SystemProfileAction::LaunchGame {
target: GameSwitchTarget {
path: entry.path.clone(),
app_id: 42,
title: "Stress".to_string(),
app_version: "1.0.0".to_string(),
}
})
);
}