feat(play): Windows' graphics preference and the NVIDIA profile follow the player into a new build #87
No reviewers
Labels
No labels
area/build
area/install
area/saves
area/ui
area/updates
ci: approved
good first issue
gpu/amd
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
platform/linux
platform/steam-deck
platform/windows
priority
critical
priority
high
priority
low
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/LongshotLauncher!87
Loading…
Reference in a new issue
No description provided.
Delete branch "dyst/LongshotLauncher:feat/driver-settings-follow"
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?
After an update into a new folder, the game no longer runs on the GPU the player chose for it in Windows, and the NVIDIA app's settings for it (Smooth Motion, DLSS overrides) stop applying (Longshot issue 224). Windows and the driver keep those by the program's full path, which a new folder changes. This brings them over before Play.
Builds on #84 (merged): rebased onto
mainafter it, one commit.What changed
Core/DriverSettings.csGpuPreference): the per-program GPU choice under Settings > System > Display > Graphics is a value ofHKCU\Software\Microsoft\DirectX\UserGpuPreferences, named by the exe's path. A new build's exe with no value gets the one from the most recently updated other build that has one. This goes through the existingIUserRegistry, current user only, no admin.DriverSettings.Nvidia,NvApiProfiles):nvapi64.dll(NvAPI_DRS_CreateSession, LoadSettings, FindApplicationByName, GetProfileInfo, CreateApplication, SaveSettings). The IDs and structure layouts come from NVIDIA's open nvapi headers (NVDRS_APPLICATION_V4,NVDRS_PROFILE_V1).LauncherService.CarryDriverSettings, Windows only):Testing
Tested (Windows 11, RTX 3080, NVIDIA driver 621.14, not elevated):
python -I tests/test_launcher_core.py --strict: 1071 checks pass, after the rebase ontomain(9254499). That includes the newDriverSettingsChecks:dotnet build App -c Release: 0 warnings, 0 errors.NVAPI_OK). The IDs forCreateApplicationandSaveSettingsresolve in this driver. Neither was called.Not tested:
CreateApplicationandSaveSettingsagainst a real driver. This PC has no profile naming a Longshot exe, and I didn't want to change the driver's settings without agreement.Must be tested:
bin\longshot.exe, such as Smooth Motion.For discussion
NvAPI_DRS_SaveSettingsneed an elevated process on current drivers? Reading works without it here. If saving is refused without admin (NVAPI_INVALID_USER_PRIVILEGE), this PR leaves things as they were and says nothing. The options are to keep it that way, to ask once per update behind an elevation prompt, or to leave NVIDIA out.Risks
UserGpuPreferencesgets a value for each new build's exe, copied as it was; old builds' values stay.Related: #57 (an update in place, which would keep the path and make this unneeded for updates), Longshot #729, #84, Longshot #736 (the GPU device row saved by card).
See #90 (NVIDIA app settings lost when the folder name changes).
🤖 Generated with Claude Code
9a06e6597e3907351acdWIP: feat(play): Windows' graphics preference and the NVIDIA profile follow the player into a new buildto feat(play): Windows' graphics preference and the NVIDIA profile follow the player into a new build