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 


Sending a value through an inactive function

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

Joined: 08 Mar 2015
Posts: 50

PostPosted: Sun Jul 24, 2016 4:54 pm    Post subject: Sending a value through an inactive function Reply with quote

Hi, I'm having a brainfreeze again, I have this instruction:

Code:
mov [rbx+38],edi


What it's doing is it's writing "1" to [rbx+38]. And that disables the games animations etc, it's part of pressing esc to go into the menu to change something in the options like controls or video settings etc. When pressing esc, edi will contain 1, if I press escape again to exit the menu another funtion writes the value 0 to [rbx+38].

Foolishly I thought that when I write an AOB script like this:
Code:

mov edi,(int)1
mov [rbx+38],edi


and activate the script that it would go ahead an write the value into [rbx+38], which it doesn't do because (I assume) it needs the entire chain of events when pressing the escape button to send that value on it's way.

My question is, can I make that function write the value to [rbx+38] without pressing the escape button, using a script? Is this a situation where I'd have to use createthread? (never used that, unsure how to do it)

Now that think a litle bit more about it, maybe the esc button press is even needed for [rbx+38] to contain the right address at rbx so the value get's to the correct address, only guessing here though.

The actual address where the value is stored and then read from so the game stops, is actively changing all the time and cheat engine crashes when I try and AOB that spot so I thought there must be a way to use the function that writes the value to it.

Other things I have not tried are:

1. Assigning a label to rbx and using a pointer with the label/symbol(?) as address and offset of 38 in the adress list to change the value... I doubt that would work but I'll check tomorrow.

2. Backtracing the instruction to inject at a previous point. I actually did that quickly but I guess I'd still would have the same problem of making the entire thing actually sending the value to it's destination without actually pressing the esc button.

To clarify, I don't want to press the esc button because I only want to freeze the game without opening the menu overlays etc. So I can only change this one boolean and need to avoid the rest that comes with pressing esc.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sun Jul 24, 2016 5:01 pm    Post subject: Re: Sending a value through an inactive function Reply with quote

mouser wrote:
The actual address where the value is stored and then read from so the game stops, is actively changing all the time and cheat engine crashes when I try and AOB that spot so I thought there must be a way to use the function that writes the value to it.
-Start here. Why is CE crashing?

Regarding the other stuff, none of that matters if you're not working with the correct sub-routine. Once found, however, if execution of code is required, then you'll need to call the sub-routine yourself. You can use createthread for this, but calling the function properly will be the hard part. Alternatively, you can try backtracing and analyzing code to find an area that is constantly being executed, and just manipulate the path of execution, on demand, by setting up a trigger.
Back to top
View user's profile Send private message
mouser
Advanced Cheater
Reputation: 0

Joined: 08 Mar 2015
Posts: 50

PostPosted: Mon Jul 25, 2016 5:09 am    Post subject: Reply with quote

Hi Methos, I double checked and have to make some corrections, it's only one function that writes the value to this spot, not two. And the area where the address is located, where the value is written to, isn't very turbulent at all, I still lose the address after restarting my computer. Probably not important I think.

