mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-27 12:51:42 +00:00
Replace QueryPerformanceCounter. (#35)
This commit is contained in:
parent
9b6e4406b7
commit
4a38878aa0
1 changed files with 11 additions and 7 deletions
|
|
@ -3,16 +3,20 @@
|
|||
|
||||
BOOL QueryPerformanceCounterImpl(LARGE_INTEGER* lpPerformanceCount)
|
||||
{
|
||||
BOOL result = QueryPerformanceCounter(lpPerformanceCount);
|
||||
ByteSwapInplace(lpPerformanceCount->QuadPart);
|
||||
return result;
|
||||
lpPerformanceCount->QuadPart = ByteSwap(std::chrono::steady_clock::now().time_since_epoch().count());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL QueryPerformanceFrequencyImpl(LARGE_INTEGER* lpFrequency)
|
||||
{
|
||||
BOOL result = QueryPerformanceFrequency(lpFrequency);
|
||||
ByteSwapInplace(lpFrequency->QuadPart);
|
||||
return result;
|
||||
constexpr auto Frequency = std::chrono::steady_clock::period::den / std::chrono::steady_clock::period::num;
|
||||
lpFrequency->QuadPart = ByteSwap(Frequency);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DWORD GetTickCountImpl()
|
||||
{
|
||||
return DWORD(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count());
|
||||
}
|
||||
|
||||
void GlobalMemoryStatusImpl(XLPMEMORYSTATUS lpMemoryStatus)
|
||||
|
|
@ -42,7 +46,7 @@ GUEST_FUNCTION_HOOK(sub_82BD4CA8, OutputDebugStringA);
|
|||
|
||||
GUEST_FUNCTION_HOOK(sub_82BD4AC8, QueryPerformanceCounterImpl);
|
||||
GUEST_FUNCTION_HOOK(sub_831CD040, QueryPerformanceFrequencyImpl);
|
||||
GUEST_FUNCTION_HOOK(sub_831CDAD0, GetTickCount);
|
||||
GUEST_FUNCTION_HOOK(sub_831CDAD0, GetTickCountImpl);
|
||||
|
||||
GUEST_FUNCTION_HOOK(sub_82BD4BC0, GlobalMemoryStatusImpl);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue