From c6c35a588ce21da929fdaf664b257d34cf2f93a7 Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Sun, 10 Sep 2023 14:53:54 +0100 Subject: [PATCH] [*] Switch to astatic Aurora::Utility::RateLimiter limiter` for gRuntimeConfig.threadingConfig.bWinXpThrough7BlazeOptimizerPower --- Source/AuProcAddresses.NT.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Source/AuProcAddresses.NT.cpp b/Source/AuProcAddresses.NT.cpp index 0e2c5512..b38291c4 100644 --- a/Source/AuProcAddresses.NT.cpp +++ b/Source/AuProcAddresses.NT.cpp @@ -238,7 +238,6 @@ namespace Aurora void Win32DropSchedulerResolution() { - static AuUInt uCounter {}; ULONG ullActualResolution {}; if (gShouldResPathDoNothing) @@ -248,20 +247,15 @@ namespace Aurora if (gRuntimeConfig.threadingConfig.bEnableAgrSchedulingRatelimit) { - AuUInt uCount {}; - if (!(((uCount = uCounter++)) & (1ull << (gRuntimeConfig.threadingConfig.bWinXpThrough7BlazeOptimizerPower + 5ull)))) + static Aurora::Utility::RateLimiter limiter; + if (!limiter.nsTimeStep) { - if (uCount != 0) - { - return; - } + limiter.SetNextStep(gRuntimeConfig.threadingConfig.bWinXpThrough7BlazeOptimizerPower); } - else + else if (!limiter.CheckExchangePass()) { - - uCounter = 0; + return; } - } if (pZwSetTimerResolution)