CGBJ's renderer, DLSS, an F1 settings menu, frame generation, ray tracing switch

The default of scripts\play-nvidia.ps1 changes: the game renders its own
720p and DLSS takes it to 1080p (Series S), in place of the half render
scale and the title's upscaler. -Resolution still reaches the older path.

- Renderer: codec-d/cool_fox f4b48ad (GPL-3.0) with this fork's NVIDIA
  fixes on top (residency.rs, stretch.rs, the ffx upscale dispatch).
- DLSS for the title's upscale, from avatarmanz/VIctory-7900XTX pull
  request 203 (feature `dlss`, VICTORY_UPSCALE=dlss), with
  VICTORY_DLSS_PRESET and a live sharpness setting.
- F1 settings menu in the game (host/menu.rs): saved to
  victory-settings.txt, applied by the launcher at the next start,
  "save and restart" from the menu. F3: the panel, now with the
  generated frame rate beside the real one.
- DLSS frame generation through NVIDIA Streamline (streamline.rs, fg.rs),
  2x to 6x, the amount changed while playing. Constants and the depth and
  motion vector tags are handed over at each present.
- VICTORY_FPS_CAP: the title's own 30 frames a second can be lifted
  (60, 120, none), live from the menu.
- Real ray tracing as an option (-RayTracing, VICTORY_BVH_BUILDER=1): on
  this renderer the structure builder runs on NVIDIA. Frame generation is
  left off with it: the two together run at about 0.1 fps, cause not found.
- VICTORY_HEAP_RECHECK_EVERY: textures picked by index looked at again
  for the whole run (a test against the posterized look).
- Get-NVIDIA-DLSS.cmd / scripts\get-nvidia-sdks.ps1: fetch the few NVIDIA
  files DLSS and frame generation need (about 70 MB) from NVIDIA's GitHub
  into nvidia-sdk\ (git-ignored). They are NVIDIA's, under NVIDIA's
  licences, and are not part of this repository. Without them the picture
  is stretched and there is no frame generation.
- scripts\build-nvidia.ps1; the launcher builds the layer when it is not
  built, and again with DLSS once those files are there.

