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 


[HELP]Need some help with asm code

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

Joined: 17 Apr 2013
Posts: 130

PostPosted: Tue Apr 29, 2014 10:04 am    Post subject: [HELP]Need some help with asm code Reply with quote

I know it's a long code, but maybe someone could help me, and tell me why am i crashing for no reason, or when changing a map with script on?
Also i am a little confused where to pop ecx.

Thanks

Code:
0B0D1653 - D9 1E                 - fstp dword ptr [esi]
0B0D1655 - D9 5E 04              - fstp dword ptr [esi+04]
0B0D1658 - D9 5E 08              - fstp dword ptr [esi+08]
0B0D165B - 5B                    - pop ebx
0B0D165C - 5E                    - pop esi
0B0D165D - 5F                    - pop edi
0B0D165E - 5D                    - pop ebp


Crashing after some time even without mob_to_saved/s_enable/l_enable on
Code:
[ENABLE]
Aobscan(coordaddr,D9 1E D9 5E 04 D9 5E 08 5B 5E 5F 5D)
alloc(newmem,4096)
label(returnhere)
label(x)
label(y)
label(poppy)
label(save_coord)
label(load_coord)
label(s_enable)
label(l_enable)
label(player)
label(enemy)
label(mobToSavedCoordinates)
label(mob_to_saved)
registersymbol(x)
registersymbol(y)
registersymbol(coordaddr)
registersymbol(s_enable)
registersymbol(l_enable)
registersymbol(mob_to_saved)

newmem:
fstp dword ptr [esi]
fstp dword ptr [esi+04]
push ecx
mov ecx,[esi+50]
mov ecx,[ecx]
mov ecx,[ecx+04]
cmp ecx,(int)596             //If player
je player
cmp ecx,(int)248             //If bullets
je poppy
jmp enemy

enemy:
cmp [mob_to_saved],1
je mobToSavedCoordinates
jmp poppy

player:
cmp [s_enable],1
je save_coord
cmp [l_enable],1
je load_coord
jmp poppy

//save player coordinates
save_coord:
mov [s_enable],0
push eax
mov eax,[esi]
mov [x],eax
mov eax,[esi+04]
mov [y],eax
pop eax
jmp poppy


//Player to saved coordinates
load_coord:
mov [l_enable],0
cmp [x],0
je poppy
push eax
mov eax,[x]
mov [esi],eax
mov eax,[y]
mov [esi+04],eax
pop eax
jmp poppy


//Enemy to saved coordinates
mobToSavedCoordinates:
push eax
mov eax,[x]
mov [esi],eax
mov eax,[y]
mov [esi+04],eax
pop eax
jmp poppy


poppy:
pop ecx
jmp returnhere

x:
dd 0
y:
dd 0
s_enable:
dd 0
l_enable:
dd 0
mob_to_saved:
dd 0

coordaddr:
jmp newmem
returnhere:

[DISABLE]
dealloc(newmem)
unregistersymbol(x)
unregistersymbol(y)
unregistersymbol(s_enable)
unregistersymbol(l_enable)
unregistersymbol(coordaddr)
unregistersymbol(mob_to_saved)

coordaddr:
fstp dword ptr [esi]
fstp dword ptr [esi+04]
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

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

PostPosted: Tue Apr 29, 2014 11:42 am    Post subject: This post has 1 review(s) Reply with quote

Launch game, attach OllyDbg to that game, resume process (because OllyDbg pauses process while attaching). Now launch CE and enable script. Play the game.

After a while, game will freeze, go to OllyDbg. On the bottom there will be exception type. Faulty opcode will be highlighted. My bet is, it will be "access violation" exception.


Then try changing this to something else:
Code:
mov ecx,[esi+50]
mov ecx,[ecx]
mov ecx,[ecx+04]




maybe this will be enough:
Code:
mov ecx,[esi+50]
cmp ecx,00010000
jbe poppy
mov ecx,[ecx]
cmp ecx,00010000
jbe poppy

mov ecx,[ecx+04]

_________________
Back to top
View user's profile Send private message MSN Messenger
lamafao
Expert Cheater
Reputation: 1

Joined: 17 Apr 2013
Posts: 130

PostPosted: Tue Apr 29, 2014 12:27 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
Launch game, attach OllyDbg to that game, resume process (because OllyDbg pauses process while attaching). Now launch CE and enable script. Play the game.

After a while, game will freeze, go to OllyDbg. On the bottom there will be exception type. Faulty opcode will be highlighted. My bet is, it will be "access violation" exception.


Then try changing this to something else:
Code:
mov ecx,[esi+50]
mov ecx,[ecx]
mov ecx,[ecx+04]




maybe this will be enough:
Code:
mov ecx,[esi+50]
cmp ecx,00010000
jbe poppy
mov ecx,[ecx]
cmp ecx,00010000
jbe poppy

mov ecx,[ecx+04]


You were right "Access violation when reading [00000000]"

The code that you gave worked, thanks a lot.
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