Source launcher is scripts\play-nvidia.ps1 (was play-foxhound.ps1); the Steam helper exe is gone, Steam starts victory.exe play; the launcher sets play's shader-key defaults so a preloaded cache is hit (#4067)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
trustno1-coder
2026-11-30 08:17:39 -08:00
parent 5baad7e316
commit 84bd61e2c7
17 changed files with 492 additions and 782 deletions

2
.gitignore vendored
View File

@ -13,8 +13,6 @@
# Local configuration (contains paths to YOUR files)
/victory.toml
# What scripts\play-foxhound.exe is given when started with no arguments (Steam's "Play")
/scripts/play-args.txt
# Places people tend to drop data into. Keep data outside the repo instead.
/game/

View File

@ -62,7 +62,7 @@ cargo xtask install-hooks # git config core.hooksPath .githooks
Narrower checks while iterating: `cargo test -p victory-shader --lib`, `cargo test -p victory-gpu`, `cargo clippy -p victory-gpu --all-targets -- -D warnings`. There is **no `cargo fmt` gate** anywhere (CI, hook, docs), and the tree is far from rustfmt-clean: `cargo fmt --all -- --check` reports 3777 diff hunks, starting in `apps/victory/src/main.rs:73`. Never run `cargo fmt` here, and do not reformat lines you did not otherwise change.
Running a title: `victory run <exe> --console series-s|series-x --execute`, or the launchers `scripts\play-foxhound.ps1 -Exe <exe>` (`play-nvidia.ps1` is the same script under its old name) and `PLAY_FRAMEGEN.cmd`.
Running a title: `victory run <exe> --console series-s|series-x --execute`, or the launchers `scripts\play-nvidia.ps1 -Exe <exe>` and `PLAY_FRAMEGEN.cmd`.
## Code Conventions & Common Patterns

View File

