Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Auto-Assembly - how to make CPU wait?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
deama1234
Master Cheater
Reputation: 3

Joined: 20 Dec 2014
Posts: 328

PostPosted: Fri Jan 23, 2015 11:00 am    Post subject: Auto-Assembly - how to make CPU wait? Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25791
Location: The netherlands

PostPosted: Fri Jan 23, 2015 11:04 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
deama1234
Master Cheater
Reputation: 3

Joined: 20 Dec 2014
Posts: 328

PostPosted: Fri Jan 23, 2015 11:29 am    Post subject: Reply with quote

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
View user's profile Send private message
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Fri Jan 23, 2015 1:34 pm    Post subject: Reply with quote

It's the same as (int)1000.
_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
deama1234
Master Cheater
Reputation: 3

Joined: 20 Dec 2014
Posts: 328

PostPosted: Fri Jan 23, 2015 2:22 pm    Post subject: Reply with quote

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
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Fri Jan 23, 2015 11:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25791
Location: The netherlands

PostPosted: Fri Jan 23, 2015 11:25 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
deama1234
Master Cheater
Reputation: 3

Joined: 20 Dec 2014
Posts: 328

PostPosted: Sat Jan 24, 2015 4:50 pm    Post subject: Reply with quote

++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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites