View previous topic :: View next topic |
Author |
Message |
deama1234 Master Cheater
Reputation: 3
Joined: 20 Dec 2014 Posts: 328
|
Posted: Fri Jan 23, 2015 11:00 am Post subject: Auto-Assembly - how to make CPU wait? |
|
|
Like the name suggests, how do I make the processing of my opcodes stop for say 1 second and then continue processing it?
I read something about "call sleep" but I haven't found a good explanation or even a good example of how to use it...
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25791 Location: The netherlands
|
Posted: Fri Jan 23, 2015 11:04 am Post subject: |
|
|
in 32-bit:
push #1000
call kernel32.sleep
in 64-bit:
mov ecx,#1000
call kernel32.sleep
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
deama1234 Master Cheater
Reputation: 3
Joined: 20 Dec 2014 Posts: 328
|
Posted: Fri Jan 23, 2015 11:29 am Post subject: |
|
|
Dark Byte wrote: | in 32-bit:
push #1000
call kernel32.sleep
in 64-bit:
mov ecx,#1000
call kernel32.sleep |
Thanks, though what does the "#" mean?
|
|
Back to top |
|
 |
Geri Moderator
Reputation: 111
Joined: 05 Feb 2010 Posts: 5636
|
Posted: Fri Jan 23, 2015 1:34 pm Post subject: |
|
|
It's the same as (int)1000.
_________________
|
|
Back to top |
|
 |
deama1234 Master Cheater
Reputation: 3
Joined: 20 Dec 2014 Posts: 328
|
Posted: Fri Jan 23, 2015 2:22 pm Post subject: |
|
|
Oh...
EDIT: Is there a way to keep the game running but stop a specific function? So when I press space for the character to jump, is there a way to stop it from hitting that "dec eax" opcode that tells the game that I've reached the max height? Like, can I make it wait 1 second?
|
|
Back to top |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Fri Jan 23, 2015 11:02 pm Post subject: |
|
|
Yes...you can create an internal timer that NOP's the original function until your custom condition is satisfied.
You can register a symbol and set up a hotkey that sets the value for that symbol (e.g. 9999 float). Then, when the function gets executed, you can check that symbol value against 0, and if the condition is true, the original code gets executed. If the value is not 0, it will execute the custom timer that will sub the value incrementally until the result is 0. You can adjust the timer as needed to allow for more or less time by setting up multiple hotkeys for different timer values etc...but that's usually not necessary.
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25791 Location: The netherlands
|
Posted: Fri Jan 23, 2015 11:25 pm Post subject: |
|
|
you can also do a code injection that jumps over the specific code for a certain amount of time
Use "call gettickcount" to get a counter that increases by 1 every millisecond
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
deama1234 Master Cheater
Reputation: 3
Joined: 20 Dec 2014 Posts: 328
|
Posted: Sat Jan 24, 2015 4:50 pm Post subject: |
|
|
++METHOS wrote: | Yes...you can create an internal timer that NOP's the original function until your custom condition is satisfied.
You can register a symbol and set up a hotkey that sets the value for that symbol (e.g. 9999 float). Then, when the function gets executed, you can check that symbol value against 0, and if the condition is true, the original code gets executed. If the value is not 0, it will execute the custom timer that will sub the value incrementally until the result is 0. You can adjust the timer as needed to allow for more or less time by setting up multiple hotkeys for different timer values etc...but that's usually not necessary. |
I could "try it"...
Well, seems to work fine; thanks.
Dark Byte wrote: | you can also do a code injection that jumps over the specific code for a certain amount of time
Use "call gettickcount" to get a counter that increases by 1 every millisecond |
Where does the "gettickcount" get put into? What register? Or can I manually put it into whatever register I choose? If so, how?
EDIT: I think it's eax isn't it? So, how do I reset the counter or make it "wait" 1 second?
Alright, I made a code that is supposed to delay the action commented by a second, but it won't work...
Code: | originalcode:
push ecx
push eax
push edx
push bx
jmp compare
calculate:
sub [ebx+00000480],01 //action to delay
pop bx
pop edx
pop eax
pop ecx
jmp exit
compare:
cmp bx,00
je delay
call gettickcount
mov ecx,eax
sub ecx,edx
cmp ecx,03E8
jae calculate
jmp compare
delay:
call gettickcount
mov edx,eax
inc bx
jmp compare
exit:
jmp returnhere |
|
|
Back to top |
|
 |
|