Advertisement
TehMerkMods

GG

Nov 13th, 2015
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Detour write packet routine:
  2. void hooked_wp_func_proxy() __attribute__ ((naked));
  3. void hooked_wp_func_proxy()
  4. {
  5.     __asm__
  6.     (
  7.     "stdu 1, -0x70(1);"
  8.     "mfspr 0, %lr;"
  9.     "std 0, 0x80(1);"
  10.  
  11.     "lis 11, 0x3E;"
  12.     "addi 11, 11, 0x05F8;"
  13.     "mtspr %ctr, 11;"
  14.     "bctrl;"
  15.     );
  16.  
  17.     wp_detour();
  18.  
  19.     __asm__
  20.     (
  21.     "ld 0, 0x80(1);"
  22.     "mtspr %lr, 0;"
  23.     "addi 1, 1, 0x70;"
  24.     "blr;"
  25.     );
  26. }
  27.  
  28. Proxy:
  29. void wp_detour()
  30. {
  31.     Client * client = client_get();
  32.     if (client == NULL) return;
  33.        
  34.     CGame * cgame = cgame_get();
  35.     if (cgame == NULL) return;
  36.  
  37.     CCommand * cur = &client->input.commands[client->input.currentIdx & 0x7F];
  38.     CCommand * old = &client->input.commands[(client->input.currentIdx - 1) & 0x7F];
  39.  
  40.     if (hasAutoAimTarget)
  41.     {
  42.         old->viewAngles[0] = cur->viewAngles[0] + ANGLE2SHORT(autoAimTargetAngles[0]);
  43.         old->viewAngles[1] = cur->viewAngles[1] + ANGLE2SHORT(autoAimTargetAngles[1]);
  44.         old->time++;
  45.     }
  46.  
  47.     if (autoShootOn && autoAimReadyToShoot)
  48.     {
  49.         old->buttons &= ~CMD_MASK_FIRE;
  50.         cur->buttons |= CMD_MASK_FIRE;
  51.     }
  52. }
  53. silent aim bo2 C++
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement