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 


Comparing Pointers (or something)

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

Joined: 12 Jul 2006
Posts: 334
Location: The Netherlands

PostPosted: Wed Jul 12, 2006 5:42 am    Post subject: Comparing Pointers (or something) Reply with quote

I'm trying to stop a value from decreasing IF it's the player's ammo. I got a pointer to the ammo [03281434+56], and I managed to do it. But there is one weird gun that works different. The pointer is still valid though. Here's the code that decreases the ammo:
sub [ebp+02],dx
So, I made this (it has the standard Code Injection template, with this in newcode):
cmp ebp,[03281434+56]-02
je exit

But it doesn't work. "cmp ebp,[03281434+54]" doesn't work either. What I want to do is check whether ebp+2 is the same adress that 03281434+56 points to. How do I do that?

Thanks in advance
Back to top
View user's profile Send private message Visit poster's website
me
Grandmaster Cheater
Reputation: 2

Joined: 24 Jun 2004
Posts: 733
Location: location location

PostPosted: Wed Jul 12, 2006 9:50 am    Post subject: Reply with quote

have you tried loading [03281434+56] into a register then comparing it with [ebp+02]

you have to push the register first , as an example Arrow

push eax
mov eax,[03281434+56]
cmp eax,[ebp+02]
pop eax
je exit


or something along those lines

Exclamation

_________________
Back to top
View user's profile Send private message
Glest
Master Cheater
Reputation: 0

Joined: 12 Jul 2006
Posts: 334
Location: The Netherlands

PostPosted: Wed Jul 12, 2006 10:43 am    Post subject: Reply with quote

the problem is that I don't want to compare the value's stored in the adresses, but the adresses itself. For some reason, this line: "cmp ebp+02,[03281434+56]" fails because of the ebp+02. So, I tried this

push eax
mov eax,ebp
add eax,02 //mov eax,ebp+02 gave a compile error
cmp eax,[03281434+56]
pop eax
je exit

But this didn't work either.

Here's the complete situation:
03281434+56 is a pointer to a memory addres
eax+02 is a memory adress
I wan't to compare them. I don't want to compare the value stored in the memory adresses, I want to compare the adresses.
this all failed:
cmp ebp+02,[03281434+56] (compile error)
cmp ebp,[03281434+56]-2 (just didn't work)
cmp ebp,[03281434+54] (also just didn't work)

so.. what can I do? I just started with Cheat Engine, but I think this should be possible.


/edit:
the reason it didn't work is that here, it uses ebp+02. The normal gun routine uses esi+56. The same offset as my pointer, so i could just compare esi with [03281434], but that doesn't work here. So i thought "cmp ebp,[03281434+54]" should work. But apparantly, I'm missing something fundamental.
Back to top
View user's profile Send private message Visit poster's website
me
Grandmaster Cheater
Reputation: 2

Joined: 24 Jun 2004
Posts: 733
Location: location location

PostPosted: Wed Jul 12, 2006 9:53 pm    Post subject: Reply with quote

try putting [03281434+56] into another register first Arrow

push ecx
mov ecx,[03281434+56]
cmp eax,ecx
remembering to pop ecx ....

try adding that into your code and see if that helps,

also make a note of all that the relevent registers are holding in the more info window to keep track of whats going on,

for instance what sub [ebp+02],dx is doing, what value is edx holding,

say you are using a rifle in the game then edx may be subbing 1 from your ammo,
if your using a shotgun in the game then edx may be subbing 2 or more from your ammo, Im guessing that is what may be happening here,

it just helps to keep track what all the registers are doing at the time when the debugger took that snapshot,

just keep hitting the more info button and keep am eye on the register values.


//edit** have you got a register holding the 03281434 part of [03281434+56] its funny seeing the pointer out in the open like that unless the offset is in a register ?? but there you go its a funny world //edit**

_________________
Back to top
View user's profile Send private message
Glest
Master Cheater
Reputation: 0

Joined: 12 Jul 2006
Posts: 334
Location: The Netherlands

PostPosted: Thu Jul 13, 2006 3:35 am    Post subject: Reply with quote

Thanks. I got it to work now... I should have done [03281434]+56 instead of [03281434+56]. So it ended up like this:

push eax
mov eax,[03281434]
add eax,54 //it uses ebp+02, so subtract 02 from 56
cmp ebp,eax
pop eax
je exit
Back to top
View user's profile Send private message Visit poster's website
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