fix(sandbox): DLSS starts on Windows PCs where the container is refused ProgramData's path, and NGX's lines are logged when it fails #3086
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3086
Loadingβ¦
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:fix/ngx-programdata"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes #3085: with the sandbox on, DLSS can't be chosen on some Windows PCs, and the menu wrongly says DLSS needs an RTX GPU.
The cause. In NVIDIA's NGX core (
_nvngx.dll),NGXGetPathcallsSHGetKnownFolderPath(FOLDERID_ProgramData, 0, NULL, ...)before anything else. If that call fails, NGX logsNGXGetPath failed to obtain path to models(its line 997,0x3e5) and gives up. That branch is reached from this one call only. I read this from the disassembly of the Windows NGX core that NVIDIA's Linux driver ships for Wine (/usr/lib/nvidia/wine/_nvngx.dll):jsstraight after the call, the GUID62AB5D82-β¦isFOLDERID_ProgramData, and the line number matches the player's log. So on that PC, Windows refuses the AppContainer ProgramData's path. This is why #3085 ruled out the folder's permissions: NGX never got as far as opening anything. Why Windows refuses it on that PC only is still unknown.The fix.
SHGetKnownFolderPath), and passes it to the game inLONGSHOT_SANDBOX_PROGRAMDATA: a drive's whole path, normalised bypath_norm. The variable is under the sandbox's ownLONGSHOT_SANDBOX_prefix, so a player's file can't set it.host/hos_file_windows.c) also patchesSHGetKnownFolderPathin every module's shell32 imports, including_nvngx.dll's, which is loaded later. Windows' answer is kept whenever the call succeeds. Only when it fails forFOLDERID_ProgramDatawith no token, the builder's folder is returned instead, and the log says so once with Windows' error:sandbox: Windows refused the container ProgramData's path (SHGetKnownFolderPath: 0x...) ....NGX's lines in the log without a switch. Until now a failed start left one line (
NGX did not start (0xbad00002)), and the real reason neededRX_VK_DLSS_LOG=1and a second round trip with the player. NGX's lines now always go to the game. The last 64 are kept and written out undervk: NVIDIA DLSS: <why>: NGX's last N lines:whenever NGX fails to start (init, capabilities, not available, parameters).RX_VK_DLSS_LOG=1still logs every line live. NGX's own log files are always off: they went to<game>\ngx, which the sandbox serves read-only.Read first:
my_SHGetKnownFolderPathandpatch_known_folderinhost/hos_file_windows.c,program_datainsandbox_windows.rs,ngx_loginvk_dlss.cpp.Testing
Tested:
tests/test_sandbox_program_data_wine.py(new, Wine and llvm-mingw): 15 checks pass. Refused β the builder's folder, counted and logged once with0x80070005. Not refused β Windows' own answer kept. Another known folder, a token, a bad or missing value β never answered. It fails onmain, where the layer has no such hook (the test program doesn't build).cargo test -p build-core program_data: the value's form (a drive's whole path; a share, relative path,..or control character refused).cargo clippy -p build-core --target x86_64-pc-windows-gnullvm -D warnings: clean.-fsyntax-only -Wall -Wextra -Werror:host/hos_file_windows.candhost/sandbox_windows.c.gpu/vk/vk_dlss.cpp(with the NGX SDK headers): no errors.Not tested: nothing has run in the game. The change is Windows-only, and the PC this was written on is Linux (RTX 3090). Opened without a game run (
--force) at the request of the person I work for.Still to test:
nvmdi.inf, 621.47), sandbox on: expect thesandbox: Windows refused the container ProgramData's pathline, thenNGX started, and DLSS selectable (by hand, the player)refusedline and no change (by hand or Test Farm)RX_VK_DLSS_DIRpointing at an empty folder with no runtime elsewhere), noRX_VK_DLSS_LOG: expectNGX's last N lines:in the log (by hand or Test Farm)NGX startedand nongx:lines without the switch (shared queue run)Measurements
Nothing to measure. One import-table pass more per loaded module (shell32 imports only). NGX's lines are kept in memory instead of written to files: at most 64 strings.
Risks
Checklist
Ready for review
main; the title is a Conventional Commit.--forceon request)mise run testpasses (any failure that also fails onmainis named). (Only the new and directly affected tests ran)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.vk_dlss.cppnot compiled for Linux)Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.π€ Generated with Claude Code
NVIDIA's NGX (_nvngx.dll, NGXGetPath) asks SHGetKnownFolderPath(FOLDERID_ProgramData) before anything else and gives up when it fails ("NGXGetPath failed to obtain path to models", line 997, reached from that call alone). On some PCs Windows refuses it to the AppContainer. The builder now asks it outside the container and hands it over (LONGSHOT_SANDBOX_PROGRAMDATA); the file layer answers SHGetKnownFolderPath(ProgramData) with it only where Windows refused, logged once with Windows' error. NGX's own lines always come to the game: kept (the last 64) and written to the log when NGX fails to start, live with RX_VK_DLSS_LOG=1 as before. Never NGX's own log files, in a folder the sandbox serves read only. Co-Authored-By: Claude Opus 5.5 <[email protected]>WIP: fix(sandbox): DLSS starts on Windows PCs where the container is refused ProgramData's path, and NGX's lines are logged when it failsto fix(sandbox): DLSS starts on Windows PCs where the container is refused ProgramData's path, and NGX's lines are logged when it failsHumanBean referenced this pull request2026-12-03 20:55:53 +00:00