diff --git a/GlosSITarget/GlosSITarget.vcxproj b/GlosSITarget/GlosSITarget.vcxproj index b113102..466039f 100644 --- a/GlosSITarget/GlosSITarget.vcxproj +++ b/GlosSITarget/GlosSITarget.vcxproj @@ -194,6 +194,7 @@ + diff --git a/GlosSITarget/GlosSITarget.vcxproj.filters b/GlosSITarget/GlosSITarget.vcxproj.filters index 899ddfa..68b6120 100644 --- a/GlosSITarget/GlosSITarget.vcxproj.filters +++ b/GlosSITarget/GlosSITarget.vcxproj.filters @@ -131,6 +131,9 @@ Header Files + + Header Files + diff --git a/GlosSITarget/ProcessPriority.h b/GlosSITarget/ProcessPriority.h new file mode 100644 index 0000000..972d60a --- /dev/null +++ b/GlosSITarget/ProcessPriority.h @@ -0,0 +1,51 @@ +#pragma once + +#include + +#include "imgui.h" +#include "Overlay.h" + +namespace ProcessPriority { + + +static int current_priority = HIGH_PRIORITY_CLASS; + +inline void init() +{ + SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); + + Overlay::AddOverlayElem([]() { + ImGui::SetNextWindowPos({913, 418}, ImGuiCond_FirstUseEver); + ImGui::SetNextWindowSizeConstraints({170, 325}, {1000, 1000}); + ImGui::Begin("Process Priority"); + ImGui::Text("Might help with input-lag or bad game performance"); + if (ImGui::RadioButton("Realtime", current_priority == REALTIME_PRIORITY_CLASS)) { + SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS); + current_priority = REALTIME_PRIORITY_CLASS; + } + if (ImGui::RadioButton("High", current_priority == HIGH_PRIORITY_CLASS)) { + SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); + current_priority = HIGH_PRIORITY_CLASS; + } + if (ImGui::RadioButton("Above Normal", current_priority == ABOVE_NORMAL_PRIORITY_CLASS)) { + SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS); + current_priority = ABOVE_NORMAL_PRIORITY_CLASS; + } + if (ImGui::RadioButton("Normal", current_priority == NORMAL_PRIORITY_CLASS)) { + SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); + current_priority = NORMAL_PRIORITY_CLASS; + } + if (ImGui::RadioButton("Below Normal", current_priority == BELOW_NORMAL_PRIORITY_CLASS)) { + SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS); + current_priority = BELOW_NORMAL_PRIORITY_CLASS; + } + if (ImGui::RadioButton("Low", current_priority == IDLE_PRIORITY_CLASS)) { + SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS); + current_priority = IDLE_PRIORITY_CLASS; + } + ImGui::End(); + }); + +} + +} diff --git a/GlosSITarget/Resource.rc b/GlosSITarget/Resource.rc index b198bc8..fdbbc31 100644 --- a/GlosSITarget/Resource.rc +++ b/GlosSITarget/Resource.rc @@ -51,8 +51,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,0,3,1012008015277 - PRODUCTVERSION 0,0,3,1012008015277 + FILEVERSION 0,0,4,101004450861 + PRODUCTVERSION 0,0,4,101004450861 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -69,12 +69,12 @@ BEGIN BEGIN VALUE "CompanyName", "Peter Repukat - FlatspotSoftware" VALUE "FileDescription", "GlosSI - SteamTarget" - VALUE "FileVersion", "0.0.3.1-12-g8d15277" + VALUE "FileVersion", "0.0.4.1-1-g445f861" VALUE "InternalName", "GlosSITarget" VALUE "LegalCopyright", "Copyright (C) 2021 Peter Repukat - FlatspotSoftware" VALUE "OriginalFilename", "GlosSITarget.exe" VALUE "ProductName", "GlosSI" - VALUE "ProductVersion", "0.0.3.1-12-g8d15277" + VALUE "ProductVersion", "0.0.4.1-1-g445f861" END END BLOCK "VarFileInfo" @@ -695,6 +695,22 @@ END + + + + + + + + + + + + + + + + diff --git a/GlosSITarget/TargetWindow.cpp b/GlosSITarget/TargetWindow.cpp index a971967..db88967 100644 --- a/GlosSITarget/TargetWindow.cpp +++ b/GlosSITarget/TargetWindow.cpp @@ -22,12 +22,15 @@ limitations under the License. #include #include + #ifdef _WIN32 #include #include #include #include +#include "ProcessPriority.h" + #include "Settings.h" #if !defined(WM_DPICHANGED) @@ -57,6 +60,8 @@ TargetWindow::TargetWindow( } ImGui::End(); }); + + ProcessPriority::init(); } void TargetWindow::setFpsLimit(unsigned int fps_limit)