Modify and restore NVIDIA control panel settings

Namely:
- Power profile for sunshine.exe
- Global OpenGL/Vulkan DXGI swapchain
This commit is contained in:
ns6089 2023-07-02 13:01:29 +03:00 committed by Cameron Gutman
commit f245f777f7
15 changed files with 1174 additions and 4 deletions

View file

@ -33,6 +33,8 @@
#include "src/utility.h"
#include <iterator>
#include "nvprefs/nvprefs_interface.h"
// UDP_SEND_MSG_SIZE was added in the Windows 10 20H1 SDK
#ifndef UDP_SEND_MSG_SIZE
#define UDP_SEND_MSG_SIZE 2
@ -740,6 +742,16 @@ namespace platf {
// Promote ourselves to high priority class
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
// Modify NVIDIA control panel settings again, in case they have been changed externally since sunshine launch
if (nvprefs_instance.load()) {
if (!nvprefs_instance.owning_undo_file()) {
nvprefs_instance.restore_from_and_delete_undo_file_if_exists();
}
nvprefs_instance.modify_application_profile();
nvprefs_instance.modify_global_profile();
nvprefs_instance.unload();
}
// Enable low latency mode on all connected WLAN NICs if wlanapi.dll is available
if (fn_WlanOpenHandle) {
DWORD negotiated_version;