Sunshine master
Self-hosted game stream host for Moonlight.
nvprefs_common.h
Go to the documentation of this file.
1
5#pragma once
6
7// platform includes
8// disable clang-format header reordering
9// clang-format off
10#include <Windows.h>
11#include <AclAPI.h>
12// clang-format on
13
14// local includes
15#include "src/utility.h"
16
17namespace nvprefs {
18
22 struct safe_handle: public util::safe_ptr_v2<void, BOOL, CloseHandle> {
23 using util::safe_ptr_v2<void, BOOL, CloseHandle>::safe_ptr_v2;
24
28 explicit operator bool() const {
29 auto handle = get();
30 return handle != nullptr && handle != INVALID_HANDLE_VALUE;
31 }
32 };
33
43 void operator()(void *p) {
44 LocalFree(p);
45 }
46 };
47
51 template<typename T>
53
58
64 void info_message(const std::wstring &message);
65
71 void info_message(const std::string &message);
72
78 void error_message(const std::wstring &message);
79
85 void error_message(const std::string &message);
86
94
101
102} // namespace nvprefs
Unique pointer wrapper with customizable pointer and deleter types.
Definition utility.h:820
pointer get()
Return the currently wrapped value or handle.
Definition utility.h:948
void info_message(const std::wstring &message)
Forward an informational NVPrefs message to the logger.
Definition nvprefs_common.cpp:17
void error_message(const std::wstring &message)
Forward an NVPrefs error message to the logger.
Definition nvprefs_common.cpp:31
nvprefs_options get_nvprefs_options()
Get nvprefs options.
Definition nvprefs_common.cpp:45
Parsed command-line options for the NVIDIA preferences helper.
Definition nvprefs_common.h:90
bool sunshine_high_power_mode
Whether NVIDIA high-power mode should be enabled for Sunshine.
Definition nvprefs_common.h:92
bool opengl_vulkan_on_dxgi
Whether NVIDIA OpenGL/Vulkan-on-DXGI should be enabled.
Definition nvprefs_common.h:91
Owning Windows HANDLE wrapper that closes handles automatically.
Definition nvprefs_common.h:22
Deleter for memory allocated by Windows LocalAlloc APIs.
Definition nvprefs_common.h:37
void operator()(void *p)
Free memory allocated by Windows local-memory APIs.
Definition nvprefs_common.h:43
Declarations for utility functions.