diff --git a/Build-SessionMarker.ps1 b/Build-SessionMarker.ps1 new file mode 100644 index 00000000..f58fd89b --- /dev/null +++ b/Build-SessionMarker.ps1 @@ -0,0 +1,39 @@ +param([switch]$StageOnly, [string]$DependencyTargetDirectory = (Join-Path $PSScriptRoot 'target')) +$ErrorActionPreference = 'Stop' +$privateDirectory = Join-Path $PSScriptRoot '.local/session-marker' +$buildDirectory = Join-Path $privateDirectory 'build' +$artifact = Join-Path $buildDirectory 'skate3rust-session-marker.exe' +$destination = Join-Path $privateDirectory 'skate3-session-marker.exe' +Push-Location $PSScriptRoot +$previousFlags = $env:CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS +try { + New-Item -ItemType Directory -Force -Path $buildDirectory | Out-Null + if (-not $StageOnly) { + $env:CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS = '-C target-feature=+crt-static' + # Dependencies may use a shared cache. The linker writes this task's + # artifact directly, never staging the cache's generic skate3rust.exe. + & cargo rustc --release --locked --target x86_64-pc-windows-msvc ` + --target-dir $DependencyTargetDirectory -p skate-game --no-default-features ` + --bin skate3rust -- -C extra-filename=-session-marker ` + -o (Join-Path $buildDirectory 'skate3rust.exe') + if ($LASTEXITCODE -ne 0) { throw 'Session-marker build failed.' } + } + $bytes = [System.IO.File]::ReadAllBytes($artifact) + $text = [System.Text.Encoding]::ASCII.GetString($bytes) + foreach ($required in @('--start-paused', 'session_marker/effect.wgsl', 'Session marker return rejected')) { + if (-not $text.Contains($required)) { throw "Wrong session-marker artifact: missing $required" } + } + Copy-Item -LiteralPath $artifact -Destination $destination -Force + $hash = (Get-FileHash -LiteralPath $destination -Algorithm SHA256).Hash + if ($hash -ne (Get-FileHash -LiteralPath $artifact -Algorithm SHA256).Hash) { + throw 'Staged executable hash mismatch.' + } + @{ executable = $destination; sha256 = $hash; source = $PSScriptRoot; + revision = (& git rev-parse HEAD); staticChecks = 'CLI, marker shader, return path' } | + ConvertTo-Json | Set-Content -LiteralPath (Join-Path $privateDirectory 'build-manifest.json') -Encoding UTF8 + Write-Host "Ready for manual launch: $destination" + Write-Host "SHA256: $hash" +} finally { + $env:CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS = $previousFlags + Pop-Location +} diff --git a/PLAY-SESSION-MARKER.bat b/PLAY-SESSION-MARKER.bat index 8060b036..728d57dc 100644 --- a/PLAY-SESSION-MARKER.bat +++ b/PLAY-SESSION-MARKER.bat @@ -2,7 +2,7 @@ setlocal cd /d "%~dp0" set "MARKER_DIR=%~dp0.local\session-marker" -if not exist "%MARKER_DIR%\skate3rust.exe" ( +if not exist "%MARKER_DIR%\skate3-session-marker.exe" ( echo Missing private session-marker build. See docs\session-markers.md. pause exit /b 1 @@ -16,5 +16,5 @@ if not defined SKATE3_ASSETS ( exit /b 1 ) set "SKATE3_SESSION_MARKER_OVERLAY=%MARKER_DIR%\overlay" -"%MARKER_DIR%\skate3rust.exe" --assets "%SKATE3_ASSETS%" --start-paused %* +"%MARKER_DIR%\skate3-session-marker.exe" --assets "%SKATE3_ASSETS%" --start-paused %* if errorlevel 1 pause diff --git a/docs/session-markers.md b/docs/session-markers.md index a9a416f5..bd99db77 100644 --- a/docs/session-markers.md +++ b/docs/session-markers.md @@ -25,7 +25,7 @@ SHA-256 provenance: ```text Owned default.xex: 1db39496585c521d17a2137804f42cf73ebed2b32cac166ec42dbf772f4dcf7f TU3 disassembly image: f4aa113eb541bfba03dbc108cf5ab43f58c965b20fa3b82f9c40938a0ad841c4 -Private manual executable: 38be66b784b64d87d2134120b9bf582c74b295d4a01b1d1e9246cf62b4f0775f +Corrected private manual executable: cf5e5e0cc4ed88547f03a8a1ebe628133d4b58ecc451ecad4d59276d1ba22cbf ``` | Native owner | Behavior represented | @@ -96,6 +96,15 @@ Release compilation passed with the existing static-CRT Windows target flags: cargo build --release --locked --target x86_64-pc-windows-msvc -p skate-game --no-default-features ``` +The first staged executable was subsequently found to be an older build from +the shared target directory: it contained neither `--start-paused` nor the +marker shader. The compile result did not verify the staged artifact. That +executable has been superseded by `.local/session-marker/skate3-session-marker.exe`. +`Build-SessionMarker.ps1` now links directly into the task's private build +directory with a distinct artifact name, checks the CLI/marker strings without +executing it, and verifies the staged SHA-256. Use that script for future builds; +`-DependencyTargetDirectory` can select an existing dependency cache. + Three standalone hold-state tests passed (cancellation/latching, unset/nearby/ blocked returns and tail, distance ramp). The WGSL passed offline Naga27 parsing and validation. Original HUD manifest counts, triangle structure and every RGBA