Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- an example of how pspeed works, made for kujou
- this is really rough, but that's how most pspeeds work(atleast the pasted one by ph0ne)
- -Snorflake
- */
- #include <Windows.h>
- #include <iostream>
- int timesrun = 5; //basic pspeed code
- void CreateMove()
- {
- //We hook here
- void* pBase; //ebp of CreateMove()
- __asm mov pBase, ebp; //copies ebp into pBase
- 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
- //We can prove this, if we DONT dereference pBase, it'll only run CreateMove recursively, instead of CL_Move recursively.
- if (timesrun > 1) //basic pspeed code
- {
- timesrun--; //basic pspeed code
- *retnaddr -= 0x5; //Retn address is 4 bytes after ebp, so move it back 4 + 1
- }
- ///////////////////////////////////
- //original create move
- printf("Called CreateMove!\n");
- }
- void CL_Move()
- {
- printf("Called CL_Move!\n");
- CreateMove();
- }
- int main()
- {
- //each tick main() is called
- CL_Move();
- getchar(); //keeps the console on the screen
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment