fix(app): resident launcher apps are not games, and the TTS keeps its share of the card
On the game PC, Wallpaper Engine (steamapps\common\wallpaper_engine) and the Riot client's crash handler (Riot Games\Riot Client) were taken for games running behind other windows as the services started, so no reading of other programs was kept and the game stage placed 0 GiB of experts instead of 2. - A launcher's own folders and non-game apps under its game folder are not game folders (Steamworks Shared, wallpaper_engine; Launcher, Epic Online Services; Riot Client). - The game log tab names the program found running at the start. - The placement keeps the TTS's share (MeloTTS, 1005 MiB, M0 tts_melo) beside the STT's, and takes the worker's loaded models off what the card holds, so a start (TTS not yet loaded) and a switch (TTS loaded) place the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -28,12 +28,14 @@ const NOT_GAMES: &[&str] = &[
|
||||
];
|
||||
|
||||
/// Launcher game folders, as the path parts before the game's own folder: a program under one
|
||||
/// counts as a game whatever its window looks like. Battle.net installs anywhere, so its games come
|
||||
/// from their install folders (`InstalledGame`).
|
||||
const LAUNCHERS: &[(&[&str], &str)] = &[
|
||||
(&["steamapps", "common"], "Steam"),
|
||||
(&["epic games"], "Epic"),
|
||||
(&["riot games"], "Riot"),
|
||||
/// counts as a game whatever its window looks like, unless that folder is one of the launcher's
|
||||
/// own (its client, shared runtimes, or a non-game app such as Wallpaper Engine, which runs all
|
||||
/// the time). Battle.net installs anywhere, so its games come from their install folders
|
||||
/// (`InstalledGame`).
|
||||
const LAUNCHERS: &[(&[&str], &str, &[&str])] = &[
|
||||
(&["steamapps", "common"], "Steam", &["steamworks shared", "wallpaper_engine"]),
|
||||
(&["epic games"], "Epic", &["launcher", "epic online services"]),
|
||||
(&["riot games"], "Riot", &["riot client"]),
|
||||
];
|
||||
|
||||
/// A game a launcher installed somewhere of its own choosing.
|
||||
@@ -71,10 +73,11 @@ fn launcher_game(path: &str, installed: &[InstalledGame]) -> Option<(&'static st
|
||||
return Some((g.launcher, g.name.clone()));
|
||||
}
|
||||
}
|
||||
for (marker, launcher) in LAUNCHERS {
|
||||
for (marker, launcher, own) in LAUNCHERS {
|
||||
// The game's folder follows the marker, and the program is inside it.
|
||||
if let Some(i) = (0..p.len().saturating_sub(marker.len() + 1)).find(|&i| same(&p[i..i + marker.len()], marker)) {
|
||||
return Some((launcher, p[i + marker.len()].to_owned()));
|
||||
let folder = p[i + marker.len()];
|
||||
return (!own.iter().any(|o| folder.eq_ignore_ascii_case(o))).then(|| (*launcher, folder.to_owned()));
|
||||
}
|
||||
}
|
||||
None
|
||||
@@ -150,14 +153,14 @@ pub fn classify(fg: &Foreground, d3d_fullscreen: bool, s: &GameSettings, install
|
||||
(fg.covers_monitor && fg.no_frame && fg.gpu_3d >= MIN_GPU_3D).then_some(Reason::Borderless)
|
||||
}
|
||||
|
||||
/// Whether one of these programs (full paths) is a game by what it is: the person's list or a
|
||||
/// The first of these programs (full paths) that is a game by what it is: the person's list or a
|
||||
/// launcher's game folder. Used once as the services start, for games behind other windows (how a
|
||||
/// window looks is not known there, so those rules do not apply).
|
||||
pub fn game_running_among(paths: &[String], s: &GameSettings, installed: &[InstalledGame]) -> bool {
|
||||
paths.iter().any(|p| {
|
||||
let fg = Foreground { pid: 0, path: p.clone(), covers_monitor: false, no_frame: false, gpu_3d: 0.0 };
|
||||
pub fn game_running_among(paths: &[String], s: &GameSettings, installed: &[InstalledGame]) -> Option<String> {
|
||||
paths.iter().find(|p| {
|
||||
let fg = Foreground { pid: 0, path: (*p).clone(), covers_monitor: false, no_frame: false, gpu_3d: 0.0 };
|
||||
classify(&fg, false, s, installed).is_some()
|
||||
})
|
||||
}).cloned()
|
||||
}
|
||||
|
||||
/// A game's name for the dashboard: its name from the launcher (the folder under a launcher's game
|
||||
@@ -225,7 +228,11 @@ impl GameWatch {
|
||||
if cfg!(windows) && settings.detect {
|
||||
let snap = probe::Probe::new().snapshot();
|
||||
state.lock().unwrap().update(&snap, &settings, probe::alive);
|
||||
background = game_running_among(&probe::process_paths(), &settings, &snap.installed);
|
||||
if let Some(path) = game_running_among(&probe::process_paths(), &settings, &snap.installed) {
|
||||
// Which program, so a wrong one can be put on the "not games" list.
|
||||
crate::info_log!("game", "a game runs as the services start: {}", file_name(&path));
|
||||
background = true;
|
||||
}
|
||||
}
|
||||
let thread = (cfg!(windows) && settings.detect).then(|| {
|
||||
let (state, stop) = (state.clone(), stop.clone());
|
||||
@@ -622,15 +629,35 @@ mod tests {
|
||||
let s = settings();
|
||||
let wow = InstalledGame { dir: r"D:\Games\World of Warcraft".into(), name: "World of Warcraft".into(), launcher: "Battle.net" };
|
||||
// Behind other windows: only what the program is (where it lives, or the person's list).
|
||||
assert!(game_running_among(&[r"C:\Windows\explorer.exe".into(), r"C:\Riot Games\VALORANT\live\VALORANT.exe".into()], &s, &[]));
|
||||
assert!(game_running_among(&[r"D:\Games\World of Warcraft\_retail_\Wow.exe".into()], &s, &[wow]));
|
||||
assert!(!game_running_among(&[r"C:\Windows\explorer.exe".into(), r"C:\Riot Games\Riot Client\RiotClientServices.exe".into(),
|
||||
r"C:\Program Files\Google\Chrome\Application\chrome.exe".into()], &s, &[]), "launchers and browsers are not games");
|
||||
assert_eq!(game_running_among(&[r"C:\Windows\explorer.exe".into(), r"C:\Riot Games\VALORANT\live\VALORANT.exe".into()], &s, &[]),
|
||||
Some(r"C:\Riot Games\VALORANT\live\VALORANT.exe".into()), "the program found, for the log");
|
||||
assert!(game_running_among(&[r"D:\Games\World of Warcraft\_retail_\Wow.exe".into()], &s, &[wow]).is_some());
|
||||
assert!(game_running_among(&[r"C:\Windows\explorer.exe".into(), r"C:\Riot Games\Riot Client\RiotClientServices.exe".into(),
|
||||
r"C:\Program Files\Google\Chrome\Application\chrome.exe".into()], &s, &[]).is_none(), "launchers and browsers are not games");
|
||||
let mut mine = settings();
|
||||
mine.games = vec!["mygame".into()];
|
||||
assert!(game_running_among(&[r"D:\x\MyGame.exe".into()], &mine, &[]));
|
||||
assert!(game_running_among(&[r"D:\x\MyGame.exe".into()], &mine, &[]).is_some());
|
||||
mine.not_games = vec!["VALORANT.exe".into()];
|
||||
assert!(!game_running_among(&[r"C:\Riot Games\VALORANT\live\VALORANT.exe".into()], &mine, &[]));
|
||||
assert!(game_running_among(&[r"C:\Riot Games\VALORANT\live\VALORANT.exe".into()], &mine, &[]).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn programs_in_a_launchers_own_folders_are_not_games() {
|
||||
let s = settings();
|
||||
// Always running on the game PC (2026-11-17): Wallpaper Engine is a Steam app, and the Riot
|
||||
// client's crash handler sits in the client's folder.
|
||||
for p in [r"C:\Program Files (x86)\Steam\steamapps\common\wallpaper_engine\wallpaper64.exe",
|
||||
r"C:\Program Files (x86)\Steam\steamapps\common\Steamworks Shared\_CommonRedist\vcredist\x.exe",
|
||||
r"C:\Riot Games\Riot Client\RiotClientCrashHandler.exe",
|
||||
r"C:\Program Files\Epic Games\Launcher\Portal\Binaries\Win64\EpicGamesLauncher.exe",
|
||||
r"C:\Program Files (x86)\Epic Games\Epic Online Services\service\EpicOnlineServices.exe"] {
|
||||
assert_eq!(classify(&fg(p, false, false, 0.0), false, &s, &[]), None, "{p}");
|
||||
}
|
||||
assert_eq!(game_running_among(&[r"C:\Riot Games\Riot Client\RiotClientCrashHandler.exe".into(),
|
||||
r"C:\Program Files (x86)\Steam\steamapps\common\wallpaper_engine\wallpaper64.exe".into()], &s, &[]), None);
|
||||
// The games beside them still are.
|
||||
assert_eq!(classify(&fg(r"C:\Program Files\Epic Games\Fortnite\FortniteClient.exe", false, false, 0.0), false, &s, &[]),
|
||||
Some(Reason::Launcher("Epic")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user