Measured on an RTX 5070 (Series S, DLSS, opening rooms): about 15-17 fps
without ray tracing, 13-15 with it, before generated frames. What is known
to be wrong is in the README's new section.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
trustno1-coderandClaude Fable 5.2 committed 2026-11-26 17:56:14 -08:00
1 parent 9e7ab9d9a2
commit 63957271cd
55 files changed
+8030 -1313

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
# Builds the layer the way scripts\play-nvidia.ps1 expects it (the diag profile with diagnostics: the F1 menu,
# the F3 panel and several NVIDIA settings are diagnostics switches).
# scripts\build-nvidia.ps1 with DLSS when nvidia-sdk\DLSS is there (Get-NVIDIA-DLSS.cmd fetches it),
# without it otherwise
# scripts\build-nvidia.ps1 -NoDlss without DLSS even then
# scripts\build-nvidia.ps1 -DlssSdk <your checkout of github.com/NVIDIA/DLSS>
# A build with DLSS links NVIDIA's loader library: it is for your own use, not for passing on.
param(
[string]$DlssSdk,
[switch]$NoDlss
)
$root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
if (-not $DlssSdk) { $DlssSdk = Join-Path $root 'nvidia-sdk\DLSS' }
$features = 'diagnostics'
if (-not $NoDlss -and (Test-Path (Join-Path $DlssSdk 'lib\Windows_x86_64\x64\nvsdk_ngx_d.lib'))) {
$env:VICTORY_DLSS_SDK = (Resolve-Path $DlssSdk).Path
$features = 'diagnostics,dlss'
Write-Host "Building with DLSS (SDK: $env:VICTORY_DLSS_SDK)"
} else {
Write-Host 'Building without DLSS (Get-NVIDIA-DLSS.cmd fetches its files; without them the picture is stretched to the screen)'
}
Push-Location $root
try { cargo build --locked --profile diag -p victory --features $features } finally { Pop-Location }
if ($LASTEXITCODE -eq 0) { Set-Content -Path (Join-Path $root 'target\diag\built-with.txt') -Value $features -Encoding ascii }
if ($LASTEXITCODE -eq 0) { Write-Host "Built: $(Join-Path $root 'target\diag\victory.exe'). Next: scripts\play-nvidia.ps1 -Exe <your copy's executable>" }
+154
View File
@@ -0,0 +1,154 @@
# Fetches the few NVIDIA files DLSS and DLSS frame generation need (about 70 MB) from NVIDIA's own GitHub
# into nvidia-sdk\ here (git-ignored). They are NVIDIA's, under NVIDIA's licences (saved beside them: read
# them); this repository does not and may not carry them, so each person gets them from NVIDIA directly.
# Get-NVIDIA-DLSS.cmd in the repository's folder runs this.
# scripts\get-nvidia-sdks.ps1 DLSS and frame generation
# scripts\get-nvidia-sdks.ps1 -NoStreamline DLSS only (about 60 MB)
# Then: scripts\build-nvidia.ps1 (scripts\play-nvidia.ps1 does it by itself at its next start).
param(
[string]$DlssTag = 'v310.9.16',
[string]$StreamlineTag = 'v2.14.16',
[switch]$NoStreamline
)
$ProgressPreference = 'SilentlyContinue' # Invoke-WebRequest's progress bar makes it many times slower
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
$root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
$sdk = Join-Path $root 'nvidia-sdk'
# One file from a URL, with curl's progress line where Windows has curl (it has since Windows 10 1803).
function Get-File([string]$Url, [string]$To) {
New-Item -ItemType Directory -Force (Split-Path $To) | Out-Null
$part = "$To.part"
if (Get-Command curl.exe -ErrorAction SilentlyContinue) {
& curl.exe --location --fail --silent --show-error --progress-bar --output $part $Url
if ($LASTEXITCODE -ne 0) { Remove-Item $part -ErrorAction SilentlyContinue; throw "could not get $Url" }
} else {
Invoke-WebRequest -Uri $Url -OutFile $part -UseBasicParsing -ErrorAction Stop
}
Move-Item $part $To -Force
}
# Bytes first..last of a URL.
function Get-Range([string]$Url, [long]$First, [long]$Last) {
$q = [Net.HttpWebRequest]::Create($Url)
$q.UserAgent = 'get-nvidia-sdks'
$q.AddRange($First, $Last)
$r = $q.GetResponse()
try {
if ([int]$r.StatusCode -ne 206) { throw 'the server does not give parts of the file' }
$m = New-Object IO.MemoryStream
$r.GetResponseStream().CopyTo($m)
, $m.ToArray()
} finally { $r.Close() }
}
# Takes the named files out of a zip on a server without downloading the whole zip: its directory is at
# its end, and each file in it can be asked for by its place. $Want: a regex on the paths in the zip.
# Each goes into $Into under the part of its path after the SDK's top folder.
function Get-FromZip([string]$Url, [string]$Want, [string]$Into) {
# Where the file really is (the download address redirects), and how long it is.
$h = [Net.HttpWebRequest]::Create($Url); $h.Method = 'HEAD'; $h.UserAgent = 'get-nvidia-sdks'
$r = $h.GetResponse(); $real = $r.ResponseUri.AbsoluteUri; $length = $r.ContentLength; $r.Close()
$tailLen = [Math]::Min($length, 2MB)
$tail = Get-Range $real ($length - $tailLen) ($length - 1)
$end = -1
for ($i = $tail.Length - 22; $i -ge 0; $i--) {
if ($tail[$i] -eq 0x50 -and $tail[$i + 1] -eq 0x4b -and $tail[$i + 2] -eq 5 -and $tail[$i + 3] -eq 6) { $end = $i; break }
}
if ($end -lt 0) { throw 'no zip directory found' }
$dirSize = [BitConverter]::ToUInt32($tail, $end + 12)
$dirAt = [BitConverter]::ToUInt32($tail, $end + 16)
if ($dirAt -eq [uint32]::MaxValue) { throw 'a zip64 archive' }
$dir = if ($dirAt -ge $length - $tailLen) {
$from = [int]($dirAt - ($length - $tailLen)); , $tail[$from..($from + $dirSize - 1)]
} else { Get-Range $real $dirAt ($dirAt + $dirSize - 1) }
$got = 0
$at = 0
while ($at + 46 -le $dir.Length -and [BitConverter]::ToUInt32($dir, $at) -eq 0x02014b50) {
$method = [BitConverter]::ToUInt16($dir, $at + 10)
$packed = [BitConverter]::ToUInt32($dir, $at + 20)
$size = [BitConverter]::ToUInt32($dir, $at + 24)
$nameLen = [BitConverter]::ToUInt16($dir, $at + 28)
$extraLen = [BitConverter]::ToUInt16($dir, $at + 30)
$noteLen = [BitConverter]::ToUInt16($dir, $at + 32)
$headerAt = [BitConverter]::ToUInt32($dir, $at + 42)
$name = [Text.Encoding]::UTF8.GetString($dir, $at + 46, $nameLen)
$at += 46 + $nameLen + $extraLen + $noteLen
if ($name -notmatch $Want) { continue }
# The file's own header (its extra field may be longer than the directory's), then its bytes.
$piece = Get-Range $real $headerAt ($headerAt + 30 + $nameLen + 2048 + $packed - 1)
if ([BitConverter]::ToUInt32($piece, 0) -ne 0x04034b50) { throw "no file header for $name" }
$dataAt = 30 + [BitConverter]::ToUInt16($piece, 26) + [BitConverter]::ToUInt16($piece, 28)
if ($dataAt + $packed -gt $piece.Length) { throw "the header of $name is longer than expected" }
$bytes = if ($method -eq 0) { , $piece[$dataAt..($dataAt + $packed - 1)] }
elseif ($method -eq 8) {
$in = [IO.MemoryStream]::new($piece, $dataAt, [int]$packed)
$z = [IO.Compression.DeflateStream]::new($in, [IO.Compression.CompressionMode]::Decompress)
$out = [IO.MemoryStream]::new(); $z.CopyTo($out); $z.Close(); , $out.ToArray()
} else { throw "$name is packed in a way this script does not know ($method)" }
if ($bytes.Length -ne $size) { throw "$name came out $($bytes.Length) bytes long, not $size" }
$rel = ($name -replace '^.*?(?=(bin/x64/|license\.txt$))', '') -replace '/', '\'
$to = Join-Path $Into $rel
New-Item -ItemType Directory -Force (Split-Path $to) | Out-Null
[IO.File]::WriteAllBytes($to, $bytes)
Write-Host (" {0} {1:N1} MB" -f $rel, ($size / 1MB))
$got++
}
$got
}
# DLSS: the library the build links (4 MB) and the DLL the game loads (56 MB), each at NVIDIA's release tag.
$dlss = Join-Path $sdk 'DLSS'
$raw = "https://raw.githubusercontent.com/NVIDIA/DLSS/$DlssTag"
$files = @('LICENSE.txt', 'lib/Windows_x86_64/x64/nvsdk_ngx_d.lib', 'lib/Windows_x86_64/rel/nvngx_dlss.dll')
Write-Host "NVIDIA DLSS $DlssTag from github.com/NVIDIA/DLSS (about 60 MB):"
foreach ($f in $files) {
$to = Join-Path $dlss ($f -replace '/', '\')
if (Test-Path $to) { Write-Host " $f is there already"; continue }
Write-Host " $f"
Get-File "$raw/$f" $to
}
Write-Host " NVIDIA's licence for these: $(Join-Path $dlss 'LICENSE.txt')"
# Frame generation: Streamline's five DLLs (3 MB, taken out of NVIDIA's 263 MB release archive without
# downloading the rest) and the frame generation model (7 MB, from the DLSS repository).
if (-not $NoStreamline) {
$sl = Join-Path $sdk 'Streamline'
$bin = Join-Path $sl 'bin\x64'
Write-Host "NVIDIA Streamline $StreamlineTag from github.com/NVIDIA-RTX/Streamline (about 10 MB):"
if (Test-Path (Join-Path $bin 'sl.interposer.dll')) {
Write-Host ' the Streamline DLLs are there already'
} else {
$url = "https://github.com/NVIDIA-RTX/Streamline/releases/download/$StreamlineTag/streamline-sdk-$StreamlineTag.zip"
$want = '(^|/)bin/x64/(sl\.(interposer|common|dlss_g|reflex|pcl)\.dll|[^/]*license[^/]*\.txt)$|^([^/]+/)?license\.txt$'
$got = 0
try { $got = Get-FromZip $url $want $sl }
catch { Write-Host " Taking the files out of the archive in place did not work ($($_.Exception.Message))." }
if (-not (Test-Path (Join-Path $bin 'sl.interposer.dll'))) {
# The whole archive then (263 MB).
Write-Host ' Getting the whole archive instead (263 MB) ...'
$zip = Join-Path $sdk "streamline-sdk-$StreamlineTag.zip"
Get-File $url $zip
$into = Join-Path $sdk 'streamline-unpacked'
Expand-Archive -Path $zip -DestinationPath $into -Force -ErrorAction Stop
$found = Get-ChildItem $into -Recurse -Filter 'sl.interposer.dll' |
Where-Object { $_.FullName -match '\\bin\\x64\\sl\.interposer\.dll$' -and $_.FullName -notmatch '\\development\\' } |
Select-Object -First 1
if (-not $found) { throw 'The Streamline archive has no bin\x64\sl.interposer.dll.' }
$top = Split-Path (Split-Path (Split-Path $found.FullName))
New-Item -ItemType Directory -Force $bin | Out-Null
Get-ChildItem (Join-Path $top 'bin\x64') -File |
Where-Object { $_.Name -match '^(sl\.(interposer|common|dlss_g|reflex|pcl)\.dll|.*license.*\.txt)$' } |
Copy-Item -Destination $bin -Force
Copy-Item (Join-Path $top 'license.txt') $sl -Force -ErrorAction SilentlyContinue
Remove-Item $into -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item $zip -Force
}
}
$model = Join-Path $bin 'nvngx_dlssg.dll'
if (Test-Path $model) { Write-Host ' nvngx_dlssg.dll is there already' }
else { Write-Host ' nvngx_dlssg.dll'; Get-File "$raw/lib/Windows_x86_64/rel/nvngx_dlssg.dll" $model }
Write-Host " licences: $(Join-Path $sl 'license.txt') (Streamline) and NVIDIA's DLSS licence above (nvngx_dlssg.dll)"
}
Write-Host ''
Write-Host 'Done. The next start of scripts\play-nvidia.ps1 builds the layer with DLSS (about a minute) and uses it.'
+166 -63
View File
@@ -1,17 +1,28 @@
# Starts the title on an NVIDIA card with the Series S settings measured on an RTX 5070 (about 18-22 fps, no device loss).
# Starts the title on an NVIDIA card: Series S, the game's own 720p picture taken to 1080p by DLSS, the F1
# settings menu in the game (measured on an RTX 5070: about 15-17 fps before generated frames).
# scripts\play-nvidia.ps1 -Exe <path of your own copy's executable>
# DLSS and DLSS frame generation need a few NVIDIA files (about 70 MB) that this repository does not carry:
# run Get-NVIDIA-DLSS.cmd in the repository's folder once, and they are fetched from NVIDIA's GitHub into
# nvidia-sdk\. Without them the game runs with its picture stretched to the screen instead.
# The layer is built here if it is not built yet, and built again with DLSS once those files are there.
# In the game: F1 = settings (arrows pick and change, Enter saves; kept in victory-settings.txt next to this
# folder), F3 = the numbers panel.
# -NoSmoothMotion run target\<build>\victory.exe itself. By default a copy named victory_sm.exe is started instead,
# so a Smooth Motion profile set for that exe in the NVIDIA App applies every time.
# -SeriesX the Series X profile instead (slower: about 7 fps at half scale)
# -Quality fewer stretched/jumping bodies and less rainbow skin, at about 13 fps instead of about 20
# -RayTracing keep the title's ray-tracing passes (off by default: see below)
# -Resolution the height the game renders at before the title's own upscaler: 2160, 1440, 1080, 720, 540 or 480.
# Series S outputs 1080p (so up to 1080 there), Series X 2160p. Default: half the output (540 on S,
# 1080 on X). The play-S-*.ps1 and play-X-*.ps1 scripts next to this one call it with each.
# -NoDlss no DLSS: the picture is stretched (fast, softer)
# -SeriesX the Series X profile instead (much slower; no DLSS there)
# -Quality fewer stretched/jumping bodies, slower (relay stage 1, no card steps)
# -RayTracing the title's real ray tracing (the structure builder runs). Shaders build for minutes the
# first time, and DLSS frame generation is left off with it (the two together do not work yet).
# -Resolution the older path: the game renders at this height (2160, 1440, 1080, 720, 540 or 480) and the
# title's own upscaler does the rest, without DLSS. The play-S-*.ps1 and play-X-*.ps1 scripts use it.
# -Adapter on a PC with more than one card, the one to use: part of its name (-Adapter 5060) or its index
# (-Adapter '#1'). Default: Windows' default card (the one the main display is on).
# (-Adapter '#1'). Default: Windows' default card.
# -Build target\diag (the default, the build all measurements are of) or target\release
# (the release build ignores the ray-tracing skip list: VICTORY_SKIP_PIPELINES is a diagnostics switch)
# -DlssDir the folder with nvngx_dlss.dll, if not nvidia-sdk\DLSS\lib\Windows_x86_64\rel
# -StreamlineDir the folder with sl.interposer.dll (frame generation), if not nvidia-sdk\Streamline\bin\x64
# -Log the layer's log goes to a file in %LOCALAPPDATA%\VIctory\logs instead of this window
# -Capture F9 in the game saves that frame and the pictures it drew, in %LOCALAPPDATA%\VIctory\captures
# -WindowsBarMB maximum MiB of title memory windows in CPU-mapped VRAM (by default 3072 on PCs with under
# 24 GB of RAM, else 0; -WindowsBarMB 0 turns it off).
# -More other settings: -More @{VICTORY_PANEL='1'}
@@ -19,70 +30,90 @@
param(
[Parameter(Mandatory)][string]$Exe,
[switch]$NoSmoothMotion,
[switch]$NoDlss,
[switch]$SeriesX,
[switch]$Quality,
[switch]$RayTracing,
[ValidateSet('2160', '1440', '1080', '720', '540', '480')][string]$Resolution,
[string]$Adapter,
[ValidateSet('diag', 'release')][string]$Build = 'diag',
[string]$DlssDir,
[string]$StreamlineDir,
[switch]$Log,
[switch]$Capture,
[hashtable]$More = @{},
[uint32]$WindowsBarMB
)
$root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
if (-not (Test-Path $Exe)) { Write-Host "No $Exe."; return }
$Exe = (Resolve-Path $Exe).Path
# NVIDIA's own files: where they are (Get-NVIDIA-DLSS.cmd puts them in nvidia-sdk\). Nothing is downloaded here.
if (-not $DlssDir) { $DlssDir = $env:VICTORY_DLSS_DIR }
if (-not $StreamlineDir) { $StreamlineDir = $env:VICTORY_STREAMLINE_DIR }
$sdkDlss = Join-Path $root 'nvidia-sdk\DLSS'
$sdkDlssLib = Join-Path $sdkDlss 'lib\Windows_x86_64\x64\nvsdk_ngx_d.lib'
$sdkStreamline = Join-Path $root 'nvidia-sdk\Streamline\bin\x64'
$wantDlss = -not $NoDlss -and -not $SeriesX -and -not $Resolution
if (-not $DlssDir -and (Test-Path (Join-Path $sdkDlss 'lib\Windows_x86_64\rel\nvngx_dlss.dll'))) { $DlssDir = Join-Path $sdkDlss 'lib\Windows_x86_64\rel' }
if (-not $StreamlineDir -and (Test-Path (Join-Path $sdkStreamline 'sl.interposer.dll'))) { $StreamlineDir = $sdkStreamline }
if ($wantDlss -and -not $DlssDir) {
Write-Host 'No DLSS files here: the picture is stretched to the screen instead. Get-NVIDIA-DLSS.cmd (in the'
Write-Host "repository's folder) fetches them from NVIDIA once, about 70 MB, with frame generation's."
}
# The build: made here if there is none, and made again with DLSS once its SDK is there (the diag build only).
$victory = Join-Path $root "target\$Build\victory.exe"
$built = Join-Path $root "target\$Build\built-with.txt"
$hasDlss = (Test-Path $built) -and ((Get-Content $built -Raw) -match 'dlss')
$canDlss = $wantDlss -and (Test-Path $sdkDlssLib)
if ($Build -eq 'diag' -and (-not (Test-Path $victory) -or ($canDlss -and -not $hasDlss -and (Test-Path $built)))) {
if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) { Write-Host 'No build and no cargo: install Rust (README.md), then start this again.'; return }
Write-Host 'Building the layer (a few minutes the first time) ...'
& (Join-Path $PSScriptRoot 'build-nvidia.ps1')
$hasDlss = (Test-Path $built) -and ((Get-Content $built -Raw) -match 'dlss')
}
if (-not (Test-Path $victory)) { Write-Host "No $victory. Build it first (scripts\build-nvidia.ps1)."; return }
# A build nobody noted the making of (cargo by hand) is taken at its word: with DLSS if the files are there.
$dlss = $wantDlss -and $DlssDir -and ($hasDlss -or -not (Test-Path $built))
$settings = @{
# This fork's play set (scripts\play.ps1, not -Safe): the speed set.
VICTORY_TEXTURE_NO_WAIT = '1'; VICTORY_RELAY = '2'; VICTORY_CARD_STEPS = '2'
# The play set. Textures are waited for: one loaded once at the start could stay empty for the run otherwise.
VICTORY_TEXTURE_NO_WAIT = '0'; VICTORY_RELAY = '2'; VICTORY_CARD_STEPS = '2'
VICTORY_WIDE_BACK = '1'; VICTORY_CARD_REHASH_RUNS = '1'
VICTORY_JOIN_COPIES = '1'; VICTORY_INDIRECT_WINDOW = '1'; VICTORY_RELAY_COPY = '1'
# Copy-backs caught half-written are fetched again (torn.rs).
VICTORY_FETCH_CHECK = '1'
VICTORY_INDIRECT_BATCH = '2'; VICTORY_MAP_THREADS = '1'; VICTORY_TITLE_PRIORITIES = '0'; VICTORY_CARD_AWAKE = '1'
VICTORY_SHOW_AFTER = '1'; VICTORY_AMBIENT = '0.8'; VICTORY_D3D12_DRED = 'light'; VICTORY_SKIP_PIPELINES = 'none'
# The renderer's light stand-in is off (its coarse estimate made indoor light blotchy).
VICTORY_SHOW_AFTER = '1'; VICTORY_AMBIENT = '0'; VICTORY_D3D12_DRED = 'light'
VICTORY_THIN = '1'; VICTORY_JOIN_PARTS = '8'; VICTORY_UPLOAD_AHEAD = '1'
# Cheap picture fixes, on in both sets:
# - Overbright views: without rays the light probes keep the sky's light indoors. The fog is bounded by 1.5 times
# the light around, and what the title left by 2 times the estimate (was 4; ambient.rs).
VICTORY_AMBIENT_AIR = '1.5'; VICTORY_AMBIENT_MOST = '2'
# - Black blobs: a NaN a shader writes is made 0 before blur and the temporal upscaler spread it (emit/lower.rs).
VICTORY_NAN_SCRUB = '1'
# Wait for new shaders rather than skip their draws (a hitch the first time a place is seen). Each pipeline is
# waited for at most once (VICTORY_PIPELINE_WAIT_ONCE, on by default): one that takes longer no longer stops the
# picture in every frame it is in view (pipeline/make.rs).
# Fog bounded by 1.5 times the light around; a NaN a shader writes is made 0 before blur and the upscaler spread it.
VICTORY_AMBIENT_AIR = '1.5'; VICTORY_NAN_SCRUB = '1'
# Wait for new shaders rather than skip their draws (each pipeline is waited for at most once). The F1 menu's
# SHADER WAIT MS changes it: 0 never waits, things then show up as their shaders are done.
VICTORY_PIPELINE_WAIT_MS = '10000'
# NVIDIA caps the shader-visible view heap at 1,000,000: without more dynamic slots thousands of draws a frame
# are dropped (descriptor/host.rs dynamic_slots).
VICTORY_DYNAMIC_SLOTS = '524288'
# Half render scale with the title's own upscaler (Series S needs it with a scale below 1; victory-loader hooks.rs).
VICTORY_RENDER_SCALE = '0.5'; VICTORY_OWN_UPSCALER = '1'
# Ray walks end at the root while the structure builder is off (emit/intersect.rs).
VICTORY_BVH_MISS = '1'
# Memory compares on the card instead of the CPU: 11 -> about 22 fps on Series S.
# Memory compares on the card instead of the CPU.
VICTORY_CARD_BUFFERS_MIN_MB = '1'; VICTORY_CARD_BUFFERS_MB = '1536'
# Series S presents the interface as a second plane: laid over the game (compose.rs), else black before gameplay.
VICTORY_COMPOSE = '1'
}
# Ray tracing mostly off. The structure builder cannot run on NVIDIA (its 64-lane programs are refused; upstream
# Marvisak/VIctory pull request 2311), so every ray misses, and the passes that turn misses into light made rooms go
# white depending on the view angle. rt_off_hashes.txt lists the 1,000 CS_RaytracingResolve and 34 traced-shadow
# shaders, which are skipped. The screen-probe and visibility traces keep running: skipping those too left their
# outputs as garbage (rainbow glitter everywhere).
$rtList = Join-Path $PSScriptRoot 'rt_off_hashes.txt'
if (-not $RayTracing -and (Test-Path $rtList)) {
$settings.VICTORY_SKIP_PIPELINES = (Get-Content $rtList -Raw).Trim()
}
if ($Quality) {
# Stretched/jumping bodies: relay stage 1 and no card steps (avatarmanz/VIctory-7900XTX issue 13,
# fxceless/victory-fork issue 89). Rainbow skin: texture refreshes wait for the runtime's remapping.
# Costs about 7 fps (the submitting thread waits about 30 ms a frame for the card).
$settings.VICTORY_RELAY = '1'; $settings.VICTORY_CARD_STEPS = '0'; $settings.VICTORY_TEXTURE_NO_WAIT = '0'
}
# The render scale is the rendered height over the output height (Series S 1080, Series X 2160).
$outHeight = if ($SeriesX) { 2160 } else { 1080 }
$console = if ($SeriesX) { 'X' } else { 'S' }
$console = if ($SeriesX) { 'series-x' } else { 'series-s' }
if ($Resolution) {
if ([int]$Resolution -gt $outHeight) {
Write-Host "Series $console outputs ${outHeight}p: ${Resolution}p is above it."
return
}
# The older path: a render scale and the title's own upscaler (rendered height over output height).
$outHeight = if ($SeriesX) { 2160 } else { 1080 }
if ([int]$Resolution -gt $outHeight) { Write-Host "That console outputs ${outHeight}p: ${Resolution}p is above it."; return }
$settings.VICTORY_RENDER_SCALE = ([int]$Resolution / $outHeight).ToString('0.####', [Globalization.CultureInfo]::InvariantCulture)
$settings.VICTORY_OWN_UPSCALER = '1'
} elseif ($dlss) {
$settings.VICTORY_UPSCALE = 'dlss'; $settings.VICTORY_DLSS_DIR = $DlssDir
} elseif (-not $SeriesX) {
$settings.VICTORY_UPSCALE = 'stretch'
}
if ($StreamlineDir) { $settings.VICTORY_STREAMLINE_DIR = $StreamlineDir }
if ($Quality) { $settings.VICTORY_RELAY = '1'; $settings.VICTORY_CARD_STEPS = '0' }
if ($RayTracing) { $settings.VICTORY_BVH_BUILDER = '1' }
if ($Adapter) { $settings.VICTORY_ADAPTER = $Adapter }
if ($PSBoundParameters.ContainsKey('WindowsBarMB')) {
$settings.VICTORY_WINDOWS_BAR_MB = $WindowsBarMB.ToString([Globalization.CultureInfo]::InvariantCulture)
@@ -96,27 +127,99 @@ if ($PSBoundParameters.ContainsKey('WindowsBarMB')) {
Write-Host "$([math]::Round($ram / 1GB)) GB of RAM: title memory windows in the card's memory the CPU maps, up to 3 GB (-WindowsBarMB 0 turns this off)"
}
}
foreach ($k in $More.Keys) { $settings[$k] = $More[$k] }
$scale = [double]::Parse($settings.VICTORY_RENDER_SCALE, [Globalization.CultureInfo]::InvariantCulture)
Write-Host "Series $console, rendering at $([int]($outHeight * $scale))p (render scale $($settings.VICTORY_RENDER_SCALE))"
$victory = Join-Path $PSScriptRoot "..\target\$Build\victory.exe"
if (-not (Test-Path $victory)) { Write-Host "No $victory. Build it first (README.md)."; return }
if (-not (Test-Path $Exe)) { Write-Host "No $Exe."; return }
if (-not $NoSmoothMotion) {
# What the F1 menu saved (victory-settings.txt, git-ignored), over the settings above. An empty value unsets one.
$menuFile = Join-Path $root 'victory-settings.txt'
$smooth = -not $NoSmoothMotion
if (Test-Path $menuFile) {
foreach ($line in Get-Content $menuFile) {
if ($line -notmatch '^\s*(VICTORY_[A-Z0-9_]+)\s*=(.*)$') { continue }
$k = $Matches[1]; $v = $Matches[2].Trim()
if ($k -eq 'VICTORY_MENU_SMOOTH_MOTION') { $smooth = $v -ne '0'; continue }
if ($k -eq 'VICTORY_MENU_CONSOLE') { if ($v) { $console = $v }; continue }
if ($v) { $settings[$k] = $v } else { $settings.Remove($k) }
}
}
foreach ($k in $More.Keys) { $settings[$k] = $More[$k] }
# DLSS only where it can be: a menu choice of it without the files or the build falls back to the stretch.
if ($settings.VICTORY_UPSCALE -eq 'dlss' -and -not $dlss) { $settings.VICTORY_UPSCALE = 'stretch' }
# DLSS frame generation and real ray tracing do not work together yet (0.1 frames a second): with ray tracing
# on, frame generation is left off and Smooth Motion can do the extra frames.
if ($settings.VICTORY_BVH_BUILDER -eq '1' -and $settings.VICTORY_FRAME_GEN -and $settings.VICTORY_FG_WITH_RT -ne '1') {
Write-Host 'Ray tracing is on: DLSS frame generation is left off (the two together do not work yet).'
$settings.Remove('VICTORY_FRAME_GEN')
}
if ($settings.VICTORY_FRAME_GEN -and -not $StreamlineDir) {
Write-Host 'Frame generation needs the Streamline files (Get-NVIDIA-DLSS.cmd): left off.'
$settings.Remove('VICTORY_FRAME_GEN')
}
# Smooth Motion is a second frame generator: off while DLSS frame generation is on.
if ($settings.VICTORY_FRAME_GEN -and $settings.VICTORY_FRAME_GEN -ne '1') { $smooth = $false }
# For the menu: what it shows as the current values, where it saves, and how it starts the game again.
$settings.VICTORY_MENU_SMOOTH_MOTION = if ($smooth) { '1' } else { '0' }
$settings.VICTORY_MENU_CONSOLE = $console
$settings.VICTORY_MENU_FILE = $menuFile
$settings.VICTORY_MENU_PLAY = $MyInvocation.MyCommand.Path
$again = @("-Exe '$($Exe -replace "'", "''")'", "-Build $Build")
foreach ($s in 'NoSmoothMotion', 'NoDlss', 'SeriesX', 'Quality', 'RayTracing', 'Log', 'Capture') {
if ($PSBoundParameters[$s]) { $again += "-$s" }
}
foreach ($s in 'Resolution', 'Adapter', 'DlssDir', 'StreamlineDir') {
if ($PSBoundParameters[$s]) { $again += "-$s '$($PSBoundParameters[$s] -replace "'", "''")'" }
}
if ($PSBoundParameters.ContainsKey('WindowsBarMB')) { $again += "-WindowsBarMB $WindowsBarMB" }
$settings.VICTORY_MENU_ARGS = $again -join ' '
$picture = if ($settings.VICTORY_RENDER_SCALE) { "render scale $($settings.VICTORY_RENDER_SCALE), the title's upscaler" }
elseif ($settings.VICTORY_UPSCALE -eq 'dlss') { 'DLSS' }
elseif ($settings.VICTORY_UPSCALE -eq 'stretch') { 'stretched (no DLSS)' }
else { "the title's upscaler" }
$extras = ''
if ($settings.VICTORY_FRAME_GEN) { $extras += ", frame generation $($settings.VICTORY_FRAME_GEN)x" }
if ($settings.VICTORY_BVH_BUILDER -eq '1') { $extras += ', ray tracing' }
Write-Host "Series $(if ($console -eq 'series-x') { 'X' } else { 'S' }), $picture$extras. F1 in the game: settings."
if ($smooth) {
# A copy under the name the NVIDIA App's Smooth Motion profile is set for, refreshed when the build changes.
$sm = Join-Path (Split-Path $victory) 'victory_sm.exe'
if (-not (Test-Path $sm) -or (Get-Item $sm).LastWriteTime -lt (Get-Item $victory).LastWriteTime) {
Copy-Item $victory $sm -Force
try { Copy-Item $victory $sm -Force -ErrorAction Stop }
catch {
# Still held by a game that has not quite gone: Windows lets it be renamed out of the way.
Rename-Item $sm "victory_sm.exe.old-$(Get-Date -Format HHmmss)" -ErrorAction SilentlyContinue
Copy-Item $victory $sm -Force
}
}
$victory = $sm
}
Get-ChildItem (Join-Path (Split-Path $victory) '*.old-*') -ErrorAction SilentlyContinue | Remove-Item -ErrorAction SilentlyContinue
# (Other settings left over in this window go; where your files are stays.)
$paths = 'VICTORY_CONFIG', 'VICTORY_GAME_DIR', 'VICTORY_CACHE_DIR', 'VICTORY_DATA_DIR'
Get-ChildItem Env:VICTORY_* | Where-Object { $_.Name -notin $paths } | ForEach-Object { Remove-Item "Env:$($_.Name)" }
foreach ($k in $settings.Keys) { Set-Item "Env:$k" $settings[$k] }
$Exe = (Resolve-Path $Exe).Path
$runArgs = @('run', $Exe, '--execute')
if (-not $SeriesX) { $runArgs += @('--console', 'series-s') }
Push-Location (Join-Path $PSScriptRoot '..') # victory.toml is looked for here
try { & $victory @runArgs } finally { Pop-Location }
# A shader cache of its own: one an earlier version of this fork filled does not fit this renderer's pipelines.
$toml = Join-Path $root 'victory.toml'
if (-not $env:VICTORY_CACHE_DIR -and -not ((Test-Path $toml) -and (Select-String -Path $toml -Pattern '^\s*cache_dir\s*=' -Quiet))) {
$env:VICTORY_CACHE_DIR = Join-Path $env:LOCALAPPDATA 'VIctory\cache-nvidia-2'
}
$stamp = Get-Date -Format 'MMdd-HHmmss'
if ($Capture) {
$env:VICTORY_CAPTURE = Join-Path $env:LOCALAPPDATA "VIctory\captures\$stamp"
$env:VICTORY_DUMP_TARGETS = '1'
New-Item -ItemType Directory -Force $env:VICTORY_CAPTURE | Out-Null
Write-Host "F9 saves a frame to $env:VICTORY_CAPTURE"
}
$runArgs = @('run', "`"$Exe`"", '--execute', '--console', $console)
Push-Location $root # victory.toml is looked for here
try {
if ($Log) {
$logs = Join-Path $env:LOCALAPPDATA 'VIctory\logs'
New-Item -ItemType Directory -Force $logs | Out-Null
Get-ChildItem $logs -Filter 'play-*.log' | Sort-Object LastWriteTime -Descending | Select-Object -Skip 4 | Remove-Item -ErrorAction SilentlyContinue
Write-Host "log: $logs\play-$stamp.log"
Start-Process -FilePath $victory -ArgumentList $runArgs -NoNewWindow -Wait -RedirectStandardError "$logs\play-$stamp.log"
} else {
Start-Process -FilePath $victory -ArgumentList $runArgs -NoNewWindow -Wait
}
} finally { Pop-Location }