mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 14:20:42 -07:00
rb: update reflec beat to use new timer (#692)
## Link to GitHub Issue or related Pull Request, if one exists Continuation of #682 ## Description of change RB uses SleepEx, so it was missed during the search while working on #682. ## Testing Plays about the same on a 200Hz touch monitor.
This commit is contained in:
+10
-10
@@ -4,6 +4,8 @@
|
||||
#include "hooks/devicehook.h"
|
||||
#include "hooks/audio/backends/dsound/dsound_backend.h"
|
||||
#include "util/detour.h"
|
||||
#include "util/precise_timer.h"
|
||||
#include "util/logging.h"
|
||||
|
||||
#include "touch.h"
|
||||
|
||||
@@ -11,20 +13,18 @@ static decltype(SleepEx) *SleepEx_orig;
|
||||
|
||||
static DWORD WINAPI SleepEx_hook(DWORD dwMilliseconds, BOOL bAltertable) {
|
||||
|
||||
/*
|
||||
* Increase touch poll from ~110 FPS to ~500 FPS
|
||||
*/
|
||||
// increase touch poll from ~110 FPS to ~500 FPS (Sleep) or ~1000 FPS (Win10 high-res timer)
|
||||
if (dwMilliseconds == 8) {
|
||||
static bool initialized = false;
|
||||
if (!initialized) {
|
||||
initialized = true;
|
||||
|
||||
// if we only sleep for 1ms we also don't need the high priority RB sets
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
|
||||
}
|
||||
dwMilliseconds = 1;
|
||||
}
|
||||
|
||||
// most calls from rb are actually non-alertable
|
||||
if (!bAltertable) {
|
||||
static thread_local timeutils::PreciseSleepTimer timer;
|
||||
timer.sleep(dwMilliseconds);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// call original
|
||||
return SleepEx_orig(dwMilliseconds, bAltertable);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user