Files
moonwell-client-core/scripts/deploy-moonwell.ps1
T
sindoring ad314acbfa feat(moonwell-gfx): добавить FSR и DLSS
Добавить FSR 3.1.5 и DLSS Super Resolution для Windows и Vulkan с выбором в настройках и возвратом к MoonWell при недоступном режиме.

Проверены scripts/check.sh, офлайн-сцены на RTX 5070 и Radeon, переключение режимов, сброс истории при телепорте и запуск локального пакета с DLL и без неё. Замеры 4K подтвердили снижение времени GPU относительно нативного рендера. Проверки клиента выполнены локально, игровые сцены запущены офлайн.
2026-11-24 12:53:25 +04:00

140 lines
6.8 KiB
PowerShell

[CmdletBinding()]
param(
[string]$DataPath = '',
[string]$IconPath = '',
[string]$PatchSource = '',
[string]$AuthHost = '',
[string]$EnvFile = '',
[string]$PackagePath = '',
[string]$BinaryPath = '',
[string]$VcRuntimePath = '',
[string]$DlssRuntimePath = '',
[string]$DlssNoticesPath = '',
[string]$Prefix = 'World of Warcraft 1.12.1',
[string]$ManifestKey = 'manifest-1.12.1.json',
[switch]$Publish,
[switch]$DryRun,
[switch]$SkipClientBuild
)
$ErrorActionPreference = 'Stop'
$repoRoot = Split-Path $PSScriptRoot -Parent
if (-not $EnvFile) {
$EnvFile = Join-Path (Split-Path $repoRoot -Parent) 'MoonWellClientSources\.env'
}
if (-not $PackagePath) {
$PackagePath = Join-Path $repoRoot ('dist\moonwell-' + (Get-Date -Format 'yyyyMMdd-HHmmss'))
}
$targetDir = Join-Path $repoRoot 'target'
$playerBinary = Join-Path $targetDir 'release\MoonWell.exe'
$explicitBinary = [bool]$BinaryPath
if (-not $BinaryPath) { $BinaryPath = $playerBinary }
function Build-Executable([string]$Name, [string[]]$Arguments) {
$executable = $null
# Cargo writes progress and ordinary warnings to stderr on a successful build.
$ErrorActionPreference = 'Continue'
& cargo @Arguments --target-dir $targetDir --message-format=json-render-diagnostics |
ForEach-Object {
if ($_ -like '*"reason":"compiler-artifact"*') {
$artifact = ConvertFrom-Json $_ -ErrorAction Stop
if ($artifact.target.name -eq $Name -and $artifact.executable) {
$executable = [IO.Path]::GetFullPath($artifact.executable)
}
}
}
if ($LASTEXITCODE -ne 0 -or -not $executable) { throw "$Name build failed." }
return $executable
}
if ($DlssRuntimePath -or $DlssNoticesPath) {
if (-not $BinaryPath.EndsWith('.exe', [StringComparison]::OrdinalIgnoreCase)) {
throw 'DLSS packaging is available for the Windows player.'
}
if (-not $DlssRuntimePath -or -not $DlssNoticesPath) {
throw 'Pass both -DlssRuntimePath (nvngx_dlss.dll) and -DlssNoticesPath.'
}
$DlssRuntimePath = (Resolve-Path -LiteralPath $DlssRuntimePath).Path
$DlssNoticesPath = (Resolve-Path -LiteralPath $DlssNoticesPath).Path
if ((Split-Path $DlssRuntimePath -Leaf) -ine 'nvngx_dlss.dll' -or
-not (Test-Path -LiteralPath $DlssRuntimePath -PathType Leaf) -or
-not (Test-Path -LiteralPath $DlssNoticesPath -PathType Leaf)) {
throw 'DLSS staging requires the NVIDIA runtime DLL and a notices file.'
}
}
if ($BinaryPath.EndsWith('.exe', [StringComparison]::OrdinalIgnoreCase)) {
if (-not $VcRuntimePath) {
$vswherePath = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe'
$vsInstall = (& $vswherePath -latest -products '*' -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath).Trim()
if ($LASTEXITCODE -ne 0 -or -not $vsInstall) { throw 'Visual Studio C++ runtime was not found; pass -VcRuntimePath.' }
$redistVersion = Get-ChildItem -LiteralPath (Join-Path $vsInstall 'VC\Redist\MSVC') -Directory |
Where-Object { $_.Name -match '^\d+\.\d+\.\d+$' } |
Sort-Object { [version]$_.Name } -Descending | Select-Object -First 1
$VcRuntimePath = Join-Path $redistVersion.FullName 'x64\Microsoft.VC143.CRT'
}
if (-not (Test-Path -LiteralPath (Join-Path $VcRuntimePath 'vcruntime140.dll') -PathType Leaf)) {
throw 'The x64 Visual C++ redistributable vcruntime140.dll was not found.'
}
}
if (-not $DataPath -or -not $AuthHost) {
throw 'Pass -DataPath pointing to WoW 1.12.1 Data and -AuthHost host[:port]. WOW_HOME from the old .env is deliberately not used.'
}
if ($Publish -and $DryRun) { throw 'Choose -Publish or -DryRun.' }
if (Test-Path -LiteralPath $PackagePath) { throw 'PackagePath already exists; choose a new staging directory.' }
if (($Publish -or $DryRun) -and -not (Test-Path -LiteralPath $EnvFile -PathType Leaf)) {
throw 'Deployment .env was not found.'
}
Push-Location $repoRoot
try {
if (-not $SkipClientBuild) {
$embeddedIcon = Join-Path $repoRoot 'crates\moonwell\assets\moonwell.ico'
if ($IconPath) {
$sourceIcon = (Resolve-Path -LiteralPath $IconPath).Path
New-Item -ItemType Directory -Path (Split-Path $embeddedIcon -Parent) -Force | Out-Null
if ($sourceIcon -ne $embeddedIcon) { Copy-Item -LiteralPath $sourceIcon -Destination $embeddedIcon }
}
if (-not (Test-Path -LiteralPath $embeddedIcon -PathType Leaf)) {
throw 'Provide the MoonWell icon with -IconPath or place it in crates/moonwell/assets/moonwell.ico.'
}
$playerArgs = @('build', '-p', 'moonwell', '--release', '--no-default-features', '--locked')
if ($DlssRuntimePath) { $playerArgs += @('--features', 'dlss') }
$builtPlayer = Build-Executable 'MoonWell' $playerArgs
if (-not $explicitBinary) { $BinaryPath = $builtPlayer }
if ($DlssRuntimePath -and [IO.Path]::GetFullPath($BinaryPath) -ne $builtPlayer) {
throw 'Build and stage the same DLSS executable, or pass -SkipClientBuild for a prebuilt DLSS executable.'
}
}
$toolPath = Build-Executable 'moonwell-deploy' @('build', '-p', 'moonwell-deploy', '--release', '--locked')
$stageArguments = @('stage', '--binary', $BinaryPath, '--data', $DataPath,
'--output', $PackagePath, '--auth-host', $AuthHost)
if ($PatchSource) { $stageArguments += @('--source', $PatchSource) }
& $toolPath @stageArguments
if ($LASTEXITCODE -ne 0) { throw 'Package staging failed.' }
if ($BinaryPath.EndsWith('.exe', [StringComparison]::OrdinalIgnoreCase)) {
Copy-Item -LiteralPath (Join-Path $VcRuntimePath 'vcruntime140.dll') -Destination (Join-Path $PackagePath 'vcruntime140.dll')
}
if ($DlssRuntimePath) {
Copy-Item -LiteralPath $DlssRuntimePath -Destination (Join-Path $PackagePath 'nvngx_dlss.dll')
Copy-Item -LiteralPath $DlssNoticesPath -Destination (Join-Path $PackagePath 'NVIDIA-DLSS-NOTICES.txt')
}
# The local inventory lives outside the package, so it cannot list itself.
$inventoryPath = $PackagePath + '.manifest.json'
& $toolPath manifest --dir $PackagePath --output $inventoryPath
if ($LASTEXITCODE -ne 0) { throw 'Manifest generation failed.' }
if ($Publish -or $DryRun) {
$publishArguments = @('publish', '--dir', $PackagePath, '--env-file', $EnvFile,
'--prefix', $Prefix, '--manifest-key', $ManifestKey)
if ($DryRun) { $publishArguments += '--dry-run' }
& $toolPath @publishArguments
if ($LASTEXITCODE -ne 0) { throw 'S3 publication failed.' }
}
Write-Host "Package: $PackagePath"
Write-Host "Local manifest: $inventoryPath"
} finally {
Pop-Location
}