Sunshine0.0.5917
Sunshine 0.0.5917
Self-hosted game stream host for Moonlight.
Loading...
Searching...
No Matches
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
44 template<class T>
45 void operator()(T *p) const {
46 LocalFree(p);
47 }
48 };
49
53 template<typename T>
55
60
66 void info_message(const std::wstring &message);
67
73 void info_message(const std::string &message);
74
80 void error_message(const std::wstring &message);
81
87 void error_message(const std::string &message);
88
96
103
104} // namespace nvprefs
Unique pointer wrapper with customizable pointer and deleter types.
Definition utility.h:814
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
util::uniq_ptr< std::remove_pointer_t< T >, safe_hlocal_deleter > safe_hlocal
Unique pointer for memory released with LocalFree.
Definition nvprefs_common.h:54
util::safe_ptr_v2< void, PVOID, &FreeSid > safe_sid
Safe pointer for Windows security identifiers released with FreeSid.
Definition nvprefs_common.h:59
Parsed command-line options for the NVIDIA preferences helper.
Definition nvprefs_common.h:92
bool sunshine_high_power_mode
Whether NVIDIA high-power mode should be enabled for Sunshine.
Definition nvprefs_common.h:94
bool opengl_vulkan_on_dxgi
Whether NVIDIA OpenGL/Vulkan-on-DXGI should be enabled.
Definition nvprefs_common.h:93
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()(T *p) const
Free memory allocated by Windows local-memory APIs.
Definition nvprefs_common.h:45
Declarations for utility functions.
uniq_ptr< T, Destroy< T *, ReturnType, function > > safe_ptr_v2
Safe pointer wrapper for APIs whose release function returns a status value.
Definition utility.h:1597