upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/d3d12
diff options
context:
space:
mode:
authorOreo <tony37160@hotmail.fr>2026-12-03 04:13:32 +0000
committerGitHub <noreply@github.com>2026-12-03 04:13:32 +0000
commitd9b618f10150f275c30088e4769c1acbf1d8d689 (patch)
tree4adca9210af8f0a7d36d3e0f51b42d80caab33aa /d3d12
parent516c9eaabfd9134ef971a9446d6b9fae715e1231 (diff)
parentaec7489e33fec2d8d5f73be1b294396a2019ee19 (diff)
Merge pull request #3272 from OreoFR/feat/launcher-fgrt-follows-playHEADmainHEAD
launcher: follow-ups after #3182 (FG+RT greying, zip to clone, game folder, AMD, clearer choices, clear cache, Controls, FSR 3 files)
Diffstat (limited to 'd3d12')
-rw-r--r--d3d12/.gitignore2
-rw-r--r--d3d12/Get-AMD-FidelityFX.cmd9
-rw-r--r--d3d12/scripts/get-amd-fidelityfx.ps1113
-rw-r--r--d3d12/scripts/play-nvidia.ps128
4 files changed, 149 insertions, 3 deletions
diff --git a/d3d12/.gitignore b/d3d12/.gitignore
index 621ffa255..2d1a1a371 100644
--- a/d3d12/.gitignore
+++ b/d3d12/.gitignore
@@ -80,5 +80,7 @@ Thumbs.db
80 80
81# NVIDIA's own files (scripts/get-nvidia-sdks.ps1 fetches them from NVIDIA; never part of this repository) 81# NVIDIA's own files (scripts/get-nvidia-sdks.ps1 fetches them from NVIDIA; never part of this repository)
82/nvidia-sdk/ 82/nvidia-sdk/
83# AMD's own files (scripts/get-amd-fidelityfx.ps1 fetches them from AMD; never part of this repository)
84/amd-sdk/
83# What the F1 menu saved 85# What the F1 menu saved
84/leonida-settings.txt 86/leonida-settings.txt
diff --git a/d3d12/Get-AMD-FidelityFX.cmd b/d3d12/Get-AMD-FidelityFX.cmd
new file mode 100644
index 000000000..f51a4e0cf
--- /dev/null
+++ b/d3d12/Get-AMD-FidelityFX.cmd
@@ -0,0 +1,9 @@
1@echo off
2rem Downloads AMD's two signed FidelityFX DLLs that FSR 3 frame generation needs (about 29 MB) from AMD's own
3rem GitHub and puts them where the launcher looks for them (amd-sdk\FidelityFX\bin in this folder). Run it once.
4rem They are AMD's files under AMD's licence, which is saved beside them; this repository does not contain them.
5rem Each is checked first: the pinned size and hash, and AMD's valid signature. Without them the game still runs:
6rem FSR 3 frame generation stays off (DLSS frame generation, on RTX 40 and 50, does not need them).
7powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0scripts\get-amd-fidelityfx.ps1" %*
8echo.
9pause
diff --git a/d3d12/scripts/get-amd-fidelityfx.ps1 b/d3d12/scripts/get-amd-fidelityfx.ps1
new file mode 100644
index 000000000..4d988b021
--- /dev/null
+++ b/d3d12/scripts/get-amd-fidelityfx.ps1
@@ -0,0 +1,113 @@
1# Fetches AMD's two signed FidelityFX DLLs that FSR 3 frame generation needs (about 29 MB) from AMD's own GitHub
2# (GPUOpen-LibrariesAndSDKs/FidelityFX-SDK, Kits/FidelityFX/signedbin at a pinned tag) into amd-sdk\FidelityFX\bin
3# here (git-ignored), the folder play-nvidia.ps1 reads by default. They are AMD's, under AMD's licence (saved beside
4# them: read it); this repository does not and may not carry them, so each person gets them from AMD directly.
5# Get-AMD-FidelityFX.cmd in the d3d12 folder runs this; so does the launcher's Tools > Fetch AMD FidelityFX files.
6# scripts\get-amd-fidelityfx.ps1
7# Each DLL is checked before it is kept: its size and git blob hash are the pinned tag's, and its Authenticode
8# signature is valid and AMD's (crates/leonida-gpu/src/fsr.rs checks the signature again before loading it). Any
9# failure deletes what was fetched and ends with a non-zero code. -From takes the files from a local folder instead
10# of the network (the tests).
11param(
12 # The SDK whose structure versions fsr.rs speaks: FidelityFX SDK v2.4.0 (frame generation 4.0.2, its DX12 swap
13 # chain 4.0.0). Another tag needs its sizes and hashes below, and fsr.rs's versions checked against its headers.
14 [string]$Tag = 'v2.4.0',
15 [string]$From
16)
17$ErrorActionPreference = 'Stop'
18$ProgressPreference = 'SilentlyContinue' # Invoke-WebRequest's progress bar makes it many times slower
19[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
20$root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
21$kit = Join-Path $root 'amd-sdk\FidelityFX'
22$bin = Join-Path $kit 'bin'
23$work = Join-Path $kit 'download'
24$base = "https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK/$Tag/Kits/FidelityFX"
25# The two files fsr.rs loads, with the pinned tag's size and git blob hash (git ls-tree; SHA-1 of "blob <size>\0"
26# and the bytes).
27$pins = @{
28 'v2.4.0' = [ordered]@{
29 'amd_fidelityfx_loader_dx12.dll' = @{ Size = 39184; Blob = 'f1afee09dd3bcded005c722b1e94befb3ee3f9e6' }
30 'amd_fidelityfx_framegeneration_dx12.dll' = @{ Size = 29679376; Blob = '445674331676665f18b5acd1b3c8621629cb0e75' }
31 }
32}
33$want = $pins[$Tag]
34if (-not $want) { Write-Host "No sizes and hashes are pinned for FidelityFX SDK $Tag in this script."; exit 1 }
35
36# One file from a URL, with curl's progress line where Windows has curl (it has since Windows 10 1803).
37function Get-File([string]$Url, [string]$To) {
38 New-Item -ItemType Directory -Force (Split-Path $To) | Out-Null
39 if (Get-Command curl.exe -ErrorAction SilentlyContinue) {
40 & curl.exe --location --fail --silent --show-error --progress-bar --output $To $Url
41 if ($LASTEXITCODE -ne 0) { throw "could not get $Url" }
42 } else {
43 Invoke-WebRequest -Uri $Url -OutFile $To -UseBasicParsing
44 }
45}
46
47# git's hash of a file's bytes: SHA-1 of "blob <size>\0" and the bytes.
48function Get-BlobHash([string]$Path) {
49 $bytes = [IO.File]::ReadAllBytes($Path)
50 $head = [Text.Encoding]::ASCII.GetBytes("blob $($bytes.Length)`0")
51 $sha = [Security.Cryptography.SHA1]::Create()
52 try {
53 $all = New-Object byte[] ($head.Length + $bytes.Length)
54 [Array]::Copy($head, $all, $head.Length)
55 [Array]::Copy($bytes, 0, $all, $head.Length, $bytes.Length)
56 -join ($sha.ComputeHash($all) | ForEach-Object { $_.ToString('x2') })
57 } finally { $sha.Dispose() }
58}
59
60# Why a fetched DLL cannot be kept, or $null: the pinned size and blob hash, then a valid Authenticode signature
61# whose signer is Advanced Micro Devices.
62function Test-Dll([string]$Path, $Pin) {
63 $size = (Get-Item $Path).Length
64 if ($size -ne $Pin.Size) { return "it is $size bytes, not the pinned $($Pin.Size)" }
65 $blob = Get-BlobHash $Path
66 if ($blob -ne $Pin.Blob) { return "its hash is $blob, not the pinned $($Pin.Blob)" }
67 $sig = Get-AuthenticodeSignature -FilePath $Path
68 if ($sig.Status -ne 'Valid') { return "its signature is not valid ($($sig.Status))" }
69 if ("$($sig.SignerCertificate.Subject)" -notmatch 'O="?Advanced Micro Devices') {
70 return "it is signed by $($sig.SignerCertificate.Subject), not by Advanced Micro Devices"
71 }
72 $null
73}
74
75$ready = @($want.Keys | Where-Object { Test-Path (Join-Path $bin $_) })
76if ($ready.Count -eq $want.Count -and -not @($want.Keys | Where-Object { Test-Dll (Join-Path $bin $_) $want[$_] })) {
77 Write-Host "AMD's FidelityFX DLLs ($Tag) are in $bin already, signatures valid."
78 exit 0
79}
80
81Write-Host "AMD FidelityFX SDK $Tag, signed DLLs from github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK (about 29 MB):"
82Remove-Item $work -Recurse -Force -ErrorAction SilentlyContinue
83try {
84 foreach ($name in $want.Keys) {
85 $to = Join-Path $work $name
86 Write-Host " $name"
87 if ($From) {
88 New-Item -ItemType Directory -Force $work | Out-Null
89 Copy-Item (Join-Path $From $name) $to
90 } else {
91 Get-File "$base/signedbin/$name" $to
92 }
93 $why = Test-Dll $to $want[$name]
94 if ($why) { throw "$name cannot be kept: $why" }
95 }
96 # Every file checked: only now into bin, so a failure never leaves one of the pair there.
97 New-Item -ItemType Directory -Force $bin | Out-Null
98 foreach ($name in $want.Keys) { Move-Item (Join-Path $work $name) (Join-Path $bin $name) -Force }
99 if (-not $From) {
100 try { Get-File "$base/docs/license.md" (Join-Path $kit 'license.md') }
101 catch { Write-Host " AMD's licence could not be fetched ($($_.Exception.Message)): read it in the SDK on GitHub." }
102 }
103} catch {
104 Write-Host "The FidelityFX DLLs were not kept: $($_.Exception.Message)"
105 Remove-Item $work -Recurse -Force -ErrorAction SilentlyContinue
106 exit 1
107}
108Remove-Item $work -Recurse -Force -ErrorAction SilentlyContinue
109Write-Host " in $bin, sizes, hashes and AMD's signatures checked"
110if (Test-Path (Join-Path $kit 'license.md')) { Write-Host " AMD's licence for these: $(Join-Path $kit 'license.md')" }
111Write-Host ''
112Write-Host 'Done. FSR 3 frame generation (Settings > Frame generation > FSR 3, or -FsrFrameGen) uses them from the next start.'
113exit 0
diff --git a/d3d12/scripts/play-nvidia.ps1 b/d3d12/scripts/play-nvidia.ps1
index 20eee56df..f1fe90dc4 100644
--- a/d3d12/scripts/play-nvidia.ps1
+++ b/d3d12/scripts/play-nvidia.ps1
@@ -102,6 +102,10 @@ param(
102 [string[]]$Typed, 102 [string[]]$Typed,
103 # Set by the F1 menu's SAVE AND RESTART: the switches are the last start's again, so the menu's values win. 103 # Set by the F1 menu's SAVE AND RESTART: the switches are the last start's again, so the menu's values win.
104 [switch]$MenuRestart, 104 [switch]$MenuRestart,
105 # The switches (this script's names) the card cannot run, from the launcher on an AMD or Intel card: NoDlss,
106 # NoFrameGen, NoSmoothMotion. The F1 menu's values for their settings are left out of this start only, and stay in
107 # the menu file for a later start on an NVIDIA card; NoFrameGen also keeps the automatic DLSS frame generation off.
108 [string[]]$CardMask,
105 [switch]$PrecompileUsed 109 [switch]$PrecompileUsed
106) 110)
107$root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path 111$root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
@@ -448,8 +452,16 @@ if ($FsrFrameGen) { $settings.LEONIDA_FSR_FRAMEGEN = '1' }
448# shown. It generates only while the game's window has the focus. -NoFrameGen leaves it off (Smooth Motion then). 452# shown. It generates only while the game's window has the focus. -NoFrameGen leaves it off (Smooth Motion then).
449# Never by itself with ray tracing (software or hardware): turning ray tracing on does not turn frame generation on; 453# Never by itself with ray tracing (software or hardware): turning ray tracing on does not turn frame generation on;
450# with it, frame generation runs only when asked for (-FrameGen, the F1 menu, LEONIDA_FRAME_GEN), rules below. 454# with it, frame generation runs only when asked for (-FrameGen, the F1 menu, LEONIDA_FRAME_GEN), rules below.
451if (-not $FrameGen -and -not $NoFrameGen -and ($Resolution -or $Lowest) -and -not $RayTracing -and -not $HardwareRT -and $StreamlineDir) { 455if (-not $FrameGen -and -not $NoFrameGen -and -not (@($CardMask) -contains 'NoFrameGen') -and ($Resolution -or $Lowest) -and -not $RayTracing -and -not $HardwareRT -and $StreamlineDir) {
452 $card = try { (Get-CimInstance Win32_VideoController -ErrorAction Stop | ForEach-Object { $_.Name }) -join ';' } catch { '' } 456 # The card the title runs on: with -Adapter, the cards whose name holds it (any case, as the runtime picks it;
457 # every card when none does), so an AMD card chosen beside an RTX 40 gets no DLSS frame generation (review of
458 # #3272); without it, every card, as before.
459 $cardNames = @(try { Get-CimInstance Win32_VideoController -ErrorAction Stop | ForEach-Object { "$($_.Name)" } } catch { })
460 if ($Adapter) {
461 $picked = @($cardNames | Where-Object { $_.IndexOf($Adapter, [StringComparison]::OrdinalIgnoreCase) -ge 0 })
462 if ($picked.Count) { $cardNames = $picked }
463 }
464 $card = $cardNames -join ';'
453 if ($card -match 'RTX\s*(40|50)\d\d') { 465 if ($card -match 'RTX\s*(40|50)\d\d') {
454 $settings.LEONIDA_FRAME_GEN = '2' 466 $settings.LEONIDA_FRAME_GEN = '2'
455 # Reflex holds the frames shown to 28 a second (14 rendered, 71.4 ms apart), so that the made frames fall 467 # Reflex holds the frames shown to 28 a second (14 rendered, 71.4 ms apart), so that the made frames fall
@@ -626,7 +638,11 @@ $fromLine.LEONIDA_MENU_SMOOTH_MOTION = if ($smooth) { '1' } else { '0' }
626foreach ($k in $More.Keys) { $fromLine[$k] = "$($More[$k])" } 638foreach ($k in $More.Keys) { $fromLine[$k] = "$($More[$k])" }
627$menu = Read-SettingsFile $menuFile 639$menu = Read-SettingsFile $menuFile
628$menuRead = $menu.Count 640$menuRead = $menu.Count
629$fromMenu = @(); $replaced = @() 641# -CardMask: the settings of the switches the card cannot run. The menu's values for them stay in its file and are
642# not used by this start.
643$masked = @{}
644foreach ($name in @($CardMask | Where-Object { $_ })) { foreach ($k in @($switchSettings[$name])) { if ($k) { $masked[$k] = $name } } }
645$fromMenu = @(); $replaced = @(); $heldBack = @()
630foreach ($k in @($menu.Keys)) { 646foreach ($k in @($menu.Keys)) {
631 $v = $menu[$k] 647 $v = $menu[$k]
632 if ($chosenNow.ContainsKey($k)) { 648 if ($chosenNow.ContainsKey($k)) {
@@ -635,6 +651,7 @@ foreach ($k in @($menu.Keys)) {
635 $menu.Remove($k) 651 $menu.Remove($k)
636 continue 652 continue
637 } 653 }
654 if ($masked.ContainsKey($k)) { $heldBack += "$k=$(if ($v) { $v } else { '(unset)' })"; continue }
638 $fromMenu += "$k=$(if ($v) { $v } else { '(unset)' })" 655 $fromMenu += "$k=$(if ($v) { $v } else { '(unset)' })"
639 if ($k -eq 'LEONIDA_MENU_SMOOTH_MOTION') { $smooth = $v -ne '0'; continue } 656 if ($k -eq 'LEONIDA_MENU_SMOOTH_MOTION') { $smooth = $v -ne '0'; continue }
640 if ($k -eq 'LEONIDA_MENU_CONSOLE') { if ($v) { $console = $v }; continue } 657 if ($k -eq 'LEONIDA_MENU_CONSOLE') { if ($v) { $console = $v }; continue }
@@ -642,6 +659,7 @@ foreach ($k in @($menu.Keys)) {
642} 659}
643if ($fromMenu) { Write-Host "F1 menu settings (leonida-settings.txt, for what the command line did not set): $($fromMenu -join ', ')" } 660if ($fromMenu) { Write-Host "F1 menu settings (leonida-settings.txt, for what the command line did not set): $($fromMenu -join ', ')" }
644if ($replaced) { Write-Host "Command line over the F1 menu's saved values: $($replaced -join ', ')" } 661if ($replaced) { Write-Host "Command line over the F1 menu's saved values: $($replaced -join ', ')" }
662if ($heldBack) { Write-Host "F1 menu settings this card cannot run, kept in the menu file but not used now: $($heldBack -join ', ')" }
645# The menu file keeps the rest as it was; a value the command line set leaves it. If the file cannot be written, this 663# The menu file keeps the rest as it was; a value the command line set leaves it. If the file cannot be written, this
646# start still runs with the command line's values and the file stays whole, so nothing saved is lost. 664# start still runs with the command line's values and the file stays whole, so nothing saved is lost.
647if (-not $DryRun -and $menu.Count -ne $menuRead) { 665if (-not $DryRun -and $menu.Count -ne $menuRead) {
@@ -777,6 +795,10 @@ foreach ($s in 'Resolution', 'Lowest', 'Dlss', 'FrameGen', 'Aspect', 'PresentSca
777 if ($PSBoundParameters[$s]) { $again += "-$s '$($PSBoundParameters[$s] -replace "'", "''")'" } 795 if ($PSBoundParameters[$s]) { $again += "-$s '$($PSBoundParameters[$s] -replace "'", "''")'" }
778} 796}
779if ($PSBoundParameters.ContainsKey('WindowsBarMB')) { $again += "-WindowsBarMB $WindowsBarMB" } 797if ($PSBoundParameters.ContainsKey('WindowsBarMB')) { $again += "-WindowsBarMB $WindowsBarMB" }
798# -CardMask too: a card that cannot run the menu's DLSS, DLSS frame generation or Smooth Motion cannot run them after
799# a SAVE AND RESTART either (review of #3272). Its names are switch names, quoted all the same.
800$cardMaskNames = @($CardMask | Where-Object { $_ })
801if ($cardMaskNames.Count) { $again += '-CardMask ' + (@($cardMaskNames | ForEach-Object { "'$($_ -replace "'", "''")'" }) -join ',') }
780# -More too (the launcher's frame limit and advanced options, LEONIDA_FG_WITH_RT ...): without it a SAVE AND RESTART 802# -More too (the launcher's frame limit and advanced options, LEONIDA_FG_WITH_RT ...): without it a SAVE AND RESTART
781# started the game without them. The menu runs these words with -Command, so the table goes as a PowerShell literal, 803# started the game without them. The menu runs these words with -Command, so the table goes as a PowerShell literal,
782# every quote doubled (PowerShell takes the typographic single quotes U+2018 to U+201B for ' too). 804# every quote doubled (PowerShell takes the typographic single quotes U+2018 to U+201B for ' too).