Files
skate-3-rust-engine/scripts/build-multiplayer-test.ps1
T
Hails 3d485c8dfa Input: SDL3 gamepad backend with XInput fallback
Implements issue #14. A dedicated thread owns SDL3 (3.4.16, statically
linked via sdl3 =0.20.0) and publishes per-slot snapshots re-expressed as
the XInput-shaped XboxState, so the TU3 conversion in skate-core is
unchanged. Conversions are exact for XInput-backed pads (stick Y via
bitwise NOT, trigger round-to-nearest). SKATE3_INPUT=xinput selects the
original transport, which is also the fallback if SDL fails to start.
Optional settings/controller.json maps paddles to XInput buttons.

Build: scripts/Ensure-CMake.ps1 locates CMake (PATH or Visual Studio's
copy) for the SDL source build. sdl3-sys is vendored with a build.rs
patch setting CMAKE_MSVC_RUNTIME_LIBRARY from crt-static, because SDL's
CMake (policy CMP0091) ignores cmake-rs' -MT and the static-CRT release
build failed with unresolved __imp_* symbols.

See docs/hails-additions/03-sdl3-gamepad-input.md and vendor/README.md.
2026-09-30 19:26:50 -06:00

29 lines
2.3 KiB
PowerShell

param([string]$OutputDirectory = 'bin/multiplayer')
$ErrorActionPreference = 'Stop'
. (Join-Path $PSScriptRoot 'Ensure-CMake.ps1')
$workspace = Split-Path -Parent $PSScriptRoot
Set-Location -LiteralPath $workspace
$output = [IO.Path]::GetFullPath((Join-Path $workspace $OutputDirectory))
$relay = Join-Path $output 'steam-relay'
$build = Join-Path $output 'build'
New-Item -ItemType Directory -Path $relay,$build -Force | Out-Null
$env:CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS = '-C target-feature=+crt-static'
# Share dependency artifacts, but link directly into this checkout's staging folder.
& cargo rustc --release --target x86_64-pc-windows-msvc --target-dir (Join-Path $workspace 'target') -p skate-game --bin skate3-multiplayer --no-default-features --locked -- -C extra-filename=-multiplayer-test --emit "link=$build/skate3-multiplayer-test.exe"
if ($LASTEXITCODE -ne 0) { throw 'Multiplayer build failed.' }
& cargo rustc --release --target x86_64-pc-windows-msvc --target-dir (Join-Path $workspace 'target') -p skate-steam-relay --bin skate-steam-relay --locked -- -C extra-filename=-multiplayer-test --emit "link=$build/relay-multiplayer-test.exe"
if ($LASTEXITCODE -ne 0) { throw 'Steam relay build failed.' }
Copy-Item -LiteralPath (Join-Path $build 'skate3-multiplayer-test.exe') -Destination (Join-Path $output 'skate3-multiplayer.exe') -Force
Copy-Item -LiteralPath (Join-Path $build 'relay-multiplayer-test.exe') -Destination (Join-Path $relay 'skate-steam-relay.exe') -Force
$metadata = (& cargo metadata --format-version 1 --locked) -join "`n"
if ($LASTEXITCODE -ne 0) { throw 'Could not locate the Steam redistributable.' }
# Extract only the JSON string we need. Windows PowerShell's JSON object parser
# rejects unrelated dependency feature keys that differ only in letter case.
$sdk = [regex]::Match($metadata, '"name":"steamworks-sys","version":"0\.13\.0".*?"manifest_path":("(?:[^"\\]|\\.)*")')
if (-not $sdk.Success) { throw 'Steamworks SDK package was not found in Cargo metadata.' }
$manifest = ConvertFrom-Json -InputObject $sdk.Groups[1].Value
$dll = Join-Path (Split-Path -Parent $manifest) 'lib/steam/redistributable_bin/win64/steam_api64.dll'
Copy-Item -LiteralPath $dll -Destination $relay
Write-Host "Staged multiplayer build: $output"
Write-Host 'Build only; no game or Steam process was launched.'