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
This commit is contained in:
@@ -150,26 +150,13 @@ void ArchHooks_Win32::SetTime( tm newtime )
|
|||||||
|
|
||||||
void ArchHooks_Win32::BoostPriority()
|
void ArchHooks_Win32::BoostPriority()
|
||||||
{
|
{
|
||||||
/* We just want a slight boost, so we don't skip needlessly if something happens
|
// Be sure to boost the app, not the thread, to make sure the sound thread stays higher priority than the main thread.
|
||||||
* in the background. We don't really want to be high-priority--above normal should
|
SetPriorityClass( GetCurrentProcess(), HIGH_PRIORITY_CLASS );
|
||||||
* 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 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArchHooks_Win32::UnBoostPriority()
|
void ArchHooks_Win32::UnBoostPriority()
|
||||||
{
|
{
|
||||||
SetPriorityClass( GetCurrentProcess(), NORMAL_PRIORITY_CLASS );
|
SetPriorityClass( GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArchHooks_Win32::SetupConcurrentRenderingThread()
|
void ArchHooks_Win32::SetupConcurrentRenderingThread()
|
||||||
|
|||||||
Reference in New Issue
Block a user