Files
FWS-ISO/configs/releng/airootfs/usr/local/share/fws/gameboot-windows/fws-play.ps1
T
nocode beec38a899 feat(gameboot-windows): add Windows dual-boot orchestration scripts for FWS gaming
Add PowerShell scripts to manage dual-boot transitions between FWS and Windows 11 for gaming sessions with Valorant.

Includes:
- fws-return.ps1: Arms firmware boot-next (one-shot) to target OS via bcdedit
- fws-play.ps1: Orchestrates Valorant session with robust crash recovery
- Install-FwsGameboot.ps1: Deploys scripts, disables hibernation, creates ONSTART task
- README.md: Documentation on dual-boot workflow and prerequisites

Design principles:
- Minimal footprint, no Vanguard interference (no injection/kernel hooks)
- Permanent fallback: BootOrder[0]=FWS catches unmanaged reboots
- Robust locale-independent bcdedit parsing via EFI paths and GUIDs
- Crash-proof game session: ONSTART task disabled during play to prevent mid-match boot changes
2026-07-08 02:39:27 +02:00

62 lines
2.8 KiB
PowerShell

<#
fws-play.ps1 — session de jeu Windows orchestree pour le retour vers FWS.
Flux robuste :
- on desactive la tache ONSTART (evite qu'un declenchement tardif ne rearme
FWS EN PLEIN MATCH) ;
- on arme le boot suivant vers WINDOWS (un crash/reboot pendant le jeu revient
sur Windows, pas ejecte vers FWS au milieu d'un match) ;
- on lance Valorant et on attend sa fermeture OU son crash ;
- dans un FINALLY (donc quoi qu'il arrive) : on rearme le boot suivant vers
FWS, on reactive la tache ONSTART, et on reboote — SEULEMENT si le jeu a
bien ete vu (pas de reboot force en plein 1er telechargement de patch).
Le filet permanent BootOrder[0]=FWS couvre tout ce que ce script raterait.
A lancer a l'ouverture de session du compte gaming (autologin) ou a la main.
Doit tourner EN ADMIN. #>
$ErrorActionPreference = 'Stop'
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$return = Join-Path $here 'fws-return.ps1'
$taskName = 'FWS-Return-OnStart'
$seen = $false
try {
# Neutraliser la course avec la tache ONSTART pendant la session.
try { Disable-ScheduledTask -TaskName $taskName -ErrorAction Stop | Out-Null } catch { }
# Pendant la session, un crash/reboot doit rester sur WINDOWS.
try { & $return -Target Windows } catch { Write-Warning "Arm Windows a echoue : $_" }
# Lancer Valorant via le Riot Client (adapter le chemin si necessaire).
$riot = Join-Path $Env:ProgramFiles 'Riot Games\Riot Client\RiotClientServices.exe'
if (Test-Path $riot) {
Start-Process $riot -ArgumentList '--launch-product=valorant','--launch-patchline=live'
} else {
Write-Warning "Riot Client introuvable : $riot — lance Valorant manuellement."
}
# Attendre l'apparition du process (SANS plafond serre : un 1er patch Riot /
# une MAJ Vanguard peuvent etre longs), puis attendre sa fermeture/crash.
$proc = 'VALORANT-Win64-Shipping'
for ($i = 0; $i -lt 1440; $i++) { # ~2 h max d'attente d'apparition
if (Get-Process $proc -ErrorAction SilentlyContinue) { $seen = $true; break }
Start-Sleep -Seconds 5
}
if ($seen) {
Get-Process $proc -ErrorAction SilentlyContinue | ForEach-Object { $_.WaitForExit() }
} else {
Write-Warning "Jeu jamais detecte — pas de reboot automatique."
}
}
finally {
# Rearmer FWS et reactiver la tache, QUOI QU'IL ARRIVE.
try { & $return -Target FWS } catch { Write-Warning "Arm FWS a echoue : $_ — BootOrder[0]=FWS reste le filet." }
try { Enable-ScheduledTask -TaskName $taskName -ErrorAction Stop | Out-Null } catch { }
if ($seen) {
Start-Sleep -Seconds 2
Restart-Computer -Force
} else {
Write-Warning "Session sans jeu detecte : redemarre manuellement pour revenir a FWS (BootNext deja arme vers FWS)."
}
}