Windows 10 runtime, F1 preload fix, AMD FSR download, warm-up restart, MFG Unlocker notice
- Windows 10: every pipeline was refused (E_INVALIDARG) and the game closed within seconds, because Windows 10's own Direct3D 12 stops at shader model 6.5 and the translated shaders are 6.6. victory.exe now exports D3D12SDKVersion = 614 and D3D12SDKPath = .\D3D12\. Where the GPU runs below 6.6, `play` offers Microsoft's D3D12Core.dll (Agility SDK 1.614.1, from nuget.org; pinned SHA-256 and Microsoft signature checked) into D3D12 beside the exe, then checks again and stops with a clear message if it still can't. `victory get-d3d12` does it by hand. The host logs its shader model and runtime file. Windows 11 keeps using its own newer runtime. - F1 > PRELOAD SHADERS: the restart passed the script launcher's -Preload to victory.exe, which refused it, and the window closed at once. It now sets VICTORY_PRELOAD=1, which both launchers read, and a failed restart keeps its window open. - AMD FSR 3 files: offered for download where FSR 3 would be used (`victory get-fsr`, Get-AMD-FSR.cmd, scripts\get-amd-fsr.ps1; pinned hashes, AMD signature). - First start of a new victory.exe: it ran at a flat 14 fps for the whole session and normally from the second start on. The first start now plays 20 s with a notice, marks that exe under %LOCALAPPDATA%\victory\warmed and restarts by itself once (VICTORY_WARMUP_RESTART=0: not done). - RTX 20/30 with DLSS frame generation running (MFG Unlocker as winmm.dll beside the exe): the start notice says it is unlocked by a mod, and the log names DLLs beside victory.exe. - README: the above. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
ca9c75cd6d
commit
10862a6d87
14 files changed
+653
-12
No files matched your search
@@ -79,6 +79,8 @@ Thumbs.db
|
||||
|
||||
# NVIDIA's own files (Get-NVIDIA-DLSS.cmd fetches them from NVIDIA; never part of this repository)
|
||||
/nvidia-sdk/
|
||||
# AMD's own files (Get-AMD-FSR.cmd fetches them from AMD; never part of this repository)
|
||||
/amd-sdk/
|
||||
# What the F1 menu saved
|
||||
/victory-settings.txt
|
||||
/victory-settings.*.txt
|
||||
@@ -0,0 +1,8 @@
|
||||
@echo off
|
||||
rem Downloads the AMD files that FSR 3 frame generation needs (about 30 MB) from AMD's own GitHub
|
||||
rem (the FidelityFX SDK) and puts them where the launcher looks for them (amd-sdk\ in this folder).
|
||||
rem Run it once. They are AMD's files under AMD's licence, which is saved beside them; this repository
|
||||
rem does not contain them. FSR 3 is the frame generation for cards without DLSS frame generation.
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0scripts\get-amd-fsr.ps1" %*
|
||||
echo.
|
||||
pause
|
||||
@@ -29,9 +29,14 @@
|
||||
DLSS, or FSR 3 (also on an RTX 40/50, if you prefer it). FRAME GENERATION
|
||||
switches it off or on.
|
||||
- FSR 3 needs AMD's FidelityFX DLLs (`amd_fidelityfx_loader_dx12.dll` and
|
||||
`amd_fidelityfx_framegeneration_dx12.dll`, from AMD's FidelityFX SDK). They
|
||||
are AMD's and not part of this program: put them in a `fidelityfx` folder
|
||||
next to `victory.exe`, or name their folder with `VICTORY_FIDELITYFX_DIR`.
|
||||
`amd_fidelityfx_framegeneration_dx12.dll`, about 30 MB). They are AMD's and
|
||||
not part of this program. On a card without DLSS frame generation (or with
|
||||
FSR 3 chosen in F1) the first start of `victory.exe` asks once whether to
|
||||
download them from AMD's own GitHub (the FidelityFX SDK);
|
||||
`victory.exe get-fsr` does it later, and `Get-AMD-FSR.cmd` does it for the
|
||||
script launcher. Each file is checked against the copy this fork was tested
|
||||
with, and only loaded with AMD's valid signature. A `fidelityfx` folder next
|
||||
to `victory.exe`, or `VICTORY_FIDELITYFX_DIR`, works too.
|
||||
|
||||
## Quick start: how to run it
|
||||
|
||||
@@ -48,11 +53,31 @@
|
||||
generation files (about 70 MB) from NVIDIA's own GitHub. They are NVIDIA's
|
||||
and are not part of this program; say no and the game still runs, with its
|
||||
own upscaling and no frame generation.
|
||||
- Nothing is written into your game folder: settings, saves, caches, logs and
|
||||
NVIDIA's files are kept under `%LOCALAPPDATA%\victory`.
|
||||
- Settings, saves, caches, logs and NVIDIA's and AMD's files are kept under
|
||||
`%LOCALAPPDATA%\victory`. The one exception is on Windows 10. Its own Direct3D 12
|
||||
stops at shader model 6.5, and the game's translated shaders need 6.6. Without
|
||||
6.6 the game shows a black screen and closes within seconds. So the first start
|
||||
there offers to fetch Microsoft's newer Direct3D 12 runtime (the D3D12 Agility
|
||||
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.
|
||||
The file is checked against Microsoft's signature and the tested SHA-256.
|
||||
Windows 11 keeps using its own runtime.
|
||||
- You need Windows 10 or 11, 32 GB of RAM or more, an SSD and an NVIDIA
|
||||
GeForce RTX card with a recent driver. This repository and its releases
|
||||
contain no game files.
|
||||
- **The first start of each new version restarts by itself once.** A new
|
||||
`victory.exe` runs at about 14 fps on its first start, and normally from then
|
||||
on. So the first start plays about 20 seconds, says so at the top of the
|
||||
picture, and starts the game again. It doesn't happen again for that version
|
||||
(a mark is kept in `%LOCALAPPDATA%\victory\warmed`).
|
||||
- RTX 20 and 30 cards can try DLSS frame generation with the
|
||||
[MFG Unlocker](https://github.com/dashdogy/MFG-Unlocker) mod (not ours, and
|
||||
not tested with this fork, which was only run on an RTX 50). Download it from
|
||||
its own releases, rename `MFGUnlocker.dll` to `winmm.dll` and put it beside
|
||||
`victory.exe`. victory.exe loads `winmm.dll`, so Windows starts the mod with it.
|
||||
The start's notice then says "UNLOCKED BY A MOD" and the log names the DLL. If
|
||||
the game crashes or frame generation fails, delete that `winmm.dll`. FSR 3
|
||||
frame generation (2x) is the supported way on those cards.
|
||||
|
||||
**In the game**
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
//! victory.exe exports `D3D12SDKVersion` and `D3D12SDKPath` (main.rs): Windows'
|
||||
//! Direct3D 12 reads them from the process's executable to load Microsoft's
|
||||
//! newer runtime from `D3D12\` beside it. An executable exports nothing by
|
||||
//! itself, so the linker is told to.
|
||||
fn main() {
|
||||
if std::env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc") {
|
||||
println!("cargo:rustc-link-arg-bins=/EXPORT:D3D12SDKVersion,DATA");
|
||||
println!("cargo:rustc-link-arg-bins=/EXPORT:D3D12SDKPath,DATA");
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,33 @@ use std::path::PathBuf;
|
||||
use anyhow::Result;
|
||||
use clap::{Parser, Subcommand, ValueEnum};
|
||||
|
||||
/// The Direct3D 12 runtime this program asks Windows for: Microsoft's D3D12
|
||||
/// Agility SDK 1.614, from `D3D12\D3D12Core.dll` beside victory.exe where it
|
||||
/// is there (exported by build.rs). Windows uses it only where its own is
|
||||
/// older: Windows 10's stops at shader model 6.5, and the translated shaders
|
||||
/// are 6.6 (`victory play` fetches it there; 2026-11-27, an RTX 3060 on
|
||||
/// Windows 10 22H2 had every pipeline refused). Without the folder, nothing changes.
|
||||
#[cfg(windows)]
|
||||
#[unsafe(no_mangle)]
|
||||
#[used]
|
||||
#[allow(non_upper_case_globals)]
|
||||
pub static D3D12SDKVersion: u32 = 614;
|
||||
|
||||
/// `D3D12SDKPath`'s value: a pointer to a C string.
|
||||
#[cfg(windows)]
|
||||
#[repr(transparent)]
|
||||
pub struct SdkPath(*const std::ffi::c_char);
|
||||
// SAFETY: it points at a string literal, never written.
|
||||
#[cfg(windows)]
|
||||
unsafe impl Sync for SdkPath {}
|
||||
|
||||
/// Where `D3D12Core.dll` is, from victory.exe's folder.
|
||||
#[cfg(windows)]
|
||||
#[unsafe(no_mangle)]
|
||||
#[used]
|
||||
#[allow(non_upper_case_globals)]
|
||||
pub static D3D12SDKPath: SdkPath = SdkPath(c".\\D3D12\\".as_ptr());
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(
|
||||
name = "victory",
|
||||
@@ -150,6 +177,22 @@ enum Command {
|
||||
/// (about 70 MB) to where `play` looks for them.
|
||||
#[cfg(windows)]
|
||||
GetDlss,
|
||||
/// Fetch AMD's FSR 3 frame generation files from AMD's GitHub (about
|
||||
/// 30 MB) to where `play` looks for them: frame generation on cards
|
||||
/// without DLSS frame generation.
|
||||
#[cfg(windows)]
|
||||
GetFsr,
|
||||
/// Fetch Microsoft's newer Direct3D 12 runtime (D3D12Core.dll, about
|
||||
/// 22 MB from nuget.org) into `D3D12` beside this program: Windows 10,
|
||||
/// whose own Direct3D 12 does not run the translated shaders. `play`
|
||||
/// does it by itself where it is needed.
|
||||
#[cfg(windows)]
|
||||
GetD3d12,
|
||||
/// Print the highest shader model the default GPU runs here (`play`
|
||||
/// asks it in a process of its own).
|
||||
#[cfg(windows)]
|
||||
#[command(hide = true)]
|
||||
ShaderModel,
|
||||
/// Prepare, map and bind a title executable; with --execute, run it.
|
||||
Run {
|
||||
exe: PathBuf,
|
||||
@@ -295,6 +338,22 @@ fn main() -> Result<()> {
|
||||
Command::Play(_) => unreachable!("handled above"),
|
||||
#[cfg(windows)]
|
||||
Command::GetDlss => play::get_dlss(),
|
||||
#[cfg(windows)]
|
||||
Command::GetFsr => play::get_fsr(),
|
||||
#[cfg(windows)]
|
||||
Command::GetD3d12 => play::get_d3d12(),
|
||||
#[cfg(windows)]
|
||||
Command::ShaderModel => {
|
||||
let model = victory_hle::streamline::highest_shader_model();
|
||||
if let Some(core) = victory_hle::streamline::d3d12_core_path() {
|
||||
println!("runtime {}", core.display());
|
||||
}
|
||||
match model {
|
||||
Some((major, minor)) => println!("{major}.{minor}"),
|
||||
None => println!("none"),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
Command::Run {
|
||||
exe,
|
||||
unimplemented,
|
||||
|
||||
+265
-1
@@ -12,6 +12,15 @@
|
||||
//! this program. Where they are missing, the first start asks once whether to
|
||||
//! fetch them from NVIDIA's own GitHub (`victory get-dlss` does it later);
|
||||
//! without them the title runs with its own upscaling.
|
||||
//!
|
||||
//! AMD's FSR 3 frame generation files are AMD's, likewise: on a card without
|
||||
//! DLSS Frame Generation (or with FSR 3 chosen in F1) the first start asks
|
||||
//! once whether to fetch them from AMD's own GitHub (`victory get-fsr`).
|
||||
//!
|
||||
//! The one thing that goes beside the program: on a PC whose Direct3D 12 runs
|
||||
//! no shader model 6.6 (Windows 10's own stops at 6.5), Microsoft's newer
|
||||
//! runtime, `D3D12\D3D12Core.dll` from Microsoft's NuGet package, after asking
|
||||
//! (`victory get-d3d12`). Windows loads it only from there (main.rs).
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::io::{IsTerminal, Write};
|
||||
@@ -25,6 +34,15 @@ const GAME: &str = "game_scarlett_master.exe";
|
||||
/// `scripts\get-nvidia-sdks.ps1`, run by Windows PowerShell.
|
||||
const FETCH: &str = include_str!("../../../scripts/get-nvidia-sdks.ps1");
|
||||
|
||||
/// `scripts\get-amd-fsr.ps1`, run by Windows PowerShell.
|
||||
const FETCH_FSR: &str = include_str!("../../../scripts/get-amd-fsr.ps1");
|
||||
|
||||
/// `scripts\get-d3d12.ps1`, run by Windows PowerShell.
|
||||
const FETCH_D3D12: &str = include_str!("../../../scripts/get-d3d12.ps1");
|
||||
|
||||
/// The two AMD files FSR 3 frame generation loads.
|
||||
const FSR_FILES: [&str; 2] = ["amd_fidelityfx_loader_dx12.dll", "amd_fidelityfx_framegeneration_dx12.dll"];
|
||||
|
||||
/// The settings the title is started with (`scripts\play-foxhound.ps1` has
|
||||
/// the same, with what each is for).
|
||||
const SETTINGS: &[(&str, &str)] = &[
|
||||
@@ -195,6 +213,25 @@ fn streamline_dir(here: &Path) -> Option<PathBuf> {
|
||||
named.into_iter().chain(ours).chain(beside).find(|d| has_streamline(d))
|
||||
}
|
||||
|
||||
/// Where `victory get-fsr` puts AMD's files.
|
||||
fn amd_home() -> Result<PathBuf> {
|
||||
Ok(home()?.join("amd-fidelityfx"))
|
||||
}
|
||||
|
||||
fn has_fsr(dir: &Path) -> bool {
|
||||
FSR_FILES.iter().all(|f| dir.join(f).is_file())
|
||||
}
|
||||
|
||||
/// The folder with AMD's FSR 3 files: the one `VICTORY_FIDELITYFX_DIR` names,
|
||||
/// where `get-fsr` puts them, or beside this program (a `fidelityfx` folder,
|
||||
/// a repository's `amd-sdk`, or the files themselves).
|
||||
fn fidelityfx_dir(here: &Path) -> Option<PathBuf> {
|
||||
let named = std::env::var_os("VICTORY_FIDELITYFX_DIR").filter(|v| !v.is_empty()).map(PathBuf::from);
|
||||
let ours = amd_home().ok();
|
||||
let beside = [here.join("fidelityfx"), here.join("amd-sdk").join("FidelityFX").join("bin"), here.to_path_buf()];
|
||||
named.into_iter().chain(ours).chain(beside).find(|d| has_fsr(d))
|
||||
}
|
||||
|
||||
/// The lines `NAME=value` of the menu's file.
|
||||
fn parse_menu(text: &str) -> Vec<(String, String)> {
|
||||
text.lines()
|
||||
@@ -389,6 +426,189 @@ fn offer_dlss() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Runs the AMD fetcher: AMD's FSR 3 files from AMD's GitHub into `to`.
|
||||
fn fetch_fsr(to: &Path) -> Result<()> {
|
||||
std::fs::create_dir_all(to).with_context(|| format!("creating {}", to.display()))?;
|
||||
let script = to.join("get-amd-fsr.ps1");
|
||||
std::fs::write(&script, FETCH_FSR).with_context(|| format!("writing {}", script.display()))?;
|
||||
let status = std::process::Command::new("powershell.exe")
|
||||
.args(["-NoProfile", "-ExecutionPolicy", "Bypass", "-File"])
|
||||
.arg(&script)
|
||||
.arg("-To")
|
||||
.arg(to)
|
||||
.status()
|
||||
.context("starting Windows PowerShell")?;
|
||||
let _ = std::fs::remove_file(&script);
|
||||
anyhow::ensure!(
|
||||
status.success() && has_fsr(to),
|
||||
"AMD's files did not arrive (see above); the title runs without FSR 3 frame generation"
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// `victory get-fsr`.
|
||||
pub(crate) fn get_fsr() -> Result<()> {
|
||||
let to = amd_home()?;
|
||||
let _ = std::fs::remove_file(to.join("declined"));
|
||||
fetch_fsr(&to)
|
||||
}
|
||||
|
||||
/// Asks once, at a start that would use FSR 3 without AMD's files, whether to fetch them.
|
||||
fn offer_fsr(card: &str) {
|
||||
let Ok(to) = amd_home() else { return };
|
||||
let declined = to.join("declined");
|
||||
if declined.exists() || !std::io::stdin().is_terminal() {
|
||||
println!("No AMD FSR 3 files: frame generation stays off on this card (`victory get-fsr` fetches them).");
|
||||
return;
|
||||
}
|
||||
if card.is_empty() {
|
||||
println!("FSR 3 frame generation is chosen, and AMD's files for it are not on this PC yet.");
|
||||
} else {
|
||||
println!("This card ({card}) has no DLSS frame generation (it needs an RTX 40 or later), but AMD's");
|
||||
println!("FSR 3 frame generation runs on it (2x). AMD's files for it are not on this PC yet.");
|
||||
}
|
||||
println!("They are AMD's own, under AMD's licence, and come from github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK");
|
||||
println!("(about 30 MB, once).");
|
||||
print!("Download them now? [Y/n] ");
|
||||
let _ = std::io::stdout().flush();
|
||||
let mut answer = String::new();
|
||||
let _ = std::io::stdin().read_line(&mut answer);
|
||||
if answer.trim().to_ascii_lowercase().starts_with('n') {
|
||||
let _ = std::fs::create_dir_all(&to);
|
||||
let _ = std::fs::write(&declined, "asked once; `victory get-fsr` fetches them\r\n");
|
||||
println!("Not downloaded. `victory get-fsr` does it later; the title runs without frame generation.");
|
||||
} else if let Err(e) = fetch_fsr(&to) {
|
||||
println!("{e:#}");
|
||||
}
|
||||
}
|
||||
|
||||
/// `D3D12` beside this program: where Windows looks for Microsoft's newer
|
||||
/// Direct3D 12 runtime (main.rs's `D3D12SDKPath`).
|
||||
fn d3d12_dir() -> Result<PathBuf> {
|
||||
let program = std::env::current_exe().context("this program's own path")?;
|
||||
Ok(program.parent().map(Path::to_path_buf).unwrap_or_default().join("D3D12"))
|
||||
}
|
||||
|
||||
/// The highest shader model the default GPU runs, asked by a process of our
|
||||
/// own (`victory shader-model`: a process keeps the first Direct3D 12 runtime
|
||||
/// it loads, and this one is yet to choose). `None`: no answer.
|
||||
fn shader_model() -> Option<(u32, u32)> {
|
||||
let program = std::env::current_exe().ok()?;
|
||||
let out = std::process::Command::new(program)
|
||||
.arg("shader-model")
|
||||
.env_remove("VICTORY_LOG_FILE")
|
||||
.stdin(std::process::Stdio::null())
|
||||
.stderr(std::process::Stdio::null())
|
||||
.output()
|
||||
.ok()?;
|
||||
let text = String::from_utf8_lossy(&out.stdout);
|
||||
let (major, minor) = text.lines().rev().find_map(|l| l.trim().split_once('.'))?;
|
||||
Some((major.parse().ok()?, minor.parse().ok()?))
|
||||
}
|
||||
|
||||
/// Runs the fetcher: Microsoft's D3D12Core.dll from nuget.org into `to`.
|
||||
fn fetch_d3d12(to: &Path) -> Result<()> {
|
||||
std::fs::create_dir_all(to).with_context(|| format!("creating {} (beside victory.exe)", to.display()))?;
|
||||
let script = std::env::temp_dir().join(format!("victory-get-d3d12-{}.ps1", std::process::id()));
|
||||
std::fs::write(&script, FETCH_D3D12).with_context(|| format!("writing {}", script.display()))?;
|
||||
let status = std::process::Command::new("powershell.exe")
|
||||
.args(["-NoProfile", "-ExecutionPolicy", "Bypass", "-File"])
|
||||
.arg(&script)
|
||||
.arg("-To")
|
||||
.arg(to)
|
||||
.status()
|
||||
.context("starting Windows PowerShell")?;
|
||||
let _ = std::fs::remove_file(&script);
|
||||
anyhow::ensure!(
|
||||
status.success() && to.join("D3D12Core.dll").is_file(),
|
||||
"Microsoft's Direct3D 12 runtime did not arrive (see above)"
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// `victory get-d3d12`.
|
||||
pub(crate) fn get_d3d12() -> Result<()> {
|
||||
fetch_d3d12(&d3d12_dir()?)
|
||||
}
|
||||
|
||||
/// Makes sure the GPU runs the translated shaders' model (6.6) before the
|
||||
/// title starts: where Windows' own Direct3D 12 does not (Windows 10),
|
||||
/// Microsoft's newer runtime is fetched beside this program, after asking.
|
||||
/// Below 6.6 every pipeline is refused and the title closes within seconds,
|
||||
/// so a start that still cannot run it stops here, saying why.
|
||||
fn check_shader_model() -> Result<()> {
|
||||
let needed = victory_hle::streamline::SHADER_MODEL_NEEDED;
|
||||
let Some(found) = shader_model() else { return Ok(()) };
|
||||
if found >= needed {
|
||||
return Ok(());
|
||||
}
|
||||
let to = d3d12_dir()?;
|
||||
let had = to.join("D3D12Core.dll").is_file();
|
||||
if !had {
|
||||
println!("This PC's Direct3D 12 runs shader model {}.{}, and the game's translated shaders need 6.6.", found.0, found.1);
|
||||
println!("Windows 10's own Direct3D 12 stops at 6.5; Microsoft's newer runtime (the D3D12 Agility SDK)");
|
||||
println!("runs 6.6. It is Microsoft's own, under Microsoft's licence, from nuget.org (about 22 MB, once),");
|
||||
println!("and goes into {}.", to.display());
|
||||
let yes = if std::io::stdin().is_terminal() {
|
||||
print!("Download it now? [Y/n] ");
|
||||
let _ = std::io::stdout().flush();
|
||||
let mut answer = String::new();
|
||||
let _ = std::io::stdin().read_line(&mut answer);
|
||||
!answer.trim().to_ascii_lowercase().starts_with('n')
|
||||
} else {
|
||||
true
|
||||
};
|
||||
if yes {
|
||||
match fetch_d3d12(&to) {
|
||||
Ok(()) => match shader_model() {
|
||||
Some(now) if now >= needed => {
|
||||
println!("Shader model {}.{} with Microsoft's runtime. Starting the game.", now.0, now.1);
|
||||
return Ok(());
|
||||
}
|
||||
now => {
|
||||
let now = now.unwrap_or(found);
|
||||
println!("With Microsoft's runtime the GPU still runs shader model {}.{}.", now.0, now.1);
|
||||
}
|
||||
},
|
||||
Err(e) => println!("{e:#}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
let now = shader_model().unwrap_or(found);
|
||||
anyhow::bail!(
|
||||
"this PC's Direct3D 12 runs shader model {}.{}, and the game needs 6.6: every shader would be \
|
||||
refused and the game would close at once. {}",
|
||||
now.0,
|
||||
now.1,
|
||||
if to.join("D3D12Core.dll").is_file() {
|
||||
"Microsoft's newer runtime is in place (D3D12 beside victory.exe), so it is the graphics \
|
||||
driver: update it, or use Windows 11"
|
||||
} else {
|
||||
"`victory get-d3d12` fetches Microsoft's newer runtime into D3D12 beside victory.exe; \
|
||||
or use Windows 11"
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/// DLLs beside this program under the names of Windows' own that it loads (a
|
||||
/// mod's proxy: MFG Unlocker as `winmm.dll` unlocks DLSS Frame Generation on
|
||||
/// RTX 20 and 30 cards), for the log: a report then says what else ran.
|
||||
fn mod_dlls(here: &Path) -> Vec<String> {
|
||||
const NAMES: [&str; 7] = ["winmm.dll", "version.dll", "dxgi.dll", "d3d12.dll", "xinput1_4.dll", "dinput8.dll", "winhttp.dll"];
|
||||
NAMES.iter().filter(|n| here.join(n).is_file()).map(|n| (*n).to_owned()).collect()
|
||||
}
|
||||
|
||||
/// How long the first start of a new victory.exe plays before it restarts.
|
||||
const WARMUP_SECONDS: u32 = 20;
|
||||
|
||||
/// The file that says this victory.exe (its bytes) had its warm-up start:
|
||||
/// `%LOCALAPPDATA%\victory\warmed\<hash>`. `None`: the exe could not be read.
|
||||
fn warmup_mark(home: &Path, program: &Path) -> Option<PathBuf> {
|
||||
let bytes = std::fs::read(program).ok()?;
|
||||
let hash = blake3::hash(&bytes).to_hex();
|
||||
Some(home.join("warmed").join(&hash.as_str()[..16]))
|
||||
}
|
||||
|
||||
/// What a start needs once its settings are in the environment.
|
||||
pub(crate) struct Ready {
|
||||
pub(crate) exe: PathBuf,
|
||||
@@ -416,6 +636,8 @@ pub(crate) fn prepare(o: &Play) -> Result<Ready> {
|
||||
// (Windows' own long form `\\?\C:\...` back to the plain one.)
|
||||
let exe = PathBuf::from(exe.to_string_lossy().trim_start_matches(r"\\?\").to_owned());
|
||||
|
||||
check_shader_model()?;
|
||||
|
||||
let home = home()?;
|
||||
std::fs::create_dir_all(&home).with_context(|| format!("creating {}", home.display()))?;
|
||||
let menu_file = home.join("victory-settings.txt");
|
||||
@@ -431,6 +653,32 @@ pub(crate) fn prepare(o: &Play) -> Result<Ready> {
|
||||
}
|
||||
let streamline = streamline_dir(&here);
|
||||
let (mut s, series_s) = settings(o, &menu, streamline.as_deref());
|
||||
// FSR 3 made ready: AMD's files, asked for only where they would be used (FSR 3 chosen,
|
||||
// or a card without DLSS Frame Generation).
|
||||
if s.contains_key("VICTORY_FSR_FRAMEGEN") {
|
||||
if fidelityfx_dir(&here).is_none() {
|
||||
let chosen = s.get("VICTORY_MENU_FG_TYPE").is_some_and(|t| t == "fsr");
|
||||
let card = victory_hle::streamline::adapter_name().unwrap_or_default();
|
||||
if chosen || !victory_hle::streamline::dlss_framegen_card(&card) {
|
||||
offer_fsr(if chosen { "" } else { &card });
|
||||
}
|
||||
}
|
||||
if let Some(dir) = fidelityfx_dir(&here) {
|
||||
s.insert("VICTORY_FIDELITYFX_DIR".to_owned(), dir.to_string_lossy().into_owned());
|
||||
}
|
||||
}
|
||||
// The first start of this victory.exe (no mark for its bytes yet): the game plays a little
|
||||
// and starts again by itself (crates\victory-gpu\src\host\menu.rs, `warmup`), since a new
|
||||
// exe's first run stays at about 14 fps. `--set VICTORY_WARMUP_RESTART=0`: not done.
|
||||
if !s.contains_key("VICTORY_WARMUP_RESTART")
|
||||
&& let Some(mark) = warmup_mark(&home, &program)
|
||||
&& !mark.exists()
|
||||
{
|
||||
println!("First start of this version of victory.exe: the game restarts by itself after {WARMUP_SECONDS} seconds,");
|
||||
println!("once (a new version's first run otherwise stays at about 14 fps).");
|
||||
s.insert("VICTORY_WARMUP_RESTART".to_owned(), WARMUP_SECONDS.to_string());
|
||||
s.insert("VICTORY_WARMUP_MARK".to_owned(), mark.to_string_lossy().into_owned());
|
||||
}
|
||||
// Where the menu saves, and how it starts the title again (`--set` is not carried over).
|
||||
let quoted = |p: &Path| format!("'{}'", p.to_string_lossy().replace('\'', "''"));
|
||||
s.insert("VICTORY_MENU_FILE".to_owned(), menu_file.to_string_lossy().into_owned());
|
||||
@@ -442,7 +690,14 @@ pub(crate) fn prepare(o: &Play) -> Result<Ready> {
|
||||
let log = log_file(&home.join("logs"))?;
|
||||
let console = if series_s { "series-s" } else { "series-x" };
|
||||
let line: Vec<String> = s.iter().map(|(k, v)| format!("{k}={v}")).collect();
|
||||
std::fs::write(&log, format!("# console={console} build=release switches: {}\n", line.join(" ")))
|
||||
let mods = mod_dlls(&here);
|
||||
let mods_line = if mods.is_empty() {
|
||||
String::new()
|
||||
} else {
|
||||
println!("Beside this program, loaded in its place by Windows: {} (a mod, e.g. MFG Unlocker).", mods.join(", "));
|
||||
format!("# beside victory.exe (mods, loaded instead of Windows' own): {}\n", mods.join(" "))
|
||||
};
|
||||
std::fs::write(&log, format!("# console={console} build=release switches: {}\n{mods_line}", line.join(" ")))
|
||||
.with_context(|| format!("writing {}", log.display()))?;
|
||||
println!("Log: {}", log.display());
|
||||
s.insert("VICTORY_LOG_FILE".to_owned(), log.to_string_lossy().into_owned());
|
||||
@@ -575,6 +830,15 @@ mod tests {
|
||||
assert_eq!((get("VICTORY_AMBIENT"), get("VICTORY_NEW")), (Some("0"), Some("2")));
|
||||
}
|
||||
|
||||
/// AMD's files are offered only to cards without DLSS Frame Generation (or FSR 3 chosen).
|
||||
#[test]
|
||||
fn cards_with_dlss_frame_generation() {
|
||||
use victory_hle::streamline::dlss_framegen_card as fg;
|
||||
assert!(fg("NVIDIA GeForce RTX 5070") && fg("NVIDIA GeForce RTX 4070 SUPER") && fg("NVIDIA GeForce RTX 5090 Laptop GPU"));
|
||||
assert!(!fg("NVIDIA GeForce RTX 3080 Ti") && !fg("NVIDIA GeForce RTX 2060") && !fg("NVIDIA GeForce GTX 1080"));
|
||||
assert!(!fg("AMD Radeon RX 7900 XTX") && !fg("Intel(R) Arc(TM) A770 Graphics") && !fg(""));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stamps_are_dates() {
|
||||
assert_eq!(stamp(0), "19700101-000000");
|
||||
|
||||
@@ -951,6 +951,20 @@ fn create() -> windows::core::Result<Host> {
|
||||
let amd = crate::indirect::amd(&device);
|
||||
victory_shader::emit::set_host_rdna(amd && o1.WaveLaneCountMin == 32 && o1.WaveLaneCountMax == 64);
|
||||
}
|
||||
// Every translated shader is SM 6.6: below it each pipeline is refused (E_INVALIDARG),
|
||||
// and the title falls over within seconds (Windows 10's own D3D12, 2026-11-27).
|
||||
match crate::streamline::device_shader_model(&device) {
|
||||
Some(sm) if sm >= crate::streamline::SHADER_MODEL_NEEDED => {
|
||||
let runtime = crate::streamline::d3d12_core_path().map(|p| p.display().to_string());
|
||||
tracing::info!(model = %format!("{}.{}", sm.0, sm.1), ?runtime, "host shader model");
|
||||
}
|
||||
sm => tracing::error!(
|
||||
model = %sm.map_or("unknown".to_owned(), |sm| format!("{}.{}", sm.0, sm.1)),
|
||||
"host shader model below 6.6: no translated shader can run here. On Windows 10, \
|
||||
`victory play` fetches Microsoft's newer Direct3D 12 runtime (D3D12\\D3D12Core.dll \
|
||||
beside victory.exe); otherwise update the graphics driver"
|
||||
),
|
||||
}
|
||||
let messages = debug
|
||||
.then(|| device.cast::<ID3D12InfoQueue>().ok())
|
||||
.flatten();
|
||||
|
||||
@@ -111,6 +111,28 @@ fn get(var: &str) -> String {
|
||||
std::env::var(var).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// The first start of a new victory.exe: the seconds it plays before it starts
|
||||
/// again by itself (`VICTORY_WARMUP_RESTART`, set by the launcher while the exe
|
||||
/// has no mark under `%LOCALAPPDATA%\victory\warmed`). On the RTX 5070, every
|
||||
/// new build's first run stayed at a flat 14 fps (Present ~40 ms) for as long as
|
||||
/// it ran, and every later run was normal (27-29 fps), even after a first run of
|
||||
/// 45 seconds; a copy of an exe already run was fast at once (2026-11-27). Likely
|
||||
/// the driver's cache of the program; not ours to fix, so it is run through once.
|
||||
pub(crate) fn warmup_seconds() -> Option<u64> {
|
||||
get("VICTORY_WARMUP_RESTART").parse().ok().filter(|s| *s > 0)
|
||||
}
|
||||
|
||||
/// The start's notice lines for the warm-up start ([`warmup_seconds`]).
|
||||
pub(crate) fn warmup_notice(seconds: u64) -> Vec<String> {
|
||||
vec![
|
||||
"FIRST START OF THIS VERSION: A ONE-TIME WARM-UP".to_owned(),
|
||||
format!("THE GAME RESTARTS BY ITSELF IN ABOUT {seconds} SECONDS"),
|
||||
"THIS HAPPENS ONCE PER NEW VERSION, AND IS NEEDED:".to_owned(),
|
||||
"WITHOUT IT THE FIRST RUN STAYS AT ABOUT 14 FPS".to_owned(),
|
||||
String::new(),
|
||||
]
|
||||
}
|
||||
|
||||
/// Starts `command_line` in a console window of its own, with that console's input and output.
|
||||
/// (`std::process::Command` always hands its child this process's standard handles: the restarted
|
||||
/// launcher then wrote into the old launcher's pipe and log, not its own window, and kept the old
|
||||
@@ -455,7 +477,7 @@ impl Menu {
|
||||
}
|
||||
|
||||
/// Starts the launcher again in a new console, a few seconds on, and ends this run.
|
||||
/// `preload`: the launcher makes every shader first (its `-Preload`, for that start alone).
|
||||
/// `preload`: the launcher makes every shader first (`VICTORY_PRELOAD=1`, for that start alone).
|
||||
fn restart(&mut self, preload: bool) {
|
||||
let Some(play) = std::env::var_os("VICTORY_MENU_PLAY") else {
|
||||
self.note = "SAVED. START THE LAUNCHER AGAIN YOURSELF".to_owned();
|
||||
@@ -463,7 +485,14 @@ impl Menu {
|
||||
};
|
||||
let play = play.to_string_lossy().replace('\'', "''");
|
||||
let args = get("VICTORY_MENU_ARGS");
|
||||
let command = format!("Start-Sleep 3; & '{play}' {args}{}", if preload { " -Preload" } else { "" });
|
||||
// The preload is asked by VICTORY_PRELOAD=1, which both launchers read (victory.exe's is
|
||||
// `--preload`, the script's `-Preload`: the script's flag given to victory.exe was refused,
|
||||
// and the window closed before it could be read, 2026-11-27). A launcher that fails keeps
|
||||
// its window until Enter.
|
||||
let command = format!(
|
||||
"Start-Sleep 3; {}& '{play}' {args}; if ($LASTEXITCODE) {{ Read-Host 'The start failed (see above). Press Enter to close this window' }}",
|
||||
if preload { "$env:VICTORY_PRELOAD='1'; " } else { "" }
|
||||
);
|
||||
match new_console(&format!("powershell.exe -NoProfile -ExecutionPolicy Bypass -Command \"{}\"", command.replace('"', "\\\""))) {
|
||||
Ok(()) => {
|
||||
tracing::info!(command, preload, "settings menu: restarting");
|
||||
@@ -483,6 +512,30 @@ impl Menu {
|
||||
}
|
||||
}
|
||||
|
||||
/// The warm-up start ([`warmup_seconds`]): once its time is up, this exe is
|
||||
/// marked as warmed up (`VICTORY_WARMUP_MARK`) and the game starts again.
|
||||
fn warmup(&mut self) {
|
||||
static BEGAN: OnceLock<std::time::Instant> = OnceLock::new();
|
||||
static DONE: AtomicBool = AtomicBool::new(false);
|
||||
let Some(seconds) = warmup_seconds() else { return };
|
||||
if DONE.load(Ordering::Relaxed) {
|
||||
return;
|
||||
}
|
||||
if BEGAN.get_or_init(std::time::Instant::now).elapsed() < Duration::from_secs(seconds) {
|
||||
return;
|
||||
}
|
||||
DONE.store(true, Ordering::Relaxed);
|
||||
let mark = std::path::PathBuf::from(get("VICTORY_WARMUP_MARK"));
|
||||
if !mark.as_os_str().is_empty() {
|
||||
if let Some(dir) = mark.parent() {
|
||||
let _ = std::fs::create_dir_all(dir);
|
||||
}
|
||||
let _ = std::fs::write(&mark, "this victory.exe was warmed up (its first start, then a restart)\r\n");
|
||||
}
|
||||
tracing::info!(seconds, mark = %mark.display(), "first start of this victory.exe: warmed up; the game starts again");
|
||||
self.restart(false);
|
||||
}
|
||||
|
||||
/// Removes the settings file: the launcher's own settings at the next start.
|
||||
fn reset(&mut self) {
|
||||
if let Some(path) = std::env::var_os("VICTORY_MENU_FILE") {
|
||||
@@ -493,6 +546,7 @@ impl Menu {
|
||||
|
||||
/// A frame was presented: the keys pressed since the last one.
|
||||
pub(super) fn frame(&mut self) {
|
||||
self.warmup();
|
||||
let pressed = std::mem::take(&mut *keys().lock().unwrap_or_else(|e| e.into_inner()));
|
||||
if pressed.is_empty() {
|
||||
return;
|
||||
|
||||
@@ -423,7 +423,10 @@ pub(super) struct Notice {
|
||||
|
||||
impl Notice {
|
||||
pub(super) fn new() -> Notice {
|
||||
let lines: Vec<String> = crate::streamline::notice().into_iter().map(|l| l.to_ascii_uppercase()).collect();
|
||||
// The first start of a new victory.exe says first that it restarts by itself (menu.rs).
|
||||
let warmup = super::menu::warmup_seconds().map(super::menu::warmup_notice).unwrap_or_default();
|
||||
let lines: Vec<String> =
|
||||
warmup.into_iter().chain(crate::streamline::notice()).map(|l| l.to_ascii_uppercase()).collect();
|
||||
let columns = lines.iter().map(|l| l.len() as u32).max().unwrap_or(0).min(NOTICE_COLUMNS);
|
||||
let shape = Shape { columns, lines: lines.len() as u32 };
|
||||
Notice { done: lines.is_empty(), lines, shape, since: None, buffers: None, written: false }
|
||||
|
||||
@@ -434,7 +434,12 @@ fn notice_of(f: &Facts, dlss_live: bool, fsr_live: bool) -> Vec<String> {
|
||||
"DLSS FRAME GEN: NOT ON THIS CARD (RTX 40 AND UP)"
|
||||
}.into());
|
||||
}
|
||||
if dlss_live {
|
||||
if dlss_live && !f.adapter.is_empty() && !dlss_framegen_card(&f.adapter) {
|
||||
// An RTX 20 or 30 with DLSS Frame Generation: a mod beside victory.exe (MFG Unlocker,
|
||||
// as winmm.dll) answers for the card; how many frames it gives, Streamline says.
|
||||
lines.push("FRAME GEN: DLSS, UNLOCKED BY A MOD (F1 MENU: 2X-6X)".into());
|
||||
lines.push("NVIDIA DOES NOT SUPPORT IT: IF IT FAILS, REMOVE IT".into());
|
||||
} else if dlss_live {
|
||||
lines.push("FRAME GEN: DLSS, SUPPORTED HERE (F1 MENU: 2X-6X)".into());
|
||||
lines.push("MORE THAN 2X NEEDS AN RTX 50 CARD".into());
|
||||
} else if fsr_live {
|
||||
@@ -623,6 +628,21 @@ fn wide(path: &Path) -> Vec<u16> {
|
||||
path.as_os_str().encode_wide().chain([0]).collect()
|
||||
}
|
||||
|
||||
/// The name of the card the title will run on (the launcher asks whether to
|
||||
/// fetch AMD's FSR 3 files only where DLSS Frame Generation will not run).
|
||||
pub fn adapter_name() -> Option<String> {
|
||||
default_adapter().map(|a| a.0)
|
||||
}
|
||||
|
||||
/// Whether a card of this name runs DLSS Frame Generation: a GeForce RTX of
|
||||
/// the 40 or 50 series ("NVIDIA GeForce RTX 4070 SUPER", "... RTX 5090 Laptop GPU").
|
||||
pub fn dlss_framegen_card(name: &str) -> bool {
|
||||
let name = name.to_ascii_uppercase();
|
||||
let Some(at) = name.find("RTX") else { return false };
|
||||
let model: String = name[at + 3..].trim_start().chars().take_while(char::is_ascii_digit).collect();
|
||||
model.len() == 4 && (model.starts_with("40") || model.starts_with("50"))
|
||||
}
|
||||
|
||||
/// The adapter a device made with no adapter named is on (the first), its
|
||||
/// name and LUID.
|
||||
fn default_adapter() -> Option<(String, windows::Win32::Foundation::LUID)> {
|
||||
@@ -636,6 +656,61 @@ fn default_adapter() -> Option<(String, windows::Win32::Foundation::LUID)> {
|
||||
}
|
||||
}
|
||||
|
||||
/// The translated shaders' shader model (6.6, `ResourceDescriptorHeap[]`).
|
||||
pub const SHADER_MODEL_NEEDED: (u32, u32) = (6, 6);
|
||||
|
||||
/// The highest shader model `device` runs, as (major, minor). Asked from 6.9
|
||||
/// down: a runtime that does not know a model refuses the question.
|
||||
pub fn device_shader_model(device: &ID3D12Device) -> Option<(u32, u32)> {
|
||||
(0x60..=0x69).rev().find_map(|v| {
|
||||
let mut model = D3D12_FEATURE_DATA_SHADER_MODEL { HighestShaderModel: D3D_SHADER_MODEL(v) };
|
||||
// SAFETY: writes `model` of the given size.
|
||||
let ok = unsafe {
|
||||
device.CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL, (&raw mut model).cast(), size_of_val(&model) as u32)
|
||||
}
|
||||
.is_ok();
|
||||
let m = model.HighestShaderModel.0 as u32;
|
||||
ok.then_some((m >> 4, m & 0xF))
|
||||
})
|
||||
.or(Some((5, 1)))
|
||||
}
|
||||
|
||||
/// The highest shader model of the default adapter (the one the title's device is
|
||||
/// on), from a device made for the question; `None` without one. Windows 10's own
|
||||
/// Direct3D 12 stops at 6.5; Microsoft's newer runtime (`D3D12\D3D12Core.dll`
|
||||
/// beside the program, which victory.exe asks for) runs 6.6. Made in a process of
|
||||
/// its own (`victory shader-model`), since a process keeps the first runtime it loads.
|
||||
pub fn highest_shader_model() -> Option<(u32, u32)> {
|
||||
use windows::Win32::Graphics::Direct3D::D3D_FEATURE_LEVEL_11_0;
|
||||
// SAFETY: plain DXGI and D3D12 calls with owned results.
|
||||
let device = unsafe {
|
||||
let factory: IDXGIFactory1 = CreateDXGIFactory1().ok()?;
|
||||
let adapter = factory.EnumAdapters1(0).ok()?;
|
||||
let mut device: Option<ID3D12Device> = None;
|
||||
D3D12CreateDevice(&adapter, D3D_FEATURE_LEVEL_11_0, &mut device).ok()?;
|
||||
device?
|
||||
};
|
||||
device_shader_model(&device)
|
||||
}
|
||||
|
||||
/// The file of the Direct3D 12 runtime this process loaded (`D3D12Core.dll`:
|
||||
/// Windows' own in System32, or Microsoft's newer one from `D3D12\` beside the
|
||||
/// program); `None` before a device is made.
|
||||
pub fn d3d12_core_path() -> Option<PathBuf> {
|
||||
use windows_sys::Win32::System::LibraryLoader::{GetModuleFileNameW, GetModuleHandleW};
|
||||
let name = wide(Path::new("D3D12Core.dll"));
|
||||
// SAFETY: a module of this process by name, its file name into a buffer of the given size.
|
||||
unsafe {
|
||||
let module = GetModuleHandleW(name.as_ptr());
|
||||
if module.is_null() {
|
||||
return None;
|
||||
}
|
||||
let mut buf = [0u16; 1024];
|
||||
let len = GetModuleFileNameW(module, buf.as_mut_ptr(), buf.len() as u32) as usize;
|
||||
(len > 0).then(|| PathBuf::from(String::from_utf16_lossy(&buf[..len])))
|
||||
}
|
||||
}
|
||||
|
||||
/// The Authenticode signature of `path` (NVIDIA signs its DLLs), checked
|
||||
/// without going online.
|
||||
fn verify_signature(path: &Path) -> Result<(), String> {
|
||||
|
||||
@@ -906,7 +906,13 @@ mod tests {
|
||||
l.join("|")
|
||||
};
|
||||
// RTX 40/50: DLSS frame generation.
|
||||
assert!(lines(facts(true, true, true, false), true, false).contains("FRAME GEN: DLSS"));
|
||||
let mut rtx40 = facts(true, true, true, false);
|
||||
rtx40.adapter = "NVIDIA GeForce RTX 4070".into();
|
||||
let rtx40 = lines(rtx40, true, false);
|
||||
assert!(rtx40.contains("FRAME GEN: DLSS, SUPPORTED") && !rtx40.contains("MOD"), "{rtx40}");
|
||||
// RTX 20/30 with DLSS frame generation running: a mod unlocked it (MFG Unlocker).
|
||||
let unlocked = lines(facts(true, true, true, false), true, false);
|
||||
assert!(unlocked.contains("UNLOCKED BY A MOD") && !unlocked.contains("SUPPORTED HERE"), "{unlocked}");
|
||||
// RTX 20/30 on Series X with DLSS: FSR 3 instead, 2X.
|
||||
let rtx30 = lines(facts(true, false, true, false), false, true);
|
||||
assert!(rtx30.contains("NOT ON THIS CARD") && rtx30.contains("FSR 3") && rtx30.contains("2X"));
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
# 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
|
||||
# %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.
|
||||
param(
|
||||
[string]$Tag = 'v2.4.0',
|
||||
[string]$To = ''
|
||||
)
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
|
||||
$bin = if ($To) { $To } else { Join-Path (Resolve-Path (Join-Path $PSScriptRoot '..')).Path 'amd-sdk\FidelityFX\bin' }
|
||||
$base = "https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK/$Tag/Kits/FidelityFX"
|
||||
# What the game loads, and the SHA-256 of the copies tested (FidelityFX SDK v2.4.0).
|
||||
$files = [ordered]@{
|
||||
'amd_fidelityfx_loader_dx12.dll' = 'E2191D3C0828BE45EB8AFFD4E3EC0378F2293ADC345B772A7170EDCF3B021ECB'
|
||||
'amd_fidelityfx_framegeneration_dx12.dll' = 'E6843252F58B0341A0D80F6A20BC0D840643EE95BC48C22CAC08745344577BB6'
|
||||
}
|
||||
|
||||
function Get-File([string]$Url, [string]$To) {
|
||||
New-Item -ItemType Directory -Force (Split-Path $To) | Out-Null
|
||||
$part = "$To.part"
|
||||
if (Get-Command curl.exe -ErrorAction SilentlyContinue) {
|
||||
& curl.exe --location --fail --silent --show-error --progress-bar --output $part $Url
|
||||
if ($LASTEXITCODE -ne 0) { Remove-Item $part -ErrorAction SilentlyContinue; throw "could not get $Url" }
|
||||
} else {
|
||||
Invoke-WebRequest -Uri $Url -OutFile $part -UseBasicParsing -ErrorAction Stop
|
||||
}
|
||||
$part
|
||||
}
|
||||
|
||||
Write-Host "AMD FSR 3 frame generation (FidelityFX SDK $Tag), from github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK (about 30 MB):"
|
||||
New-Item -ItemType Directory -Force $bin | Out-Null
|
||||
foreach ($name in $files.Keys) {
|
||||
$to = Join-Path $bin $name
|
||||
if ((Test-Path $to) -and (Get-FileHash $to -Algorithm SHA256).Hash -eq $files[$name]) {
|
||||
Write-Host " $name already there"
|
||||
continue
|
||||
}
|
||||
$part = Get-File "$base/signedbin/$name" $to
|
||||
$hash = (Get-FileHash $part -Algorithm SHA256).Hash
|
||||
if ($hash -ne $files[$name]) {
|
||||
Remove-Item $part -Force
|
||||
throw "$name is not the file this build was tested with (SHA-256 $hash); not kept"
|
||||
}
|
||||
Move-Item $part $to -Force
|
||||
$len = (Get-Item $to).Length
|
||||
Write-Host (" {0} {1}" -f $name, $(if ($len -ge 1MB) { '{0:N1} MB' -f ($len / 1MB) } else { '{0:N0} KB' -f ($len / 1KB) }))
|
||||
}
|
||||
try {
|
||||
$lic = Get-File "$base/docs/license.md" (Join-Path $bin 'amd-fidelityfx-license.md')
|
||||
Move-Item $lic (Join-Path $bin 'amd-fidelityfx-license.md') -Force
|
||||
Write-Host " licence: $(Join-Path $bin 'amd-fidelityfx-license.md')"
|
||||
} catch { Write-Host " (AMD's licence text could not be fetched: $($_.Exception.Message))" }
|
||||
Write-Host ''
|
||||
Write-Host 'Done. They are used from the next start.'
|
||||
@@ -0,0 +1,60 @@
|
||||
# Fetches Microsoft's newer Direct3D 12 runtime (the D3D12 Agility SDK, D3D12Core.dll, from Microsoft's own
|
||||
# NuGet package Microsoft.Direct3D.D3D12, about 22 MB) into a D3D12 folder: by default the one beside
|
||||
# target\release\victory.exe; `victory play` names the one beside itself. Windows 10's own Direct3D 12 stops at
|
||||
# shader model 6.5, and every shader the layer translates is 6.6: without this runtime each pipeline is refused
|
||||
# and the game closes within seconds. victory.exe asks Windows for this runtime (it exports D3D12SDKVersion = 614
|
||||
# and D3D12SDKPath = .\D3D12\); Windows uses it only where its own is older. It is Microsoft's, under Microsoft's
|
||||
# licence (saved beside it: read it); this repository does not carry it. The package and the DLL are checked
|
||||
# against the SHA-256 of the copies this fork was tested with, and the DLL against Microsoft's signature.
|
||||
param(
|
||||
[string]$Version = '1.614.1',
|
||||
[string]$To = ''
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
|
||||
$dir = if ($To) { $To } else { Join-Path (Resolve-Path (Join-Path $PSScriptRoot '..')).Path 'target\release\D3D12' }
|
||||
# The SHA-256 of the copies tested (Microsoft.Direct3D.D3D12 1.614.1, D3D12Core.dll 1.614.1.0).
|
||||
$package = '9880AA91602DD51DD6CF7911A2BCA7A2323513B15338573CDE014B3356EEAFF2'
|
||||
$core = '8A23D826B25B4329522FF451CB52B7F2B34D7F2913CFEB878371CE8BD765FE2D'
|
||||
$url = "https://api.nuget.org/v3-flatcontainer/microsoft.direct3d.d3d12/$Version/microsoft.direct3d.d3d12.$Version.nupkg"
|
||||
|
||||
$target = Join-Path $dir 'D3D12Core.dll'
|
||||
if ((Test-Path $target) -and (Get-FileHash $target -Algorithm SHA256).Hash -eq $core) {
|
||||
Write-Host "Microsoft's Direct3D 12 runtime $Version is already in $dir"
|
||||
exit 0
|
||||
}
|
||||
Write-Host "Microsoft's Direct3D 12 runtime $Version (the Agility SDK), from nuget.org (about 22 MB):"
|
||||
New-Item -ItemType Directory -Force $dir | Out-Null
|
||||
$part = Join-Path $dir "microsoft.direct3d.d3d12.$Version.nupkg.part"
|
||||
try {
|
||||
if (Get-Command curl.exe -ErrorAction SilentlyContinue) {
|
||||
& curl.exe --location --fail --silent --show-error --progress-bar --output $part $url
|
||||
if ($LASTEXITCODE -ne 0) { throw "could not get $url" }
|
||||
} else {
|
||||
Invoke-WebRequest -Uri $url -OutFile $part -UseBasicParsing
|
||||
}
|
||||
$hash = (Get-FileHash $part -Algorithm SHA256).Hash
|
||||
if ($hash -ne $package) { throw "the package is not the one this build was tested with (SHA-256 $hash); not kept" }
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
$zip = [IO.Compression.ZipFile]::OpenRead($part)
|
||||
try {
|
||||
$entry = $zip.Entries | Where-Object FullName -eq 'build/native/bin/x64/D3D12Core.dll'
|
||||
if (-not $entry) { throw 'the package has no build/native/bin/x64/D3D12Core.dll' }
|
||||
$dll = "$target.part"
|
||||
[IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $dll, $true)
|
||||
$lic = $zip.Entries | Where-Object FullName -eq 'LICENSE.txt'
|
||||
if ($lic) { [IO.Compression.ZipFileExtensions]::ExtractToFile($lic, (Join-Path $dir 'microsoft-d3d12-license.txt'), $true) }
|
||||
} finally { $zip.Dispose() }
|
||||
$hash = (Get-FileHash $dll -Algorithm SHA256).Hash
|
||||
if ($hash -ne $core) { Remove-Item $dll -Force; throw "D3D12Core.dll is not the file this build was tested with (SHA-256 $hash); not kept" }
|
||||
$sig = Get-AuthenticodeSignature $dll
|
||||
if ($sig.Status -ne 'Valid' -or $sig.SignerCertificate.Subject -notlike 'CN=Microsoft Corporation,*') {
|
||||
Remove-Item $dll -Force; throw "D3D12Core.dll is not validly signed by Microsoft ($($sig.Status)); not kept"
|
||||
}
|
||||
Move-Item $dll $target -Force
|
||||
} finally {
|
||||
Remove-Item $part -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
Write-Host (' D3D12Core.dll {0:N1} MB, signed by Microsoft' -f ((Get-Item $target).Length / 1MB))
|
||||
Write-Host " in $dir (licence: microsoft-d3d12-license.txt beside it)"
|
||||
@@ -33,7 +33,7 @@ param(
|
||||
[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) and, on Series X, DLSS for the upscaling (the title's own takes Series S sizes).
|
||||
# amd-sdk\FidelityFX\bin here, where Get-AMD-FSR.cmd puts them) and, on Series X, DLSS for the upscaling (the title's own takes Series S sizes).
|
||||
[ValidateSet('auto', 'dlss', 'fsr')][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.
|
||||
@@ -123,6 +123,10 @@ if ($FgType -ne 'dlss' -and ($FrameGen -or -not $NoFrameGenReady)) {
|
||||
# its first 30 s, and in this window) says what runs and why not. On Series X without DLSS it stays off: the
|
||||
# title's own upscaling, which it needs, takes the Series S sizes only.
|
||||
$settings.VICTORY_FSR_FRAMEGEN = '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 -eq 'fsr') { $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' } }
|
||||
|
||||
Reference in new issue
Block a user