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 


Need help with a most likely simple situation

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

Joined: 02 Jul 2007
Posts: 805

PostPosted: Fri Jan 10, 2020 8:55 pm    Post subject: Need help with a most likely simple situation Reply with quote

Hey all,

I'm attempting something and don't really know how to go about it or I'm just brain dead as it has been a very long day haha.

So I have a address found by doing an AOB scan which the register EDI at that location has the base address. The address I am looking to get the value for is +24C8 from that address. I am looking to compare the value of base player address+24C8 a integer (let's say 4) and if it is less than that then write the integer to the to the address value.

I think I'm going about this stupidly, but this is what I have so far.

Code:

  mov [pPlayer],edi //pPlayer stores the base address
  mov esi,[pPlayer]+24c8 //store the heath address into esi
  mov [health],esi //store the health address into a heath var


I guess what I am asking is how do I compare the value of an address, but the address is stored inside another variable. Is there a pointer compare where I could just say this is a pointer to the real address which holds the value and compare to the value that the pointer points at?

Any help would be appreciated. I'm just starting newish to this after taking a long long long hiatus.

_________________
Name: Player One
Occupation: Gamer

The Players are a particularly violent group of gamers. They solve all of their problems via bloody bouts with each other, and they live happier lives for it.

Player One is blue, and a bit of an asshole.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4300

PostPosted: Fri Jan 10, 2020 9:35 pm    Post subject: Reply with quote

Code:
cmp [edi+24c8],4
jge short @f
mov [edi+24c8],4
@@:
// original code...

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
godsblight
Grandmaster Cheater
Reputation: 0

Joined: 02 Jul 2007
Posts: 805

PostPosted: Fri Jan 10, 2020 10:16 pm    Post subject: Reply with quote

Crashes when I attempt that I think it is because edi actually stores the pointer address and it moves pplayer. When looking pPlayer it gives the address of what was allocated under newmem, but when I add pPlayer to the cheat table as a pointer it gives me a usable address.

So I would need to do something like [Pointer address + offset] (offset in this case would be 0) and then move up 0x24C8.

Edit: It would be helpful if I had some sort of output so I could tell what was being written lol. In the cheat table I can add pPlayer as a pointer and 24c8 as an offset and it points to the correct address, but my issue is that when I try [edi + 24c8] or [pPlayer + 24c8] the game crashes. Doing [pPlayer]+24c8 doesn't get me anywhere it copies over pPlayer, but ignores the 24c8 part.

Edit 2: I made what I wanted to happen with a Lua script as a sub script of the script that finds the base player pointer. I would still like to know if there is a way to combine into 1 script. I would have tried to do this totally from Lua, but I don't know how to read a register from a point in the code, like when [address here] gets executed read [register here] and store in [varable here] type thing.

_________________
Name: Player One
Occupation: Gamer

The Players are a particularly violent group of gamers. They solve all of their problems via bloody bouts with each other, and they live happier lives for it.

Player One is blue, and a bit of an asshole.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4300

PostPosted: Sat Jan 11, 2020 11:31 am    Post subject: Reply with quote

godsblight wrote:
Crashes when I attempt that I think it is because edi actually stores the pointer address and it moves pplayer.
You mean like this? (based on what you say later, this probably won't work)
Code:
push esi
mov esi,[edi]
cmp [esi+24c8],4
jge short @f
mov [esi+24c8],4
@@:
pop esi
// original code...

godsblight wrote:
It would be helpful if I had some sort of output so I could tell what was being written lol.
Try setting a breakpoint just before the injection point, and step into the jump. Keep going until it crashes or you notice the problem.

godsblight wrote:
In the cheat table I can add pPlayer as a pointer and 24c8 as an offset and it points to the correct address
That's the same thing as [edi+24c8]. Setting the base address to pPlayer dereferences the memory you allocated giving you edi, and the only offset just adds 0x24c8 to edi.
Post the full script- I'd guess something else is crashing the game.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
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