Snorflake

pspeed recreation

Oct 9th, 2015
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. /*
  2. an example of how pspeed works, made for kujou
  3. this is really rough, but that's how most pspeeds work(atleast the pasted one by ph0ne)
  4. -Snorflake
  5. */
  6. #include <Windows.h>
  7. #include <iostream>
  8. int timesrun = 5; //basic pspeed code
  9. void CreateMove()
  10. {
  11. //We hook here
  12. void* pBase; //ebp of CreateMove()
  13. __asm mov pBase, ebp; //copies ebp into pBase
  14. DWORD* retnaddr = (DWORD*)(*(DWORD*)pBase + 0x4); //Gets the return address of the function that called this(because we dereference ebp). In this case, CL_MOVE
  15. //We can prove this, if we DONT dereference pBase, it'll only run CreateMove recursively, instead of CL_Move recursively.
  16. if (timesrun > 1) //basic pspeed code
  17. {
  18. timesrun--; //basic pspeed code
  19. *retnaddr -= 0x5; //Retn address is 4 bytes after ebp, so move it back 4 + 1
  20. }
  21. ///////////////////////////////////
  22. //original create move
  23. printf("Called CreateMove!\n");
  24. }
  25. void CL_Move()
  26. {
  27. printf("Called CL_Move!\n");
  28. CreateMove();
  29. }
  30. int main()
  31. {
  32. //each tick main() is called
  33. CL_Move();
  34.  
  35. getchar(); //keeps the console on the screen
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment