diff options
| author | lixonik <71736299+lixonik@users.noreply.github.com> | 2026-11-25 08:50:31 +0300 |
|---|---|---|
| committer | lixonik <71736299+lixonik@users.noreply.github.com> | 2026-11-25 08:50:31 +0300 |
| commit | 0236b63f4e18996a8210c841bea54e64af3f3ba7 (patch) | |
| tree | 7cab9561480c163d45aab37023f4975bd005e11f /scripts/windows-boot | |
| parent | 42537e7b6f84c233ac009b924d3a25d2a1178197 (diff) | |
Keep Windows boot driver artifacts outside the checkout
Diffstat (limited to 'scripts/windows-boot')
| -rw-r--r-- | scripts/windows-boot/README.md | 3 | ||||
| -rw-r--r-- | scripts/windows-boot/boot.ps1 | 35 |
2 files changed, 29 insertions, 9 deletions
diff --git a/scripts/windows-boot/README.md b/scripts/windows-boot/README.md index 3a875af4b..954052c93 100644 --- a/scripts/windows-boot/README.md +++ b/scripts/windows-boot/README.md | |||
| @@ -25,6 +25,9 @@ Set `LEONIDA_GAME_DIR`, `LEONIDA_SHADERS` (and `GTA6RT`, `LEONIDA_RUNS` if you u | |||
| 25 | profile and the parameters can be left out. Defaults: `gta6rt` from `runtime\build\RelWithDebInfo\` of this | 25 | profile and the parameters can be left out. Defaults: `gta6rt` from `runtime\build\RelWithDebInfo\` of this |
| 26 | checkout, the executable from the game folder (`-Exe` or `LEONIDA_EXE` when it lives elsewhere), outputs in `$HOME\leonida-runs`. | 26 | checkout, the executable from the game folder (`-Exe` or `LEONIDA_EXE` when it lives elsewhere), outputs in `$HOME\leonida-runs`. |
| 27 | The script refuses an output folder inside the repository. | 27 | The script refuses an output folder inside the repository. |
| 28 | The runtime starts in `<out>\work_<name>`, where driver artifacts such as `ucode.elf` can land. Relative path | ||
| 29 | parameters are resolved from the caller's PowerShell location. Use absolute paths for additional runtime switches | ||
| 30 | supplied through `-ExtraArgs` or custom environment variables. | ||
| 28 | 31 | ||
| 29 | ## What it sets | 32 | ## What it sets |
| 30 | 33 | ||
diff --git a/scripts/windows-boot/boot.ps1 b/scripts/windows-boot/boot.ps1 index d052a79da..c95bec4c0 100644 --- a/scripts/windows-boot/boot.ps1 +++ b/scripts/windows-boot/boot.ps1 | |||
| @@ -139,6 +139,12 @@ function Get-FirstValue { | |||
| 139 | return "" | 139 | return "" |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | function Get-BootPath { | ||
| 143 | param([string]$Path) | ||
| 144 | if ($Path) { return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Path) } | ||
| 145 | return "" | ||
| 146 | } | ||
| 147 | |||
| 142 | function Read-SideFile { | 148 | function Read-SideFile { |
| 143 | # One line from a text file make_game.py writes beside gta6rt.exe (game_path.txt, shader_path.txt). | 149 | # One line from a text file make_game.py writes beside gta6rt.exe (game_path.txt, shader_path.txt). |
| 144 | param([string]$Path) | 150 | param([string]$Path) |
| @@ -188,14 +194,14 @@ if (-not $Name) { $Name = "boot-" + (Get-Date -Format "yyyyMMdd-HHmmss") } | |||
| 188 | if ($NoInput) { $InputScript = "" } | 194 | if ($NoInput) { $InputScript = "" } |
| 189 | if ($Name -notmatch '^[A-Za-z0-9._-]+$') { throw "-Name may hold letters, digits, '.', '_' and '-' only: $Name" } | 195 | if ($Name -notmatch '^[A-Za-z0-9._-]+$') { throw "-Name may hold letters, digits, '.', '_' and '-' only: $Name" } |
| 190 | 196 | ||
| 191 | $Runtime = Get-FirstValue @($Runtime, $env:GTA6RT, (Join-Path $RepoRoot "runtime\build\RelWithDebInfo\gta6rt.exe")) | 197 | $Runtime = Get-BootPath (Get-FirstValue @($Runtime, $env:GTA6RT, (Join-Path $RepoRoot "runtime\build\RelWithDebInfo\gta6rt.exe"))) |
| 192 | $RuntimeDir = Split-Path -Parent $Runtime | 198 | $RuntimeDir = Split-Path -Parent $Runtime |
| 193 | $GameDir = Get-FirstValue @($GameDir, $env:LEONIDA_GAME_DIR, (Read-SideFile (Join-Path $RuntimeDir "game_path.txt"))) | 199 | $GameDir = Get-BootPath (Get-FirstValue @($GameDir, $env:LEONIDA_GAME_DIR, (Read-SideFile (Join-Path $RuntimeDir "game_path.txt")))) |
| 194 | $Exe = Get-FirstValue @($Exe, $env:LEONIDA_EXE, $(if ($GameDir) { Join-Path $GameDir $ExeName } else { "" })) | 200 | $Exe = Get-BootPath (Get-FirstValue @($Exe, $env:LEONIDA_EXE, $(if ($GameDir) { Join-Path $GameDir $ExeName } else { "" }))) |
| 195 | $Shaders = Get-FirstValue @($Shaders, $env:LEONIDA_SHADERS) | 201 | $Shaders = Get-BootPath (Get-FirstValue @($Shaders, $env:LEONIDA_SHADERS)) |
| 196 | $OutDir = Get-FirstValue @($OutDir, $env:LEONIDA_RUNS, (Join-Path $HOME "leonida-runs")) | 202 | $OutDir = Get-BootPath (Get-FirstValue @($OutDir, $env:LEONIDA_RUNS, (Join-Path $HOME "leonida-runs"))) |
| 197 | $OutDir = [System.IO.Path]::GetFullPath($OutDir) | 203 | $Overlay = Get-BootPath (Get-FirstValue @($Overlay, (Join-Path $OutDir "overlay"))) |
| 198 | $Overlay = Get-FirstValue @($Overlay, (Join-Path $OutDir "overlay")) | 204 | $RunDirectory = Join-Path $OutDir ("work_" + $Name) |
| 199 | $Capture = Join-Path $OutDir ("cap_" + $Name) | 205 | $Capture = Join-Path $OutDir ("cap_" + $Name) |
| 200 | $LogFile = Join-Path $OutDir ($Name + ".log") | 206 | $LogFile = Join-Path $OutDir ($Name + ".log") |
| 201 | $StdoutFile = Join-Path $OutDir ($Name + ".stdout.log") | 207 | $StdoutFile = Join-Path $OutDir ($Name + ".stdout.log") |
| @@ -266,6 +272,16 @@ foreach ($pair in $EnvPairs) { | |||
| 266 | if ($pair -notmatch '^([A-Za-z_][A-Za-z0-9_]*)=(.*)$') { throw "not a parameter and not KEY=VALUE: '$pair' (Get-Help $PSCommandPath -Full)" } | 272 | if ($pair -notmatch '^([A-Za-z_][A-Za-z0-9_]*)=(.*)$') { throw "not a parameter and not KEY=VALUE: '$pair' (Get-Help $PSCommandPath -Full)" } |
| 267 | $bootEnv[$Matches[1]] = $Matches[2] | 273 | $bootEnv[$Matches[1]] = $Matches[2] |
| 268 | } | 274 | } |
| 275 | foreach ($key in @("LEONIDA_SHADERS", "LEONIDA_CAPTURE", "LEONIDA_PIPELINE_CACHE_DIR")) { | ||
| 276 | if ($bootEnv[$key]) { $bootEnv[$key] = Get-BootPath $bootEnv[$key] } | ||
| 277 | } | ||
| 278 | foreach ($key in @("LEONIDA_COMPAT_DIR", "LEONIDA_DSTORAGE_HISTORY", "LEONIDA_SAVE_DIR", | ||
| 279 | "LEONIDA_WRITE_DIR", "LEONIDA_XMEM_BACKING_DIR")) { | ||
| 280 | $value = $bootEnv[$key] | ||
| 281 | if ($value -and -not [System.IO.Path]::IsPathRooted($value)) { | ||
| 282 | $bootEnv[$key] = Get-BootPath (Join-Path $RepoRoot $value) | ||
| 283 | } | ||
| 284 | } | ||
| 269 | if ($bootEnv["LEONIDA_CAPTURE"]) { $Capture = $bootEnv["LEONIDA_CAPTURE"] } | 285 | if ($bootEnv["LEONIDA_CAPTURE"]) { $Capture = $bootEnv["LEONIDA_CAPTURE"] } |
| 270 | 286 | ||
| 271 | $gameArgs = @("--run", $Exe, "--game-dir", $GameDir, "--overlay", $Overlay, "--trace", $TraceFile, "--trace-d3d12") + $ExtraArgs | 287 | $gameArgs = @("--run", $Exe, "--game-dir", $GameDir, "--overlay", $Overlay, "--trace", $TraceFile, "--trace-d3d12") + $ExtraArgs |
| @@ -275,6 +291,7 @@ if (-not $DigestOnly) { | |||
| 275 | Write-Output "[boot] $Name ${Seconds}s repo $RepoRoot" | 291 | Write-Output "[boot] $Name ${Seconds}s repo $RepoRoot" |
| 276 | Write-Output "[boot] gta6rt $Runtime" | 292 | Write-Output "[boot] gta6rt $Runtime" |
| 277 | Write-Output "[boot] out $OutDir" | 293 | Write-Output "[boot] out $OutDir" |
| 294 | Write-Output "[boot] cwd $RunDirectory" | ||
| 278 | foreach ($k in $bootEnv.Keys) { if ($bootEnv[$k] -ne "") { Write-Output ("[boot] env {0}={1}" -f $k, $bootEnv[$k]) } } | 295 | foreach ($k in $bootEnv.Keys) { if ($bootEnv[$k] -ne "") { Write-Output ("[boot] env {0}={1}" -f $k, $bootEnv[$k]) } } |
| 279 | Write-Output "[boot] command $(ConvertTo-ProcessArgument $Runtime) $argLine" | 296 | Write-Output "[boot] command $(ConvertTo-ProcessArgument $Runtime) $argLine" |
| 280 | } | 297 | } |
| @@ -314,7 +331,7 @@ if (-not $DigestOnly) { | |||
| 314 | } | 331 | } |
| 315 | } | 332 | } |
| 316 | 333 | ||
| 317 | foreach ($d in @($OutDir, $Overlay)) { New-Item -ItemType Directory -Force -Path $d | Out-Null } | 334 | foreach ($d in @($OutDir, $Overlay, $RunDirectory)) { New-Item -ItemType Directory -Force -Path $d | Out-Null } |
| 318 | if ($bootEnv["LEONIDA_PIPELINE_CACHE_DIR"]) { | 335 | if ($bootEnv["LEONIDA_PIPELINE_CACHE_DIR"]) { |
| 319 | New-Item -ItemType Directory -Force -Path $bootEnv["LEONIDA_PIPELINE_CACHE_DIR"] | Out-Null | 336 | New-Item -ItemType Directory -Force -Path $bootEnv["LEONIDA_PIPELINE_CACHE_DIR"] | Out-Null |
| 320 | } | 337 | } |
| @@ -336,7 +353,7 @@ if (-not $DigestOnly) { | |||
| 336 | 353 | ||
| 337 | # ------------------------------------------------------------------------------------------- the boot | 354 | # ------------------------------------------------------------------------------------------- the boot |
| 338 | $started = Get-Date | 355 | $started = Get-Date |
| 339 | $proc = Start-Process -FilePath $Runtime -ArgumentList $argLine -WorkingDirectory $RepoRoot -NoNewWindow -PassThru ` | 356 | $proc = Start-Process -FilePath $Runtime -ArgumentList $argLine -WorkingDirectory $RunDirectory -NoNewWindow -PassThru ` |
| 340 | -RedirectStandardError $LogFile -RedirectStandardOutput $StdoutFile | 357 | -RedirectStandardError $LogFile -RedirectStandardOutput $StdoutFile |
| 341 | $handle = $proc.Handle # keeps the exit code readable after the process ends | 358 | $handle = $proc.Handle # keeps the exit code readable after the process ends |
| 342 | $stopped = $false | 359 | $stopped = $false |