Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Copyright Ryley Angus, 2018
- #include <substrate.h>
- const double resolutionMilliSeconds = 0.1;
- #ifdef __LP64__
- static double (*old_now)();
- double new_now() {
- double orig = old_now();
- return (floor(orig / resolutionMilliSeconds) * resolutionMilliSeconds);
- }
- #else
- static double (*old_other)(void* arg0);
- double new_other(void* arg0) {
- double temp = old_other(arg0);
- return (floor(temp / resolutionMilliSeconds) * resolutionMilliSeconds);
- }
- #endif
- __attribute__((constructor)) static void initialize() {
- #ifdef __LP64__
- MSHookFunction("__ZNK7WebCore11Performance3nowEv", new_now, &old_now);
- #else
- MSHookFunction("__ZN7WebCore33jsPerformancePrototypeFunctionNowEPN3JSC9ExecStateE", new_other, &old_other);
- #endif
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement