1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-23 12:57:45 +00:00

Fix encrypted arguments on macOS failing

It seems something changed in recent Wine versions(?) so there's now
a new TickCount() function using mach_continuous_time() based off of
XIV on Mac's implementation.
This commit is contained in:
Joshua Goins 2022-04-14 19:02:14 -04:00
parent a2f73779be
commit c925fc5342

View file

@ -10,12 +10,16 @@
#endif #endif
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
// this is pretty much what wine does :-0 // taken from XIV-on-Mac, apparently Wine changed this?
uint32_t TickCount() { uint32_t TickCount() {
struct mach_timebase_info convfact; struct mach_timebase_info timebase;
mach_timebase_info(&convfact); mach_timebase_info(&timebase);
return (mach_absolute_time() * convfact.numer) / (convfact.denom * 1000000); auto machtime = mach_continuous_time();
auto numer = uint64_t (timebase.numer);
auto denom = uint64_t(timebase.denom);
auto monotonic_time = machtime * numer / denom / 100;
return monotonic_time / 10000;
} }
#endif #endif