@ -72,7 +72,7 @@ bindings file keeps the gamepad pictures.
SDK, `D3D12Core.dll`, about 22 MB from nuget.org). It goes into a `D3D12`
folder beside `victory.exe`. `victory.exe get-d3d12` does the same by hand,
`Get-D3D12.cmd` does it for a build of your own (into `target\release\D3D12`),
and `scripts\play-foxhound.ps1` (with `play-nvidia.ps1` and `PLAY_FRAMEGEN.cmd`)
and `scripts\play-nvidia.ps1` (and `PLAY_FRAMEGEN.cmd`)
runs it when that folder is missing and no device runs shader model 6.6.
The file is checked against Microsoft's signature and the tested SHA-256.
Windows 11 keeps using its own runtime. A `D3D12` folder that is already
@ -114,7 +114,7 @@ bindings file keeps the gamepad pictures.
checked against the SHA-256 its author published) into
`%LOCALAPPDATA%\victory\mfg-unlocker`, and every start loads it. Nothing is
renamed or copied. The script launcher loads it too
(`scripts\play-foxhound.ps1`, and Steam through it): before, only
(`scripts\play-nvidia.ps1`, and Steam through it): before, only
`victory play` did, so a start from the script carried the switch and no mod.
What it unlocks is DLSS frame generation, so **DLSS has to be on and FRAME
GENERATION at 2X or more**; with frame generation off, or FSR 3 picked, the
@ -249,45 +249,27 @@ first start builds the layer, which takes a few minutes.
**Starting it through Steam (controller support)**
Steam's *Add a Non-Steam Game* browser lists `.exe` files only, so
`play-foxhound.ps1` cannot be picked there — and a game started outside Steam
gets neither Steam's overlay nor Steam Input, which is what a Stadia controller
needs (over Bluetooth it is a generic HID pad, not XInput, and Steam Input is
what turns it into the virtual Xbox pad the title reads).
A game started outside Steam gets neither Steam's overlay nor Steam Input,
which is what a Stadia controller needs (over Bluetooth it is a generic HID
pad, not XInput, and Steam Input is what turns it into the virtual Xbox pad the
title reads). Steam starts `victory.exe` itself:
`scripts\play-foxhound.exe` is that script as a program Steam takes: it starts
Windows PowerShell with `play-foxhound.ps1` beside it and hands every argument
on, so the launch options are the script's own.
1. Steam, **Games → Add a Non-Steam Game → Browse** → your `victory.exe`
(`target\release\victory.exe` after a build, or the release's), then
**Add Selected Programs**. Rename it if you like (right-click, Properties).
1. Build it once (Rust is needed for this repository anyway):
```powershell
scripts\build-steam-launcher.cmd
```
2. Steam, **Games → Add a Non-Steam Game → Browse** → the
`scripts\play-foxhound.exe` that step 1 built, then **Add Selected
Programs**. Rename it if you like (right-click, Properties).
3. Right-click it, **Properties → Launch Options**, and put the path of **your
own** `game_scarlett_master.exe` there — nothing else:
2. Right-click it, **Properties → Launch Options**, and put `play` and the path
of **your own** `game_scarlett_master.exe` there:
```
"D:\Games\MyDump\game_scarlett_master.exe"
play "D:\Games\MyDump\game_scarlett_master.exe"
```
A first argument that is not a switch is taken as the title and gets `-Exe`
in front of it; the script's options work as well, e.g.
`"D:\Games\MyDump\game_scarlett_master.exe" -FrameGen -Dlss balanced`.
Or write the same lines into `scripts\play-args.txt` (one argument a line,
`#` for comments) and leave the launch options empty.
Switches go after it as `--set NAME=VALUE`, e.g.
`play "D:\Games\MyDump\game_scarlett_master.exe" --set VICTORY_AMBIENT=0.8`.
A `victory.exe` beside `game_scarlett_master.exe` needs no launch options.
Switches the script takes through `-More` work here too, as `NAME=VALUE`
(a hashtable cannot be written on a command line): several of them
comma-separated, in one argument —
`-More VICTORY_GAMEPAD_LOG=1,VICTORY_AMBIENT=0.8`. `NAME=` unsets a switch.
4. Controllers: Steam, **Settings → Controller** — turn on **Steam Input for
3. Controllers: Steam, **Settings → Controller** — turn on **Steam Input for
Xbox/PlayStation controllers** and **Generic Gamepad Configuration Support**
(a Stadia controller is a generic pad, so that second one is what makes
Steam Input answer for it). Start the game from Steam and, in its controller
@ -299,7 +281,7 @@ on, so the launch options are the script's own.
and check under Settings → Controller that Steam lists it.
If nothing answers in the game, start it once with
`... -More VICTORY_GAMEPAD_LOG=1`: the log
`... --set VICTORY_GAMEPAD_LOG=1`: the log
(`%LOCALAPPDATA%\victory\logs`, the file the console names on its `Log:`
line) then says, per pad slot, which XInput path answered and what the pad
sent, or that no pad answered it at all.
@ -457,7 +439,7 @@ On 2026-11-26 this fork moved onto
twice the frame rate of what this fork had, at a higher resolution, so its
tree is now this one's, with its history kept, and this fork's own additions
are on top. What foxhound is and how it got there is in its own README, kept as
[docs/README-foxhound.md](docs/README-foxhound.md); its measurements are in
[docs/README-nvidia.md](docs/README-nvidia.md); its measurements are in
[docs/findings.md](docs/findings.md).
What foxhound brings:
@ -540,8 +522,7 @@ are saved beside them; this repository does not carry them and may not. Nothing
is downloaded unless you run that file; `VICTORY_STREAMLINE_DIR` names another
folder if you have the Streamline SDK already.
`scripts\play-nvidia.ps1` is `scripts\play-foxhound.ps1` under the name this
fork has always had; its options:
`scripts\play-nvidia.ps1` is the launcher for a build of your own; its options:
| Option | What |
|---|---|
@ -556,7 +537,7 @@ fork has always had; its options:
| `-Preload` | every shader and the pipelines of earlier runs made before the game starts (once per build or driver; what is done is kept), with a progress window over the title's own splash screen: the step, how far it is, about how long is left, and Skip (or Esc) to start the game at once |
| `-Splash <file or URL>` / `-NoPreloadWindow` | another picture behind the preload's window (a URL is fetched once into `%LOCALAPPDATA%\victory\splash`) / the preload's progress in the console only |
| `-Build diag` | the diagnostics build (slower; captures, timelines, recording time in the F3 panel) |
| `-More @{VICTORY_X='1'}`, `-More VICTORY_X=1` | add or override any switch (the second form where a hashtable cannot be written: Steam's launch options, `play-args.txt`) |
| `-More @{VICTORY_X='1'}`, `-More VICTORY_X=1` | add or override any switch (the second form where a hashtable cannot be written: PLAY_FRAMEGEN.cmd) |
The script reads F1 settings from `victory-settings.txt` in `VICTORY_HOME`
when set, or in the repository folder by default. Rename that file to restore
@ -577,7 +558,7 @@ to check memory on systems with 32 GB of RAM or GPUs with 8 GB of VRAM.
## How it works, and the findings
- [docs/README-foxhound.md](docs/README-foxhound.md): foxhound's own README
- [docs/README-nvidia.md](docs/README-nvidia.md): foxhound's own README
(set-up by hand, warming up, its switches).
- [docs/troubleshooting.md](docs/troubleshooting.md): common errors and what
to do about them.

View File

@ -11,7 +11,7 @@
//! Lines are written by a thread of their own: the thread that logs only
//! hands its formatted line over. Written where they were logged, every line
//! was a write to the console's pipe on that thread, which a launcher that
//! reads the pipe line by line (`play-foxhound.ps1`) held up when it fell
//! reads the pipe line by line (`play-nvidia.ps1`) held up when it fell
//! behind: the submitting thread and the title's threads stood in a log
//! call, and the frames' statistics, some eighty lines every five seconds,
//! were a hitch of 30-40 ms in every five-second window (RTX 5060 Laptop,

View File

@ -42,7 +42,7 @@
//! `cargo test -p victory-gpu --lib memory_bench_steady_state -- --ignored --nocapture`
//!
//! and the same with `VICTORY_RELAY=2 VICTORY_RELAY_COPY=1` for the relay's
//! paths (`scripts/play-foxhound.ps1` sets both). `VICTORY_MEMBENCH_STRICT=1`
//! paths (`scripts/play-nvidia.ps1` sets both). `VICTORY_MEMBENCH_STRICT=1`
//! also asserts that pressure lets go of what a spike made (the list pool,
//! spare scratch, fetch buffers).

View File

@ -14,7 +14,7 @@
//!
//! The settings are read once at start, so a change is saved at once (as well as by the save
//! lines) to the file
//! `VICTORY_MENU_FILE` names (`scripts\play-foxhound.ps1` sets it to
//! `VICTORY_MENU_FILE` names (`scripts\play-nvidia.ps1` sets it to
//! `victory-settings.txt` in the repository's folder and applies it at every
//! start) and takes effect at the next start; "SAVE AND RESTART" starts the
//! launcher again (`VICTORY_MENU_PLAY`, with `VICTORY_MENU_ARGS`) and ends

View File

@ -1,12 +1,12 @@
# foxhound
# VIctory-NVIDIA
A fork of [VIctory](https://github.com/Marvisak/VIctory), a compatibility layer that runs an Xbox Series title
natively on Windows from files **you** supply. foxhound is tuned for **NVIDIA RTX** GPUs: DLSS Super Resolution and
natively on Windows from files **you** supply. VIctory-NVIDIA is tuned for **NVIDIA RTX** GPUs: DLSS Super Resolution and
DLSS Frame Generation in place of the title's own upscaling, the Series X profile at a native 2560x1440, and fewer
stalls at scene cuts.
> **This repository contains no game files, code or assets.** You need your own legally obtained copy of the
> title. foxhound is not affiliated with or endorsed by the title's developer or publisher, nor by NVIDIA.
> title. VIctory-NVIDIA is not affiliated with or endorsed by the title's developer or publisher, nor by NVIDIA.
> See [docs/asset-policy.md](docs/asset-policy.md).
## Where it stands
@ -53,8 +53,8 @@ What is known to be wrong:
## Build
```powershell
git clone https://github.com/readmet3xt-lab/foxhound
cd foxhound
git clone https://github.com/trustno1-coder/VIctory-NVIDIA
cd VIctory-NVIDIA
cargo build --release --locked -p victory
```
@ -73,7 +73,7 @@ The diagnostics build (frame timelines, captures, GPU timing) is optional:
2. **DLSS (optional, recommended on RTX).** Download the Streamline SDK release from
<https://github.com/NVIDIA-RTX/Streamline/releases> (tested: `streamline-sdk-v2.14.16.zip`; it comes under
NVIDIA's RTX SDK license, which you accept yourself), unpack it **outside** the repository, and point foxhound
NVIDIA's RTX SDK license, which you accept yourself), unpack it **outside** the repository, and point VIctory-NVIDIA
at its `bin\x64` folder:
```powershell
@ -83,7 +83,7 @@ The diagnostics build (frame timelines, captures, GPU timing) is optional:
Check it without the title: `target\release\victory.exe upscaler-check --device` (and `--present` for Frame
Generation). Details: [docs/dlss.md](docs/dlss.md). Without Streamline the launcher runs without DLSS.
3. **Translate the shaders ahead** (a few minutes, once per new build of foxhound):
3. **Translate the shaders ahead** (a few minutes, once per new build of VIctory-NVIDIA):
```powershell
$env:VICTORY_HOST_WAVE = '32' # NVIDIA runs 32-lane waves; leave it out on AMD
@ -93,7 +93,7 @@ The diagnostics build (frame timelines, captures, GPU timing) is optional:
## Run
```powershell
.\scripts\play-foxhound.ps1 -Exe 'D:\Games\MyDump\game_scarlett_master.exe'
.\scripts\play-nvidia.ps1 -Exe 'D:\Games\MyDump\game_scarlett_master.exe'
```
| Option | What |
@ -126,7 +126,7 @@ The NVIDIA driver keeps its compiled pipelines **per program path**: a build run
## Switches worth knowing
Every `VICTORY_...` switch is described in a comment where the code reads it. The launcher's full set is in
`scripts/play-foxhound.ps1`; these are the ones foxhound added or changed:
`scripts/play-nvidia.ps1`; these are the ones VIctory-NVIDIA added or changed:
| Switch | Launcher | What |
|---|---|---|

View File

@ -1157,7 +1157,7 @@ code and long argument lists ask for a decision, not a rewrite.
## 11. Sources
In this repository: `README.md`, `docs/findings.md`,
`docs/windows-memory.md`, `docs/README-foxhound.md`,
`docs/windows-memory.md`, `docs/README-nvidia.md`,
`docs/README-fxceless.md`, `docs/replay.md`, and the comments of the files
named.

View File

@ -1,38 +0,0 @@
@echo off
rem Builds play-foxhound.exe: play-foxhound.ps1 as a program Steam will take.
rem Steam's "Add a Non-Steam Game" browser lists .exe files only, so the script cannot be
rem picked there; the program it builds starts PowerShell with that script and hands every
rem argument on, so Steam's launch options are the script's own (see play-steam.rs).
rem
rem scripts\build-steam-launcher.cmd
rem
rem Needs Rust (rustup.rs), which this repository needs anyway; nothing is downloaded and
rem no crate is used. Run it again after play-steam.rs changes.
setlocal EnableExtensions
pushd "%~dp0"
rem rustup's folder is not on every PATH (this repository is built from one that has it):
rem the shim there picks the toolchain of rust-toolchain.toml at the repository's root.
set "RUSTC="
for %%R in (rustc.exe) do if not defined RUSTC if exist "%%~$PATH:R" set "RUSTC=%%~$PATH:R"
if not defined RUSTC if exist "%USERPROFILE%\.cargo\bin\rustc.exe" set "RUSTC=%USERPROFILE%\.cargo\bin\rustc.exe"
if not defined RUSTC if exist "%CARGO_HOME%\bin\rustc.exe" set "RUSTC=%CARGO_HOME%\bin\rustc.exe"
if not defined RUSTC (
echo No rustc: install Rust from https://rustup.rs, then run this again.
popd
exit /b 1
)
"%RUSTC%" --edition 2021 -O -C strip=symbols -o play-foxhound.exe play-steam.rs
if errorlevel 1 (
echo The build failed; see the lines above.
popd
exit /b 1
)
echo Built "%~dp0play-foxhound.exe"
echo Point Steam at it: Add a Non-Steam Game, Browse, this file; then put the title's path
echo into the game's Launch Options, e.g.
echo "D:\Games\MyDump\game_scarlett_master.exe"
popd
exit /b 0

View File

@ -1,6 +1,6 @@
# Fetches the AMD files FSR 3 frame generation needs (about 30 MB) from AMD's own GitHub (the FidelityFX SDK,
# GPUOpen-LibrariesAndSDKs/FidelityFX-SDK) into a fidelityfx folder: by default amd-sdk\FidelityFX\bin here
# (git-ignored), where scripts\play-foxhound.ps1 looks for them; `victory get-fsr` names one under
# (git-ignored), where scripts\play-nvidia.ps1 looks for them; `victory get-fsr` names one under
# %LOCALAPPDATA%\victory. They are AMD's, under AMD's licence (saved beside them: read it); this repository does
# not carry them, so each person gets them from AMD directly. Each file is checked against the SHA-256 of the
# copy this fork was tested with, and the game loads them only with AMD's valid signature.

View File

@ -1,5 +1,5 @@
# Fetches the NVIDIA files DLSS and DLSS frame generation need (about 70 MB) from NVIDIA's own GitHub into
# nvidia-sdk\Streamline\bin\x64 here (git-ignored), where scripts\play-foxhound.ps1 looks for them. They are
# nvidia-sdk\Streamline\bin\x64 here (git-ignored), where scripts\play-nvidia.ps1 looks for them. 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.
# Nothing of NVIDIA's is needed to build the layer: the files are loaded when the game runs.

View File

@ -1,442 +0,0 @@
# Starts your own copy of the title on foxhound with the settings tested on an RTX 4070 SUPER (Series X profile,
# 2560x1440 output, DLSS Quality when NVIDIA Streamline is set up).
#
# .\scripts\play-foxhound.ps1 -Exe 'D:\MyDump\game_scarlett_master.exe'
# .\scripts\play-foxhound.ps1 -Exe ... -Dlss off the title's own upscaling, no DLSS
# .\scripts\play-foxhound.ps1 -Exe ... -Dlss balanced -FrameGen
# .\scripts\play-foxhound.ps1 -Exe ... -SeriesS Series S profile (1280x720 inside, faster, softer)
# .\scripts\play-foxhound.ps1 -Exe ... -Build diag diagnostics build (slower; captures, timelines)
# .\scripts\play-foxhound.ps1 -Exe ... -FrameGen -ForceMfg 3x DLSS frame generation on an RTX 40 through MFG Unlocker (a mod)
# .\scripts\play-foxhound.ps1 -Exe ... -FgType fsr4 -FrameGen AMD FSR 4 upscaling (quality) and FSR 4 frame generation (experimental)
# .\scripts\play-foxhound.ps1 -Exe ... -WarmUsed warm pipelines seen in earlier runs, then exit
# .\scripts\play-foxhound.ps1 -Exe ... -More @{VICTORY_AMBIENT_SPECULAR='0'} add or override switches
# .\scripts\play-foxhound.ps1 -Exe ... -Preload every shader and pipeline made first, with a progress
# window over the title's splash screen (-Splash <file or
# URL> for another picture, -NoPreloadWindow for none)
# .\scripts\play-foxhound.ps1 -Exe ... -Dlss off -NoMenu as asked here, whatever the F1 menu saved (measuring runs)
# .\scripts\play-foxhound.ps1 -Exe ... -More VICTORY_AMBIENT_SPECULAR=0 the same where a hashtable
# cannot be written (Steam's launch options); several pairs, comma-separated, in one -More
#
# In the game, F1 opens a settings menu (arrow keys pick and change, Enter does it). What it saves goes to
# victory-settings.txt under VICTORY_HOME, or in the repository folder by default. The script reads it at each start.
#
# Build first (README). Run from a normal window, not as administrator. Each run writes a log to
# the logs folder under VICTORY_HOME (default %LOCALAPPDATA%\victory).
# Every VICTORY_... switch is described in a comment where the code reads it.
param(
[Parameter(Mandatory)][string]$Exe,
[ValidateSet('diag', 'release')][string]$Build = 'release',
[switch]$SeriesS,
# 1440: output and scene 2560x1440 (Series X, the image is patched); 1080to1440: scene 1920x1080 upscaled by
# the title; 4k: the stock Series X output (3840x2160).
[ValidateSet('1440', '1080to1440', '4k')][string]$Res = '1440',
# DLSS Super Resolution in place of the title's upscaling; needs NVIDIA Streamline (README).
[ValidateSet('off', 'dlaa', 'quality', 'balanced', 'performance', 'ultraperformance')][string]$Dlss = 'quality',
# DLSS Frame Generation (RTX 40 or later, hardware-accelerated GPU scheduling on); needs DLSS.
[switch]$FrameGen,
# Frames shown for each one rendered with -FrameGen: 2 to 6 (more than 2 needs an RTX 50; the layer asks the
# driver how many this card does and gives no more).
[ValidateRange(2, 6)][int]$FrameGenX = 2,
# Frame generation is made ready at every start with Streamline, on or off, so that the F1 menu switches it
# and changes its amount while playing. Only with -FrameGenReady now: ready but off, Streamline's swap chain
# held this PC's frames at 14 a second (20 without), so frame generation off is off unless asked.
[switch]$FrameGenReady,
# (The default now; still taken.)
[switch]$NoFrameGenReady,
# Which frame generation: auto (DLSS Frame Generation where it runs, else AMD's FSR 3), dlss, or fsr (FSR 3
# even on an RTX 40/50; 2X only). FSR 3 needs AMD's FidelityFX DLLs (VICTORY_FIDELITYFX_DIR, else
# amd-sdk\FidelityFX\bin here, where Get-AMD-FSR.cmd puts them) and DLSS for the upscaling, on either console.
# fsr4 (experimental, as `victory play --fg-type fsr4`): AMD's PC upscaler in place of DLSS (FSR 4 on RDNA 4,
# VICTORY_PC_FSR), its scene at -Dlss's size (quality where -Dlss is off), and with -FrameGen FSR 4 frame
# generation (VICTORY_FSR_FRAMEGEN=4, 2X). Same DLLs.
[ValidateSet('auto', 'dlss', 'fsr', 'fsr4')][string]$FgType = 'auto',
# Frames begin every 1/Fps s whatever the title asks (it asks 1/30). 1000, the default: no cap, a frame
# begins as soon as the last is done. 30: the title's own rate.
[ValidateRange(1, 1000)][int]$Fps = 1000,
# -Fps also gives the title its own frame rate (VICTORY_FRAME_INTERVAL_MS), so that its simulation steps by the
# time that passed: with only our clock faster, each frame still moved game time 1/30 s and above 30 fps the game
# ran fast. -FixedStep: our clock alone (VICTORY_FRAME_INTERVAL_US), as before.
[switch]$FixedStep,
[switch]$ForceMfg,
# Every shader and the loading pipelines made first (`victory preload`), then the game; the F1 menu's
# PRELOAD SHADERS starts this again with it.
[switch]$Preload,
# The preload shows its progress in a window (scripts\preload-window.ps1) over the title's own splash screen
# (SplashScreenImage in MicrosoftGame.config beside -Exe), or over the picture -Splash names: a file, or an
# http(s) URL fetched once into %LOCALAPPDATA%\victory\splash. -NoPreloadWindow: in this window only.
[string]$Splash = '',
[switch]$NoPreloadWindow,
[switch]$WarmUsed,
# What the F1 menu saved (victory-settings.txt) is left out: this call's options stand. For runs
# that are compared with each other: a saved DLSS mode went over "-Dlss off" otherwise.
[switch]$NoMenu,
# Switches to add or override: a hashtable (`-More @{VICTORY_X='1'}`), or, where a hashtable
# cannot be written — Steam's launch options hand every argument over as it was typed, and
# anything else starting this with -File does too, and no parameter can be given twice —
# `NAME=VALUE`, several of them comma-separated in one `-More`; `NAME=` unsets a switch.
[object[]]$More = @()
)
$repo = Split-Path $PSScriptRoot -Parent
. (Join-Path $PSScriptRoot 'preload-window.ps1')
$preloadWindow = $null
# The F1 menu's "PRELOAD SHADERS" restarts this with -Preload (and VICTORY_PRELOAD=1, read here before the
# switches below are cleared).
$preload = $Preload -or $env:VICTORY_PRELOAD -eq '1'
# Its "CLEAR SHADER CACHE" restarts this with VICTORY_CLEAR_SHADERS=1 (read here too): the shaders and pipelines
# made so far are deleted before the game starts (`victory clear-shaders`).
$clearShaders = $env:VICTORY_CLEAR_SHADERS -eq '1'
# What the F1 menu saved: its own choices (VICTORY_MENU_...) stand in for this script's options, and its
# switches go over the settings below. An empty value unsets a switch.
$homeDir = if ($env:VICTORY_HOME) { $env:VICTORY_HOME } else { Join-Path $env:LOCALAPPDATA 'victory' }
$menuDir = if ($env:VICTORY_HOME) { $homeDir } else { $repo }
$menuFile = Join-Path $menuDir 'victory-settings.txt'
$menu = [ordered]@{}
if (-not $NoMenu -and (Test-Path -LiteralPath $menuFile)) {
foreach ($line in Get-Content -LiteralPath $menuFile) {
if ($line -match '^\s*(VICTORY_[A-Z0-9_]+)\s*=(.*)$') { $menu[$Matches[1]] = $Matches[2].Trim() }
}
}
$fpsWanted = $Fps
if ($menu.Contains('VICTORY_MENU_CONSOLE')) { $SeriesS = $menu['VICTORY_MENU_CONSOLE'] -eq 'series-s' }
if ($menu['VICTORY_MENU_RES'] -in '1440', '1080to1440', '4k') { $Res = $menu['VICTORY_MENU_RES'] }
$hasSavedDlss = $menu['VICTORY_MENU_DLSS'] -in 'off', 'dlaa', 'quality', 'balanced', 'performance', 'ultraperformance'
if ($hasSavedDlss) { $Dlss = $menu['VICTORY_MENU_DLSS'] }
$timesWanted = $FrameGenX
if ($menu.Contains('VICTORY_MENU_FRAMEGEN')) {
# 0: off; 2 to 6: that many frames shown for each one rendered (1, from an older file: 2).
$FrameGen = $menu['VICTORY_MENU_FRAMEGEN'] -match '^[1-6]$'
if ($menu['VICTORY_MENU_FRAMEGEN'] -match '^[2-6]$') { $timesWanted = [int]$menu['VICTORY_MENU_FRAMEGEN'] }
}
if ($menu['VICTORY_MENU_FG_TYPE'] -in 'auto', 'dlss', 'fsr', 'fsr4') { $FgType = $menu['VICTORY_MENU_FG_TYPE'] }
# F1's FORCE 3X ON RTX 40: MFG Unlocker (github.com/dashdogy/MFG-Unlocker, someone else's MIT mod, fetched and
# checked by scripts\get-mfg-unlocker.ps1) loaded by victory.exe, and 3x where frame generation is on at 2x. The
# layer keeps 2x if the card still reports one generated frame at most.
if ($menu.Contains('VICTORY_FORCE_MFG_RTX40')) { $ForceMfg = $menu['VICTORY_FORCE_MFG_RTX40'] -eq '1' }
if ($ForceMfg -and $timesWanted -eq 2) { $timesWanted = 3 }
if ($menu['VICTORY_MENU_FPS'] -match '^\d+$' -and [int]$menu['VICTORY_MENU_FPS'] -ge 1 -and [int]$menu['VICTORY_MENU_FPS'] -le 1000) { $fpsWanted = [int]$menu['VICTORY_MENU_FPS'] }
# Pipeline workers raise shader-build throughput but also increase the startup memory peak.
# Use fewer on 16 GiB hosts; `-More` can still override this for a specific run.
$physicalRam = (Get-CimInstance -ClassName Win32_ComputerSystem -ErrorAction SilentlyContinue).TotalPhysicalMemory
$pipelineWorkers = '8'
if ($physicalRam) { $pipelineWorkers = if ($physicalRam -le 16GB) { '4' } else { '12' } }
$settings = @{
# Submission and copy machinery
# Left off: VICTORY_RELAY=2, as fast as off on an RTX 5070 Ti (26.9 against 27.4 fps, the first cutscene's diner
# and the prologue's cell, release, every pipeline warmed) with more frames over 50 ms, and the switch
# fxceless/victory-fork #89 found characters' skin missing with on an RTX 5070 Laptop.
VICTORY_THIN = '1'; VICTORY_JOIN_PARTS = '8'; VICTORY_RELAY_COPY = '1'; VICTORY_WIDE_BACK = '1'
VICTORY_CARD_REHASH_RUNS = '1'; VICTORY_JOIN_COPIES = '1'; VICTORY_CARD_STEPS = '2'
# Not VICTORY_CARD_AWAKE (a compute job kept running between submissions): slower in the game, 17.4 fps against
# 19.0 on an RTX 4070 Ti SUPER, and it held a menu back (#771). -More @{VICTORY_CARD_AWAKE='1'} turns it on.
VICTORY_CARD_BUFFERS_MIN_KB = '64'; VICTORY_INDIRECT_WINDOW = '1'; VICTORY_INDIRECT_BATCH = '2'
VICTORY_UPLOAD_AHEAD = '1'; VICTORY_SHOW_AFTER = '1'; VICTORY_MAP_THREADS = '1'
# Shader writes into big write-combined copies stay on the card (-5 ms a frame)
VICTORY_WC_NO_BACK = '1'; VICTORY_WC_NO_BACK_MIN_KB = '1024'
# The title's page-mapping copies kept without Windows views (no cutscene freezes at scene cuts)
VICTORY_SOFT_VIEWS = 'copies'
# Textures: pool with no blocks made ahead, 32 ms a pass, no catch-up; auto selects on-demand levels for <=8 GiB budgets
VICTORY_TEXTURE_POOL = '1'; VICTORY_RIPE_BLOCKS = '0'; VICTORY_TEXTURE_NO_WAIT = '1'; VICTORY_TEXTURE_CATCHUP = '0'
VICTORY_TEXTURE_STAGE_MS = '32'; VICTORY_LEVELS_ON_DEMAND = 'auto'
# VICTORY_POOL_SMALL at its default (textures of 64 KiB and less at 4 KiB multiples in the pool): the 64 KiB
# placement was for device losses on an AMD card. On the RTX 5070 Ti the same ~18,000 textures took 1.52 GB
# instead of 2.24 and the pool's blocks 2.8 GB instead of 3.9; no device loss in six minutes.
# Small textures at 4 KiB. RTX 2060, Series S, one switch: about 10 fps to 13, about 800 MB less on the card (2026-11-28)
VICTORY_PRELUDE_UPLOADS = '1'; VICTORY_SHOW_NEW_LATER = '1'; VICTORY_POOL_SMALL = '1'; VICTORY_TABLED_REREAD = '1'
VICTORY_QUEUE_HOST_TEXTURES = '0'
# Descriptor heaps' records
VICTORY_HEAP_SYNC_FIRST = '1'; VICTORY_SYNC_IN_PLACE = '1'; VICTORY_SPANS_QUICK = '1'; VICTORY_SYNC_FINE = '1'
VICTORY_HEAP_SYNC_AT_SUBMIT = '1'
# A frame's texture passes within 8 ms together; helpers woken at each submission's start (foxhound 0.2.0-pre.4,
# from its PR #13); the layer's threads a frame waits for above normal priority (foxhound 0.2.0-pre.3). As `victory play`.
VICTORY_TEXSPK_PASS_MS = '8'; VICTORY_PASSES_HOT = '1'; VICTORY_HELPER_PRIORITY = '1'
# Light without the title's ray tracing: an estimate of indirect light and of reflections
VICTORY_AMBIENT = '0.8'; VICTORY_AMBIENT_AIR = '1.5'; VICTORY_AMBIENT_SPECULAR = '1'
# Pixel programs keep the console's early depth test
VICTORY_EARLY_DEPTH = '1'
# 默认跳过人脸重定位和热浪;人脸重定位的新 Wave32 路径由 PLAY_FACES_FIX 启用。
# Left out: the face-relocation compute and the heat-haze pass
VICTORY_LEAVE_OUT = '02384a60fda6f2d0,731a39171b568298'
# Pipelines the title makes are written down, so `victory warm` can make them ahead
VICTORY_PIPELINE_BOOK = '1'
# Fewer makers on 16 GiB hosts reduce shader-build peak memory; `-More` can override.
# Pipelines the library cannot hold are made again every start. The wait stays at 500 ms: at 50 ms a pass
# a face needs is dropped.
VICTORY_PIPELINE_LOWEST = '0'; VICTORY_PIPELINE_WORKERS = $pipelineWorkers; VICTORY_PIPELINE_SLOW = '0'
# Memory stack (skornuta): unused texture slots given back, old allocators taken anew, small buffers packed
VICTORY_SLOT_EVICT = '1'
VICTORY_ALLOCATOR_TRIM = '1'
VICTORY_BUDGET_PACK = '1'
}
# PCs with 16 GB of RAM or less: the host copies of title memory are cut on a 1 MiB grid, and an ask without a
# length (a root view) takes its 4 MiB cell from its own 256 KiB step on, not from the cell's start. Measured on an
# RTX 5060 Laptop (8 GB) with 16 GB of RAM, Series S, the prison's day room (diagnostics build, memory line): the
# windows 3,400 -> 2,598 MB, of them those asked for without a length 2,732 -> 980 MB, the card's share of the PC's
# memory 6.0 -> 5.2 GB, and the slowest tenth of seconds 3.7 -> 11.9 fps (median 14.0 -> 14.4); release build,
# median 16.0 -> 16.4 fps. -More @{VICTORY_WINDOW_KB='4096'} restores the 4 MiB grid.
$ramGb = try { (Get-CimInstance Win32_ComputerSystem -ErrorAction Stop).TotalPhysicalMemory / 1GB } catch { 0 }
if ($ramGb -gt 0 -and $ramGb -le 16.5) {
$settings.VICTORY_WINDOW_KB = '1024'; $settings.VICTORY_WINDOW_TAILS = '1'
}
if (-not $SeriesS) {
if ($Res -eq '1440') { $settings.VICTORY_NATIVE_1440P = '1' }
elseif ($Res -eq '1080to1440') { $settings.VICTORY_RENDER_1080P = '1' }
}
# Where victory.exe keeps NVIDIA's and AMD's files (its get-dlss and get-fsr, and its first start): VICTORY_HOME,
# else %LOCALAPPDATA%\victory. Looked in after this repository's own folders, as victory.exe looks there before
# its own: without it, a PC set up with victory.exe ran this launcher without DLSS and said so only in this
# window (an RTX 5070 Ti, 2026-11-28: six measured runs with the title's own upscaling instead of DLSS Quality).
$victoryHome = if ($env:VICTORY_HOME) { $env:VICTORY_HOME } else { Join-Path $env:LOCALAPPDATA 'victory' }
if ($Dlss -ne 'off' -and $FgType -ne 'fsr4') {
# NVIDIA's files: where VICTORY_STREAMLINE_DIR says, else where Get-NVIDIA-DLSS.cmd puts them, else victory.exe's.
$sl = if ($env:VICTORY_STREAMLINE_DIR) { $env:VICTORY_STREAMLINE_DIR } else {
@((Join-Path $repo 'nvidia-sdk\Streamline\bin\x64'), (Join-Path $victoryHome 'nvidia-sdk\Streamline\bin\x64')) |
Where-Object { Test-Path (Join-Path $_ 'sl.interposer.dll') } | Select-Object -First 1
}
if (-not $sl) { $sl = Join-Path $repo 'nvidia-sdk\Streamline\bin\x64' }
if (Test-Path (Join-Path $sl 'sl.interposer.dll')) {
# Absolute: the title is started from the repository's folder, where a relative path is not found.
$sl = (Resolve-Path -LiteralPath $sl).ProviderPath
$settings.VICTORY_DLSS = '1'; $settings.VICTORY_DLSS_MODE = $Dlss; $settings.VICTORY_STREAMLINE_DIR = $sl
if ($FrameGen) { $settings.VICTORY_FRAMEGEN = '1'; $settings.VICTORY_FRAMEGEN_X = [string]$timesWanted }
elseif ($FrameGenReady -and -not $NoFrameGenReady) { $settings.VICTORY_FRAMEGEN = '1'; $settings.VICTORY_FRAMEGEN_X = '0' } # ready, off
# Frame generation takes 1.5 to 2 GB of the card's memory, which the layer otherwise fills with textures up
# to nine tenths of its budget (on a 12 GB card it then ran out: no generated frames). On from the start, it
# is left a fifth of the budget; ready but off, a little less is held back.
if ($settings.VICTORY_FRAMEGEN -eq '1') {
$settings.VICTORY_TEXTURE_ROOM_PERCENT = if ($FrameGen -and $timesWanted -gt 2) { '74' } elseif ($FrameGen) { '80' } else { '86' }
# (held back only when a frame-generation backend was made available on this adapter)
$settings.VICTORY_FRAMEGEN_ROOM_RESERVE = '1'
}
} else {
Write-Host "No NVIDIA files in ${sl}: running without DLSS and frame generation. Get-NVIDIA-DLSS.cmd in the"
Write-Host "repository folder fetches them from NVIDIA once (about 70 MB); VICTORY_STREAMLINE_DIR names another folder."
}
}
# AMD's FidelityFX DLLs: where VICTORY_FIDELITYFX_DIR says, else where Get-AMD-FSR.cmd puts them, else victory.exe's.
$fx = if ($env:VICTORY_FIDELITYFX_DIR) { $env:VICTORY_FIDELITYFX_DIR } else {
@((Join-Path $repo 'amd-sdk\FidelityFX\bin'), (Join-Path $victoryHome 'amd-fidelityfx')) |
Where-Object { Test-Path (Join-Path $_ 'amd_fidelityfx_framegeneration_dx12.dll') } | Select-Object -First 1
}
if (-not $fx) { $fx = Join-Path $repo 'amd-sdk\FidelityFX\bin' }
if (Test-Path -LiteralPath $fx) { $fx = (Resolve-Path -LiteralPath $fx).ProviderPath }
# -FgType fsr4: AMD's PC upscaler takes the title's upscalings, as `victory play --fg-type fsr4` sets it up
# (play.rs). Its scene at -Dlss's size, quality where that is off: with frame generation and no mode named the
# layer keeps the scene at the output's size, which on an RX 9070 XT (2026-11-29) rendered 2560x1440 with
# nothing upscaled and fell from about 22 to 3 fps once a save was loaded.
if ($FgType -eq 'fsr4') {
$settings.VICTORY_PC_FSR = '1'; $settings.VICTORY_FIDELITYFX_DIR = $fx
$settings.VICTORY_DLSS_MODE = if ($Dlss -eq 'off') { 'quality' } else { $Dlss }
if (-not (Test-Path (Join-Path $fx 'amd_fidelityfx_upscaler_dx12.dll'))) {
Write-Host "No AMD FSR files in ${fx}: Get-AMD-FSR.cmd in the repository's folder fetches them from AMD (about"
Write-Host '30 MB, once). Without them the title upscales on its own.'
}
}
# AMD FSR 3 frame generation: made ready as DLSS Frame Generation is (on, or ready and off for the F1 menu).
# auto: the layer uses it only where DLSS Frame Generation does not run; fsr: DLSS Frame Generation is not asked;
# fsr4: FSR 4 frame generation on AMD's PC upscaler, without DLSS.
if ($FgType -ne 'dlss' -and ($FrameGen -or ($FrameGenReady -and -not $NoFrameGenReady))) {
# Asked whatever is here: the layer checks the files and the card, and the start's notice (on the picture for
# its first 30 s, and in this window) says what runs and why not. Without DLSS it stays off, on either
# console: it needs DLSS for the upscaling.
$settings.VICTORY_FSR_FRAMEGEN = if ($FgType -eq 'fsr4') { '4' } else { '1' }; $settings.VICTORY_FIDELITYFX_DIR = $fx
if (-not (Test-Path (Join-Path $fx 'amd_fidelityfx_framegeneration_dx12.dll'))) {
Write-Host "No AMD FSR 3 files in ${fx}: Get-AMD-FSR.cmd in the repository's folder fetches them from AMD (about"
Write-Host '30 MB, once). Needed only on cards without DLSS frame generation, or with FSR 3 chosen in F1.'
}
if ($FgType -in 'fsr', 'fsr4') { $settings.Remove('VICTORY_FRAMEGEN') }
if (-not $settings.VICTORY_FRAMEGEN_X) { $settings.VICTORY_FRAMEGEN_X = if ($FrameGen) { [string]$timesWanted } else { '0' } }
if (-not $settings.VICTORY_TEXTURE_ROOM_PERCENT) {
$settings.VICTORY_TEXTURE_ROOM_PERCENT = if ($FrameGen) { '80' } else { '86' }
$settings.VICTORY_FRAMEGEN_ROOM_RESERVE = '1'
}
}
if ($FixedStep) { $settings.VICTORY_FRAME_INTERVAL_US = [string][int][math]::Round(1000000 / $fpsWanted) }
elseif ($fpsWanted -ge 1000) {
# No wait of ours, and the title told 59 (not its "no limit", which halves a per-frame scale of its own):
# real speed from 15 to 59 rendered frames a second, measured 0.985x at 30-36.
$settings.VICTORY_FRAME_INTERVAL_MS = '0'; $settings.VICTORY_TITLE_FPS = '59'
}
else { $settings.VICTORY_FRAME_INTERVAL_MS = ([math]::Round(1000 / $fpsWanted, 3)).ToString([Globalization.CultureInfo]::InvariantCulture) }
foreach ($k in $menu.Keys) {
if ($k -like 'VICTORY_MENU_*') { continue }
if ($k -eq 'VICTORY_TEXTURE_ROOM_PERCENT') { $settings.Remove('VICTORY_FRAMEGEN_ROOM_RESERVE') }
if ($menu[$k]) { $settings[$k] = $menu[$k] } else { $settings.Remove($k) }
}
# -More: a hashtable from a PowerShell window, or NAME=VALUE strings where one cannot be written
# (Steam's launch options, and anything else that starts this with -File, hand the arguments over
# as they were typed).
$moreSettings = [ordered]@{}
foreach ($item in $More) {
if ($item -is [System.Collections.IDictionary]) {
foreach ($k in $item.Keys) { $moreSettings["$k"] = "$($item[$k])" }
continue
}
# A command line PowerShell did not split itself (Steam's, and -File's): the pairs may be
# comma-separated there. A comma inside a value is left alone — VICTORY_LEAVE_OUT has one —
# so only a comma in front of another NAME= separates.
foreach ($pair in ("$item" -split ',(?=\s*VICTORY_[A-Z0-9_]+\s*=)')) {
if ($pair -match '^\s*(VICTORY_[A-Z0-9_]+)\s*=(.*)$') {
$moreSettings[$Matches[1]] = $Matches[2].Trim()
} elseif ("$pair") {
Write-Host "Ignoring -More `"$pair`": not NAME=VALUE."
}
}
}
foreach ($k in $moreSettings.Keys) {
if ($k -eq 'VICTORY_TEXTURE_ROOM_PERCENT') { $settings.Remove('VICTORY_FRAMEGEN_ROOM_RESERVE') }
if ($moreSettings[$k]) { $settings[$k] = $moreSettings[$k] } else { $settings.Remove($k) }
}
# A held mouse that is not put back in the middle stops at the window's edge, and with it the turning.
if ($settings.VICTORY_MOUSE_CAPTURE -eq '1' -and -not $settings.Contains('VICTORY_MOUSE_WARP')) { $settings.VICTORY_MOUSE_WARP = '1' }
# Mouse and keyboard (F1, MOUSE AND KEYBOARD), as victory.exe play does it (play.rs): the keys and
# sensitivity in bindings.ini in %LOCALAPPDATA%\victory (VICTORY_HOME if set), written with the
# repository's defaults the first time, and the game started with it. Without that file named, the game
# had no mouse and keyboard however the menu was set, and KEY BINDINGS asked to turn them on (#1369).
# A VICTORY_MNK_BINDINGS given with -More names another file.
if ($settings.VICTORY_MNK -eq '1' -and -not $settings.VICTORY_MNK_BINDINGS) {
$mnkHome = if ($env:VICTORY_HOME) { $env:VICTORY_HOME } else { Join-Path $env:LOCALAPPDATA 'victory' }
$bindings = Join-Path $mnkHome 'bindings.ini'
if (-not (Test-Path -LiteralPath $bindings)) {
New-Item -ItemType Directory -Force -Path $mnkHome | Out-Null
# A copy that fails when the file is there, so the player's own keys are never written over
# (a file made since the check above, or one the check could not see); as play.rs does it.
try { [System.IO.File]::Copy((Join-Path $repo 'bindings.ini'), $bindings, $false) } catch { }
}
if (Test-Path -LiteralPath $bindings) {
$settings.VICTORY_MNK_BINDINGS = $bindings
Write-Host "mouse/keyboard on: keys and sensitivity in $bindings"
}
}
$console = if ($SeriesS) { 'series-s' } else { 'series-x' }
# For the menu: what it shows as the current choices, where it saves, and how it starts the game again
# (-More is not carried over a restart from the menu).
$settings.VICTORY_MENU_CONSOLE = $console
$settings.VICTORY_MENU_RES = $Res
$settings.VICTORY_MENU_DLSS = if ($hasSavedDlss -or $settings.VICTORY_DLSS -eq '1') { $Dlss } else { 'off' }
if ($ForceMfg -and $settings.VICTORY_DLSS -eq '1') {
$mfgDir = Join-Path $env:LOCALAPPDATA 'victory\mfg-unlocker'
& powershell.exe -NoProfile -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot 'get-mfg-unlocker.ps1') -To $mfgDir
$mfgDll = Join-Path $mfgDir 'MFGUnlocker.dll'
if (Test-Path -LiteralPath $mfgDll) {
$settings.VICTORY_MFG_UNLOCKER = '1'; $settings.VICTORY_MFG_UNLOCKER_DLL = $mfgDll; $settings.VICTORY_FORCE_MFG_RTX40 = '1'
} else {
Write-Warning 'MFG Unlocker did not arrive: frame generation stays at what the card gives (2x on RTX 40).'
}
}
$settings.VICTORY_MENU_FRAMEGEN = if ($settings.VICTORY_FRAMEGEN -eq '1' -or $settings.VICTORY_FSR_FRAMEGEN -in '1', '4') { [string]$settings.VICTORY_FRAMEGEN_X } else { '0' }
$settings.VICTORY_MENU_FG_TYPE = $FgType
$settings.VICTORY_MENU_FPS = [string]$fpsWanted
$settings.VICTORY_MENU_FILE = $menuFile
$settings.VICTORY_MENU_PLAY = $MyInvocation.MyCommand.Path
$settings.VICTORY_MENU_CWD = $PWD.ProviderPath
$settings.VICTORY_MENU_ARGS = "-Exe `$env:VICTORY_MENU_EXE -Build $Build$(if ($FrameGenReady -and -not $NoFrameGenReady) { ' -FrameGenReady' })$(if ($FixedStep) { ' -FixedStep' })" +
$(if ($Splash) { " -Splash '$($Splash -replace "'", "''")'" }) + $(if ($NoPreloadWindow) { ' -NoPreloadWindow' })
$victory = Join-Path $repo "target\$Build\victory.exe"
if (-not (Test-Path $victory)) {
# Not built yet: built here, once.
if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) { Write-Host "No $victory, and no cargo to build it with: install Rust (README), then start this again."; exit 1 }
Write-Host 'Building the layer (a few minutes the first time) ...'
Push-Location $repo
try {
if ($Build -eq 'diag') { cargo build --locked --profile diag -p victory --features diagnostics }
else { cargo build --release --locked -p victory }
} finally { Pop-Location }
if (-not (Test-Path $victory)) { Write-Host "The build did not make $victory."; exit 1 }
}
if (-not (Test-Path -LiteralPath $Exe)) { Write-Host "No $Exe."; exit 1 }
# Absolute before the folder changes below: the title is started from the repository's folder, where a
# relative path would not be found (the check above looks from the folder the launcher was started in).
$Exe = (Resolve-Path -LiteralPath $Exe).ProviderPath
# Every translated shader is SM 6.6. Windows 10's own Direct3D 12 stops at 6.5, and with no D3D12\D3D12Core.dll
# beside victory.exe it makes no device at all ("none"); `victory get-d3d12` fetches Microsoft's newer runtime
# there, as `victory play` does. Asked only while that folder is missing; nothing is fetched at 6.6 or above.
if (-not (Test-Path -LiteralPath (Join-Path (Split-Path -Parent $victory) 'D3D12\D3D12Core.dll'))) {
$model = "$(& $victory shader-model 2>$null | Select-Object -Last 1)".Trim()
if ($model -notmatch '^\d+\.\d+$' -or [version]$model -lt [version]'6.6') {
Write-Host "Direct3D 12 here runs shader model $(if ($model -match '^\d+\.\d+$') { $model } else { 'none (no device)' }); the game's translated shaders need 6.6."
& $victory get-d3d12
if ($LASTEXITCODE -ne 0 -and $model -match '^\d+\.\d+$') {
Write-Host "Microsoft's Direct3D 12 runtime did not arrive: every shader would be refused. ``$victory get-d3d12`` tries again."
exit 1
}
}
}
$settings.VICTORY_MENU_EXE = $Exe
# The optional ReShade host has its own application directory. DXGI and its
# add-ons are discovered next to that executable, including at process start.
# For an RTX 40, install the full add-on edition of ReShade and the optional
# mavismmg/MFGAdaUnlock-RenoDx add-on in target/<build>/ada-mfg. In a new
# PowerShell session set $env:GTA6_ADA_MFG='1' and $env:GTA6_FRAMEGEN_X='4',
# then run .\PLAY_FRAMEGEN.cmd 3. The multiplier override accepts 2 through 6.
if ($env:GTA6_ADA_MFG -eq '1') {
$hostDir = Join-Path $repo "target\$Build\ada-mfg"
foreach ($file in 'dxgi.dll', 'renodx-mfgunlock.addon64') {
if (-not (Test-Path -LiteralPath (Join-Path $hostDir $file) -PathType Leaf)) {
throw "The optional Ada MFG host is missing $file in $hostDir"
}
}
$hostExe = Join-Path $hostDir 'victory.exe'
if (-not (Test-Path -LiteralPath $hostExe) -or (Get-FileHash $victory).Hash -ne (Get-FileHash $hostExe).Hash) {
Copy-Item -LiteralPath $victory -Destination $hostExe -Force -ErrorAction Stop
}
$victory = $hostExe
}
# Switches left over in this window are cleared; path settings and the card stay, as the launcher's KEPT
# keeps them (apps\victory\src\play.rs; victory.toml gives the paths otherwise). Cleared, VICTORY_HOME sent
# the preload's and the game's caches to %LOCALAPPDATA% (#751).
$paths = 'VICTORY_MENU_PAD', 'VICTORY_HOME', 'VICTORY_ADAPTER', 'VICTORY_CONFIG', 'VICTORY_GAME_DIR', 'VICTORY_CACHE_DIR', 'VICTORY_DATA_DIR', 'VICTORY_STREAMLINE_DIR', 'VICTORY_FIDELITYFX_DIR', 'VICTORY_LOG'
Get-ChildItem Env:VICTORY_* -ErrorAction SilentlyContinue | Where-Object { $_.Name -notin $paths } | ForEach-Object { Remove-Item "Env:$($_.Name)" }
foreach ($k in $settings.Keys) { Set-Item "Env:$k" $settings[$k] }
$logs = Join-Path $homeDir 'logs'; New-Item -ItemType Directory -Force $logs | Out-Null
$log = Join-Path $logs ('victory-nvidia-{0:yyyyMMdd-HHmmss}.log' -f (Get-Date))
$writer = [IO.StreamWriter]::new($log, $false, [Text.UTF8Encoding]::new($false)); $writer.AutoFlush = $true
$writer.WriteLine("# console=$console build=$Build preload=$preload warm-used=$WarmUsed switches: " + (($settings.GetEnumerator() | Sort-Object Name | ForEach-Object { "$($_.Name)=$($_.Value)" }) -join ' '))
Write-Host "Log: $log"
Push-Location $repo # victory.toml is read from here
try {
if ($clearShaders) {
& $victory clear-shaders 2>&1 | ForEach-Object { $line = "$_"; $writer.WriteLine("# clear-shaders: $line"); $line }
}
if ($WarmUsed) {
$warmArgs = @('warm', '--used')
if ($settings.VICTORY_PRELOAD_JOBS -match '^[1-9][0-9]*$') {
$warmArgs += @('--jobs', $settings.VICTORY_PRELOAD_JOBS)
}
& $victory @warmArgs 2>&1 | ForEach-Object { $line = "$_"; $writer.WriteLine($line); $line }
exit $LASTEXITCODE
}
if ($preload) {
# With this start's switches (the translations depend on them); its lines go to the log too.
Write-Host 'Preloading shaders before the game starts. This takes a while (see the lines below).'
$began = Get-Date
if (-not $NoPreloadWindow) {
$preloadWindow = Start-PreloadWindow -Splash (Get-SplashImage $Exe $Splash) -Icon (Get-SplashIcon $Exe) `
-StateFile (Join-Path $env:LOCALAPPDATA 'victory\preload-last.txt')
}
# (Split-Path -LiteralPath with -Parent: no such parameter set in Windows PowerShell 5.1.)
& $victory preload ([IO.Path]::GetDirectoryName($Exe)) 2>&1 | ForEach-Object {
$line = "$_"; $writer.WriteLine("# preload: $line"); Update-PreloadWindow $preloadWindow $line; $line
}
$code = $LASTEXITCODE
$minutes = ((Get-Date) - $began).TotalMinutes
$how = if ($preloadWindow -and $preloadWindow.Skipped) { 'skipped (what it did is kept)' } elseif ($code -eq 0) { 'done' } else { "ended with code $code" }
$said = 'Preload {0} after {1:N1} min. Starting the game.' -f $how, $minutes
$writer.WriteLine("# $said"); Write-Host $said
Complete-PreloadWindow $preloadWindow ('Preload {0} after {1:N1} min.' -f $how, $minutes) ($code -eq 0)
}
# DLSS Enabler (winmm.dll beside victory.exe) stays off in a process with a console window or console output,
# so the layer runs without a window and its output comes through a pipe.
$env:VFG_BIN = $victory; $env:VFG_EXE = $Exe
$psi = [Diagnostics.ProcessStartInfo]::new('cmd.exe', ('/d /s /c ""%VFG_BIN%" run "%VFG_EXE%" --console {0} --execute 2>&1"' -f $console))
$psi.UseShellExecute = $false; $psi.CreateNoWindow = $true; $psi.RedirectStandardOutput = $true
$psi.StandardOutputEncoding = [Text.UTF8Encoding]::new($false); $psi.WorkingDirectory = $repo
$p = [Diagnostics.Process]::Start($psi)
while ($null -ne ($line = $p.StandardOutput.ReadLine())) { $writer.WriteLine($line); $line }
$p.WaitForExit()
$global:LASTEXITCODE = $p.ExitCode
}
finally { Pop-Location; $writer.Dispose(); Close-PreloadWindow $preloadWindow }
# What `victory run` returned: a title that failed is a failed start for whoever called this script.
exit $LASTEXITCODE

View File

@ -1,4 +1,4 @@
# One-click GTA VI on trustno1-coder/VIctory-NVIDIA (foxhound base): DLSS Super Resolution and frame
# One-click GTA VI on trustno1-coder/VIctory-NVIDIA: DLSS Super Resolution and frame
# generation (DLSS's on RTX 40 and later, AMD's FSR 3 on the cards before it).
# PLAY_FRAMEGEN.cmd runs this. What it does, in order:
# 1. finds the game folder (game_dir.txt in the repository folder, else a search of every drive)
@ -7,7 +7,7 @@
# 3b. on a card without DLSS frame generation, gets AMD's FSR 3 files once (scripts\get-amd-fsr.ps1, from
# github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK): the layer uses FSR 3 there, and without those
# files frame generation stays off ("FRAME GEN OFF: AMD FSR 3 FILES NOT FOUND" on the start's notice)
# 4. starts scripts\play-foxhound.ps1, which builds the layer the first time (a few minutes)
# 4. starts scripts\play-nvidia.ps1, which builds the layer the first time (a few minutes)
# Modes: 1 Series X 1440p + DLSS Quality + frame generation 2x (default)
# 2 same without frame generation
# 3 Series S + DLSS Quality + frame generation 2x (faster, softer)
@ -78,7 +78,7 @@ function Test-DlssFrameGenCard([string]$name) {
}
$gpuName = (Get-CimInstance Win32_VideoController -ErrorAction SilentlyContinue | Where-Object { $_.Name -match 'NVIDIA' } | Select-Object -First 1).Name
# Which frame generation is asked for: GTA6_FG_TYPE, then what was last chosen in the F1 menu, which wins
# because play-foxhound.ps1 reads that same file over anything passed to it.
# because play-nvidia.ps1 reads that same file over anything passed to it.
$fgType = 'auto'
if ($env:GTA6_FG_TYPE -in 'auto', 'dlss', 'fsr') { $fgType = $env:GTA6_FG_TYPE }
$menuFile = Join-Path $repo 'victory-settings.txt'
@ -124,7 +124,7 @@ if (Get-Process victory -ErrorAction SilentlyContinue) { Write-Host 'The game is
# 2. Saves backup, verified file by file.
if (-not $NoBackup) {
# Ask the runner in the same working directory as play-foxhound so path overrides
# Ask the runner in the same working directory as play-nvidia.ps1 so path overrides
# and victory.toml select the same saves for backup and play.
Push-Location $repo
$encoding = [Console]::OutputEncoding
@ -181,13 +181,13 @@ if ($opts.FrameGen -and $needsFsr -and -not $hasFsr) {
}
if ($hagsOff) { Write-Host 'Hardware-accelerated GPU scheduling is off: frame generation will not work until it is on.' }
# 4. Start (play-foxhound.ps1 builds target\release\victory.exe the first time).
# 4. Start (play-nvidia.ps1 builds target\release\victory.exe the first time).
if (-not (Test-Path $victory)) { Write-Host 'First start: building the layer, a few minutes ...' }
Write-Host "Starting GTA VI: $what"
Write-Host 'In the game: F1 settings menu, F3 stats panel. Keep this window open while playing.'
$env:VICTORY_GAME_DIR = $GameDir
$ErrorActionPreference = 'Continue'
# foxhound reads these but play-foxhound.ps1 does not set them: AnyXboxX's worker pools for 16/24+ logical CPUs
# foxhound reads these but play-nvidia.ps1 does not set them: AnyXboxX's worker pools for 16/24+ logical CPUs
# (measured on an RTX 4070 SUPER: heavy scenes +22-29 %) and Vice-Tay's placed order. GTA6_NO_TUNE=1: leave them out.
$cpus = [Environment]::ProcessorCount
$more = @{ VICTORY_PLACED_ORDER = '1' }
@ -195,7 +195,7 @@ if ($cpus -ge 24) { $more.VICTORY_THIN_THREADS = '12'; $more.VICTORY_UNDER_THREA
elseif ($cpus -ge 16) { $more.VICTORY_THIN_THREADS = '12'; $more.VICTORY_UNDER_THREADS = '8'; $more.VICTORY_LAND_THREADS = '6' }
# Extreme: the landing pool sat full at 8 (x6.1-6.6 of 8 in AnyXboxX's heavy scenes), one more pipeline worker.
if (($Mode -in @('5', '6')) -and $cpus -ge 24) { $more.VICTORY_LAND_THREADS = '12'; $more.VICTORY_PIPELINE_WORKERS = '4' }
if ($env:GTA6_NO_TUNE -eq '1') { $more = @{}; Write-Host 'GTA6_NO_TUNE=1: foxhound defaults (no pool or placed-order tuning).' }
if ($env:GTA6_NO_TUNE -eq '1') { $more = @{}; Write-Host 'GTA6_NO_TUNE=1: default settings (no pool or placed-order tuning).' }
else { Write-Host ("Tuning for {0} logical CPUs: {1}" -f $cpus, (($more.GetEnumerator() | Sort-Object Name | ForEach-Object { "$($_.Name)=$($_.Value)" }) -join ' ')) }
if ($FaceMeshFix) {
$more.VICTORY_LEAVE_OUT = $HEAT_HAZE_HASH
@ -226,4 +226,4 @@ if ($Mode -in @('5', '6')) {
}
Write-Host 'Extreme: the game process goes to High priority once it starts.'
}
& (Join-Path $PSScriptRoot 'play-foxhound.ps1') -Exe $gameExe -Build release @opts
& (Join-Path $PSScriptRoot 'play-nvidia.ps1') -Exe $gameExe -Build release @opts

View File

@ -1,4 +1,445 @@
# The launcher under the name this fork has always had: everything goes on to play-foxhound.ps1 (its options
# are described at its top).
# scripts\play-nvidia.ps1 -Exe <path of your own copy's executable>
& "$PSScriptRoot\play-foxhound.ps1" @args
# Starts your own copy of the title on VIctory-NVIDIA with the settings tested on an RTX 4070 SUPER (Series X profile,
# 2560x1440 output, DLSS Quality when NVIDIA Streamline is set up).
#
# .\scripts\play-nvidia.ps1 -Exe 'D:\MyDump\game_scarlett_master.exe'
# .\scripts\play-nvidia.ps1 -Exe ... -Dlss off the title's own upscaling, no DLSS
# .\scripts\play-nvidia.ps1 -Exe ... -Dlss balanced -FrameGen
# .\scripts\play-nvidia.ps1 -Exe ... -SeriesS Series S profile (1280x720 inside, faster, softer)
# .\scripts\play-nvidia.ps1 -Exe ... -Build diag diagnostics build (slower; captures, timelines)
# .\scripts\play-nvidia.ps1 -Exe ... -FrameGen -ForceMfg 3x DLSS frame generation on an RTX 40 through MFG Unlocker (a mod)
# .\scripts\play-nvidia.ps1 -Exe ... -FgType fsr4 -FrameGen AMD FSR 4 upscaling (quality) and FSR 4 frame generation (experimental)
# .\scripts\play-nvidia.ps1 -Exe ... -WarmUsed warm pipelines seen in earlier runs, then exit
# .\scripts\play-nvidia.ps1 -Exe ... -More @{VICTORY_AMBIENT_SPECULAR='0'} add or override switches
# .\scripts\play-nvidia.ps1 -Exe ... -Preload every shader and pipeline made first, with a progress
# window over the title's splash screen (-Splash <file or
# URL> for another picture, -NoPreloadWindow for none)
# .\scripts\play-nvidia.ps1 -Exe ... -Dlss off -NoMenu as asked here, whatever the F1 menu saved (measuring runs)
# .\scripts\play-nvidia.ps1 -Exe ... -More VICTORY_AMBIENT_SPECULAR=0 the same where a hashtable
# cannot be written (Steam's launch options); several pairs, comma-separated, in one -More
#
# In the game, F1 opens a settings menu (arrow keys pick and change, Enter does it). What it saves goes to
# victory-settings.txt under VICTORY_HOME, or in the repository folder by default. The script reads it at each start.
#
# Build first (README). Run from a normal window, not as administrator. Each run writes a log to
# the logs folder under VICTORY_HOME (default %LOCALAPPDATA%\victory).
# Every VICTORY_... switch is described in a comment where the code reads it.
param(
[Parameter(Mandatory)][string]$Exe,
[ValidateSet('diag', 'release')][string]$Build = 'release',
[switch]$SeriesS,
# 1440: output and scene 2560x1440 (Series X, the image is patched); 1080to1440: scene 1920x1080 upscaled by
# the title; 4k: the stock Series X output (3840x2160).
[ValidateSet('1440', '1080to1440', '4k')][string]$Res = '1440',
# DLSS Super Resolution in place of the title's upscaling; needs NVIDIA Streamline (README).
[ValidateSet('off', 'dlaa', 'quality', 'balanced', 'performance', 'ultraperformance')][string]$Dlss = 'quality',
# DLSS Frame Generation (RTX 40 or later, hardware-accelerated GPU scheduling on); needs DLSS.
[switch]$FrameGen,
# Frames shown for each one rendered with -FrameGen: 2 to 6 (more than 2 needs an RTX 50; the layer asks the
# driver how many this card does and gives no more).
[ValidateRange(2, 6)][int]$FrameGenX = 2,
# Frame generation is made ready at every start with Streamline, on or off, so that the F1 menu switches it
# and changes its amount while playing. Only with -FrameGenReady now: ready but off, Streamline's swap chain
# held this PC's frames at 14 a second (20 without), so frame generation off is off unless asked.
[switch]$FrameGenReady,
# (The default now; still taken.)
[switch]$NoFrameGenReady,
# Which frame generation: auto (DLSS Frame Generation where it runs, else AMD's FSR 3), dlss, or fsr (FSR 3
# even on an RTX 40/50; 2X only). FSR 3 needs AMD's FidelityFX DLLs (VICTORY_FIDELITYFX_DIR, else
# amd-sdk\FidelityFX\bin here, where Get-AMD-FSR.cmd puts them) and DLSS for the upscaling, on either console.
# fsr4 (experimental, as `victory play --fg-type fsr4`): AMD's PC upscaler in place of DLSS (FSR 4 on RDNA 4,
# VICTORY_PC_FSR), its scene at -Dlss's size (quality where -Dlss is off), and with -FrameGen FSR 4 frame
# generation (VICTORY_FSR_FRAMEGEN=4, 2X). Same DLLs.
[ValidateSet('auto', 'dlss', 'fsr', 'fsr4')][string]$FgType = 'auto',
# Frames begin every 1/Fps s whatever the title asks (it asks 1/30). 1000, the default: no cap, a frame
# begins as soon as the last is done. 30: the title's own rate.
[ValidateRange(1, 1000)][int]$Fps = 1000,
# -Fps also gives the title its own frame rate (VICTORY_FRAME_INTERVAL_MS), so that its simulation steps by the
# time that passed: with only our clock faster, each frame still moved game time 1/30 s and above 30 fps the game
# ran fast. -FixedStep: our clock alone (VICTORY_FRAME_INTERVAL_US), as before.
[switch]$FixedStep,
[switch]$ForceMfg,
# Every shader and the loading pipelines made first (`victory preload`), then the game; the F1 menu's
# PRELOAD SHADERS starts this again with it.
[switch]$Preload,
# The preload shows its progress in a window (scripts\preload-window.ps1) over the title's own splash screen
# (SplashScreenImage in MicrosoftGame.config beside -Exe), or over the picture -Splash names: a file, or an
# http(s) URL fetched once into %LOCALAPPDATA%\victory\splash. -NoPreloadWindow: in this window only.
[string]$Splash = '',
[switch]$NoPreloadWindow,
[switch]$WarmUsed,
# What the F1 menu saved (victory-settings.txt) is left out: this call's options stand. For runs
# that are compared with each other: a saved DLSS mode went over "-Dlss off" otherwise.
[switch]$NoMenu,
# Switches to add or override: a hashtable (`-More @{VICTORY_X='1'}`), or, where a hashtable
# cannot be written — Steam's launch options hand every argument over as it was typed, and
# anything else starting this with -File does too, and no parameter can be given twice —
# `NAME=VALUE`, several of them comma-separated in one `-More`; `NAME=` unsets a switch.
[object[]]$More = @()
)
$repo = Split-Path $PSScriptRoot -Parent
. (Join-Path $PSScriptRoot 'preload-window.ps1')
$preloadWindow = $null
# The F1 menu's "PRELOAD SHADERS" restarts this with -Preload (and VICTORY_PRELOAD=1, read here before the
# switches below are cleared).
$preload = $Preload -or $env:VICTORY_PRELOAD -eq '1'
# Its "CLEAR SHADER CACHE" restarts this with VICTORY_CLEAR_SHADERS=1 (read here too): the shaders and pipelines
# made so far are deleted before the game starts (`victory clear-shaders`).
$clearShaders = $env:VICTORY_CLEAR_SHADERS -eq '1'
# What the F1 menu saved: its own choices (VICTORY_MENU_...) stand in for this script's options, and its
# switches go over the settings below. An empty value unsets a switch.
$homeDir = if ($env:VICTORY_HOME) { $env:VICTORY_HOME } else { Join-Path $env:LOCALAPPDATA 'victory' }
$menuDir = if ($env:VICTORY_HOME) { $homeDir } else { $repo }
$menuFile = Join-Path $menuDir 'victory-settings.txt'
$menu = [ordered]@{}
if (-not $NoMenu -and (Test-Path -LiteralPath $menuFile)) {
foreach ($line in Get-Content -LiteralPath $menuFile) {
if ($line -match '^\s*(VICTORY_[A-Z0-9_]+)\s*=(.*)$') { $menu[$Matches[1]] = $Matches[2].Trim() }
}
}
$fpsWanted = $Fps
if ($menu.Contains('VICTORY_MENU_CONSOLE')) { $SeriesS = $menu['VICTORY_MENU_CONSOLE'] -eq 'series-s' }
if ($menu['VICTORY_MENU_RES'] -in '1440', '1080to1440', '4k') { $Res = $menu['VICTORY_MENU_RES'] }
$hasSavedDlss = $menu['VICTORY_MENU_DLSS'] -in 'off', 'dlaa', 'quality', 'balanced', 'performance', 'ultraperformance'
if ($hasSavedDlss) { $Dlss = $menu['VICTORY_MENU_DLSS'] }
$timesWanted = $FrameGenX
if ($menu.Contains('VICTORY_MENU_FRAMEGEN')) {
# 0: off; 2 to 6: that many frames shown for each one rendered (1, from an older file: 2).
$FrameGen = $menu['VICTORY_MENU_FRAMEGEN'] -match '^[1-6]$'
if ($menu['VICTORY_MENU_FRAMEGEN'] -match '^[2-6]$') { $timesWanted = [int]$menu['VICTORY_MENU_FRAMEGEN'] }
}
if ($menu['VICTORY_MENU_FG_TYPE'] -in 'auto', 'dlss', 'fsr', 'fsr4') { $FgType = $menu['VICTORY_MENU_FG_TYPE'] }
# F1's FORCE 3X ON RTX 40: MFG Unlocker (github.com/dashdogy/MFG-Unlocker, someone else's MIT mod, fetched and
# checked by scripts\get-mfg-unlocker.ps1) loaded by victory.exe, and 3x where frame generation is on at 2x. The
# layer keeps 2x if the card still reports one generated frame at most.
if ($menu.Contains('VICTORY_FORCE_MFG_RTX40')) { $ForceMfg = $menu['VICTORY_FORCE_MFG_RTX40'] -eq '1' }
if ($ForceMfg -and $timesWanted -eq 2) { $timesWanted = 3 }
if ($menu['VICTORY_MENU_FPS'] -match '^\d+$' -and [int]$menu['VICTORY_MENU_FPS'] -ge 1 -and [int]$menu['VICTORY_MENU_FPS'] -le 1000) { $fpsWanted = [int]$menu['VICTORY_MENU_FPS'] }
# Pipeline workers raise shader-build throughput but also increase the startup memory peak.
# Use fewer on 16 GiB hosts; `-More` can still override this for a specific run.
$physicalRam = (Get-CimInstance -ClassName Win32_ComputerSystem -ErrorAction SilentlyContinue).TotalPhysicalMemory
$pipelineWorkers = '8'
if ($physicalRam) { $pipelineWorkers = if ($physicalRam -le 16GB) { '4' } else { '12' } }
$settings = @{
# Submission and copy machinery
# Left off: VICTORY_RELAY=2, as fast as off on an RTX 5070 Ti (26.9 against 27.4 fps, the first cutscene's diner
# and the prologue's cell, release, every pipeline warmed) with more frames over 50 ms, and the switch
# fxceless/victory-fork #89 found characters' skin missing with on an RTX 5070 Laptop.
VICTORY_THIN = '1'; VICTORY_JOIN_PARTS = '8'; VICTORY_RELAY_COPY = '1'; VICTORY_WIDE_BACK = '1'
VICTORY_CARD_REHASH_RUNS = '1'; VICTORY_JOIN_COPIES = '1'; VICTORY_CARD_STEPS = '2'
# Not VICTORY_CARD_AWAKE (a compute job kept running between submissions): slower in the game, 17.4 fps against
# 19.0 on an RTX 4070 Ti SUPER, and it held a menu back (#771). -More @{VICTORY_CARD_AWAKE='1'} turns it on.
VICTORY_CARD_BUFFERS_MIN_KB = '64'; VICTORY_INDIRECT_WINDOW = '1'; VICTORY_INDIRECT_BATCH = '2'
VICTORY_UPLOAD_AHEAD = '1'; VICTORY_SHOW_AFTER = '1'; VICTORY_MAP_THREADS = '1'
# Shader writes into big write-combined copies stay on the card (-5 ms a frame)
VICTORY_WC_NO_BACK = '1'; VICTORY_WC_NO_BACK_MIN_KB = '1024'
# The title's page-mapping copies kept without Windows views (no cutscene freezes at scene cuts)
VICTORY_SOFT_VIEWS = 'copies'
# Textures: pool with no blocks made ahead, 32 ms a pass, no catch-up; auto selects on-demand levels for <=8 GiB budgets
VICTORY_TEXTURE_POOL = '1'; VICTORY_RIPE_BLOCKS = '0'; VICTORY_TEXTURE_NO_WAIT = '1'; VICTORY_TEXTURE_CATCHUP = '0'
VICTORY_TEXTURE_STAGE_MS = '32'; VICTORY_LEVELS_ON_DEMAND = 'auto'
# VICTORY_POOL_SMALL at its default (textures of 64 KiB and less at 4 KiB multiples in the pool): the 64 KiB
# placement was for device losses on an AMD card. On the RTX 5070 Ti the same ~18,000 textures took 1.52 GB
# instead of 2.24 and the pool's blocks 2.8 GB instead of 3.9; no device loss in six minutes.
# Small textures at 4 KiB. RTX 2060, Series S, one switch: about 10 fps to 13, about 800 MB less on the card (2026-11-28)
VICTORY_PRELUDE_UPLOADS = '1'; VICTORY_SHOW_NEW_LATER = '1'; VICTORY_POOL_SMALL = '1'; VICTORY_TABLED_REREAD = '1'
VICTORY_QUEUE_HOST_TEXTURES = '0'
# Descriptor heaps' records
VICTORY_HEAP_SYNC_FIRST = '1'; VICTORY_SYNC_IN_PLACE = '1'; VICTORY_SPANS_QUICK = '1'; VICTORY_SYNC_FINE = '1'
VICTORY_HEAP_SYNC_AT_SUBMIT = '1'
# A frame's texture passes within 8 ms together; helpers woken at each submission's start (foxhound 0.2.0-pre.4,
# from its PR #13); the layer's threads a frame waits for above normal priority (foxhound 0.2.0-pre.3). As `victory play`.
VICTORY_TEXSPK_PASS_MS = '8'; VICTORY_PASSES_HOT = '1'; VICTORY_HELPER_PRIORITY = '1'
# Light without the title's ray tracing: an estimate of indirect light and of reflections
VICTORY_AMBIENT = '0.8'; VICTORY_AMBIENT_AIR = '1.5'; VICTORY_AMBIENT_SPECULAR = '1'
# Pixel programs keep the console's early depth test
VICTORY_EARLY_DEPTH = '1'
# 默认跳过人脸重定位和热浪;人脸重定位的新 Wave32 路径由 PLAY_FACES_FIX 启用。
# Left out: the face-relocation compute and the heat-haze pass
VICTORY_LEAVE_OUT = '02384a60fda6f2d0,731a39171b568298'
# Pipelines the title makes are written down, so `victory warm` can make them ahead
VICTORY_PIPELINE_BOOK = '1'
# Fewer makers on 16 GiB hosts reduce shader-build peak memory; `-More` can override.
# Pipelines the library cannot hold are made again every start. The wait stays at 500 ms: at 50 ms a pass
# a face needs is dropped.
VICTORY_PIPELINE_LOWEST = '0'; VICTORY_PIPELINE_WORKERS = $pipelineWorkers; VICTORY_PIPELINE_SLOW = '0'
# Memory stack (skornuta): unused texture slots given back, old allocators taken anew, small buffers packed
VICTORY_SLOT_EVICT = '1'
VICTORY_ALLOCATOR_TRIM = '1'
VICTORY_BUDGET_PACK = '1'
}
# PCs with 16 GB of RAM or less: the host copies of title memory are cut on a 1 MiB grid, and an ask without a
# length (a root view) takes its 4 MiB cell from its own 256 KiB step on, not from the cell's start. Measured on an
# RTX 5060 Laptop (8 GB) with 16 GB of RAM, Series S, the prison's day room (diagnostics build, memory line): the
# windows 3,400 -> 2,598 MB, of them those asked for without a length 2,732 -> 980 MB, the card's share of the PC's
# memory 6.0 -> 5.2 GB, and the slowest tenth of seconds 3.7 -> 11.9 fps (median 14.0 -> 14.4); release build,
# median 16.0 -> 16.4 fps. -More @{VICTORY_WINDOW_KB='4096'} restores the 4 MiB grid.
$ramGb = try { (Get-CimInstance Win32_ComputerSystem -ErrorAction Stop).TotalPhysicalMemory / 1GB } catch { 0 }
if ($ramGb -gt 0 -and $ramGb -le 16.5) {
$settings.VICTORY_WINDOW_KB = '1024'; $settings.VICTORY_WINDOW_TAILS = '1'
}
if (-not $SeriesS) {
if ($Res -eq '1440') { $settings.VICTORY_NATIVE_1440P = '1' }
elseif ($Res -eq '1080to1440') { $settings.VICTORY_RENDER_1080P = '1' }
}
# Where victory.exe keeps NVIDIA's and AMD's files (its get-dlss and get-fsr, and its first start): VICTORY_HOME,
# else %LOCALAPPDATA%\victory. Looked in after this repository's own folders, as victory.exe looks there before
# its own: without it, a PC set up with victory.exe ran this launcher without DLSS and said so only in this
# window (an RTX 5070 Ti, 2026-11-28: six measured runs with the title's own upscaling instead of DLSS Quality).
$victoryHome = if ($env:VICTORY_HOME) { $env:VICTORY_HOME } else { Join-Path $env:LOCALAPPDATA 'victory' }
if ($Dlss -ne 'off' -and $FgType -ne 'fsr4') {
# NVIDIA's files: where VICTORY_STREAMLINE_DIR says, else where Get-NVIDIA-DLSS.cmd puts them, else victory.exe's.
$sl = if ($env:VICTORY_STREAMLINE_DIR) { $env:VICTORY_STREAMLINE_DIR } else {
@((Join-Path $repo 'nvidia-sdk\Streamline\bin\x64'), (Join-Path $victoryHome 'nvidia-sdk\Streamline\bin\x64')) |
Where-Object { Test-Path (Join-Path $_ 'sl.interposer.dll') } | Select-Object -First 1
}
if (-not $sl) { $sl = Join-Path $repo 'nvidia-sdk\Streamline\bin\x64' }
if (Test-Path (Join-Path $sl 'sl.interposer.dll')) {
# Absolute: the title is started from the repository's folder, where a relative path is not found.
$sl = (Resolve-Path -LiteralPath $sl).ProviderPath
$settings.VICTORY_DLSS = '1'; $settings.VICTORY_DLSS_MODE = $Dlss; $settings.VICTORY_STREAMLINE_DIR = $sl
if ($FrameGen) { $settings.VICTORY_FRAMEGEN = '1'; $settings.VICTORY_FRAMEGEN_X = [string]$timesWanted }
elseif ($FrameGenReady -and -not $NoFrameGenReady) { $settings.VICTORY_FRAMEGEN = '1'; $settings.VICTORY_FRAMEGEN_X = '0' } # ready, off
# Frame generation takes 1.5 to 2 GB of the card's memory, which the layer otherwise fills with textures up
# to nine tenths of its budget (on a 12 GB card it then ran out: no generated frames). On from the start, it
# is left a fifth of the budget; ready but off, a little less is held back.
if ($settings.VICTORY_FRAMEGEN -eq '1') {
$settings.VICTORY_TEXTURE_ROOM_PERCENT = if ($FrameGen -and $timesWanted -gt 2) { '74' } elseif ($FrameGen) { '80' } else { '86' }
# (held back only when a frame-generation backend was made available on this adapter)
$settings.VICTORY_FRAMEGEN_ROOM_RESERVE = '1'
}
} else {
Write-Host "No NVIDIA files in ${sl}: running without DLSS and frame generation. Get-NVIDIA-DLSS.cmd in the"
Write-Host "repository folder fetches them from NVIDIA once (about 70 MB); VICTORY_STREAMLINE_DIR names another folder."
}
}
# AMD's FidelityFX DLLs: where VICTORY_FIDELITYFX_DIR says, else where Get-AMD-FSR.cmd puts them, else victory.exe's.
$fx = if ($env:VICTORY_FIDELITYFX_DIR) { $env:VICTORY_FIDELITYFX_DIR } else {
@((Join-Path $repo 'amd-sdk\FidelityFX\bin'), (Join-Path $victoryHome 'amd-fidelityfx')) |
Where-Object { Test-Path (Join-Path $_ 'amd_fidelityfx_framegeneration_dx12.dll') } | Select-Object -First 1
}
if (-not $fx) { $fx = Join-Path $repo 'amd-sdk\FidelityFX\bin' }
if (Test-Path -LiteralPath $fx) { $fx = (Resolve-Path -LiteralPath $fx).ProviderPath }
# -FgType fsr4: AMD's PC upscaler takes the title's upscalings, as `victory play --fg-type fsr4` sets it up
# (play.rs). Its scene at -Dlss's size, quality where that is off: with frame generation and no mode named the
# layer keeps the scene at the output's size, which on an RX 9070 XT (2026-11-29) rendered 2560x1440 with
# nothing upscaled and fell from about 22 to 3 fps once a save was loaded.
if ($FgType -eq 'fsr4') {
$settings.VICTORY_PC_FSR = '1'; $settings.VICTORY_FIDELITYFX_DIR = $fx
$settings.VICTORY_DLSS_MODE = if ($Dlss -eq 'off') { 'quality' } else { $Dlss }
if (-not (Test-Path (Join-Path $fx 'amd_fidelityfx_upscaler_dx12.dll'))) {
Write-Host "No AMD FSR files in ${fx}: Get-AMD-FSR.cmd in the repository's folder fetches them from AMD (about"
Write-Host '30 MB, once). Without them the title upscales on its own.'
}
}
# AMD FSR 3 frame generation: made ready as DLSS Frame Generation is (on, or ready and off for the F1 menu).
# auto: the layer uses it only where DLSS Frame Generation does not run; fsr: DLSS Frame Generation is not asked;
# fsr4: FSR 4 frame generation on AMD's PC upscaler, without DLSS.
if ($FgType -ne 'dlss' -and ($FrameGen -or ($FrameGenReady -and -not $NoFrameGenReady))) {
# Asked whatever is here: the layer checks the files and the card, and the start's notice (on the picture for
# its first 30 s, and in this window) says what runs and why not. Without DLSS it stays off, on either
# console: it needs DLSS for the upscaling.
$settings.VICTORY_FSR_FRAMEGEN = if ($FgType -eq 'fsr4') { '4' } else { '1' }; $settings.VICTORY_FIDELITYFX_DIR = $fx
if (-not (Test-Path (Join-Path $fx 'amd_fidelityfx_framegeneration_dx12.dll'))) {
Write-Host "No AMD FSR 3 files in ${fx}: Get-AMD-FSR.cmd in the repository's folder fetches them from AMD (about"
Write-Host '30 MB, once). Needed only on cards without DLSS frame generation, or with FSR 3 chosen in F1.'
}
if ($FgType -in 'fsr', 'fsr4') { $settings.Remove('VICTORY_FRAMEGEN') }
if (-not $settings.VICTORY_FRAMEGEN_X) { $settings.VICTORY_FRAMEGEN_X = if ($FrameGen) { [string]$timesWanted } else { '0' } }
if (-not $settings.VICTORY_TEXTURE_ROOM_PERCENT) {
$settings.VICTORY_TEXTURE_ROOM_PERCENT = if ($FrameGen) { '80' } else { '86' }
$settings.VICTORY_FRAMEGEN_ROOM_RESERVE = '1'
}
}
if ($FixedStep) { $settings.VICTORY_FRAME_INTERVAL_US = [string][int][math]::Round(1000000 / $fpsWanted) }
elseif ($fpsWanted -ge 1000) {
# No wait of ours, and the title told 59 (not its "no limit", which halves a per-frame scale of its own):
# real speed from 15 to 59 rendered frames a second, measured 0.985x at 30-36.
$settings.VICTORY_FRAME_INTERVAL_MS = '0'; $settings.VICTORY_TITLE_FPS = '59'
}
else { $settings.VICTORY_FRAME_INTERVAL_MS = ([math]::Round(1000 / $fpsWanted, 3)).ToString([Globalization.CultureInfo]::InvariantCulture) }
foreach ($k in $menu.Keys) {
if ($k -like 'VICTORY_MENU_*') { continue }
if ($k -eq 'VICTORY_TEXTURE_ROOM_PERCENT') { $settings.Remove('VICTORY_FRAMEGEN_ROOM_RESERVE') }
if ($menu[$k]) { $settings[$k] = $menu[$k] } else { $settings.Remove($k) }
}
# -More: a hashtable from a PowerShell window, or NAME=VALUE strings where one cannot be written
# (Steam's launch options, and anything else that starts this with -File, hand the arguments over
# as they were typed).
$moreSettings = [ordered]@{}
foreach ($item in $More) {
if ($item -is [System.Collections.IDictionary]) {
foreach ($k in $item.Keys) { $moreSettings["$k"] = "$($item[$k])" }
continue
}
# A command line PowerShell did not split itself (Steam's, and -File's): the pairs may be
# comma-separated there. A comma inside a value is left alone — VICTORY_LEAVE_OUT has one —
# so only a comma in front of another NAME= separates.
foreach ($pair in ("$item" -split ',(?=\s*VICTORY_[A-Z0-9_]+\s*=)')) {
if ($pair -match '^\s*(VICTORY_[A-Z0-9_]+)\s*=(.*)$') {
$moreSettings[$Matches[1]] = $Matches[2].Trim()
} elseif ("$pair") {
Write-Host "Ignoring -More `"$pair`": not NAME=VALUE."
}
}
}
foreach ($k in $moreSettings.Keys) {
if ($k -eq 'VICTORY_TEXTURE_ROOM_PERCENT') { $settings.Remove('VICTORY_FRAMEGEN_ROOM_RESERVE') }
if ($moreSettings[$k]) { $settings[$k] = $moreSettings[$k] } else { $settings.Remove($k) }
}
# A held mouse that is not put back in the middle stops at the window's edge, and with it the turning.
if ($settings.VICTORY_MOUSE_CAPTURE -eq '1' -and -not $settings.Contains('VICTORY_MOUSE_WARP')) { $settings.VICTORY_MOUSE_WARP = '1' }
# Mouse and keyboard (F1, MOUSE AND KEYBOARD), as victory.exe play does it (play.rs): the keys and
# sensitivity in bindings.ini in %LOCALAPPDATA%\victory (VICTORY_HOME if set), written with the
# repository's defaults the first time, and the game started with it. Without that file named, the game
# had no mouse and keyboard however the menu was set, and KEY BINDINGS asked to turn them on (#1369).
# A VICTORY_MNK_BINDINGS given with -More names another file.
if ($settings.VICTORY_MNK -eq '1' -and -not $settings.VICTORY_MNK_BINDINGS) {
$mnkHome = if ($env:VICTORY_HOME) { $env:VICTORY_HOME } else { Join-Path $env:LOCALAPPDATA 'victory' }
$bindings = Join-Path $mnkHome 'bindings.ini'
if (-not (Test-Path -LiteralPath $bindings)) {
New-Item -ItemType Directory -Force -Path $mnkHome | Out-Null
# A copy that fails when the file is there, so the player's own keys are never written over
# (a file made since the check above, or one the check could not see); as play.rs does it.
try { [System.IO.File]::Copy((Join-Path $repo 'bindings.ini'), $bindings, $false) } catch { }
}
if (Test-Path -LiteralPath $bindings) {
$settings.VICTORY_MNK_BINDINGS = $bindings
Write-Host "mouse/keyboard on: keys and sensitivity in $bindings"
}
}
$console = if ($SeriesS) { 'series-s' } else { 'series-x' }
# For the menu: what it shows as the current choices, where it saves, and how it starts the game again
# (-More is not carried over a restart from the menu).
$settings.VICTORY_MENU_CONSOLE = $console
$settings.VICTORY_MENU_RES = $Res
$settings.VICTORY_MENU_DLSS = if ($hasSavedDlss -or $settings.VICTORY_DLSS -eq '1') { $Dlss } else { 'off' }
if ($ForceMfg -and $settings.VICTORY_DLSS -eq '1') {
$mfgDir = Join-Path $env:LOCALAPPDATA 'victory\mfg-unlocker'
& powershell.exe -NoProfile -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot 'get-mfg-unlocker.ps1') -To $mfgDir
$mfgDll = Join-Path $mfgDir 'MFGUnlocker.dll'
if (Test-Path -LiteralPath $mfgDll) {
$settings.VICTORY_MFG_UNLOCKER = '1'; $settings.VICTORY_MFG_UNLOCKER_DLL = $mfgDll; $settings.VICTORY_FORCE_MFG_RTX40 = '1'
} else {
Write-Warning 'MFG Unlocker did not arrive: frame generation stays at what the card gives (2x on RTX 40).'
}
}
$settings.VICTORY_MENU_FRAMEGEN = if ($settings.VICTORY_FRAMEGEN -eq '1' -or $settings.VICTORY_FSR_FRAMEGEN -in '1', '4') { [string]$settings.VICTORY_FRAMEGEN_X } else { '0' }
$settings.VICTORY_MENU_FG_TYPE = $FgType
$settings.VICTORY_MENU_FPS = [string]$fpsWanted
$settings.VICTORY_MENU_FILE = $menuFile
$settings.VICTORY_MENU_PLAY = $MyInvocation.MyCommand.Path
$settings.VICTORY_MENU_CWD = $PWD.ProviderPath
$settings.VICTORY_MENU_ARGS = "-Exe `$env:VICTORY_MENU_EXE -Build $Build$(if ($FrameGenReady -and -not $NoFrameGenReady) { ' -FrameGenReady' })$(if ($FixedStep) { ' -FixedStep' })" +
$(if ($Splash) { " -Splash '$($Splash -replace "'", "''")'" }) + $(if ($NoPreloadWindow) { ' -NoPreloadWindow' })
$victory = Join-Path $repo "target\$Build\victory.exe"
if (-not (Test-Path $victory)) {
# Not built yet: built here, once.
if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) { Write-Host "No $victory, and no cargo to build it with: install Rust (README), then start this again."; exit 1 }
Write-Host 'Building the layer (a few minutes the first time) ...'
Push-Location $repo
try {
if ($Build -eq 'diag') { cargo build --locked --profile diag -p victory --features diagnostics }
else { cargo build --release --locked -p victory }
} finally { Pop-Location }
if (-not (Test-Path $victory)) { Write-Host "The build did not make $victory."; exit 1 }
}
if (-not (Test-Path -LiteralPath $Exe)) { Write-Host "No $Exe."; exit 1 }
# Absolute before the folder changes below: the title is started from the repository's folder, where a
# relative path would not be found (the check above looks from the folder the launcher was started in).
$Exe = (Resolve-Path -LiteralPath $Exe).ProviderPath
# Every translated shader is SM 6.6. Windows 10's own Direct3D 12 stops at 6.5, and with no D3D12\D3D12Core.dll
# beside victory.exe it makes no device at all ("none"); `victory get-d3d12` fetches Microsoft's newer runtime
# there, as `victory play` does. Asked only while that folder is missing; nothing is fetched at 6.6 or above.
if (-not (Test-Path -LiteralPath (Join-Path (Split-Path -Parent $victory) 'D3D12\D3D12Core.dll'))) {
$model = "$(& $victory shader-model 2>$null | Select-Object -Last 1)".Trim()
if ($model -notmatch '^\d+\.\d+$' -or [version]$model -lt [version]'6.6') {
Write-Host "Direct3D 12 here runs shader model $(if ($model -match '^\d+\.\d+$') { $model } else { 'none (no device)' }); the game's translated shaders need 6.6."
& $victory get-d3d12
if ($LASTEXITCODE -ne 0 -and $model -match '^\d+\.\d+$') {
Write-Host "Microsoft's Direct3D 12 runtime did not arrive: every shader would be refused. ``$victory get-d3d12`` tries again."
exit 1
}
}
}
$settings.VICTORY_MENU_EXE = $Exe
# The optional ReShade host has its own application directory. DXGI and its
# add-ons are discovered next to that executable, including at process start.
# For an RTX 40, install the full add-on edition of ReShade and the optional
# mavismmg/MFGAdaUnlock-RenoDx add-on in target/<build>/ada-mfg. In a new
# PowerShell session set $env:GTA6_ADA_MFG='1' and $env:GTA6_FRAMEGEN_X='4',
# then run .\PLAY_FRAMEGEN.cmd 3. The multiplier override accepts 2 through 6.
if ($env:GTA6_ADA_MFG -eq '1') {
$hostDir = Join-Path $repo "target\$Build\ada-mfg"
foreach ($file in 'dxgi.dll', 'renodx-mfgunlock.addon64') {
if (-not (Test-Path -LiteralPath (Join-Path $hostDir $file) -PathType Leaf)) {
throw "The optional Ada MFG host is missing $file in $hostDir"
}
}
$hostExe = Join-Path $hostDir 'victory.exe'
if (-not (Test-Path -LiteralPath $hostExe) -or (Get-FileHash $victory).Hash -ne (Get-FileHash $hostExe).Hash) {
Copy-Item -LiteralPath $victory -Destination $hostExe -Force -ErrorAction Stop
}
$victory = $hostExe
}
# Switches left over in this window are cleared; path settings and the card stay, as the launcher's KEPT
# keeps them (apps\victory\src\play.rs; victory.toml gives the paths otherwise). Cleared, VICTORY_HOME sent
# the preload's and the game's caches to %LOCALAPPDATA% (#751).
$paths = 'VICTORY_MENU_PAD', 'VICTORY_HOME', 'VICTORY_ADAPTER', 'VICTORY_CONFIG', 'VICTORY_GAME_DIR', 'VICTORY_CACHE_DIR', 'VICTORY_DATA_DIR', 'VICTORY_STREAMLINE_DIR', 'VICTORY_FIDELITYFX_DIR', 'VICTORY_LOG'
Get-ChildItem Env:VICTORY_* -ErrorAction SilentlyContinue | Where-Object { $_.Name -notin $paths } | ForEach-Object { Remove-Item "Env:$($_.Name)" }
# Play mode's defaults that are part of the shader translation key (apps\victory\src\play.rs): without them
# a cache made by `victory preload` is never hit and every shader is translated again in play (#4067).
foreach ($k in 'VICTORY_BVH_MISS', 'VICTORY_NAN_SCRUB', 'VICTORY_SAMPLED_MARKS') { if (-not $settings.ContainsKey($k)) { $settings[$k] = '1' } }
foreach ($k in $settings.Keys) { Set-Item "Env:$k" $settings[$k] }
$logs = Join-Path $homeDir 'logs'; New-Item -ItemType Directory -Force $logs | Out-Null
$log = Join-Path $logs ('victory-nvidia-{0:yyyyMMdd-HHmmss}.log' -f (Get-Date))
$writer = [IO.StreamWriter]::new($log, $false, [Text.UTF8Encoding]::new($false)); $writer.AutoFlush = $true
$writer.WriteLine("# console=$console build=$Build preload=$preload warm-used=$WarmUsed switches: " + (($settings.GetEnumerator() | Sort-Object Name | ForEach-Object { "$($_.Name)=$($_.Value)" }) -join ' '))
Write-Host "Log: $log"
Push-Location $repo # victory.toml is read from here
try {
if ($clearShaders) {
& $victory clear-shaders 2>&1 | ForEach-Object { $line = "$_"; $writer.WriteLine("# clear-shaders: $line"); $line }
}
if ($WarmUsed) {
$warmArgs = @('warm', '--used')
if ($settings.VICTORY_PRELOAD_JOBS -match '^[1-9][0-9]*$') {
$warmArgs += @('--jobs', $settings.VICTORY_PRELOAD_JOBS)
}
& $victory @warmArgs 2>&1 | ForEach-Object { $line = "$_"; $writer.WriteLine($line); $line }
exit $LASTEXITCODE
}
if ($preload) {
# With this start's switches (the translations depend on them); its lines go to the log too.
Write-Host 'Preloading shaders before the game starts. This takes a while (see the lines below).'
$began = Get-Date
if (-not $NoPreloadWindow) {
$preloadWindow = Start-PreloadWindow -Splash (Get-SplashImage $Exe $Splash) -Icon (Get-SplashIcon $Exe) `
-StateFile (Join-Path $env:LOCALAPPDATA 'victory\preload-last.txt')
}
# (Split-Path -LiteralPath with -Parent: no such parameter set in Windows PowerShell 5.1.)
& $victory preload ([IO.Path]::GetDirectoryName($Exe)) 2>&1 | ForEach-Object {
$line = "$_"; $writer.WriteLine("# preload: $line"); Update-PreloadWindow $preloadWindow $line; $line
}
$code = $LASTEXITCODE
$minutes = ((Get-Date) - $began).TotalMinutes
$how = if ($preloadWindow -and $preloadWindow.Skipped) { 'skipped (what it did is kept)' } elseif ($code -eq 0) { 'done' } else { "ended with code $code" }
$said = 'Preload {0} after {1:N1} min. Starting the game.' -f $how, $minutes
$writer.WriteLine("# $said"); Write-Host $said
Complete-PreloadWindow $preloadWindow ('Preload {0} after {1:N1} min.' -f $how, $minutes) ($code -eq 0)
}
# DLSS Enabler (winmm.dll beside victory.exe) stays off in a process with a console window or console output,
# so the layer runs without a window and its output comes through a pipe.
$env:VFG_BIN = $victory; $env:VFG_EXE = $Exe
$psi = [Diagnostics.ProcessStartInfo]::new('cmd.exe', ('/d /s /c ""%VFG_BIN%" run "%VFG_EXE%" --console {0} --execute 2>&1"' -f $console))
$psi.UseShellExecute = $false; $psi.CreateNoWindow = $true; $psi.RedirectStandardOutput = $true
$psi.StandardOutputEncoding = [Text.UTF8Encoding]::new($false); $psi.WorkingDirectory = $repo
$p = [Diagnostics.Process]::Start($psi)
while ($null -ne ($line = $p.StandardOutput.ReadLine())) { $writer.WriteLine($line); $line }
$p.WaitForExit()
$global:LASTEXITCODE = $p.ExitCode
}
finally { Pop-Location; $writer.Dispose(); Close-PreloadWindow $preloadWindow }
# What `victory run` returned: a title that failed is a failed start for whoever called this script.
exit $LASTEXITCODE

View File

@ -1,230 +0,0 @@
//! `play-foxhound.exe`: `scripts\play-foxhound.ps1` as a program Steam will take.
//!
//! Steam's "Add a Non-Steam Game" browser lists `.exe` files only, so the script launcher
//! cannot be picked there, and a game started outside Steam gets neither Steam's overlay nor
//! Steam Input. Steam Input is what a Stadia controller needs: over Bluetooth it is a generic
//! HID pad, not XInput, and Steam Input is what turns it into the virtual Xbox pad the title
//! reads (`XInputGetState`, crates\victory-hle\src\modules\gameinput.rs).
//!
//! So this program is the script with a program's name: it starts Windows PowerShell with the
//! `play-foxhound.ps1` beside it and hands on every argument it was given, which makes Steam's
//! launch options the script's own options:
//!
//! -Exe "D:\Games\MyDump\game_scarlett_master.exe"
//!
//! A first argument that is not a switch is taken as the title's path and gets `-Exe` put in
//! front of it, so the launch options can be just that path. Started with no argument at all
//! (a double click), the arguments are read from `play-args.txt` beside this program, one
//! argument a line (`#` comments and blank lines skipped).
//!
//! It waits for the script and for the game the script starts, and returns the script's exit
//! code: Steam counts the game as running, and keeps Steam Input on it, for as long as this
//! program lives.
//!
//! Built by `scripts\build-steam-launcher.cmd` (rustc, no crates, no cargo).
use std::io::{IsTerminal, Write};
use std::path::{Path, PathBuf};
use std::process::{Command, ExitCode};
/// The launcher this program stands in for, looked for beside the program.
const SCRIPT: &str = "play-foxhound.ps1";
/// Where the arguments are read from when none are given on the command line.
const ARGS_FILE: &str = "play-args.txt";
fn main() -> ExitCode {
let Some(here) = std::env::current_exe()
.ok()
.and_then(|program| program.parent().map(Path::to_path_buf))
else {
return fail("Cannot tell which folder this program is in.");
};
let script = here.join(SCRIPT);
if !script.is_file() {
return fail(&format!(
"No {SCRIPT} beside this program ({}).",
here.display()
));
}
let args = match given_args() {
Ok(args) => args,
Err(message) => return fail(&message),
};
let args = script_args(args);
if args.is_empty() {
return fail(&usage(&here));
}
let powershell = powershell();
println!("Starting {SCRIPT} with {}", powershell.display());
println!(" arguments: {}", args.join(" "));
let status = Command::new(&powershell)
.args(["-NoProfile", "-ExecutionPolicy", "Bypass", "-File"])
.arg(&script)
.args(&args)
// The script finds the repository from its own folder; this makes a relative path in
// the arguments mean the same thing whoever starts the program.
.current_dir(&here)
.status();
match status {
// The script's own code: a failed start stays a failed start for Steam.
Ok(status) => ExitCode::from(u8::try_from(status.code().unwrap_or(1)).unwrap_or(1)),
Err(e) => fail(&format!("Windows PowerShell could not be started: {e}")),
}
}
/// The arguments from the command line, else from `play-args.txt` beside this program.
fn given_args() -> Result<Vec<String>, String> {
let given: Vec<String> = std::env::args_os()
.skip(1)
.map(|a| a.to_string_lossy().into_owned())
.collect();
if !given.is_empty() {
return Ok(given);
}
let file = std::env::current_exe()
.ok()
.and_then(|program| program.parent().map(|here| here.join(ARGS_FILE)))
.ok_or("Cannot tell which folder this program is in.")?;
read_args_file(&file).map_err(|e| format!("{}: {e}", file.display()))
}
/// The lines of `path`, one argument each: blank lines and lines starting with `#` are left
/// out. A file that is not there is no arguments at all.
fn read_args_file(path: &Path) -> std::io::Result<Vec<String>> {
if !path.is_file() {
return Ok(Vec::new());
}
Ok(std::fs::read_to_string(path)?
.lines()
.map(str::trim)
.filter(|line| !line.is_empty() && !line.starts_with('#'))
.map(str::to_owned)
.collect())
}
/// The script's arguments: a first one that is not a switch is the title's path and gets
/// `-Exe` in front of it (`play-foxhound.exe "D:\Games\MyDump\game_scarlett_master.exe"`), so
/// Steam's launch options can be just the path.
fn script_args(given: Vec<String>) -> Vec<String> {
let mut args = given;
if args.first().is_some_and(|first| !first.starts_with('-')) {
args.insert(0, "-Exe".to_owned());
}
args
}
/// Where Windows PowerShell is: its own folder, which no `powershell.exe` of another program
/// beside this one can stand in for; else whatever `powershell.exe` the PATH finds.
fn powershell() -> PathBuf {
let system = std::env::var_os("SystemRoot")
.map(PathBuf::from)
.unwrap_or_else(|| PathBuf::from(r"C:\Windows"));
let windows_powershell = system
.join("System32")
.join("WindowsPowerShell")
.join("v1.0")
.join("powershell.exe");
if windows_powershell.is_file() {
windows_powershell
} else {
PathBuf::from("powershell.exe")
}
}
/// What to put into Steam's launch options for this game, or into `play-args.txt`.
fn usage(here: &Path) -> String {
[
"No arguments: the script needs the title's executable.".to_owned(),
String::new(),
"Put this line into Steam's launch options for this game (right-click the game,".to_owned(),
"Properties, Launch Options):".to_owned(),
String::new(),
r#" "D:\Games\MyDump\game_scarlett_master.exe""#.to_owned(),
String::new(),
format!(
"or write it into {} beside this program.",
here.join(ARGS_FILE).display()
),
"The script's own options work too (-FrameGen, -SeriesS, -Dlss balanced, -Fps 60, ...);"
.to_owned(),
format!(
"what each is for is at the top of {}.",
here.join(SCRIPT).display()
),
]
.join("\n")
}
/// A message for a start that cannot go on, and, when a window was started by hand rather
/// than by Steam, that window kept open to read it.
fn fail(message: &str) -> ExitCode {
eprintln!("{message}");
hold_window();
ExitCode::from(2)
}
/// After a failure in a window of its own (a double click): the text stays until a key is
/// pressed. Steam starts the game without a terminal, so nothing waits there.
fn hold_window() {
if std::io::stdin().is_terminal() {
print!("Press Enter to close this window.");
let _ = std::io::stdout().flush();
let _ = std::io::stdin().read_line(&mut String::new());
}
}
#[cfg(test)]
mod tests {
use super::*;
/// A path alone is the title; a switch is already the script's own.
#[test]
fn a_first_path_is_the_title() {
let title = r"D:\Games\MyDump\game_scarlett_master.exe".to_owned();
assert_eq!(
script_args(vec![title.clone()]),
vec!["-Exe".to_owned(), title.clone()]
);
assert_eq!(
script_args(vec![title.clone(), "-FrameGen".to_owned()]),
vec!["-Exe".to_owned(), title.clone(), "-FrameGen".to_owned()]
);
let given = vec![
"-Exe".to_owned(),
title,
"-Dlss".to_owned(),
"balanced".to_owned(),
];
assert_eq!(script_args(given.clone()), given);
assert_eq!(script_args(Vec::new()), Vec::<String>::new());
}
/// One argument a line; `#` and blank lines are not arguments, and no file is no arguments.
#[test]
fn the_arguments_file_is_one_argument_a_line() {
let path = std::env::temp_dir().join(format!("play-args-test-{}.txt", std::process::id()));
std::fs::write(&path, "# the title via Steam\r\n\r\n -Exe \r\nD:\\Games\\MyDump\\game_scarlett_master.exe\r\n-FrameGen\r\n")
.unwrap();
let args = read_args_file(&path).unwrap();
let _ = std::fs::remove_file(&path);
assert_eq!(
args,
vec![
"-Exe",
r"D:\Games\MyDump\game_scarlett_master.exe",
"-FrameGen"
]
);
assert!(read_args_file(&path).unwrap().is_empty());
}
/// The script is the one beside the program.
#[test]
fn the_script_is_beside_the_program() {
let here = std::env::current_dir().unwrap();
assert_eq!(here.join(SCRIPT).file_name().unwrap(), "play-foxhound.ps1");
assert!(powershell().is_absolute());
}
}

View File

@ -9,7 +9,7 @@
# after every command (=light) cost an RTX 2080 Ti about 37 ms of card time a frame. For a device
# loss: -More @{VICTORY_D3D12_DRED='light'}
# Run it from a normal window, not as administrator: the driver then keeps its shader cache elsewhere.
# These are the settings docs\findings.md was measured with. scripts\play-foxhound.ps1 and victory.exe play set
# These are the settings docs\findings.md was measured with. scripts\play-nvidia.ps1 and victory.exe play set
# more since (the heaps' records at the submit, write-combined copies left on the card, the texture pool's): to
# compare with those, pass them with -More.
param(

View File

@ -1,5 +1,5 @@
# The preload's progress window: the title's splash screen with the step the preload is at, how far it is, and
# about how long is left. play-foxhound.ps1 dot-sources this and passes it every line `victory preload` prints;
# about how long is left. play-nvidia.ps1 dot-sources this and passes it every line `victory preload` prints;
# the window runs on a thread of its own, so it stays responsive while the preload is quiet. Skip (or Esc) ends
# the preload (what it did is kept) and lets the game start; the window closes when the game's window opens.
# Nothing here is needed for a start: if the window cannot open, the preload goes on in the console alone.