I'm 99% certain it's the correct address (not sure about the sub routine...I checked for changed/unchanged with bytes and going in and out of the menu with the esc button that's how I found it), at the moment I always set a breakpint on access on the function that writes to it (the function has a stable AOB so I always have it at hand) and so I retrieve this address. I set a hotkey for it that puts "1" into it and now I have my timestop (I reverse the timestop by pressing esc)

It's not really a very userfriendly way of having always to retrieve the address like that though, everytime starting up the game.

I don't know why CE is crashing when I try to AOB the address directly, I have tried this 3 times, it always freezes CE.

I know that you are usually talking on a higher level of knowledge when it comes to these things so i'm not sure how helpful my own research and answers seem to you here but I put up a screencap of the tracer (break and trace on the function writing the value). You can see when rdi receives the value for the first time down in the chain. It's at the load effective address function highlighted in the screenshot.

Is that in any way useful for finding another spot or do I have to go further back to the address that is loaded into rdi at that place? (I believe rdi and edi are part of the same register? Do I need to learn registers better Razz ?)

I hope I'm making sense here with my limited knowledge about the english language? Smile



Tracer_when_rdi_receives_1_timestop.JPG
 Description:
 Filesize:  137.13 KB
 Viewed:  11449 Time(s)

Tracer_when_rdi_receives_1_timestop.JPG


Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Mon Jul 25, 2016 5:43 am    Post subject: Reply with quote

The address at your targeted instruction should be static: [mgsvtpp.exe+2B99C78]

You should be able to add that address to your cheat table and use it every time.

If it's not static and is changing on startup, for whatever reason, then you can try injection. We will need to look at why the target is crashing when you inject at that location. Is it an online game or a game that is likely to have memory integrity checks?
Back to top
View user's profile Send private message
mouser
Advanced Cheater
Reputation: 0

Joined: 08 Mar 2015
Posts: 50

PostPosted: Mon Jul 25, 2016 3:24 pm    Post subject: Reply with quote

The game is MGS V the singleplayer of it, I'm disconeccting from the internet while doing this so there shouldn't be anything disrupting it. There are some dll modules I don't know what they do so maybe there are some integrity checks going on...but I think I know what went wrong, it's my own fault again. When cheat engine was crashing for the first time it eat up all my hdd space (I have only a few gigs left on my SSD) I just now managed to figure that out and I guess this is why it was crashing all the time, I freed up the space... have not yet dared to try again to aob that spot. But I did a check and restarted my comp 5 times now having the address in the list, as you said, it seems stable now.

I keep an eye on it and if it changes again I will go and try something else.
I've also tried full injection at that spot:

it's something like:
Code:

movapi eax,edi


and when escape is pressed the second register changes to a different one. I didn't know how to write a script that would have any effect on that.

Anyway thanks for your help, I'm still interested in how to script that spot in case it stops working but I think this will do for the time being.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Mon Jul 25, 2016 3:44 pm    Post subject: Reply with quote

Injection should be easy. If there is an integrity check, you can work around that, too, usually.
Back to top
View user's profile Send private message
mouser
Advanced Cheater
Reputation: 0

Joined: 08 Mar 2015
Posts: 50

PostPosted: Tue Jul 26, 2016 12:23 pm    Post subject: Reply with quote

On a somehwat related problem, I can freeze the game now but I lose camera control via mouse/controller.

I can still move the camera by changing the xyz values for it... would it be possible to reactivate the cameracontrols for mouse /controller and still keep the game frozen?

(Maybe that's better suited for another thread?)
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Tue Jul 26, 2016 10:34 pm    Post subject: Reply with quote

You would just create a new thread and call the camera move function independently in that thread while the game was paused. If the game doesnt render the screen while paused, you would have more problems though.
Back to top
View user's profile Send private message
mouser
Advanced Cheater
Reputation: 0

Joined: 08 Mar 2015
Posts: 50

PostPosted: Wed Jul 27, 2016 1:01 am    Post subject: Reply with quote

Do I get to the camera function by simply backtracing the cameras position? Is the camera base address this function or is it further back/somewhere else completely? (or am I missunderstanding something, never tried this?)
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Wed Jul 27, 2016 2:47 am    Post subject: Reply with quote

Find what accesses the camera's address. See if instruction accesses anything else, if not, then it is solely for setting the camera. Trace the function call to the return, see what calls it. See what is pushed or added to stack before function call, now you can trace the full function and call it when you want by setting it up properly, maybe.
Back to top
View user's profile Send private message
mouser
Advanced Cheater
Reputation: 0

Joined: 08 Mar 2015
Posts: 50

PostPosted: Wed Jul 27, 2016 7:34 am    Post subject: Reply with quote

This is a screenshot of the end of the function that writes the camera coordinates.

I highlighted the last call that was made. But this is not the call you are talking about, right?

Would the call be at the very beginning (at the bottom of that screenshot) or can it be somewhere in between or even inside another call?



What writes to camera tracer first call or last call.JPG
 Description:
 Filesize:  233.47 KB
 Viewed:  11159 Time(s)

What writes to camera tracer first call or last call.JPG


Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Wed Jul 27, 2016 8:02 am    Post subject: Reply with quote

You may be over-complicating things. Sometimes, it's a simple bool that prohibits such things...but not always.
Back to top
View user's profile Send private message
mouser
Advanced Cheater
Reputation: 0

Joined: 08 Mar 2015
Posts: 50

PostPosted: Wed Jul 27, 2016 9:47 am    Post subject: Reply with quote

You're probably right, I'm just very curious about how this would be done and I usually need more than the concept of it to really understand it... it's a slow fight for me Smile

Anyway, when I try to look for booleans using changed/unchanged with bytes only the I can widdle down the nearly 5 billion results to around 2200. From there it's a trial & error of crashes over crashes though, I'm not sure I have the patience to check them all under these circumstances. I'll definitely try some more but I already gave it good amount of hours.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Wed Jul 27, 2016 10:11 am    Post subject: Reply with quote

Keep in mind that if the time-stop value that you are manipulating controls everything, globally, then it may not be possible. For example, slowing down game speed to a halt won't allow you to move your character, but changing the character's coordinates will still allow you to teleport to a different location. In this case, the frames are probably managed, so everything is affected. Not all games are like this, however.
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Wed Jul 27, 2016 11:06 pm    Post subject: Reply with quote

The trace you uploaded did not find the return, so you didnt find the function call that handles it

The return will be the last line of the current function call, when you trace to it, and double click the next line after the return, it takes you to the line below the function call in memory viewer (usually). If the instruction you traced accesses other stuff, you might be tracing the wrong calls unless you set a breakpoint with conditions (break only on your value, and then trace after the break).

Once you find it, just go up one line, NOP the call, see if you broke the camera, if so, you are very close!
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