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 


Dealing with Rapidly Changing Function Parameters

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

Joined: 27 Feb 2023
Posts: 64

PostPosted: Mon Nov 20, 2023 4:48 am    Post subject: Dealing with Rapidly Changing Function Parameters Reply with quote

Hi everyone,

I need some advice regarding handling a situation where a function's parameter value changes rapidly. For instance, when I press the sprint button in a game, the associated pointer shifts to a different structure in memory. This pointer is stack-stored, which I believe is the reason for its frequent changes. By setting a breakpoint on the function and activating the sprint button, I can trace where the stack value leads, and it consistently brings me to the correct structure when my mouse cursor is hovering the sprint symbol.

However, my game crashes as it seems to pick up a random pointer from the stack since my mouse cursor isnt over the sprint symbol when i call the function using a function pointer. Would the most effective solution be to create my own struct with the necessary values at specific offsets and then use this for my function pointer?

Any advice would be greatly appreciated
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 147

Joined: 06 Jul 2014
Posts: 4570

PostPosted: Mon Nov 20, 2023 12:22 pm    Post subject: Reply with quote

wulfcare wrote:
For instance, when I press the sprint button in a game, the associated pointer shifts to a different structure in memory.
Sounds like that isn't a good pointer. Sprint, pause the game (Edit -> Settings -> Hotkeys -> Pause the selected process), generate a pointermap, and use that for a pointer scan.

wulfcare wrote:
Would the most effective solution be to create my own struct with the necessary values at specific offsets and then use this for my function pointer?
Technically yes, this is possible; however, it's likely to be far more work than you think. What are the "correct" values? At which offsets? For all pointer values, you'll have to do the same thing recursively. Not to mention any mutable global state...
You'd have to reverse engineer the function and all the calls it makes recursively to figure this information out. At that point, there would be no need to create your own struct since you'd understand how the function gets the sprint value and could copy that.

Another alternative is code injection (search "injection copy").

_________________
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 programming 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