diff --git a/UnleashedRecomp/misc_impl.cpp b/UnleashedRecomp/misc_impl.cpp index a89f2664..bfaaddba 100644 --- a/UnleashedRecomp/misc_impl.cpp +++ b/UnleashedRecomp/misc_impl.cpp @@ -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::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);