Sunshine master
Self-hosted game stream host for Moonlight.
undo_file.h
Go to the documentation of this file.
1
5#pragma once
6
7// standard includes
8#include <filesystem>
9
10// local includes
11#include "nvprefs_common.h"
12#include "undo_data.h"
13
14namespace nvprefs {
15
20 public:
28 static std::optional<undo_file_t> open_existing_file(std::filesystem::path file_path, bool &access_denied);
29
36 static std::optional<undo_file_t> create_new_file(std::filesystem::path file_path);
37
43 bool delete_file();
44
51 bool write_undo_data(const undo_data_t &undo_data);
52
58 std::optional<undo_data_t> read_undo_data();
59
60 private:
61 undo_file_t() = default;
62 safe_handle file_handle;
63 };
64
65} // namespace nvprefs
Serializable NVIDIA profile state saved before preference changes.
Definition undo_data.h:18
File-backed storage for NVIDIA preference undo data.
Definition undo_file.h:19
static std::optional< undo_file_t > create_new_file(std::filesystem::path file_path)
Create new file.
Definition undo_file.cpp:65
bool write_undo_data(const undo_data_t &undo_data)
Write undo data.
Definition undo_file.cpp:94
bool delete_file()
Delete the persisted NVIDIA settings undo file.
Definition undo_file.cpp:80
std::optional< undo_data_t > read_undo_data()
Read undo data.
Definition undo_file.cpp:125
static std::optional< undo_file_t > open_existing_file(std::filesystem::path file_path, bool &access_denied)
Open existing file.
Definition undo_file.cpp:52
Declarations for common nvidia preferences.
Owning Windows HANDLE wrapper that closes handles automatically.
Definition nvprefs_common.h:22
Declarations for undoing changes to nvidia preferences.