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 


Coding a loop around a call? //infinite loop ?!

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

Joined: 18 Apr 2015
Posts: 34

PostPosted: Fri Jun 26, 2015 3:52 am    Post subject: Coding a loop around a call? //infinite loop ?! Reply with quote

Code:
[enable]
alloc(myCode1, 1024)
label(myLoop)

005E3892:
jmp myCode1
nop
nop
nop
nop
nop

myCode1:
mov edx,8
mov ebx,8
push ecx
push edx
push eax
mov ecx,esi

myLoop:
call 005E28D0
inc eax
cmp eax,5
jne myLoop
jmp 005E389C

[disable]
dealloc(myCode1)

005E3892:
push ecx
push edx
push eax
mov ecx,esi
call 005E28D0


Code:
Edit: the problem is that eax changes to 0 after call so infinite loop...

how do I solve this?


this instruction call 005E28D0 I believe it is the shoot function.. is my loop correct? because I am getting crashes the only reason I can think of is that eax is already used so I cant use it as counter =/?
but maybe something else is wrong?


also if all registers are taken.. can I define somehow a new counter?
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Jun 26, 2015 10:05 am    Post subject: Re: Coding a loop around a call? //infinite loop ?! Reply with quote

For simplicity, just define a new variable.
Code:
alloc(myvar,4)
inc dword ptr [myvar]
cmp dword ptr [myvar],5

However, you'll also need to save the values and re-push everything when making each call.
Code:
push ecx
push edx
push eax
mov ecx,esi
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Fri Jun 26, 2015 2:38 pm    Post subject: Reply with quote

Code:
  push ebp
  mov ebp,esp

  mov ebx,8
  mov edx,8

  push esi

  push ecx
  push edx
  push eax
  //stack
  //eax      ebp-10
  //edx      ebp-0c
  //ecx      ebp-08
  //esi      ebp-04
  //ebp      ebp±00

loop:
  push [ebp-08]
  push [ebp-0c]
  push [ebp-10]
  mov ecx,[ebp-04]
  call 005E28D0
  inc [ebp-10]
  cmp [ebp-10],5
  jne short loop

  mov esi,[ebp-04]

  add esp,10
  pop ebp

  jmp 005E389C

_________________
Back to top
View user's profile Send private message MSN Messenger
Loset
Cheater
Reputation: 0

Joined: 18 Apr 2015
Posts: 34

PostPosted: Fri Jun 26, 2015 3:22 pm    Post subject: Reply with quote

thanks guys you have been very helpful =] ! it took me a few hours but I now understand better the concept thanks.
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