From 3f8a7f5fd389cd3e8f923229bf46df278cdbf5cf Mon Sep 17 00:00:00 2001 From: sukibaby <163092272+sukibaby@users.noreply.github.com> Date: Tue, 23 Apr 2024 20:06:26 -0700 Subject: [PATCH] Run as "High Priority" on Windows Enforcing HIGH_PRIORITY_CLASS is best for Win10+ where Windows Update can interrupt the game and it also prevents streaming apps (OBS/Discord) from causing stutter by taking rendering priority away from ITGMania. Update ArchHooks_Win32.cpp --- src/arch/ArchHooks/ArchHooks_Win32.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/arch/ArchHooks/ArchHooks_Win32.cpp b/src/arch/ArchHooks/ArchHooks_Win32.cpp index 0da254e5fe..4abc1213a1 100644 --- a/src/arch/ArchHooks/ArchHooks_Win32.cpp +++ b/src/arch/ArchHooks/ArchHooks_Win32.cpp @@ -150,26 +150,13 @@ void ArchHooks_Win32::SetTime( tm newtime ) void ArchHooks_Win32::BoostPriority() { - /* We just want a slight boost, so we don't skip needlessly if something happens - * in the background. We don't really want to be high-priority--above normal should - * be enough. However, ABOVE_NORMAL_PRIORITY_CLASS is only supported in Win2000 - * and later. */ -#ifndef ABOVE_NORMAL_PRIORITY_CLASS -#define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000 -#endif - - DWORD pri = HIGH_PRIORITY_CLASS; - if( IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN2K), LOBYTE(_WIN32_WINNT_WIN2K), 0) ) - pri = ABOVE_NORMAL_PRIORITY_CLASS; - - /* Be sure to boost the app, not the thread, to make sure the - * sound thread stays higher priority than the main thread. */ - SetPriorityClass( GetCurrentProcess(), pri ); + // Be sure to boost the app, not the thread, to make sure the sound thread stays higher priority than the main thread. + SetPriorityClass( GetCurrentProcess(), HIGH_PRIORITY_CLASS ); } void ArchHooks_Win32::UnBoostPriority() { - SetPriorityClass( GetCurrentProcess(), NORMAL_PRIORITY_CLASS ); + SetPriorityClass( GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS ); } void ArchHooks_Win32::SetupConcurrentRenderingThread()