SHARE
TWEET

SpectrePatch Source - Ryley Angus

a guest Jan 7th, 2018 1,012 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Copyright Ryley Angus, 2018
  2. #include <substrate.h>
  3. const double resolutionMilliSeconds = 0.1;
  4.  
  5. #ifdef  __LP64__
  6. static double (*old_now)();
  7.  
  8. double new_now() {
  9.     double orig = old_now();
  10.     return (floor(orig / resolutionMilliSeconds) * resolutionMilliSeconds);
  11. }
  12.  
  13. #else
  14.  
  15. static double (*old_other)(void* arg0);
  16.  
  17. double new_other(void* arg0) {
  18.     double temp = old_other(arg0);
  19.     return (floor(temp / resolutionMilliSeconds) * resolutionMilliSeconds);
  20. }
  21. #endif
  22.  
  23. __attribute__((constructor)) static void initialize() {
  24.     #ifdef __LP64__
  25.         MSHookFunction("__ZNK7WebCore11Performance3nowEv", new_now, &old_now);
  26.     #else
  27.         MSHookFunction("__ZN7WebCore33jsPerformancePrototypeFunctionNowEPN3JSC9ExecStateE", new_other, &old_other);
  28.     #endif
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top