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 


A few questions about debugging

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

Joined: 09 Jul 2011
Posts: 48

PostPosted: Mon Feb 18, 2013 5:56 am    Post subject: A few questions about debugging Reply with quote

First question: I've encountered in DMC5 a situation like this:

Code:
movss [ecx], xmm0


This is the operation that sets the HP (For anyone making a CT for that game: it's in "DMC-DevilMayCry.exe"+68164)

Both before the game stepped into this line, and after, ECX didn't contain the right address. I found out that to get the right address I had to apply an offset of 2 (so if it was 0000000, it would have been 00000002).

How is this possible that the actual destination of this instruction is [ecx+2]?

My second question is this:

What do you do when a game crashes from your assembly? How do you debug it or even know what was the problem?

And my third and last question is: I tried to set a breakpoint before an instruction, and also find out what's writing to the address the instruction is writing to, and somehow the registers in the debug window and the registers in the information window were different, why is that?

Thank you very much.


Last edited by Pokiaka on Mon Feb 18, 2013 8:36 pm; edited 1 time in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Mon Feb 18, 2013 6:56 am    Post subject: Reply with quote

1:
Post the bytes of that instruction here, but my guess is that the address you found isn't the correct one.
This often happens when doing a unknown initial value scan with a wrong type or alignment. In this case, it's of type "Float"

2:
Set a breakpoint and debug (perhaps add a jmp originalcode that you must manually nop after setting the breakpoin)

alternatively, you can use the Lua command sharedmem=allocateSharedMemory("name", size)
That returns an address in the game you can use to store debug information.

(And then in combination with registerSymbol("sharedmem", sharedmem) so aa scripts can use it.)

e.g:
mov [sharedmem], 1
..do stuff..
mov [sharedmem],2
..do stuff..

then when the game has crashed call allocateSharedMemory again (on any process you like) and in the new location you can see at which step it crashed

3: The instruction may be used by other addresses as well.
E.g, the decreasehealth() function might be used for both the player as an enemy

_________________
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
Pokiaka
Cheater
Reputation: 0

Joined: 09 Jul 2011
Posts: 48

PostPosted: Mon Feb 18, 2013 7:11 am    Post subject: Reply with quote

Dark Byte wrote:
1:
Post the bytes of that instruction here, but my guess is that the address you found isn't the correct one.
This often happens when doing a unknown initial value scan with a wrong type or alignment. In this case, it's of type "Float"

2:
Set a breakpoint and debug (perhaps add a jmp originalcode that you must manually nop after setting the breakpoin)

alternatively, you can use the Lua command sharedmem=allocateSharedMemory("name", size)
That returns an address in the game you can use to store debug information.

(And then in combination with registerSymbol("sharedmem", sharedmem) so aa scripts can use it.)

e.g:
mov [sharedmem], 1
..do stuff..
mov [sharedmem],2
..do stuff..

then when the game has crashed call allocateSharedMemory again (on any process you like) and in the new location you can see at which step it crashed

3: The instruction may be used by other addresses as well.
E.g, the decreasehealth() function might be used for both the player as an enemy


Thank Dark Byte,

1:
F3 0F11 01 - movss [ecx],xmm0

2:
I thought of using a breakpoint but it's not practical.
It crashes randomly, and because it's the instruction that reduces HP it happens all the time. The game wouldn't be playable.

As for the alternative, I don't know Lua, or any of the commands. do you have a reference that'll teach me?

EDIT:

I've found the wiki page with all the functions and I think I can handle Lua syntax, but how exactly could I save all the debug information?

I actually have 2 questions about it:

A) Do I to do something tedious like writing every single register into an allocated space?
B) How do I read it again later? I didn't get how allocating new memory in another process could show me the information I need.. just an allocation.

3:
It is for both enemy and player.
But the registers are different for the same instruction.

(What I've actually done is right click on an address and opened the find out window. Since I already knew what instruction will change it I've set a breakpoint there too, and in one cycle the registers were different.)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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