[MISC] Allow user to override process priority class

This commit is contained in:
Xphalnos
2024-10-25 20:03:20 +02:00
committed by Radosław Gliński
parent 82cb261140
commit cf0ee05da6
5 changed files with 35 additions and 0 deletions

View File

@@ -86,6 +86,12 @@ DECLARE_int32(user_language);
DECLARE_bool(allow_plugins);
DEFINE_int32(priority_class, 0,
"Forces Xenia to use different process priority than default one. "
"It might affect performance and cause unexpected bugs. Possible "
"values: 0 - Normal, 1 - Above normal, 2 - High",
"General");
namespace xe {
using namespace xe::literals;
@@ -125,6 +131,13 @@ Emulator::Emulator(const std::filesystem::path& command_line,
paused_(false),
restoring_(false),
restore_fence_() {
if (cvars::priority_class != 0) {
if (SetProcessPriorityClass(cvars::priority_class)) {
XELOGI("Higher priority class request: Successful. New priority: {}",
cvars::priority_class);
}
}
#if XE_PLATFORM_WIN32 == 1
// Show a disclaimer that links to the quickstart
// guide the first time they ever open the emulator